451dbfa5fb8bd807c1f250d8f5fcc4219b97eae1
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 /* Show tab dialog headers */
30 $display= "";
32 /* Show main page */
33 $smarty= get_smarty();
35 /* Load attributes */
36 foreach($this->attributes as $val){
37 $smarty->assign("$val", $this->$val);
38 $smarty->assign($val."ACL", chkacl($this->acl, "$val"));
39 }
40 if ($this->is_account){
41 $smarty->assign("phpgwState", "checked");
42 } else {
43 $smarty->assign("fstate", "disabled");
44 }
46 if ($this->parent != NULL){
47 $smarty->assign("tabbed", 1);
48 }
50 $display.= $smarty->fetch (get_template_path('phpgw.tpl', TRUE, dirname(__FILE__)));
51 return ($display);
52 }
54 function remove_from_parent()
55 {
56 /* Cancel if there's nothing to do here */
57 if (!$this->initially_was_account){
58 return;
59 }
61 plugin::remove_from_parent();
62 $ldap= $this->config->get_ldap_link();
64 $ldap->cd($this->dn);
65 @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
66 $this->attributes, "Save");
67 $ldap->modify($this->attrs);
68 show_ldap_error($ldap->get_error());
70 /* Optionally execute a command after we're done */
71 $this->handle_post_events('remove');
72 }
75 /* Save data to object */
76 function save_object()
77 {
78 /* Do we need to flip is_account state? */
79 if (isset($_POST['connectivityTab'])){
80 if (isset($_POST['phpgw'])){
81 if (!$this->is_account && $_POST['phpgw'] == "B"){
82 $this->is_account= TRUE;
83 }
84 } else {
85 $this->is_account= FALSE;
86 }
87 }
89 plugin::save_object();
90 if (isset($_POST["phpgwStatus"])){
91 $this->phpgwStatus = "disabled";
92 } else {
93 $this->phpgwStatus = "enabled";
94 }
95 }
98 /* Save to LDAP */
99 function save()
100 {
101 plugin::save();
103 /* Write back to ldap */
104 $ldap= $this->config->get_ldap_link();
105 $ldap->cd($this->dn);
106 $ldap->modify($this->attrs);
107 show_ldap_error($ldap->get_error());
109 /* Optionally execute a command after we're done */
110 if ($this->initially_was_account == $this->is_account){
111 if ($this->is_modified){
112 $this->handle_post_events("mofify");
113 }
114 } else {
115 $this->handle_post_events("add");
116 }
117 }
119 }
121 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
122 ?>