ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 ($objId, $usrId)
 
static getEmptyInstance ()
 
static getResultsForObject ($objId)
 

Protected Member Functions

 update ()
 
 insert ()
 
 assignFromDbRow ($row)
 

Protected Attributes

 $id
 
 $objId
 
 $usrId
 
 $version
 
 $score
 
 $status
 
 $lastUpdate
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilCmiXapiResult::__construct ( )

ilCmiXapiResult constructor.

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

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

63  {
64  $this->id = 0;
65  $this->objId = 0;
66  $this->usrId = 0;
67  $this->version = 0;
68  $this->score = 0.0;
69  $this->status = '';
70  $this->lastUpdate = '';
71  }

Member Function Documentation

◆ assignFromDbRow()

ilCmiXapiResult::assignFromDbRow (   $row)
protected
Parameters
ilCmiXapiResult$result
$row

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

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

232  {
233  $this->setId($row['id']);
234  $this->setObjId($row['obj_id']);
235  $this->setUsrId($row['usr_id']);
236  $this->setVersion($row['version']);
237  $this->setScore($row['score']);
238  $this->setStatus($row['status']);
239  $this->setLastUpdate($row['last_update']);
240  }
setLastUpdate(string $lastUpdate)
setStatus(string $status)
+ Here is the call graph for this function:

◆ getEmptyInstance()

static ilCmiXapiResult::getEmptyInstance ( )
static

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

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

266  {
267  return new self();
268  }
+ Here is the caller graph for this function:

◆ getId()

ilCmiXapiResult::getId ( )
Returns
int

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

References $id.

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

76  : int
77  {
78  return $this->id;
79  }
+ Here is the caller graph for this function:

◆ getInstanceByObjIdAndUsrId()

static ilCmiXapiResult::getInstanceByObjIdAndUsrId (   $objId,
  $usrId 
)
static

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

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

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

243  {
244  global $DIC; /* @var \ILIAS\DI\Container $DIC */
245 
246  $query = "
247  SELECT * FROM cmix_results
248  WHERE obj_id = %s AND usr_id = %s
249  ";
250 
251  $res = $DIC->database()->queryF($query, array('integer', 'integer'), array($objId, $usrId));
252 
253  while ($row = $DIC->database()->fetchAssoc($res)) {
254  $result = new self();
255  $result->assignFromDbRow($row);
256 
257  return $result;
258  }
259 
260  throw new ilCmiXapiException(
261  "no result record exists for: usr=$usrId obj=$objId"
262  );
263  }
$result
foreach($_POST as $key=> $value) $res
$query
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ getLastUpdate()

ilCmiXapiResult::getLastUpdate ( )
Returns
string

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

References $lastUpdate.

172  : string
173  {
174  return $this->lastUpdate;
175  }

◆ getObjId()

ilCmiXapiResult::getObjId ( )
Returns
int

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

References $objId.

Referenced by insert(), and update().

92  : int
93  {
94  return $this->objId;
95  }
+ Here is the caller graph for this function:

◆ getResultsForObject()

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

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

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

Referenced by ilLPStatusCmiXapiAbstract\loadStatusInfo().

275  {
276  global $DIC;
277 
278  $query = 'SELECT * FROM cmix_results'
279  . ' WHERE obj_id = ' . $DIC->database()->quote($objId, 'integer');
280 
281  $res = $DIC->database()->query($query);
282 
283  $results = [];
284 
285  if ($row = $DIC->database()->fetchAssoc($res)) {
286  $result = new self();
287  $result->assignFromDbRow($row);
288 
289  $results[$result->getUsrId()] = $result;
290  }
291 
292  return $results;
293  }
$result
foreach($_POST as $key=> $value) $res
$query
$results
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ getScore()

ilCmiXapiResult::getScore ( )
Returns
float

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

References $score.

Referenced by insert(), and update().

140  : float
141  {
142  return $this->score;
143  }
+ Here is the caller graph for this function:

◆ getStatus()

◆ getUsrId()

ilCmiXapiResult::getUsrId ( )
Returns
int

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

References $usrId.

Referenced by insert(), and update().

108  : int
109  {
110  return $this->usrId;
111  }
+ Here is the caller graph for this function:

◆ getVersion()

ilCmiXapiResult::getVersion ( )
Returns
int

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

References $version.

Referenced by insert(), and update().

124  : int
125  {
126  return $this->version;
127  }
+ Here is the caller graph for this function:

◆ insert()

ilCmiXapiResult::insert ( )
protected

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

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

Referenced by save().

211  {
212  global $DIC; /* @var \ILIAS\DI\Container $DIC */
213 
214  $this->setId($DIC->database()->nextId('cmix_results'));
215 
216  $DIC->database()->insert('cmix_results', array(
217  'id' => array('intger', $this->getId()),
218  'obj_id' => array('intger', $this->getObjId()),
219  'usr_id' => array('intger', $this->getUsrId()),
220  'version' => array('intger', $this->getVersion()),
221  'score' => array('float', $this->getScore()),
222  'status' => array('text', $this->getStatus()),
223  'last_update' => array('timestamp', ilCmiXapiAuthToken::selectCurrentTimestamp())
224  ));
225  }
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilCmiXapiResult::save ( )

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

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

186  {
187  if ($this->getId()) {
188  $this->update();
189  } else {
190  $this->insert();
191  }
192  }
+ Here is the call graph for this function:

◆ setId()

ilCmiXapiResult::setId ( int  $id)
Parameters
int$id

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

References $id.

Referenced by assignFromDbRow(), and insert().

85  {
86  $this->id = $id;
87  }
+ Here is the caller graph for this function:

◆ setLastUpdate()

ilCmiXapiResult::setLastUpdate ( string  $lastUpdate)
Parameters
string$lastUpdate

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

References $lastUpdate.

Referenced by assignFromDbRow().

181  {
182  $this->lastUpdate = $lastUpdate;
183  }
+ Here is the caller graph for this function:

◆ setObjId()

ilCmiXapiResult::setObjId ( int  $objId)
Parameters
int$objId

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

References $objId.

Referenced by assignFromDbRow().

101  {
102  $this->objId = $objId;
103  }
+ Here is the caller graph for this function:

◆ setScore()

ilCmiXapiResult::setScore ( float  $score)
Parameters
float$score

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

References $score.

Referenced by assignFromDbRow().

149  {
150  $this->score = $score;
151  }
+ Here is the caller graph for this function:

◆ setStatus()

ilCmiXapiResult::setStatus ( string  $status)
Parameters
string$status

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

References $status.

Referenced by assignFromDbRow().

165  {
166  $this->status = $status;
167  }
+ Here is the caller graph for this function:

◆ setUsrId()

ilCmiXapiResult::setUsrId ( int  $usrId)
Parameters
int$usrId

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

References $usrId.

Referenced by assignFromDbRow().

117  {
118  $this->usrId = $usrId;
119  }
+ Here is the caller graph for this function:

◆ setVersion()

ilCmiXapiResult::setVersion ( int  $version)
Parameters
int$version

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

References $version.

Referenced by assignFromDbRow().

133  {
134  $this->version = $version;
135  }
+ Here is the caller graph for this function:

◆ update()

ilCmiXapiResult::update ( )
protected

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

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

Referenced by save().

195  {
196  global $DIC; /* @var \ILIAS\DI\Container $DIC */
197 
198  $DIC->database()->update('cmix_results', array(
199  'obj_id' => array('intger', $this->getObjId()),
200  'usr_id' => array('intger', $this->getUsrId()),
201  'version' => array('intger', $this->getVersion()),
202  'score' => array('float', $this->getScore()),
203  'status' => array('text', $this->getStatus()),
204  'last_update' => array('timestamp', ilCmiXapiAuthToken::selectCurrentTimestamp())
205  ), array(
206  'id' => array('intger', $this->getId())
207  ));
208  }
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $id

ilCmiXapiResult::$id
protected

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

Referenced by getId(), and setId().

◆ $lastUpdate

ilCmiXapiResult::$lastUpdate
protected

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

Referenced by getLastUpdate(), and setLastUpdate().

◆ $objId

ilCmiXapiResult::$objId
protected

◆ $score

ilCmiXapiResult::$score
protected

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

Referenced by getScore(), and setScore().

◆ $status

ilCmiXapiResult::$status
protected

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

Referenced by getStatus(), and setStatus().

◆ $usrId

ilCmiXapiResult::$usrId
protected

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

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

◆ $version

ilCmiXapiResult::$version
protected

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

Referenced by getVersion(), and setVersion().


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