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. ".
37 "Having a large number of phone conferences, you might prefer the range ".
38 "selectors on top of the conferences list."));
40 $this->EnableAplhabet(true);
42 /* Disable buttonsm */
43 $this->EnableCloseButton(false);
44 $this->EnableSaveButton (false);
46 /* set Page header */
47 $this->AddHeader(array("string" => " ", "attach" => "style='text-align:center;width:20px;'"));
48 $this->AddHeader(array("string" =>_("Name - Number"), "attach" => "style=''"));
49 $this->AddHeader(array("string" => _("Owner"), "attach" => "style='width:200px;'"));
50 $this->AddHeader(array("string" => _("PIN"), "attach" => "style='width:50px;'"));
51 $this->AddHeader(array("string" =>_("Actions"), "attach" => "style='width:60px;border-right:0px;text-align:right;'"));
53 /* Add Checkboxes / SubSearch checkbox */
54 $this->AddCheckBox("SubSearch", _("Select to search within subtrees"), _("Ignore subtrees"), false);
56 /* Name ,Text ,Default , Connect with alphabet */
57 $this->AddRegex ("Regex", _("Regular expression for matching conference names"),"*" , true);
58 }
60 function GenHeader()
61 {
62 /* Prepare departments,
63 which are shown in the listbox on top of the listbox
64 */
65 $options= "";
66 foreach ($this->config->idepartments as $key => $value){
67 if ($this->selectedBase == $key){
68 $options.= "<option selected='selected' value='$key'>$value</option>";
69 } else {
70 $options.= "<option value='$key'>$value</option>";
71 }
72 }
74 /* NEW LIST MANAGMENT */
75 $listhead = "<div style='background:#F0F0F9;padding:5px;'>".
76 " <input class='center' type='image' src='images/list_root.png' align='middle'
77 title='"._("Go to root department")."' name='dep_root' alt='". _("Root")."'> ".
78 " <input class='center' type='image' align='middle' src='images/list_back.png'
79 title='"._("Go up one department")."' alt='"._("Up")."' name='dep_back'> ".
80 " <input class='center' type='image' align='middle' src='images/list_home.png'
81 title='"._("Go to users department")."' alt='"._("Home")."' name='dep_home'> ".
82 " <input class='center' type='image' src='images/list_reload.png' align='middle'
83 title='"._("Reload list")."' name='submit_department' alt='". _("Submit")."'> ".
84 " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> ".
85 " <input class='center' type='image' align='middle' src='images/list_new_conference.png'
86 title='"._("Create new conference")."' alt='"._("New conference")."' name='user_new'> ".
87 " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> ".
88 _("Base")." <select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
89 " <input class='center' type='image' src='images/list_submit.png' align='middle'
90 title='"._("Submit department")."' name='submit_department' alt='". _("Submit"). "'> ".
91 "</div>";
93 $this->SetListHeader($listhead);
94 }
96 function execute()
97 {
98 $this->ClearElementsList();
99 $this->GenHeader();
100 }
102 function setEntries($list)
103 {
104 $actions = "<input class='center' type='image' src='images/edit.png'
105 alt='"._("edit")."' name='conf_edit_%KEY%' title='"._("Edit this entry")."'>";
106 $actions.= "<input class='center' type='image' src='images/edittrash.png'
107 alt='"._("delete")."' name='conf_del_%KEY%' title='"._("Delete this entry")."'>";
108 $actions2= "<input class='center' type='image' src='images/edittrash.png'
109 alt='"._("delete")."' name='conf_del_%KEY%' title='"._("Delete this entry")."'>";
110 $linkopen= "<a href='?plug=".$_GET['plug']."&act=dep_open&dep_id=%s'>%s</a>";
112 $userimg = "<img class='center' src='images/select_conference.png' alt='User' title='%s'>";
113 $editlink = "<a href='?plug=".$_GET['plug']."&id=%s&act=edit_entry'>%s</a>";
115 /* Insert conferneces*/
116 foreach($list as $conferencekey => $conference ){
118 if((isset($conference['goFonPIN'][0]))&&(($this->parent->ui->dn==$conference['goFonConferenceOwner'][0])||($this->parent->acl=="#all#"))){
119 $pin = "<img class='center' src='images/list_password.png' title='PIN : ".$conference['goFonPIN'][0]."' alt='PIN'>";
120 }else{
121 $pin = " ";
122 }
124 if(isset($conference['telephoneNumber'][0])){
125 $number = " - ".$conference['telephoneNumber'][0];
126 }else{
127 $number = " - ?";
128 }
130 $ldap= $this->parent->config->get_ldap_link();
131 $ldap->cat($conference['goFonConferenceOwner'][0], array('cn'));
132 $data = $ldap->fetch();
133 $cn = $data['cn'][0];
135 $a_field1 = array("string"=>sprintf($userimg,_("Conference")), "attach" => "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" => "style=''");
139 }else{
140 $a_field2 = array("string"=>$conference['cn'][0].$number, "attach" => "style=''");
141 }
142 $a_field3 = array("string"=> $cn, "attach" => "style='width:200px;'");
143 $a_field4 = array("string"=> $pin, "attach" => "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" => "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" => "style='width:52px;border-right:0px;text-align:right;'");
149 }else{
150 $a_field5 = array("string"=>" ", "attach" => "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 ?>