1 <?php
3 class divListConference extends MultiSelectWindow
4 {
6 /* Current base */
7 var $selectedBase = "";
8 var $departments = array();
10 /* Regex */
11 var $Regex = "*";
13 /* checkboxes */
14 var $ShowSendBocklists ;
15 var $ShowReceiveMacros ;
17 /* Subsearch checkbox */
18 var $SubSearch;
20 var $parent ;
21 var $ui ;
23 function divListConference ($config,$parent)
24 {
25 MultiSelectWindow::MultiSelectWindow($config,"Conferences");
27 $this->parent = $parent;
28 $this->ui = get_userinfo();
30 /* Set list strings */
31 $this->SetTitle(_("List of conference rooms"));
32 $this->SetSummary(_("List of conference rooms"));
34 /* Result page will look like a headpage */
35 $this->SetHeadpageMode();
36 $this->SetInformation(_("This menu allows you to create, delete and edit selected phone conferences. Having a large number of phone conferences, you might prefer the range selectors on top of the conferences list."));
38 $this->EnableAplhabet(true);
40 /* Disable buttonsm */
41 $this->EnableCloseButton(false);
42 $this->EnableSaveButton (false);
44 /* Dynamic action col, depending on snapshot icons */
45 $action_col_size = 50;
46 if($this->parent->snapshotEnabled()){
47 $action_col_size += 20;
48 }
50 /* set Page header */
51 $this->AddHeader(array("string" => " ", "attach" => "style='text-align:center;width:20px;'"));
52 $this->AddHeader(array("string" =>_("Name - Number"), "attach" => "style=''"));
53 $this->AddHeader(array("string" => _("Owner"), "attach" => "style='width:200px;'"));
54 $this->AddHeader(array("string" => _("PIN"), "attach" => "style='width:50px;'"));
55 $this->AddHeader(array("string" =>_("Actions"), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'"));
57 /* Add Checkboxes / SubSearch checkbox */
58 $this->AddCheckBox("SubSearch", _("Select to search within subtrees"), _("Ignore subtrees"), false);
60 /* Name ,Text ,Default , Connect with alphabet */
61 $this->AddRegex ("Regex", _("Regular expression for matching conference names"),"*" , true);
62 }
64 function GenHeader()
65 {
66 /* Prepare departments,
67 which are shown in the listbox on top of the listbox
68 */
69 $options= "";
70 foreach ($this->config->idepartments as $key => $value){
71 if ($this->selectedBase == $key){
72 $options.= "<option selected='selected' value='$key'>$value</option>";
73 } else {
74 $options.= "<option value='$key'>$value</option>";
75 }
76 }
78 /* NEW LIST MANAGMENT */
79 $listhead = "<div style='background:#F0F0F9;padding:5px;'>".
80 " <input class='center' type='image' src='images/list_root.png' align='middle'
81 title='"._("Go to root department")."' name='dep_root' alt='". _("Root")."'> ".
82 " <input class='center' type='image' align='middle' src='images/list_back.png'
83 title='"._("Go up one department")."' alt='"._("Up")."' name='dep_back'> ".
84 " <input class='center' type='image' align='middle' src='images/list_home.png'
85 title='"._("Go to users department")."' alt='"._("Home")."' name='dep_home'> ".
86 " <input class='center' type='image' src='images/list_reload.png' align='middle'
87 title='"._("Reload list")."' name='submit_department' alt='". _("Submit")."'> ".
88 " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> ".
89 " <input class='center' type='image' align='middle' src='images/list_new_conference.png'
90 title='"._("Create new conference")."' alt='"._("New conference")."' name='user_new'> ".
91 " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> ";
92 $listhead .= $this->get_snapshot_header($this->selectedBase);
93 $listhead .= _("Base")." <select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
94 " <input class='center' type='image' src='images/list_submit.png' align='middle'
95 title='"._("Submit department")."' name='submit_department' alt='". _("Submit"). "'> ".
96 "</div>";
98 $this->SetListHeader($listhead);
99 }
101 function execute()
102 {
103 $this->ClearElementsList();
104 $this->GenHeader();
105 }
107 function setEntries($list)
108 {
109 $linkopen= "<a href='?plug=".$_GET['plug']."&act=dep_open&dep_id=%s'>%s</a>";
111 $userimg = "<img class='center' src='images/select_conference.png' alt='User' title='%s'>";
112 $editlink = "<a href='?plug=".$_GET['plug']."&id=%s&act=edit_entry'>%s</a>";
114 /* Dynamic action col, depending on snapshot icons */
115 $action_col_size = 50;
116 if($this->parent->snapshotEnabled()){
117 $action_col_size += 20;
118 }
120 /* Insert conferneces*/
121 foreach($list as $conferencekey => $conference ){
123 $actions= "<input class='center' type='image' src='images/edit.png'
124 alt='"._("edit")."' name='conf_edit_%KEY%' title='"._("Edit this entry")."'>";
125 $actions.= $this->GetSnapShotActions($conference['dn']);
126 $actions.= "<input class='center' type='image' src='images/edittrash.png'
127 alt='"._("delete")."' name='conf_del_%KEY%' title='"._("Delete this entry")."'>";
128 $actions2= "<input class='center' type='image' src='images/edittrash.png'
129 alt='"._("delete")."' name='conf_del_%KEY%' title='"._("Delete this entry")."'>";
131 if((isset($conference['goFonPIN'][0]))&&(($this->parent->ui->dn==$conference['goFonConferenceOwner'][0])||($this->parent->acl=="#all#"))){
132 $pin = "<img class='center' src='images/list_password.png' title='PIN : ".$conference['goFonPIN'][0]."' alt='PIN'>";
133 }else{
134 $pin = " ";
135 }
137 if(isset($conference['telephoneNumber'][0])){
138 $number = " - ".$conference['telephoneNumber'][0];
139 }else{
140 $number = " - ?";
141 }
143 $ldap= $this->parent->config->get_ldap_link();
144 $ldap->cat($conference['goFonConferenceOwner'][0], array('cn'));
145 $data = $ldap->fetch();
146 if(isset($data['cn'][0])){
147 $cn = $data['cn'][0];
148 }else{
149 $cn ="";
150 }
152 $title = " title='".preg_replace("/ /"," ",@LDAP::fix($data['dn']))."' ";
154 $a_field1 = array("string"=>sprintf($userimg,_("Conference")), "attach" => $title." style='text-align:center;width:20px;'");
156 if(($this->parent->acl=="#all#")||(($this->parent->ui->dn==$conference['goFonConferenceOwner'][0])&&(chkacl($this->parent->acl,"goFonConferenceOwner")==""))){
157 $a_field2 = array("string"=>sprintf($editlink,$conferencekey,$conference['cn'][0].$number), "attach" => $title." style=''");
158 }else{
159 $a_field2 = array("string"=>$conference['cn'][0].$number, "attach" => $title." style=''");
160 }
161 $a_field3 = array("string"=> $cn, "attach" => $title." style='width:200px;'");
162 $a_field4 = array("string"=> $pin, "attach" => $title." style='width:50px;'");
164 if(($this->parent->ui->dn==$conference['goFonConferenceOwner'][0])&&(chkacl($this->parent->acl,"goFonConferenceOwner")=="")){
165 $a_field5 = array("string"=>preg_replace("/%KEY%/",$conferencekey,$actions), "attach" => $title."style='width:".$action_col_size."px;border-right:0px;text-align:right;'");
166 }elseif(chkacl($this->parent->acl,"goFonConferenceOwner")==""){
167 $a_field5 = array("string"=>preg_replace("/%KEY%/",$conferencekey,$action.$actions2), "attach" => $title."style='width:52px;border-right:0px;text-align:right;'");
168 }else{
169 $a_field5 = array("string"=>" ", "attach" => $title."style='width:52px;border-right:0px;text-align:right;'");
170 }
172 $this->AddElement(array($a_field1,$a_field2,$a_field3,$a_field4,$a_field5));
173 }
174 }
176 function Save()
177 {
178 MultiSelectWindow :: Save();
179 }
181 function save_object()
182 {
183 /* Save automatic created POSTs like regex, checkboxes */
184 MultiSelectWindow :: save_object();
185 }
186 }
187 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
188 ?>