Code

Added comments and translation tags to connectivity plinfo functions
[gosa.git] / plugins / personal / connectivity / class_phpscheduleitAccount.inc
1 <?php
3 /*
4   This code is part of GOsa (https://gosa.gonicus.de)
5   Copyright (C) 2005 Guillaume Delecourt
6   Copuright (C) 2005 Benoit Mortier
8   This program is free software; you can redistribute it and/or modify
9   it under the terms of the GNU General Public License as published by
10   the Free Software Foundation; either version 2 of the License, or
11   (at your option) any later version.
13   This program is distributed in the hope that it will be useful,
14   but WITHOUT ANY WARRANTY; without even the implied warranty of
15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16   GNU General Public License for more details.
18   You should have received a copy of the GNU General Public License
19   along with this program; if not, write to the Free Software
20   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21 */
24 class phpscheduleitAccount extends plugin
25 {
26   /* Definitions */
27   var $plHeadline= "PHPscheduleit";
28   var $plDescription= "This does something";
30   /* attribute list for save action */
31   var $attributes= array();
32   var $objectclasses= array("phpscheduleitAccount");
34   function phpscheduleitAccount ($config, $dn= NULL)
35   {
36     plugin::plugin ($config, $dn);
37   }
39   function execute()
40   {
41         /* Call parent execute */
42 //      plugin::execute();
44     /* Show tab dialog headers */
45     $display= "";
47     /* Show main page */
48     $smarty= get_smarty();
50     if ($this->is_account){
51       $smarty->assign("phpscheduleitState", "checked");
52     } else {
53       $smarty->assign("phpscheduleitState", "");
54       $smarty->assign("wstate", "disabled");
55     }
57     $smarty->assign('gosaphpscheduleitACL', chkacl($this->acl, 'gosaphpscheduleit'));
59     $display.= $smarty->fetch (get_template_path('phpscheduleit.tpl', TRUE, dirname(__FILE__)));
60     return ($display);
61   }
63   function remove_from_parent()
64   {
65     /* Cancel if there's nothing to do here */
66     if (!$this->initially_was_account){
67       return;
68     }
70     plugin::remove_from_parent();
71     $ldap= $this->config->get_ldap_link();
73     $ldap->cd($this->dn);
74     @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
75         $this->attributes, "Save");
76     $this->cleanup();
77     $ldap->modify ($this->attrs); 
78     show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/PHPscheduleit account with dn '%s' failed."),$this->dn));
80     /* Optionally execute a command after we're done */
81     $this->handle_post_events('remove');
82   }
85   /* Save data to object */
86   function save_object()
87   {
88     /* Do we need to flip is_account state? */
89     if (isset($_POST['connectivityTab'])){
90       if (isset($_POST['phpscheduleit'])){
91         if (!$this->is_account && $_POST['phpscheduleit'] == "B"){
92           $this->is_account= TRUE;
93         }
94       } else {
95         $this->is_account= FALSE;
96       }
97     }
99     plugin::save_object();
100     if (isset($_POST["phpscheduleitStatus"])){
101       $this->pptpStatus = "disabled";
102     } else {
103       $this->pptpStatus = "enabled";
104     }
105   }
108   /* Save to LDAP */
109   function save()
110   {
111     plugin::save();
113     /* Write back to ldap */
114     $ldap= $this->config->get_ldap_link();
115     $ldap->cd($this->dn);
116     $this->cleanup();
117     $ldap->modify ($this->attrs); 
119     show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/PHPscheduleit account with dn '%s' failed."),$this->dn));
121     /* Optionally execute a command after we're done */
122     if ($this->initially_was_account == $this->is_account){
123       if ($this->is_modified){
124         $this->handle_post_events("mofify");
125       }
126     } else {
127       $this->handle_post_events("add");
128     }
130   }
133   /* Return pluign informations for acl handling 
134       #FIXME This is only an enable/disable checkbox for this account, there is possibly a better solution available later */
135   function plInfo()
136   {
137     return (array(  "plDescription"   => _("PHPscheduleit account"),
138           "plSelfModify"    => TRUE,
139           "plDepends"       => array("objectClass" => "gosaAccount"),
140           "phpscheduleitAccount" => "!!! FIXME "._("PHPscheduleit account")));
141   }
146 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
147 ?>