Code

W3c fixes, empty option removed
[gosa.git] / plugins / personal / connectivity / class_intranetAccount.inc
1 <?php
3 /*!
4       \author  Harald Falk <hf@doellken-weimar.de>
5       \version 1.00
6       \date    1.07.2005
8       \brief   Enables Apache authentification for Intranet through openldap with .htaccess files   
9 */
11 class intranetAccount extends plugin
12 {
13   /*! Definitions */
14   var $plHeadline= "Intranet";
15   /*! Definitions */
16   var $plDescription= "This does something";
18   /*! CLI vars */
19   var $cli_summary= "Manage users Intranet account";
20   /*! CLI vars */
21   var $cli_description= "Some longer text\nfor help";
22   /*! CLI vars */
23   var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
25   /* attribute list for save action */
26   var $attributes= array();
27   /* ObjectClasses list for save action */
28   var $objectclasses= array("gosaIntranetAccount");
30   /*! \brief Konstructor  
31                 
32         \param $config  The Config Object used to initialise plugin
33         \param $dn              The DN of the currently edited entry    
34       \author  Harald Falk <hf@doellken-weimar.de>
35       \version 1.00
36       \date    1.07.2005
37   */
38   function intranetAccount ($config, $dn= NULL)
39   {
40         plugin::plugin ($config, $dn);
41   }
43   /*!
44         \brief General execution 
45       \author  Harald Falk <hf@doellken-weimar.de>
46       \version 1.00
47       \date    1.07.2005
48         
49         Load smarty Template and assign needed smarty vars
50         */
51         
52         
53   function execute()
54   {
55         $display= "";
57         $smarty= get_smarty();
59         if ($this->is_account){
60                 $smarty->assign("intranetState", "checked");
61                 $smarty->assign("wstate", "");
62         } else {
63                 $smarty->assign("wstate", "disabled");
64                 $smarty->assign("intranetState", "");
65         }
67         //! Ever assign vars to smarty in both cases, to avoid php errors (missing variable aso. ) 
68         if ($this->parent != NULL){
69                 $smarty->assign("tabbed", 1);
70         }else{
71                 $smarty->assign("tabbed", 0);   
72         }
74    $smarty->assign('gosaIntranetACL', chkacl($this->acl, 'intranetAccount'));
76         $display.= $smarty->fetch (get_template_path('intranet.tpl', TRUE, dirname(__FILE__)));
77         return ($display);
78   }
80   /*! 
81         \brief Delete ext from User
82       \author  Harald Falk <hf@doellken-weimar.de>
83       \version 1.00
84       \date    1.07.2005
85         Handles deletion of this object
86   */
87   function remove_from_parent()
88   {
89         plugin::remove_from_parent();
90         $ldap= $this->config->get_ldap_link();
92         $ldap->cd($this->dn);
93         @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
94                 $this->attributes, "Save");
95         $ldap->modify($this->attrs);
96         show_ldap_error($ldap->get_error());
98         /* Optionally execute a command after we're done */
99         $this->postremove();
100   }
103   /*!
104         \brief handles Post data 
105       \author  Harald Falk <hf@doellken-weimar.de>
106       \version 1.00
107       \date    1.07.2005
108         Save data to object 
109         */
110   function save_object()
111   {
112         /* Do we need to flip is_account state? */
113         if (isset($_POST['connectivityTab'])){
114                 if (isset($_POST['intranet'])){
115                         if (!$this->is_account && $_POST['intranet'] == "B"){
116                                 $this->is_account= TRUE;
117                         }
118                 } else {
119                         $this->is_account= FALSE;
120                 }
121         }
123         plugin::save_object();
124         if (isset($_POST["INTRANETStatus"])){
125                 $this->INTRANETStatus = "disabled";
126         } else {
127                 $this->INTRANETStatus = "enabled";
128         }
129   }
132   /*! \brief Handles LDAP saves 
133       \author  Harald Falk <hf@doellken-weimar.de>
134       \version 1.00
135       \date    1.07.2005
136         Save objectClass for User in LDAP 
137         
138         */
139   function save()
140   {
141         plugin::save();
143         /* Write back to ldap */
144         $ldap= $this->config->get_ldap_link();
145         $ldap->cd($this->dn);
146         $ldap->modify($this->attrs);
147         show_ldap_error($ldap->get_error());
149         /* Optionally execute a command after we're done */
150         $this->postcreate();
151   }
155 ?>