775773261726530cfb4b912bdafb21bbf6bb7d25
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 /* CLI vars */
31 var $cli_summary= "Manage users phpscheduleit account";
32 var $cli_description= "Some longer text\nfor help";
33 var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
35 /* attribute list for save action */
36 var $attributes= array();
37 var $objectclasses= array("phpscheduleitAccount");
39 function phpscheduleitAccount ($config, $dn= NULL)
40 {
41 plugin::plugin ($config, $dn);
42 }
44 function execute()
45 {
46 /* Call parent execute */
47 // plugin::execute();
49 /* Show tab dialog headers */
50 $display= "";
52 /* Show main page */
53 $smarty= get_smarty();
55 if ($this->is_account){
56 $smarty->assign("phpscheduleitState", "checked");
57 } else {
58 $smarty->assign("phpscheduleitState", "");
59 $smarty->assign("wstate", "disabled");
60 }
62 $smarty->assign('gosaphpscheduleitACL', chkacl($this->acl, 'gosaphpscheduleit'));
64 $display.= $smarty->fetch (get_template_path('phpscheduleit.tpl', TRUE, dirname(__FILE__)));
65 return ($display);
66 }
68 function remove_from_parent()
69 {
70 /* Cancel if there's nothing to do here */
71 if (!$this->initially_was_account){
72 return;
73 }
75 plugin::remove_from_parent();
76 $ldap= $this->config->get_ldap_link();
78 $ldap->cd($this->dn);
79 @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
80 $this->attributes, "Save");
81 $ldap->modify($this->attrs);
82 show_ldap_error($ldap->get_error());
84 /* Optionally execute a command after we're done */
85 $this->handle_post_events('remove');
86 }
89 /* Save data to object */
90 function save_object()
91 {
92 /* Do we need to flip is_account state? */
93 if (isset($_POST['connectivityTab'])){
94 if (isset($_POST['phpscheduleit'])){
95 if (!$this->is_account && $_POST['phpscheduleit'] == "B"){
96 $this->is_account= TRUE;
97 }
98 } else {
99 $this->is_account= FALSE;
100 }
101 }
103 plugin::save_object();
104 if (isset($_POST["phpscheduleitStatus"])){
105 $this->pptpStatus = "disabled";
106 } else {
107 $this->pptpStatus = "enabled";
108 }
109 }
112 /* Save to LDAP */
113 function save()
114 {
115 plugin::save();
117 /* Write back to ldap */
118 $ldap= $this->config->get_ldap_link();
119 $ldap->cd($this->dn);
120 $ldap->modify($this->attrs);
121 show_ldap_error($ldap->get_error());
123 /* Optionally execute a command after we're done */
124 if ($this->initially_was_account == $this->is_account){
125 if ($this->is_modified){
126 $this->handle_post_events("mofify");
127 }
128 } else {
129 $this->handle_post_events("add");
130 }
132 }
134 }
136 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
137 ?>