Code

Smarty var wasn't defined
[gosa.git] / plugins / personal / connectivity / class_phpgwAccount.inc
1 <?php
2 class phpgwAccount extends plugin
3 {
4   /* Definitions */
5   var $plHeadline= "PHPGroupware";
6   var $plDescription= "This does something";
8   /* CLI vars */
9   var $cli_summary= "Manage users PHPGroupware account";
10   var $cli_description= "Some longer text\nfor help";
11   var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
13   /* GW attributes */
14   var $phpgwAccountExpires= "-1";
15   var $phpgwAccountStatus= "A";
16   var $phpgwAccountType= "u";
18   /* attribute list for save action */
19   var $attributes= array("phpgwAccountExpires", "phpgwAccountStatus", "phpgwAccountType");
20   var $objectclasses= array("phpgwAccount");
22   function phpgwAccount ($config, $dn= NULL)
23   {
24     plugin::plugin ($config, $dn);
25   }
27   function execute()
28   {
29         /* Call parent execute */
30 //      plugin::execute();
32     /* Show tab dialog headers */
33     $display= "";
35     /* Show main page */
36     $smarty= get_smarty();
38     /* Load attributes */
39     foreach($this->attributes as $val){
40       $smarty->assign("$val", $this->$val);
41       $smarty->assign($val."ACL", chkacl($this->acl, "$val"));
42     }
43     if ($this->is_account){
44       $smarty->assign("phpgwState", "checked");
45     } else {
46       $smarty->assign("phpgwState", "");
47       $smarty->assign("fstate", "disabled");
48     }
50     if ($this->parent != NULL){
51       $smarty->assign("tabbed", 1);
52     }else{
53       $smarty->assign("tabbed", 0);
54     }
56     $smarty->assign('phpgwAccountACL', chkacl($this->acl, 'phpgwAccount'));
58     $display.= $smarty->fetch (get_template_path('phpgw.tpl', TRUE, dirname(__FILE__)));
59     return ($display);
60   }
62   function remove_from_parent()
63   {
64     /* Cancel if there's nothing to do here */
65     if (!$this->initially_was_account){
66       return;
67     }
68     
69     plugin::remove_from_parent();
70     $ldap= $this->config->get_ldap_link();
72     $ldap->cd($this->dn);
73     @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
74         $this->attributes, "Save");
75     $ldap->modify($this->attrs);
76     show_ldap_error($ldap->get_error());
78     /* Optionally execute a command after we're done */
79     $this->handle_post_events('remove');
80   }
83   /* Save data to object */
84   function save_object()
85   {
86     /* Do we need to flip is_account state? */
87     if (isset($_POST['connectivityTab'])){
88       if (isset($_POST['phpgw'])){
89         if (!$this->is_account && $_POST['phpgw'] == "B"){
90           $this->is_account= TRUE;
91         }
92       } else {
93         $this->is_account= FALSE;
94       }
95     }
97     plugin::save_object();
98     if (isset($_POST["phpgwStatus"])){
99       $this->phpgwStatus = "disabled";
100     } else {
101       $this->phpgwStatus = "enabled";
102     }
103   }
106   /* Save to LDAP */
107   function save()
108   {
109     plugin::save();
111     /* Write back to ldap */
112     $ldap= $this->config->get_ldap_link();
113     $ldap->cd($this->dn);
114     $ldap->modify($this->attrs);
115     show_ldap_error($ldap->get_error());
117     /* Optionally execute a command after we're done */
118     if ($this->initially_was_account == $this->is_account){
119       if ($this->is_modified){
120         $this->handle_post_events("mofify");
121       }
122     } else {
123       $this->handle_post_events("add");
124     }
125   }
129 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
130 ?>