ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilLTIConsumerGradeSynchronization.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
30{
31 public int $id;
32 public int $obj_id;
33 public int $usr_id;
34
38 public ?float $result = null;
39
40
41 public function getId(): int
42 {
43 return $this->id;
44 }
45
46 public function getObjId(): int
47 {
48 return $this->obj_id;
49 }
50
51 public function getUsrId(): int
52 {
53 return $this->usr_id;
54 }
55
56 public function getResult(): ?float
57 {
58 return $this->result;
59 }
60
61 public static function getGradesForObject(int $objId, ?int $usrID = null, ?string $activity_progress = null, ?string $grading_progress = null, ?ilDateTime $startDate = null, ?ilDateTime $endDate = null): array
62 {
63 global $DIC; /* @var \ILIAS\DI\Container $DIC */
64
65 $query = 'SELECT * FROM lti_consumer_grades'
66 . ' WHERE obj_id = ' . $DIC->database()->quote($objId, 'integer');
67
68 if ($usrID != null) {
69 $query .= ' AND usr_id = ' . $DIC->database()->quote($usrID, 'integer');
70 }
71
72 if ($activity_progress != null) {
73 $query .= ' AND activity_progress = ' . $DIC->database()->quote($activity_progress, 'text');
74 }
75
76 if ($grading_progress != null) {
77 $query .= ' AND grading_progress = ' . $DIC->database()->quote($grading_progress, 'text');
78 }
79
80 if ($startDate != null && $startDate->get(IL_CAL_DATETIME) != null) {
81 $query .= ' AND lti_timestamp >= ' . $DIC->database()->quote($startDate->get(IL_CAL_DATETIME), 'timestamp');
82 }
83
84 if ($endDate != null && $endDate->get(IL_CAL_DATETIME) != null) {
85 $query .= ' AND lti_timestamp <= ' . $DIC->database()->quote($endDate->get(IL_CAL_DATETIME), 'timestamp');
86 }
87
88 $query .= ' ORDER BY lti_timestamp DESC';
89
90 $res = $DIC->database()->query($query);
91
92 $results = [];
93
94 while ($row = $DIC->database()->fetchAssoc($res)) {
95 $results[] = $row;
96 }
97
98 return $results;
99 }
100}
const IL_CAL_DATETIME
@classDescription Date and time handling
static getGradesForObject(int $objId, ?int $usrID=null, ?string $activity_progress=null, ?string $grading_progress=null, ?ilDateTime $startDate=null, ?ilDateTime $endDate=null)
$res
Definition: ltiservices.php:69
$results
global $DIC
Definition: shib_login.php:26
$objId
Definition: xapitoken.php:57