ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilPCQuestion Class Reference

Class ilPCQuestion. More...

+ Inheritance diagram for ilPCQuestion:
+ Collaboration diagram for ilPCQuestion:

Public Member Functions

 init ()
 Init page content component. More...
 
 setNode ($a_node)
 Set node. More...
 
 setQuestionReference ($a_questionreference)
 Set Question Reference. More...
 
 getQuestionReference ()
 Get Question Reference. More...
 
 create (&$a_pg_obj, $a_hier_id)
 Create Question Element. More...
 
 copyPoolQuestionIntoPage ($a_q_id, $a_hier_id)
 Copy question from pool into page. More...
 
 modifyPageContentPostXsl ($a_output, $a_mode, $a_abstract_only=false)
 
 getJavascriptFiles ($a_mode)
 Get Javascript files. More...
 
 getCssFiles ($a_mode)
 Get css files. More...
 
 getOnloadCode ($a_mode)
 Get on load code. More...
 
 getQuestionJsOfPage ($a_no_interaction, $a_mode)
 Get question js. More...
 
- Public Member Functions inherited from ilPageContent
 __construct ($a_pg_obj)
 Constructor. More...
 
 setPage ($a_val)
 Set page. More...
 
 getPage ()
 Get page. More...
 
 init ()
 Init object. More...
 
 getType ()
 Get type of page content. More...
 
 setNode ($a_node)
 Set xml node of page content. More...
 
getNode ()
 Get xml node of page content. More...
 
 getJavascriptFiles ($a_mode)
 Get Javascript files. More...
 
 getCssFiles ($a_mode)
 Get css files. More...
 
 getOnloadCode ($a_mode)
 Get on load code. More...
 
 setHierId ($a_hier_id)
 Set hierarchical ID in xml structure. More...
 
 getHierId ()
 Get hierarchical id. More...
 
 lookupHierId ()
 Get hierarchical id from dom. More...
 
 readHierId ()
 Read PC Id. More...
 
 setPcId ($a_pcid)
 Set PC Id. More...
 
 getPCId ()
 Get PC Id. More...
 
 setFileDownloadLink ($a_download_link)
 Set file download link. More...
 
 getFileDownloadLink ()
 Get file download link. More...
 
 setProfileBackUrl ($url)
 
 getProfileBackUrl ()
 
 setFullscreenLink ($a_fullscreen_link)
 Set fullscreen link. More...
 
 getFullscreenLink ()
 Get fullscreen link. More...
 
 setSourcecodeDownloadScript ($script_name)
 Set sourcecode download script. More...
 
 getSourcecodeDownloadScript ()
 Get sourcecode download script. More...
 
 readPCId ()
 Read PC Id. More...
 
 writePCId ($a_pc_id)
 Write pc id. More...
 
 setEnabled ($value)
 Set Enabled value for page content component. More...
 
 enable ()
 Enable page content. More...
 
 disable ()
 Disable page content. More...
 
 isEnabled ()
 Check whether page content is enabled. More...
 
 createPageContentNode ($a_set_this_node=true)
 Create page content node (always use this method first when adding a new element) More...
 
 modifyPageContentPostXsl ($a_output, $a_mode, $a_abstract_only=false)
 Modify page content after xsl. More...
 
 getModel ()
 Get model. More...
 

Static Public Member Functions

static getLangVars ()
 Get lang vars needed for editing. More...
 
static afterPageUpdate ($a_page, DOMDocument $a_domdoc, $a_xml, $a_creation)
 After page has been updated (or created) More...
 
static beforePageDelete ($a_page)
 Before page is being deleted. More...
 
static _getQuestionIdsForPage ($a_parent_type, $a_page_id, $a_lang="-")
 Get all questions of a page. More...
 
static _getPageForQuestionId ($a_q_id, $a_parent_type="")
 Get page for question id. More...
 
static resetInitialState ()
 Reset initial state (for exports) More...
 
static getJSTextInitCode ($a_lang)
 Get js txt init code. More...
 
- Static Public Member Functions inherited from ilPageContent
static incEdId ($ed_id)
 Increases an hierarchical editing id at lowest level (last number) More...
 
static decEdId ($ed_id)
 Decreases an hierarchical editing id at lowest level (last number) More...
 
static haveSameContainer ($ed_id1, $ed_id2)
 Check, if two ids are in same container. More...
 
static sortHierIds ($a_array)
 Sort an array of Hier IDS in ascending order. More...
 
static isGreaterHierId ($a, $b)
 Check whether Hier ID $a is greater than Hier ID $b. More...
 
static getLangVars ()
 Get lang vars needed for editing. More...
 
static handleCopiedContent (DOMDocument $a_domdoc, $a_self_ass=true, $a_clone_mobs=false)
 Handle copied content. More...
 
static afterPageUpdate ($a_page, DOMDocument $a_domdoc, $a_xml, $a_creation)
 After page has been updated (or created) More...
 
static beforePageDelete ($a_page)
 Before page is being deleted. More...
 
static afterPageHistoryEntry ($a_page, DOMDocument $a_old_domdoc, $a_old_xml, $a_old_nr)
 After page history entry has been created. More...
 

Data Fields

 $dom
 
 $q_node
 
- Data Fields inherited from ilPageContent
 $hier_id
 
 $node
 
 $dom
 
 $page_lang
 

Protected Attributes

 $lng
 
 $ctrl
 
 $user
 
- Protected Attributes inherited from ilPageContent
 $profile_back_url
 
 $file_download_link
 
 $fullscreen_link
 
 $sourcecode_download_script
 
 $log
 

Static Protected Attributes

static $initial_done
 

Additional Inherited Members

- Protected Member Functions inherited from ilPageContent
 setType ($a_type)
 Set Type. More...
 

Detailed Description

Class ilPCQuestion.

Assessment Question of ilPageObject

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 18 of file class.ilPCQuestion.php.

Member Function Documentation

◆ _getPageForQuestionId()

static ilPCQuestion::_getPageForQuestionId (   $a_q_id,
  $a_parent_type = "" 
)
static

Get page for question id.

Parameters

Definition at line 279 of file class.ilPCQuestion.php.

References $DIC, and $ilDB.

Referenced by ilObjMediaObject\getParentObjectIdForUsage().

280  {
281  global $DIC;
282 
283  $ilDB = $DIC->database();
284 
285  $set = $ilDB->query(
286  "SELECT * FROM page_question " .
287  " WHERE question_id = " . $ilDB->quote($a_q_id, "integer")
288  );
289  while ($rec = $ilDB->fetchAssoc($set)) {
290  if ($a_parent_type == "" || $rec["page_parent_type"] == $a_parent_type) {
291  return array("page_id" => $rec["page_id"], "parent_type" => $rec["page_parent_type"]);
292  }
293  }
294  return false;
295  }
global $DIC
Definition: goto.php:24
global $ilDB
+ Here is the caller graph for this function:

◆ _getQuestionIdsForPage()

static ilPCQuestion::_getQuestionIdsForPage (   $a_parent_type,
  $a_page_id,
  $a_lang = "-" 
)
static

Get all questions of a page.

Definition at line 251 of file class.ilPCQuestion.php.

References $DIC, $ilDB, and $res.

Referenced by ilCOPageHTMLExport\collectPageElements(), ilSCORM2004Asset\exportHTMLPageObjects(), ilSCORM2004Asset\exportPDFPrepareXmlNFiles(), ilSCORM2004Asset\exportXMLPageObjects(), ilObjectivesAlignmentTableGUI\fillRow(), ilLMPageObject\getQuestionIds(), ilLearningModuleExporter\getXmlRepresentation(), and ilSCORM2004ScoGUI\sahs_questions().

252  {
253  global $DIC;
254 
255  $ilDB = $DIC->database();
256 
257  $parent_type_array = explode(':', $a_parent_type);
258 
259  $res = $ilDB->queryF(
260  "SELECT * FROM page_question WHERE page_parent_type = %s " .
261  " AND page_id = %s AND page_lang = %s",
262  array("text", "integer", "text"),
263  array($parent_type_array[0], $a_page_id, $a_lang)
264  );
265  $q_ids = array();
266  while ($rec = $ilDB->fetchAssoc($res)) {
267  $q_ids[] = $rec["question_id"];
268  }
269 
270  return $q_ids;
271  }
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
global $ilDB
+ Here is the caller graph for this function:

◆ afterPageUpdate()

static ilPCQuestion::afterPageUpdate (   $a_page,
DOMDocument  $a_domdoc,
  $a_xml,
  $a_creation 
)
static

After page has been updated (or created)

Parameters
objectpage object
DOMDocument$a_domdocdom document
stringxml
booltrue on creation, otherwise false

Definition at line 186 of file class.ilPCQuestion.php.

References $DIC, $ilDB, ilPageContent\$node, ilInternalLink\_extractInstOfTarget(), and ilInternalLink\_extractObjIdOfTarget().

187  {
188  global $DIC;
189 
190  $ilDB = $DIC->database();
191 
192  include_once("./Services/Link/classes/class.ilInternalLink.php");
193 
194  $ilDB->manipulateF(
195  "DELETE FROM page_question WHERE page_parent_type = %s " .
196  " AND page_id = %s AND page_lang = %s",
197  array("text", "integer", "text"),
198  array($a_page->getParentType(), $a_page->getId(), $a_page->getLanguage())
199  );
200 
201  $xpath = new DOMXPath($a_domdoc);
202  $nodes = $xpath->query('//Question');
203  $q_ids = array();
204  foreach ($nodes as $node) {
205  $q_ref = $node->getAttribute("QRef");
206 
207  $inst_id = ilInternalLink::_extractInstOfTarget($q_ref);
208  if (!($inst_id > 0)) {
210  if ($q_id > 0) {
211  $q_ids[$q_id] = $q_id;
212  }
213  }
214  }
215  foreach ($q_ids as $qid) {
216  $ilDB->replace(
217  "page_question",
218  [
219  "page_parent_type" => ["text", $a_page->getParentType()],
220  "page_id" => ["integer", $a_page->getId()],
221  "page_lang" => ["text", $a_page->getLanguage()],
222  "question_id" => ["integer", $qid]
223  ],
224  []
225  );
226  }
227  }
global $DIC
Definition: goto.php:24
global $ilDB
+ Here is the call graph for this function:

◆ beforePageDelete()

static ilPCQuestion::beforePageDelete (   $a_page)
static

Before page is being deleted.

Parameters
objectpage object

Definition at line 234 of file class.ilPCQuestion.php.

References $DIC, and $ilDB.

235  {
236  global $DIC;
237 
238  $ilDB = $DIC->database();
239 
240  $ilDB->manipulateF(
241  "DELETE FROM page_question WHERE page_parent_type = %s " .
242  " AND page_id = %s AND page_lang = %s",
243  array("text", "integer", "text"),
244  array($a_page->getParentType(), $a_page->getId(), $a_page->getLanguage())
245  );
246  }
global $DIC
Definition: goto.php:24
global $ilDB

◆ copyPoolQuestionIntoPage()

ilPCQuestion::copyPoolQuestionIntoPage (   $a_q_id,
  $a_hier_id 
)

Copy question from pool into page.

Parameters

Definition at line 105 of file class.ilPCQuestion.php.

References assQuestion\_instanciateQuestion(), and ilAssSelfAssessmentQuestionFormatter\prepareQuestionForLearningModule().

106  {
107  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
108  include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
109  $question = assQuestion::_instanciateQuestion($a_q_id);
110  $duplicate_id = $question->copyObject(0, $question->getTitle());
111  $duplicate = assQuestion::_instanciateQuestion($duplicate_id);
112  $duplicate->setObjId(0);
113 
114  /* PATCH-BEGIN: moved cleanup code to central place ilAssSelfAssessmentQuestionFormatter */
115  /*
116  // we remove everything not supported by the non-tiny self
117  // assessment question editor
118  $q = $duplicate->getQuestion();
119 
120  // we try to save all latex tags
121  $try = true;
122  $ls = '<span class="latex">';
123  $le = '</span>';
124  while ($try)
125  {
126  // search position of start tag
127  $pos1 = strpos($q, $ls);
128  if (is_int($pos1))
129  {
130  $pos2 = strpos($q, $le, $pos1);
131  if (is_int($pos2))
132  {
133  // both found: replace end tag
134  $q = substr($q, 0, $pos2)."[/tex]".substr($q, $pos2+7);
135  $q = substr($q, 0, $pos1)."[tex]".substr($q, $pos1+20);
136  }
137  else
138  {
139  $try = false;
140  }
141  }
142  else
143  {
144  $try = false;
145  }
146  }
147 
148  $tags = assQuestionGUI::getSelfAssessmentTags();
149  $tstr = "";
150  foreach ($tags as $t)
151  {
152  $tstr.="<".$t.">";
153  }
154  $q = ilUtil::secureString($q, true, $tstr);
155  // self assessment uses nl2br, not p
156  $duplicate->setQuestion($q);
157 
158  $duplicate->saveQuestionDataToDb();
159  */
160 
161  require_once 'Modules/TestQuestionPool/classes/questions/class.ilAssSelfAssessmentQuestionFormatter.php';
163 
164  /* PATCH-END: moved cleanup code to central place ilAssSelfAssessmentQuestionFormatter */
165 
166  $this->q_node->set_attribute("QRef", "il__qst_" . $duplicate_id);
167  }
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
+ Here is the call graph for this function:

◆ create()

ilPCQuestion::create ( $a_pg_obj,
  $a_hier_id 
)

Create Question Element.

Definition at line 90 of file class.ilPCQuestion.php.

References ilPageContent\createPageContentNode(), and IL_INSERT_AFTER.

91  {
92  $this->createPageContentNode();
93  $a_pg_obj->insertContent($this, $a_hier_id, IL_INSERT_AFTER);
94  $this->q_node = $this->dom->create_element("Question");
95  $this->q_node = $this->node->append_child($this->q_node);
96  $this->q_node->set_attribute("QRef", "");
97  }
const IL_INSERT_AFTER
createPageContentNode($a_set_this_node=true)
Create page content node (always use this method first when adding a new element) ...
+ Here is the call graph for this function:

◆ getCssFiles()

ilPCQuestion::getCssFiles (   $a_mode)

Get css files.

Definition at line 396 of file class.ilPCQuestion.php.

References ilPageContent\getPage().

397  {
398  if ($this->getPage()->getPageConfig()->getEnableSelfAssessment()) {
399  return array("./Modules/Scorm2004/templates/default/question_handling.css",
400  "Modules/TestQuestionPool/templates/default/test_javascript.css");
401  }
402  return array();
403  }
+ Here is the call graph for this function:

◆ getJavascriptFiles()

ilPCQuestion::getJavascriptFiles (   $a_mode)

Get Javascript files.

Definition at line 369 of file class.ilPCQuestion.php.

References assQuestionGUI\_getQuestionGUI(), ilPageContent\getPage(), and ilPageObjectGUI\PREVIEW.

370  {
371  $js_files = array();
372 
373  if ($this->getPage()->getPageConfig()->getEnableSelfAssessment()) {
374  $js_files[] = "./Modules/Scorm2004/scripts/questions/pure.js";
375  $js_files[] = "./Modules/Scorm2004/scripts/questions/question_handling.js";
376  $js_files[] = 'Modules/TestQuestionPool/js/ilAssMultipleChoice.js';
377  $js_files[] = "Modules/TestQuestionPool/js/ilMatchingQuestion.js";
378 
379  foreach ($this->getPage()->getQuestionIds() as $qId) {
380  $qstGui = assQuestionGUI::_getQuestionGUI('', $qId);
381  $js_files = array_merge($js_files, $qstGui->getPresentationJavascripts());
382  }
383  }
384 
385  if (!$this->getPage()->getPageConfig()->getEnableSelfAssessmentScorm() && $a_mode != ilPageObjectGUI::PREVIEW
386  && $a_mode != "offline") {
387  $js_files[] = "./Services/COPage/js/ilCOPageQuestionHandler.js";
388  }
389 
390  return $js_files;
391  }
static _getQuestionGUI($question_type, $question_id=-1)
Creates a question gui representation and returns the alias to the question gui note: please do not u...
+ Here is the call graph for this function:

◆ getJSTextInitCode()

static ilPCQuestion::getJSTextInitCode (   $a_lang)
static

Get js txt init code.

Parameters

Definition at line 450 of file class.ilPCQuestion.php.

References $DIC, $ilUser, and $lng.

Referenced by ilSCORM2004Asset\exportHTMLPageObjects().

451  {
452  global $DIC;
453 
454  $lng = $DIC->language();
455  $ilUser = $DIC->user();
456 
457  if ($a_lang == "") {
458  $a_lang = $ilUser->getLanguage();
459  }
460 
461  return
462  '
463  ilias.questions.txt.wrong_answers = "' . $lng->txtlng("content", "cont_wrong_answers", $a_lang) . '";
464  ilias.questions.txt.wrong_answers_single = "' . $lng->txtlng("content", "cont_wrong_answers_single", $a_lang) . '";
465  ilias.questions.txt.tries_remaining = "' . $lng->txtlng("content", "cont_tries_remaining", $a_lang) . '";
466  ilias.questions.txt.please_try_again = "' . $lng->txtlng("content", "cont_please_try_again", $a_lang) . '";
467  ilias.questions.txt.all_answers_correct = "' . $lng->txtlng("content", "cont_all_answers_correct", $a_lang) . '";
468  ilias.questions.txt.enough_answers_correct = "' . $lng->txtlng("content", "cont_enough_answers_correct", $a_lang) . '";
469  ilias.questions.txt.nr_of_tries_exceeded = "' . $lng->txtlng("content", "cont_nr_of_tries_exceeded", $a_lang) . '";
470  ilias.questions.txt.correct_answers_separator = "' . $lng->txtlng("assessment", "or", $a_lang) . '";
471  ilias.questions.txt.correct_answers_shown = "' . $lng->txtlng("content", "cont_correct_answers_shown", $a_lang) . '";
472  ilias.questions.txt.correct_answers_also = "' . $lng->txtlng("content", "cont_correct_answers_also", $a_lang) . '";
473  ilias.questions.txt.correct_answer_also = "' . $lng->txtlng("content", "cont_correct_answer_also", $a_lang) . '";
474  ilias.questions.txt.ov_all_correct = "' . $lng->txtlng("content", "cont_ov_all_correct", $a_lang) . '";
475  ilias.questions.txt.ov_some_correct = "' . $lng->txtlng("content", "cont_ov_some_correct", $a_lang) . '";
476  ilias.questions.txt.ov_wrong_answered = "' . $lng->txtlng("content", "cont_ov_wrong_answered", $a_lang) . '";
477  ilias.questions.txt.please_select = "' . $lng->txtlng("content", "cont_please_select", $a_lang) . '";
478  ilias.questions.txt.ov_preview = "' . $lng->txtlng("content", "cont_ov_preview", $a_lang) . '";
479  ilias.questions.txt.submit_answers = "' . $lng->txtlng("content", "cont_submit_answers", $a_lang) . '";
480  ilias.questions.refresh_lang();
481  ';
482  }
global $DIC
Definition: goto.php:24
$ilUser
Definition: imgupload.php:18
+ Here is the caller graph for this function:

◆ getLangVars()

static ilPCQuestion::getLangVars ( )
static

Get lang vars needed for editing.

Returns
array array of lang var keys

Definition at line 173 of file class.ilPCQuestion.php.

174  {
175  return array("ed_insert_pcqst", "empty_question", "pc_qst");
176  }

◆ getOnloadCode()

ilPCQuestion::getOnloadCode (   $a_mode)

Get on load code.

Definition at line 408 of file class.ilPCQuestion.php.

References $ctrl, $ilUser, $url, $user, ilPageQuestionProcessor\getAnswerStatus(), ilPageContent\getPage(), and ilPageObjectGUI\PREVIEW.

409  {
410  $ilCtrl = $this->ctrl;
412 
413  $code = array();
414 
415  if ($this->getPage()->getPageConfig()->getEnableSelfAssessment()) {
416  if (!$this->getPage()->getPageConfig()->getEnableSelfAssessmentScorm() && $a_mode != ilPageObjectGUI::PREVIEW
417  && $a_mode != "offline") {
418  $ilCtrl->setParameterByClass(strtolower(get_class($this->getPage())) . "gui", "page_id", $this->getPage()->getId());
419  $url = $ilCtrl->getLinkTargetByClass(strtolower(get_class($this->getPage())) . "gui", "processAnswer", "", true, false);
420  $code[] = "ilCOPageQuestionHandler.initCallback('" . $url . "');";
421  }
422 
423  if ($this->getPage()->getPageConfig()->getDisableDefaultQuestionFeedback()) {
424  $code[] = "ilias.questions.default_feedback = false;";
425  }
426 
427  $code[] = self::getJSTextInitCode($this->getPage()->getPageConfig()->getLocalizationLanguage()) . ' il.COPagePres.updateQuestionOverviews();';
428  }
429 
430  $get_stored_tries = $this->getPage()->getPageConfig()->getUseStoredQuestionTries();
431  if ($get_stored_tries) {
432  $q_ids = $this->getPage()->getQuestionIds();
433  if (count($q_ids) > 0) {
434  foreach ($q_ids as $q_id) {
435  include_once("./Services/COPage/classes/class.ilPageQuestionProcessor.php");
436  $as = ilPageQuestionProcessor::getAnswerStatus($q_id, $ilUser->getId());
437  $code[] = "ilias.questions.initAnswer(" . $q_id . ", " . (int) $as["try"] . ", " . ($as["passed"] ? "true" : "null") . ");";
438  }
439  }
440  }
441  return $code;
442  }
static getAnswerStatus($a_q_id, $a_user_id=0)
Get statistics for question.
$url
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

◆ getQuestionJsOfPage()

ilPCQuestion::getQuestionJsOfPage (   $a_no_interaction,
  $a_mode 
)

Get question js.

Definition at line 487 of file class.ilPCQuestion.php.

References ilPageContent\getPage().

Referenced by modifyPageContentPostXsl().

488  {
489  require_once './Modules/Scorm2004/classes/class.ilQuestionExporter.php';
490  $q_ids = $this->getPage()->getQuestionIds();
491  $js = array();
492  if (count($q_ids) > 0) {
493  foreach ($q_ids as $q_id) {
494  $q_exporter = new ilQuestionExporter($a_no_interaction);
495  $image_path = null;
496  if ($a_mode == "offline") {
497  if ($this->getPage()->getParentType() == "sahs") {
498  $image_path = "./objects/";
499  }
500  if ($this->getPage()->getParentType() == "lm") {
501  $image_path = "./assessment/0/" . $q_id . "/images/";
502  }
503  }
504 
505  $js[$q_id] = $q_exporter->exportQuestion($q_id, $image_path, $a_mode);
506  }
507  }
508  return $js;
509  }
Scorm 2004 Question Exporter.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getQuestionReference()

ilPCQuestion::getQuestionReference ( )

Get Question Reference.

Returns
string Question Reference

Definition at line 79 of file class.ilPCQuestion.php.

80  {
81  if (is_object($this->q_node)) {
82  return $this->q_node->get_attribute("QRef", $a_questionreference);
83  }
84  return false;
85  }

◆ init()

ilPCQuestion::init ( )

Init page content component.

Definition at line 43 of file class.ilPCQuestion.php.

References $DIC, ilPageContent\setType(), and user().

44  {
45  global $DIC;
46 
47  $this->lng = $DIC->language();
48  $this->ctrl = $DIC->ctrl();
49  $this->user = $DIC->user();
50  $this->setType("pcqst");
51  }
setType($a_type)
Set Type.
user()
Definition: user.php:4
global $DIC
Definition: goto.php:24
+ Here is the call graph for this function:

◆ modifyPageContentPostXsl()

ilPCQuestion::modifyPageContentPostXsl (   $a_output,
  $a_mode,
  $a_abstract_only = false 
)

Definition at line 300 of file class.ilPCQuestion.php.

References $lng, assQuestionGUI\_getQuestionGUI(), ilPageContent\getPage(), getQuestionJsOfPage(), and ilQuestionExporter\questionsJS().

301  {
302  $lng = $this->lng;
303 
304  $qhtml = "";
305 
306  if ($this->getPage()->getPageConfig()->getEnableSelfAssessment()) {
307  // #14154
308  $q_ids = $this->getPage()->getQuestionIds();
309  if (sizeof($q_ids)) {
310  include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
311  foreach ($q_ids as $q_id) {
312  $q_gui = assQuestionGUI::_getQuestionGUI("", $q_id);
313  // object check due to #16557
314  if (is_object($q_gui->object) && !$q_gui->object->isComplete()) {
315  $a_output = str_replace(
316  "{{{{{Question;il__qst_" . $q_id . "}}}}}",
317  "<i>" . $lng->txt("cont_empty_question") . "</i>",
318  $a_output
319  );
320  }
321  }
322 
323  // this exports the questions which is needed below
324  $qhtml = $this->getQuestionJsOfPage(($a_mode == "edit") ? true : false, $a_mode);
325 
326  require_once './Modules/Scorm2004/classes/class.ilQuestionExporter.php';
327  $a_output = "<script>" . ilQuestionExporter::questionsJS($q_ids) . "</script>" . $a_output;
328  if (!self::$initial_done) {
329  $a_output = "<script>var ScormApi=null; var questions = new Array();</script>" . $a_output;
330  self::$initial_done = true;
331  }
332  }
333  } else {
334  // set by T&A components
335  $qhtml = $this->getPage()->getPageConfig()->getQuestionHTML();
336 
337  // address #19788
338  if (!is_array($qhtml) || count($qhtml) == 0) {
339  // #14154
340  $q_ids = $this->getPage()->getQuestionIds();
341  if (sizeof($q_ids)) {
342  foreach ($q_ids as $k) {
343  $a_output = str_replace("{{{{{Question;il__qst_$k" . "}}}}}", " " . $lng->txt("copg_questions_not_supported_here"), $a_output);
344  }
345  }
346  }
347  }
348 
349  if (is_array($qhtml)) {
350  foreach ($qhtml as $k => $h) {
351  $a_output = str_replace("{{{{{Question;il__qst_$k" . "}}}}}", " " . $h, $a_output);
352  }
353  }
354 
355  return $a_output;
356  }
getQuestionJsOfPage($a_no_interaction, $a_mode)
Get question js.
static _getQuestionGUI($question_type, $question_id=-1)
Creates a question gui representation and returns the alias to the question gui note: please do not u...
static questionsJS(array $a_qids=null)
+ Here is the call graph for this function:

◆ resetInitialState()

static ilPCQuestion::resetInitialState ( )
static

Reset initial state (for exports)

Definition at line 361 of file class.ilPCQuestion.php.

Referenced by ILIAS\Portfolio\Export\PortfolioHtmlExport\getInitialisedTemplate(), ILIAS\Blog\Export\BlogHtmlExport\getInitialisedTemplate(), ILIAS\Glossary\Export\GlossaryHtmlExport\initScreen(), and ILIAS\LearningModule\Export\LMHtmlExport\initScreen().

362  {
363  self::$initial_done = false;
364  }
+ Here is the caller graph for this function:

◆ setNode()

ilPCQuestion::setNode (   $a_node)

Set node.

Definition at line 56 of file class.ilPCQuestion.php.

57  {
58  parent::setNode($a_node); // this is the PageContent node
59  $this->q_node = $a_node->first_child(); //... and this the Question
60  }

◆ setQuestionReference()

ilPCQuestion::setQuestionReference (   $a_questionreference)

Set Question Reference.

Parameters
string$a_questionreferenceQuestion Reference

Definition at line 67 of file class.ilPCQuestion.php.

68  {
69  if (is_object($this->q_node)) {
70  $this->q_node->set_attribute("QRef", $a_questionreference);
71  }
72  }

Field Documentation

◆ $ctrl

ilPCQuestion::$ctrl
protected

Definition at line 28 of file class.ilPCQuestion.php.

Referenced by getOnloadCode().

◆ $dom

ilPCQuestion::$dom

Definition at line 35 of file class.ilPCQuestion.php.

◆ $initial_done

ilPCQuestion::$initial_done
staticprotected

Definition at line 38 of file class.ilPCQuestion.php.

◆ $lng

ilPCQuestion::$lng
protected

Definition at line 23 of file class.ilPCQuestion.php.

Referenced by getJSTextInitCode(), and modifyPageContentPostXsl().

◆ $q_node

ilPCQuestion::$q_node

Definition at line 36 of file class.ilPCQuestion.php.

◆ $user

ilPCQuestion::$user
protected

Definition at line 33 of file class.ilPCQuestion.php.

Referenced by getOnloadCode().


The documentation for this class was generated from the following file: