class ilcourseobjective
More...
class ilcourseobjective
- Author
- Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
- Version
- $Id$
Definition at line 19 of file class.ilCourseObjectiveResult.php.
◆ __construct()
ilCourseObjectiveResult::__construct |
( |
|
$a_usr_id | ) |
|
◆ __deleteEntries()
ilCourseObjectiveResult::__deleteEntries |
( |
|
$a_objective_ids | ) |
|
◆ __isFullfilled()
static ilCourseObjectiveResult::__isFullfilled |
( |
|
$question_points, |
|
|
|
$objective_data |
|
) |
| |
|
static |
Definition at line 467 of file class.ilCourseObjectiveResult.php.
Referenced by _updateObjectiveStatus().
469 if (!is_array($objective_data[
'questions'])) {
474 foreach ($objective_data[
'questions'] as $question_id) {
475 $max_points += $question_points[$question_id][
'max_points'];
476 $reached_points += $question_points[$question_id][
'reached_points'];
482 return $reached_points >= $objective_data[
'tst_limit'] ? true :
false;
484 return (($reached_points / $max_points * 100) >= $objective_data[
'tst_limit']) ? true :
false;
◆ __updatePassed()
static ilCourseObjectiveResult::__updatePassed |
( |
|
$a_user_id, |
|
|
|
$objective_ids |
|
) |
| |
|
static |
can be protected?
type $ilDB
- Parameters
-
type | $a_user_id | |
type | $objective_ids | |
Definition at line 494 of file class.ilCourseObjectiveResult.php.
References $DIC, $ilDB, $query, $res, $row, ilCourseParticipants\_getInstanceByObjId(), ilLPStatusWrapper\_updateStatus(), and ilDBConstants\FETCHMODE_OBJECT.
Referenced by _updateObjectiveStatus().
498 $ilDB = $DIC[
'ilDB'];
502 $query =
"SELECT COUNT(t1.crs_id) num,t1.crs_id FROM crs_objectives t1 " .
503 "JOIN crs_objectives t2 WHERE t1.crs_id = t2.crs_id and " .
504 $ilDB->in(
't1.objective_id', $objective_ids,
false,
'integer') .
" " .
505 "GROUP BY t1.crs_id";
509 $query =
"SELECT COUNT(cs.objective_id) num_passed FROM crs_objective_status cs " .
510 "JOIN crs_objectives co ON cs.objective_id = co.objective_id " .
511 "WHERE crs_id = " .
$ilDB->quote(
$row->crs_id,
'integer') .
" " .
512 "AND user_id = " .
$ilDB->quote($a_user_id,
'integer') .
" ";
516 if ($user_row->num_passed ==
$row->num) {
517 $passed[] =
$row->crs_id;
520 $crs_ids[
$row->crs_id] =
$row->crs_id;
522 if (count($passed)) {
523 foreach ($passed as $crs_id) {
524 include_once(
'Modules/Course/classes/class.ilCourseParticipants.php');
526 $members->updatePassed($a_user_id,
true);
531 foreach ($crs_ids as $cid) {
532 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
foreach($_POST as $key=> $value) $res
◆ _deleteUser()
static ilCourseObjectiveResult::_deleteUser |
( |
|
$user_id | ) |
|
|
static |
◆ _getAccomplished()
static ilCourseObjectiveResult::_getAccomplished |
( |
|
$a_user_id, |
|
|
|
$a_crs_id |
|
) |
| |
|
static |
Definition at line 48 of file class.ilCourseObjectiveResult.php.
References $DIC, $ilDB, $query, $res, $row, ilCourseObjective\_getObjectiveIds(), and ilDBConstants\FETCHMODE_OBJECT.
Referenced by getAccomplished().
54 include_once
'Modules/Course/classes/class.ilCourseObjective.php';
59 if (!is_array($objectives)) {
62 $query =
"SELECT objective_id FROM crs_objective_status " .
63 "WHERE " .
$ilDB->in(
'objective_id', $objectives,
false,
'integer') .
' ' .
64 "AND user_id = " .
$ilDB->quote($a_user_id,
'integer') .
" ";
67 $accomplished[] =
$row->objective_id;
69 return $accomplished ? $accomplished : array();
static _getObjectiveIds($course_id, $a_activated_only=false)
foreach($_POST as $key=> $value) $res
◆ _getSuggested()
Definition at line 77 of file class.ilCourseObjectiveResult.php.
References $DIC, $ilDB, $query, $res, $row, ilCourseObjective\_getObjectiveIds(), ilDBConstants\FETCHMODE_OBJECT, IL_OBJECTIVE_STATUS_FINAL, and IL_OBJECTIVE_STATUS_FINISHED.
Referenced by getSuggested(), and ilCourseObjectiveResultCache\readSuggested().
83 include_once
'./Modules/Course/classes/class.ilCourseObjective.php';
92 $query =
"SELECT objective_id FROM crs_objective_status " .
93 "WHERE " .
$ilDB->in(
'objective_id', $objectives,
false,
'integer') .
" " .
94 "AND user_id = " .
$ilDB->quote($a_user_id,
'integer') .
" ";
97 $finished[] =
$row->objective_id;
101 $query =
"SELECT objective_id FROM crs_objective_status_p " .
102 "WHERE " .
$ilDB->in(
'objective_id', $objectives,
false,
'integer') .
' ' .
103 "AND user_id = " .
$ilDB->quote($a_user_id,
'integer');
106 $finished[] =
$row->objective_id;
109 foreach ($objectives as $objective_id) {
110 if (!in_array($objective_id, $finished)) {
111 $suggested[] = $objective_id;
114 return $suggested ? $suggested : array();
const IL_OBJECTIVE_STATUS_FINISHED
static _getObjectiveIds($course_id, $a_activated_only=false)
foreach($_POST as $key=> $value) $res
const IL_OBJECTIVE_STATUS_FINAL
◆ _readAssignedObjectives()
static ilCourseObjectiveResult::_readAssignedObjectives |
( |
|
$a_all_objectives | ) |
|
|
static |
Definition at line 364 of file class.ilCourseObjectiveResult.php.
References $DIC, $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.
Referenced by getStatus(), and readStatus().
368 $ilDB = $DIC[
'ilDB'];
371 $query =
"SELECT t.objective_id obj,t.ref_id ref, question_id,tst_status,tst_limit " .
372 "FROM crs_objective_tst t JOIN crs_objective_qst q " .
373 "ON (t.objective_id = q.objective_id AND t.ref_id = q.ref_id) " .
374 "WHERE " .
$ilDB->in(
't.objective_id', $a_all_objectives,
false,
'integer');
385 $objectives[
$row->obj .
"_" .
$row->tst_status][
'questions'][
$row->question_id] =
$row->question_id;
386 $objectives[
$row->obj .
"_" .
$row->tst_status][
'tst_status'] =
$row->tst_status;
387 $objectives[
$row->obj .
"_" .
$row->tst_status][
'tst_limit'] =
$row->tst_limit;
388 $objectives[
$row->obj .
"_" .
$row->tst_status][
'objective_id'] =
$row->obj;
390 return $objectives ? $objectives : array();
foreach($_POST as $key=> $value) $res
◆ _readAssignedObjectivesOfQuestion()
static ilCourseObjectiveResult::_readAssignedObjectivesOfQuestion |
( |
|
$a_question_id | ) |
|
|
static |
Definition at line 339 of file class.ilCourseObjectiveResult.php.
References $DIC, $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.
343 $ilDB = $DIC[
'ilDB'];
346 $query =
"SELECT q2.question_id qid,q2.objective_id ob FROM crs_objective_qst q1, " .
347 "crs_objective_qst q2 " .
348 "WHERE q1.question_id = " .
$ilDB->quote($a_question_id,
'integer') .
" " .
349 "AND q1.objective_id = q2.objective_id ";
353 $objectives[
'all_objectives'][
$row->ob] =
$row->ob;
354 $objectives[
'all_questions'][
$row->qid] =
$row->qid;
356 if (!is_array($objectives)) {
359 $objectives[
'objectives'] = self::_readAssignedObjectives($objectives[
'all_objectives']);
360 return $objectives ? $objectives : array();
foreach($_POST as $key=> $value) $res
◆ _updateObjectiveResult()
static ilCourseObjectiveResult::_updateObjectiveResult |
( |
|
$a_user_id, |
|
|
|
$a_active_id, |
|
|
|
$a_question_id |
|
) |
| |
|
static |
◆ _updateObjectiveStatus()
static ilCourseObjectiveResult::_updateObjectiveStatus |
( |
|
$a_user_id, |
|
|
|
$objectives |
|
) |
| |
|
static |
Definition at line 393 of file class.ilCourseObjectiveResult.php.
References $data, $DIC, $ilDB, $ilUser, $query, $res, $row, __isFullfilled(), __updatePassed(), ilDBConstants\FETCHMODE_OBJECT, and ilUtil\quoteArray().
Referenced by readStatus().
397 $ilDB = $DIC[
'ilDB'];
400 if (!count($objectives[
'all_questions'])
or 401 !count($objectives[
'all_objectives'])) {
405 $query =
"SELECT question_id,points FROM qpl_questions " .
406 "WHERE " .
$ilDB->in(
'question_id', (array) $objectives[
'all_questions'],
false,
'integer');
409 $objectives[
'all_question_points'][
$row[
'question_id']][
'max_points'] = $row[
'points'];
412 $query =
"SELECT question_fi, MAX(points) as reached FROM tst_test_result " .
413 "JOIN tst_active ON (active_id = active_fi) " .
414 "WHERE user_fi = " .
$ilDB->quote($a_user_id,
'integer') .
" " .
415 "AND " .
$ilDB->in(
'question_fi', (array) $objectives[
'all_questions'],
false,
'integer') .
" " .
416 #
"AND question_fi IN (".implode(
",",
ilUtil::quoteArray($objectives[
'all_questions'])).
") ".
417 "GROUP BY question_fi,user_fi";
420 $objectives[
'all_question_points'][
$row->question_fi][
'reached_points'] =
$row->reached;
424 $fullfilled = array();
426 foreach ($objectives[
'objectives'] as $kind =>
$data) {
430 if (
$data[
'tst_status']) {
431 $fullfilled[] = array(
$data[
'objective_id'],
$ilUser->getId(),
$data[
'tst_status']);
433 $pretest[] = array(
$data[
'objective_id'],
$ilUser->getId());
437 if (count($fullfilled)) {
438 foreach ($fullfilled as $fullfilled_arr) {
440 'crs_objective_status',
442 'objective_id' => array(
'integer',$fullfilled_arr[0]),
443 'user_id' => array(
'integer',$fullfilled_arr[1])
446 'status' => array(
'integer',$fullfilled_arr[2])
452 if (count($pretest)) {
453 foreach ($pretest as $pretest_arr) {
455 'crs_objective_status_p',
457 'objective_id' => array(
'integer',$pretest_arr[0]),
458 'user_id' => array(
'integer',$pretest_arr[1])
foreach($_POST as $key=> $value) $res
static quoteArray($a_array)
Quotes all members of an array for usage in DB query statement.
static __updatePassed($a_user_id, $objective_ids)
can be protected?
static __isFullfilled($question_points, $objective_data)
◆ getAccomplished()
ilCourseObjectiveResult::getAccomplished |
( |
|
$a_crs_id | ) |
|
◆ getStatus()
ilCourseObjectiveResult::getStatus |
( |
|
$a_course_id | ) |
|
Definition at line 223 of file class.ilCourseObjectiveResult.php.
References $data, assQuestion\_areAnswered(), ilCourseObjective\_getObjectiveIds(), _readAssignedObjectives(), getAccomplished(), getSuggested(), getUserId(), IL_OBJECTIVE_STATUS_EMPTY, IL_OBJECTIVE_STATUS_FINAL, IL_OBJECTIVE_STATUS_FINISHED, IL_OBJECTIVE_STATUS_NONE, IL_OBJECTIVE_STATUS_PRETEST, and IL_OBJECTIVE_STATUS_PRETEST_NON_SUGGEST.
225 include_once
'./Modules/TestQuestionPool/classes/class.assQuestion.php';
226 include_once
'Modules/Course/classes/class.ilCourseObjective.php';
234 if (!count($objective_ids)) {
238 if (count($accomplished) == count($objective_ids)) {
242 $all_pretest_answered =
false;
243 $all_final_answered =
false;
244 foreach ($objectives as
$data) {
246 if ($data[
'tst_status']) {
247 $all_final_answered =
true;
249 $all_pretest_answered =
true;
253 if ($all_final_answered) {
256 if ($all_pretest_answered
and 257 !count($suggested)) {
259 } elseif ($all_pretest_answered) {
const IL_OBJECTIVE_STATUS_EMPTY
const IL_OBJECTIVE_STATUS_FINISHED
static _areAnswered($a_user_id, $a_question_ids)
Checks if an array of question ids is answered by an user or not.
static _getObjectiveIds($course_id, $a_activated_only=false)
getSuggested($a_crs_id, $a_status=IL_OBJECTIVE_STATUS_FINAL)
const IL_OBJECTIVE_STATUS_PRETEST_NON_SUGGEST
const IL_OBJECTIVE_STATUS_NONE
const IL_OBJECTIVE_STATUS_FINAL
getAccomplished($a_crs_id)
const IL_OBJECTIVE_STATUS_PRETEST
static _readAssignedObjectives($a_all_objectives)
◆ getSuggested()
◆ getSuggestedQuestions()
static ilCourseObjectiveResult::getSuggestedQuestions |
( |
|
$a_usr_id, |
|
|
|
$a_crs_id |
|
) |
| |
|
static |
get suggested questions ids
- Parameters
-
object | $a_usr_id | |
object | $a_crs_id | |
- Returns
Definition at line 123 of file class.ilCourseObjectiveResult.php.
125 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) {
129 $qsts[] = $qst[
'question_id'];
132 return $qsts ? $qsts : array();
class ilcourseobjectiveQuestion
◆ getUserId()
ilCourseObjectiveResult::getUserId |
( |
| ) |
|
◆ hasAccomplishedObjective()
ilCourseObjectiveResult::hasAccomplishedObjective |
( |
|
$a_objective_id | ) |
|
◆ readStatus()
ilCourseObjectiveResult::readStatus |
( |
|
$a_crs_id | ) |
|
◆ reset()
ilCourseObjectiveResult::reset |
( |
|
$a_course_id | ) |
|
Definition at line 152 of file class.ilCourseObjectiveResult.php.
References $DIC, $factory, $ilDB, $lng, $query, $res, ilCourseObjective\_getObjectiveIds(), ilLPStatusWrapper\_updateStatus(), ilLOTestAssignments\getInstance(), ilLOSettings\getInstanceByObjId(), getUserId(), resetTestForUser(), ilLOSettings\TYPE_TEST_INITIAL, and ilLOSettings\TYPE_TEST_QUALIFIED.
Referenced by ilObjCourseGUI\resetObject().
156 $ilDB = $DIC[
'ilDB'];
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';
167 foreach (array_merge(
172 $tst =
$factory->getInstanceByRefId($assignment->getTestRefId(),
false);
178 require_once
'Modules/Test/classes/class.ilTestParticipantData.php';
180 $participantData->setUserIdsFilter(array($this->
getUserId()));
181 $participantData->load($tst->getTestId());
182 $tst->removeTestResults($participantData);
187 $initial_tst =
$factory->getInstanceByRefId($initial,
false);
188 if ($initial_tst instanceof ilObjTest) {
193 $qualified_tst =
$factory->getInstanceByRefId($qualified,
false);
194 if ($qualified_tst instanceof ilObjTest) {
200 if (count($objectives)) {
201 $query =
"DELETE FROM crs_objective_status " .
202 "WHERE " .
$ilDB->in(
'objective_id', $objectives,
false,
'integer') .
' ' .
203 "AND user_id = " .
$ilDB->quote($this->
getUserId(),
'integer') .
" ";
206 $query =
"DELETE FROM crs_objective_status_p " .
207 "WHERE " .
$ilDB->in(
'objective_id', $objectives,
false,
'integer') .
' ' .
211 $query =
"DELETE FROM loc_user_results " .
212 "WHERE " .
$ilDB->in(
'objective_id', $objectives,
false,
'integer') .
' ' .
217 include_once
'./Services/Tracking/classes/class.ilLPStatusWrapper.php';
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.
static _getObjectiveIds($course_id, $a_activated_only=false)
resetTestForUser(ilObjTest $a_test, $a_user_id)
foreach($_POST as $key=> $value) $res
const TYPE_TEST_QUALIFIED
◆ resetTestForUser()
ilCourseObjectiveResult::resetTestForUser |
( |
ilObjTest |
$a_test, |
|
|
|
$a_user_id |
|
) |
| |
|
protected |
◆ $db
ilCourseObjectiveResult::$db = null |
◆ $user_id
ilCourseObjectiveResult::$user_id = null |
The documentation for this class was generated from the following file: