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