19 declare(strict_types=1);
44 $this->internal_data = $DIC->blog()->internal()->data();
45 $this->posting_manager = $DIC->blog()->internal()->domain()->posting();
53 public function setTitle(
string $a_title): void
55 $this->title = $a_title;
75 $this->created = $a_date;
85 $this->author = $a_id;
95 $this->approved = $a_status;
109 $this->withdrawn = $a_date;
124 bool $a_import =
false 136 $id = $this->posting_manager->create(
$post);
140 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" 160 $this->posting_manager->update(
$post);
162 $ret = parent::update($a_validate, $a_no_history);
167 $this->blog_node_is_wsp,
183 $query =
"SELECT * FROM il_blog_posting" .
184 " WHERE id = " .
$ilDB->quote($this->
getId(),
"integer");
185 $set =
$ilDB->query($query);
186 $rec =
$ilDB->fetchAssoc($set);
192 if ($rec[
"approved"]) {
206 $this->approved =
false;
214 public function delete():
void 225 $this->posting_manager->delete($this->
getId());
238 $this->
update(
true,
false,
false);
257 $mgr = $DIC->blog()->internal()->domain()->posting();
258 foreach ($mgr->getAllByBlog($a_blog_id, 0) as $posting) {
259 $lom_services->deleteAll($a_blog_id, $posting->getId(),
"blp");
269 return $DIC->blog()->internal()->domain()->posting()->lookupBlogId($a_posting_id);
282 $pages = parent::getAllPages(
"blp", $a_blog_id);
284 foreach ($DIC->blog()->internal()->domain()->posting()->getAllByBlog(
289 $id = $posting->getId();
290 if (isset($pages[
$id])) {
291 $posts[
$id] = $pages[
$id];
292 $posts[
$id][
"title"] = $posting->getTitle();
293 $posts[
$id][
"created"] = $posting->getCreated();
294 $posts[
$id][
"author"] = $posting->getAuthor();
295 $posts[
$id][
"approved"] = $posting->isApproved();
296 $posts[
$id][
"last_withdrawn"] = $posting->getLastWithdrawn();
298 foreach (self::getPageContributors(
"blp", $id) as $editor) {
299 if ($editor[
"user_id"] != $posting->getAuthor()) {
300 $posts[
$id][
"editors"][] = $editor[
"user_id"];
317 return $DIC->blog()->internal()->domain()->posting()->exists(
330 return $DIC->blog()->internal()->domain()->posting()->getLastPost($a_blog_id);
338 bool $a_is_in_workspace =
false 340 $this->blog_node_id = $a_id;
341 $this->blog_node_is_wsp = $a_is_in_workspace;
349 $snippet = str_replace(array(
'<br/>',
'<br />',
'</p>',
'</div>'),
"\n", $snippet);
351 return trim(strip_tags($snippet));
358 $this->lom_services->manipulate($this->
getBlogId(), $this->
getId(),
"blp")
359 ->prepareDelete($this->lom_services->paths()->keywords())
360 ->prepareCreateOrUpdate($this->lom_services->paths()->keywords(), ...$keywords)
373 $keywords =
$lom_services->read($a_obj_id, $a_posting_id,
"blp")
375 foreach ($keywords as $keyword) {
376 if ($keyword->value() !==
"") {
377 $result[] = $keyword->value();
getActive(bool $a_check_scheduled_activation=false)
getNotificationAbstract()
static getLastPost(int $a_blog_id)
Get newest posting for blog.
InternalDataService $internal_data
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.
PostingManager $posting_manager
setCreated(ilDateTime $a_date)
static getAllPostings(int $a_blog_id, int $a_limit=1000, int $a_offset=0)
Get all postings of blog.
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)
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.
getWithdrawn()
Get last withdrawal date.
static now()
Return current timestamp in Y-m-d H:i:s format.
static deleteAllBlogPostings(int $a_blog_id)
Delete all postings for blog.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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)
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)
setBlogNodeId(int $a_id, bool $a_is_in_workspace=false)
Set blog node id (needed for notification)
static lookupBlogId(int $a_posting_id)
LOMServices $lom_services
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 getKeywords(int $a_obj_id, int $a_posting_id)
setActive(bool $a_active)