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

Public Member Functions

 ilLPCollections ($a_obj_id)
 cloneCollections ($a_target_id, $a_copy_id)
 Clone collections.
 getObjId ()
 getItems ()
 isAssigned ($a_ref_id)
 add ($item_id)
 delete ($item_id)
 _getPossibleItems ($a_target_id)
 _getCountPossibleItems ($a_target_id)
 _getCountPossibleSAHSItems ($a_target_id)
 _getPossibleSAHSItems ($target_id)
 get all tracking items of scorm or aicc object
 deleteAll ()
 _deleteAll ($a_obj_id)
_getItems ($a_obj_id)
 __deleteEntry ($a_obj_id, $a_item_id)
 __read ()

Data Fields

 $db = null
 $obj_id = null
 $items = array()

Detailed Description

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

Member Function Documentation

ilLPCollections::__deleteEntry (   $a_obj_id,
  $a_item_id 
)

Definition at line 297 of file class.ilLPCollections.php.

Referenced by __read(), and _getItems().

{
global $ilDB;
$query = "DELETE FROM ut_lp_collections ".
"WHERE obj_id = '".$a_obj_id."' ".
"AND item_id = '".$a_item_id."'";
$ilDB->query($query);
return true;
}

+ Here is the caller graph for this function:

ilLPCollections::__read ( )

Definition at line 309 of file class.ilLPCollections.php.

References $res, __deleteEntry(), ilObject\_getAllReferences(), _getPossibleItems(), ilObjTest\_lookupAnonymity(), DB_FETCHMODE_OBJECT, and getObjId().

Referenced by add(), delete(), and ilLPCollections().

{
global $ilObjDataCache;
if($ilObjDataCache->lookupType($this->getObjId()) != 'sahs')
{
$course_ref_ids = ilObject::_getAllReferences($this->getObjId());
$course_ref_id = end($course_ref_ids);
$query = "SELECT * FROM ut_lp_collections as utc ".
"JOIN object_reference as obr ON item_id = ref_id ".
"JOIN object_data as obd ON obr.obj_id = obd.obj_id ".
"WHERE utc.obj_id = ".$this->db->quote($this->obj_id)." ".
"ORDER BY title";
}
else
{
$query = "SELECT * FROM ut_lp_collections WHERE obj_id = '".$this->getObjId()."'";
}
$res = $this->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
if($ilObjDataCache->lookupType($this->getObjId()) != 'sahs')
{
if(!in_array($row->item_id,ilLPCollections::_getPossibleItems($course_ref_id)))
{
$this->__deleteEntry($this->getObjId(),$row->item_id);
continue;
}
}
// Check anonymized
if($ilObjDataCache->lookupType($item_obj_id = $ilObjDataCache->lookupObjId($row->item_id)) == 'tst')
{
include_once './Modules/Test/classes/class.ilObjTest.php';
if(ilObjTest::_lookupAnonymity($item_obj_id))
{
$this->__deleteEntry($this->getObjId(),$row->item_id);
continue;
}
}
$this->items[] = $row->item_id;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLPCollections::_deleteAll (   $a_obj_id)

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

Referenced by deleteAll().

{
global $ilDB;
$query = "DELETE FROM ut_lp_collections ".
"WHERE obj_id = '".$a_obj_id."'";
$ilDB->query($query);
return true;
}

+ Here is the caller graph for this function:

ilLPCollections::_getCountPossibleItems (   $a_target_id)

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

References _getPossibleItems().

Referenced by ilLPListOfSettingsGUI\__showCollectionTable().

{
return count(ilLPCollections::_getPossibleItems($a_target_id));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLPCollections::_getCountPossibleSAHSItems (   $a_target_id)

Definition at line 168 of file class.ilLPCollections.php.

References _getPossibleSAHSItems().

Referenced by ilLPObjSettings\getValidModes().

{
return count(ilLPCollections::_getPossibleSAHSItems($a_target_id));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& ilLPCollections::_getItems (   $a_obj_id)

Definition at line 234 of file class.ilLPCollections.php.

References $items, $res, __deleteEntry(), ilObject\_getAllReferences(), ilCourseObjective\_getObjectiveIds(), _getPossibleItems(), ilObjTest\_lookupAnonymity(), ilLPObjSettings\_lookupMode(), DB_FETCHMODE_OBJECT, LP_MODE_COLLECTION, LP_MODE_MANUAL_BY_TUTOR, LP_MODE_OBJECTIVES, and LP_MODE_SCORM.

{
global $ilObjDataCache;
global $ilDB;
include_once 'Services/Tracking/classes/class.ilLPObjSettings.php';
$mode = ilLPObjSettings::_lookupMode($a_obj_id);
if($mode == LP_MODE_OBJECTIVES)
{
include_once 'Modules/Course/classes/class.ilCourseObjective.php';
}
if($mode != LP_MODE_SCORM and $mode != LP_MODE_COLLECTION and $mode != LP_MODE_MANUAL_BY_TUTOR)
{
return array();
}
if($ilObjDataCache->lookupType($a_obj_id) != 'sahs')
{
$course_ref_ids = ilObject::_getAllReferences($a_obj_id);
$course_ref_id = end($course_ref_ids);
$possible_items = ilLPCollections::_getPossibleItems($course_ref_id);
$query = "SELECT * FROM ut_lp_collections as utc ".
"JOIN object_reference as obr ON item_id = ref_id ".
"JOIN object_data as obd ON obr.obj_id = obd.obj_id ".
"WHERE utc.obj_id = ".$ilDB->quote($a_obj_id)." ".
"ORDER BY title";
}
else
{
// SAHS
$query = "SELECT * FROM ut_lp_collections WHERE obj_id = '".$a_obj_id."'";
}
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
if($ilObjDataCache->lookupType($a_obj_id) != 'sahs')
{
if(!in_array($row->item_id,$possible_items))
{
ilLPCollections::__deleteEntry($a_obj_id,$row->item_id);
continue;
}
}
// Check anonymized
if($ilObjDataCache->lookupType($item_obj_id = $ilObjDataCache->lookupObjId($row->item_id)) == 'tst')
{
include_once './Modules/Test/classes/class.ilObjTest.php';
if(ilObjTest::_lookupAnonymity($item_obj_id))
{
ilLPCollections::__deleteEntry($a_obj_id,$row->item_id);
continue;
}
}
$items[] = $row->item_id;
}
return $items ? $items : array();
}

+ Here is the call graph for this function:

ilLPCollections::_getPossibleItems (   $a_target_id)

Definition at line 127 of file class.ilLPCollections.php.

Referenced by __read(), ilLPListOfSettingsGUI\__showCollectionTable(), _getCountPossibleItems(), and _getItems().

{
global $tree;
if($tree->isDeleted($a_target_id))
{
return array();
}
$node_data = $tree->getNodeData($a_target_id);
foreach($tree->getSubTree($node_data) as $node)
{
// avoid recursion
if($node['ref_id'] == $a_target_id)
{
continue;
}
switch($node['type'])
{
case 'sess':
case 'exc':
case 'fold':
case 'grp':
case 'sahs':
case 'lm':
case 'tst':
case 'htlm':
$all_possible[] = $node['ref_id'];
break;
}
}
return $all_possible ? $all_possible : array();
}

+ Here is the caller graph for this function:

ilLPCollections::_getPossibleSAHSItems (   $target_id)

get all tracking items of scorm or aicc object

Definition at line 178 of file class.ilLPCollections.php.

References $items, $target_id, ilObjSCORMLearningModule\_getTrackingItems(), ilObjAICCLearningModule\_getTrackingItems(), ilObjSCORM2004LearningModule\_getTrackingItems(), and ilObjSAHSLearningModule\_lookupSubType().

Referenced by ilLPListOfSettingsGUI\__showSCOTable(), _getCountPossibleSAHSItems(), and ilConditionHandlerInterface\initFormCondition().

{
include_once './Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php';
{
case 'hacp':
case 'aicc':
include_once './Modules/ScormAicc/classes/class.ilObjAICCLearningModule.php';
{
$items["$item[obj_id]"]['title'] = $item['title'];
#$items[$item->getId()]['title'] = $item->getTitle();
}
return $items ? $items : array();
case 'scorm':
include_once './Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php';
include_once './Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php';
{
$items[$item->getId()]['title'] = $item->getTitle();
}
return $items ? $items : array();
case 'scorm2004':
include_once './Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php';
{
$items[$item["id"]]['title'] = $item["title"];
}
return $items ? $items : array();
}
return array();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLPCollections::add (   $item_id)

Definition at line 97 of file class.ilLPCollections.php.

References __read().

{
$query = "DELETE FROM ut_lp_collections ".
"WHERE obj_id = '".$this->obj_id."' ".
"AND item_id = '".(int) $item_id."'";
$this->db->query($query);
$query = "REPLACE INTO ut_lp_collections ".
"SET obj_id = '".$this->obj_id."', ".
"item_id = '".(int) $item_id."'";
$this->db->query($query);
$this->__read();
return true;
}

+ Here is the call graph for this function:

ilLPCollections::cloneCollections (   $a_target_id,
  $a_copy_id 
)

Clone collections.

public

Parameters

Definition at line 60 of file class.ilLPCollections.php.

References $ilLog, ilCopyWizardOptions\_getInstance(), and ilLPCollections().

{
global $ilObjDataCache,$ilLog;
$target_obj_id = $ilObjDataCache->lookupObjId($a_target_id);
include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
$mappings = $cwo->getMappings();
$new_collections = new ilLPCollections($target_obj_id);
foreach($this->items as $item)
{
if(!isset($mappings[$item]) or !$mappings[$item])
{
continue;
}
$new_collections->add($mappings[$item]);
$ilLog->write(__METHOD__.': Added learning progress collection.');
}
}

+ Here is the call graph for this function:

ilLPCollections::delete (   $item_id)

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

References __read().

{
$query = "DELETE FROM ut_lp_collections ".
"WHERE item_id = '".$item_id."' ".
"AND obj_id = '".$this->obj_id."'";
$this->db->query($query);
$this->__read();
return true;
}

+ Here is the call graph for this function:

ilLPCollections::deleteAll ( )

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

References _deleteAll(), and getObjId().

Referenced by ilConditionHandlerInterface\assign().

{
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLPCollections::getItems ( )

Definition at line 87 of file class.ilLPCollections.php.

References $items.

{
return $this->items;
}
ilLPCollections::getObjId ( )

Definition at line 82 of file class.ilLPCollections.php.

References $obj_id.

Referenced by __read(), and deleteAll().

{
return (int) $this->obj_id;
}

+ Here is the caller graph for this function:

ilLPCollections::ilLPCollections (   $a_obj_id)

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

References __read().

Referenced by cloneCollections().

{
global $ilObjDataCache,$ilDB;
$this->db =& $ilDB;
$this->obj_id = $a_obj_id;
$this->__read();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLPCollections::isAssigned (   $a_ref_id)

Definition at line 92 of file class.ilLPCollections.php.

{
return (bool) in_array($a_ref_id,$this->items);
}

Field Documentation

ilLPCollections::$db = null

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

ilLPCollections::$items = array()

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

Referenced by _getItems(), _getPossibleSAHSItems(), and getItems().

ilLPCollections::$obj_id = null

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

Referenced by getObjId().


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