56 private ?
string $tag = null;
65 public function __construct(
string $label,
int $scoreMaximum,
string $resourceId = null,
string $tag = null)
80 $lineItem = new \stdClass();
82 $lineItem->{
'@type'} =
'LineItem';
84 $lineItem->reportingMethod =
'http://purl.imsglobal.org/ctx/lis/v2p1/Result#normalScore';
85 if (!empty($this->resourceId)) {
86 $lineItem->assignedActivity = new \stdClass();
89 $lineItem->scoreConstraints = new \stdClass();
90 $lineItem->scoreConstraints->{
'@type'} =
'NumericLimits';
103 $lineItem = new \stdClass();
107 if (!empty($this->resourceId)) {
110 if (!empty($this->tag)) {
126 $reportingMethod = null;
132 foreach (get_object_vars($item) as
$name => $value) {
137 case 'reportingMethod':
138 $reportingMethod = $item->reportingMethod;
140 case 'scoreConstraints':
141 $scoreConstraints = $item->scoreConstraints;
146 case 'assignedActivity':
147 if (isset($item->assignedActivity->activityId)) {
148 $activityId = $item->assignedActivity->activityId;
152 $activityId = $item->resourceId;
160 foreach (get_object_vars($scoreConstraints) as
$name => $value) {
161 $method = str_replace(
'Maximum',
'Score',
$name);
162 if (substr($reportingMethod, -strlen($method)) === $method) {
toJsonldObject()
Generate the JSON-LD object representation of the line-item.
toJsonObject()
Generate the JSON object representation of the line-item.
int $scoreMaximum
Maximum score of line-item.
Class to represent a line-item object.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
string $tag
Tag of line-item.
string $label
Label of line-item.
static fromJsonObject(object $item)
Generate a LineItem object from its JSON or JSON-LD representation.
__construct(string $label, int $scoreMaximum, string $resourceId=null, string $tag=null)
Class constructor.
string $resourceId
Resource ID associated with line-item.