Code

Added execute methods
[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         /* Call parent execute */
56         plugin::execute();
57         $display= "";
59         $smarty= get_smarty();
61         if ($this->is_account){
62                 $smarty->assign("intranetState", "checked");
63                 $smarty->assign("wstate", "");
64         } else {
65                 $smarty->assign("wstate", "disabled");
66                 $smarty->assign("intranetState", "");
67         }
69         //! Ever assign vars to smarty in both cases, to avoid php errors (missing variable aso. ) 
70         if ($this->parent != NULL){
71                 $smarty->assign("tabbed", 1);
72         }else{
73                 $smarty->assign("tabbed", 0);   
74         }
76    $smarty->assign('gosaIntranetACL', chkacl($this->acl, 'intranetAccount'));
78         $display.= $smarty->fetch (get_template_path('intranet.tpl', TRUE, dirname(__FILE__)));
79         return ($display);
80   }
82   /*! 
83         \brief Delete ext from User
84       \author  Harald Falk <hf@doellken-weimar.de>
85       \version 1.00
86       \date    1.07.2005
87         Handles deletion of this object
88   */
89   function remove_from_parent()
90   {
91         plugin::remove_from_parent();
92         $ldap= $this->config->get_ldap_link();
94         $ldap->cd($this->dn);
95         @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
96                 $this->attributes, "Save");
97         $ldap->modify($this->attrs);
98         show_ldap_error($ldap->get_error());
100         /* Optionally execute a command after we're done */
101         $this->postremove();
102   }
105   /*!
106         \brief handles Post data 
107       \author  Harald Falk <hf@doellken-weimar.de>
108       \version 1.00
109       \date    1.07.2005
110         Save data to object 
111         */
112   function save_object()
113   {
114         /* Do we need to flip is_account state? */
115         if (isset($_POST['connectivityTab'])){
116                 if (isset($_POST['intranet'])){
117                         if (!$this->is_account && $_POST['intranet'] == "B"){
118                                 $this->is_account= TRUE;
119                         }
120                 } else {
121                         $this->is_account= FALSE;
122                 }
123         }
125         plugin::save_object();
126         if (isset($_POST["INTRANETStatus"])){
127                 $this->INTRANETStatus = "disabled";
128         } else {
129                 $this->INTRANETStatus = "enabled";
130         }
131   }
134   /*! \brief Handles LDAP saves 
135       \author  Harald Falk <hf@doellken-weimar.de>
136       \version 1.00
137       \date    1.07.2005
138         Save objectClass for User in LDAP 
139         
140         */
141   function save()
142   {
143         plugin::save();
145         /* Write back to ldap */
146         $ldap= $this->config->get_ldap_link();
147         $ldap->cd($this->dn);
148         $ldap->modify($this->attrs);
149         show_ldap_error($ldap->get_error());
151         /* Optionally execute a command after we're done */
152         $this->postcreate();
153   }
157 ?>