ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ilCourseContentGUI Class Reference

Class ilCourseContentGUI. More...

+ Inheritance diagram for ilCourseContentGUI:
+ Collaboration diagram for ilCourseContentGUI:

Public Member Functions

 __construct (ilContainerGUI $container_gui_obj)
 
 executeCommand ()
 
 getContainerObject ()
 
 initStartObjects ()
 
 showStartObjects (ilCourseStart $start_obj)
 
 returnToMembers ()
 
 showUserTimings ()
 
 __renderUserItem (array $item, int $level)
 
 __setSubTabs ()
 
 initCourseObject ()
 
- Public Member Functions inherited from ilObjectGUI
 getRefId ()
 
 setAdminMode (string $mode)
 
 getAdminMode ()
 
 getObject ()
 
 executeCommand ()
 
 withReferences ()
 determines whether objects are referenced or not (got ref ids or not) More...
 
 setCreationMode (bool $mode=true)
 If true, a creation screen is displayed the current [ref_id] does belong to the parent class The mode is determined in ilRepositoryGUI. More...
 
 getCreationMode ()
 
 prepareOutput (bool $show_sub_objects=true)
 
 getAdminTabs ()
 administration tabs show only permissions and trash folder More...
 
 getHTML ()
 
 confirmedDeleteObject ()
 confirmed deletion of object -> objects are moved to trash or deleted immediately, if trash is disabled More...
 
 cancelObject ()
 cancel action and go back to previous page More...
 
 createObject ()
 create new object form More...
 
 editAvailabilityPeriodObject ()
 
 saveAvailabilityPeriodObject ()
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 
 getDidacticTemplateVar (string $type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $obj, ?int $parent_node_id=null)
 Add object to tree at given position. More...
 
 editObject ()
 
 addExternalEditFormCustom (ilPropertyFormGUI $form)
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction (string $cmd, string $default_form_action="")
 Get form action for command (command is method name without "Object", e.g. More...
 
 isVisible (int $ref_id, string $type)
 
 viewObject ()
 viewObject container presentation for "administration -> repository, trash, permissions" More...
 
 deleteObject (bool $error=false)
 Display deletion confirmation screen. More...
 
 setColumnSettings (ilColumnGUI $column_gui)
 
 addToDeskObject ()
 
 removeFromDeskObject ()
 
- Public Member Functions inherited from ILIAS\Object\ImplementsCreationCallback
 callCreationCallback (\ilObject $object, \ilObjectDefinition $obj_definition, int $requested_crtcb)
 

Protected Member Functions

 initMemberIdFromQuery ()
 
 manageTimings (array $failed_items=[])
 Manage timings. More...
 
 managePersonalTimings (array $failed=[])
 Manage personal timings. More...
 
 updatePersonalTimings ()
 Update personal timings. More...
 
 updateManagedTimings ()
 
- Protected Member Functions inherited from ilObjectGUI
 getObjectService ()
 
 assignObject ()
 
 setTitleAndDescription ()
 
 createActionDispatcherGUI ()
 
 initHeaderAction (?string $sub_type=null, ?int $sub_id=null)
 Add header action menu. More...
 
 insertHeaderAction (?ilObjectListGUI $list_gui=null)
 Insert header action into main template. More...
 
 addHeaderAction ()
 Add header action menu. More...
 
 redrawHeaderActionObject ()
 Ajax call: redraw action header only. More...
 
 setTabs ()
 set admin tabs More...
 
 setAdminTabs ()
 set admin tabs More...
 
 setLocator ()
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 omitLocator (bool $omit=true)
 
 addAdminLocatorItems (bool $do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 getCreationFormsHTML (StandardForm|ilPropertyFormGUI|array $form)
 
 getTitleForCreationFormPage ()
 
 getCreationFormTitle ()
 
 initCreateForm (string $new_type)
 
 didacticTemplatesToForm ()
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 
 retrieveAdditionalDidacticTemplateOptions ()
 
 addAdoptContentLinkToToolbar ()
 
 addImportButtonToToolbar ()
 
 addAvailabilityPeriodButtonToToolbar (ilToolbarGUI $toolbar)
 
 parseDidacticTemplateVar (string $var, string $type)
 
 afterSave (ilObject $new_object)
 Post (successful) object creation hook. More...
 
 initEditForm ()
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormValues ()
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 validateCustom (ilPropertyFormGUI $form)
 Validate custom values (if not possible with checkInput()) More...
 
 updateCustom (ilPropertyFormGUI $form)
 Insert custom update form values into object. More...
 
 afterUpdate ()
 Post (successful) object update hook. More...
 
 routeImportCmdObject ()
 
 importFile (string $file_to_import, string $path_to_uploaded_file_in_temp_dir)
 
 deleteUploadedImportFile (string $path_to_uploaded_file_in_temp_dir)
 
 afterImport (ilObject $new_object)
 Post (successful) object import hook. More...
 
 setFormAction (string $cmd, string $form_action)
 
 getReturnLocation (string $cmd, string $default_location="")
 Get return location for command (command is method name without "Object", e.g. More...
 
 setReturnLocation (string $cmd, string $location)
 set specific return location for command More...
 
 getTargetFrame (string $cmd, string $default_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame (string $cmd, string $target_frame)
 Set specific target frame for command. More...
 
 showPossibleSubObjects ()
 show possible sub objects (pull down menu) More...
 
 getTabs ()
 @abstract overwrite in derived GUI class of your object type More...
 
 redirectToRefId (int $ref_id, string $cmd="")
 redirects to (repository) view per ref id usually to a container and usually used at the end of a save/import method where the object gui type (of the new object) doesn't match with the type of the current ["ref_id"] value of the request More...
 
 getCenterColumnHTML ()
 Get center column. More...
 
 getRightColumnHTML ()
 Display right column. More...
 
 checkPermission (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 checkPermissionBool (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files. More...
 
 getCreatableObjectTypes ()
 
 buildAddNewItemElements (array $subtypes, string $create_target_class=ilRepositoryGUI::class, ?int $redirect_target_ref_id=null,)
 
 buildGroup (string $create_target_class, array $obj_types_in_group, string $title, array $subtypes)
 

Protected Attributes

ilGlobalTemplateInterface $main_tpl
 
ilContainerGUI $container_gui
 
ilContainer $container_obj
 
ilObjCourse $course_obj
 
ilGlobalTemplateInterface $tpl
 
ilCtrlInterface $ctrl
 
ilLanguage $lng
 
ilTabsGUI $tabs
 
ilFavouritesManager $fav_manager
 
ilAccessHandler $access
 
ilErrorHandling $error
 
ilObjUser $user
 
ilObjectDataCache $objectDataCache
 
ilTree $tree
 
GlobalHttpState $http
 
Factory $refinery
 
UIFactory $ui_factory
 
UIRenderer $ui_renderer
 
UIServices $ui
 
LOMServices $lom_services
 
- Protected Attributes inherited from ilObjectGUI
ILIAS Notes Service $notes_service
 
GlobalHttpState $http
 
ServerRequestInterface $request
 
ilLocatorGUI $locator
 
ilObjUser $user
 
ilAccessHandler $access
 
ilSetting $settings
 
ilToolbarGUI $toolbar
 
ilRbacAdmin $rbac_admin
 
ilRbacSystem $rbac_system
 
ilRbacReview $rbac_review
 
ilObjectService $object_service
 
ilObjectDefinition $obj_definition
 
ilGlobalTemplateInterface $tpl
 
ilTree $tree
 
ilCtrl $ctrl
 
ilErrorHandling $error
 
ilLanguage $lng
 
ilTabsGUI $tabs_gui
 
ILIAS $ilias
 
ArrayBasedRequestWrapper $post_wrapper
 
RequestWrapper $request_wrapper
 
Refinery $refinery
 
ilFavouritesManager $favourites
 
CustomIconFactory $custom_icon_factory
 
UIFactory $ui_factory
 
UIRenderer $ui_renderer
 
Filesystem $temp_file_system
 
ilObject $object = null
 
bool $creation_mode = false
 
 $data
 
int $id
 
bool $call_by_reference = false
 
bool $prepare_output
 
int $ref_id
 
int $obj_id
 
int $maxcount
 
array $form_action = []
 
array $return_location = []
 
array $target_frame = []
 
string $tmp_import_dir
 
string $sub_objects = ""
 
bool $omit_locator = false
 
string $type = ""
 
string $admin_mode = self::ADMIN_MODE_NONE
 
int $requested_ref_id = 0
 
int $requested_crtptrefid = 0
 
int $requested_crtcb = 0
 
string $requested_new_type = ""
 
string $link_params
 
string $html = ""
 

Additional Inherited Members

- Static Public Member Functions inherited from ilObjectGUI
static _gotoRepositoryRoot (bool $raise_error=false)
 Goto repository root. More...
 
static _gotoRepositoryNode (int $ref_id, string $cmd="")
 
static _gotoSharedWorkspaceNode (int $wsp_id)
 
- Data Fields inherited from ilObjectGUI
const ADMIN_MODE_NONE = ""
 
const ADMIN_MODE_SETTINGS = "settings"
 
const ADMIN_MODE_REPOSITORY = "repository"
 
const UPLOAD_TYPE_LOCAL = 1
 
const UPLOAD_TYPE_UPLOAD_DIRECTORY = 2
 
const CFORM_NEW = 1
 
const CFORM_IMPORT = 2
 
const CFORM_CLONE = 3
 
const SUPPORTED_IMPORT_MIME_TYPES = [MimeType::APPLICATION__ZIP, MimeType::APPLICATION__X_ZIP_COMPRESSED]
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilCourseContentGUI::__construct ( ilContainerGUI  $container_gui_obj)

Definition at line 58 of file class.ilCourseContentGUI.php.

59 {
60 global $DIC;
61
62 $this->main_tpl = $DIC->ui()->mainTemplate();
63 $this->tpl = $DIC->ui()->mainTemplate();
64 $this->ctrl = $DIC->ctrl();
65 $this->lng = $DIC->language();
66 $this->tabs = $DIC->tabs();
67 $this->fav_manager = new ilFavouritesManager();
68 $this->access = $DIC->access();
69 $this->error = $DIC['ilErr'];
70 $this->user = $DIC->user();
71 $this->objectDataCache = $DIC['ilObjDataCache'];
72 $this->tree = $DIC->repositoryTree();
73 $this->http = $DIC->http();
74 $this->refinery = $DIC->refinery();
75 $this->ui_factory = $DIC->ui()->factory();
76 $this->ui_renderer = $DIC->ui()->renderer();
77 $this->ui = $DIC->ui();
78 $this->lom_services = $DIC->learningObjectMetadata();
79
80 $this->container_gui = $container_gui_obj;
81 $this->container_obj = $this->container_gui->getObject();
82 $this->initCourseObject();
83 }
Manages favourites, currently the interface for other components, needs discussion.
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ilObjectGUI\getObject(), ILIAS\FileDelivery\http(), initCourseObject(), ILIAS\Repository\lng(), ILIAS\Repository\objectDataCache(), ILIAS\Repository\refinery(), ILIAS\Repository\tabs(), ILIAS\Repository\ui(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ __renderUserItem()

ilCourseContentGUI::__renderUserItem ( array  $item,
int  $level 
)
Deprecated:
Todo:

Definition at line 388 of file class.ilCourseContentGUI.php.

388 : void
389 {
390 $this->lng->loadLanguageModule('meta');
391
392 $usr_planed = new ilTimingUser($item['ref_id'], $this->initMemberIdFromQuery());
393
394 for ($i = 0; $i < $level; $i++) {
395 $this->tpl->touchBlock('start_indent');
396 $this->tpl->touchBlock('end_indent');
397 }
398 if (strlen($item['description'])) {
399 $this->tpl->setCurrentBlock("item_description");
400 $this->tpl->setVariable("DESC", $item['description']);
401 $this->tpl->parseCurrentBlock();
402 }
403
404 $tlt_data = $this->lom_services->read(
405 ilObject::_lookupObjId($item['ref_id']),
406 0,
407 $item['type'],
408 $this->lom_services->paths()->firstTypicalLearningTime()
409 )->firstData($this->lom_services->paths()->firstTypicalLearningTime());
410
411 if ($tlt = $this->lom_services->dataHelper()->durationToSeconds($tlt_data->value())) {
412 $this->tpl->setCurrentBlock("tlt");
413 $this->tpl->setVariable("TXT_TLT", $this->lng->txt('meta_typical_learning_time'));
414 $this->tpl->setVariable("TLT_VAL", ilDatePresentation::secondsToString($tlt));
415 $this->tpl->parseCurrentBlock();
416 }
417
418 if (!$item['title'] &&
419 $item['type'] == 'sess') {
422 $app_info['start'],
423 $app_info['end'],
424 (bool) $app_info['fullday']
425 );
426 }
427
428 $this->tpl->setCurrentBlock("title_plain");
429 $this->tpl->setVariable("TITLE", $item['title']);
430 $this->tpl->parseCurrentBlock();
431
432 $this->tpl->setCurrentBlock("container_standard_row");
433
434 $this->tpl->setVariable('TYPE_IMG', ilObject::_getIcon($item['obj_id'], 'tiny', $item['type']));
435 $this->tpl->setVariable("TYPE_ALT_IMG", $this->lng->txt('obj_' . $item['type']));
436
437 if ($item['timing_type'] == ilObjectActivation::TIMINGS_PRESETTING) {
438 if ($usr_planed->getStart()->get(IL_CAL_UNIX)) {
439 $this->tpl->setVariable('SUG_START', $usr_planed->getStart()->get(IL_CAL_DATE));
440 }
441 if ($usr_planed->getEnd()->get(IL_CAL_UNIX)) {
442 $this->tpl->setVariable('SUG_END', $usr_planed->getEnd()->get(IL_CAL_DATE));
443 }
444 }
445 $this->tpl->parseCurrentBlock();
446 foreach (ilObjectActivation::getTimingsAdministrationItems($item['ref_id']) as $item_data) {
447 if (($item_data['timing_type'] == ilObjectActivation::TIMINGS_PRESETTING) or
448 ilObjectActivation::hasChangeableTimings($item_data['ref_id'])) {
449 $this->__renderUserItem($item_data, $level + 1);
450 }
451 }
452 }
const IL_CAL_DATE
const IL_CAL_UNIX
__renderUserItem(array $item, int $level)
static secondsToString(int $seconds, bool $force_with_seconds=false, ?ilLanguage $a_lng=null)
converts seconds to string: Long: 7 days 4 hour(s) ...
static hasChangeableTimings(int $ref_id)
Check if there is any active changeable timing (in subtree)
static getTimingsAdministrationItems(int $parent_id)
Get (sub) item data for timings administration view (active/inactive)
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
static _lookupObjId(int $ref_id)
static _lookupAppointment(int $a_obj_id)
static _appointmentToString(int $start, int $end, bool $fulltime)
TableGUI class for timings administration.

References __renderUserItem(), ilSessionAppointment\_appointmentToString(), ilObject\_getIcon(), ilSessionAppointment\_lookupAppointment(), ilObject\_lookupObjId(), ilObjectActivation\getTimingsAdministrationItems(), ilObjectActivation\hasChangeableTimings(), IL_CAL_DATE, IL_CAL_UNIX, initMemberIdFromQuery(), ILIAS\Repository\lng(), ilDatePresentation\secondsToString(), and ilObjectActivation\TIMINGS_PRESETTING.

Referenced by __renderUserItem().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __setSubTabs()

ilCourseContentGUI::__setSubTabs ( )

Definition at line 521 of file class.ilCourseContentGUI.php.

521 : void
522 {
523 if ($this->container_obj->getType() == 'crs') {
524 $this->container_gui->setContentSubTabs();
525 }
526 }

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ executeCommand()

ilCourseContentGUI::executeCommand ( )

Reimplemented from ilObjectGUI.

Definition at line 85 of file class.ilCourseContentGUI.php.

85 : void
86 {
87 if (!$this->access->checkAccess('read', '', $this->container_obj->getRefId())) {
88 $this->error->raiseError($this->lng->txt('msg_no_perm_read'), $this->error->WARNING);
89 }
90
91 $this->__setSubTabs();
92 $this->tabs->setTabActive('view_content');
93 $cmd = $this->ctrl->getCmd();
94
95 switch ($this->ctrl->getNextClass($this)) {
96 default:
97 $start = $this->initStartObjects();
98 if ($start instanceof ilCourseStart) {
99 $this->showStartObjects($start);
100 break;
101 }
102 if (!$cmd) {
103 throw new RuntimeException('Missing ctrl command.');
104 }
105 $this->$cmd();
106 break;
107 }
108 }
showStartObjects(ilCourseStart $start_obj)

References __setSubTabs(), ILIAS\Repository\access(), ILIAS\Repository\ctrl(), initStartObjects(), ILIAS\Repository\lng(), showStartObjects(), and ILIAS\Repository\tabs().

+ Here is the call graph for this function:

◆ getContainerObject()

ilCourseContentGUI::getContainerObject ( )

Definition at line 121 of file class.ilCourseContentGUI.php.

122 {
124 }
Class ilContainer.

References $container_obj.

Referenced by managePersonalTimings(), and manageTimings().

+ Here is the caller graph for this function:

◆ initCourseObject()

ilCourseContentGUI::initCourseObject ( )

Definition at line 528 of file class.ilCourseContentGUI.php.

528 : bool
529 {
530 if ($this->container_obj instanceof ilObjCourse) {
531 $this->course_obj = $this->container_obj;
532 } else {
533 $course_ref_id = $this->tree->checkForParentType($this->container_obj->getRefId(), 'crs');
534 $course = ilObjectFactory::getInstanceByRefId($course_ref_id, false);
535 if ($course instanceof ilObjCourse) {
536 $this->course_obj = $course;
537 }
538 }
539 return true;
540 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id

References $container_obj, and ilObjectFactory\getInstanceByRefId().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initMemberIdFromQuery()

ilCourseContentGUI::initMemberIdFromQuery ( )
protected

Definition at line 110 of file class.ilCourseContentGUI.php.

110 : int
111 {
112 if ($this->http->wrapper()->query()->has('member_id')) {
113 return $this->http->wrapper()->query()->retrieve(
114 'member_id',
115 $this->refinery->kindlyTo()->int()
116 );
117 }
118 return 0;
119 }

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

Referenced by __renderUserItem(), and showUserTimings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initStartObjects()

ilCourseContentGUI::initStartObjects ( )

Definition at line 126 of file class.ilCourseContentGUI.php.

127 {
128 if ($this->access->checkAccess('write', '', $this->course_obj->getRefId())) {
129 return null;
130 }
131 $start_obj = new ilCourseStart($this->course_obj->getRefId(), $this->course_obj->getId());
132 if (count($start_obj->getStartObjects()) && !$start_obj->allFullfilled($this->user->getId())) {
133 return $start_obj;
134 }
135 return null;
136 }

References ILIAS\Repository\access().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ managePersonalTimings()

ilCourseContentGUI::managePersonalTimings ( array  $failed = [])
protected

Manage personal timings.

Definition at line 279 of file class.ilCourseContentGUI.php.

279 : void
280 {
281 global $ilErr, $ilAccess;
282
283 if (!$this->access->checkAccess('read', '', $this->container_obj->getRefId())) {
284 $this->error->raiseError($this->lng->txt('msg_no_perm_read'), $ilErr->WARNING);
285 }
286 $this->tabs->setTabActive('timings_timings');
287 $this->tabs->clearSubTabs();
288
289 $table = new ilTimingsPersonalTableGUI(
290 $this,
291 'managePersonalTimings',
292 $this->getContainerObject(),
293 $this->course_obj
294 );
295 $table->setFailureStatus((bool) count($failed));
296 $table->setUserId($this->user->getId());
297 $table->init();
298 $table->parse(
300 $this->getContainerObject()->getRefId(),
301 false
302 ),
303 $failed
304 );
305 $this->tpl->setContent($table->getHTML());
306 }
static getItems(int $parent_id, bool $with_list_data=true)
Get sub item data.
TableGUI class for editing personal timings.

References ILIAS\Repository\access(), getContainerObject(), ilObjectActivation\getItems(), ilObjectGUI\getRefId(), ILIAS\Repository\lng(), ILIAS\Repository\tabs(), and ILIAS\Repository\user().

Referenced by updatePersonalTimings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ manageTimings()

ilCourseContentGUI::manageTimings ( array  $failed_items = [])
protected

Manage timings.

Definition at line 251 of file class.ilCourseContentGUI.php.

251 : void
252 {
253 if (!$this->access->checkAccess('write', '', $this->container_obj->getRefId())) {
254 $this->error->raiseError($this->lng->txt('msg_no_perm_write'), $this->error->WARNING);
255 }
256 $this->tabs->setTabActive('timings_timings');
257 $this->tabs->clearSubTabs();
258
259 $table = new ilTimingsManageTableGUI(
260 $this,
261 'manageTimings',
262 $this->getContainerObject(),
263 $this->course_obj
264 );
265 if ($failed_items !== []) {
266 $table->setFailureStatus(true);
267 }
268 $table->init();
269 $table->parse(
271 $failed_items
272 );
273 $this->tpl->setContent($table->getHTML());
274 }
TableGUI class for timings administration.

References ILIAS\Repository\access(), getContainerObject(), ilObjectGUI\getRefId(), ilObjectActivation\getTimingsAdministrationItems(), ILIAS\Repository\lng(), and ILIAS\Repository\tabs().

Referenced by updateManagedTimings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ returnToMembers()

ilCourseContentGUI::returnToMembers ( )

Definition at line 349 of file class.ilCourseContentGUI.php.

349 : void
350 {
351 $this->ctrl->returnToParent($this);
352 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ showStartObjects()

ilCourseContentGUI::showStartObjects ( ilCourseStart  $start_obj)

Definition at line 138 of file class.ilCourseContentGUI.php.

138 : void
139 {
140 $this->tabs->setSubTabActive('crs_content');
141
142 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.crs_start_view.html", 'components/ILIAS/Course');
143 $this->tpl->setVariable("INFO_STRING", $this->lng->txt('crs_info_start'));
144 $this->tpl->setVariable("TBL_TITLE_START", $this->lng->txt('crs_table_start_objects'));
145 $this->tpl->setVariable("HEADER_NR", $this->lng->txt('crs_nr'));
146 $this->tpl->setVariable("HEADER_DESC", $this->lng->txt('description'));
147 $this->tpl->setVariable("HEADER_EDITED", $this->lng->txt('crs_objective_accomplished'));
148
149 $lm_continue = new ilCourseLMHistory($this->course_obj->getRefId(), $this->user->getId());
150 $continue_data = $lm_continue->getLMHistory();
151
152 $counter = 0;
153 foreach ($start_obj->getStartObjects() as $start) {
154 $obj_id = $this->objectDataCache->lookupObjId((int) $start['item_ref_id']);
155 $ref_id = $start['item_ref_id'];
156 $type = $this->objectDataCache->lookupType($obj_id);
157
159
160 $obj_link = ilLink::_getLink($ref_id, $type);
161 $obj_frame = '';
162
163 // Tmp fix for tests
164 $obj_frame = $type == 'tst' ? '' : $obj_frame;
165
166 if ($this->access->checkAccess('read', '', $ref_id)) {
167 $this->tpl->setCurrentBlock("start_read");
168 $this->tpl->setVariable("READ_TITLE_START", $this->objectDataCache->lookupTitle($obj_id));
169 $this->tpl->setVariable("READ_TARGET_START", $obj_frame);
170 $this->tpl->setVariable(
171 "READ_LINK_START",
172 $obj_link . '&crs_show_result=' . $this->course_obj->getRefId()
173 );
174 $this->tpl->parseCurrentBlock();
175 } else {
176 $this->tpl->setCurrentBlock("start_visible");
177 $this->tpl->setVariable("VISIBLE_LINK_START", $this->objectDataCache->lookupTitle($obj_id));
178 $this->tpl->parseCurrentBlock();
179 }
180
181 // CONTINUE LINK
182 if (isset($continue_data[$ref_id])) {
183 $this->tpl->setCurrentBlock("link");
184 $this->tpl->setVariable("LINK_HREF", ilLink::_getLink($ref_id, '', array('obj_id',
185 $continue_data[$ref_id]['lm_page_id']
186 )));
187 #$this->tpl->setVariable("CONTINUE_LINK_TARGET",$target);
188 $this->tpl->setVariable("LINK_NAME", $this->lng->txt('continue_work'));
189 $this->tpl->parseCurrentBlock();
190 }
191
192 // add to desktop link
193 $this->lng->loadLanguageModule('dash');
194 if ($this->course_obj->getAboStatus()) {
195 if (!$this->fav_manager->ifIsFavourite($this->user->getId(), $ref_id)) {
196 if ($this->access->checkAccess('read', '', $ref_id)) {
197 $this->tpl->setCurrentBlock("link");
198 $this->ctrl->setParameterByClass(get_class($this->container_gui), 'item_ref_id', $ref_id);
199 $this->ctrl->setParameterByClass(get_class($this->container_gui), 'item_id', $ref_id);
200 $this->ctrl->setParameterByClass(get_class($this->container_gui), 'type', $type);
201
202 $this->tpl->setVariable(
203 "LINK_HREF",
204 $this->ctrl->getLinkTarget($this->container_gui, 'addToDesk')
205 );
206 $this->tpl->setVariable("LINK_NAME", $this->lng->txt("add_to_favourites"));
207 $this->tpl->parseCurrentBlock();
208 }
209 } else {
210 $this->tpl->setCurrentBlock("link");
211 $this->ctrl->setParameterByClass(get_class($this->container_gui), 'item_ref_id', $ref_id);
212 $this->ctrl->setParameterByClass(get_class($this->container_gui), 'item_id', $ref_id);
213 $this->ctrl->setParameterByClass(get_class($this->container_gui), 'type', $type);
214
215 $this->tpl->setVariable(
216 "LINK_HREF",
217 $this->ctrl->getLinkTarget($this->container_gui, 'removeFromDesk')
218 );
219 $this->tpl->setVariable("LINK_NAME", $this->lng->txt("remove_from_favourites"));
220 $this->tpl->parseCurrentBlock();
221 }
222 }
223
224 // Description
225 if (strlen($this->objectDataCache->lookupDescription($obj_id))) {
226 $this->tpl->setCurrentBlock("start_description");
227 $this->tpl->setVariable("DESCRIPTION_START", $this->objectDataCache->lookupDescription($obj_id));
228 $this->tpl->parseCurrentBlock();
229 }
230
231 if ($start_obj->isFullfilled($this->user->getId(), $ref_id)) {
232 $accomplished = 'accomplished';
233 $icon = ilUtil::getImagePath("standard/icon_ok.svg");
234 } else {
235 $accomplished = 'not_accomplished';
236 $icon = ilUtil::getImagePath("standard/icon_not_ok.svg");
237 }
238 $this->tpl->setCurrentBlock("start_row");
239 $this->tpl->setVariable("EDITED_IMG", $icon);
240 $this->tpl->setVariable("EDITED_ALT", $this->lng->txt('crs_objective_' . $accomplished));
241 $this->tpl->setVariable("ROW_CLASS", 'option_value');
242 $this->tpl->setVariable("ROW_CLASS_CENTER", 'option_value_center');
243 $this->tpl->setVariable("OBJ_NR_START", ++$counter . '.');
244 $this->tpl->parseCurrentBlock();
245 }
246 }
static _checkAllConditionsOfTarget(int $a_target_ref_id, int $a_target_id, string $a_target_type="", int $a_usr_id=0)
checks wether all conditions of a target object are fulfilled
class ilCourseLMHistory
isFullfilled(int $user_id, int $item_id)
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)

References ilObjectGUI\$obj_id, ilObjectGUI\$ref_id, ilObjectGUI\$type, ilConditionHandler\_checkAllConditionsOfTarget(), ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ilUtil\getImagePath(), ilCourseStart\getStartObjects(), ilCourseStart\isFullfilled(), ILIAS\Repository\lng(), ILIAS\Repository\objectDataCache(), and ILIAS\Repository\tabs().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showUserTimings()

ilCourseContentGUI::showUserTimings ( )

Definition at line 354 of file class.ilCourseContentGUI.php.

354 : void
355 {
356 $this->tabs->clearSubTabs();
357 $this->tabs->activateTab('members');
358 $back_breadcrumb = $this->ui->factory()->breadcrumbs([
359 $this->ui->factory()->link()->standard(
360 $this->lng->txt("back"),
361 $this->ctrl->getLinkTarget($this, 'returnToMembers')
362 )
363 ]);
364 if (!$this->initMemberIdFromQuery()) {
365 $this->main_tpl->setOnScreenMessage('failure', $this->lng->txt('no_checkbox'), true);
366 $this->ctrl->redirectByClass(ilCourseContentGUI::class, 'returnToMembers');
367 }
368 $membership_timingsview_table_factory = new ILIAS\Course\Table\TimingsView\Factory(
369 $this->user,
370 $this->ui,
371 $this->http,
372 $this->lng
373 );
374 $data_retrieval = $membership_timingsview_table_factory->dataRetrieval(
375 $this->initMemberIdFromQuery(),
376 $this->course_obj->getRefId()
377 );
378 $table = $membership_timingsview_table_factory->handler(
379 $data_retrieval
380 );
381 $this->tpl->setContent($this->ui->renderer()->render($back_breadcrumb) . $table->getHTML());
382 }

References ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), initMemberIdFromQuery(), ILIAS\Repository\lng(), ILIAS\Repository\tabs(), ILIAS\Repository\ui(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ updateManagedTimings()

ilCourseContentGUI::updateManagedTimings ( )
protected

Definition at line 454 of file class.ilCourseContentGUI.php.

454 : bool
455 {
456 if (!$this->access->checkAccess('write', '', $this->container_obj->getRefId())) {
457 $this->error->raiseError($this->lng->txt('msg_no_perm_write'), $this->error->WARNING);
458 }
459
460 $this->tabs->clearSubTabs();
461
462 $failed = array();
463 $post_item = (array) ($this->http->request()->getParsedBody()['item']) ?? [];
464 foreach ($post_item as $ref_id => $data) {
465 $item_obj = new ilObjectActivation();
466 $item_obj->read($ref_id);
467
468 $data['active'] = $data['active'] ?? 0;
470 $item_obj->toggleChangeable((bool) ($data['change'] ?? false));
471
472 if ($this->course_obj->getTimingMode() == ilCourseConstants::IL_CRS_VIEW_TIMING_ABSOLUTE) {
473 $sug_start_dt = ilCalendarUtil::parseIncomingDate($data['sug_start'] ?? '');
474 $sug_end_dt = ilCalendarUtil::parseIncomingDate($data['sug_end'] ?? '');
475
476 if ($sug_start_dt instanceof ilDate && $sug_end_dt instanceof ilDate) {
477 if (ilDateTime::_after($sug_start_dt, $sug_end_dt)) {
478 $failed[$ref_id] = 'crs_timing_err_start_end';
479 continue;
480 }
481 $item_obj->setSuggestionStart($sug_start_dt->get(IL_CAL_UNIX));
482 $item_obj->setSuggestionEnd($sug_end_dt->get(IL_CAL_UNIX));
483 } else {
484 $failed['ref_id'] = 'crs_timing_err_valid_dates';
485 continue;
486 }
487 } else {
488 if (
489 (int) $data['sug_start_rel'] < 0 || (int) $data['duration_a'] < 0
490 ) {
491 $failed[$ref_id] = 'crs_timing_err_start_dur_rel';
492 continue;
493 }
494 $item_obj->setSuggestionStartRelative($data['sug_start_rel']);
495 $item_obj->setSuggestionEndRelative($data['sug_start_rel'] + $data['duration_a']);
496
497 // add default values for start/end (relative to now)
498 $start = new ilDate(time(), IL_CAL_UNIX);
499 $start->increment(IL_CAL_DAY, $data['sug_start_rel']);
500 $item_obj->setSuggestionStart($start->get(IL_CAL_UNIX));
501
502 $start->increment(IL_CAL_DAY, $data['duration_a']);
503 $item_obj->setSuggestionEnd($start->get(IL_CAL_UNIX));
504 }
505
506 $item_obj->update($ref_id);
507 }
508 if ($failed === []) {
509 // update course => create calendar entries
510 $this->course_obj->update();
511 $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'));
512 $this->manageTimings();
513 return true;
514 } else {
515 $this->main_tpl->setOnScreenMessage('failure', $this->lng->txt('err_check_input'));
516 $this->manageTimings($failed);
517 return true;
518 }
519 }
const IL_CAL_DAY
static parseIncomingDate($value, bool $add_time=false)
Try to parse incoming value to date object.
manageTimings(array $failed_items=[])
Manage timings.
static _after(ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
compare two dates and check start is after end This method does not consider tz offsets.
Class for single dates.
Class ilObjectActivation.

References ilObjectGUI\$data, ilObjectGUI\$ref_id, ilDateTime\_after(), ILIAS\Repository\access(), ILIAS\FileDelivery\http(), IL_CAL_DAY, IL_CAL_UNIX, ilCourseConstants\IL_CRS_VIEW_TIMING_ABSOLUTE, ILIAS\Repository\lng(), manageTimings(), ilCalendarUtil\parseIncomingDate(), ILIAS\Repository\tabs(), ilObjectActivation\TIMINGS_DEACTIVATED, and ilObjectActivation\TIMINGS_PRESETTING.

+ Here is the call graph for this function:

◆ updatePersonalTimings()

ilCourseContentGUI::updatePersonalTimings ( )
protected

Update personal timings.

Definition at line 311 of file class.ilCourseContentGUI.php.

311 : bool
312 {
313 if (!$this->access->checkAccess('read', '', $this->container_obj->getRefId())) {
314 $this->error->raiseError($this->lng->txt('msg_no_perm_write'), $this->error->WARNING);
315 }
316 $this->tabs->clearSubTabs();
317 $failed = array();
318
319 $post_item = (array) ($this->http->request()->getParsedBody()['item'] ?? []);
320 foreach ($post_item as $ref_id => $data) {
321 $sug_start_dt = ilCalendarUtil::parseIncomingDate($data['sug_start']);
322 $sug_end_dt = ilCalendarUtil::parseIncomingDate($data['sug_end']);
323
324 if ($sug_start_dt instanceof ilDate && $sug_end_dt instanceof ilDate) {
325 if (ilDateTime::_after($sug_start_dt, $sug_end_dt)) {
326 $failed[$ref_id] = 'crs_timing_err_start_end';
327 continue;
328 }
329 // update user date
330 $tu = new ilTimingUser($ref_id, $GLOBALS['ilUser']->getId());
331 $tu->getStart()->setDate($sug_start_dt->get(IL_CAL_UNIX), IL_CAL_UNIX);
332 $tu->getEnd()->setDate($sug_end_dt->get(IL_CAL_UNIX), IL_CAL_UNIX);
333 $tu->update();
334 } else {
335 $failed['ref_id'] = 'crs_timing_err_valid_dates';
336 }
337 }
338 if ($failed === []) {
339 $this->main_tpl->setOnScreenMessage('success', $GLOBALS['lng']->txt('settings_saved'));
340 $this->managePersonalTimings();
341 return true;
342 } else {
343 $this->main_tpl->setOnScreenMessage('failure', $this->lng->txt('err_check_input'));
344 $this->managePersonalTimings($failed);
345 return true;
346 }
347 }
managePersonalTimings(array $failed=[])
Manage personal timings.
$GLOBALS["DIC"]
Definition: wac.php:66

References ilObjectGUI\$data, $GLOBALS, ilObjectGUI\$ref_id, ilDateTime\_after(), ILIAS\Repository\access(), ILIAS\Survey\Mode\getId(), ILIAS\FileDelivery\http(), IL_CAL_UNIX, ILIAS\Repository\lng(), managePersonalTimings(), ilCalendarUtil\parseIncomingDate(), and ILIAS\Repository\tabs().

+ Here is the call graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilCourseContentGUI::$access
protected

Definition at line 46 of file class.ilCourseContentGUI.php.

◆ $container_gui

ilContainerGUI ilCourseContentGUI::$container_gui
protected

Definition at line 37 of file class.ilCourseContentGUI.php.

◆ $container_obj

ilContainer ilCourseContentGUI::$container_obj
protected

Definition at line 38 of file class.ilCourseContentGUI.php.

Referenced by getContainerObject(), and initCourseObject().

◆ $course_obj

ilObjCourse ilCourseContentGUI::$course_obj
protected

Definition at line 39 of file class.ilCourseContentGUI.php.

◆ $ctrl

ilCtrlInterface ilCourseContentGUI::$ctrl
protected

Definition at line 42 of file class.ilCourseContentGUI.php.

◆ $error

ilErrorHandling ilCourseContentGUI::$error
protected

Definition at line 47 of file class.ilCourseContentGUI.php.

◆ $fav_manager

ilFavouritesManager ilCourseContentGUI::$fav_manager
protected

Definition at line 45 of file class.ilCourseContentGUI.php.

◆ $http

GlobalHttpState ilCourseContentGUI::$http
protected

Definition at line 51 of file class.ilCourseContentGUI.php.

◆ $lng

ilLanguage ilCourseContentGUI::$lng
protected

Definition at line 43 of file class.ilCourseContentGUI.php.

◆ $lom_services

LOMServices ilCourseContentGUI::$lom_services
protected

Definition at line 56 of file class.ilCourseContentGUI.php.

◆ $main_tpl

ilGlobalTemplateInterface ilCourseContentGUI::$main_tpl
protected

Definition at line 36 of file class.ilCourseContentGUI.php.

◆ $objectDataCache

ilObjectDataCache ilCourseContentGUI::$objectDataCache
protected

Definition at line 49 of file class.ilCourseContentGUI.php.

◆ $refinery

Factory ilCourseContentGUI::$refinery
protected

Definition at line 52 of file class.ilCourseContentGUI.php.

◆ $tabs

ilTabsGUI ilCourseContentGUI::$tabs
protected

Definition at line 44 of file class.ilCourseContentGUI.php.

◆ $tpl

ilGlobalTemplateInterface ilCourseContentGUI::$tpl
protected

Definition at line 41 of file class.ilCourseContentGUI.php.

◆ $tree

ilTree ilCourseContentGUI::$tree
protected

Definition at line 50 of file class.ilCourseContentGUI.php.

◆ $ui

UIServices ilCourseContentGUI::$ui
protected

Definition at line 55 of file class.ilCourseContentGUI.php.

◆ $ui_factory

UIFactory ilCourseContentGUI::$ui_factory
protected

Definition at line 53 of file class.ilCourseContentGUI.php.

◆ $ui_renderer

UIRenderer ilCourseContentGUI::$ui_renderer
protected

Definition at line 54 of file class.ilCourseContentGUI.php.

◆ $user

ilObjUser ilCourseContentGUI::$user
protected

Definition at line 48 of file class.ilCourseContentGUI.php.


The documentation for this class was generated from the following file: