ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilObjIndividualAssessmentGUI.php
Go to the documentation of this file.
1<?php
2
21require_once 'Services/Object/classes/class.ilObjectGUI.php';
22require_once 'Modules/IndividualAssessment/classes/class.ilIndividualAssessmentLP.php';
23require_once 'Services/Tracking/classes/class.ilObjUserTracking.php';
24
25
27{
28 const TAB_SETTINGS = 'settings';
29 const TAB_INFO = 'info_short';
30 const TAB_PERMISSION = 'perm_settings';
31 const TAB_MEMBERS = 'members';
32 const TAB_LP = 'learning_progress';
33 const TAB_EXPORT = 'export';
34 const TAB_META_DATA = "meta_data";
35
36 public function __construct($a_data, $a_id = 0, $a_call_by_reference = true, $a_prepare_output = true)
37 {
38 global $DIC;
39 $this->ilNavigationHistory = $DIC['ilNavigationHistory'];
40 $this->type = 'iass';
41 $this->tpl = $DIC['tpl'];
42 $this->ctrl = $DIC['ilCtrl'];
43 $this->usr = $DIC['ilUser'];
44 $this->ilias = $DIC['ilias'];
45 $this->lng = $DIC['lng'];
46 $this->ilAccess = $DIC['ilAccess'];
47 $this->lng->loadLanguageModule('iass');
48 $this->tpl->getStandardTemplate();
49 $this->locator = $DIC['ilLocator'];
50
51 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
52 }
53
54 public function addLocatorItems()
55 {
56 if (is_object($this->object)) {
57 $this->locator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, "view"), "", $this->object->getRefId());
58 }
59 }
60
61 protected function recordIndividualAssessmentRead() {
62
64 $this->object->getType(),
65 $this->object->getRefId(),
66 $this->object->getId(),
67 $this->usr->getId()
68 );
69
70 }
71
72 public function executeCommand()
73 {
74 $next_class = $this->ctrl->getNextClass($this);
75 $cmd = $this->ctrl->getCmd();
76 $this->prepareOutput();
78
79 switch ($next_class) {
80 case 'ilpermissiongui':
81 $this->tabs_gui->setTabActive(self::TAB_PERMISSION);
82 require_once 'Services/AccessControl/classes/class.ilPermissionGUI.php';
83 $ilPermissionGUI = new ilPermissionGUI($this);
84 $this->ctrl->forwardCommand($ilPermissionGUI);
85 break;
86 case 'ilindividualassessmentsettingsgui':
87 $this->tabs_gui->setTabActive(self::TAB_SETTINGS);
88 require_once 'Modules/IndividualAssessment/classes/class.ilIndividualAssessmentSettingsGUI.php';
89 $gui = new ilIndividualAssessmentSettingsGUI($this, $this->ref_id);
90 $this->ctrl->forwardCommand($gui);
91 break;
92 case 'ilindividualassessmentmembersgui':
93 $this->membersObject();
94 break;
95 case 'ilinfoscreengui':
96 $this->tabs_gui->setTabActive(self::TAB_INFO);
97 require_once 'Services/InfoScreen/classes/class.ilInfoScreenGUI.php';
98 $info = $this->buildInfoScreen();
99 $this->ctrl->forwardCommand($info);
100 break;
101 case 'illearningprogressgui':
102 if (!$this->object->accessHandler()->mayViewObject()) {
103 $this->handleAccessViolation();
104 }
105 require_once 'Services/Tracking/classes/class.ilLearningProgressGUI.php';
106 $this->tabs_gui->setTabActive(self::TAB_LP);
107 $learning_progress = new ilLearningProgressGUI(
109 $this->object->getRefId(),
110 $this->usr->getId()
111 );
112 $this->ctrl->forwardCommand($learning_progress);
113 break;
114 case "ilcommonactiondispatchergui":
115 include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
117 $this->ctrl->forwardCommand($gui);
118 break;
119 case "ilexportgui":
120 include_once("./Services/Export/classes/class.ilExportGUI.php");
121 $this->tabs_gui->setTabActive(self::TAB_EXPORT);
122 $exp_gui = new ilExportGUI($this); // $this is the ilObj...GUI class of the resource
123 $exp_gui->addFormat("xml");
124 $ret = $this->ctrl->forwardCommand($exp_gui);
125 break;
126 case 'ilobjectmetadatagui':
127 $this->checkPermissionBool("write");
128 $this->tabs_gui->activateTab(self::TAB_META_DATA);
129 include_once 'Services/Object/classes/class.ilObjectMetaDataGUI.php';
130 $md_gui = new ilObjectMetaDataGUI($this->object);
131 $this->ctrl->forwardCommand($md_gui);
132 break;
133 case 'ilobjectcopygui':
134 include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
135 $cp = new ilObjectCopyGUI($this);
136 $cp->setType('crs');
137 $this->ctrl->forwardCommand($cp);
138 break;
139 default:
140 if (!$cmd) {
141 $cmd = 'view';
142 if ($this->object->accessHandler()->mayEditMembers()) {
143 $this->ctrl->setCmdClass('ilIndividualassessmentmembersgui');
144 $cmd = 'members';
145 }
146 }
147 $cmd .= 'Object';
148 $this->$cmd();
149 }
150 return true;
151 }
152
153 public function tabsGUI()
154 {
155 return $this->tabs_gui;
156 }
157
158 public function viewObject()
159 {
160 $this->tabs_gui->setTabActive(self::TAB_INFO);
161 require_once 'Services/InfoScreen/classes/class.ilInfoScreenGUI.php';
162 $this->ctrl->setCmd('showSummary');
163 $this->ctrl->setCmdClass('ilinfoscreengui');
164 $info = $this->buildInfoScreen();
165 $this->ctrl->forwardCommand($info);
167 }
168
169 public function membersObject()
170 {
171 $this->tabs_gui->setTabActive(self::TAB_MEMBERS);
172 require_once 'Modules/IndividualAssessment/classes/class.ilIndividualAssessmentMembersGUI.php';
173 $gui = new ilIndividualAssessmentMembersGUI($this, $this->ref_id);
174 $this->ctrl->forwardCommand($gui);
175 }
176
177 protected function buildInfoScreen()
178 {
179 $info = new ilInfoScreenGUI($this);
180 if ($this->object) {
181 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
182 $record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_INFO, 'iass', $this->object->getId());
183 $record_gui->setInfoObject($info);
184 $record_gui->parse();
185
186 $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
187
189 if ($this->object->loadMembers()->userAllreadyMember($this->usr)) {
191 }
193 }
194 return $info;
195 }
196
198 {
199 $member = $this->object->membersStorage()->loadMember($this->object, $this->usr);
200 $info->addSection($this->lng->txt('grading_info'));
201 if ($member->finalized()) {
202 $info->addProperty($this->lng->txt('grading'), $this->getEntryForStatus($member->LPStatus()));
203 }
204 if ($member->notify() && $member->finalized()) {
205 $info->addProperty($this->lng->txt('grading_record'), nl2br($member->record()));
206 if (($member->viewFile() || $view_self) && $member->fileName() && $member->fileName() != "") {
207 $tpl = new ilTemplate("tpl.iass_user_file_download.html", true, true, "Modules/IndividualAssessment");
208 $tpl->setVariable("FILE_NAME", $member->fileName());
209 $tpl->setVariable("HREF", $this->ctrl->getLinkTarget($this, "downloadFile"));
210 $info->addProperty($this->lng->txt('iass_upload_file'), $tpl->get());
211 }
212 }
213
214 return $info;
215 }
216
217 protected function downloadFileObject()
218 {
219 $member = $this->object->membersStorage()->loadMember($this->object, $this->usr);
220 $file_storage = $this->object->getFileStorage();
221 $file_storage->setUserId($this->usr->getId());
222 ilUtil::deliverFile($file_storage->getFilePath(), $member->fileName());
223 }
224
226 {
227 $content = $this->object->getSettings()->content();
228 if ($content !== null && $content !== '') {
229 $info->addSection($this->lng->txt('general'));
230 $info->addProperty($this->lng->txt('content'), $content);
231 }
232 return $info;
233 }
234
236 {
237 $info_settings = $this->object->getInfoSettings();
238 if ($this->shouldShowContactInfo($info_settings)) {
239 $info->addSection($this->lng->txt('iass_contact_info'));
240 $info->addProperty($this->lng->txt('iass_contact'), $info_settings->contact());
241 $info->addProperty($this->lng->txt('iass_responsibility'), $info_settings->responsibility());
242 $info->addProperty($this->lng->txt('iass_phone'), $info_settings->phone());
243 $info->addProperty($this->lng->txt('iass_mails'), $info_settings->mails());
244 $info->addProperty($this->lng->txt('iass_consultation_hours'), $info_settings->consultationHours());
245 }
246 return $info;
247 }
248
250 {
251 $val = $info_settings->contact();
252 if ($val !== null && $val !== '') {
253 return true;
254 }
255 $val = $info_settings->responsibility();
256 if ($val !== null && $val !== '') {
257 return true;
258 }
259 $val = $info_settings->phone();
260 if ($val !== null && $val !== '') {
261 return true;
262 }
263 $val = $info_settings->mails();
264 if ($val !== null && $val !== '') {
265 return true;
266 }
267 $val = $info_settings->consultationHours();
268 if ($val !== null && $val !== '') {
269 return true;
270 }
271 return false;
272 }
273
274 public function getTabs()
275 {
276 if ($this->object->accessHandler()->mayViewObject()) {
277 $this->tabs_gui->addTab(
278 self::TAB_INFO,
279 $this->lng->txt('info_short'),
280 $this->getLinkTarget('info')
281 );
282 }
283 if ($this->object->accessHandler()->mayEditObject()) {
284 $this->tabs_gui->addTab(
285 self::TAB_SETTINGS,
286 $this->lng->txt('settings'),
287 $this->getLinkTarget('settings')
288 );
289 include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
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->lng->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->lng->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->lng->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
356 public function getBaseEditForm()
357 {
358 return $this->initEditForm();
359 }
360
361 public function handleAccessViolation()
362 {
363 global $DIC;
364 $DIC['ilias']->raiseError($DIC['lng']->txt("msg_no_perm_read"), $DIC['ilias']->error_obj->WARNING);
365 }
366
367 public static function _goto($a_target, $a_add = '')
368 {
369 global $DIC;
370 if ($DIC['ilAccess']->checkAccess('write', '', $a_target)) {
371 ilObjectGUI::_gotoRepositoryNode($a_target, 'edit');
372 }
373 if ($DIC['ilAccess']->checkAccess('read', '', $a_target)) {
375 }
376 }
377
378 protected function getEntryForStatus($a_status)
379 {
380 switch ($a_status) {
382 return $this->lng->txt('iass_status_pending');
383 break;
385 return $this->lng->txt('iass_status_completed');
386 break;
388 return $this->lng->txt('iass_status_failed');
389 break;
390 }
391 }
392
393 protected function afterSave(ilObject $a_new_object)
394 {
395 ilUtil::sendSuccess($this->lng->txt("iass_added"), true);
396 $this->ctrl->setParameter($this, "ref_id", $a_new_object->getRefId());
397 ilUtil::redirect($this->ctrl->getLinkTargetByClass('ilIndividualassessmentsettingsgui', 'edit', '', false, false));
398 }
399
400 public function addToNavigationHistory()
401 {
402 if (!$this->getCreationMode()) {
403 if ($this->object->accessHandler()->mayViewObject()) {
404 $link = ilLink::_getLink($_GET["ref_id"], "iass");
405 $this->ilNavigationHistory->addItem($_GET['ref_id'], $link, 'iass');
406 }
407 }
408 }
409}
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
Class ilAccessHandler.
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.
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
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.
$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