4define(
"NEWS_NOTICE", 0);
 
    5define(
"NEWS_MESSAGE", 1);
 
    6define(
"NEWS_WARNING", 2);
 
    8define(
"NEWS_TEXT", 
"text");
 
    9define(
"NEWS_HTML", 
"html");
 
   10define(
"NEWS_AUDIO", 
"audio");
 
   11define(
"NEWS_USERS", 
"users");
 
   12define(
"NEWS_PUBLIC", 
"public");
 
   71                $this->limitation = 
true;
 
  101                $this->title = $a_title;
 
  141                $this->context_obj_id = $a_context_obj_id;
 
  161                $this->context_obj_type = $a_context_obj_type;
 
  181                $this->context_sub_obj_id = $a_context_sub_obj_id;
 
  201                $this->context_sub_obj_type = $a_context_sub_obj_type;
 
  221                $this->content_type = $a_content_type;
 
  241                $this->creation_date = $a_creation_date;
 
  261                $this->update_date = $a_update_date;
 
  281                $this->user_id = $a_user_id;
 
  301                $this->update_user_id = $a_val;
 
  321                $this->visibility = $a_visibility;
 
  341                $this->content_long = $a_content_long;
 
  361                $this->priority = $a_priority;
 
  381                $this->content_is_lang_var = $a_content_is_lang_var;
 
  401                $this->mob_id = $a_mob_id;
 
  421                $this->playtime = $a_playtime;
 
  442                $this->limitation = $a_limitation;
 
  462                $this->content_text_is_lang_var = $a_val;
 
  472                return $this->content_text_is_lang_var;
 
  482                $this->mob_cnt_play = $a_val;
 
  492                return $this->mob_cnt_play;
 
  502                $this->mob_cnt_download = $a_val;
 
  512                return $this->mob_cnt_download;
 
  522                $this->content_html = $a_val;
 
  542                $query = 
"SELECT * FROM il_news_item WHERE id = ".
 
  545                $rec = 
$ilDB->fetchAssoc($set);
 
  579                $this->
setId($ilDB->nextId(
"il_news_item"));
 
  580                $ilDB->insert(
"il_news_item", array(
 
  581                        "id" => array(
"integer", $this->
getId()),
 
  582                        "title" => array(
"text", $this->
getTitle()),
 
  583                        "content" => array(
"clob", $this->
getContent()),
 
  584                        "content_html" => array(
"integer", (
int) $this->
getContentHtml()),
 
  590                        "creation_date" => array(
"timestamp", 
ilUtil::now()),
 
  591                        "update_date" => array(
"timestamp", 
ilUtil::now()),
 
  592                        "user_id" => array(
"integer", $this->
getUserId()),
 
  596                        "priority" => array(
"integer", $this->
getPriority()),
 
  599                        "mob_id" => array(
"integer", $this->
getMobId()),
 
  605                $max_items = $news_set->get(
"max_items");
 
  615                        $query = 
"SELECT count(*) cnt ".
 
  616                                "FROM il_news_item ".
 
  624                        $rec = 
$ilDB->fetchAssoc($set);
 
  630                                        "FROM il_news_item ".
 
  636                        " ORDER BY creation_date ASC";
 
  638                                $ilDB->setLimit($rec[
"cnt"] - $max_items);
 
  640                                while ($del_item = 
$ilDB->fetchAssoc($del_set))
 
  654        public function update($a_as_new = 
false)
 
  659                        "title" => array(
"text", $this->
getTitle()),
 
  660                        "content" => array(
"clob", $this->
getContent()),
 
  661                        "content_html" => array(
"integer", (
int) $this->
getContentHtml()),
 
  667                        "user_id" => array(
"integer", $this->
getUserId()),
 
  671                        "priority" => array(
"integer", $this->
getPriority()),
 
  674                        "mob_id" => array(
"integer", $this->
getMobId()),
 
  683                        $fields[
"creation_date"] = array(
"timestamp", $now);
 
  684                        $fields[
"update_date"] = array(
"timestamp", $now);
 
  688                        $fields[
"update_date"] = array(
"timestamp", $now);
 
  691                $ilDB->update(
"il_news_item", $fields, array(
 
  692                        "id" => array(
"integer", $this->
getId())
 
  702                $a_prevent_aggregation = 
false, $a_per = 0, &$a_cnt = NULL)
 
  711                include_once(
"./Services/News/classes/class.ilNewsSubscription.php");
 
  712                include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
 
  721                        foreach($pd_items as $item)
 
  723                                if (!in_array($item[
"ref_id"], $ref_ids))
 
  725                                        $ref_ids[] = $item[
"ref_id"];
 
  730                        include_once 
'Services/Membership/classes/class.ilParticipants.php';
 
  733                        $items = array_merge($crs_mbs, $grp_mbs);
 
  734                        foreach($items as $i)
 
  737                                if(is_array($item_references) && count($item_references))
 
  739                                        foreach($item_references as 
$ref_id)
 
  741                                                if (!in_array(
$ref_id, $ref_ids))
 
  757                                $acc = $ilAccess->checkAccessOfUser($a_user_id, 
"read", 
"", 
$ref_id);
 
  776                        $news = $news_item->getNewsForRefId(
$ref_id, $a_only_public, 
false,
 
  777                                $per, $a_prevent_aggregation, 
false, 
false, 
false, $a_user_id);
 
  780                        if (!is_null($a_cnt))
 
  782                                $a_cnt[
$ref_id] = count($news);
 
  810                $a_time_period = 0, $a_prevent_aggregation = 
true, $a_forum_group_sequences = 
false,
 
  811                $a_no_auto_generated = 
false, $a_ignore_date_filter = 
false, $a_user_id = 
null, $a_limit = 0, $a_excluded = array())
 
  818                if ($obj_type == 
"grp" || $obj_type == 
"crs" || $obj_type == 
"cat")
 
  820                        include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
 
  823                        if ($hide_news_per_date && !$a_ignore_date_filter)
 
  830                if ($obj_type == 
"cat" && !$a_stopnesting)
 
  833                $a_prevent_aggregation, $starting_date, $a_no_auto_generated);
 
  835                else if (($obj_type == 
"grp" || $obj_type == 
"crs") &&
 
  839                $a_prevent_aggregation, $starting_date, $a_no_auto_generated, $a_user_id, $a_limit, $a_excluded);
 
  844                        $news_item->setContextObjId($obj_id);
 
  845                        $news_item->setContextObjType($obj_type);
 
  846                        $news = $news_item->queryNewsForContext($a_only_public, $a_time_period,
 
  847                $starting_date, $a_no_auto_generated);
 
  849                        foreach ($news as $k => $v)
 
  851                                if (!$a_only_public || $v[
"visibility"] == 
NEWS_PUBLIC ||
 
  852                    ($v[
"priority"] == 0 &&
 
  856                                        $news[$k][
"ref_id"] = $a_ref_id;
 
  863                        foreach ($unset as $un)
 
  869                if (!$a_prevent_aggregation)
 
  873                else if ($a_forum_group_sequences)
 
  885        $a_prevent_aggregation = 
false, $a_starting_date = 
"", $a_no_auto_generated = 
false,
 
  886                $a_user_id = 
null, $a_limit = 0, $a_exclude = array())
 
  888                global $tree, $ilAccess, $ilObjDataCache;
 
  895                $cur_node = $tree->getNodeData($a_ref_id);
 
  900                        $nodes = (array) $tree->getSubTree($cur_node,
true);
 
  910                foreach($nodes as $node)
 
  912                        $ref_ids[] = $node[
"child"];
 
  913                        $obj_ids[] = $node[
"obj_id"];
 
  916                $ilObjDataCache->preloadReferenceCache($ref_ids);
 
  919                        include_once 
"Services/Object/classes/class.ilObjectActivation.php";
 
  929                foreach($nodes as $node)
 
  932                        if (!in_array($node[
"obj_id"], $news_obj_ids))
 
  941                                        $acc = $ilAccess->checkAccess(
"read", 
"", $node[
"child"]);
 
  945                                        $acc = $ilAccess->checkAccessOfUser($a_user_id, 
"read", 
"",
 
  954                        $ref_id[$node[
"obj_id"]] = $node[
"child"];
 
  955                        $contexts[] = array(
"obj_id" => $node[
"obj_id"],
 
  956                                "obj_type" => $node[
"type"]);
 
  961            $a_starting_date, $a_no_auto_generated, $a_user_id, $a_limit, $a_exclude);
 
  964                foreach ($news as $k => $v)
 
  966                        $news[$k][
"ref_id"] = 
$ref_id[$v[
"context_obj_id"]];
 
  972                if (!$a_prevent_aggregation)
 
  986                foreach ($news as $k => $v)
 
  988                        if ($a_group_posting_sequence && $last_aggregation_forum > 0 &&
 
  989                                $last_aggregation_forum != $news[$k][
"context_obj_id"])
 
  991                                $forums[$last_aggregation_forum] = 
"";
 
  994                        if ($news[$k][
"context_obj_type"] == 
"frm")
 
  996                                if ($forums[$news[$k][
"context_obj_id"]] == 
"")
 
  999                                        $forums[$news[$k][
"context_obj_id"]] = $k;
 
 1000                                        $last_aggregation_forum = $news[$k][
"context_obj_id"];
 
 1007                                $news[$k][
"no_context_title"] = 
true;
 
 1010                                $news[$forums[$news[$k][
"context_obj_id"]]][
"aggregation"][$k]
 
 1012                                $news[$k][
"agg_ref_id"]
 
 1013                                        = $news[$k][
"ref_id"];
 
 1014                                $news[$k][
"content"] = 
"";
 
 1015                                $news[$k][
"content_long"] = 
"";
 
 1020                foreach($to_del as $k)
 
 1034                foreach ($news as $k => $v)
 
 1037                        if ($news[$k][
"context_obj_type"] == 
"file")
 
 1039                                if ($first_file == 
"")
 
 1047                                $news[$first_file][
"aggregation"][$k] = $news[$k];
 
 1048                                $news[$first_file][
"agg_ref_id"] = $a_ref_id;
 
 1049                                $news[$first_file][
"ref_id"] = $a_ref_id;
 
 1053                foreach($to_del as $v)
 
 1066                $a_time_period = 0, $a_prevent_aggregation = 
false, $a_starting_date = 
"",
 
 1067        $a_no_auto_generated = 
false)
 
 1069                global $tree, $ilAccess;
 
 1073                        true, 
false, 
false, $a_no_auto_generated);
 
 1074                foreach (
$data as $k => $v)
 
 1076                        $data[$k][
"ref_id"] = $a_ref_id;
 
 1080                $nodes = $tree->getChilds($a_ref_id);
 
 1084                foreach($nodes as $node)
 
 1086                        $obj_ids[] = $node[
"obj_id"];
 
 1092                $contexts = array();
 
 1093                foreach($nodes as $node)
 
 1096                        if (!in_array($node[
"obj_id"], $news_obj_ids))
 
 1101                        if (!$a_only_public && !$ilAccess->checkAccess(
"read", 
"", $node[
"child"]))
 
 1105                        $ref_id[$node[
"obj_id"]] = $node[
"child"];
 
 1106                        $contexts[] = array(
"obj_id" => $node[
"obj_id"],
 
 1107                                "obj_type" => $node[
"type"]);
 
 1111            $a_starting_date, $a_no_auto_generated);
 
 1112                foreach ($news as $k => $v)
 
 1114                        $news[$k][
"ref_id"] = 
$ref_id[$v[
"context_obj_id"]];
 
 1121                if (!$a_prevent_aggregation)
 
 1132        function setContext($a_obj_id, $a_obj_type, $a_sub_obj_id = 0, $a_sub_obj_type = 
"")
 
 1149                if(is_numeric($a_time_period))
 
 1151                        if($a_time_period > 0)
 
 1153                                return date(
'Y-m-d H:i:s', time() - ($a_time_period * 24 * 60 * 60));
 
 1157                else if(preg_match(
"/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/", $a_time_period))
 
 1159                        return $a_time_period;
 
 1173        $a_starting_date = 
"", $a_no_auto_generated = 
false, $a_oldest_first = 
false, $a_limit = 0)
 
 1178                if ($a_time_period > 0)
 
 1181                        $and = 
" AND creation_date >= ".$ilDB->quote($limit_ts, 
"timestamp").
" ";
 
 1184                if ($a_starting_date != 
"")
 
 1186                        $and.= 
" AND creation_date > ".$ilDB->quote($a_starting_date, 
"timestamp").
" ";
 
 1189                if ($a_no_auto_generated)
 
 1191                        $and.= 
" AND priority = 1 AND content_type = ".$ilDB->quote(
"text", 
"text").
" ";
 
 1197                        $and.= 
" AND context_sub_obj_id = ".$ilDB->quote($this->
getContextSubObjId(), 
"integer").
 
 1201                $ordering = ($a_oldest_first)
 
 1202            ? 
" creation_date ASC, id ASC " 
 1203            : 
" creation_date DESC, id DESC ";
 
 1208                                "FROM il_news_item ".
 
 1210                                        "context_obj_id = ".$ilDB->quote($this->
getContextObjId(), 
"integer").
 
 1211                                        " AND context_obj_type = ".$ilDB->quote($this->getContextObjType(), 
"text").
 
 1213                                        " ORDER BY ".$ordering;
 
 1217                        $query = 
"SELECT il_news_item.* ".
 
 1218                                ", il_news_read.user_id user_read ".
 
 1219                                "FROM il_news_item LEFT JOIN il_news_read ".
 
 1220                                "ON il_news_item.id = il_news_read.news_id AND ".
 
 1223                                        "context_obj_id = ".$ilDB->quote($this->
getContextObjId(), 
"integer").
 
 1226                                        " ORDER BY ".$ordering;
 
 1230                        $query = 
"SELECT il_news_item.* ".
 
 1231                                ", il_news_read.user_id as user_read ".
 
 1232                                "FROM il_news_item LEFT JOIN il_news_read ".
 
 1233                                "ON il_news_item.id = il_news_read.news_id AND ".
 
 1234                                " il_news_read.user_id = ".$ilDB->quote(
$ilUser->getId(), 
"integer").
 
 1236                                        "context_obj_id = ".$ilDB->quote($this->
getContextObjId(), 
"integer").
 
 1239                                        " ORDER BY ".$ordering;
 
 1244                while($rec = 
$ilDB->fetchAssoc($set))
 
 1246                        if ($a_limit > 0 && count(
$result) >= $a_limit)
 
 1251                                ($rec[
"priority"] == 0 &&
 
 1253                                0, $rec[
"context_obj_id"]))))
 
 1264                if ($a_time_period != 
"" && $a_for_rss_use)
 
 1266                        include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
 
 1269                        if ($keep_rss_min > 0)
 
 1272                                        $a_starting_date, $a_no_auto_generated, $a_oldest_first, $keep_rss_min);
 
 1289                global $tree, 
$ilDB;
 
 1293                if(!$tree->isDeleted($a_ref_id))
 
 1297                        $node = $tree->getNodeData($a_ref_id);                                  
 
 1298                        foreach($tree->getSubTree($node) as $child)
 
 1300                                if($child[
"type"] != 
"rolf")
 
 1302                                        $nodes[$child[
"obj_id"]] = $child[
"type"];
 
 1309                        $query = 
$ilDB->query(
"SELECT id,context_obj_id,context_obj_type".
 
 1310                                " FROM il_news_item".
 
 1311                                " WHERE ".
$ilDB->in(
"context_obj_id", array_keys($nodes), 
false, 
"integer").
 
 1312                                " AND creation_date >= ".
$ilDB->quote($limit_ts, 
"timestamp"));
 
 1315                                if ($nodes[$rec[
"context_obj_id"]] == $rec[
"context_obj_type"])
 
 1317                                        $all[] = $rec[
"id"];
 
 1339        $a_time_period = 0, $a_starting_date = 
"", $a_no_auto_generated = 
false,
 
 1340                $a_user_id = 
null, $a_limit = 0, $a_exclude = array())
 
 1345                if ($a_time_period > 0)
 
 1348                        $and = 
" AND creation_date >= ".$ilDB->quote($limit_ts, 
"timestamp").
" ";
 
 1351                if ($a_starting_date != 
"")
 
 1353                        $and.= 
" AND creation_date > ".$ilDB->quote($a_starting_date, 
"timestamp").
" ";
 
 1356                if ($a_no_auto_generated)
 
 1358                        $and.= 
" AND priority = 1 AND content_type = ".$ilDB->quote(
"text", 
"text").
" ";
 
 1363                        $ilDB->setLimit($a_limit, 0);
 
 1366                if (is_array($a_exclude) && count($a_exclude) > 0)
 
 1368                        $and.= 
" AND ".$ilDB->in(
"id", $a_exclude, 
true, 
"integer").
" ";
 
 1374                foreach($a_contexts as $cont)
 
 1376                        $ids[] = $cont[
"obj_id"];
 
 1377                        $type[$cont[
"obj_id"]] = $cont[
"obj_type"];
 
 1383                                "FROM il_news_item ".
 
 1385                                        $ilDB->in(
"context_obj_id", $ids, 
false, 
"integer").
" ".
 
 1387                    " ORDER BY creation_date DESC ";
 
 1391                        $query = 
"SELECT il_news_item.* ".
 
 1392                                ", il_news_read.user_id as user_read ".
 
 1393                                "FROM il_news_item LEFT JOIN il_news_read ".
 
 1394                                "ON il_news_item.id = il_news_read.news_id AND ".
 
 1397                                        $ilDB->in(
"context_obj_id", $ids, 
false, 
"integer").
" ".
 
 1399                    " ORDER BY creation_date DESC ";
 
 1411                        $query = 
"SELECT il_news_item.* ".
 
 1412                                ", il_news_read.user_id as user_read ".
 
 1413                                "FROM il_news_item LEFT JOIN il_news_read ".
 
 1414                                "ON il_news_item.id = il_news_read.news_id AND ".
 
 1415                                " il_news_read.user_id = ".$ilDB->quote(
$user_id, 
"integer").
 
 1417                                        $ilDB->in(
"context_obj_id", $ids, 
false, 
"integer").
" ".
 
 1419                    " ORDER BY creation_date DESC ";
 
 1424                while($rec = 
$ilDB->fetchAssoc($set))
 
 1426                        if ($type[$rec[
"context_obj_id"]] == $rec[
"context_obj_type"])
 
 1429                                        ($rec[
"priority"] == 0 &&
 
 1431                                        0, $rec[
"context_obj_id"]))))
 
 1448                global 
$ilDB, $ilAppEventHandler;
 
 1450                $ilDB->replace(
"il_news_read",
 
 1452                                "user_id" => array(
"integer", $a_user_id),
 
 1453                                "news_id" => array(
"integer", $a_news_id)
 
 1466                $ilAppEventHandler->raise(
"Services/News", 
"readNews",
 
 1467                        array(
"user_id" => $a_user_id, 
"news_ids" => array($a_news_id)));
 
 1475                global 
$ilDB, $ilAppEventHandler;
 
 1477                $ilDB->manipulate(
"DELETE FROM il_news_read (user_id, news_id) VALUES (".
 
 1478                        " WHERE user_id = ".
$ilDB->quote($a_user_id, 
"integer").
 
 1479                        " AND news_id = ".$ilDB->quote($a_news_id, 
"integer"));
 
 1481                $ilAppEventHandler->raise(
"Services/News", 
"unreadNews",
 
 1482                        array(
"user_id" => $a_user_id, 
"news_ids" => array($a_news_id)));
 
 1495                foreach($n2 as 
$id => $news)
 
 1512                include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
 
 1515                $default_visibility = ($news_set->get(
"default_visibility") != 
"")
 
 1516                                ? $news_set->get(
"default_visibility")
 
 1519                if ($tree->isInTree($a_ref_id))
 
 1521                        $path = $tree->getPathFull($a_ref_id);
 
 1525                                if (!in_array(
$row[
"type"], array(
"root", 
"cat",
"crs", 
"fold", 
"grp")))
 
 1540                return $default_visibility;
 
 1548        public function delete()
 
 1553                $ilDB->manipulate(
"DELETE FROM il_news_read ".
 
 1554                        " WHERE news_id = ".
$ilDB->quote($this->getId(), 
"integer"));
 
 1560                $query = 
"DELETE FROM il_news_item".
 
 1561                        " WHERE id = ".$ilDB->quote($this->
getId(), 
"integer");
 
 1562                $ilDB->manipulate(
$query);
 
 1567                        include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
 1578                $a_context_obj_type, $a_context_sub_obj_id = 0, $a_context_sub_obj_type = 
"")
 
 1582                if ($a_context_obj_id == 0 || $a_context_obj_type == 
"")
 
 1587                if ($a_context_sub_obj_id > 0)
 
 1589                        $and = 
" AND context_sub_obj_id = ".$ilDB->quote($a_context_sub_obj_id, 
"integer").
 
 1590                                " AND context_sub_obj_type = ".$ilDB->quote($a_context_sub_obj_type, 
"text");
 
 1594                $query = 
"SELECT * FROM il_news_item".
 
 1595                        " WHERE context_obj_id = ".$ilDB->quote($a_context_obj_id, 
"integer").
 
 1596                        " AND context_obj_type = ".$ilDB->quote($a_context_obj_type, 
"text").
 
 1601                while ($news = 
$ilDB->fetchAssoc($news_set))
 
 1604                        $news_obj->delete();
 
 1615                $query = 
"SELECT title FROM il_news_item WHERE id = ".
 
 1616                        $ilDB->quote($a_news_id, 
"integer");
 
 1618                $rec = 
$ilDB->fetchAssoc($set);
 
 1619                return $rec[
"title"];
 
 1629                $query = 
"SELECT visibility FROM il_news_item WHERE id = ".
 
 1630                        $ilDB->quote($a_news_id, 
"integer");
 
 1632                $rec = 
$ilDB->fetchAssoc($set);
 
 1634                return $rec[
"visibility"];
 
 1644                $query = 
"SELECT mob_id FROM il_news_item WHERE id = ".
 
 1645                        $ilDB->quote($a_news_id, 
"integer");
 
 1647                $rec = 
$ilDB->fetchAssoc($set);
 
 1648                return $rec[
"mob_id"];
 
 1654        static function filterObjIdsPerNews($a_obj_ids, $a_time_period = 0, $a_starting_date = 
"",$a_ending_date = 
'', $ignore_period = 
false)
 
 1659                if ($a_time_period > 0)
 
 1662                        $and = 
" AND creation_date >= ".$ilDB->quote($limit_ts, 
"timestamp").
" ";
 
 1665                if ($a_starting_date != 
"")
 
 1667                        $and.= 
" AND creation_date >= ".$ilDB->quote($a_starting_date, 
"timestamp");
 
 1670                $query = 
"SELECT DISTINCT(context_obj_id) AS obj_id FROM il_news_item".
 
 1671                        " WHERE ".$ilDB->in(
"context_obj_id", $a_obj_ids, 
false, 
"integer").
" ".$and;
 
 1676                while($rec = 
$ilDB->fetchAssoc($set))
 
 1678                        $objs[] = $rec[
"obj_id"];
 
 1688                $a_agg_ref_id = 0, $a_aggregation = 
"")
 
 1692                if ($a_agg_ref_id > 0)
 
 1694                        $cnt = count($a_aggregation);
 
 1697                        if ($a_context_obj_type == 
"frm")
 
 1701                                        return sprintf(
$lng->txt(
"news_x_postings"), $cnt);
 
 1705                                        return $lng->txt(
"news_1_postings");
 
 1710                                $up_cnt = $cr_cnt = 0;
 
 1711                                foreach($a_aggregation as $item)
 
 1713                                        if ($item[
"title"] == 
"file_updated")
 
 1725                                        $tit = 
$lng->txt(
"news_1_file_created");
 
 1728                                else if ($cr_cnt > 1)
 
 1730                                        $tit = 
sprintf(
$lng->txt(
"news_x_files_created"), $cr_cnt);
 
 1735                                        $tit .= $sep.$lng->txt(
"news_1_file_updated");
 
 1737                                else if ($up_cnt > 1)
 
 1739                                        $tit .= $sep.sprintf(
$lng->txt(
"news_x_files_updated"), $up_cnt);
 
 1746                        if ($a_content_is_lang_var)
 
 1748                                return $lng->txt($a_title);
 
 1768                        $lng->loadLanguageModule($a_context_obj_type);
 
 1783                $a_context_obj_type, $a_context_sub_obj_id = 
"", $a_context_sub_obj_type = 
"")
 
 1789                        "FROM il_news_item ".
 
 1791                                "context_obj_id = ".$ilDB->quote($a_context_obj_id, 
"integer").
 
 1792                                " AND context_obj_type = ".$ilDB->quote($a_context_obj_type, 
"text").
 
 1793                                " AND context_sub_obj_id = ".$ilDB->quote($a_context_sub_obj_id, 
"integer").
 
 1794                                " AND ".$ilDB->equals(
"context_sub_obj_type", $a_context_sub_obj_type, 
"text", 
true);
 
 1797                $rec = 
$ilDB->fetchAssoc($set);
 
 1806                $a_context_obj_type, $a_context_sub_obj_id = 
"", $a_context_sub_obj_type = 
"",
 
 1807                $a_only_today = 
false)
 
 1812                $query = 
"SELECT id, update_date ".
 
 1813                        "FROM il_news_item ".
 
 1815                                "context_obj_id = ".$ilDB->quote($a_context_obj_id, 
"integer").
 
 1816                                " AND context_obj_type = ".$ilDB->quote($a_context_obj_type, 
"text").
 
 1817                                " AND context_sub_obj_id = ".$ilDB->quote($a_context_sub_obj_id, 
"integer").
 
 1818                                " AND ".$ilDB->equals(
"context_sub_obj_type", $a_context_sub_obj_type, 
"text", 
true).
 
 1819                        " ORDER BY update_date DESC";
 
 1823                $rec = 
$ilDB->fetchAssoc($set);
 
 1825                $id = (int) $rec[
"id"];
 
 1829                        if (substr($now, 0, 10) != substr($rec[
"update_date"], 0, 10))
 
 1847                        "FROM il_news_item ".
 
 1849                                " mob_id = ".$ilDB->quote($a_mob_id, 
"integer");
 
 1853                while ($rec = 
$ilDB->fetchAssoc($set))
 
 1855                        $usages[$rec[
"id"]] = array(
"type" => 
"news", 
"id" => $rec[
"id"]);
 
 1869                        "FROM il_news_item ".
 
 1871                                " id = ".$ilDB->quote($a_news_id, 
"integer");
 
 1873                $rec = 
$ilDB->fetchAssoc($set);
 
 1875                return $rec[
"context_obj_id"];
 
 1881                $per = $news_set->get(
"pd_period");
 
 1893                $allow_shorter_periods = $news_set->get(
"allow_shorter_periods");
 
 1894                $allow_longer_periods = $news_set->get(
"allow_longer_periods");
 
 1897                include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
 
 1903                        (!$allow_shorter_periods && ($per < $default_per)) ||
 
 1904                        (!$allow_longer_periods && ($per > $default_per))
 
 1907                        $per = $default_per;
 
 1916                $rss_period = $news_set->get(
"rss_period");
 
 1917                if ($rss_period == 0)           
 
 1942                include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
 1947                if (!$mob->hasPurposeItem($a_purpose))
 
 1952                $m_item = $mob->getMediaItem($a_purpose);
 
 1953                if ($m_item->getLocationType() != 
"Reference")
 
 1955                    $file = $mob_dir.
"/".$m_item->getLocation();
 
 1958                        if ($a_increase_download_cnt)
 
 1973                        if ($a_increase_download_cnt)
 
 1994                $ilDB->manipulate(
"UPDATE il_news_item SET ".
 
 1995                        " mob_cnt_download = ".
$ilDB->quote($cnt, 
"integer").
 
 1996                        " WHERE id = ".$ilDB->quote($this->getId(), 
"integer")
 
 2013                $ilDB->manipulate(
"UPDATE il_news_item SET ".
 
 2014                        " mob_cnt_play = ".
$ilDB->quote($cnt, 
"integer").
 
 2015                        " WHERE id = ".$ilDB->quote($this->getId(), 
"integer")
 
 2030                $news_ids = array_keys(
$data);
 
 2031                $set = 
$ilDB->query(
"SELECT id FROM il_news_item ".
 
 2032                        " WHERE ".
$ilDB->in(
"id", $news_ids, 
false, 
"integer"));
 
 2033                $existing_ids = array();
 
 2034                while ($rec = 
$ilDB->fetchAssoc($set))
 
 2036                        $existing_ids[] = $rec[
"id"];
 
 2039                $existing_news = array();
 
 2040                foreach (
$data as $k => $v)
 
 2042                        if (in_array($k, $existing_ids))
 
 2044                                $existing_news[$k] = $v;
 
 2051                return $existing_news;
 
sprintf('%.4f', $callTime)
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
An exception for terminatinating execution or to throw for unit testing.
static _lookup($a_type, $a_setting, $a_user=0, $a_block_id=0)
Lookup setting from database.
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.
setContent($a_content)
Set Content.
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 getPrivateFeedId()
static _lookupRSSPeriod()
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.
setMobId($a_mob_id)
Set MobId.
getContentIsLangVar()
Get ContentIsLangVar.
static _setUnread($a_user_id, $a_news_id)
Set item unread.
setCreationDate($a_creation_date)
Set CreationDate.
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.
getUpdateDate()
Get UpdateDate.
static handleTimePeriod($a_time_period)
Convert time period for DB-queries.
getPlaytime()
Get Playtime.
aggregateForums($news, $a_group_posting_sequence=false)
setContentIsLangVar($a_content_is_lang_var=0)
Set ContentIsLangVar.
getContextSubObjId()
Get ContextSubObjId.
getContextSubObjType()
Get ContextSubObjType.
setUserId($a_user_id)
Set UserId.
setContextObjId($a_context_obj_id)
Set ContextObjId.
setContextSubObjId($a_context_sub_obj_id)
Set ContextSubObjId.
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, $a_limit=0, $a_excluded=array())
Get News For Ref Id.
increasePlayCounter()
Increase play counter.
setLimitation($a_limitation)
Set Limitation for number of items.
increaseDownloadCounter()
Increase download counter.
static _setRead($a_user_id, $a_news_id)
Set item read.
queryNewsForMultipleContexts($a_contexts, $a_for_rss_use=false, $a_time_period=0, $a_starting_date="", $a_no_auto_generated=false, $a_user_id=null, $a_limit=0, $a_exclude=array())
Query News for multiple Contexts.
getVisibility()
Get Visibility.
static filterObjIdsPerNews($a_obj_ids, $a_time_period=0, $a_starting_date="", $a_ending_date='', $ignore_period=false)
Checks whether news are available for.
setUpdateDate($a_update_date)
Set UpdateDate.
static determineNewsContent($a_context_obj_type, $a_content, $a_is_lang_var)
Determine new content.
setTitle($a_title)
Set Title.
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)
static prepareNewsDataFromCache($a_cres)
Prepare news data from cache.
getContentType()
Get ContentType.
setUpdateUserId($a_val)
Set update user id.
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.
setPlaytime($a_playtime)
Set Playtime.
static _lookupUserPDPeriod($a_user_id)
setContextObjType($a_context_obj_type)
Set ContextObjType.
setPriority($a_priority=1)
Set Priority.
setContentLong($a_content_long)
Set ContentLong.
static setPrivateFeedId($a_userId)
getContentLong()
Get ContentLong.
static mergeNews($n1, $n2)
Merges two sets of news.
static _lookupDefaultPDPeriod()
setContentTextIsLangVar($a_val=0)
Set content text ist lang var.
getPriority()
Get Priority.
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.
setVisibility($a_visibility="users")
Set Visibility.
getContextObjId()
Get ContextObjId.
setContentType($a_content_type="text")
Set ContentType.
getMobPlayCounter()
Get mob play counter.
setContextSubObjType($a_context_sub_obj_type)
Set ContextSubObjType.
setContentHtml($a_val)
Is content HTML (tiny used?)
getMobDownloadCounter()
Get mob download counter.
setMobDownloadCounter($a_val)
Set mob download counter.
getCreationDate()
Get CreationDate.
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.
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, $a_limit=0, $a_exclude=array())
Get news aggregation (e.g.
getContextObjType()
Get ContextObjType.
getUpdateUserId()
Get update user id.
getContentHtml()
Get content as html.
static _lookupMediaObjectUsages($a_mob_id)
Lookup media object usage(s)
static _getSubscriptionsOfUser($a_user_id)
Get subscriptions of user.
static _lookupPref($a_usr_id, $a_keyword)
static _lookupDesktopItems($user_id, $a_types="")
get all desktop items of user and specified type
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.
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file