ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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...
 
 setSuggestionEnd ($a_end)
 Set suggestion end. More...
 
 getSuggestionEnd ()
 Get suggestion end. More...
 
 setEarliestStart ($a_start)
 Set earliest start. More...
 
 getEarliestStart ()
 Get earliest start. More...
 
 setLatestEnd ($a_end)
 Set latest end. More...
 
 getLatestEnd ()
 Get latest end. 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...
 
 update ($a_ref_id, $a_parent_id=null)
 Update db entry. More...
 

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

 $timing_type
 
 $timing_start
 
 $timing_end
 
 $suggestion_start
 
 $suggestion_end
 
 $earliest_start
 
 $latest_end
 
 $visible
 
 $changeable
 

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

32 {
33
34 }

Member Function Documentation

◆ addAdditionalSubItemInformation()

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

Parse item data for list entries.

Parameters
array&$a_item

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

341 {
342 global $ilUser;
343
344 $item = self::getItem($a_item['ref_id']);
345
346 $a_item['obj_id'] = ($a_item['obj_id'] > 0)
347 ? $a_item['obj_id']
348 : ilObject::_lookupObjId($a_item['ref_id']);
349 $a_item['type'] = ($a_item['type'] != '')
350 ? $a_item['type']
351 : ilObject::_lookupType($a_item['obj_id']);
352
353 $a_item['timing_type'] = $item['timing_type'];
354
355 if($item['changeable'] &&
356 $item['timing_type'] == self::TIMINGS_PRESETTING)
357 {
358 include_once 'Modules/Course/classes/Timings/class.ilTimingPlaned.php';
359 $user_data = ilTimingPlaned::_getPlanedTimings($ilUser->getId(), $a_item['ref_id']);
360 if($user_data['planed_start'])
361 {
362 $a_item['start'] = $user_data['planed_start'];
363 $a_item['end'] = $user_data['planed_end'];
364 $a_item['activation_info'] = 'crs_timings_planed_info';
365 }
366 else
367 {
368 $a_item['start'] = $item['suggestion_start'];
369 $a_item['end'] = $item['suggestion_end'];
370 $a_item['activation_info'] = 'crs_timings_suggested_info';
371 }
372 }
373 elseif($item['timing_type'] == self::TIMINGS_PRESETTING)
374 {
375 $a_item['start'] = $item['suggestion_start'];
376 $a_item['end'] = $item['suggestion_end'];
377 $a_item['activation_info'] = 'crs_timings_suggested_info';
378 }
379 elseif($item['timing_type'] == self::TIMINGS_ACTIVATION)
380 {
381 $a_item['start'] = $item['timing_start'];
382 $a_item['end'] = $item['timing_end'];
383 $a_item['activation_info'] = 'obj_activation_list_gui';
384 }
385 else
386 {
387 $a_item['start'] = 'abc';
388 }
389
390 // #7359 - session sorting should always base on appointment date
391 if($a_item['type'] == 'sess')
392 {
393 include_once('./Modules/Session/classes/class.ilSessionAppointment.php');
395
396 // #11987
397 $a_item['masked_start'] = $a_item['start'];
398 $a_item['masked_end'] = $a_item['end'];
399 $a_item['start'] = $info['start'];
400 $a_item['end'] = $info['end'];
401 }
402 }
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
static _getPlanedTimings($a_usr_id, $a_item_id)
$info
Definition: example_052.php:80
$ilUser
Definition: imgupload.php:18

References $ilUser, $info, ilTimingPlaned\_getPlanedTimings(), ilSessionAppointment\_lookupAppointment(), ilObject\_lookupObjId(), ilObject\_lookupType(), and getItem().

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

412 {
413 global $lng;
414
416 if(isset($a_item['timing_type']))
417 {
418 if(!isset($a_item['masked_start']))
419 {
420 $start = $a_item['start'];
421 $end = $a_item['end'];
422 }
423 else
424 {
425 $start = $a_item['masked_start'];
426 $end = $a_item['masked_end'];
427 }
428 $activation = '';
429 switch($a_item['timing_type'])
430 {
434 new ilDateTime($end,IL_CAL_UNIX));
435 break;
436
440 new ilDate($end,IL_CAL_UNIX));
441 break;
442 }
443 if ($activation != "")
444 {
445 global $lng;
446 $lng->loadLanguageModule('crs');
447
448 $a_list_gui->addCustomProperty($lng->txt($a_item['activation_info']),
449 $activation, false, true);
450 }
451 }
452 }
const IL_CAL_UNIX
static formatPeriod(ilDateTime $start, ilDateTime $end)
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
global $lng
Definition: privfeed.php:17

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

Referenced by ilSearchResultTableGUI\fillRow(), ilPDSelectedItemsBlockGUI\getMembershipItemsPerLocation(), ilPDSelectedItemsBlockGUI\getMembershipItemsPerType(), ilPDSelectedItemsBlockGUI\getSelectedItemsPerLocation(), ilPDSelectedItemsBlockGUI\getSelectedItemsPerType(), ilObjSessionGUI\modifyItemGUI(), 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 559 of file class.ilObjectActivation.php.

560 {
561 global $ilLog;
562
563 $ilLog->write(__METHOD__.': Begin course items...');
564
565 $items = self::getItems($a_ref_id);
566 if(!$items)
567 {
568 $ilLog->write(__METHOD__.': No course items found.');
569 return true;
570 }
571
572 // new course item object
573 if(!is_object($new_container = ilObjectFactory::getInstanceByRefId($a_target_id,false)))
574 {
575 $ilLog->write(__METHOD__.': Cannot create target object.');
576 return false;
577 }
578
579 include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
580 $cp_options = ilCopyWizardOptions::_getInstance($a_copy_id);
581 $mappings = $cp_options->getMappings();
582
583 foreach($items as $item)
584 {
585 if(!isset($mappings[$item['parent_id']]) or !$mappings[$item['parent_id']])
586 {
587 $ilLog->write(__METHOD__.': No mapping for parent nr. '.$item['parent_id']);
588 continue;
589 }
590 if(!isset($mappings[$item['obj_id']]) or !$mappings[$item['obj_id']])
591 {
592 $ilLog->write(__METHOD__.': No mapping for item nr. '.$item['obj_id']);
593 continue;
594 }
595 $new_item_id = $mappings[$item['obj_id']];
596 $new_parent = $mappings[$item['parent_id']];
597
598 $new_item = new self();
599 $new_item->setTimingType($item['timing_type']);
600 $new_item->setTimingStart($item['timing_start']);
601 $new_item->setTimingEnd($item['timing_end']);
602 $new_item->setSuggestionStart($item['suggestion_start']);
603 $new_item->setSuggestionEnd($item['suggestion_end']);
604 $new_item->toggleChangeable($item['changeable']);
605 $new_item->setEarliestStart($item['earliest_start']);
606 $new_item->setLatestEnd($item['latest_end']);
607 $new_item->toggleVisible($item['visible']);
608 $new_item->update($new_item_id, $new_parent);
609
610 $ilLog->write(__METHOD__.': Added new entry for item nr. '.$item['obj_id']);
611 }
612 $ilLog->write(__METHOD__.': Finished course items.');
613 }
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 $ilLog, 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 460 of file class.ilObjectActivation.php.

461 {
462 global $ilDB, $tree;
463
464 $parent_id = $tree->getParentId($a_ref_id);
465 if(!$parent_id)
466 {
467 return;
468 }
469
470
471 $ilAtomQuery = $ilDB->buildAtomQuery();
472 $ilAtomQuery->addTableLock("crs_items");
473
474 $ilAtomQuery->addQueryCallable(function(ilDBInterface $ilDB) use ($a_ref_id, $parent_id, &$a_item){
475
476 $sql = "SELECT * FROM crs_items".
477 " WHERE obj_id = ".$ilDB->quote($a_ref_id, "integer");
478 $set = $ilDB->query($sql);
479 if(!$ilDB->numRows($set))
480 {
481 $now = time();
482 $now_parts = getdate($now);
483
484 $a_item = array();
485 $a_item["timing_type"] = self::TIMINGS_DEACTIVATED;
486 $a_item["timing_start"] = $now;
487 $a_item["timing_end"] = $now;
488 $a_item["suggestion_start"] = $now;
489 $a_item["suggestion_end"] = $now;
490 $a_item['visible'] = 0;
491 $a_item['changeable'] = 0;
492 $a_item['earliest_start'] = $now;
493 $a_item['latest_end'] = mktime(23,55,00,$now_parts["mon"],$now_parts["mday"],$now_parts["year"]);
494 $a_item['visible'] = 0;
495 $a_item['changeable'] = 0;
496
497 $query = "INSERT INTO crs_items (parent_id,obj_id,timing_type,timing_start,timing_end," .
498 "suggestion_start,suggestion_end, ".
499 "changeable,earliest_start,latest_end,visible,position) ".
500 "VALUES( ".
501 $ilDB->quote($parent_id,'integer').",".
502 $ilDB->quote($a_ref_id,'integer').",".
503 $ilDB->quote($a_item["timing_type"],'integer').",".
504 $ilDB->quote($a_item["timing_start"],'integer').",".
505 $ilDB->quote($a_item["timing_end"],'integer').",".
506 $ilDB->quote($a_item["suggestion_start"],'integer').",".
507 $ilDB->quote($a_item["suggestion_end"],'integer').",".
508 $ilDB->quote($a_item["changeable"],'integer').",".
509 $ilDB->quote($a_item['earliest_start'],'integer').", ".
510 $ilDB->quote($a_item['latest_end'],'integer').", ".
511 $ilDB->quote($a_item["visible"],'integer').", ".
512 $ilDB->quote(0,'integer').")";
513 $ilDB->manipulate($query);
514 }
515
516 });
517
518 $ilAtomQuery->run();
519
520 // #9982 - to make getItem()-cache work
521 $a_item["obj_id"] = $a_ref_id;
522 $a_item["parent_id"] = $parent_id;
523
524 return $a_item;
525 }
Interface ilDBInterface.
global $ilDB

References $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 532 of file class.ilObjectActivation.php.

533 {
534 global $ilDB;
535
536 if(!$a_ref_id)
537 {
538 return;
539 }
540
541 $query = "DELETE FROM crs_items ".
542 "WHERE obj_id = ".$ilDB->quote($a_ref_id,'integer');
543 $ilDB->manipulate($query);
544
545 $query = "DELETE FROM crs_items ".
546 "WHERE parent_id = ".$ilDB->quote($a_ref_id,'integer');
547 $ilDB->manipulate($query);
548
549 return true;
550 }

References $ilDB, and $query.

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

+ Here is the caller graph for this function:

◆ enabledChangeable()

ilObjectActivation::enabledChangeable ( )

Get changeable status.

Returns
bool

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

214 {
215 return (bool) $this->changeable;
216 }

References $changeable.

Referenced by update().

+ Here is the caller graph for this function:

◆ enabledVisible()

ilObjectActivation::enabledVisible ( )

Get visible status.

Returns
bool

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

194 {
195 return (bool) $this->visible;
196 }

References $visible.

Referenced by update().

+ Here is the caller graph for this function:

◆ getEarliestStart()

ilObjectActivation::getEarliestStart ( )

Get earliest start.

Returns
timestamp

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

References $earliest_start.

Referenced by update().

+ Here is the caller graph for this function:

◆ getItem()

static ilObjectActivation::getItem (   $a_ref_id)
static

Get item data.

Parameters
int$a_ref_id
Returns
array

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

311 {
312 global $ilDB;
313
314 if(isset(self::$preloaded_data[$a_ref_id]))
315 {
316 return self::$preloaded_data[$a_ref_id];
317 }
318
319 $sql = "SELECT * FROM crs_items".
320 " WHERE obj_id = ".$ilDB->quote($a_ref_id, "integer");
321 $set = $ilDB->query($sql);
322 $row = $ilDB->fetchAssoc($set);
323
324 if(!isset($row["obj_id"]))
325 {
326 $row = self::createDefaultEntry($a_ref_id);
327 }
328 if($row["obj_id"])
329 {
330 self::$preloaded_data[$row["obj_id"]] = $row;
331 }
332 return $row;
333 }
static createDefaultEntry($a_ref_id)
Create db entry with default values.

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

Referenced by ilObjectXMLWriter\__appendTimeTargets(), ilObjCourse\__readSettings(), ilTimingCache\_getTimings(), ilObjCourseAccess\_isActivated(), ilObjPollAccess\_isActivated(), addAdditionalSubItemInformation(), ilObjSurvey\checkReminder(), ilAccessHandler\doActivationCheck(), ilObjPoll\doRead(), ilObjPortfolioTemplate\doRead(), ilObjectActivationGUI\getValues(), ilObjSurvey\loadFromDb(), ilObjTest\loadFromDb(), 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 756 of file class.ilObjectActivation.php.

757 {
758 global $tree;
759
760 $items = array();
761
762 $ref_ids = array();
763 foreach($tree->getChilds($a_parent_id) as $item)
764 {
765 if($item['type'] != 'rolf')
766 {
767 $items[] = $item;
768 $ref_ids[] = $item['ref_id'];
769 }
770 }
771
772 if($ref_ids)
773 {
774 self::preloadData($ref_ids);
775
776 foreach($items as $idx => $item)
777 {
778 if(!$a_with_list_data)
779 {
780 $items[$idx] = array_merge($item, self::getItem($item['ref_id']));
781 }
782 else
783 {
785 $items[$idx] = $item;
786 }
787 }
788 }
789
790 return $items;
791 }
static preloadData(array $a_ref_ids)
Preload data to internal cache.

References addAdditionalSubItemInformation(), and preloadData().

Referenced by cloneDependencies(), ilCourseStart\getPossibleStarters(), ilContainerStartObjects\getPossibleStarters(), getTimingsAdministrationItems(), 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 715 of file class.ilObjectActivation.php.

716 {
717 include_once 'Modules/Session/classes/class.ilEventItems.php';
718 $event_items = new ilEventItems($a_event_id);
719 return self::processListItems($event_items->getItems());
720 }
class ilEvent
static processListItems(array $a_ref_ids)
Validate ref ids and add list data.

References processListItems().

Referenced by 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 728 of file class.ilObjectActivation.php.

729 {
730 include_once 'Modules/ItemGroup/classes/class.ilItemGroupItems.php';
731 $ig_items = new ilItemGroupItems($a_item_group_ref_id);
732 $items = $ig_items->getValidItems();
733 return self::processListItems($items);
734 }

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

743 {
744 include_once('./Modules/Course/classes/class.ilCourseObjectiveMaterials.php');
745 $item_ids = ilCourseObjectiveMaterials::_getAssignedMaterials($a_objective_id);
746 return self::processListItems($item_ids);
747 }
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:

◆ getLatestEnd()

ilObjectActivation::getLatestEnd ( )

Get latest end.

Returns
timestamp

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

References $latest_end.

Referenced by update().

+ Here is the caller graph for this function:

◆ getSuggestionEnd()

ilObjectActivation::getSuggestionEnd ( )

Get suggestion end.

Returns
timestamp

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

References $suggestion_end.

Referenced by update(), and validateActivation().

+ Here is the caller graph for this function:

◆ getSuggestionStart()

ilObjectActivation::getSuggestionStart ( )

Get suggestion start.

Returns
timestamp

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

References $suggestion_start.

Referenced by update(), and validateActivation().

+ Here is the caller graph for this function:

◆ getTimingEnd()

ilObjectActivation::getTimingEnd ( )

Get timing end.

Returns
timestamp

Definition at line 93 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 799 of file class.ilObjectActivation.php.

800 {
801 $items = self::getItems($a_parent_id, false);
802
803 if($items)
804 {
805 $active = $inactive = array();
806 foreach($items as $item)
807 {
808 // active should be first in order
809 if($item['timing_type'] == self::TIMINGS_DEACTIVATED)
810 {
811 $inactive[] = $item;
812 }
813 else
814 {
815 $active[] = $item;
816 }
817 }
818
819 $active = ilUtil::sortArray($active,'start','asc');
820 $inactive = ilUtil::sortArray($inactive,'title','asc');
821 $items = array_merge($active,$inactive);
822 }
823
824 return $items;
825 }
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(), 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 833 of file class.ilObjectActivation.php.

834 {
835 global $objDefinition;
836
837 $filtered = array();
838
839 include_once 'Modules/Session/classes/class.ilEventItems.php';
840 $event_items = ilEventItems::_getItemsOfContainer($a_container_ref_id);
841 foreach(self::getTimingsAdministrationItems($a_container_ref_id) as $item)
842 {
843 if(!in_array($item['ref_id'],$event_items) &&
844 !$objDefinition->isSideBlock($item['type']))
845 {
846 $filtered[] = $item;
847 }
848 }
849
850 return $filtered;
851 }
static _getItemsOfContainer($a_ref_id)

References ilEventItems\_getItemsOfContainer().

Referenced by ilCourseContentGUI\__editAdvancedUserTimings(), ilCourseContentGUI\__editUserTimings(), and ilCourseContentGUI\__renderItem().

+ 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 73 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 53 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 650 of file class.ilObjectActivation.php.

651 {
652 global $tree, $ilDB;
653
654 $subtree = $tree->getSubTree($tree->getNodeData($a_ref_id));
655 $ref_ids = array();
656 foreach($subtree as $node)
657 {
658 $ref_ids[] = $node['ref_id'];
659 }
660
661 $query = "SELECT * FROM crs_items ".
662 "WHERE timing_type = ".$ilDB->quote(self::TIMINGS_PRESETTING,'integer')." ".
663 "AND changeable = ".$ilDB->quote(1,'integer')." ".
664 "AND ".$ilDB->in('obj_id',$ref_ids,false,'integer');
665 $res = $ilDB->query($query);
666 return $res->numRows() ? true : false;
667 }

References $ilDB, $query, and $res.

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

627 {
628 global $tree, $ilDB;
629
630 $subtree = $tree->getSubTree($tree->getNodeData($a_ref_id));
631 $ref_ids = array();
632 foreach($subtree as $node)
633 {
634 $ref_ids[] = $node['ref_id'];
635 }
636
637 $query = "SELECT * FROM crs_items ".
638 "WHERE timing_type = ".$ilDB->quote(self::TIMINGS_PRESETTING,'integer')." ".
639 "AND ".$ilDB->in('obj_id',$ref_ids,false,'integer');
640 $res = $ilDB->query($query);
641 return $res->numRows() ? true :false;
642 }

References $ilDB, $query, and $res.

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

292 {
293 global $ilDB;
294
295 $sql = "SELECT * FROM crs_items".
296 " WHERE ".$ilDB->in("obj_id", $a_ref_ids, "", "integer");
297 $set = $ilDB->query($sql);
298 while($row = $ilDB->fetchAssoc($set))
299 {
300 self::$preloaded_data[$row["obj_id"]] = $row;
301 }
302 }

References $ilDB, and $row.

Referenced by ilNewsItem\getAggregatedNewsData(), getItems(), 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 675 of file class.ilObjectActivation.php.

676 {
677 global $tree;
678
679 $res = array();
680
681 foreach($a_ref_ids as $item_ref_id)
682 {
683 if($tree->isDeleted($item_ref_id))
684 {
685 continue;
686 }
687 // #7571: when node is removed from system, e.g. inactive trashcan, an empty array is returned
688 $node = $tree->getNodeData($item_ref_id);
689 if($node["ref_id"] != $item_ref_id)
690 {
691 continue;
692 }
693 $res[$item_ref_id] = $node;
694 }
695
696 if(sizeof($res))
697 {
698 self::preloadData(array_keys($res));
699 foreach($res as $idx => $item)
700 {
702 $res[$idx] = $item;
703 }
704 }
705
706 return array_values($res);
707 }

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

◆ setEarliestStart()

ilObjectActivation::setEarliestStart (   $a_start)

Set earliest start.

Parameters
timestamp$a_start

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

144 {
145 $this->earliest_start = $a_start;
146 }

◆ setLatestEnd()

ilObjectActivation::setLatestEnd (   $a_end)

Set latest end.

Parameters
timestamp$a_end

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

164 {
165 $this->latest_end = $a_end;
166 }

◆ setSuggestionEnd()

ilObjectActivation::setSuggestionEnd (   $a_end)

Set suggestion end.

Parameters
timestamp$a_end

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

124 {
125 $this->suggestion_end = $a_end;
126 }

◆ setSuggestionStart()

ilObjectActivation::setSuggestionStart (   $a_start)

Set suggestion start.

Parameters
timestamp$a_start

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

104 {
105 $this->suggestion_start = $a_start;
106 }

◆ setTimingEnd()

ilObjectActivation::setTimingEnd (   $a_end)

Set timing end.

Parameters
timestamp$a_end

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

84 {
85 $this->timing_end = $a_end;
86 }

◆ setTimingStart()

ilObjectActivation::setTimingStart (   $a_start)

Set timing start.

Parameters
timestamp$a_start

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

64 {
65 $this->timing_start = $a_start;
66 }

◆ setTimingType()

ilObjectActivation::setTimingType (   $a_type)

Set timing type.

See also
class constants
Parameters
int$a_type

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

43 {
44 $this->timing_type = $a_type;
45 }
$a_type
Definition: workflow.php:93

References $a_type.

Referenced by 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 203 of file class.ilObjectActivation.php.

204 {
205 $this->changeable = (int) $a_status;
206 }

◆ toggleVisible()

ilObjectActivation::toggleVisible (   $a_status)

Set visible status.

Parameters
bool$a_status

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

184 {
185 $this->visible = (int) $a_status;
186 }

◆ 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 257 of file class.ilObjectActivation.php.

258 {
259 global $ilDB;
260
261 // #10110
262 $query = "UPDATE crs_items SET ".
263 "timing_type = ".$ilDB->quote($this->getTimingType(),'integer').", ".
264 "timing_start = ".$ilDB->quote((int)$this->getTimingStart(),'integer').", ".
265 "timing_end = ".$ilDB->quote((int)$this->getTimingEnd(),'integer').", ".
266 "suggestion_start = ".$ilDB->quote((int)$this->getSuggestionStart(),'integer').", ".
267 "suggestion_end = ".$ilDB->quote((int)$this->getSuggestionEnd(),'integer').", ".
268 "changeable = ".$ilDB->quote($this->enabledChangeable(),'integer').", ".
269 "earliest_start = ".$ilDB->quote((int)$this->getEarliestStart(),'integer').", ".
270 "latest_end = ".$ilDB->quote((int)$this->getLatestEnd(),'integer').", ";
271
272 if($a_parent_id)
273 {
274 $query .= "parent_id = ".$ilDB->quote($a_parent_id,'integer').", ";
275 }
276
277 $query .= "visible = ".$ilDB->quote($this->enabledVisible(),'integer')." ".
278 "WHERE obj_id = ".$ilDB->quote($a_ref_id,'integer');
279 $ilDB->manipulate($query);
280
281 unset(self::$preloaded_data[$a_ref_id]);
282
283 return true;
284 }
getTimingStart()
Get timing start.
enabledVisible()
Get visible status.
getEarliestStart()
Get earliest start.
getTimingType()
get timing type
enabledChangeable()
Get changeable status.
getSuggestionStart()
Get suggestion start.
getSuggestionEnd()
Get suggestion end.

References $ilDB, $query, enabledChangeable(), enabledVisible(), getEarliestStart(), getLatestEnd(), getSuggestionEnd(), getSuggestionStart(), getTimingEnd(), getTimingStart(), and getTimingType().

+ Here is the call graph for this function:

◆ validateActivation()

ilObjectActivation::validateActivation ( )

Validate current properties.

Returns
boolean

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

224 {
225 global $ilErr, $lng;
226
227 $ilErr->setMessage('');
228
229 if($this->getTimingType() == self::TIMINGS_ACTIVATION)
230 {
231 if($this->getTimingStart() > $this->getTimingEnd())
232 {
233 $ilErr->appendMessage($lng->txt("crs_activation_start_invalid"));
234 }
235 }
236 else if($this->getTimingType() == self::TIMINGS_PRESETTING)
237 {
238 if($this->getSuggestionStart() > $this->getSuggestionEnd())
239 {
240 $ilErr->appendMessage($lng->txt('crs_latest_end_not_valid'));
241 }
242 }
243
244 if($ilErr->getMessage())
245 {
246 return false;
247 }
248 return true;
249 }
global $ilErr
Definition: raiseError.php:16

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

+ Here is the call graph for this function:

Field Documentation

◆ $changeable

ilObjectActivation::$changeable
protected

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

Referenced by enabledChangeable().

◆ $earliest_start

ilObjectActivation::$earliest_start
protected

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

Referenced by getEarliestStart().

◆ $latest_end

ilObjectActivation::$latest_end
protected

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

Referenced by getLatestEnd().

◆ $preloaded_data

ilObjectActivation::$preloaded_data = array()
staticprotected

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

◆ $suggestion_end

ilObjectActivation::$suggestion_end
protected

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

Referenced by getSuggestionEnd().

◆ $suggestion_start

ilObjectActivation::$suggestion_start
protected

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

Referenced by getSuggestionStart().

◆ $timing_end

ilObjectActivation::$timing_end
protected

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

Referenced by getTimingEnd().

◆ $timing_start

ilObjectActivation::$timing_start
protected

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

Referenced by getTimingStart().

◆ $timing_type

ilObjectActivation::$timing_type
protected

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

Referenced by getTimingType().

◆ $visible

ilObjectActivation::$visible
protected

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

Referenced by enabledVisible().

◆ TIMINGS_ACTIVATION

◆ TIMINGS_DEACTIVATED

◆ TIMINGS_FIXED

const ilObjectActivation::TIMINGS_FIXED = 3

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

◆ TIMINGS_PRESETTING


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