ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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.

References $DIC.

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: feed.php:28

Member Function Documentation

◆ assignFromDbRow()

ilCmiXapiResult::assignFromDbRow ( array  $row)
protected

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

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

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  }
setLastUpdate(string $lastUpdate)
setStatus(string $status)
setVersion(int $version)
+ Here is the call graph for this function:

◆ getEmptyInstance()

static ilCmiXapiResult::getEmptyInstance ( )
static

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

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

209  {
210  return new self();
211  }
+ Here is the caller graph for this function:

◆ getId()

ilCmiXapiResult::getId ( )

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

References $id.

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

64  : int
65  {
66  return $this->id;
67  }
+ 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.

References $DIC, $query, and $res.

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

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
global $DIC
Definition: feed.php:28
$query
+ Here is the caller graph for this function:

◆ getLastUpdate()

ilCmiXapiResult::getLastUpdate ( )

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

References $lastUpdate.

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

◆ getObjId()

ilCmiXapiResult::getObjId ( )

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

References $objId.

Referenced by insert(), and update().

74  : int
75  {
76  return $this->objId;
77  }
+ 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.

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

Referenced by ilLPStatusCmiXapiAbstract\loadStatusInfo().

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  while ($row = $DIC->database()->fetchAssoc($res)) {
228  $result = new self();
229  $result->assignFromDbRow($row);
230 
231  $results[$result->getUsrId()] = $result;
232  }
233  return $results;
234  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
$query
$results
+ Here is the caller graph for this function:

◆ getScore()

ilCmiXapiResult::getScore ( )

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

References $score.

Referenced by insert(), and update().

104  : float
105  {
106  return $this->score;
107  }
+ Here is the caller graph for this function:

◆ getStatus()

◆ getUsrId()

ilCmiXapiResult::getUsrId ( )

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

References $usrId.

Referenced by insert(), and update().

84  : int
85  {
86  return $this->usrId;
87  }
+ Here is the caller graph for this function:

◆ getVersion()

ilCmiXapiResult::getVersion ( )

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

References $version.

Referenced by insert(), and update().

94  : int
95  {
96  return $this->version;
97  }
+ Here is the caller graph for this function:

◆ insert()

ilCmiXapiResult::insert ( )
protected

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

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

Referenced by save().

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  }
+ 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.

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

134  : void
135  {
136  if ($this->getId()) {
137  $this->update();
138  } else {
139  $this->insert();
140  }
141  }
+ Here is the call graph for this function:

◆ setId()

ilCmiXapiResult::setId ( int  $id)

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

References $id.

Referenced by assignFromDbRow(), and insert().

69  : void
70  {
71  $this->id = $id;
72  }
+ Here is the caller graph for this function:

◆ setLastUpdate()

ilCmiXapiResult::setLastUpdate ( string  $lastUpdate)

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

References $lastUpdate.

Referenced by assignFromDbRow().

129  : void
130  {
131  $this->lastUpdate = $lastUpdate;
132  }
+ Here is the caller graph for this function:

◆ setObjId()

ilCmiXapiResult::setObjId ( int  $objId)

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

References $objId.

Referenced by assignFromDbRow().

79  : void
80  {
81  $this->objId = $objId;
82  }
+ Here is the caller graph for this function:

◆ setScore()

ilCmiXapiResult::setScore ( float  $score)

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

References $score.

Referenced by assignFromDbRow().

109  : void
110  {
111  $this->score = $score;
112  }
+ Here is the caller graph for this function:

◆ setStatus()

ilCmiXapiResult::setStatus ( string  $status)

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

References $status.

Referenced by assignFromDbRow().

119  : void
120  {
121  $this->status = $status;
122  }
+ Here is the caller graph for this function:

◆ setUsrId()

ilCmiXapiResult::setUsrId ( int  $usrId)

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

References $usrId.

Referenced by assignFromDbRow().

89  : void
90  {
91  $this->usrId = $usrId;
92  }
+ Here is the caller graph for this function:

◆ setVersion()

ilCmiXapiResult::setVersion ( int  $version)

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

References $version.

Referenced by assignFromDbRow().

99  : void
100  {
101  $this->version = $version;
102  }
+ Here is the caller graph for this function:

◆ update()

ilCmiXapiResult::update ( )
protected

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

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

Referenced by save().

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  }
+ 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

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

Referenced by getObjId(), and setObjId().

◆ $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 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: