forked from ILIAS-eLearning/ILIAS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclass.ilLMPageGUI.php
More file actions
122 lines (104 loc) · 3.7 KB
/
class.ilLMPageGUI.php
File metadata and controls
122 lines (104 loc) · 3.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<?php
/* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
include_once("./Services/COPage/classes/class.ilPageObjectGUI.php");
include_once("./Modules/LearningModule/classes/class.ilLMPage.php");
/**
* Extension of ilPageObjectGUI for learning modules
*
* @author Alex Killing <alex.killing@gmx.de>
* @version $Id$
* @ilCtrl_Calls ilLMPageGUI: ilPageEditorGUI, ilObjectMetaDataGUI, ilEditClipboardGUI, ilMediaPoolTargetSelector, ilCommonActionDispatcherGUI, ilPageObjectGUI
* @ilCtrl_Calls ilLMPageGUI: ilNewsItemGUI, ilQuestionEditGUI, ilAssQuestionFeedbackEditingGUI, ilPageMultiLangGUI, ilPropertyFormGUI, ilPCPluggedGUI
* @ingroup ModuleLearningModule
*/
class ilLMPageGUI extends ilPageObjectGUI
{
/**
* @var ilDB
*/
protected $db;
/**
* Constructor
*/
function __construct($a_id = 0, $a_old_nr = 0, $a_prevent_get_id = false, $a_lang = "")
{
global $DIC;
$this->lng = $DIC->language();
$this->user = $DIC->user();
$this->db = $DIC->database();
$this->plugin_admin = $DIC["ilPluginAdmin"];
$this->log = $DIC["ilLog"];
parent::__construct("lm", $a_id, $a_old_nr, $a_prevent_get_id, $a_lang);
include_once("./Modules/LearningModule/classes/class.ilObjContentObject.php");
$this->getPageConfig()->setUseStoredQuestionTries(ilObjContentObject::_lookupStoreTries($this->getPageObject()->getParentId()));
}
/**
* On feedback editing forwarding
*/
function onFeedbackEditingForwarding()
{
$lng = $this->lng;
if (strtolower($_GET["cmdClass"]) == "ilassquestionfeedbackeditinggui")
{
include_once("./Modules/LearningModule/classes/class.ilObjContentObject.php");
if (ilObjContentObject::_lookupDisableDefaultFeedback($this->getPageObject()->getParentId()))
{
ilUtil::sendInfo($lng->txt("cont_def_feedb_deactivated"));
}
else
{
ilUtil::sendInfo($lng->txt("cont_def_feedb_activated"));
}
}
}
/**
* Process answer
*/
function processAnswer()
{
$ilUser = $this->user;
$ilDB = $this->db;
$lng = $this->lng;
$ilPluginAdmin = $this->plugin_admin;
$ilLog = $this->log;
parent::processAnswer();
//
// Send notifications to authors that want to be informed on blocked users
//
$parent_id = ilPageObject::lookupParentId((int) $_GET["page_id"], "lm");
// is restriction mode set?
include_once("./Modules/LearningModule/classes/class.ilObjContentObject.php");
if (ilObjContentObject::_lookupRestrictForwardNavigation($parent_id))
{
// check if user is blocked
$id = ilUtil::stripSlashes($_POST["id"]);
include_once("./Services/COPage/classes/class.ilPageQuestionProcessor.php");
$as = ilPageQuestionProcessor::getAnswerStatus($id, $ilUser->getId());
// get question information
include_once("./Modules/TestQuestionPool/classes/class.ilAssQuestionList.php");
$qlist = new ilAssQuestionList($ilDB, $lng, $ilPluginAdmin);
$qlist->setParentObjId(0);
$qlist->setJoinObjectData(false);
$qlist->addFieldFilter("question_id", array($id));
$qlist->load();
$qdata = $qlist->getQuestionDataArray();
// has the user been blocked?
if ($as["try"] >= $qdata[$as["qst_id"]]["nr_of_tries"] && $qdata[$as["qst_id"]]["nr_of_tries"] > 0 && !$as["passed"])
{
include_once "./Services/Notification/classes/class.ilNotification.php";
$users = ilNotification::getNotificationsForObject(ilNotification::TYPE_LM_BLOCKED_USERS, $parent_id);
if (count($users) > 0)
{
include_once("./Modules/LearningModule/classes/class.ilLMMailNotification.php");
$not = new ilLMMailNotification();
$not->setType(ilLMMailNotification::TYPE_USER_BLOCKED);
$not->setQuestionId($id);
$not->setRefId((int) $_GET["ref_id"]);
$not->setRecipients($users);
$not->send();
}
}
}
}
}
?>