Code

Added empty lines
[gosa.git] / plugins / personal / connectivity / class_phpscheduleitAccount.inc
1 <?php
3 class phpscheduleitAccount extends plugin
4 {
5   /* Definitions */
6   var $plHeadline= "PHPscheduleit Account";
7   var $plDescription= "This does something";
9   /* CLI vars */
10   var $cli_summary= "Manage users phpscheduleit account";
11   var $cli_description= "Some longer text\nfor help";
12   var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
14   /* attribute list for save action */
15   var $attributes= array();
16   var $objectclasses= array("phpscheduleitAccount");
18   function phpscheduleitAccount ($config, $dn= NULL)
19   {
20     plugin::plugin ($config, $dn);
21   }
23   function execute()
24   {
25         /* Call parent execute */
26         plugin::execute();
28     /* Show tab dialog headers */
29     $display= "";
31     /* Show main page */
32     $smarty= get_smarty();
34     if ($this->is_account){
35       $smarty->assign("phpscheduleitState", "checked");
36     } else {
37       $smarty->assign("phpscheduleitState", "");
38       $smarty->assign("wstate", "disabled");
39     }
41     if ($this->parent != NULL){
42       $smarty->assign("tabbed", 1);
43     }
45     $smarty->assign('gosaphpscheduleitACL', chkacl($this->acl, 'gosaphpscheduleit'));
47     $display.= $smarty->fetch (get_template_path('phpscheduleit.tpl', TRUE, dirname(__FILE__)));
48     return ($display);
49   }
51   function remove_from_parent()
52   {
53     /* Cancel if there's nothing to do here */
54     if (!$this->initially_was_account){
55       return;
56     }
58     plugin::remove_from_parent();
59     $ldap= $this->config->get_ldap_link();
61     $ldap->cd($this->dn);
62     @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
63         $this->attributes, "Save");
64     $ldap->modify($this->attrs);
65     show_ldap_error($ldap->get_error());
67     /* Optionally execute a command after we're done */
68     $this->handle_post_events('remove');
69   }
72   /* Save data to object */
73   function save_object()
74   {
75     /* Do we need to flip is_account state? */
76     if (isset($_POST['connectivityTab'])){
77       if (isset($_POST['phpscheduleit'])){
78         if (!$this->is_account && $_POST['phpscheduleit'] == "B"){
79           $this->is_account= TRUE;
80         }
81       } else {
82         $this->is_account= FALSE;
83       }
84     }
86     plugin::save_object();
87     if (isset($_POST["phpscheduleitStatus"])){
88       $this->pptpStatus = "disabled";
89     } else {
90       $this->pptpStatus = "enabled";
91     }
92   }
95   /* Save to LDAP */
96   function save()
97   {
98     plugin::save();
100     /* Write back to ldap */
101     $ldap= $this->config->get_ldap_link();
102     $ldap->cd($this->dn);
103     $ldap->modify($this->attrs);
104     show_ldap_error($ldap->get_error());
106     /* Optionally execute a command after we're done */
107     if ($this->initially_was_account == $this->is_account){
108       if ($this->is_modified){
109         $this->handle_post_events("mofify");
110       }
111     } else {
112       $this->handle_post_events("add");
113     }
115   }
119 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
120 ?>