diff --git a/include/class.search.php b/include/class.search.php index ffdf9a46ef2409d31b883cfa5006f7f194cd176c..c2e4f93d1f1e03c226b65eec1c87cad27ec78852 100644 --- a/include/class.search.php +++ b/include/class.search.php @@ -702,10 +702,27 @@ class HelpTopicChoiceField extends ChoiceField { require_once INCLUDE_DIR . 'class.dept.php'; class DepartmentChoiceField extends ChoiceField { + var $_choices = null; + function getChoices($verbose=false) { return Dept::getDepartments(); } + function getQuickFilterChoices() { + global $thisstaff; + + if (!isset($this->_choices)) { + $this->_choices = array(); + $depts = $thisstaff ? $thisstaff->getDepts() : array(); + foreach ($this->getChoices() as $id => $name) { + if (!$depts || in_array($id, $depts)) + $this->_choices[$id] = $name; + } + } + + return $this->_choices; + } + function getSearchMethods() { return array( 'includes' => __('is'),