ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilCmiXapiResult Class Reference
+ Collaboration diagram for ilCmiXapiResult:

Public Member Functions

 __construct ()
 ilCmiXapiResult constructor. More...
 
 getId ()
 
 setId (int $id)
 
 getObjId ()
 
 setObjId (int $objId)
 
 getUsrId ()
 
 setUsrId (int $usrId)
 
 getVersion ()
 
 setVersion (int $version)
 
 getScore ()
 
 setScore (float $score)
 
 getStatus ()
 
 setStatus (string $status)
 
 getLastUpdate ()
 
 setLastUpdate (string $lastUpdate)
 
 save ()
 

Static Public Member Functions

static getInstanceByObjIdAndUsrId (int $objId, int $usrId)
 
static getEmptyInstance ()
 
static getResultsForObject (int $objId)
 

Protected Member Functions

 update ()
 
 insert ()
 
 assignFromDbRow (array $row)
 

Protected Attributes

int $id
 
int $objId
 
int $usrId
 
int $version
 
float $score
 
string $status
 
string $lastUpdate
 

Private Attributes

ilDBInterface $database
 

Detailed Description

Definition at line 30 of file class.ilCmiXapiResult.php.

Constructor & Destructor Documentation

◆ __construct()

ilCmiXapiResult::__construct ( )

ilCmiXapiResult constructor.

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

52 {
53 global $DIC;
54 $this->database = $DIC->database();
55 $this->id = 0;
56 $this->objId = 0;
57 $this->usrId = 0;
58 $this->version = 0;
59 $this->score = 0.0;
60 $this->status = '';
61 $this->lastUpdate = '';
62 }
global $DIC
Definition: shib_login.php:26

References $DIC, and ILIAS\Repository\database().

+ Here is the call graph for this function:

Member Function Documentation

◆ assignFromDbRow()

ilCmiXapiResult::assignFromDbRow ( array  $row)
protected

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

172 : void
173 {
174 $this->setId((int) $row['id']);
175 $this->setObjId((int) $row['obj_id']);
176 $this->setUsrId((int) $row['usr_id']);
177 $this->setVersion((int) $row['version']);
178 $this->setScore((float) $row['score']);
179 $this->setStatus((string) $row['status']);
180 $this->setLastUpdate((string) $row['last_update']);
181 }
setVersion(int $version)
setStatus(string $status)
setLastUpdate(string $lastUpdate)

References setId(), setLastUpdate(), setObjId(), setScore(), setStatus(), setUsrId(), and setVersion().

+ Here is the call graph for this function:

◆ getEmptyInstance()

static ilCmiXapiResult::getEmptyInstance ( )
static

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

209 {
210 return new self();
211 }

Referenced by ilCmiXapiPlaceholderValues\getReachedScore(), and ilXapiStatementEvaluation\getUserResult().

+ Here is the caller graph for this function:

◆ getId()

ilCmiXapiResult::getId ( )

Definition at line 64 of file class.ilCmiXapiResult.php.

64 : int
65 {
66 return $this->id;
67 }

References $id.

Referenced by insert(), save(), and update().

+ Here is the caller graph for this function:

◆ getInstanceByObjIdAndUsrId()

static ilCmiXapiResult::getInstanceByObjIdAndUsrId ( int  $objId,
int  $usrId 
)
static
Exceptions
ilCmiXapiException

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

187 {
188 global $DIC; /* @var \ILIAS\DI\Container $DIC */
189 $query = "
190 SELECT * FROM cmix_results
191 WHERE obj_id = %s AND usr_id = %s
192 ";
193
194 $res = $DIC->database()->queryF($query, array('integer', 'integer'), array($objId, $usrId));
195
196 while ($row = $DIC->database()->fetchAssoc($res)) {
197 $result = new self();
198 $result->assignFromDbRow($row);
199
200 return $result;
201 }
202
203 throw new ilCmiXapiException(
204 "no result record exists for: usr=$usrId obj=$objId"
205 );
206 }
$res
Definition: ltiservices.php:69

References $DIC, $objId, $res, and $usrId.

Referenced by ilLPStatusCmiXapiAbstract\getCmixUserResult(), ilCmiXapiPlaceholderValues\getReachedScore(), and ilXapiStatementEvaluation\getUserResult().

+ Here is the caller graph for this function:

◆ getLastUpdate()

ilCmiXapiResult::getLastUpdate ( )

Definition at line 124 of file class.ilCmiXapiResult.php.

124 : string
125 {
126 return $this->lastUpdate;
127 }

References $lastUpdate.

◆ getObjId()

ilCmiXapiResult::getObjId ( )

Definition at line 74 of file class.ilCmiXapiResult.php.

74 : int
75 {
76 return $this->objId;
77 }

References $objId.

Referenced by insert(), and update().

+ Here is the caller graph for this function:

◆ getResultsForObject()

static ilCmiXapiResult::getResultsForObject ( int  $objId)
static
Returns
ilCmiXapiResult[]

Definition at line 216 of file class.ilCmiXapiResult.php.

216 : array
217 {
218 global $DIC;
219
220 $query = 'SELECT * FROM cmix_results'
221 . ' WHERE obj_id = ' . $DIC->database()->quote($objId, 'integer');
222
223 $res = $DIC->database()->query($query);
224
225 $results = [];
226
227 if ($row = $DIC->database()->fetchAssoc($res)) {
228 $result = new self();
229 $result->assignFromDbRow($row);
230
231 $results[$result->getUsrId()] = $result;
232 }
233
234 return $results;
235 }
$results

References $DIC, $objId, $res, and $results.

Referenced by ilLPStatusCmiXapiAbstract\loadStatusInfo().

+ Here is the caller graph for this function:

◆ getScore()

ilCmiXapiResult::getScore ( )

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

104 : float
105 {
106 return $this->score;
107 }

References $score.

Referenced by insert(), and update().

+ Here is the caller graph for this function:

◆ getStatus()

◆ getUsrId()

ilCmiXapiResult::getUsrId ( )

Definition at line 84 of file class.ilCmiXapiResult.php.

84 : int
85 {
86 return $this->usrId;
87 }

References $usrId.

Referenced by insert(), and update().

+ Here is the caller graph for this function:

◆ getVersion()

ilCmiXapiResult::getVersion ( )

Definition at line 94 of file class.ilCmiXapiResult.php.

94 : int
95 {
96 return $this->version;
97 }

References $version.

Referenced by insert(), and update().

+ Here is the caller graph for this function:

◆ insert()

ilCmiXapiResult::insert ( )
protected

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

157 : void
158 {
159 $this->setId($this->database->nextId('cmix_results'));
160
161 $this->database->insert('cmix_results', array(
162 'id' => array('integer', $this->getId()),
163 'obj_id' => array('integer', $this->getObjId()),
164 'usr_id' => array('integer', $this->getUsrId()),
165 'version' => array('integer', $this->getVersion()),
166 'score' => array('float', $this->getScore()),
167 'status' => array('text', $this->getStatus()),
168 'last_update' => array('timestamp', ilCmiXapiAuthToken::selectCurrentTimestamp())
169 ));
170 }

References ILIAS\Repository\database(), getId(), getObjId(), getScore(), getStatus(), getUsrId(), getVersion(), ilCmiXapiAuthToken\selectCurrentTimestamp(), and setId().

Referenced by save().

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

◆ save()

ilCmiXapiResult::save ( )

Definition at line 134 of file class.ilCmiXapiResult.php.

134 : void
135 {
136 if ($this->getId()) {
137 $this->update();
138 } else {
139 $this->insert();
140 }
141 }

References getId(), insert(), and update().

+ Here is the call graph for this function:

◆ setId()

ilCmiXapiResult::setId ( int  $id)

Definition at line 69 of file class.ilCmiXapiResult.php.

69 : void
70 {
71 $this->id = $id;
72 }

References $id.

Referenced by assignFromDbRow(), and insert().

+ Here is the caller graph for this function:

◆ setLastUpdate()

ilCmiXapiResult::setLastUpdate ( string  $lastUpdate)

Definition at line 129 of file class.ilCmiXapiResult.php.

129 : void
130 {
131 $this->lastUpdate = $lastUpdate;
132 }

References $lastUpdate.

Referenced by assignFromDbRow().

+ Here is the caller graph for this function:

◆ setObjId()

ilCmiXapiResult::setObjId ( int  $objId)

Definition at line 79 of file class.ilCmiXapiResult.php.

79 : void
80 {
81 $this->objId = $objId;
82 }

References $objId.

Referenced by assignFromDbRow().

+ Here is the caller graph for this function:

◆ setScore()

ilCmiXapiResult::setScore ( float  $score)

Definition at line 109 of file class.ilCmiXapiResult.php.

109 : void
110 {
111 $this->score = $score;
112 }

References $score.

Referenced by assignFromDbRow().

+ Here is the caller graph for this function:

◆ setStatus()

ilCmiXapiResult::setStatus ( string  $status)

Definition at line 119 of file class.ilCmiXapiResult.php.

119 : void
120 {
121 $this->status = $status;
122 }

References $status.

Referenced by assignFromDbRow().

+ Here is the caller graph for this function:

◆ setUsrId()

ilCmiXapiResult::setUsrId ( int  $usrId)

Definition at line 89 of file class.ilCmiXapiResult.php.

89 : void
90 {
91 $this->usrId = $usrId;
92 }

References $usrId.

Referenced by assignFromDbRow().

+ Here is the caller graph for this function:

◆ setVersion()

ilCmiXapiResult::setVersion ( int  $version)

Definition at line 99 of file class.ilCmiXapiResult.php.

99 : void
100 {
101 $this->version = $version;
102 }

References $version.

Referenced by assignFromDbRow().

+ Here is the caller graph for this function:

◆ update()

ilCmiXapiResult::update ( )
protected

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

143 : void
144 {
145 $this->database->update('cmix_results', array(
146 'obj_id' => array('intger', $this->getObjId()),
147 'usr_id' => array('intger', $this->getUsrId()),
148 'version' => array('intger', $this->getVersion()),
149 'score' => array('float', $this->getScore()),
150 'status' => array('text', $this->getStatus()),
151 'last_update' => array('timestamp', ilCmiXapiAuthToken::selectCurrentTimestamp())
152 ), array(
153 'id' => array('intger', $this->getId())
154 ));
155 }

References ILIAS\Repository\database(), getId(), getObjId(), getScore(), getStatus(), getUsrId(), getVersion(), and ilCmiXapiAuthToken\selectCurrentTimestamp().

Referenced by save().

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

Field Documentation

◆ $database

ilDBInterface ilCmiXapiResult::$database
private

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

◆ $id

int ilCmiXapiResult::$id
protected

Definition at line 32 of file class.ilCmiXapiResult.php.

Referenced by getId(), and setId().

◆ $lastUpdate

string ilCmiXapiResult::$lastUpdate
protected

Definition at line 44 of file class.ilCmiXapiResult.php.

Referenced by getLastUpdate(), and setLastUpdate().

◆ $objId

int ilCmiXapiResult::$objId
protected

◆ $score

float ilCmiXapiResult::$score
protected

Definition at line 40 of file class.ilCmiXapiResult.php.

Referenced by getScore(), and setScore().

◆ $status

string ilCmiXapiResult::$status
protected

Definition at line 42 of file class.ilCmiXapiResult.php.

Referenced by getStatus(), and setStatus().

◆ $usrId

int ilCmiXapiResult::$usrId
protected

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

Referenced by getInstanceByObjIdAndUsrId(), getUsrId(), and setUsrId().

◆ $version

int ilCmiXapiResult::$version
protected

Definition at line 38 of file class.ilCmiXapiResult.php.

Referenced by getVersion(), and setVersion().


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