19declare(strict_types=1);
35 private \ILIAS\DI\Container
$dic;
41 $this->main_tpl =
$DIC->ui()->mainTemplate();
54 if (!$this->
access->hasStatementsAccess()) {
58 switch (
$DIC->ctrl()->getNextClass($this)) {
60 $cmd =
$DIC->ctrl()->getCmd(
'show') .
'Cmd';
68 $table->resetFilter();
69 $table->resetOffset();
76 $table->writeFilterToSession();
77 $table->resetOffset();
87 $statementsFilter->setActivityId($this->
object->getActivityId());
94 }
catch (Exception
$e) {
95 $this->main_tpl->setOnScreenMessage(
'failure',
$e->getMessage());
96 $table->setData(array());
97 $table->setMaxCount(0);
98 $table->resetOffset();
101 $this->dic->ui()->mainTemplate()->setContent($table->getHTML());
119 if ($this->
access->hasOutcomesAccess()) {
121 if ($actor && strlen($actor)) {
127 "given actor ({$actor}) is not a valid actor for object ({$this->object->getId()})"
132 $filter->setActor(
new ilCmiXapiUser($this->
object->getId(), $this->dic->user()->getId(), $this->object->getPrivacyIdent()));
140 if ($table->getFilterItemByPostVar(
'verb') != null) {
153 if ($table->getFilterItemByPostVar(
'period') != null) {
156 if ($period->getStartXapiDateTime()) {
160 if ($period->getEndXapiDateTime()) {
161 $filter->
setEndDate($period->getEndXapiDateTime());
169 $auto->setSearchFields(array(
'login',
'firstname',
'lastname',
'email'));
170 $auto->setResultField(
'login');
171 $auto->enableFieldSearchableCheck(
true);
172 $auto->setMoreLinkAvailable(
true);
176 if ($this->dic->http()->wrapper()->query()->has(
'term')) {
177 $term = $this->dic->http()->wrapper()->query()->retrieve(
'term', $this->dic->refinery()->kindlyTo()->string());
178 } elseif ($this->dic->http()->wrapper()->post()->has(
'term')) {
179 $term = $this->dic->http()->wrapper()->post()->retrieve(
'term', $this->dic->refinery()->kindlyTo()->string());
183 echo json_encode($result);
193 if ($this->
access->hasOutcomesAccess()) {
201 $usrId =
$DIC->user()->getId();
212 $this->object->getLrsType()->getLrsEndpointStatementsAggregationLink(),
217 $this->
object->getLrsType()->getBasicAuth(),
220 $statementsReport = $request->queryReport($this->
object->getId());
221 $data = $statementsReport->getTableData();
223 $table->
setMaxCount($statementsReport->getMaxCount());
228 $isMultiActorReport = $this->
access->hasOutcomesAccess();
238 $lrsType = $this->
object->getLrsType();
241 $defaultLrs = $lrsType->getLrsEndpointStatementsAggregationLink();
243 $defaultBasicAuth = $lrsType->getBasicAuth();
246 'X-Experience-API-Version' =>
'1.0.3',
247 'Authorization' => $defaultBasicAuth,
248 'Cache-Control' =>
'no-cache, no-store, must-revalidate'
256 $pipeline = json_encode($this->getVerbsPipline());
258 $defaultVerbsUrl = $defaultLrs .
"?pipeline=" . urlencode($pipeline);
260 $client =
new GuzzleHttp\Client();
262 GuzzleHttp\RequestOptions::VERIFY =>
true,
263 GuzzleHttp\RequestOptions::CONNECT_TIMEOUT => 10,
264 GuzzleHttp\RequestOptions::HTTP_ERRORS =>
false
267 $defaultVerbsRequest =
new GuzzleHttp\Psr7\Request(
273 $promises[
'defaultVerbs'] =
$client->sendAsync($defaultVerbsRequest, $req_opts);
275 $responses = GuzzleHttp\Promise\Utils::settle($promises)->wait();
278 return json_decode($body, (
bool) JSON_OBJECT_AS_ARRAY);
279 }
catch (Exception
$e) {
292 $match[
'statement.object.objectType'] =
'Activity';
293 $match[
'statement.actor.objectType'] =
'Agent';
295 $activityId = array();
299 $activityId[
'statement.context.extensions.https://ilias&46;de/cmi5/activityid'] = $this->
object->getActivityId();
302 '$regex' =>
'^' . preg_quote($this->
object->getActivityId()) .
''
304 $activityId[
'$or'] = [];
305 $activityId[
'$or'][] = [
'statement.object.id' => $activityQuery];
306 $activityId[
'$or'][] = [
'statement.context.contextActivities.parent.id' => $activityQuery];
309 $match[
'$and'][] = $activityId;
312 $sort[
'statement.verb.id'] = 1;
315 $group = array(
'_id' =>
'$statement.verb.id');
319 $pipeline[] = array(
'$match' => $match);
320 $pipeline[] = array(
'$group' => $group);
321 $pipeline[] = array(
'$sort' => $sort);
static checkResponse(array $response, &$body, array $allowedStatus=[200, 204])
static getInstance(ilObjCmiXapi $object)
initActorFilter(ilCmiXapiStatementsReportFilter $filter, ilCmiXapiStatementsTableGUI $table)
ilGlobalTemplateInterface $main_tpl
initVerbFilter(ilCmiXapiStatementsReportFilter $filter, ilCmiXapiStatementsTableGUI $table)
initTableData(ilCmiXapiStatementsTableGUI $table, ilCmiXapiStatementsReportFilter $filter)
asyncUserAutocompleteCmd()
__construct(ilObjCmiXapi $object)
initLimitingAndOrdering(ilCmiXapiStatementsReportFilter $filter, ilCmiXapiStatementsTableGUI $table)
initPeriodFilter(ilCmiXapiStatementsReportFilter $filter, ilCmiXapiStatementsTableGUI $table)
setStartDate(\ilCmiXapiDateTime $startDate)
setOrderDirection(string $orderDirection)
setEndDate(\ilCmiXapiDateTime $endDate)
setActor(\ilCmiXapiUser $actor)
setOrderField(string $orderField)
static getUsersForObject(int $objId, bool $asUsrId=false)
static getUserIdByLogin(string $a_login)
setFilterCommand(string $a_val, string $a_caption="")
getFilterItemByPostVar(string $a_post_var)
determineOffsetAndOrder(bool $a_omit_offset=false)
resetOffset(bool $a_in_determination=false)
setResetCommand(string $a_val, string $a_caption="")
setData(array $a_data)
Set table data.
setMaxCount(int $a_max_count)
set max.
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
if(!file_exists('../ilias.ini.php'))