/**
  * Get Options.
  *
  * @return	array	Options. Array ("value" => "option_text")
  */
 public function getOptions()
 {
     global $lng;
     $lng->loadLanguageModule("meta");
     $lng->loadLanguageModule("form");
     include_once "./Services/Utilities/classes/class.ilCountry.php";
     foreach (ilCountry::getCountryCodes() as $c) {
         $options[$c] = $lng->txt("meta_c_" . $c);
     }
     asort($options);
     $options = array("" => "- " . $lng->txt("form_please_select") . " -") + $options;
     return $options;
 }
 public static function _getSearchableFieldsInfo($a_admin = false)
 {
     global $lng;
     $counter = 1;
     foreach (ilUserSearchOptions::_getPossibleFields($a_admin) as $field) {
         // TODO: check enabled
         // DONE
         if ($a_admin == false and !ilUserSearchOptions::_isEnabled($field)) {
             continue;
         }
         $fields[$counter]['values'] = array();
         $fields[$counter]['type'] = FIELD_TYPE_TEXT;
         $fields[$counter]['lang'] = $lng->txt($field);
         $fields[$counter]['db'] = $field;
         /**
          * @todo: implement a more general solution
          */
         $fields[$counter]['autoComplete'] = false;
         switch ($field) {
             case 'login':
             case 'firstname':
             case 'lastname':
             case 'email':
                 $fields[$counter]['autoComplete'] = true;
                 break;
             case 'title':
                 $fields[$counter]['lang'] = $lng->txt('person_title');
                 break;
                 // SELECTS
             // SELECTS
             case 'gender':
                 $fields[$counter]['type'] = FIELD_TYPE_SELECT;
                 $fields[$counter]['values'] = array(0 => $lng->txt('please_choose'), 'f' => $lng->txt('gender_f'), 'm' => $lng->txt('gender_m'));
                 break;
             case 'sel_country':
                 $fields[$counter]['type'] = FIELD_TYPE_SELECT;
                 $fields[$counter]['values'] = array(0 => $lng->txt('please_choose'));
                 // #7843 -- see ilCountrySelectInputGUI
                 $lng->loadLanguageModule('meta');
                 include_once './Services/Utilities/classes/class.ilCountry.php';
                 foreach (ilCountry::getCountryCodes() as $c) {
                     $fields[$counter]['values'][$c] = $lng->txt('meta_c_' . $c);
                 }
                 asort($fields[$counter]['values']);
                 break;
                 /*
                 case 'active':
                 	$fields[$counter]['type'] = FIELD_TYPE_SELECT;
                 	$fields[$counter]['values'] = array(-1 => $lng->txt('please_choose'),
                 									'1' => $lng->txt('active'),
                 									'0' => $lng->txt('inactive'));
                 	
                 	break;
                 */
         }
         ++$counter;
     }
     $fields = ilUserSearchOptions::__appendUserDefinedFields($fields, $counter);
     return $fields ? $fields : array();
 }
 /**
  * Init filter
  */
 function initFilter()
 {
     global $lng;
     foreach ($this->getSelectableColumns() as $column => $meta) {
         // no udf!
         switch ($column) {
             case "firstname":
             case "lastname":
             case "mark":
             case "u_comment":
             case "institution":
             case "department":
             case "title":
             case "street":
             case "zipcode":
             case "city":
             case "country":
             case "email":
             case "matriculation":
             case "login":
                 $item = $this->addFilterItemByMetaType($column, ilTable2GUI::FILTER_TEXT, true, $meta["txt"]);
                 $this->filter[$column] = $item->getValue();
                 break;
             case "first_access":
             case "last_access":
             case "create_date":
             case 'status_changed':
                 $item = $this->addFilterItemByMetaType($column, ilTable2GUI::FILTER_DATETIME_RANGE, true, $meta["txt"]);
                 $this->filter[$column] = $item->getDate();
                 break;
             case "birthday":
                 $item = $this->addFilterItemByMetaType($column, ilTable2GUI::FILTER_DATE_RANGE, true, $meta["txt"]);
                 $this->filter[$column] = $item->getDate();
                 break;
             case "read_count":
             case "percentage":
                 $item = $this->addFilterItemByMetaType($column, ilTable2GUI::FILTER_NUMBER_RANGE, true, $meta["txt"]);
                 $this->filter[$column] = $item->getValue();
                 break;
             case "gender":
                 $item = $this->addFilterItemByMetaType("gender", ilTable2GUI::FILTER_SELECT, true, $meta["txt"]);
                 $item->setOptions(array("" => $lng->txt("trac_all"), "m" => $lng->txt("gender_m"), "f" => $lng->txt("gender_f")));
                 $this->filter["gender"] = $item->getValue();
                 break;
             case "sel_country":
                 $item = $this->addFilterItemByMetaType("sel_country", ilTable2GUI::FILTER_SELECT, true, $meta["txt"]);
                 $options = array();
                 include_once "./Services/Utilities/classes/class.ilCountry.php";
                 foreach (ilCountry::getCountryCodes() as $c) {
                     $options[$c] = $lng->txt("meta_c_" . $c);
                 }
                 asort($options);
                 $item->setOptions(array("" => $lng->txt("trac_all")) + $options);
                 $this->filter["sel_country"] = $item->getValue();
                 break;
             case "status":
                 include_once "Services/Tracking/classes/class.ilLPStatus.php";
                 $item = $this->addFilterItemByMetaType("status", ilTable2GUI::FILTER_SELECT, true, $meta["txt"]);
                 $item->setOptions(array("" => $lng->txt("trac_all"), ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM + 1 => $lng->txt(ilLPStatus::LP_STATUS_NOT_ATTEMPTED), ilLPStatus::LP_STATUS_IN_PROGRESS_NUM + 1 => $lng->txt(ilLPStatus::LP_STATUS_IN_PROGRESS), ilLPStatus::LP_STATUS_COMPLETED_NUM + 1 => $lng->txt(ilLPStatus::LP_STATUS_COMPLETED), ilLPStatus::LP_STATUS_FAILED_NUM + 1 => $lng->txt(ilLPStatus::LP_STATUS_FAILED)));
                 $this->filter["status"] = $item->getValue();
                 if ($this->filter["status"]) {
                     $this->filter["status"]--;
                 }
                 break;
             case "language":
                 $item = $this->addFilterItemByMetaType("language", ilTable2GUI::FILTER_LANGUAGE, true);
                 $this->filter["language"] = $item->getValue();
                 break;
             case "spent_seconds":
                 $item = $this->addFilterItemByMetaType("spent_seconds", ilTable2GUI::FILTER_DURATION_RANGE, true, $meta["txt"]);
                 $this->filter["spent_seconds"]["from"] = $item->getCombinationItem("from")->getValueInSeconds();
                 $this->filter["spent_seconds"]["to"] = $item->getCombinationItem("to")->getValueInSeconds();
                 break;
         }
     }
 }
 function getSelCountryCodes()
 {
     global $lng;
     include_once "./Services/Utilities/classes/class.ilCountry.php";
     $options = array();
     foreach (ilCountry::getCountryCodes() as $c) {
         $options[$c] = $lng->txt("meta_c_" . $c);
     }
     asort($options);
     return $options;
 }