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) | |
allFullfilled ($user_id) | |
isFullfilled ($user_id, $item_id) | |
__read () | |
Data Fields | |
$db | |
$ref_id | |
$id | |
$start_objs = array() |
Definition at line 34 of file class.ilCourseStart.php.
ilCourseStart::__deleteAll | ( | ) |
Definition at line 117 of file class.ilCourseStart.php.
References $query.
ilCourseStart::__read | ( | ) |
Definition at line 206 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; }
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; }
ilCourseStart::allFullfilled | ( | $ | user_id | ) |
Definition at line 145 of file class.ilCourseStart.php.
References $user_id, getStartObjects(), and isFullfilled().
{ foreach($this->getStartObjects() as $item) { if(!$this->isFullfilled($user_id,$item['item_ref_id'])) { return false; } } return true; }
ilCourseStart::delete | ( | $ | a_crs_start_id | ) |
Definition at line 80 of file class.ilCourseStart.php.
References $query.
ilCourseStart::exists | ( | $ | a_item_ref_id | ) |
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 'sahs': case 'svy': 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;
}
ilCourseStart::getStartObjects | ( | ) |
Definition at line 75 of file class.ilCourseStart.php.
Referenced by allFullfilled().
{
return $this->start_objs ? $this->start_objs : array();
}
ilCourseStart::ilCourseStart | ( | $ | a_course_ref_id, | |
$ | a_course_obj_id | |||
) |
Constructor public.
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(); }
ilCourseStart::isFullfilled | ( | $ | user_id, | |
$ | item_id | |||
) |
Definition at line 158 of file class.ilCourseStart.php.
References $obj_id, $type, $user_id, ilObjTestAccess::_checkCondition(), ilLPStatusWrapper::_getCompleted(), ilObjSurveyAccess::_lookupFinished(), and getRefId().
Referenced by allFullfilled().
{ global $ilObjDataCache; include_once './course/classes/class.ilCourseLMHistory.php'; $lm_continue =& new ilCourseLMHistory($this->getRefId(),$user_id); $continue_data = $lm_continue->getLMHistory(); $obj_id = $ilObjDataCache->lookupObjId($item_id); $type = $ilObjDataCache->lookupType($obj_id); switch($type) { case 'tst': include_once './assessment/classes/class.ilObjTestAccess.php'; if(!ilObjTestAccess::_checkCondition($obj_id,'finished','')) { return false; } break; case 'svy': include_once './survey/classes/class.ilObjSurveyAccess.php'; if(!ilObjSurveyAccess::_lookupFinished($obj_id, $user_id)) { return false; } break; case 'sahs': include_once 'Services/Tracking/classes/class.ilLPStatusWrapper.php'; $completed = ilLPStatusWrapper::_getCompleted($obj_id); if(!in_array($user_id,$completed)) { return false; } break; default: if(!isset($continue_data[$item_id])) { return false; } } return true; }
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; }
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.