ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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.

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

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:22
+ Here is the call graph for this function:

Member Function Documentation

◆ applyFilterCmd()

ilLTIConsumerXapiStatementsGUI::applyFilterCmd ( )
protected

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

References buildTableGUI(), and showCmd().

80  : void
81  {
82  $table = $this->buildTableGUI();
83  $table->writeFilterToSession();
84  $table->resetOffset();
85  $this->showCmd();
86  }
+ Here is the call graph for this function:

◆ asyncUserAutocompleteCmd()

ilLTIConsumerXapiStatementsGUI::asyncUserAutocompleteCmd ( )

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

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

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="")
setSearchFields(array $a_fields)
Set searchable fields.
exit
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ buildTableGUI()

ilLTIConsumerXapiStatementsGUI::buildTableGUI ( )
protected

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

References ILIAS\Repository\access().

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

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  }
+ 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.

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

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  }
global $DIC
Definition: shib_login.php:22
+ 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.

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

Referenced by showCmd().

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  }
getFilterItemByPostVar(string $a_post_var)
static getUserIdByLogin(string $a_login)
global $DIC
Definition: shib_login.php:22
+ 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.

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

Referenced by showCmd().

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)
+ 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.

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

Referenced by showCmd().

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  }
getFilterItemByPostVar(string $a_post_var)
+ 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.

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

Referenced by showCmd().

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 
211  $request = new ilCmiXapiStatementsReportRequest(
212  $basicAuth,
213  $linkBuilder
214  );
215 
216  $statementsReport = $request->queryReport($this->object->getId());
217  $table->setData($statementsReport->getTableData());
218  $table->setMaxCount($statementsReport->getMaxCount());
219  }
setData(array $a_data)
static buildBasicAuth($lrsKey, $lrsSecret)
setMaxCount(int $a_max_count)
set max.
+ 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.

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

Referenced by showCmd().

148  : void
149  {
150  $verb = urldecode($table->getFilterItemByPostVar('verb')->getValue());
151 
152  if (ilCmiXapiVerbList::getInstance()->isValidVerb($verb)) {
153  $filter->setVerb($verb);
154  }
155  }
getFilterItemByPostVar(string $a_post_var)
+ 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.

References buildTableGUI(), and showCmd().

72  : void
73  {
74  $table = $this->buildTableGUI();
75  $table->resetFilter();
76  $table->resetOffset();
77  $this->showCmd();
78  }
+ Here is the call graph for this function:

◆ showCmd()

ilLTIConsumerXapiStatementsGUI::showCmd ( )
protected

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

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

Referenced by applyFilterCmd(), and resetFilterCmd().

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  }
initTableData(ilCmiXapiStatementsTableGUI $table, ilCmiXapiStatementsReportFilter $filter)
initLimitingAndOrdering(ilCmiXapiStatementsReportFilter $filter, ilCmiXapiStatementsTableGUI $table)
initActorFilter(ilCmiXapiStatementsReportFilter $filter, ilCmiXapiStatementsTableGUI $table)
initPeriodFilter(ilCmiXapiStatementsReportFilter $filter, ilCmiXapiStatementsTableGUI $table)
global $DIC
Definition: shib_login.php:22
initVerbFilter(ilCmiXapiStatementsReportFilter $filter, ilCmiXapiStatementsTableGUI $table)
+ 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: