34     public function init(): void
    38         $this->
lng = $DIC->language();
    39         $this->
ctrl = $DIC->ctrl();
    40         $this->
user = $DIC->user();
    47             $this->
getChildNode()->setAttribute(
"QRef", $a_questionreference);
    80         $duplicate_id = $question->copyObject(0, $question->getTitle());
    82         $duplicate->setObjId(0);
    86         $this->
getChildNode()->setAttribute(
"QRef", 
"il__qst_" . $duplicate_id);
    91         return array(
"ed_insert_pcqst", 
"empty_question", 
"pc_qst");
   105         $ilDB = $DIC->database();
   108             "DELETE FROM page_question WHERE page_parent_type = %s " .
   109             " AND page_id = %s AND page_lang = %s",
   110             array(
"text", 
"integer", 
"text"),
   115         $nodes = $xpath->query(
'//Question');
   117         foreach ($nodes as $node) {
   118             $q_ref = $node->getAttribute(
"QRef");
   121             if (!($inst_id > 0)) {
   124                     $q_ids[$q_id] = $q_id;
   128         foreach ($q_ids as $qid) {
   133                 "page_id" => [
"integer", $a_page->
getId()],
   135                 "question_id" => [
"integer", $qid]
   147         $ilDB = $DIC->database();
   150             "DELETE FROM page_question WHERE page_parent_type = %s " .
   151             " AND page_id = %s AND page_lang = %s",
   152             array(
"text", 
"integer", 
"text"),
   158         string $a_parent_type,
   164         $ilDB = $DIC->database();
   166         $parent_type_array = explode(
':', $a_parent_type);
   169             "SELECT * FROM page_question WHERE page_parent_type = %s " .
   170             " AND page_id = %s AND page_lang = %s",
   171             array(
"text", 
"integer", 
"text"),
   172             array($parent_type_array[0], $a_page_id, $a_lang)
   176             $q_ids[] = $rec[
"question_id"];
   184         string $a_parent_type = 
""   188         $ilDB = $DIC->database();
   191             "SELECT * FROM page_question " .
   192             " WHERE question_id = " . 
$ilDB->quote($a_q_id, 
"integer")
   194         while ($rec = 
$ilDB->fetchAssoc($set)) {
   195             if ($a_parent_type == 
"" || $rec[
"page_parent_type"] == $a_parent_type) {
   196                 return array(
"page_id" => $rec[
"page_id"], 
"parent_type" => $rec[
"page_parent_type"]);
   205         bool $a_abstract_only = 
false   211         if ($this->
getPage()->getPageConfig()->getEnableSelfAssessment()) {
   215                 foreach ($q_ids as $q_id) {
   218                     if (is_object($q_gui->object) && !$q_gui->object->isComplete()) {
   219                         $a_output = str_replace(
   220                             "{{{{{Question;il__qst_" . $q_id . 
"}}}}}",
   221                             "<i>" . $lng->
txt(
"cont_empty_question") . 
"</i>",
   231                 if (!self::$initial_done) {
   232                     $a_output = 
"<script>var ScormApi=null; var questions = new Array();</script>" . $a_output;
   233                     self::$initial_done = 
true;
   238             $qhtml = $this->
getPage()->getPageConfig()->getQuestionHTML();
   241             if (!is_array($qhtml) || count($qhtml) == 0) {
   245                     foreach ($q_ids as $k) {
   246                         $a_output = str_replace(
"{{{{{Question;il__qst_$k" . 
"}}}}}", 
" " . $lng->
txt(
"copg_questions_not_supported_here"), $a_output);
   252         if (is_array($qhtml)) {
   253             foreach ($qhtml as $k => $h) {
   254                 $a_output = str_replace(
"{{{{{Question;il__qst_$k" . 
"}}}}}", 
" " . $h, $a_output);
   266         self::$initial_done = 
false;
   273         if ($this->
getPage()->getPageConfig()->getEnableSelfAssessment()) {
   274             $js_files[] = 
"./Modules/Scorm2004/scripts/questions/pure.js";
   275             $js_files[] = 
"./Modules/Scorm2004/scripts/questions/question_handling.js";
   276             $js_files[] = 
'Modules/TestQuestionPool/js/ilAssMultipleChoice.js';
   277             $js_files[] = 
"Modules/TestQuestionPool/js/ilMatchingQuestion.js";
   281                 $js_files = array_merge($js_files, $qstGui->getPresentationJavascripts());
   286             && $a_mode != 
"offline") {
   287             $js_files[] = 
"./Services/COPage/js/ilCOPageQuestionHandler.js";
   295         if ($this->
getPage()->getPageConfig()->getEnableSelfAssessment()) {
   296             return array(
"./Modules/Scorm2004/templates/default/question_handling.css",
   297                 "Modules/TestQuestionPool/templates/default/test_javascript.css");
   309         if ($this->
getPage()->getPageConfig()->getEnableSelfAssessment()) {
   311                 && $a_mode != 
"offline" && $a_mode !== 
"edit") {
   312                 $ilCtrl->setParameterByClass(strtolower(get_class($this->
getPage())) . 
"gui", 
"page_id", $this->
getPage()->
getId());
   313                 $url = $ilCtrl->getLinkTargetByClass(strtolower(get_class($this->
getPage())) . 
"gui", 
"processAnswer", 
"", 
true, 
false);
   314                 $code[] = 
"ilCOPageQuestionHandler.initCallback('" . 
$url . 
"');";
   317             if ($this->
getPage()->getPageConfig()->getDisableDefaultQuestionFeedback()) {
   318                 $code[] = 
"ilias.questions.default_feedback = false;";
   321             $code[] = self::getJSTextInitCode($this->
getPage()->getPageConfig()->getLocalizationLanguage()) . 
' il.COPagePres.updateQuestionOverviews();';
   327         foreach ($q_ids as $q_id) {
   328             $code[] = 
"if (typeof renderILQuestion$q_id === 'function') {renderILQuestion$q_id();}";
   332         $get_stored_tries = $this->
getPage()->getPageConfig()->getUseStoredQuestionTries();
   333         if ($get_stored_tries) {
   334             if (count($q_ids) > 0) {
   335                 foreach ($q_ids as $q_id) {
   337                     $code[] = 
"ilias.questions.initAnswer(" . $q_id . 
", " . (
int) ($as[
"try"] ?? 0) . 
", " . ($as[
"passed"] ? 
"true" : 
"null") . 
");";
   351         $lng = $DIC->language();
   352         $ilUser = $DIC->user();
   355             $a_lang = $ilUser->getLanguage();
   360                         ilias.questions.txt.wrong_answers = "' . $lng->
txtlng(
"content", 
"cont_wrong_answers", $a_lang) . 
'";   361                         ilias.questions.txt.wrong_answers_single = "' . $lng->
txtlng(
"content", 
"cont_wrong_answers_single", $a_lang) . 
'";   362                         ilias.questions.txt.tries_remaining = "' . $lng->
txtlng(
"content", 
"cont_tries_remaining", $a_lang) . 
'";   363                         ilias.questions.txt.please_try_again = "' . $lng->
txtlng(
"content", 
"cont_please_try_again", $a_lang) . 
'";   364                         ilias.questions.txt.all_answers_correct = "' . $lng->
txtlng(
"content", 
"cont_all_answers_correct", $a_lang) . 
'";   365                         ilias.questions.txt.enough_answers_correct = "' . $lng->
txtlng(
"content", 
"cont_enough_answers_correct", $a_lang) . 
'";   366                         ilias.questions.txt.nr_of_tries_exceeded = "' . $lng->
txtlng(
"content", 
"cont_nr_of_tries_exceeded", $a_lang) . 
'";   367                         ilias.questions.txt.correct_answers_separator = "' . $lng->
txtlng(
"assessment", 
"or", $a_lang) . 
'";   368                         ilias.questions.txt.correct_answers_shown = "' . $lng->
txtlng(
"content", 
"cont_correct_answers_shown", $a_lang) . 
'";   369                         ilias.questions.txt.correct_answers_also = "' . $lng->
txtlng(
"content", 
"cont_correct_answers_also", $a_lang) . 
'";   370                         ilias.questions.txt.correct_answer_also = "' . $lng->
txtlng(
"content", 
"cont_correct_answer_also", $a_lang) . 
'";   371                         ilias.questions.txt.ov_all_correct = "' . $lng->
txtlng(
"content", 
"cont_ov_all_correct", $a_lang) . 
'";   372                         ilias.questions.txt.ov_some_correct = "' . $lng->
txtlng(
"content", 
"cont_ov_some_correct", $a_lang) . 
'";   373                         ilias.questions.txt.ov_wrong_answered = "' . $lng->
txtlng(
"content", 
"cont_ov_wrong_answered", $a_lang) . 
'";   374                         ilias.questions.txt.please_select = "' . $lng->
txtlng(
"content", 
"cont_please_select", $a_lang) . 
'";   375                         ilias.questions.txt.ov_preview = "' . $lng->
txtlng(
"content", 
"cont_ov_preview", $a_lang) . 
'";   376                         ilias.questions.txt.submit_answers = "' . $lng->
txtlng(
"content", 
"cont_submit_answers", $a_lang) . 
'";   377                         ilias.questions.refresh_lang();   382         bool $a_no_interaction,
   387         if (count($q_ids) > 0) {
   388             foreach ($q_ids as $q_id) {
   391                 if ($a_mode == 
"offline") {
   392                     if ($this->
getPage()->getParentType() == 
"sahs") {
   393                         $image_path = 
"./objects/";
   395                     if ($this->
getPage()->getParentType() == 
"lm") {
   396                         $image_path = 
"./assessment/0/" . $q_id . 
"/images/";
   399                 $js[$q_id] = $q_exporter->exportQuestion($q_id, $image_path, $a_mode);
   407         $dom = $this->
getPage()->getDomDoc();
   409         $nodes = $this->dom_util->path($dom, 
"//Question");
   410         foreach ($nodes as $node) {
   411             $qref = $node->getAttribute(
"QRef");
   415             if (!($inst_id > 0)) {
   426         bool $a_self_ass = 
true,
   427         bool $a_clone_mobs = 
false,
   428         int $new_parent_id = 0,
   433         $dom_util = $DIC->copage()->internal()->domain()->domUtil();
   438             $path = 
"//Question";
   440             foreach ($nodes as $node) {
   441                 $qref = $node->getAttribute(
"QRef");
   446                 if (!($inst_id > 0)) {
   454                         if (is_object($question) && $question->isComplete()) {
   458                                 $question->createPageObject();
   463                             $duplicate_id = $question->duplicate(
false);
   464                             $node->setAttribute(
"QRef", 
"il__qst_" . $duplicate_id);
   471             $path = 
"//Question";
   473             foreach ($nodes as $node) {
   474                 $parent = $node->parentNode;
   475                 $parent->parentNode->removeChild($parent);
 setType(string $a_type)
Set Type. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static bool $initial_done
 
init()
Init page content component. 
 
getQuestionJsOfPage(bool $a_no_interaction, string $a_mode)
 
txtlng(string $a_module, string $a_topic, string $a_language)
gets the text for a given topic in a given language if the topic is not in the list, the topic itself with "-" will be returned 
 
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
 
static _extractObjIdOfTarget(string $a_target)
Extract object id out of target. 
 
getCssFiles(string $a_mode)
 
copyPoolQuestionIntoPage(string $a_q_id, string $a_hier_id)
Copy question from pool into page. 
 
static _getPageForQuestionId(int $a_q_id, string $a_parent_type="")
 
static getAnswerStatus( $a_q_id, int $a_user_id=0)
 
modifyPageContentPostXsl(string $a_output, string $a_mode, bool $a_abstract_only=false)
 
static _getQuestionGUI(string $question_type='', int $question_id=-1)
Creates a question gui representation and returns the alias to the question gui. 
 
Content object of ilPageObject (see ILIAS DTD). 
 
getOnloadCode(string $a_mode)
 
static _extractInstOfTarget(string $a_target)
Extract installation id out of target. 
 
static getJSTextInitCode(string $a_lang)
Get js txt init code. 
 
static instantiateQuestion(int $question_id)
 
static afterPageUpdate(ilPageObject $a_page, DOMDocument $a_domdoc, string $a_xml, bool $a_creation)
After page has been updated (or created) 
 
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
create(ilPageObject $a_pg_obj, string $a_hier_id, string $a_pc_id="")
 
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD) 
 
getJavascriptFiles(string $a_mode)
 
setQuestionReference(string $a_questionreference)
 
static resetInitialState()
Reset initial state (for exports) 
 
static beforePageDelete(ilPageObject $a_page)
 
ILIAS COPage Dom DomUtil $dom_util
 
static handleCopiedContent(DOMDocument $a_domdoc, bool $a_self_ass=true, bool $a_clone_mobs=false, int $new_parent_id=0, int $obj_copy_id=0)
 
static _getQuestionIdsForPage(string $a_parent_type, int $a_page_id, string $a_lang="-")
 
static questionsJS(array $a_qids=null)
 
createInitialChildNode(string $hier_id, string $pc_id, string $child, array $child_attributes=[])