ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilTestParticipantData Class Reference
+ Collaboration diagram for ilTestParticipantData:

Public Member Functions

 __construct (ilDBInterface $db, ilLanguage $lng)
 
 load ($testId)
 
 getConditionalExpression ()
 
 setActiveIds ($activeIds)
 
 getActiveIds ()
 
 setUserIds ($userIds)
 
 getUserIds ()
 
 setAnonymousIds ($anonymousIds)
 
 getAnonymousIds ()
 
 getUserIdByActiveId ($activeId)
 
 getActiveIdByUserId ($userId)
 
 getConcatedFullnameByActiveId ($activeId)
 
 getFormatedFullnameByActiveId ($activeId)
 
 getFileSystemCompliantFullnameByActiveId ($activeId)
 
 getOptionArray ()
 
 getAnonymousActiveIds ()
 
 getUserDataByActiveId ($activeId)
 

Protected Attributes

 $db
 
 $lng
 

Private Member Functions

 buildFormatedFullname ($usrData)
 

Private Attributes

 $activeIds
 
 $userIds
 
 $anonymousIds
 
 $byActiveId
 
 $byUserId
 
 $byAnonymousId
 

Detailed Description

Definition at line 11 of file class.ilTestParticipantData.php.

Constructor & Destructor Documentation

◆ __construct()

ilTestParticipantData::__construct ( ilDBInterface  $db,
ilLanguage  $lng 
)

Definition at line 53 of file class.ilTestParticipantData.php.

54 {
55 $this->db = $db;
56 $this->lng = $lng;
57
58 $this->activeIds = array();
59 $this->userIds = array();
60 $this->anonymousIds = array();
61
62 $this->byActiveId = array();
63 $this->byUserId = array();
64 $this->byAnonymousId = array();
65 }

References $db, and $lng.

Member Function Documentation

◆ buildFormatedFullname()

ilTestParticipantData::buildFormatedFullname (   $usrData)
private

Definition at line 199 of file class.ilTestParticipantData.php.

200 {
201 return sprintf(
202 $this->lng->txt('tst_participant_fullname_pattern'),
203 $usrData['firstname'],
204 $usrData['lastname']
205 );
206 }
sprintf('%.4f', $callTime)

References sprintf.

Referenced by getFormatedFullnameByActiveId(), and getOptionArray().

+ Here is the caller graph for this function:

◆ getActiveIdByUserId()

ilTestParticipantData::getActiveIdByUserId (   $userId)

Definition at line 162 of file class.ilTestParticipantData.php.

163 {
164 return $this->byUserId[$userId]['active_id'];
165 }

◆ getActiveIds()

ilTestParticipantData::getActiveIds ( )

Definition at line 132 of file class.ilTestParticipantData.php.

References $activeIds.

Referenced by getConditionalExpression(), and ilObjTest\removeTestResults().

+ Here is the caller graph for this function:

◆ getAnonymousActiveIds()

ilTestParticipantData::getAnonymousActiveIds ( )

Definition at line 208 of file class.ilTestParticipantData.php.

209 {
210 $anonymousActiveIds = array();
211
212 foreach ($this->byActiveId as $activeId => $active) {
213 if ($active['user_id'] == ANONYMOUS_USER_ID) {
214 $anonymousActiveIds[] = $activeId;
215 }
216 }
217
218 return $anonymousActiveIds;
219 }

Referenced by ilObjTest\removeTestResults().

+ Here is the caller graph for this function:

◆ getAnonymousIds()

ilTestParticipantData::getAnonymousIds ( )

Definition at line 152 of file class.ilTestParticipantData.php.

References $anonymousIds.

Referenced by getConditionalExpression().

+ Here is the caller graph for this function:

◆ getConcatedFullnameByActiveId()

ilTestParticipantData::getConcatedFullnameByActiveId (   $activeId)

Definition at line 167 of file class.ilTestParticipantData.php.

168 {
169 return "{$this->byActiveId[$activeId]['firstname']} {$this->byActiveId[$activeId]['lastname']}";
170 }

◆ getConditionalExpression()

ilTestParticipantData::getConditionalExpression ( )

Definition at line 104 of file class.ilTestParticipantData.php.

105 {
106 $conditions = array();
107
108 if (count($this->getActiveIds())) {
109 $conditions[] = $this->db->in('active_id', $this->getActiveIds(), false, 'integer');
110 }
111
112 if (count($this->getUserIds())) {
113 $conditions[] = $this->db->in('user_fi', $this->getUserIds(), false, 'integer');
114 }
115
116 if (count($this->getAnonymousIds())) {
117 $conditions[] = $this->db->in('anonymous_id', $this->getAnonymousIds(), false, 'integer');
118 }
119
120 if (count($conditions)) {
121 return '(' . implode(' OR ', $conditions) . ')';
122 }
123
124 return '1 = 1';
125 }

References getActiveIds(), getAnonymousIds(), and getUserIds().

+ Here is the call graph for this function:

◆ getFileSystemCompliantFullnameByActiveId()

ilTestParticipantData::getFileSystemCompliantFullnameByActiveId (   $activeId)

Definition at line 177 of file class.ilTestParticipantData.php.

178 {
179 $fullname = str_replace(' ', '', $this->byActiveId[$activeId]['lastname']);
180 $fullname .= '_' . str_replace(' ', '', $this->byActiveId[$activeId]['firstname']);
181 $fullname .= '_' . $this->byActiveId[$activeId]['login'];
182
183 return ilUtil::getASCIIFilename($fullname);
184 }
static getASCIIFilename($a_filename)
convert utf8 to ascii filename

References ilUtil\getASCIIFilename().

Referenced by ilAssFileUploadUploadsExporter\collectUploadedFiles().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFormatedFullnameByActiveId()

ilTestParticipantData::getFormatedFullnameByActiveId (   $activeId)

Definition at line 172 of file class.ilTestParticipantData.php.

173 {
174 return $this->buildFormatedFullname($this->byActiveId[$activeId]);
175 }

References buildFormatedFullname().

+ Here is the call graph for this function:

◆ getOptionArray()

ilTestParticipantData::getOptionArray ( )

Definition at line 186 of file class.ilTestParticipantData.php.

187 {
188 $options = array();
189
190 foreach ($this->byActiveId as $activeId => $usrData) {
191 $options[$activeId] = $this->buildFormatedFullname($usrData);
192 }
193
194 asort($options);
195
196 return $options;
197 }
if(!isset( $_REQUEST[ 'ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20

References $options, and buildFormatedFullname().

+ Here is the call graph for this function:

◆ getUserDataByActiveId()

ilTestParticipantData::getUserDataByActiveId (   $activeId)

Definition at line 221 of file class.ilTestParticipantData.php.

222 {
223 if (isset($this->byActiveId[$activeId])) {
224 return $this->byActiveId[$activeId];
225 }
226
227 return null;
228 }

◆ getUserIdByActiveId()

ilTestParticipantData::getUserIdByActiveId (   $activeId)

Definition at line 157 of file class.ilTestParticipantData.php.

158 {
159 return $this->byActiveId[$activeId]['user_id'];
160 }

◆ getUserIds()

ilTestParticipantData::getUserIds ( )

Definition at line 142 of file class.ilTestParticipantData.php.

References $userIds.

Referenced by getConditionalExpression(), and ilObjTest\removeTestResults().

+ Here is the caller graph for this function:

◆ load()

ilTestParticipantData::load (   $testId)

Definition at line 67 of file class.ilTestParticipantData.php.

68 {
69 $this->byActiveId = array();
70 $this->byUserId = array();
71
72 $query = "
73 SELECT ta.active_id,
74 ta.user_fi user_id,
75 ta.anonymous_id,
76 ud.firstname,
77 ud.lastname,
78 ud.login,
79 ud.matriculation
80 FROM tst_active ta
81 LEFT JOIN usr_data ud
82 ON ud.usr_id = ta.user_fi
83 WHERE test_fi = %s
84 AND {$this->getConditionalExpression()}
85 ";
86
87 $res = $this->db->queryF($query, array('integer'), array($testId));
88
89 while ($row = $this->db->fetchAssoc($res)) {
90 $this->byActiveId[ $row['active_id'] ] = $row;
91
92 if ($row['user_id'] == ANONYMOUS_USER_ID) {
93 $this->byAnonymousId[ $row['anonymous_id'] ] = $row;
94 } else {
95 $this->byUserId[ $row['user_id'] ] = $row;
96 }
97 }
98
99 $this->setActiveIds(array_keys($this->byActiveId));
100 $this->setUserIds(array_keys($this->byUserId));
101 $this->setAnonymousIds(array_keys($this->byAnonymousId));
102 }
$query
foreach($_POST as $key=> $value) $res

References $query, $res, $row, setActiveIds(), setAnonymousIds(), and setUserIds().

+ Here is the call graph for this function:

◆ setActiveIds()

ilTestParticipantData::setActiveIds (   $activeIds)

Definition at line 127 of file class.ilTestParticipantData.php.

128 {
129 $this->activeIds = $activeIds;
130 }

References $activeIds.

Referenced by load().

+ Here is the caller graph for this function:

◆ setAnonymousIds()

ilTestParticipantData::setAnonymousIds (   $anonymousIds)

Definition at line 147 of file class.ilTestParticipantData.php.

148 {
149 $this->anonymousIds = $anonymousIds;
150 }

References $anonymousIds.

Referenced by load().

+ Here is the caller graph for this function:

◆ setUserIds()

ilTestParticipantData::setUserIds (   $userIds)

Definition at line 137 of file class.ilTestParticipantData.php.

138 {
139 $this->userIds = $userIds;
140 }

References $userIds.

Referenced by load().

+ Here is the caller graph for this function:

Field Documentation

◆ $activeIds

ilTestParticipantData::$activeIds
private

Definition at line 26 of file class.ilTestParticipantData.php.

Referenced by getActiveIds(), and setActiveIds().

◆ $anonymousIds

ilTestParticipantData::$anonymousIds
private

Definition at line 36 of file class.ilTestParticipantData.php.

Referenced by getAnonymousIds(), and setAnonymousIds().

◆ $byActiveId

ilTestParticipantData::$byActiveId
private

Definition at line 41 of file class.ilTestParticipantData.php.

◆ $byAnonymousId

ilTestParticipantData::$byAnonymousId
private

Definition at line 51 of file class.ilTestParticipantData.php.

◆ $byUserId

ilTestParticipantData::$byUserId
private

Definition at line 46 of file class.ilTestParticipantData.php.

◆ $db

ilTestParticipantData::$db
protected

Definition at line 16 of file class.ilTestParticipantData.php.

Referenced by __construct().

◆ $lng

ilTestParticipantData::$lng
protected

Definition at line 21 of file class.ilTestParticipantData.php.

Referenced by __construct().

◆ $userIds

ilTestParticipantData::$userIds
private

Definition at line 31 of file class.ilTestParticipantData.php.

Referenced by getUserIds(), and setUserIds().


The documentation for this class was generated from the following file: