ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilXapiCompliantStatementsReportLinkBuilder.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5
16{
20 protected $object;
21
25 protected $lrsType;
26
30 protected $filter;
31
33 {
34 $this->object = $object;
35 $this->lrsType = $object->getLrsType();
36 $this->filter = $filter;
37 }
38
39 public function getUrl()
40 {
41 $link = $this->lrsType->getLrsEndpointStatementsLink();
42 $link = $this->appendRequestParameters($link);
43 return $link;
44 }
45
50 protected function appendRequestParameters($link)
51 {
52 if ($this->filter->getLimit()) {
54 }
55
56 if ($this->filter->getActor()) {
58 }
59
60 if ($this->filter->getVerb()) {
61 $link = ilUtil::appendUrlParameterString($link, $this->buildParamVerb());
62 }
63
64 if ($this->filter->getStartDate()) {
66 }
67
68 if ($this->filter->getEndDate()) {
70 }
71
75
76 return $link;
77 }
78
79 protected function buildParamAgent()
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()
90 {
91 $verb = urlencode($this->filter->getVerb());
92 return "verb={$verb}";
93 }
94
95 protected function buildParamSince()
96 {
97 $since = urlencode($this->filter->getStartDate()->toXapiTimestamp());
98 return "since={$since}";
99 }
100
101 protected function buildParamUntil()
102 {
103 $until = urlencode($this->filter->getEndDate()->toXapiTimestamp());
104 return "until={$until}";
105 }
106
107 protected function buildParamActivity()
108 {
109 return "activity={$this->object->getActivityId()}";
110 }
111
112 protected function buildParamRelatedAgents()
113 {
114 return "related_agents=false";
115 }
116
117 protected function buildParamRelatedActivities()
118 {
119 return "related_activities=false";
120 }
121
122 protected function buildParamLimit()
123 {
124 return "limit={$this->filter->getLimit()}";
125 }
126}
An exception for terminatinating execution or to throw for unit testing.
static appendUrlParameterString($a_url, $a_par, $xml_style=false)
append URL parameter string ("par1=value1&par2=value2...") to given URL string
__construct(ilObjCmiXapi $object, ilCmiXapiStatementsReportFilter $filter)
filter()
Definition: filter.php:2