5define(
'IL_OBJECTIVE_STATUS_EMPTY',
'empty');
 
    6define(
'IL_OBJECTIVE_STATUS_PRETEST',
'pretest');
 
    7define(
'IL_OBJECTIVE_STATUS_FINAL',
'final');
 
    8define(
'IL_OBJECTIVE_STATUS_NONE',
'none');
 
    9define(
'IL_OBJECTIVE_STATUS_FINISHED',
'finished');
 
   10define(
'IL_OBJECTIVE_STATUS_PRETEST_NON_SUGGEST',
'pretest_non_suggest');
 
   31                $this->user_id = $a_usr_id;
 
   46                include_once 
'Modules/Course/classes/class.ilCourseObjective.php';
 
   51                if(!is_array($objectives))
 
   55                $query = 
"SELECT objective_id FROM crs_objective_status ".
 
   56                        "WHERE ".$ilDB->in(
'objective_id',$objectives,
false,
'integer').
' '.
 
   57                        "AND user_id = ".$ilDB->quote($a_user_id ,
'integer').
" ";
 
   61                        $accomplished[] = 
$row->objective_id;
 
   63                return $accomplished ? $accomplished : array();
 
   75                include_once 
'./Modules/Course/classes/class.ilCourseObjective.php';
 
   85                        $query = 
"SELECT objective_id FROM crs_objective_status ".
 
   86                                "WHERE ".$ilDB->in(
'objective_id',$objectives,
false,
'integer').
" ".
 
   87                                "AND user_id = ".$ilDB->quote($a_user_id ,
'integer').
" ";
 
   91                                $finished[] = 
$row->objective_id;
 
   97                        $query = 
"SELECT objective_id FROM crs_objective_status_p ".
 
   98                                "WHERE ".$ilDB->in(
'objective_id',$objectives,
false,
'integer').
' '.
 
   99                                "AND user_id = ".$ilDB->quote($a_user_id ,
'integer');
 
  103                                $finished[] = 
$row->objective_id;
 
  106                foreach($objectives as $objective_id)
 
  108                        if(!in_array($objective_id,$finished))
 
  110                                $suggested[] = $objective_id;
 
  113                return $suggested ? $suggested : array();
 
  124                foreach(self::_getSuggested($a_usr_id,$a_crs_id) as $objective_id)
 
  126                        include_once 
'./Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
 
  128                        foreach($obj->getFinalTestQuestions() as $qst)
 
  130                                $qsts[] = $qst[
'question_id'];
 
  133                return $qsts ? $qsts : array();
 
  142                include_once 
"Modules/Test/classes/class.ilTestLP.php";
 
  144                $test_lp->resetLPDataForUserIds(array($a_user_id));             
 
  158                include_once 
'./Modules/Course/classes/class.ilCourseObjective.php';
 
  159                include_once 
'./Modules/Course/classes/class.ilCourseObjectiveQuestion.php';            
 
  161                include_once 
'./Services/Object/classes/class.ilObjectFactory.php';
 
  164                include_once 
'./Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
 
  165                include_once 
'./Modules/Course/classes/Objectives/class.ilLOSettings.php';
 
  174                        $tst = $factory->getInstanceByRefId($assignment->getTestRefId(),FALSE);
 
  179                                require_once 
'Modules/Test/classes/class.ilTestParticipantData.php';
 
  181                                $participantData->setUserIds(array($this->
getUserId()));
 
  182                                $participantData->load($tst->getTestId());
 
  183                                $tst->removeTestResults($participantData);
 
  189                $initial_tst = $factory->getInstanceByRefId($initial, FALSE);
 
  196                $qualified_tst = $factory->getInstanceByRefId($qualified, FALSE);
 
  204                if(count($objectives))
 
  206                        $query = 
"DELETE FROM crs_objective_status ".
 
  207                                "WHERE ".$ilDB->in(
'objective_id',$objectives,
false,
'integer').
' '.
 
  208                                "AND user_id = ".$ilDB->quote($this->
getUserId() ,
'integer').
" ";
 
  211                        $query = 
"DELETE FROM crs_objective_status_p ".
 
  212                                "WHERE ".$ilDB->in(
'objective_id',$objectives,
false,
'integer').
' '.
 
  213                                "AND user_id = ".$ilDB->quote($this->
getUserId()).
"";
 
  216                        $query = 
"DELETE FROM loc_user_results ".
 
  217                                "WHERE ".$ilDB->in(
'objective_id',$objectives,
false,
'integer').
' '.
 
  218                                "AND user_id = ".$ilDB->quote($this->
getUserId()).
"";
 
  222                include_once 
'./Services/Tracking/classes/class.ilLPStatusWrapper.php'; 
 
  230                include_once 
'./Modules/TestQuestionPool/classes/class.assQuestion.php';
 
  231                include_once 
'Modules/Course/classes/class.ilCourseObjective.php';
 
  239                if(!count($objective_ids))
 
  244                if(count($accomplished) == count($objective_ids))
 
  249                $all_pretest_answered = 
false;
 
  250                $all_final_answered = 
false;
 
  251                foreach($objectives as 
$data)
 
  255                                if(
$data[
'tst_status'])
 
  257                                        $all_final_answered = 
true;
 
  261                                        $all_pretest_answered = 
true;
 
  265                if($all_final_answered)
 
  269                if($all_pretest_answered and 
 
  274                elseif($all_pretest_answered)
 
  285                $query = 
"SELECT status FROM crs_objective_status ".
 
  286                        "WHERE objective_id = ".$ilDB->quote($a_objective_id ,
'integer').
" ".
 
  287                        "AND user_id = ".$ilDB->quote($this->
getUserId() ,
'integer').
"";
 
  299                include_once 
'./Modules/Course/classes/class.ilCourseObjective.php';
 
  318                #$ilLog(__METHOD__.': Call of deprecated method.'); 
  327                $query = 
"DELETE FROM crs_objective_status ".
 
  328                        "WHERE user_id = ".$ilDB->quote(
$user_id ,
'integer').
" ";
 
  331                $query = 
"DELETE FROM crs_objective_status_p ".
 
  332                        "WHERE user_id = ".$ilDB->quote(
$user_id ,
'integer').
" ";
 
  356                $query = 
"SELECT q2.question_id qid,q2.objective_id ob FROM crs_objective_qst q1, ".
 
  357                        "crs_objective_qst q2 ".
 
  358                        "WHERE q1.question_id = ".$ilDB->quote($a_question_id ,
'integer').
" ".
 
  359                        "AND q1.objective_id = q2.objective_id ";
 
  364                        $objectives[
'all_objectives'][
$row->ob] = 
$row->ob;
 
  365                        $objectives[
'all_questions'][
$row->qid] = 
$row->qid;
 
  367                if(!is_array($objectives))
 
  372                return $objectives ? $objectives : array();
 
  381                $query = 
"SELECT t.objective_id obj,t.ref_id ref, question_id,tst_status,tst_limit ".
 
  382                        "FROM crs_objective_tst t JOIN crs_objective_qst q ".
 
  383                        "ON (t.objective_id = q.objective_id AND t.ref_id = q.ref_id) ".
 
  384                        "WHERE ".$ilDB->in(
't.objective_id',$a_all_objectives,
false,
'integer');
 
  396                        $objectives[
$row->obj.
"_".
$row->tst_status][
'questions'][
$row->question_id] = 
$row->question_id;
 
  397                        $objectives[
$row->obj.
"_".
$row->tst_status][
'tst_status'] = 
$row->tst_status;
 
  398                        $objectives[
$row->obj.
"_".
$row->tst_status][
'tst_limit'] = 
$row->tst_limit;
 
  399                        $objectives[
$row->obj.
"_".
$row->tst_status][
'objective_id'] = 
$row->obj;
 
  403                return $objectives ? $objectives : array();
 
  410                if(!count($objectives[
'all_questions']) or
 
  411                   !count($objectives[
'all_objectives']))
 
  416                $query = 
"SELECT question_id,points FROM qpl_questions ".
 
  417                        "WHERE ".$ilDB->in(
'question_id',(array) $objectives[
'all_questions'],
false,
'integer');
 
  421                        $objectives[
'all_question_points'][
$row[
'question_id']][
'max_points'] = 
$row[
'points'];
 
  424                $query = 
"SELECT question_fi, MAX(points) as reached FROM tst_test_result ".
 
  425                        "JOIN tst_active ON (active_id = active_fi) ".
 
  426                        "WHERE user_fi = ".$ilDB->quote($a_user_id,
'integer').
" ".
 
  427                        "AND ".$ilDB->in(
'question_fi',(array) $objectives[
'all_questions'],
false,
'integer').
" ".
 
  428                        #"AND question_fi IN (".implode(",",ilUtil::quoteArray($objectives['all_questions'])).") ".
 
  429                        "GROUP BY question_fi,user_fi";
 
  433                        $objectives[
'all_question_points'][
$row->question_fi][
'reached_points'] = 
$row->reached;
 
  437                $fullfilled = array();
 
  439                foreach($objectives[
'objectives'] as $kind => 
$data)
 
  445                                if(
$data[
'tst_status'])
 
  447                                        $fullfilled[] = array(
$data[
'objective_id'],
$ilUser->getId(),
$data[
'tst_status']);
 
  451                                        $pretest[] = array(
$data[
'objective_id'],
$ilUser->getId());
 
  455                if(count($fullfilled))
 
  457                        foreach($fullfilled as $fullfilled_arr)
 
  460                                        'crs_objective_status',
 
  462                                                'objective_id' => array(
'integer',$fullfilled_arr[0]),
 
  463                                                'user_id' => array(
'integer',$fullfilled_arr[1])
 
  466                                                'status' => array(
'integer',$fullfilled_arr[2])
 
  474                        foreach($pretest as $pretest_arr)
 
  477                                        'crs_objective_status_p',
 
  479                                                'objective_id' => array(
'integer',$pretest_arr[0]),
 
  480                                                'user_id' => array(
'integer',$pretest_arr[1])
 
  491                if(!is_array($objective_data[
'questions']))
 
  497                foreach($objective_data[
'questions'] as $question_id)
 
  499                        $max_points += $question_points[$question_id][
'max_points'];
 
  500                        $reached_points += $question_points[$question_id][
'reached_points'];
 
  507                return $reached_points >= $objective_data[
'tst_limit'] ? true : 
false;
 
  509                return (($reached_points / $max_points * 100) >= $objective_data[
'tst_limit']) ? true : 
false;
 
  518                $query = 
"SELECT COUNT(t1.crs_id) num,t1.crs_id FROM crs_objectives t1 ".
 
  519                        "JOIN crs_objectives t2 WHERE t1.crs_id = t2.crs_id and  ".
 
  520                        $ilDB->in(
't1.objective_id',$objective_ids,
false,
'integer').
" ".
 
  521                        "GROUP BY t1.crs_id";
 
  526                        $query = 
"SELECT COUNT(cs.objective_id) num_passed FROM crs_objective_status cs ".
 
  527                                "JOIN crs_objectives co ON cs.objective_id = co.objective_id ".
 
  528                                "WHERE crs_id = ".$ilDB->quote(
$row->crs_id ,
'integer').
" ".
 
  529                                "AND user_id = ".$ilDB->quote($a_user_id ,
'integer').
" ";
 
  534                                if($user_row->num_passed == 
$row->num)
 
  536                                        $passed[] = 
$row->crs_id;
 
  539                        $crs_ids[
$row->crs_id] = 
$row->crs_id;
 
  543                        foreach($passed as $crs_id)
 
  545                                include_once(
'Modules/Course/classes/class.ilCourseParticipants.php');
 
  547                                $members->updatePassed($a_user_id,
true);
 
  552                foreach ($crs_ids as $cid)
 
  554                        include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
 
const IL_OBJECTIVE_STATUS_PRETEST_NON_SUGGEST
const IL_OBJECTIVE_STATUS_EMPTY
const IL_OBJECTIVE_STATUS_FINISHED
const IL_OBJECTIVE_STATUS_NONE
const IL_OBJECTIVE_STATUS_PRETEST
const IL_OBJECTIVE_STATUS_FINAL
const DB_FETCHMODE_OBJECT
static _areAnswered($a_user_id, $a_question_ids)
Checks if an array of question ids is answered by an user or not.
class ilcourseobjectiveQuestion
_updateObjectiveStatus($a_user_id, $objectives)
_readAssignedObjectives($a_all_objectives)
_updateObjectiveResult($a_user_id, $a_active_id, $a_question_id)
static getSuggestedQuestions($a_usr_id, $a_crs_id)
get suggested questions ids
ilCourseObjectiveResult($a_usr_id)
__isFullfilled($question_points, $objective_data)
static _deleteUser($user_id)
resetTestForUser(ilObjTest $a_test, $a_user_id)
_getAccomplished($a_user_id, $a_crs_id)
hasAccomplishedObjective($a_objective_id)
_getSuggested($a_user_id, $a_crs_id, $a_status=IL_OBJECTIVE_STATUS_FINAL)
_readAssignedObjectivesOfQuestion($a_question_id)
getAccomplished($a_crs_id)
__updatePassed($a_user_id, $objective_ids)
__deleteEntries($a_objective_ids)
getSuggested($a_crs_id, $a_status=IL_OBJECTIVE_STATUS_FINAL)
static _getObjectiveIds($course_id, $a_activated_only=false)
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
const TYPE_TEST_QUALIFIED
static getInstanceByObjId($a_obj_id)
get singleton instance
static getInstance($a_container_id)
Get instance by container id.
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.
removeTestActives($activeIds)
getActiveIdOfUser($user_id="", $anonymous_id="")
Gets the active id of a given user.
static getInstance($a_obj_id)
getId()
get object id @access public