28 $pipeline[] = array(
'$facet' => array(
30 array(
'$group' => array(
'_id' => null,
'count' => array(
'$sum' => 1) ))
35 $pipeline[] = array(
'$unwind' =>
'$stage1');
37 $pipeline[] = array(
'$project' => array(
38 'maxcount' =>
'$stage1.count',
39 'statements' =>
'$stage2.statement' 51 array(
'$skip' => (
int) $this->filter->getOffset())
54 if ($this->filter->getLimit()) {
55 $stage[] = array(
'$limit' => (
int) $this->filter->getLimit());
62 $cmi5_extensions_query =
false;
65 $stage[
'statement.object.objectType'] =
'Activity';
66 $stage[
'statement.actor.objectType'] =
'Agent';
67 if ($this->filter->getVerb()) {
68 $stage[
'statement.verb.id'] = $this->filter->getVerb();
71 if ($this->filter->getStartDate() || $this->filter->getEndDate()) {
72 $stage[
'statement.timestamp'] = array();
74 if ($this->filter->getStartDate()) {
75 $stage[
'statement.timestamp'][
'$gt'] = $this->filter->getStartDate()->toXapiTimestamp();
78 if ($this->filter->getEndDate()) {
79 $stage[
'statement.timestamp'][
'$lt'] = $this->filter->getEndDate()->toXapiTimestamp();
84 $activityId = array();
89 $activityId[
'statement.context.extensions.https://ilias&46;de/cmi5/activityid'] =
$obj->getActivityId();
95 '$regex' =>
'^' . preg_quote($this->filter->getActivityId()) .
'' 97 $activityId[
'$or'] = [];
102 $activityId[
'$or'][] = [
'statement.object.id' => $activityQuery];
103 $activityId[
'$or'][] = [
'statement.context.contextActivities.parent.id' => $activityQuery];
104 $activityId[
'$or'][] = [
'statement.context.contextActivities.grouping.id' => $activityQuery];
112 if ($this->filter->getActor())
117 $actor[
'$or'][] = [
'statement.actor.mbox' =>
"mailto:{$usrIdent}"];
118 $actor[
'$or'][] = [
'statement.actor.account.name' =>
"{$usrIdent}"];
121 if (count($actor) == 0)
123 $actor[
'$or'][] = [
'statement.actor.mbox' =>
"mailto:{$this->filter->getActor()->getUsrIdent()}"];
124 $actor[
'$or'][] = [
'statement.actor.account.name' =>
"{$this->filter->getActor()->getUsrIdent()}"];
131 $actor[
'$or'][] = [
'statement.actor.mbox' =>
"mailto:{$cmixUser->getUsrIdent()}"];
132 $actor[
'$or'][] = [
'statement.actor.account.name' =>
"{$cmixUser->getUsrIdent()}"];
138 if ($this->filter->getActor())
140 $cmixUser = $this->filter->getActor();
141 $actor[
'statement.context.registration'] = $cmixUser->getRegistration();
146 if ($this->filter->getActor())
150 $actor[
'$or'][] = [
'statement.actor.mbox' =>
"mailto:{$usrIdent}"];
153 if (count($actor) == 0)
155 $actor[
'statement.actor.mbox'] = $this->filter->getActor()->getUsrIdent();
167 $actor[
'$or'][] = [
'statement.actor.mbox' =>
"mailto:{$cmixUser->getUsrIdent()}"];
172 $stage[
'$and'][] = $activityId;
173 if (count($actor) > 0) {
174 $stage[
'$and'][] = $actor;
176 return array(
'$match' => $stage);
185 $actor =
'statement.actor.name';
189 $actor =
'statement.actor.name';
192 if (
$obj->getPublisherId() ==
'')
194 $actor =
'statement.actor.mbox';
196 $actor =
'statement.actor.account.name';
200 $actor =
'statement.actor.mbox';
204 switch ($this->filter->getOrderField()) {
206 $field =
'statement.object.id';
210 $field =
'statement.verb.id';
219 $field =
'statement.timestamp';
223 $orderingFields = array(
224 $field => $this->filter->getOrderDirection() ==
'desc' ? -1 : 1
227 return array(
'$sort' => $orderingFields);
static getUsersForObject($objId, $asUsrId=false)
static getUserIdents($objId, $usrId)
static getLogger($a_component_id)
Get component logger.