/** * called by prepare output */ function setTitleAndDescription() { parent::setTitleAndDescription(); if ($_GET["q_id"] > 0) { include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php"; $q_gui = assQuestionGUI::_getQuestionGUI("", $_GET["q_id"]); if ($q_gui->object instanceof assQuestion) { $q_gui->object->setObjId($this->object->getId()); $title = $q_gui->object->getTitle(); if (!$title) { $title = $this->lng->txt('new') . ': ' . assQuestion::_getQuestionTypeName($q_gui->object->getQuestionType()); } $this->tpl->setTitle($title); $this->tpl->setDescription($q_gui->object->getComment()); if ($this->object instanceof ilObjectPlugin) { $this->tpl->setTitleIcon($this->object->plugin->getImagePath("icon_" . $this->object->getType() . ".svg"), $this->lng->txt("obj_" . $this->object->getType())); } else { $this->tpl->setTitleIcon(ilObject::_getIcon("", "big", $this->object->getType())); } } else { // Workaround for context issues: If no object was found, redirect without q_id parameter $this->ctrl->setParameter($this, 'q_id', ''); $this->ctrl->redirect($this); } } else { $this->tpl->setTitle($this->object->getTitle()); $this->tpl->setDescription($this->object->getLongDescription()); $this->tpl->setTitleIcon(ilObject::_getIcon("", "big", $this->object->getType())); } }
private function loadQPList($qpItem) { $retval = array(); $curT = intval(time()); // $this->log(json_encode($qpItem)); // check predefined timings if (intval($qpItem["timing_type"]) == 0) { // ensure that the correct timings are used if (array_key_exists("start", $qpItem) && ($curT < intval($qpItem["start"]) || $curT > intval($qpItem["end"])) || array_key_exists("timing_start", $qpItem) && ($curT < intval($qpItem["timing_start"]) || $curT > intval($qpItem["timing_end"]))) { $this->log('bad timig, skip question pool'); return $retval; } } $questionPool = new ilObjQuestionPool($qpItem["ref_id"]); $questionPool->read(); // check online state if ($questionPool->getOnline() == 0) { $this->log('offline, skip question pool'); return $retval; } $questions = $questionPool->getQuestionList(); if (empty($questions)) { // ignore empty question pools return $retval; } // load the actual questions. if ($this->iliasVersion != "4.2") { $retval["questions"] = $this->getQuestionListNew($questions); } else { $retval["questions"] = $this->getQuestionListOld($questions); } $retval["id"] = $qpItem["ref_id"]; // pass only the reference id $retval["title"] = $questionPool->getTitle(); $retval["description"] = $questionPool->getDescription(); if (intval($qpItem["timing_type"]) == 0) { // pass the end-date on, so the remote broker can switch // the pool off if necessary. if (array_key_exists("end", $qpItem)) { $retval["end-date"] = intval($qpItem["end"]); } else { if (array_key_exists("timing_end", $qpItem)) { $retval["end-date"] = intval($qpItem["timing_end"]); } } } return $retval; }