ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilObjectActivation Class Reference

Class ilObjectActivation. More...

+ Inheritance diagram for ilObjectActivation:
+ Collaboration diagram for ilObjectActivation:

Public Member Functions

 __construct ()
 
 setTimingType ($a_type)
 Set timing type. More...
 
 getTimingType ()
 get timing type More...
 
 setTimingStart ($a_start)
 Set timing start. More...
 
 getTimingStart ()
 Get timing start. More...
 
 setTimingEnd ($a_end)
 Set timing end. More...
 
 getTimingEnd ()
 Get timing end. More...
 
 setSuggestionStart ($a_start)
 Set suggestion start. More...
 
 getSuggestionStart ()
 Get suggestion start. More...
 
 getSuggestionStartRelative ()
 
 setSuggestionStartRelative ($a_start)
 
 getSuggestionEndRelative ()
 
 setSuggestionEndRelative ($a_end)
 
 getEaliestStartRelative ()
 
 setEarliestStartRelative ($a_start)
 
 setSuggestionEnd ($a_end)
 Set suggestion end. More...
 
 getSuggestionEnd ()
 Get suggestion end. More...
 
 setEarliestStart ($a_start)
 Set earliest start. More...
 
 getEarliestStart ()
 Get earliest start. More...
 
 toggleVisible ($a_status)
 Set visible status. More...
 
 enabledVisible ()
 Get visible status. More...
 
 toggleChangeable ($a_status)
 Set changeable status. More...
 
 enabledChangeable ()
 Get changeable status. More...
 
 validateActivation ()
 Validate current properties. More...
 
 validateRelativePlaning ()
 
 update ($a_ref_id, $a_parent_id=null)
 Update db entry. More...
 
 read ($a_ref_id, $a_parent_id=0)
 

Static Public Member Functions

static preloadData (array $a_ref_ids)
 Preload data to internal cache. More...
 
static getItem ($a_ref_id)
 Get item data. More...
 
static addAdditionalSubItemInformation (array &$a_item)
 Parse item data for list entries. More...
 
static addListGUIActivationProperty (ilObjectListGUI $a_list_gui, array &$a_item)
 Get timing details for list gui. More...
 
static deleteAllEntries ($a_ref_id)
 Delete all db entries for ref id. More...
 
static cloneDependencies ($a_ref_id, $a_target_id, $a_copy_id)
 Clone dependencies. More...
 
static hasTimings ($a_ref_id)
 Check if there is any active timing (in subtree) More...
 
static hasChangeableTimings ($a_ref_id)
 Check if there is any active changeable timing (in subtree) More...
 
static getItemsByEvent ($a_event_id)
 Get session material / event items. More...
 
static getItemsByItemGroup ($a_item_group_ref_id)
 Get materials of item group. More...
 
static getItemsByObjective ($a_objective_id)
 Get objective items. More...
 
static getItems ($a_parent_id, $a_with_list_data=true)
 Get sub item data. More...
 
static getTimingsAdministrationItems ($a_parent_id)
 Get (sub) item data for timings administration view (active/inactive) More...
 
static getTimingsItems ($a_container_ref_id)
 Get (sub) item data for timings view (no session material, no side blocks) More...
 

Data Fields

const ERR_SUG_START_END = 1
 
const TIMINGS_ACTIVATION = 0
 
const TIMINGS_DEACTIVATED = 1
 
const TIMINGS_PRESETTING = 2
 
const TIMINGS_FIXED = 3
 

Static Protected Member Functions

static createDefaultEntry ($a_ref_id)
 Create db entry with default values. More...
 
static processListItems (array $a_ref_ids)
 Validate ref ids and add list data. More...
 

Protected Attributes

 $error
 
 $lng
 
 $db
 
 $timing_type
 
 $timing_start
 
 $timing_end
 
 $suggestion_start
 
 $suggestion_end
 
 $visible
 
 $changeable
 
 $suggestion_start_rel
 
 $suggestion_end_rel
 

Static Protected Attributes

static $preloaded_data = array()
 

Detailed Description

Class ilObjectActivation.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
Id
class.ilCourseItems.php 30321 2011-08-22 12:05:03Z jluetzen

Definition at line 12 of file class.ilObjectActivation.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjectActivation::__construct ( )

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

References $DIC.

51  {
52  global $DIC;
53 
54  $this->error = $DIC["ilErr"];
55  $this->lng = $DIC->language();
56  $this->db = $DIC->database();
57  }
global $DIC
Definition: saml.php:7

Member Function Documentation

◆ addAdditionalSubItemInformation()

static ilObjectActivation::addAdditionalSubItemInformation ( array &  $a_item)
static

Parse item data for list entries.

Parameters
array&$a_item

Definition at line 383 of file class.ilObjectActivation.php.

References $DIC, $ilUser, $info, ilSessionAppointment\_lookupAppointment(), ilObject\_lookupObjId(), ilObject\_lookupType(), ilTimingUser\getStart(), and IL_CAL_UNIX.

Referenced by ilObjCategory\addAdditionalSubItemInformation(), ilObjRootFolder\addAdditionalSubItemInformation(), ilObjFolder\addAdditionalSubItemInformation(), ilObjGroup\addAdditionalSubItemInformation(), and ilObjCourse\addAdditionalSubItemInformation().

384  {
385  global $DIC;
386 
387  $ilUser = $DIC->user();
388 
389  $item = self::getItem($a_item['ref_id']);
390 
391  $a_item['obj_id'] = ($a_item['obj_id'] > 0)
392  ? $a_item['obj_id']
393  : ilObject::_lookupObjId($a_item['ref_id']);
394  $a_item['type'] = ($a_item['type'] != '')
395  ? $a_item['type']
396  : ilObject::_lookupType($a_item['obj_id']);
397 
398  $a_item['timing_type'] = $item['timing_type'];
399 
400  if ($item['changeable'] &&
401  $item['timing_type'] == self::TIMINGS_PRESETTING) {
402  // cognos-blu-patch: begin
403  include_once './Modules/Course/classes/Timings/class.ilTimingUser.php';
404  $user_data = new ilTimingUser($a_item['ref_id'], $ilUser->getId());
405  if ($user_data->isScheduled()) {
406  $a_item['start'] = $user_data->getStart()->get(IL_CAL_UNIX);
407  $a_item['end'] = $user_data->getEnd()->get(IL_CAL_UNIX);
408  $a_item['activation_info'] = 'crs_timings_planed_info';
409  } else {
410  $a_item['start'] = $item['suggestion_start'];
411  $a_item['end'] = $item['suggestion_end'];
412  $a_item['activation_info'] = 'crs_timings_suggested_info';
413  }
414  // cognos-blu-patch: end
415  } elseif ($item['timing_type'] == self::TIMINGS_PRESETTING) {
416  $a_item['start'] = $item['suggestion_start'];
417  $a_item['end'] = $item['suggestion_end'];
418  $a_item['activation_info'] = 'crs_timings_suggested_info';
419  } elseif ($item['timing_type'] == self::TIMINGS_ACTIVATION) {
420  $a_item['start'] = $item['timing_start'];
421  $a_item['end'] = $item['timing_end'];
422  $a_item['activation_info'] = 'obj_activation_list_gui';
423  } else {
424  $a_item['start'] = 'abc';
425  }
426 
427  // #7359 - session sorting should always base on appointment date
428  if ($a_item['type'] == 'sess') {
429  include_once('./Modules/Session/classes/class.ilSessionAppointment.php');
430  $info = ilSessionAppointment::_lookupAppointment($a_item['obj_id']);
431 
432  // #11987
433  $a_item['masked_start'] = $a_item['start'];
434  $a_item['masked_end'] = $a_item['end'];
435  $a_item['start'] = $info['start'];
436  $a_item['end'] = $info['end'];
437  }
438  }
getStart()
Use to set start date.
global $DIC
Definition: saml.php:7
TableGUI class for timings administration.
const IL_CAL_UNIX
static _lookupObjId($a_id)
$ilUser
Definition: imgupload.php:18
static _lookupType($a_id, $a_reference=false)
lookup object type
static _lookupAppointment($a_obj_id)
lookup appointment
$info
Definition: index.php:5
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addListGUIActivationProperty()

static ilObjectActivation::addListGUIActivationProperty ( ilObjectListGUI  $a_list_gui,
array &  $a_item 
)
static

Get timing details for list gui.

Parameters
ilObjectListGUI$a_list_gui
array&$a_item
Returns
array caption, value

Definition at line 447 of file class.ilObjectActivation.php.

References $DIC, $end, $lng, $start, ilObjectListGUI\addCustomProperty(), ilDatePresentation\formatPeriod(), IL_CAL_UNIX, TIMINGS_ACTIVATION, and TIMINGS_PRESETTING.

Referenced by ilSearchResultTableGUI\fillRow(), ilObjSessionGUI\modifyItemGUI(), ilContainerContentGUI\renderItem(), and ilPDSelectedItemsBlockGUI\setFooterLinks().

448  {
449  global $DIC;
450 
451  $lng = $DIC->language();
452 
453  self::addAdditionalSubItemInformation($a_item);
454  if (isset($a_item['timing_type'])) {
455  if (!isset($a_item['masked_start'])) {
456  $start = $a_item['start'];
457  $end = $a_item['end'];
458  } else {
459  $start = $a_item['masked_start'];
460  $end = $a_item['masked_end'];
461  }
462  $activation = '';
463  switch ($a_item['timing_type']) {
465  $activation = ilDatePresentation::formatPeriod(
468  );
469  break;
470 
472  $activation = ilDatePresentation::formatPeriod(
473  new ilDate($start, IL_CAL_UNIX),
474  new ilDate($end, IL_CAL_UNIX)
475  );
476  break;
477  }
478  if ($activation != "") {
479  global $DIC;
480 
481  $lng = $DIC->language();
482  $lng->loadLanguageModule('crs');
483 
484  $a_list_gui->addCustomProperty(
485  $lng->txt($a_item['activation_info']),
486  $activation,
487  false,
488  true
489  );
490  }
491  }
492  }
global $DIC
Definition: saml.php:7
const IL_CAL_UNIX
$start
Definition: bench.php:8
addCustomProperty( $a_property="", $a_value="", $a_alert=false, $a_newline=false)
add custom property
Class for single dates.
Date and time handling
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cloneDependencies()

static ilObjectActivation::cloneDependencies (   $a_ref_id,
  $a_target_id,
  $a_copy_id 
)
static

Clone dependencies.

Parameters
int$a_ref_id
int$a_target_id
int$a_copy_id

Definition at line 595 of file class.ilObjectActivation.php.

References $DIC, $ilLog, ilCopyWizardOptions\_getInstance(), and ilObjectFactory\getInstanceByRefId().

Referenced by ilObjFolder\cloneDependencies(), ilObjGroup\cloneDependencies(), and ilObjCourse\cloneDependencies().

596  {
597  global $DIC;
598 
599  $ilLog = $DIC["ilLog"];
600 
601  $ilLog->write(__METHOD__ . ': Begin course items...' . $a_ref_id);
602 
603  $items = self::getItems($a_ref_id, false);
604  if (!$items) {
605  $ilLog->write(__METHOD__ . ': No course items found.');
606  return true;
607  }
608 
609  // new course item object
610  if (!is_object($new_container = ilObjectFactory::getInstanceByRefId($a_target_id, false))) {
611  $ilLog->write(__METHOD__ . ': Cannot create target object.');
612  return false;
613  }
614 
615  include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
616  $cp_options = ilCopyWizardOptions::_getInstance($a_copy_id);
617  $mappings = $cp_options->getMappings();
618 
619  foreach ($items as $item) {
620  if (!isset($mappings[$item['parent_id']]) or !$mappings[$item['parent_id']]) {
621  $ilLog->write(__METHOD__ . ': No mapping for parent nr. ' . $item['parent_id']);
622  continue;
623  }
624  if (!isset($mappings[$item['obj_id']]) or !$mappings[$item['obj_id']]) {
625  $ilLog->write(__METHOD__ . ': No mapping for item nr. ' . $item['obj_id']);
626  continue;
627  }
628  $new_item_id = $mappings[$item['obj_id']];
629  $new_parent = $mappings[$item['parent_id']];
630 
631  $new_item = new self();
632  $new_item->setTimingType($item['timing_type']);
633  $new_item->setTimingStart($item['timing_start']);
634  $new_item->setTimingEnd($item['timing_end']);
635  $new_item->setSuggestionStart($item['suggestion_start']);
636  $new_item->setSuggestionEnd($item['suggestion_end']);
637  $new_item->toggleChangeable($item['changeable']);
638  $new_item->toggleVisible($item['visible']);
639  $new_item->update($new_item_id, $new_parent);
640  $new_item->setSuggestionStartRelative($item['suggestion_start_rel']);
641  $new_item->setSuggestionEndRelative($item['suggestion_end_rel']);
642  $new_item->createDefaultEntry($new_item_id);
643  $new_item->update($new_item_id);
644  }
645  }
global $DIC
Definition: saml.php:7
static _getInstance($a_copy_id)
Get instance of copy wizard options.
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:

◆ createDefaultEntry()

static ilObjectActivation::createDefaultEntry (   $a_ref_id)
staticprotected

Create db entry with default values.

Parameters
int$a_ref_id
Returns
array

Definition at line 500 of file class.ilObjectActivation.php.

References $DIC, $ilDB, $query, $tree, ilDBInterface\manipulate(), ilDBInterface\numRows(), ilDBInterface\query(), and ilDBInterface\quote().

501  {
502  global $DIC;
503 
504  $ilDB = $DIC->database();
505  $tree = $DIC->repositoryTree();
506 
507  $parent_id = $tree->getParentId($a_ref_id);
508  if (!$parent_id) {
509  return;
510  }
511 
512 
513  $ilAtomQuery = $ilDB->buildAtomQuery();
514  $ilAtomQuery->addTableLock("crs_items");
515 
516  $ilAtomQuery->addQueryCallable(function (ilDBInterface $ilDB) use ($a_ref_id, $parent_id, &$a_item) {
517  $sql = "SELECT * FROM crs_items" .
518  " WHERE obj_id = " . $ilDB->quote($a_ref_id, "integer");
519  $set = $ilDB->query($sql);
520  if (!$ilDB->numRows($set)) {
521  $now = time();
522  $now_parts = getdate($now);
523 
524  $a_item = array();
525  $a_item["timing_type"] = self::TIMINGS_DEACTIVATED;
526  $a_item["timing_start"] = $now;
527  $a_item["timing_end"] = $now;
528  $a_item["suggestion_start"] = $now;
529  $a_item["suggestion_end"] = $now;
530  $a_item['visible'] = 0;
531  $a_item['changeable'] = 0;
532 
533  $query = "INSERT INTO crs_items (parent_id,obj_id,timing_type,timing_start,timing_end," .
534  "suggestion_start,suggestion_end, " .
535  "changeable,visible,suggestion_start_rel, suggestion_end_rel, position) " .
536  "VALUES( " .
537  $ilDB->quote($parent_id, 'integer') . "," .
538  $ilDB->quote($a_ref_id, 'integer') . "," .
539  $ilDB->quote($a_item["timing_type"], 'integer') . "," .
540  $ilDB->quote($a_item["timing_start"], 'integer') . "," .
541  $ilDB->quote($a_item["timing_end"], 'integer') . "," .
542  $ilDB->quote($a_item["suggestion_start"], 'integer') . "," .
543  $ilDB->quote($a_item["suggestion_end"], 'integer') . "," .
544  $ilDB->quote($a_item["changeable"], 'integer') . "," .
545  $ilDB->quote($a_item["visible"], 'integer') . ", " .
546  $ilDB->quote($a_item["suggestion_start_rel"], 'integer') . "," .
547  $ilDB->quote($a_item['suggestion_end_rel'], 'integer') . ", " .
548  $ilDB->quote(0, 'integer') . ")";
549  $ilDB->manipulate($query);
550  }
551  });
552 
553  $ilAtomQuery->run();
554 
555  // #9982 - to make getItem()-cache work
556  $a_item["obj_id"] = $a_ref_id;
557  $a_item["parent_id"] = $parent_id;
558 
559  return $a_item;
560  }
global $DIC
Definition: saml.php:7
numRows($query_result)
quote($value, $type)
$query
global $ilDB
query($query)
Run a (read-only) Query on the database.
manipulate($query)
Run a (write) Query on the database.
+ Here is the call graph for this function:

◆ deleteAllEntries()

static ilObjectActivation::deleteAllEntries (   $a_ref_id)
static

Delete all db entries for ref id.

Parameters
int$a_ref_id

Definition at line 567 of file class.ilObjectActivation.php.

References $DIC, $ilDB, and $query.

Referenced by ilObject\countReferences(), ilObjChatroom\delete(), and ilObjPoll\doDelete().

568  {
569  global $DIC;
570 
571  $ilDB = $DIC->database();
572 
573  if (!$a_ref_id) {
574  return;
575  }
576 
577  $query = "DELETE FROM crs_items " .
578  "WHERE obj_id = " . $ilDB->quote($a_ref_id, 'integer');
579  $ilDB->manipulate($query);
580 
581  $query = "DELETE FROM crs_items " .
582  "WHERE parent_id = " . $ilDB->quote($a_ref_id, 'integer');
583  $ilDB->manipulate($query);
584 
585  return true;
586  }
global $DIC
Definition: saml.php:7
$query
global $ilDB
+ Here is the caller graph for this function:

◆ enabledChangeable()

ilObjectActivation::enabledChangeable ( )

Get changeable status.

Returns
bool

Definition at line 247 of file class.ilObjectActivation.php.

References $changeable.

Referenced by update().

248  {
249  return (bool) $this->changeable;
250  }
+ Here is the caller graph for this function:

◆ enabledVisible()

ilObjectActivation::enabledVisible ( )

Get visible status.

Returns
bool

Definition at line 227 of file class.ilObjectActivation.php.

References $visible.

Referenced by update().

228  {
229  return (bool) $this->visible;
230  }
+ Here is the caller graph for this function:

◆ getEaliestStartRelative()

ilObjectActivation::getEaliestStartRelative ( )

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

162  {
163  return $this->earliest_start_rel;
164  }

◆ getEarliestStart()

ilObjectActivation::getEarliestStart ( )

Get earliest start.

Returns
int

Definition at line 206 of file class.ilObjectActivation.php.

207  {
208  return $this->earliest_start;
209  }

◆ getItem()

static ilObjectActivation::getItem (   $a_ref_id)
static

Get item data.

Parameters
int$a_ref_id
Returns
array

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

References $DIC, $ilDB, and $row.

Referenced by ilObjectXMLWriter\__appendTimeTargets(), ilObjCourse\__readSettings(), ilTimingCache\_getTimings(), ilObjPollAccess\_isActivated(), ilObjCourseAccess\_isActivated(), ilObjSurvey\checkReminder(), ilAccess\doPathCheck(), ilObjPortfolioTemplate\doRead(), ilObjPoll\doRead(), ilTimingsUser\handleNewMembership(), ilObjChatroomAccess\isActivated(), ilObjSurvey\loadFromDb(), ilObjTest\loadFromDb(), ilCalendarScheduleFilterTimings\modifyEvent(), ilObjChatroom\read(), ilTimingCache\readObjectInformation(), ilObjSurvey\saveToDb(), ilObjTest\saveToDb(), ilObjPortfolioTemplate\updateActivation(), ilSoapObjectAdministration\updateReferences(), ilObjCourse\updateSettings(), ilCourseContentGUI\updateTimings(), ilTimingPlaned\validate(), and ilContainerXmlWriter\writeCourseItemInformation().

355  {
356  global $DIC;
357 
358  $ilDB = $DIC->database();
359 
360  if (isset(self::$preloaded_data[$a_ref_id])) {
361  return self::$preloaded_data[$a_ref_id];
362  }
363 
364  $sql = "SELECT * FROM crs_items" .
365  " WHERE obj_id = " . $ilDB->quote($a_ref_id, "integer");
366  $set = $ilDB->query($sql);
367  $row = $ilDB->fetchAssoc($set);
368 
369  if (!isset($row["obj_id"])) {
370  $row = self::createDefaultEntry($a_ref_id);
371  }
372  if ($row["obj_id"]) {
373  self::$preloaded_data[$row["obj_id"]] = $row;
374  }
375  return $row;
376  }
global $DIC
Definition: saml.php:7
$row
global $ilDB
+ Here is the caller graph for this function:

◆ getItems()

static ilObjectActivation::getItems (   $a_parent_id,
  $a_with_list_data = true 
)
static

Get sub item data.

Parameters
int$a_parent_id
bool$a_with_list_data
Returns
array

Definition at line 789 of file class.ilObjectActivation.php.

References $DIC, and $tree.

Referenced by ilCourseStart\getPossibleStarters(), ilContainerStartObjects\getPossibleStarters(), ilCourseContentGUI\managePersonalTimings(), and ilCourseContentGUI\setColumnSettings().

790  {
791  global $DIC;
792 
793  $tree = $DIC->repositoryTree();
794 
795  $items = array();
796 
797  $ref_ids = array();
798  foreach ($tree->getChilds($a_parent_id) as $item) {
799  if ($item['type'] != 'rolf') {
800  $items[] = $item;
801  $ref_ids[] = $item['ref_id'];
802  }
803  }
804 
805  if ($ref_ids) {
806  self::preloadData($ref_ids);
807 
808  foreach ($items as $idx => $item) {
809  if (!$a_with_list_data) {
810  $items[$idx] = array_merge($item, self::getItem($item['ref_id']));
811  } else {
812  self::addAdditionalSubItemInformation($item);
813  $items[$idx] = $item;
814  }
815  }
816  }
817  return $items;
818  }
global $DIC
Definition: saml.php:7
+ Here is the caller graph for this function:

◆ getItemsByEvent()

static ilObjectActivation::getItemsByEvent (   $a_event_id)
static

Get session material / event items.

Parameters
int$a_event_id(object id)
Returns
array

Definition at line 748 of file class.ilObjectActivation.php.

Referenced by ilAppointmentSessionFileHandler\getFiles(), ilObjSessionGUI\infoScreen(), ilContainerGUI\redrawListItemObject(), and ilContainerContentGUI\renderItem().

749  {
750  include_once 'Modules/Session/classes/class.ilEventItems.php';
751  $event_items = new ilEventItems($a_event_id);
752  return self::processListItems($event_items->getItems());
753  }
class ilEvent
+ Here is the caller graph for this function:

◆ getItemsByItemGroup()

static ilObjectActivation::getItemsByItemGroup (   $a_item_group_ref_id)
static

Get materials of item group.

Parameters
int$a_item_group_id(object id)
Returns
array

Definition at line 761 of file class.ilObjectActivation.php.

Referenced by ilContainerContentGUI\renderItemGroup(), and ilRepositoryExplorerGUI\sortChilds().

762  {
763  include_once 'Modules/ItemGroup/classes/class.ilItemGroupItems.php';
764  $ig_items = new ilItemGroupItems($a_item_group_ref_id);
765  $items = $ig_items->getValidItems();
766  return self::processListItems($items);
767  }
Item group items.
+ Here is the caller graph for this function:

◆ getItemsByObjective()

static ilObjectActivation::getItemsByObjective (   $a_objective_id)
static

Get objective items.

Parameters
int$a_objective_id
Returns
array

Definition at line 775 of file class.ilObjectActivation.php.

References ilCourseObjectiveMaterials\_getAssignedMaterials().

Referenced by ilContainerObjectiveGUI\renderObjective().

776  {
777  include_once('./Modules/Course/classes/class.ilCourseObjectiveMaterials.php');
778  $item_ids = ilCourseObjectiveMaterials::_getAssignedMaterials($a_objective_id);
779  return self::processListItems($item_ids);
780  }
static _getAssignedMaterials($a_objective_id)
get assigned materials
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSuggestionEnd()

ilObjectActivation::getSuggestionEnd ( )

Get suggestion end.

Returns
int

Definition at line 186 of file class.ilObjectActivation.php.

References $suggestion_end.

Referenced by update(), and validateActivation().

187  {
188  return $this->suggestion_end;
189  }
+ Here is the caller graph for this function:

◆ getSuggestionEndRelative()

ilObjectActivation::getSuggestionEndRelative ( )

Definition at line 151 of file class.ilObjectActivation.php.

References $suggestion_end_rel.

Referenced by update(), and validateRelativePlaning().

152  {
154  }
+ Here is the caller graph for this function:

◆ getSuggestionStart()

ilObjectActivation::getSuggestionStart ( )

Get suggestion start.

Returns
timestamp

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

References $suggestion_start.

Referenced by update(), and validateActivation().

137  {
139  }
+ Here is the caller graph for this function:

◆ getSuggestionStartRelative()

ilObjectActivation::getSuggestionStartRelative ( )

Definition at line 141 of file class.ilObjectActivation.php.

References $suggestion_start_rel.

Referenced by update(), and validateRelativePlaning().

+ Here is the caller graph for this function:

◆ getTimingEnd()

ilObjectActivation::getTimingEnd ( )

Get timing end.

Returns
timestamp

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

References $timing_end.

Referenced by update(), and validateActivation().

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

◆ getTimingsAdministrationItems()

static ilObjectActivation::getTimingsAdministrationItems (   $a_parent_id)
static

Get (sub) item data for timings administration view (active/inactive)

Parameters
int$a_parent_id
Returns
array

Definition at line 826 of file class.ilObjectActivation.php.

References ilUtil\sortArray().

Referenced by ilCourseContentGUI\__renderUserItem(), ilCourseContentGUI\editTimings(), ilCourseContentGUI\manageTimings(), and ilCourseContentGUI\showUserTimings().

827  {
828  $items = self::getItems($a_parent_id, false);
829 
830  if ($items) {
831  $active = $inactive = array();
832  foreach ($items as $item) {
833  // active should be first in order
834  if ($item['timing_type'] == self::TIMINGS_DEACTIVATED) {
835  $inactive[] = $item;
836  } else {
837  $active[] = $item;
838  }
839  }
840 
841  $active = ilUtil::sortArray($active, 'start', 'asc');
842  $inactive = ilUtil::sortArray($inactive, 'title', 'asc');
843  $items = array_merge($active, $inactive);
844  }
845 
846  return $items;
847  }
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTimingsItems()

static ilObjectActivation::getTimingsItems (   $a_container_ref_id)
static

Get (sub) item data for timings view (no session material, no side blocks)

Parameters
int$a_container_ref_id
Returns
array

Definition at line 855 of file class.ilObjectActivation.php.

References $DIC, and ilEventItems\_getItemsOfContainer().

Referenced by ilCourseContentGUI\__editAdvancedUserTimings(), ilCourseContentGUI\__editUserTimings(), ilCourseContentGUI\__renderItem(), ilCalendarScheduleFilterTimings\addCustomEvents(), and ilObjCourse\prepareAppointments().

856  {
857  global $DIC;
858 
859  $objDefinition = $DIC["objDefinition"];
860 
861  $filtered = array();
862 
863  include_once 'Modules/Session/classes/class.ilEventItems.php';
864  $event_items = ilEventItems::_getItemsOfContainer($a_container_ref_id);
865  foreach (self::getTimingsAdministrationItems($a_container_ref_id) as $item) {
866  if (!in_array($item['ref_id'], $event_items) &&
867  !$objDefinition->isSideBlock($item['type'])) {
868  $filtered[] = $item;
869  }
870  }
871 
872  return $filtered;
873  }
global $DIC
Definition: saml.php:7
static _getItemsOfContainer($a_ref_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTimingStart()

ilObjectActivation::getTimingStart ( )

Get timing start.

Returns
timestamp

Definition at line 96 of file class.ilObjectActivation.php.

References $timing_start.

Referenced by update(), and validateActivation().

+ Here is the caller graph for this function:

◆ getTimingType()

ilObjectActivation::getTimingType ( )

get timing type

See also
class constants
Returns
int

Definition at line 76 of file class.ilObjectActivation.php.

References $timing_type.

Referenced by update(), and validateActivation().

+ Here is the caller graph for this function:

◆ hasChangeableTimings()

static ilObjectActivation::hasChangeableTimings (   $a_ref_id)
static

Check if there is any active changeable timing (in subtree)

Parameters
intref_id
Returns
bool

Definition at line 684 of file class.ilObjectActivation.php.

References $DIC, $ilDB, $query, $res, and $tree.

Referenced by ilCourseContentGUI\__renderUserItem(), ilCourseContentGUI\editUserTimings(), and ilCourseContentGUI\showUserTimings().

685  {
686  global $DIC;
687 
688  $tree = $DIC->repositoryTree();
689  $ilDB = $DIC->database();
690 
691  $subtree = $tree->getSubTree($tree->getNodeData($a_ref_id));
692  $ref_ids = array();
693  foreach ($subtree as $node) {
694  $ref_ids[] = $node['ref_id'];
695  }
696 
697  $query = "SELECT * FROM crs_items " .
698  "WHERE timing_type = " . $ilDB->quote(self::TIMINGS_PRESETTING, 'integer') . " " .
699  "AND changeable = " . $ilDB->quote(1, 'integer') . " " .
700  "AND " . $ilDB->in('obj_id', $ref_ids, false, 'integer');
701  $res = $ilDB->query($query);
702  return $res->numRows() ? true : false;
703  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the caller graph for this function:

◆ hasTimings()

static ilObjectActivation::hasTimings (   $a_ref_id)
static

Check if there is any active timing (in subtree)

Parameters
intref_id
Returns
bool

Definition at line 658 of file class.ilObjectActivation.php.

References $DIC, $ilDB, $query, $res, and $tree.

Referenced by ilCourseMembershipGUI\initParticipantTableGUI().

659  {
660  global $DIC;
661 
662  $tree = $DIC->repositoryTree();
663  $ilDB = $DIC->database();
664 
665  $subtree = $tree->getSubTree($tree->getNodeData($a_ref_id));
666  $ref_ids = array();
667  foreach ($subtree as $node) {
668  $ref_ids[] = $node['ref_id'];
669  }
670 
671  $query = "SELECT * FROM crs_items " .
672  "WHERE timing_type = " . $ilDB->quote(self::TIMINGS_PRESETTING, 'integer') . " " .
673  "AND " . $ilDB->in('obj_id', $ref_ids, false, 'integer');
674  $res = $ilDB->query($query);
675  return $res->numRows() ? true :false;
676  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the caller graph for this function:

◆ preloadData()

static ilObjectActivation::preloadData ( array  $a_ref_ids)
static

Preload data to internal cache.

Parameters
array$a_ref_ids

Definition at line 334 of file class.ilObjectActivation.php.

References $DIC, $ilDB, and $row.

Referenced by ilNewsItem\getAggregatedNewsData(), ilTimingsUser\init(), and ilObjectListGUIPreloader\preload().

335  {
336  global $DIC;
337 
338  $ilDB = $DIC->database();
339 
340  $sql = "SELECT * FROM crs_items" .
341  " WHERE " . $ilDB->in("obj_id", $a_ref_ids, "", "integer");
342  $set = $ilDB->query($sql);
343  while ($row = $ilDB->fetchAssoc($set)) {
344  self::$preloaded_data[$row["obj_id"]] = $row;
345  }
346  }
global $DIC
Definition: saml.php:7
$row
global $ilDB
+ Here is the caller graph for this function:

◆ processListItems()

static ilObjectActivation::processListItems ( array  $a_ref_ids)
staticprotected

Validate ref ids and add list data.

Parameters
array$a_ref_ids
Returns
array

Definition at line 711 of file class.ilObjectActivation.php.

References $DIC, $res, and $tree.

712  {
713  global $DIC;
714 
715  $tree = $DIC->repositoryTree();
716 
717  $res = array();
718 
719  foreach ($a_ref_ids as $item_ref_id) {
720  if ($tree->isDeleted($item_ref_id)) {
721  continue;
722  }
723  // #7571: when node is removed from system, e.g. inactive trashcan, an empty array is returned
724  $node = $tree->getNodeData($item_ref_id);
725  if ($node["ref_id"] != $item_ref_id) {
726  continue;
727  }
728  $res[$item_ref_id] = $node;
729  }
730 
731  if (sizeof($res)) {
732  self::preloadData(array_keys($res));
733  foreach ($res as $idx => $item) {
734  self::addAdditionalSubItemInformation($item);
735  $res[$idx] = $item;
736  }
737  }
738 
739  return array_values($res);
740  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res

◆ read()

ilObjectActivation::read (   $a_ref_id,
  $a_parent_id = 0 
)
Parameters
$a_ref_id
int$a_parent_id
Exceptions
ilDatabaseException

Definition at line 880 of file class.ilObjectActivation.php.

References $DIC, $ilDB, $query, $res, $row, ilDBConstants\FETCHMODE_OBJECT, setSuggestionEnd(), setSuggestionEndRelative(), setSuggestionStart(), setSuggestionStartRelative(), setTimingEnd(), setTimingStart(), setTimingType(), toggleChangeable(), and toggleVisible().

881  {
882  global $DIC;
883  $ilDB = $DIC->database();
884 
885  $query = 'SELECT * FROM crs_items ' .
886  'WHERE obj_id = ' . $ilDB->quote($a_ref_id, 'integer') . ' ';
887 
888  if ($a_parent_id) {
889  $query .= ('AND parent_id = ' . $ilDB->quote($a_parent_id, 'integer') . ' ');
890  }
891  $res = $ilDB->query($query);
892  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
893  $this->setSuggestionStart($row->suggestion_start);
894  $this->setSuggestionEnd($row->suggestion_end);
895  $this->setSuggestionStartRelative($row->suggestion_start_rel);
896  $this->setSuggestionEndRelative($row->suggestion_end_rel);
897  $this->toggleVisible($row->visible);
898  $this->toggleChangeable($row->changeable);
899  $this->setTimingType($row->timing_type);
900  $this->setTimingStart($row->timing_start);
901  $this->setTimingEnd($row->timing_end);
902  }
903  }
setTimingStart($a_start)
Set timing start.
global $DIC
Definition: saml.php:7
toggleVisible($a_status)
Set visible status.
foreach($_POST as $key=> $value) $res
setTimingEnd($a_end)
Set timing end.
$query
setSuggestionStart($a_start)
Set suggestion start.
setTimingType($a_type)
Set timing type.
$row
toggleChangeable($a_status)
Set changeable status.
global $ilDB
setSuggestionEnd($a_end)
Set suggestion end.
+ Here is the call graph for this function:

◆ setEarliestStart()

ilObjectActivation::setEarliestStart (   $a_start)

Set earliest start.

Parameters
int$a_start

Definition at line 196 of file class.ilObjectActivation.php.

197  {
198  $this->earliest_start = $a_start;
199  }

◆ setEarliestStartRelative()

ilObjectActivation::setEarliestStartRelative (   $a_start)

Definition at line 166 of file class.ilObjectActivation.php.

167  {
168  $this->earliest_start_rel = $a_start;
169  }

◆ setSuggestionEnd()

ilObjectActivation::setSuggestionEnd (   $a_end)

Set suggestion end.

Parameters
int$a_end

Definition at line 176 of file class.ilObjectActivation.php.

Referenced by read().

177  {
178  $this->suggestion_end = $a_end;
179  }
+ Here is the caller graph for this function:

◆ setSuggestionEndRelative()

ilObjectActivation::setSuggestionEndRelative (   $a_end)

Definition at line 156 of file class.ilObjectActivation.php.

Referenced by read().

157  {
158  $this->suggestion_end_rel = $a_end;
159  }
+ Here is the caller graph for this function:

◆ setSuggestionStart()

ilObjectActivation::setSuggestionStart (   $a_start)

Set suggestion start.

Parameters
timestamp$a_start

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

Referenced by read().

127  {
128  $this->suggestion_start = $a_start;
129  }
+ Here is the caller graph for this function:

◆ setSuggestionStartRelative()

ilObjectActivation::setSuggestionStartRelative (   $a_start)

Definition at line 146 of file class.ilObjectActivation.php.

Referenced by read().

147  {
148  $this->suggestion_start_rel = $a_start;
149  }
+ Here is the caller graph for this function:

◆ setTimingEnd()

ilObjectActivation::setTimingEnd (   $a_end)

Set timing end.

Parameters
timestamp$a_end

Definition at line 106 of file class.ilObjectActivation.php.

Referenced by read().

107  {
108  $this->timing_end = $a_end;
109  }
+ Here is the caller graph for this function:

◆ setTimingStart()

ilObjectActivation::setTimingStart (   $a_start)

Set timing start.

Parameters
timestamp$a_start

Definition at line 86 of file class.ilObjectActivation.php.

Referenced by read().

87  {
88  $this->timing_start = $a_start;
89  }
+ Here is the caller graph for this function:

◆ setTimingType()

ilObjectActivation::setTimingType (   $a_type)

Set timing type.

See also
class constants
Parameters
int$a_type

Definition at line 65 of file class.ilObjectActivation.php.

References $a_type.

Referenced by read(), ilObjSurvey\saveToDb(), ilObjTest\saveToDb(), ilObjPortfolioTemplate\updateActivation(), and ilObjCourse\updateSettings().

66  {
67  $this->timing_type = $a_type;
68  }
$a_type
Definition: workflow.php:92
+ Here is the caller graph for this function:

◆ toggleChangeable()

ilObjectActivation::toggleChangeable (   $a_status)

Set changeable status.

Parameters
bool$a_status

Definition at line 237 of file class.ilObjectActivation.php.

Referenced by read().

238  {
239  $this->changeable = (int) $a_status;
240  }
+ Here is the caller graph for this function:

◆ toggleVisible()

ilObjectActivation::toggleVisible (   $a_status)

Set visible status.

Parameters
bool$a_status

Definition at line 217 of file class.ilObjectActivation.php.

Referenced by read().

218  {
219  $this->visible = (int) $a_status;
220  }
+ Here is the caller graph for this function:

◆ update()

ilObjectActivation::update (   $a_ref_id,
  $a_parent_id = null 
)

Update db entry.

Parameters
int$a_ref_id
int$a_parent_id

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

References $db, $ilDB, $query, enabledChangeable(), enabledVisible(), getSuggestionEnd(), getSuggestionEndRelative(), getSuggestionStart(), getSuggestionStartRelative(), getTimingEnd(), getTimingStart(), and getTimingType().

302  {
303  $ilDB = $this->db;
304 
305  // #10110
306  $query = "UPDATE crs_items SET " .
307  "timing_type = " . $ilDB->quote($this->getTimingType(), 'integer') . ", " .
308  "timing_start = " . $ilDB->quote((int) $this->getTimingStart(), 'integer') . ", " .
309  "timing_end = " . $ilDB->quote((int) $this->getTimingEnd(), 'integer') . ", " .
310  "suggestion_start = " . $ilDB->quote((int) $this->getSuggestionStart(), 'integer') . ", " .
311  "suggestion_end = " . $ilDB->quote((int) $this->getSuggestionEnd(), 'integer') . ", " .
312  "changeable = " . $ilDB->quote($this->enabledChangeable(), 'integer') . ", " .
313  'suggestion_start_rel = ' . $ilDB->quote($this->getSuggestionStartRelative(), 'integer') . ', ' .
314  'suggestion_end_rel = ' . $ilDB->quote($this->getSuggestionEndRelative(), 'integer') . ', ';
315 
316  if ($a_parent_id) {
317  $query .= "parent_id = " . $ilDB->quote($a_parent_id, 'integer') . ", ";
318  }
319 
320  $query .= "visible = " . $ilDB->quote($this->enabledVisible(), 'integer') . " " .
321  "WHERE obj_id = " . $ilDB->quote($a_ref_id, 'integer');
322  $ilDB->manipulate($query);
323 
324  unset(self::$preloaded_data[$a_ref_id]);
325 
326  return true;
327  }
getTimingEnd()
Get timing end.
enabledVisible()
Get visible status.
getSuggestionEnd()
Get suggestion end.
getTimingStart()
Get timing start.
$query
getTimingType()
get timing type
getSuggestionStart()
Get suggestion start.
enabledChangeable()
Get changeable status.
global $ilDB
+ Here is the call graph for this function:

◆ validateActivation()

ilObjectActivation::validateActivation ( )

Validate current properties.

Returns
boolean

Definition at line 257 of file class.ilObjectActivation.php.

References $error, $ilErr, $lng, getSuggestionEnd(), getSuggestionStart(), getTimingEnd(), getTimingStart(), and getTimingType().

258  {
260  $lng = $this->lng;
261 
262  $ilErr->setMessage('');
263 
264  if ($this->getTimingType() == self::TIMINGS_ACTIVATION) {
265  if ($this->getTimingStart() > $this->getTimingEnd()) {
266  $ilErr->appendMessage($lng->txt("crs_activation_start_invalid"));
267  }
268  } elseif ($this->getTimingType() == self::TIMINGS_PRESETTING) {
269  if ($this->getSuggestionStart() > $this->getSuggestionEnd()) {
270  $ilErr->appendMessage($lng->txt('crs_timing_err_sug_start_end'));
271  }
272  }
273 
274  if ($ilErr->getMessage()) {
275  return false;
276  }
277  return true;
278  }
getTimingEnd()
Get timing end.
$ilErr
Definition: raiseError.php:18
getSuggestionEnd()
Get suggestion end.
getTimingStart()
Get timing start.
getTimingType()
get timing type
getSuggestionStart()
Get suggestion start.
+ Here is the call graph for this function:

◆ validateRelativePlaning()

ilObjectActivation::validateRelativePlaning ( )
Returns
array

Definition at line 283 of file class.ilObjectActivation.php.

References $errors, getSuggestionEndRelative(), and getSuggestionStartRelative().

284  {
285  $errors = array();
286 
287  if ($this->getSuggestionStartRelative() >= $this->getSuggestionEndRelative()) {
288  $errors[] = self::ERR_SUG_START_END;
289  } elseif ($this->getSuggestionStartRelative() < 0) {
290  $errors[] = self::ERR_SUG_START_END;
291  }
292  return $errors;
293  }
$errors
Definition: index.php:6
+ Here is the call graph for this function:

Field Documentation

◆ $changeable

ilObjectActivation::$changeable
protected

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

Referenced by enabledChangeable().

◆ $db

ilObjectActivation::$db
protected

Definition at line 30 of file class.ilObjectActivation.php.

Referenced by update().

◆ $error

ilObjectActivation::$error
protected

Definition at line 20 of file class.ilObjectActivation.php.

Referenced by validateActivation().

◆ $lng

ilObjectActivation::$lng
protected

◆ $preloaded_data

ilObjectActivation::$preloaded_data = array()
staticprotected

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

◆ $suggestion_end

ilObjectActivation::$suggestion_end
protected

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

Referenced by getSuggestionEnd().

◆ $suggestion_end_rel

ilObjectActivation::$suggestion_end_rel
protected

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

Referenced by getSuggestionEndRelative().

◆ $suggestion_start

ilObjectActivation::$suggestion_start
protected

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

Referenced by getSuggestionStart().

◆ $suggestion_start_rel

ilObjectActivation::$suggestion_start_rel
protected

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

Referenced by getSuggestionStartRelative().

◆ $timing_end

ilObjectActivation::$timing_end
protected

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

Referenced by getTimingEnd().

◆ $timing_start

ilObjectActivation::$timing_start
protected

Definition at line 33 of file class.ilObjectActivation.php.

Referenced by getTimingStart().

◆ $timing_type

ilObjectActivation::$timing_type
protected

Definition at line 32 of file class.ilObjectActivation.php.

Referenced by getTimingType().

◆ $visible

ilObjectActivation::$visible
protected

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

Referenced by enabledVisible().

◆ ERR_SUG_START_END

const ilObjectActivation::ERR_SUG_START_END = 1

Definition at line 14 of file class.ilObjectActivation.php.

◆ TIMINGS_ACTIVATION

◆ TIMINGS_DEACTIVATED

◆ TIMINGS_FIXED

const ilObjectActivation::TIMINGS_FIXED = 3

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

◆ TIMINGS_PRESETTING


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