ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilObjectActivation Class Reference

Class ilObjectActivation. More...

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

Public Member Functions

 __construct ()
 setTimingType ($a_type)
 Set timing type.
 getTimingType ()
 get timing type
 setTimingStart ($a_start)
 Set timing start.
 getTimingStart ()
 Get timing start.
 setTimingEnd ($a_end)
 Set timing end.
 getTimingEnd ()
 Get timing end.
 setSuggestionStart ($a_start)
 Set suggestion start.
 getSuggestionStart ()
 Get suggestion start.
 setSuggestionEnd ($a_end)
 Set suggestion end.
 getSuggestionEnd ()
 Get suggestion end.
 setEarliestStart ($a_start)
 Set earliest start.
 getEarliestStart ()
 Get earliest start.
 setLatestEnd ($a_end)
 Set latest end.
 getLatestEnd ()
 Get latest end.
 toggleVisible ($a_status)
 Set visible status.
 enabledVisible ()
 Get visible status.
 toggleChangeable ($a_status)
 Set changeable status.
 enabledChangeable ()
 Get changeable status.
 validateActivation ()
 Validate current properties.
 update ($a_ref_id, $a_parent_id=null)
 Update db entry.

Static Public Member Functions

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

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

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

ilObjectActivation::__construct ( )

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

{
}

Member Function Documentation

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.

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

Referenced by addListGUIActivationProperty(), getItems(), and processListItems().

{
global $ilUser;
$item = self::getItem($a_item['ref_id']);
$a_item['obj_id'] = ($a_item['obj_id'] > 0)
? $a_item['obj_id']
: ilObject::_lookupObjId($a_item['ref_id']);
$a_item['type'] = ($a_item['type'] != '')
? $a_item['type']
: ilObject::_lookupType($a_item['obj_id']);
$a_item['timing_type'] = $item['timing_type'];
if($item['changeable'] &&
$item['timing_type'] == self::TIMINGS_PRESETTING)
{
include_once 'Modules/Course/classes/Timings/class.ilTimingPlaned.php';
$user_data = ilTimingPlaned::_getPlanedTimings($ilUser->getId(), $a_item['ref_id']);
if($user_data['planed_start'])
{
$a_item['start'] = $user_data['planed_start'];
$a_item['end'] = $user_data['planed_end'];
$a_item['activation_info'] = 'crs_timings_planed_info';
}
else
{
$a_item['start'] = $item['suggestion_start'];
$a_item['end'] = $item['suggestion_end'];
$a_item['activation_info'] = 'crs_timings_suggested_info';
}
}
elseif($item['timing_type'] == self::TIMINGS_PRESETTING)
{
$a_item['start'] = $item['suggestion_start'];
$a_item['end'] = $item['suggestion_end'];
$a_item['activation_info'] = 'crs_timings_suggested_info';
}
elseif($item['timing_type'] == self::TIMINGS_ACTIVATION)
{
$a_item['start'] = $item['timing_start'];
$a_item['end'] = $item['timing_end'];
$a_item['activation_info'] = 'activation';
}
else
{
$a_item['start'] = 'abc';
}
// #7359 - session sorting should always base on appointment date
if($a_item['type'] == 'sess')
{
include_once('./Modules/Session/classes/class.ilSessionAppointment.php');
$info = ilSessionAppointment::_lookupAppointment($a_item['obj_id']);
// #11987
$a_item['masked_start'] = $a_item['start'];
$a_item['masked_end'] = $a_item['end'];
$a_item['start'] = $info['start'];
$a_item['end'] = $info['end'];
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

References $lng, 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().

{
global $lng;
if(isset($a_item['timing_type']))
{
if(!isset($a_item['masked_start']))
{
$start = $a_item['start'];
$end = $a_item['end'];
}
else
{
$start = $a_item['masked_start'];
$end = $a_item['masked_end'];
}
$activation = '';
switch($a_item['timing_type'])
{
new ilDateTime($start,IL_CAL_UNIX),
new ilDateTime($end,IL_CAL_UNIX));
break;
new ilDate($start,IL_CAL_UNIX),
new ilDate($end,IL_CAL_UNIX));
break;
}
if ($activation != "")
{
global $lng;
$lng->loadLanguageModule('crs');
$a_list_gui->addCustomProperty($lng->txt($a_item['activation_info']),
$activation, false, true);
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

{
global $ilLog;
$ilLog->write(__METHOD__.': Begin course items...');
$items = self::getItems($a_ref_id);
if(!$items)
{
$ilLog->write(__METHOD__.': No course items found.');
return true;
}
// new course item object
if(!is_object($new_container = ilObjectFactory::getInstanceByRefId($a_target_id,false)))
{
$ilLog->write(__METHOD__.': Cannot create target object.');
return false;
}
include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
$cp_options = ilCopyWizardOptions::_getInstance($a_copy_id);
$mappings = $cp_options->getMappings();
foreach($items as $item)
{
if(!isset($mappings[$item['parent_id']]) or !$mappings[$item['parent_id']])
{
$ilLog->write(__METHOD__.': No mapping for parent nr. '.$item['parent_id']);
continue;
}
if(!isset($mappings[$item['obj_id']]) or !$mappings[$item['obj_id']])
{
$ilLog->write(__METHOD__.': No mapping for item nr. '.$item['obj_id']);
continue;
}
$new_item_id = $mappings[$item['obj_id']];
$new_parent = $mappings[$item['parent_id']];
$new_item = new self();
$new_item->setTimingType($item['timing_type']);
$new_item->setTimingStart($item['timing_start']);
$new_item->setTimingEnd($item['timing_end']);
$new_item->setSuggestionStart($item['suggestion_start']);
$new_item->setSuggestionEnd($item['suggestion_end']);
$new_item->toggleChangeable($item['changeable']);
$new_item->setEarliestStart($item['earliest_start']);
$new_item->setLatestEnd($item['latest_end']);
$new_item->toggleVisible($item['visible']);
$new_item->update($new_item_id, $new_parent);
$ilLog->write(__METHOD__.': Added new entry for item nr. '.$item['obj_id']);
}
$ilLog->write(__METHOD__.': Finished course items.');
}

+ Here is the call graph for this function:

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.

References $query, ilDB\LOCK_WRITE, and TIMINGS_DEACTIVATED.

Referenced by getItem().

{
global $ilDB, $tree;
$parent_id = $tree->getParentId($a_ref_id);
if(!$parent_id)
{
return;
}
// #10077
$ilDB->lockTables(array(
array("name" => "crs_items",
"type" => ilDB::LOCK_WRITE,
"alias" => "")
));
$sql = "SELECT * FROM crs_items".
" WHERE obj_id = ".$ilDB->quote($a_ref_id, "integer");
$set = $ilDB->query($sql);
if(!$ilDB->numRows($set))
{
$now = time();
$now_parts = getdate($now);
$a_item = array();
$a_item["timing_type"] = self::TIMINGS_DEACTIVATED;
$a_item["timing_start"] = $now;
$a_item["timing_end"] = $now;
$a_item["suggestion_start"] = $now;
$a_item["suggestion_end"] = $now;
$a_item['visible'] = 0;
$a_item['changeable'] = 0;
$a_item['earliest_start'] = $now;
$a_item['latest_end'] = mktime(23,55,00,$now_parts["mon"],$now_parts["mday"],$now_parts["year"]);
$a_item['visible'] = 0;
$a_item['changeable'] = 0;
$query = "INSERT INTO crs_items (parent_id,obj_id,timing_type,timing_start,timing_end," .
"suggestion_start,suggestion_end, ".
"changeable,earliest_start,latest_end,visible,position) ".
"VALUES( ".
$ilDB->quote($parent_id,'integer').",".
$ilDB->quote($a_ref_id,'integer').",".
$ilDB->quote($a_item["timing_type"],'integer').",".
$ilDB->quote($a_item["timing_start"],'integer').",".
$ilDB->quote($a_item["timing_end"],'integer').",".
$ilDB->quote($a_item["suggestion_start"],'integer').",".
$ilDB->quote($a_item["suggestion_end"],'integer').",".
$ilDB->quote($a_item["changeable"],'integer').",".
$ilDB->quote($a_item['earliest_start'],'integer').", ".
$ilDB->quote($a_item['latest_end'],'integer').", ".
$ilDB->quote($a_item["visible"],'integer').", ".
$ilDB->quote(0,'integer').")";
$ilDB->manipulate($query);
}
$ilDB->unlockTables();
// #9982 - to make getItem()-cache work
$a_item["obj_id"] = $a_ref_id;
$a_item["parent_id"] = $parent_id;
return $a_item;
}

+ Here is the caller graph for this function:

static ilObjectActivation::deleteAllEntries (   $a_ref_id)
static

Delete all db entries for ref id.

Parameters
int$a_ref_id

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

References $query.

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

{
global $ilDB;
if(!$a_ref_id)
{
return;
}
$query = "DELETE FROM crs_items ".
"WHERE obj_id = ".$ilDB->quote($a_ref_id,'integer');
$ilDB->manipulate($query);
$query = "DELETE FROM crs_items ".
"WHERE parent_id = ".$ilDB->quote($a_ref_id,'integer');
$ilDB->manipulate($query);
return true;
}

+ Here is the caller graph for this function:

ilObjectActivation::enabledChangeable ( )

Get changeable status.

Returns
bool

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

References $changeable.

Referenced by update().

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

+ Here is the caller graph for this function:

ilObjectActivation::enabledVisible ( )

Get visible status.

Returns
bool

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

References $visible.

Referenced by update().

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

+ Here is the caller graph for this function:

ilObjectActivation::getEarliestStart ( )

Get earliest start.

Returns
timestamp

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

Referenced by update().

{
return $this->earliest_start ? $this->earliest_start : mktime(0,0,1,date('n',time()),date('j',time()),date('Y',time()));
}

+ Here is the caller graph for this function:

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.

References $row, and createDefaultEntry().

Referenced by ilObjectXMLWriter\__appendTimeTargets(), ilObjCourse\__readSettings(), ilTimingCache\_getTimings(), ilObjPollAccess\_isActivated(), ilObjCourseAccess\_isActivated(), addAdditionalSubItemInformation(), ilAccessHandler\doActivationCheck(), ilObjPoll\doRead(), ilObjectActivationGUI\getValues(), ilObjSurvey\loadFromDb(), ilObjTest\loadFromDb(), ilObjSurvey\saveToDb(), ilObjTest\saveToDb(), ilSoapObjectAdministration\updateReferences(), ilObjCourse\updateSettings(), ilCourseContentGUI\updateTimings(), ilTimingPlaned\validate(), and ilContainerXmlWriter\writeCourseItemInformation().

{
global $ilDB;
if(isset(self::$preloaded_data[$a_ref_id]))
{
return self::$preloaded_data[$a_ref_id];
}
$sql = "SELECT * FROM crs_items".
" WHERE obj_id = ".$ilDB->quote($a_ref_id, "integer");
$set = $ilDB->query($sql);
$row = $ilDB->fetchAssoc($set);
if(!isset($row["obj_id"]))
{
}
if($row["obj_id"])
{
self::$preloaded_data[$row["obj_id"]] = $row;
}
return $row;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

References addAdditionalSubItemInformation(), and preloadData().

Referenced by ilCourseObjectivePresentationGUI\__getAllTests(), ilCourseObjectivePresentationGUI\__getOtherResources(), cloneDependencies(), ilCourseStart\getPossibleStarters(), getTimingsAdministrationItems(), and ilCourseContentGUI\setColumnSettings().

{
global $tree;
$items = array();
$ref_ids = array();
foreach($tree->getChilds($a_parent_id) as $item)
{
if($item['type'] != 'rolf')
{
$items[] = $item;
$ref_ids[] = $item['ref_id'];
}
}
if($ref_ids)
{
self::preloadData($ref_ids);
foreach($items as $idx => $item)
{
if(!$a_with_list_data)
{
$items[$idx] = array_merge($item, self::getItem($item['ref_id']));
}
else
{
$items[$idx] = $item;
}
}
}
return $items;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilObjectActivation::getItemsByEvent (   $a_event_id)
static

Get session material / event items.

Parameters
int$a_event_id(object id)
Returns
array

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

References processListItems().

Referenced by ilObjSessionGUI\infoScreen(), and ilContainerContentGUI\renderItem().

{
include_once 'Modules/Session/classes/class.ilEventItems.php';
$event_items = new ilEventItems($a_event_id);
return self::processListItems($event_items->getItems());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

References processListItems().

Referenced by ilContainerContentGUI\renderItemGroup().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilObjectActivation::getItemsByObjective (   $a_objective_id)
static

Get objective items.

Parameters
int$a_objective_id
Returns
array

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

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

Referenced by ilContainerObjectiveGUI\renderObjective().

{
include_once('./Modules/Course/classes/class.ilCourseObjectiveMaterials.php');
return self::processListItems($item_ids);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjectActivation::getLatestEnd ( )

Get latest end.

Returns
timestamp

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

Referenced by update().

{
return $this->latest_end ? $this->latest_end : mktime(23,55,00,date('n',time()),date('j',time()),date('Y',time()));
}

+ Here is the caller graph for this function:

ilObjectActivation::getSuggestionEnd ( )

Get suggestion end.

Returns
timestamp

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

Referenced by update(), and validateActivation().

{
return $this->suggestion_end ? $this->suggestion_end : mktime(23,55,00,date('n',time()),date('j',time()),date('Y',time()));
}

+ Here is the caller graph for this function:

ilObjectActivation::getSuggestionStart ( )

Get suggestion start.

Returns
timestamp

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

Referenced by update(), and validateActivation().

{
return $this->suggestion_start ? $this->suggestion_start : mktime(0,0,1,date('n',time()),date('j',time()),date('Y',time()));
}

+ Here is the caller graph for this function:

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:

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

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

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

{
$items = self::getItems($a_parent_id, false);
if($items)
{
$active = $inactive = array();
foreach($items as $item)
{
// active should be first in order
if($item['timing_type'] == self::TIMINGS_DEACTIVATED)
{
$inactive[] = $item;
}
else
{
$active[] = $item;
}
}
$active = ilUtil::sortArray($active,'start','asc');
$inactive = ilUtil::sortArray($inactive,'title','asc');
$items = array_merge($active,$inactive);
}
return $items;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

References ilEventItems\_getItemsOfContainer().

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

{
global $objDefinition;
$filtered = array();
include_once 'Modules/Session/classes/class.ilEventItems.php';
$event_items = ilEventItems::_getItemsOfContainer($a_container_ref_id);
foreach(self::getTimingsAdministrationItems($a_container_ref_id) as $item)
{
if(!in_array($item['ref_id'],$event_items) &&
!$objDefinition->isSideBlock($item['type']))
{
$filtered[] = $item;
}
}
return $filtered;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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:

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:

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

References $query, and $res.

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

{
global $tree, $ilDB;
$subtree = $tree->getSubTree($tree->getNodeData($a_ref_id));
$ref_ids = array();
foreach($subtree as $node)
{
$ref_ids[] = $node['ref_id'];
}
$query = "SELECT * FROM crs_items ".
"WHERE timing_type = ".$ilDB->quote(self::TIMINGS_PRESETTING,'integer')." ".
"AND changeable = ".$ilDB->quote(1,'integer')." ".
"AND ".$ilDB->in('obj_id',$ref_ids,false,'integer');
$res = $ilDB->query($query);
return $res->numRows() ? true : false;
}

+ Here is the caller graph for this function:

static ilObjectActivation::hasTimings (   $a_ref_id)
static

Check if there is any active timing (in subtree)

Parameters
intref_id
Returns
bool

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

References $query, and $res.

Referenced by ilObjCourseGUI\membersObject().

{
global $tree, $ilDB;
$subtree = $tree->getSubTree($tree->getNodeData($a_ref_id));
$ref_ids = array();
foreach($subtree as $node)
{
$ref_ids[] = $node['ref_id'];
}
$query = "SELECT * FROM crs_items ".
"WHERE timing_type = ".$ilDB->quote(self::TIMINGS_PRESETTING,'integer')." ".
"AND ".$ilDB->in('obj_id',$ref_ids,false,'integer');
$res = $ilDB->query($query);
return $res->numRows() ? true :false;
}

+ Here is the caller graph for this function:

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.

References $row.

Referenced by ilNewsItem\getAggregatedNewsData(), getItems(), ilContainer\getSubItems(), and processListItems().

{
global $ilDB;
$sql = "SELECT * FROM crs_items".
" WHERE ".$ilDB->in("obj_id", $a_ref_ids, "", "integer");
$set = $ilDB->query($sql);
while($row = $ilDB->fetchAssoc($set))
{
self::$preloaded_data[$row["obj_id"]] = $row;
}
}

+ Here is the caller graph for this function:

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

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

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

{
global $tree;
$res = array();
foreach($a_ref_ids as $item_ref_id)
{
if($tree->isDeleted($item_ref_id))
{
continue;
}
// #7571: when node is removed from system, e.g. inactive trashcan, an empty array is returned
$node = $tree->getNodeData($item_ref_id);
if($node["ref_id"] != $item_ref_id)
{
continue;
}
$res[$item_ref_id] = $node;
}
if(sizeof($res))
{
self::preloadData(array_keys($res));
foreach($res as $idx => $item)
{
$res[$idx] = $item;
}
}
return array_values($res);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjectActivation::setEarliestStart (   $a_start)

Set earliest start.

Parameters
timestamp$a_start

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

{
$this->earliest_start = $a_start;
}
ilObjectActivation::setLatestEnd (   $a_end)

Set latest end.

Parameters
timestamp$a_end

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

{
$this->latest_end = $a_end;
}
ilObjectActivation::setSuggestionEnd (   $a_end)

Set suggestion end.

Parameters
timestamp$a_end

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

{
$this->suggestion_end = $a_end;
}
ilObjectActivation::setSuggestionStart (   $a_start)

Set suggestion start.

Parameters
timestamp$a_start

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

{
$this->suggestion_start = $a_start;
}
ilObjectActivation::setTimingEnd (   $a_end)

Set timing end.

Parameters
timestamp$a_end

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

{
$this->timing_end = $a_end;
}
ilObjectActivation::setTimingStart (   $a_start)

Set timing start.

Parameters
timestamp$a_start

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

{
$this->timing_start = $a_start;
}
ilObjectActivation::setTimingType (   $a_type)

Set timing type.

See Also
class constants
Parameters
int$a_type

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

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

{
$this->timing_type = $a_type;
}

+ Here is the caller graph for this function:

ilObjectActivation::toggleChangeable (   $a_status)

Set changeable status.

Parameters
bool$a_status

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

{
$this->changeable = (int) $a_status;
}
ilObjectActivation::toggleVisible (   $a_status)

Set visible status.

Parameters
bool$a_status

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

{
$this->visible = (int) $a_status;
}
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.

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

{
global $ilDB;
// #10110
$query = "UPDATE crs_items SET ".
"timing_type = ".$ilDB->quote($this->getTimingType(),'integer').", ".
"timing_start = ".$ilDB->quote((int)$this->getTimingStart(),'integer').", ".
"timing_end = ".$ilDB->quote((int)$this->getTimingEnd(),'integer').", ".
"suggestion_start = ".$ilDB->quote($this->getSuggestionStart(),'integer').", ".
"suggestion_end = ".$ilDB->quote($this->getSuggestionEnd(),'integer').", ".
"changeable = ".$ilDB->quote($this->enabledChangeable(),'integer').", ".
"earliest_start = ".$ilDB->quote($this->getEarliestStart(),'integer').", ".
"latest_end = ".$ilDB->quote($this->getLatestEnd(),'integer').", ";
if($a_parent_id)
{
$query .= "parent_id = ".$ilDB->quote($a_parent_id,'integer').", ";
}
$query .= "visible = ".$ilDB->quote($this->enabledVisible(),'integer')." ".
"WHERE obj_id = ".$ilDB->quote($a_ref_id,'integer');
$ilDB->manipulate($query);
unset(self::$preloaded_data[$a_ref_id]);
return true;
}

+ Here is the call graph for this function:

ilObjectActivation::validateActivation ( )

Validate current properties.

Returns
boolean

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

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

{
global $ilErr, $lng;
$ilErr->setMessage('');
if($this->getTimingType() == self::TIMINGS_ACTIVATION)
{
if($this->getTimingStart() > $this->getTimingEnd())
{
$ilErr->appendMessage($lng->txt("crs_activation_start_invalid"));
}
}
{
if($this->getSuggestionStart() > $this->getSuggestionEnd())
{
$ilErr->appendMessage($lng->txt('crs_latest_end_not_valid'));
}
}
if($ilErr->getMessage())
{
return false;
}
return true;
}

+ Here is the call graph for this function:

Field Documentation

ilObjectActivation::$changeable
protected

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

Referenced by enabledChangeable().

ilObjectActivation::$earliest_start
protected

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

ilObjectActivation::$latest_end
protected

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

ilObjectActivation::$preloaded_data = array()
staticprotected

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

ilObjectActivation::$suggestion_end
protected

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

ilObjectActivation::$suggestion_start
protected

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

ilObjectActivation::$timing_end
protected

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

Referenced by getTimingEnd().

ilObjectActivation::$timing_start
protected

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

Referenced by getTimingStart().

ilObjectActivation::$timing_type
protected

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

Referenced by getTimingType().

ilObjectActivation::$visible
protected

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

Referenced by enabledVisible().

const ilObjectActivation::TIMINGS_FIXED = 3

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


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