ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilCourseContentGUI Class Reference

Class ilCourseContentGUI. More...

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

Public Member Functions

 __construct ($container_gui_obj)
 Constructor public. More...
 
 executeCommand ()
 
 getContainerObject ()
 
 __getDefaultCommand ()
 
 __checkStartObjects ()
 
 showStartObjects ()
 
 view ()
 Output course content. More...
 
 getRightColumnHTML ()
 Display right column. More...
 
 setColumnSettings ($column_gui)
 
 __forwardToColumnGUI ()
 Get columngui output. More...
 
 editTimings ()
 
 editUserTimings ()
 
 returnToMembers ()
 
 showUserTimings ()
 
 __renderUserItem ($item, $level)
 
 __editAdvancedUserTimings ()
 
 __editUserTimings ()
 
 __renderItem ($item, $level)
 
 updateUserTimings ()
 
__loadFromPost (&$item)
 
 updateTimings ()
 
 __setSubTabs ()
 
 __initCourseObject ()
 
 __toUnix ($date, $time=array())
 
 __prepareDateSelect ($a_unix_time)
 
 __prepareTimeSelect ($a_unix_time)
 
 __buildPath ($a_ref_id)
 
- Public Member Functions inherited from ilObjectGUI
 executeCommand ()
 execute command More...
 
 withReferences ()
 determines wether objects are referenced or not (got ref ids or not) More...
 
 setCreationMode ($a_mode=true)
 if true, a creation screen is displayed the current $_GET[ref_id] don't belong to the current class! the mode is determined in ilrepositorygui More...
 
 getCreationMode ()
 get creation mode More...
 
 prepareOutput ($a_show_subobjects=true)
 prepare output More...
 
 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 public More...
 
 createObject ()
 create new object form More...
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 save object More...
 
 getDidacticTemplateVar ($a_type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $a_obj, $a_parent_node_id=null)
 Add object to tree at given position. More...
 
 editObject ()
 edit object More...
 
 addExternalEditFormCustom (ilPropertyFormGUI $a_form)
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction ($a_cmd, $a_formaction="")
 get form action for command (command is method name without "Object", e.g. More...
 
 isVisible ($a_ref_id, $a_type)
 
 viewObject ()
 viewObject container presentation for "administration -> repository, trash, permissions" More...
 
 deleteObject ($a_error=false)
 Display deletion confirmation screen. More...
 
 cloneAllObject ()
 Clone single (not container object) Method is overwritten in ilContainerGUI. More...
 
 redirectAfterCreation ()
 Redirect after creation, see https://docu.ilias.de/goto_docu_wiki_wpage_5035_1357.html. More...
 
 addToDeskObject ()
 
 removeFromDeskObject ()
 
- Public Member Functions inherited from ILIAS\Object\ImplementsCreationCallback
 callCreationCallback (\ilObject $object, \ilObjectDefinition $obj_definition, int $requested_crtcb)
 

Data Fields

 $container_gui
 
 $container_obj
 
 $course_obj
 
 $tpl
 
 $ctrl
 
 $lng
 
 $tabs_gui
 
- Data Fields inherited from ilObjectGUI
const ALLOWED_TAGS_IN_TITLE_AND_DESCRIPTION
 
const COPY_WIZARD_NEEDS_PAGE = 1
 
 $objDefinition
 
 $tpl
 
 $tree
 
 $lng
 
 $data
 
 $object
 
 $ref_id
 
 $obj_id
 
 $maxcount
 
 $formaction
 
 $return_location
 
 $target_frame
 
 $tab_target_script
 
 $actions
 
 $sub_objects
 
 $omit_locator = false
 
const CFORM_NEW = 1
 
const CFORM_IMPORT = 2
 
const CFORM_CLONE = 3
 

Protected Member Functions

 manageTimings ($failed_items=array())
 Manage timings type $ilAccess type $ilErr. More...
 
 managePersonalTimings ($failed=array())
 Manage personal timings. More...
 
 updatePersonalTimings ()
 Update personal timings type $ilAccess type $ilErr. More...
 
 updateManagedTimings ()
 
- Protected Member Functions inherited from ilObjectGUI
 getObjectService ()
 Get object service. More...
 
 assignObject ()
 
 setTitleAndDescription ()
 called by prepare output More...
 
 initHeaderAction ($a_sub_type=null, $a_sub_id=null)
 Add header action menu. More...
 
 insertHeaderAction ($a_list_gui)
 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 public More...
 
 setAdminTabs ()
 set admin tabs public More...
 
 setLocator ()
 set Locator More...
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 omitLocator ($a_omit=true)
 
 addAdminLocatorItems ($a_do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 initCreationForms ($a_new_type)
 Init creation froms. More...
 
 getCreationFormsHTML (array $a_forms)
 Get HTML for creation forms (accordion) More...
 
 initCreateForm ($a_new_type)
 Init object creation form. More...
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 Show didactic template types. More...
 
 addDidacticTemplateOptions (array &$a_options)
 Add custom templates. More...
 
 afterSave (ilObject $a_new_object)
 Post (successful) object creation hook. More...
 
 initEditForm ()
 Init object edit form. More...
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormValues ()
 Get values for edit form. More...
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 validateCustom (ilPropertyFormGUI $a_form)
 Validate custom values (if not possible with checkInput()) More...
 
 updateCustom (ilPropertyFormGUI $a_form)
 Insert custom update form values into object. More...
 
 afterUpdate ()
 Post (successful) object update hook. More...
 
 initImportForm ($a_new_type)
 Init object import form. More...
 
 importFileObject ($parent_id=null, $a_catch_errors=true)
 Import. More...
 
 afterImport (ilObject $a_new_object)
 Post (successful) object import hook. More...
 
 setFormAction ($a_cmd, $a_formaction)
 set specific form action for command More...
 
 getReturnLocation ($a_cmd, $a_location="")
 get return location for command (command is method name without "Object", e.g. More...
 
 setReturnLocation ($a_cmd, $a_location)
 set specific return location for command More...
 
 getTargetFrame ($a_cmd, $a_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame ($a_cmd, $a_target_frame)
 set specific target frame for command More...
 
 showPossibleSubObjects ()
 show possible subobjects (pulldown menu) More...
 
 getTemplateFile ($a_cmd, $a_type="")
 get a template blockfile format: tpl. More...
 
 getTabs ()
 get tabs abstract method. More...
 
 __showButton ($a_cmd, $a_text, $a_target='')
 
 hitsperpageObject ()
 
__initTableGUI ()
 
 __setTableGUIBasicData (&$tbl, &$result_set, $a_from="")
 standard implementation for tables use 'from' variable use different initial setting of table More...
 
 redirectToRefId ($a_ref_id, $a_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 $_GET["ref_id"] value More...
 
 fillCloneTemplate ($a_tpl_varname, $a_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...
 
 setColumnSettings (ilColumnGUI $column_gui)
 May be overwritten in subclasses. More...
 
 checkPermission ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission and redirect on error. More...
 
 checkPermissionBool ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission. More...
 
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files. More...
 
 handleAutoRating (ilObject $a_new_obj)
 Activate rating automatically if parent container setting. More...
 

Protected Attributes

 $fav_manager
 
- Protected Attributes inherited from ilObjectGUI
const UPLOAD_TYPE_LOCAL = 1
 
const UPLOAD_TYPE_UPLOAD_DIRECTORY = 2
 
 $ilErr
 
 $locator
 
 $user
 
 $access
 
 $rbacsystem
 
 $settings
 
 $rbacreview
 
 $toolbar
 
 $tmp_import_dir
 
 $tabs_gui = null
 
 $ctrl
 
 $object_service
 
 $favourites
 
 $request
 

Additional Inherited Members

- Static Public Member Functions inherited from ilObjectGUI
static _gotoRepositoryRoot ($a_raise_error=false)
 Goto repository root. More...
 
static _gotoRepositoryNode ($a_ref_id, $a_cmd="frameset")
 Goto repository root. More...
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilCourseContentGUI::__construct (   $container_gui_obj)

Constructor public.

Parameters
ilObjectGUI

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

References $DIC, $lng, $tpl, and __initCourseObject().

37  {
38  global $DIC;
39 
40  $tpl = $DIC['tpl'];
41  $ilCtrl = $DIC['ilCtrl'];
42  $lng = $DIC['lng'];
43  $ilObjDataCache = $DIC['ilObjDataCache'];
44  $ilTabs = $DIC['ilTabs'];
45 
46  $this->tpl = $tpl;
47  $this->ctrl = $ilCtrl;
48  $this->lng = $lng;
49  $this->lng->loadLanguageModule('crs');
50  $this->tabs_gui = $ilTabs;
51 
52  $this->container_gui = &$container_gui_obj;
53  $this->container_obj = &$this->container_gui->object;
54  $this->fav_manager = new ilFavouritesManager();
55 
56  $this->__initCourseObject();
57  }
Manages favourites, currently the interface for other components, needs discussion.
global $DIC
Definition: goto.php:24
+ Here is the call graph for this function:

Member Function Documentation

◆ __buildPath()

ilCourseContentGUI::__buildPath (   $a_ref_id)

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

References ilObjectGUI\$data, $DIC, and ilObjectGUI\$tree.

1339  {
1340  global $DIC;
1341 
1342  $tree = $DIC['tree'];
1343 
1344  $path_arr = $tree->getPathFull($a_ref_id, $this->course_obj->getRefId());
1345  $counter = 0;
1346  foreach ($path_arr as $data) {
1347  if ($counter++) {
1348  $path .= " -> ";
1349  }
1350  $path .= $data['title'];
1351  }
1352 
1353  return $path;
1354  }
global $DIC
Definition: goto.php:24

◆ __checkStartObjects()

ilCourseContentGUI::__checkStartObjects ( )

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

References $DIC, and $ilUser.

Referenced by executeCommand().

143  {
144  include_once './Modules/Course/classes/class.ilCourseStart.php';
145 
146  global $DIC;
147 
148  $ilAccess = $DIC['ilAccess'];
149  $ilUser = $DIC['ilUser'];
150 
151  if ($ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
152  return true;
153  }
154  $this->start_obj = new ilCourseStart($this->course_obj->getRefId(), $this->course_obj->getId());
155  if (count($this->start_obj->getStartObjects()) and !$this->start_obj->allFullfilled($ilUser->getId())) {
156  return false;
157  }
158  return true;
159  }
Class ilObj<module_name>
global $DIC
Definition: goto.php:24
$ilUser
Definition: imgupload.php:18
+ Here is the caller graph for this function:

◆ __editAdvancedUserTimings()

ilCourseContentGUI::__editAdvancedUserTimings ( )

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

References $_SESSION, __renderItem(), ilUtil\getImagePath(), and ilObjectActivation\getTimingsItems().

Referenced by editUserTimings().

871  {
872  $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.crs_usr_edit_timings_adv.html', 'Modules/Course');
873 
874  $this->tabs_gui->clearSubTabs();
875 
876  $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
877  $this->tpl->setVariable("HEADER_IMG", ilUtil::getImagePath('icon_crs.svg'));
878  $this->tpl->setVariable("HEADER_ALT", $this->lng->txt('obj_crs'));
879  $this->tpl->setVariable("BLOCK_HEADER_CONTENT", $this->lng->txt('timings_usr_edit'));
880 
881  if (!$_SESSION['crs_timings_user_hidden']) {
882  $this->tpl->setVariable("SHOW_HIDE_TEXT", $this->lng->txt('show_details'));
883  $this->ctrl->setParameter($this, 'show_details', 1);
884  $this->tpl->setVariable("SHOW_HIDE_LINK", $this->ctrl->getLinkTarget($this, 'editUserTimings'));
885  } else {
886  $this->tpl->setVariable("SHOW_HIDE_TEXT", $this->lng->txt('hide_details'));
887  $this->ctrl->setParameter($this, 'show_details', 0);
888  $this->tpl->setVariable("SHOW_HIDE_LINK", $this->ctrl->getLinkTarget($this, 'editUserTimings'));
889  }
890  $this->ctrl->clearParameters($this);
891  $this->tpl->setVariable("TXT_TITLE", $this->lng->txt('title'));
892  $this->tpl->setVariable("TXT_START_END", $this->lng->txt('crs_timings_short_start_end'));
893  $this->tpl->setVariable("TXT_INFO_START_END", $this->lng->txt('crs_timings_start_end_info'));
894 
895 
896  $this->tpl->setVariable("TXT_OWN_PRESETTING", $this->lng->txt('crs_timings_planed_start'));
897  $this->tpl->setVariable("TXT_INFO_OWN_PRESETTING", $this->lng->txt('crs_timings_start_end_info'));
898 
899  $this->tpl->setVariable("TXT_DURATION", $this->lng->txt('crs_timings_time_frame'));
900  $this->tpl->setVariable("TXT_INFO_DURATION", $this->lng->txt('crs_timings_in_days'));
901 
902  $this->tpl->setVariable("TXT_BTN_UPDATE", $this->lng->txt('save'));
903  $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt('cancel'));
904 
905  include_once 'Services/Object/classes/class.ilObjectActivation.php';
906  $sorted_items = ilObjectActivation::getTimingsItems($this->course_obj->getRefId());
907 
908  $this->counter = 0;
909  foreach ($sorted_items as $item) {
910  switch ($item['type']) {
911  case 'itgr':
912  break;
913 
914  default:
915  $this->__renderItem($item, 0);
916  break;
917  }
918  }
919  }
$_SESSION["AccountId"]
static getTimingsItems($a_container_ref_id)
Get (sub) item data for timings view (no session material, no side blocks)
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __editUserTimings()

ilCourseContentGUI::__editUserTimings ( )

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

References $_SESSION, __renderItem(), ilUtil\getImagePath(), and ilObjectActivation\getTimingsItems().

Referenced by editUserTimings().

922  {
923  $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.crs_usr_edit_timings.html', 'Modules/Course');
924 
925  $this->tabs_gui->clearSubTabs();
926 
927  $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
928  $this->tpl->setVariable("HEADER_IMG", ilUtil::getImagePath('icon_crs.svg'));
929  $this->tpl->setVariable("HEADER_ALT", $this->lng->txt('obj_crs'));
930 
931  if (!$_SESSION['crs_timings_user_hidden']) {
932  $this->tpl->setVariable("SHOW_HIDE_TEXT", $this->lng->txt('show_details'));
933  $this->ctrl->setParameter($this, 'show_details', 1);
934  $this->tpl->setVariable("SHOW_HIDE_LINK", $this->ctrl->getLinkTarget($this, 'editUserTimings'));
935  } else {
936  $this->tpl->setVariable("SHOW_HIDE_TEXT", $this->lng->txt('hide_details'));
937  $this->ctrl->setParameter($this, 'show_details', 0);
938  $this->tpl->setVariable("SHOW_HIDE_LINK", $this->ctrl->getLinkTarget($this, 'editUserTimings'));
939  }
940  $this->ctrl->clearParameters($this);
941 
942  $this->tpl->setVariable("BLOCK_HEADER_CONTENT", $this->lng->txt('timings_timings'));
943  $this->tpl->setVariable("TXT_TITLE", $this->lng->txt('title'));
944  $this->tpl->setVariable("TXT_START", $this->lng->txt('crs_timings_sug_begin'));
945  $this->tpl->setVariable("TXT_END", $this->lng->txt('crs_timings_sug_end'));
946 
947  include_once 'Services/Object/classes/class.ilObjectActivation.php';
948  $sorted_items = ilObjectActivation::getTimingsItems($this->course_obj->getRefId());
949 
950  $this->counter = 0;
951  foreach ($sorted_items as $item) {
952  switch ($item['type']) {
953  case 'itgr':
954  break;
955 
956  default:
957  $this->__renderItem($item, 0);
958  break;
959  }
960  }
961  }
$_SESSION["AccountId"]
static getTimingsItems($a_container_ref_id)
Get (sub) item data for timings view (no session material, no side blocks)
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __forwardToColumnGUI()

ilCourseContentGUI::__forwardToColumnGUI ( )

Get columngui output.

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

References $DIC, ilObjectGUI\$obj_id, ilObject\_lookupObjId(), ilObject\_lookupType(), ilColumnGUI\getCmdSide(), ilColumnGUI\getScreenMode(), IL_COL_LEFT, IL_COL_RIGHT, IL_SCREEN_SIDE, and setColumnSettings().

394  {
395  global $DIC;
396 
397  $ilCtrl = $DIC['ilCtrl'];
398  $ilAccess = $DIC['ilAccess'];
399 
400  include_once("Services/Block/classes/class.ilColumnGUI.php");
401 
402  $obj_id = ilObject::_lookupObjId($this->container_obj->getRefId());
403  $obj_type = ilObject::_lookupType($obj_id);
404 
405  if (!$ilCtrl->isAsynch()) {
406  //if ($column_gui->getScreenMode() != IL_SCREEN_SIDE)
408  // right column wants center
410  $column_gui = new ilColumnGUI($obj_type, IL_COL_RIGHT);
411  $this->setColumnSettings($column_gui);
412  $html = $ilCtrl->forwardCommand($column_gui);
413  }
414  // left column wants center
416  $column_gui = new ilColumnGUI($obj_type, IL_COL_LEFT);
417  $this->setColumnSettings($column_gui);
418  $html = $ilCtrl->forwardCommand($column_gui);
419  }
420  } else {
421  {
422  $this->getDefaultView();
423  }
424  }
425  }
426 
427  return $html;
428  }
static getCmdSide()
Get Column Side of Current Command.
const IL_COL_RIGHT
Column user interface class.
static _lookupObjId($a_id)
global $DIC
Definition: goto.php:24
static _lookupType($a_id, $a_reference=false)
lookup object type
static getScreenMode()
Get Screen Mode for current command.
const IL_SCREEN_SIDE
const IL_COL_LEFT
+ Here is the call graph for this function:

◆ __getDefaultCommand()

ilCourseContentGUI::__getDefaultCommand ( )

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

References $_SESSION, $DIC, and IL_CRS_VIEW_TIMING.

Referenced by executeCommand().

123  {
124  global $DIC;
125 
126  $ilAccess = $DIC['ilAccess'];
127 
128  // edit timings if panel is on
129  if ($_SESSION['crs_timings_panel'][$this->course_obj->getId()]) {
130  return 'manageTimings';
131  }
132  if ($ilAccess->checkAccess('write', '', $this->container_obj->getRefId())) {
133  return 'view';
134  }
135  if ($this->container_obj->getType() == 'crs' and
136  $this->course_obj->getViewMode() == IL_CRS_VIEW_TIMING) {
137  return 'editUserTimings';
138  }
139  return 'view';
140  }
$_SESSION["AccountId"]
const IL_CRS_VIEW_TIMING
global $DIC
Definition: goto.php:24
+ Here is the caller graph for this function:

◆ __initCourseObject()

ilCourseContentGUI::__initCourseObject ( )

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

References $container_obj, $DIC, ilObjectGUI\$tree, and ilObjectFactory\getInstanceByRefId().

Referenced by __construct().

1303  {
1304  global $DIC;
1305 
1306  $tree = $DIC['tree'];
1307 
1308  if ($this->container_obj->getType() == 'crs') {
1309  // Container is course
1310  $this->course_obj = &$this->container_obj;
1311  } else {
1312  $course_ref_id = $tree->checkForParentType($this->container_obj->getRefId(), 'crs');
1313  $this->course_obj = &ilObjectFactory::getInstanceByRefId($course_ref_id);
1314  }
1315  return true;
1316  }
global $DIC
Definition: goto.php:24
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __loadFromPost()

& ilCourseContentGUI::__loadFromPost ( $item)

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

References $_POST, ilObjectGUI\$obj_id, __toUnix(), and ilObjectActivation\TIMINGS_PRESETTING.

Referenced by editTimings().

1134  {
1135  $obj_id = $item['obj_id'];
1136 
1137  if (!isset($_POST['item'][$obj_id])) {
1138  return $item;
1139  }
1140  $item['suggestion_start'] = $this->__toUnix($_POST['item'][$obj_id]['sug_start']);
1141  if (isset($_POST['item'][$obj_id]['sug_end'])) {
1142  // #9325
1143  $item['suggestion_end'] = $this->__toUnix($_POST['item'][$obj_id]['sug_end']);
1144  }
1145  $item['changeable'] = $_POST['item'][$obj_id]['change'];
1146  $item['timing_type'] = $_POST['item'][$obj_id]['active'] ? ilObjectActivation::TIMINGS_PRESETTING : $item['timing_type'];
1147  $item['duration_a'] = $_POST['item'][$obj_id]['duration_a'];
1148  $item['duration_b'] = $_POST['item'][$obj_id]['duration_b'];
1149 
1150  return $item;
1151  }
__toUnix($date, $time=array())
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __prepareDateSelect()

ilCourseContentGUI::__prepareDateSelect (   $a_unix_time)

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

Referenced by __renderItem(), and editTimings().

1324  {
1325  return array('y' => date('Y', $a_unix_time),
1326  'm' => date('m', $a_unix_time),
1327  'd' => date('d', $a_unix_time));
1328  }
+ Here is the caller graph for this function:

◆ __prepareTimeSelect()

ilCourseContentGUI::__prepareTimeSelect (   $a_unix_time)

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

1331  {
1332  return array('h' => date('G', $a_unix_time),
1333  'm' => date('i', $a_unix_time),
1334  's' => date('s', $a_unix_time));
1335  }

◆ __renderItem()

ilCourseContentGUI::__renderItem (   $item,
  $level 
)

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

References $_POST, $_SESSION, $DIC, $i, $ilUser, __prepareDateSelect(), __toUnix(), ilSessionAppointment\_appointmentToString(), ilLink\_getLink(), ilMDEducational\_getTypicalLearningTimeSeconds(), ilSessionAppointment\_lookupAppointment(), ilObject\_lookupObjId(), ilDatePresentation\formatDate(), ilObjectActivation\getTimingsItems(), ilUtil\getTypeIconPath(), IL_CAL_UNIX, ilUtil\makeDateSelect(), ilDatePresentation\secondsToString(), ilUtil\switchColor(), and ilObjectActivation\TIMINGS_PRESETTING.

Referenced by __editAdvancedUserTimings(), and __editUserTimings().

964  {
965  global $DIC;
966 
967  $ilUser = $DIC['ilUser'];
968  $ilAccess = $DIC['ilAccess'];
969 
970  include_once 'Modules/Course/classes/Timings/class.ilTimingPlaned.php';
971  include_once './Services/Link/classes/class.ilLink.php';
972  include_once './Services/MetaData/classes/class.ilMDEducational.php';
973 
974  if (!$ilAccess->checkAccess('visible', '', $item['ref_id'])) {
975  return false;
976  }
977 
978  $this->lng->loadLanguageModule('meta');
979 
980  $usr_planed = new ilTimingPlaned($item['ref_id'], $ilUser->getId());
981 
982  for ($i = 0;$i < $level;$i++) {
983  $this->tpl->touchBlock('start_indent');
984  $this->tpl->touchBlock('end_indent');
985  }
986  if (strlen($item['description'])) {
987  $this->tpl->setCurrentBlock("item_description");
988  $this->tpl->setVariable("DESC", $item['description']);
989  $this->tpl->parseCurrentBlock();
990  }
991  if ($tlt = ilMDEducational::_getTypicalLearningTimeSeconds($item['obj_id'])) {
992  $this->tpl->setCurrentBlock("tlt");
993  $this->tpl->setVariable("TXT_TLT", $this->lng->txt('meta_typical_learning_time'));
994  $this->tpl->setVariable("TLT_VAL", ilDatePresentation::secondsToString($tlt));
995  $this->tpl->parseCurrentBlock();
996  }
997 
998  if (!$item['title'] &&
999  $item['type'] == 'sess') {
1000  include_once('./Modules/Session/classes/class.ilSessionAppointment.php');
1002  $item['title'] = ilSessionAppointment::_appointmentToString($app_info['start'], $app_info['end'], $app_info['fullday']);
1003  }
1004 
1005  if ($ilAccess->checkAccess('read', '', $item['ref_id'])) {
1006  $this->tpl->setCurrentBlock("title_as_link");
1007  $this->tpl->setVariable("TITLE_LINK", ilLink::_getLink($item['ref_id'], $item['type']));
1008  $this->tpl->setVariable("TITLE_NAME", $item['title']);
1009  $this->tpl->parseCurrentBlock();
1010  } else {
1011  $this->tpl->setCurrentBlock("title_plain");
1012  $this->tpl->setVariable("TITLE", $item['title']);
1013  $this->tpl->parseCurrentBlock();
1014  }
1015  $this->tpl->setCurrentBlock("container_standard_row");
1016 
1017  if (isset($this->invalid["$item[ref_id]"])) {
1018  $this->tpl->setVariable("ROWCLASS", 'tblrowmarked');
1019  } else {
1020  $this->tpl->setVariable("ROWCLASS", ilUtil::switchColor($this->counter++, 'tblrow1', 'tblrow2'));
1021  }
1022  #$this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_'.$item['type'].'.svg'));
1023  $this->tpl->setVariable('TYPE_IMG', ilUtil::getTypeIconPath($item['type'], $item['obj_id'], 'small'));
1024  $this->tpl->setVariable("TYPE_ALT_IMG", $this->lng->txt('obj_' . $item['type']));
1025 
1026 
1027  if ($item['timing_type'] == ilObjectActivation::TIMINGS_PRESETTING) {
1028  $this->tpl->setVariable('SUG_START', ilDatePresentation::formatDate(new ilDate($item['suggestion_start'], IL_CAL_UNIX)));
1029  $this->tpl->setVariable('SUG_END', ilDatePresentation::formatDate(new ilDate($item['suggestion_end'], IL_CAL_UNIX)));
1030  }
1031 
1032  if ($item['changeable']) {
1033  $item_prefix = "item[" . $item['ref_id'] . ']';
1034 
1035  if (is_array($_POST['item']["$item[ref_id]"]['own_start'])) {
1036  #echo "Start post<br>";
1037  $start = $this->__toUnix($_POST['item']["$item[ref_id]"]['own_start']);
1038  } elseif ($usr_planed->getPlanedStartingTime()) {
1039  #echo "Own start<br>";
1040  $start = $usr_planed->getPlanedStartingTime();
1041  } else {
1042  #echo "Empfehlung start<br>";
1043  $start = $item['suggestion_start'];
1044  }
1045 
1046  $date = $this->__prepareDateSelect($start);
1047  $this->tpl->setVariable(
1048  "OWN_START",
1050  $item_prefix . "[own_start]",
1051  $date['y'],
1052  $date['m'],
1053  $date['d'],
1054  date('Y', time()),
1055  false
1056  )
1057  );
1058 
1059  if ($usr_planed->getPlanedEndingTime()) {
1060  #echo "Own End<br>";
1061  $end = $usr_planed->getPlanedEndingTime();
1062  } else {
1063  #echo "Empfehlung end<br>";
1064  $end = $item['suggestion_end'];
1065  }
1066  $this->tpl->setVariable('OWN_END', ilDatePresentation::formatDate(new ilDate($end, IL_CAL_UNIX)));
1067  $this->tpl->setVariable("NAME_DURATION", $item_prefix . "[duration]");
1068 
1069  // Duration
1070  if (isset($_POST['item']["$item[ref_id]"]['duration'])) {
1071  $this->tpl->setVariable("VAL_DURATION", $_POST['item']["$item[ref_id]"]['duration']);
1072  } else {
1073  $this->tpl->setVariable("VAL_DURATION", intval(($end - $start) / (60 * 60 * 24)));
1074  }
1075  }
1076 
1077  $this->tpl->parseCurrentBlock();
1078 
1079  if (!$_SESSION['crs_timings_user_hidden']) {
1080  return true;
1081  }
1082 
1083  foreach (ilObjectActivation::getTimingsItems($item['ref_id']) as $item_data) {
1084  $this->__renderItem($item_data, $level + 1);
1085  }
1086  }
__toUnix($date, $time=array())
static _getTypicalLearningTimeSeconds($a_rbac_id, $a_obj_id=0)
$_SESSION["AccountId"]
class ilTimingPlaned
static getTimingsItems($a_container_ref_id)
Get (sub) item data for timings view (no session material, no side blocks)
const IL_CAL_UNIX
static getTypeIconPath($a_type, $a_obj_id, $a_size='small')
Get type icon path path Return image path for icon_xxx.pngs Or (if enabled) path to custom icon Depre...
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
static secondsToString($seconds, $force_with_seconds=false, $a_lng=null)
converts seconds to string: Long: 7 days 4 hour(s) ...
Class for single dates.
static _lookupObjId($a_id)
global $DIC
Definition: goto.php:24
static _appointmentToString($start, $end, $fulltime)
static makeDateSelect($prefix, $year="", $month="", $day="", $startyear="", $a_long_month=true, $a_further_options=array(), $emptyoption=false)
Creates a combination of HTML selects for date inputs.
static switchColor($a_num, $a_css1, $a_css2)
switches style sheets for each even $a_num (used for changing colors of different result rows) ...
static _lookupAppointment($a_obj_id)
lookup appointment
$ilUser
Definition: imgupload.php:18
$_POST["username"]
$i
Definition: metadata.php:24
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __renderUserItem()

ilCourseContentGUI::__renderUserItem (   $item,
  $level 
)

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

References $_GET, $i, ilSessionAppointment\_appointmentToString(), ilMDEducational\_getTypicalLearningTimeSeconds(), ilSessionAppointment\_lookupAppointment(), ilObject\_lookupObjId(), ilDatePresentation\formatDate(), ilUtil\getImagePath(), ilObjectActivation\getTimingsAdministrationItems(), ilUtil\getTypeIconPath(), ilObjectActivation\hasChangeableTimings(), IL_CAL_DATE, IL_CAL_UNIX, ilDatePresentation\secondsToString(), ilUtil\switchColor(), and ilObjectActivation\TIMINGS_PRESETTING.

Referenced by showUserTimings().

782  {
783  include_once 'Modules/Course/classes/Timings/class.ilTimingPlaned.php';
784  include_once './Services/MetaData/classes/class.ilMDEducational.php';
785 
786  $this->lng->loadLanguageModule('meta');
787 
788  include_once './Modules/Course/classes/Timings/class.ilTimingUser.php';
789  $usr_planed = new ilTimingUser($item['ref_id'], (int) $_GET['member_id']);
790 
791  for ($i = 0;$i < $level;$i++) {
792  $this->tpl->touchBlock('start_indent');
793  $this->tpl->touchBlock('end_indent');
794  }
795  if (strlen($item['description'])) {
796  $this->tpl->setCurrentBlock("item_description");
797  $this->tpl->setVariable("DESC", $item['description']);
798  $this->tpl->parseCurrentBlock();
799  }
800  if ($tlt = ilMDEducational::_getTypicalLearningTimeSeconds($item['obj_id'])) {
801  $this->tpl->setCurrentBlock("tlt");
802  $this->tpl->setVariable("TXT_TLT", $this->lng->txt('meta_typical_learning_time'));
803  $this->tpl->setVariable("TLT_VAL", ilDatePresentation::secondsToString($tlt));
804  $this->tpl->parseCurrentBlock();
805  }
806 
807  if (!$item['title'] &&
808  $item['type'] == 'sess') {
809  include_once('./Modules/Session/classes/class.ilSessionAppointment.php');
811  $item['title'] = ilSessionAppointment::_appointmentToString($app_info['start'], $app_info['end'], $app_info['fullday']);
812  }
813 
814  $this->tpl->setCurrentBlock("title_plain");
815  $this->tpl->setVariable("TITLE", $item['title']);
816  $this->tpl->parseCurrentBlock();
817 
818  $this->tpl->setCurrentBlock("container_standard_row");
819 
820  $this->tpl->setVariable("ROWCLASS", ilUtil::switchColor($this->counter++, 'tblrow1', 'tblrow2'));
821  #$this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_'.$item['type'].'.svg'));
822  $this->tpl->setVariable('TYPE_IMG', ilUtil::getTypeIconPath($item['type'], $item['obj_id'], 'tiny'));
823  $this->tpl->setVariable("TYPE_ALT_IMG", $this->lng->txt('obj_' . $item['type']));
824 
825  if ($item['timing_type'] == ilObjectActivation::TIMINGS_PRESETTING) {
826  if ($usr_planed->getStart()->get(IL_CAL_UNIX)) {
827  $this->tpl->setVariable('SUG_START', $usr_planed->getStart()->get(IL_CAL_DATE));
828  }
829  if ($usr_planed->getEnd()->get(IL_CAL_UNIX)) {
830  $this->tpl->setVariable('SUG_END', $usr_planed->getEnd()->get(IL_CAL_DATE));
831  }
832  }
833 
834 
835  if (0 and $item['changeable'] and $item['timing_type'] == ilObjectActivation::TIMINGS_PRESETTING) {
836  if ($usr_planed->getPlanedStartingTime()) {
837  $start = $usr_planed->getPlanedStartingTime();
838  } else {
839  $start = $item['suggestion_start'];
840  }
841  $this->tpl->setVariable('OWN_START', ilDatePresentation::formatDate(new ilDate($start, IL_CAL_UNIX)));
842 
843  if ($usr_planed->getPlanedEndingTime() and 0) {
844  $end = $usr_planed->getPlanedEndingTime();
845  } else {
846  $end = $item['suggestion_end'];
847  }
848  if ($start != $item['suggestion_start'] or $end != $item['suggestion_end']) {
849  $this->tpl->setVariable("OK_IMG", ilUtil::getImagePath('icon_ok.svg'));
850  $this->tpl->setVariable("OK_ALT", $this->lng->txt('crs_timings_changed'));
851  } else {
852  $this->tpl->setVariable("OK_IMG", ilUtil::getImagePath('icon_not_ok.svg'));
853  $this->tpl->setVariable("OK_ALT", $this->lng->txt('crs_timings_not_changed'));
854  }
855  $this->tpl->setVariable('OWN_END', ilDatePresentation::formatDate(new ilDate($end, IL_CAL_UNIX)));
856  }
857 
858  $this->tpl->parseCurrentBlock();
859 
860  foreach (ilObjectActivation::getTimingsAdministrationItems($item['ref_id']) as $item_data) {
861  if (($item_data['timing_type'] == ilObjectActivation::TIMINGS_PRESETTING) or
862  ilObjectActivation::hasChangeableTimings($item_data['ref_id'])) {
863  $this->__renderUserItem($item_data, $level + 1);
864  }
865  }
866  }
static _getTypicalLearningTimeSeconds($a_rbac_id, $a_obj_id=0)
$_GET["client_id"]
TableGUI class for timings administration.
const IL_CAL_UNIX
static getTypeIconPath($a_type, $a_obj_id, $a_size='small')
Get type icon path path Return image path for icon_xxx.pngs Or (if enabled) path to custom icon Depre...
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
static secondsToString($seconds, $force_with_seconds=false, $a_lng=null)
converts seconds to string: Long: 7 days 4 hour(s) ...
Class for single dates.
static getTimingsAdministrationItems($a_parent_id)
Get (sub) item data for timings administration view (active/inactive)
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static hasChangeableTimings($a_ref_id)
Check if there is any active changeable timing (in subtree)
static _lookupObjId($a_id)
static _appointmentToString($start, $end, $fulltime)
const IL_CAL_DATE
static switchColor($a_num, $a_css1, $a_css2)
switches style sheets for each even $a_num (used for changing colors of different result rows) ...
static _lookupAppointment($a_obj_id)
lookup appointment
$i
Definition: metadata.php:24
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __setSubTabs()

ilCourseContentGUI::__setSubTabs ( )

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

Referenced by executeCommand().

1296  {
1297  if ($this->container_obj->getType() == 'crs') {
1298  $this->container_gui->setContentSubTabs();
1299  }
1300  }
+ Here is the caller graph for this function:

◆ __toUnix()

ilCourseContentGUI::__toUnix (   $date,
  $time = array() 
)

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

Referenced by __loadFromPost(), __renderItem(), editTimings(), updateTimings(), and updateUserTimings().

1319  {
1320  return gmmktime($time['h'], $time['m'], 0, $date['m'], $date['d'], $date['y']);
1321  }
+ Here is the caller graph for this function:

◆ editTimings()

ilCourseContentGUI::editTimings ( )

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

References $_POST, $DIC, ilObjectGUI\$ilErr, __loadFromPost(), __prepareDateSelect(), __toUnix(), ilSessionAppointment\_appointmentToString(), ilFrameTargetInfo\_getFrame(), ilLink\_getLink(), ilMDEducational\_getTypicalLearningTimeSeconds(), ilSessionAppointment\_lookupAppointment(), ilObject\_lookupObjId(), ilDatePresentation\formatDate(), ilUtil\getImagePath(), ilObjectActivation\getTimingsAdministrationItems(), IL_CAL_UNIX, ilUtil\makeDateSelect(), ilDatePresentation\secondsToString(), ilUtil\switchColor(), and ilObjectActivation\TIMINGS_PRESETTING.

Referenced by updateTimings().

559  {
560  global $DIC;
561 
562  $ilAccess = $DIC['ilAccess'];
563  $ilErr = $DIC['ilErr'];
564 
565  $this->lng->loadLanguageModule('meta');
566 
567  if (!$ilAccess->checkAccess('write', '', $this->container_obj->getRefId())) {
568  $ilErr->raiseError($this->lng->txt('msg_no_perm_write'), $ilErr->WARNING);
569  }
570  $this->tabs_gui->setTabActive('timings_timings');
571  $this->tabs_gui->clearSubTabs();
572 
573  $this->cont_arr = ilObjectActivation::getTimingsAdministrationItems($this->container_obj->getRefId());
574 
575  $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.crs_edit_items.html', 'Modules/Course');
576  $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
577  $this->tpl->setVariable("HEADER_IMG", ilUtil::getImagePath('icon_crs.svg'));
578  $this->tpl->setVariable("HEADER_ALT", $this->lng->txt('crs_materials'));
579  $this->tpl->setVariable("BLOCK_HEADER_CONTENT", $this->lng->txt('edit_timings_list'));
580  $this->tpl->setVariable("TXT_TITLE", $this->lng->txt('title'));
581 
582 
583  $this->tpl->setVariable("TXT_DURATION", $this->lng->txt('crs_timings_time_frame'));
584  $this->tpl->setVariable("TXT_INFO_DURATION", $this->lng->txt('crs_timings_in_days'));
585 
586  $this->tpl->setVariable("TXT_START_END", $this->lng->txt('crs_timings_short_start_end'));
587  $this->tpl->setVariable("TXT_INFO_START_END", $this->lng->txt('crs_timings_start_end_info'));
588 
589  $this->tpl->setVariable("TXT_CHANGEABLE", $this->lng->txt('crs_timings_short_changeable'));
590 
591  $this->tpl->setVariable("TXT_INFO_LIMIT", $this->lng->txt('crs_timings_from_until'));
592  $this->tpl->setVariable("TXT_LIMIT", $this->lng->txt('crs_timings_short_limit_start_end'));
593  $this->tpl->setVariable("TXT_ACTIVE", $this->lng->txt('crs_timings_short_active'));
594  $this->tpl->setVariable("TXT_INFO_ACTIVE", $this->lng->txt('crs_timings_info_active'));
595 
596  $counter = 0;
597  foreach ($this->cont_arr as $item) {
598  if ($item['type'] == 'itgr') {
599  continue;
600  }
601  $item = $this->__loadFromPost($item);
602  $item_prefix = "item[$item[ref_id]]";
603  $item_change_prefix = "item_change[$item[ref_id]]";
604  $item_active_prefix = "item_active[$item[ref_id]]";
605 
606  if ($item['type'] == 'grp' or
607  $item['type'] == 'fold') {
608  $this->tpl->setVariable("TITLE_LINK", ilLink::_getLink($item['ref_id'], $item['type']));
609  $this->tpl->setVariable("TITLE_FRAME", ilFrameTargetInfo::_getFrame('MainContent', $item['type']));
610  $this->tpl->setVariable("TITLE_LINK_NAME", $item['title']);
611  } else {
612  if (!$item['title'] &&
613  $item['type'] == 'sess') {
614  include_once('./Modules/Session/classes/class.ilSessionAppointment.php');
616  $item['title'] = ilSessionAppointment::_appointmentToString($app_info['start'], $app_info['end'], $app_info['fullday']);
617  }
618 
619  $this->tpl->setVariable("TITLE", $item['title']);
620  }
621 
622  if (strlen($item['description'])) {
623  $this->tpl->setCurrentBlock("item_description");
624  $this->tpl->setVariable("DESC", $item['description']);
625  $this->tpl->parseCurrentBlock();
626  }
627 
628  if ($tlt = ilMDEducational::_getTypicalLearningTimeSeconds($item['obj_id'])) {
629  $this->tpl->setCurrentBlock("tlt");
630  $this->tpl->setVariable("TXT_TLT", $this->lng->txt('meta_typical_learning_time'));
631  $this->tpl->setVariable("TLT_VAL", ilDatePresentation::secondsToString($tlt));
632  $this->tpl->parseCurrentBlock();
633  }
634 
635  $this->tpl->setCurrentBlock("container_standard_row");
636 
637  // Suggested
638  if (is_array($_POST['item']["$item[ref_id]"]['sug_start'])) {
639  $start = $this->__toUnix($_POST['item']["$item[ref_id]"]['sug_start']);
640  } else {
641  $start = $item['suggestion_start'];
642  }
643  $end = $item['suggestion_end'];
644  $date = $this->__prepareDateSelect($start);
645  $this->tpl->setVariable(
646  "SUG_START",
648  $item_prefix . "[sug_start]",
649  $date['y'],
650  $date['m'],
651  $date['d'],
652  date('Y', time()),
653  false
654  )
655  );
656 
657  $this->tpl->setVariable("NAME_DURATION_A", $item_prefix . "[duration_a]");
658  if (isset($_POST['item']["$item[ref_id]"]['duration_a'])) {
659  $this->tpl->setVariable("VAL_DURATION_A", abs($_POST['item']["$item[ref_id]"]['duration_a']));
660  } else {
661  $this->tpl->setVariable("VAL_DURATION_A", intval(($end - $start) / (60 * 60 * 24)));
662  }
663 
664  $this->tpl->setVariable('SUG_END', ilDatePresentation::formatDate(new ilDate($item['suggestion_end'], IL_CAL_UNIX)));
665 
666 
667  $date = $this->__prepareDateSelect($end);
668  $this->tpl->setVariable(
669  "LIM_END",
671  $item_prefix . "[lim_end]",
672  $date['y'],
673  $date['m'],
674  $date['d'],
675  date('Y', time()),
676  false
677  )
678  );
679 
680  $this->tpl->setVariable("NAME_CHANGE", $item_change_prefix . "[change]");
681  $this->tpl->setVariable("NAME_ACTIVE", $item_active_prefix . "[active]");
682 
683  if (isset($_POST['item'])) {
684  $change = $_POST['item_change']["$item[ref_id]"]['change'];
685  $active = $_POST['item_active']["$item[ref_id]"]['active'];
686  } else {
687  $change = $item['changeable'];
688  $active = ($item['timing_type'] == ilObjectActivation::TIMINGS_PRESETTING);
689  }
690 
691  $this->tpl->setVariable("CHECKED_ACTIVE", $active ? 'checked="checked"' : '');
692  $this->tpl->setVariable("CHECKED_CHANGE", $change ? 'checked="checked"' : '');
693 
694  if (isset($this->failed["$item[ref_id]"])) {
695  $this->tpl->setVariable("ROWCLASS", 'tblrowmarked');
696  } else {
697  $this->tpl->setVariable("ROWCLASS", ilUtil::switchColor($counter++, 'tblrow1', 'tblrow2'));
698  }
699  $this->tpl->parseCurrentBlock();
700  }
701 
702  // Select all
703  $this->tpl->setVariable("CHECKCLASS", ilUtil::switchColor($counter++, 'tblrow1', 'tblrow2'));
704  $this->tpl->setVariable("SELECT_ALL", $this->lng->txt('select_all'));
705 
706  $this->tpl->setVariable("BTN_SAVE", $this->lng->txt('save'));
707  $this->tpl->setVariable("BTN_CANCEL", $this->lng->txt('cancel'));
708  }
__toUnix($date, $time=array())
static _getTypicalLearningTimeSeconds($a_rbac_id, $a_obj_id=0)
const IL_CAL_UNIX
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
static secondsToString($seconds, $force_with_seconds=false, $a_lng=null)
converts seconds to string: Long: 7 days 4 hour(s) ...
Class for single dates.
static getTimingsAdministrationItems($a_parent_id)
Get (sub) item data for timings administration view (active/inactive)
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static _lookupObjId($a_id)
global $DIC
Definition: goto.php:24
static _appointmentToString($start, $end, $fulltime)
static makeDateSelect($prefix, $year="", $month="", $day="", $startyear="", $a_long_month=true, $a_further_options=array(), $emptyoption=false)
Creates a combination of HTML selects for date inputs.
static _getFrame($a_class, $a_type='')
Get content frame name.
static switchColor($a_num, $a_css1, $a_css2)
switches style sheets for each even $a_num (used for changing colors of different result rows) ...
static _lookupAppointment($a_obj_id)
lookup appointment
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editUserTimings()

ilCourseContentGUI::editUserTimings ( )

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

References $_GET, $_SESSION, $DIC, ilObjectGUI\$ilErr, __editAdvancedUserTimings(), __editUserTimings(), and ilObjectActivation\hasChangeableTimings().

Referenced by updateUserTimings().

711  {
712  global $DIC;
713 
714  $ilAccess = $DIC['ilAccess'];
715  $ilErr = $DIC['ilErr'];
716 
717  if (!$ilAccess->checkAccess('read', '', $this->container_obj->getRefId())) {
718  $ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $ilErr->WARNING);
719  }
720  $this->tabs_gui->clearSubTabs();
721  $this->tabs_gui->setTabActive('timings_timings');
722 
723  $_SESSION['crs_timings_user_hidden'] = isset($_GET['show_details']) ? $_GET['show_details'] : $_SESSION['crs_timings_user_hidden'];
724 
725  include_once 'Services/Object/classes/class.ilObjectActivation.php';
726  if (ilObjectActivation::hasChangeableTimings($this->course_obj->getRefId())) {
727  $this->__editAdvancedUserTimings();
728  } else {
729  $this->__editUserTimings();
730  }
731  }
$_SESSION["AccountId"]
$_GET["client_id"]
static hasChangeableTimings($a_ref_id)
Check if there is any active changeable timing (in subtree)
global $DIC
Definition: goto.php:24
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilCourseContentGUI::executeCommand ( )

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

References $_GET, $DIC, ilObjectGUI\$ilErr, __checkStartObjects(), __getDefaultCommand(), __setSubTabs(), showStartObjects(), and view().

60  {
61  global $DIC;
62 
63  $ilAccess = $DIC['ilAccess'];
64  $ilErr = $DIC['ilErr'];
65  $ilTabs = $DIC['ilTabs'];
66  $ilCtrl = $DIC['ilCtrl'];
67 
68  if (!$ilAccess->checkAccess('read', '', $this->container_obj->getRefId())) {
69  $ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $ilErr->WARNING);
70  }
71 
72 
73  $this->__setSubTabs();
74  $this->tabs_gui->setTabActive('view_content');
75  $cmd = $this->ctrl->getCmd();
76 
77  switch ($this->ctrl->getNextClass($this)) {
78  case 'ilcoursearchivesgui':
79  $this->__forwardToArchivesGUI();
80  break;
81 
82  case "ilcolumngui":
83  $ilCtrl->saveParameterByClass("ilcolumngui", "col_return");
84  $ilTabs->setSubTabActive("crs_content");
85  $this->view();
86  break;
87 
88  default:
89  if (!$this->__checkStartObjects()) {
90  $this->showStartObjects();
91  break;
92  }
93 
94  // forward to objective presentation
95  if ((!$this->is_tutor and
96  $this->container_obj->getType() == 'crs' and
97  $this->container_obj->enabledObjectiveView()) ||
98  $_GET["col_return"] == "objectives") {
99  $this->use_objective_presentation = true;
100  $this->view();
101  //$this->__forwardToObjectivePresentation();
102  break;
103  }
104 
105 
106  if (!$cmd) {
107  $cmd = $this->__getDefaultCommand();
108  }
109  $this->$cmd();
110  break;
111  }
112  }
view()
Output course content.
$_GET["client_id"]
global $DIC
Definition: goto.php:24
+ Here is the call graph for this function:

◆ getContainerObject()

ilCourseContentGUI::getContainerObject ( )
Returns
ilObject

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

References $container_obj.

Referenced by managePersonalTimings(), and manageTimings().

118  {
119  return $this->container_obj;
120  }
+ Here is the caller graph for this function:

◆ getRightColumnHTML()

ilCourseContentGUI::getRightColumnHTML ( )

Display right column.

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

References $DIC, $ilUser, $lng, ilObjectGUI\$obj_id, ilObject\_lookupObjId(), ilObject\_lookupType(), IL_COL_RIGHT, IL_SCREEN_FULL, IL_SCREEN_SIDE, and setColumnSettings().

Referenced by view().

315  {
316  global $DIC;
317 
318  $ilUser = $DIC['ilUser'];
319  $lng = $DIC['lng'];
320  $ilCtrl = $DIC['ilCtrl'];
321  $ilAccess = $DIC['ilAccess'];
322 
323  $ilCtrl->saveParameterByClass("ilcolumngui", "col_return");
324 
325  $obj_id = ilObject::_lookupObjId($this->container_obj->getRefId());
326  $obj_type = ilObject::_lookupType($obj_id);
327 
328  include_once("Services/Block/classes/class.ilColumnGUI.php");
329  $column_gui = new ilColumnGUI($obj_type, IL_COL_RIGHT);
330 
331  if ($column_gui->getScreenMode() == IL_SCREEN_FULL) {
332  return "";
333  }
334 
335  $this->setColumnSettings($column_gui);
336 
337  if ($ilCtrl->getNextClass() == "ilcolumngui" &&
338  $column_gui->getCmdSide() == IL_COL_RIGHT &&
339  $column_gui->getScreenMode() == IL_SCREEN_SIDE) {
340  $html = $ilCtrl->forwardCommand($column_gui);
341  } else {
342  if (!$ilCtrl->isAsynch()) {
343  $html = $ilCtrl->getHTML($column_gui);
344  }
345  }
346 
347  return $html;
348  }
const IL_COL_RIGHT
const IL_SCREEN_FULL
Column user interface class.
static _lookupObjId($a_id)
global $DIC
Definition: goto.php:24
static _lookupType($a_id, $a_reference=false)
lookup object type
$ilUser
Definition: imgupload.php:18
const IL_SCREEN_SIDE
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ managePersonalTimings()

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

Manage personal timings.

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

References $failed, $GLOBALS, ilObjectGUI\$ilErr, getContainerObject(), and ilObjectActivation\getItems().

Referenced by updatePersonalTimings().

471  {
472  global $ilErr, $ilAccess;
473 
474  if (!$ilAccess->checkAccess('read', '', $this->container_obj->getRefId())) {
475  $ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $ilErr->WARNING);
476  }
477  $GLOBALS['ilTabs']->setTabActive('timings_timings');
478  $GLOBALS['ilTabs']->clearSubTabs();
479 
480  include_once './Modules/Course/classes/Timings/class.ilTimingsPersonalTableGUI.php';
481  $table = new ilTimingsPersonalTableGUI(
482  $this,
483  'managePersonalTimings',
484  $this->getContainerObject(),
485  $this->course_obj
486  );
487  $table->setFailureStatus(count($failed));
488  $table->setUserId($GLOBALS['ilUser']->getId());
489  $table->init();
490  $table->parse(
492  $this->getContainerObject()->getRefId(),
493  false
494  ),
495  $failed
496  );
497  $GLOBALS['tpl']->setContent($table->getHTML());
498  }
static getItems($a_parent_id, $a_with_list_data=true)
Get sub item data.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
$failed
Definition: Utf8Test.php:85
TableGUI class for editing personal timings.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ manageTimings()

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

Manage timings type $ilAccess type $ilErr.

Parameters
type$failed_items

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

References $DIC, $GLOBALS, ilObjectGUI\$ilErr, getContainerObject(), and ilObjectActivation\getTimingsAdministrationItems().

Referenced by updateManagedTimings().

438  {
439  global $DIC;
440 
441  $ilAccess = $DIC->access();
442  $ilErr = $DIC['ilErr'];
443  $mainTemplate = $DIC->ui()->mainTemplate();
444 
445  if (!$ilAccess->checkAccess('write', '', $this->container_obj->getRefId())) {
446  $ilErr->raiseError($this->lng->txt('msg_no_perm_write'), $ilErr->WARNING);
447  }
448  $GLOBALS['DIC']['ilTabs']->setTabActive('timings_timings');
449  $GLOBALS['DIC']['ilTabs']->clearSubTabs();
450 
451  $table = new ilTimingsManageTableGUI(
452  $this,
453  'manageTimings',
454  $this->getContainerObject(),
455  $this->course_obj
456  );
457  if (count($failed_items)) {
458  $table->setFailureStatus(true);
459  }
460  $table->init();
461  $table->parse(ilObjectActivation::getTimingsAdministrationItems($this->getContainerObject()->getRefId()), $failed_items);
462 
463 
464  $mainTemplate->setContent($table->getHTML());
465  }
static getTimingsAdministrationItems($a_parent_id)
Get (sub) item data for timings administration view (active/inactive)
global $DIC
Definition: goto.php:24
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
TableGUI class for timings administration.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ returnToMembers()

ilCourseContentGUI::returnToMembers ( )

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

734  {
735  $this->ctrl->returnToParent($this);
736  }

◆ setColumnSettings()

ilCourseContentGUI::setColumnSettings (   $column_gui)

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

References $DIC, $lng, and ilObjectActivation\getItems().

Referenced by __forwardToColumnGUI(), and getRightColumnHTML().

351  {
352  global $DIC;
353 
354  $ilAccess = $DIC['ilAccess'];
355  $lng = $DIC['lng'];
356 
357  $column_gui->setRepositoryMode(true);
358  $column_gui->setEnableEdit(false);
359  $column_gui->setBlockProperty(
360  "news",
361  "title",
362  $lng->txt("crs_news")
363  );
364 
365  include_once "Services/Object/classes/class.ilObjectActivation.php";
366  $grouped_items = array();
367  foreach (ilObjectActivation::getItems($this->container_obj->getRefId()) as $item) {
368  $grouped_items[$item["type"]][] = $item;
369  }
370 
371  $column_gui->setRepositoryItems($grouped_items);
372  if ($ilAccess->checkAccess("write", "", $this->container_obj->getRefId())) {
373  $column_gui->setEnableEdit(true);
374  }
375 
376  // Configure Settings, if administration panel is on
377  if ($this->is_tutor) {
378  $column_gui->setBlockProperty("news", "settings", true);
379  //$column_gui->setBlockProperty("news", "public_notifications_option", true);
380  $column_gui->setBlockProperty("news", "default_visibility_option", true);
381  $column_gui->setBlockProperty("news", "hide_news_block_option", true);
382  }
383 
384  if ($this->container_gui->isActiveAdministrationPanel()) {
385  $column_gui->setAdminCommands(true);
386  }
387  }
static getItems($a_parent_id, $a_with_list_data=true)
Get sub item data.
global $DIC
Definition: goto.php:24
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showStartObjects()

ilCourseContentGUI::showStartObjects ( )

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

References $DIC, $ilUser, ilObjectGUI\$obj_id, ilObjectGUI\$rbacsystem, ilObjectGUI\$ref_id, $type, ilConditionHandler\_checkAllConditionsOfTarget(), ilLink\_getLink(), ilRepositoryExplorer\buildFrameTarget(), ilUtil\getImagePath(), and ilCourseLMHistory\getLMHistory().

Referenced by executeCommand().

162  {
163  include_once './Modules/Course/classes/class.ilCourseLMHistory.php';
164  include_once './Services/Repository/classes/class.ilRepositoryExplorer.php';
165  include_once './Services/Link/classes/class.ilLink.php';
166 
167  global $DIC;
168 
169  $rbacsystem = $DIC['rbacsystem'];
170  $ilias = $DIC['ilias'];
171  $ilUser = $DIC['ilUser'];
172  $ilAccess = $DIC['ilAccess'];
173  $ilObjDataCache = $DIC['ilObjDataCache'];
174 
175  $this->tabs_gui->setSubTabActive('crs_content');
176 
177  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.crs_start_view.html", 'Modules/Course');
178  $this->tpl->setVariable("INFO_STRING", $this->lng->txt('crs_info_start'));
179  $this->tpl->setVariable("TBL_TITLE_START", $this->lng->txt('crs_table_start_objects'));
180  $this->tpl->setVariable("HEADER_NR", $this->lng->txt('crs_nr'));
181  $this->tpl->setVariable("HEADER_DESC", $this->lng->txt('description'));
182  $this->tpl->setVariable("HEADER_EDITED", $this->lng->txt('crs_objective_accomplished'));
183 
184 
185  $lm_continue = new ilCourseLMHistory($this->course_obj->getRefId(), $ilUser->getId());
186  $continue_data = $lm_continue->getLMHistory();
187 
188  $counter = 0;
189  foreach ($this->start_obj->getStartObjects() as $start) {
190  $obj_id = $ilObjDataCache->lookupObjId($start['item_ref_id']);
191  $ref_id = $start['item_ref_id'];
192  $type = $ilObjDataCache->lookupType($obj_id);
193 
195 
196  $obj_link = ilLink::_getLink($ref_id, $type);
198  $obj_frame = $obj_frame ? $obj_frame : '';
199 
200  // Tmp fix for tests
201  $obj_frame = $type == 'tst' ? '' : $obj_frame;
202 
203  $contentObj = false;
204 
205  if ($ilAccess->checkAccess('read', '', $ref_id)) {
206  $this->tpl->setCurrentBlock("start_read");
207  $this->tpl->setVariable("READ_TITLE_START", $ilObjDataCache->lookupTitle($obj_id));
208  $this->tpl->setVariable("READ_TARGET_START", $obj_frame);
209  $this->tpl->setVariable("READ_LINK_START", $obj_link . '&crs_show_result=' . $this->course_obj->getRefId());
210  $this->tpl->parseCurrentBlock();
211  } else {
212  $this->tpl->setCurrentBlock("start_visible");
213  $this->tpl->setVariable("VISIBLE_LINK_START", $ilObjDataCache->lookupTitle($obj_id));
214  $this->tpl->parseCurrentBlock();
215  }
216 
217  // CONTINUE LINK
218  if (isset($continue_data[$ref_id])) {
219  $this->tpl->setCurrentBlock("link");
220  $this->tpl->setVariable("LINK_HREF", ilLink::_getLink($ref_id, '', array('obj_id',
221  $continue_data[$ref_id]['lm_page_id'])));
222  #$this->tpl->setVariable("CONTINUE_LINK_TARGET",$target);
223  $this->tpl->setVariable("LINK_NAME", $this->lng->txt('continue_work'));
224  $this->tpl->parseCurrentBlock();
225  }
226 
227  // add to desktop link
228  if ($this->course_obj->getAboStatus()) {
229  if (!$this->fav_manager->ifIsFavourite($ilUser->getId(), $ref_id)) {
230  if ($ilAccess->checkAccess('read', '', $ref_id)) {
231  $this->tpl->setCurrentBlock("link");
232  $this->ctrl->setParameterByClass(get_class($this->container_gui), 'item_ref_id', $ref_id);
233  $this->ctrl->setParameterByClass(get_class($this->container_gui), 'item_id', $ref_id);
234  $this->ctrl->setParameterByClass(get_class($this->container_gui), 'type', $type);
235 
236  $this->tpl->setVariable(
237  "LINK_HREF",
238  $this->ctrl->getLinkTarget($this->container_gui, 'addToDesk')
239  );
240  $this->tpl->setVariable("LINK_NAME", $this->lng->txt("rep_add_to_favourites"));
241  $this->tpl->parseCurrentBlock();
242  }
243  } else {
244  $this->tpl->setCurrentBlock("link");
245  $this->ctrl->setParameterByClass(get_class($this->container_gui), 'item_ref_id', $ref_id);
246  $this->ctrl->setParameterByClass(get_class($this->container_gui), 'item_id', $ref_id);
247  $this->ctrl->setParameterByClass(get_class($this->container_gui), 'type', $type);
248 
249  $this->tpl->setVariable(
250  "LINK_HREF",
251  $this->ctrl->getLinkTarget($this->container_gui, 'removeFromDesk')
252  );
253  $this->tpl->setVariable("LINK_NAME", $this->lng->txt("rep_remove_from_favourites"));
254  $this->tpl->parseCurrentBlock();
255  }
256  }
257 
258 
259  // Description
260  if (strlen($ilObjDataCache->lookupDescription($obj_id))) {
261  $this->tpl->setCurrentBlock("start_description");
262  $this->tpl->setVariable("DESCRIPTION_START", $ilObjDataCache->lookupDescription($obj_id));
263  $this->tpl->parseCurrentBlock();
264  }
265 
266 
267  if ($this->start_obj->isFullfilled($ilUser->getId(), $ref_id)) {
268  $accomplished = 'accomplished';
269  $icon = ilUtil::getImagePath("icon_ok.svg");
270  } else {
271  $accomplished = 'not_accomplished';
272  $icon = ilUtil::getImagePath("icon_not_ok.svg");
273  }
274  $this->tpl->setCurrentBlock("start_row");
275  $this->tpl->setVariable("EDITED_IMG", $icon);
276  $this->tpl->setVariable("EDITED_ALT", $this->lng->txt('crs_objective_' . $accomplished));
277  $this->tpl->setVariable("ROW_CLASS", 'option_value');
278  $this->tpl->setVariable("ROW_CLASS_CENTER", 'option_value_center');
279  $this->tpl->setVariable("OBJ_NR_START", ++$counter . '.');
280  $this->tpl->parseCurrentBlock();
281  }
282  return true;
283  }
$type
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
global $DIC
Definition: goto.php:24
static _checkAllConditionsOfTarget($a_target_ref_id, $a_target_id, $a_target_type="", $a_usr_id=0)
checks wether all conditions of a target object are fulfilled
buildFrameTarget($a_type, $a_child=0, $a_obj_id=0)
STATIC, do not use $this inside!
$ilUser
Definition: imgupload.php:18
class ilCourseLMHistory
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showUserTimings()

ilCourseContentGUI::showUserTimings ( )

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

References $_GET, $name, __renderUserItem(), ilObjUser\_lookupName(), ilUtil\getImagePath(), ilObjectActivation\getTimingsAdministrationItems(), ilObjectActivation\hasChangeableTimings(), ilUtil\sendFailure(), and ilObjectActivation\TIMINGS_PRESETTING.

739  {
740  $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.crs_user_timings.html', 'Modules/Course');
741  $this->tabs_gui->clearSubTabs();
742  $this->tabs_gui->setTabActive('members');
743 
744  if (!$_GET['member_id']) {
745  ilUtil::sendFailure($this->lng->txt('no_checkbox'), true);
746  $this->ctrl->returnToParent($this);
747  }
748 
749 
750  // Back button
751  $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
752  $this->tpl->setCurrentBlock("btn_cell");
753  $this->tpl->setVariable("BTN_LINK", $this->ctrl->getLinkTarget($this, 'returnToMembers'));
754  $this->tpl->setVariable("BTN_TXT", $this->lng->txt("back"));
755  $this->tpl->parseCurrentBlock();
756 
757 
758  $this->tpl->setVariable("HEADER_IMG", ilUtil::getImagePath('icon_usr.svg'));
759  $this->tpl->setVariable("HEADER_ALT", $this->lng->txt('obj_usr'));
760  $this->tpl->setVariable("TABLE_HEADER", $this->lng->txt('timings_of'));
761  $name = ilObjUser::_lookupName($_GET['member_id']);
762  $this->tpl->setVariable("USER_NAME", $name['lastname'] . ', ' . $name['firstname']);
763 
764  $this->tpl->setVariable("TXT_TITLE", $this->lng->txt('title'));
765  $this->tpl->setVariable("TXT_START_END", $this->lng->txt('crs_timings_short_start_end'));
766  $this->tpl->setVariable("TXT_INFO_START_END", $this->lng->txt('crs_timings_start_end_info'));
767  $this->tpl->setVariable("TXT_CHANGED", $this->lng->txt('crs_timings_changed'));
768  $this->tpl->setVariable("TXT_OWN_PRESETTING", $this->lng->txt('crs_timings_planed_start'));
769  $this->tpl->setVariable("TXT_INFO_OWN_PRESETTING", $this->lng->txt('crs_timings_from_until'));
770 
771  include_once 'Services/Object/classes/class.ilObjectActivation.php';
772  $items = ilObjectActivation::getTimingsAdministrationItems($this->course_obj->getRefId());
773  foreach ($items as $item) {
774  if (($item['timing_type'] == ilObjectActivation::TIMINGS_PRESETTING) or
775  ilObjectActivation::hasChangeableTimings($item['ref_id'])) {
776  $this->__renderUserItem($item, 0);
777  }
778  }
779  }
static _lookupName($a_user_id)
lookup user name
$_GET["client_id"]
if($format !==null) $name
Definition: metadata.php:230
static getTimingsAdministrationItems($a_parent_id)
Get (sub) item data for timings administration view (active/inactive)
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static hasChangeableTimings($a_ref_id)
Check if there is any active changeable timing (in subtree)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ updateManagedTimings()

ilCourseContentGUI::updateManagedTimings ( )
protected
Returns
bool
Exceptions
ilDateTimeException

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

References $_POST, ilObjectGUI\$data, $DIC, $failed, ilObjectGUI\$ilErr, ilObjectGUI\$ref_id, ilDateTime\_after(), IL_CAL_DAY, IL_CAL_UNIX, ilCourseConstants\IL_CRS_VIEW_TIMING_ABSOLUTE, manageTimings(), ilCalendarUtil\parseIncomingDate(), ilUtil\sendFailure(), ilObjectActivation\TIMINGS_DEACTIVATED, and ilObjectActivation\TIMINGS_PRESETTING.

1158  {
1159  global $DIC;
1160 
1161  $ilAccess = $DIC->access();
1162  $ilErr = $DIC['ilErr'];
1163 
1164  if (!$ilAccess->checkAccess('write', '', $this->container_obj->getRefId())) {
1165  $ilErr->raiseError($this->lng->txt('msg_no_perm_write'), $ilErr->WARNING);
1166  }
1167 
1168  $this->tabs_gui->clearSubTabs();
1169 
1170  $failed = array();
1171  $all_items = array();
1172  include_once './Services/Calendar/classes/class.ilCalendarUtil.php';
1173  foreach ((array) $_POST['item'] as $ref_id => $data) {
1174  $item_obj = new ilObjectActivation();
1175  $item_obj->read($ref_id);
1176 
1178  #$item_obj->setTimingStart($old_data['timing_start']);
1179  #$item_obj->setTimingEnd($old_data['timing_end']);
1180  #$item_obj->toggleVisible($old_data['visible']);
1181  $item_obj->toggleChangeable((int) $data['change']);
1182 
1183  if ($this->course_obj->getTimingMode() == ilCourseConstants::IL_CRS_VIEW_TIMING_ABSOLUTE) {
1184  $sug_start_dt = ilCalendarUtil::parseIncomingDate($data['sug_start']);
1185  $sug_end_dt = ilCalendarUtil::parseIncomingDate($data['sug_end']);
1186 
1187 
1188  if (($sug_start_dt instanceof ilDate) and ($sug_end_dt instanceof ilDate)) {
1189  include_once './Services/Calendar/classes/class.ilDateTime.php';
1190  if (ilDateTime::_after($sug_start_dt, $sug_end_dt)) {
1191  $failed[$ref_id] = 'crs_timing_err_start_end';
1192  continue;
1193  }
1194  $item_obj->setSuggestionStart($sug_start_dt->get(IL_CAL_UNIX));
1195  $item_obj->setSuggestionEnd($sug_end_dt->get(IL_CAL_UNIX));
1196  } else {
1197  $failed['ref_id'] = 'crs_timing_err_valid_dates';
1198  continue;
1199  }
1200  } else {
1201  if (
1202  ((int) $data['sug_start_rel'] < 0) or
1203  ((int) $data['duration_a'] < 0)
1204  ) {
1205  $failed[$ref_id] = 'crs_timing_err_start_dur_rel';
1206  continue;
1207  }
1208  $item_obj->setSuggestionStartRelative($data['sug_start_rel']);
1209  $item_obj->setSuggestionEndRelative($data['sug_start_rel'] + $data['duration_a']);
1210 
1211  // add default values for start/end (relative to now)
1212  $start = new ilDate(time(), IL_CAL_UNIX);
1213  $start->increment(IL_CAL_DAY, $data['sug_start_rel']);
1214  $item_obj->setSuggestionStart($start->get(IL_CAL_UNIX));
1215 
1216  $start->increment(IL_CAL_DAY, $data['duration_a']);
1217  $item_obj->setSuggestionEnd($start->get(IL_CAL_UNIX));
1218  }
1219 
1220  $item_obj->update($ref_id);
1221  }
1222  if (!$failed) {
1223  // update course => create calendar entries
1224  $this->course_obj->update();
1225 
1226  ilUtil::sendSuccess($this->lng->txt('settings_saved'));
1227  $this->manageTimings();
1228 
1229  return true;
1230  } else {
1231  ilUtil::sendFailure($this->lng->txt('err_check_input'));
1232  $this->manageTimings($failed);
1233  return true;
1234  }
1235  }
static _after(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
compare two dates and check start is after end This method does not consider tz offsets.
const IL_CAL_UNIX
const IL_CAL_DAY
Class for single dates.
global $DIC
Definition: goto.php:24
manageTimings($failed_items=array())
Manage timings type $ilAccess type $ilErr.
$failed
Definition: Utf8Test.php:85
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Class ilObjectActivation.
$_POST["username"]
static parseIncomingDate($a_value, $a_add_time=null)
Try to parse incoming value to date object.
+ Here is the call graph for this function:

◆ updatePersonalTimings()

ilCourseContentGUI::updatePersonalTimings ( )
protected

Update personal timings type $ilAccess type $ilErr.

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

References $_POST, ilObjectGUI\$data, $failed, $GLOBALS, ilObjectGUI\$ilErr, ilObjectGUI\$ref_id, ilDateTime\_after(), IL_CAL_UNIX, managePersonalTimings(), ilCalendarUtil\parseIncomingDate(), and ilUtil\sendFailure().

507  {
508  global $ilAccess,$ilErr;
509 
510  if (!$ilAccess->checkAccess('read', '', $this->container_obj->getRefId())) {
511  $ilErr->raiseError($this->lng->txt('msg_no_perm_write'), $ilErr->WARNING);
512  }
513 
514  $this->tabs_gui->clearSubTabs();
515 
516  $failed = array();
517  include_once './Services/Calendar/classes/class.ilCalendarUtil.php';
518  foreach ((array) $_POST['item'] as $ref_id => $data) {
519  $sug_start_dt = ilCalendarUtil::parseIncomingDate($data['sug_start']);
520  $sug_end_dt = ilCalendarUtil::parseIncomingDate($data['sug_end']);
521 
522  if (($sug_start_dt instanceof ilDate) and ($sug_end_dt instanceof ilDate)) {
523  include_once './Services/Calendar/classes/class.ilDateTime.php';
524  if (ilDateTime::_after($sug_start_dt, $sug_end_dt)) {
525  $failed[$ref_id] = 'crs_timing_err_start_end';
526  continue;
527  }
528  // update user date
529  include_once './Modules/Course/classes/Timings/class.ilTimingUser.php';
530  $tu = new ilTimingUser($ref_id, $GLOBALS['ilUser']->getId());
531  $tu->getStart()->setDate($sug_start_dt->get(IL_CAL_UNIX), IL_CAL_UNIX);
532  $tu->getEnd()->setDate($sug_end_dt->get(IL_CAL_UNIX), IL_CAL_UNIX);
533  $tu->update();
534  } else {
535  $failed['ref_id'] = 'crs_timing_err_valid_dates';
536  continue;
537  }
538  }
539  // cognos-blu-patch: begin
540  if (!$failed) {
541  ilUtil::sendSuccess($GLOBALS['lng']->txt('settings_saved'));
542  $this->managePersonalTimings();
543  return true;
544  } else {
545  ilUtil::sendFailure($this->lng->txt('err_check_input'));
547  return true;
548  }
549  // cognos-blu-patch: end
550  }
managePersonalTimings($failed=array())
Manage personal timings.
static _after(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
compare two dates and check start is after end This method does not consider tz offsets.
TableGUI class for timings administration.
const IL_CAL_UNIX
Class for single dates.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
$failed
Definition: Utf8Test.php:85
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST["username"]
static parseIncomingDate($a_value, $a_add_time=null)
Try to parse incoming value to date object.
+ Here is the call graph for this function:

◆ updateTimings()

ilCourseContentGUI::updateTimings ( )

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

References $_POST, ilObjectGUI\$data, $DIC, ilObjectGUI\$ilErr, $message, ilObjectGUI\$ref_id, __toUnix(), editTimings(), ilObjectActivation\getItem(), ilUtil\sendFailure(), ilObjectActivation\TIMINGS_DEACTIVATED, and ilObjectActivation\TIMINGS_PRESETTING.

1238  {
1239  global $DIC;
1240 
1241  $ilAccess = $DIC['ilAccess'];
1242  $ilErr = $DIC['ilErr'];
1243 
1244  if (!$ilAccess->checkAccess('write', '', $this->container_obj->getRefId())) {
1245  $ilErr->raiseError($this->lng->txt('msg_no_perm_write'), $ilErr->WARNING);
1246  }
1247  $this->failed = array();
1248  // Validate
1249 
1250  $_POST['item'] = is_array($_POST['item']) ? $_POST['item'] : array();
1251  $all_items = array();
1252 
1253  foreach ($_POST['item'] as $ref_id => $data) {
1254  $item_obj = new ilObjectActivation();
1255  $old_data = ilObjectActivation::getItem($ref_id);
1256 
1257  $item_obj->setTimingType($_POST['item_active'][$ref_id]['active'] ?
1260  $item_obj->setTimingStart($old_data['timing_start']);
1261  $item_obj->setTimingEnd($old_data['timing_end']);
1262  $item_obj->setSuggestionStart($this->__toUnix($data["sug_start"]));
1263 
1264  // add duration
1265  $data['sug_start']['d'] += abs($data['duration_a']);
1266  $item_obj->setSuggestionEnd($this->__toUnix($data['sug_start'], array('h' => 23,'m' => 55)));
1267  $item_obj->toggleVisible($old_data['visible']);
1268  $item_obj->toggleChangeable($_POST['item_change'][$ref_id]['change']);
1269 
1270  if (!$item_obj->validateActivation()) {
1271  $this->failed[$ref_id] = $old_data['title'];
1272  }
1273  $all_items[$ref_id] = &$item_obj;
1274  unset($item_obj);
1275  }
1276 
1277  if (count($this->failed)) {
1278  $message = $this->lng->txt('crs_timings_update_error');
1279  $message .= ("<br />" . $this->lng->txt('crs_materials') . ': ');
1280  $message .= (implode(',', $this->failed));
1282  $this->editTimings();
1283  return false;
1284  }
1285 
1286  // No do update
1287  foreach ($all_items as $ref_id => $item_obj_new) {
1288  $item_obj_new->update($ref_id);
1289  }
1290  ilUtil::sendSuccess($this->lng->txt('settings_saved'));
1291  $this->editTimings();
1292  return false;
1293  }
__toUnix($date, $time=array())
static getItem($a_ref_id)
Get item data.
global $DIC
Definition: goto.php:24
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$message
Definition: xapiexit.php:14
Class ilObjectActivation.
$_POST["username"]
+ Here is the call graph for this function:

◆ updateUserTimings()

ilCourseContentGUI::updateUserTimings ( )

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

References $_POST, ilObjectGUI\$data, $DIC, $ilUser, $message, ilObjectGUI\$ref_id, __toUnix(), editUserTimings(), ilUtil\sendFailure(), and ilTimingPlaned\setPlanedStartingTime().

1090  {
1091  global $DIC;
1092 
1093  $ilUser = $DIC['ilUser'];
1094  $ilObjDataCache = $DIC['ilObjDataCache'];
1095  include_once 'Modules/Course/classes/Timings/class.ilTimingPlaned.php';
1096 
1097  $this->tabs_gui->clearSubTabs();
1098 
1099  // Validate
1100  $this->invalid = array();
1101  foreach ($_POST['item'] as $ref_id => $data) {
1102  $tmp_planed = new ilTimingPlaned($ref_id, $ilUser->getId());
1103 
1104  $tmp_planed->setPlanedStartingTime($this->__toUnix($data['own_start']));
1105  if (isset($data['duration'])) {
1106  $data['own_start']['d'] += $data['duration'];
1107  $tmp_planed->setPlanedEndingTime($this->__toUnix($data['own_start'], array('h' => 23,'m' => 55)));
1108  } else {
1109  $tmp_planed->setPlanedEndingTime($this->__toUnix($data['own_start']), array('h' => 23,'m' => 55));
1110  }
1111  if (!$tmp_planed->validate()) {
1112  $this->invalid[$ref_id] = $ilObjDataCache->lookupTitle($ilObjDataCache->lookupObjId($ref_id));
1113  }
1114  $all_items[] = $tmp_planed;
1115  }
1116  if (count($this->invalid)) {
1117  $message = $this->lng->txt('crs_timings_update_error');
1118  $message .= ("<br />" . $this->lng->txt('crs_materials') . ': ');
1119  $message .= (implode(',', $this->invalid));
1121  $this->editUserTimings();
1122  return false;
1123  }
1124  foreach ($all_items as $new_item_obj) {
1125  $new_item_obj->update();
1126  }
1127  ilUtil::sendSuccess($this->lng->txt('settings_saved'));
1128  $this->editUserTimings();
1129  return true;
1130  }
__toUnix($date, $time=array())
class ilTimingPlaned
global $DIC
Definition: goto.php:24
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
setPlanedStartingTime($a_time)
$message
Definition: xapiexit.php:14
$ilUser
Definition: imgupload.php:18
$_POST["username"]
+ Here is the call graph for this function:

◆ view()

ilCourseContentGUI::view ( )

Output course content.

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

References $DIC, $ilUser, ilObjectGUI\$obj_id, ilObject\_lookupObjId(), ilChangeEvent\_recordReadEvent(), ilObjectGUI\getCenterColumnHTML(), and getRightColumnHTML().

Referenced by executeCommand().

289  {
290  // BEGIN ChangeEvent: record read event.
291  require_once('Services/Tracking/classes/class.ilChangeEvent.php');
292  global $DIC;
293 
294  $ilUser = $DIC['ilUser'];
295  $obj_id = ilObject::_lookupObjId($this->container_obj->getRefId());
297  $this->container_obj->getType(),
298  $this->container_obj->getRefId(),
299  $obj_id,
300  $ilUser->getId()
301  );
302  // END ChangeEvent: record read event.
303 
304  $this->getCenterColumnHTML();
305 
306  if (!$this->no_right_column) {
307  $this->tpl->setRightContent($this->getRightColumnHTML());
308  }
309  }
static _recordReadEvent( $a_type, $a_ref_id, $obj_id, $usr_id, $isCatchupWriteEvents=true, $a_ext_rc=false, $a_ext_time=false)
Records a read event and catches up with write events.
getRightColumnHTML()
Display right column.
getCenterColumnHTML()
Get center column.
static _lookupObjId($a_id)
global $DIC
Definition: goto.php:24
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $container_gui

ilCourseContentGUI::$container_gui

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

◆ $container_obj

ilCourseContentGUI::$container_obj

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

Referenced by __initCourseObject(), and getContainerObject().

◆ $course_obj

ilCourseContentGUI::$course_obj

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

◆ $ctrl

ilCourseContentGUI::$ctrl

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

◆ $fav_manager

ilCourseContentGUI::$fav_manager
protected

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

◆ $lng

ilCourseContentGUI::$lng

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

Referenced by __construct(), getRightColumnHTML(), and setColumnSettings().

◆ $tabs_gui

ilCourseContentGUI::$tabs_gui

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

◆ $tpl

ilCourseContentGUI::$tpl

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

Referenced by __construct().


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