22f0061dc41cc337faf8b8a1bb5c7b8ab6a363c0
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 /* Add default header */
73 $listhead = MultiSelectWindow::get_default_header();
74 $listhead.= " <input class='center' type='image' align='middle' src='images/list_new_conference.png'
75 title='"._("Create new conference")."' alt='"._("New conference")."' name='user_new'> ".
76 " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> ".
77 _("Base")." <select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
78 " <input class='center' type='image' src='images/list_submit.png' align='middle'
79 title='"._("Submit department")."' name='submit_department' alt='". _("Submit"). "'> ".
80 "</div>";
82 $this->SetListHeader($listhead);
83 }
85 function execute()
86 {
87 $this->ClearElementsList();
88 $this->GenHeader();
89 }
91 function setEntries($list)
92 {
93 $actions = "<input class='center' type='image' src='images/edit.png'
94 alt='"._("edit")."' name='conf_edit_%KEY%' title='"._("Edit this entry")."'>";
95 $actions.= "<input class='center' type='image' src='images/edittrash.png'
96 alt='"._("delete")."' name='conf_del_%KEY%' title='"._("Delete this entry")."'>";
97 $actions2= "<input class='center' type='image' src='images/edittrash.png'
98 alt='"._("delete")."' name='conf_del_%KEY%' title='"._("Delete this entry")."'>";
99 $linkopen= "<a href='?plug=".$_GET['plug']."&act=dep_open&dep_id=%s'>%s</a>";
101 $userimg = "<img class='center' src='images/select_conference.png' alt='User' title='%s'>";
102 $editlink = "<a href='?plug=".$_GET['plug']."&id=%s&act=edit_entry'>%s</a>";
104 /* Insert conferneces*/
105 foreach($list as $conferencekey => $conference ){
107 if((isset($conference['goFonPIN'][0]))&&(($this->parent->ui->dn==$conference['goFonConferenceOwner'][0])||($this->parent->acl=="#all#"))){
108 $pin = "<img class='center' src='images/list_password.png' title='PIN : ".$conference['goFonPIN'][0]."' alt='PIN'>";
109 }else{
110 $pin = " ";
111 }
113 if(isset($conference['telephoneNumber'][0])){
114 $number = " - ".$conference['telephoneNumber'][0];
115 }else{
116 $number = " - ?";
117 }
119 $ldap= $this->parent->config->get_ldap_link();
120 $ldap->cat($conference['goFonConferenceOwner'][0], array('cn'));
121 $data = $ldap->fetch();
122 if(isset($data['cn'][0])){
123 $cn = $data['cn'][0];
124 }else{
125 $cn ="";
126 }
128 /* Create the display name */
129 $d_name = $conference['cn'][0];
130 if(isset($conference['description'][0])){
131 $d_name.=" [".$conference['description'][0]."] ";
132 }
133 $d_name .=$number;
136 $title = " title='".preg_replace("/ /"," ",@LDAP::fix($data['dn']))."' ";
138 $a_field1 = array("string"=>sprintf($userimg,_("Conference")), "attach" => $title." style='text-align:center;width:20px;'");
140 if(($this->parent->acl=="#all#")||(($this->parent->ui->dn==$conference['goFonConferenceOwner'][0])&&(chkacl($this->parent->acl,"goFonConferenceOwner")==""))){
141 $a_field2 = array("string"=>sprintf($editlink,$conferencekey,$d_name ), "attach" => $title." style=''");
142 }else{
143 $a_field2 = array("string"=>$d_name , "attach" => $title." style=''");
144 }
145 $a_field3 = array("string"=> $cn, "attach" => $title." style='width:200px;'");
146 $a_field4 = array("string"=> $pin, "attach" => $title." style='width:50px;'");
148 if(($this->parent->ui->dn==$conference['goFonConferenceOwner'][0])&&(chkacl($this->parent->acl,"goFonConferenceOwner")=="")){
149 $a_field5 = array("string"=>preg_replace("/%KEY%/",$conferencekey,$actions), "attach" => $title."style='width:60px;border-right:0px;text-align:right;'");
150 }elseif(chkacl($this->parent->acl,"goFonConferenceOwner")==""){
151 $a_field5 = array("string"=>preg_replace("/%KEY%/",$conferencekey,$actions2), "attach" => $title."style='width:52px;border-right:0px;text-align:right;'");
152 }else{
153 $a_field5 = array("string"=>" ", "attach" => $title."style='width:52px;border-right:0px;text-align:right;'");
154 }
156 $this->AddElement(array($a_field1,$a_field2,$a_field3,$a_field4,$a_field5));
157 }
161 }
163 function Save()
164 {
165 MultiSelectWindow :: Save();
166 }
168 function save_object()
169 {
170 /* Save automatic created POSTs like regex, checkboxes */
171 MultiSelectWindow :: save_object();
172 }
173 }
174 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
175 ?>