29 protected \ILIAS\Notes\Service
$notes;
46 object $a_access_handler =
null,
49 bool $a_enable_public_notes =
true,
50 bool $a_may_contribute =
true,
51 int $a_style_sheet_id = 0
55 $this->
tabs = $DIC->tabs();
56 $this->
locator = $DIC[
"ilLocator"];
58 $this->
user = $DIC->user();
61 $this->blog_request =
$DIC->blog()
68 $this->node_id = $a_node_id;
69 $this->access_handler = $a_access_handler;
70 $this->enable_public_notes = $a_enable_public_notes;
75 $this->getBlogPosting()->setBlogNodeId($this->node_id, $this->
isInWorkspace());
76 $this->getBlogPosting()->getPageConfig()->setEditLockSupport(!$this->
isInWorkspace());
79 $this->may_contribute = $a_may_contribute;
86 "LOCATION_SYNTAX_STYLESHEET",
94 "LOCATION_CONTENT_STYLESHEET",
102 $this->blpg = $this->blog_request->getBlogPage();
103 $this->fetchall = $this->blog_request->getFetchAll();
104 $this->term = $this->blog_request->getTerm();
106 $this->reading_time_manager = new \ILIAS\Blog\ReadingTime\ReadingTimeManager();
107 $this->notes =
$DIC->notes();
116 $next_class = $ilCtrl->getNextClass($this);
118 $posting = $this->getBlogPosting();
119 $ilCtrl->setParameter($this,
"blpg", $posting->getId());
121 switch ($next_class) {
129 if ($ilCtrl->getCmd() ===
"deactivatePageToList") {
130 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"blog_draft_info"),
true);
131 } elseif ($ilCtrl->getCmd() ===
"activatePageToList") {
132 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"blog_new_posting_info"),
true);
137 $posting->getTitle());
140 $this->
lng->txt(
"obj_blog")
144 $posting->getTitle(),
145 $ilCtrl->getLinkTarget($this,
"preview")
148 return parent::executeCommand();
166 if ($a_cmd ===
"contribute") {
169 return $this->access_handler->checkAccess($a_cmd,
"", $this->node_id);
173 string $a_mode =
null
183 $this->getBlogPosting()->increaseViewCnt();
186 "tpl.blog_page_view_main_column.html",
195 $this->
ctrl->redirect($this,
"previewFullscreen");
198 $callback = array($this,
"observeNoteAction");
202 $may_delete_comments = ($this->
checkAccess(
"contribute") &&
205 $wtpl->setVariable(
"TOOLBAR",
$toolbar->getHTML());
208 $this->getBlogPosting(),
210 $this->enable_public_notes,
211 $may_delete_comments,
216 if ($a_mode !==
"embedded") {
217 $append = ($this->blpg > 0)
226 $wtpl->setVariable(
"PAGE", parent::preview());
230 $ilCtrl->setParameter($this,
"blpg", $this->getBlogPosting()->getId());
240 return $this->preview(
"embedded");
248 $this->add_date =
true;
249 return $this->preview(
"fullscreen");
255 $this->setTemplateOutput(false);
257 $this->setPresentationTitle(
"");
258 if (!$this->getAbstractOnly() && !$this->showPageHeading()) {
259 if ($a_title !==
"") {
260 $this->setPresentationTitle($a_title);
262 $this->setPresentationTitle($this->getBlogPosting()->getTitle());
265 $this->getBlogPosting()->increaseViewCnt();
266 return parent::showPage();
275 if (is_object($this->access_handler)) {
276 $class = get_class($this->access_handler);
279 return stristr($class,
"workspace");
289 if ($this->showPageHeading()) {
290 $a_output = $this->getPageHeading() . $a_output;
298 if (!$this->getAbstractOnly() && $this->add_date) {
313 if (!$this->isInWorkspace()) {
315 $author_id = $this->getBlogPosting()->getAuthor();
321 if ($editor[
"user_id"] != $author_id) {
327 $author = implode(
", ", $authors) .
" - ";
332 $tpl =
new ilTemplate(
"tpl.posting_head.html",
true,
true,
"Modules/Blog");
335 $reading_time = $this->reading_time_manager->getReadingTime(
336 $this->getBlogPosting()->getParentId(),
337 $this->getBlogPosting()->
getId()
339 if (!is_null($reading_time)) {
340 $this->
lng->loadLanguageModule(
"copg");
341 $tpl->setCurrentBlock(
"reading_time");
344 $this->
lng->txt(
"copg_est_reading_time") .
": " .
345 sprintf($this->
lng->txt(
"copg_x_minutes"), $reading_time)
347 $tpl->parseCurrentBlock();
350 $tpl->setVariable(
"TITLE", $this->getBlogPosting()->getTitle());
359 public function getTabs(
string $a_activate =
""): void
361 $ilCtrl = $this->ctrl;
363 $ilCtrl->setParameterByClass(
"ilobjbloggui",
"blpg", $this->getBlogPosting()->
getId());
365 parent::getTabs($a_activate);
371 $ilCtrl = $this->ctrl;
374 if ($this->checkAccess(
"write") || $this->checkAccess(
"contribute")) {
376 $confirmation_gui->setFormAction($ilCtrl->getFormAction($this));
377 $confirmation_gui->setHeaderText(
$lng->txt(
"blog_posting_deletion_confirmation"));
378 $confirmation_gui->setCancel(
$lng->txt(
"cancel"),
"cancelBlogPostingDeletion");
379 $confirmation_gui->setConfirm(
$lng->txt(
"delete"),
"confirmBlogPostingDeletion");
382 "tpl.blog_posting_deletion_confirmation.html",
388 $dtpl->setVariable(
"PAGE_TITLE", $this->getBlogPosting()->getTitle());
391 $cnt_note_users = $this->notes->domain()->getUserCount(
392 $this->getBlogPosting()->getParentId(),
393 $this->getBlogPosting()->
getId(),
397 "TXT_NUMBER_USERS_NOTES_OR_COMMENTS",
398 $lng->txt(
"blog_number_users_notes_or_comments")
400 $dtpl->setVariable(
"TXT_NR_NOTES_COMMENTS", $cnt_note_users);
402 $confirmation_gui->addItem(
"",
"", $dtpl->get());
404 $tpl->setContent($confirmation_gui->getHTML());
410 $ilCtrl = $this->ctrl;
412 $ilCtrl->redirect($this,
"preview");
417 $ilCtrl = $this->ctrl;
420 if ($this->checkAccess(
"write") || $this->checkAccess(
"contribute")) {
422 $md_section = $this->getBlogPosting()->getMDSection();
423 foreach ($md_section->getKeywordIds() as
$id) {
424 $md_key = $md_section->getKeyword(
$id);
428 $this->getBlogPosting()->delete();
429 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"blog_posting_deleted"),
true);
432 $ilCtrl->setParameterByClass(
"ilobjbloggui",
"blpg",
"");
433 $ilCtrl->redirectByClass(
"ilobjbloggui",
"render");
439 $ilTabs = $this->tabs;
441 $ilTabs->clearTargets();
442 $ilTabs->setBackTarget($this->
lng->txt(
"back"), $this->ctrl->getLinkTargetByClass(
"ilobjblogGUI"));
444 $ilTabs->activateTab(
"edit");
447 $a_form = $this->initTitleForm();
450 $tpl->setContent($a_form->getHTML());
457 $form = $this->initTitleForm();
458 if ($form->checkInput()) {
459 if ($this->checkAccess(
"write") || $this->checkAccess(
"contribute")) {
460 $page = $this->getPageObject();
461 $page->setTitle($form->getInput(
"title"));
464 $page->handleNews(
true);
466 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"settings_saved"),
true);
468 $this->
ctrl->redirectByClass(
"ilObjBlogGUI",
"");
472 $form->setValuesByPost();
473 $this->editTitle($form);
479 $ilCtrl = $this->ctrl;
482 $form->setFormAction($ilCtrl->getFormAction($this));
483 $form->setTitle(
$lng->txt(
'blog_rename_posting'));
486 $title->setRequired(
true);
487 $form->addItem($title);
489 $title->setValue($this->getPageObject()->getTitle());
491 $form->addCommandButton(
'updateTitle',
$lng->txt(
'save'));
492 $form->addCommandButton(
'cancelEdit',
$lng->txt(
'cancel'));
500 $ilTabs = $this->tabs;
502 $ilTabs->clearTargets();
503 $ilTabs->setBackTarget($this->
lng->txt(
"back"), $this->ctrl->getLinkTargetByClass(
"ilobjblogGUI"));
505 $ilTabs->activateTab(
"edit");
508 $a_form = $this->initDateForm();
511 $tpl->setContent($a_form->getHTML());
518 $form = $this->initDateForm();
519 if ($form->checkInput()) {
520 if ($this->checkAccess(
"write") || $this->checkAccess(
"contribute")) {
521 $dt = $form->getItemByPostVar(
"date");
522 $dt = $dt->getDate();
524 $page = $this->getPageObject();
525 $page->setCreated($dt);
528 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"settings_saved"),
true);
530 $this->
ctrl->redirectByClass(
"ilObjBlogGUI",
"");
534 $form->setValuesByPost();
535 $this->editTitle($form);
541 $ilCtrl = $this->ctrl;
544 $form->setFormAction($ilCtrl->getFormAction($this));
545 $form->setTitle(
$lng->txt(
'blog_edit_date'));
548 $date->setRequired(
true);
549 $date->setShowTime(
true);
550 $date->setInfo(
$lng->txt(
'blog_edit_date_info'));
551 $form->addItem($date);
553 $date->setDate($this->getPageObject()->getCreated());
555 $form->addCommandButton(
'updateDate',
$lng->txt(
'save'));
556 $form->addCommandButton(
'cancelEdit',
$lng->txt(
'cancel'));
563 $this->
ctrl->redirectByClass(
"ilObjBlogGUI",
"");
574 $note = $this->notes->domain()->getById($a_note_id);
575 $text = $note->getText();
583 return array(
"deactivatePage" =>
$lng->txt(
"blog_toggle_draft"),
584 "activatePage" =>
$lng->txt(
"blog_toggle_final"));
589 $this->deactivatePage(
true);
594 if ($this->checkAccess(
"write") || $this->checkAccess(
"contribute")) {
595 $this->getBlogPosting()->unpublish();
599 $this->
ctrl->redirect($this,
"edit");
601 $this->
ctrl->setParameterByClass(
"ilobjbloggui",
"blpg",
"");
602 $this->
ctrl->redirectByClass(
"ilobjbloggui",
"");
608 $this->activatePage(
true);
616 if ($this->checkAccess(
"write") || $this->checkAccess(
"contribute")) {
617 $this->getBlogPosting()->setActive(
true);
618 $this->getBlogPosting()->update(
true,
false);
621 $this->
ctrl->redirect($this,
"edit");
623 $this->
ctrl->setParameterByClass(
"ilobjbloggui",
"blpg",
"");
624 $this->
ctrl->redirectByClass(
"ilobjbloggui",
"");
635 $renderer =
$DIC->ui()->renderer();
637 $ilTabs = $this->tabs;
640 $ilTabs->clearTargets();
641 $ilTabs->setBackTarget($this->
lng->txt(
"back"), $this->ctrl->getLinkTargetByClass(
"ilobjblogGUI"));
643 if (!$this->checkAccess(
"contribute")) {
647 $ilTabs->activateTab(
"pg");
649 $tpl->setContent($renderer->render($this->initKeywordsForm()));
659 $ui_factory =
$DIC->ui()->factory();
661 $md_section = $this->getBlogPosting()->getMDSection();
664 foreach ($ids = $md_section->getKeywordIds() as
$id) {
665 $md_key = $md_section->getKeyword(
$id);
666 if (trim($md_key->getKeyword()) !==
"") {
667 $keywords[] = $md_key->getKeyword();
674 if ($posting_id != $this->getBlogPosting()->
getId()) {
679 $other = array_unique($other);
680 sort($other, SORT_LOCALE_STRING);
682 $input_tag = $ui_factory->input()->field()->tag($this->
lng->txt(
"blog_keywords"), $other, $this->lng->txt(
"blog_keyword_enter"))->withUserCreatedTagsAllowed(
true);
683 if (count($keywords) > 0) {
684 $input_tag = $input_tag->withValue($keywords);
687 $DIC->ctrl()->setParameter(
693 $section = $ui_factory->input()->field()->section([$input_tag], $this->
lng->txt(
"blog_edit_keywords"),
"");
695 $form_action =
$DIC->ctrl()->getFormAction($this,
"saveKeywordsForm");
696 return $ui_factory->input()->container()->form()->standard($form_action, [
"tags" => $section]);
701 if ($this->node_id) {
702 if ($this->isInWorkspace()) {
703 return $this->access_handler->getTree()->lookupObjectId($this->node_id);
715 $request =
$DIC->http()->request();
716 $form = $this->initKeywordsForm();
718 if ($request->getMethod() ===
"POST"
719 && $request->getQueryParams()[
'tags'] ==
'tags_processing') {
720 $form = $form->withRequest($request);
721 $result = $form->getData();
723 $keywords = $result[
"tags"][0];
725 if ($this->checkAccess(
"write") || $this->checkAccess(
"contribute")) {
726 if (is_array($keywords)) {
727 $this->getBlogPosting()->updateKeywords($keywords);
729 $this->getBlogPosting()->updateKeywords([]);
733 $this->
ctrl->redirectByClass(
"ilObjBlogGUI",
"");
742 bool $a_truncate =
false,
743 int $a_truncate_length = 500,
744 string $a_truncate_sign =
"...",
745 bool $a_include_picture =
false,
746 int $a_picture_width = 144,
747 int $a_picture_height = 144,
748 string $a_export_directory =
null
750 $bpgui = new self(0, null, $a_id);
754 if ($a_include_picture) {
755 $img = $bpgui->getFirstMediaObjectAsTag($a_picture_width, $a_picture_height, $a_export_directory);
758 $bpgui->setRawPageContent(
true);
759 $bpgui->setAbstractOnly(
true);
762 $bpgui->setFileDownloadLink(
".");
763 $bpgui->setFullscreenLink(
".");
764 $bpgui->setSourcecodeDownloadScript(
".");
765 $bpgui->setProfileBackUrl(
".");
768 $page = $bpgui->showPage();
775 $page =
'<div>' .
$img . $page .
'</div><div style="clear:both;"></div>';
784 string $a_export_directory =
null
786 $this->obj->buildDom();
787 $mob_ids = $this->obj->collectMediaObjects();
789 foreach ($mob_ids as $mob_id) {
791 $mob_item = $mob_obj->getMediaItem(
"Standard");
792 if (stripos($mob_item->getFormat(),
"image") !==
false) {
793 $mob_size = $mob_item->getOriginalSize();
794 if (is_null($mob_size)) {
797 if ($mob_size[
"width"] >= $a_width ||
798 $mob_size[
"height"] >= $a_height) {
799 if (!$a_export_directory) {
803 $mob_dir =
"./mobs/mm_" . $mob_obj->getId();
805 $mob_res = self::parseImage(
813 $location = $mob_item->getLocationType() ===
"Reference"
814 ? $mob_item->getLocation()
815 : $mob_dir .
"/" . $mob_item->getLocation();
819 ' width="' . $mob_res[0] .
'"' .
820 ' height="' . $mob_res[1] .
'"' .
821 ' class="ilBlogListItemSnippetPreviewImage ilFloatLeft noMirror"' .
836 $ratio_width = $ratio_height = 1;
837 if ($src_width > $tgt_width) {
838 $ratio_width = $tgt_width / $src_width;
840 if ($src_height > $tgt_height) {
841 $ratio_height = $tgt_height / $src_height;
843 $shrink_ratio = min($ratio_width, $ratio_height);
846 (
int) round($src_width * $shrink_ratio),
847 (
int) round($src_height * $shrink_ratio)
853 return $this->
lng->txt(
"blog_draft_text");
858 return $this->getNotesHTML(
859 $this->getBlogPosting(),
861 $this->enable_public_notes,
874 $this->
ctrl->setParameterByClass(
"ilobjbloggui",
"bmn",
"");
875 $this->
ctrl->redirectByClass(
"ilobjbloggui",
"render");
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
$location
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilBlogPosting GUI class.
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.
getActivationCaptions()
Get captions for activation action menu entries.
isInWorkspace()
Is current page part of personal workspace blog?
getTabs(string $a_activate="")
previewEmbedded()
Needed for portfolio/blog handling.
previewFullscreen()
Needed for portfolio/blog handling.
ILIAS Notes Service $notes
observeNoteAction(int $a_blog_id, int $a_posting_id, string $a_type, string $a_action, int $a_note_id)
postOutputProcessing(string $a_output)
Finalizing output processing.
static parseImage(int $src_width, int $src_height, int $tgt_width, int $tgt_height)
executeCommand()
execute command
deleteBlogPostingConfirmationScreen()
setBlogPosting(ilBlogPosting $a_posting)
cancelBlogPostingDeletion()
preview(string $a_mode=null)
confirmBlogPostingDeletion()
editTitle(ilPropertyFormGUI $a_form=null)
ILIAS Blog ReadingTime ReadingTimeManager $reading_time_manager
getPageHeading()
Get page heading see also https://docu.ilias.de/goto_docu_wiki_wpage_5793_1357.html the presentation ...
bool $enable_public_notes
checkAccess(string $a_cmd)
deactivatePage(bool $a_to_list=false)
StandardGUIRequest $blog_request
editDate(ilPropertyFormGUI $a_form=null)
showPage(string $a_title="")
showEditToolbar()
Show edit toolbar.
editKeywords()
Diplay the keywords form.
getFirstMediaObjectAsTag(int $a_width=144, int $a_height=144, string $a_export_directory=null)
activatePage(bool $a_to_list=false)
__construct(int $a_node_id, object $a_access_handler=null, int $a_id=0, int $a_old_nr=0, bool $a_enable_public_notes=true, bool $a_may_contribute=true, int $a_style_sheet_id=0)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getAllPostings(int $a_blog_id, int $a_limit=1000, int $a_offset=0)
Get all postings of blog.
static getKeywords(int $a_obj_id, int $a_posting_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static useRelativeDates()
static setUseRelativeDates(bool $a_status)
set use relative dates
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
loadLanguageModule(string $a_module)
Load language module.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static sendNotification(string $a_action, bool $a_in_wsp, int $a_blog_node_id, int $a_posting_id, ?string $a_comment=null)
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)
static getSyntaxStylePath()
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
setStyleId(int $a_styleid)
setPresentationTitle(string $a_title="")
getNotesHTML(object $a_content_object=null, bool $a_enable_private_notes=true, bool $a_enable_public_notes=false, bool $a_enable_notes_deletion=false, callable $a_callback=null, bool $export=false)
Get html for public and/or private notes.
ilGlobalTemplateInterface $tpl
setEnableEditing(bool $a_enableediting)
setPageObject(ilPageObject $a_pg_obj)
static truncateHTML(string $a_text, int $a_length=100, string $a_ending='...', bool $a_exact=false, bool $a_consider_html=true)
Truncate (html) string.
static getPageContributors(string $a_parent_type, int $a_page_id, string $a_lang="-")
Get all contributors for parent object.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
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:
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
if(!file_exists(getcwd() . '/ilias.ini.php'))
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setLoginTargetPar(string $a_val)
Set target parameter for login (public sector).
setTitleIcon(string $a_icon_path, string $a_icon_desc="")
set title icon
setPermanentLink(string $a_type, ?int $a_id, string $a_append="", string $a_target="", string $a_title="")
Generates and sets a permanent ilias link.
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
setVariable(string $variable, $value='')
Sets the given variable to the given value.
setTitle(string $a_title, bool $hidden=false)
Sets title in standard template.
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ChatMainBarProvider \MainMenu\Provider.