ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilLTIConsumerXapiStatementsGUI Class Reference
+ Collaboration diagram for ilLTIConsumerXapiStatementsGUI:

Public Member Functions

 __construct (ilObjLTIConsumer $object)
 
 executeCommand ()
 
 asyncUserAutocompleteCmd ()
 

Protected Member Functions

 resetFilterCmd ()
 
 applyFilterCmd ()
 
 showCmd ()
 
 initLimitingAndOrdering (ilCmiXapiStatementsReportFilter $filter, ilCmiXapiStatementsTableGUI $table)
 
 initActorFilter (ilCmiXapiStatementsReportFilter $filter, ilCmiXapiStatementsTableGUI $table)
 
 initVerbFilter (ilCmiXapiStatementsReportFilter $filter, ilCmiXapiStatementsTableGUI $table)
 
 initPeriodFilter (ilCmiXapiStatementsReportFilter $filter, ilCmiXapiStatementsTableGUI $table)
 
 initTableData (ilCmiXapiStatementsTableGUI $table, ilCmiXapiStatementsReportFilter $filter)
 
 buildTableGUI ()
 

Protected Attributes

ilObjLTIConsumer $object
 
ilLTIConsumerAccess $access
 

Private Attributes

ilGlobalTemplateInterface $main_tpl
 
ILIAS DI Container $dic
 

Detailed Description

Definition at line 30 of file class.ilLTIConsumerXapiStatementsGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilLTIConsumerXapiStatementsGUI::__construct ( ilObjLTIConsumer  $object)

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

45 {
46 global $DIC;
47 $this->dic = $DIC;
48 $this->main_tpl = $DIC->ui()->mainTemplate();
49 $this->object = $object;
50
51 $this->access = ilLTIConsumerAccess::getInstance($this->object);
52 }
static getInstance(ilObjLTIConsumer $object)
global $DIC
Definition: shib_login.php:26

References $DIC, $object, ILIAS\Repository\access(), and ilLTIConsumerAccess\getInstance().

+ Here is the call graph for this function:

Member Function Documentation

◆ applyFilterCmd()

ilLTIConsumerXapiStatementsGUI::applyFilterCmd ( )
protected

Definition at line 80 of file class.ilLTIConsumerXapiStatementsGUI.php.

80 : void
81 {
82 $table = $this->buildTableGUI();
83 $table->writeFilterToSession();
84 $table->resetOffset();
85 $this->showCmd();
86 }

References buildTableGUI(), and showCmd().

+ Here is the call graph for this function:

◆ asyncUserAutocompleteCmd()

ilLTIConsumerXapiStatementsGUI::asyncUserAutocompleteCmd ( )

Definition at line 170 of file class.ilLTIConsumerXapiStatementsGUI.php.

170 : void
171 {
172 $auto = new ilCmiXapiUserAutocomplete($this->object->getId());
173 $auto->setSearchFields(array('login','firstname','lastname','email'));
174 $auto->setResultField('login');
175 $auto->enableFieldSearchableCheck(true);
176 $auto->setMoreLinkAvailable(true);
177
178 //$auto->setLimit(ilUserAutoComplete::MAX_ENTRIES);
179 $term = '';
180 if ($this->dic->http()->wrapper()->query()->has('term')) {
181 $term = $this->dic->http()->wrapper()->query()->retrieve('term', $this->dic->refinery()->kindlyTo()->string());
182 } elseif ($this->dic->http()->wrapper()->post()->has('term')) {
183 $term = $this->dic->http()->wrapper()->post()->retrieve('term', $this->dic->refinery()->kindlyTo()->string());
184 }
185 if ($term != '') {
186 $result = json_decode($auto->getList(ilUtil::stripSlashes($term)), true);
187 echo json_encode($result);
188 }
189 exit();
190 }
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
exit

References exit, ILIAS\Repository\object(), and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ buildTableGUI()

ilLTIConsumerXapiStatementsGUI::buildTableGUI ( )
protected

Definition at line 221 of file class.ilLTIConsumerXapiStatementsGUI.php.

222 {
223 $isMultiActorReport = $this->access->hasOutcomesAccess();
224
225 $table = new ilCmiXapiStatementsTableGUI($this, 'show', $isMultiActorReport);
226 $table->setFilterCommand('applyFilter');
227 $table->setResetCommand('resetFilter');
228 return $table;
229 }

References ILIAS\Repository\access().

Referenced by applyFilterCmd(), resetFilterCmd(), and showCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilLTIConsumerXapiStatementsGUI::executeCommand ( )
Exceptions
ilCmiXapiException

Definition at line 57 of file class.ilLTIConsumerXapiStatementsGUI.php.

57 : void
58 {
59 global $DIC; /* @var \ILIAS\DI\Container $DIC */
60
61 if (!$this->access->hasStatementsAccess()) {
62 throw new ilCmiXapiException('access denied!');
63 }
64
65 switch ($DIC->ctrl()->getNextClass($this)) {
66 default:
67 $cmd = $DIC->ctrl()->getCmd('show') . 'Cmd';
68 $this->{$cmd}();
69 }
70 }

References $DIC, and ILIAS\Repository\access().

+ Here is the call graph for this function:

◆ initActorFilter()

ilLTIConsumerXapiStatementsGUI::initActorFilter ( ilCmiXapiStatementsReportFilter  $filter,
ilCmiXapiStatementsTableGUI  $table 
)
protected

Definition at line 125 of file class.ilLTIConsumerXapiStatementsGUI.php.

125 : void
126 {
127 global $DIC; /* @var \ILIAS\DI\Container $DIC */
128
129 if ($this->access->hasOutcomesAccess()) {
130 $actor = $table->getFilterItemByPostVar('actor')->getValue();
131
132 if (strlen($actor)) {
133 $usrId = ilObjUser::getUserIdByLogin($actor);
134
135 if ($usrId) {
136 $filter->setActor(new ilCmiXapiUser($this->object->getId(), $usrId, $this->object->getProvider()->getPrivacyIdent()));
137 } else {
139 "given actor ({$actor}) is not a valid actor for object ({$this->object->getId()})"
140 );
141 }
142 }
143 } else {
144 $filter->setActor(new ilCmiXapiUser($this->object->getId(), $DIC->user()->getId(), $this->object->getProvider()->getPrivacyIdent()));
145 }
146 }
static getUserIdByLogin(string $a_login)
getFilterItemByPostVar(string $a_post_var)

References $DIC, ILIAS\Repository\access(), ilTable2GUI\getFilterItemByPostVar(), ilObjUser\getUserIdByLogin(), ILIAS\Repository\object(), and ilCmiXapiStatementsReportFilter\setActor().

Referenced by showCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initLimitingAndOrdering()

ilLTIConsumerXapiStatementsGUI::initLimitingAndOrdering ( ilCmiXapiStatementsReportFilter  $filter,
ilCmiXapiStatementsTableGUI  $table 
)
protected

Definition at line 114 of file class.ilLTIConsumerXapiStatementsGUI.php.

114 : void
115 {
116 $table->determineOffsetAndOrder();
117
118 $filter->setLimit($table->getLimit());
119 $filter->setOffset($table->getOffset());
120
121 $filter->setOrderField($table->getOrderField());
122 $filter->setOrderDirection($table->getOrderDirection());
123 }
determineOffsetAndOrder(bool $a_omit_offset=false)

References ilTable2GUI\determineOffsetAndOrder(), ilTable2GUI\getLimit(), ilTable2GUI\getOffset(), ilTableGUI\getOrderDirection(), ilTable2GUI\getOrderField(), ilCmiXapiStatementsReportFilter\setLimit(), ilCmiXapiStatementsReportFilter\setOffset(), ilCmiXapiStatementsReportFilter\setOrderDirection(), and ilCmiXapiStatementsReportFilter\setOrderField().

Referenced by showCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initPeriodFilter()

ilLTIConsumerXapiStatementsGUI::initPeriodFilter ( ilCmiXapiStatementsReportFilter  $filter,
ilCmiXapiStatementsTableGUI  $table 
)
protected

Definition at line 157 of file class.ilLTIConsumerXapiStatementsGUI.php.

157 : void
158 {
159 $period = $table->getFilterItemByPostVar('period');
160
161 if ($period->getStartXapiDateTime()) {
162 $filter->setStartDate($period->getStartXapiDateTime());
163 }
164
165 if ($period->getEndXapiDateTime()) {
166 $filter->setEndDate($period->getEndXapiDateTime());
167 }
168 }

References ilTable2GUI\getFilterItemByPostVar(), ilCmiXapiStatementsReportFilter\setEndDate(), and ilCmiXapiStatementsReportFilter\setStartDate().

Referenced by showCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initTableData()

ilLTIConsumerXapiStatementsGUI::initTableData ( ilCmiXapiStatementsTableGUI  $table,
ilCmiXapiStatementsReportFilter  $filter 
)
protected

Definition at line 192 of file class.ilLTIConsumerXapiStatementsGUI.php.

192 : void
193 {
194 $aggregateEndPointUrl = str_replace(
195 'data/xAPI',
196 'api/statements/aggregate',
197 $this->object->getProvider()->getXapiLaunchUrl() // should be named endpoint not launch url
198 );
199
200 $linkBuilder = new ilCmiXapiStatementsReportLinkBuilder(
201 $this->object->getId(),
202 $aggregateEndPointUrl,
203 $filter
204 );
205
207 $this->object->getProvider()->getXapiLaunchKey(),
208 $this->object->getProvider()->getXapiLaunchSecret()
209 );
210
212 $basicAuth,
213 $linkBuilder
214 );
215
216 $statementsReport = $request->queryReport($this->object->getId());
217 $table->setData($statementsReport->getTableData());
218 $table->setMaxCount($statementsReport->getMaxCount());
219 }
static buildBasicAuth($lrsKey, $lrsSecret)
setData(array $a_data)
Set table data.
setMaxCount(int $a_max_count)
set max.

References ilCmiXapiLrsType\buildBasicAuth(), ILIAS\Repository\object(), ilTable2GUI\setData(), and ilTableGUI\setMaxCount().

Referenced by showCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initVerbFilter()

ilLTIConsumerXapiStatementsGUI::initVerbFilter ( ilCmiXapiStatementsReportFilter  $filter,
ilCmiXapiStatementsTableGUI  $table 
)
protected

Definition at line 148 of file class.ilLTIConsumerXapiStatementsGUI.php.

148 : void
149 {
150 $verb = urldecode($table->getFilterItemByPostVar('verb')->getValue());
151
152 if (ilCmiXapiVerbList::getInstance()->isValidVerb($verb)) {
153 $filter->setVerb($verb);
154 }
155 }

References ilTable2GUI\getFilterItemByPostVar(), ilCmiXapiVerbList\getInstance(), and ilCmiXapiStatementsReportFilter\setVerb().

Referenced by showCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetFilterCmd()

ilLTIConsumerXapiStatementsGUI::resetFilterCmd ( )
protected

Definition at line 72 of file class.ilLTIConsumerXapiStatementsGUI.php.

72 : void
73 {
74 $table = $this->buildTableGUI();
75 $table->resetFilter();
76 $table->resetOffset();
77 $this->showCmd();
78 }

References buildTableGUI(), and showCmd().

+ Here is the call graph for this function:

◆ showCmd()

ilLTIConsumerXapiStatementsGUI::showCmd ( )
protected

Definition at line 88 of file class.ilLTIConsumerXapiStatementsGUI.php.

88 : void
89 {
90 global $DIC; /* @var \ILIAS\DI\Container $DIC */
91
92 $table = $this->buildTableGUI();
93
94 try {
95 $statementsFilter = new ilCmiXapiStatementsReportFilter();
96
97 $statementsFilter->setActivityId($this->object->getActivityId());
98
99 $this->initLimitingAndOrdering($statementsFilter, $table);
100 $this->initActorFilter($statementsFilter, $table);
101 $this->initVerbFilter($statementsFilter, $table);
102 $this->initPeriodFilter($statementsFilter, $table);
103 $this->initTableData($table, $statementsFilter);
104 } catch (Exception $e) {
105 $this->main_tpl->setOnScreenMessage('failure', $e->getMessage());
106 $table->setData(array());
107 $table->setMaxCount(0);
108 $table->resetOffset();
109 }
110
111 $DIC->ui()->mainTemplate()->setContent($table->getHTML());
112 }
initLimitingAndOrdering(ilCmiXapiStatementsReportFilter $filter, ilCmiXapiStatementsTableGUI $table)
initTableData(ilCmiXapiStatementsTableGUI $table, ilCmiXapiStatementsReportFilter $filter)
initPeriodFilter(ilCmiXapiStatementsReportFilter $filter, ilCmiXapiStatementsTableGUI $table)
initVerbFilter(ilCmiXapiStatementsReportFilter $filter, ilCmiXapiStatementsTableGUI $table)
initActorFilter(ilCmiXapiStatementsReportFilter $filter, ilCmiXapiStatementsTableGUI $table)

References $DIC, Vendor\Package\$e, buildTableGUI(), initActorFilter(), initLimitingAndOrdering(), initPeriodFilter(), initTableData(), initVerbFilter(), and ILIAS\Repository\object().

Referenced by applyFilterCmd(), and resetFilterCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilLTIConsumerAccess ilLTIConsumerXapiStatementsGUI::$access
protected

Definition at line 40 of file class.ilLTIConsumerXapiStatementsGUI.php.

◆ $dic

ILIAS DI Container ilLTIConsumerXapiStatementsGUI::$dic
private

Definition at line 42 of file class.ilLTIConsumerXapiStatementsGUI.php.

◆ $main_tpl

ilGlobalTemplateInterface ilLTIConsumerXapiStatementsGUI::$main_tpl
private

Definition at line 41 of file class.ilLTIConsumerXapiStatementsGUI.php.

◆ $object

ilObjLTIConsumer ilLTIConsumerXapiStatementsGUI::$object
protected

Definition at line 35 of file class.ilLTIConsumerXapiStatementsGUI.php.

Referenced by __construct().


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