4define(
"NEWS_NOTICE", 0);
 
    5define(
"NEWS_MESSAGE", 1);
 
    6define(
"NEWS_WARNING", 2);
 
    8include_once(
"./Services/News/classes/class.ilNewsItemGen.php");
 
   35                parent::__construct($a_id);
 
   36                $this->limitation = 
true;
 
   47                $this->limitation = $a_limitation;
 
   67                $this->content_text_is_lang_var = $a_val;
 
   77                return $this->content_text_is_lang_var;
 
   87                $this->mob_cnt_play = $a_val;
 
   97                return $this->mob_cnt_play;
 
  107                $this->mob_cnt_download = $a_val;
 
  117                return $this->mob_cnt_download;
 
  127                $query = 
"SELECT * FROM il_news_item WHERE id = ".
 
  130                $rec = 
$ilDB->fetchAssoc($set);
 
  162                $this->
setId($ilDB->nextId(
"il_news_item"));
 
  163                $ilDB->insert(
"il_news_item", array(
 
  164                        "id" => array(
"integer", $this->
getId()),
 
  165                        "title" => array(
"text", $this->
getTitle()),
 
  166                        "content" => array(
"clob", $this->
getContent()),
 
  172                        "creation_date" => array(
"timestamp", 
ilUtil::now()),
 
  173                        "update_date" => array(
"timestamp", 
ilUtil::now()),
 
  174                        "user_id" => array(
"integer", $this->
getUserId()),
 
  177                        "priority" => array(
"integer", $this->
getPriority()),
 
  180                        "mob_id" => array(
"integer", $this->
getMobId()),
 
  186                $max_items = $news_set->get(
"max_items");
 
  196                        $query = 
"SELECT count(*) cnt ".
 
  197                                "FROM il_news_item ".
 
  205                        $rec = 
$ilDB->fetchAssoc($set);
 
  211                                        "FROM il_news_item ".
 
  217                        " ORDER BY creation_date ASC";
 
  219                                $ilDB->setLimit($rec[
"cnt"] - $max_items);
 
  221                                while ($del_item = 
$ilDB->fetchAssoc($del_set))
 
  235        public function update($a_as_new = 
false)
 
  240                        "title" => array(
"text", $this->
getTitle()),
 
  241                        "content" => array(
"clob", $this->
getContent()),
 
  247                        "user_id" => array(
"integer", $this->
getUserId()),
 
  250                        "priority" => array(
"integer", $this->
getPriority()),
 
  253                        "mob_id" => array(
"integer", $this->
getMobId()),
 
  262                        $fields[
"creation_date"] = array(
"timestamp", $now);
 
  263                        $fields[
"update_date"] = array(
"timestamp", $now);
 
  267                        $fields[
"update_date"] = array(
"timestamp", $now);
 
  270                $ilDB->update(
"il_news_item", $fields, array(
 
  271                        "id" => array(
"integer", $this->
getId())
 
  281                $a_prevent_aggregation = 
false, $a_per = 0, &$a_cnt = NULL)
 
  290                include_once(
"./Services/News/classes/class.ilNewsSubscription.php");
 
  291                include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
 
  300                        foreach($pd_items as $item)
 
  302                                if (!in_array($item[
"ref_id"], $ref_ids))
 
  304                                        $ref_ids[] = $item[
"ref_id"];
 
  309                        include_once 
'Services/Membership/classes/class.ilParticipants.php';
 
  312                        $items = array_merge($crs_mbs, $grp_mbs);
 
  313                        foreach($items as $i)
 
  316                                if(is_array($item_references) && count($item_references))
 
  318                                        foreach($item_references as 
$ref_id)
 
  320                                                if (!in_array(
$ref_id, $ref_ids))
 
  336                                $acc = $ilAccess->checkAccessOfUser($a_user_id, 
"read", 
"", 
$ref_id);
 
  355                        $news = $news_item->getNewsForRefId(
$ref_id, $a_only_public, 
false,
 
  356                                $per, $a_prevent_aggregation, 
false, 
false, 
false, $a_user_id);
 
  359                        if (!is_null($a_cnt))
 
  361                                $a_cnt[
$ref_id] = count($news);
 
  378                $a_time_period = 0, $a_prevent_aggregation = 
true, $a_forum_group_sequences = 
false,
 
  379                $a_no_auto_generated = 
false, $a_ignore_date_filter = 
false, $a_user_id = 
null)
 
  386                if ($obj_type == 
"grp" || $obj_type == 
"crs" || $obj_type == 
"cat")
 
  388                        include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
 
  391                        if ($hide_news_per_date && !$a_ignore_date_filter)
 
  398                if ($obj_type == 
"cat" && !$a_stopnesting)
 
  401                $a_prevent_aggregation, $starting_date, $a_no_auto_generated);
 
  403                else if (($obj_type == 
"grp" || $obj_type == 
"crs") &&
 
  407                $a_prevent_aggregation, $starting_date, $a_no_auto_generated, $a_user_id);
 
  412                        $news_item->setContextObjId($obj_id);
 
  413                        $news_item->setContextObjType($obj_type);
 
  414                        $news = $news_item->queryNewsForContext($a_only_public, $a_time_period,
 
  415                $starting_date, $a_no_auto_generated);
 
  417                        foreach ($news as $k => $v)
 
  419                                if (!$a_only_public || $v[
"visibility"] == 
NEWS_PUBLIC ||
 
  420                    ($v[
"priority"] == 0 &&
 
  424                                        $news[$k][
"ref_id"] = $a_ref_id;
 
  431                        foreach ($unset as $un)
 
  437                if (!$a_prevent_aggregation)
 
  441                else if ($a_forum_group_sequences)
 
  453        $a_prevent_aggregation = 
false, $a_starting_date = 
"", $a_no_auto_generated = 
false,
 
  456                global $tree, $ilAccess, $ilObjDataCache;
 
  463                $cur_node = $tree->getNodeData($a_ref_id);
 
  468                        $nodes = (array) $tree->getSubTree($cur_node,
true);
 
  478                foreach($nodes as $node)
 
  480                        $ref_ids[] = $node[
"child"];
 
  481                        $obj_ids[] = $node[
"obj_id"];
 
  484                $ilObjDataCache->preloadReferenceCache($ref_ids);
 
  487                        include_once 
"Services/Object/classes/class.ilObjectActivation.php";
 
  497                foreach($nodes as $node)
 
  500                        if (!in_array($node[
"obj_id"], $news_obj_ids))
 
  509                                        $acc = $ilAccess->checkAccess(
"read", 
"", $node[
"child"]);
 
  513                                        $acc = $ilAccess->checkAccessOfUser($a_user_id, 
"read", 
"",
 
  522                        $ref_id[$node[
"obj_id"]] = $node[
"child"];
 
  523                        $contexts[] = array(
"obj_id" => $node[
"obj_id"],
 
  524                                "obj_type" => $node[
"type"]);
 
  529            $a_starting_date, $a_no_auto_generated, $a_user_id);
 
  532                foreach ($news as $k => $v)
 
  534                        $news[$k][
"ref_id"] = 
$ref_id[$v[
"context_obj_id"]];
 
  540                if (!$a_prevent_aggregation)
 
  554                foreach ($news as $k => $v)
 
  556                        if ($a_group_posting_sequence && $last_aggregation_forum > 0 &&
 
  557                                $last_aggregation_forum != $news[$k][
"context_obj_id"])
 
  559                                $forums[$last_aggregation_forum] = 
"";
 
  562                        if ($news[$k][
"context_obj_type"] == 
"frm")
 
  564                                if ($forums[$news[$k][
"context_obj_id"]] == 
"")
 
  567                                        $forums[$news[$k][
"context_obj_id"]] = $k;
 
  568                                        $last_aggregation_forum = $news[$k][
"context_obj_id"];
 
  575                                $news[$k][
"no_context_title"] = 
true;
 
  578                                $news[$forums[$news[$k][
"context_obj_id"]]][
"aggregation"][$k]
 
  580                                $news[$k][
"agg_ref_id"]
 
  581                                        = $news[$k][
"ref_id"];
 
  582                                $news[$k][
"content"] = 
"";
 
  583                                $news[$k][
"content_long"] = 
"";
 
  588                foreach($to_del as $k)
 
  602                foreach ($news as $k => $v)
 
  605                        if ($news[$k][
"context_obj_type"] == 
"file")
 
  607                                if ($first_file == 
"")
 
  615                                $news[$first_file][
"aggregation"][$k] = $news[$k];
 
  616                                $news[$first_file][
"agg_ref_id"] = $a_ref_id;
 
  617                                $news[$first_file][
"ref_id"] = $a_ref_id;
 
  621                foreach($to_del as $v)
 
  634                $a_time_period = 0, $a_prevent_aggregation = 
false, $a_starting_date = 
"",
 
  635        $a_no_auto_generated = 
false)
 
  637                global $tree, $ilAccess;
 
  641                        true, 
false, 
false, $a_no_auto_generated);
 
  642                foreach (
$data as $k => $v)
 
  644                        $data[$k][
"ref_id"] = $a_ref_id;
 
  648                $nodes = $tree->getChilds($a_ref_id);
 
  652                foreach($nodes as $node)
 
  654                        $obj_ids[] = $node[
"obj_id"];
 
  661                foreach($nodes as $node)
 
  664                        if (!in_array($node[
"obj_id"], $news_obj_ids))
 
  669                        if (!$a_only_public && !$ilAccess->checkAccess(
"read", 
"", $node[
"child"]))
 
  673                        $ref_id[$node[
"obj_id"]] = $node[
"child"];
 
  674                        $contexts[] = array(
"obj_id" => $node[
"obj_id"],
 
  675                                "obj_type" => $node[
"type"]);
 
  679            $a_starting_date, $a_no_auto_generated);
 
  680                foreach ($news as $k => $v)
 
  682                        $news[$k][
"ref_id"] = 
$ref_id[$v[
"context_obj_id"]];
 
  689                if (!$a_prevent_aggregation)
 
  700        function setContext($a_obj_id, $a_obj_type, $a_sub_obj_id = 0, $a_sub_obj_type = 
"")
 
  717        $a_starting_date = 
"", $a_no_auto_generated = 
false, $a_oldest_first = 
false, $a_limit = 0)
 
  722                        if ($a_time_period > 0)
 
  724                                $limit_ts = date(
'Y-m-d H:i:s', time() - ($a_time_period * 24 * 60 * 60));
 
  725                        $and = 
" AND creation_date >= ".$ilDB->quote($limit_ts, 
"timestamp").
" ";
 
  728                if ($a_starting_date != 
"")
 
  730                        $and.= 
" AND creation_date > ".$ilDB->quote($a_starting_date, 
"timestamp").
" ";
 
  733                if ($a_no_auto_generated)
 
  735                        $and.= 
" AND priority = 1 AND content_type = ".$ilDB->quote(
"text", 
"text").
" ";
 
  741                        $and.= 
" AND context_sub_obj_id = ".$ilDB->quote($this->
getContextSubObjId(), 
"integer").
 
  745                $ordering = ($a_oldest_first)
 
  746            ? 
" creation_date ASC, id ASC " 
  747            : 
" creation_date DESC, id DESC ";
 
  752                                "FROM il_news_item ".
 
  755                                        " AND context_obj_type = ".$ilDB->quote($this->getContextObjType(), 
"text").
 
  757                                        " ORDER BY ".$ordering;
 
  761                        $query = 
"SELECT il_news_item.* ".
 
  762                                ", il_news_read.user_id user_read ".
 
  763                                "FROM il_news_item LEFT JOIN il_news_read ".
 
  764                                "ON il_news_item.id = il_news_read.news_id AND ".
 
  770                                        " ORDER BY ".$ordering;
 
  774                        $query = 
"SELECT il_news_item.* ".
 
  775                                ", il_news_read.user_id as user_read ".
 
  776                                "FROM il_news_item LEFT JOIN il_news_read ".
 
  777                                "ON il_news_item.id = il_news_read.news_id AND ".
 
  778                                " il_news_read.user_id = ".$ilDB->quote(
$ilUser->getId(), 
"integer").
 
  783                                        " ORDER BY ".$ordering;
 
  788                while($rec = 
$ilDB->fetchAssoc($set))
 
  790                        if ($a_limit > 0 && count(
$result) >= $a_limit)
 
  795                                ($rec[
"priority"] == 0 &&
 
  797                                0, $rec[
"context_obj_id"]))))
 
  808                if ($a_time_period != 
"" && $a_for_rss_use)
 
  810                        include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
 
  813                        if ($keep_rss_min > 0)
 
  816                                        $a_starting_date, $a_no_auto_generated, $a_oldest_first, $keep_rss_min);
 
  837                if(!$tree->isDeleted($a_ref_id))
 
  841                        $node = $tree->getNodeData($a_ref_id);                                  
 
  842                        foreach($tree->getSubTree($node) as $child)
 
  844                                if($child[
"type"] != 
"rolf")
 
  846                                        $nodes[$child[
"obj_id"]] = $child[
"type"];
 
  850                        $limit_ts = date(
'Y-m-d H:i:s', time() - ($a_time_period * 24 * 60 * 60));
 
  853                        $query = 
$ilDB->query(
"SELECT id,context_obj_id,context_obj_type".
 
  854                                " FROM il_news_item".
 
  855                                " WHERE ".
$ilDB->in(
"context_obj_id", array_keys($nodes), 
false, 
"integer").
 
  856                                " AND creation_date >= ".
$ilDB->quote($limit_ts, 
"timestamp"));
 
  859                                if ($nodes[$rec[
"context_obj_id"]] == $rec[
"context_obj_type"])
 
  875        $a_time_period = 0, $a_starting_date = 
"", $a_no_auto_generated = 
false,
 
  881                if ($a_time_period > 0)
 
  883                        $limit_ts = date(
'Y-m-d H:i:s', time() - ($a_time_period * 24 * 60 * 60));
 
  884                        $and = 
" AND creation_date >= ".$ilDB->quote($limit_ts, 
"timestamp").
" ";
 
  887                if ($a_starting_date != 
"")
 
  889                        $and.= 
" AND creation_date > ".$ilDB->quote($a_starting_date, 
"timestamp").
" ";
 
  892                if ($a_no_auto_generated)
 
  894                        $and.= 
" AND priority = 1 AND content_type = ".$ilDB->quote(
"text", 
"text").
" ";
 
  899                foreach($a_contexts as $cont)
 
  901                        $ids[] = $cont[
"obj_id"];
 
  902                        $type[$cont[
"obj_id"]] = $cont[
"obj_type"];
 
  908                                "FROM il_news_item ".
 
  910                                        $ilDB->in(
"context_obj_id", $ids, 
false, 
"integer").
" ".
 
  912                    " ORDER BY creation_date DESC ";
 
  916                        $query = 
"SELECT il_news_item.* ".
 
  917                                ", il_news_read.user_id as user_read ".
 
  918                                "FROM il_news_item LEFT JOIN il_news_read ".
 
  919                                "ON il_news_item.id = il_news_read.news_id AND ".
 
  922                                        $ilDB->in(
"context_obj_id", $ids, 
false, 
"integer").
" ".
 
  924                    " ORDER BY creation_date DESC ";
 
  936                        $query = 
"SELECT il_news_item.* ".
 
  937                                ", il_news_read.user_id as user_read ".
 
  938                                "FROM il_news_item LEFT JOIN il_news_read ".
 
  939                                "ON il_news_item.id = il_news_read.news_id AND ".
 
  940                                " il_news_read.user_id = ".$ilDB->quote(
$user_id, 
"integer").
 
  942                                        $ilDB->in(
"context_obj_id", $ids, 
false, 
"integer").
" ".
 
  944                    " ORDER BY creation_date DESC ";
 
  949                while($rec = 
$ilDB->fetchAssoc($set))
 
  951                        if ($type[$rec[
"context_obj_id"]] == $rec[
"context_obj_type"])
 
  954                                        ($rec[
"priority"] == 0 &&
 
  956                                        0, $rec[
"context_obj_id"]))))
 
  973                global 
$ilDB, $ilAppEventHandler;
 
  975                $ilDB->replace(
"il_news_read",
 
  977                                "user_id" => array(
"integer", $a_user_id),
 
  978                                "news_id" => array(
"integer", $a_news_id)
 
  991                $ilAppEventHandler->raise(
"Services/News", 
"readNews",
 
  992                        array(
"user_id" => $a_user_id, 
"news_ids" => array($a_news_id)));
 
 1000                global 
$ilDB, $ilAppEventHandler;
 
 1002                $ilDB->manipulate(
"DELETE FROM il_news_read (user_id, news_id) VALUES (".
 
 1003                        " WHERE user_id = ".
$ilDB->quote($a_user_id, 
"integer").
 
 1004                        " AND news_id = ".$ilDB->quote($a_news_id, 
"integer"));
 
 1006                $ilAppEventHandler->raise(
"Services/News", 
"unreadNews",
 
 1007                        array(
"user_id" => $a_user_id, 
"news_ids" => array($a_news_id)));
 
 1020                foreach($n2 as 
$id => $news)
 
 1037                include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
 
 1040                $default_visibility = ($news_set->get(
"default_visibility") != 
"")
 
 1041                                ? $news_set->get(
"default_visibility")
 
 1044                if ($tree->isInTree($a_ref_id))
 
 1046                        $path = $tree->getPathFull($a_ref_id);
 
 1050                                if (!in_array(
$row[
"type"], array(
"root", 
"cat",
"crs", 
"fold", 
"grp", 
"icrs")))
 
 1065                return $default_visibility;
 
 1073        public function delete()
 
 1078                $ilDB->manipulate(
"DELETE FROM il_news_read ".
 
 1079                        " WHERE news_id = ".
$ilDB->quote($this->getId(), 
"integer"));
 
 1090                        include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
 1101                $a_context_obj_type, $a_context_sub_obj_id = 0, $a_context_sub_obj_type = 
"")
 
 1105                if ($a_context_obj_id == 0 || $a_context_obj_type == 
"")
 
 1110                if ($a_context_sub_obj_id > 0)
 
 1112                        $and = 
" AND context_sub_obj_id = ".$ilDB->quote($a_context_sub_obj_id, 
"integer").
 
 1113                                " AND context_sub_obj_type = ".$ilDB->quote($a_context_sub_obj_type, 
"text");
 
 1117                $query = 
"SELECT * FROM il_news_item".
 
 1118                        " WHERE context_obj_id = ".$ilDB->quote($a_context_obj_id, 
"integer").
 
 1119                        " AND context_obj_type = ".$ilDB->quote($a_context_obj_type, 
"text").
 
 1124                while ($news = 
$ilDB->fetchAssoc($news_set))
 
 1127                        $news_obj->delete();
 
 1138                $query = 
"SELECT title FROM il_news_item WHERE id = ".
 
 1139                        $ilDB->quote($a_news_id, 
"integer");
 
 1141                $rec = 
$ilDB->fetchAssoc($set);
 
 1142                return $rec[
"title"];
 
 1152                $query = 
"SELECT visibility FROM il_news_item WHERE id = ".
 
 1153                        $ilDB->quote($a_news_id, 
"integer");
 
 1155                $rec = 
$ilDB->fetchAssoc($set);
 
 1157                return $rec[
"visibility"];
 
 1167                $query = 
"SELECT mob_id FROM il_news_item WHERE id = ".
 
 1168                        $ilDB->quote($a_news_id, 
"integer");
 
 1170                $rec = 
$ilDB->fetchAssoc($set);
 
 1171                return $rec[
"mob_id"];
 
 1177        static function filterObjIdsPerNews($a_obj_ids, $a_time_period = 0, $a_starting_date = 
"",$a_ending_date = 
'', $ignore_period = 
false)
 
 1182                        if ($a_time_period > 0)
 
 1184                                $limit_ts = date(
'Y-m-d H:i:s', time() - ($a_time_period * 24 * 60 * 60));
 
 1185            $and = 
" AND creation_date >= ".$ilDB->quote($limit_ts, 
"timestamp").
" ";
 
 1188                if ($a_starting_date != 
"")
 
 1190                        $and.= 
" AND creation_date >= ".$ilDB->quote($a_starting_date, 
"timestamp");
 
 1193                $query = 
"SELECT DISTINCT(context_obj_id) AS obj_id FROM il_news_item".
 
 1194                        " WHERE ".$ilDB->in(
"context_obj_id", $a_obj_ids, 
false, 
"integer").
" ".$and;
 
 1199                while($rec = 
$ilDB->fetchAssoc($set))
 
 1201                        $objs[] = $rec[
"obj_id"];
 
 1211                $a_agg_ref_id = 0, $a_aggregation = 
"")
 
 1215                if ($a_agg_ref_id > 0)
 
 1217                        $cnt = count($a_aggregation);
 
 1220                        if ($a_context_obj_type == 
"frm")
 
 1224                                        return sprintf(
$lng->txt(
"news_x_postings"), $cnt);
 
 1228                                        return $lng->txt(
"news_1_postings");
 
 1233                                $up_cnt = $cr_cnt = 0;
 
 1234                                foreach($a_aggregation as $item)
 
 1236                                        if ($item[
"title"] == 
"file_updated")
 
 1248                                        $tit = 
$lng->txt(
"news_1_file_created");
 
 1251                                else if ($cr_cnt > 1)
 
 1253                                        $tit = sprintf(
$lng->txt(
"news_x_files_created"), $cr_cnt);
 
 1258                                        $tit .= $sep.$lng->txt(
"news_1_file_updated");
 
 1260                                else if ($up_cnt > 1)
 
 1262                                        $tit .= $sep.sprintf(
$lng->txt(
"news_x_files_updated"), $up_cnt);
 
 1269                        if ($a_content_is_lang_var)
 
 1271                                return $lng->txt($a_title);
 
 1291                        $lng->loadLanguageModule($a_context_obj_type);
 
 1292                        return $lng->txt($a_content);
 
 1306                $a_context_obj_type, $a_context_sub_obj_id = 
"", $a_context_sub_obj_type = 
"")
 
 1312                        "FROM il_news_item ".
 
 1314                                "context_obj_id = ".$ilDB->quote($a_context_obj_id, 
"integer").
 
 1315                                " AND context_obj_type = ".$ilDB->quote($a_context_obj_type, 
"text").
 
 1316                                " AND context_sub_obj_id = ".$ilDB->quote($a_context_sub_obj_id, 
"integer").
 
 1317                                " AND ".$ilDB->equals(
"context_sub_obj_type", $a_context_sub_obj_type, 
"text", 
true);
 
 1320                $rec = 
$ilDB->fetchAssoc($set);
 
 1329                $a_context_obj_type, $a_context_sub_obj_id = 
"", $a_context_sub_obj_type = 
"",
 
 1330                $a_only_today = 
false)
 
 1335                $query = 
"SELECT id, update_date ".
 
 1336                        "FROM il_news_item ".
 
 1338                                "context_obj_id = ".$ilDB->quote($a_context_obj_id, 
"integer").
 
 1339                                " AND context_obj_type = ".$ilDB->quote($a_context_obj_type, 
"text").
 
 1340                                " AND context_sub_obj_id = ".$ilDB->quote($a_context_sub_obj_id, 
"integer").
 
 1341                                " AND ".$ilDB->equals(
"context_sub_obj_type", $a_context_sub_obj_type, 
"text", 
true).
 
 1342                        " ORDER BY update_date DESC";
 
 1346                $rec = 
$ilDB->fetchAssoc($set);
 
 1348                $id = (int) $rec[
"id"];
 
 1352                        if (substr($now, 0, 10) != substr($rec[
"update_date"], 0, 10))
 
 1370                        "FROM il_news_item ".
 
 1372                                " mob_id = ".$ilDB->quote($a_mob_id, 
"integer");
 
 1376                while ($rec = 
$ilDB->fetchAssoc($set))
 
 1378                        $usages[$rec[
"id"]] = array(
"type" => 
"news", 
"id" => $rec[
"id"]);
 
 1392                        "FROM il_news_item ".
 
 1394                                " id = ".$ilDB->quote($a_news_id, 
"integer");
 
 1396                $rec = 
$ilDB->fetchAssoc($set);
 
 1398                return $rec[
"context_obj_id"];
 
 1404                $per = $news_set->get(
"pd_period");
 
 1418                $allow_shorter_periods = $news_set->get(
"allow_shorter_periods");
 
 1419                $allow_longer_periods = $news_set->get(
"allow_longer_periods");
 
 1422                include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
 
 1428                        (!$allow_shorter_periods && ($per < $default_per)) ||
 
 1429                        (!$allow_longer_periods && ($per > $default_per))
 
 1432                        $per = $default_per;
 
 1441                $rss_period = $news_set->get(
"rss_period");
 
 1442                if ($rss_period == 0)           
 
 1467                include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
 1472                if (!$mob->hasPurposeItem($a_purpose))
 
 1477                $m_item = $mob->getMediaItem($a_purpose);
 
 1478                if ($m_item->getLocationType() != 
"Reference")
 
 1480                    $file = $mob_dir.
"/".$m_item->getLocation();
 
 1483                        if ($a_increase_download_cnt)
 
 1497                        if ($a_increase_download_cnt)
 
 1518                $ilDB->manipulate(
"UPDATE il_news_item SET ".
 
 1519                        " mob_cnt_download = ".
$ilDB->quote($cnt, 
"integer").
 
 1520                        " WHERE id = ".$ilDB->quote($this->getId(), 
"integer")
 
 1537                $ilDB->manipulate(
"UPDATE il_news_item SET ".
 
 1538                        " mob_cnt_play = ".
$ilDB->quote($cnt, 
"integer").
 
 1539                        " WHERE id = ".$ilDB->quote($this->getId(), 
"integer")
 
static _lookup($a_type, $a_setting, $a_user=0, $a_block_id=0)
Lookup setting from database.
A news item can be created by different sources.
getContextObjId()
Get ContextObjId.
setTitle($a_title)
Set Title.
setContentType($a_content_type="text")
Set ContentType.
setCreationDate($a_creation_date)
Set CreationDate.
setVisibility($a_visibility="users")
Set Visibility.
setContextSubObjType($a_context_sub_obj_type)
Set ContextSubObjType.
setPlaytime($a_playtime)
Set Playtime.
setContentIsLangVar($a_content_is_lang_var=0)
Set ContentIsLangVar.
setUserId($a_user_id)
Set UserId.
setContextObjType($a_context_obj_type)
Set ContextObjType.
getPriority()
Get Priority.
setContextObjId($a_context_obj_id)
Set ContextObjId.
getContentType()
Get ContentType.
setContextSubObjId($a_context_sub_obj_id)
Set ContextSubObjId.
setContent($a_content)
Set Content.
setPriority($a_priority=1)
Set Priority.
setUpdateDate($a_update_date)
Set UpdateDate.
getContextObjType()
Get ContextObjType.
setMobId($a_mob_id)
Set MobId.
getContextSubObjId()
Get ContextSubObjId.
getContentIsLangVar()
Get ContentIsLangVar.
getPlaytime()
Get Playtime.
getContextSubObjType()
Get ContextSubObjType.
queryNewsForContext()
Query NewsForContext.
getContentLong()
Get ContentLong.
setContentLong($a_content_long)
Set ContentLong.
getVisibility()
Get Visibility.
getAggregatedChildNewsData($a_ref_id, $a_only_public=false, $a_time_period=0, $a_prevent_aggregation=false, $a_starting_date="", $a_no_auto_generated=false)
Get news aggregation for child objects (e.g.
update($a_as_new=false)
Update item in database.
deliverMobFile($a_purpose="Standard", $a_increase_download_cnt=false)
Deliver mob file.
static _getDefaultVisibilityForRefId($a_ref_id)
Get default visibility for reference id.
static _lookupVisibility($a_news_id)
Lookup News Visibility.
static _lookupTitle($a_news_id)
Lookup News Title.
static _getNewsItemsOfUser($a_user_id, $a_only_public=false, $a_prevent_aggregation=false, $a_per=0, &$a_cnt=NULL)
Get all news items for a user.
__construct($a_id=0)
Constructor.
static getFirstNewsIdForContext($a_context_obj_id, $a_context_obj_type, $a_context_sub_obj_id="", $a_context_sub_obj_type="")
Get first new id of news set related to a certain context.
static _lookupMobId($a_news_id)
Lookup mob id.
setContext($a_obj_id, $a_obj_type, $a_sub_obj_id=0, $a_sub_obj_type="")
Convenient function to set the whole context information.
read()
Read item from database.
setMobPlayCounter($a_val)
Set mob play counter.
queryNewsForMultipleContexts($a_contexts, $a_for_rss_use=false, $a_time_period=0, $a_starting_date="", $a_no_auto_generated=false, $a_user_id=null)
Query News for multiple Contexts.
aggregateForums($news, $a_group_posting_sequence=false)
increasePlayCounter()
Increase play counter.
setLimitation($a_limitation)
Set Limitation for number of items.
increaseDownloadCounter()
Increase download counter.
static filterObjIdsPerNews($a_obj_ids, $a_time_period=0, $a_starting_date="", $a_ending_date='', $ignore_period=false)
Checks whether news are available for.
static determineNewsContent($a_context_obj_type, $a_content, $a_is_lang_var)
Determine new content.
_setRead($a_user_id, $a_news_id)
Set item read.
static determineNewsTitle($a_context_obj_type, $a_title, $a_content_is_lang_var, $a_agg_ref_id=0, $a_aggregation="")
Determine title for news item entry.
checkNewsExistsForGroupCourse($a_ref_id, $a_time_period=1)
_setUnread($a_user_id, $a_news_id)
Set item unread.
static deleteNewsOfContext($a_context_obj_id, $a_context_obj_type, $a_context_sub_obj_id=0, $a_context_sub_obj_type="")
Delete all news of a context.
getLimitation()
Get Limitation for number of items.
_lookupUserPDPeriod($a_user_id)
mergeNews($n1, $n2)
Merges two sets of news.
getAggregatedNewsData($a_ref_id, $a_only_public=false, $a_time_period=0, $a_prevent_aggregation=false, $a_starting_date="", $a_no_auto_generated=false, $a_user_id=null)
Get news aggregation (e.g.
setContentTextIsLangVar($a_val=0)
Set content text ist lang var.
static getLastNewsIdForContext($a_context_obj_id, $a_context_obj_type, $a_context_sub_obj_id="", $a_context_sub_obj_type="", $a_only_today=false)
Get last news id of news set related to a certain context.
getNewsForRefId($a_ref_id, $a_only_public=false, $a_stopnesting=false, $a_time_period=0, $a_prevent_aggregation=true, $a_forum_group_sequences=false, $a_no_auto_generated=false, $a_ignore_date_filter=false, $a_user_id=null)
Get News For Ref Id.
getMobPlayCounter()
Get mob play counter.
getMobDownloadCounter()
Get mob download counter.
setMobDownloadCounter($a_val)
Set mob download counter.
getContentTextIsLangVar()
Get content text ist lang var.
aggregateFiles($news, $a_ref_id)
queryNewsForContext($a_for_rss_use=false, $a_time_period=0, $a_starting_date="", $a_no_auto_generated=false, $a_oldest_first=false, $a_limit=0)
static _lookupContextObjId($a_news_id)
Context Object ID.
setPrivateFeedId($a_userId)
static _lookupMediaObjectUsages($a_mob_id)
Lookup media object usage(s)
static _getSubscriptionsOfUser($a_user_id)
Get subscriptions of user.
static _lookupDesktopItems($user_id, $a_types="")
get all desktop items of user and specified type
_lookupPref($a_usr_id, $a_keyword)
static preloadData(array $a_ref_ids)
Preload data to internal cache.
static _lookupObjId($a_id)
static _getAllReferences($a_id)
get all reference ids of object
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data@access public
static _lookupType($a_id, $a_reference=false)
lookup object type
static _getMembershipByType($a_usr_id, $a_type, $a_only_member_role=false)
get membership by type Get course or group membership
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static redirect($a_script)
http redirect to other script
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static now()
Return current timestamp in Y-m-d H:i:s format.
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.