ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilLPStatusSurveyFinished.php
Go to the documentation of this file.
1<?php
2
3// patch-begin svy_lp
4
5/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
6
7include_once './Services/Tracking/classes/class.ilLPStatus.php';
8
18{
19 function _getInProgress($a_obj_id)
20 {
21 return self::getParticipants($a_obj_id);
22 }
23
24 function _getCompleted($a_obj_id)
25 {
26 return self::getParticipants($a_obj_id, true);
27 }
28
37 function determineStatus($a_obj_id, $a_user_id, $a_obj = null)
38 {
39 $survey_id = self::getSurveyId($a_obj_id);
40 if(!$survey_id)
41 {
42 return;
43 }
44
46
47 include_once './Modules/Survey/classes/class.ilObjSurveyAccess.php';
48 if(ilObjSurveyAccess::_isSurveyParticipant($a_user_id, $survey_id))
49 {
51
52 if(ilObjSurveyAccess::_lookupFinished($a_obj_id, $a_user_id))
53 {
55 }
56 }
57
58 return $status;
59 }
60
61 protected static function getSurveyId($a_obj_id)
62 {
63 global $ilDB;
64
65 $set = $ilDB->query("SELECT survey_id FROM svy_svy".
66 " WHERE obj_fi = ".$ilDB->quote($a_obj_id));
67 $row = $ilDB->fetchAssoc($set);
68 return (int)$row["survey_id"];
69 }
70
71 public static function getParticipants($a_obj_id, $a_only_finished = false)
72 {
73 global $ilDB;
74
75 $res = array();
76
77 $survey_id = self::getSurveyId($a_obj_id);
78 if(!$survey_id)
79 {
80 return $res;
81 }
82
83 $sql = "SELECT user_fi FROM svy_finished fin".
84 " WHERE fin.survey_fi = ".$ilDB->quote($survey_id, "integer");
85
86 if($a_only_finished)
87 {
88 $sql .= " AND fin.state = ".$ilDB->quote(1, "integer");
89 }
90
91 $set = $ilDB->query($sql);
92 while($row = $ilDB->fetchAssoc($set))
93 {
94 $res[] = $row["user_fi"];
95 }
96
97 return $res;
98 }
99
100}
101
102// patch-end svy_lp
103
104?>
determineStatus($a_obj_id, $a_user_id, $a_obj=null)
Determine status.
static getParticipants($a_obj_id, $a_only_finished=false)
Abstract class ilLPStatus for all learning progress modes E.g ilLPStatusManual, ilLPStatusObjectives ...
const LP_STATUS_COMPLETED_NUM
const LP_STATUS_IN_PROGRESS_NUM
const LP_STATUS_NOT_ATTEMPTED_NUM
_isSurveyParticipant($user_id, $survey_id)
_lookupFinished($a_obj_id, $a_user_id="")
get finished status
global $ilDB