32                $this->objective_id = $a_objective_id;
 
   33                if($this->objective_id)
 
   51                $query = 
"SELECT crs_id FROM crs_objectives ".
 
   52                        "WHERE objective_id = ".$ilDB->quote($a_objective_id ,
'integer');
 
   79                $query = 
'SELECT passes from crs_objectives '.
 
   80                                'WHERE objective_id = '.$ilDB->quote($a_objective_id,
'integer');
 
   84                        return (
int) 
$row->passes;
 
   93                $query = 
'SELECT title from crs_objectives '.
 
   94                                'WHERE objective_id = '.$ilDB->quote($a_objective_id,
'integer');
 
  113        public function ilClone($a_target_id,$a_copy_id)
 
  117                $ilLog->write(__METHOD__.
': Start cloning learning objectives...');
 
  119                $query = 
"SELECT * FROM crs_objectives ".
 
  120                        "WHERE crs_id  = ".$this->db->quote($this->course_obj->getId() ,
'integer').
' '.
 
  121                        "ORDER BY position ";
 
  125                        $ilLog->write(__METHOD__.
': ... no objectives found.');
 
  131                        $ilLog->write(__METHOD__.
': Cannot init new course object.');
 
  137                        $new_objective->setTitle(
$row->title);
 
  138                        $new_objective->setDescription(
$row->description);
 
  139                        $new_objective->setActive(
$row->active);
 
  144                        include_once(
'Modules/Course/classes/class.ilCourseObjectiveQuestion.php');
 
  152                        include_once(
'Modules/Course/classes/class.ilCourseObjectiveMaterials.php');
 
  154                        $objective_material->cloneDependencies(
$objective_id,$a_copy_id);
 
  156                $ilLog->write(__METHOD__.
': Finished cloning objectives.');
 
  162                $this->active = $a_stat;
 
  172                $this->passes = $a_passes;
 
  182                return $this->passes > 0;
 
  188                $this->title = $a_title;
 
  196                $this->description = $a_description;
 
  200                return $this->description;
 
  204                $this->objective_id = $a_objective_id;
 
  216                $next_id = 
$ilDB->nextId(
'crs_objectives');
 
  217                $query = 
"INSERT INTO crs_objectives (crs_id,objective_id,active,title,description,position,created,passes) ".
 
  219                        $ilDB->quote($this->course_obj->getId() ,
'integer').
", ".
 
  220                        $ilDB->quote($next_id,
'integer').
", ".
 
  222                        $ilDB->quote($this->
getTitle() ,
'text').
", ".
 
  225                        $ilDB->quote(time() ,
'integer').
", ".
 
  232                include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
 
  235                return $this->objective_id = $next_id;
 
  243                $query = 
"UPDATE crs_objectives ".
 
  244                        "SET title = ".$ilDB->quote($this->
getTitle() ,
'text').
", ".
 
  245                        'active = '.$ilDB->quote($this->
isActive(),
'integer').
', '.
 
  246                        "description = ".$ilDB->quote($this->
getDescription() ,
'text').
", ".
 
  247                        'passes = '.$ilDB->quote($this->
getPasses(),
'integer').
' '.
 
  248                        "WHERE objective_id = ".$ilDB->quote($this->
getObjectiveId() ,
'integer').
" ".
 
  249                        "AND crs_id = ".$ilDB->quote($this->course_obj->getId() ,
'integer').
" ";
 
  267                $query = 
"UPDATE crs_objectives ".
 
  268                        "SET position = ".$this->db->quote((
string) $a_position ,
'integer').
" ".
 
  269                        "WHERE objective_id = ".$this->db->quote($this->
getObjectiveId() ,
'integer').
" ";
 
  282                return (
bool) strlen($this->
getTitle());
 
  289                include_once 
'./Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
 
  292                $tmp_obj_qst->deleteAll();
 
  294                include_once 
'./Modules/Course/classes/class.ilCourseObjectiveMaterials.php';
 
  297                $tmp_obj_lm->deleteAll();
 
  300                $query = 
"DELETE FROM crs_objectives ".
 
  301                        "WHERE crs_id = ".$ilDB->quote($this->course_obj->getId() ,
'integer').
" ".
 
  302                        "AND objective_id = ".$ilDB->quote($this->
getObjectiveId() ,
'integer').
" ";
 
  306                include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
 
  326                $query = 
"UPDATE crs_objectives ".
 
  327                        "SET position = position + 1 ".
 
  328                        "WHERE position = ".$ilDB->quote($this->
__getPosition() - 1 ,
'integer').
" ".
 
  329                        "AND crs_id = ".$ilDB->quote($this->course_obj->getId() ,
'integer').
" ";
 
  332                $query = 
"UPDATE crs_objectives ".
 
  333                        "SET position = position - 1 ".
 
  334                        "WHERE objective_id = ".$ilDB->quote($this->
getObjectiveId() ,
'integer').
" ".
 
  335                        "AND crs_id = ".$ilDB->quote($this->course_obj->getId() ,
'integer').
" ";
 
  357                $query = 
"UPDATE crs_objectives ".
 
  358                        "SET position = position - 1 ".
 
  359                        "WHERE position = ".$ilDB->quote($this->
__getPosition() + 1 ,
'integer').
" ".
 
  360                        "AND crs_id = ".$ilDB->quote($this->course_obj->getId() ,
'integer').
" ";
 
  363                $query = 
"UPDATE crs_objectives ".
 
  364                        "SET position = position + 1 ".
 
  365                        "WHERE objective_id = ".$ilDB->quote($this->
getObjectiveId() ,
'integer').
" ".
 
  366                        "AND crs_id = ".$ilDB->quote($this->course_obj->getId() ,
'integer').
" ";
 
  377                $this->position = $a_position;
 
  381                return $this->position;
 
  385                $this->created = $a_created;
 
  389                return $this->created;
 
  399                        $query = 
"SELECT * FROM crs_objectives ".
 
  400                                "WHERE crs_id = ".$ilDB->quote($this->course_obj->getId() ,
'integer').
" ".
 
  401                                "AND objective_id = ".$ilDB->quote($this->
getObjectiveId() ,
'integer').
" ";
 
  424                switch($this->course_obj->getOrderType())
 
  427                                return 'ORDER BY position';
 
  430                                return 'ORDER BY title';
 
  433                                return 'ORDER BY create';
 
  442                $query = 
"UPDATE crs_objectives ".
 
  443                        "SET position = position - 1 ".
 
  444                        "WHERE position > ".$ilDB->quote($this->
__getPosition() ,
'integer').
" ".
 
  445                        "AND crs_id = ".$ilDB->quote($this->course_obj->getId() ,
'integer').
" ";
 
  455                $query = 
"SELECT MAX(position) pos FROM crs_objectives ".
 
  456                        "WHERE crs_id = ".$ilDB->quote($this->course_obj->getId() ,
'integer').
" ";
 
  472                if($a_activated_only)
 
  474                        $query = 
"SELECT objective_id FROM crs_objectives ".
 
  475                                "WHERE crs_id = ".$ilDB->quote($course_id ,
'integer').
" ".
 
  476                                'AND active = '.$ilDB->quote(1,
'integer').
' '.
 
  481                        $query = 
"SELECT objective_id FROM crs_objectives ".
 
  482                                "WHERE crs_id = ".$ilDB->quote($course_id ,
'integer').
" ".
 
  489                        $ids[] = 
$row->objective_id;
 
  492                return $ids ? $ids : array();
 
  508                $in = 
$ilDB->in(
'objective_id',$ids,
false,
'integer');
 
  511                $query = 
"DELETE FROM crs_objective_lm WHERE  ".$in;
 
  514                $query = 
"DELETE FROM crs_objective_tst WHERE ".$in;
 
  517                $query = 
"DELETE FROM crs_objective_qst WHERE ".$in;
 
  520                $query = 
"DELETE FROM crs_objectives WHERE crs_id = ".$ilDB->quote($course_id ,
'integer');
 
  524                include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
 
const DB_FETCHMODE_OBJECT
class ilCourseObjectiveMaterials
class ilcourseobjectiveQuestion
static lookupObjectiveTitle($a_objective_id)
__setPosition($a_position)
static _lookupContainerIdByObjectiveId($a_objective_id)
Get container of object.
ilCourseObjective(&$course_obj, $a_objective_id=0)
static _getCountObjectives($a_obj_id, $a_activated_only=false)
get count objectives
static lookupMaxPasses($a_objective_id)
static _getObjectiveIds($course_id, $a_activated_only=false)
setDescription($a_description)
writePosition($a_position)
write position
setObjectiveId($a_objective_id)
ilClone($a_target_id, $a_copy_id)
clone objectives
_refreshStatus($a_obj_id, $a_users=null)
Set dirty.
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id