ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilObjIndividualAssessmentGUI.php
Go to the documentation of this file.
1<?php
2
20require_once 'Services/Object/classes/class.ilObjectGUI.php';
21require_once 'Modules/IndividualAssessment/classes/class.ilIndividualAssessmentLP.php';
22require_once 'Services/Tracking/classes/class.ilObjUserTracking.php';
23
24
26{
27 const TAB_SETTINGS = 'settings';
28 const TAB_INFO = 'info_short';
29 const TAB_PERMISSION = 'perm_settings';
30 const TAB_MEMBERS = 'members';
31 const TAB_LP = 'learning_progress';
32 const TAB_EXPORT = 'export';
33
34 public function __construct($a_data, $a_id = 0, $a_call_by_reference = true, $a_prepare_output = true)
35 {
36 global $DIC;
37 $this->ilNavigationHistory = $DIC['ilNavigationHistory'];
38 $this->type = 'iass';
39 $this->tpl = $DIC['tpl'];
40 $this->ctrl = $DIC['ilCtrl'];
41 $this->usr = $DIC['ilUser'];
42 $this->ilias = $DIC['ilias'];
43 $this->lng = $DIC['lng'];
44 $this->ilAccess = $DIC['ilAccess'];
45 $this->lng->loadLanguageModule('iass');
46 $this->tpl->getStandardTemplate();
47 $this->locator = $DIC['ilLocator'];
48
49 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
50 }
51
52 public function addLocatorItems()
53 {
54 if (is_object($this->object)) {
55 $this->locator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, "view"), "", $this->object->getRefId());
56 }
57 }
58
59 public function executeCommand()
60 {
61 $next_class = $this->ctrl->getNextClass($this);
62 $cmd = $this->ctrl->getCmd();
63 $this->prepareOutput();
65
66 switch ($next_class) {
67 case 'ilpermissiongui':
68 $this->tabs_gui->setTabActive(self::TAB_PERMISSION);
69 require_once 'Services/AccessControl/classes/class.ilPermissionGUI.php';
70 $ilPermissionGUI = new ilPermissionGUI($this);
71 $this->ctrl->forwardCommand($ilPermissionGUI);
72 break;
73 case 'ilindividualassessmentsettingsgui':
74 $this->tabs_gui->setTabActive(self::TAB_SETTINGS);
75 require_once 'Modules/IndividualAssessment/classes/class.ilIndividualAssessmentSettingsGUI.php';
76 $gui = new ilIndividualAssessmentSettingsGUI($this, $this->ref_id);
77 $this->ctrl->forwardCommand($gui);
78 break;
79 case 'ilindividualassessmentmembersgui':
80 $this->membersObject();
81 break;
82 case 'ilinfoscreengui':
83 $this->tabs_gui->setTabActive(self::TAB_INFO);
84 require_once 'Services/InfoScreen/classes/class.ilInfoScreenGUI.php';
85 $info = $this->buildInfoScreen();
86 $this->ctrl->forwardCommand($info);
87 break;
88 case 'illearningprogressgui':
89 if (!$this->object->accessHandler()->mayViewObject()) {
90 $this->handleAccessViolation();
91 }
92 require_once 'Services/Tracking/classes/class.ilLearningProgressGUI.php';
93 $this->tabs_gui->setTabActive(self::TAB_LP);
94 $learning_progress = new ilLearningProgressGUI(
96 $this->object->getRefId(),
97 $this->usr->getId()
98 );
99 $this->ctrl->forwardCommand($learning_progress);
100 break;
101 case "ilcommonactiondispatchergui":
102 include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
104 $this->ctrl->forwardCommand($gui);
105 break;
106 case "ilexportgui":
107 include_once("./Services/Export/classes/class.ilExportGUI.php");
108 $this->tabs_gui->setTabActive(self::TAB_EXPORT);
109 $exp_gui = new ilExportGUI($this); // $this is the ilObj...GUI class of the resource
110 $exp_gui->addFormat("xml");
111 $ret = $this->ctrl->forwardCommand($exp_gui);
112 break;
113 default:
114 if (!$cmd) {
115 $cmd = 'view';
116 if ($this->object->accessHandler()->mayEditMembers()) {
117 $this->ctrl->setCmdClass('ilIndividualassessmentmembersgui');
118 $cmd = 'members';
119 }
120 }
121 $cmd .= 'Object';
122 $this->$cmd();
123 }
124 return true;
125 }
126
127 public function tabsGUI()
128 {
129 return $this->tabs_gui;
130 }
131
132 public function viewObject()
133 {
134 $this->tabs_gui->setTabActive(self::TAB_INFO);
135 require_once 'Services/InfoScreen/classes/class.ilInfoScreenGUI.php';
136 $this->ctrl->setCmd('showSummary');
137 $this->ctrl->setCmdClass('ilinfoscreengui');
138 $info = $this->buildInfoScreen();
139 $this->ctrl->forwardCommand($info);
140 }
141
142 public function membersObject()
143 {
144 $this->tabs_gui->setTabActive(self::TAB_MEMBERS);
145 require_once 'Modules/IndividualAssessment/classes/class.ilIndividualAssessmentMembersGUI.php';
146 $gui = new ilIndividualAssessmentMembersGUI($this, $this->ref_id);
147 $this->ctrl->forwardCommand($gui);
148 }
149
150 protected function buildInfoScreen()
151 {
152 $info = new ilInfoScreenGUI($this);
153 if ($this->object) {
155 if ($this->object->loadMembers()->userAllreadyMember($this->usr)) {
157 }
159 }
160 return $info;
161 }
162
164 {
165 $member = $this->object->membersStorage()->loadMember($this->object, $this->usr);
166 $info->addSection($this->lng->txt('grading_info'));
167 if ($member->finalized()) {
168 $info->addProperty($this->lng->txt('grading'), $this->getEntryForStatus($member->LPStatus()));
169 }
170 if ($member->notify() && $member->finalized()) {
171 $info->addProperty($this->lng->txt('grading_record'), nl2br($member->record()));
172 if (($member->viewFile() || $view_self) && $member->fileName() && $member->fileName() != "") {
173 $tpl = new ilTemplate("tpl.iass_user_file_download.html", true, true, "Modules/IndividualAssessment");
174 $tpl->setVariable("FILE_NAME", $member->fileName());
175 $tpl->setVariable("HREF", $this->ctrl->getLinkTarget($this, "downloadFile"));
176 $info->addProperty($this->lng->txt('iass_upload_file'), $tpl->get());
177 }
178 }
179
180 return $info;
181 }
182
183 protected function downloadFileObject()
184 {
185 $member = $this->object->membersStorage()->loadMember($this->object, $this->usr);
186 $file_storage = $this->object->getFileStorage();
187 $file_storage->setUserId($this->usr->getId());
188 ilUtil::deliverFile($file_storage->getFilePath(), $member->fileName());
189 }
190
192 {
193 $content = $this->object->getSettings()->content();
194 if ($content !== null && $content !== '') {
195 $info->addSection($this->lng->txt('general'));
196 $info->addProperty($this->lng->txt('content'), $content);
197 }
198 return $info;
199 }
200
202 {
203 $info_settings = $this->object->getInfoSettings();
204 if ($this->shouldShowContactInfo($info_settings)) {
205 $info->addSection($this->lng->txt('iass_contact_info'));
206 $info->addProperty($this->lng->txt('iass_contact'), $info_settings->contact());
207 $info->addProperty($this->lng->txt('iass_responsibility'), $info_settings->responsibility());
208 $info->addProperty($this->lng->txt('iass_phone'), $info_settings->phone());
209 $info->addProperty($this->lng->txt('iass_mails'), $info_settings->mails());
210 $info->addProperty($this->lng->txt('iass_consultation_hours'), $info_settings->consultationHours());
211 }
212 return $info;
213 }
214
216 {
217 $val = $info_settings->contact();
218 if ($val !== null && $val !== '') {
219 return true;
220 }
221 $val = $info_settings->responsibility();
222 if ($val !== null && $val !== '') {
223 return true;
224 }
225 $val = $info_settings->phone();
226 if ($val !== null && $val !== '') {
227 return true;
228 }
229 $val = $info_settings->mails();
230 if ($val !== null && $val !== '') {
231 return true;
232 }
233 $val = $info_settings->consultationHours();
234 if ($val !== null && $val !== '') {
235 return true;
236 }
237 return false;
238 }
239
240 public function getTabs()
241 {
242 if ($this->object->accessHandler()->mayViewObject()) {
243 $this->tabs_gui->addTab(
244 self::TAB_INFO,
245 $this->lng->txt('info_short'),
246 $this->getLinkTarget('info')
247 );
248 }
249 if ($this->object->accessHandler()->mayEditObject()) {
250 $this->tabs_gui->addTab(
251 self::TAB_SETTINGS,
252 $this->lng->txt('settings'),
253 $this->getLinkTarget('settings')
254 );
255 }
256 if ($this->object->accessHandler()->mayEditMembers()
257 || $this->object->accessHandler()->mayGradeUser()
258 || $this->object->accessHandler()->mayAmendGradeUser()
259 || $this->object->accessHandler()->mayViewUser()) {
260 $this->tabs_gui->addTab(
261 self::TAB_MEMBERS,
262 $this->lng->txt('il_iass_members'),
263 $this->getLinkTarget('members')
264 );
265 }
266 if (($this->object->accessHandler()->mayViewUser()
267 || $this->object->accessHandler()->mayGradeUser()
268 || ($this->object->loadMembers()->userAllreadyMember($this->usr)
269 && $this->object->isActiveLP()))
271 $this->tabs_gui->addTab(
272 self::TAB_LP,
273 $this->lng->txt('learning_progress'),
274 $this->ctrl->getLinkTargetByClass('illearningprogressgui')
275 );
276 }
277
278 if ($this->object->accessHandler()->mayEditObject()) {
279 $this->tabs_gui->addTarget(
280 self::TAB_EXPORT,
281 $this->ctrl->getLinkTargetByClass('ilexportgui', ''),
282 'export',
283 'ilexportgui'
284 );
285 }
286
287 if ($this->object->accessHandler()->mayEditPermissions()) {
288 $this->tabs_gui->addTarget(
289 self::TAB_PERMISSION,
290 $this->ctrl->getLinkTargetByClass('ilpermissiongui', 'perm'),
291 array(),
292 'ilpermissiongui'
293 );
294 }
295 parent::getTabs();
296 }
297
298 protected function getLinkTarget($a_cmd)
299 {
300 if ($a_cmd == 'settings') {
301 return $this->ctrl->getLinkTargetByClass('ilindividualassessmentsettingsgui', 'edit');
302 }
303 if ($a_cmd == 'info') {
304 return $this->ctrl->getLinkTarget($this, 'view');
305 }
306 if ($a_cmd == 'members') {
307 return $this->ctrl->getLinkTargetByClass('ilindividualassessmentmembersgui', 'view');
308 }
309 return $this->ctrl->getLinkTarget($this, $a_cmd);
310 }
311
312 public function getBaseEditForm()
313 {
314 return $this->initEditForm();
315 }
316
317 public function handleAccessViolation()
318 {
319 global $DIC;
320 $DIC['ilias']->raiseError($DIC['lng']->txt("msg_no_perm_read"), $DIC['ilias']->error_obj->WARNING);
321 }
322
323 public static function _goto($a_target, $a_add = '')
324 {
325 global $DIC;
326 if ($DIC['ilAccess']->checkAccess('read', '', $a_target)) {
327 ilObjectGUI::_gotoRepositoryNode($a_target, 'view');
328 }
329 }
330
331 protected function getEntryForStatus($a_status)
332 {
333 switch ($a_status) {
335 return $this->lng->txt('iass_status_pending');
336 break;
338 return $this->lng->txt('iass_status_completed');
339 break;
341 return $this->lng->txt('iass_status_failed');
342 break;
343 }
344 }
345
346 protected function afterSave(ilObject $a_new_object)
347 {
348 ilUtil::sendSuccess($this->lng->txt("iass_added"), true);
349 $this->ctrl->setParameter($this, "ref_id", $a_new_object->getRefId());
350 ilUtil::redirect($this->ctrl->getLinkTargetByClass('ilIndividualassessmentsettingsgui', 'edit', '', false, false));
351 }
352
353 public function addToNavigationHistory()
354 {
355 if (!$this->getCreationMode()) {
356 if ($this->object->accessHandler()->mayViewObject()) {
357 $link = ilLink::_getLink($_GET["ref_id"], "iass");
358 $this->ilNavigationHistory->addItem($_GET['ref_id'], $link, 'iass');
359 }
360 }
361 }
362}
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
Class ilAccessHandler.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Export User Interface Class.
For the purpose of streamlining the grading and learning-process status definition outside of tests,...
Class ilInfoScreenGUI.
Class ilObjUserTrackingGUI.
Navigation History of Repository Items.
addItem( $a_ref_id, $a_link, $a_type, $a_title="", $a_sub_obj_id="", $a_goto_link="")
Add an item to the stack.
For the purpose of streamlining the grading and learning-process status definition outside of tests,...
addLocatorItems()
should be overwritten to add object specific items (repository items are preloaded)
__construct($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
afterSave(ilObject $a_new_object)
Post (successful) object creation hook.
shouldShowContactInfo(ilIndividualAssessmentInfoSettings $info_settings)
static _enabledLearningProgress()
check wether learing progress is enabled or not
Class ilObjectGUI Basic methods of all Output classes.
prepareOutput($a_show_subobjects=true)
prepare output
static _gotoRepositoryNode($a_ref_id, $a_cmd="frameset")
Goto repository root.
getCreationMode()
get creation mode
initEditForm()
Init object edit form.
Class ilObject Basic functions for all objects.
getRefId()
get reference id @access public
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
special template class to simplify handling of ITX/PEAR
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static redirect($a_script)
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
$info
Definition: index.php:5
redirection script todo: (a better solution should control the processing via a xml file)
$ret
Definition: parser.php:6
global $DIC
Definition: saml.php:7