Public Member Functions | Data Fields

ilLPCollections Class Reference

Public Member Functions

 ilLPCollections ($a_obj_id)
 getObjId ()
 getItems ()
 isAssigned ($a_obj_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 ($a_obj_id)
 _getItems ($a_obj_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::__read (  ) 

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

References $ilObjDataCache, $query, $res, $row, ilObject::_getAllReferences(), _getPossibleItems(), and getObjId().

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

        {
                global $ilObjDataCache;

                if($ilObjDataCache->lookupType($this->getObjId()) == 'crs')
                {
                        $course_ref_ids = ilObject::_getAllReferences($this->getObjId());
                        $course_ref_id = end($course_ref_ids);
                }

                $query = "SELECT * FROM ut_lp_collections WHERE obj_id = '".$this->db->quote($this->obj_id)."'";
                $res = $this->db->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        if($ilObjDataCache->lookupType($this->getObjId()) == 'crs')
                        {
                                if(!in_array($row->item_id,ilLPCollections::_getPossibleItems($course_ref_id)))
                                {
                                        $query = "DELETE FROM ut_lp_collections ".
                                                "WHERE obj_id = '".$this->getObjId()."' ".
                                                "AND item_id = '".$row->item_id."'";
                                        $this->db->query($query);
                                        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 165 of file class.ilLPCollections.php.

References $query.

        {
                global $ilDB;

                $query = "DELETE FROM ut_lp_collections ".
                        "WHERE obj_id = '".$a_obj_id."'";
                $ilDB->query($query);

                return true;
        }

ilLPCollections::_getCountPossibleItems ( a_target_id  ) 

Definition at line 119 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 124 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 176 of file class.ilLPCollections.php.

References $ilObjDataCache, $items, $query, $res, $row, ilObject::_getAllReferences(), and _getPossibleItems().

Referenced by ilLearningProgressBaseGUI::__readItemStatusInfo(), ilLearningProgressBaseGUI::__readScormCompleted(), ilLPListOfProgressGUI::__showCourseDetails(), ilLPListOfProgressGUI::__showSCORMDetails(), ilLPListOfObjectsGUI::__showUserList(), ilLPStatusSCORM::_getCompleted(), ilLPStatusCollection::_getCompleted(), ilLPStatusSCORM::_getInProgress(), and ilLPStatusCollection::_getInProgress().

        {
                global $ilObjDataCache;
                global $ilDB;

                if($ilObjDataCache->lookupType($a_obj_id) == 'crs')
                {
                        $course_ref_ids = ilObject::_getAllReferences($a_obj_id);
                        $course_ref_id = end($course_ref_ids);
                }

                $query = "SELECT * FROM ut_lp_collections WHERE obj_id = '".(int) $a_obj_id."'";
                $res = $ilDB->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        if($ilObjDataCache->lookupType($a_obj_id) == 'crs')
                        {
                                if(!in_array($row->item_id,ilLPCollections::_getPossibleItems($course_ref_id)))
                                {
                                        $query = "DELETE FROM ut_lp_collections ".
                                                "WHERE obj_id = '".$a_obj_id."' ".
                                                "AND item_id = '".$row->item_id."'";
                                        $ilDB->query($query);
                                        continue;
                                }
                        }
                        $items[] = $row->item_id;
                }
                return $items ? $items : array();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilLPCollections::_getPossibleItems ( a_target_id  ) 

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

References $tree.

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

        {
                global $tree;

                $node_data = $tree->getNodeData($a_target_id);
                foreach($tree->getSubTree($node_data) as $node)
                {
                        switch($node['type'])
                        {
                                case 'sahs':
                                case 'lm':
                                case 'tst':
                                        $all_possible["$node[ref_id]"] = $node['obj_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 134 of file class.ilLPCollections.php.

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

Referenced by ilLPListOfSettingsGUI::__showSCOTable(), and _getCountPossibleSAHSItems().

        {
                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, __read(), and isAssigned().

        {
                if($this->isAssigned($item_id))
                {
                        return false;
                }

                $query = "INSERT 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 85 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::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().

        {
                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 $ilObjDataCache, and __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_obj_id  ) 

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

Referenced by add().

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

Here is the caller graph for this function:


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: