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;
134 $this->getWithdrawn()
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"
150 $data = $this->internal_data;
158 $this->getWithdrawn()
160 $this->posting_manager->update(
$post);
162 $ret = parent::update($a_validate, $a_no_history);
164 if ($a_notify && $this->getActive()) {
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);
188 $this->setTitle($rec[
"title"]);
189 $this->setBlogId($rec[
"blog_id"]);
191 $this->setAuthor($rec[
"author"]);
192 if ($rec[
"approved"]) {
193 $this->setApproved(
true);
198 $this->addUpdateListener($this,
"checkApproval");
205 if (!$this->getActive() && $this->isApproved()) {
206 $this->approved =
false;
214 public function delete():
void
222 $this->getParentType()
225 $this->posting_manager->delete($this->
getId());
235 $this->setApproved(
false);
236 $this->setActive(
false);
238 $this->update(
true,
false,
false);
244 $this->getParentType()
256 $lom_services =
$DIC->learningObjectMetadata();
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)
370 $lom_services =
$DIC->learningObjectMetadata();
373 $keywords = $lom_services->read($a_obj_id, $a_posting_id,
"blp")
374 ->allData($lom_services->paths()->keywords());
375 foreach ($keywords as $keyword) {
376 if ($keyword->value() !==
"") {
377 $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
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.