Public Member Functions | Data Fields

ilLPObjSettings Class Reference

Public Member Functions

 ilLPObjSettings ($a_obj_id)
 getVisits ()
 setVisits ($a_visits)
 setMode ($a_mode)
 getMode ()
 getObjId ()
 getObjType ()
 update ()
 insert ()
 _lookupVisits ($a_obj_id)
 _isContainer ($a_mode)
 _delete ($a_obj_id)
 _lookupMode ($a_obj_id)
 getValidModes ()
 _mode2Text ($a_mode)
 _checkObjectives ($a_obj_id)
 _checkSCORMPreconditions ($a_obj_id)
 __read ()
 __getDefaultMode ($a_obj_id, $a_type)

Data Fields

 $db = null
 $obj_id = null
 $obj_type = null
 $obj_mode = null
 $visits = null
 $is_stored = false

Detailed Description

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


Member Function Documentation

ilLPObjSettings::__getDefaultMode ( a_obj_id,
a_type 
)

Definition at line 361 of file class.ilLPObjSettings.php.

References _checkObjectives().

Referenced by _lookupMode(), and ilLPObjSettings().

        {
                global $ilDB;

                #$type = strlen($a_type) ? $a_type : $this->obj_type;

                switch($a_type)
                {
                        case 'crs':
                                // If objectives are enabled return deactivated
                                if(ilLPObjSettings::_checkObjectives($a_obj_id))
                                {
                                        return LP_MODE_OBJECTIVES;
                                }
                                return LP_MODE_MANUAL;

                        case 'dbk':
                        case 'lm':
                        case 'htlm':
                                return LP_MODE_MANUAL;

                        case 'sahs':
                                return LP_MODE_DEACTIVATED;

                        case 'dbk':
                                return LP_MODE_MANUAL;

                        case 'tst':
                                return LP_MODE_TEST_PASSED;

                        case 'exc':
                                return LP_MODE_EXERCISE_RETURNED;

                        case 'grp':
                                return LP_MODE_DEACTIVATED;

                        case 'fold':
                                return LP_MODE_DEACTIVATED;
                                        
                        default:
                                return LP_MODE_UNDEFINED;
                }
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilLPObjSettings::__read (  ) 

Definition at line 336 of file class.ilLPObjSettings.php.

References $res, $row, _checkObjectives(), and _checkSCORMPreconditions().

Referenced by ilLPObjSettings(), insert(), and update().

        {
                $res = $this->db->query("SELECT * FROM ut_lp_settings WHERE obj_id = '".$this->db->quote($this->obj_id)."'");
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $this->is_stored = true;
                        $this->obj_type = $row->obj_type;
                        $this->obj_mode = $row->mode;
                        $this->visits = $row->visits;

                        if(ilLPObjSettings::_checkObjectives($this->obj_id))
                        {
                                $this->obj_mode = LP_MODE_OBJECTIVES;
                        }
                        if(ilLPObjSettings::_checkSCORMPreconditions($this->obj_id))
                        {
                                $this->obj_mode = LP_MODE_SCORM;
                        }

                        return true;
                }

                return false;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilLPObjSettings::_checkObjectives ( a_obj_id  ) 

Definition at line 301 of file class.ilLPObjSettings.php.

References ilObjCourse::_lookupViewMode().

Referenced by __getDefaultMode(), __read(), _lookupMode(), and getValidModes().

        {
                global $ilDB,$ilObjDataCache;

                // Return deactivate for course with objective view
                if($ilObjDataCache->lookupType($a_obj_id) == 'crs')
                {
                        include_once 'course/classes/class.ilObjCourse.php';

                        if(ilObjCourse::_lookupViewMode($a_obj_id) == IL_CRS_VIEW_OBJECTIVE)
                        {
                                return true;
                        }
                }
                return false;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilLPObjSettings::_checkSCORMPreconditions ( a_obj_id  ) 

Definition at line 318 of file class.ilLPObjSettings.php.

References ilConditionHandler::_getConditionsOfTrigger().

Referenced by __read(), _lookupMode(), and getValidModes().

        {
                global $ilObjDataCache;
                
                if($ilObjDataCache->lookupType($a_obj_id) != 'sahs')
                {
                        return false;
                }
                include_once('classes/class.ilConditionHandler.php');
                if(count($conditions = ilConditionHandler::_getConditionsOfTrigger('sahs',$a_obj_id)))
                {
                        return true;
                }
                return false;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilLPObjSettings::_delete ( a_obj_id  ) 

Definition at line 155 of file class.ilLPObjSettings.php.

References $query.

        {
                global $ilDB;

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

                return true;
        }

ilLPObjSettings::_isContainer ( a_mode  ) 

Definition at line 147 of file class.ilLPObjSettings.php.

Referenced by ilPDFPresentation::__createObjectDetails(), ilLPListOfProgressGUI::__renderContainerRow(), ilLPListOfObjectsGUI::__renderContainerRow(), and ilLPListOfProgressGUI::details().

        {
                return $a_mode == LP_MODE_COLLECTION or
                        $a_mode == LP_MODE_SCORM or
                        $a_mode == LP_MODE_OBJECTIVES;
        }

Here is the caller graph for this function:

ilLPObjSettings::_lookupMode ( a_obj_id  ) 

Definition at line 165 of file class.ilLPObjSettings.php.

References $query, $res, $row, __getDefaultMode(), _checkObjectives(), and _checkSCORMPreconditions().

Referenced by ilPDFPresentation::__createObjectDetails(), ilLPFilter::__getAllObjects(), ilLPListOfProgressGUI::__initDetails(), ilLPListOfObjectsGUI::__initDetails(), ilLearningProgressBaseGUI::__readItemStatusInfo(), ilLPItemListGUI::__readMode(), ilLPListOfSettingsGUI::__showCollectionTable(), ilLPListOfObjectsGUI::__showEditUser(), ilLearningProgressBaseGUI::__showObjectDetails(), ilLPStatusFactory::_getClassById(), ilLPStatusFactory::_getInstance(), ilLPCollections::_getItems(), ilCourseItems::_hasCollectionTimings(), ilObjCourseGUI::getTabs(), ilLPFilter::searchFilterListener(), and ilInfoScreenGUI::showLearningProgress().

        {
                global $ilDB,$ilObjDataCache;

                if(ilLPObjSettings::_checkObjectives($a_obj_id))
                {
                        return LP_MODE_OBJECTIVES;
                }
                if(ilLPObjSettings::_checkSCORMPreconditions($a_obj_id))
                {
                        return LP_MODE_SCORM;
                }

                $query = "SELECT mode FROM ut_lp_settings ".
                        "WHERE obj_id = '".$a_obj_id."'";

                $res = $ilDB->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        return $row->mode;
                }
                
                // no db entry exists => return default mode by type
                return ilLPObjSettings::__getDefaultMode($a_obj_id,$ilObjDataCache->lookupType($a_obj_id));
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilLPObjSettings::_lookupVisits ( a_obj_id  ) 

Definition at line 130 of file class.ilLPObjSettings.php.

References $query, $res, and $row.

Referenced by ilLearningProgressBaseGUI::__readItemStatusInfo(), ilLearningProgressBaseGUI::__showObjectDetails(), and ilLPStatusVisits::_getStatusInfo().

        {
                global $ilDB;

                #echo $a_obj_id;

                $query = "SELECT visits FROM ut_lp_settings ".
                        "WHERE obj_id = '".$a_obj_id."'";

                $res = $ilDB->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        return $row->visits;
                }
                return LP_DEFAULT_VISITS;
        }

Here is the caller graph for this function:

ilLPObjSettings::_mode2Text ( a_mode  ) 

Definition at line 258 of file class.ilLPObjSettings.php.

References $lng.

Referenced by ilLPListOfSettingsGUI::__showCollectionTable(), ilLearningProgressBaseGUI::__showObjectDetails(), ilLPItemListGUI::renderObjectInfo(), and ilLPItemListGUI::renderObjectInfoXML().

        {
                global $lng;

                switch($a_mode)
                {
                        case LP_MODE_DEACTIVATED:
                                return $lng->txt('trac_mode_deactivated');

                        case LP_MODE_TLT:
                                return $lng->txt('trac_mode_tlt');

                        case LP_MODE_VISITS:
                                return $lng->txt('trac_mode_visits');
                                
                        case LP_MODE_MANUAL:
                                return $lng->txt('trac_mode_manual');

                        case LP_MODE_OBJECTIVES:
                                return $lng->txt('trac_mode_objectives');

                        case LP_MODE_COLLECTION:
                                return $lng->txt('trac_mode_collection');

                        case LP_MODE_SCORM:
                                return $lng->txt('trac_mode_scorm');

                        case LP_MODE_TEST_FINISHED:
                                return $lng->txt('trac_mode_test_finished');

                        case LP_MODE_TEST_PASSED:
                                return $lng->txt('trac_mode_test_passed');

                        case LP_MODE_EXERCISE_RETURNED:
                                return $lng->txt('trac_mode_exercise_returned');

                }
        }

Here is the caller graph for this function:

ilLPObjSettings::getMode (  ) 

Definition at line 90 of file class.ilLPObjSettings.php.

        {
                return $this->obj_mode;
        }

ilLPObjSettings::getObjId (  ) 

Definition at line 95 of file class.ilLPObjSettings.php.

Referenced by getValidModes().

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

Here is the caller graph for this function:

ilLPObjSettings::getObjType (  ) 

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

        {
                return $this->obj_type;
        }

ilLPObjSettings::getValidModes (  ) 

Definition at line 191 of file class.ilLPObjSettings.php.

References $lng, _checkObjectives(), _checkSCORMPreconditions(), ilLPCollections::_getCountPossibleSAHSItems(), and getObjId().

        {
                global $lng;

                switch($this->obj_type)
                {
                        case 'crs':
                                if(ilLPObjSettings::_checkObjectives($this->getObjId()))
                                {
                                        return array(LP_MODE_OBJECTIVES => $lng->txt('trac_mode_objectives'));
                                }

                                return array(LP_MODE_DEACTIVATED => $lng->txt('trac_mode_deactivated'),
                                                         LP_MODE_MANUAL => $lng->txt('trac_mode_manual'),
                                                         #LP_MODE_OBJECTIVES => $lng->txt('trac_mode_objectives'),
                                                         LP_MODE_COLLECTION => $lng->txt('trac_mode_collection'));

                                break;

                        case 'dbk':
                        case 'lm':
                                return array(LP_MODE_MANUAL => $lng->txt('trac_mode_manual'),
                                                         LP_MODE_VISITS => $lng->txt('trac_mode_visits'),
                                                         LP_MODE_TLT => $lng->txt('trac_mode_tlt'),
                                                         LP_MODE_DEACTIVATED => $lng->txt('trac_mode_deactivated'));

                        case 'htlm':
                                return array(LP_MODE_DEACTIVATED => $lng->txt('trac_mode_deactivated'),
                                                         LP_MODE_MANUAL => $lng->txt('trac_mode_manual'));

                        case 'sahs':
                                include_once './Services/Tracking/classes/class.ilLPCollections.php';
                                
                                if(ilLPObjSettings::_checkSCORMPreconditions($this->getObjId()))
                                {
                                        return array(LP_MODE_SCORM => $lng->txt('trac_mode_scorm_aicc'));
                                }
                                if(ilLPCollections::_getCountPossibleSAHSItems($this->getObjId()))
                                {
                                        return array(LP_MODE_DEACTIVATED => $lng->txt('trac_mode_deactivated'),
                                                                 LP_MODE_SCORM => $lng->txt('trac_mode_scorm_aicc'));
                                }
                                return array(LP_MODE_DEACTIVATED => $lng->txt('trac_mode_deactivated'));

                        case 'tst':
                                return array(LP_MODE_TEST_FINISHED => $lng->txt('trac_mode_test_finished'),
                                                         LP_MODE_TEST_PASSED => $lng->txt('trac_mode_test_passed'),
                                                         LP_MODE_DEACTIVATED => $lng->txt('trac_mode_deactivated'));

                        case 'exc':
                                return array(LP_MODE_DEACTIVATED => $lng->txt('trac_mode_deactivated'),
                                                         LP_MODE_EXERCISE_RETURNED => $lng->txt('trac_mode_exercise_returned'));

                        case 'grp':
                                return array(LP_MODE_DEACTIVATED => $lng->txt('trac_mode_deactivated'),
                                                         LP_MODE_MANUAL => $lng->txt('trac_mode_manual'),
                                                         LP_MODE_COLLECTION => $lng->txt('trac_mode_collection'));

                        case 'fold':
                                return array(LP_MODE_DEACTIVATED => $lng->txt('trac_mode_deactivated'),
                                                         LP_MODE_COLLECTION => $lng->txt('trac_mode_collection'));

                        default:
                                return array();
                }
        }

Here is the call graph for this function:

ilLPObjSettings::getVisits (  ) 

Definition at line 76 of file class.ilLPObjSettings.php.

        {
                return (int) $this->visits ? $this->visits : LP_DEFAULT_VISITS;
        }

ilLPObjSettings::ilLPObjSettings ( a_obj_id  ) 

Definition at line 61 of file class.ilLPObjSettings.php.

References __getDefaultMode(), and __read().

        {
                global $ilObjDataCache,$ilDB;

                $this->db =& $ilDB;

                $this->obj_id = $a_obj_id;

                if(!$this->__read())
                {
                        $this->obj_type = $ilObjDataCache->lookupType($this->obj_id);
                        $this->obj_mode = $this->__getDefaultMode($this->obj_id,$this->obj_type);
                }
        }

Here is the call graph for this function:

ilLPObjSettings::insert (  ) 

Definition at line 118 of file class.ilLPObjSettings.php.

References $query, and __read().

Referenced by update().

        {
                $query = "INSERT INTO ut_lp_settings SET obj_id = '".$this->obj_id."', ".
                        "obj_type = '".$this->obj_type."', ".
                        "mode = '".$this->obj_mode."'";
                $this->db->query($query);
                $this->__read();
                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilLPObjSettings::setMode ( a_mode  ) 

Definition at line 86 of file class.ilLPObjSettings.php.

        {
                $this->obj_mode = $a_mode;
        }

ilLPObjSettings::setVisits ( a_visits  ) 

Definition at line 81 of file class.ilLPObjSettings.php.

        {
                $this->visits = $a_visits;
        }

ilLPObjSettings::update (  ) 

Definition at line 104 of file class.ilLPObjSettings.php.

References $query, __read(), and insert().

        {
                if(!$this->is_stored)
                {
                        return $this->insert();
                }
                $query = "UPDATE ut_lp_settings SET mode = '".$this->obj_mode.
                        "', visits = '".$this->visits."' ".
                        "WHERE obj_id = '".$this->getObjId()."'";
                $this->db->query($query);
                $this->__read();
                return true;
        }

Here is the call graph for this function:


Field Documentation

ilLPObjSettings::$db = null

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

ilLPObjSettings::$is_stored = false

Definition at line 59 of file class.ilLPObjSettings.php.

ilLPObjSettings::$obj_id = null

Definition at line 54 of file class.ilLPObjSettings.php.

ilLPObjSettings::$obj_mode = null

Definition at line 56 of file class.ilLPObjSettings.php.

ilLPObjSettings::$obj_type = null

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

ilLPObjSettings::$visits = null

Definition at line 57 of file class.ilLPObjSettings.php.


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