Code

Added modified menu templates, removed unused templates
[gosa.git] / include / class_MultiSelectWindow.inc
index db82577f37a044121960f7ac5a4c1597639ea74c..bc99ac9f1857a4d9cf972d3cb67958ec1b694422 100644 (file)
@@ -13,6 +13,7 @@ class MultiSelectWindow{
 
        var $string_Title                         = "";
        var $string_ListHeader  = "";
+  var $string_ListDropDown= "";
        var $string_Summary                     = "";
        var $string_Information = "";
 
@@ -27,12 +28,13 @@ class MultiSelectWindow{
        var $is_headpage                          = false;      // if true the design changes
        var $filterName                           = "Liste";
        var $DepartmentsAdded           = false;
+  var $Added_Departments  = array();
        var $selectedBase       = "";
 
   var $DivHeight          = "";
 
   var $HideFilterPart     = false;
-
+  var $List_Bottom_Info   = "";
   var $SaveAdditionalVars = array();  // Additional Post vars to store 
   var $module= "";
 
@@ -72,15 +74,42 @@ class MultiSelectWindow{
                $this->array_Regexes[] = $arr;
        }
 
+
+  function SetDropDownHeaderMenu($str)
+  {
+    $this->string_ListDropDown = $str;
+  }
+
+  function GetDropDownHeaderMenu()
+  {
+    if(!empty($this->string_ListDropDown)){
+      $mid = new LayersMenu(6, 7, 2, 1);
+      $mid->setImgwww("./images/");
+      $mid->setIcondir("./images/");
+      $mid->setDirroot("/storage/hickert/gosa/include/php_layers_menu/");
+      $mid->setHorizontalMenuTpl('GOsa_MultiSelectHeader.ihtml');
+      $mid->setMenuStructureString($this->string_ListDropDown);
+      $mid->parseStructureForMenu('menu');
+      $mid->newHorizontalMenu('menu');
+      $s = $mid->getHeader();
+      $s.= $mid->getMenu('menu');
+      $s.= $mid->getFooter('menu');
+      return($s);
+    }else{
+      return("");
+    }
+  }
+
+
        /* Contrucktion */
-       function MultiSelectWindow($config, $filterName, $module)
+       function MultiSelectWindow(&$config, $filterName, $module)
        {
-               $this->config = $config;
+               $this->config = &$config;
                $this->module = $module;
                $this->SaveButtonString         = _("Save");
                $this->CloseButtonString        = _("Close");
                $this->filterName                       = $filterName;
-
+    $this->ui = get_userinfo();
                $this->selectedBase = $_SESSION['CurrentMainBase'];
 
     /* Check default values for SaveAdditionalVars */
@@ -171,15 +200,14 @@ class MultiSelectWindow{
       $enable_back = FALSE;
       $enable_root = FALSE;
     }
-   
+  
+    $listhead ="";
     /* Check if we are in users home  department */ 
     if(!count($deps) ||$this->selectedBase == get_base_from_people($ui->dn)){
       $enable_home = FALSE;
     }
 
-    /* Create header with selected base */
-    $listhead = "<div style='background:white;padding:5px;'>";
-
     /* Draw root button */
     if($enable_root){
       $listhead .= " <input class='center' type='image' src='images/list_root.png' align='middle'
@@ -294,7 +322,12 @@ class MultiSelectWindow{
 
                $divlist = new divlist($this->string_Title);
                $divlist->SetSummary($this->string_Summary);
-               $divlist->SetEntriesPerPage(0); // 0 for scrollable list 
+               $divlist->SetEntriesPerPage(0); // 0 for scrollable list
+
+    /* Display list footer with summary of all listed entries */
+    if(isset($this->config->data['MAIN']['LIST_SUMMARY']) && preg_match("/true/i",$this->config->data['MAIN']['LIST_SUMMARY'])){
+      $divlist->SetFooter($this->get_List_Bottom_Info());
+    }
   
     if($this->DivHeight != ""){
       $divlist->SetHeight($this->DivHeight);
@@ -369,7 +402,8 @@ class MultiSelectWindow{
                 */     
                $smarty->assign("Display_alphabet",     $this->bool_DisplayAlpahabet);
                $smarty->assign("alphabet",             generate_alphabet());
-               $smarty->assign("Header"                        , $this->string_ListHeader );
+               $smarty->assign("Header"                        , $this->string_ListHeader);
+               $smarty->assign("HeaderDropDown", $this->GetDropDownHeaderMenu());
                $smarty->assign("Summary"                       , $this->string_Summary);
                $smarty->assign("Title"                         , $this->string_Title);
                $smarty->assign("Information"           , $this->string_Information);
@@ -464,7 +498,9 @@ class MultiSelectWindow{
     if($s_action=="root"){
       $this->selectedBase=($this->config->current['BASE']);
       $dep_id = $this->ui->get_module_departments($this->module);
-      $this->selectedBase = $dep_id[key($dep_id)];
+      if(isset($dep_id[key($dep_id)])){
+        $this->selectedBase = $dep_id[key($dep_id)];
+      }
     }
 
 
@@ -598,6 +634,7 @@ class MultiSelectWindow{
        function AddDepartments($base = false,$numtabs = 3,$empty_tabs_in_front = 0)
        {
                $this->DepartmentsAdded = true;
+    $this->Added_Departments = array();
 
                /* check for a valid base */
                if(!$base){
@@ -652,7 +689,7 @@ class MultiSelectWindow{
                        $non_empty="";
                        $nkey= normalizePreg($key);
                        foreach($this->config->departments as $keyd=>$vald ){
-                               if(preg_match("/$nkey\/.*/",$keyd)){
+                               if(preg_match('/$nkey\/.*/',$keyd)){
                                        $non_empty="full";
                                }
                        }
@@ -679,8 +716,19 @@ class MultiSelectWindow{
                                }
                        }
                        $this->AddElement($row);
+      $this->Added_Departments[] = $row;
                }
        }
+
+  function set_List_Bottom_Info($str)
+  {
+    $this->List_Bottom_Info = $str;
+  }
+
+  function get_List_Bottom_Info()
+  {
+    return($this->List_Bottom_Info); 
+  }
 }
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>