ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilXapiCompliantStatementsReportLinkBuilder.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
31{
33
35
37
39 {
40 $this->object = $object;
41 $this->lrsType = $object->getLrsType();
42 $this->filter = $filter;
43 }
44
45 public function getUrl(): string
46 {
47 $link = $this->lrsType->getLrsEndpointStatementsLink();
48 return $this->appendRequestParameters($link);
49 }
50
51 protected function appendRequestParameters(string $link): string
52 {
53 if ($this->filter->getLimit() !== 0) {
55 }
56
57 if ($this->filter->getActor() !== null) {
59 }
60
61 if ($this->filter->getVerb()) {
62 $link = ilUtil::appendUrlParameterString($link, $this->buildParamVerb());
63 }
64
65 if ($this->filter->getStartDate() !== null) {
67 }
68
69 if ($this->filter->getEndDate() !== null) {
71 }
72
75
77 }
78
79 protected function buildParamAgent(): string
80 {
81 $agent = json_encode([
82 'objectType' => 'Agent',
83 'mbox' => 'mailto:' . $this->filter->getActor()->getUsrIdent()
84 ]);
85
86 return "agent={$agent}";
87 }
88
89 protected function buildParamVerb(): string
90 {
91 $verb = urlencode($this->filter->getVerb());
92 return "verb={$verb}";
93 }
94
95 protected function buildParamSince(): string
96 {
97 $since = urlencode($this->filter->getStartDate()->toXapiTimestamp());
98 return "since={$since}";
99 }
100
101 protected function buildParamUntil(): string
102 {
103 $until = urlencode($this->filter->getEndDate()->toXapiTimestamp());
104 return "until={$until}";
105 }
106
107 protected function buildParamActivity(): string
108 {
109 return "activity={$this->object->getActivityId()}";
110 }
111
112 protected function buildParamRelatedAgents(): string
113 {
114 return "related_agents=false";
115 }
116
117 protected function buildParamRelatedActivities(): string
118 {
119 return "related_activities=false";
120 }
121
122 protected function buildParamLimit(): string
123 {
124 return "limit={$this->filter->getLimit()}";
125 }
126}
static appendUrlParameterString(string $a_url, string $a_par, bool $xml_style=false)
__construct(ilObjCmiXapi $object, ilCmiXapiStatementsReportFilter $filter)
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)