Public Member Functions | Data Fields

ilCourseStart Class Reference

Public Member Functions

 ilCourseStart ($a_course_ref_id, $a_course_obj_id)
 Constructor public.
 setId ($a_id)
 getId ()
 setRefId ($a_ref_id)
 getRefId ()
 getStartObjects ()
 delete ($a_crs_start_id)
 exists ($a_item_ref_id)
 add ($a_item_ref_id)
 __deleteAll ()
 getPossibleStarters (&$item_obj)
 isFullfilled ($user_id)
 __read ()

Data Fields

 $db
 $ref_id
 $id
 $start_objs = array()

Detailed Description

Definition at line 34 of file class.ilCourseStart.php.


Member Function Documentation

ilCourseStart::__deleteAll (  ) 

Definition at line 117 of file class.ilCourseStart.php.

References $query.

        {
                $query = "DELETE FROM crs_start ".
                        "WHERE crs_id = '".$this->getId()."'";


                $this->db->query($query);

                return true;
        }

ilCourseStart::__read (  ) 

Definition at line 184 of file class.ilCourseStart.php.

References $query, $res, $row, and $tree.

Referenced by ilCourseStart().

        {
                global $tree;

                $this->start_objs = array();

                $query = "SELECT * FROM crs_start ".
                        "WHERE crs_id = '".$this->getId()."'";

                $res = $this->db->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        if($tree->isInTree($row->item_ref_id))
                        {
                                $this->start_objs[$row->crs_start_id]['item_ref_id'] = $row->item_ref_id;
                        }
                        else
                        {
                                $this->delete($row->item_ref_id);
                        }
                }
                return true;
        }

Here is the caller graph for this function:

ilCourseStart::add ( a_item_ref_id  ) 

Definition at line 102 of file class.ilCourseStart.php.

References $query.

Referenced by ilObjCourseGUI::addStarterObject().

        {
                if($a_item_ref_id)
                {
                        $query = "INSERT INTO crs_start ".
                                "SET crs_id = '".$this->getId()."', ".
                                "item_ref_id = '".$a_item_ref_id."'";

                        $this->db->query($query);

                        return true;
                }
                return false;
        }

Here is the caller graph for this function:

ilCourseStart::delete ( a_crs_start_id  ) 

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

References $query.

        {
                $query = "DELETE FROM crs_start ".
                        "WHERE crs_start_id = '".$a_crs_start_id."' ".
                        "AND crs_id = '".$this->getId()."'";

                $this->db->query($query);

                return true;
        }

ilCourseStart::exists ( a_item_ref_id  ) 

Definition at line 91 of file class.ilCourseStart.php.

References $query, and $res.

        {
                $query = "SELECT * FROM crs_start ".
                        "WHERE crs_id = '".$this->getId()."' ".
                        "AND item_ref_id = '".$a_item_ref_id."'";

                $res = $this->db->query($query);

                return $res->numRows() ? true : false;
        }

ilCourseStart::getId (  ) 

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

        {
                return $this->id;
        }

ilCourseStart::getPossibleStarters ( &$  item_obj  ) 

Definition at line 128 of file class.ilCourseStart.php.

        {
                foreach($item_obj->getItems() as $node)
                {
                        switch($node['type'])
                        {
                                case 'lm':
                                case 'htlm':
                                case 'alm':
                                case 'sahs':
                                case 'tst':
                                        $poss_items[] = $node['ref_id'];
                                        break;
                        }
                }
                return $poss_items ? $poss_items : array();
        }

ilCourseStart::getRefId (  ) 

Definition at line 71 of file class.ilCourseStart.php.

Referenced by isFullfilled().

        {
                return $this->ref_id;
        }

Here is the caller graph for this function:

ilCourseStart::getStartObjects (  ) 

Definition at line 75 of file class.ilCourseStart.php.

Referenced by isFullfilled().

        {
                return $this->start_objs ? $this->start_objs : array();
        }

Here is the caller graph for this function:

ilCourseStart::ilCourseStart ( a_course_ref_id,
a_course_obj_id 
)

Constructor public.

Parameters:
integer reference_id or object_id
boolean treat the id as reference_id (true) or object_id (false)

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

References __read().

        {
                global $ilDB;

                $this->db =& $ilDB;

                $this->ref_id = $a_course_ref_id;
                $this->id = $a_course_obj_id;

                $this->__read();
        }

Here is the call graph for this function:

ilCourseStart::isFullfilled ( user_id  ) 

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

References $user_id, ilObjTest::_checkCondition(), ilObjectFactory::getInstanceByRefId(), getRefId(), and getStartObjects().

        {
                $fullfilled = true;


                include_once './course/classes/class.ilCourseLMHistory.php';

                $lm_continue =& new ilCourseLMHistory($this->getRefId(),$user_id);
                $continue_data = $lm_continue->getLMHistory();
                
                foreach($this->getStartObjects() as $item)
                {
                        $tmp_obj = ilObjectFactory::getInstanceByRefId($item['item_ref_id']);

                        if($tmp_obj->getType() == 'tst')
                        {
                                include_once './assessment/classes/class.ilObjTest.php';

                                if(!ilObjTest::_checkCondition($tmp_obj->getId(),'finished',''))
                                {
                                        $fullfilled = false;
                                        continue;
                                }
                        }
                        else
                        {
                                if(!isset($continue_data[$tmp_obj->getRefId()]))
                                {
                                        $fullfilled = false;
                                        continue;
                                }
                        }
                }
                return $fullfilled;
        }

Here is the call graph for this function:

ilCourseStart::setId ( a_id  ) 

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

        {
                $this->id = $a_id;
        }

ilCourseStart::setRefId ( a_ref_id  ) 

Definition at line 67 of file class.ilCourseStart.php.

        {
                $this->ref_id = $a_ref_id;
        }


Field Documentation

ilCourseStart::$db

Definition at line 36 of file class.ilCourseStart.php.

ilCourseStart::$id

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

ilCourseStart::$ref_id

Definition at line 38 of file class.ilCourseStart.php.

ilCourseStart::$start_objs = array()

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


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