ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilLMPageGUI.php
Go to the documentation of this file.
1<?php
2
20
21use ILIAS\Refinery\Factory as Refinery;
22
31{
32 protected ilDBInterface $db;
34 protected Refinery $refinery;
36
37 public function __construct(
38 int $a_id = 0,
39 int $a_old_nr = 0,
40 bool $a_prevent_get_id = false,
41 string $a_lang = "",
42 string $concrete_lang = ""
43 ) {
44 global $DIC;
45 $this->lng = $DIC->language();
46 $this->user = $DIC->user();
47 $this->db = $DIC->database();
48 $this->refinery = $DIC['refinery'];
49 $this->component_repository = $DIC['component.repository'];
50
51 $this->log = $DIC["ilLog"];
52 parent::__construct("lm", $a_id, $a_old_nr, $a_prevent_get_id, $a_lang, $concrete_lang);
53 $this->pres_request = $DIC
54 ->learningModule()
55 ->internal()
56 ->gui()
57 ->presentation()
58 ->request();
59
60 $this->getPageConfig()->setUseStoredQuestionTries(ilObjContentObject::_lookupStoreTries($this->getPageObject()->getParentId()));
61 }
62
66 public function onFeedbackEditingForwarding(): void
67 {
69
70 if (strtolower($this->ctrl->getCmdClass()) == "ilassquestionfeedbackeditinggui") {
72 $this->tpl->setOnScreenMessage('info', $lng->txt("cont_def_feedb_deactivated"));
73 } else {
74 $this->tpl->setOnScreenMessage('info', $lng->txt("cont_def_feedb_activated"));
75 }
76 }
77 }
78
82 public function processAnswer(): void
83 {
84 $ilUser = $this->user;
89
90 parent::processAnswer();
91
92 //
93 // Send notifications to authors that want to be informed on blocked users
94 //
95
97 $this->pres_request->getQuestionPageId(),
98 "lm"
99 );
100
101 // is restriction mode set?
103 // check if user is blocked
104 $id = ilUtil::stripSlashes($this->pres_request->getQuestionId());
105
106 $as = ilPageQuestionProcessor::getAnswerStatus($id, $ilUser->getId());
107 // get question information
109 $qlist->setParentObjId(0);
110 $qlist->setJoinObjectData(false);
111 $qlist->addFieldFilter("question_id", array($id));
112 $qlist->load();
113 $qdata = $qlist->getQuestionDataArray();
114 // has the user been blocked?
115 if ($as["try"] >= $qdata[$as["qst_id"]]["nr_of_tries"] && $qdata[$as["qst_id"]]["nr_of_tries"] > 0 && !$as["passed"]) {
117
118 if (count($users) > 0) {
119 $not = new ilLMMailNotification();
121 $not->setQuestionId($id);
122 $not->setRefId($this->pres_request->getRefId());
123 $not->setRecipients($users);
124 $not->send();
125 }
126 }
127 }
128 }
129
130 public function finishEditing(): void
131 {
132 $lm_tree = new ilLMTree($this->getPageObject()->getParentId());
133 if ($lm_tree->isInTree($this->getPageObject()->getId())) {
134 $parent_id = $lm_tree->getParentId($this->getPageObject()->getId());
135 $this->ctrl->setParameterByClass(
136 ilStructureObjectGUI::class,
137 "obj_id",
138 $parent_id
139 );
140 $this->ctrl->redirectByClass([
141 ilObjLearningModuleGUI::class,
142 ilStructureObjectGUI::class
143 ], "view");
144 }
145 $this->ctrl->redirectByClass(
146 ilObjLearningModuleGUI::class,
147 "pages"
148 );
149 }
150}
Builds data types.
Definition: Factory.php:36
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Extension of ilPageObjectGUI for learning modules.
PresentationGUIRequest $pres_request
Refinery $refinery
onFeedbackEditingForwarding()
On feedback editing forwarding.
ilDBInterface $db
processAnswer()
Process answer.
__construct(int $a_id=0, int $a_old_nr=0, bool $a_prevent_get_id=false, string $a_lang="", string $concrete_lang="")
ilComponentRepository $component_repository
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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 getNotificationsForObject(int $type, int $id, ?int $page_id=null, bool $ignore_threshold=false)
Get all users/recipients for given object.
static _lookupStoreTries(int $a_id)
static _lookupDisableDefaultFeedback(int $a_id)
static _lookupRestrictForwardNavigation(int $a_obj_id)
Class ilPageObjectGUI.
static lookupParentId(int $a_id, string $a_type)
static getAnswerStatus( $a_q_id, int $a_user_id=0)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
Readable part of repository interface to ilComponentDataDB.
Interface ilDBInterface.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26