ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 ()
 list childs of current object 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...
 

Data Fields

 $container_gui
 
 $container_obj
 
 $course_obj
 
 $tpl
 
 $ctrl
 
 $lng
 
 $tabs_gui
 
- Data Fields inherited from ilObjectGUI
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...
 
 showMountWebfolderIcon ()
 
 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...
 

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...
 
- Protected Attributes inherited from ilObjectGUI
 $ilErr
 
 $locator
 
 $user
 
 $access
 
 $settings
 
 $rbacreview
 
 $toolbar
 
 $tmp_import_dir
 
 $tabs_gui = null
 
 $ctrl
 
 $object_service
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilCourseContentGUI::__construct (   $container_gui_obj)

Constructor public.

Parameters
ilObjectGUI

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

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

32  {
33  global $DIC;
34 
35  $tpl = $DIC['tpl'];
36  $ilCtrl = $DIC['ilCtrl'];
37  $lng = $DIC['lng'];
38  $ilObjDataCache = $DIC['ilObjDataCache'];
39  $ilTabs = $DIC['ilTabs'];
40 
41  $this->tpl = $tpl;
42  $this->ctrl = $ilCtrl;
43  $this->lng = $lng;
44  $this->lng->loadLanguageModule('crs');
45  $this->tabs_gui = $ilTabs;
46 
47  $this->container_gui = &$container_gui_obj;
48  $this->container_obj = &$this->container_gui->object;
49 
50  $this->__initCourseObject();
51  }
global $DIC
Definition: saml.php:7
global $ilCtrl
Definition: ilias.php:18
+ Here is the call graph for this function:

Member Function Documentation

◆ __buildPath()

ilCourseContentGUI::__buildPath (   $a_ref_id)

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

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

1332  {
1333  global $DIC;
1334 
1335  $tree = $DIC['tree'];
1336 
1337  $path_arr = $tree->getPathFull($a_ref_id, $this->course_obj->getRefId());
1338  $counter = 0;
1339  foreach ($path_arr as $data) {
1340  if ($counter++) {
1341  $path .= " -> ";
1342  }
1343  $path .= $data['title'];
1344  }
1345 
1346  return $path;
1347  }
$path
Definition: aliased.php:25
global $DIC
Definition: saml.php:7

◆ __checkStartObjects()

ilCourseContentGUI::__checkStartObjects ( )

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

References $DIC, and $ilUser.

Referenced by executeCommand().

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

◆ __editAdvancedUserTimings()

ilCourseContentGUI::__editAdvancedUserTimings ( )

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

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

Referenced by editUserTimings().

864  {
865  $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.crs_usr_edit_timings_adv.html', 'Modules/Course');
866 
867  $this->tabs_gui->clearSubTabs();
868 
869  $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
870  $this->tpl->setVariable("HEADER_IMG", ilUtil::getImagePath('icon_crs.svg'));
871  $this->tpl->setVariable("HEADER_ALT", $this->lng->txt('obj_crs'));
872  $this->tpl->setVariable("BLOCK_HEADER_CONTENT", $this->lng->txt('timings_usr_edit'));
873 
874  if (!$_SESSION['crs_timings_user_hidden']) {
875  $this->tpl->setVariable("SHOW_HIDE_TEXT", $this->lng->txt('show_details'));
876  $this->ctrl->setParameter($this, 'show_details', 1);
877  $this->tpl->setVariable("SHOW_HIDE_LINK", $this->ctrl->getLinkTarget($this, 'editUserTimings'));
878  } else {
879  $this->tpl->setVariable("SHOW_HIDE_TEXT", $this->lng->txt('hide_details'));
880  $this->ctrl->setParameter($this, 'show_details', 0);
881  $this->tpl->setVariable("SHOW_HIDE_LINK", $this->ctrl->getLinkTarget($this, 'editUserTimings'));
882  }
883  $this->ctrl->clearParameters($this);
884  $this->tpl->setVariable("TXT_TITLE", $this->lng->txt('title'));
885  $this->tpl->setVariable("TXT_START_END", $this->lng->txt('crs_timings_short_start_end'));
886  $this->tpl->setVariable("TXT_INFO_START_END", $this->lng->txt('crs_timings_start_end_info'));
887 
888 
889  $this->tpl->setVariable("TXT_OWN_PRESETTING", $this->lng->txt('crs_timings_planed_start'));
890  $this->tpl->setVariable("TXT_INFO_OWN_PRESETTING", $this->lng->txt('crs_timings_start_end_info'));
891 
892  $this->tpl->setVariable("TXT_DURATION", $this->lng->txt('crs_timings_time_frame'));
893  $this->tpl->setVariable("TXT_INFO_DURATION", $this->lng->txt('crs_timings_in_days'));
894 
895  $this->tpl->setVariable("TXT_BTN_UPDATE", $this->lng->txt('save'));
896  $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt('cancel'));
897 
898  include_once 'Services/Object/classes/class.ilObjectActivation.php';
899  $sorted_items = ilObjectActivation::getTimingsItems($this->course_obj->getRefId());
900 
901  $this->counter = 0;
902  foreach ($sorted_items as $item) {
903  switch ($item['type']) {
904  case 'itgr':
905  break;
906 
907  default:
908  $this->__renderItem($item, 0);
909  break;
910  }
911  }
912  }
$_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 914 of file class.ilCourseContentGUI.php.

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

Referenced by editUserTimings().

915  {
916  $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.crs_usr_edit_timings.html', 'Modules/Course');
917 
918  $this->tabs_gui->clearSubTabs();
919 
920  $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
921  $this->tpl->setVariable("HEADER_IMG", ilUtil::getImagePath('icon_crs.svg'));
922  $this->tpl->setVariable("HEADER_ALT", $this->lng->txt('obj_crs'));
923 
924  if (!$_SESSION['crs_timings_user_hidden']) {
925  $this->tpl->setVariable("SHOW_HIDE_TEXT", $this->lng->txt('show_details'));
926  $this->ctrl->setParameter($this, 'show_details', 1);
927  $this->tpl->setVariable("SHOW_HIDE_LINK", $this->ctrl->getLinkTarget($this, 'editUserTimings'));
928  } else {
929  $this->tpl->setVariable("SHOW_HIDE_TEXT", $this->lng->txt('hide_details'));
930  $this->ctrl->setParameter($this, 'show_details', 0);
931  $this->tpl->setVariable("SHOW_HIDE_LINK", $this->ctrl->getLinkTarget($this, 'editUserTimings'));
932  }
933  $this->ctrl->clearParameters($this);
934 
935  $this->tpl->setVariable("BLOCK_HEADER_CONTENT", $this->lng->txt('timings_timings'));
936  $this->tpl->setVariable("TXT_TITLE", $this->lng->txt('title'));
937  $this->tpl->setVariable("TXT_START", $this->lng->txt('crs_timings_sug_begin'));
938  $this->tpl->setVariable("TXT_END", $this->lng->txt('crs_timings_sug_end'));
939 
940  include_once 'Services/Object/classes/class.ilObjectActivation.php';
941  $sorted_items = ilObjectActivation::getTimingsItems($this->course_obj->getRefId());
942 
943  $this->counter = 0;
944  foreach ($sorted_items as $item) {
945  switch ($item['type']) {
946  case 'itgr':
947  break;
948 
949  default:
950  $this->__renderItem($item, 0);
951  break;
952  }
953  }
954  }
$_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 386 of file class.ilCourseContentGUI.php.

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

387  {
388  global $DIC;
389 
390  $ilCtrl = $DIC['ilCtrl'];
391  $ilAccess = $DIC['ilAccess'];
392 
393  include_once("Services/Block/classes/class.ilColumnGUI.php");
394 
395  $obj_id = ilObject::_lookupObjId($this->container_obj->getRefId());
396  $obj_type = ilObject::_lookupType($obj_id);
397 
398  if (!$ilCtrl->isAsynch()) {
399  //if ($column_gui->getScreenMode() != IL_SCREEN_SIDE)
401  // right column wants center
403  $column_gui = new ilColumnGUI($obj_type, IL_COL_RIGHT);
404  $this->setColumnSettings($column_gui);
405  $html = $ilCtrl->forwardCommand($column_gui);
406  }
407  // left column wants center
409  $column_gui = new ilColumnGUI($obj_type, IL_COL_LEFT);
410  $this->setColumnSettings($column_gui);
411  $html = $ilCtrl->forwardCommand($column_gui);
412  }
413  } else {
414  {
415  $this->getDefaultView();
416  }
417  }
418  }
419 
420  return $html;
421  }
static getCmdSide()
Get Column Side of Current Command.
global $DIC
Definition: saml.php:7
const IL_COL_RIGHT
global $ilCtrl
Definition: ilias.php:18
Column user interface class.
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
static getScreenMode()
Get Screen Mode for current command.
const IL_SCREEN_SIDE
$html
Definition: example_001.php:87
const IL_COL_LEFT
+ Here is the call graph for this function:

◆ __getDefaultCommand()

ilCourseContentGUI::__getDefaultCommand ( )

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

References $_SESSION, $DIC, and IL_CRS_VIEW_TIMING.

Referenced by executeCommand().

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

◆ __initCourseObject()

ilCourseContentGUI::__initCourseObject ( )

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

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

Referenced by __construct().

1296  {
1297  global $DIC;
1298 
1299  $tree = $DIC['tree'];
1300 
1301  if ($this->container_obj->getType() == 'crs') {
1302  // Container is course
1303  $this->course_obj = &$this->container_obj;
1304  } else {
1305  $course_ref_id = $tree->checkForParentType($this->container_obj->getRefId(), 'crs');
1306  $this->course_obj = &ilObjectFactory::getInstanceByRefId($course_ref_id);
1307  }
1308  return true;
1309  }
global $DIC
Definition: saml.php:7
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 1126 of file class.ilCourseContentGUI.php.

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

Referenced by editTimings().

1127  {
1128  $obj_id = $item['obj_id'];
1129 
1130  if (!isset($_POST['item'][$obj_id])) {
1131  return $item;
1132  }
1133  $item['suggestion_start'] = $this->__toUnix($_POST['item'][$obj_id]['sug_start']);
1134  if (isset($_POST['item'][$obj_id]['sug_end'])) {
1135  // #9325
1136  $item['suggestion_end'] = $this->__toUnix($_POST['item'][$obj_id]['sug_end']);
1137  }
1138  $item['changeable'] = $_POST['item'][$obj_id]['change'];
1139  $item['timing_type'] = $_POST['item'][$obj_id]['active'] ? ilObjectActivation::TIMINGS_PRESETTING : $item['timing_type'];
1140  $item['duration_a'] = $_POST['item'][$obj_id]['duration_a'];
1141  $item['duration_b'] = $_POST['item'][$obj_id]['duration_b'];
1142 
1143  return $item;
1144  }
__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 1316 of file class.ilCourseContentGUI.php.

Referenced by __renderItem(), and editTimings().

1317  {
1318  return array('y' => date('Y', $a_unix_time),
1319  'm' => date('m', $a_unix_time),
1320  'd' => date('d', $a_unix_time));
1321  }
+ Here is the caller graph for this function:

◆ __prepareTimeSelect()

ilCourseContentGUI::__prepareTimeSelect (   $a_unix_time)

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

1324  {
1325  return array('h' => date('G', $a_unix_time),
1326  'm' => date('i', $a_unix_time),
1327  's' => date('s', $a_unix_time));
1328  }

◆ __renderItem()

ilCourseContentGUI::__renderItem (   $item,
  $level 
)

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

References $_POST, $_SESSION, $DIC, $end, $i, $ilUser, $start, __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().

957  {
958  global $DIC;
959 
960  $ilUser = $DIC['ilUser'];
961  $ilAccess = $DIC['ilAccess'];
962 
963  include_once 'Modules/Course/classes/Timings/class.ilTimingPlaned.php';
964  include_once './Services/Link/classes/class.ilLink.php';
965  include_once './Services/MetaData/classes/class.ilMDEducational.php';
966 
967  if (!$ilAccess->checkAccess('visible', '', $item['ref_id'])) {
968  return false;
969  }
970 
971  $this->lng->loadLanguageModule('meta');
972 
973  $usr_planed = new ilTimingPlaned($item['ref_id'], $ilUser->getId());
974 
975  for ($i = 0;$i < $level;$i++) {
976  $this->tpl->touchBlock('start_indent');
977  $this->tpl->touchBlock('end_indent');
978  }
979  if (strlen($item['description'])) {
980  $this->tpl->setCurrentBlock("item_description");
981  $this->tpl->setVariable("DESC", $item['description']);
982  $this->tpl->parseCurrentBlock();
983  }
984  if ($tlt = ilMDEducational::_getTypicalLearningTimeSeconds($item['obj_id'])) {
985  $this->tpl->setCurrentBlock("tlt");
986  $this->tpl->setVariable("TXT_TLT", $this->lng->txt('meta_typical_learning_time'));
987  $this->tpl->setVariable("TLT_VAL", ilDatePresentation::secondsToString($tlt));
988  $this->tpl->parseCurrentBlock();
989  }
990 
991  if (!$item['title'] &&
992  $item['type'] == 'sess') {
993  include_once('./Modules/Session/classes/class.ilSessionAppointment.php');
995  $item['title'] = ilSessionAppointment::_appointmentToString($app_info['start'], $app_info['end'], $app_info['fullday']);
996  }
997 
998  if ($ilAccess->checkAccess('read', '', $item['ref_id'])) {
999  $this->tpl->setCurrentBlock("title_as_link");
1000  $this->tpl->setVariable("TITLE_LINK", ilLink::_getLink($item['ref_id'], $item['type']));
1001  $this->tpl->setVariable("TITLE_NAME", $item['title']);
1002  $this->tpl->parseCurrentBlock();
1003  } else {
1004  $this->tpl->setCurrentBlock("title_plain");
1005  $this->tpl->setVariable("TITLE", $item['title']);
1006  $this->tpl->parseCurrentBlock();
1007  }
1008  $this->tpl->setCurrentBlock("container_standard_row");
1009 
1010  if (isset($this->invalid["$item[ref_id]"])) {
1011  $this->tpl->setVariable("ROWCLASS", 'tblrowmarked');
1012  } else {
1013  $this->tpl->setVariable("ROWCLASS", ilUtil::switchColor($this->counter++, 'tblrow1', 'tblrow2'));
1014  }
1015  #$this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_'.$item['type'].'.svg'));
1016  $this->tpl->setVariable('TYPE_IMG', ilUtil::getTypeIconPath($item['type'], $item['obj_id'], 'small'));
1017  $this->tpl->setVariable("TYPE_ALT_IMG", $this->lng->txt('obj_' . $item['type']));
1018 
1019 
1020  if ($item['timing_type'] == ilObjectActivation::TIMINGS_PRESETTING) {
1021  $this->tpl->setVariable('SUG_START', ilDatePresentation::formatDate(new ilDate($item['suggestion_start'], IL_CAL_UNIX)));
1022  $this->tpl->setVariable('SUG_END', ilDatePresentation::formatDate(new ilDate($item['suggestion_end'], IL_CAL_UNIX)));
1023  }
1024 
1025  if ($item['changeable']) {
1026  $item_prefix = "item[" . $item['ref_id'] . ']';
1027 
1028  if (is_array($_POST['item']["$item[ref_id]"]['own_start'])) {
1029  #echo "Start post<br>";
1030  $start = $this->__toUnix($_POST['item']["$item[ref_id]"]['own_start']);
1031  } elseif ($usr_planed->getPlanedStartingTime()) {
1032  #echo "Own start<br>";
1033  $start = $usr_planed->getPlanedStartingTime();
1034  } else {
1035  #echo "Empfehlung start<br>";
1036  $start = $item['suggestion_start'];
1037  }
1038 
1039  $date = $this->__prepareDateSelect($start);
1040  $this->tpl->setVariable(
1041  "OWN_START",
1043  $item_prefix . "[own_start]",
1044  $date['y'],
1045  $date['m'],
1046  $date['d'],
1047  date('Y', time()),
1048  false
1049  )
1050  );
1051 
1052  if ($usr_planed->getPlanedEndingTime()) {
1053  #echo "Own End<br>";
1054  $end = $usr_planed->getPlanedEndingTime();
1055  } else {
1056  #echo "Empfehlung end<br>";
1057  $end = $item['suggestion_end'];
1058  }
1059  $this->tpl->setVariable('OWN_END', ilDatePresentation::formatDate(new ilDate($end, IL_CAL_UNIX)));
1060  $this->tpl->setVariable("NAME_DURATION", $item_prefix . "[duration]");
1061 
1062  // Duration
1063  if (isset($_POST['item']["$item[ref_id]"]['duration'])) {
1064  $this->tpl->setVariable("VAL_DURATION", $_POST['item']["$item[ref_id]"]['duration']);
1065  } else {
1066  $this->tpl->setVariable("VAL_DURATION", intval(($end - $start) / (60 * 60 * 24)));
1067  }
1068  }
1069 
1070  $this->tpl->parseCurrentBlock();
1071 
1072  if (!$_SESSION['crs_timings_user_hidden']) {
1073  return true;
1074  }
1075 
1076  foreach (ilObjectActivation::getTimingsItems($item['ref_id']) as $item_data) {
1077  $this->__renderItem($item_data, $level + 1);
1078  }
1079  }
__toUnix($date, $time=array())
static _getTypicalLearningTimeSeconds($a_rbac_id, $a_obj_id=0)
$_SESSION["AccountId"]
global $DIC
Definition: saml.php:7
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.
$start
Definition: bench.php:8
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)
static _appointmentToString($start, $end, $fulltime)
$ilUser
Definition: imgupload.php:18
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
$i
Definition: disco.tpl.php:19
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __renderUserItem()

ilCourseContentGUI::__renderUserItem (   $item,
  $level 
)

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

References $_GET, $end, $i, $start, 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().

775  {
776  include_once 'Modules/Course/classes/Timings/class.ilTimingPlaned.php';
777  include_once './Services/MetaData/classes/class.ilMDEducational.php';
778 
779  $this->lng->loadLanguageModule('meta');
780 
781  include_once './Modules/Course/classes/Timings/class.ilTimingUser.php';
782  $usr_planed = new ilTimingUser($item['ref_id'], (int) $_GET['member_id']);
783 
784  for ($i = 0;$i < $level;$i++) {
785  $this->tpl->touchBlock('start_indent');
786  $this->tpl->touchBlock('end_indent');
787  }
788  if (strlen($item['description'])) {
789  $this->tpl->setCurrentBlock("item_description");
790  $this->tpl->setVariable("DESC", $item['description']);
791  $this->tpl->parseCurrentBlock();
792  }
793  if ($tlt = ilMDEducational::_getTypicalLearningTimeSeconds($item['obj_id'])) {
794  $this->tpl->setCurrentBlock("tlt");
795  $this->tpl->setVariable("TXT_TLT", $this->lng->txt('meta_typical_learning_time'));
796  $this->tpl->setVariable("TLT_VAL", ilDatePresentation::secondsToString($tlt));
797  $this->tpl->parseCurrentBlock();
798  }
799 
800  if (!$item['title'] &&
801  $item['type'] == 'sess') {
802  include_once('./Modules/Session/classes/class.ilSessionAppointment.php');
804  $item['title'] = ilSessionAppointment::_appointmentToString($app_info['start'], $app_info['end'], $app_info['fullday']);
805  }
806 
807  $this->tpl->setCurrentBlock("title_plain");
808  $this->tpl->setVariable("TITLE", $item['title']);
809  $this->tpl->parseCurrentBlock();
810 
811  $this->tpl->setCurrentBlock("container_standard_row");
812 
813  $this->tpl->setVariable("ROWCLASS", ilUtil::switchColor($this->counter++, 'tblrow1', 'tblrow2'));
814  #$this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_'.$item['type'].'.svg'));
815  $this->tpl->setVariable('TYPE_IMG', ilUtil::getTypeIconPath($item['type'], $item['obj_id'], 'tiny'));
816  $this->tpl->setVariable("TYPE_ALT_IMG", $this->lng->txt('obj_' . $item['type']));
817 
818  if ($item['timing_type'] == ilObjectActivation::TIMINGS_PRESETTING) {
819  if ($usr_planed->getStart()->get(IL_CAL_UNIX)) {
820  $this->tpl->setVariable('SUG_START', $usr_planed->getStart()->get(IL_CAL_DATE));
821  }
822  if ($usr_planed->getEnd()->get(IL_CAL_UNIX)) {
823  $this->tpl->setVariable('SUG_END', $usr_planed->getEnd()->get(IL_CAL_DATE));
824  }
825  }
826 
827 
828  if (0 and $item['changeable'] and $item['timing_type'] == ilObjectActivation::TIMINGS_PRESETTING) {
829  if ($usr_planed->getPlanedStartingTime()) {
830  $start = $usr_planed->getPlanedStartingTime();
831  } else {
832  $start = $item['suggestion_start'];
833  }
834  $this->tpl->setVariable('OWN_START', ilDatePresentation::formatDate(new ilDate($start, IL_CAL_UNIX)));
835 
836  if ($usr_planed->getPlanedEndingTime() and 0) {
837  $end = $usr_planed->getPlanedEndingTime();
838  } else {
839  $end = $item['suggestion_end'];
840  }
841  if ($start != $item['suggestion_start'] or $end != $item['suggestion_end']) {
842  $this->tpl->setVariable("OK_IMG", ilUtil::getImagePath('icon_ok.svg'));
843  $this->tpl->setVariable("OK_ALT", $this->lng->txt('crs_timings_changed'));
844  } else {
845  $this->tpl->setVariable("OK_IMG", ilUtil::getImagePath('icon_not_ok.svg'));
846  $this->tpl->setVariable("OK_ALT", $this->lng->txt('crs_timings_not_changed'));
847  }
848  $this->tpl->setVariable('OWN_END', ilDatePresentation::formatDate(new ilDate($end, IL_CAL_UNIX)));
849  }
850 
851  $this->tpl->parseCurrentBlock();
852 
853  foreach (ilObjectActivation::getTimingsAdministrationItems($item['ref_id']) as $item_data) {
854  if (($item_data['timing_type'] == ilObjectActivation::TIMINGS_PRESETTING) or
855  ilObjectActivation::hasChangeableTimings($item_data['ref_id'])) {
856  $this->__renderUserItem($item_data, $level + 1);
857  }
858  }
859  }
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.
$start
Definition: bench.php:8
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: disco.tpl.php:19
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __setSubTabs()

ilCourseContentGUI::__setSubTabs ( )

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

Referenced by executeCommand().

1289  {
1290  if ($this->container_obj->getType() == 'crs') {
1291  $this->container_gui->setContentSubTabs();
1292  }
1293  }
+ Here is the caller graph for this function:

◆ __toUnix()

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

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

References $time.

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

1312  {
1313  return gmmktime($time['h'], $time['m'], 0, $date['m'], $date['d'], $date['y']);
1314  }
$time
Definition: cron.php:21
+ Here is the caller graph for this function:

◆ editTimings()

ilCourseContentGUI::editTimings ( )

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

References $_POST, $DIC, $end, ilObjectGUI\$ilErr, $start, __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().

552  {
553  global $DIC;
554 
555  $ilAccess = $DIC['ilAccess'];
556  $ilErr = $DIC['ilErr'];
557 
558  $this->lng->loadLanguageModule('meta');
559 
560  if (!$ilAccess->checkAccess('write', '', $this->container_obj->getRefId())) {
561  $ilErr->raiseError($this->lng->txt('msg_no_perm_write'), $ilErr->WARNING);
562  }
563  $this->tabs_gui->setTabActive('timings_timings');
564  $this->tabs_gui->clearSubTabs();
565 
566  $this->cont_arr = ilObjectActivation::getTimingsAdministrationItems($this->container_obj->getRefId());
567 
568  $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.crs_edit_items.html', 'Modules/Course');
569  $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
570  $this->tpl->setVariable("HEADER_IMG", ilUtil::getImagePath('icon_crs.svg'));
571  $this->tpl->setVariable("HEADER_ALT", $this->lng->txt('crs_materials'));
572  $this->tpl->setVariable("BLOCK_HEADER_CONTENT", $this->lng->txt('edit_timings_list'));
573  $this->tpl->setVariable("TXT_TITLE", $this->lng->txt('title'));
574 
575 
576  $this->tpl->setVariable("TXT_DURATION", $this->lng->txt('crs_timings_time_frame'));
577  $this->tpl->setVariable("TXT_INFO_DURATION", $this->lng->txt('crs_timings_in_days'));
578 
579  $this->tpl->setVariable("TXT_START_END", $this->lng->txt('crs_timings_short_start_end'));
580  $this->tpl->setVariable("TXT_INFO_START_END", $this->lng->txt('crs_timings_start_end_info'));
581 
582  $this->tpl->setVariable("TXT_CHANGEABLE", $this->lng->txt('crs_timings_short_changeable'));
583 
584  $this->tpl->setVariable("TXT_INFO_LIMIT", $this->lng->txt('crs_timings_from_until'));
585  $this->tpl->setVariable("TXT_LIMIT", $this->lng->txt('crs_timings_short_limit_start_end'));
586  $this->tpl->setVariable("TXT_ACTIVE", $this->lng->txt('crs_timings_short_active'));
587  $this->tpl->setVariable("TXT_INFO_ACTIVE", $this->lng->txt('crs_timings_info_active'));
588 
589  $counter = 0;
590  foreach ($this->cont_arr as $item) {
591  if ($item['type'] == 'itgr') {
592  continue;
593  }
594  $item = $this->__loadFromPost($item);
595  $item_prefix = "item[$item[ref_id]]";
596  $item_change_prefix = "item_change[$item[ref_id]]";
597  $item_active_prefix = "item_active[$item[ref_id]]";
598 
599  if ($item['type'] == 'grp' or
600  $item['type'] == 'fold') {
601  $this->tpl->setVariable("TITLE_LINK", ilLink::_getLink($item['ref_id'], $item['type']));
602  $this->tpl->setVariable("TITLE_FRAME", ilFrameTargetInfo::_getFrame('MainContent', $item['type']));
603  $this->tpl->setVariable("TITLE_LINK_NAME", $item['title']);
604  } else {
605  if (!$item['title'] &&
606  $item['type'] == 'sess') {
607  include_once('./Modules/Session/classes/class.ilSessionAppointment.php');
609  $item['title'] = ilSessionAppointment::_appointmentToString($app_info['start'], $app_info['end'], $app_info['fullday']);
610  }
611 
612  $this->tpl->setVariable("TITLE", $item['title']);
613  }
614 
615  if (strlen($item['description'])) {
616  $this->tpl->setCurrentBlock("item_description");
617  $this->tpl->setVariable("DESC", $item['description']);
618  $this->tpl->parseCurrentBlock();
619  }
620 
621  if ($tlt = ilMDEducational::_getTypicalLearningTimeSeconds($item['obj_id'])) {
622  $this->tpl->setCurrentBlock("tlt");
623  $this->tpl->setVariable("TXT_TLT", $this->lng->txt('meta_typical_learning_time'));
624  $this->tpl->setVariable("TLT_VAL", ilDatePresentation::secondsToString($tlt));
625  $this->tpl->parseCurrentBlock();
626  }
627 
628  $this->tpl->setCurrentBlock("container_standard_row");
629 
630  // Suggested
631  if (is_array($_POST['item']["$item[ref_id]"]['sug_start'])) {
632  $start = $this->__toUnix($_POST['item']["$item[ref_id]"]['sug_start']);
633  } else {
634  $start = $item['suggestion_start'];
635  }
636  $end = $item['suggestion_end'];
637  $date = $this->__prepareDateSelect($start);
638  $this->tpl->setVariable(
639  "SUG_START",
641  $item_prefix . "[sug_start]",
642  $date['y'],
643  $date['m'],
644  $date['d'],
645  date('Y', time()),
646  false
647  )
648  );
649 
650  $this->tpl->setVariable("NAME_DURATION_A", $item_prefix . "[duration_a]");
651  if (isset($_POST['item']["$item[ref_id]"]['duration_a'])) {
652  $this->tpl->setVariable("VAL_DURATION_A", abs($_POST['item']["$item[ref_id]"]['duration_a']));
653  } else {
654  $this->tpl->setVariable("VAL_DURATION_A", intval(($end - $start) / (60 * 60 * 24)));
655  }
656 
657  $this->tpl->setVariable('SUG_END', ilDatePresentation::formatDate(new ilDate($item['suggestion_end'], IL_CAL_UNIX)));
658 
659 
660  $date = $this->__prepareDateSelect($end);
661  $this->tpl->setVariable(
662  "LIM_END",
664  $item_prefix . "[lim_end]",
665  $date['y'],
666  $date['m'],
667  $date['d'],
668  date('Y', time()),
669  false
670  )
671  );
672 
673  $this->tpl->setVariable("NAME_CHANGE", $item_change_prefix . "[change]");
674  $this->tpl->setVariable("NAME_ACTIVE", $item_active_prefix . "[active]");
675 
676  if (isset($_POST['item'])) {
677  $change = $_POST['item_change']["$item[ref_id]"]['change'];
678  $active = $_POST['item_active']["$item[ref_id]"]['active'];
679  } else {
680  $change = $item['changeable'];
681  $active = ($item['timing_type'] == ilObjectActivation::TIMINGS_PRESETTING);
682  }
683 
684  $this->tpl->setVariable("CHECKED_ACTIVE", $active ? 'checked="checked"' : '');
685  $this->tpl->setVariable("CHECKED_CHANGE", $change ? 'checked="checked"' : '');
686 
687  if (isset($this->failed["$item[ref_id]"])) {
688  $this->tpl->setVariable("ROWCLASS", 'tblrowmarked');
689  } else {
690  $this->tpl->setVariable("ROWCLASS", ilUtil::switchColor($counter++, 'tblrow1', 'tblrow2'));
691  }
692  $this->tpl->parseCurrentBlock();
693  }
694 
695  // Select all
696  $this->tpl->setVariable("CHECKCLASS", ilUtil::switchColor($counter++, 'tblrow1', 'tblrow2'));
697  $this->tpl->setVariable("SELECT_ALL", $this->lng->txt('select_all'));
698 
699  $this->tpl->setVariable("BTN_SAVE", $this->lng->txt('save'));
700  $this->tpl->setVariable("BTN_CANCEL", $this->lng->txt('cancel'));
701  }
__toUnix($date, $time=array())
static _getTypicalLearningTimeSeconds($a_rbac_id, $a_obj_id=0)
global $DIC
Definition: saml.php:7
const IL_CAL_UNIX
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
$start
Definition: bench.php:8
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)
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 703 of file class.ilCourseContentGUI.php.

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

Referenced by updateUserTimings().

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

◆ executeCommand()

ilCourseContentGUI::executeCommand ( )

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

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

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

◆ getContainerObject()

ilCourseContentGUI::getContainerObject ( )
Returns
ilObject

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

References $container_obj.

Referenced by managePersonalTimings(), and manageTimings().

112  {
113  return $this->container_obj;
114  }
+ Here is the caller graph for this function:

◆ getRightColumnHTML()

ilCourseContentGUI::getRightColumnHTML ( )

Display right column.

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

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

Referenced by view().

302  {
303  global $DIC;
304 
305  $ilUser = $DIC['ilUser'];
306  $lng = $DIC['lng'];
307  $ilCtrl = $DIC['ilCtrl'];
308  $ilAccess = $DIC['ilAccess'];
309 
310  $ilCtrl->saveParameterByClass("ilcolumngui", "col_return");
311 
312  $obj_id = ilObject::_lookupObjId($this->container_obj->getRefId());
313  $obj_type = ilObject::_lookupType($obj_id);
314 
315  include_once("Services/Block/classes/class.ilColumnGUI.php");
316  $column_gui = new ilColumnGUI($obj_type, IL_COL_RIGHT);
317 
318  if ($column_gui->getScreenMode() == IL_SCREEN_FULL) {
319  return "";
320  }
321 
322  $this->setColumnSettings($column_gui);
323 
324  if ($ilCtrl->getNextClass() == "ilcolumngui" &&
325  $column_gui->getCmdSide() == IL_COL_RIGHT &&
326  $column_gui->getScreenMode() == IL_SCREEN_SIDE) {
327  $html = $ilCtrl->forwardCommand($column_gui);
328  } else {
329  if (!$ilCtrl->isAsynch()) {
330  $html = $ilCtrl->getHTML($column_gui);
331  }
332  }
333 
334  return $html;
335  }
global $DIC
Definition: saml.php:7
const IL_COL_RIGHT
global $ilCtrl
Definition: ilias.php:18
const IL_SCREEN_FULL
Column user interface class.
static _lookupObjId($a_id)
$ilUser
Definition: imgupload.php:18
static _lookupType($a_id, $a_reference=false)
lookup object type
const IL_SCREEN_SIDE
$html
Definition: example_001.php:87
+ 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 463 of file class.ilCourseContentGUI.php.

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

Referenced by updatePersonalTimings().

464  {
465  global $ilErr, $ilAccess;
466 
467  if (!$ilAccess->checkAccess('read', '', $this->container_obj->getRefId())) {
468  $ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $ilErr->WARNING);
469  }
470  $GLOBALS['ilTabs']->setTabActive('timings_timings');
471  $GLOBALS['ilTabs']->clearSubTabs();
472 
473  include_once './Modules/Course/classes/Timings/class.ilTimingsPersonalTableGUI.php';
475  $this,
476  'managePersonalTimings',
477  $this->getContainerObject(),
478  $this->course_obj
479  );
480  $table->setFailureStatus(count($failed));
481  $table->setUserId($GLOBALS['ilUser']->getId());
482  $table->init();
483  $table->parse(
485  $this->getContainerObject()->getRefId(),
486  false
487  ),
488  $failed
489  );
490  $GLOBALS['tpl']->setContent($table->getHTML());
491  }
static getItems($a_parent_id, $a_with_list_data=true)
Get sub item data.
$failed
Definition: Utf8Test.php:85
if(empty($password)) $table
Definition: pwgen.php:24
TableGUI class for editing personal timings.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ 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 430 of file class.ilCourseContentGUI.php.

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

Referenced by updateManagedTimings().

431  {
432  global $DIC;
433 
434  $ilAccess = $DIC->access();
435  $ilErr = $DIC['ilErr'];
436  $mainTemplate = $DIC->ui()->mainTemplate();
437 
438  if (!$ilAccess->checkAccess('write', '', $this->container_obj->getRefId())) {
439  $ilErr->raiseError($this->lng->txt('msg_no_perm_write'), $ilErr->WARNING);
440  }
441  $GLOBALS['DIC']['ilTabs']->setTabActive('timings_timings');
442  $GLOBALS['DIC']['ilTabs']->clearSubTabs();
443 
445  $this,
446  'manageTimings',
447  $this->getContainerObject(),
448  $this->course_obj
449  );
450  if (count($failed_items)) {
451  $table->setFailureStatus(true);
452  }
453  $table->init();
454  $table->parse(ilObjectActivation::getTimingsAdministrationItems($this->getContainerObject()->getRefId()), $failed_items);
455 
456 
457  $mainTemplate->setContent($table->getHTML());
458  }
global $DIC
Definition: saml.php:7
static getTimingsAdministrationItems($a_parent_id)
Get (sub) item data for timings administration view (active/inactive)
TableGUI class for timings administration.
if(empty($password)) $table
Definition: pwgen.php:24
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ returnToMembers()

ilCourseContentGUI::returnToMembers ( )

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

727  {
728  $this->ctrl->returnToParent($this);
729  }

◆ setColumnSettings()

ilCourseContentGUI::setColumnSettings (   $column_gui)

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

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

Referenced by __forwardToColumnGUI(), and getRightColumnHTML().

338  {
339  global $DIC;
340 
341  $ilAccess = $DIC['ilAccess'];
342  $lng = $DIC['lng'];
343 
344  $column_gui->setRepositoryMode(true);
345  $column_gui->setEnableEdit(false);
346  $column_gui->setBlockProperty(
347  "news",
348  "title",
349  $lng->txt("crs_news")
350  );
351 
352  include_once "Services/Object/classes/class.ilObjectActivation.php";
353  $grouped_items = array();
354  foreach (ilObjectActivation::getItems($this->container_obj->getRefId()) as $item) {
355  $grouped_items[$item["type"]][] = $item;
356  }
357 
358  $column_gui->setRepositoryItems($grouped_items);
359  if ($ilAccess->checkAccess("write", "", $this->container_obj->getRefId())) {
360  $column_gui->setEnableEdit(true);
361  }
362 
363  // Allow movement of blocks for tutors
364  if ($this->is_tutor &&
365  $this->container_gui->isActiveAdministrationPanel()) {
366  $column_gui->setEnableMovement(true);
367  }
368 
369  // Configure Settings, if administration panel is on
370  if ($this->is_tutor) {
371  $column_gui->setBlockProperty("news", "settings", true);
372  //$column_gui->setBlockProperty("news", "public_notifications_option", true);
373  $column_gui->setBlockProperty("news", "default_visibility_option", true);
374  $column_gui->setBlockProperty("news", "hide_news_block_option", true);
375  }
376 
377  if ($this->container_gui->isActiveAdministrationPanel()) {
378  $column_gui->setAdminCommands(true);
379  }
380  }
static getItems($a_parent_id, $a_with_list_data=true)
Get sub item data.
global $DIC
Definition: saml.php:7
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showStartObjects()

ilCourseContentGUI::showStartObjects ( )

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

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

Referenced by executeCommand().

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

◆ showUserTimings()

ilCourseContentGUI::showUserTimings ( )

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

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

732  {
733  $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.crs_user_timings.html', 'Modules/Course');
734  $this->tabs_gui->clearSubTabs();
735  $this->tabs_gui->setTabActive('members');
736 
737  if (!$_GET['member_id']) {
738  ilUtil::sendFailure($this->lng->txt('no_checkbox'), true);
739  $this->ctrl->returnToParent($this);
740  }
741 
742 
743  // Back button
744  $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
745  $this->tpl->setCurrentBlock("btn_cell");
746  $this->tpl->setVariable("BTN_LINK", $this->ctrl->getLinkTarget($this, 'returnToMembers'));
747  $this->tpl->setVariable("BTN_TXT", $this->lng->txt("back"));
748  $this->tpl->parseCurrentBlock();
749 
750 
751  $this->tpl->setVariable("HEADER_IMG", ilUtil::getImagePath('icon_usr.svg'));
752  $this->tpl->setVariable("HEADER_ALT", $this->lng->txt('obj_usr'));
753  $this->tpl->setVariable("TABLE_HEADER", $this->lng->txt('timings_of'));
754  $name = ilObjUser::_lookupName($_GET['member_id']);
755  $this->tpl->setVariable("USER_NAME", $name['lastname'] . ', ' . $name['firstname']);
756 
757  $this->tpl->setVariable("TXT_TITLE", $this->lng->txt('title'));
758  $this->tpl->setVariable("TXT_START_END", $this->lng->txt('crs_timings_short_start_end'));
759  $this->tpl->setVariable("TXT_INFO_START_END", $this->lng->txt('crs_timings_start_end_info'));
760  $this->tpl->setVariable("TXT_CHANGED", $this->lng->txt('crs_timings_changed'));
761  $this->tpl->setVariable("TXT_OWN_PRESETTING", $this->lng->txt('crs_timings_planed_start'));
762  $this->tpl->setVariable("TXT_INFO_OWN_PRESETTING", $this->lng->txt('crs_timings_from_until'));
763 
764  include_once 'Services/Object/classes/class.ilObjectActivation.php';
765  $items = ilObjectActivation::getTimingsAdministrationItems($this->course_obj->getRefId());
766  foreach ($items as $item) {
767  if (($item['timing_type'] == ilObjectActivation::TIMINGS_PRESETTING) or
768  ilObjectActivation::hasChangeableTimings($item['ref_id'])) {
769  $this->__renderUserItem($item, 0);
770  }
771  }
772  }
static _lookupName($a_user_id)
lookup user name
$_GET["client_id"]
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 1150 of file class.ilCourseContentGUI.php.

References $_POST, ilObjectGUI\$data, $DIC, $failed, ilObjectGUI\$ilErr, ilObjectGUI\$ref_id, $start, 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.

1151  {
1152  global $DIC;
1153 
1154  $ilAccess = $DIC->access();
1155  $ilErr = $DIC['ilErr'];
1156 
1157  if (!$ilAccess->checkAccess('write', '', $this->container_obj->getRefId())) {
1158  $ilErr->raiseError($this->lng->txt('msg_no_perm_write'), $ilErr->WARNING);
1159  }
1160 
1161  $this->tabs_gui->clearSubTabs();
1162 
1163  $failed = array();
1164  $all_items = array();
1165  include_once './Services/Calendar/classes/class.ilCalendarUtil.php';
1166  foreach ((array) $_POST['item'] as $ref_id => $data) {
1167  $item_obj = new ilObjectActivation();
1168  $item_obj->read($ref_id);
1169 
1171  #$item_obj->setTimingStart($old_data['timing_start']);
1172  #$item_obj->setTimingEnd($old_data['timing_end']);
1173  #$item_obj->toggleVisible($old_data['visible']);
1174  $item_obj->toggleChangeable((int) $data['change']);
1175 
1176  if ($this->course_obj->getTimingMode() == ilCourseConstants::IL_CRS_VIEW_TIMING_ABSOLUTE) {
1177  $sug_start_dt = ilCalendarUtil::parseIncomingDate($data['sug_start']);
1178  $sug_end_dt = ilCalendarUtil::parseIncomingDate($data['sug_end']);
1179 
1180 
1181  if (($sug_start_dt instanceof ilDate) and ($sug_end_dt instanceof ilDate)) {
1182  include_once './Services/Calendar/classes/class.ilDateTime.php';
1183  if (ilDateTime::_after($sug_start_dt, $sug_end_dt)) {
1184  $failed[$ref_id] = 'crs_timing_err_start_end';
1185  continue;
1186  }
1187  $item_obj->setSuggestionStart($sug_start_dt->get(IL_CAL_UNIX));
1188  $item_obj->setSuggestionEnd($sug_end_dt->get(IL_CAL_UNIX));
1189  } else {
1190  $failed['ref_id'] = 'crs_timing_err_valid_dates';
1191  continue;
1192  }
1193  } else {
1194  if (
1195  ((int) $data['sug_start_rel'] < 0) or
1196  ((int) $data['duration_a'] < 0)
1197  ) {
1198  $failed[$ref_id] = 'crs_timing_err_start_dur_rel';
1199  continue;
1200  }
1201  $item_obj->setSuggestionStartRelative($data['sug_start_rel']);
1202  $item_obj->setSuggestionEndRelative($data['sug_start_rel'] + $data['duration_a']);
1203 
1204  // add default values for start/end (relative to now)
1205  $start = new ilDate(time(), IL_CAL_UNIX);
1206  $start->increment(IL_CAL_DAY, $data['sug_start_rel']);
1207  $item_obj->setSuggestionStart($start->get(IL_CAL_UNIX));
1208 
1209  $start->increment(IL_CAL_DAY, $data['duration_a']);
1210  $item_obj->setSuggestionEnd($start->get(IL_CAL_UNIX));
1211  }
1212 
1213  $item_obj->update($ref_id);
1214  }
1215  if (!$failed) {
1216  // update course => create calendar entries
1217  $this->course_obj->update();
1218 
1219  ilUtil::sendSuccess($this->lng->txt('settings_saved'));
1220  $this->manageTimings();
1221 
1222  return true;
1223  } else {
1224  ilUtil::sendFailure($this->lng->txt('err_check_input'));
1225  $this->manageTimings($failed);
1226  return true;
1227  }
1228  }
global $DIC
Definition: saml.php:7
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
$start
Definition: bench.php:8
const IL_CAL_DAY
Class for single dates.
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 499 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().

500  {
501  global $ilAccess,$ilErr;
502 
503  if (!$ilAccess->checkAccess('read', '', $this->container_obj->getRefId())) {
504  $ilErr->raiseError($this->lng->txt('msg_no_perm_write'), $ilErr->WARNING);
505  }
506 
507  $this->tabs_gui->clearSubTabs();
508 
509  $failed = array();
510  include_once './Services/Calendar/classes/class.ilCalendarUtil.php';
511  foreach ((array) $_POST['item'] as $ref_id => $data) {
512  $sug_start_dt = ilCalendarUtil::parseIncomingDate($data['sug_start']);
513  $sug_end_dt = ilCalendarUtil::parseIncomingDate($data['sug_end']);
514 
515  if (($sug_start_dt instanceof ilDate) and ($sug_end_dt instanceof ilDate)) {
516  include_once './Services/Calendar/classes/class.ilDateTime.php';
517  if (ilDateTime::_after($sug_start_dt, $sug_end_dt)) {
518  $failed[$ref_id] = 'crs_timing_err_start_end';
519  continue;
520  }
521  // update user date
522  include_once './Modules/Course/classes/Timings/class.ilTimingUser.php';
523  $tu = new ilTimingUser($ref_id, $GLOBALS['ilUser']->getId());
524  $tu->getStart()->setDate($sug_start_dt->get(IL_CAL_UNIX), IL_CAL_UNIX);
525  $tu->getEnd()->setDate($sug_end_dt->get(IL_CAL_UNIX), IL_CAL_UNIX);
526  $tu->update();
527  } else {
528  $failed['ref_id'] = 'crs_timing_err_valid_dates';
529  continue;
530  }
531  }
532  // cognos-blu-patch: begin
533  if (!$failed) {
534  ilUtil::sendSuccess($GLOBALS['lng']->txt('settings_saved'));
535  $this->managePersonalTimings();
536  return true;
537  } else {
538  ilUtil::sendFailure($this->lng->txt('err_check_input'));
540  return true;
541  }
542  // cognos-blu-patch: end
543  }
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.
$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.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ Here is the call graph for this function:

◆ updateTimings()

ilCourseContentGUI::updateTimings ( )

Definition at line 1230 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.

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

◆ updateUserTimings()

ilCourseContentGUI::updateUserTimings ( )

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

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

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

◆ view()

ilCourseContentGUI::view ( )

Output course content.

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

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

Referenced by executeCommand().

276  {
277  // BEGIN ChangeEvent: record read event.
278  require_once('Services/Tracking/classes/class.ilChangeEvent.php');
279  global $DIC;
280 
281  $ilUser = $DIC['ilUser'];
282  $obj_id = ilObject::_lookupObjId($this->container_obj->getRefId());
284  $this->container_obj->getType(),
285  $this->container_obj->getRefId(),
286  $obj_id,
287  $ilUser->getId()
288  );
289  // END ChangeEvent: record read event.
290 
291  $this->getCenterColumnHTML();
292 
293  if (!$this->no_right_column) {
294  $this->tpl->setRightContent($this->getRightColumnHTML());
295  }
296  }
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.
global $DIC
Definition: saml.php:7
getCenterColumnHTML()
Get center column.
static _lookupObjId($a_id)
$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.

◆ $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: