/** * Get news aggregation for child objects (e.g. for categories) */ function getAggregatedChildNewsData($a_ref_id, $a_only_public = false, $a_time_period = 0, $a_prevent_aggregation = false, $a_starting_date = "", $a_no_auto_generated = false) { global $tree, $ilAccess; // get news of parent object $data = $this->getNewsForRefId($a_ref_id, $a_only_public, true, $a_time_period, true, false, false, $a_no_auto_generated); foreach ($data as $k => $v) { $data[$k]["ref_id"] = $a_ref_id; } // get childs $nodes = $tree->getChilds($a_ref_id); // no check, for which of the objects any news are available $obj_ids = array(); foreach ($nodes as $node) { $obj_ids[] = $node["obj_id"]; } $news_obj_ids = ilNewsItem::filterObjIdsPerNews($obj_ids, $a_time_period, $a_starting_date); //$news_obj_ids = $obj_ids; // get news for all subtree nodes $contexts = array(); foreach ($nodes as $node) { // only go on, if news are available if (!in_array($node["obj_id"], $news_obj_ids)) { continue; } if (!$a_only_public && !$ilAccess->checkAccess("read", "", $node["child"])) { continue; } $ref_id[$node["obj_id"]] = $node["child"]; $contexts[] = array("obj_id" => $node["obj_id"], "obj_type" => $node["type"]); } $news = $this->queryNewsForMultipleContexts($contexts, $a_only_public, $a_time_period, $a_starting_date, $a_no_auto_generated); foreach ($news as $k => $v) { $news[$k]["ref_id"] = $ref_id[$v["context_obj_id"]]; } $data = ilNewsItem::mergeNews($data, $news); // sort and return $data = ilUtil::sortArray($data, "creation_date", "desc", false, true); if (!$a_prevent_aggregation) { $data = $this->aggregateFiles($data, $a_ref_id); } return $data; }