f2e0bb69ee3a1ed2f5a7eea2733d4e6a1d6cf9a3
1 <?php
2 /*
3 This code is part of GOsa (https://gosa.gonicus.de)
4 Copyright (C) 2003 Cajus Pollmeier
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20 require "tabs_conference.inc";
22 class phoneConferenceManagment extends plugin
23 {
24 /* Definitions */
25 var $plHeadline = "Phone Conference Rooms";
26 var $plDescription = "Managment ";
28 /* CLI vars */
29 var $cli_summary = "Handling of LDAP subtrees";
30 var $cli_description = "Some longer text\nfor help";
31 var $cli_parameters = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
33 /* Headpage attributes */
34 var $conferences = array();
36 /* attribute list for save action */
37 var $attributes = array();
38 var $objectclasses = array();
39 var $conftab = false;
41 /* Initialise Class */
42 function phoneConferenceManagment ($config, $ui)
43 {
44 $this->ui = $ui;
45 $this->dn = "";
46 $this->config = $config;
47 }
49 /* Execute class and display something */
50 function execute()
51 {
52 /* Reload departments */
53 $this->config->departments = get_departments();
54 $smarty = get_smarty();
55 $display = "";
56 $s_action = ""; // Will contain an action, like del or edit
57 $s_entry = ""; // The entry name for edit delete -...
59 foreach($_POST as $post => $key){
60 if(preg_match("/.*new.*/i",$post)){
61 $s_action = "new";
62 }
63 }
65 if($s_action == "new"){
66 $this->dn= "new";
67 $this->conftab= new conferencetabs($this->config,$this->config->data['TABS']['CONFERENCETABS'], $this->dn);
68 $this->conftab->set_acl(array(':all'));
69 }
71 /* if edit or new, show dialog */
72 if($this->conftab){
73 $display= $this->conftab->execute();
75 /* Don't show buttons if tab dialog requests this */
76 if (!$this->conftab->by_object[$this->conftab->current]->dialog){
77 $display.= "<p style=\"text-align:right\">\n";
78 $display.= "<input type=submit name=\"edit_finish\" value=\""._("Finish")."\">\n";
79 $display.= " \n";
80 $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
81 $display.= "</p>";
82 }
83 return ($display);
84 }
86 $this->reload();
87 $listhead = "<div style='background:#F0F0F9;padding:5px;'>
88 <input type='image' align='middle' src='images/list_new_department.png'
89 align='middle' alt='"._("Create new department")."' name='dep_new'>
90 </div>";
91 $actions = "<input type='image' src='images/edit.png' alt='"._("edit")."' name='dep_edit_%KEY%' title='"._("Edit this entry")."'>";
92 $actions.= "<input type='image' src='images/edittrash.png' alt='"._("delete")."' name='dep_del_%KEY%' title='"._("Delete this entry")."'>";
93 $linkopen= "<a href='?plug=".$_GET['plug']."&act=dep_open&dep_id=%s'>%s</a>";
95 /* Set Header */
96 $divlist = new divlist("conferenceTabs");
97 $divlist->SetSummary(_("This table displays all available conference rooms."));
98 $divlist->SetEntriesPerPage(20);
99 $divlist->SetHeader(array(
100 array("string" => " "),
101 array("string" =>_("Name / nummer")),
102 array("string" =>_("Actions"), "attach" => "style='text-align: right;border:none'")));
104 foreach($this->conferences as $conference ){
105 $field1 = array("string"=>"");
106 $field2 = array("string"=>$conference['cn'][0]);
107 $field3 = array("string"=>"");
108 $divlist->AddEntry(array($field1,$field2,$field3));
109 }
111 $smarty->assign("search_image", get_template_path('images/search.png'));
112 $smarty->assign("tree_image", get_template_path('images/tree.png'));
113 $smarty->assign("infoimage", get_template_path('images/info.png'));
114 $smarty->assign("launchimage", get_template_path('images/launch.png'));
115 $smarty->assign("conferences", $divlist->DrawList());
116 $smarty->assign("conferencehead", $listhead);
117 $smarty->assign("deplist", $this->config->idepartments);
118 $smarty->assign("apply", apply_filter());
119 $smarty->assign("alphabet", generate_alphabet());
120 $smarty->assign("hint", print_sizelimit_warning());
122 $display= $smarty->fetch(get_template_path('headpage.tpl', TRUE));
123 return($display);
124 }
127 function reload()
128 {
129 $base = "dc=gonicus,dc=de";
130 $this->conferences= get_list($this->ui->subtreeACL, "(objectClass=goFonAccount)",TRUE, $base, array("*"), TRUE);
132 }
134 function remove_from_parent()
135 {
136 $ldap= $this->config->get_ldap_link();
137 $ldap->cd ($this->dn);
138 $ldap->recursive_remove();
140 /* Optionally execute a command after we're done */
141 $this->postremove();
143 /* Delete references to object groups */
144 $ldap->cd ($this->config->current['BASE']);
145 $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
146 while ($ldap->fetch()){
147 $og= new conftab($this->config, $ldap->getDN());
148 unset($og->member[$this->dn]);
149 $og->save ();
150 }
152 }
154 function remove_lock()
155 {
156 if (isset($this->dn)){
157 del_lock ($this->dn);
158 }
159 }
161 }
162 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
163 ?>