ILIAS  trunk Revision v11.0_alpha-1811-gd2d5443e411
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilLTIConsumerResult Class Reference
+ Collaboration diagram for ilLTIConsumerResult:

Public Member Functions

 save ()
 Save a result object. More...
 
 getId ()
 
 getObjId ()
 
 getUsrId ()
 
 getResult ()
 

Static Public Member Functions

static getById (int $a_id)
 Get a result by id. More...
 
static getByKeys (int $a_obj_id, int $a_usr_id, ?bool $a_create=false)
 Get a result by object and user key. More...
 
static getResultsForObject (int $objId)
 

Data Fields

int $id
 
int $obj_id
 
int $usr_id
 
float $result = null
 

Protected Member Functions

 fillData (array $data)
 Fill the properties with data from an array. More...
 

Detailed Description

Definition at line 29 of file class.ilLTIConsumerResult.php.

Member Function Documentation

◆ fillData()

ilLTIConsumerResult::fillData ( array  $data)
protected

Fill the properties with data from an array.

Parameters
arrayassoc data

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

References ILIAS\Repository\int().

104  : void
105  {
106  $this->id = (int) $data['id'];
107  $this->obj_id = (int) $data['obj_id'];
108  $this->usr_id = (int) $data['usr_id'];
109  $this->result = (float) $data['result'];
110  }
+ Here is the call graph for this function:

◆ getById()

static ilLTIConsumerResult::getById ( int  $a_id)
static

Get a result by id.

Definition at line 54 of file class.ilLTIConsumerResult.php.

References $DIC, $res, and null.

55  {
56  global $DIC;
57 
58  $query = 'SELECT * FROM lti_consumer_results'
59  . ' WHERE id = ' . $DIC->database()->quote($a_id, 'integer');
60 
61  $res = $DIC->database()->query($query);
62  if ($row = $DIC->database()->fetchAssoc($res)) {
63  $resObj = new ilLTIConsumerResult();
64  $resObj->fillData($row);
65  return $resObj;
66  } else {
67  return null;
68  }
69  }
$res
Definition: ltiservices.php:66
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22

◆ getByKeys()

static ilLTIConsumerResult::getByKeys ( int  $a_obj_id,
int  $a_usr_id,
?bool  $a_create = false 
)
static

Get a result by object and user key.

Returns
ilLTIConsumerResult

Definition at line 75 of file class.ilLTIConsumerResult.php.

References $DIC, $res, and null.

Referenced by ilObjLTIConsumer\buildLaunchParameters(), ilObjLTIConsumer\buildLaunchParametersLTI13(), ilLTIConsumerGradeServiceScores\checkScore(), ilLPStatusLtiOutcome\getLtiUserResult(), ilLTIConsumerPlaceholderValues\getReachedScore(), and ilLTIConsumerResultService\handleRequest().

76  {
77  global $DIC;
78 
79  $query = 'SELECT * FROM lti_consumer_results'
80  . ' WHERE obj_id = ' . $DIC->database()->quote($a_obj_id, 'integer')
81  . ' AND usr_id = ' . $DIC->database()->quote($a_usr_id, 'integer');
82 
83  $res = $DIC->database()->query($query);
84  if ($row = $DIC->database()->fetchAssoc($res)) {
85  $resObj = new ilLTIConsumerResult();
86  $resObj->fillData($row);
87  return $resObj;
88  } elseif ($a_create) {
89  $resObj = new ilLTIConsumerResult();
90  $resObj->obj_id = $a_obj_id;
91  $resObj->usr_id = $a_usr_id;
92  $resObj->result = null;
93  $resObj->save();
94  return $resObj;
95  } else {
96  return null;
97  }
98  }
$res
Definition: ltiservices.php:66
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ getId()

ilLTIConsumerResult::getId ( )

Definition at line 139 of file class.ilLTIConsumerResult.php.

References $id.

139  : int
140  {
141  return $this->id;
142  }

◆ getObjId()

ilLTIConsumerResult::getObjId ( )

Definition at line 144 of file class.ilLTIConsumerResult.php.

References $obj_id.

144  : int
145  {
146  return $this->obj_id;
147  }

◆ getResult()

ilLTIConsumerResult::getResult ( )

Definition at line 154 of file class.ilLTIConsumerResult.php.

References $result.

154  : ?float
155  {
156  return $this->result;
157  }

◆ getResultsForObject()

static ilLTIConsumerResult::getResultsForObject ( int  $objId)
static
Parameters
$objId
Returns
ilLTIConsumerResult[]

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

References $DIC, $res, and $results.

163  : array
164  {
165  global $DIC; /* @var \ILIAS\DI\Container $DIC */
166 
167  $query = 'SELECT * FROM lti_consumer_results'
168  . ' WHERE obj_id = ' . $DIC->database()->quote($objId, 'integer');
169 
170  $res = $DIC->database()->query($query);
171 
172  $results = [];
173 
174  if ($row = $DIC->database()->fetchAssoc($res)) {
175  $resObj = new ilLTIConsumerResult();
176  $resObj->fillData($row);
177 
178  $results[$resObj->getUsrId()] = $resObj;
179  }
180 
181  return $results;
182  }
$res
Definition: ltiservices.php:66
$objId
Definition: xapitoken.php:57
global $DIC
Definition: shib_login.php:22
$results

◆ getUsrId()

ilLTIConsumerResult::getUsrId ( )

Definition at line 149 of file class.ilLTIConsumerResult.php.

References $usr_id.

149  : int
150  {
151  return $this->usr_id;
152  }

◆ save()

ilLTIConsumerResult::save ( )

Save a result object.

Definition at line 115 of file class.ilLTIConsumerResult.php.

References $DIC.

Referenced by ilLTIConsumerResultService\replaceResult().

115  : bool
116  {
117  global $DIC; /* @var \ILIAS\DI\Container $DIC */
118 
119  if (!isset($this->usr_id) || !isset($this->obj_id)) {
120  return false;
121  }
122  if (!isset($this->id)) {
123  $this->id = $DIC->database()->nextId('lti_consumer_results');
124  }
125  $DIC->database()->replace(
126  'lti_consumer_results',
127  array(
128  'id' => array('integer', $this->id)
129  ),
130  array(
131  'obj_id' => array('integer', $this->obj_id),
132  'usr_id' => array('integer', $this->usr_id),
133  'result' => array('float', $this->result)
134  )
135  );
136  return true;
137  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

Field Documentation

◆ $id

int ilLTIConsumerResult::$id

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

Referenced by getId().

◆ $obj_id

int ilLTIConsumerResult::$obj_id

Definition at line 39 of file class.ilLTIConsumerResult.php.

Referenced by getObjId().

◆ $result

float ilLTIConsumerResult::$result = null

Definition at line 49 of file class.ilLTIConsumerResult.php.

Referenced by getResult().

◆ $usr_id

int ilLTIConsumerResult::$usr_id

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

Referenced by getUsrId().


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