/** * (non-PHPdoc) * @see EPPager::getFilterOptions() */ protected function getFilterOptions() { $options = array(); $options['org_id'] = array('type' => 'select', 'options' => array_merge(array('' => ''), EPOrg::getOrgOptions(EPOrg::select(array('name', 'id')))), 'value' => '', 'datatype' => 'int'); $terms = EPCourse::selectFields('term', array(), array('DISTINCT'), array(), true); natcasesort($terms); $terms = array_merge(array(''), $terms); $terms = array_combine($terms, $terms); $options['term'] = array('type' => 'select', 'options' => $terms, 'value' => ''); // $options['lang'] = array( // 'type' => 'select', // 'options' => EPUtils::getLanguageOptions( $this->getLanguage()->getCode() ), // 'value' => '', // ); $options['status'] = array('type' => 'select', 'options' => array_merge(array('' => ''), EPCourse::getStatuses()), 'value' => 'current'); return $options; }
/** * (non-PHPdoc) * @see EPPager::getFilterOptions() */ protected function getFilterOptions() { $options = array(); if (!array_key_exists('course_id', $this->conds)) { $options['course_id'] = array('type' => 'select', 'options' => array_merge(array('' => ''), EPCourse::getCourseOptions(EPCourse::select(array('name', 'id')))), 'value' => '', 'datatype' => 'int'); $options['org_id'] = array('type' => 'select', 'options' => array_merge(array('' => ''), EPOrg::getOrgOptions(EPOrg::select(array('name', 'id')))), 'value' => '', 'datatype' => 'int'); } $years = EPTerm::selectFields('year', array(), array('DISTINCT'), array(), true); asort($years, SORT_NUMERIC); $years = array_merge(array(''), $years); $years = array_combine($years, $years); $options['year'] = array('type' => 'select', 'options' => $years, 'value' => ''); $options['status'] = array('type' => 'select', 'options' => array_merge(array('' => ''), EPTerm::getStatuses()), 'value' => 'current'); return $options; }
/** * (non-PHPdoc) * @see EPPager::getFilterOptions() */ protected function getFilterOptions() { return array('org_id' => array('type' => 'select', 'options' => array_merge(array('' => ''), EPOrg::getOrgOptions(EPOrg::select(array('name', 'id')))), 'value' => '', 'datatype' => 'int'), 'active' => array('type' => 'select', 'options' => array('' => '', wfMsg('epcoursepager-yes') => '1', wfMsg('epcoursepager-no') => '0'), 'value' => '')); }
/** * Returns a list of orgs in an array that can be fed to select inputs. * * @since 0.1 * * @param array|null $orgs * * @return array */ public static function getOrgOptions(array $orgs = null) { $options = array(); if (is_null($orgs)) { $orgs = EPOrg::select(array('name', 'id')); } foreach ($orgs as $org) { $options[$org->getField('name')] = $org->getId(); } return $options; }