Code

Added execute methods
[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();
27     /* Show tab dialog headers */
28     $display= "";
30     /* Show main page */
31     $smarty= get_smarty();
33     if ($this->is_account){
34       $smarty->assign("phpscheduleitState", "checked");
35     } else {
36       $smarty->assign("phpscheduleitState", "");
37       $smarty->assign("wstate", "disabled");
38     }
40     if ($this->parent != NULL){
41       $smarty->assign("tabbed", 1);
42     }
44     $smarty->assign('gosaphpscheduleitACL', chkacl($this->acl, 'gosaphpscheduleit'));
46     $display.= $smarty->fetch (get_template_path('phpscheduleit.tpl', TRUE, dirname(__FILE__)));
47     return ($display);
48   }
50   function remove_from_parent()
51   {
52     /* Cancel if there's nothing to do here */
53     if (!$this->initially_was_account){
54       return;
55     }
57     plugin::remove_from_parent();
58     $ldap= $this->config->get_ldap_link();
60     $ldap->cd($this->dn);
61     @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
62         $this->attributes, "Save");
63     $ldap->modify($this->attrs);
64     show_ldap_error($ldap->get_error());
66     /* Optionally execute a command after we're done */
67     $this->handle_post_events('remove');
68   }
71   /* Save data to object */
72   function save_object()
73   {
74     /* Do we need to flip is_account state? */
75     if (isset($_POST['connectivityTab'])){
76       if (isset($_POST['phpscheduleit'])){
77         if (!$this->is_account && $_POST['phpscheduleit'] == "B"){
78           $this->is_account= TRUE;
79         }
80       } else {
81         $this->is_account= FALSE;
82       }
83     }
85     plugin::save_object();
86     if (isset($_POST["phpscheduleitStatus"])){
87       $this->pptpStatus = "disabled";
88     } else {
89       $this->pptpStatus = "enabled";
90     }
91   }
94   /* Save to LDAP */
95   function save()
96   {
97     plugin::save();
99     /* Write back to ldap */
100     $ldap= $this->config->get_ldap_link();
101     $ldap->cd($this->dn);
102     $ldap->modify($this->attrs);
103     show_ldap_error($ldap->get_error());
105     /* Optionally execute a command after we're done */
106     if ($this->initially_was_account == $this->is_account){
107       if ($this->is_modified){
108         $this->handle_post_events("mofify");
109       }
110     } else {
111       $this->handle_post_events("add");
112     }
114   }
118 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
119 ?>