ILIAS  release_8 Revision v8.24
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
 __construct ($data, int $id=0, bool $call_by_reference=true, bool $prepare_output=true)
 
 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] don't belong to the current 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...
 
 cancelDeleteObject ()
 cancel deletion of object More...
 
 cancelObject ()
 cancel action and go back to previous page More...
 
 createObject ()
 create new object form More...
 
 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)
 
 redirectAfterCreation ()
 Redirect after creation, see https://docu.ilias.de/goto_docu_wiki_wpage_5035_1357.html Should be overwritten and redirect to settings screen. More...
 
 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 ()
 
 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...
 
 initCreationForms (string $new_type)
 Init creation forms. More...
 
 getCreationFormsHTML (array $forms)
 Get HTML for creation forms (accordion) More...
 
 initCreateForm (string $new_type)
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 
 addDidacticTemplateOptions (array &$a_options)
 Add custom templates. More...
 
 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...
 
 initImportForm (string $new_type)
 
 importFileObject (int $parent_id=null)
 
 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...
 
 fillCloneTemplate (?string $tpl_name, string $type)
 Fill object clone template This method can be called from any object GUI class that wants to offer object cloning. 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...
 
 showCustomIconsEditing ( $input_colspan=1, ilPropertyFormGUI $form=null, $as_section=true)
 show edit section of custom icons for container More...
 

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
 
- Protected Attributes inherited from ilObjectGUI
ILIAS Notes Service $notes_service
 
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
 
Factory $refinery
 
ilFavouritesManager $favourites
 
ilObjectCustomIconFactory $custom_icon_factory
 
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 ALLOWED_TAGS_IN_TITLE_AND_DESCRIPTION
 
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
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilCourseContentGUI::__construct ( ilContainerGUI  $container_gui_obj)

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

55 {
56 global $DIC;
57
58 $this->main_tpl = $DIC->ui()->mainTemplate();
59 $this->tpl = $DIC->ui()->mainTemplate();
60 $this->ctrl = $DIC->ctrl();
61 $this->lng = $DIC->language();
62 $this->tabs = $DIC->tabs();
63 $this->fav_manager = new ilFavouritesManager();
64 $this->access = $DIC->access();
65 $this->error = $DIC['ilErr'];
66 $this->user = $DIC->user();
67 $this->objectDataCache = $DIC['ilObjDataCache'];
68 $this->tree = $DIC->repositoryTree();
69 $this->http = $DIC->http();
70 $this->refinery = $DIC->refinery();
71 $this->ui_factory = $DIC->ui()->factory();
72 $this->ui_renderer = $DIC->ui()->renderer();
73
74 $this->container_gui = $container_gui_obj;
75 $this->container_obj = $this->container_gui->getObject();
76 $this->initCourseObject();
77 }
error(string $a_errmsg)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
static http()
Fetches the global http state from ILIAS.

References $DIC, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), error(), ilObjectGUI\getObject(), ILIAS\FileDelivery\http(), initCourseObject(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ILIAS\Repository\tabs(), 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 399 of file class.ilCourseContentGUI.php.

399 : void
400 {
401 $this->lng->loadLanguageModule('meta');
402
403 $usr_planed = new ilTimingUser($item['ref_id'], $this->initMemberIdFromQuery());
404
405 for ($i = 0; $i < $level; $i++) {
406 $this->tpl->touchBlock('start_indent');
407 $this->tpl->touchBlock('end_indent');
408 }
409 if (strlen($item['description'])) {
410 $this->tpl->setCurrentBlock("item_description");
411 $this->tpl->setVariable("DESC", $item['description']);
412 $this->tpl->parseCurrentBlock();
413 }
414 if ($tlt = ilMDEducational::_getTypicalLearningTimeSeconds($item['obj_id'])) {
415 $this->tpl->setCurrentBlock("tlt");
416 $this->tpl->setVariable("TXT_TLT", $this->lng->txt('meta_typical_learning_time'));
417 $this->tpl->setVariable("TLT_VAL", ilDatePresentation::secondsToString($tlt));
418 $this->tpl->parseCurrentBlock();
419 }
420
421 if (!$item['title'] &&
422 $item['type'] == 'sess') {
425 $app_info['start'],
426 $app_info['end'],
427 (bool) $app_info['fullday']
428 );
429 }
430
431 $this->tpl->setCurrentBlock("title_plain");
432 $this->tpl->setVariable("TITLE", $item['title']);
433 $this->tpl->parseCurrentBlock();
434
435 $this->tpl->setCurrentBlock("container_standard_row");
436
437 $this->tpl->setVariable('TYPE_IMG', ilObject::_getIcon($item['obj_id'], 'tiny', $item['type']));
438 $this->tpl->setVariable("TYPE_ALT_IMG", $this->lng->txt('obj_' . $item['type']));
439
440 if ($item['timing_type'] == ilObjectActivation::TIMINGS_PRESETTING) {
441 if ($usr_planed->getStart()->get(IL_CAL_UNIX)) {
442 $this->tpl->setVariable('SUG_START', $usr_planed->getStart()->get(IL_CAL_DATE));
443 }
444 if ($usr_planed->getEnd()->get(IL_CAL_UNIX)) {
445 $this->tpl->setVariable('SUG_END', $usr_planed->getEnd()->get(IL_CAL_DATE));
446 }
447 }
448 $this->tpl->parseCurrentBlock();
449 foreach (ilObjectActivation::getTimingsAdministrationItems($item['ref_id']) as $item_data) {
450 if (($item_data['timing_type'] == ilObjectActivation::TIMINGS_PRESETTING) or
451 ilObjectActivation::hasChangeableTimings($item_data['ref_id'])) {
452 $this->__renderUserItem($item_data, $level + 1);
453 }
454 }
455 }
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 _getTypicalLearningTimeSeconds(int $a_rbac_id, int $a_obj_id=0)
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)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$i
Definition: metadata.php:41

References $i, __renderUserItem(), ilSessionAppointment\_appointmentToString(), ilObject\_getIcon(), ilMDEducational\_getTypicalLearningTimeSeconds(), 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(), and showUserTimings().

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

◆ __setSubTabs()

ilCourseContentGUI::__setSubTabs ( )

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

524 : void
525 {
526 if ($this->container_obj->getType() == 'crs') {
527 $this->container_gui->setContentSubTabs();
528 }
529 }

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ executeCommand()

ilCourseContentGUI::executeCommand ( )

Reimplemented from ilObjectGUI.

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

79 : void
80 {
81 if (!$this->access->checkAccess('read', '', $this->container_obj->getRefId())) {
82 $this->error->raiseError($this->lng->txt('msg_no_perm_read'), $this->error->WARNING);
83 }
84
85 $this->__setSubTabs();
86 $this->tabs->setTabActive('view_content');
87 $cmd = $this->ctrl->getCmd();
88
89 switch ($this->ctrl->getNextClass($this)) {
90 default:
91 $start = $this->initStartObjects();
92 if ($start instanceof ilCourseStart) {
93 $this->showStartObjects($start);
94 break;
95 }
96 if (!$cmd) {
97 throw new RuntimeException('Missing ctrl command.');
98 }
99 $this->$cmd();
100 break;
101 }
102 }
showStartObjects(ilCourseStart $start_obj)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

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

+ Here is the call graph for this function:

◆ getContainerObject()

ilCourseContentGUI::getContainerObject ( )

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

116 {
118 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $container_obj.

Referenced by managePersonalTimings(), and manageTimings().

+ Here is the caller graph for this function:

◆ initCourseObject()

ilCourseContentGUI::initCourseObject ( )

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

531 : bool
532 {
533 if ($this->container_obj instanceof ilObjCourse) {
534 $this->course_obj = $this->container_obj;
535 } else {
536 $course_ref_id = $this->tree->checkForParentType($this->container_obj->getRefId(), 'crs');
537 $course = ilObjectFactory::getInstanceByRefId($course_ref_id, false);
538 if ($course instanceof ilObjCourse) {
539 $this->course_obj = $course;
540 }
541 }
542 return true;
543 }
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 104 of file class.ilCourseContentGUI.php.

104 : int
105 {
106 if ($this->http->wrapper()->query()->has('member_id')) {
107 return $this->http->wrapper()->query()->retrieve(
108 'member_id',
109 $this->refinery->kindlyTo()->int()
110 );
111 }
112 return 0;
113 }

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 120 of file class.ilCourseContentGUI.php.

121 {
122 if ($this->access->checkAccess('write', '', $this->course_obj->getRefId())) {
123 return null;
124 }
125 $start_obj = new ilCourseStart($this->course_obj->getRefId(), $this->course_obj->getId());
126 if (count($start_obj->getStartObjects()) && !$start_obj->allFullfilled($this->user->getId())) {
127 return $start_obj;
128 }
129 return null;
130 }

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 272 of file class.ilCourseContentGUI.php.

272 : void
273 {
274 global $ilErr, $ilAccess;
275
276 if (!$this->access->checkAccess('read', '', $this->container_obj->getRefId())) {
277 $this->error->raiseError($this->lng->txt('msg_no_perm_read'), $ilErr->WARNING);
278 }
279 $this->tabs->setTabActive('timings_timings');
280 $this->tabs->clearSubTabs();
281
282 $table = new ilTimingsPersonalTableGUI(
283 $this,
284 'managePersonalTimings',
285 $this->getContainerObject(),
286 $this->course_obj
287 );
288 $table->setFailureStatus((bool) count($failed));
289 $table->setUserId($this->user->getId());
290 $table->init();
291 $table->parse(
293 $this->getContainerObject()->getRefId(),
294 false
295 ),
296 $failed
297 );
298 $this->tpl->setContent($table->getHTML());
299 }
static getItems(int $parent_id, bool $with_list_data=true)
Get sub item data.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ilErr
Definition: raiseError.php:17

References $ilErr, ILIAS\Repository\access(), error(), 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 244 of file class.ilCourseContentGUI.php.

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

References ILIAS\Repository\access(), error(), 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 342 of file class.ilCourseContentGUI.php.

342 : void
343 {
344 $this->ctrl->returnToParent($this);
345 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ showStartObjects()

ilCourseContentGUI::showStartObjects ( ilCourseStart  $start_obj)

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

132 : void
133 {
134 $this->tabs->setSubTabActive('crs_content');
135
136 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.crs_start_view.html", 'Modules/Course');
137 $this->tpl->setVariable("INFO_STRING", $this->lng->txt('crs_info_start'));
138 $this->tpl->setVariable("TBL_TITLE_START", $this->lng->txt('crs_table_start_objects'));
139 $this->tpl->setVariable("HEADER_NR", $this->lng->txt('crs_nr'));
140 $this->tpl->setVariable("HEADER_DESC", $this->lng->txt('description'));
141 $this->tpl->setVariable("HEADER_EDITED", $this->lng->txt('crs_objective_accomplished'));
142
143 $lm_continue = new ilCourseLMHistory($this->course_obj->getRefId(), $this->user->getId());
144 $continue_data = $lm_continue->getLMHistory();
145
146 $counter = 0;
147 foreach ($start_obj->getStartObjects() as $start) {
148 $obj_id = $this->objectDataCache->lookupObjId((int) $start['item_ref_id']);
149 $ref_id = $start['item_ref_id'];
150 $type = $this->objectDataCache->lookupType($obj_id);
151
153
154 $obj_link = ilLink::_getLink($ref_id, $type);
155 $obj_frame = '';
156
157 // Tmp fix for tests
158 $obj_frame = $type == 'tst' ? '' : $obj_frame;
159
160 if ($this->access->checkAccess('read', '', $ref_id)) {
161 $this->tpl->setCurrentBlock("start_read");
162 $this->tpl->setVariable("READ_TITLE_START", $this->objectDataCache->lookupTitle($obj_id));
163 $this->tpl->setVariable("READ_TARGET_START", $obj_frame);
164 $this->tpl->setVariable(
165 "READ_LINK_START",
166 $obj_link . '&crs_show_result=' . $this->course_obj->getRefId()
167 );
168 $this->tpl->parseCurrentBlock();
169 } else {
170 $this->tpl->setCurrentBlock("start_visible");
171 $this->tpl->setVariable("VISIBLE_LINK_START", $this->objectDataCache->lookupTitle($obj_id));
172 $this->tpl->parseCurrentBlock();
173 }
174
175 // CONTINUE LINK
176 if (isset($continue_data[$ref_id])) {
177 $this->tpl->setCurrentBlock("link");
178 $this->tpl->setVariable("LINK_HREF", ilLink::_getLink($ref_id, '', array('obj_id',
179 $continue_data[$ref_id]['lm_page_id']
180 )));
181 #$this->tpl->setVariable("CONTINUE_LINK_TARGET",$target);
182 $this->tpl->setVariable("LINK_NAME", $this->lng->txt('continue_work'));
183 $this->tpl->parseCurrentBlock();
184 }
185
186 // add to desktop link
187 if ($this->course_obj->getAboStatus()) {
188 if (!$this->fav_manager->ifIsFavourite($this->user->getId(), $ref_id)) {
189 if ($this->access->checkAccess('read', '', $ref_id)) {
190 $this->tpl->setCurrentBlock("link");
191 $this->ctrl->setParameterByClass(get_class($this->container_gui), 'item_ref_id', $ref_id);
192 $this->ctrl->setParameterByClass(get_class($this->container_gui), 'item_id', $ref_id);
193 $this->ctrl->setParameterByClass(get_class($this->container_gui), 'type', $type);
194
195 $this->tpl->setVariable(
196 "LINK_HREF",
197 $this->ctrl->getLinkTarget($this->container_gui, 'addToDesk')
198 );
199 $this->tpl->setVariable("LINK_NAME", $this->lng->txt("rep_add_to_favourites"));
200 $this->tpl->parseCurrentBlock();
201 }
202 } else {
203 $this->tpl->setCurrentBlock("link");
204 $this->ctrl->setParameterByClass(get_class($this->container_gui), 'item_ref_id', $ref_id);
205 $this->ctrl->setParameterByClass(get_class($this->container_gui), 'item_id', $ref_id);
206 $this->ctrl->setParameterByClass(get_class($this->container_gui), 'type', $type);
207
208 $this->tpl->setVariable(
209 "LINK_HREF",
210 $this->ctrl->getLinkTarget($this->container_gui, 'removeFromDesk')
211 );
212 $this->tpl->setVariable("LINK_NAME", $this->lng->txt("rep_remove_from_favourites"));
213 $this->tpl->parseCurrentBlock();
214 }
215 }
216
217 // Description
218 if (strlen($this->objectDataCache->lookupDescription($obj_id))) {
219 $this->tpl->setCurrentBlock("start_description");
220 $this->tpl->setVariable("DESCRIPTION_START", $this->objectDataCache->lookupDescription($obj_id));
221 $this->tpl->parseCurrentBlock();
222 }
223
224 if ($start_obj->isFullfilled($this->user->getId(), $ref_id)) {
225 $accomplished = 'accomplished';
226 $icon = ilUtil::getImagePath("icon_ok.svg");
227 } else {
228 $accomplished = 'not_accomplished';
229 $icon = ilUtil::getImagePath("icon_not_ok.svg");
230 }
231 $this->tpl->setCurrentBlock("start_row");
232 $this->tpl->setVariable("EDITED_IMG", $icon);
233 $this->tpl->setVariable("EDITED_ALT", $this->lng->txt('crs_objective_' . $accomplished));
234 $this->tpl->setVariable("ROW_CLASS", 'option_value');
235 $this->tpl->setVariable("ROW_CLASS_CENTER", 'option_value_center');
236 $this->tpl->setVariable("OBJ_NR_START", ++$counter . '.');
237 $this->tpl->parseCurrentBlock();
238 }
239 }
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
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
isFullfilled(int $user_id, int $item_id)
static getImagePath(string $img, 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(), ilLink\_getLink(), ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ilUtil\getImagePath(), ilCourseStart\getStartObjects(), ilCourseStart\isFullfilled(), ILIAS\Repository\lng(), 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 ( )
Deprecated:
Todo:

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

351 : void
352 {
353 $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.crs_user_timings.html', 'Modules/Course');
354 $this->tabs->clearSubTabs();
355 $this->tabs->setTabActive('members');
356
357 if (!$this->initMemberIdFromQuery()) {
358 $this->main_tpl->setOnScreenMessage('failure', $this->lng->txt('no_checkbox'), true);
359 $this->ctrl->returnToParent($this);
360 }
361
362 // Back button
363 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
364 $this->tpl->setCurrentBlock("btn_cell");
365 $this->tpl->setVariable("BTN_LINK", $this->ctrl->getLinkTarget($this, 'returnToMembers'));
366 $this->tpl->setVariable("BTN_TXT", $this->lng->txt("back"));
367 $this->tpl->parseCurrentBlock();
368
369 $usr_icon = $this->ui_factory->symbol()->icon()->standard(
370 'usr',
371 $this->lng->txt('obj_usr'),
372 'large'
373 );
374 $this->tpl->setVariable("HEADER_IMG", $this->ui_renderer->render($usr_icon));
375 $this->tpl->setVariable("TABLE_HEADER", $this->lng->txt('timings_of'));
377 $this->tpl->setVariable("USER_NAME", $name['lastname'] . ', ' . $name['firstname']);
378
379 $this->tpl->setVariable("TXT_TITLE", $this->lng->txt('title'));
380 $this->tpl->setVariable("TXT_START_END", $this->lng->txt('crs_timings_short_start_end'));
381 $this->tpl->setVariable("TXT_INFO_START_END", $this->lng->txt('crs_timings_start_end_info'));
382 $this->tpl->setVariable("TXT_CHANGED", $this->lng->txt('crs_timings_changed'));
383 $this->tpl->setVariable("TXT_OWN_PRESETTING", $this->lng->txt('crs_timings_planed_start'));
384 $this->tpl->setVariable("TXT_INFO_OWN_PRESETTING", $this->lng->txt('crs_timings_from_until'));
385
386 $items = ilObjectActivation::getTimingsAdministrationItems($this->course_obj->getRefId());
387 foreach ($items as $item) {
388 if (($item['timing_type'] == ilObjectActivation::TIMINGS_PRESETTING) or
390 $this->__renderUserItem($item, 0);
391 }
392 }
393 }
static _lookupName(int $a_user_id)
lookup user name
if($format !==null) $name
Definition: metadata.php:247

References $name, __renderUserItem(), ilObjUser\_lookupName(), ILIAS\Repository\ctrl(), ilObjectActivation\getTimingsAdministrationItems(), ilObjectActivation\hasChangeableTimings(), initMemberIdFromQuery(), ILIAS\Repository\lng(), ILIAS\Repository\tabs(), and ilObjectActivation\TIMINGS_PRESETTING.

+ Here is the call graph for this function:

◆ updateManagedTimings()

ilCourseContentGUI::updateManagedTimings ( )
protected

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

457 : bool
458 {
459 if (!$this->access->checkAccess('write', '', $this->container_obj->getRefId())) {
460 $this->error->raiseError($this->lng->txt('msg_no_perm_write'), $this->error->WARNING);
461 }
462
463 $this->tabs->clearSubTabs();
464
465 $failed = array();
466 $post_item = (array) ($this->http->request()->getParsedBody()['item']) ?? [];
467 foreach ($post_item as $ref_id => $data) {
468 $item_obj = new ilObjectActivation();
469 $item_obj->read($ref_id);
470
471 $data['active'] = $data['active'] ?? 0;
473 $item_obj->toggleChangeable((bool) ($data['change'] ?? false));
474
475 if ($this->course_obj->getTimingMode() == ilCourseConstants::IL_CRS_VIEW_TIMING_ABSOLUTE) {
476 $sug_start_dt = ilCalendarUtil::parseIncomingDate($data['sug_start'] ?? '');
477 $sug_end_dt = ilCalendarUtil::parseIncomingDate($data['sug_end'] ?? '');
478
479 if ($sug_start_dt instanceof ilDate && $sug_end_dt instanceof ilDate) {
480 if (ilDateTime::_after($sug_start_dt, $sug_end_dt)) {
481 $failed[$ref_id] = 'crs_timing_err_start_end';
482 continue;
483 }
484 $item_obj->setSuggestionStart($sug_start_dt->get(IL_CAL_UNIX));
485 $item_obj->setSuggestionEnd($sug_end_dt->get(IL_CAL_UNIX));
486 } else {
487 $failed['ref_id'] = 'crs_timing_err_valid_dates';
488 continue;
489 }
490 } else {
491 if (
492 (int) $data['sug_start_rel'] < 0 || (int) $data['duration_a'] < 0
493 ) {
494 $failed[$ref_id] = 'crs_timing_err_start_dur_rel';
495 continue;
496 }
497 $item_obj->setSuggestionStartRelative($data['sug_start_rel']);
498 $item_obj->setSuggestionEndRelative($data['sug_start_rel'] + $data['duration_a']);
499
500 // add default values for start/end (relative to now)
501 $start = new ilDate(time(), IL_CAL_UNIX);
502 $start->increment(IL_CAL_DAY, $data['sug_start_rel']);
503 $item_obj->setSuggestionStart($start->get(IL_CAL_UNIX));
504
505 $start->increment(IL_CAL_DAY, $data['duration_a']);
506 $item_obj->setSuggestionEnd($start->get(IL_CAL_UNIX));
507 }
508
509 $item_obj->update($ref_id);
510 }
511 if ($failed === []) {
512 // update course => create calendar entries
513 $this->course_obj->update();
514 $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'));
515 $this->manageTimings();
516 return true;
517 } else {
518 $this->main_tpl->setOnScreenMessage('failure', $this->lng->txt('err_check_input'));
519 $this->manageTimings($failed);
520 return true;
521 }
522 }
const IL_CAL_DAY
static parseIncomingDate($a_value, bool $a_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(), error(), 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 304 of file class.ilCourseContentGUI.php.

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

References ilObjectGUI\$data, $GLOBALS, ilObjectGUI\$ref_id, ilDateTime\_after(), ILIAS\Repository\access(), error(), 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 44 of file class.ilCourseContentGUI.php.

◆ $container_gui

ilContainerGUI ilCourseContentGUI::$container_gui
protected

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

◆ $container_obj

ilContainer ilCourseContentGUI::$container_obj
protected

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

Referenced by getContainerObject(), and initCourseObject().

◆ $course_obj

ilObjCourse ilCourseContentGUI::$course_obj
protected

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

◆ $ctrl

ilCtrlInterface ilCourseContentGUI::$ctrl
protected

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

◆ $error

ilErrorHandling ilCourseContentGUI::$error
protected

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

◆ $fav_manager

ilFavouritesManager ilCourseContentGUI::$fav_manager
protected

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

◆ $http

GlobalHttpState ilCourseContentGUI::$http
protected

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

◆ $lng

ilLanguage ilCourseContentGUI::$lng
protected

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

◆ $main_tpl

ilGlobalTemplateInterface ilCourseContentGUI::$main_tpl
protected

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

◆ $objectDataCache

ilObjectDataCache ilCourseContentGUI::$objectDataCache
protected

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

◆ $refinery

Factory ilCourseContentGUI::$refinery
protected

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

◆ $tabs

ilTabsGUI ilCourseContentGUI::$tabs
protected

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

◆ $tpl

ilGlobalTemplateInterface ilCourseContentGUI::$tpl
protected

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

◆ $tree

ilTree ilCourseContentGUI::$tree
protected

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

◆ $ui_factory

UIFactory ilCourseContentGUI::$ui_factory
protected

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

◆ $ui_renderer

UIRenderer ilCourseContentGUI::$ui_renderer
protected

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

◆ $user

ilObjUser ilCourseContentGUI::$user
protected

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


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