get_module_departments($this->module); if(!in_array($this->selectedBase, $deps)){ $this->selectedBase = array_shift($deps); } $this->array_Elements = array(); } function HideFilterPart($bool = true) { $this->HideFilterPart = $bool; } /*! \brief Set the height of the divlist */ function SetHeight($height) { $this->DivHeight=$height; } /* Adds a regex input field to the current dialog */ function AddRegex($name,$string,$value,$conn,$image="images/lists/search.png", $return_array=FALSE) { $arr = array(); /* Check if the given input field name was already used for this type of dialog */ $MultiDialogFilters = session::get('MultiDialogFilters'); if(isset($MultiDialogFilters[$this->filterName][$name])){ $arr['value'] = $MultiDialogFilters[$this->filterName][$name]; $this->$name = $arr['value']; }else{ $arr['value'] = $value; } $arr['name'] = $name; $arr['string'] = $string; $arr['image'] = $image; $arr['connAlpha'] = $conn; // Connect with alphabet select if (!$return_array) { $this->array_Regexes[] = $arr; } else { return($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/layer_menu/"); $mid->setIcondir("./images/layer_menu/"); $mid->setDirroot("../include/utils/layer-menu/"); $mid->setHorizontalMenuTpl("../ihtml/".get_template_path("",FALSE).'GOsa_MultiSelectHeader.ihtml'); $mid->setSubMenuTpl("../ihtml/".get_template_path("",FALSE).'GOsa_MultiSelectHeaderSubEntry.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) { $this->config = &$config; $this->module = $module; $this->SaveButtonString = _("Save"); $this->CloseButtonString = _("Close"); $this->filterName = $filterName; $this->ui = get_userinfo(); $this->post_id = preg_replace("/[^0-9]/","",microtime(TRUE)); $this->selectedBase = session::get('CurrentMainBase'); /* Check default values for SaveAdditionalVars */ $MultiDialogFilters = session::get('MultiDialogFilters'); foreach($this->SaveAdditionalVars as $name){ if(isset($MultiDialogFilters[$this->filterName][$name])){ $this->$name = $MultiDialogFilters[$this->filterName][$name]; } } } /* Enables the headpage mode, which changes the list look */ function SetHeadpageMode() { $this->is_headpage = true; } /* \brief Sets the List internal name (not displayed anywhere) It is used to identify every single list. */ function SetTitle($str) { $this->string_Title = $str; } /*! \brief Set the list header string */ function SetListHeader($str) { $this->string_ListHeader = $str; } /*! \brief This sets the list description which is the first gray bar on top of the list */ function SetSummary($str) { $this->string_Summary = $str; } /*! \brief Change the caption of the save button (if it is enabled) */ function SetSaveButtonString($str) { $this->SaveButtonString = $str; } /*! \brief Change the caption of the close button (if it is enabled) */ function SetCloseButtonString($str) { $this->CloseButtonString = $str; } /*! \brief Change the text of the information box */ function SetInformation($str) { $this->string_Information = $str; } /*! \brief Toggle the alphabet selection display */ function EnableAplhabet($bool) { $this->bool_DisplayAlpahabet = $bool; } /*! \brief Add additional header col */ function AddHeader($arr) { $this->array_Header[] = $arr; } /*! \brief Add additional List element */ function AddElement($arr) { $this->array_Elements[] = $arr; } /*! \brief Return default header part. * Returns the default header part (with back, home and root icons and * department selection) * * \param boolean 'seperator' Show a seperator between each button (default: true) * */ function get_default_header($seperator= TRUE) { $enable_back = TRUE; $enable_root = TRUE; $enable_home = TRUE; $ui = get_userinfo(); /* Check if selectedBase = first available base */ $deps = $ui->get_module_departments($this->module); if(!count($deps) || $deps[0] == $this->selectedBase){ $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; } /* Draw root button */ if($enable_root){ $listhead .= " "; }else{ $listhead .= " "; } /* Draw back button */ if($enable_back){ $listhead .= " "; }else{ $listhead .= " "; } /* Draw home button */ if($enable_home){ $listhead .= " "; }else{ $listhead .= " "; } /* And at least draw reload button, this button is enabled everytime */ $listhead .= " "; if ($seperator){ $listhead.= " "; } return ($listhead); } /*! \brief Add a checkbox to the filter element * * \param string 'name' specifies an existing class var to store the 'selection' * */ function AddCheckBox($name,$value="Unset",$string="Unset",$default=false) { $arr = array(); if($name == SEPERATOR){ $arr['name'] = SEPERATOR; }else{ /* Check if there was already a variable for this dialog which we should use instead of the default*/ $MultiDialogFilters = session::get('MultiDialogFilters'); if(isset($MultiDialogFilters[$this->filterName][$name])){ $arr['default'] = $MultiDialogFilters[$this->filterName][$name]; $this->$name = $arr['default']; }else{ $arr['default'] = $default; $this->$name = $default; } $arr['name'] = $name; $arr['string'] = $string; $arr['value'] = $value; $arr['enabled'] = true; } $this->array_Checkboxes[] = $arr; } /*! \brief Hides or unhides the checkbox with the given name */ function DisableCheckBox($name,$HideShow = false) { foreach($this->array_Checkboxes as $key => $chkbox){ if($chkbox['name'] == $name){ $this->array_Checkboxes[$key]['enabled'] = $HideShow; } } } /*! \brief Returns true if the close button was pressed */ function isClosed() { return($this->is_closed); } function SetListFooter($str){ $this->footer = $str; } /*! \brief Enable the close button */ function EnableCloseButton($bool) { $this->bool_DisplayCloseButton = $bool; } /*! \brief Enable the save button on the bottom of the list*/ function EnableSaveButton ($bool) { $this->bool_DisplaySaveButton = $bool; } /*! \brief Add a list specific filter object to position 1 on top of Information 2 Between Information && Filter 3 Below the Filter Part */ function AddUserBoxToFilter($position) { return(""); } function EnableJSLeaveMsg($ignore = TRUE) { $this->IgnoreAccount = !$ignore; } function GetCheckbox($box, $start_table=FALSE) { $ret = ""; $boxClick = " onClick='document.mainform.submit();' "; if($box['name'] == SEPERATOR){ $ret = "
";
return($ret);
}
/* Skip disabled boxes */
if(!$box['enabled']) return;
/* Check if box is checked */
if($box['default'] == true){
$ret .=" ".$box['string']." "; }else{ $ret .=" ".$box['string']." "; } return($ret); } function GetRegex($regex, $draw_line=TRUE) { $ret = ""; $line_css = ""; if ($draw_line) { $line_css = "solid #B0B0B0;"; } $ret=" |