/**
  * Get questions
  *
  * @param
  * @return
  */
 function getQuestions()
 {
     global $ilAccess, $ilDB, $lng, $ilPluginAdmin;
     include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
     $all_types = ilObjQuestionPool::_getSelfAssessmentQuestionTypes();
     $all_ids = array();
     foreach ($all_types as $k => $v) {
         $all_ids[] = $v["question_type_id"];
     }
     $questions = array();
     if ($ilAccess->checkAccess("read", "", $this->pool_ref_id)) {
         require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
         $questionList = new ilAssQuestionList($ilDB, $lng, $ilPluginAdmin, $this->pool_obj_id);
         $questionList->load();
         $data = $questionList->getQuestionDataArray();
         $questions = array();
         foreach ($data as $d) {
             // list only self assessment question types
             if (in_array($d["question_type_fi"], $all_ids)) {
                 $questions[] = $d;
             }
         }
     }
     $this->setData($questions);
 }
 private function showSkillQuestionAssignmentsCmd()
 {
     $this->handleAssignmentConfigurationHintMessage();
     $table = $this->buildTableGUI();
     $assignmentList = $this->buildSkillQuestionAssignmentList();
     $assignmentList->loadFromDb();
     $assignmentList->loadAdditionalSkillData();
     $table->setSkillQuestionAssignmentList($assignmentList);
     $table->setData($this->orderQuestionData($this->questionList->getQuestionDataArray()));
     $this->tpl->setContent($this->ctrl->getHTML($table));
 }
Ejemplo n.º 3
0
 /**
  * Process answer
  */
 function processAnswer()
 {
     global $ilUser, $ilDB, $lng, $ilPluginAdmin, $ilLog;
     parent::processAnswer();
     //
     // Send notifications to authors that want to be informed on blocked users
     //
     $parent_id = ilPageObject::lookupParentId((int) $_GET["page_id"], "lm");
     // is restriction mode set?
     include_once "./Modules/LearningModule/classes/class.ilObjContentObject.php";
     if (ilObjContentObject::_lookupRestrictForwardNavigation($parent_id)) {
         // check if user is blocked
         $id = ilUtil::stripSlashes($_POST["id"]);
         include_once "./Services/COPage/classes/class.ilPageQuestionProcessor.php";
         $as = ilPageQuestionProcessor::getAnswerStatus($id, $ilUser->getId());
         // get question information
         include_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionList.php";
         $qlist = new ilAssQuestionList($ilDB, $lng, $ilPluginAdmin);
         $qlist->setParentObjId(0);
         $qlist->addFieldFilter("question_id", array($id));
         $qlist->load();
         $qdata = $qlist->getQuestionDataArray();
         // has the user been blocked?
         if ($as["try"] >= $qdata[$as["qst_id"]]["nr_of_tries"] && $qdata[$as["qst_id"]]["nr_of_tries"] > 0 && !$as["passed"]) {
             include_once "./Services/Notification/classes/class.ilNotification.php";
             $users = ilNotification::getNotificationsForObject(ilNotification::TYPE_LM_BLOCKED_USERS, $parent_id);
             if (count($users) > 0) {
                 include_once "./Modules/LearningModule/classes/class.ilLMMailNotification.php";
                 $not = new ilLMMailNotification();
                 $not->setType(ilLMMailNotification::TYPE_USER_BLOCKED);
                 $not->setQuestionId($id);
                 $not->setRefId((int) $_GET["ref_id"]);
                 $not->setRecipients($users);
                 $not->send();
             }
         }
     }
 }
 /**
  * @param array $taxIds
  * @global ilRbacSystem  $rbacsystem
  * @global ilDB $ilDB
  * @global ilLanguage $lng
  * @global ilPluginAdmin $ilPluginAdmin
  * @return ilQuestionBrowserTableGUI
  */
 private function buildQuestionBrowserTableGUI($taxIds)
 {
     global $rbacsystem, $ilDB, $lng, $ilPluginAdmin;
     include_once "./Modules/TestQuestionPool/classes/tables/class.ilQuestionBrowserTableGUI.php";
     $table_gui = new ilQuestionBrowserTableGUI($this, 'questions', $rbacsystem->checkAccess('write', $_GET['ref_id']) ? true : false, false, $taxIds);
     $table_gui->setEditable($rbacsystem->checkAccess('write', $_GET['ref_id']));
     require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
     $questionList = new ilAssQuestionList($ilDB, $lng, $ilPluginAdmin, $this->object->getId());
     foreach ($table_gui->getFilterItems() as $item) {
         if (substr($item->getPostVar(), 0, strlen('tax_')) == 'tax_') {
             $v = $item->getValue();
             if (is_array($v) && count($v) && !(int) $v[0]) {
                 continue;
             }
             $taxId = substr($item->getPostVar(), strlen('tax_'));
             $questionList->addTaxonomyFilter($taxId, $item->getValue());
         } elseif ($item->getValue() !== false) {
             $questionList->addFieldFilter($item->getPostVar(), $item->getValue());
         }
     }
     if ($this->object->isNavTaxonomyActive() && (int) $_GET['tax_node']) {
         $questionList->addTaxonomyFilter($this->object->getNavTaxonomyId(), array((int) $_GET['tax_node']));
     }
     $questionList->load();
     $data = $questionList->getQuestionDataArray();
     $table_gui->setData($data);
     return $table_gui;
 }
 public function getAllQuestionsData()
 {
     return $this->completeQuestionList->getQuestionDataArray();
 }
 /**
  * @return array
  */
 private function getQuestionsData()
 {
     $questionList = new ilAssQuestionList($this->db, $this->lng, $this->pluginAdmin);
     $questionList->setQuestionInstanceTypeFilter($this->getQuestionInstanceTypeFilter());
     $questionList->setExcludeQuestionIdsFilter($this->testOBJ->getExistingQuestions());
     $repositoryRootNode = self::REPOSITORY_ROOT_NODE_ID;
     foreach ($this->getFilterItems() as $item) {
         if ($item->getValue() !== false) {
             switch ($item->getPostVar()) {
                 case 'title':
                 case 'description':
                 case 'author':
                 case 'type':
                 case 'parent_title':
                     $questionList->addFieldFilter($item->getPostVar(), $item->getValue());
                     break;
                 case 'repository_root_node':
                     $repositoryRootNode = $item->getValue();
             }
         }
     }
     $parentObjectIds = $this->getQuestionParentObjIds($repositoryRootNode);
     if (!count($parentObjectIds)) {
         return array();
     }
     $questionList->setParentObjIdsFilter($parentObjectIds);
     $questionList->load();
     return $questionList->getQuestionDataArray();
 }
Ejemplo n.º 7
0
 /**
  * Get blocked users information
  *
  * @param
  * @return
  */
 function getBlockedUsersInformation()
 {
     global $ilDB, $lng, $ilPluginAdmin, $ilUser;
     $blocked_users = array();
     // load question/pages information
     $this->page_questions = array();
     $this->all_questions = array();
     $page_for_question = array();
     include_once "./Modules/LearningModule/classes/class.ilLMPageObject.php";
     $q = ilLMPageObject::queryQuestionsOfLearningModule($this->lm_obj_id, "", "", 0, 0);
     foreach ($q["set"] as $quest) {
         $this->page_questions[$quest["page_id"]][] = $quest["question_id"];
         $this->all_questions[] = $quest["question_id"];
         $page_for_question[$quest["question_id"]] = $quest["page_id"];
     }
     // get question information
     include_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionList.php";
     $qlist = new ilAssQuestionList($ilDB, $lng, $ilPluginAdmin);
     $qlist->setParentObjId(0);
     $qlist->addFieldFilter("question_id", $this->all_questions);
     $qlist->load();
     $qdata = $qlist->getQuestionDataArray();
     // load question answer information
     include_once "./Services/COPage/classes/class.ilPageQuestionProcessor.php";
     $this->answer_status = ilPageQuestionProcessor::getAnswerStatus($this->all_questions);
     include_once "./Modules/LearningModule/classes/class.ilLMPageObject.php";
     foreach ($this->answer_status as $as) {
         if ($as["try"] >= $qdata[$as["qst_id"]]["nr_of_tries"] && $qdata[$as["qst_id"]]["nr_of_tries"] > 0 && !$as["passed"]) {
             //var_dump($qdata[$as["qst_id"]]);
             $name = ilObjUser::_lookupName($as["user_id"]);
             $as["user_name"] = $name["lastname"] . ", " . $name["firstname"] . " [" . $name["login"] . "]";
             $as["question_text"] = $qdata[$as["qst_id"]]["question_text"];
             $as["page_id"] = $page_for_question[$as["qst_id"]];
             $as["page_title"] = ilLMPageObject::_lookupTitle($as["page_id"]);
             $blocked_users[] = $as;
         }
     }
     return $blocked_users;
 }
 public function getFilteredQuestionsData()
 {
     return $this->filteredQuestionList->getQuestionDataArray();
 }
 private static function getQuestionData($testObjId, $questionIds)
 {
     global $ilDB, $lng, $ilPluginAdmin;
     require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
     $questionList = new ilAssQuestionList($ilDB, $lng, $ilPluginAdmin, $testObjId);
     $questionList->setQuestionInstanceTypeFilter(ilAssQuestionList::QUESTION_INSTANCE_TYPE_DUPLICATES);
     $questionList->setQuestionIdsFilter($questionIds);
     $questionList->load();
     return $questionList->getQuestionDataArray();
 }