ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilObjIndividualAssessmentGUI.php
Go to the documentation of this file.
1<?php
2
22{
23 const TAB_SETTINGS = 'settings';
24 const TAB_INFO = 'info_short';
25 const TAB_PERMISSION = 'perm_settings';
26 const TAB_MEMBERS = 'members';
27 const TAB_LP = 'learning_progress';
28 const TAB_EXPORT = 'export';
29 const TAB_META_DATA = "meta_data";
30
35
39 protected $type;
40
44 protected $usr;
45
49 protected $error_object;
50
54 protected $ilAccess;
55
56 public function __construct($a_data, $a_id = 0, $a_call_by_reference = true, $a_prepare_output = true)
57 {
58 global $DIC;
59 $this->ilNavigationHistory = $DIC['ilNavigationHistory'];
60 $this->type = 'iass';
61 $this->tpl = $DIC['tpl'];
62 $this->ctrl = $DIC['ilCtrl'];
63 $this->usr = $DIC['ilUser'];
64 $this->error_object = $DIC['ilErr'];
65 $this->lng = $DIC['lng'];
66 $this->lng->loadLanguageModule('iass');
67 $this->tpl->loadStandardTemplate();
68
69 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
70 }
71
72 public function addLocatorItems()
73 {
74 if (is_object($this->object)) {
75 $this->locator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, "view"), "", $this->object->getRefId());
76 }
77 }
78
79 protected function recordIndividualAssessmentRead()
80 {
82 $this->object->getType(),
83 $this->object->getRefId(),
84 $this->object->getId(),
85 $this->usr->getId()
86 );
87 }
88
89 public function executeCommand()
90 {
91 $next_class = $this->ctrl->getNextClass($this);
92 $cmd = $this->ctrl->getCmd();
93 $this->prepareOutput();
95
96 switch ($next_class) {
97 case 'ilpermissiongui':
98 $this->tabs_gui->activateTab(self::TAB_PERMISSION);
99 $ilPermissionGUI = new ilPermissionGUI($this);
100 $this->ctrl->forwardCommand($ilPermissionGUI);
101 break;
102 case 'ilindividualassessmentsettingsgui':
103 $this->tabs_gui->activateTab(self::TAB_SETTINGS);
104 $gui = $this->object->getSettingsGUI();
105 $this->ctrl->forwardCommand($gui);
106 break;
107 case 'ilindividualassessmentmembersgui':
108 $this->membersObject();
109 break;
110 case 'ilinfoscreengui':
111 $this->tabs_gui->activateTab(self::TAB_INFO);
112 $info = $this->buildInfoScreen();
113 $this->ctrl->forwardCommand($info);
114 break;
115 case 'illearningprogressgui':
116 if (!$this->object->accessHandler()->mayViewObject()) {
117 $this->handleAccessViolation();
118 }
119 $this->tabs_gui->activateTab(self::TAB_LP);
120 $learning_progress = new ilLearningProgressGUI(
122 $this->object->getRefId(),
123 $this->usr->getId()
124 );
125 $this->ctrl->forwardCommand($learning_progress);
126 break;
127 case "ilcommonactiondispatchergui":
129 $this->ctrl->forwardCommand($gui);
130 break;
131 case "ilexportgui":
132 $this->tabs_gui->activateTab(self::TAB_EXPORT);
133 $exp_gui = new ilExportGUI($this); // $this is the ilObj...GUI class of the resource
134 $exp_gui->addFormat("xml");
135 $ret = $this->ctrl->forwardCommand($exp_gui);
136 break;
137 case 'ilobjectmetadatagui':
138 $this->checkPermissionBool("write");
139 $this->tabs_gui->activateTab(self::TAB_META_DATA);
140 $md_gui = new ilObjectMetaDataGUI($this->object);
141 $this->ctrl->forwardCommand($md_gui);
142 break;
143 case 'ilobjectcopygui':
144 $cp = new ilObjectCopyGUI($this);
145 $cp->setType('crs');
146 $this->ctrl->forwardCommand($cp);
147 break;
148 default:
149 if (!$cmd) {
150 $cmd = 'view';
151 if ($this->object->accessHandler()->mayEditMembers()) {
152 $this->ctrl->setCmdClass('ilIndividualassessmentmembersgui');
153 $cmd = 'members';
154 }
155 }
156 $cmd .= 'Object';
157 $this->$cmd();
158 }
159 return true;
160 }
161
162 public function viewObject()
163 {
164 $this->tabs_gui->activateTab(self::TAB_INFO);
165 $this->ctrl->setCmd('showSummary');
166 $this->ctrl->setCmdClass('ilinfoscreengui');
167 $info = $this->buildInfoScreen();
168 $this->ctrl->forwardCommand($info);
170 }
171
172 public function membersObject()
173 {
174 $this->tabs_gui->activateTab(self::TAB_MEMBERS);
175 $gui = $this->object->getMembersGUI();
176 $this->ctrl->forwardCommand($gui);
177 }
178
179 protected function buildInfoScreen()
180 {
181 $info = new ilInfoScreenGUI($this);
182 if ($this->object) {
183 $record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_INFO, 'iass', $this->object->getId());
184 $record_gui->setInfoObject($info);
185 $record_gui->parse();
186
187 $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
188
189 $info = $this->addGeneralDataToInfo($info);
190 if ($this->object->loadMembers()->userAllreadyMember($this->usr)) {
191 $info = $this->addMemberDataToInfo($info);
192 }
193 $info = $this->addContactDataToInfo($info);
194 }
195 return $info;
196 }
197
198 protected function addMemberDataToInfo(ilInfoScreenGUI $info)
199 {
200 $member = $this->object->membersStorage()->loadMember($this->object, $this->usr);
201 $info->addSection($this->txt('grading_info'));
202 if ($member->finalized()) {
203 $info->addProperty($this->txt('grading'), $this->getEntryForStatus($member->LPStatus()));
204 }
205 if ($member->notify() && $member->finalized()) {
206 $info->addProperty($this->txt('grading_record'), nl2br($member->record()));
207 if (($member->viewFile() || $view_self) && $member->fileName() && $member->fileName() != "") {
208 $tpl = new ilTemplate("tpl.iass_user_file_download.html", true, true, "Modules/IndividualAssessment");
209 $tpl->setVariable("FILE_NAME", $member->fileName());
210 $tpl->setVariable("HREF", $this->ctrl->getLinkTarget($this, "downloadFile"));
211 $info->addProperty($this->txt('iass_upload_file'), $tpl->get());
212 }
213 }
214
215 return $info;
216 }
217
218 protected function downloadFileObject()
219 {
220 $member = $this->object->membersStorage()->loadMember($this->object, $this->usr);
221 $file_storage = $this->object->getFileStorage();
222 $file_storage->setUserId($this->usr->getId());
223 ilUtil::deliverFile($file_storage->getFilePath(), $member->fileName());
224 }
225
226 protected function addGeneralDataToInfo(ilInfoScreenGUI $info)
227 {
228 $content = $this->object->getSettings()->getContent();
229 if ($content !== null && $content !== '') {
230 $info->addSection($this->txt('general'));
231 $info->addProperty($this->txt('content'), $content);
232 }
233 return $info;
234 }
235
236 protected function addContactDataToInfo(ilInfoScreenGUI $info)
237 {
238 $info_settings = $this->object->getInfoSettings();
239 if ($this->shouldShowContactInfo($info_settings)) {
240 $info->addSection($this->txt('iass_contact_info'));
241 $info->addProperty($this->txt('iass_contact'), $info_settings->getContact());
242 $info->addProperty($this->txt('iass_responsibility'), $info_settings->getResponsibility());
243 $info->addProperty($this->txt('iass_phone'), $info_settings->getPhone());
244 $info->addProperty($this->txt('iass_mails'), $info_settings->getMails());
245 $info->addProperty($this->txt('iass_consultation_hours'), $info_settings->getConsultationHours());
246 }
247 return $info;
248 }
249
251 {
252 $val = $info_settings->getContact();
253 if ($val !== null && $val !== '') {
254 return true;
255 }
256 $val = $info_settings->getResponsibility();
257 if ($val !== null && $val !== '') {
258 return true;
259 }
260 $val = $info_settings->getPhone();
261 if ($val !== null && $val !== '') {
262 return true;
263 }
264 $val = $info_settings->getMails();
265 if ($val !== null && $val !== '') {
266 return true;
267 }
268 $val = $info_settings->getConsultationHours();
269 if ($val !== null && $val !== '') {
270 return true;
271 }
272 return false;
273 }
274
275 public function getTabs()
276 {
277 if ($this->object->accessHandler()->mayViewObject()) {
278 $this->tabs_gui->addTab(
279 self::TAB_INFO,
280 $this->txt('info_short'),
281 $this->getLinkTarget('info')
282 );
283 }
284 if ($this->object->accessHandler()->mayEditObject()) {
285 $this->tabs_gui->addTab(
286 self::TAB_SETTINGS,
287 $this->txt('settings'),
288 $this->getLinkTarget('settings')
289 );
290 $mdgui = new ilObjectMetaDataGUI($this->object);
291 $mdtab = $mdgui->getTab();
292 if ($mdtab) {
293 $this->tabs_gui->addTab(
294 self::TAB_META_DATA,
295 $this->txt("meta_data"),
296 $mdtab
297 );
298 }
299 }
300 if ($this->object->accessHandler()->mayEditMembers()
301 || $this->object->accessHandler()->mayGradeUser()
302 || $this->object->accessHandler()->mayAmendGradeUser()
303 || $this->object->accessHandler()->mayViewUser()) {
304 $this->tabs_gui->addTab(
305 self::TAB_MEMBERS,
306 $this->txt('il_iass_members'),
307 $this->getLinkTarget('members')
308 );
309 }
310 if (($this->object->accessHandler()->mayViewUser()
311 || $this->object->accessHandler()->mayGradeUser()
312 || ($this->object->loadMembers()->userAllreadyMember($this->usr)
313 && $this->object->isActiveLP()))
315 $this->tabs_gui->addTab(
316 self::TAB_LP,
317 $this->txt('learning_progress'),
318 $this->ctrl->getLinkTargetByClass('illearningprogressgui')
319 );
320 }
321
322 if ($this->object->accessHandler()->mayEditObject()) {
323 $this->tabs_gui->addTarget(
324 self::TAB_EXPORT,
325 $this->ctrl->getLinkTargetByClass('ilexportgui', ''),
326 'export',
327 'ilexportgui'
328 );
329 }
330
331 if ($this->object->accessHandler()->mayEditPermissions()) {
332 $this->tabs_gui->addTarget(
333 self::TAB_PERMISSION,
334 $this->ctrl->getLinkTargetByClass('ilpermissiongui', 'perm'),
335 array(),
336 'ilpermissiongui'
337 );
338 }
339 parent::getTabs();
340 }
341
342 protected function getLinkTarget($a_cmd)
343 {
344 if ($a_cmd == 'settings') {
345 return $this->ctrl->getLinkTargetByClass('ilindividualassessmentsettingsgui', 'edit');
346 }
347 if ($a_cmd == 'info') {
348 return $this->ctrl->getLinkTarget($this, 'view');
349 }
350 if ($a_cmd == 'members') {
351 return $this->ctrl->getLinkTargetByClass('ilindividualassessmentmembersgui', 'view');
352 }
353 return $this->ctrl->getLinkTarget($this, $a_cmd);
354 }
355 public function editObject()
356 {
357 $link = $this->getLinkTarget('settings');
358 $this->ctrl->redirectToURL($link);
359 }
360
361 public function getBaseEditForm()
362 {
363 return $this->initEditForm();
364 }
365
366 public function handleAccessViolation()
367 {
368 $this->error_object->raiseError($this->txt("msg_no_perm_read"), $this->error_object->WARNING);
369 }
370
371 public static function _goto($a_target, $a_add = '')
372 {
373 global $DIC;
374 if ($DIC['ilAccess']->checkAccess('write', '', $a_target)) {
375 ilObjectGUI::_gotoRepositoryNode($a_target, 'edit');
376 }
377 if ($DIC['ilAccess']->checkAccess('read', '', $a_target)) {
379 }
380 }
381
382 protected function getEntryForStatus($a_status)
383 {
384 switch ($a_status) {
386 return $this->txt('iass_status_pending');
387 break;
389 return $this->txt('iass_status_completed');
390 break;
392 return $this->txt('iass_status_failed');
393 break;
394 }
395 }
396
397 protected function afterSave(ilObject $a_new_object)
398 {
399 ilUtil::sendSuccess($this->txt("iass_added"), true);
400 $this->ctrl->setParameter($this, "ref_id", $a_new_object->getRefId());
401 ilUtil::redirect($this->ctrl->getLinkTargetByClass('ilIndividualassessmentsettingsgui', 'edit', '', false, false));
402 }
403
404 public function addToNavigationHistory()
405 {
406 if (!$this->getCreationMode()) {
407 if ($this->object->accessHandler()->mayViewObject()) {
408 $link = ilLink::_getLink($_GET["ref_id"], "iass");
409 $this->ilNavigationHistory->addItem($_GET['ref_id'], $link, 'iass');
410 }
411 }
412 }
413
414 protected function txt(string $code) : string
415 {
416 return $this->lng->txt($code);
417 }
418}
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
static _recordReadEvent( $a_type, $a_ref_id, $obj_id, $usr_id, $isCatchupWriteEvents=true, $a_ext_rc=false, $a_ext_time=false)
Records a read event and catches up with write events.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Export User Interface Class.
Class ilInfoScreenGUI.
addProperty($a_name, $a_value, $a_link="")
add a property to current section
addSection($a_title)
add a new section
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,...
viewObject()
viewObject container presentation for "administration -> repository, trash, permissions"
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
GUI class for the workflow of copying objects.
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
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
initEditForm()
Init object edit form.
Class ilObjectMetaDataGUI.
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 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.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$ret
Definition: parser.php:6
$DIC
Definition: xapitoken.php:46