class ilcourseobjective More...
Inheritance diagram for ilCourseObjective:
Collaboration diagram for ilCourseObjective:Public Member Functions | |
| ilCourseObjective (&$course_obj, $a_objective_id=0) | |
| ilClone ($a_target_id, $a_copy_id) | |
| clone objectives | |
| 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 () | |
Static Public Member Functions | |
| static | _lookupContainerIdByObjectiveId ($a_objective_id) |
| Get container of object. | |
Data Fields | |
| $db = null | |
| $course_obj = null | |
| $objective_id = null | |
class ilcourseobjective
Definition at line 34 of file class.ilCourseObjective.php.
| ilCourseObjective::__cleanStructure | ( | ) |
Definition at line 414 of file class.ilCourseObjective.php.
References $res.
Referenced by ilCourseObjective().
{
global $ilDB;
$query = "SELECT * FROM crs_objectives ".
"WHERE crs_id = ".$ilDB->quote($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 = ".$ilDB->quote($counter)." ".
"WHERE objective_id = ".$ilDB->quote($row->objective_id)." ";
$this->db->query($query);
}
}
return true;
}
Here is the caller graph for this function:| ilCourseObjective::__getCreated | ( | ) |
Definition at line 291 of file class.ilCourseObjective.php.
{
return $this->created;
}
| ilCourseObjective::__getLastPosition | ( | ) |
Definition at line 352 of file class.ilCourseObjective.php.
References $res.
Referenced by moveDown().
{
global $ilDB;
$query = "SELECT MAX(position) AS pos FROM crs_objectives ".
"WHERE crs_id = ".$ilDB->quote($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 322 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 283 of file class.ilCourseObjective.php.
Referenced by __updateTop(), moveDown(), and moveUp().
{
return $this->position;
}
Here is the caller graph for this function:| ilCourseObjective::__read | ( | ) |
Definition at line 297 of file class.ilCourseObjective.php.
References $res, __setCreated(), __setPosition(), getObjectiveId(), setDescription(), setObjectiveId(), and setTitle().
Referenced by ilCourseObjective(), moveDown(), and moveUp().
{
global $ilDB;
if($this->getObjectiveId())
{
$query = "SELECT * FROM crs_objectives ".
"WHERE crs_id = ".$ilDB->quote($this->course_obj->getId())." ".
"AND objective_id = ".$ilDB->quote($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 287 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 279 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 338 of file class.ilCourseObjective.php.
References __getPosition().
Referenced by delete().
{
global $ilDB;
$query = "UPDATE crs_objectives ".
"SET position = position - 1 ".
"WHERE position > ".$ilDB->quote($this->__getPosition())." ".
"AND crs_id = ".$ilDB->quote($this->course_obj->getId())." ";
$this->db->query($query);
return true;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilCourseObjective::_deleteAll | ( | $ | course_id | ) |
Definition at line 385 of file class.ilCourseObjective.php.
References _getObjectiveIds(), and ilUtil::quoteArray().
Referenced by ilObjCourse::delete().
{
global $ilDB;
$ids = ilCourseObjective::_getObjectiveIds($course_id);
if(!count($ids))
{
return true;
}
$in = "IN (";
$in .= implode(",",ilUtil::quoteArray($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);
$query = "DELETE FROM crs_objectives WHERE crs_id = ".$ilDB->quote($course_id);
$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 368 of file class.ilCourseObjective.php.
References $res.
Referenced by ilCourseObjectivePresentationGUI::__showInfo(), ilCourseObjectivePresentationGUI::__showObjectives(), _deleteAll(), ilCourseObjectiveResult::_getAccomplished(), ilLPCollections::_getItems(), ilLPStatusObjectives::_getStatusInfo(), ilCourseObjectiveResult::_getSuggested(), ilCourseObjectivesGUI::editQuestionAssignment(), ilCourseObjectiveResult::getStatus(), ilCourseObjectivesGUI::listObjectives(), ilCourseObjectiveResult::readStatus(), and ilCourseObjectiveResult::reset().
{
global $ilDB;
$query = "SELECT objective_id FROM crs_objectives ".
"WHERE crs_id = ".$ilDB->quote($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:| static ilCourseObjective::_lookupContainerIdByObjectiveId | ( | $ | a_objective_id | ) | [static] |
Get container of object.
public
| int | objective id |
Definition at line 64 of file class.ilCourseObjective.php.
References $res.
Referenced by ilCourseObjectiveQuestion::__read(), and ilCourseObjectiveMaterials::__read().
{
global $ilDB;
$query = "SELECT crs_id FROM crs_objectives ".
"WHERE objective_id = ".$ilDB->quote($a_objective_id);
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
return $row->crs_id;
}
return false;
}
Here is the caller graph for this function:| ilCourseObjective::add | ( | ) |
Definition at line 155 of file class.ilCourseObjective.php.
{
global $ilDB;
$query = "INSERT INTO crs_objectives ".
"SET crs_id = ".$ilDB->quote($this->course_obj->getId()).", ".
"title = ".$ilDB->quote($this->getTitle()).", ".
"description = ".$ilDB->quote($this->getDescription()).", ".
"position = ".$ilDB->quote($this->__getLastPosition() + 1).", ".
"created = ".$ilDB->quote(time());
$this->db->query($query);
return $this->objective_id = $this->db->getLastInsertId();
}
| ilCourseObjective::delete | ( | ) |
Definition at line 186 of file class.ilCourseObjective.php.
References __updateTop(), and getObjectiveId().
{
global $ilDB;
include_once './Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
$tmp_obj_qst =& new ilCourseObjectiveQuestion($this->getObjectiveId());
$tmp_obj_qst->deleteAll();
include_once './Modules/Course/classes/class.ilCourseObjectiveMaterials.php';
$tmp_obj_lm =& new ilCourseObjectiveMaterials($this->getObjectiveId());
$tmp_obj_lm->deleteAll();
$query = "DELETE FROM crs_objectives ".
"WHERE crs_id = ".$ilDB->quote($this->course_obj->getId())." ".
"AND objective_id = ".$ilDB->quote($this->getObjectiveId())." ";
$this->db->query($query);
$this->__updateTop();
return true;
}
Here is the call graph for this function:| ilCourseObjective::getDescription | ( | ) |
Definition at line 142 of file class.ilCourseObjective.php.
Referenced by update().
{
return $this->description;
}
Here is the caller graph for this function:| ilCourseObjective::getObjectiveId | ( | ) |
Definition at line 150 of file class.ilCourseObjective.php.
Referenced by __read(), delete(), moveDown(), moveUp(), and update().
{
return $this->objective_id;
}
Here is the caller graph for this function:| ilCourseObjective::getTitle | ( | ) |
Definition at line 134 of file class.ilCourseObjective.php.
Referenced by update().
{
return $this->title;
}
Here is the caller graph for this function:| ilCourseObjective::ilClone | ( | $ | a_target_id, | |
| $ | a_copy_id | |||
| ) |
clone objectives
public
| int | target id | |
| int | copy id |
Definition at line 86 of file class.ilCourseObjective.php.
References $ilLog, $objective_id, $res, ilObjectFactory::getInstanceByRefId(), and ilCourseObjective().
{
global $ilLog;
$ilLog->write(__METHOD__.': Start cloning learning objectives...');
$query = "SELECT * FROM crs_objectives ".
"WHERE crs_id = ".$this->db->quote($this->course_obj->getId()).
"ORDER BY position ";
$res = $this->db->query($query);
if(!$res->numRows())
{
$ilLog->write(__METHOD__.': ... no objectives found.');
return true;
}
if(!is_object($new_course = ilObjectFactory::getInstanceByRefId($a_target_id,false)))
{
$ilLog->write(__METHOD__.': Cannot init new course object.');
return true;
}
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$new_objective = new ilCourseObjective($new_course);
$new_objective->setTitle($row->title);
$new_objective->setDescription($row->description);
$objective_id = $new_objective->add();
$ilLog->write(__METHOD__.': Added new objective nr: '.$objective_id);
// Clone crs_objective_tst entries
include_once('Modules/Course/classes/class.ilCourseObjectiveQuestion.php');
$objective_qst = new ilCourseObjectiveQuestion($row->objective_id);
$objective_qst->cloneDependencies($objective_id,$a_copy_id);
$ilLog->write(__METHOD__.': Finished objective question dependencies: '.$objective_id);
// Clone crs_objective_lm entries (assigned course materials)
include_once('Modules/Course/classes/class.ilCourseObjectiveMaterials.php');
$objective_material = new ilCourseObjectiveMaterials($row->objective_id);
$objective_material->cloneDependencies($objective_id,$a_copy_id);
}
$ilLog->write(__METHOD__.': Finished cloning objectives.');
}
Here is the call graph for this function:| ilCourseObjective::ilCourseObjective | ( | &$ | course_obj, | |
| $ | a_objective_id = 0 | |||
| ) |
Definition at line 41 of file class.ilCourseObjective.php.
References $course_obj, __cleanStructure(), and __read().
Referenced by ilClone().
{
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:
Here is the caller graph for this function:| ilCourseObjective::moveDown | ( | ) |
Definition at line 245 of file class.ilCourseObjective.php.
References __getLastPosition(), __getPosition(), __read(), and getObjectiveId().
{
global $ilDB;
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 = ".$ilDB->quote($this->__getPosition() + 1)." ".
"AND crs_id = ".$ilDB->quote($this->course_obj->getId())." ";
$this->db->query($query);
$query = "UPDATE crs_objectives ".
"SET position = position + 1 ".
"WHERE objective_id = ".$ilDB->quote($this->getObjectiveId())." ".
"AND crs_id = ".$ilDB->quote($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 212 of file class.ilCourseObjective.php.
References __getPosition(), __read(), and getObjectiveId().
{
global $ilDB;
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 = ".$ilDB->quote($this->__getPosition() - 1)." ".
"AND crs_id = ".$ilDB->quote($this->course_obj->getId())." ";
$this->db->query($query);
$query = "UPDATE crs_objectives ".
"SET position = position - 1 ".
"WHERE objective_id = ".$ilDB->quote($this->getObjectiveId())." ".
"AND crs_id = ".$ilDB->quote($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 138 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 146 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 130 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 171 of file class.ilCourseObjective.php.
References getDescription(), getObjectiveId(), and getTitle().
{
global $ilDB;
$query = "UPDATE crs_objectives ".
"SET title = ".$ilDB->quote($this->getTitle()).", ".
"description = ".$ilDB->quote($this->getDescription())." ".
"WHERE objective_id = ".$ilDB->quote($this->getObjectiveId())." ".
"AND crs_id = ".$ilDB->quote($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 38 of file class.ilCourseObjective.php.
Referenced by ilCourseObjective().
| ilCourseObjective::$db = null |
Definition at line 36 of file class.ilCourseObjective.php.
| ilCourseObjective::$objective_id = null |
Definition at line 39 of file class.ilCourseObjective.php.
Referenced by ilClone().
1.7.1