ILIAS  release_7 Revision v7.30-3-g800a261c036
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.

51 {
52 global $DIC;
53
54 $this->error = $DIC["ilErr"];
55 $this->lng = $DIC->language();
56 $this->db = $DIC->database();
57 }
error($a_errmsg)
set error message @access public
global $DIC
Definition: goto.php:24

References $DIC, and error().

+ Here is the call graph for this function:

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.

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 }
const IL_CAL_UNIX
static getItem($a_ref_id)
Get item data.
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
static _lookupAppointment($a_obj_id)
lookup appointment
TableGUI class for timings administration.
$ilUser
Definition: imgupload.php:18

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

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

+ 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.

448 {
449 global $DIC;
450
451 $lng = $DIC->language();
452
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']) {
466 new ilDateTime($start, IL_CAL_UNIX),
467 new ilDateTime($end, IL_CAL_UNIX)
468 );
469 break;
470
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 }
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
@classDescription Date and time handling
Class for single dates.
static addAdditionalSubItemInformation(array &$a_item)
Parse item data for list entries.
addCustomProperty( $a_property="", $a_value="", $a_alert=false, $a_newline=false)
add custom property

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

Referenced by ilSearchResultTableGUI\fillRow(), ilPDObjectsTileRenderer\getCard(), ilPDSelectedItemsBlockGUI\getCardForData(), ilPDSelectedItemsBlockGUI\getListItemForData(), ilObjSessionGUI\modifyItemGUI(), ilPDObjectsListRenderer\render(), and ilContainerContentGUI\renderItem().

+ 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.

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 }
static _getInstance($a_copy_id)
Get instance of copy wizard options.
static getItems($a_parent_id, $a_with_list_data=true)
Get sub item data.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id

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

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

+ 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.

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 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $ilDB

References $DIC, and $ilDB.

Referenced by getItem().

+ Here is the caller 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.

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 }
$query

References $DIC, $ilDB, and $query.

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

+ 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.

248 {
249 return (bool) $this->changeable;
250 }

References $changeable.

Referenced by update().

+ 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.

228 {
229 return (bool) $this->visible;
230 }

References $visible.

Referenced by update().

+ 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.

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 }
static createDefaultEntry($a_ref_id)
Create db entry with default values.

References $DIC, $ilDB, and createDefaultEntry().

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

+ Here is the call graph for this function:
+ 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.

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 {
813 $items[$idx] = $item;
814 }
815 }
816 }
817 return $items;
818 }
static preloadData(array $a_ref_ids)
Preload data to internal cache.

References $DIC, addAdditionalSubItemInformation(), and preloadData().

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

+ Here is the call graph for this function:
+ 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.

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
static processListItems(array $a_ref_ids)
Validate ref ids and add list data.

References processListItems().

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

+ Here is the call graph for this function:
+ 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.

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 }

References processListItems().

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

+ Here is the call graph for this function:
+ 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.

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

References ilCourseObjectiveMaterials\_getAssignedMaterials(), and processListItems().

Referenced by ilContainerObjectiveGUI\renderObjective().

+ 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().

+ 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().

+ 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().

+ 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().

+ 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.

827 {
828 $items = self::getItems($a_parent_id, false);
829 $active = $availability = $inactive = [];
830 foreach ($items as $item) {
831 if ($item['timing_type'] == self::TIMINGS_DEACTIVATED) {
832 $inactive[] = $item;
833 } elseif ($item['timing_type'] == self::TIMINGS_ACTIVATION) {
834 $availability[] = $item;
835 } else {
836 $active[] = $item;
837 }
838 }
839 $active = \ilUtil::sortArray($active, 'suggestion_start', 'asc');
840 $availability = \ilUtil::sortArray($availability, 'timing_start', 'asc');
841 $inactive = \ilUtil::sortArray($inactive, 'title', 'asc');
842
843 $items = array_merge($active, $availability, $inactive);
844 return $items;
845 }
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray

References getItems(), and ilUtil\sortArray().

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

+ 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 853 of file class.ilObjectActivation.php.

854 {
855 global $DIC;
856
857 $objDefinition = $DIC["objDefinition"];
858
859 $filtered = array();
860
861 include_once 'Modules/Session/classes/class.ilEventItems.php';
862 $event_items = ilEventItems::_getItemsOfContainer($a_container_ref_id);
863 foreach (self::getTimingsAdministrationItems($a_container_ref_id) as $item) {
864 if (!in_array($item['ref_id'], $event_items) &&
865 !$objDefinition->isSideBlock($item['type'])) {
866 $filtered[] = $item;
867 }
868 }
869
870 return $filtered;
871 }
static _getItemsOfContainer($a_ref_id)

References $DIC, and ilEventItems\_getItemsOfContainer().

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

+ 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.

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 }
return true
Flag indicating whether or not HTTP headers will be sent when outputting captcha image/audio.
foreach($_POST as $key=> $value) $res

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

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

+ 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.

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 }

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

Referenced by ilCourseMembershipGUI\initParticipantTableGUI().

+ 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.

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 }

References $DIC, and $ilDB.

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

+ 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.

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) {
735 $res[$idx] = $item;
736 }
737 }
738
739 return array_values($res);
740 }

References $DIC, $res, addAdditionalSubItemInformation(), and preloadData().

Referenced by getItemsByEvent(), getItemsByItemGroup(), and getItemsByObjective().

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

◆ read()

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

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

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

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

+ 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.

177 {
178 $this->suggestion_end = $a_end;
179 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setSuggestionEndRelative()

ilObjectActivation::setSuggestionEndRelative (   $a_end)

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

157 {
158 $this->suggestion_end_rel = $a_end;
159 }

Referenced by read().

+ 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.

127 {
128 $this->suggestion_start = $a_start;
129 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setSuggestionStartRelative()

ilObjectActivation::setSuggestionStartRelative (   $a_start)

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

147 {
148 $this->suggestion_start_rel = $a_start;
149 }

Referenced by read().

+ 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.

107 {
108 $this->timing_end = $a_end;
109 }

Referenced by read().

+ 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.

87 {
88 $this->timing_start = $a_start;
89 }

Referenced by read().

+ 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.

66 {
67 $this->timing_type = $a_type;
68 }

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

+ 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.

238 {
239 $this->changeable = (int) $a_status;
240 }

Referenced by read().

+ 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.

218 {
219 $this->visible = (int) $a_status;
220 }

Referenced by read().

+ 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.

302 {
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 }
getTimingStart()
Get timing start.
enabledVisible()
Get visible status.
getTimingType()
get timing type
enabledChangeable()
Get changeable status.
getSuggestionStart()
Get suggestion start.
getSuggestionEnd()
Get suggestion end.

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

+ 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.

258 {
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 }
$ilErr
Definition: raiseError.php:18

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

+ Here is the call graph for this function:

◆ validateRelativePlaning()

ilObjectActivation::validateRelativePlaning ( )
Returns
array

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

284 {
285 $errors = array();
286
287 if ($this->getSuggestionStartRelative() >= $this->getSuggestionEndRelative()) {
289 } elseif ($this->getSuggestionStartRelative() < 0) {
291 }
292 return $errors;
293 }
$errors
Definition: imgupload.php:49

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

+ 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.

Referenced by validateRelativePlaning().

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