ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilPCQuestionOverview.php
Go to the documentation of this file.
1 <?php
2 
25 {
27 
28  public function init(): void
29  {
30  $this->setType("qover");
31  }
32 
33  public function setNode(php4DOMElement $a_node): void
34  {
35  parent::setNode($a_node); // this is the PageContent node
36  $this->qover_node = $a_node->first_child(); // this is the question overview node
37  }
38 
39  public function create(
40  ilPageObject $a_pg_obj,
41  string $a_hier_id,
42  string $a_pc_id = ""
43  ): void {
44  $this->node = $this->createPageContentNode();
45  $a_pg_obj->insertContent($this, $a_hier_id, IL_INSERT_AFTER, $a_pc_id);
46  $this->qover_node = $this->dom->create_element("QuestionOverview");
47  $this->qover_node = $this->node->append_child($this->qover_node);
48  $this->qover_node->set_attribute("ShortMessage", "y");
49  }
50 
54  public function setShortMessage(bool $a_val): void
55  {
56  if ($a_val) {
57  $this->qover_node->set_attribute("ShortMessage", "y");
58  } else {
59  if ($this->qover_node->has_attribute("ShortMessage")) {
60  $this->qover_node->remove_attribute("ShortMessage");
61  }
62  }
63  }
64 
65  public function getShortMessage(): bool
66  {
67  if (is_object($this->qover_node)) {
68  if ($this->qover_node->get_attribute("ShortMessage") == "y") {
69  return true;
70  }
71  }
72  return false;
73  }
74 
75  public function setListWrongQuestions(bool $a_val): void
76  {
77  if ($a_val) {
78  $this->qover_node->set_attribute("ListWrongQuestions", "y");
79  } else {
80  if ($this->qover_node->has_attribute("ListWrongQuestions")) {
81  $this->qover_node->remove_attribute("ListWrongQuestions");
82  }
83  }
84  }
85 
86  public function getListWrongQuestions(): bool
87  {
88  if (is_object($this->qover_node)) {
89  if ($this->qover_node->get_attribute("ListWrongQuestions") == "y") {
90  return true;
91  }
92  }
93  return false;
94  }
95 }
setType(string $a_type)
Set Type.
create(ilPageObject $a_pg_obj, string $a_hier_id, string $a_pc_id="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
php4DomElement
insertContent(ilPageContent $a_cont_obj, string $a_pos, int $a_mode=IL_INSERT_AFTER, string $a_pcid="", bool $remove_placeholder=true)
insert a content node before/after a sibling or as first child of a parent
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)
const IL_INSERT_AFTER
createPageContentNode(bool $a_set_this_node=true)
Create page content node (always use this method first when adding a new element) ...
setNode(php4DOMElement $a_node)
setShortMessage(bool $a_val)
Set short message.