19declare(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;
117 return $this->withdrawn;
124 bool $a_import =
false
126 $data = $this->internal_data;
141 $this->getWithdrawn()
143 $id = $this->posting_manager->create(
$post);
147 parent::create($a_import);
152 bool $a_validate =
true,
153 bool $a_no_history =
false,
154 bool $a_notify =
true,
155 string $a_notify_action =
"update"
157 $data = $this->internal_data;
165 $this->getWithdrawn()
167 $this->posting_manager->update(
$post);
169 $ret = parent::update($a_validate, $a_no_history);
171 if ($a_notify && $this->getActive()) {
174 $this->blog_node_is_wsp,
190 $query =
"SELECT * FROM il_blog_posting" .
191 " WHERE id = " .
$ilDB->quote($this->
getId(),
"integer");
192 $set =
$ilDB->query($query);
193 $rec =
$ilDB->fetchAssoc($set);
195 $this->setTitle($rec[
"title"]);
196 $this->setBlogId($rec[
"blog_id"]);
198 $this->setAuthor($rec[
"author"]);
199 if ($rec[
"approved"]) {
200 $this->setApproved(
true);
205 $this->addUpdateListener($this,
"checkApproval");
212 if (!$this->getActive() && $this->isApproved()) {
213 $this->approved =
false;
221 public function delete():
void
229 $this->getParentType()
232 $this->posting_manager->delete($this->
getId());
242 $this->setApproved(
false);
243 $this->setActive(
false);
245 $this->update(
true,
false,
false);
251 $this->getParentType()
263 $lom_services =
$DIC->learningObjectMetadata();
264 $mgr =
$DIC->blog()->internal()->domain()->posting();
265 foreach ($mgr->getAllByBlog($a_blog_id, 0) as $posting) {
266 $lom_services->deleteAll($a_blog_id, $posting->getId(),
"blp");
276 return $DIC->blog()->internal()->domain()->posting()->lookupBlogId($a_posting_id);
289 $pages = parent::getAllPages(
"blp", $a_blog_id);
291 foreach (
$DIC->blog()->internal()->domain()->posting()->getAllByBlog(
296 $id = $posting->getId();
297 if (isset($pages[
$id])) {
298 $posts[
$id] = $pages[
$id];
299 $posts[
$id][
"title"] = $posting->getTitle();
300 $posts[
$id][
"created"] = $posting->getCreated();
301 $posts[
$id][
"author"] = $posting->getAuthor();
302 $posts[
$id][
"approved"] = $posting->isApproved();
303 $posts[
$id][
"last_withdrawn"] = $posting->getLastWithdrawn();
305 foreach (self::getPageContributors(
"blp",
$id) as $editor) {
306 if ($editor[
"user_id"] != $posting->getAuthor()) {
307 $posts[
$id][
"editors"][] = $editor[
"user_id"];
324 return $DIC->blog()->internal()->domain()->posting()->exists(
337 return $DIC->blog()->internal()->domain()->posting()->getLastPost($a_blog_id);
345 bool $a_is_in_workspace =
false
347 $this->blog_node_id = $a_id;
348 $this->blog_node_is_wsp = $a_is_in_workspace;
356 $snippet = str_replace(array(
'<br/>',
'<br />',
'</p>',
'</div>'),
"\n", $snippet);
358 return trim(strip_tags($snippet));
365 $this->lom_services->manipulate($this->getBlogId(), $this->
getId(),
"blp")
366 ->prepareDelete($this->lom_services->paths()->keywords())
367 ->prepareCreateOrUpdate($this->lom_services->paths()->keywords(), ...$keywords)
377 $lom_services =
$DIC->learningObjectMetadata();
380 $keywords = $lom_services->read($a_obj_id, $a_posting_id,
"blp")
381 ->allData($lom_services->paths()->keywords());
382 foreach ($keywords as $keyword) {
383 if ($keyword->value() !==
"") {
384 $result[] = $keyword->value();
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
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 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")
create(bool $a_import=false)
Create new blog posting.
getNotificationAbstract()
setApproved(bool $a_status)
setBlogNodeId(int $a_id, bool $a_is_in_workspace=false)
Set blog node id (needed for notification)
static getAllPostings(int $a_blog_id, int $a_limit=1000, int $a_offset=0)
Get all postings of blog.
updateKeywords(array $keywords)
static lookupBlogId(int $a_posting_id)
static getKeywords(int $a_obj_id, int $a_posting_id)
static getLastPost(int $a_blog_id)
Get newest posting for blog.
PostingManager $posting_manager
InternalDataService $internal_data
setCreated(ilDateTime $a_date)
setWithdrawn(ilDateTime $a_date)
Set last withdrawal date.
static deleteAllBlogPostings(int $a_blog_id)
Delete all postings for blog.
setTitle(string $a_title)
getWithdrawn()
Get last withdrawal date.
@classDescription Date and time handling
get(int $a_format, string $a_format_str='', string $a_tz='')
get formatted date
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 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)
static now()
Return current timestamp in Y-m-d H:i:s format.