Code

3b8761790a12c0c217c070e6eb8239c702b16ff6
[gosa.git] / gosa-core / include / class_MultiSelectWindow.inc
1 <?php
3 define ("SEPERATOR", 1002);
5 class MultiSelectWindow{
7         var $bool_DisplayAlpahabet      = false;
8         var $bool_DisplayCloseButton= true;     
9         var $bool_DisplaySaveButton = true;     
11         var $SaveButtonString           = "";
12         var $CloseButtonString  = "";
14         var $string_Title                         = "";
15         var $string_ListHeader  = "";
16   var $string_ListDropDown= "";
17         var $string_Summary                     = "";
18         var $string_Information = "";
20         var $array_Header                         = array();
21         var $array_Elements                     = array();      
22         var $array_Checkboxes           = array();      
23         var $array_Regexes                      = array();      
25         var $config                                         = array("");
26         var $is_closed                            = false;
27         var $is_saved                               = false;
28         var $is_headpage                          = false;      // if true the design changes
29         var $filterName                           = "Liste";
30         var $DepartmentsAdded           = false;
31   var $Added_Departments  = array();
32         var $selectedBase       = "";
34   var $DivHeight          = "";
36   var $HideFilterPart     = false;
37   var $List_Bottom_Info   = "";
38   var $SaveAdditionalVars = array();  // Additional Post vars to store 
39   var $module= "";
41   var $IgnoreAccount = TRUE;
43         function ClearElementsList()
44         {
45                 $this->array_Elements = array();
46         }
48   function HideFilterPart($bool = true)
49   {
50     $this->HideFilterPart = $bool;
51   }
53   function SetHeight($height)
54   { 
55     $this->DivHeight=$height;
56   }
58         /* Adds a regex input field to the current dialog */
59         function AddRegex($name,$string,$value,$conn,$image="images/search.png")
60         {
61                 $arr = array();
63                 /* Check if the given input field name was already used 
64                    for this type of dialog */   
65                 if(isset($_SESSION['MultiDialogFilters'][$this->filterName][$name])){
66                         $arr['value']   = $_SESSION['MultiDialogFilters'][$this->filterName][$name];
67                         $this->$name = $arr['value'];
68                 }else{
69                         $arr['value']   = $value;       
70                 }
72                 $arr['name']            = $name;
73                 $arr['string']          = $string;
74                 $arr['image']           = $image;       
75                 $arr['connAlpha']       = $conn;                // Connect with alphabet select 
76                 $this->array_Regexes[] = $arr;
77         }
80   function SetDropDownHeaderMenu($str)
81   {
82     $this->string_ListDropDown = $str;
83   }
85   function GetDropDownHeaderMenu()
86   {
87     if(!empty($this->string_ListDropDown)){
88       $mid = new LayersMenu(6, 7, 2, 1);
89       $mid->setImgwww("./images/");
90       $mid->setIcondir("./images/");
91       $mid->setDirroot("../include/php_layers_menu/");
92       $mid->setHorizontalMenuTpl("../ihtml/".get_template_path("",FALSE).'GOsa_MultiSelectHeader.ihtml');
93       $mid->setSubMenuTpl("../ihtml/".get_template_path("",FALSE).'GOsa_MultiSelectHeaderSubEntry.ihtml');
94       $mid->setMenuStructureString($this->string_ListDropDown);
95       $mid->parseStructureForMenu('menu');
96       $mid->newHorizontalMenu('menu');
97       $s = $mid->getHeader();
98       $s.= $mid->getMenu('menu');
99       $s.= $mid->getFooter('menu');
100       return($s);
101     }else{
102       return("");
103     }
104   }
107         /* Contrucktion */
108         function MultiSelectWindow(&$config, $filterName, $module)
109         {
110                 $this->config = &$config;
111                 $this->module = $module;
112                 $this->SaveButtonString         = _("Save");
113                 $this->CloseButtonString        = _("Close");
114                 $this->filterName                       = $filterName;
115     $this->ui = get_userinfo();
116                 $this->selectedBase = $_SESSION['CurrentMainBase'];
118     /* Check default values for SaveAdditionalVars */
119     foreach($this->SaveAdditionalVars as $name){
120       if(isset($_SESSION['MultiDialogFilters'][$this->filterName][$name])){
121         $this->$name = $_SESSION['MultiDialogFilters'][$this->filterName][$name];
122       }
123     }
124     
125         }
127         /* Enables the headpage mode, which changes the list look */
128         function SetHeadpageMode()
129         {
130                 $this->is_headpage = true;
131         }
133         /* Sets the List internal name (not displayed anywhere) 
134            it is used to identify every single list
135          */     
136         function SetTitle($str)
137         {
138                 $this->string_Title = $str;
139         }
141         /* Set the list header string  */
142         function SetListHeader($str)
143         {
144                 $this->string_ListHeader = $str;
145         }
147         /* This sets the list description which is the first gray bar on top of the list */
148         function SetSummary($str)
149         {
150                 $this->string_Summary = $str;
151         }
153         /* If the save button is enabled, you can change its caption with this function */      
154         function SetSaveButtonString($str)
155         {
156                 $this->SaveButtonString = $str;
157         }
159         /* If the close button is enabled, you can change its caption with this function */     
160         function SetCloseButtonString($str)
161         {
162                 $this->CloseButtonString = $str;
163         }
165         /* With this function you can change the text of the information box */
166         function SetInformation($str)
167         {
168                 $this->string_Information = $str;
169         }
171         /* Display the alphabet selection box*/
172         function EnableAplhabet($bool)
173         {
174                 $this->bool_DisplayAlpahabet = $bool;
175         }
177         /* Add additional header col */
178         function AddHeader($arr)
179         {
180                 $this->array_Header[] = $arr;
181         }
183         /* add additional List element */
184         function AddElement($arr)
185         {
186                 $this->array_Elements[] = $arr;
187         }
190   /* Return default header part. With back, home and root icons and department selection */
191   function get_default_header()
192   {
193     $enable_back = TRUE;
194     $enable_root = TRUE;
195     $enable_home = TRUE;
197     $ui = get_userinfo();
199     /* Check if selectedBase = first available base */
200     $deps = $ui->get_module_departments($this->module);
202     if(!count($deps) || $deps[0] == $this->selectedBase){
203       $enable_back = FALSE;
204       $enable_root = FALSE;
205     }
206   
207     $listhead ="";
208  
209     /* Check if we are in users home  department */ 
210     if(!count($deps) ||$this->selectedBase == get_base_from_people($ui->dn)){
211       $enable_home = FALSE;
212     }
214     /* Draw root button */
215     if($enable_root){
216       $listhead .= " <input class='center' type='image' src='images/list_root.png' align='middle'
217         title='"._("Go to root department")."' name='dep_root' alt='"._("Root")."'>&nbsp;";
218     }else{
219       $listhead .= " <img src='images/list_root_gray.png' class='center' alt='"._("Root")."'>&nbsp;";
220     }
222     /* Draw back button */
223     if($enable_back){
224       $listhead .= " <input class='center' type='image' align='middle' src='images/list_back.png'
225         title='"._("Go up one department")."' alt='"._("Up")."'                name='dep_back'>&nbsp;";
226     }else{
227       $listhead .= " <img src='images/list_back_gray.png' class='center' alt='"._("Up")."'>&nbsp;";
228     }
230     /* Draw home button */
231     if($enable_home){
232       $listhead .= " <input class='center' type='image' align='middle' src='images/list_home.png'
233         title='"._("Go to users department")."' alt='"._("Home")."'            name='dep_home'>&nbsp;";
234     }else{
235       $listhead .= " <img src='images/list_home_gray.png' class='center' alt='"._("Home")."'>&nbsp;";
236     }
237    
238     /* And at least draw reload button, this button is enabled everytime */ 
239     $listhead .=  " <input class='center' type='image' src='images/list_reload.png' align='middle'
240       title='"._("Reload list")."' name='submit_department' alt='"._("Submit")."'>&nbsp;".
241       " <img   class='center' src='images/list_seperator.png' align='middle' alt='-' height='16' width='1'>&nbsp;";
243     return ($listhead);
244   }
246         /* Add a checkbox to the filter element,
247            the name specifies an existing class var to store the 'selection' */
248         function AddCheckBox($name,$value="Unset",$string="Unset",$default=false)
249         {
250                 $arr = array();
252                 if($name == SEPERATOR){
253                         $arr['name'] = SEPERATOR;
254                 }else{
255                         /* Check if there was already a variable 
256                            for this dialog which we should use instead of the default*/
257                         if(isset($_SESSION['MultiDialogFilters'][$this->filterName][$name])){
258                                 $arr['default'] = $_SESSION['MultiDialogFilters'][$this->filterName][$name];
259                                 $this->$name = $arr['default'];
260                         }else{
261                                 $arr['default'] = $default; 
262         $this->$name = $default;
263                         }
264                         $arr['name']          = $name;
265                         $arr['string']      = $string;
266                         $arr['value']         = $value;
267                         $arr['enabled']     = true;
269                 }
270                 $this->array_Checkboxes[] = $arr;
271         }
274         /* Hides or unhides the checkbox with the given name */
275         function DisableCheckBox($name,$HideShow = false)
276         {
277                 foreach($this->array_Checkboxes as $key => $chkbox){
278                         if($chkbox['name'] == $name){
279                                 $this->array_Checkboxes[$key]['enabled'] = $HideShow;
280                         }
281                 }
282         }
285         /* Returns true if the close button was pressed */
286         function isClosed()
287         {
288                 return($this->is_closed);
289         }
291         /* Enable the close button */
292         function EnableCloseButton($bool)
293         {
294                 $this->bool_DisplayCloseButton = $bool;
295         }
297         /* Enable the save button on the bottom of the list*/
298         function EnableSaveButton ($bool)
299         {
300                 $this->bool_DisplaySaveButton = $bool;
301         }
303   /* Add a list specific filter object to position 
304       1 on top of Information 
305       2 Between Information && Filter
306       3 Below the Filter Part */
307   function AddUserBoxToFilter($position)
308   {
309     return("");
310   }
312   function EnableJSLeaveMsg($ignore = TRUE)
313   {
314     $this->IgnoreAccount = !$ignore;
315   }
317         /* Draw the list with all list elements and filters */
318         function Draw()
319         {
321                 /* Check for exeeded sizelimit */
322                 if (($message= check_sizelimit()) != ""){
323                         return($message);
324                 }
326                 $smarty = get_smarty();
327                 $smarty->assign("UserBox1",$this->AddUserBoxToFilter(1));
328                 $smarty->assign("UserBox2",$this->AddUserBoxToFilter(2));
329                 $smarty->assign("UserBox3",$this->AddUserBoxToFilter(3));
331                 $divlist = new divlist($this->string_Title);
332                 $divlist->SetSummary($this->string_Summary);
333                 $divlist->SetEntriesPerPage(0); // 0 for scrollable list
335     /* Display list footer with summary of all listed entries */
336     if(isset($this->config->data['MAIN']['LIST_SUMMARY']) && preg_match("/true/i",$this->config->data['MAIN']['LIST_SUMMARY'])){
337       $divlist->SetFooter($this->get_List_Bottom_Info());
338     }
339   
340     if($this->DivHeight != ""){
341       $divlist->SetHeight($this->DivHeight);
342     }
344                 /* set Header informations 
345                  */
346                 $header = array();
347                 foreach($this->array_Header as $head){
348                         $header[] = $head;
349                 }
350                 $divlist->SetHeader($header);
352                 /* set Entries 
353                  */
354                 $elements = array();
355                 foreach($this->array_Elements as $element){
356                         $divlist->AddEntry($element);
357                 }
359                 /* Create checkboxes fields 
360                  */
361                 $boxes = "";
362                 $boxClick = " onClick='document.mainform.submit();' ";
363                 foreach($this->array_Checkboxes as $box){
365                         if($box['name'] == SEPERATOR){
366                                 $boxes .= "</td></tr></table><table style='width:100%;border-top:1px solid #B0B0B0;'><tr><td>";
367                                 continue;
368                         }
370                         /* Skip disabled boxes */
371                         if(!$box['enabled']) continue;
373                         /* Check if box is checked */
374                         if($box['default'] == true){
375                                 $boxes .="<input type='checkbox' name=\"".$box['name']."\" value='1' title=\"".htmlentities($box['value'])."\" checked ".$boxClick.">&nbsp;".$box['string']."<br>";
376                         }else{
377                                 $boxes .="<input type='checkbox' name=\"".$box['name']."\" value='1' title=\"".htmlentities($box['value'])."\" ".$boxClick.">&nbsp;".$box['string']."<br>";
378                         }
379                 }
380                 $smarty->assign("CheckBoxes", $boxes);
382                 /* Assign regex fields 
383                  */
384                 $regexes = "";
385                 foreach($this->array_Regexes as $regex){
386                         $regexes.="<table summary=\"\" style=\"width:100%;border-top:1px solid #B0B0B0;\">
387                                 <tr>
388                                 <td>
389                                 <label for=\"".$regex['name']."\">
390                                 <img alt=\"".$regex['string']."\" src=\"".$regex['image']."\" align=middle>
391                                 </label>
392                                 </td>
393                                 <td width=\"99%\">
394                                 <input id=\"".$regex['name']."\" type=\"text\" style='width:99%' name=\"".$regex['name']."\" maxlength='20'
395                                 value=\"".htmlentities($regex['value'])."\" title=\"".htmlentities($regex['string'])."\"> 
396                                 </td>
397                                 </tr>
398                                 </table>";
399                 }
400                 $smarty->assign("regexes"                       , $regexes );
402     /* Hide Filter Part if Requested or empty */
403     if((empty($boxes)) && (empty($regexes)) || ($this->HideFilterPart)){
404                   $smarty->assign("Skip_Filter_Part",   true);
405     }else{ 
406                   $smarty->assign("Skip_Filter_Part",   false);
407     }
409                 /* Assign alphabet and display it 
410                  */     
411                 $smarty->assign("Display_alphabet",     $this->bool_DisplayAlpahabet);
412                 $smarty->assign("alphabet",             generate_alphabet());
413                 $smarty->assign("Header"                        , $this->string_ListHeader);
414                 $smarty->assign("HeaderDropDown", $this->GetDropDownHeaderMenu());
415                 $smarty->assign("Summary"                       , $this->string_Summary);
416                 $smarty->assign("Title"                         , $this->string_Title);
417                 $smarty->assign("Information"           , $this->string_Information);
418                 $smarty->assign("IgnoreAccount"         , $this->IgnoreAccount);
420                 /* Check for exeeded sizelimit */
421                 $smarty->assign("hint"                          , print_sizelimit_warning());
422                 $smarty->assign("DivList"                       , $divlist->DrawList());
425                 if($this->is_headpage){
426                         $smarty->assign("tree_image",           get_template_path('images/tree.png'));
427                         $smarty->assign("infoimage",            get_template_path('images/info.png'));
428                         $smarty->assign("launchimage",          get_template_path('images/launch.png'));
429                         $smarty->assign("apply",                        apply_filter());
430                 }else{
431                         $smarty->assign("tree_image",           get_template_path('images/tree.png'));
432                         $smarty->assign("infoimage",            get_template_path('images/info_small.png'));
433                         $smarty->assign("launchimage",          get_template_path('images/rocket.png'));
434                         $smarty->assign("apply",                        apply_filter());
435                 }
437                 /* Button handling */
438                 $smarty->assign("SaveButtonString" ,$this->SaveButtonString);
439                 $smarty->assign("CloseButtonString",$this->CloseButtonString);
441                 $smarty->assign("Display_Close",        $this->bool_DisplayCloseButton);
442                 $smarty->assign("Display_Save" ,        $this->bool_DisplaySaveButton);
444                 $smarty->assign("filterName"    ,       $this->filterName);
445                 $smarty->assign("is_headpage"   ,       $this->is_headpage);
447                 $display = $smarty->fetch(get_template_path("MultiSelectWindow.tpl"));
448                 return($display);
449         }
451         /* Set the close var, which simulates the close button is pressed */
452         function Close()
453         {
454                 $this->is_closed = true;
455         }
457         function Save()
458         {
459                 $this->is_saved = true;
460         }
462         /* Store all checkboxes/ regexes ... 
463            Store data also into a session var, to keep the checkboxes check after reload  */
464         function save_object()
465         {
466     /* Get up to date config */
467     if(isset($this->parent->config)){
468       $this->config = $this->parent->config;
469     }
471     /* Update current base */
472     $s_action ="";
473     foreach($_POST as $key => $value){
474       if(preg_match("/^dep_back.*/i",$key)){
475         $s_action="back";
476       }elseif(preg_match("/^dep_root.*/",$key)){
477         $s_action="root";
478       }elseif(preg_match("/^dep_home.*/i",$key)){
479         $s_action="home";
480       }
481     }
483     /* Save base selection from headpage selectbox*/
484     if(isset($_POST['CurrentMainBase'])){
485       $this->selectedBase = $_POST['CurrentMainBase'];
486     }
488     /* Homebutton is posted */
489     if($s_action=="home"){
490       $ui= get_userinfo();
491       $base = get_base_from_people($ui->dn);
492       $this->selectedBase= $base;
493     }
495     /* Open selected department
496        this is posted by the parent class MultiSelectWindow */
497     if(isset($_GET['act'])&& ($_GET['act'] == "dep_open")){
498       $s_entry = base64_decode($_GET['dep_id']);
499       if (!isset($this->config->departments[$s_entry])){
500         print_red(_("Error: The requested subtree has an inconsistent DN encoding, check your LDAP!"));
501       } else {
502         $this->selectedBase = $this->config->departments[$s_entry];
503       }
504     }
506     /* back to the roots ^^ */
507     if($s_action=="root"){
508       $this->selectedBase=($this->config->current['BASE']);
509       $dep_id = $this->ui->get_module_departments($this->module);
510       if(isset($dep_id[key($dep_id)])){
511         $this->selectedBase = $dep_id[key($dep_id)];
512       }
513     }
516     /* If Back-button is pressed, move back one step in DN */
517     if($s_action=="back"){
519       /* Get parent deprtment and check if we are allowed to step in it */
520       $base_back= preg_replace("/^[^,]+,/", "", $_SESSION['CurrentMainBase']);
521       $dep_id = $this->ui->get_module_departments($this->module);
522       if(in_array_ics($base_back,$dep_id)){
524         /* The department array keeps non DN entries as index. We need to convert
525            it before checking the existance. */
526         $base_back= trim(convert_department_dn($base_back));
528         /* Check if the department exists, otherwise revert to the configure base DN */
529         if(isset($this->config->departments[$base_back])){
530           $this->selectedBase= $this->config->departments[$base_back];
531         }else{
532           $this->selectedBase= $this->config->departments['/'];
533         }
534       }
535     }
536     session::set('CurrentMainBase',$this->selectedBase);
538                 if(isset($_POST['MultiSelectWindow'.$this->filterName])){
540       /* Save some additional vars */
541       foreach($this->SaveAdditionalVars as $name){
542         if(isset($_POST[$name])){
543           if(isset($this->$name)){
544             $this->$name = $_POST[$name];
545             $_SESSION['MultiDialogFilters'][$this->filterName][$name] = $_POST[$name];
546           }
547         }
548       }
550                         /* Check posts from checkboxes 
551                          */
552                         foreach($this->array_Checkboxes as $key => $box){
553                                 if(isset($_POST[$box['name']])){
554                                         $this->array_Checkboxes[$key]['default'] = true;
555                                         $this->$box['name'] = true;
556                                 }else{
557                                         $this->array_Checkboxes[$key]['default'] = false;
558                                         $this->$box['name'] = false;
559                                 }
560                                 /* Save settings in out session */
561                                 $_SESSION['MultiDialogFilters'][$this->filterName][$box['name']] = $this->$box['name'];
562                         }
564                         /* Check regex posts */
565                         foreach($this->array_Regexes as $key => $box){
566                                 $this->array_Regexes[$key]['value'] = $_POST[$box['name']];
567                                 $this->$box['name'] = $_POST[$box['name']];
568                                 $_SESSION['MultiDialogFilters'][$this->filterName][$box['name']] = $this->$box['name'];
569                         }
571                         /* call close/save if buttons are pressed */
572                         if(isset($_POST['CloseMultiSelectWindow'])){
573                                 $this->Close();
574                         }
576                         if(isset($_POST['SaveMultiSelectWindow'])){
577                                 $this->Save();
578                         }
579                 }
581                 /* check for alphabet selection
582                    Check which regexes are connected to the alphabet 
583                  */     
584                 if(isset($_GET['search'])){
585                         foreach($this->array_Regexes as $key => $box){
586                                 /* check if this regex is connected to the alphabet selection */
587                                 if(($box['connAlpha'])&&(isset($_GET['search']))){
588                                         $val =  $_GET['search']."*";
589                                         $val = preg_replace("/\*\**/","*",$val);
590                                         $this->array_Regexes[$key]['value'] = $val;
591                                         $this->$box['name'] = $val;
592           $_SESSION['MultiDialogFilters'][$this->filterName][$box['name']] =  $val;
593                                 }
594                         }
595                 }
596         }
599   /* Create header snapshot value */
600   function get_snapshot_header($layer_menu = FALSE)
601   {
602     $str = "";
603     if($this->parent->snapshotEnabled()){
604       $ok = false;
605       foreach($this->parent->get_used_snapshot_bases() as $base){
606         $ok |= count($this->parent->getAllDeletedSnapshots($base)) >= 1 ;
607       }
608       if($ok){
609         if($layer_menu){
610           $str = "..|<img class='center' src='images/restore.png' alt='"._("Restore")."'>&nbsp;"._("Restore")."|RestoreDeletedSnapShot|\n";
611         }else{
612           $str = "<input class='center' type='image' align='middle' src='images/restore.png'
613             title='"._("Restore snapshopts of already deleted objects")."' 
614             alt='"._("Restore")."' name='RestoreDeletedSnapShot'>&nbsp;"; 
615         }
616       }else{
617         if($layer_menu){
618           $str = "..|<img class='center' src='images/restore_grey.png' alt=''>&nbsp;"._("Restore")."||\n";
619         }else{
620           $str = "<img class='center' src='images/restore_grey.png' alt=''>&nbsp;";
621         }
622       }
623 #      $str .= "<img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;";
624     }
625     return($str);
626   }
629   function GetSnapShotActions($dn)
630   {
631     $str= "";
632     if($this->parent->snapshotEnabled()){
634       if(count($this->parent->Available_SnapsShots($dn))){
635         $str.= "<input class='center' type='image' src='images/restore.png'
636           alt='"._("Restore snapshot")."' name='RestoreSnapShotDialog_".base64_encode($dn)."' title='"._("Restore snapshot")."'>&nbsp;";
637       } else {
638         $str = "<img class='center' src='images/restore_grey.png' alt=''>&nbsp;";
639       }
641       $str.= "<input class='center' type='image' src='images/snapshot.png'
642         alt='"._("Create snapshot")."' name='CreateSnapShotDialog_".base64_encode($dn)."' title='"._("Create a new snapshot from this object")."'>&nbsp;";
643     }
645     return($str);
646   }
649         /* this function adds the sub-departments of the current tree to the list */
650         function AddDepartments($base = false,$numtabs = 3,$empty_tabs_in_front = 0)
651         {
652                 $this->DepartmentsAdded = true;
653     $this->Added_Departments = array();
655                 /* check for a valid base */
656                 if(!$base){
657                         if(!isset($_SESSION['CurrentMainBase'])){
658                                 session::set('CurrentMainBase',$this->config->current['BASE']);
659                         }
660                         $base = $_SESSION['CurrentMainBase'];
661                 }
663                 /* Create ldap obj and switch into base*/
664                 $ldap = $this->config->get_ldap_link();
665                 $ldap->cd($base);
667                 /* reset current deps */
668                 $this->departments = array();
670                 /* Get all departments within this subtree */
671                 $deps= get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
672                     array("ou", "description"), GL_SIZELIMIT | GL_CONVERT);
674                 /* Edit delete link for system types
675                  */
676                 $linkopen = "<a href='?plug=".$_GET['plug']."&amp;act=dep_open&amp;dep_id=%s'>%s</a>";
678                 /* Create an array with all visible (in the list) departments */
679                 $departments = array();
680                 foreach($deps as $value){
681                         if(isset($value['description'][0])){
682                                 $this->departments[$value['dn']]= get_sub_department($value['dn'])." - [".$value["description"][0]."]";
683                         }else{
684                                 $this->departments[$value['dn']]= get_sub_department($value['dn']);
685                         }
686                 }
687                 natcasesort($this->departments);
690     if($empty_tabs_in_front){
691 #      $numtabs -= $empty_tabs_in_front;
692     }
693   
694                 /* Add deps to this dialog object list */
695                 foreach($this->departments as $key=> $val){
697                         /* Add missing entries ... */
698                         if(!isset($this->config->departments[trim($key)])){
699                                 $this->config->departments[trim($key)]="";
700                         }
702                         /* check if this department contains sub-departments
703                            Display different image in this case
704                          */
705                         $non_empty="";
706                         $nkey= normalizePreg($key);
707                         foreach($this->config->departments as $keyd=>$vald ){
708                                 if(preg_match('/$nkey\/.*/',$keyd)){
709                                         $non_empty="full";
710                                 }
711                         }
713                         /* Add to divlist */
714                         $row = array();
716       if($empty_tabs_in_front){
717         for($i = 0; $i < $empty_tabs_in_front ; $i ++){
718           $row[] = array("string"=>"&nbsp;", "attach" => "style='text-align:center;width:20px;'");
719         }
720       }
722                         $row[]=$field1=array("string"=>"<img src='images/".$non_empty."folder.png' alt='department'>","attach"=>"style='text-align:center;width:20px;'");
723                         $row[]=$field2=array("string"=>sprintf($linkopen,base64_encode($key),$val), "attach" => "style=''");
725                         if($numtabs > 2){       
726                                 for($i = 2 ; $i < $numtabs;$i++){
727           if(isset( $this->array_Header[$i + $empty_tabs_in_front]['attach'])){
728             $row[] = array("string"=>"&nbsp;","attach" => $this->array_Header[$i + $empty_tabs_in_front]['attach']);
729           }else{
730             $row[] = array("string"=>"&nbsp;");
731           }
732                                 }
733                         }
734                         $this->AddElement($row);
735       $this->Added_Departments[] = $row;
736                 }
737         }
739   function set_List_Bottom_Info($str)
740   {
741     $this->List_Bottom_Info = $str;
742   }
744   function get_List_Bottom_Info()
745   {
746     return($this->List_Bottom_Info); 
747   }
749 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
750 ?>