public function initFilter()
 {
     // title
     include_once "./Services/Form/classes/class.ilTextInputGUI.php";
     $ti = new ilTextInputGUI($this->lng->txt("tst_qbt_filter_question_title"), "title");
     $ti->setMaxLength(64);
     $ti->setSize(20);
     $ti->setValidationRegexp('/(^[^%]+$)|(^$)/is');
     $this->addFilterItem($ti);
     $ti->readFromSession();
     $this->filter["title"] = $ti->getValue();
     // description
     $ti = new ilTextInputGUI($this->lng->txt("description"), "description");
     $ti->setMaxLength(64);
     $ti->setSize(20);
     $ti->setValidationRegexp('/(^[^%]+$)|(^$)/is');
     $this->addFilterItem($ti);
     $ti->readFromSession();
     $this->filter["description"] = $ti->getValue();
     // questiontype
     include_once "./Services/Form/classes/class.ilSelectInputGUI.php";
     include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
     $types = ilObjQuestionPool::_getQuestionTypes();
     $options = array();
     $options[""] = $this->lng->txt('filter_all_question_types');
     foreach ($types as $translation => $row) {
         $options[$row['type_tag']] = $translation;
     }
     $si = new ilSelectInputGUI($this->lng->txt("question_type"), "type");
     $si->setOptions($options);
     $this->addFilterItem($si);
     $si->readFromSession();
     $this->filter["type"] = $si->getValue();
     // author
     $ti = new ilTextInputGUI($this->lng->txt("author"), "author");
     $ti->setMaxLength(64);
     $ti->setSize(20);
     $this->addFilterItem($ti);
     $ti->setValidationRegexp('/(^[^%]+$)|(^$)/is');
     $ti->readFromSession();
     $this->filter["author"] = $ti->getValue();
     // question pool
     $ti = new ilTextInputGUI($this->getParentObjectLabel(), 'parent_title');
     $ti->setMaxLength(64);
     $ti->setSize(20);
     $ti->setValidationRegexp('/(^[^%]+$)|(^$)/is');
     $this->addFilterItem($ti);
     $ti->readFromSession();
     $this->filter['parent_title'] = $ti->getValue();
     // repo root node
     require_once 'Services/Form/classes/class.ilRepositorySelectorInputGUI.php';
     $ri = new ilRepositorySelectorInputGUI($this->lng->txt('repository'), 'repository_root_node');
     $ri->setHeaderMessage($this->lng->txt('question_browse_area_info'));
     $this->addFilterItem($ri);
     $ri->readFromSession();
     $this->filter['repository_root_node'] = $ri->getValue();
 }
Ejemplo n.º 2
0
 /**
  * Init filter
  */
 function initFilter()
 {
     global $lng, $rbacreview, $ilUser, $ilCtrl;
     // Show context filter
     if ($this->getMode() == self::MODE_LOCAL_USER) {
         include_once './Services/User/classes/class.ilLocalUser.php';
         $parent_ids = ilLocalUser::_getFolderIds();
         if (count($parent_ids) > 1) {
             include_once "./Services/Form/classes/class.ilSelectInputGUI.php";
             $co = new ilSelectInputGUI($lng->txt('context'), 'time_limit_owner');
             $ref_id = $this->getUserFolderId();
             $opt[0] = $this->lng->txt('all_users');
             $opt[$this->getUserFolderId()] = $lng->txt('users') . ' (' . ilObject::_lookupTitle(ilObject::_lookupObjId($this->getUserFolderId())) . ')';
             foreach ($parent_ids as $parent_id) {
                 if ($parent_id == $this->getUserFolderId()) {
                     continue;
                 }
                 switch ($parent_id) {
                     case USER_FOLDER_ID:
                         $opt[USER_FOLDER_ID] = $lng->txt('global_user');
                         break;
                     default:
                         $opt[$parent_id] = $lng->txt('users') . ' (' . ilObject::_lookupTitle(ilObject::_lookupObjId($parent_id)) . ')';
                         break;
                 }
             }
             $co->setOptions($opt);
             $this->addFilterItem($co);
             $co->readFromSession();
             $this->filter['time_limit_owner'] = $co->getValue();
         }
     }
     // User name, login, email filter
     include_once "./Services/Form/classes/class.ilTextInputGUI.php";
     $ul = new ilTextInputGUI($lng->txt("login") . "/" . $lng->txt("email") . "/" . $lng->txt("name"), "query");
     $ul->setDataSource($ilCtrl->getLinkTarget($this->getParentObject(), "addUserAutoComplete", "", true));
     $ul->setSize(20);
     $ul->setSubmitFormOnEnter(true);
     $this->addFilterItem($ul);
     $ul->readFromSession();
     $this->filter["query"] = $ul->getValue();
     /*
     include_once("./Services/Form/classes/class.ilTextInputGUI.php");
     $ti = new ilTextInputGUI($lng->txt("login")."/".$lng->txt("email")."/".$lng->txt("name"), "query");
     $ti->setMaxLength(64);
     $ti->setSize(20);
     $ti->setSubmitFormOnEnter(true);
     $this->addFilterItem($ti);
     $ti->readFromSession();
     $this->filter["query"] = $ti->getValue();
     */
     // activation
     include_once "./Services/Form/classes/class.ilSelectInputGUI.php";
     $options = array("" => $lng->txt("user_all"), "active" => $lng->txt("active"), "inactive" => $lng->txt("inactive"));
     $si = new ilSelectInputGUI($this->lng->txt("user_activation"), "activation");
     $si->setOptions($options);
     $this->addFilterItem($si);
     $si->readFromSession();
     $this->filter["activation"] = $si->getValue();
     // limited access
     include_once "./Services/Form/classes/class.ilCheckboxInputGUI.php";
     $cb = new ilCheckboxInputGUI($this->lng->txt("user_limited_access"), "limited_access");
     $this->addFilterItem($cb);
     $cb->readFromSession();
     $this->filter["limited_access"] = $cb->getChecked();
     // last login
     include_once "./Services/Form/classes/class.ilDateTimeInputGUI.php";
     $di = new ilDateTimeInputGUI($this->lng->txt("user_last_login_before"), "last_login");
     $default_date = new ilDateTime(time(), IL_CAL_UNIX);
     $default_date->increment(IL_CAL_DAY, 1);
     $di->setDate($default_date);
     $this->addFilterItem($di);
     $di->readFromSession();
     $this->filter["last_login"] = $di->getDate();
     if ($this->getMode() == self::MODE_USER_FOLDER) {
         // no assigned courses
         include_once "./Services/Form/classes/class.ilCheckboxInputGUI.php";
         $cb = new ilCheckboxInputGUI($this->lng->txt("user_no_courses"), "no_courses");
         $this->addFilterItem($cb);
         $cb->readFromSession();
         $this->filter["no_courses"] = $cb->getChecked();
         // no assigned groups
         include_once "./Services/Form/classes/class.ilCheckboxInputGUI.php";
         $ng = new ilCheckboxInputGUI($this->lng->txt("user_no_groups"), "no_groups");
         $this->addFilterItem($ng);
         $ng->readFromSession();
         $this->filter['no_groups'] = $ng->getChecked();
         // course/group members
         include_once "./Services/Form/classes/class.ilRepositorySelectorInputGUI.php";
         $rs = new ilRepositorySelectorInputGUI($lng->txt("user_member_of_course_group"), "course_group");
         $rs->setSelectText($lng->txt("user_select_course_group"));
         $rs->setHeaderMessage($lng->txt("user_please_select_course_group"));
         $rs->setClickableTypes(array("crs", "grp"));
         $this->addFilterItem($rs);
         $rs->readFromSession();
         $this->filter["course_group"] = $rs->getValue();
     }
     // global roles
     $options = array("" => $lng->txt("user_any"));
     $roles = $rbacreview->getRolesByFilter(2, $ilUser->getId());
     foreach ($roles as $role) {
         $options[$role["rol_id"]] = $role["title"];
     }
     $si = new ilSelectInputGUI($this->lng->txt("user_global_role"), "global_role");
     $si->setOptions($options);
     $this->addFilterItem($si);
     $si->readFromSession();
     $this->filter["global_role"] = $si->getValue();
 }