3 declare(strict_types=1);
    41     public function setTitle(
string $a_title): void
    43         $this->title = $a_title;
    63         $this->created = $a_date;
    73         $this->author = $a_id;
    83         $this->approved = $a_status;
    97         $this->withdrawn = $a_date;
   112         bool $a_import = 
false   116         $id = 
$ilDB->nextId(
"il_blog_posting");
   127         $query = 
"INSERT INTO il_blog_posting (id, title, blog_id, created, author, approved, last_withdrawn)" .
   129             $ilDB->quote($this->
getId(), 
"integer") . 
"," .
   132             $ilDB->quote($created, 
"timestamp") . 
"," .
   135             $ilDB->quote($withdrawn, 
"timestamp") . 
")";
   136         $ilDB->manipulate($query);
   139             parent::create($a_import);
   145         bool $a_validate = 
true,
   146         bool $a_no_history = 
false,
   147         bool $a_notify = 
true,
   148         string $a_notify_action = 
"update"   154         $query = 
"UPDATE il_blog_posting SET" .
   158             ",last_withdrawn =" . 
$ilDB->quote($withdrawn, 
"timestamp") .
   159             " WHERE id = " . 
$ilDB->quote($this->
getId(), 
"integer");
   160         $ilDB->manipulate($query);
   162         $ret = parent::update($a_validate, $a_no_history);
   178         $query = 
"SELECT * FROM il_blog_posting" .
   179             " WHERE id = " . 
$ilDB->quote($this->
getId(), 
"integer");
   180         $set = 
$ilDB->query($query);
   181         $rec = 
$ilDB->fetchAssoc($set);
   187         if ($rec[
"approved"]) {
   201             $this->approved = 
false;
   209     public function delete(): 
void   220         $query = 
"DELETE FROM il_blog_posting" .
   221             " WHERE id = " . 
$ilDB->quote($this->
getId(), 
"integer");
   222         $ilDB->manipulate($query);
   235         $this->
update(
true, 
false, 
false);
   254         $ilDB = $DIC->database();
   256         $query = 
"SELECT * FROM il_blog_posting" .
   257             " WHERE blog_id = " . 
$ilDB->quote($a_blog_id, 
"integer");
   258         $set = 
$ilDB->query($query);
   259         while ($rec = 
$ilDB->fetchAssoc($set)) {
   261             $md_obj = 
new ilMD($a_blog_id, $rec[
"id"], 
"blp");
   262             if (is_object($md_section = $md_obj->getGeneral())) {
   263                 foreach ($md_section->getKeywordIds() as 
$id) {
   264                     $md_key = $md_section->getKeyword(
$id);
   279         $ilDB = $DIC->database();
   281         $query = 
"SELECT blog_id FROM il_blog_posting" .
   282             " WHERE id = " . 
$ilDB->quote($a_posting_id, 
"integer");
   283         $set = 
$ilDB->query($query);
   284         if ($rec = 
$ilDB->fetchAssoc($set)) {
   285             return (
int) $rec[
"blog_id"];
   300         $ilDB = $DIC->database();
   302         $pages = parent::getAllPages(
"blp", $a_blog_id);
   305             $ilDB->setLimit($a_limit, $a_offset);
   308         $query = 
"SELECT * FROM il_blog_posting" .
   309             " WHERE blog_id = " . 
$ilDB->quote($a_blog_id, 
"integer") .
   310             " ORDER BY created DESC";
   311         $set = 
$ilDB->query($query);
   313         while ($rec = 
$ilDB->fetchAssoc($set)) {
   314             if (isset($pages[$rec[
"id"]])) {
   315                 $post[$rec[
"id"]] = $pages[$rec[
"id"]];
   316                 $post[$rec[
"id"]][
"title"] = $rec[
"title"];
   318                 $post[$rec[
"id"]][
"author"] = $rec[
"author"];
   319                 $post[$rec[
"id"]][
"approved"] = (bool) $rec[
"approved"];
   322                 foreach (self::getPageContributors(
"blp", $rec[
"id"]) as $editor) {
   323                     if ($editor[
"user_id"] != $rec[
"author"]) {
   324                         $post[$rec[
"id"]][
"editors"][] = $editor[
"user_id"];
   342         $ilDB = $DIC->database();
   344         $query = 
"SELECT id FROM il_blog_posting" .
   345             " WHERE blog_id = " . 
$ilDB->quote($a_blog_id, 
"integer") .
   346             " AND id = " . 
$ilDB->quote($a_posting_id, 
"integer");
   347         $set = 
$ilDB->query($query);
   348         if ($rec = 
$ilDB->fetchAssoc($set)) {
   360         $data = self::getAllPostings($a_blog_id, 1);
   362             $keys = array_keys(
$data);
   373         bool $a_is_in_workspace = 
false   375         $this->blog_node_id = $a_id;
   376         $this->blog_node_is_wsp = $a_is_in_workspace;
   387         $ilDB = $DIC->database();
   391         $sql = 
"SELECT DISTINCT(blog_id)" .
   392             " FROM il_blog_posting" .
   393             " WHERE author = " . 
$ilDB->quote($a_user_id);
   394         $set = 
$ilDB->query($sql);
   395         while ($row = 
$ilDB->fetchAssoc($set)) {
   396             $ids[] = (
int) $row[
"blog_id"];
   406         $snippet = str_replace(array(
'<br/>', 
'<br />', 
'</p>', 
'</div>'), 
"\n", $snippet);
   408         return trim(strip_tags($snippet));
   418         if (!is_object($md_section = $md_obj->getGeneral())) {
   419             $md_section = $md_obj->addGeneral();
   433         $keywords = array($ulang => $keywords);
   449         bool $a_update = 
false   480             $default_visibility = $news_set->get(
"default_visibility", 
"users");
   483             $news_item->setContext(
   490             $news_item->setVisibility($default_visibility);
   494         $news_item->setUserId($ilUser->getId());
   499         $news_item->setTitle($this->
getTitle());
   502             ? 
"blog_news_posting_updated"   503             : 
"blog_news_posting_published";
   509         $contributors = array();
   511             $contributors[] = $user[
"user_id"];
   513         if (count($contributors) > 1 || !in_array($this->
getAuthor(), $contributors)) {
   516             foreach ($contributors as $user_id) {
   521             $content .= 
"\n" . sprintf(
$lng->
txt(
"blog_news_posting_authors"), implode(
", ", $authors));
   524         $news_item->setContentTextIsLangVar(
false);
   525         $news_item->setContent($content);
   528         $news_item->setContentLong($snippet);
   530         if (!$news_item->getId()) {
   531             $news_item->create();
   533             $news_item->update(
true);
   546         $db = $DIC->database();
   548         $set = 
$db->
query(
"SELECT $a_field FROM il_blog_posting " .
   549             " WHERE id = " . 
$db->
quote($a_posting_id, 
"integer"));
   552         return $rec[$a_field] ?? null;
   557         return (
string) self::lookup(
"title", $a_posting_id);
 getActive(bool $a_check_scheduled_activation=false)
 
getNotificationAbstract()
 
static lookupTitle(int $a_posting_id)
 
static getLastPost(int $a_blog_id)
Get newest posting for blog. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static deleteNewsOfContext(int $a_context_obj_id, string $a_context_obj_type, int $a_context_sub_obj_id=0, string $a_context_sub_obj_type="")
Delete all news of a context. 
 
static searchBlogsByAuthor(int $a_user_id)
Get all blogs where user has postings. 
 
setCreated(ilDateTime $a_date)
 
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
 
static getLastNewsIdForContext(int $a_context_obj_id, string $a_context_obj_type, int $a_context_sub_obj_id=0, string $a_context_sub_obj_type="", bool $a_only_today=false)
Get last news id of news set related to a certain context. 
 
static getAllPostings(int $a_blog_id, int $a_limit=1000, int $a_offset=0)
Get all postings of blog. 
 
fetchAssoc(ilDBStatement $statement)
 
static exists(int $a_blog_id, int $a_posting_id)
Checks whether a posting exists. 
 
update(bool $a_validate=true, bool $a_no_history=false, bool $a_notify=true, string $a_notify_action="update")
 
setTitle(string $a_title)
 
quote($value, string $type)
 
getWithdrawn()
Get last withdrawal date. 
 
static now()
Return current timestamp in Y-m-d H:i:s format. 
 
handleNews(bool $a_update=false)
Handle news item. 
 
static updateKeywords(ilMDGeneral $a_md_section, array $a_keywords)
 
static deleteAllBlogPostings(int $a_blog_id)
Delete all postings for blog. 
 
static lookup(string $a_field, int $a_posting_id)
Lookup posting property. 
 
setApproved(bool $a_status)
 
updateKeywords(array $keywords)
 
static sendNotification(string $a_action, bool $a_in_wsp, int $a_blog_node_id, int $a_posting_id, ?string $a_comment=null)
 
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link='', bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path='ilpublicuserprofilegui')
Default behaviour is: 
 
const NEWS_NOTICE
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD) 
 
static lookupKeywords(int $a_rbac_id, int $a_obj_id, bool $a_return_ids=false)
 
query(string $query)
Run a (read-only) Query on the database. 
 
setBlogNodeId(int $a_id, bool $a_is_in_workspace=false)
Set blog node id (needed for notification) 
 
static lookupBlogId(int $a_posting_id)
 
A news item can be created by different sources. 
 
addUpdateListener(object $a_object, string $a_method, $a_parameters="")
 
create(bool $a_import=false)
Create new blog posting. 
 
setWithdrawn(ilDateTime $a_date)
Set last withdrawal date. 
 
static getSnippet(int $a_id, bool $a_truncate=false, int $a_truncate_length=500, string $a_truncate_sign="...", bool $a_include_picture=false, int $a_picture_width=144, int $a_picture_height=144, string $a_export_directory=null)
Get first text paragraph of page. 
 
static getKeywords(int $a_obj_id, int $a_posting_id)
 
setActive(bool $a_active)