ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilObjCourseGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 
5 require_once "./Services/Container/classes/class.ilContainerGUI.php";
6 
30 {
35  public function __construct()
36  {
37  global $ilCtrl, $ilHelp;
38 
39  // CONTROL OPTIONS
40  $this->ctrl = $ilCtrl;
41  $this->ctrl->saveParameter($this,array("ref_id","cmdClass"));
42 
43  $this->type = "crs";
44  parent::__construct('',(int) $_GET['ref_id'],true,false);
45 
46  $this->lng->loadLanguageModule('crs');
47 
48  $this->SEARCH_USER = 1;
49  $this->SEARCH_GROUP = 2;
50  $this->SEARCH_COURSE = 3;
51  }
52 
53  function gatewayObject()
54  {
55  switch($_POST["action"])
56  {
57 
58  case "deleteSubscribers":
59  $this->deleteSubscribers();
60  break;
61 
62  case "addSubscribers":
63  $this->addSubscribers();
64  break;
65 
66  case "addFromWaitingList":
67  $this->addFromWaitingList();
68  break;
69 
70  case "removeFromWaitingList":
71  $this->removeFromWaitingList();
72  break;
73 
74  default:
75  $this->viewObject();
76  break;
77  }
78  return true;
79  }
80 
85  protected function afterImport(ilObject $a_new_object)
86  {
87  global $ilUser, $ilSetting;
88 
89  // #11895
90  include_once './Modules/Course/classes/class.ilCourseParticipants.php';
91  $part = ilCourseParticipants::_getInstanceByObjId($a_new_object->getId());
92  $part->add($ilUser->getId(), ilCourseConstants::CRS_ADMIN);
93  $part->updateNotification($ilUser->getId(), $ilSetting->get('mail_crs_admin_notification', true));
94 
95  parent::afterImport($a_new_object);
96  }
97 
98  function renderObject()
99  {
100  $this->ctrl->setCmd("view");
101  $this->viewObject();
102  }
103 
109  protected function forwardToTimingsView()
110  {
111  if(!$this->ctrl->getCmd() and $this->object->getViewMode() == ilContainer::VIEW_TIMING)
112  {
113  if(!isset($_SESSION['crs_timings'])) {
114  $_SESSION['crs_timings'] = true;
115  }
116 
117  if($_SESSION['crs_timings'] == true) {
118  include_once './Modules/Course/classes/class.ilCourseContentGUI.php';
119  $course_content_obj = new ilCourseContentGUI($this);
120  $this->ctrl->setCmdClass(get_class($course_content_obj));
121  $this->ctrl->setCmd('editUserTimings');
122  $this->ctrl->forwardCommand($course_content_obj);
123  return true;
124  }
125  }
126  $_SESSION['crs_timings'] = false;
127  return false;
128  }
129 
130 
131  function viewObject()
132  {
133  global $rbacsystem, $ilUser, $ilCtrl;
134 
135  $this->tabs_gui->setTabActive('view_content');
136 
137  // CHECK ACCESS
138  $this->checkPermission('read','view');
139  /*
140  if(!$rbacsystem->checkAccess("read",$this->object->getRefId()))
141  {
142  $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
143  }
144  */
145  if (strtolower($_GET["baseClass"]) == "iladministrationgui")
146  {
147  parent::viewObject();
148  return true;
149  }
150 
151  // Fill meta header tags
152  include_once('Services/MetaData/classes/class.ilMDUtils.php');
153  ilMDUtils::_fillHTMLMetaTags($this->object->getId(),$this->object->getId(),'crs');
154 
155  // Trac access
156  if ($ilCtrl->getNextClass() != "ilcolumngui")
157  {
158  include_once 'Services/Tracking/classes/class.ilLearningProgress.php';
159  ilLearningProgress::_tracProgress($ilUser->getId(),$this->object->getId(),
160  $this->object->getRefId(),'crs');
161  }
162 
163  if(!$this->checkAgreement())
164  {
165  include_once('Services/Membership/classes/class.ilMemberAgreementGUI.php');
166  $this->tabs_gui->clearTargets();
167  $this->ctrl->setReturn($this,'view_content');
168  $agreement = new ilMemberAgreementGUI($this->object->getRefId());
169  $this->ctrl->setCmdClass(get_class($agreement));
170  $this->ctrl->forwardCommand($agreement);
171  return true;
172  }
173 
174  if(!$this->__checkStartObjects())
175  {
176  include_once "Services/Container/classes/class.ilContainerStartObjectsContentGUI.php";
177  $stgui = new ilContainerStartObjectsContentGUI($this, $this->object);
178  $stgui->enableDesktop($this->object->getAboStatus(), $this);
179  return $stgui->getHTML();
180  }
181 
182  // views handled by general container logic
183  if ($this->object->getViewMode() == ilContainer::VIEW_SIMPLE ||
184  $this->object->getViewMode() == ilContainer::VIEW_BY_TYPE ||
185  $this->object->getViewMode() == ilContainer::VIEW_SESSIONS ||
186  $this->object->getViewMode() == ilContainer::VIEW_TIMING ||
187  $this->object->getViewMode() == ilContainer::VIEW_OBJECTIVE
188  )
189  {
190  $ret = parent::renderObject();
191  return $ret;
192  }
193  else
194  {
195  include_once './Modules/Course/classes/class.ilCourseContentGUI.php';
196  $course_content_obj = new ilCourseContentGUI($this);
197 
198  $this->ctrl->setCmdClass(get_class($course_content_obj));
199  $this->ctrl->forwardCommand($course_content_obj);
200  }
201 
202  return true;
203  }
204 
205  function renderContainer()
206  {
207  return parent::renderObject();
208  }
209 
215  function infoScreenObject()
216  {
217  $this->ctrl->setCmd("showSummary");
218  $this->ctrl->setCmdClass("ilinfoscreengui");
219  $this->infoScreen();
220  }
221 
225  function infoScreen()
226  {
227  global $ilErr,$ilAccess, $ilUser, $ilSetting;
228 
229  $this->checkPermission('visible');
230  // Fill meta header tags
231  include_once('Services/MetaData/classes/class.ilMDUtils.php');
232  ilMDUtils::_fillHTMLMetaTags($this->object->getId(),$this->object->getId(),'crs');
233 
234  $this->tabs_gui->setTabActive('info_short');
235 
236  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
237  include_once 'Modules/Course/classes/class.ilCourseFile.php';
238 
239  $files =& ilCourseFile::_readFilesByCourse($this->object->getId());
240 
241  $info = new ilInfoScreenGUI($this);
242  $info->enablePrivateNotes();
243  $info->enableFeedback();
244  $info->enableNews();
245  if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]))
246  {
247  $info->enableNewsEditing();
248  }
249 
250  if(strlen($this->object->getImportantInformation()) or
251  strlen($this->object->getSyllabus()) or
252  count($files))
253  {
254  $info->addSection($this->lng->txt('crs_general_informations'));
255  }
256 
257  if(strlen($this->object->getImportantInformation()))
258  {
259  $info->addProperty($this->lng->txt('crs_important_info'),
260  "<strong>".nl2br(
261  ilUtil::makeClickable($this->object->getImportantInformation(), true)."</strong>"));
262  }
263  if(strlen($this->object->getSyllabus()))
264  {
265  $info->addProperty($this->lng->txt('crs_syllabus'), nl2br(
266  ilUtil::makeClickable ($this->object->getSyllabus(), true)));
267  }
268  // files
269  if(count($files))
270  {
271  $tpl = new ilTemplate('tpl.event_info_file.html',true,true,'Modules/Course');
272 
273  foreach($files as $file)
274  {
275  $tpl->setCurrentBlock("files");
276  $this->ctrl->setParameter($this,'file_id',$file->getFileId());
277  $tpl->setVariable("DOWN_LINK",$this->ctrl->getLinkTarget($this,'sendfile'));
278  $tpl->setVariable("DOWN_NAME",$file->getFileName());
279  $tpl->setVariable("DOWN_INFO_TXT",$this->lng->txt('crs_file_size_info'));
280  $tpl->setVariable("DOWN_SIZE",$file->getFileSize());
281  $tpl->setVariable("TXT_BYTES",$this->lng->txt('bytes'));
282  $tpl->parseCurrentBlock();
283  }
284  $info->addProperty($this->lng->txt('crs_file_download'),
285  $tpl->get());
286  }
287 
288  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
289  $record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_INFO,'crs',$this->object->getId());
290  $record_gui->setInfoObject($info);
291  $record_gui->parse();
292 
293  // meta data
294  $info->addMetaDataSections($this->object->getId(),0, $this->object->getType());
295 
296  // contact
297  if($this->object->hasContactData())
298  {
299  $info->addSection($this->lng->txt("crs_contact"));
300  }
301  if(strlen($this->object->getContactName()))
302  {
303  $info->addProperty($this->lng->txt("crs_contact_name"),
304  $this->object->getContactName());
305  }
306  if(strlen($this->object->getContactResponsibility()))
307  {
308  $info->addProperty($this->lng->txt("crs_contact_responsibility"),
309  $this->object->getContactResponsibility());
310  }
311  if(strlen($this->object->getContactPhone()))
312  {
313  $info->addProperty($this->lng->txt("crs_contact_phone"),
314  $this->object->getContactPhone());
315  }
316  if($this->object->getContactEmail())
317  {
318  include_once './Modules/Course/classes/class.ilCourseMailTemplateMemberContext.php';
319  require_once 'Services/Mail/classes/class.ilMailFormCall.php';
320 
321  $emails = explode(",",$this->object->getContactEmail());
322  foreach ($emails as $email) {
323  $email = trim($email);
324  $etpl = new ilTemplate("tpl.crs_contact_email.html", true, true , 'Modules/Course');
325  $etpl->setVariable(
326  "EMAIL_LINK",
328  $info, 'showSummary', array(),
329  array(
330  'type' => 'new',
331  'rcp_to' => $email,
332  'sig' => $this->createMailSignature()
333  ),
334  array(
336  'ref_id' => $this->object->getRefId(),
337  'ts' => time()
338  )
339  )
340  );
341  $etpl->setVariable("CONTACT_EMAIL", $email);
342  $mailString .= $etpl->get()."<br />";
343  }
344  $info->addProperty($this->lng->txt("crs_contact_email"), $mailString);
345  }
346  if(strlen($this->object->getContactConsultation()))
347  {
348  $info->addProperty($this->lng->txt("crs_contact_consultation"),
349  nl2br($this->object->getContactConsultation()));
350  }
351 
352 
353  // support contacts
354  $parts = ilParticipants::getInstanceByObjId($this->object->getId());
355  $conts = $parts->getContacts();
356  if (count($conts) > 0)
357  {
358  $info->addSection($this->lng->txt("crs_mem_contacts"));
359  foreach ($conts as $c)
360  {
361  include_once("./Services/User/classes/class.ilPublicUserProfileGUI.php");
362  $pgui = new ilPublicUserProfileGUI($c);
363  $pgui->setBackUrl($this->ctrl->getLinkTargetByClass("ilinfoscreengui"));
364  $pgui->setEmbedded(true);
365  $info->addProperty("", $pgui->getHTML());
366  }
367  }
368 
369 
370 
371  //
372  // access
373  //
374 
375  // #10360
376  $this->lng->loadLanguageModule("rep");
377  $info->addSection($this->lng->txt("rep_activation_availability"));
378  $info->showLDAPRoleGroupMappingInfo();
379 
380  // activation
381  if($this->object->getActivationUnlimitedStatus())
382  {
383  $info->addProperty($this->lng->txt("rep_activation_access"),
384  $this->lng->txt('crs_visibility_limitless'));
385  }
386  else
387  {
388  $info->addProperty($this->lng->txt('rep_activation_access'),
390  new ilDateTime($this->object->getActivationStart(),IL_CAL_UNIX),
391  new ilDateTime($this->object->getActivationEnd(),IL_CAL_UNIX)));
392 
393  }
394  switch($this->object->getSubscriptionLimitationType())
395  {
397  $txt = $this->lng->txt("crs_info_reg_deactivated");
398  break;
399 
400  default:
401  switch($this->object->getSubscriptionType())
402  {
404  $txt = $this->lng->txt("crs_info_reg_confirmation");
405  break;
407  $txt = $this->lng->txt("crs_info_reg_direct");
408  break;
410  $txt = $this->lng->txt("crs_info_reg_password");
411  break;
412  }
413  }
414 
415  // subscription
416  $info->addProperty($this->lng->txt("crs_info_reg"),$txt);
417 
418 
419  if($this->object->getSubscriptionLimitationType() != IL_CRS_SUBSCRIPTION_DEACTIVATED)
420  {
421  if($this->object->getSubscriptionUnlimitedStatus())
422  {
423  $info->addProperty($this->lng->txt("crs_reg_until"),
424  $this->lng->txt('crs_unlimited'));
425  }
426  elseif($this->object->getSubscriptionStart() < time())
427  {
428  $info->addProperty($this->lng->txt("crs_reg_until"),
429  $this->lng->txt('crs_to').' '.
430  ilDatePresentation::formatDate(new ilDateTime($this->object->getSubscriptionEnd(),IL_CAL_UNIX)));
431  }
432  elseif($this->object->getSubscriptionStart() > time())
433  {
434  $info->addProperty($this->lng->txt("crs_reg_until"),
435  $this->lng->txt('crs_from').' '.
436  ilDatePresentation::formatDate(new ilDateTime($this->object->getSubscriptionStart(),IL_CAL_UNIX)));
437  }
438  if ($this->object->isSubscriptionMembershipLimited())
439  {
440  if($this->object->getSubscriptionMinMembers())
441  {
442  $info->addProperty(
443  $this->lng->txt("mem_min_users"),
444  $this->object->getSubscriptionMinMembers()
445  );
446  }
447  if($this->object->getSubscriptionMaxMembers())
448  {
449  include_once './Modules/Course/classes/class.ilObjCourseAccess.php';
450  $reg_info = ilObjCourseAccess::lookupRegistrationInfo($this->object->getId());
451 
452  $info->addProperty(
453  $this->lng->txt('mem_free_places'),
454  $reg_info['reg_info_free_places']
455  );
456  }
457  }
458  }
459 
460  if($this->object->getCancellationEnd())
461  {
462  $info->addProperty($this->lng->txt('crs_cancellation_end'),
463  ilDatePresentation::formatDate( $this->object->getCancellationEnd()));
464  }
465 
466  if($this->object->getCourseStart())
467  {
468  $info->addProperty($this->lng->txt('crs_period'),
470  $this->object->getCourseStart(),
471  $this->object->getCourseEnd()
472  ));
473  }
474 
475  // Confirmation
476  include_once('Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
477  $privacy = ilPrivacySettings::_getInstance();
478 
479  include_once('Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
480  if($privacy->courseConfirmationRequired() or ilCourseDefinedFieldDefinition::_getFields($this->object->getId()) or $privacy->enabledCourseExport())
481  {
482  include_once('Services/PrivacySecurity/classes/class.ilExportFieldsInfo.php');
483 
484  $field_info = ilExportFieldsInfo::_getInstanceByType($this->object->getType());
485 
486  $this->lng->loadLanguageModule('ps');
487  $info->addSection($this->lng->txt('crs_user_agreement_info'));
488  $info->addProperty($this->lng->txt('ps_export_data'),$field_info->exportableFieldsToInfoString());
489 
490  if($fields = ilCourseDefinedFieldDefinition::_fieldsToInfoString($this->object->getId()))
491  {
492  $info->addProperty($this->lng->txt('ps_crs_user_fields'),$fields);
493  }
494  }
495 
496  $info->enableLearningProgress(true);
497 
498  // forward the command
499  $this->ctrl->forwardCommand($info);
500  }
501 
506  {
507  include_once "Services/Membership/classes/class.ilMembershipNotifications.php";
508  $noti = new ilMembershipNotifications($this->ref_id);
509  if($noti->canCurrentUserEdit())
510  {
511  if((bool)$_REQUEST["crs_ntf"])
512  {
513  $noti->activateUser();
514  }
515  else
516  {
517  $noti->deactivateUser();
518  }
519  }
520  ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
521  $this->ctrl->redirect($this, "");
522  }
523 
530  public function editInfoObject(ilPropertyFormGUI $a_form = null)
531  {
532  include_once 'Modules/Course/classes/class.ilCourseFile.php';
533 
534  global $ilErr,$ilAccess;
535 
536  $this->checkPermission('write');
537  /*
538  if(!$ilAccess->checkAccess('write','',$this->object->getRefId()))
539  {
540  $ilErr->raiseError($this->lng->txt('msg_no_perm_read'),$ilErr->MESSAGE);
541  }
542  */
543  $this->setSubTabs('properties');
544  $this->tabs_gui->setTabActive('settings');
545  $this->tabs_gui->setSubTabActive('crs_info_settings');
546 
547  if(!$a_form)
548  {
549  $a_form = $this->initInfoEditor();
550  }
551  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.edit_info.html','Modules/Course');
552  $this->tpl->setVariable('INFO_TABLE',$a_form->getHTML());
553 
554  if(!count($files = ilCourseFile::_readFilesByCourse($this->object->getId())))
555  {
556  return true;
557  }
558  $rows = array();
559  foreach($files as $file)
560  {
561  $table_data['id'] = $file->getFileId();
562  $table_data['filename'] = $file->getFileName();
563  $table_data['filetype'] = $file->getFileType();
564  $table_data['filesize'] = $file->getFileSize();
565 
566  $rows[] = $table_data;
567  }
568 
569  include_once("./Modules/Course/classes/class.ilCourseInfoFileTableGUI.php");
570  $table_gui = new ilCourseInfoFileTableGUI($this, "edit");
571  $table_gui->setTitle($this->lng->txt("crs_info_download"));
572  $table_gui->setData($rows);
573  $table_gui->addCommandButton("cancel", $this->lng->txt("cancel"));
574  $table_gui->addMultiCommand("confirmDeleteInfoFiles", $this->lng->txt("delete"));
575  $table_gui->setSelectAllCheckbox("file_id");
576  $this->tpl->setVariable('INFO_FILE_TABLE',$table_gui->getHTML());
577 
578  return true;
579 
580  }
581 
590  {
591  if(!count($_POST['file_id']))
592  {
593  ilUtil::sendFailure($this->lng->txt('select_one'));
594  $this->editInfoObject();
595  return false;
596  }
597 
598  $this->setSubTabs('properties');
599  $this->tabs_gui->setTabActive('settings');
600  $this->tabs_gui->setSubTabActive('crs_info_settings');
601 
602  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
603  $c_gui = new ilConfirmationGUI();
604 
605  // set confirm/cancel commands
606  $c_gui->setFormAction($this->ctrl->getFormAction($this, "deleteInfoFiles"));
607  $c_gui->setHeaderText($this->lng->txt("info_delete_sure"));
608  $c_gui->setCancel($this->lng->txt("cancel"), "editInfo");
609  $c_gui->setConfirm($this->lng->txt("confirm"), "deleteInfoFiles");
610 
611  // add items to delete
612  include_once('Modules/Course/classes/class.ilCourseFile.php');
613  foreach($_POST["file_id"] as $file_id)
614  {
615  $file = new ilCourseFile($file_id);
616  $c_gui->addItem("file_id[]", $file_id, $file->getFileName());
617  }
618 
619  $this->tpl->setContent($c_gui->getHTML());
620  }
621 
628  public function deleteInfoFilesObject()
629  {
630  if(!count($_POST['file_id']))
631  {
632  ilUtil::sendFailure($this->lng->txt('select_one'));
633  $this->editInfoObject();
634  return false;
635  }
636  include_once('Modules/Course/classes/class.ilCourseFile.php');
637 
638  foreach($_POST['file_id'] as $file_id)
639  {
640  $file = new ilCourseFile($file_id);
641  if($this->object->getId() == $file->getCourseId())
642  {
643  $file->delete();
644  }
645  }
646  ilUtil::sendSuccess($this->lng->txt('settings_saved'));
647  $this->editInfoObject();
648  return true;
649  }
650 
658  public function initInfoEditor()
659  {
660  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
661  $form = new ilPropertyFormGUI();
662  $form->setFormAction($this->ctrl->getFormAction($this,'updateInfo'));
663  $form->setMultipart(true);
664  $form->setTitle($this->lng->txt('crs_general_info'));
665  $form->addCommandButton('updateInfo',$this->lng->txt('save'));
666  $form->addCommandButton('cancel',$this->lng->txt('cancel'));
667 
668  $area = new ilTextAreaInputGUI($this->lng->txt('crs_important_info'),'important');
669  $area->setValue($this->object->getImportantInformation());
670  $area->setRows(6);
671  $area->setCols(80);
672  $form->addItem($area);
673 
674  $area = new ilTextAreaInputGUI($this->lng->txt('crs_syllabus'),'syllabus');
675  $area->setValue($this->object->getSyllabus());
676  $area->setRows(6);
677  $area->setCols(80);
678  $form->addItem($area);
679 
681  $section->setTitle($this->lng->txt('crs_info_download'));
682  $form->addItem($section);
683 
684  $file = new ilFileInputGUI($this->lng->txt('crs_file'),'file');
685  $file->enableFileNameSelection('file_name');
686  $form->addItem($file);
687 
689  $section->setTitle($this->lng->txt('crs_contact'));
690  $form->addItem($section);
691 
692  $text = new ilTextInputGUI($this->lng->txt('crs_contact_name'),'contact_name');
693  $text->setValue($this->object->getContactName());
694  $text->setSize(40);
695  $text->setMaxLength(70);
696  $form->addItem($text);
697 
698  $text = new ilTextInputGUI($this->lng->txt('crs_contact_responsibility'),'contact_responsibility');
699  $text->setValue($this->object->getContactResponsibility());
700  $text->setSize(40);
701  $text->setMaxLength(70);
702  $form->addItem($text);
703 
704  $text = new ilTextInputGUI($this->lng->txt('crs_contact_phone'),'contact_phone');
705  $text->setValue($this->object->getContactPhone());
706  $text->setSize(40);
707  $text->setMaxLength(40);
708  $form->addItem($text);
709 
710  $text = new ilTextInputGUI($this->lng->txt('crs_contact_email'),'contact_email');
711  $text->setValue($this->object->getContactEmail());
712  $text->setInfo($this->lng->txt('crs_contact_email_info'));
713  $text->setSize(40);
714  $text->setMaxLength(255);
715  $form->addItem($text);
716 
717  $area = new ilTextAreaInputGUI($this->lng->txt('crs_contact_consultation'),'contact_consultation');
718  $area->setValue($this->object->getContactConsultation());
719  $area->setRows(6);
720  $area->setCols(80);
721  $form->addItem($area);
722 
723  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
724  $this->record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_EDITOR,'crs',$this->object->getId());
725  $this->record_gui->setPropertyForm($form);
726  $this->record_gui->parse();
727 
728  return $form;
729  }
730 
731  function updateInfoObject()
732  {
733  global $ilErr,$ilAccess;
734 
735  $this->checkPermission('write');
736 
737  include_once 'Modules/Course/classes/class.ilCourseFile.php';
738  $file_obj = new ilCourseFile();
739  $file_obj->setCourseId($this->object->getId());
740  $file_obj->setFileName(strlen($_POST['file_name']) ?
741  ilUtil::stripSlashes($_POST['file_name']) :
742  $_FILES['file']['name']);
743  $file_obj->setFileSize($_FILES['file']['size']);
744  $file_obj->setFileType($_FILES['file']['type']);
745  $file_obj->setTemporaryName($_FILES['file']['tmp_name']);
746  $file_obj->setErrorCode($_FILES['file']['error']);
747 
748  $this->object->setImportantInformation(ilUtil::stripSlashes($_POST['important']));
749  $this->object->setSyllabus(ilUtil::stripSlashes($_POST['syllabus']));
750  $this->object->setContactName(ilUtil::stripSlashes($_POST['contact_name']));
751  $this->object->setContactResponsibility(ilUtil::stripSlashes($_POST['contact_responsibility']));
752  $this->object->setContactPhone(ilUtil::stripSlashes($_POST['contact_phone']));
753  $this->object->setContactEmail(ilUtil::stripSlashes($_POST['contact_email']));
754  $this->object->setContactConsultation(ilUtil::stripSlashes($_POST['contact_consultation']));
755 
756 
757  // validate
758 
759  $error = false;
760  $ilErr->setMessage('');
761 
762  $file_obj->validate();
763  $this->object->validateInfoSettings();
764  if(strlen($ilErr->getMessage()))
765  {
766  $error = $ilErr->getMessage();
767  }
768 
769  // needed for proper advanced MD validation
770  $form = $this->initInfoEditor();
771  $form->checkInput();
772  if(!$this->record_gui->importEditFormPostValues())
773  {
774  $error = true;
775  }
776 
777  if($error)
778  {
779  if($error !== true)
780  {
781  ilUtil::sendFailure($ilErr->getMessage());
782  }
783  $this->editInfoObject($form);
784  return false;
785  }
786 
787  $this->object->update();
788  $file_obj->create();
789  $this->record_gui->writeEditForm();
790 
791 
792  // Update ecs content
793  include_once 'Modules/Course/classes/class.ilECSCourseSettings.php';
794  $ecs = new ilECSCourseSettings($this->object);
795  $ecs->handleContentUpdate();
796 
797  ilUtil::sendSuccess($this->lng->txt("crs_settings_saved"));
798  $this->editInfoObject();
799  return true;
800  }
801 
802 
808  public function updateObject()
809  {
810  $form = $this->initEditForm();
811 
812  if(!$form->checkInput())
813  {
814  $form->setValuesByPost();
815  ilUtil::sendFailure($GLOBALS['DIC']->language()->txt('err_check_input'));
816  return $this->editObject($form);
817  }
818 
819  // check successful
820 
821  // title/desc
822  $this->object->setTitle($form->getInput('title'));
823  $this->object->setDescription($form->getInput('desc'));
824 
825  // period
826  $crs_period = $form->getItemByPostVar("period");
827  $this->object->setCourseStart($crs_period->getStart());
828  $this->object->setCourseEnd($crs_period->getEnd());
829 
830  // activation/online
831  $this->object->setOfflineStatus((bool) !$form->getInput('activation_online'));
832 
833  // activation period
834  $period = $form->getItemByPostVar("access_period");
835  if($period->getStart() && $period->getEnd())
836  {
837  $this->object->setActivationType(IL_CRS_ACTIVATION_LIMITED);
838  $this->object->setActivationStart($period->getStart()->get(IL_CAL_UNIX));
839  $this->object->setActivationEnd($period->getEnd()->get(IL_CAL_UNIX));
840  $this->object->setActivationVisibility((int) $form->getInput('activation_visibility'));
841  }
842  else
843  {
844  $this->object->setActivationType(IL_CRS_ACTIVATION_UNLIMITED);
845  $this->object->setActivationStart(null);
846  $this->object->setActivationEnd(null);
847  }
848 
849  // subscription settings
850  $this->object->setSubscriptionPassword($form->getInput('subscription_password'));
851  $this->object->setSubscriptionStart(null);
852  $this->object->setSubscriptionEnd(null);
853 
854  $sub_type = $form->getInput('subscription_type');
855  $sub_period = $form->getItemByPostVar('subscription_period');
856 
857  $this->object->setSubscriptionType($sub_type);
858  if($sub_type != IL_CRS_SUBSCRIPTION_DEACTIVATED)
859  {
860  if($sub_period->getStart() && $sub_period->getEnd())
861  {
862  $this->object->setSubscriptionLimitationType(IL_CRS_SUBSCRIPTION_LIMITED);
863  $this->object->setSubscriptionStart($sub_period->getStart()->get(IL_CAL_UNIX));
864  $this->object->setSubscriptionEnd($sub_period->getEnd()->get(IL_CAL_UNIX));
865  }
866  else
867  {
868  $this->object->setSubscriptionLimitationType(IL_CRS_SUBSCRIPTION_UNLIMITED);
869  }
870  }
871  else
872  {
873  $this->object->setSubscriptionType(IL_CRS_SUBSCRIPTION_DIRECT);
874  $this->object->setSubscriptionLimitationType(IL_CRS_SUBSCRIPTION_DEACTIVATED);
875  }
876 
877  // registration code
878  $this->object->enableRegistrationAccessCode((int) $form->getInput('reg_code_enabled'));
879  $this->object->setRegistrationAccessCode($form->getInput('reg_code'));
880 
881  // cancellation end
882  $this->object->setCancellationEnd($form->getItemByPostVar("cancel_end")->getDate());
883 
884  // waiting list
885  $this->object->enableSubscriptionMembershipLimitation((int) $form->getInput('subscription_membership_limitation'));
886  $this->object->setSubscriptionMaxMembers((int) $form->getInput('subscription_max'));
887  $this->object->setSubscriptionMinMembers((int) $form->getInput('subscription_min'));
888  $old_autofill = $this->object->hasWaitingListAutoFill();
889  switch((int) $form->getInput('waiting_list'))
890  {
891  case 2:
892  $this->object->enableWaitingList(true);
893  $this->object->setWaitingListAutoFill(true);
894  break;
895 
896  case 1:
897  $this->object->enableWaitingList(true);
898  $this->object->setWaitingListAutoFill(false);
899  break;
900 
901  default:
902  $this->object->enableWaitingList(false);
903  $this->object->setWaitingListAutoFill(false);
904  break;
905  }
906 
907  // view mode settings
908  $this->object->setViewMode((int) $form->getInput('view_mode'));
909  if($this->object->getViewMode() == IL_CRS_VIEW_TIMING)
910  {
911  $this->object->setOrderType(ilContainer::SORT_ACTIVATION);
912  }
913  else
914  {
915  $this->object->setOrderType($form->getInput('sorting'));
916  }
917  $this->saveSortingSettings($form);
918 
919  $this->object->setAboStatus((int) $form->getInput('abo'));
920  $this->object->setShowMembers((int) $form->getInput('show_members'));
921  $this->object->setMailToMembersType((int) $form->getInput('mail_type'));
922 
923  $this->object->enableSessionLimit((int) $form->getInput('sl'));
924 
925  $session_sp = $form->getInput('sp');
926  $this->object->setNumberOfPreviousSessions(is_numeric($session_sp) ? (int) $session_sp : -1 );
927  $session_sn = $form->getInput('sn');
928  $this->object->setNumberOfnextSessions(is_numeric($session_sn) ? (int) $session_sn : -1 );
929  $this->object->setAutoNotification($form->getInput('auto_notification') == 1 ? true : false);
930 
931  // lp sync
932  $show_lp_sync_confirmation = false;
933 
934  // could be hidden in form
935  if(isset($_POST['status_dt']))
936  {
937  if(
938  $this->object->getStatusDetermination() != ilObjCourse::STATUS_DETERMINATION_LP &&
939  (int)$_POST['status_dt'] == ilObjCourse::STATUS_DETERMINATION_LP
940  )
941  {
942  $show_lp_sync_confirmation = true;
943  }
944  else
945  {
946  $this->object->setStatusDetermination((int) $form->getInput('status_dt'));
947  }
948  }
949 
950  if(!$old_autofill && $this->object->hasWaitingListAutoFill())
951  {
952  $this->object->handleAutoFill();
953  }
954  $this->object->update();
955 
956 
957  include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
959  $this->object->getId(),
960  $form,
961  array(
968  )
969  );
970 
971  require_once('Services/Tracking/classes/class.ilChangeEvent.php');
972  global $ilUser;
973  ilChangeEvent::_recordWriteEvent($this->object->getId(), $ilUser->getId(), 'update');
974  ilChangeEvent::_catchupWriteEvents($this->object->getId(), $ilUser->getId());
975 
976  // lp sync confirmation required
977  if($show_lp_sync_confirmation)
978  {
979  return $this->confirmLPSync();
980  }
981 
982  // Update ecs export settings
983  include_once 'Modules/Course/classes/class.ilECSCourseSettings.php';
984  $ecs = new ilECSCourseSettings($this->object);
985  if(!$ecs->handleSettingsUpdate())
986  {
987  $form->setValuesByPost();
988  ilUtil::sendFailure($GLOBALS['DIC']->language()->txt('err_check_input'));
989  return $this->editObject($form);
990  }
991 
992  return $this->afterUpdate();
993  }
994 
995  protected function confirmLPSync()
996  {
997  global $tpl;
998 
999  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1000  $cgui = new ilConfirmationGUI();
1001  $cgui->setFormAction($this->ctrl->getFormAction($this, "setLPSync"));
1002  $cgui->setHeaderText($this->lng->txt("crs_status_determination_sync"));
1003  $cgui->setCancel($this->lng->txt("cancel"), "edit");
1004  $cgui->setConfirm($this->lng->txt("confirm"), "setLPSync");
1005 
1006  $tpl->setContent($cgui->getHTML());
1007  }
1008 
1009  protected function setLPSyncObject()
1010  {
1011  $this->object->setStatusDetermination(ilObjCourse::STATUS_DETERMINATION_LP);
1012  $this->object->update();
1013 
1014  $this->object->syncMembersStatusWithLP();
1015 
1016  ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
1017  $this->ctrl->redirect($this, "edit");
1018  }
1019 
1026  public function editObject(ilPropertyFormGUI $form = null)
1027  {
1028  $this->setSubTabs('properties');
1029  $this->tabs_gui->setSubTabActive('crs_settings');
1030 
1031  if($form instanceof ilPropertyFormGUI)
1032  {
1033  $GLOBALS['tpl']->setContent($form->getHTML());
1034  return true;
1035  }
1036  else
1037  {
1038  parent::editObject();
1039  }
1040  }
1041 
1049  protected function initEditForm()
1050  {
1051  include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
1052  include_once('./Services/Calendar/classes/class.ilDateTime.php');
1053 
1054  $form = new ilPropertyFormGUI();
1055  $form->setTitle($this->lng->txt('crs_edit'));
1056 
1057  $form->addCommandButton('update',$this->lng->txt('save'));
1058  $form->addCommandButton('cancel',$this->lng->txt('cancel'));
1059 
1060  $form->setFormAction($this->ctrl->getFormAction($this,'update'));
1061 
1062  // title
1063  $title = new ilTextInputGUI($this->lng->txt('title'),'title');
1064  $title->setSubmitFormOnEnter(true);
1065  $title->setValue($this->object->getTitle());
1066  $title->setSize(min(40, ilObject::TITLE_LENGTH));
1067  $title->setMaxLength(ilObject::TITLE_LENGTH);
1068  $title->setRequired(true);
1069  $form->addItem($title);
1070 
1071  // desc
1072  $desc = new ilTextAreaInputGUI($this->lng->txt('description'),'desc');
1073  $desc->setValue($this->object->getLongDescription());
1074  $desc->setRows(2);
1075  $desc->setCols(40);
1076  $form->addItem($desc);
1077 
1078  // Show didactic template type
1079  $this->initDidacticTemplate($form);
1080 
1081  // period
1082  include_once "Services/Form/classes/class.ilDateDurationInputGUI.php";
1083  $cdur = new ilDateDurationInputGUI($this->lng->txt('crs_period'), 'period');
1084  $cdur->setInfo($this->lng->txt('crs_period_info'));
1085  if($this->object->getCourseStart())
1086  {
1087  $cdur->setStart($this->object->getCourseStart());
1088  }
1089  if($this->object->getCourseStart())
1090  {
1091  $cdur->setEnd($this->object->getCourseEnd());
1092  }
1093  $form->addItem($cdur);
1094 
1095 
1096  // activation/availability
1097 
1098  $this->lng->loadLanguageModule('rep');
1099 
1101  $section->setTitle($this->lng->txt('rep_activation_availability'));
1102  $form->addItem($section);
1103 
1104  $online = new ilCheckboxInputGUI($this->lng->txt('rep_activation_online'),'activation_online');
1105  $online->setChecked(!$this->object->getOfflineStatus());
1106  $online->setInfo($this->lng->txt('crs_activation_online_info'));
1107  $form->addItem($online);
1108 
1109  // $act_type = new ilCheckboxInputGUI($this->lng->txt('crs_visibility_until'), 'activation_type');
1110  // $act_type->setInfo($this->lng->txt('crs_visibility_until_info'));
1111  // $act_type->setChecked($this->object->getActivationType() == IL_CRS_ACTIVATION_LIMITED);
1112  // $form->addItem($act_type);
1113 
1114  include_once "Services/Form/classes/class.ilDateDurationInputGUI.php";
1115  $dur = new ilDateDurationInputGUI($this->lng->txt('rep_time_period'), "access_period");
1116  $dur->setShowTime(true);
1117  $dur->setStart(new ilDateTime($this->object->getActivationStart(),IL_CAL_UNIX));
1118  $dur->setEnd(new ilDateTime($this->object->getActivationEnd(),IL_CAL_UNIX));
1119  $form->addItem($dur);
1120 
1121  $visible = new ilCheckboxInputGUI($this->lng->txt('rep_activation_limited_visibility'), 'activation_visibility');
1122  $visible->setInfo($this->lng->txt('crs_activation_limited_visibility_info'));
1123  $visible->setChecked($this->object->getActivationVisibility());
1124  $dur->addSubItem($visible);
1125 
1126 
1128  $section->setTitle($this->lng->txt('crs_reg'));
1129  $form->addItem($section);
1130 
1131  $reg_proc = new ilRadioGroupInputGUI($this->lng->txt('crs_registration_type'),'subscription_type');
1132  $reg_proc->setValue(
1133  ($this->object->getSubscriptionLimitationType() != IL_CRS_SUBSCRIPTION_DEACTIVATED)
1134  ? $this->object->getSubscriptionType()
1136  // $reg_proc->setInfo($this->lng->txt('crs_reg_type_info'));
1137 
1138  $opt = new ilRadioOption($this->lng->txt('crs_subscription_options_direct'),IL_CRS_SUBSCRIPTION_DIRECT);
1139  $reg_proc->addOption($opt);
1140 
1141  $opt = new ilRadioOption($this->lng->txt('crs_subscription_options_password'),IL_CRS_SUBSCRIPTION_PASSWORD);
1142 
1143  $pass = new ilTextInputGUI($this->lng->txt("password"),'subscription_password');
1144  $pass->setInfo($this->lng->txt('crs_reg_password_info'));
1145  $pass->setSubmitFormOnEnter(true);
1146  $pass->setSize(12);
1147  $pass->setMaxLength(12);
1148  $pass->setValue($this->object->getSubscriptionPassword());
1149 
1150  $opt->addSubItem($pass);
1151  $reg_proc->addOption($opt);
1152 
1153  $opt = new ilRadioOption($this->lng->txt('crs_subscription_options_confirmation'),IL_CRS_SUBSCRIPTION_CONFIRMATION);
1154  $opt->setInfo($this->lng->txt('crs_registration_confirmation_info'));
1155  $reg_proc->addOption($opt);
1156 
1157  $opt = new ilRadioOption($this->lng->txt('crs_reg_no_selfreg'),IL_CRS_SUBSCRIPTION_DEACTIVATED);
1158  $opt->setInfo($this->lng->txt('crs_registration_deactivated'));
1159  $reg_proc->addOption($opt);
1160 
1161  $form->addItem($reg_proc);
1162 
1163 
1164  // Registration codes
1165  $reg_code = new ilCheckboxInputGUI($this->lng->txt('crs_reg_code'),'reg_code_enabled');
1166  $reg_code->setChecked($this->object->isRegistrationAccessCodeEnabled());
1167  $reg_code->setValue(1);
1168  $reg_code->setInfo($this->lng->txt('crs_reg_code_enabled_info'));
1169 
1170  /*
1171  $code = new ilNonEditableValueGUI($this->lng->txt('crs_reg_code_value'));
1172  $code->setValue($this->object->getRegistrationAccessCode());
1173  $reg_code->addSubItem($code);
1174  */
1175 
1176  #$link = new ilNonEditableValueGUI($this->lng->txt('crs_reg_code_link'));
1177  // Create default access code
1178  if(!$this->object->getRegistrationAccessCode())
1179  {
1180  include_once './Services/Membership/classes/class.ilMembershipRegistrationCodeUtils.php';
1181  $this->object->setRegistrationAccessCode(ilMembershipRegistrationCodeUtils::generateCode());
1182  }
1183  $reg_link = new ilHiddenInputGUI('reg_code');
1184  $reg_link->setValue($this->object->getRegistrationAccessCode());
1185  $form->addItem($reg_link);
1186 
1187  $link = new ilCustomInputGUI($this->lng->txt('crs_reg_code_link'));
1188  include_once './Services/Link/classes/class.ilLink.php';
1189  $val = ilLink::_getLink($this->object->getRefId(),$this->object->getType(),array(),'_rcode'.$this->object->getRegistrationAccessCode());
1190  $link->setHTML('<font class="small">'.$val.'</font>');
1191  $reg_code->addSubItem($link);
1192 
1193  $form->addItem($reg_code);
1194 
1195  // time limit
1196  include_once "Services/Form/classes/class.ilDateDurationInputGUI.php";
1197  $sdur = new ilDateDurationInputGUI($this->lng->txt('crs_registration_limited'), "subscription_period");
1198  $sdur->setShowTime(true);
1199  if($this->object->getSubscriptionStart())
1200  {
1201  $sdur->setStart(new ilDateTime($this->object->getSubscriptionStart(),IL_CAL_UNIX));
1202  }
1203  if($this->object->getSubscriptionEnd())
1204  {
1205  $sdur->setEnd(new ilDateTime($this->object->getSubscriptionEnd(),IL_CAL_UNIX));
1206  }
1207  $form->addItem($sdur);
1208 
1209  // cancellation limit
1210  $cancel = new ilDateTimeInputGUI($this->lng->txt('crs_cancellation_end'), 'cancel_end');
1211  $cancel->setInfo($this->lng->txt('crs_cancellation_end_info'));
1212  $cancel_end = $this->object->getCancellationEnd();
1213  if($cancel_end)
1214  {
1215  $cancel->setDate($cancel_end);
1216  }
1217  $form->addItem($cancel);
1218 
1219  // Max members
1220  $lim = new ilCheckboxInputGUI($this->lng->txt('crs_subscription_max_members_short'),'subscription_membership_limitation');
1221  $lim->setInfo($this->lng->txt('crs_subscription_max_members_short_info'));
1222  $lim->setValue(1);
1223  $lim->setChecked($this->object->isSubscriptionMembershipLimited());
1224 
1225  $min = new ilTextInputGUI('','subscription_min');
1226  $min->setSubmitFormOnEnter(true);
1227  $min->setSize(4);
1228  $min->setMaxLength(4);
1229  $min->setValue($this->object->getSubscriptionMinMembers() ? $this->object->getSubscriptionMinMembers() : '');
1230  $min->setTitle($this->lng->txt('crs_subscription_min_members'));
1231  $min->setInfo($this->lng->txt('crs_subscription_min_members_info'));
1232  $lim->addSubItem($min);
1233 
1234  $max = new ilTextInputGUI('','subscription_max');
1235  $max->setSubmitFormOnEnter(true);
1236  $max->setSize(4);
1237  $max->setMaxLength(4);
1238  $max->setValue($this->object->getSubscriptionMaxMembers() ? $this->object->getSubscriptionMaxMembers() : '');
1239  $max->setTitle($this->lng->txt('crs_subscription_max_members'));
1240  $max->setInfo($this->lng->txt('crs_reg_max_info'));
1241 
1242  $lim->addSubItem($max);
1243 
1244  /*
1245  $wait = new ilCheckboxInputGUI($this->lng->txt('crs_waiting_list'),'waiting_list');
1246  $wait->setChecked($this->object->enabledWaitingList());
1247  $wait->setInfo($this->lng->txt('crs_wait_info'));
1248  $lim->addSubItem($wait);
1249 
1250  $wait = new ilCheckboxInputGUI($this->lng->txt('crs_waiting_list'),'waiting_list');
1251  $wait->setChecked($this->object->enabledWaitingList());
1252  $wait->setInfo($this->lng->txt('crs_wait_info'));
1253  $lim->addSubItem($wait);
1254 
1255  $auto = new ilCheckboxInputGUI($this->lng->txt('crs_waiting_list_autofill'), 'auto_wait');
1256  $auto->setChecked($this->object->hasWaitingListAutoFill());
1257  $auto->setInfo($this->lng->txt('crs_waiting_list_autofill_info'));
1258  $wait->addSubItem($auto);
1259  */
1260 
1261  $wait = new ilRadioGroupInputGUI($this->lng->txt('crs_waiting_list'), 'waiting_list');
1262 
1263  $option = new ilRadioOption($this->lng->txt('none'), 0);
1264  $wait->addOption($option);
1265 
1266  $option = new ilRadioOption($this->lng->txt('crs_waiting_list_no_autofill'), 1);
1267  $option->setInfo($this->lng->txt('crs_wait_info'));
1268  $wait->addOption($option);
1269 
1270  $option = new ilRadioOption($this->lng->txt('crs_waiting_list_autofill'), 2);
1271  $option->setInfo($this->lng->txt('crs_waiting_list_autofill_info'));
1272  $wait->addOption($option);
1273 
1274  if($this->object->hasWaitingListAutoFill())
1275  {
1276  $wait->setValue(2);
1277  }
1278  else if($this->object->enabledWaitingList())
1279  {
1280  $wait->setValue(1);
1281  }
1282 
1283  $lim->addSubItem($wait);
1284 
1285  $form->addItem($lim);
1286 
1287 
1288  $pres = new ilFormSectionHeaderGUI();
1289  $pres->setTitle($this->lng->txt('crs_view_mode'));
1290 
1291  $form->addItem($pres);
1292 
1293  // presentation type
1294  $view_type = new ilRadioGroupInputGUI($this->lng->txt('crs_presentation_type'),'view_mode');
1295  $view_type->setValue($this->object->getViewMode());
1296 
1297  $opts = new ilRadioOption($this->lng->txt('cntr_view_sessions'),IL_CRS_VIEW_SESSIONS);
1298  $opts->setInfo($this->lng->txt('cntr_view_info_sessions'));
1299  $view_type->addOption($opts);
1300 
1301  // Limited sessions
1302  $sess = new ilCheckboxInputGUI($this->lng->txt('sess_limit'),'sl');
1303  $sess->setValue(1);
1304  $sess->setChecked($this->object->isSessionLimitEnabled());
1305  $sess->setInfo($this->lng->txt('sess_limit_info'));
1306 
1307  $prev = new ilNumberInputGUI($this->lng->txt('sess_num_prev'),'sp');
1308  #$prev->setSubmitFormOnEnter(true);
1309  $prev->setMinValue(0);
1310  $prev->setValue($this->object->getNumberOfPreviousSessions() == -1 ?
1311  '' :
1312  $this->object->getNumberOfPreviousSessions()
1313  );
1314  $prev->setSize(2);
1315  $prev->setMaxLength(3);
1316  $sess->addSubItem($prev);
1317 
1318  $next = new ilNumberInputGUI($this->lng->txt('sess_num_next'),'sn');
1319  #$next->setSubmitFormOnEnter(true);
1320  $next->setMinValue(0);
1321  $next->setValue($this->object->getNumberOfNextSessions() == -1 ?
1322  '' :
1323  $this->object->getNumberOfnextSessions()
1324  );
1325  $next->setSize(2);
1326  $next->setMaxLength(3);
1327  $sess->addSubItem($next);
1328 
1329  $opts->addSubItem($sess);
1330 
1331 
1332 
1333 
1334  $optsi = new ilRadioOption($this->lng->txt('cntr_view_simple'),IL_CRS_VIEW_SIMPLE);
1335  $optsi->setInfo($this->lng->txt('cntr_view_info_simple'));
1336  $view_type->addOption($optsi);
1337 
1338  $optbt = new ilRadioOption($this->lng->txt('cntr_view_by_type'),IL_CRS_VIEW_BY_TYPE);
1339  $optbt->setInfo($this->lng->txt('cntr_view_info_by_type'));
1340  $view_type->addOption($optbt);
1341 
1342  $opto = new ilRadioOption($this->lng->txt('crs_view_objective'),IL_CRS_VIEW_OBJECTIVE);
1343  $opto->setInfo($this->lng->txt('crs_view_info_objective'));
1344  $view_type->addOption($opto);
1345 
1346  $optt = new ilRadioOption($this->lng->txt('crs_view_timing'),IL_CRS_VIEW_TIMING);
1347  $optt->setInfo($this->lng->txt('crs_view_info_timing'));
1348  $view_type->addOption($optt);
1349 
1350  $form->addItem($view_type);
1351 
1352  $this->initSortingForm(
1353  $form,
1354  array(
1359  )
1360  );
1361 
1362 
1363 
1364  // lp vs. course status
1365  include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
1367  {
1368  include_once './Services/Object/classes/class.ilObjectLP.php';
1369  $olp = ilObjectLP::getInstance($this->object->getId());
1370  if($olp->getCurrentMode())
1371  {
1372  $lp_status = new ilFormSectionHeaderGUI();
1373  $lp_status->setTitle($this->lng->txt('crs_course_status_of_users'));
1374  $form->addItem($lp_status);
1375 
1376  $lp_status_options = new ilRadioGroupInputGUI($this->lng->txt('crs_status_determination'), "status_dt");
1377 // $lp_status_options->setRequired(true);
1378  $lp_status_options->setValue($this->object->getStatusDetermination());
1379 
1380  $lp_option = new ilRadioOption($this->lng->txt('crs_status_determination_lp'),
1381  ilObjCourse::STATUS_DETERMINATION_LP, $this->lng->txt('crs_status_determination_lp_info'));
1382  $lp_status_options->addOption($lp_option);
1383  $lp_status_options->addOption(new ilRadioOption($this->lng->txt('crs_status_determination_manual'),
1385 
1386  $form->addItem($lp_status_options);
1387  }
1388  }
1389 
1390  // additional features
1391  $feat = new ilFormSectionHeaderGUI();
1392  $feat->setTitle($this->lng->txt('obj_features'));
1393  $form->addItem($feat);
1394 
1395  include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
1397  $this->object->getId(),
1398  $form,
1399  array(
1406  )
1407  );
1408 
1409  $mem = new ilCheckboxInputGUI($this->lng->txt('crs_show_members'),'show_members');
1410  $mem->setChecked($this->object->getShowMembers());
1411  $mem->setInfo($this->lng->txt('crs_show_members_info'));
1412  $form->addItem($mem);
1413 
1414  // Show members type
1415  $mail_type = new ilRadioGroupInputGUI($this->lng->txt('crs_mail_type'), 'mail_type');
1416  $mail_type->setValue($this->object->getMailToMembersType());
1417 
1418  $mail_tutors = new ilRadioOption($this->lng->txt('crs_mail_tutors_only'), ilCourseConstants::MAIL_ALLOWED_TUTORS,
1419  $this->lng->txt('crs_mail_tutors_only_info'));
1420  $mail_type->addOption($mail_tutors);
1421 
1422  $mail_all = new ilRadioOption($this->lng->txt('crs_mail_all'), ilCourseConstants::MAIL_ALLOWED_ALL,
1423  $this->lng->txt('crs_mail_all_info'));
1424  $mail_type->addOption($mail_all);
1425  $form->addItem($mail_type);
1426 
1427  // Notification Settings
1428  /*$notification = new ilFormSectionHeaderGUI();
1429  $notification->setTitle($this->lng->txt('crs_notification'));
1430  $form->addItem($notification);*/
1431 
1432  // Self notification
1433  $not = new ilCheckboxInputGUI($this->lng->txt('crs_auto_notification'), 'auto_notification');
1434  $not->setValue(1);
1435  $not->setInfo($this->lng->txt('crs_auto_notification_info'));
1436  $not->setChecked( $this->object->getAutoNotification() );
1437  $form->addItem($not);
1438 
1439 
1440  // Further information
1441  //$further = new ilFormSectionHeaderGUI();
1442  //$further->setTitle($this->lng->txt('crs_further_settings'));
1443  //$form->addItem($further);
1444 
1445  $desk = new ilCheckboxInputGUI($this->lng->txt('crs_add_remove_from_desktop'),'abo');
1446  $desk->setChecked($this->object->getAboStatus());
1447  $desk->setInfo($this->lng->txt('crs_add_remove_from_desktop_info'));
1448  $form->addItem($desk);
1449 
1450 
1451  // Edit ecs export settings
1452  include_once 'Modules/Course/classes/class.ilECSCourseSettings.php';
1453  $ecs = new ilECSCourseSettings($this->object);
1454  $ecs->addSettingsToForm($form, 'crs');
1455 
1456  return $form;
1457  }
1458 
1459  protected function getEditFormValues()
1460  {
1461  // values are done in initEditForm()
1462  }
1463 
1467  function editCourseIconsObject($a_form = null)
1468  {
1469  global $tpl;
1470 
1471  $this->checkPermission('write');
1472 
1473  $this->setSubTabs("properties");
1474  $this->tabs_gui->setTabActive('settings');
1475  $this->tabs_gui->activateSubTab('icon_settings');
1476 
1477  if(!$a_form)
1478  {
1479  $a_form = $this->initCourseIconsForm();
1480  }
1481 
1482  $tpl->setContent($a_form->getHTML());
1483  }
1484 
1486  {
1487  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
1488  $form = new ilPropertyFormGUI();
1489  $form->setFormAction($this->ctrl->getFormAction($this));
1490 
1491  $this->showCustomIconsEditing(1, $form);
1492 
1493  // $form->setTitle($this->lng->txt('edit_grouping'));
1494  $form->addCommandButton('updateCourseIcons', $this->lng->txt('save'));
1495 
1496  return $form;
1497  }
1498 
1499  function sendFileObject()
1500  {
1501  include_once 'Modules/Course/classes/class.ilCourseFile.php';
1502  $file = new ilCourseFile((int) $_GET['file_id']);
1503  ilUtil::deliverFile($file->getAbsolutePath(),$file->getFileName(),$file->getFileType());
1504  return true;
1505  }
1506 
1511  {
1512  global $ilSetting;
1513 
1514  $this->checkPermission('write');
1515 
1516  $form = $this->initCourseIconsForm();
1517  if($form->checkInput())
1518  {
1519  //save custom icons
1520  if ($ilSetting->get("custom_icons"))
1521  {
1522  if($_POST["cont_icon_delete"])
1523  {
1524  $this->object->removeCustomIcon();
1525  }
1526  $this->object->saveIcons($_FILES["cont_icon"]['tmp_name']);
1527  }
1528 
1529  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"),true);
1530  $this->ctrl->redirect($this,"editCourseIcons");
1531  }
1532 
1533  $form->setValuesByPost();
1534  $this->editCourseIconsObject($form);
1535  }
1536 
1537 
1541  function setSubTabs($a_tab)
1542  {
1543  global $rbacsystem,$ilUser,$ilAccess,$tree;
1544 
1545  switch ($a_tab)
1546  {
1547  case "properties":
1548  $this->tabs_gui->addSubTabTarget("crs_settings",
1549  $this->ctrl->getLinkTarget($this,'edit'),
1550  "edit", get_class($this));
1551 
1552  $this->tabs_gui->addSubTabTarget("crs_info_settings",
1553  $this->ctrl->getLinkTarget($this,'editInfo'),
1554  "editInfo", get_class($this));
1555 
1556  $this->tabs_gui->addSubTabTarget("preconditions",
1557  $this->ctrl->getLinkTargetByClass('ilConditionHandlerGUI','listConditions'),
1558  "", "ilConditionHandlerGUI");
1559 
1560  $this->tabs_gui->addSubTabTarget("crs_start_objects",
1561  $this->ctrl->getLinkTargetByClass('ilContainerStartObjectsGUI','listStructure'),
1562  "listStructure", get_class($this));
1563 
1564  $this->tabs_gui->addSubTabTarget('groupings',
1565  $this->ctrl->getLinkTargetByClass('ilobjcoursegroupinggui','listGroupings'),
1566  'listGroupings',
1567  get_class($this));
1568 
1569  // custom icon
1570  if ($this->ilias->getSetting("custom_icons"))
1571  {
1572  $this->tabs_gui->addSubTabTarget("icon_settings",
1573  $this->ctrl->getLinkTarget($this,'editCourseIcons'),
1574  "editCourseIcons", get_class($this));
1575  }
1576 
1577  // map settings
1578  include_once("./Services/Maps/classes/class.ilMapUtil.php");
1579  if (ilMapUtil::isActivated())
1580  {
1581  $this->tabs_gui->addSubTabTarget("crs_map_settings",
1582  $this->ctrl->getLinkTarget($this,'editMapSettings'),
1583  "editMapSettings", get_class($this));
1584  }
1585 
1586 
1587  include_once('Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
1588  include_once('Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
1589  // only show if export permission is granted
1590  if(ilPrivacySettings::_getInstance()->checkExportAccess($this->object->getRefId()) or ilCourseDefinedFieldDefinition::_hasFields($this->object->getId()))
1591  {
1592  $this->tabs_gui->addSubTabTarget('crs_custom_user_fields',
1593  $this->ctrl->getLinkTargetByClass('ilobjectcustomuserfieldsgui'),
1594  '',
1595  'ilobjectcustomuserfieldsgui');
1596  }
1597 
1598  // certificates
1599  include_once "Services/Certificate/classes/class.ilCertificate.php";
1601  {
1602  $this->tabs_gui->addSubTabTarget(
1603  "certificate",
1604  $this->ctrl->getLinkTargetByClass("ilcertificategui", "certificateeditor"),
1605  "", "ilcertificategui");
1606  }
1607  // news settings
1608  if ($this->object->getUseNews())
1609  {
1610  $this->tabs_gui->addSubTab('obj_news_settings',
1611  $this->lng->txt("cont_news_settings"),
1612  $this->ctrl->getLinkTargetByClass('ilcontainernewssettingsgui'));
1613  }
1614  break;
1615 
1616  }
1617  }
1618 
1623  {
1624  if ($this->object->getViewMode() == ilContainer::VIEW_OBJECTIVE
1625  && !$this->isActiveAdministrationPanel())
1626  {
1627  return false;
1628  }
1629  parent::showPossibleSubObjects();
1630  }
1631 
1638  {
1639  $this->object->removeSmallIcon();
1640  $this->ctrl->redirect($this,'editCourseIcons');
1641  }
1642 
1649  {
1650  $this->object->removeBigIcon();
1651  $this->ctrl->redirect($this,'editCourseIcons');
1652  }
1653 
1654 
1661  {
1662  $this->object->removeTinyIcon();
1663  $this->ctrl->redirect($this,'editCourseIcons');
1664  }
1665 
1670  protected function afterSave(ilObject $a_new_object)
1671  {
1672  global $rbacadmin, $ilUser, $ilSetting;
1673 
1674  $a_new_object->getMemberObject()->add($ilUser->getId(),IL_CRS_ADMIN);
1675  $a_new_object->getMemberObject()->updateNotification($ilUser->getId(),$ilSetting->get('mail_crs_admin_notification', true));
1676  // cognos-blu-patch: begin
1677  $a_new_object->getMemberObject()->updateContact($ilUser->getId(),1);
1678  // cognos-blu-patch: end
1679  $a_new_object->update();
1680 
1681  // BEGIN ChangeEvent: Record write event.
1682  require_once('Services/Tracking/classes/class.ilChangeEvent.php');
1683  global $ilUser;
1684  ilChangeEvent::_recordWriteEvent($a_new_object->getId(), $ilUser->getId(), 'create');
1685  // END ChangeEvent: Record write event.
1686 
1687  // always send a message
1688  ilUtil::sendSuccess($this->lng->txt("crs_added"),true);
1689 
1690  $this->ctrl->setParameter($this, "ref_id", $a_new_object->getRefId());
1691  ilUtil::redirect($this->getReturnLocation("save",
1692  $this->ctrl->getLinkTarget($this, "edit", "", false, false)));
1693  }
1694 
1701  public function setShowHidePrefs()
1702  {
1703  global $ilUser;
1704 
1705  if(isset($_GET['admin_hide']))
1706  {
1707  $ilUser->writePref('crs_admin_hide',(int) $_GET['admin_hide']);
1708  }
1709  if(isset($_GET['tutor_hide']))
1710  {
1711  $ilUser->writePref('crs_tutor_hide',(int) $_GET['tutor_hide']);
1712  }
1713  if(isset($_GET['member_hide']))
1714  {
1715  $ilUser->writePref('crs_member_hide',(int) $_GET['member_hide']);
1716  }
1717  if(isset($_GET['subscriber_hide']))
1718  {
1719  $ilUser->writePref('crs_subscriber_hide',(int) $_GET['subscriber_hide']);
1720  }
1721  if(isset($_GET['wait_hide']))
1722  {
1723  $ilUser->writePref('crs_wait_hide',(int) $_GET['wait_hide']);
1724  }
1725  include_once './Modules/Course/classes/class.ilCourseParticipants.php';
1726  foreach(ilCourseParticipants::getMemberRoles($this->object->getRefId()) as $role_id)
1727  {
1728  if(isset($_GET['role_hide_'.$role_id]))
1729  {
1730  $ilUser->writePref('crs_role_hide_'.$role_id,(int) $_GET['role_hide_'.$role_id]);
1731  }
1732  }
1733  }
1734 
1735  public function readMemberData($ids,$selected_columns = null)
1736  {
1737  include_once './Services/Tracking/classes/class.ilObjUserTracking.php';
1738  $this->show_tracking =
1741  );
1742  if($this->show_tracking)
1743  {
1744  include_once('./Services/Object/classes/class.ilObjectLP.php');
1745  $olp = ilObjectLP::getInstance($this->object->getId());
1746  $this->show_tracking = $olp->isActive();
1747  }
1748 
1749  if($this->show_tracking)
1750  {
1751  include_once 'Services/Tracking/classes/class.ilLPStatusWrapper.php';
1752  $completed = ilLPStatusWrapper::_lookupCompletedForObject($this->object->getId());
1753  $in_progress = ilLPStatusWrapper::_lookupInProgressForObject($this->object->getId());
1755  }
1756  include_once('./Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
1757  $privacy = ilPrivacySettings::_getInstance();
1758 
1759  if($privacy->enabledCourseAccessTimes())
1760  {
1761  include_once('./Services/Tracking/classes/class.ilLearningProgress.php');
1762  $progress = ilLearningProgress::_lookupProgressByObjId($this->object->getId());
1763  }
1764 
1765  $do_prtf = (is_array($selected_columns) &&
1766  in_array('prtf', $selected_columns) &&
1767  is_array($ids));
1768  if($do_prtf)
1769  {
1770  include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
1772  $this->ctrl->getLinkTarget($this, "members"));
1773  }
1774 
1775  foreach((array) $ids as $usr_id)
1776  {
1777  $name = ilObjUser::_lookupName($usr_id);
1778  $tmp_data['firstname'] = $name['firstname'];
1779  $tmp_data['lastname'] = $name['lastname'];
1780  $tmp_data['login'] = ilObjUser::_lookupLogin($usr_id);
1781  $tmp_data['passed'] = $this->object->getMembersObject()->hasPassed($usr_id) ? 1 : 0;
1782  if($this->object->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP)
1783  {
1784  $tmp_data['passed_info'] = $this->object->getMembersObject()->getPassedInfo($usr_id);
1785  }
1786  $tmp_data['notification'] = $this->object->getMembersObject()->isNotificationEnabled($usr_id) ? 1 : 0;
1787  $tmp_data['blocked'] = $this->object->getMembersObject()->isBlocked($usr_id) ? 1 : 0;
1788  // cognos-blu-patch: begin
1789  $tmp_data['contact'] = $this->object->getMembersObject()->isContact($usr_id) ? 1 : 0;
1790  // cognos-blu-patch: end
1791 
1792  $tmp_data['usr_id'] = $usr_id;
1793 
1794  if($this->show_tracking)
1795  {
1796  if(in_array($usr_id,$completed))
1797  {
1798  $tmp_data['progress'] = ilLPStatus::LP_STATUS_COMPLETED;
1799  }
1800  elseif(in_array($usr_id,$in_progress))
1801  {
1802  $tmp_data['progress'] = ilLPStatus::LP_STATUS_IN_PROGRESS;
1803  }
1804  elseif(in_array($usr_id,$failed))
1805  {
1806  $tmp_data['progress'] = ilLPStatus::LP_STATUS_FAILED;
1807  }
1808  else
1809  {
1810  $tmp_data['progress'] = ilLPStatus::LP_STATUS_NOT_ATTEMPTED;
1811  }
1812  }
1813 
1814  if($privacy->enabledCourseAccessTimes())
1815  {
1816  if(isset($progress[$usr_id]['ts']) and $progress[$usr_id]['ts'])
1817  {
1818  $tmp_data['access_ut'] = $progress[$usr_id]['ts'];
1819  $tmp_data['access_time'] = ilDatePresentation::formatDate(new ilDateTime($progress[$usr_id]['ts'],IL_CAL_UNIX));
1820  }
1821  else
1822  {
1823  $tmp_data['access_ut'] = 0;
1824  $tmp_data['access_time'] = $this->lng->txt('no_date');
1825  }
1826  }
1827 
1828  if($do_prtf)
1829  {
1830  $tmp_data['prtf'] = $all_prtf[$usr_id];
1831  }
1832 
1833  $members[$usr_id] = $tmp_data;
1834  }
1835  return $members ? $members : array();
1836  }
1837 
1844  public function updateLPFromStatus($a_member_id, $a_has_passed)
1845  {
1846  global $ilUser;
1847 
1848  include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
1850  $this->object->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP)
1851  {
1852  include_once './Services/Object/classes/class.ilObjectLP.php';
1853  $olp = ilObjectLP::getInstance($this->object->getId());
1854  if($olp->getCurrentMode() == ilLPObjSettings::LP_MODE_MANUAL_BY_TUTOR)
1855  {
1856  include_once 'Services/Tracking/classes/class.ilLPMarks.php';
1857  $marks = new ilLPMarks($this->object->getId(), $a_member_id);
1858 
1859  // only if status has changed
1860  if($marks->getCompleted() != $a_has_passed)
1861  {
1862  $marks->setCompleted($a_has_passed);
1863  $marks->update();
1864 
1865  // as course is origin of LP status change, block syncing
1866  include_once("./Modules/Course/classes/class.ilCourseAppEventListener.php");
1868 
1869  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
1870  ilLPStatusWrapper::_updateStatus($this->object->getId(), $a_member_id);
1871  }
1872  }
1873  }
1874  }
1875 
1876 
1877 
1878  function autoFillObject()
1879  {
1880  global $rbacsystem;
1881 
1882  $this->checkPermission('write');
1883 
1884  if($this->object->isSubscriptionMembershipLimited() and $this->object->getSubscriptionMaxMembers() and
1885  $this->object->getSubscriptionMaxMembers() <= $this->object->getMembersObject()->getCountMembers())
1886  {
1887  ilUtil::sendFailure($this->lng->txt("crs_max_members_reached"));
1888  $this->membersObject();
1889 
1890  return false;
1891  }
1892  if($number = $this->object->getMembersObject()->autoFillSubscribers())
1893  {
1894  ilUtil::sendSuccess($this->lng->txt("crs_number_users_added")." ".$number);
1895  }
1896  else
1897  {
1898  ilUtil::sendFailure($this->lng->txt("crs_no_users_added"));
1899  }
1900  $this->membersObject();
1901 
1902  return true;
1903  }
1904 
1905  public function leaveObject()
1906  {
1907  global $ilUser;
1908 
1909  $this->checkPermission('leave');
1910 
1911  if($this->object->getMembersObject()->isLastAdmin($ilUser->getId()))
1912  {
1913  ilUtil::sendFailure($this->lng->txt('crs_min_one_admin'));
1914  $this->viewObject();
1915  return false;
1916  }
1917 
1918  $this->tabs_gui->setTabActive('crs_unsubscribe');
1919 
1920  include_once "Services/Utilities/classes/class.ilConfirmationGUI.php";
1921  $cgui = new ilConfirmationGUI();
1922  $cgui->setHeaderText($this->lng->txt('crs_unsubscribe_sure'));
1923  $cgui->setFormAction($this->ctrl->getFormAction($this));
1924  $cgui->setCancel($this->lng->txt("cancel"), "cancel");
1925  $cgui->setConfirm($this->lng->txt("crs_unsubscribe"), "performUnsubscribe");
1926  $this->tpl->setContent($cgui->getHTML());
1927  }
1928 
1933  {
1934  $this->leaveObject();
1935  }
1936 
1938  {
1939  global $ilUser, $ilCtrl;
1940 
1941  // CHECK ACCESS
1942  $this->checkPermission('leave');
1943  $this->object->getMembersObject()->delete($this->ilias->account->getId());
1944  $this->object->getMembersObject()->sendUnsubscribeNotificationToAdmins($this->ilias->account->getId());
1945  $this->object->getMembersObject()->sendNotification($this->object->getMembersObject()->NOTIFY_UNSUBSCRIBE,$ilUser->getId());
1946 
1947  ilUtil::sendSuccess($this->lng->txt('crs_unsubscribed_from_crs'),true);
1948 
1949  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->tree->getParentId($this->ref_id));
1950  $ilCtrl->redirectByClass("ilrepositorygui", "");
1951  }
1952 
1956  protected function getAgreementTabs()
1957  {
1958  if ($GLOBALS['ilAccess']->checkAccess('visible','',$this->ref_id))
1959  {
1960  $GLOBALS['ilTabs']->addTarget("info_short",
1961  $this->ctrl->getLinkTargetByClass(
1962  array("ilobjcoursegui", "ilinfoscreengui"), "showSummary"),
1963  "infoScreen"
1964  );
1965  }
1966  if($GLOBALS['ilAccess']->checkAccess('leave','',$this->object->getRefId()) and $this->object->getMemberObject()->isMember())
1967  {
1968  $GLOBALS['ilTabs']->addTarget("crs_unsubscribe",
1969  $this->ctrl->getLinkTarget($this, "unsubscribe"),
1970  'leave',
1971  "");
1972  }
1973 
1974  }
1975 
1982  function addContentTab()
1983  {
1984  $this->tabs_gui->addTab("view_content", $this->lng->txt("content"),
1985  $this->ctrl->getLinkTarget($this, "view"));
1986  }
1987 
1991  function getTabs()
1992  {
1993  global $rbacsystem,$ilAccess,$ilUser, $lng, $ilHelp;
1994 
1995  $ilHelp->setScreenIdComponent("crs");
1996 
1997  $this->ctrl->setParameter($this,"ref_id",$this->ref_id);
1998 
1999  if($ilAccess->checkAccess('read','',$this->ref_id))
2000  {
2001  // default activation
2002  $this->tabs_gui->activateTab('view_content');
2003  if ($this->object->isNewsTimelineEffective())
2004  {
2005  if (!$this->object->isNewsTimelineLandingPageEffective())
2006  {
2007  $this->addContentTab();
2008  }
2009  $this->tabs_gui->addTab("news_timeline", $lng->txt("cont_news_timeline_tab"),
2010  $this->ctrl->getLinkTargetByClass("ilnewstimelinegui", "show"));
2011  if ($this->object->isNewsTimelineLandingPageEffective())
2012  {
2013  $this->addContentTab();
2014  }
2015  }
2016  else
2017  {
2018  $this->addContentTab();
2019  }
2020  }
2021 
2022  // learning objectives
2023  if($ilAccess->checkAccess('write','',$this->ref_id))
2024  {
2025  include_once('./Modules/Course/classes/class.ilCourseObjective.php');
2026  if($this->object->getViewMode() == IL_CRS_VIEW_OBJECTIVE or ilCourseObjective::_getCountObjectives($this->object->getId()))
2027  {
2028  $this->tabs_gui->addTarget(
2029  'crs_objectives',
2030  $this->ctrl->getLinkTargetByClass('illoeditorgui',''),
2031  'illoeditorgui'
2032  );
2033 
2034  }
2035  }
2036 
2037  if ($ilAccess->checkAccess('visible','',$this->ref_id))
2038  {
2039  //$next_class = $this->ctrl->getNextClass($this);
2040 
2041  // this is not nice. tabs should be displayed in ilcoursegui
2042  // not via ilrepositorygui, then next_class == ilinfoscreengui
2043  // could be checked
2044  $force_active = (strtolower($_GET["cmdClass"]) == "ilinfoscreengui"
2045  || strtolower($_GET["cmdClass"]) == "ilnotegui")
2046  ? true
2047  : false;
2048  $this->tabs_gui->addTarget("info_short",
2049  $this->ctrl->getLinkTargetByClass(
2050  array("ilobjcoursegui", "ilinfoscreengui"), "showSummary"),
2051  "infoScreen",
2052  "", "", $force_active);
2053  }
2054  if ($ilAccess->checkAccess('write','',$this->ref_id))
2055  {
2056  $force_active = (strtolower($_GET["cmdClass"]) == "ilconditionhandlergui"
2057  && $_GET["item_id"] == "")
2058  ? true
2059  : false;
2060  $this->tabs_gui->addTarget("settings",
2061  $this->ctrl->getLinkTarget($this, "edit"),
2062  array("edit", "editMapSettings", "editCourseIcons", "listStructure"), "", "", $force_active);
2063  }
2064 
2065 
2066  include_once './Modules/Course/classes/class.ilCourseParticipants.php';
2067  $is_participant = ilCourseParticipants::_isParticipant($this->ref_id, $ilUser->getId());
2068  include_once './Services/Mail/classes/class.ilMail.php';
2069  $mail = new ilMail($GLOBALS['ilUser']->getId());
2070 
2071  include_once './Modules/Course/classes/class.ilCourseMembershipGUI.php';
2072  $membership_gui = new ilCourseMembershipGUI($this, $this->object);
2073  $membership_gui->addMemberTab($this->tabs_gui, $is_participant);
2074 
2075  // badges
2076  if($ilAccess->checkAccess('write','',$this->ref_id))
2077  {
2078  include_once 'Services/Badge/classes/class.ilBadgeHandler.php';
2079  if(ilBadgeHandler::getInstance()->isObjectActive($this->object->getId()))
2080  {
2081  $this->tabs_gui->addTarget("obj_tool_setting_badges",
2082  $this->ctrl->getLinkTargetByClass("ilbadgemanagementgui", ""),
2083  "",
2084  "ilbadgemanagementgui");
2085  }
2086  }
2087 
2088 
2089  // learning progress
2090  include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
2091  if(ilLearningProgressAccess::checkAccess($this->object->getRefId(), $is_participant))
2092  {
2093  $this->tabs_gui->addTarget('learning_progress',
2094  $this->ctrl->getLinkTargetByClass(array('ilobjcoursegui','illearningprogressgui'),''),
2095  '',
2096  array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui'));
2097  }
2098 
2099  // license overview
2100  include_once("Services/License/classes/class.ilLicenseAccess.php");
2101  if ($ilAccess->checkAccess('edit_permission', '', $this->ref_id)
2103  {
2104  $this->tabs_gui->addTarget("licenses",
2105  $this->ctrl->getLinkTargetByClass('illicenseoverviewgui', ''),
2106  "", "illicenseoverviewgui");
2107  }
2108 
2109  // meta data
2110  if ($ilAccess->checkAccess('write','',$this->ref_id))
2111  {
2112  include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
2113  $mdgui = new ilObjectMetaDataGUI($this->object);
2114  $mdtab = $mdgui->getTab();
2115  if($mdtab)
2116  {
2117  $this->tabs_gui->addTarget("meta_data",
2118  $mdtab,
2119  "",
2120  "ilobjectmetadatagui");
2121  }
2122  }
2123 
2124  if($ilAccess->checkAccess('write','',$this->object->getRefId()))
2125  {
2126  $this->tabs_gui->addTarget(
2127  'export',
2128  $this->ctrl->getLinkTargetByClass('ilexportgui',''),
2129  'export',
2130  'ilexportgui'
2131  );
2132  }
2133 
2134  if ($ilAccess->checkAccess('edit_permission','',$this->ref_id))
2135  {
2136  $this->tabs_gui->addTarget("perm_settings",
2137  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"),
2138  array("perm","info","owner"), 'ilpermissiongui');
2139  }
2140 
2141  if ($this->ctrl->getTargetScript() == "adm_object.php")
2142  {
2143  $this->tabs_gui->addTarget("show_owner",
2144  $this->ctrl->getLinkTarget($this, "owner"), "owner", get_class($this));
2145 
2146  if ($this->tree->getSavedNodeData($this->ref_id))
2147  {
2148  $this->tabs_gui->addTarget("trash",
2149  $this->ctrl->getLinkTarget($this, "trash"), "trash", get_class($this));
2150  }
2151  }
2152  // Join/Leave
2153  if($ilAccess->checkAccess('join','',$this->ref_id)
2154  and !$this->object->getMemberObject()->isAssigned())
2155  {
2156  include_once './Modules/Course/classes/class.ilCourseWaitingList.php';
2157  if(ilCourseWaitingList::_isOnList($ilUser->getId(), $this->object->getId()))
2158  {
2159  $this->tabs_gui->addTab(
2160  'leave',
2161  $this->lng->txt('membership_leave'),
2162  $this->ctrl->getLinkTargetByClass('ilcourseregistrationgui','show','')
2163  );
2164 
2165  }
2166  else
2167  {
2168 
2169  $this->tabs_gui->addTarget("join",
2170  $this->ctrl->getLinkTargetByClass('ilcourseregistrationgui', "show"),
2171  'show',
2172  "");
2173  }
2174  }
2175  if($ilAccess->checkAccess('leave','',$this->object->getRefId())
2176  and $this->object->getMemberObject()->isMember())
2177  {
2178  $this->tabs_gui->addTarget("crs_unsubscribe",
2179  $this->ctrl->getLinkTarget($this, "unsubscribe"),
2180  'leave',
2181  "");
2182 
2183  }
2184  }
2185 
2186 
2187  function executeCommand()
2188  {
2189  global $rbacsystem,$ilUser,$ilAccess,$ilErr,$ilTabs,$ilNavigationHistory,$ilCtrl, $ilToolbar;
2190 
2191  $next_class = $this->ctrl->getNextClass($this);
2192  $cmd = $this->ctrl->getCmd();
2193 
2194  $this->prepareOutput();
2195 
2196  // show repository tree
2197  $this->showRepTree();
2198 
2199  // add entry to navigation history
2200  if(!$this->getCreationMode() &&
2201  $ilAccess->checkAccess('read', '', $_GET['ref_id']))
2202  {
2203  include_once("./Services/Link/classes/class.ilLink.php");
2204  $ilNavigationHistory->addItem($_GET["ref_id"],
2205  ilLink::_getLink($_GET["ref_id"], "crs"), "crs");
2206  }
2207 
2208  switch($next_class)
2209  {
2210  case 'ilcoursemembershipgui':
2211 
2212  $this->tabs_gui->activateTab('members');
2213 
2214  include_once './Modules/Course/classes/class.ilCourseMembershipGUI.php';
2215  $mem_gui = new ilCourseMembershipGUI($this, $this->object);
2216  $this->ctrl->forwardCommand($mem_gui);
2217  break;
2218 
2219  case "ilinfoscreengui":
2220  $this->infoScreen(); // forwards command
2221  break;
2222 
2223  case 'ilobjectmetadatagui';
2224  if(!$ilAccess->checkAccess('write','',$this->object->getRefId()))
2225  {
2226  $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->WARNING);
2227  }
2228  $this->tabs_gui->setTabActive('meta_data');
2229  include_once 'Services/Object/classes/class.ilObjectMetaDataGUI.php';
2230  $md_gui = new ilObjectMetaDataGUI($this->object);
2231  $this->ctrl->forwardCommand($md_gui);
2232  break;
2233 
2234  case 'ilcourseregistrationgui':
2235  $this->ctrl->setReturn($this,'');
2236  $this->tabs_gui->setTabActive('join');
2237  include_once('./Modules/Course/classes/class.ilCourseRegistrationGUI.php');
2238  $registration = new ilCourseRegistrationGUI($this->object, $this);
2239  $this->ctrl->forwardCommand($registration);
2240  break;
2241 
2242  case 'ilobjectcustomuserfieldsgui':
2243  include_once './Services/Membership/classes/class.ilObjectCustomUserFieldsGUI.php';
2244  $cdf_gui = new ilObjectCustomUserFieldsGUI($this->object->getId());
2245  $this->setSubTabs('properties');
2246  $this->tabs_gui->setTabActive('settings');
2247  $this->ctrl->forwardCommand($cdf_gui);
2248  break;
2249 
2250  case "ilcourseobjectivesgui":
2251  include_once './Modules/Course/classes/class.ilCourseObjectivesGUI.php';
2252 
2253  $this->ctrl->setReturn($this,"");
2254  $reg_gui = new ilCourseObjectivesGUI($this->object->getRefId());
2255  $ret =& $this->ctrl->forwardCommand($reg_gui);
2256  break;
2257 
2258  case 'ilobjcoursegroupinggui':
2259  include_once './Modules/Course/classes/class.ilObjCourseGroupingGUI.php';
2260 
2261  $this->ctrl->setReturn($this,'edit');
2262  $this->setSubTabs('properties');
2263  $crs_grp_gui = new ilObjCourseGroupingGUI($this->object,(int) $_GET['obj_id']);
2264  $this->ctrl->forwardCommand($crs_grp_gui);
2265  $this->tabs_gui->setTabActive('settings');
2266  $this->tabs_gui->setSubTabActive('groupings');
2267  break;
2268 
2269  case "ilcolumngui":
2270  $this->tabs_gui->setTabActive('none');
2271  $this->checkPermission("read");
2272  //$this->prepareOutput();
2273  //include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
2274  //$this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
2275  // ilObjStyleSheet::getContentStylePath(0));
2276  //$this->renderObject();
2277  $this->viewObject();
2278  break;
2279 
2280  case "ilconditionhandlergui":
2281  include_once './Services/AccessControl/classes/class.ilConditionHandlerGUI.php';
2282  // preconditions for whole course
2283  $this->setSubTabs("properties");
2284  $this->tabs_gui->setTabActive('settings');
2285  $new_gui = new ilConditionHandlerGUI($this);
2286  $this->ctrl->forwardCommand($new_gui);
2287  break;
2288 
2289  case "illearningprogressgui":
2290  include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
2291 
2293  $this->object->getRefId(),
2294  $_GET['user_id'] ? $_GET['user_id'] : $ilUser->getId());
2295  $this->ctrl->forwardCommand($new_gui);
2296  $this->tabs_gui->setTabActive('learning_progress');
2297  break;
2298 
2299 
2300  case 'illicenseoverviewgui':
2301  include_once("./Services/License/classes/class.ilLicenseOverviewGUI.php");
2303  $ret =& $this->ctrl->forwardCommand($license_gui);
2304  $this->tabs_gui->setTabActive('licenses');
2305  break;
2306 
2307  case 'ilpermissiongui':
2308  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
2309  $this->tabs_gui->setTabActive('perm_settings');
2310  $perm_gui = new ilPermissionGUI($this);
2311  $ret =& $this->ctrl->forwardCommand($perm_gui);
2312  break;
2313 
2314 
2315  case 'ilcoursecontentinterface':
2316 
2317  $this->initCourseContentInterface();
2318  $this->cci_obj->cci_setContainer($this);
2319 
2320  $this->ctrl->forwardCommand($this->cci_obj);
2321  $this->setSubTabs('content');
2322  $this->tabs_gui->setTabActive('content');
2323  break;
2324 
2325  case 'ilcoursecontentgui':
2326  $this->ctrl->setReturn($this,'members');
2327  include_once './Modules/Course/classes/class.ilCourseContentGUI.php';
2328  $course_content_obj = new ilCourseContentGUI($this);
2329  $this->ctrl->forwardCommand($course_content_obj);
2330  break;
2331 
2332  case 'ilpublicuserprofilegui':
2333  $this->tpl->enableDragDropFileUpload(null);
2334  require_once './Services/User/classes/class.ilPublicUserProfileGUI.php';
2335  $this->setSubTabs('members');
2336  $this->tabs_gui->setTabActive('members');
2337  $profile_gui = new ilPublicUserProfileGUI($_GET["user"]);
2338  $profile_gui->setBackUrl($this->ctrl->getLinkTargetByClass(["ilCourseMembershipGUI", "ilUsersGalleryGUI"],'view'));
2339  $this->tabs_gui->setSubTabActive('crs_members_gallery');
2340  $html = $this->ctrl->forwardCommand($profile_gui);
2341  $this->tpl->setVariable("ADM_CONTENT", $html);
2342  break;
2343 
2344 
2345  case 'ilmemberagreementgui':
2346  include_once('Services/Membership/classes/class.ilMemberAgreementGUI.php');
2347  $this->tabs_gui->clearTargets();
2348 
2349  $this->ctrl->setReturn($this,'');
2350  $agreement = new ilMemberAgreementGUI($this->object->getRefId());
2351  $this->ctrl->forwardCommand($agreement);
2352  break;
2353 
2354 
2355  // container page editing
2356  case "ilcontainerpagegui":
2357  $ret = $this->forwardToPageObject();
2358  if ($ret != "")
2359  {
2360  $this->tpl->setContent($ret);
2361  }
2362  break;
2363 
2364  case "ilcontainerstartobjectspagegui":
2365  // file downloads, etc. (currently not active)
2366  include_once "Services/Container/classes/class.ilContainerStartObjectsPageGUI.php";
2367  $pgui = new ilContainerStartObjectsPageGUI($this->object->getId());
2368  $ret = $this->ctrl->forwardCommand($pgui);
2369  if($ret)
2370  {
2371  $this->tpl->setContent($ret);
2372  }
2373  break;
2374 
2375  case 'ilobjectcopygui':
2376  include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
2377  $cp = new ilObjectCopyGUI($this);
2378  $cp->setType('crs');
2379  $this->ctrl->forwardCommand($cp);
2380  break;
2381 
2382  case "ilobjstylesheetgui":
2383  $this->forwardToStyleSheet();
2384  break;
2385 
2386 
2387  case 'ilexportgui':
2388  $this->tabs_gui->setTabActive('export');
2389  include_once './Services/Export/classes/class.ilExportGUI.php';
2390  $exp = new ilExportGUI($this);
2391  $exp->addFormat('xml');
2392  $this->ctrl->forwardCommand($exp);
2393  break;
2394 
2395  case "ilcommonactiondispatchergui":
2396  include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
2398  $this->ctrl->forwardCommand($gui);
2399  break;
2400 
2401  case 'ildidactictemplategui':
2402  $this->ctrl->setReturn($this,'edit');
2403  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateGUI.php';
2404  $did = new ilDidacticTemplateGUI($this);
2405  $this->ctrl->forwardCommand($did);
2406  break;
2407 
2408  case "ilcertificategui":
2409  $this->tabs_gui->activateTab("settings");
2410  $this->setSubTabs("properties");
2411 
2412  include_once "./Services/Certificate/classes/class.ilCertificateGUI.php";
2413  include_once "./Modules/Course/classes/class.ilCourseCertificateAdapter.php";
2414  $output_gui = new ilCertificateGUI(new ilCourseCertificateAdapter($this->object));
2415  $this->ctrl->forwardCommand($output_gui);
2416  break;
2417 
2418  case 'ilobjectservicesettingsgui':
2419  $this->ctrl->setReturn($this,'edit');
2420  $this->setSubTabs("properties");
2421  $this->tabs_gui->activateTab('settings');
2422  $this->tabs_gui->acltivateSubTab('tool_settings');
2423 
2424  include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
2425  $service = new ilObjectServiceSettingsGUI(
2426  $this,
2427  $this->object->getId(),
2428  array(
2430  ));
2431  $this->ctrl->forwardCommand($service);
2432  break;
2433 
2434  case 'illoeditorgui':
2435  #$this->tabs_gui->clearTargets();
2436  #$this->tabs_gui->setBackTarget($this->lng->txt('back'),$this->ctrl->getLinkTarget($this,''));
2437  $this->tabs_gui->activateTab('crs_objectives');
2438 
2439  include_once './Modules/Course/classes/Objectives/class.ilLOEditorGUI.php';
2440  $editor = new ilLOEditorGUI($this->object);
2441  $this->ctrl->forwardCommand($editor);
2442  break;
2443 
2444  case 'ilcontainerstartobjectsgui':
2445  $this->ctrl->setReturn($this,'edit');
2446  $this->tabs_gui->clearTargets();
2447  $this->tabs_gui->setBackTarget($this->lng->txt("back_to_crs_content"),
2448  $this->ctrl->getLinkTarget($this, "edit"));
2449  $this->tabs_gui->addTab("start",
2450  $this->lng->txt("crs_start_objects"),
2451  $this->ctrl->getLinkTargetByClass("ilcontainerstartobjectsgui", "listStructure"));
2452  global $ilHelp;
2453  $ilHelp->setScreenIdComponent("crs");
2454 
2455  include_once './Services/Container/classes/class.ilContainerStartObjectsGUI.php';
2456  $stgui = new ilContainerStartObjectsGUI($this->object);
2457  $this->ctrl->forwardCommand($stgui);
2458  break;
2459 
2460  case 'illomembertestresultgui':
2461  include_once './Modules/Course/classes/Objectives/class.ilLOMemberTestResultGUI.php';
2462  $GLOBALS['ilCtrl']->setReturn($this, 'members');
2463  $GLOBALS['ilTabs']->clearTargets();
2464  $GLOBALS['ilTabs']->setBackTarget(
2465  $GLOBALS['lng']->txt('back'),
2466  $GLOBALS['ilCtrl']->getLinkTarget($this,'members')
2467  );
2468 
2469  $result_view = new ilLOMemberTestResultGUI($this, $this->object, (int) $_REQUEST['uid']);
2470  $this->ctrl->forwardCommand($result_view);
2471  break;
2472 
2473  case 'ilmailmembersearchgui':
2474  include_once 'Services/Mail/classes/class.ilMail.php';
2475  $mail = new ilMail($ilUser->getId());
2476 
2477  if(!($this->object->getMailToMembersType() == ilCourseConstants::MAIL_ALLOWED_ALL ||
2478  $ilAccess->checkAccess('manage_members',"",$this->object->getRefId())) &&
2479  $rbacsystem->checkAccess('internal_mail',$mail->getMailObjectReferenceId()))
2480  {
2481  $ilErr->raiseError($this->lng->txt("msg_no_perm_read"),$ilErr->MESSAGE);
2482  }
2483 
2484  $this->tabs_gui->setTabActive('members');
2485 
2486  include_once './Services/Contact/classes/class.ilMailMemberSearchGUI.php';
2487  include_once './Services/Contact/classes/class.ilMailMemberCourseRoles.php';
2488 
2489  $mail_search = new ilMailMemberSearchGUI($this, $this->object->getRefId(), new ilMailMemberCourseRoles());
2491  $this->ctrl->forwardCommand($mail_search);
2492  break;
2493 
2494  case 'ilbadgemanagementgui':
2495  $this->tabs_gui->setTabActive('obj_tool_setting_badges');
2496  include_once 'Services/Badge/classes/class.ilBadgeManagementGUI.php';
2497  $bgui = new ilBadgeManagementGUI($this->object->getRefId(), $this->object->getId(), 'crs');
2498  $this->ctrl->forwardCommand($bgui);
2499  break;
2500 
2501  case "ilcontainernewssettingsgui":
2502  $this->setSubTabs("properties");
2503  $this->tabs_gui->setTabActive('settings');
2504  include_once("./Services/Container/classes/class.ilContainerNewsSettingsGUI.php");
2505  $news_set_gui = new ilContainerNewsSettingsGUI($this);
2506  $this->ctrl->forwardCommand($news_set_gui);
2507  break;
2508 
2509  case "ilnewstimelinegui":
2510  $this->tabs_gui->setTabActive('news_timeline');
2511  include_once("./Services/News/classes/class.ilNewsTimelineGUI.php");
2512  $t = ilNewsTimelineGUI::getInstance($this->object->getRefId(), $this->object->getNewsTimelineAutoENtries());
2513  $t->setUserEditAll($ilAccess->checkAccess('write','',$this->object->getRefId(),'grp'));
2514  $this->showPermanentLink($tpl);
2515  $this->ctrl->forwardCommand($t);
2516  break;
2517 
2518  default:
2519 /* if(!$this->creation_mode)
2520  {
2521  $this->checkPermission('visible');
2522  }*/
2523  /*
2524  if(!$this->creation_mode and !$ilAccess->checkAccess('visible','',$this->object->getRefId(),'crs'))
2525  {
2526  $ilErr->raiseError($this->lng->txt("msg_no_perm_read"),$ilErr->MESSAGE);
2527  }
2528  */
2529 
2530  // #9401 - see also ilStartupGUI::_checkGoto()
2531  if($cmd == 'infoScreenGoto')
2532  {
2533  if(ilObjCourse::_isActivated($this->object->getId()) &&
2534  ilObjCourse::_registrationEnabled($this->object->getId()))
2535  {
2536  $cmd = 'join';
2537  }
2538  else
2539  {
2540  $cmd = 'infoScreen';
2541  }
2542  }
2543 
2544  if(!$this->creation_mode)
2545  {
2546  if ($cmd == "infoScreen")
2547  {
2548  $this->checkPermission("visible");
2549  }
2550  else
2551  {
2552 // $this->checkPermission("read");
2553  }
2554  }
2555 
2556 
2557  if( !$this->creation_mode
2558  && $cmd != 'infoScreen'
2559  && $cmd != 'sendfile'
2560  && $cmd != 'unsubscribe'
2561  && $cmd != 'performUnsubscribe'
2562  && !$ilAccess->checkAccess("read",'',$this->object->getRefId())
2563  || $cmd == 'join'
2564  || $cmd == 'subscribe')
2565  {
2566  include_once './Modules/Course/classes/class.ilCourseParticipants.php';
2567  if($rbacsystem->checkAccess('join',$this->object->getRefId()) &&
2568  !ilCourseParticipants::_isParticipant($this->object->getRefId(),$ilUser->getId()))
2569  {
2570  include_once('./Modules/Course/classes/class.ilCourseRegistrationGUI.php');
2571  $this->ctrl->redirectByClass("ilCourseRegistrationGUI");
2572  }
2573  else
2574  {
2575  $this->infoScreenObject();
2576  break;
2577  }
2578  }
2579 
2580  if($cmd == 'listObjectives')
2581  {
2582  include_once './Modules/Course/classes/class.ilCourseObjectivesGUI.php';
2583 
2584  $this->ctrl->setReturn($this,"");
2585  $obj_gui = new ilCourseObjectivesGUI($this->object->getRefId());
2586  $ret =& $this->ctrl->forwardCommand($obj_gui);
2587  break;
2588  }
2589 
2590  // Dirty hack for course timings view
2591  if($this->forwardToTimingsView())
2592  {
2593  break;
2594  }
2595 
2596  // if news timeline is landing page, redirect if necessary
2597  if ($cmd == "" && $this->object->isNewsTimelineLandingPageEffective())
2598  {
2599  $this->ctrl->redirectbyclass("ilnewstimelinegui");
2600  }
2601 
2602  if(!$cmd)
2603  {
2604  $cmd = 'view';
2605  }
2606  $cmd .= 'Object';
2607  $this->$cmd();
2608 
2609  break;
2610  }
2611 
2612  $this->addHeaderAction();
2613 
2614  return true;
2615  }
2616 
2623  private function checkAgreement()
2624  {
2625  global $ilUser,$ilAccess;
2626 
2627  if($ilAccess->checkAccess('write','',$this->object->getRefId()))
2628  {
2629  return true;
2630  }
2631 
2632  // Disable aggrement if is not member of course
2633  if(!$this->object->getMemberObject()->isAssigned())
2634  {
2635  return true;
2636  }
2637 
2638  include_once './Services/Container/classes/class.ilMemberViewSettings.php';
2639  if(ilMemberViewSettings::getInstance()->isActive())
2640  {
2641  return true;
2642  }
2643 
2644  include_once('Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
2645  include_once('Services/Membership/classes/class.ilMemberAgreement.php');
2646  $privacy = ilPrivacySettings::_getInstance();
2647 
2648  // Check agreement
2649  if(($privacy->courseConfirmationRequired() or ilCourseDefinedFieldDefinition::_hasFields($this->object->getId()))
2650  and !ilMemberAgreement::_hasAccepted($ilUser->getId(),$this->object->getId()))
2651  {
2652  $GLOBALS['ilLog']->write(__METHOD__.': Missing course confirmation.');
2653  return false;
2654  }
2655  // Check required fields
2656  include_once('Modules/Course/classes/Export/class.ilCourseUserData.php');
2657  if(!ilCourseUserData::_checkRequired($ilUser->getId(),$this->object->getId()))
2658  {
2659  $GLOBALS['ilLog']->write(__METHOD__.': Missing required fields');
2660  return false;
2661  }
2662  return true;
2663  }
2664 
2665 
2672  private function checkLicenses($a_keep = false)
2673  {
2674  global $lng;
2675 
2676 
2677  include_once("Services/License/classes/class.ilLicenseAccess.php");
2679  {
2680  $lic_set = new ilSetting("license");
2681  $buffer = $lic_set->get("license_warning");
2682 
2683  include_once("./Services/License/classes/class.ilLicense.php");
2684  $licensed_items = ilLicense::_getLicensedChildObjects($this->object->getRefId());
2685  foreach ($licensed_items as $item)
2686  {
2687  $license = new ilLicense($item['obj_id']);
2688  $remaining = $license->getRemainingLicenses();
2689  if ($remaining <= $buffer)
2690  {
2691  $lng->loadlanguageModule("license");
2692  ilUtil::sendInfo(sprintf($this->lng->txt("course_licenses_rare"), $remaining), $a_keep);
2693  break;
2694  }
2695  }
2696  }
2697  }
2698 
2699  // STATIC
2700  public static function _forwards()
2701  {
2702  return array("ilCourseRegisterGUI",'ilConditionHandlerGUI');
2703  }
2704 
2705  function addLocatorItems()
2706  {
2707  global $ilLocator;
2708  switch ($this->ctrl->getCmd())
2709  {
2710  default:
2711  #$ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""));
2712  break;
2713  }
2714  }
2715 
2719  protected function membersObject()
2720  {
2721  $GLOBALS['ilCtrl']->redirectByClass('ilcoursemembershipgui');
2722  }
2723 
2727  public static function _goto($a_target, $a_add = "")
2728  {
2729  global $ilAccess, $ilErr, $lng,$ilUser;
2730 
2731  include_once './Services/Membership/classes/class.ilMembershipRegistrationCodeUtils.php';
2732  if(substr($a_add,0,5) == 'rcode')
2733  {
2734  if($ilUser->getId() == ANONYMOUS_USER_ID)
2735  {
2736  // Redirect to login for anonymous
2738  "login.php?target=".$_GET["target"]."&cmd=force_login&lang=".
2739  $ilUser->getCurrentLanguage()
2740  );
2741  }
2742 
2743  // Redirects to target location after assigning user to course
2745  $a_target,
2747  substr($a_add,5)
2748  );
2749  }
2750 
2751  if ($a_add == "mem" && $ilAccess->checkAccess("manage_members", "", $a_target))
2752  {
2753  ilObjectGUI::_gotoRepositoryNode($a_target, "members");
2754  }
2755 
2756  if ($ilAccess->checkAccess("read", "", $a_target))
2757  {
2759  }
2760  else
2761  {
2762  // to do: force flat view
2763  if ($ilAccess->checkAccess("visible", "", $a_target))
2764  {
2765  ilObjectGUI::_gotoRepositoryNode($a_target, "infoScreenGoto");
2766  }
2767  else
2768  {
2769  if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
2770  {
2771  ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
2772  ilObject::_lookupTitle(ilObject::_lookupObjId($a_target))), true);
2774  }
2775  }
2776  }
2777  $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
2778  }
2779 
2780 
2785  {
2786  global $ilUser, $ilCtrl, $ilUser, $ilAccess;
2787 
2788  $this->setSubTabs("properties");
2789  $this->tabs_gui->setTabActive('settings');
2790 
2791  if (!ilMapUtil::isActivated() ||
2792  !$ilAccess->checkAccess("write", "", $this->object->getRefId()))
2793  {
2794  return;
2795  }
2796 
2797  $latitude = $this->object->getLatitude();
2798  $longitude = $this->object->getLongitude();
2799  $zoom = $this->object->getLocationZoom();
2800 
2801  // Get Default settings, when nothing is set
2802  if ($latitude == 0 && $longitude == 0 && $zoom == 0)
2803  {
2805  $latitude = $def["latitude"];
2806  $longitude = $def["longitude"];
2807  $zoom = $def["zoom"];
2808  }
2809 
2810  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
2811  $form = new ilPropertyFormGUI();
2812  $form->setFormAction($ilCtrl->getFormAction($this));
2813 
2814  $form->setTitle($this->lng->txt("crs_map_settings"));
2815 
2816  // enable map
2817  $public = new ilCheckboxInputGUI($this->lng->txt("crs_enable_map"),
2818  "enable_map");
2819  $public->setValue("1");
2820  $public->setChecked($this->object->getEnableCourseMap());
2821  $form->addItem($public);
2822 
2823  // map location
2824  $loc_prop = new ilLocationInputGUI($this->lng->txt("crs_map_location"),
2825  "location");
2826  $loc_prop->setLatitude($latitude);
2827  $loc_prop->setLongitude($longitude);
2828  $loc_prop->setZoom($zoom);
2829  $form->addItem($loc_prop);
2830 
2831  $form->addCommandButton("saveMapSettings", $this->lng->txt("save"));
2832 
2833  $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
2834  //$this->tpl->show();
2835  }
2836 
2838  {
2839  global $ilCtrl, $ilUser;
2840 
2841  $this->object->setLatitude(ilUtil::stripSlashes($_POST["location"]["latitude"]));
2842  $this->object->setLongitude(ilUtil::stripSlashes($_POST["location"]["longitude"]));
2843  $this->object->setLocationZoom(ilUtil::stripSlashes($_POST["location"]["zoom"]));
2844  $this->object->setEnableCourseMap(ilUtil::stripSlashes($_POST["enable_map"]));
2845  $this->object->update();
2846 
2847  $ilCtrl->redirect($this, "editMapSettings");
2848  }
2849 
2850 
2858  public function modifyItemGUI($a_item_list_gui, $a_item_data, $a_show_path)
2859  {
2860  return ilObjCourseGUI::_modifyItemGUI($a_item_list_gui, 'ilcoursecontentgui', $a_item_data, $a_show_path,
2861  $this->object->getAboStatus(), $this->object->getRefId(), $this->object->getId());
2862  }
2863 
2867  public static function _modifyItemGUI($a_item_list_gui, $a_cmd_class, $a_item_data, $a_show_path,
2868  $a_abo_status, $a_course_ref_id, $a_course_obj_id, $a_parent_ref_id = 0)
2869  {
2870  global $lng, $ilAccess;
2871 
2872  // this is set for folders within the course
2873  if ($a_parent_ref_id == 0)
2874  {
2875  $a_parent_ref_id = $a_course_ref_id;
2876  }
2877 
2878  // Special handling for tests in courses with learning objectives
2879  if($a_item_data['type'] == 'tst' and
2881  {
2882  $a_item_list_gui->addCommandLinkParameter(array('crs_show_result' => $a_course_ref_id));
2883  }
2884 
2885  $a_item_list_gui->enableSubscribe($a_abo_status);
2886 
2887  $is_tutor = ($ilAccess->checkAccess('write','',
2888  $a_course_ref_id,'crs', $a_course_obj_id));
2889 
2890  if($a_show_path and $is_tutor)
2891  {
2892  $a_item_list_gui->addCustomProperty($lng->txt('path'),
2893  ilContainer::_buildPath($a_item_data['ref_id'], $a_course_ref_id),
2894  false,
2895  true);
2896  }
2897  }
2898 
2903  {
2904  global $ilAccess, $lng, $ilCtrl;
2905 
2906  if ($this->object->getType() != 'crs')
2907  {
2908  return true;
2909  }
2910  if (!$ilAccess->checkAccess('write','',
2911  $this->object->getRefId(),'crs',$this->object->getId()))
2912  {
2913  $is_tutor = false;
2914  // No further tabs if objective view or archives
2915  if($this->object->enabledObjectiveView())
2916  {
2917  return false;
2918  }
2919  }
2920  else
2921  {
2922  $is_tutor = true;
2923  }
2924 
2925  // These subtabs should also work, if the command is called directly in
2926  // ilObjCourseGUI, so please use ...ByClass methods.
2927  // (see ilObjCourseGUI->executeCommand: case "ilcolumngui")
2928 
2929  if(!$_SESSION['crs_timings_panel'][$this->object->getId()] or 1)
2930  {
2931  if (!$this->isActiveAdministrationPanel())
2932  {
2933  $this->tabs_gui->addSubTab("view_content", $lng->txt("view"), $ilCtrl->getLinkTargetByClass("ilobjcoursegui", "view"));
2934  }
2935  else
2936  {
2937  $this->tabs_gui->addSubTab("view_content", $lng->txt("view"), $ilCtrl->getLinkTargetByClass("ilobjcoursegui", "disableAdministrationPanel"));
2938  }
2939  }
2940  if($this->object->getViewMode() == IL_CRS_VIEW_TIMING)
2941  {
2942  $this->tabs_gui->addSubTabTarget('timings_timings',
2943  $this->ctrl->getLinkTargetByClass('ilcoursecontentgui','editUserTimings'));
2944  }
2945 
2946  $this->addStandardContainerSubTabs(false);
2947 
2948 
2949  return true;
2950  }
2951 
2959  protected function loadDate($a_field)
2960  {
2961  global $ilUser;
2962 
2963  include_once('./Services/Calendar/classes/class.ilDateTime.php');
2964 
2965  // #10206 / #10217
2966  if(is_array($_POST[$a_field]['date']))
2967  {
2968  $dt['year'] = (int) $_POST[$a_field]['date']['y'];
2969  $dt['mon'] = (int) $_POST[$a_field]['date']['m'];
2970  $dt['mday'] = (int) $_POST[$a_field]['date']['d'];
2971  $dt['hours'] = (int) $_POST[$a_field]['time']['h'];
2972  $dt['minutes'] = (int) $_POST[$a_field]['time']['m'];
2973  $dt['seconds'] = (int) $_POST[$a_field]['time']['s'];
2974  }
2975  else
2976  {
2977  $date = date_parse($_POST[$a_field]['date']." ".$_POST[$a_field]['time']);
2978  $dt['year'] = (int) $date['year'];
2979  $dt['mon'] = (int) $date['month'];
2980  $dt['mday'] = (int) $date['day'];
2981  $dt['hours'] = (int) $date['hour'];
2982  $dt['minutes'] = (int) $date['minute'];
2983  $dt['seconds'] = (int) $date['second'];
2984  }
2985 
2986  $date = new ilDateTime($dt,IL_CAL_FKT_GETDATE,$ilUser->getTimeZone());
2987  return $date;
2988  }
2989 
2997  public function askResetObject()
2998  {
2999  ilUtil::sendQuestion($this->lng->txt('crs_objectives_reset_sure'));
3000 
3001  include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
3002  $confirm = new ilConfirmationGUI();
3003  $confirm->setFormAction($this->ctrl->getFormAction($this));
3004  $confirm->setConfirm($this->lng->txt('reset'), 'reset');
3005  $confirm->setCancel($this->lng->txt('cancel'), 'cancel');
3006 
3007  $GLOBALS['tpl']->setContent($confirm->getHTML());
3008  return true;
3009  }
3010 
3011  function resetObject()
3012  {
3013  global $ilUser;
3014 
3015  include_once './Modules/Course/classes/Objectives/class.ilLOUserResults.php';
3016  $usr_results = new ilLOUserResults($this->object->getId(), $GLOBALS['ilUser']->getId());
3017  $usr_results->delete();
3018 
3019 
3020  include_once './Modules/Course/classes/Objectives/class.ilLOTestRun.php';
3021  include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
3023  $this->object->getId(),
3024  $GLOBALS['ilUser']->getId()
3025  );
3026 
3027  include_once './Modules/Course/classes/class.ilCourseObjectiveResult.php';
3028 
3029  $tmp_obj_res = new ilCourseObjectiveResult($ilUser->getId());
3030  $tmp_obj_res->reset($this->object->getId());
3031 
3032  $ilUser->deletePref('crs_objectives_force_details_'.$this->object->getId());
3033 
3034  ilUtil::sendSuccess($this->lng->txt('crs_objectives_reseted'));
3035  $this->viewObject();
3036  }
3037 
3039  {
3040  global $ilAccess,$ilUser;
3041 
3042  if($ilAccess->checkAccess('write','',$this->object->getRefId()))
3043  {
3044  return true;
3045  }
3046 
3047  include_once './Services/Container/classes/class.ilContainerStartObjects.php';
3048  $this->start_obj = new ilContainerStartObjects($this->object->getRefId(),
3049  $this->object->getId());
3050  if(count($this->start_obj->getStartObjects()) &&
3051  !$this->start_obj->allFullfilled($ilUser->getId()))
3052  {
3053  return false;
3054  }
3055 
3056  return true;
3057  }
3058 
3063  public function prepareOutput($a_show_subobjects = true)
3064  {
3065  global $rbacsystem;
3066  if(!$this->getCreationMode())
3067  {
3068  include_once './Services/Container/classes/class.ilMemberViewSettings.php';
3069  $settings = ilMemberViewSettings::getInstance();
3070  if($settings->isActive() and $settings->getContainer() != $this->object->getRefId())
3071  {
3072  $settings->setContainer($this->object->getRefId());
3073  $rbacsystem->initMemberView();
3074  }
3075  }
3076  parent::prepareOutput($a_show_subobjects);
3077  }
3078 
3083  public function createMailSignature()
3084  {
3085  $link = chr(13).chr(10).chr(13).chr(10);
3086  $link .= $this->lng->txt('crs_mail_permanent_link');
3087  $link .= chr(13).chr(10).chr(13).chr(10);
3088  include_once './Services/Link/classes/class.ilLink.php';
3089  $link .= ilLink::_getLink($this->object->getRefId());
3090  return rawurlencode(base64_encode($link));
3091  }
3092 
3093  protected function initHeaderAction($a_sub_type = null, $a_sub_id = null)
3094  {
3095  global $ilSetting, $ilUser;
3096 
3097  $lg = parent::initHeaderAction($a_sub_type, $a_sub_id);
3098 
3099  if($lg && $this->ref_id && ilCourseParticipants::_isParticipant($this->ref_id, $ilUser->getId()))
3100  {
3101  // certificate
3102  include_once "Services/Certificate/classes/class.ilCertificate.php";
3103  if (ilCertificate::isActive() &&
3104  ilCertificate::isObjectActive($this->object->getId()) &&
3105  ilCourseParticipants::getDateTimeOfPassed($this->object->getId(), $ilUser->getId()))
3106  {
3107  $cert_url = $this->ctrl->getLinkTarget($this, "deliverCertificate");
3108 
3109  $this->lng->loadLanguageModule("certificate");
3110  $lg->addCustomCommand($cert_url, "download_certificate");
3111 
3112  $lg->addHeaderIcon("cert_icon",
3113  ilUtil::getImagePath("icon_cert.svg"),
3114  $this->lng->txt("download_certificate"),
3115  null,
3116  null,
3117  $cert_url);
3118  }
3119 
3120  // notification
3121  include_once "Services/Membership/classes/class.ilMembershipNotifications.php";
3123  {
3124  $noti = new ilMembershipNotifications($this->ref_id);
3125  if(!$noti->isCurrentUserActive())
3126  {
3127  $lg->addHeaderIcon("not_icon",
3128  ilUtil::getImagePath("notification_off.svg"),
3129  $this->lng->txt("crs_notification_deactivated"));
3130 
3131  $this->ctrl->setParameter($this, "crs_ntf", 1);
3132  $caption = "crs_activate_notification";
3133  }
3134  else
3135  {
3136  $lg->addHeaderIcon("not_icon",
3137  ilUtil::getImagePath("notification_on.svg"),
3138  $this->lng->txt("crs_notification_activated"));
3139 
3140  $this->ctrl->setParameter($this, "crs_ntf", 0);
3141  $caption = "crs_deactivate_notification";
3142  }
3143 
3144  if($noti->canCurrentUserEdit())
3145  {
3146  $lg->addCustomCommand($this->ctrl->getLinkTarget($this, "saveNotification"),
3147  $caption);
3148  }
3149 
3150  $this->ctrl->setParameter($this, "crs_ntf", "");
3151  }
3152  }
3153 
3154  return $lg;
3155  }
3156 
3158  {
3159  global $ilUser, $ilAccess;
3160 
3161  $user_id = null;
3162  if ($ilAccess->checkAccess('manage_members','',$this->ref_id))
3163  {
3164  $user_id = $_REQUEST["member_id"];
3165  }
3166  if(!$user_id)
3167  {
3168  $user_id = $ilUser->getId();
3169  }
3170 
3171  include_once "Services/Certificate/classes/class.ilCertificate.php";
3172  if(!ilCertificate::isActive() ||
3173  !ilCertificate::isObjectActive($this->object->getId()) ||
3174  !ilCourseParticipants::getDateTimeOfPassed($this->object->getId(), $user_id))
3175  {
3176  ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
3177  $this->ctrl->redirect($this);
3178  }
3179 
3180  include_once "./Modules/Course/classes/class.ilCourseCertificateAdapter.php";
3181  $certificate = new ilCertificate(new ilCourseCertificateAdapter($this->object));
3182  $certificate->outCertificate(array("user_id" => $user_id), true);
3183  }
3184 
3185 
3186  protected function afterSaveCallback()
3187  {
3188  $this->ctrl->redirectByClass(array('ilrepositorygui','ilobjcoursegui','illoeditorgui'),'materials');
3189  }
3190 
3191  public function saveSortingObject()
3192  {
3193  if(isset($_POST['position']["lobj"]))
3194  {
3195  $lobj = $_POST['position']["lobj"];
3196  unset($_POST['position']["lobj"]);
3197 
3198  $objective_order = array();
3199  foreach($lobj as $objective_id => $materials)
3200  {
3201  $objective_order[$objective_id] = $materials[0];
3202  unset($lobj[$objective_id][0]);
3203  }
3204 
3205  // objective order
3206  include_once "Modules/Course/classes/class.ilCourseObjective.php";
3207  asort($objective_order);
3208  $pos = 0;
3209  foreach(array_keys($objective_order) as $objective_id)
3210  {
3211  $obj = new ilCourseObjective($this->object, $objective_id);
3212  $obj->writePosition(++$pos);
3213  }
3214 
3215  // material order
3216  include_once "Modules/Course/classes/class.ilCourseObjectiveMaterials.php";
3217  foreach($lobj as $objective_id => $materials)
3218  {
3219  $objmat = new ilCourseObjectiveMaterials($objective_id);
3220 
3221  asort($materials);
3222  $pos = 0;
3223  foreach(array_keys($materials) as $ass_id)
3224  {
3225  $objmat->writePosition($ass_id, ++$pos);
3226  }
3227  }
3228  }
3229 
3230  return parent::saveSortingObject();
3231  }
3232 
3238  {
3239  include_once './Services/Link/classes/class.ilLink.php';
3240  ilUtil::redirect(ilLink::_getLink((int) $_REQUEST['tid']));
3241  return TRUE;
3242 
3243  }
3244 
3248  protected function redirectLocToTestObject($a_force_new_run = NULL)
3249  {
3250  $objective_id = (int) $_REQUEST['objective_id'];
3251  $test_id = (int) $_REQUEST['tid'];
3252 
3253  include_once './Modules/Course/classes/Objectives/class.ilLOUserResults.php';
3254  include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
3255  include_once './Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
3256 
3257 
3258  $res = new ilLOUserResults(
3259  $this->object->getId(),
3260  $GLOBALS['ilUser']->getId());
3261  $passed = $res->getCompletedObjectiveIds();
3262 
3263  $has_completed = FALSE;
3264  if($objective_id)
3265  {
3266  $objective_ids = array($objective_id);
3267  if(in_array($objective_id, $passed))
3268  {
3269  $has_completed = TRUE;
3270  $passed = array();
3271  }
3272  }
3273  else
3274  {
3275  include_once './Modules/Course/classes/class.ilCourseObjective.php';
3276  $objective_ids = ilCourseObjective::_getObjectiveIds($this->object->getId(),true);
3277 
3278  // do not disable objective question if all are passed
3279  if(count($objective_ids) == count($passed))
3280  {
3281  $has_completed = TRUE;
3282  $passed = array();
3283  }
3284  }
3285 
3286  if($has_completed)
3287  {
3288  // show confirmation
3289  $this->redirectLocToTestConfirmation($objective_id,$test_id);
3290  return TRUE;
3291  }
3292 
3293  include_once './Services/Link/classes/class.ilLink.php';
3295  return TRUE;
3296 
3297  }
3298 
3304  protected function redirectLocToTestConfirmation($a_objective_id, $a_test_id)
3305  {
3306  include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
3307  $confirm = new ilConfirmationGUI();
3308  $confirm->setFormAction($GLOBALS['ilCtrl']->getFormAction($this));
3309 
3310  if($a_objective_id)
3311  {
3312  $question = $this->lng->txt('crs_loc_objective_passed_confirmation');
3313  }
3314  else
3315  {
3316  $question = $this->lng->txt('crs_loc_objectives_passed_confirmation');
3317  }
3318 
3319  $confirm->addHiddenItem('objective_id', $a_objective_id);
3320  $confirm->addHiddenItem('tid', $a_test_id);
3321  $confirm->setConfirm($this->lng->txt('crs_loc_tst_start'), 'redirectLocToTestConfirmed');
3322  $confirm->setCancel($this->lng->txt('cancel'), 'view');
3323 
3324  ilUtil::sendQuestion($question);
3325 
3326  $GLOBALS['tpl']->setContent($confirm->getHTML());
3327  return true;
3328  }
3329  // end-patch lok
3330 
3337  public function getLocalRoles($a_exclude = array())
3338  {
3339  $crs_admin = $this->object->getDefaultAdminRole();
3340  $crs_member = $this->object->getDefaultMemberRole();
3341  $local_roles = $this->object->getLocalCourseRoles(false);
3342  $crs_roles = array();
3343 
3344  //put the course member role to the top of the crs_roles array
3345  if(in_array($crs_member, $local_roles))
3346  {
3347  #$crs_roles[$crs_member] = ilObjRole::_getTranslation(array_search ($crs_member, $local_roles));
3348  #unset($local_roles[$crs_roles[$crs_member]]);
3349  }
3350 
3351  foreach($local_roles as $title => $role_id)
3352  {
3353  if($role_id == $crs_admin && !$this->hasAdminPermission())
3354  {
3355  continue;
3356  }
3357 
3358  $crs_roles[$role_id] = ilObjRole::_getTranslation($title);
3359  }
3360 
3361  if(count($a_exclude) > 0)
3362  {
3363  foreach($a_exclude as $excluded_role)
3364  {
3365  if(isset($crs_roles[$excluded_role]))
3366  {
3367  unset($crs_roles[$excluded_role]);
3368  }
3369  }
3370  }
3371  return $crs_roles;
3372  }
3373 
3378  protected function hasAdminPermission()
3379  {
3380  global $ilUser;
3381  return ilCourseParticipant::_getInstanceByObjId($this->object->getId(), $ilUser->getId())->isAdmin()
3382  or $this->checkPermissionBool('edit_permission');
3383  }
3384 
3385 
3389  protected function jump2UsersGalleryObject()
3390  {
3391  $this->ctrl->redirectByClass('ilUsersGalleryGUI');
3392  }
3393 
3398  {
3399  $this->ctrl->setReturn($this, "view");
3400  }
3401 
3402 
3403 } // END class.ilObjCourseGUI
3404 ?>
$files
Definition: add-vimline.php:18
static _modifyItemGUI($a_item_list_gui, $a_cmd_class, $a_item_data, $a_show_path, $a_abo_status, $a_course_ref_id, $a_course_obj_id, $a_parent_ref_id=0)
We need a static version of this, e.g.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static _lookupLogin($a_user_id)
lookup login
static _lookupName($a_user_id)
lookup user name
static _isParticipant($a_ref_id, $a_usr_id)
Static function to check if a user is a participant of the container object.
setLatitude($a_latitude)
Set Latitude.
global $ilErr
Definition: raiseError.php:16
$error
Definition: Error.php:17
This class represents an option in a radio group.
unsubscribeObject()
DEPRECATED?
ILIAS Setting Class.
const IL_CRS_ACTIVATION_LIMITED
Class ilObjectMetaDataGUI.
$lg
Definition: example_018.php:62
showPossibleSubObjects()
show possible sub objects selection list
class ilConditionHandlerGUI
static isActive()
Is feature active?
const IL_CRS_SUBSCRIPTION_LIMITED
Container start objects page GUI class.
Class ilInfoScreenGUI.
const IL_CRS_VIEW_OBJECTIVE
redirectLocToTestObject($a_force_new_run=NULL)
Test redirection will be moved lo adapter.
loadDate($a_field)
load date
static _fieldsToInfoString($a_obj_id)
Fields to info string.
saveSortingSettings(ilPropertyFormGUI $form)
Save sorting settings.
$_SESSION["AccountId"]
hasAdminPermission()
user has admin permission or "edit permission" permission on this course
updateLPFromStatus($a_member_id, $a_has_passed)
sync course status and lp status
This class represents a property form user interface.
GUI class for the workflow of copying objects.
setPropertyForm($form)
set property form object
const TITLE_LENGTH
max length of object title
static getDateTimeOfPassed($a_obj_id, $a_usr_id)
confirmDeleteInfoFilesObject()
show info file donfimation table
$_GET["client_id"]
static _registrationEnabled($a_obj_id)
Registration enabled? Method is in Access class, since it is needed by Access/ListGUI.
This class represents a section header in a property form.
This class represents a file property in a property form.
const LP_STATUS_NOT_ATTEMPTED
Class ilObject Basic functions for all objects.
Class ilLOEditorGUI.
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.
static _isEnabled()
Check, if licencing is enabled This check is called from the ilAccessHandler class.
delete()
Delete for user and course type $ilDB.
static _recordWriteEvent($obj_id, $usr_id, $action, $parent_obj_id=null)
Records a write event.
readMemberData($ids, $selected_columns=null)
static formatPeriod(ilDateTime $start, ilDateTime $end)
Format a period of two date Shows: 14.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
$cmd
Definition: sahs_server.php:35
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
getLocalRoles($a_exclude=array())
setValue($a_value)
Set Value.
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
static _getObjectiveIds($course_id, $a_activated_only=false)
static _lookupFailedForObject($a_obj_id, $a_user_ids=null)
Get failed users for object.
static _tracProgress($a_user_id, $a_obj_id, $a_ref_id, $a_obj_type='')
This class represents a checkbox property in a property form.
setShowHidePrefs()
set preferences (show/hide tabel content)
removeTinyIconObject()
remove small icon
static _lookupTitle($a_id)
lookup object title
Class ilMailMemberSearchGUI.
Class ilObjCourseGUI.
static getMemberRoles($a_ref_id)
Get member roles.
static _lookupViewMode($a_id)
lookup view mode of container
const IL_CRS_SUBSCRIPTION_CONFIRMATION
static _goto($a_target, $a_add="")
goto target course
static handleCode($a_ref_id, $a_type, $a_code)
Handle target parameter.
const IL_CAL_UNIX
const IL_CRS_VIEW_TIMING
const STATUS_DETERMINATION_LP
setInfo($a_info)
Set Info.
modifyItemGUI($a_item_list_gui, $a_item_data, $a_show_path)
Modify Item ListGUI for presentation in container.
initHeaderAction($a_sub_type=null, $a_sub_id=null)
updateObject()
Update course settings type $ilUser.
static _hasAccepted($a_usr_id, $a_obj_id)
Check if user has accepted agreement.
const LP_STATUS_IN_PROGRESS
editObject(ilPropertyFormGUI $form=null)
edit object
const IL_CRS_VIEW_SIMPLE
const IL_CRS_VIEW_BY_TYPE
This class represents a date/time property in a property form.
static _catchupWriteEvents($obj_id, $usr_id, $timestamp=null)
Catches up with all write events which occured before the specified timestamp.
global $ilCtrl
Definition: ilias.php:18
static deleteRuns($a_container_id, $a_user_id)
Delete runs type $ilDB.
setSideColumnReturn()
Set return point for side column actions.
setInfo($a_info)
Set Information Text.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
if(@file_exists(dirname(__FILE__).'/lang/eng.php')) $certificate
Definition: example_052.php:77
$section
Definition: Utf8Test.php:83
setChecked($a_checked)
Set Checked.
Export User Interface Class.
static checkAccess($a_ref_id, $a_allow_only_read=true)
check access to learning progress
static _enabledUserRelatedData()
check wether user related tracking is enabled or not
This class represents a hidden form property in a property form.
$info
Definition: example_052.php:80
class ilCourseObjectiveMaterials
input GUI for a time span (start and end date)
GUI class for public user profile presentation.
static _enabledLearningProgress()
check wether learing progress is enabled or not
const IL_CRS_SUBSCRIPTION_PASSWORD
afterSave(ilObject $a_new_object)
save object public
prepareOutput($a_show_subobjects=true)
Handle member view.
Class ilMailMemberCourseRoles.
This class represents a property in a property form.
class ilobjcourseobjectivesgui
updateCourseIconsObject()
update container icons
setValue($a_value)
Set Value.
const LP_STATUS_FAILED
GUI class for didactic template settings inside repository objects.
static _lookupProgressByObjId($a_obj_id)
lookup progress for a specific object
setMinValue($a_minvalue, $a_display_always=false)
Set Minimum Value.
showPermanentLink(&$tpl)
show permanent link
const IL_CRS_VIEW_SESSIONS
setInfoObject($info)
get info sections
getId()
get object id public
createMailSignature()
Create a course mail signature.
showCustomIconsEditing($a_input_colspan=1, ilPropertyFormGUI $a_form=null, $a_as_section=true)
show edit section of custom icons for container
static _getInstanceByType($a_type)
Get Singleton Instance.
addContentTab()
Add content tab.
static _gotoRepositoryNode($a_ref_id, $a_cmd="frameset")
Goto repository root.
class ilcourseobjective
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
This class represents a number property in a property form.
This class handles base functions for mail handling.
initDidacticTemplate(ilPropertyFormGUI $form)
Show didactic template types.
static _lookupObjId($a_id)
static makeClickable($a_text, $detectGotoLinks=false)
makeClickable In Texten enthaltene URLs und Mail-Adressen klickbar machen
setValue($a_value)
Set Value.
editMapSettingsObject()
Edit Map Settings.
special template class to simplify handling of ITX/PEAR
static getDefaultSettings()
Get default longitude, latitude and zoom.
This class represents a location property in a property form.
This class represents a text property in a property form.
const IL_CRS_SUBSCRIPTION_UNLIMITED
static formatDate(ilDateTime $date)
Format a date public.
getAgreementTabs()
Get tabs for member agreement.
GUI class to create PDF certificates.
static lookupRegistrationInfo($a_obj_id)
Lookup registration info ilDB $ilDB ilObjUser $ilUser ilLanguage $lng.
Date and time handling
forwardToStyleSheet()
Forward to style object.
& forwardToPageObject()
forward command to page object
$ilUser
Definition: imgupload.php:18
redirection script todo: (a better solution should control the processing via a xml file) ...
membersObject()
Called from goto?
const IL_CRS_ADMIN
Base class for course and group participants.
editObject()
edit object
redirectLocToTestConfirmation($a_objective_id, $a_test_id)
Show confirmation whether user wants to start a new run or resume a previous run. ...
setShowTime($a_showtime)
Set Show Time Information.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
askResetObject()
ask reset test results
const STATUS_DETERMINATION_MANUAL
static getAvailablePortfolioLinksForUserIds(array $a_owner_ids, $a_back_url=null)
$txt
Definition: error.php:12
static _getInstanceByObjId($a_obj_id, $a_usr_id)
Get singleton instance.
removeSmallIconObject()
remove small icon
static _readFilesByCourse($a_course_id)
static updateServiceSettingsForm($a_obj_id, ilPropertyFormGUI $form, $services)
Update service settings.
static _checkRequired($a_usr_id, $a_obj_id)
Check required fields.
static _isOnList($a_usr_id, $a_obj_id)
Check if a user on the waiting list.
$failed
Definition: Utf8Test.php:85
static _getTranslation($a_role_title)
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
Class ilObjCourseGroupingGUI.
afterImport(ilObject $a_new_object)
add course admin after import file
static _hasFields($a_container_id)
Check if there are any define fields.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
const CONTEXT_KEY
Session parameter for the context.
static _lookupInProgressForObject($a_obj_id, $a_user_ids=null)
Get in progress users for object.
const IL_CAL_FKT_GETDATE
GUI class for course registrations.
static isActivated()
Checks whether Map feature is activated.
removeBigIconObject()
remove big icon
setSubTabs($a_tab)
set sub tabs
static getLinkTarget($gui, $cmd, Array $gui_params=array(), Array $mail_params=array(), $context_params=array())
static _isActivated($a_obj_id)
Is activated.
This class represents a custom property in a property form.
static isObjectActive($a_obj_id)
static generateCode()
Generate new registration key.
checkLicenses($a_keep=false)
Check the remaining licenses of course objects and generate a message if raare.
static _getCountObjectives($a_obj_id, $a_activated_only=false)
get count objectives
static _fillHTMLMetaTags($a_rbac_id, $a_obj_id, $a_type)
Fill html meta tags.
initSortingForm(ilPropertyFormGUI $form, array $a_sorting_settings)
Append sorting settings to property form.
Create new PHPExcel object
obj_idprivate
__construct()
Constructor public.
global $ilSetting
Definition: privfeed.php:17
static getInstance()
Get instance.
This class represents a text area property in a property form.
Class ilCourseContentGUI.
$ret
Definition: parser.php:6
static initServiceSettingsForm($a_obj_id, ilPropertyFormGUI $form, $services)
Init service settings form.
getCreationMode()
get creation mode
getRefId()
get reference id public
$text
Class ilContainerStartObjectsContentGUI.
deleteInfoFilesObject()
Delete info files.
checkAgreement()
Check agreement and redirect if it is not accepted.
Class ilContainerGUI.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
Create PDF certificates.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
const IL_CRS_SUBSCRIPTION_DIRECT
static _getInstance()
Get instance of ilPrivacySettings.
editInfoObject(ilPropertyFormGUI $a_form=null)
Edit info page informations.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
GUI class for service settings (calendar, notes, comments)
static _lookupCompletedForObject($a_obj_id, $a_user_ids=null)
Get completed users for object.
update()
update object in db
setCompleted($a_status)
infoScreenObject()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually...
static redirect($a_script)
http redirect to other script
const LP_STATUS_COMPLETED
getFormAction($a_cmd, $a_formaction="")
get form action for command (command is method name without "Object", e.g.
editCourseIconsObject($a_form=null)
edit container icons
static getInstance($a_obj_id)
addHeaderAction()
Add header action menu.
infoScreen()
show information screen
Membership notification settings.
static _getLicensedChildObjects($a_ref_id)
Get a list of all sub objects with activated licensing.
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
Class ilObjUserTrackingGUI.
getReturnLocation($a_cmd, $a_location="")
get return location for command (command is method name without "Object", e.g.
$_POST["username"]
$html
Definition: example_001.php:87
static getInstanceByObjId($a_obj_id)
Get instance by obj type.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Class ilContainerStartObjectsGUI.
saveNotificationObject()
:TEMP: Save notification setting (from infoscreen)
Class ilECSCourseSettings.
setContentSubTabs()
Set content sub tabs.
initInfoEditor()
init info editor
const IL_CRS_SUBSCRIPTION_DEACTIVATED
const IL_CRS_ACTIVATION_UNLIMITED
addStandardContainerSubTabs($a_include_view=true)
Add standar container subtabs for view, manage, oderdering and text/media editor link.
Confirmation screen class.
static getInstance()
Constructor.
static getInstance($a_ref_id, $a_include_auto_entries)
Get instance.
static _getFields($a_container_id, $a_sort=IL_CDF_SORT_NAME)
Get all fields of a container.
static setBlockedForLP($a_status)
Toggle LP blocking property status.