Code

Removed executable bits that are not nessesary
[gosa.git] / plugins / gofon / conference / class_divListConferences.inc
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");
26     
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);
39   
40     /* Disable buttonsm */
41     $this->EnableCloseButton(false);
42     $this->EnableSaveButton (false);
44     /* set Page header */
45     $this->AddHeader(array("string" => "&nbsp;", "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"), _("Search in 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'>&nbsp;".
76       " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;".
77       _("Base")."&nbsp;<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").     "'>&nbsp;".
80       "</div>";
81     
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']."&amp;act=dep_open&amp;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']."&amp;id=%s&amp;act=edit_entry'>%s</a>";
103   
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 = "&nbsp;";
111       }
113       if(isset($conference['telephoneNumber'][0])){
114         $number = " - ".$conference['telephoneNumber'][0];
115       }else{
116         $number = "&nbsp; - ?";
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.="&nbsp;[".$conference['description'][0]."] &nbsp;";
132       }
133       $d_name .=$number;
136       $title = " title='".preg_replace("/ /","&nbsp;",@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"=>"&nbsp;", "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     }
158  
159     /* Create summary string for list footer */
160     $num_deps=0;
161     if(!$this->SubSearch){
162       $num_deps = count($this->Added_Departments);
163     }
164     $num_objs = count($list);
166     $num_obj_str = _("Number of listed conferences");
167     $num_dep_str = _("Number of listed departments");
169     $str = "<img class='center' src='images/select_conference.png'
170               title='".$num_obj_str."' alt='".$num_obj_str."'>&nbsp;".$num_objs."&nbsp;&nbsp;&nbsp;&nbsp;";
171     $str.= "<img class='center' src='images/folder.png'
172               title='".$num_dep_str."' alt='".$num_dep_str."'>&nbsp;".$num_deps."&nbsp;&nbsp;&nbsp;&nbsp;";
174     $this->set_List_Bottom_Info($str);
175   }
177   function Save()
178   {
179     MultiSelectWindow :: Save();  
180   }
182   function save_object()
183   {
184     /* Save automatic created POSTs like regex, checkboxes */
185     MultiSelectWindow :: save_object();   
186   }
188 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
189 ?>