4 define(
"NEWS_NOTICE", 0);
5 define(
"NEWS_MESSAGE", 1);
6 define(
"NEWS_WARNING", 2);
8 define(
"NEWS_TEXT",
"text");
9 define(
"NEWS_HTML",
"html");
10 define(
"NEWS_AUDIO",
"audio");
11 define(
"NEWS_USERS",
"users");
12 define(
"NEWS_PUBLIC",
"public");
103 $this->db = $DIC->database();
104 $this->tree = $DIC->repositoryTree();
105 $this->access = $DIC->access();
106 $this->obj_data_cache = $DIC[
"ilObjDataCache"];
107 $this->
user = $DIC->user();
108 $this->lng = $DIC->language();
109 $this->ctrl = $DIC->ctrl();
114 $this->limitation =
true;
144 $this->title = $a_title;
184 $this->context_obj_id = $a_context_obj_id;
204 $this->context_obj_type = $a_context_obj_type;
224 $this->context_sub_obj_id = $a_context_sub_obj_id;
244 $this->context_sub_obj_type = $a_context_sub_obj_type;
264 $this->content_type = $a_content_type;
284 $this->creation_date = $a_creation_date;
304 $this->update_date = $a_update_date;
324 $this->user_id = $a_user_id;
344 $this->update_user_id = $a_val;
364 $this->visibility = $a_visibility;
384 $this->content_long = $a_content_long;
404 $this->priority = $a_priority;
424 $this->content_is_lang_var = $a_content_is_lang_var;
444 $this->mob_id = $a_mob_id;
464 $this->playtime = $a_playtime;
485 $this->limitation = $a_limitation;
505 $this->content_text_is_lang_var = $a_val;
515 return $this->content_text_is_lang_var;
525 $this->mob_cnt_play = $a_val;
535 return $this->mob_cnt_play;
545 $this->mob_cnt_download = $a_val;
555 return $this->mob_cnt_download;
565 $this->content_html = $a_val;
585 $query =
"SELECT * FROM il_news_item WHERE id = " .
588 $rec =
$ilDB->fetchAssoc($set);
647 $max_items = $news_set->get(
"max_items");
648 if ($max_items <= 0) {
655 $query =
"SELECT count(*) cnt " .
656 "FROM il_news_item " .
664 $rec =
$ilDB->fetchAssoc($set);
669 "FROM il_news_item " .
675 " ORDER BY creation_date ASC";
677 $ilDB->setLimit($rec[
"cnt"] - $max_items);
679 while ($del_item =
$ilDB->fetchAssoc($del_set)) {
692 public function update($a_as_new =
false)
720 $fields[
"creation_date"] =
array(
"timestamp", $now);
721 $fields[
"update_date"] =
array(
"timestamp", $now);
723 $fields[
"update_date"] =
array(
"timestamp", $now);
737 $a_only_public =
false,
738 $a_prevent_aggregation =
false,
744 $ilAccess = $DIC->access();
751 include_once(
"./Services/News/classes/class.ilNewsSubscription.php");
752 include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
760 foreach ($pd_items as $item) {
761 if (!in_array($item[
"ref_id"], $ref_ids)) {
762 $ref_ids[] = $item[
"ref_id"];
767 include_once
'Services/Membership/classes/class.ilParticipants.php';
770 $items = array_merge($crs_mbs, $grp_mbs);
771 foreach ($items as
$i) {
773 if (is_array($item_references) && count($item_references)) {
774 foreach ($item_references as $ref_id) {
775 if (!in_array($ref_id, $ref_ids)) {
776 $ref_ids[] = $ref_id;
785 foreach ($ref_ids as $ref_id) {
786 if (!$a_only_public) {
788 $acc = $ilAccess->checkAccessOfUser($a_user_id,
"read",
"", $ref_id);
797 $rbacsystem = $DIC->rbac()->system();
807 $news = $news_item->getNewsForRefId(
812 $a_prevent_aggregation,
820 if (!is_null($a_cnt)) {
821 $a_cnt[$ref_id] = count($news);
850 $a_only_public =
false,
851 $a_stopnesting =
false,
853 $a_prevent_aggregation =
true,
854 $a_forum_group_sequences =
false,
855 $a_no_auto_generated =
false,
856 $a_ignore_date_filter =
false,
859 $a_excluded =
array()
866 if ($obj_type ==
"grp" || $obj_type ==
"crs" || $obj_type ==
"cat") {
867 include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
870 "hide_news_per_date",
874 if ($hide_news_per_date && !$a_ignore_date_filter) {
884 if ($obj_type ==
"cat" && !$a_stopnesting) {
889 $a_prevent_aggregation,
893 } elseif (($obj_type ==
"grp" || $obj_type ==
"crs") &&
899 $a_prevent_aggregation,
901 $a_no_auto_generated,
908 $news_item->setContextObjId($obj_id);
909 $news_item->setContextObjType($obj_type);
910 $news = $news_item->queryNewsForContext(
917 foreach ($news as $k => $v) {
918 if (!$a_only_public || $v[
"visibility"] ==
NEWS_PUBLIC ||
919 ($v[
"priority"] == 0 &&
922 "public_notifications",
926 $news[$k][
"ref_id"] = $a_ref_id;
931 foreach ($unset as $un) {
936 if (!$a_prevent_aggregation) {
938 } elseif ($a_forum_group_sequences) {
950 $a_only_public =
false,
952 $a_prevent_aggregation =
false,
953 $a_starting_date =
"",
954 $a_no_auto_generated =
false,
968 $cur_node =
$tree->getNodeData($a_ref_id);
972 $nodes = (
array)
$tree->getSubTree($cur_node,
true);
980 foreach ($nodes as $node) {
981 $ref_ids[] = $node[
"child"];
982 $obj_ids[] = $node[
"obj_id"];
985 $ilObjDataCache->preloadReferenceCache($ref_ids);
986 if (!$a_only_public) {
987 include_once
"Services/Object/classes/class.ilObjectActivation.php";
997 foreach ($nodes as $node) {
999 if (!in_array($node[
"obj_id"], $news_obj_ids)) {
1003 if (!$a_only_public) {
1005 $acc = $ilAccess->checkAccess(
"read",
"", $node[
"child"]);
1007 $acc = $ilAccess->checkAccessOfUser(
1019 $ref_id[$node[
"obj_id"]] = $node[
"child"];
1020 $contexts[] =
array(
"obj_id" => $node[
"obj_id"],
1021 "obj_type" => $node[
"type"]);
1030 $a_no_auto_generated,
1037 foreach ($news as $k => $v) {
1038 $news[$k][
"ref_id"] = $ref_id[$v[
"context_obj_id"]];
1044 if (!$a_prevent_aggregation) {
1057 foreach ($news as $k => $v) {
1058 if ($a_group_posting_sequence && $last_aggregation_forum > 0 &&
1059 $last_aggregation_forum != $news[$k][
"context_obj_id"]) {
1060 $forums[$last_aggregation_forum] =
"";
1063 if ($news[$k][
"context_obj_type"] ==
"frm") {
1064 if ($forums[$news[$k][
"context_obj_id"]] ==
"") {
1066 $forums[$news[$k][
"context_obj_id"]] = $k;
1067 $last_aggregation_forum = $news[$k][
"context_obj_id"];
1072 $news[$k][
"no_context_title"] =
true;
1075 $news[$forums[$news[$k][
"context_obj_id"]]][
"aggregation"][$k]
1077 $news[$k][
"agg_ref_id"]
1078 = $news[$k][
"ref_id"];
1079 $news[$k][
"content"] =
"";
1080 $news[$k][
"content_long"] =
"";
1085 foreach ($to_del as $k) {
1098 foreach ($news as $k => $v) {
1100 if ($news[$k][
"context_obj_type"] ==
"file") {
1101 if ($first_file ==
"") {
1106 $news[$first_file][
"aggregation"][$k] = $news[$k];
1107 $news[$first_file][
"agg_ref_id"] = $a_ref_id;
1108 $news[$first_file][
"ref_id"] = $a_ref_id;
1112 foreach ($to_del as $v) {
1125 $a_only_public =
false,
1127 $a_prevent_aggregation =
false,
1128 $a_starting_date =
"",
1129 $a_no_auto_generated =
false 1143 $a_no_auto_generated
1145 foreach (
$data as $k => $v) {
1146 $data[$k][
"ref_id"] = $a_ref_id;
1150 $nodes =
$tree->getChilds($a_ref_id);
1154 foreach ($nodes as $node) {
1155 $obj_ids[] = $node[
"obj_id"];
1161 $contexts =
array();
1162 foreach ($nodes as $node) {
1164 if (!in_array($node[
"obj_id"], $news_obj_ids)) {
1168 if (!$a_only_public && !$ilAccess->checkAccess(
"read",
"", $node[
"child"])) {
1171 $ref_id[$node[
"obj_id"]] = $node[
"child"];
1172 $contexts[] =
array(
"obj_id" => $node[
"obj_id"],
1173 "obj_type" => $node[
"type"]);
1181 $a_no_auto_generated
1183 foreach ($news as $k => $v) {
1184 $news[$k][
"ref_id"] = $ref_id[$v[
"context_obj_id"]];
1191 if (!$a_prevent_aggregation) {
1201 public function setContext($a_obj_id, $a_obj_type, $a_sub_obj_id = 0, $a_sub_obj_type =
"")
1218 if (is_numeric($a_time_period)) {
1219 if ($a_time_period > 0) {
1220 return date(
'Y-m-d H:i:s',
time() - ($a_time_period * 24 * 60 * 60));
1224 elseif (preg_match(
"/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/", $a_time_period)) {
1225 return $a_time_period;
1239 $a_for_rss_use =
false,
1241 $a_starting_date =
"",
1242 $a_no_auto_generated =
false,
1243 $a_oldest_first =
false,
1251 if ($a_time_period > 0) {
1252 $limit_ts = self::handleTimePeriod($a_time_period);
1253 $and =
" AND creation_date >= " .
$ilDB->quote($limit_ts,
"timestamp") .
" ";
1256 if ($a_starting_date !=
"") {
1257 $and.=
" AND creation_date > " .
$ilDB->quote($a_starting_date,
"timestamp") .
" ";
1260 if ($a_no_auto_generated) {
1261 $and.=
" AND priority = 1 AND content_type = " .
$ilDB->quote(
"text",
"text") .
" ";
1270 $ordering = ($a_oldest_first)
1271 ?
" creation_date ASC, id ASC " 1272 :
" creation_date DESC, id DESC ";
1276 "FROM il_news_item " .
1281 " ORDER BY " . $ordering;
1283 $query =
"SELECT il_news_item.* " .
1284 ", il_news_read.user_id user_read " .
1285 "FROM il_news_item LEFT JOIN il_news_read " .
1286 "ON il_news_item.id = il_news_read.news_id AND " .
1292 " ORDER BY " . $ordering;
1294 $query =
"SELECT il_news_item.* " .
1295 ", il_news_read.user_id as user_read " .
1296 "FROM il_news_item LEFT JOIN il_news_read " .
1297 "ON il_news_item.id = il_news_read.news_id AND " .
1298 " il_news_read.user_id = " .
$ilDB->quote(
$ilUser->getId(),
"integer") .
1300 "context_obj_id = " .
$ilDB->quote($this->getContextObjId(),
"integer") .
1301 " AND context_obj_type = " .
$ilDB->quote($this->getContextObjType(),
"text") .
1303 " ORDER BY " . $ordering;
1308 while ($rec =
$ilDB->fetchAssoc($set)) {
1309 if ($a_limit > 0 && count(
$result) >= $a_limit) {
1313 ($rec[
"priority"] == 0 &&
1316 "public_notifications",
1318 $rec[
"context_obj_id"]
1329 if ($a_time_period !=
"" && $a_for_rss_use) {
1330 include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
1337 if ($keep_rss_min > 0) {
1342 $a_no_auto_generated,
1366 if (!
$tree->isDeleted($a_ref_id)) {
1369 $node =
$tree->getNodeData($a_ref_id);
1370 foreach (
$tree->getSubTree($node) as $child) {
1371 if ($child[
"type"] !=
"rolf") {
1372 $nodes[$child[
"obj_id"]] = $child[
"type"];
1376 $limit_ts = self::handleTimePeriod($a_time_period);
1379 $query =
$ilDB->query(
"SELECT id,context_obj_id,context_obj_type" .
1380 " FROM il_news_item" .
1381 " WHERE " .
$ilDB->in(
"context_obj_id", array_keys($nodes),
false,
"integer") .
1382 " AND creation_date >= " .
$ilDB->quote($limit_ts,
"timestamp"));
1384 if ($nodes[$rec[
"context_obj_id"]] == $rec[
"context_obj_type"]) {
1385 $all[] = $rec[
"id"];
1408 $a_for_rss_use =
false,
1410 $a_starting_date =
"",
1411 $a_no_auto_generated =
false,
1414 $a_exclude =
array()
1422 if ($a_time_period > 0) {
1423 $limit_ts = self::handleTimePeriod($a_time_period);
1424 $and =
" AND creation_date >= " .
$ilDB->quote($limit_ts,
"timestamp") .
" ";
1427 if ($a_starting_date !=
"") {
1428 $and.=
" AND creation_date > " .
$ilDB->quote($a_starting_date,
"timestamp") .
" ";
1431 if ($a_no_auto_generated) {
1432 $and.=
" AND priority = 1 AND content_type = " .
$ilDB->quote(
"text",
"text") .
" ";
1436 $ilDB->setLimit($a_limit, 0);
1439 if (is_array($a_exclude) && count($a_exclude) > 0) {
1440 $and.=
" AND " .
$ilDB->in(
"id", $a_exclude,
true,
"integer") .
" ";
1446 foreach ($a_contexts as $cont) {
1447 $ids[] = $cont[
"obj_id"];
1448 $type[$cont[
"obj_id"]] = $cont[
"obj_type"];
1453 "FROM il_news_item " .
1455 $ilDB->in(
"context_obj_id", $ids,
false,
"integer") .
" " .
1457 " ORDER BY creation_date DESC ";
1459 $query =
"SELECT il_news_item.* " .
1460 ", il_news_read.user_id as user_read " .
1461 "FROM il_news_item LEFT JOIN il_news_read " .
1462 "ON il_news_item.id = il_news_read.news_id AND " .
1465 $ilDB->in(
"context_obj_id", $ids,
false,
"integer") .
" " .
1467 " ORDER BY creation_date DESC ";
1474 $query =
"SELECT il_news_item.* " .
1475 ", il_news_read.user_id as user_read " .
1476 "FROM il_news_item LEFT JOIN il_news_read " .
1477 "ON il_news_item.id = il_news_read.news_id AND " .
1478 " il_news_read.user_id = " .
$ilDB->quote(
$user_id,
"integer") .
1480 $ilDB->in(
"context_obj_id", $ids,
false,
"integer") .
" " .
1482 " ORDER BY creation_date DESC ";
1487 while ($rec =
$ilDB->fetchAssoc($set)) {
1488 if (
$type[$rec[
"context_obj_id"]] == $rec[
"context_obj_type"]) {
1490 ($rec[
"priority"] == 0 &&
1493 "public_notifications",
1495 $rec[
"context_obj_id"]
1509 public static function _setRead($a_user_id, $a_news_id)
1513 $ilDB = $DIC->database();
1514 $ilAppEventHandler = $DIC[
"ilAppEventHandler"];
1519 "user_id" =>
array(
"integer", $a_user_id),
1520 "news_id" =>
array(
"integer", $a_news_id)
1533 $ilAppEventHandler->raise(
1536 array(
"user_id" => $a_user_id,
"news_ids" =>
array($a_news_id))
1547 $ilDB = $DIC->database();
1548 $ilAppEventHandler = $DIC[
"ilAppEventHandler"];
1550 $ilDB->manipulate(
"DELETE FROM il_news_read (user_id, news_id) VALUES (" .
1551 " WHERE user_id = " .
$ilDB->quote($a_user_id,
"integer") .
1552 " AND news_id = " .
$ilDB->quote($a_news_id,
"integer"));
1554 $ilAppEventHandler->raise(
1557 array(
"user_id" => $a_user_id,
"news_ids" =>
array($a_news_id))
1571 foreach ($n2 as
$id => $news) {
1587 $tree = $DIC->repositoryTree();
1590 include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
1593 $default_visibility = ($news_set->get(
"default_visibility") !=
"")
1594 ? $news_set->get(
"default_visibility")
1597 if (
$tree->isInTree($a_ref_id)) {
1601 if (!in_array(
$row[
"type"],
array(
"root",
"cat",
"crs",
"fold",
"grp"))) {
1607 "default_visibility",
1618 return $default_visibility;
1626 public function delete()
1631 $ilDB->manipulate(
"DELETE FROM il_news_read " .
1632 " WHERE news_id = " .
$ilDB->quote($this->getId(),
"integer"));
1638 $query =
"DELETE FROM il_news_item" .
1639 " WHERE id = " .
$ilDB->quote($this->
getId(),
"integer");
1644 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1656 $a_context_obj_type,
1657 $a_context_sub_obj_id = 0,
1658 $a_context_sub_obj_type =
"" 1662 $ilDB = $DIC->database();
1664 if ($a_context_obj_id == 0 || $a_context_obj_type ==
"") {
1668 if ($a_context_sub_obj_id > 0) {
1669 $and =
" AND context_sub_obj_id = " .
$ilDB->quote($a_context_sub_obj_id,
"integer") .
1670 " AND context_sub_obj_type = " .
$ilDB->quote($a_context_sub_obj_type,
"text");
1674 $query =
"SELECT * FROM il_news_item" .
1675 " WHERE context_obj_id = " .
$ilDB->quote($a_context_obj_id,
"integer") .
1676 " AND context_obj_type = " .
$ilDB->quote($a_context_obj_type,
"text") .
1681 while ($news =
$ilDB->fetchAssoc($news_set)) {
1683 $news_obj->delete();
1694 $ilDB = $DIC->database();
1696 $query =
"SELECT title FROM il_news_item WHERE id = " .
1697 $ilDB->quote($a_news_id,
"integer");
1699 $rec =
$ilDB->fetchAssoc($set);
1700 return $rec[
"title"];
1710 $ilDB = $DIC->database();
1712 $query =
"SELECT visibility FROM il_news_item WHERE id = " .
1713 $ilDB->quote($a_news_id,
"integer");
1715 $rec =
$ilDB->fetchAssoc($set);
1717 return $rec[
"visibility"];
1727 $ilDB = $DIC->database();
1729 $query =
"SELECT mob_id FROM il_news_item WHERE id = " .
1730 $ilDB->quote($a_news_id,
"integer");
1732 $rec =
$ilDB->fetchAssoc($set);
1733 return $rec[
"mob_id"];
1739 public static function filterObjIdsPerNews($a_obj_ids, $a_time_period = 0, $a_starting_date =
"", $a_ending_date =
'', $ignore_period =
false)
1743 $ilDB = $DIC->database();
1746 if ($a_time_period > 0) {
1747 $limit_ts = self::handleTimePeriod($a_time_period);
1748 $and =
" AND creation_date >= " .
$ilDB->quote($limit_ts,
"timestamp") .
" ";
1751 if ($a_starting_date !=
"") {
1752 $and.=
" AND creation_date >= " .
$ilDB->quote($a_starting_date,
"timestamp");
1755 $query =
"SELECT DISTINCT(context_obj_id) AS obj_id FROM il_news_item" .
1756 " WHERE " .
$ilDB->in(
"context_obj_id", $a_obj_ids,
false,
"integer") .
" " . $and;
1761 while ($rec =
$ilDB->fetchAssoc($set)) {
1762 $objs[] = $rec[
"obj_id"];
1772 $a_context_obj_type,
1774 $a_content_is_lang_var,
1780 $lng = $DIC->language();
1782 if ($a_agg_ref_id > 0) {
1783 $cnt = count($a_aggregation);
1786 if ($a_context_obj_type ==
"frm") {
1788 return sprintf(
$lng->txt(
"news_x_postings"), $cnt);
1790 return $lng->txt(
"news_1_postings");
1793 $up_cnt = $cr_cnt = 0;
1794 foreach ($a_aggregation as $item) {
1795 if ($item[
"title"] ==
"file_updated") {
1803 $tit =
$lng->txt(
"news_1_file_created");
1805 } elseif ($cr_cnt > 1) {
1806 $tit = sprintf(
$lng->txt(
"news_x_files_created"), $cr_cnt);
1810 $tit .= $sep .
$lng->txt(
"news_1_file_updated");
1811 } elseif ($up_cnt > 1) {
1812 $tit .= $sep . sprintf(
$lng->txt(
"news_x_files_updated"), $up_cnt);
1817 if ($a_content_is_lang_var) {
1818 return $lng->txt($a_title);
1834 $lng = $DIC->language();
1836 if ($a_is_lang_var) {
1837 $lng->loadLanguageModule($a_context_obj_type);
1851 $a_context_obj_type,
1852 $a_context_sub_obj_id =
"",
1853 $a_context_sub_obj_type =
"" 1857 $ilDB = $DIC->database();
1861 "FROM il_news_item " .
1863 "context_obj_id = " .
$ilDB->quote($a_context_obj_id,
"integer") .
1864 " AND context_obj_type = " .
$ilDB->quote($a_context_obj_type,
"text") .
1865 " AND context_sub_obj_id = " .
$ilDB->quote($a_context_sub_obj_id,
"integer") .
1866 " AND " .
$ilDB->equals(
"context_sub_obj_type", $a_context_sub_obj_type,
"text",
true);
1869 $rec =
$ilDB->fetchAssoc($set);
1879 $a_context_obj_type,
1880 $a_context_sub_obj_id =
"",
1881 $a_context_sub_obj_type =
"",
1882 $a_only_today =
false 1886 $ilDB = $DIC->database();
1889 $query =
"SELECT id, update_date " .
1890 "FROM il_news_item " .
1892 "context_obj_id = " .
$ilDB->quote($a_context_obj_id,
"integer") .
1893 " AND context_obj_type = " .
$ilDB->quote($a_context_obj_type,
"text") .
1894 " AND context_sub_obj_id = " .
$ilDB->quote($a_context_sub_obj_id,
"integer") .
1895 " AND " .
$ilDB->equals(
"context_sub_obj_type", $a_context_sub_obj_type,
"text",
true) .
1896 " ORDER BY update_date DESC";
1900 $rec =
$ilDB->fetchAssoc($set);
1902 $id = (int) $rec[
"id"];
1903 if ($a_only_today) {
1905 if (substr($now, 0, 10) != substr($rec[
"update_date"], 0, 10)) {
1921 $ilDB = $DIC->database();
1924 "FROM il_news_item " .
1926 " mob_id = " .
$ilDB->quote($a_mob_id,
"integer");
1930 while ($rec =
$ilDB->fetchAssoc($set)) {
1931 $usages[$rec[
"id"]] =
array(
"type" =>
"news",
"id" => $rec[
"id"]);
1944 $ilDB = $DIC->database();
1947 "FROM il_news_item " .
1949 " id = " .
$ilDB->quote($a_news_id,
"integer");
1951 $rec =
$ilDB->fetchAssoc($set);
1953 return $rec[
"context_obj_id"];
1959 $per = $news_set->get(
"pd_period");
1970 $allow_shorter_periods = $news_set->get(
"allow_shorter_periods");
1971 $allow_longer_periods = $news_set->get(
"allow_longer_periods");
1974 include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
1984 (!$allow_shorter_periods && ($per < $default_per)) ||
1985 (!$allow_longer_periods && ($per > $default_per))
1987 $per = $default_per;
1996 $rss_period = $news_set->get(
"rss_period");
1997 if ($rss_period == 0) {
2018 public function deliverMobFile($a_purpose =
"Standard", $a_increase_download_cnt =
false)
2021 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
2026 if (!$mob->hasPurposeItem($a_purpose)) {
2030 $m_item = $mob->getMediaItem($a_purpose);
2031 if ($m_item->getLocationType() !=
"Reference") {
2032 $file = $mob_dir .
"/" . $m_item->getLocation();
2034 if ($a_increase_download_cnt) {
2044 if ($a_increase_download_cnt) {
2065 "UPDATE il_news_item SET " .
2066 " mob_cnt_download = " .
$ilDB->quote($cnt,
"integer") .
2067 " WHERE id = " .
$ilDB->quote($this->
getId(),
"integer")
2085 "UPDATE il_news_item SET " .
2086 " mob_cnt_play = " .
$ilDB->quote($cnt,
"integer") .
2087 " WHERE id = " .
$ilDB->quote($this->
getId(),
"integer")
2101 $ilDB = $DIC->database();
2104 $news_ids = array_keys(
$data);
2105 $set =
$ilDB->query(
"SELECT id FROM il_news_item " .
2106 " WHERE " .
$ilDB->in(
"id", $news_ids,
false,
"integer"));
2107 $existing_ids =
array();
2108 while ($rec =
$ilDB->fetchAssoc($set)) {
2109 $existing_ids[] = $rec[
"id"];
2112 $existing_news =
array();
2113 foreach (
$data as $k => $v) {
2114 if (in_array($k, $existing_ids)) {
2115 $existing_news[$k] = $v;
2122 return $existing_news;
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
getContentHtml()
Get content as html.
setContentTextIsLangVar($a_val=0)
Set content text ist lang var.
setContext($a_obj_id, $a_obj_type, $a_sub_obj_id=0, $a_sub_obj_type="")
Convenient function to set the whole context information.
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.
static _lookupRSSPeriod()
setVisibility($a_visibility="users")
Set Visibility.
setContextSubObjId($a_context_sub_obj_id)
Set ContextSubObjId.
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
static _setUnread($a_user_id, $a_news_id)
Set item unread.
static handleTimePeriod($a_time_period)
Convert time period for DB-queries.
setContextSubObjType($a_context_sub_obj_type)
Set ContextSubObjType.
getContentType()
Get ContentType.
increaseDownloadCounter()
Increase download counter.
static _lookupUserPDPeriod($a_user_id)
getPriority()
Get Priority.
static _getMembershipByType($a_usr_id, $a_type, $a_only_member_role=false)
get membership by type Get course or group membership
setCreationDate($a_creation_date)
Set CreationDate.
getPlaytime()
Get Playtime.
read()
Read item from database.
static _lookupVisibility($a_news_id)
Lookup News Visibility.
setTitle($a_title)
Set Title.
__construct($a_id=0)
Constructor.
static mergeNews($n1, $n2)
Merges two sets of news.
static prepareNewsDataFromCache($a_cres)
Prepare news data from cache.
getCreationDate()
Get CreationDate.
getContentTextIsLangVar()
Get content text ist lang var.
getContentLong()
Get ContentLong.
getContextObjType()
Get ContextObjType.
static now()
Return current timestamp in Y-m-d H:i:s format.
setPriority($a_priority=1)
Set Priority.
getContextSubObjType()
Get ContextSubObjType.
static _getAllReferences($a_id)
get all reference ids of object
getMobDownloadCounter()
Get mob download counter.
static _lookupTitle($a_news_id)
Lookup News Title.
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)
Query news for a context.
setContentIsLangVar($a_content_is_lang_var=0)
Set ContentIsLangVar.
setContent($a_content)
Set Content.
static _lookupMobId($a_news_id)
Lookup mob id.
getContentIsLangVar()
Get ContentIsLangVar.
static _getSubscriptionsOfUser($a_user_id)
Get subscriptions of user.
setContextObjId($a_context_obj_id)
Set ContextObjId.
setUpdateUserId($a_val)
Set update user id.
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.
static _lookupMediaObjectUsages($a_mob_id)
Lookup media object usage(s)
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.
static determineNewsContent($a_context_obj_type, $a_content, $a_is_lang_var)
Determine new content.
aggregateForums($news, $a_group_posting_sequence=false)
static _setRead($a_user_id, $a_news_id)
Set item read.
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.
static _lookupObjId($a_id)
setLimitation($a_limitation)
Set Limitation for number of items.
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
static _lookup($a_type, $a_setting, $a_user=0, $a_block_id=0)
Lookup setting from database.
setMobDownloadCounter($a_val)
Set mob download counter.
getUpdateDate()
Get UpdateDate.
deliverMobFile($a_purpose="Standard", $a_increase_download_cnt=false)
Deliver mob file.
static preloadData(array $a_ref_ids)
Preload data to internal cache.
update($a_as_new=false)
Update item in database.
setUserId($a_user_id)
Set UserId.
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
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.
getLimitation()
Get Limitation for number of items.
getContextSubObjId()
Get ContextSubObjId.
getVisibility()
Get Visibility.
setContentType($a_content_type="text")
Set ContentType.
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.
getMobPlayCounter()
Get mob play counter.
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 _lookupDesktopItems($user_id, $a_types="")
get all desktop items of user and specified type
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.
static getPrivateFeedId()
static _lookupPref($a_usr_id, $a_keyword)
setContentHtml($a_val)
Is content HTML (tiny used?)
setMobId($a_mob_id)
Set MobId.
setContentLong($a_content_long)
Set ContentLong.
static _getDefaultVisibilityForRefId($a_ref_id)
Get default visibility for reference id.
static _lookupContextObjId($a_news_id)
Context Object ID.
setContextObjType($a_context_obj_type)
Set ContextObjType.
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 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.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
checkNewsExistsForGroupCourse($a_ref_id, $a_time_period=1)
setPlaytime($a_playtime)
Set Playtime.
static redirect($a_script)
setUpdateDate($a_update_date)
Set UpdateDate.
getUpdateUserId()
Get update user id.
static _lookupDefaultPDPeriod()
setMobPlayCounter($a_val)
Set mob play counter.
increasePlayCounter()
Increase play counter.
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
static setPrivateFeedId($a_userId)
aggregateFiles($news, $a_ref_id)
getContextObjId()
Get ContextObjId.