ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
class.ilLMPageGUI.php
Go to the documentation of this file.
1<?php
2
20use ILIAS\Refinery\Factory as Refinery;
21
30{
31 protected ilDBInterface $db;
33 protected Refinery $refinery;
35
36 public function __construct(
37 int $a_id = 0,
38 int $a_old_nr = 0,
39 bool $a_prevent_get_id = false,
40 string $a_lang = "",
41 string $concrete_lang = ""
42 ) {
43 global $DIC;
44 $this->lng = $DIC->language();
45 $this->user = $DIC->user();
46 $this->db = $DIC->database();
47 $this->refinery = $DIC['refinery'];
48 $this->component_repository = $DIC['component.repository'];
49
50 $this->log = $DIC["ilLog"];
51 parent::__construct("lm", $a_id, $a_old_nr, $a_prevent_get_id, $a_lang, $concrete_lang);
52 $this->pres_request = $DIC
53 ->learningModule()
54 ->internal()
55 ->gui()
56 ->presentation()
57 ->request();
58
59 $this->getPageConfig()->setUseStoredQuestionTries(ilObjContentObject::_lookupStoreTries($this->getPageObject()->getParentId()));
60 }
61
65 public function onFeedbackEditingForwarding(): void
66 {
68
69 if (strtolower($this->ctrl->getCmdClass()) == "ilassquestionfeedbackeditinggui") {
71 $this->tpl->setOnScreenMessage('info', $lng->txt("cont_def_feedb_deactivated"));
72 } else {
73 $this->tpl->setOnScreenMessage('info', $lng->txt("cont_def_feedb_activated"));
74 }
75 }
76 }
77
81 public function processAnswer(): void
82 {
83 $ilUser = $this->user;
88
89 parent::processAnswer();
90
91 //
92 // Send notifications to authors that want to be informed on blocked users
93 //
94
96 $this->pres_request->getQuestionPageId(),
97 "lm"
98 );
99
100 // is restriction mode set?
102 // check if user is blocked
103 $id = ilUtil::stripSlashes($this->pres_request->getQuestionId());
104
105 $as = ilPageQuestionProcessor::getAnswerStatus($id, $ilUser->getId());
106 // get question information
108 $qlist->setParentObjId(0);
109 $qlist->setJoinObjectData(false);
110 $qlist->addFieldFilter("question_id", array($id));
111 $qlist->load();
112 $qdata = $qlist->getQuestionDataArray();
113 // has the user been blocked?
114 if ($as["try"] >= $qdata[$as["qst_id"]]["nr_of_tries"] && $qdata[$as["qst_id"]]["nr_of_tries"] > 0 && !$as["passed"]) {
116
117 if (count($users) > 0) {
118 $not = new ilLMMailNotification();
120 $not->setQuestionId($id);
121 $not->setRefId($this->pres_request->getRefId());
122 $not->setRecipients($users);
123 $not->send();
124 }
125 }
126 }
127 }
128
129 public function finishEditing(): void
130 {
131 $lm_tree = new ilLMTree($this->getPageObject()->getParentId());
132 if ($lm_tree->isInTree($this->getPageObject()->getId())) {
133 $parent_id = $lm_tree->getParentId($this->getPageObject()->getId());
134 $this->ctrl->setParameterByClass(
135 ilStructureObjectGUI::class,
136 "obj_id",
137 $parent_id
138 );
139 $this->ctrl->redirectByClass([
140 ilObjLearningModuleGUI::class,
141 ilStructureObjectGUI::class
142 ], "view");
143 }
144 $this->ctrl->redirectByClass(
145 ilObjLearningModuleGUI::class,
146 "pages"
147 );
148 }
149}
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