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 /* set Page header */
45 $this->AddHeader(array("string" => " ", "attach" => "style='text-align:center;width:20px;'"));
46 $this->AddHeader(array("string" =>_("Name - Number"), "attach" => "style=''"));
47 $this->AddHeader(array("string" => _("Owner"), "attach" => "style='width:200px;'"));
48 $this->AddHeader(array("string" => _("PIN"), "attach" => "style='width:50px;'"));
49 $this->AddHeader(array("string" =>_("Actions"), "attach" => "style='width:60px;border-right:0px;text-align:right;'"));
51 /* Add Checkboxes / SubSearch checkbox */
52 $this->AddCheckBox("SubSearch", _("Select to search within subtrees"), _("Ignore subtrees"), false);
54 /* Name ,Text ,Default , Connect with alphabet */
55 $this->AddRegex ("Regex", _("Regular expression for matching conference names"),"*" , true);
56 }
58 function GenHeader()
59 {
60 /* Prepare departments,
61 which are shown in the listbox on top of the listbox
62 */
63 $options= "";
64 foreach ($this->config->idepartments as $key => $value){
65 if ($this->selectedBase == $key){
66 $options.= "<option selected='selected' value='$key'>$value</option>";
67 } else {
68 $options.= "<option value='$key'>$value</option>";
69 }
70 }
72 /* NEW LIST MANAGMENT */
73 $listhead = "<div style='background:#F0F0F9;padding:5px;'>".
74 " <input class='center' type='image' src='images/list_root.png' align='middle'
75 title='"._("Go to root department")."' name='dep_root' alt='". _("Root")."'> ".
76 " <input class='center' type='image' align='middle' src='images/list_back.png'
77 title='"._("Go up one department")."' alt='"._("Up")."' name='dep_back'> ".
78 " <input class='center' type='image' align='middle' src='images/list_home.png'
79 title='"._("Go to users department")."' alt='"._("Home")."' name='dep_home'> ".
80 " <input class='center' type='image' src='images/list_reload.png' align='middle'
81 title='"._("Reload list")."' name='submit_department' alt='". _("Submit")."'> ".
82 " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> ".
83 " <input class='center' type='image' align='middle' src='images/list_new_conference.png'
84 title='"._("Create new conference")."' alt='"._("New conference")."' name='user_new'> ".
85 " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> ";
87 if($this->parent->snapshotEnabled()){
88 $listhead .= " <input class='center' type='image' align='middle' src='images/restore.png'
89 title='"._("Restore snapshopts of already deleted objects")."' alt='"._("Restore")."' name='RestoreDeletedSnapShot'>".
90 " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> ";
91 }
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 /* Insert conferneces*/
116 foreach($list as $conferencekey => $conference ){
118 $action = $this->GetSnapShotActions($conference['dn']);
119 $actions= "<input class='center' type='image' src='images/edit.png'
120 alt='"._("edit")."' name='conf_edit_%KEY%' title='"._("Edit this entry")."'>";
121 $actions.= "<input class='center' type='image' src='images/edittrash.png'
122 alt='"._("delete")."' name='conf_del_%KEY%' title='"._("Delete this entry")."'>";
123 $actions2= "<input class='center' type='image' src='images/edittrash.png'
124 alt='"._("delete")."' name='conf_del_%KEY%' title='"._("Delete this entry")."'>";
126 if((isset($conference['goFonPIN'][0]))&&(($this->parent->ui->dn==$conference['goFonConferenceOwner'][0])||($this->parent->acl=="#all#"))){
127 $pin = "<img class='center' src='images/list_password.png' title='PIN : ".$conference['goFonPIN'][0]."' alt='PIN'>";
128 }else{
129 $pin = " ";
130 }
132 if(isset($conference['telephoneNumber'][0])){
133 $number = " - ".$conference['telephoneNumber'][0];
134 }else{
135 $number = " - ?";
136 }
138 $ldap= $this->parent->config->get_ldap_link();
139 $ldap->cat($conference['goFonConferenceOwner'][0], array('cn'));
140 $data = $ldap->fetch();
141 if(isset($data['cn'][0])){
142 $cn = $data['cn'][0];
143 }else{
144 $cn ="";
145 }
147 $title = " title='".preg_replace("/ /"," ",@LDAP::fix($data['dn']))."' ";
149 $a_field1 = array("string"=>sprintf($userimg,_("Conference")), "attach" => $title." style='text-align:center;width:20px;'");
151 if(($this->parent->acl=="#all#")||(($this->parent->ui->dn==$conference['goFonConferenceOwner'][0])&&(chkacl($this->parent->acl,"goFonConferenceOwner")==""))){
152 $a_field2 = array("string"=>sprintf($editlink,$conferencekey,$conference['cn'][0].$number), "attach" => $title." style=''");
153 }else{
154 $a_field2 = array("string"=>$conference['cn'][0].$number, "attach" => $title." style=''");
155 }
156 $a_field3 = array("string"=> $cn, "attach" => $title." style='width:200px;'");
157 $a_field4 = array("string"=> $pin, "attach" => $title." style='width:50px;'");
159 if(($this->parent->ui->dn==$conference['goFonConferenceOwner'][0])&&(chkacl($this->parent->acl,"goFonConferenceOwner")=="")){
160 $a_field5 = array("string"=>preg_replace("/%KEY%/",$conferencekey,$action.$actions), "attach" => $title."style='width:60px;border-right:0px;text-align:right;'");
161 }elseif(chkacl($this->parent->acl,"goFonConferenceOwner")==""){
162 $a_field5 = array("string"=>preg_replace("/%KEY%/",$conferencekey,$action.$actions2), "attach" => $title."style='width:52px;border-right:0px;text-align:right;'");
163 }else{
164 $a_field5 = array("string"=>" ", "attach" => $title."style='width:52px;border-right:0px;text-align:right;'");
165 }
167 $this->AddElement(array($a_field1,$a_field2,$a_field3,$a_field4,$a_field5));
168 }
172 }
174 function Save()
175 {
176 MultiSelectWindow :: Save();
177 }
179 function save_object()
180 {
181 /* Save automatic created POSTs like regex, checkboxes */
182 MultiSelectWindow :: save_object();
183 }
184 }
185 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
186 ?>