60        $this->access = 
$DIC->access();
 
   73        $ilAccess = $this->access;
 
   75        include_once 
"Services/Membership/classes/class.ilMembershipNotifications.php";
 
   80        if (
sizeof($this->objects)) {
 
   81            $this->log->debug(
"nr of objects: " . count($this->objects));
 
   84            $this->user_news_aggr = array();
 
   86            include_once 
"Services/News/classes/class.ilNewsItem.php";
 
   87            foreach ($this->objects as $ref_id => $user_ids) {
 
   88                $this->log->debug(
"handle ref id " . $ref_id . 
", users: " . count($user_ids));
 
   93                if ($news_item->checkNewsExistsForObjects($objs[
"obj_id"], $this->last_run)) {
 
   94                    $this->log->debug(
"Got news");
 
   95                    foreach ($user_ids as $user_id) {
 
   97                        $user_news = $news_item->getNewsForRefId(
 
  109                            $this->user_news_aggr[$user_id][$ref_id] = $user_news;
 
  112                            foreach ($this->user_news_aggr as $agg_news) {
 
  113                                if (isset($agg_news[
"aggregation"]) && is_array($agg_news[
"aggregation"]) && $agg_news[
"aggregation"] !== []) {
 
  114                                    foreach ($agg_news[
"aggregation"] as 
$n) {
 
  115                                        $this->news[
$n[
"id"]] = 
$n;
 
  116                                        $this->news_per_user[$user_id][$ref_id][
$n[
"id"]] = 
$n[
"id"];
 
  119                                    if (is_array($agg_news)) {
 
  120                                        if (isset($agg_news[
"id"])) {
 
  121                                            $this->news[$agg_news[
"id"]] = $agg_news;
 
  122                                            $this->news_per_user[$user_id][$ref_id][$agg_news[
"id"]] = $agg_news[
"id"];
 
  124                                            foreach ($agg_news as $agg_news_items) {
 
  125                                                foreach ($agg_news_items as $agg_news_item) {
 
  126                                                    if (isset($agg_news_item[
"id"])) {
 
  127                                                        $this->news[$agg_news_item[
"id"]] = $agg_news_item;
 
  128                                                        $this->news_per_user[$user_id][$ref_id][$agg_news_item[
"id"]] = $agg_news_item[
"id"];
 
  141                    $this->log->debug(
"Got no news");
 
  146                $ref_for_obj_id = array();
 
  147                foreach ($objs[
"ref_id"] as 
$i) {
 
  148                    $ref_for_obj_id[
$i[
"obj_id"]][
$i[
"ref_id"]] = 
$i[
"ref_id"];
 
  150                include_once(
"./Services/Like/classes/class.ilLikeData.php");
 
  151                $like_data = 
new ilLikeData(array_keys($objs[
"obj_id"]));
 
  152                foreach (array_keys($objs[
"obj_id"]) as $obj_id) {
 
  153                    $this->log->debug(
"Get like data for obj_id: " . $obj_id);
 
  154                    foreach ($like_data->getExpressionEntriesForObject($obj_id, $this->last_run) as $like) {
 
  156                        foreach ($user_ids as $user_id) {
 
  158                            foreach ($ref_for_obj_id[$obj_id] as $perm_ref_id) {
 
  159                                if ($ilAccess->checkAccessOfUser($user_id, 
"read", 
"", $perm_ref_id)) {
 
  165                                $this->likes[$user_id][$like[
"news_id"]][] = $like;
 
  176                foreach (array_keys($objs[
"obj_id"]) as $obj_id) {
 
  184                    foreach ($coms as 
$c) {
 
  185                        if (
$c->getNewsId() == 0) {
 
  189                        foreach ($user_ids as $user_id) {
 
  191                            foreach ($ref_for_obj_id[$obj_id] as $perm_ref_id) {
 
  192                                if ($ilAccess->checkAccessOfUser($user_id, 
"read", 
"", $perm_ref_id)) {
 
  198                                $this->comments[$user_id][
$c->getNewsId()][] = 
$c;
 
  221        $this->log->debug(
"Check missing news: " . $user_id . 
"-" . $ref_id . 
"-" . $news_id);
 
  222        if (!is_array($this->news_per_user[$user_id][$ref_id]) ||
 
  223            !in_array($news_id, $this->news_per_user[$user_id][$ref_id])) {
 
  224            $this->log->debug(
"Add missing news: " . $news_id);
 
  225            $this->missing_news[$news_id] = $news_id;
 
  226            $this->missing_news_per_user[$user_id][$ref_id][$news_id] = $news_id;
 
  235        include_once(
"./Services/News/classes/class.ilNewsItem.php");
 
  237            $this->log->debug(
"Got missing news: " . 
$news[
"id"]);
 
  240        foreach ($this->missing_news_per_user as $user_id => 
$r) {
 
  241            foreach (
$r as $ref_id => 
$n) {
 
  242                foreach (
$n as $news_id) {
 
  243                    $this->log->debug(
"Load missing news: " . $user_id . 
"-" . $ref_id . 
"-" . $news_id);
 
  244                    $this->user_news_aggr[$user_id][$ref_id][$news_id] = $this->news[$news_id];
 
  245                    $this->news_per_user[$user_id][$ref_id][$news_id] = $news_id;
 
  266        if (!
$tree->isDeleted($a_ref_id)) {
 
  269            $node = 
$tree->getNodeData($a_ref_id);
 
  270            foreach (
$tree->getSubTree($node) as $child) {
 
  271                if ($child[
"type"] != 
"rolf") {
 
  272                    $nodes[
"obj_id"][$child[
"obj_id"]] = array(
 
  273                        "obj_id" => $child[
"obj_id"],
 
  274                        "type" => $child[
"type"]);
 
  275                    $nodes[
"ref_id"][$child[
"child"]] = array(
 
  276                        "ref_id" => $child[
"child"],
 
  277                        "obj_id" => $child[
"obj_id"],
 
  278                        "type" => $child[
"type"]);
 
  314        if (is_array($this->likes[$user_id][$news_id])) {
 
  315            return $this->likes[$user_id][$news_id];
 
  329        if (is_array($this->comments[$user_id][$news_id])) {
 
  330            return $this->comments[$user_id][$news_id];
 
An exception for terminatinating execution or to throw for unit testing.
static ping($a_job_id)
Keep cron job alive.
Data class for like feature.
static getLogger($a_component_id)
Get component logger.
Manage data for ilMembershipCronNotifications cron job.
getAggregatedNews()
Get aggregated news.
loadMissingNews()
Load missing news (news for new likes and/or comments)
getComments($news_id, $user_id)
Get comments for a news and user.
getLikes($news_id, $user_id)
Get likes for a news and user.
getObjectsForRefId($a_ref_id)
Get subtree object IDs for ref id.
checkMissingNews($user_id, $ref_id, $news_id)
Get missing news.
__construct($last_run, $cron_id)
static getActiveUsersforAllObjects()
Get active notifications for all objects.
static queryNewsByIds(array $a_news_ids)
Query news data by news ids.
static _getAllNotesOfSingleRepObject( $a_rep_obj_id, $a_type=IL_NOTE_PRIVATE, $a_incl_sub=false, $a_sort_ascending=false, $a_since="")
get all notes related to a single repository object