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();
88 $activityId[
'statement.context.extensions.https://ilias&46;de/cmi5/activityid'] =
$obj->getActivityId();
92 '$regex' =>
'^' . preg_quote($this->
filter->getActivityId()) .
'' 94 $activityId[
'$or'] = [];
99 $activityId[
'$or'][] = [
'statement.object.id' => $activityQuery];
100 $activityId[
'$or'][] = [
'statement.context.contextActivities.parent.id' => $activityQuery];
101 $activityId[
'$or'][] = [
'statement.context.contextActivities.grouping.id' => $activityQuery];
108 if ($this->
filter->getActor()) {
111 $actor[
'$or'][] = [
'statement.actor.mbox' =>
"mailto:{$usrIdent}"];
112 $actor[
'$or'][] = [
'statement.actor.account.name' =>
"{$usrIdent}"];
115 if (count($actor) == 0) {
116 $actor[
'$or'][] = [
'statement.actor.mbox' =>
"mailto:{$this->filter->getActor()->getUsrIdent()}"];
117 $actor[
'$or'][] = [
'statement.actor.account.name' =>
"{$this->filter->getActor()->getUsrIdent()}"];
122 $actor[
'$or'][] = [
'statement.actor.mbox' =>
"mailto:{$cmixUser->getUsrIdent()}"];
123 $actor[
'$or'][] = [
'statement.actor.account.name' =>
"{$cmixUser->getUsrIdent()}"];
127 if ($this->
filter->getActor()) {
128 $cmixUser = $this->
filter->getActor();
129 $actor[
'statement.context.registration'] = $cmixUser->getRegistration();
132 if ($this->
filter->getActor()) {
134 $actor[
'$or'][] = [
'statement.actor.mbox' =>
"mailto:{$usrIdent}"];
137 if (count($actor) == 0) {
138 $actor[
'statement.actor.mbox'] = $this->
filter->getActor()->getUsrIdent();
149 $actor[
'$or'][] = [
'statement.actor.mbox' =>
"mailto:{$cmixUser->getUsrIdent()}"];
154 $stage[
'$and'][] = $activityId;
155 if (count($actor) > 0) {
156 $stage[
'$and'][] = $actor;
158 return array(
'$match' => $stage);
167 $actor =
'statement.actor.name';
171 $actor =
'statement.actor.name';
174 if (
$obj->getPublisherId() ==
'') {
175 $actor =
'statement.actor.mbox';
177 $actor =
'statement.actor.account.name';
180 $actor =
'statement.actor.mbox';
184 switch ($this->
filter->getOrderField()) {
186 $field =
'statement.object.id';
190 $field =
'statement.verb.id';
199 $field =
'statement.timestamp';
203 $orderingFields = array(
204 $field => $this->
filter->getOrderDirection() ==
'desc' ? -1 : 1
207 return array(
'$sort' => $orderingFields);
static getUsersForObject($objId, $asUsrId=false)
static getUserIdents($objId, $usrId)
static getLogger($a_component_id)
Get component logger.