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'> ".
86 _("Base")." <select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
87 " <input class='center' type='image' src='images/list_submit.png' align='middle'
88 title='"._("Submit department")."' name='submit_department' alt='". _("Submit"). "'> ".
89 "</div>";
91 $this->SetListHeader($listhead);
92 }
94 function execute()
95 {
96 $this->ClearElementsList();
97 $this->GenHeader();
98 }
100 function setEntries($list)
101 {
102 $actions = "<input class='center' type='image' src='images/edit.png'
103 alt='"._("edit")."' name='conf_edit_%KEY%' title='"._("Edit this entry")."'>";
104 $actions.= "<input class='center' type='image' src='images/edittrash.png'
105 alt='"._("delete")."' name='conf_del_%KEY%' title='"._("Delete this entry")."'>";
106 $actions2= "<input class='center' type='image' src='images/edittrash.png'
107 alt='"._("delete")."' name='conf_del_%KEY%' title='"._("Delete this entry")."'>";
108 $linkopen= "<a href='?plug=".$_GET['plug']."&act=dep_open&dep_id=%s'>%s</a>";
110 $userimg = "<img class='center' src='images/select_conference.png' alt='User' title='%s'>";
111 $editlink = "<a href='?plug=".$_GET['plug']."&id=%s&act=edit_entry'>%s</a>";
113 /* Insert conferneces*/
114 foreach($list as $conferencekey => $conference ){
116 if((isset($conference['goFonPIN'][0]))&&(($this->parent->ui->dn==$conference['goFonConferenceOwner'][0])||($this->parent->acl=="#all#"))){
117 $pin = "<img class='center' src='images/list_password.png' title='PIN : ".$conference['goFonPIN'][0]."' alt='PIN'>";
118 }else{
119 $pin = " ";
120 }
122 if(isset($conference['telephoneNumber'][0])){
123 $number = " - ".$conference['telephoneNumber'][0];
124 }else{
125 $number = " - ?";
126 }
128 $ldap= $this->parent->config->get_ldap_link();
129 $ldap->cat($conference['goFonConferenceOwner'][0], array('cn'));
130 $data = $ldap->fetch();
131 $cn = $data['cn'][0];
133 $title = " title='".preg_replace("/ /"," ",@LDAP::fix($data['dn']))."' ";
135 $a_field1 = array("string"=>sprintf($userimg,_("Conference")), "attach" => $title." style='text-align:center;width:20px;'");
137 if(($this->parent->acl=="#all#")||(($this->parent->ui->dn==$conference['goFonConferenceOwner'][0])&&(chkacl($this->parent->acl,"goFonConferenceOwner")==""))){
138 $a_field2 = array("string"=>sprintf($editlink,$conferencekey,$conference['cn'][0].$number), "attach" => $title." style=''");
139 }else{
140 $a_field2 = array("string"=>$conference['cn'][0].$number, "attach" => $title." style=''");
141 }
142 $a_field3 = array("string"=> $cn, "attach" => $title." style='width:200px;'");
143 $a_field4 = array("string"=> $pin, "attach" => $title." style='width:50px;'");
145 if(($this->parent->ui->dn==$conference['goFonConferenceOwner'][0])&&(chkacl($this->parent->acl,"goFonConferenceOwner")=="")){
146 $a_field5 = array("string"=>preg_replace("/%KEY%/",$conferencekey,$actions), "attach" => $title."style='width:60px;border-right:0px;text-align:right;'");
147 }elseif(chkacl($this->acl,"goFonConferenceOwner")==""){
148 $a_field5 = array("string"=>preg_replace("/%KEY%/",$conferencekey,$actions2), "attach" => $title."style='width:52px;border-right:0px;text-align:right;'");
149 }else{
150 $a_field5 = array("string"=>" ", "attach" => $title."style='width:52px;border-right:0px;text-align:right;'");
151 }
153 $this->AddElement(array($a_field1,$a_field2,$a_field3,$a_field4,$a_field5));
154 }
158 }
160 function Save()
161 {
162 MultiSelectWindow :: Save();
163 }
165 function save_object()
166 {
167 /* Save automatic created POSTs like regex, checkboxes */
168 MultiSelectWindow :: save_object();
169 }
170 }
171 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
172 ?>