Public Member Functions | Data Fields

ilLPCollections Class Reference

Public Member Functions

 ilLPCollections ($a_obj_id)
 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 258 of file class.ilLPCollections.php.

References $query.

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 270 of file class.ilLPCollections.php.

References $query, $res, $row, __deleteEntry(), ilObject::_getAllReferences(), _getPossibleItems(), ilObjTest::_lookupTestType(), 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 'assessment/classes/class.ilObjTest.php';
                                if(ilObjTest::_lookupTestType($item_obj_id) == TYPE_SELF_ASSESSMENT)
                                {
                                        $this->__deleteEntry($a_obj_id,$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 184 of file class.ilLPCollections.php.

References $query.

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 133 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 138 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 195 of file class.ilLPCollections.php.

References $items, $query, $res, $row, __deleteEntry(), ilObject::_getAllReferences(), ilCourseObjective::_getObjectiveIds(), _getPossibleItems(), ilLPObjSettings::_lookupMode(), and ilObjTest::_lookupTestType().

        {
                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 'course/classes/class.ilCourseObjective.php';
                        return ilCourseObjective::_getObjectiveIds($a_obj_id);
                }
                if($mode != LP_MODE_SCORM and $mode != LP_MODE_COLLECTION)
                {
                        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 = '".$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 'assessment/classes/class.ilObjTest.php';
                                if(ilObjTest::_lookupTestType($item_obj_id) == TYPE_SELF_ASSESSMENT)
                                {
                                        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 98 of file class.ilLPCollections.php.

References $tree.

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 '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 148 of file class.ilLPCollections.php.

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

Referenced by ilLPListOfSettingsGUI::__showSCOTable(), _getCountPossibleSAHSItems(), ilConditionHandlerInterface::add(), and ilConditionHandlerInterface::edit().

        {
                include_once './content/classes/class.ilObjSAHSLearningModule.php';

                switch(ilObjSAHSLearningModule::_lookupSubType($target_id))
                {
                        case 'hacp':
                        case 'aicc':
                                include_once './content/classes/class.ilObjAICCLearningModule.php';

                                foreach(ilObjAICCLearningModule::_getTrackingItems($target_id) as $item)
                                {
                                        $items["$item[obj_id]"]['title'] = $item['title'];
                                        #$items[$item->getId()]['title'] = $item->getTitle();
                                }
                                return $items ? $items : array();

                        case 'scorm':
                                include_once './content/classes/class.ilObjSCORMLearningModule.php';
                                include_once './content/classes/SCORM/class.ilSCORMItem.php';

                                foreach(ilObjSCORMLearningModule::_getTrackingItems($target_id) as $item)
                                {
                                        $items[$item->getId()]['title'] = $item->getTitle();
                                }
                                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 68 of file class.ilLPCollections.php.

References $query, and __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::delete ( item_id  ) 

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

References $query, and __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 178 of file class.ilLPCollections.php.

References _deleteAll(), and getObjId().

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

Here is the call graph for this function:

ilLPCollections::getItems (  ) 

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

        {
                return $this->items;
        }

ilLPCollections::getObjId (  ) 

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

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

        {
                global $ilObjDataCache,$ilDB;

                $this->db =& $ilDB;

                $this->obj_id = $a_obj_id;

                $this->__read();
        }

Here is the call graph for this function:

ilLPCollections::isAssigned ( a_ref_id  ) 

Definition at line 63 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(), and _getPossibleSAHSItems().

ilLPCollections::$obj_id = null

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


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