ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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

 $object
 
 $access
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilLTIConsumerXapiStatementsGUI::__construct ( ilObjLTIConsumer  $object)
Parameters
ilObjLTIConsumer$object

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

31 {
32 $this->object = $object;
33
34 $this->access = ilLTIConsumerAccess::getInstance($this->object);
35 }
static getInstance(ilObjLTIConsumer $object)

References $object, and ilLTIConsumerAccess\getInstance().

+ Here is the call graph for this function:

Member Function Documentation

◆ applyFilterCmd()

ilLTIConsumerXapiStatementsGUI::applyFilterCmd ( )
protected

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

64 {
65 $table = $this->buildTableGUI();
66 $table->writeFilterToSession();
67 $table->resetOffset();
68 $this->showCmd();
69 }

References buildTableGUI(), and showCmd().

+ Here is the call graph for this function:

◆ asyncUserAutocompleteCmd()

ilLTIConsumerXapiStatementsGUI::asyncUserAutocompleteCmd ( )

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

154 {
155 $auto = new ilCmiXapiUserAutocomplete($this->object->getId());
156 $auto->setSearchFields(array('login','firstname','lastname','email'));
157 $auto->setResultField('login');
158 $auto->enableFieldSearchableCheck(true);
159 $auto->setMoreLinkAvailable(true);
160
161 //$auto->setLimit(ilUserAutoComplete::MAX_ENTRIES);
162
163 $result = json_decode($auto->getList(ilUtil::stripSlashes($_REQUEST['term'])), true);
164
165 echo json_encode($result);
166 exit();
167 }
$result
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
exit
Definition: login.php:29

References $result, exit, and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ buildTableGUI()

ilLTIConsumerXapiStatementsGUI::buildTableGUI ( )
protected
Returns
ilCmiXapiStatementsTableGUI

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

206 {
207 $isMultiActorReport = $this->access->hasOutcomesAccess();
208
209 $table = new ilCmiXapiStatementsTableGUI($this, 'show', $isMultiActorReport);
210 $table->setFilterCommand('applyFilter');
211 $table->setResetCommand('resetFilter');
212 return $table;
213 }

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

+ Here is the caller graph for this function:

◆ executeCommand()

ilLTIConsumerXapiStatementsGUI::executeCommand ( )
Exceptions
ilCmiXapiException

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

41 {
42 global $DIC; /* @var \ILIAS\DI\Container $DIC */
43
44 if (!$this->access->hasStatementsAccess()) {
45 throw new ilCmiXapiException('access denied!');
46 }
47
48 switch ($DIC->ctrl()->getNextClass($this)) {
49 default:
50 $cmd = $DIC->ctrl()->getCmd('show') . 'Cmd';
51 $this->{$cmd}();
52 }
53 }
$DIC
Definition: xapitoken.php:46

References $DIC.

◆ initActorFilter()

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

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

109 {
110 global $DIC; /* @var \ILIAS\DI\Container $DIC */
111
112 if ($this->access->hasOutcomesAccess()) {
113 $actor = $table->getFilterItemByPostVar('actor')->getValue();
114
115 if (strlen($actor)) {
116 $usrId = ilObjUser::getUserIdByLogin($actor);
117
118 if ($usrId) {
119 $filter->setActor(new ilCmiXapiUser($this->object->getId(), $usrId, $this->object->getProvider()->getPrivacyIdent()));
120 } else {
122 "given actor ({$actor}) is not a valid actor for object ({$this->object->getId()})"
123 );
124 }
125 }
126 } else {
127 $filter->setActor(new ilCmiXapiUser($this->object->getId(), $DIC->user()->getId(), $this->object->getProvider()->getPrivacyIdent()));
128 }
129 }
static getUserIdByLogin($a_login)
getFilterItemByPostVar($a_post_var)

References $DIC, ilTable2GUI\getFilterItemByPostVar(), ilObjUser\getUserIdByLogin(), 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 97 of file class.ilLTIConsumerXapiStatementsGUI.php.

98 {
100
101 $filter->setLimit($table->getLimit());
102 $filter->setOffset($table->getOffset());
103
104 $filter->setOrderField($table->getOrderField());
105 $filter->setOrderDirection($table->getOrderDirection());
106 }
determineOffsetAndOrder($a_omit_offset=false)
Determine offset and order.
getLimit()
Get limit.
getOffset()
Get offset.
getOrderDirection()
Get order direction.

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 140 of file class.ilLTIConsumerXapiStatementsGUI.php.

141 {
142 $period = $table->getFilterItemByPostVar('period');
143
144 if ($period->getStartXapiDateTime()) {
145 $filter->setStartDate($period->getStartXapiDateTime());
146 }
147
148 if ($period->getEndXapiDateTime()) {
149 $filter->setEndDate($period->getEndXapiDateTime());
150 }
151 }

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
Parameters
ilCmiXapiStatementsTableGUI$table
ilCmiXapiStatementsReportFilter$filter

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

174 {
175 $aggregateEndPointUrl = str_replace(
176 'data/xAPI',
177 'api/statements/aggregate',
178 $this->object->getProvider()->getXapiLaunchUrl() // should be named endpoint not launch url
179 );
180
181 $linkBuilder = new ilCmiXapiStatementsReportLinkBuilder(
182 $this->object,
183 $aggregateEndPointUrl,
184 $filter
185 );
186
188 $this->object->getProvider()->getXapiLaunchKey(),
189 $this->object->getProvider()->getXapiLaunchSecret()
190 );
191
193 $basicAuth,
194 $linkBuilder
195 );
196
197 $statementsReport = $request->queryReport($this->object);
198 $table->setData($statementsReport->getTableData());
199 $table->setMaxCount($statementsReport->getMaxCount());
200 }
static buildBasicAuth($lrsKey, $lrsSecret)
setData($a_data)
set table data @access public
setMaxCount($a_max_count)
set max.

References ilCmiXapiLrsType\buildBasicAuth(), 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 131 of file class.ilLTIConsumerXapiStatementsGUI.php.

132 {
133 $verb = urldecode($table->getFilterItemByPostVar('verb')->getValue());
134
135 if (ilCmiXapiVerbList::getInstance()->isValidVerb($verb)) {
136 $filter->setVerb($verb);
137 }
138 }

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 55 of file class.ilLTIConsumerXapiStatementsGUI.php.

56 {
57 $table = $this->buildTableGUI();
58 $table->resetFilter();
59 $table->resetOffset();
60 $this->showCmd();
61 }

References buildTableGUI(), and showCmd().

+ Here is the call graph for this function:

◆ showCmd()

ilLTIConsumerXapiStatementsGUI::showCmd ( )
protected

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

72 {
73 global $DIC; /* @var \ILIAS\DI\Container $DIC */
74
75 $table = $this->buildTableGUI();
76
77 try {
78 $statementsFilter = new ilCmiXapiStatementsReportFilter();
79
80 $statementsFilter->setActivityId($this->object->getActivityId());
81
82 $this->initLimitingAndOrdering($statementsFilter, $table);
83 $this->initActorFilter($statementsFilter, $table);
84 $this->initVerbFilter($statementsFilter, $table);
85 $this->initPeriodFilter($statementsFilter, $table);
86 $this->initTableData($table, $statementsFilter);
87 } catch (Exception $e) {
88 ilUtil::sendFailure($e->getMessage());
89 $table->setData(array());
90 $table->setMaxCount(0);
91 $table->resetOffset();
92 }
93
94 $DIC->ui()->mainTemplate()->setContent($table->getHTML());
95 }
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)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

References $DIC, Vendor\Package\$e, buildTableGUI(), initActorFilter(), initLimitingAndOrdering(), initPeriodFilter(), initTableData(), initVerbFilter(), and ilUtil\sendFailure().

Referenced by applyFilterCmd(), and resetFilterCmd().

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

Field Documentation

◆ $access

ilLTIConsumerXapiStatementsGUI::$access
protected

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

◆ $object

ilLTIConsumerXapiStatementsGUI::$object
protected

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

Referenced by __construct().


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