ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilTestParticipantData Class Reference
+ Collaboration diagram for ilTestParticipantData:

Public Member Functions

 __construct (ilDB $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 ( ilDB  $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 208 of file class.ilTestParticipantData.php.

209 {
210 return sprintf(
211 $this->lng->txt('tst_participant_fullname_pattern'), $usrData['firstname'], $usrData['lastname']
212 );
213 }

Referenced by getFormatedFullnameByActiveId(), and getOptionArray().

+ Here is the caller graph for this function:

◆ getActiveIdByUserId()

ilTestParticipantData::getActiveIdByUserId (   $userId)

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

171 {
172 return $this->byUserId[$userId]['active_id'];
173 }

◆ getActiveIds()

ilTestParticipantData::getActiveIds ( )

Definition at line 140 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 215 of file class.ilTestParticipantData.php.

216 {
217 $anonymousActiveIds = array();
218
219 foreach($this->byActiveId as $activeId => $active)
220 {
221 if($active['user_id'] == ANONYMOUS_USER_ID)
222 {
223 $anonymousActiveIds[] = $activeId;
224 }
225 }
226
227 return $anonymousActiveIds;
228 }

Referenced by ilObjTest\removeTestResults().

+ Here is the caller graph for this function:

◆ getAnonymousIds()

ilTestParticipantData::getAnonymousIds ( )

Definition at line 160 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 175 of file class.ilTestParticipantData.php.

176 {
177 return "{$this->byActiveId[$activeId]['firstname']} {$this->byActiveId[$activeId]['lastname']}";
178 }

◆ getConditionalExpression()

ilTestParticipantData::getConditionalExpression ( )

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

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

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

+ Here is the call graph for this function:

◆ getFileSystemCompliantFullnameByActiveId()

ilTestParticipantData::getFileSystemCompliantFullnameByActiveId (   $activeId)

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

186 {
187 $fullname = str_replace(' ', '', $this->byActiveId[$activeId]['lastname']);
188 $fullname .= '_'.str_replace(' ', '', $this->byActiveId[$activeId]['firstname']);
189 $fullname .= '_'.$this->byActiveId[$activeId]['login'];
190
191 return ilUtil::getASCIIFilename($fullname);
192 }
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 180 of file class.ilTestParticipantData.php.

181 {
182 return $this->buildFormatedFullname($this->byActiveId[$activeId]);
183 }

References buildFormatedFullname().

+ Here is the call graph for this function:

◆ getOptionArray()

ilTestParticipantData::getOptionArray ( )

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

195 {
196 $options = array();
197
198 foreach($this->byActiveId as $activeId => $usrData)
199 {
200 $options[$activeId] = $this->buildFormatedFullname($usrData);
201 }
202
203 asort($options);
204
205 return $options;
206 }
if(!is_array($argv)) $options

References $options, and buildFormatedFullname().

+ Here is the call graph for this function:

◆ getUserDataByActiveId()

ilTestParticipantData::getUserDataByActiveId (   $activeId)

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

231 {
232 if( isset($this->byActiveId[$activeId]) )
233 {
234 return $this->byActiveId[$activeId];
235 }
236
237 return null;
238 }

◆ getUserIdByActiveId()

ilTestParticipantData::getUserIdByActiveId (   $activeId)

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

166 {
167 return $this->byActiveId[$activeId]['user_id'];
168 }

◆ getUserIds()

ilTestParticipantData::getUserIds ( )

Definition at line 150 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 {
91 $this->byActiveId[ $row['active_id'] ] = $row;
92
93 if( $row['user_id'] == ANONYMOUS_USER_ID )
94 {
95 $this->byAnonymousId[ $row['anonymous_id'] ] = $row;
96 }
97 else
98 {
99 $this->byUserId[ $row['user_id'] ] = $row;
100 }
101 }
102
103 $this->setActiveIds(array_keys($this->byActiveId));
104 $this->setUserIds(array_keys($this->byUserId));
105 $this->setAnonymousIds(array_keys($this->byAnonymousId));
106 }

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

+ Here is the call graph for this function:

◆ setActiveIds()

ilTestParticipantData::setActiveIds (   $activeIds)

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

136 {
137 $this->activeIds = $activeIds;
138 }

References $activeIds.

Referenced by load().

+ Here is the caller graph for this function:

◆ setAnonymousIds()

ilTestParticipantData::setAnonymousIds (   $anonymousIds)

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

156 {
157 $this->anonymousIds = $anonymousIds;
158 }

References $anonymousIds.

Referenced by load().

+ Here is the caller graph for this function:

◆ setUserIds()

ilTestParticipantData::setUserIds (   $userIds)

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

146 {
147 $this->userIds = $userIds;
148 }

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: