ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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)
 getOptionArray ()
 getAnonymousActiveIds ()

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

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

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

References $db, and $lng.

{
$this->db = $db;
$this->lng = $lng;
$this->activeIds = array();
$this->userIds = array();
$this->anonymousIds = array();
$this->byActiveId = array();
$this->byUserId = array();
$this->byAnonymousId = array();
}

Member Function Documentation

ilTestParticipantData::buildFormatedFullname (   $usrData)
private

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

Referenced by getFormatedFullnameByActiveId(), and getOptionArray().

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

+ Here is the caller graph for this function:

ilTestParticipantData::getActiveIdByUserId (   $userId)

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

{
return $this->byUserId[$userId]['active_id'];
}
ilTestParticipantData::getActiveIds ( )

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

References $activeIds.

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

{
}

+ Here is the caller graph for this function:

ilTestParticipantData::getAnonymousActiveIds ( )

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

Referenced by ilObjTest\removeTestResults().

{
$anonymousActiveIds = array();
foreach($this->byActiveId as $activeId => $active)
{
if($active['user_id'] == ANONYMOUS_USER_ID)
{
$anonymousActiveIds[] = $activeId;
}
}
return $anonymousActiveIds;
}

+ Here is the caller graph for this function:

ilTestParticipantData::getAnonymousIds ( )

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

References $anonymousIds.

Referenced by getConditionalExpression().

{
}

+ Here is the caller graph for this function:

ilTestParticipantData::getConcatedFullnameByActiveId (   $activeId)

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

{
return "{$this->byActiveId[$activeId]['firstname']} {$this->byActiveId[$activeId]['lastname']}";
}
ilTestParticipantData::getConditionalExpression ( )

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

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

{
$conditions = array();
if( count($this->getActiveIds()) )
{
$conditions[] = $this->db->in('active_id', $this->getActiveIds(), false, 'integer');
}
if( count($this->getUserIds()) )
{
$conditions[] = $this->db->in('user_fi', $this->getUserIds(), false, 'integer');
}
if( count($this->getAnonymousIds()) )
{
$conditions[] = $this->db->in('anonymous_id', $this->getAnonymousIds(), false, 'integer');
}
if( count($conditions) )
{
return '('.implode(' OR ', $conditions).')';
}
return '1 = 1';
}

+ Here is the call graph for this function:

ilTestParticipantData::getFormatedFullnameByActiveId (   $activeId)

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

References buildFormatedFullname().

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

+ Here is the call graph for this function:

ilTestParticipantData::getOptionArray ( )

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

References $options, and buildFormatedFullname().

{
$options = array();
foreach($this->byActiveId as $activeId => $usrData)
{
$options[$activeId] = $this->buildFormatedFullname($usrData);
}
asort($options);
return $options;
}

+ Here is the call graph for this function:

ilTestParticipantData::getUserIdByActiveId (   $activeId)

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

{
return $this->byActiveId[$activeId]['user_id'];
}
ilTestParticipantData::getUserIds ( )

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

References $userIds.

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

{
}

+ Here is the caller graph for this function:

ilTestParticipantData::load (   $testId)

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

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

{
$this->byActiveId = array();
$this->byUserId = array();
$query = "
SELECT ta.active_id,
ta.user_fi user_id,
ta.anonymous_id,
ud.firstname,
ud.lastname
FROM tst_active ta
LEFT JOIN usr_data ud
ON ud.usr_id = ta.user_fi
WHERE test_fi = %s
AND {$this->getConditionalExpression()}
";
$res = $this->db->queryF($query, array('integer'), array($testId));
while( $row = $this->db->fetchAssoc($res) )
{
$this->byActiveId[ $row['active_id'] ] = $row;
if( $row['user_id'] == ANONYMOUS_USER_ID )
{
$this->byAnonymousId[ $row['anonymous_id'] ] = $row;
}
else
{
$this->byUserId[ $row['user_id'] ] = $row;
}
}
$this->setActiveIds(array_keys($this->byActiveId));
$this->setUserIds(array_keys($this->byUserId));
$this->setAnonymousIds(array_keys($this->byAnonymousId));
}

+ Here is the call graph for this function:

ilTestParticipantData::setActiveIds (   $activeIds)

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

References $activeIds.

Referenced by load().

{
$this->activeIds = $activeIds;
}

+ Here is the caller graph for this function:

ilTestParticipantData::setAnonymousIds (   $anonymousIds)

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

References $anonymousIds.

Referenced by load().

{
$this->anonymousIds = $anonymousIds;
}

+ Here is the caller graph for this function:

ilTestParticipantData::setUserIds (   $userIds)

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

References $userIds.

Referenced by load().

{
$this->userIds = $userIds;
}

+ Here is the caller graph for this function:

Field Documentation

ilTestParticipantData::$activeIds
private

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

Referenced by getActiveIds(), and setActiveIds().

ilTestParticipantData::$anonymousIds
private

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

Referenced by getAnonymousIds(), and setAnonymousIds().

ilTestParticipantData::$byActiveId
private

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

ilTestParticipantData::$byAnonymousId
private

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

ilTestParticipantData::$byUserId
private

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

ilTestParticipantData::$db
protected

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

Referenced by __construct().

ilTestParticipantData::$lng
protected

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

Referenced by __construct().

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: