Public Member Functions | |
| ilCourseObjective (&$course_obj, $a_objective_id=0) | |
| setTitle ($a_title) | |
| getTitle () | |
| setDescription ($a_description) | |
| getDescription () | |
| setObjectiveId ($a_objective_id) | |
| getObjectiveId () | |
| add () | |
| update () | |
| delete () | |
| moveUp () | |
| moveDown () | |
| __setPosition ($a_position) | |
| __getPosition () | |
| __setCreated ($a_created) | |
| __getCreated () | |
| __read () | |
| __getOrderColumn () | |
| __updateTop () | |
| __getLastPosition () | |
| _getObjectiveIds ($course_id) | |
| _deleteAll ($course_id) | |
| __cleanStructure () | |
Data Fields | |
| $db = null | |
| $course_obj = null | |
| $objective_id = null | |
Definition at line 35 of file class.ilCourseObjective.php.
| ilCourseObjective::__cleanStructure | ( | ) |
Definition at line 322 of file class.ilCourseObjective.php.
References $counter, $query, $res, and $row.
Referenced by ilCourseObjective().
{
$query = "SELECT * FROM crs_objectives ".
"WHERE crs_id = '".$this->course_obj->getId()."' ".
"ORDER BY position";
$res = $this->db->query($query);
$counter = 0;
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
if($row->position != ++$counter)
{
$query = "UPDATE crs_objectives SET ".
"position = '".$counter."' ".
"WHERE objective_id = '".$row->objective_id."'";
$this->db->query($query);
}
}
return true;
}
Here is the caller graph for this function:| ilCourseObjective::__getCreated | ( | ) |
Definition at line 208 of file class.ilCourseObjective.php.
{
return $this->created;
}
| ilCourseObjective::__getLastPosition | ( | ) |
Definition at line 265 of file class.ilCourseObjective.php.
References $query, $res, and $row.
Referenced by moveDown().
{
$query = "SELECT MAX(position) AS pos FROM crs_objectives ".
"WHERE crs_id = '".$this->course_obj->getId()."'";
$res = $this->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
return $row->pos;
}
return 0;
}
Here is the caller graph for this function:| ilCourseObjective::__getOrderColumn | ( | ) |
Definition at line 237 of file class.ilCourseObjective.php.
{
switch($this->course_obj->getOrderType())
{
case $this->course_obj->SORT_MANUAL:
return 'ORDER BY position';
case $this->course_obj->SORT_TITLE:
return 'ORDER BY title';
case $this->course_obj->SORT_ACTIVATION:
return 'ORDER BY create';
}
return false;
}
| ilCourseObjective::__getPosition | ( | ) |
Definition at line 200 of file class.ilCourseObjective.php.
Referenced by moveDown(), and moveUp().
{
return $this->position;
}
Here is the caller graph for this function:| ilCourseObjective::__read | ( | ) |
Definition at line 214 of file class.ilCourseObjective.php.
References $query, $res, $row, __setCreated(), __setPosition(), getObjectiveId(), setDescription(), setObjectiveId(), and setTitle().
Referenced by ilCourseObjective(), moveDown(), and moveUp().
{
if($this->getObjectiveId())
{
$query = "SELECT * FROM crs_objectives ".
"WHERE crs_id = '".$this->course_obj->getId()."' ".
"AND objective_id = '".$this->getObjectiveId()."'";
$res = $this->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->setObjectiveId($row->objective_id);
$this->setTitle($row->title);
$this->setDescription($row->description);
$this->__setPosition($row->position);
$this->__setCreated($row->created);
}
return true;
}
return false;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilCourseObjective::__setCreated | ( | $ | a_created | ) |
Definition at line 204 of file class.ilCourseObjective.php.
Referenced by __read().
{
$this->created = $a_created;
}
Here is the caller graph for this function:| ilCourseObjective::__setPosition | ( | $ | a_position | ) |
Definition at line 196 of file class.ilCourseObjective.php.
Referenced by __read().
{
$this->position = $a_position;
}
Here is the caller graph for this function:| ilCourseObjective::__updateTop | ( | ) |
Definition at line 253 of file class.ilCourseObjective.php.
References $query.
Referenced by delete().
{
$query = "UPDATE crs_objectives ".
"SET position = position - 1 ".
"WHERE position > '".$this->__getPosition()."' ".
"AND crs_id = '".$this->course_obj->getId()."'";
$this->db->query($query);
return true;
}
Here is the caller graph for this function:| ilCourseObjective::_deleteAll | ( | $ | course_id | ) |
Definition at line 296 of file class.ilCourseObjective.php.
References $query, and _getObjectiveIds().
Referenced by ilObjCourse::delete().
{
global $ilDB;
$ids = ilCourseObjective::_getObjectiveIds($course_id);
if(!count($ids))
{
return true;
}
$in = "IN ('";
$in .= implode("','",$ids);
$in .= "')";
$query = "DELETE FROM crs_objective_lm WHERE objective_id ".$in;
$ilDB->query($query);
$query = "DELETE FROM crs_objective_tst WHERE objective_id ".$in;
$ilDB->query($query);
$query = "DELETE FROM crs_objective_qst WHERE objective_id ".$in;
$ilDB->query($query);
return true;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilCourseObjective::_getObjectiveIds | ( | $ | course_id | ) |
Definition at line 279 of file class.ilCourseObjective.php.
References $query, $res, and $row.
Referenced by ilCourseContentInterface::__readAccomplished(), ilCourseContentInterface::__showInfo(), ilCourseContentInterface::__showObjectives(), _deleteAll(), ilCourseObjectivesGUI::editQuestionAssignment(), ilCourseObjectiveResult::getStatus(), ilCourseObjectivesGUI::listObjectives(), and ilCourseObjectiveResult::reset().
{
global $ilDB;
$query = "SELECT objective_id FROM crs_objectives ".
"WHERE crs_id = '".$course_id."' ".
"ORDER BY position";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$ids[] = $row->objective_id;
}
return $ids ? $ids : array();
}
Here is the caller graph for this function:| ilCourseObjective::add | ( | ) |
Definition at line 82 of file class.ilCourseObjective.php.
References $query, getDescription(), and getTitle().
{
$query = "INSERT INTO crs_objectives ".
"SET crs_id = '".$this->course_obj->getId()."', ".
"title = '".ilUtil::prepareDBString($this->getTitle())."', ".
"description = '".ilUtil::prepareDBString($this->getDescription())."', ".
"position = '".($this->__getLastPosition() + 1)."', ".
"created = '".time()."'";
$this->db->query($query);
return true;
}
Here is the call graph for this function:| ilCourseObjective::delete | ( | ) |
Definition at line 109 of file class.ilCourseObjective.php.
References $query, __updateTop(), and getObjectiveId().
{
include_once './course/classes/class.ilCourseObjectiveQuestion.php';
$tmp_obj_qst =& new ilCourseObjectiveQuestion($this->getObjectiveId());
$tmp_obj_qst->deleteAll();
include_once './course/classes/class.ilCourseObjectiveLM.php';
$tmp_obj_lm =& new ilCourseObjectiveLM($this->getObjectiveId());
$tmp_obj_lm->deleteAll();
$query = "DELETE FROM crs_objectives ".
"WHERE crs_id = '".$this->course_obj->getId()."' ".
"AND objective_id = '".$this->getObjectiveId()."'";
$this->db->query($query);
$this->__updateTop();
return true;
}
Here is the call graph for this function:| ilCourseObjective::getDescription | ( | ) |
Definition at line 69 of file class.ilCourseObjective.php.
Referenced by add(), and update().
{
return $this->description;
}
Here is the caller graph for this function:| ilCourseObjective::getObjectiveId | ( | ) |
Definition at line 77 of file class.ilCourseObjective.php.
Referenced by __read(), delete(), moveDown(), and moveUp().
{
return $this->objective_id;
}
Here is the caller graph for this function:| ilCourseObjective::getTitle | ( | ) |
Definition at line 61 of file class.ilCourseObjective.php.
Referenced by add(), and update().
{
return $this->title;
}
Here is the caller graph for this function:| ilCourseObjective::ilCourseObjective | ( | &$ | course_obj, | |
| $ | a_objective_id = 0 | |||
| ) |
Definition at line 42 of file class.ilCourseObjective.php.
References $course_obj, __cleanStructure(), and __read().
{
global $ilDB;
$this->db =& $ilDB;
$this->course_obj =& $course_obj;
$this->objective_id = $a_objective_id;
if($this->objective_id)
{
$this->__read();
}
$this->__cleanStructure();
}
Here is the call graph for this function:| ilCourseObjective::moveDown | ( | ) |
Definition at line 164 of file class.ilCourseObjective.php.
References $query, __getLastPosition(), __getPosition(), __read(), and getObjectiveId().
{
if(!$this->getObjectiveId())
{
return false;
}
// Stop if position is last
if($this->__getPosition() == $this->__getLastPosition())
{
return false;
}
$query = "UPDATE crs_objectives ".
"SET position = position - 1 ".
"WHERE position = '".($this->__getPosition() + 1)."' ".
"AND crs_id = '".$this->course_obj->getId()."'";
$this->db->query($query);
$query = "UPDATE crs_objectives ".
"SET position = position + 1 ".
"WHERE objective_id = '".$this->getObjectiveId()."' ".
"AND crs_id = '".$this->course_obj->getId()."'";
$this->db->query($query);
$this->__read();
return true;
}
Here is the call graph for this function:| ilCourseObjective::moveUp | ( | ) |
Definition at line 133 of file class.ilCourseObjective.php.
References $query, __getPosition(), __read(), and getObjectiveId().
{
if(!$this->getObjectiveId())
{
return false;
}
// Stop if position is first
if($this->__getPosition() == 1)
{
return false;
}
$query = "UPDATE crs_objectives ".
"SET position = position + 1 ".
"WHERE position = '".($this->__getPosition() - 1)."' ".
"AND crs_id = '".$this->course_obj->getId()."'";
$this->db->query($query);
$query = "UPDATE crs_objectives ".
"SET position = position - 1 ".
"WHERE objective_id = '".$this->getObjectiveId()."' ".
"AND crs_id = '".$this->course_obj->getId()."'";
$this->db->query($query);
$this->__read();
return true;
}
Here is the call graph for this function:| ilCourseObjective::setDescription | ( | $ | a_description | ) |
Definition at line 65 of file class.ilCourseObjective.php.
Referenced by __read().
{
$this->description = $a_description;
}
Here is the caller graph for this function:| ilCourseObjective::setObjectiveId | ( | $ | a_objective_id | ) |
Definition at line 73 of file class.ilCourseObjective.php.
Referenced by __read().
{
$this->objective_id = $a_objective_id;
}
Here is the caller graph for this function:| ilCourseObjective::setTitle | ( | $ | a_title | ) |
Definition at line 57 of file class.ilCourseObjective.php.
Referenced by __read().
{
$this->title = $a_title;
}
Here is the caller graph for this function:| ilCourseObjective::update | ( | ) |
Definition at line 96 of file class.ilCourseObjective.php.
References $query, getDescription(), and getTitle().
{
$query = "UPDATE crs_objectives ".
"SET title = '".ilUtil::prepareDBString($this->getTitle())."', ".
"description = '".ilUtil::prepareDBString($this->getDescription())."' ".
"WHERE objective_id = '".$this->getObjectiveId()."' ".
"AND crs_id = '".$this->course_obj->getId()."'";
$this->db->query($query);
return true;
}
Here is the call graph for this function:| ilCourseObjective::$course_obj = null |
Definition at line 39 of file class.ilCourseObjective.php.
Referenced by ilCourseObjective().
| ilCourseObjective::$db = null |
Definition at line 37 of file class.ilCourseObjective.php.
| ilCourseObjective::$objective_id = null |
Definition at line 40 of file class.ilCourseObjective.php.
1.7.1