ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilCourseItems Class Reference
+ Collaboration diagram for ilCourseItems:

Public Member Functions

 ilCourseItems (&$course_obj, $a_parent=0, $user_id=0)
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone dependencies.
 setItemId ($a_item_id)
 getItemId ()
 getUserId ()
 _hasCollectionTimings ($a_ref_id)
 _hasTimings ($a_ref_id)
 check if there is any active timing
 _hasChangeableTimings ($a_ref_id)
 setParentId ($a_parent=0)
 getParentId ()
 setTimingType ($a_type)
 getTimingType ()
 setTimingStart ($a_start)
 getTimingStart ()
 setTimingEnd ($a_end)
 getTimingEnd ()
 setSuggestionStart ($a_start)
 getSuggestionStart ()
 setSuggestionEnd ($a_end)
 getSuggestionEnd ()
 setEarliestStart ($a_start)
 getEarliestStart ()
 setLatestEnd ($a_end)
 getLatestEnd ()
 toggleVisible ($a_status)
 enabledVisible ()
 toggleChangeable ($a_status)
 enabledChangeable ()
 setPosition ($a_pos)
 getAllItems ()
 getFilteredItems ($a_container_ref_id)
 Get all items.
 getItemsByEvent ($a_event_id)
 getItemsByObjective ($a_objective_id)
 getItems ()
 getItem ($a_item_id)
 validateActivation ()
 save ()
 Save.
 update ($a_item_id)
 moveUp ($item_id)
 moveDown ($item_id)
 deleteAllEntries ()
 __read ()
 __purgeDeleted ()
 __delete ($a_obj_id)
 __getItemData ($a_item)
 createDefaultEntry ($a_item)
 __getLastPosition ()
 __isMovable ($a_ref_id)
 __switchNodes ($node_a, $node_b)
 __sort ()
 __splitByActivation ()
 _getItem ($a_item_id)
 _isActivated ($a_item_id)
 addAdditionalSubItemInformation (&$a_item)
 Adds information to object/item array needed to be displayed in repository.

Static Public Member Functions

static _sort ($a_sort_mode, $a_items)
 sort items
static _readActivationTimes ($a_ref_ids)
 read activation times

Data Fields

 $course_obj
 $ilErr
 $ilDB
 $tree
 $lng
 $items
 $parent
 $timing_type
 $timing_start
 $timing_end

Detailed Description

Definition at line 39 of file class.ilCourseItems.php.

Member Function Documentation

ilCourseItems::__delete (   $a_obj_id)

Definition at line 610 of file class.ilCourseItems.php.

References $ilDB, $res, and getParentId().

Referenced by __purgeDeleted().

{
global $ilDB;
// DELETE ENTRY
$query = "DELETE FROM crs_items ".
"WHERE parent_id = ".$ilDB->quote($this->getParentId())." ".
"AND obj_id = ".$ilDB->quote($a_obj_id)." ";
$res = $this->ilDB->query($query);
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCourseItems::__getItemData (   $a_item)

Definition at line 624 of file class.ilCourseItems.php.

References $data, $ilBench, $ilDB, $res, ilTimingPlaned\_getPlanedTimings(), ilSessionAppointment\_lookupAppointment(), createDefaultEntry(), DB_FETCHMODE_OBJECT, getUserId(), IL_CRS_TIMINGS_ACTIVATION, IL_CRS_TIMINGS_FIXED, and IL_CRS_TIMINGS_PRESETTING.

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

{
global $ilDB,$ilUser,$ilObjDataCache, $ilBench;
$ilBench->start("Course", "ilCourseItems_getItemData - 1");
$query = "SELECT * FROM crs_items ".
"WHERE obj_id = ".$ilDB->quote($a_item['child'])." ".
"AND parent_id = ".$ilDB->quote($a_item['parent'])." ";
$res = $this->ilDB->query($query);
$ilBench->stop("Course", "ilCourseItems_getItemData - 1");
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$ilBench->start("Course", "ilCourseItems_getItemData - 2");
$a_item["timing_type"] = $row->timing_type;
$a_item["timing_start"] = $row->timing_start;
$a_item["timing_end"] = $row->timing_end;
$a_item["suggestion_start"] = $row->suggestion_start ? $row->suggestion_start :
mktime(0,0,1,date('n',time()),date('j',time()),date('Y',time()));
$a_item["suggestion_end"] = $row->suggestion_end ? $row->suggestion_end :
mktime(23,55,00,date('n',time()),date('j',time()),date('Y',time()));
$a_item['changeable'] = $row->changeable;
$a_item['earliest_start'] = $row->earliest_start ? $row->earliest_start :
mktime(0,0,1,date('n',time()),date('j',time()),date('Y',time()));
$a_item['latest_end'] = $row->latest_end ? $row->latest_end :
mktime(23,55,00,date('n',time()),date('j',time()),date('Y',time()));
$a_item['visible'] = $row->visible;
include_once 'Modules/Course/classes/Timings/class.ilTimingPlaned.php';
$data = ilTimingPlaned::_getPlanedTimings($this->getUserId(),$a_item['child']);
$ilBench->stop("Course", "ilCourseItems_getItemData - 2");
$ilBench->start("Course", "ilCourseItems_getItemData - 3");
// changed for performance reasons
$obj_id = ($a_item['obj_id'] > 0)
? $a_item['obj_id']
: $ilObjDataCache->lookupObjId($row->obj_id);
$obj_type = ($a_item['type'] != "")
? $a_item['type']
: $ilObjDataCache->lookupType($obj_id);
$ilBench->stop("Course", "ilCourseItems_getItemData - 3");
//if($ilObjDataCache->lookupType($obj_id = $ilObjDataCache->lookupObjId($row->obj_id)) == 'sess')
// Check for user entry
$ilBench->start("Course", "ilCourseItems_getItemData - 4");
if($a_item['changeable'] and
$a_item['timing_type'] == IL_CRS_TIMINGS_PRESETTING)
{
if($data['planed_start'])
{
$a_item['start'] = $data['planed_start'];
$a_item['end'] = $data['planed_end'];
$a_item['activation_info'] = 'crs_timings_planed_info';
}
else
{
$a_item['start'] = $row->suggestion_start;
$a_item['end'] = $row->suggestion_end;
$a_item['activation_info'] = 'crs_timings_suggested_info';
}
}
elseif($a_item['timing_type'] == IL_CRS_TIMINGS_PRESETTING)
{
$a_item['start'] = $row->suggestion_start;
$a_item['end'] = $row->suggestion_end;
$a_item['activation_info'] = 'crs_timings_suggested_info';
}
elseif($a_item['timing_type'] == IL_CRS_TIMINGS_ACTIVATION)
{
$a_item['start'] = $row->timing_start;
$a_item['end'] = $row->timing_end;
$a_item['activation_info'] = 'activation';
}
elseif($obj_type == 'sess')
{
include_once('./Modules/Session/classes/class.ilSessionAppointment.php');
$ilBench->start("Course", "ilCourseItems_getItemData - lookupAppointment");
$ilBench->stop("Course", "ilCourseItems_getItemData - lookupAppointment");
$a_item['timing_type'] = IL_CRS_TIMINGS_FIXED;
$a_item['start'] = $info['start'];
$a_item['end'] = $info['end'];
$a_item['fullday'] = $info['fullday'];
$a_item['activation_info'] = 'crs_timings_suggested_info';
}
else
{
$a_item['start'] = 999999999;
}
$ilBench->stop("Course", "ilCourseItems_getItemData - 4");
}
$ilBench->start("Course", "ilCourseItems_getItemData - 5");
if(!isset($a_item["timing_start"]))
{
$a_item = $this->createDefaultEntry($a_item);
}
$ilBench->stop("Course", "ilCourseItems_getItemData - 5");
return $a_item;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCourseItems::__getLastPosition ( )

Definition at line 768 of file class.ilCourseItems.php.

References $ilDB, $res, DB_FETCHMODE_OBJECT, and getParentId().

{
global $ilDB;
$query = "SELECT MAX(position) as last_position FROM crs_items ".
"WHERE parent_id = ".$ilDB->quote($this->getParentId())." ";
$res = $this->ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$max = $row->last_position;
}
return $max ? $max : 0;
}

+ Here is the call graph for this function:

ilCourseItems::__isMovable (   $a_ref_id)

Definition at line 785 of file class.ilCourseItems.php.

References ilEventItems\_isAssigned().

{
include_once 'Modules/Session/classes/class.ilEventItems.php';
global $ilObjDataCache;
if($ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($a_ref_id)) != 'crs')
{
return true;
}
{
return false;
}
return true;
}

+ Here is the call graph for this function:

ilCourseItems::__purgeDeleted ( )

Definition at line 591 of file class.ilCourseItems.php.

References $ilDB, $res, $tree, __delete(), DB_FETCHMODE_OBJECT, and getParentId().

Referenced by __read().

{
global $tree,$ilDB;
$all = array();
$query = "SELECT obj_id FROM crs_items ".
"WHERE parent_id = ".$ilDB->quote($this->getParentId())." ";
$res = $this->ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
if($tree->getParentId($row->obj_id) != $this->getParentId())
{
$this->__delete($row->obj_id);
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCourseItems::__read ( )

Definition at line 547 of file class.ilCourseItems.php.

References $ilBench, $test, __getItemData(), __purgeDeleted(), and __sort().

Referenced by moveDown(), moveUp(), setParentId(), and update().

{
global $ilBench, $test;
$this->items = array();
$ilBench->start("Course", "ilCouseItems_read - getChilds");
$all_items = $this->tree->getChilds($this->parent);
$ilBench->stop("Course", "ilCouseItems_read - getChilds");
foreach($all_items as $item)
{
if($item["type"] != 'rolf')
{
$this->items[] = $item;
}
}
$ilBench->start("Course", "ilCouseItems_read - getItemData");
for($i = 0;$i < count($this->items); ++$i)
{
if($this->items[$i]["type"] == 'rolf')
{
unset($this->items[$i]);
continue;
}
$this->items[$i] = $this->__getItemData($this->items[$i]);
}
$ilBench->stop("Course", "ilCouseItems_read - getItemData");
$ilBench->start("Course", "ilCouseItems_read - purge and sort");
$this->__purgeDeleted();
$this->__sort();
$ilBench->stop("Course", "ilCouseItems_read - purge and sort");
// one array for items per child id
$this->items_per_child = array();
foreach($this->items as $item)
{
$this->items_per_child[$item["child"]] = $item;
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCourseItems::__sort ( )

Definition at line 869 of file class.ilCourseItems.php.

References __splitByActivation(), ilContainer\SORT_ACTIVATION, and ilUtil\sortArray().

Referenced by __read().

{
switch($this->course_obj->getOrderType())
{
// Sort by starting time. If mode is IL_CRS_TIMINGS_DEACTIVATED then sort these items by title and append
// them to the array.
list($active,$inactive) = $this->__splitByActivation();
$sorted_active = ilUtil::sortArray($active,"start","asc");
$sorted_inactive = ilUtil::sortArray($inactive,'title','asc');
$this->items = array_merge($sorted_active,$sorted_inactive);
break;
default:
return true;
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCourseItems::__splitByActivation ( )

Definition at line 890 of file class.ilCourseItems.php.

References IL_CRS_TIMINGS_DEACTIVATED.

Referenced by __sort().

{
$inactive = $active = array();
foreach($this->items as $item)
{
if($item['timing_type'] == IL_CRS_TIMINGS_DEACTIVATED)
{
$inactive[] = $item;
}
else
{
$active[] = $item;
}
}
return array($active,$inactive);
}

+ Here is the caller graph for this function:

ilCourseItems::__switchNodes (   $node_a,
  $node_b 
)

Definition at line 802 of file class.ilCourseItems.php.

References $ilDB, $res, and getParentId().

{
global $ilDB;
if(!$node_b["obj_id"])
{
return false;
}
$query = "UPDATE crs_items SET ".
"position = ".$ilDB->quote($node_a["position"])." ".
"WHERE obj_id = ".$ilDB->quote($node_b["obj_id"])." ".
"AND parent_id = ".$ilDB->quote($this->getParentId())."";
$res = $this->ilDB->query($query);
$query = "UPDATE crs_items SET ".
"position = ".$ilDB->quote($node_b["position"])." ".
"WHERE obj_id = ".$ilDB->quote($node_a["obj_id"])." ".
"AND parent_id = ".$ilDB->quote($this->getParentId())."";
$res = $this->ilDB->query($query);
return true;
}

+ Here is the call graph for this function:

ilCourseItems::_getItem (   $a_item_id)

Definition at line 907 of file class.ilCourseItems.php.

References $data, $ilDB, $res, ilTimingPlaned\_getPlanedTimings(), DB_FETCHMODE_OBJECT, IL_CRS_TIMINGS_ACTIVATION, and IL_CRS_TIMINGS_PRESETTING.

Referenced by ilTimingCache\_getTimings(), and ilTimingPlaned\validate().

{
include_once 'Modules/Course/classes/class.ilObjCourse.php';
global $ilDB,$ilUser;
$query = "SELECT * FROM crs_items ".
"WHERE obj_id = ".$ilDB->quote($a_item_id)." ";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$data['parent_id'] = $row->parent_id;
$data['obj_id'] = $row->obj_id;
$data['timing_type'] = $row->timing_type;
$data['timing_start'] = $row->timing_start;
$data['timing_end'] = $row->timing_end;
$data["suggestion_start"] = $row->suggestion_start ? $row->suggestion_start :
mktime(0,0,1,date('n',time()),date('j',time()),date('Y',time()));
$data["suggestion_end"] = $row->suggestion_end ? $row->suggestion_end :
mktime(23,55,00,date('n',time()),date('j',time()),date('Y',time()));
$data['changeable'] = $row->changeable;
$data['earliest_start'] = $row->earliest_start ? $row->earliest_start :
mktime(0,0,1,date('n',time()),date('j',time()),date('Y',time()));
$data['latest_end'] = $row->latest_end ? $row->latest_end :
mktime(23,55,00,date('n',time()),date('j',time()),date('Y',time()));
$data['visible'] = $row->visible;
include_once 'Modules/Course/classes/Timings/class.ilTimingPlaned.php';
$user_data = ilTimingPlaned::_getPlanedTimings($ilUser->getId(),$data['child']);
// Check for user entry
if($data['changeable'] and
$data['timing_type'] == IL_CRS_TIMINGS_PRESETTING)
{
if($user_data['planed_start'])
{
$data['start'] = $user_data['planed_start'];
$data['end'] = $user_data['planed_end'];
$data['activation_info'] = 'crs_timings_planed_info';
}
else
{
$data['start'] = $row->suggestion_start;
$data['end'] = $row->suggestion_end;
$data['activation_info'] = 'crs_timings_suggested_info';
}
}
elseif($data['timing_type'] == IL_CRS_TIMINGS_PRESETTING)
{
$data['start'] = $row->suggestion_start;
$data['end'] = $row->suggestion_end;
$data['activation_info'] = 'crs_timings_suggested_info';
}
elseif($data['timing_type'] == IL_CRS_TIMINGS_ACTIVATION)
{
$data['start'] = $row->timing_start;
$data['end'] = $row->timing_end;
$data['activation_info'] = 'activation';
}
else
{
$data['start'] = 999999999;
}
}
return $data ? $data : array();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCourseItems::_hasChangeableTimings (   $a_ref_id)

Definition at line 216 of file class.ilCourseItems.php.

References $ilDB, $res, $tree, IL_CRS_TIMINGS_PRESETTING, and ilUtil\quoteArray().

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

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCourseItems::_hasCollectionTimings (   $a_ref_id)

Definition at line 157 of file class.ilCourseItems.php.

References $ilDB, $res, $tree, ilLPCollectionCache\_getItems(), ilLPObjSettings\_lookupMode(), IL_CRS_TIMINGS_PRESETTING, LP_MODE_COLLECTION, LP_MODE_MANUAL_BY_TUTOR, and ilUtil\quoteArray().

Referenced by ilLPListOfProgressGUI\__showContainerList(), ilPDFPresentation\__showItems(), and ilLPListOfObjectsGUI\__showUsersList().

{
global $tree,$ilDB,$ilObjDataCache;
// get all collections
include_once 'Services/Tracking/classes/class.ilLPObjSettings.php';
$obj_id = $ilObjDataCache->lookupObjId($a_ref_id);
{
include_once 'Services/Tracking/classes/class.ilLPCollectionCache.php';
break;
default:
$ids = array($a_ref_id);
break;
}
if(!$ids)
{
return false;
}
$query = "SELECT * FROM crs_items ".
"WHERE timing_type = ".$ilDB->quote(IL_CRS_TIMINGS_PRESETTING)." ".
"AND obj_id IN(".implode(",",ilUtil::quoteArray($ids)).")";
$res = $ilDB->query($query);
return $res->numRows() ? true :false;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCourseItems::_hasTimings (   $a_ref_id)

check if there is any active timing

public

Parameters
intref_id
Returns

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

References $ilDB, $res, $tree, IL_CRS_TIMINGS_PRESETTING, and ilUtil\quoteArray().

Referenced by ilObjCourseGUI\membersObject().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCourseItems::_isActivated (   $a_item_id)

Definition at line 974 of file class.ilCourseItems.php.

References $ilDB, $res, and DB_FETCHMODE_OBJECT.

Referenced by ilRepositoryExplorer\isVisible(), and ilObjectGUI\isVisible().

{
global $ilDB;
$query = "SELECT * FROM crs_items ".
"WHERE obj_id = ".$ilDB->quote($a_item_id)." ";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
if($row->activation_unlimited)
{
return true;
}
if(time() > $row->activation_start and time() < $row->activation_end)
{
return true;
}
}
return false;
}

+ Here is the caller graph for this function:

static ilCourseItems::_readActivationTimes (   $a_ref_ids)
static

read activation times

public

Parameters
arrayarray(int) ref_ids

Definition at line 1003 of file class.ilCourseItems.php.

References $ilDB, $res, DB_FETCHMODE_OBJECT, and ilUtil\quoteArray().

Referenced by ilAccessHandler\doActivationCheck(), and ilAccessHandler\preloadActivationTimes().

{
global $ilDB;
if(!is_array($a_ref_ids) or !$a_ref_ids)
{
return array();
}
$query = "SELECT obj_id,timing_type,timing_start,timing_end,visible FROM crs_items ".
"WHERE obj_id IN (".implode(',',ilUtil::quoteArray($a_ref_ids)).")";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$ac_times[(string) $row->obj_id]['obj_id'] = $row->obj_id;
$ac_times[(string) $row->obj_id]['timing_type'] = $row->timing_type;
$ac_times[(string) $row->obj_id]['timing_start'] = $row->timing_start;
$ac_times[(string) $row->obj_id]['timing_end'] = $row->timing_end;
$ac_times[(string) $row->obj_id]['visible'] = $row->visible;
}
return $ac_times ? $ac_times : array();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilCourseItems::_sort (   $a_sort_mode,
  $a_items 
)
static

sort items

public

Parameters
@return

Definition at line 836 of file class.ilCourseItems.php.

References IL_CRS_TIMINGS_DEACTIVATED, ilContainer\SORT_ACTIVATION, and ilUtil\sortArray().

Referenced by ilCourseContentGUI\__showMaterials().

{
switch($a_sort_mode)
{
// Sort by starting time. If mode is IL_CRS_TIMINGS_DEACTIVATED then sort these items by title and append
// them to the array.
$inactive = $active = array();
foreach($a_items as $item)
{
if($item['timing_type'] == IL_CRS_TIMINGS_DEACTIVATED)
{
$inactive[] = $item;
}
else
{
$active[] = $item;
}
}
$sorted_active = ilUtil::sortArray($active,"start","asc");
$sorted_inactive = ilUtil::sortArray($inactive,'title','asc');
return array_merge($sorted_active,$sorted_inactive);
break;
default:
return $a_items;
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCourseItems::addAdditionalSubItemInformation ( $a_item)

Adds information to object/item array needed to be displayed in repository.

Definition at line 1030 of file class.ilCourseItems.php.

{
if (is_array($this->items_per_child[$a_item["child"]]))
{
$a_item = array_merge($a_item, $this->items_per_child[$a_item["child"]]);
}
}
ilCourseItems::cloneDependencies (   $a_target_id,
  $a_copy_id 
)

Clone dependencies.

public

Parameters
inttarget ref_id
intcopy id

Definition at line 80 of file class.ilCourseItems.php.

References $ilLog, $res, ilCopyWizardOptions\_getInstance(), DB_FETCHMODE_OBJECT, ilObjectFactory\getInstanceByRefId(), getParentId(), and ilCourseItems().

{
global $ilObjDataCache,$ilLog;
$ilLog->write(__METHOD__.': Begin course items...');
$target_obj_id = $ilObjDataCache->lookupObjId($a_target_id);
include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
$cp_options = ilCopyWizardOptions::_getInstance($a_copy_id);
$mappings = $cp_options->getMappings();
$query = "SELECT * FROM crs_items WHERE ".
"parent_id = ".$this->ilDB->quote($this->getParentId())." ";
$res = $this->ilDB->query($query);
if(!$res->numRows())
{
$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;
}
$new_items = new ilCourseItems($this->course_obj,$a_target_id);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
if(!isset($mappings[$row->parent_id]) or !$mappings[$row->parent_id])
{
$ilLog->write(__METHOD__.': No mapping for parent nr. '.$row->parent_id);
continue;
}
if(!isset($mappings[$row->obj_id]) or !$mappings[$row->obj_id])
{
$ilLog->write(__METHOD__.': No mapping for item nr. '.$row->obj_id);
continue;
}
$new_item_id = $mappings[$row->obj_id];
$new_parent = $mappings[$row->parent_id];
$new_items->setItemId($new_item_id);
$new_items->setParentId($new_parent);
$new_items->setTimingType($row->timing_type);
$new_items->setTimingStart($row->timing_start);
$new_items->setTimingEnd($row->timing_end);
$new_items->setSuggestionStart($row->suggestion_start);
$new_items->setSuggestionEnd($row->suggestion_end);
$new_items->toggleChangeable($row->changeable);
$new_items->setEarliestStart($row->earliest_start);
$new_items->setLatestEnd($row->latest_end);
$new_items->toggleVisible($row->visible);
$new_items->update($new_item_id);
$ilLog->write(__METHOD__.': Added new entry for item nr. '.$row->obj_id);
}
$ilLog->write(__METHOD__.': Finished course items.');
}

+ Here is the call graph for this function:

ilCourseItems::createDefaultEntry (   $a_item)

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

References $ilDB, $res, and IL_CRS_TIMINGS_DEACTIVATED.

Referenced by __getItemData().

{
global $ilDB, $objDefinition;
$a_item["timing_type"] = IL_CRS_TIMINGS_DEACTIVATED;
$a_item["timing_start"] = time();
$a_item["timing_end"] = time();
$a_item["suggestion_start"] = time();
$a_item["suggestion_end"] = time();
$a_item['visible'] = 0;
$a_item['changeable'] = 0;
$a_item['earliest_start'] = time();
$a_item['latest_end'] = mktime(23,55,00,date('n',time()),date('j',time()),date('Y',time()));
$a_item['visible'] = 0;
$a_item['changeable'] = 0;
$query = "INSERT INTO crs_items ".
"VALUES(".$ilDB->quote($a_item['parent']).",".
$ilDB->quote($a_item["child"]).",".
$ilDB->quote($a_item["timing_type"]).",".
$ilDB->quote($a_item["timing_start"]).",".
$ilDB->quote($a_item["timing_end"]).",".
$ilDB->quote($a_item["suggestion_start"]).",".
$ilDB->quote($a_item["suggestion_end"]).",".
$ilDB->quote($a_item["changeable"]).",".
$ilDB->quote($a_item['earliest_start']).", ".
$ilDB->quote($a_item['latest_end']).", ".
$ilDB->quote($a_item["visible"]).", ".
$ilDB->quote(0).")";
$res = $this->ilDB->query($query);
return $a_item;
}

+ Here is the caller graph for this function:

ilCourseItems::deleteAllEntries ( )

Definition at line 525 of file class.ilCourseItems.php.

References $ilDB.

{
global $ilDB;
$all_items = $this->tree->getChilds($this->parent);
foreach($all_items as $item)
{
$query = "DELETE FROM crs_items ".
"WHERE parent_id = ".$ilDB->quote($item["child"])."";
$this->ilDB->query($query);
}
$query = "DELETE FROM crs_items ".
"WHERE parent_id = ".$ilDB->quote($this->course_obj->getRefId())." ";
$this->ilDB->query($query);
return true;
}
ilCourseItems::enabledChangeable ( )

Definition at line 319 of file class.ilCourseItems.php.

Referenced by save(), and update().

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

+ Here is the caller graph for this function:

ilCourseItems::enabledVisible ( )

Definition at line 311 of file class.ilCourseItems.php.

Referenced by save(), and update().

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

+ Here is the caller graph for this function:

ilCourseItems::getAllItems ( )

Definition at line 329 of file class.ilCourseItems.php.

{
return $this->items ? $this->items : array();
}
ilCourseItems::getEarliestStart ( )

Definition at line 295 of file class.ilCourseItems.php.

Referenced by save(), and 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:

ilCourseItems::getFilteredItems (   $a_container_ref_id)

Get all items.

(No events, no side blocks)

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

References ilEventItems\_getItemsOfContainer().

Referenced by ilCourseContentGUI\__editUserTimings().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCourseItems::getItem (   $a_item_id)

Definition at line 408 of file class.ilCourseItems.php.

Referenced by ilCourseContentGUI\updateTimings().

{
foreach($this->items as $item)
{
if($item["child"] == $a_item_id)
{
return $item;
}
}
return array();
}

+ Here is the caller graph for this function:

ilCourseItems::getItemId ( )

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

Referenced by save().

{
return $this->item_id;
}

+ Here is the caller graph for this function:

ilCourseItems::getItems ( )

Definition at line 390 of file class.ilCourseItems.php.

Referenced by ilCourseContentGUI\__editAdvancedUserTimings(), and ilCourseContentGUI\showUserTimings().

{
global $rbacsystem;
foreach($this->items as $item)
{
if($item["type"] != "rolf" and
($item["timing_type"] or
($item["timing_start"] <= time() and $item["timing_end"] >= time())))
{
if($rbacsystem->checkAccess('visible',$item['ref_id']))
{
$filtered[] = $item;
}
}
}
return $filtered ? $filtered : array();
}

+ Here is the caller graph for this function:

ilCourseItems::getItemsByEvent (   $a_event_id)

Definition at line 355 of file class.ilCourseItems.php.

References $items, and __getItemData().

{
include_once 'Modules/Session/classes/class.ilEventItems.php';
$event_items_obj = new ilEventItems($a_event_id);
$event_items = $event_items_obj->getItems();
foreach($event_items as $item)
{
if($this->tree->isDeleted($item))
{
continue;
}
$node = $this->tree->getNodeData($item);
$items[] = $this->__getItemData($node);
}
return $items ? $items : array();
}

+ Here is the call graph for this function:

ilCourseItems::getItemsByObjective (   $a_objective_id)

Definition at line 373 of file class.ilCourseItems.php.

References $items, $ref_id, __getItemData(), and ilCourseObjectiveMaterials\_getAssignedMaterials().

{
include_once('./Modules/Course/classes/class.ilCourseObjectiveMaterials.php');
{
if($this->tree->isDeleted($ref_id))
{
continue;
}
$node = $this->tree->getNodeData($ref_id);
$items[] = $this->__getItemData($node);
}
return $items ? $items : array();
}

+ Here is the call graph for this function:

ilCourseItems::getLatestEnd ( )

Definition at line 303 of file class.ilCourseItems.php.

Referenced by save(), and 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:

ilCourseItems::getParentId ( )

Definition at line 245 of file class.ilCourseItems.php.

References $parent.

Referenced by __delete(), __getLastPosition(), __purgeDeleted(), __switchNodes(), cloneDependencies(), save(), and update().

{
return $this->parent;
}

+ Here is the caller graph for this function:

ilCourseItems::getSuggestionEnd ( )

Definition at line 287 of file class.ilCourseItems.php.

Referenced by save(), 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:

ilCourseItems::getSuggestionStart ( )

Definition at line 279 of file class.ilCourseItems.php.

Referenced by save(), 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:

ilCourseItems::getTimingEnd ( )

Definition at line 271 of file class.ilCourseItems.php.

References $timing_end.

Referenced by save(), update(), and validateActivation().

{
}

+ Here is the caller graph for this function:

ilCourseItems::getTimingStart ( )

Definition at line 263 of file class.ilCourseItems.php.

References $timing_start.

Referenced by save(), update(), and validateActivation().

{
}

+ Here is the caller graph for this function:

ilCourseItems::getTimingType ( )

Definition at line 254 of file class.ilCourseItems.php.

References $timing_type.

Referenced by save(), update(), and validateActivation().

{
}

+ Here is the caller graph for this function:

ilCourseItems::getUserId ( )

Definition at line 150 of file class.ilCourseItems.php.

Referenced by __getItemData().

{
global $ilUser;
return $this->user_id ? $this->user_id : $ilUser->getId();
}

+ Here is the caller graph for this function:

ilCourseItems::ilCourseItems ( $course_obj,
  $a_parent = 0,
  $user_id = 0 
)

Definition at line 55 of file class.ilCourseItems.php.

References $course_obj, $ilDB, $ilErr, $lng, $tree, and setParentId().

Referenced by cloneDependencies().

{
$this->ilErr =& $ilErr;
$this->ilDB =& $ilDB;
$this->lng =& $lng;
$this->tree =& $tree;
$this->course_obj =& $course_obj;
$this->user_id = $user_id;
$this->setParentId($a_parent); // this implicitly calls __read
//$this->__read();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCourseItems::moveDown (   $item_id)

Definition at line 518 of file class.ilCourseItems.php.

References __read().

{
$this->__read();
return true;
}

+ Here is the call graph for this function:

ilCourseItems::moveUp (   $item_id)

Definition at line 512 of file class.ilCourseItems.php.

References __read().

{
$this->__read();
return true;
}

+ Here is the call graph for this function:

ilCourseItems::save ( )

Save.

public

Definition at line 466 of file class.ilCourseItems.php.

References $ilLog, $res, enabledChangeable(), enabledVisible(), getEarliestStart(), getItemId(), getLatestEnd(), getParentId(), getSuggestionEnd(), getSuggestionStart(), getTimingEnd(), getTimingStart(), and getTimingType().

{
global $ilLog;
$query = "INSERT INTO crs_items SET ".
"timing_type = ".$ilDB->quote($this->getTimingType()).", ".
"timing_start = ".$ilDB->quote($this->getTimingStart()).", ".
"timing_end = ".$ilDB->quote($this->getTimingEnd()).", ".
"suggestion_start = ".$ilDB->quote($this->getSuggestionStart()).", ".
"suggestion_end = ".$ilDB->quote($this->getSuggestionEnd()).", ".
"changeable = ".$ilDB->quote($this->enabledChangeable()).", ".
"earliest_start = ".$ilDB->quote($this->getEarliestStart()).", ".
"latest_end = ".$ilDB->quote($this->getLatestEnd()).", ".
"visible = ".$ilDB->quote($this->enabledVisible()).", ".
"parent_id = ".$ilDB->quote($this->getParentId()).", ".
"obj_id = ".$ilDB->quote($this->getItemId())." ";
$ilLog->write(__METHOD__.': '.$query);
$res = $this->ilDB->query($query);
}

+ Here is the call graph for this function:

ilCourseItems::setEarliestStart (   $a_start)

Definition at line 291 of file class.ilCourseItems.php.

{
$this->earliest_start = $a_start;
}
ilCourseItems::setItemId (   $a_item_id)

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

{
$this->item_id = $a_item_id;
}
ilCourseItems::setLatestEnd (   $a_end)

Definition at line 299 of file class.ilCourseItems.php.

{
$this->latest_end = $a_end;
}
ilCourseItems::setParentId (   $a_parent = 0)

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

References __read().

Referenced by ilCourseItems().

{
$this->parent = $a_parent ? $a_parent : $this->course_obj->getRefId();
$this->__read();
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCourseItems::setPosition (   $a_pos)

Definition at line 324 of file class.ilCourseItems.php.

{
$this->position = $a_pos;
}
ilCourseItems::setSuggestionEnd (   $a_end)

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

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

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

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

Definition at line 267 of file class.ilCourseItems.php.

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

Definition at line 259 of file class.ilCourseItems.php.

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

Definition at line 250 of file class.ilCourseItems.php.

{
$this->timing_type = $a_type;
}
ilCourseItems::toggleChangeable (   $a_status)

Definition at line 315 of file class.ilCourseItems.php.

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

Definition at line 307 of file class.ilCourseItems.php.

{
$this->visible = (int) $a_status;
}
ilCourseItems::update (   $a_item_id)

Definition at line 488 of file class.ilCourseItems.php.

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

{
global $ilDB;
$query = "UPDATE crs_items SET ".
"timing_type = ".$ilDB->quote($this->getTimingType()).", ".
"timing_start = ".$ilDB->quote($this->getTimingStart()).", ".
"timing_end = ".$ilDB->quote($this->getTimingEnd()).", ".
"suggestion_start = ".$ilDB->quote($this->getSuggestionStart()).", ".
"suggestion_end = ".$ilDB->quote($this->getSuggestionEnd()).", ".
"changeable = ".$ilDB->quote($this->enabledChangeable()).", ".
"earliest_start = ".$ilDB->quote($this->getEarliestStart()).", ".
"latest_end = ".$ilDB->quote($this->getLatestEnd()).", ".
"visible = ".$ilDB->quote($this->enabledVisible())." ".
"WHERE parent_id = ".$ilDB->quote($this->getParentId())." ".
"AND obj_id = ".$ilDB->quote($a_item_id)."";
$res = $this->ilDB->query($query);
$this->__read();
return true;
}

+ Here is the call graph for this function:

ilCourseItems::validateActivation ( )

Definition at line 420 of file class.ilCourseItems.php.

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

{
global $ilErr;
$ilErr->setMessage('');
{
if($this->getTimingStart() > $this->getTimingEnd())
{
$ilErr->appendMessage($this->lng->txt("crs_activation_start_invalid"));
}
}
{
if($this->getSuggestionStart() > $this->getSuggestionEnd())
{
$ilErr->appendMessage($this->lng->txt('crs_latest_end_not_valid'));
}
}
// Disabled
#if($this->getTimingType() == IL_CRS_TIMINGS_PRESETTING and
# $this->enabledChangeable())
#{
# if($this->getSuggestionStart() < $this->getEarliestStart() or
# $this->getSuggestionEnd() > $this->getLatestEnd() or
# $this->getSuggestionStart() > $this->getLatestEnd() or
# $this->getSuggestionEnd() < $this->getEarliestStart())
# {
# $ilErr->appendMessage($this->lng->txt("crs_suggestion_not_within_activation"));
# }
#}
if($ilErr->getMessage())
{
return false;
}
return true;
}

+ Here is the call graph for this function:

Field Documentation

ilCourseItems::$course_obj

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

Referenced by ilCourseItems().

ilCourseItems::$ilErr

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

Referenced by ilCourseItems(), and validateActivation().

ilCourseItems::$items

Definition at line 47 of file class.ilCourseItems.php.

Referenced by getItemsByEvent(), and getItemsByObjective().

ilCourseItems::$lng

Definition at line 45 of file class.ilCourseItems.php.

Referenced by ilCourseItems().

ilCourseItems::$parent

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

Referenced by getParentId().

ilCourseItems::$timing_end

Definition at line 52 of file class.ilCourseItems.php.

Referenced by getTimingEnd().

ilCourseItems::$timing_start

Definition at line 51 of file class.ilCourseItems.php.

Referenced by getTimingStart().

ilCourseItems::$timing_type

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

Referenced by getTimingType().

ilCourseItems::$tree

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