39        $this->objective_id = $a_objective_id;
 
   40        if ($this->objective_id) {
 
   67        $query = 
"SELECT crs_id FROM crs_objectives " .
 
   68            "WHERE objective_id = " . 
$ilDB->quote($a_objective_id, 
'integer');
 
   96        $query = 
'SELECT passes from crs_objectives ' .
 
   97                'WHERE objective_id = ' . 
$ilDB->quote($a_objective_id, 
'integer');
 
  100            return (
int) $row->passes;
 
  111        $query = 
'SELECT title,description from crs_objectives ' .
 
  112                'WHERE objective_id = ' . 
$ilDB->quote($a_objective_id, 
'integer');
 
  115            if (!$a_add_description) {
 
  116                return $row[
'title'];
 
  133    public function ilClone($a_target_id, $a_copy_id)
 
  137        $ilLog = 
$DIC[
'ilLog'];
 
  141        $query = 
"SELECT * FROM crs_objectives " .
 
  142            "WHERE crs_id  = " . $this->db->quote($this->course_obj->getId(), 
'integer') . 
' ' .
 
  143            "ORDER BY position ";
 
  145        if (!
$res->numRows()) {
 
  156            $new_objective->setTitle($row->title);
 
  157            $new_objective->setDescription($row->description);
 
  158            $new_objective->setActive($row->active);
 
  163            include_once(
'Modules/Course/classes/class.ilCourseObjectiveQuestion.php');
 
  165            $objective_qst->cloneDependencies(
$objective_id, $a_copy_id);
 
  167            include_once 
'./Modules/Course/classes/Objectives/class.ilLORandomTestQuestionPools.php';
 
  168            include_once 
'./Modules/Course/classes/Objectives/class.ilLOSettings.php';
 
  175            $random_i->copy($a_copy_id, $new_course->getId(), 
$objective_id);
 
  183            $random_q->copy($a_copy_id, $new_course->getId(), 
$objective_id);
 
  185            include_once 
'./Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
 
  188            if ($assignment_it) {
 
  189                $assignment_it->cloneSettings($a_copy_id, $new_course->getId(), 
$objective_id);
 
  193            if ($assignment_qt) {
 
  194                $assignment_qt->cloneSettings($a_copy_id, $new_course->getId(), 
$objective_id);
 
  200            include_once(
'Modules/Course/classes/class.ilCourseObjectiveMaterials.php');
 
  202            $objective_material->cloneDependencies(
$objective_id, $a_copy_id);
 
  210        $this->active = $a_stat;
 
  220        $this->passes = $a_passes;
 
  230        return $this->passes > 0;
 
  236        $this->title = $a_title;
 
  244        $this->description = $a_description;
 
  248        return $this->description;
 
  252        $this->objective_id = $a_objective_id;
 
  262        $this->position = $a_pos;
 
  273        $next_id = 
$ilDB->nextId(
'crs_objectives');
 
  274        $query = 
"INSERT INTO crs_objectives (crs_id,objective_id,active,title,description,position,created,passes) " .
 
  276            $ilDB->quote($this->course_obj->getId(), 
'integer') . 
", " .
 
  277            $ilDB->quote($next_id, 
'integer') . 
", " .
 
  282            $ilDB->quote(time(), 
'integer') . 
", " .
 
  289        include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
 
  292        return $this->objective_id = $next_id;
 
  302        $query = 
"UPDATE crs_objectives " .
 
  303            "SET title = " . 
$ilDB->quote($this->
getTitle(), 
'text') . 
", " .
 
  304            'active = ' . 
$ilDB->quote($this->
isActive(), 
'integer') . 
', ' .
 
  308            "AND crs_id = " . 
$ilDB->quote($this->course_obj->getId(), 
'integer') . 
" ";
 
  328        $query = 
"UPDATE crs_objectives " .
 
  329            "SET position = " . $this->db->quote((
string) $a_position, 
'integer') . 
" " .
 
  330            "WHERE objective_id = " . $this->db->quote($this->
getObjectiveId(), 
'integer') . 
" ";
 
  343        return (
bool) strlen($this->
getTitle());
 
  346    public function delete()
 
  352        include_once 
'./Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
 
  355        $tmp_obj_qst->deleteAll();
 
  357        include_once 
'./Modules/Course/classes/class.ilCourseObjectiveMaterials.php';
 
  360        $tmp_obj_lm->deleteAll();
 
  363        $query = 
"DELETE FROM crs_objectives " .
 
  364            "WHERE crs_id = " . 
$ilDB->quote($this->course_obj->getId(), 
'integer') . 
" " .
 
  369        include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
 
  389        $query = 
"UPDATE crs_objectives " .
 
  390            "SET position = position + 1 " .
 
  392            "AND crs_id = " . 
$ilDB->quote($this->course_obj->getId(), 
'integer') . 
" ";
 
  395        $query = 
"UPDATE crs_objectives " .
 
  396            "SET position = position - 1 " .
 
  398            "AND crs_id = " . 
$ilDB->quote($this->course_obj->getId(), 
'integer') . 
" ";
 
  420        $query = 
"UPDATE crs_objectives " .
 
  421            "SET position = position - 1 " .
 
  423            "AND crs_id = " . 
$ilDB->quote($this->course_obj->getId(), 
'integer') . 
" ";
 
  426        $query = 
"UPDATE crs_objectives " .
 
  427            "SET position = position + 1 " .
 
  429            "AND crs_id = " . 
$ilDB->quote($this->course_obj->getId(), 
'integer') . 
" ";
 
  440        $this->position = $a_position;
 
  444        return $this->position;
 
  448        $this->created = $a_created;
 
  452        return $this->created;
 
  463            $query = 
"SELECT * FROM crs_objectives " .
 
  464                "WHERE crs_id = " . 
$ilDB->quote($this->course_obj->getId(), 
'integer') . 
" " .
 
  487        switch ($this->course_obj->getOrderType()) {
 
  489                return 'ORDER BY position';
 
  492                return 'ORDER BY title';
 
  495                return 'ORDER BY create';
 
  506        $query = 
"UPDATE crs_objectives " .
 
  507            "SET position = position - 1 " .
 
  509            "AND crs_id = " . 
$ilDB->quote($this->course_obj->getId(), 
'integer') . 
" ";
 
  521        $query = 
"SELECT MAX(position) pos FROM crs_objectives " .
 
  522            "WHERE crs_id = " . 
$ilDB->quote($this->course_obj->getId(), 
'integer') . 
" ";
 
  539        if ($a_activated_only) {
 
  540            $query = 
"SELECT objective_id FROM crs_objectives " .
 
  541                "WHERE crs_id = " . 
$ilDB->quote($course_id, 
'integer') . 
" " .
 
  542                'AND active = ' . 
$ilDB->quote(1, 
'integer') . 
' ' .
 
  545            $query = 
"SELECT objective_id FROM crs_objectives " .
 
  546                "WHERE crs_id = " . 
$ilDB->quote($course_id, 
'integer') . 
" " .
 
  552            $ids[] = $row->objective_id;
 
  555        return $ids ? $ids : array();
 
  572        $in = 
$ilDB->in(
'objective_id', $ids, 
false, 
'integer');
 
  575        $query = 
"DELETE FROM crs_objective_lm WHERE  " . 
$in;
 
  578        $query = 
"DELETE FROM crs_objective_tst WHERE " . 
$in;
 
  581        $query = 
"DELETE FROM crs_objective_qst WHERE " . 
$in;
 
  584        $query = 
"DELETE FROM crs_objectives WHERE crs_id = " . 
$ilDB->quote($course_id, 
'integer');
 
  602                'online' => (
int) $this->
isActive(),
 
  603                'position' => (
int) $this->position,
 
  611        include_once 
'./Modules/Course/classes/class.ilCourseObjectiveMaterials.php';
 
  613        $materials->toXml($writer);
 
  616        include_once 
'./Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
 
  618        $test->toXml($writer);
 
  620        include_once 
'./Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
 
  624        include_once 
'./Modules/Course/classes/Objectives/class.ilLORandomTestQuestionPools.php';
 
if(php_sapi_name() !='cli') $in
An exception for terminatinating execution or to throw for unit testing.
class ilCourseObjectiveMaterials
class ilcourseobjectiveQuestion
static lookupObjectiveTitle($a_objective_id, $a_add_description=false)
__setPosition($a_position)
static _lookupContainerIdByObjectiveId($a_objective_id)
Get container of object.
static _getCountObjectives($a_obj_id, $a_activated_only=false)
get count objectives
static _deleteAll($course_id)
static lookupMaxPasses($a_objective_id)
static _getObjectiveIds($course_id, $a_activated_only=false)
setDescription($a_description)
toXml(ilXmlWriter $writer)
write objective xml
__construct($course_obj, $a_objective_id=0)
Constructor.
writePosition($a_position)
write position
setObjectiveId($a_objective_id)
ilClone($a_target_id, $a_copy_id)
clone objectives
static toXml(ilXmlWriter $writer, $a_objective_id)
const TYPE_TEST_QUALIFIED
static getInstance($a_container_id)
Get instance by container id.
static _refreshStatus($a_obj_id, $a_users=null)
Set dirty.
static setDirty($a_obj_id)
Sets status of an object to dirty.
static getLogger($a_component_id)
Get component logger.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
xmlEndTag($tag)
Writes an endtag.
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
foreach($_POST as $key=> $value) $res