コード例 #1
0
 /**
  * list questions of question pool
  */
 public function questionsObject($arrFilter = null)
 {
     global $rbacsystem;
     global $ilUser;
     global $ilToolbar;
     if (get_class($this->object) == "ilObjSurvey") {
         if ($_GET["calling_survey"] > 0 || $_GET["new_for_survey"] > 0) {
             $ref_id = $_GET["calling_survey"];
             if (!strlen($ref_id)) {
                 $ref_id = $_GET["new_for_survey"];
             }
             $addurl = "";
             if (strlen($_GET["new_for_survey"])) {
                 $addurl = "&new_id=" . $_GET["q_id"];
             }
             if ($_REQUEST["pgov"]) {
                 $addurl .= "&pgov=" . $_REQUEST["pgov"];
                 $addurl .= "&pgov_pos=" . $_REQUEST["pgov_pos"];
             }
             ilUtil::redirect("ilias.php?baseClass=ilObjSurveyGUI&ref_id=" . $ref_id . "&cmd=questions" . $addurl);
         }
     }
     $this->object->purgeQuestions();
     $_SESSION['q_id_table_nav'] = $_GET['q_id_table_nav'];
     if ($rbacsystem->checkAccess('write', $_GET['ref_id'])) {
         include_once "Services/Form/classes/class.ilSelectInputGUI.php";
         $qtypes = new ilSelectInputGUI("", "sel_question_types");
         $qtypes->setValue($ilUser->getPref("svy_lastquestiontype"));
         $ilToolbar->addInputItem($qtypes);
         $options = array();
         foreach (ilObjSurveyQuestionPool::_getQuestionTypes() as $translation => $data) {
             $options[$data["type_tag"]] = $translation;
         }
         $qtypes->setOptions($options);
         $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
         $ilToolbar->addFormButton($this->lng->txt("create"), "createQuestion");
         $ilToolbar->addSeparator();
         $ilToolbar->addFormButton($this->lng->txt('import'), 'importQuestions');
     }
     include_once "./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyQuestionsTableGUI.php";
     $table_gui = new ilSurveyQuestionsTableGUI($this, 'questions', $rbacsystem->checkAccess('write', $_GET['ref_id']) ? true : false);
     $table_gui->setEditable($rbacsystem->checkAccess('write', $_GET['ref_id']));
     $arrFilter = array();
     foreach ($table_gui->getFilterItems() as $item) {
         if ($item->getValue() !== false) {
             $arrFilter[$item->getPostVar()] = $item->getValue();
         }
     }
     $table_gui->setData($this->object->getQuestionsData($arrFilter));
     $this->tpl->setContent($table_gui->getHTML());
 }
 /**
  * Init filter
  */
 function initFilter()
 {
     global $lng, $rbacreview, $ilUser;
     // title
     include_once "./Services/Form/classes/class.ilTextInputGUI.php";
     $ti = new ilTextInputGUI($lng->txt("survey_question_title"), "title");
     $ti->setMaxLength(64);
     $ti->setValidationRegexp('/^[^%]+$/is');
     $ti->setSize(20);
     $this->addFilterItem($ti);
     $ti->readFromSession();
     $this->filter["title"] = $ti->getValue();
     // description
     $ti = new ilTextInputGUI($lng->txt("description"), "description");
     $ti->setMaxLength(64);
     $ti->setValidationRegexp('/^[^%]+$/is');
     $ti->setSize(20);
     $this->addFilterItem($ti);
     $ti->readFromSession();
     $this->filter["description"] = $ti->getValue();
     // author
     $ti = new ilTextInputGUI($lng->txt("author"), "author");
     $ti->setMaxLength(64);
     $ti->setValidationRegexp('/^[^%]+$/is');
     $ti->setSize(20);
     $this->addFilterItem($ti);
     $ti->readFromSession();
     $this->filter["author"] = $ti->getValue();
     // questiontype
     include_once "./Services/Form/classes/class.ilSelectInputGUI.php";
     include_once "./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
     $types = ilObjSurveyQuestionPool::_getQuestionTypes();
     $options = array();
     $options[""] = $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();
     // questionpool text
     $ti = new ilTextInputGUI($lng->txt("survey_question_pool_title"), "spl_txt");
     $ti->setMaxLength(64);
     $ti->setSize(20);
     $this->addFilterItem($ti);
     $ti->readFromSession();
     $this->filter["spl_txt"] = $ti->getValue();
     // questionpool select
     $options = array();
     $options[""] = $lng->txt('filter_all_questionpools');
     natcasesort($this->questionpools);
     foreach ($this->questionpools as $obj_id => $title) {
         $options[$obj_id] = $title;
     }
     $si = new ilSelectInputGUI($this->lng->txt("survey_available_question_pools"), "spl");
     $si->setOptions($options);
     $this->addFilterItem($si);
     $si->readFromSession();
     $this->filter["type"] = $si->getValue();
 }
コード例 #3
0
 /**
  * list questions of question pool
  */
 public function questionsObject($arrFilter = null)
 {
     global $rbacsystem;
     global $ilUser;
     global $ilToolbar;
     $this->object->purgeQuestions();
     $_SESSION['q_id_table_nav'] = $_GET['q_id_table_nav'];
     if ($rbacsystem->checkAccess('write', $_GET['ref_id'])) {
         include_once "Services/Form/classes/class.ilSelectInputGUI.php";
         $qtypes = new ilSelectInputGUI("", "sel_question_types");
         $qtypes->setValue($ilUser->getPref("svy_lastquestiontype"));
         $ilToolbar->addInputItem($qtypes);
         $options = array();
         foreach (ilObjSurveyQuestionPool::_getQuestionTypes() as $translation => $data) {
             $options[$data["type_tag"]] = $translation;
         }
         $qtypes->setOptions($options);
         $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
         include_once "Services/UIComponent/Button/classes/class.ilSubmitButton.php";
         $button = ilSubmitButton::getInstance();
         $button->setCaption("svy_create_question");
         $button->setCommand("createQuestion");
         $ilToolbar->addButtonInstance($button);
         $ilToolbar->addSeparator();
         $button = ilSubmitButton::getInstance();
         $button->setCaption("import");
         $button->setCommand("importQuestions");
         $ilToolbar->addButtonInstance($button);
     }
     include_once "./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyQuestionsTableGUI.php";
     $table_gui = new ilSurveyQuestionsTableGUI($this, 'questions', $rbacsystem->checkAccess('write', $_GET['ref_id']) ? true : false);
     $table_gui->setEditable($rbacsystem->checkAccess('write', $_GET['ref_id']));
     $arrFilter = array();
     foreach ($table_gui->getFilterItems() as $item) {
         if ($item->getValue() !== false) {
             $arrFilter[$item->getPostVar()] = $item->getValue();
         }
     }
     $table_gui->setData($this->object->getQuestionsData($arrFilter));
     $this->tpl->setContent($table_gui->getHTML());
 }