19 declare(strict_types=1);
35 protected \ILIAS\Repository\Profile\ProfileAdapter
$profile;
37 protected \ILIAS\Blog\InternalDomainService
$domain;
38 protected \ILIAS\Blog\InternalGUIService
$gui;
40 protected \ILIAS\Notes\Service
$notes;
69 protected \ILIAS\HTTP\Services
$http;
70 protected \ILIAS\DI\UIServices
$ui;
76 int $a_id_type = self::REPOSITORY_NODE_ID,
77 int $a_parent_node_id = 0
82 $cs = $DIC->contentStyle();
83 $this->tool_context = $DIC->globalScreen()->tool()->context();
84 $this->notes = $DIC->notes();
89 $this->domain = $domain =
$service->domain();
92 $this->
settings = $domain->settings();
93 $this->
user = $domain->user();
94 $this->tree = $domain->repositoryTree();
95 $this->rbac_review = $domain->rbac()->review();
96 $this->rbacadmin = $domain->rbac()->admin();
97 $this->
lng = $domain->lng();
101 $this->
help = $gui->help();
102 $this->
tabs = $gui->tabs();
103 $this->
toolbar = $gui->toolbar();
104 $this->
ui = $gui->ui();
105 $this->
locator = $gui->locator();
106 $this->
http = $gui->http();
108 $this->nav_history = $DIC[
"ilNavigationHistory"];
109 $this->
ctrl = $gui->ctrl();
111 $this->blog_request = $gui->standardRequest();
114 $this->gtp =
$req->getGotoPage();
115 $this->edt =
$req->getEditing();
116 $this->blpg =
$req->getBlogPage();
117 $this->old_nr =
$req->getOldNr();
118 $this->ppage =
$req->getPPage();
119 $this->user_page =
$req->getUserPage();
120 $this->new_type =
$req->getNewType();
121 $this->prvm =
$req->getPreviewMode();
122 $this->ntf =
$req->getNotification();
123 $this->apid =
$req->getApId();
124 $this->month =
$req->getMonth();
125 $this->keyword =
$req->getKeyword();
126 $this->author =
$req->getAuthor();
127 $this->prt_id =
$req->getPrtId();
131 $blog_page = $this->blog_request->getBlogPage();
132 if ($blog_page > 0 &&
134 throw new ilException(
"Posting ID does not match blog.");
143 if (!$this->month || !$this->items[$this->month]) {
144 $m = array_keys($this->items);
145 $this->month = array_shift($m);
146 $this->month_default =
true;
150 $this->
ctrl->setParameter($this,
"bmn", $this->month);
151 $blog_id = $this->
object->getId();
154 $this->
lng->loadLanguageModule(
"blog");
155 $this->
ctrl->saveParameter($this,
"prvm");
157 $this->content_style_gui = $cs->gui();
158 if (is_object($this->
object)) {
159 if ($this->id_type !== self::REPOSITORY_NODE_ID) {
160 $this->content_style_domain = $cs->domain()->styleForObjId($this->
object->getId());
162 $this->content_style_domain = $cs->domain()->styleForRefId($this->
object->getRefId());
166 $this->reading_time_gui = new \ILIAS\Blog\ReadingTime\BlogSettingsGUI($blog_id);
167 $this->reading_time_manager = $domain->readingTime();
168 $this->notes = $DIC->notes();
169 $owner = $this->
object?->getOwner() ?? 0;
170 $this->blog_access = $domain->blogAccess(
174 $this->
user->getId(),
177 $this->
profile = $domain->profile();
178 $this->profile_gui = $gui->profile();
194 $forms = parent::initCreationForms($new_type);
196 if ($this->id_type === self::WORKSPACE_NODE_ID) {
197 unset($forms[self::CFORM_IMPORT], $forms[self::CFORM_CLONE]);
207 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"object_added"),
true);
217 $this->tabs_gui->addSubTab(
219 $this->
lng->txt(
"blog_properties"),
220 $this->
ctrl->getLinkTarget($this,
'edit')
223 $this->tabs_gui->addSubTab(
225 $this->
lng->txt(
"obj_sty"),
226 $this->
ctrl->getLinkTargetByClass(
"ilobjectcontentstylesettingsgui",
"")
230 if ($this->id_type === self::REPOSITORY_NODE_ID) {
234 if ($grp_ref_id > 0 || $crs_ref_id > 0) {
236 $this->tabs_gui->addSubTab(
238 $this->
lng->txt(
"notifications"),
239 $this->
ctrl->getLinkTargetByClass(
"ilobjnotificationsettingsgui",
'')
245 $this->tabs_gui->activateSubTab($a_active);
257 if ($this->id_type === self::REPOSITORY_NODE_ID) {
259 $appr->setInfo(
$lng->
txt(
"blog_enable_approval_info"));
266 if (
$ilSetting->get(
'enable_global_profiles')) {
268 $rss->setInfo(
$lng->
txt(
"blog_enable_rss_info"));
276 $nav->setTitle(
$lng->
txt(
"blog_settings_navigation"));
284 $opt->setInfo(
$lng->
txt(
"blog_nav_mode_month_list_info"));
285 $nav_mode->addOption($opt);
289 $mon_num->setInfo(
$lng->
txt(
"blog_nav_mode_month_list_num_month_info"));
290 $mon_num->setSize(3);
291 $mon_num->setMinValue(1);
292 $opt->addSubItem($mon_num);
294 $detail_num =
new ilNumberInputGUI(
$lng->
txt(
"blog_nav_mode_month_list_num_month_with_post"),
"nav_list_mon_with_post");
295 $detail_num->setInfo(
$lng->
txt(
"blog_nav_mode_month_list_num_month_with_post_info"));
297 $detail_num->setSize(3);
299 $opt->addSubItem($detail_num);
302 $opt->setInfo(
$lng->
txt(
"blog_nav_mode_month_single_info"));
303 $nav_mode->addOption($opt);
305 $order_options = array();
306 if ($this->
object->getOrder()) {
307 foreach ($this->
object->getOrder() as $item) {
308 $order_options[] =
$lng->
txt(
"blog_" . $item);
312 if (!in_array(
$lng->
txt(
"blog_navigation"), $order_options)) {
313 $order_options[] =
$lng->
txt(
"blog_navigation");
316 if ($this->id_type === self::REPOSITORY_NODE_ID) {
317 if (!in_array(
$lng->
txt(
"blog_authors"), $order_options)) {
318 $order_options[] =
$lng->
txt(
"blog_authors");
322 $auth->setInfo(
$lng->
txt(
"blog_enable_nav_authors_info"));
327 $keyw->setInfo(
$lng->
txt(
"blog_enable_keywords_info"));
330 if (!in_array(
$lng->
txt(
"blog_keywords"), $order_options)) {
331 $order_options[] =
$lng->
txt(
"blog_keywords");
335 $order->setMultiValues($order_options);
336 $order->setValue(array_shift($order_options));
337 $order->setMulti(
true,
true,
false);
344 $pres->setTitle(
$lng->
txt(
"blog_presentation_frame"));
347 if ($this->id_type === self::REPOSITORY_NODE_ID) {
348 $obj_service->commonSettings()->legacyForm($a_form, $this->
object)->addTileImage();
354 if ($this->id_type === self::REPOSITORY_NODE_ID) {
355 $ppic->setInfo(
$lng->
txt(
"blog_profile_picture_repository_info"));
359 if ($blga_set->get(
"banner")) {
360 $dimensions =
" (" . $blga_set->get(
"banner_width") .
"x" .
361 $blga_set->get(
"banner_height") .
")";
367 $file = $this->
object->getImageFullPath(
true);
373 $this->reading_time_gui->addSettingToForm($a_form);
386 $list->setTitle(
$lng->
txt(
"blog_presentation_overview"));
391 $post_num->setInfo(
$lng->
txt(
"blog_list_num_postings_info"));
392 $post_num->setSize(3);
393 $post_num->setMinValue(1);
394 $post_num->setRequired(
true);
398 $a_form->
addItem($abs_shorten);
401 $abs_shorten_len->setSize(5);
402 $abs_shorten_len->setRequired(
true);
403 $abs_shorten_len->setSuffix(
$lng->
txt(
"blog_abstract_shorten_characters"));
404 $abs_shorten_len->setMinValue(50,
true);
405 $abs_shorten->addSubItem($abs_shorten_len);
408 $abs_img->setInfo(
$lng->
txt(
"blog_abstract_image_info"));
412 $abs_img_width->setSize(5);
413 $abs_img_width->setRequired(
true);
414 $abs_img_width->setSuffix(
$lng->
txt(
"blog_abstract_image_pixels"));
415 $abs_img_width->setMinValue(32,
true);
416 $abs_img->addSubItem($abs_img_width);
419 $abs_img_height->setSize(5);
420 $abs_img_height->setRequired(
true);
421 $abs_img_height->setSuffix(
$lng->
txt(
"blog_abstract_image_pixels"));
422 $abs_img_height->setMinValue(32,
true);
423 $abs_img->addSubItem($abs_img_height);
428 if ($this->id_type === self::REPOSITORY_NODE_ID) {
429 $a_values[
"approval"] = $this->
object->hasApproval();
430 $a_values[
"nav_authors"] = $this->
object->hasAuthors();
432 $a_values[
"keywords"] = $this->
object->hasKeywords();
433 $a_values[
"notes"] = $this->
object->getNotesStatus();
434 $a_values[
"ppic"] = $this->
object->hasProfilePicture();
439 $a_values[
"banner"] = $this->
object->getImage();
440 $a_values[
"rss"] = $this->
object->hasRSS();
441 $a_values[
"abss"] = $this->
object->hasAbstractShorten();
442 $a_values[
"absi"] = $this->
object->hasAbstractImage();
443 $a_values[
"nav"] = $this->
object->getNavMode();
444 $a_values[
"nav_list_mon_with_post"] = $this->
object->getNavModeListMonthsWithPostings();
445 $a_values[
"nav_list_mon"] = $this->
object->getNavModeListMonths();
446 $a_values[
"ov_list_post_num"] = $this->
object->getOverviewPostings();
452 $a_values = $this->reading_time_gui->addValueToArray($a_values);
460 if ($this->id_type === self::REPOSITORY_NODE_ID) {
461 $this->
object->setApproval((
bool) $form->
getInput(
"approval"));
462 $this->
object->setAuthors((
bool) $form->
getInput(
"nav_authors"));
463 $obj_service->commonSettings()->legacyForm($form, $this->
object)->saveTileImage();
465 $this->
object->setKeywords((
bool) $form->
getInput(
"keywords"));
466 $this->
object->setNotesStatus((
bool) $form->
getInput(
"notes"));
467 $this->
object->setProfilePicture((
bool) $form->
getInput(
"ppic"));
468 $this->
object->setRSS((
bool) $form->
getInput(
"rss"));
469 $this->
object->setAbstractShorten((
bool) $form->
getInput(
"abss"));
470 $this->
object->setAbstractShortenLength((
int) $form->
getInput(
"abssl"));
471 $this->
object->setAbstractImage((
bool) $form->
getInput(
"absi"));
472 $this->
object->setAbstractImageWidth((
int) $form->
getInput(
"absiw"));
473 $this->
object->setAbstractImageHeight((
int) $form->
getInput(
"absih"));
474 $this->
object->setNavMode((
int) $form->
getInput(
"nav"));
475 $this->
object->setNavModeListMonthsWithPostings((
int) $form->
getInput(
"nav_list_mon_with_post"));
476 $this->
object->setNavModeListMonths((
int) $form->
getInput(
"nav_list_mon"));
477 $this->
object->setOverviewPostings((
int) $form->
getInput(
"ov_list_post_num"));
478 $this->reading_time_gui->saveSettingFromForm($form);
480 $order = (array) $form->
getInput(
"order");
482 foreach ($order as $idx => $value) {
483 if ($value ==
$lng->
txt(
"blog_navigation")) {
484 $order[$idx] =
"navigation";
485 } elseif ($value ==
$lng->
txt(
"blog_keywords")) {
486 $order[$idx] =
"keywords";
488 $order[$idx] =
"authors";
491 $this->
object->setOrder($order);
495 if ($_FILES[
"banner"][
"tmp_name"]) {
496 $this->
object->uploadImage($_FILES[
"banner"]);
497 } elseif ($banner->getDeletionFlag()) {
498 $this->
object->deleteImage();
508 if ($this->id_type === self::WORKSPACE_NODE_ID) {
509 $this->
ctrl->setParameter($this,
"wsp_id", $this->node_id);
512 $ilHelp->setScreenIdComponent(
"blog");
515 $this->
ctrl->setParameterByClass(self::class,
"bmn", null);
516 $this->tabs_gui->addTab(
519 $this->
ctrl->getLinkTarget($this,
"")
523 $this->tabs_gui->addTab(
526 $this->
ctrl->getLinkTargetByClass(array(
"ilobjbloggui",
"ilinfoscreengui"),
"showSummary")
531 $this->tabs_gui->addTab(
534 $this->
ctrl->getLinkTarget($this,
"edit")
537 if (!$this->prtf_embed) {
538 if ($this->id_type === self::REPOSITORY_NODE_ID) {
539 $this->tabs_gui->addTab(
541 $lng->
txt(
"blog_contributors"),
542 $this->
ctrl->getLinkTarget($this,
"contributors")
546 if ($this->id_type === self::REPOSITORY_NODE_ID) {
547 $this->tabs_gui->addTab(
550 $this->
ctrl->getLinkTargetByClass(
"ilexportgui",
"")
556 if (!$this->prtf_embed) {
557 if ($this->blog_access->mayContribute()) {
558 $this->tabs_gui->addNonTabbedLink(
561 $this->
ctrl->getLinkTarget($this,
"preview")
577 $next_class = $ilCtrl->getNextClass($this);
579 if ($next_class !==
"ilexportgui") {
584 if ($this->gtp > 0) {
588 $ilCtrl->setCmdClass(
"ilblogpostinggui");
589 $ilCtrl->setParameterByClass(
"ilblogpostinggui",
"blpg", $page_id);
590 if ($this->edt ===
"edit") {
591 $ilCtrl->redirectByClass(
"ilblogpostinggui",
"edit");
593 $ilCtrl->redirectByClass(
"ilblogpostinggui",
"previewFullscreen");
596 $this->tpl->setOnScreenMessage(
'failure',
$lng->
txt(
"blog_posting_not_found"));
601 $cmd = $ilCtrl->getCmd();
604 if (($this->id_type === self::REPOSITORY_NODE_ID) && !$this->
getCreationMode() &&
607 $link = $ilCtrl->getLinkTargetByClass([
"ilrepositorygui",
"ilObjBlogGUI"],
"preview");
608 $ilNavigationHistory->addItem($this->node_id, $link,
"blog");
610 switch ($next_class) {
611 case 'ilblogpostinggui':
612 $this->
ctrl->saveParameter($this,
"user_page");
613 if (!$this->prtf_embed) {
618 $this->tpl->setOnScreenMessage(
'info',
$lng->
txt(
"no_permission"));
623 if ($this->id_type === self::REPOSITORY_NODE_ID) {
627 $style_sheet_id = $this->content_style_domain->getEffectiveStyleId();
635 $this->blog_access->mayEditPosting($this->blpg),
642 case "previewFullscreen":
643 $ilCtrl->setParameter($this,
"prvm",
"fsc");
647 case "previewEmbedded":
648 $ilCtrl->setParameter($this,
"prvm",
"emb");
656 if (!$this->prtf_embed) {
657 $this->
ctrl->setParameterByClass(
"ilblogpostinggui",
"blpg", $this->blpg);
658 $this->tabs_gui->addNonTabbedLink(
661 $this->
ctrl->getLinkTargetByClass(
"ilblogpostinggui",
"previewFullscreen")
663 $this->
ctrl->setParameterByClass(
"ilblogpostinggui",
"blpg",
"");
665 $this->
ctrl->setParameterByClass(
"ilobjportfoliogui",
"user_page", $this->ppage);
666 $this->tabs_gui->addNonTabbedLink(
669 $this->
ctrl->getLinkTargetByClass(
"ilobjportfoliogui",
"preview")
671 $this->
ctrl->setParameterByClass(
"ilobjportfoliogui",
"user_page",
"");
678 $cmd =
"preview" . (($this->prvm ===
"fsc") ?
"Fullscreen" :
"Embedded");
680 if (in_array($cmd, array(
"previewFullscreen",
"previewEmbedded"))) {
683 $ret = $ilCtrl->forwardCommand($bpost_gui);
684 if (!$ilTabs->back_target) {
685 $ilCtrl->setParameter($this,
"bmn",
"");
686 $ilTabs->setBackTarget(
688 $ilCtrl->getLinkTarget($this,
"")
694 $is_owner = $this->blog_access->mayContribute();
695 $is_active = $bpost_gui->getBlogPosting()->getActive();
698 if (($cmd ===
"previewFullscreen" || $cmd ===
"previewEmbedded")
699 && !$is_owner && !$is_active) {
700 $this->
ctrl->redirect($this,
"preview");
705 case "previewFullscreen":
713 case "previewEmbedded":
727 if ($this->id_type === self::WORKSPACE_NODE_ID) {
728 $info[] =
$lng->
txt(
"blog_draft_info");
730 $info[] =
$lng->
txt(
"blog_draft_info_contributors");
733 $public_action =
false;
734 if ($cmd !==
"history" && $cmd !==
"edit" && $is_active && empty($info)) {
735 $info[] =
$lng->
txt(
"blog_new_posting_info");
736 $public_action =
true;
738 if ($this->
object->hasApproval() && !$bpost_gui->getBlogPosting()->isApproved()) {
740 $info[] =
$lng->
txt(
"blog_posting_edit_approval_info");
742 if ($public_action) {
743 $this->tpl->setOnScreenMessage(
'success', implode(
"<br />", $info));
745 if (count($info) > 0) {
746 $this->tpl->setOnScreenMessage(
'info', implode(
"<br />", $info));
752 if ($cmd !==
"edit") {
757 $this->
tabs->setBackTarget(
"",
"");
764 case "ilinfoscreengui":
774 case "ilcommonactiondispatchergui":
776 $gui->enableCommentsSettings(
false);
778 $this->
ctrl->forwardCommand($gui);
781 case "ilpermissiongui":
783 $ilTabs->activateTab(
"id_permissions");
785 $this->
ctrl->forwardCommand($perm_gui);
788 case "ilobjectcopygui":
791 $cp->setType(
"blog");
792 $this->
ctrl->forwardCommand($cp);
795 case 'ilrepositorysearchgui':
797 $ilTabs->activateTab(
"contributors");
799 $rep_search->setTitle($this->
lng->txt(
"blog_add_contributor"));
800 $rep_search->setCallback($this,
'addContributor', $this->
object->getAllLocalRoles($this->node_id));
801 $this->
ctrl->setReturn($this,
'contributors');
802 $this->
ctrl->forwardCommand($rep_search);
807 $ilTabs->activateTab(
"export");
809 $exp_gui->addFormat(
"xml");
810 $exp_gui->addFormat(
"html",
"", $this,
"buildExportFile");
812 $exp_gui->addFormat(
"html_comments",
"HTML (" . $this->
lng->txt(
"blog_incl_comments") .
")", $this,
"buildExportFile");
814 $ilCtrl->forwardCommand($exp_gui);
817 case "ilobjectcontentstylesettingsgui":
821 $ilTabs->activateTab(
"settings");
825 if ($this->id_type === self::REPOSITORY_NODE_ID) {
826 $settings_gui = $this->content_style_gui
827 ->objectSettingsGUIForRefId(
832 $settings_gui = $this->content_style_gui
833 ->objectSettingsGUIForObjId(
838 $this->
ctrl->forwardCommand($settings_gui);
842 case "ilblogexercisegui":
843 $this->
ctrl->setReturn($this,
"render");
844 $gui = $this->gui->exercise()->ilBlogExerciseGUI($this->node_id);
845 $this->
ctrl->forwardCommand($gui);
848 case 'ilobjnotificationsettingsgui':
850 $ilTabs->activateTab(
"settings");
853 $this->
ctrl->forwardCommand($gui);
857 if ($cmd !==
"gethtml") {
859 if ($cmd ===
"addToDesk" || $cmd ===
"removeFromDesk") {
860 $this->{$cmd .
"Object"}();
866 $ilCtrl->setCmd($cmd);
870 if (!$this->prtf_embed) {
871 parent::executeCommand();
880 $this->rendered_content = (string) $this->$cmd();
891 $be = $this->domain->exercise($this->node_id);
892 $be_gui = $this->gui->exercise()->ilBlogExerciseGUI($this->node_id);
893 $assignments = $be->getAssignmentsOfBlog();
894 if (count($assignments) > 0) {
895 $ass_ids = array_map(
static function ($i) {
900 $this->tool_context->current()->addAdditionalData(
902 $be_gui->getActionButtons()
912 $this->
ctrl->setCmd(
"showSummary");
913 $this->
ctrl->setCmdClass(
"ilinfoscreengui");
927 if ($this->id_type !== self::WORKSPACE_NODE_ID) {
928 $info->enablePrivateNotes();
936 $info->enableNewsEditing(
false);
939 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
941 if ($enable_internal_rss) {
942 $info->setBlockProperty(
"news",
"settings",
"1");
943 $info->setBlockProperty(
"news",
"public_notifications_option",
"1");
948 $info->addMetaDataSections($this->
object->getId(), 0, $this->
object->getType());
950 $this->
ctrl->forwardCommand($info);
961 $title = $this->blog_request->
getTitle();
965 $posting->setTitle($title);
966 $posting->setBlogId($this->
object->getId());
967 $posting->setActive(
false);
968 $posting->setAuthor($ilUser->getId());
969 $posting->create(
false);
972 $ilCtrl->setParameter($this,
"bmn", date(
"Y-m"));
974 $ilCtrl->setParameterByClass(
"ilblogpostinggui",
"blpg", $posting->getId());
975 $ilCtrl->redirectByClass(
"ilblogpostinggui",
"edit");
977 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"msg_no_title"),
true);
978 $ilCtrl->redirect($this,
"render");
994 $this->tpl->setOnScreenMessage(
'info',
$lng->
txt(
"no_permission"));
998 $ilTabs->activateTab(
"content");
1001 if ($this->blog_access->mayContribute()) {
1002 $ilToolbar->setFormAction($ilCtrl->getFormAction($this,
"createPosting"));
1005 $title->setSize(30);
1006 $ilToolbar->addStickyItem($title,
true);
1008 document.getElementById('title').setAttribute('data-blog-input', 'posting-title'); 1009 document.getElementById('title').setAttribute('placeholder', ' '); 1013 $lng->
txt(
"blog_add_posting"),
1015 )->submit()->toToolbar(
true, $ilToolbar);
1018 $keys = array_keys($this->items);
1019 $first = array_shift($keys);
1020 if ($first != $this->month) {
1021 $ilToolbar->addSeparator();
1023 $ilCtrl->setParameter($this,
"bmn", $first);
1024 $url = $ilCtrl->getLinkTarget($this,
"");
1025 $ilCtrl->setParameter($this,
"bmn", $this->month);
1028 $lng->
txt(
"blog_show_latest"),
1030 )->emphasised()->toToolbar(
true, $ilToolbar);
1034 $print_view = $this->getPrintView();
1035 $modal_elements = $print_view->getModalElements(
1036 $this->
ctrl->getLinkTarget(
1038 "printViewSelection" 1041 $ilToolbar->addSeparator();
1042 $ilToolbar->addComponent($modal_elements->button);
1043 $ilToolbar->addComponent($modal_elements->modal);
1047 $is_owner = $this->blog_access->mayContribute();
1053 $list = $this->
renderList($list_items,
"preview",
"", $is_owner);
1073 if ($this->id_type === self::REPOSITORY_NODE_ID) {
1084 $list = $this->
renderList($list_items,
"previewEmbedded");
1088 elseif ($this->prt_id) {
1092 $ilCtrl->setParameterByClass(
"ilportfoliopagegui",
"ppage", $this->user_page);
1093 $link = $ilCtrl->getLinkTargetByClass(array(
"ilportfoliopagegui",
"ilobjbloggui"),
"render");
1094 $ilCtrl->setParameterByClass(
"ilportfoliopagegui",
"ppage",
"");
1096 $this->
toolbar->addComponent($this->
ui->factory()->button()->standard(
1097 $this->
lng->txt(
"blog_edit"),
1110 bool $a_show_inactive =
false 1112 if ($this->author) {
1113 $list_items = array();
1114 foreach ($this->items as $month => $items) {
1115 foreach ($items as
$id => $item) {
1116 if ($item[
"author"] == $this->author ||
1117 (isset($item[
"editors"]) && in_array($this->author, $item[
"editors"]))) {
1118 $list_items[
$id] = $item;
1122 } elseif ($this->keyword) {
1125 $max = $this->
object->getOverviewPostings();
1126 if ($this->month_default && $max) {
1127 $list_items = array();
1128 foreach ($this->items as $month => $postings) {
1129 foreach ($postings as
$id => $item) {
1130 if (!$a_show_inactive &&
1134 $list_items[
$id] = $item;
1136 if (count($list_items) >= $max) {
1157 $this->tpl->setOnScreenMessage(
'info',
$lng->
txt(
"no_permission"));
1167 $list = $this->
renderList($list_items,
"previewFullscreen");
1179 bool $a_with_comments =
false 1195 $wtpl =
new ilTemplate(
"tpl.blog_embedded.html",
true,
true,
"Modules/Blog");
1196 $wtpl->setVariable(
"VAL_LIST", $a_content);
1197 $wtpl->setVariable(
"VAL_NAVIGATION", $a_nav);
1198 return $wtpl->get();
1206 string $a_navigation
1213 $owner = $this->
object->getOwner();
1215 $ilTabs->clearTargets();
1222 if ($owner === $ilUser->getId()) {
1224 if ($this->id_type === self::WORKSPACE_NODE_ID) {
1225 $back =
"ilias.php?baseClass=ilDashboardGUI&cmd=jumpToWorkspace&wsp_id=" .
$this->node_id;
1228 elseif ($this->blog_access->mayContribute()) {
1229 $this->
ctrl->setParameter($this,
"prvm",
"");
1230 if ($this->blpg === 0) {
1231 $back = $this->
ctrl->getLinkTarget($this,
"");
1233 $this->
ctrl->setParameterByClass(
"ilblogpostinggui",
"bmn", $this->month);
1234 $this->
ctrl->setParameterByClass(
"ilblogpostinggui",
"blpg", $this->blpg);
1235 $back = $this->
ctrl->getLinkTargetByClass(
"ilblogpostinggui",
"preview");
1237 $this->
ctrl->setParameter($this,
"prvm", $this->prvm);
1240 $back_caption = $this->
lng->txt(
"blog_back_to_blog_owner");
1245 if ($this->id_type === self::WORKSPACE_NODE_ID) {
1246 $back =
"ilias.php?baseClass=ilDashboardGUI&cmd=jumpToWorkspace&dsh=" . $owner;
1249 elseif ($this->blog_access->mayContribute()) {
1250 $back = $this->
ctrl->getLinkTarget($this,
"");
1251 $back_caption = $this->
lng->txt(
"blog_back_to_blog_owner");
1264 $this->
ctrl->setParameter($this,
"bmn",
"");
1266 $this->
ctrl->setParameter($this,
"bmn", $this->month);
1281 bool $a_export =
false 1287 $this->
object->getType(),
1289 $this->
object->getId(),
1296 if ($this->id_type !== self::REPOSITORY_NODE_ID) {
1298 $name = $name[
"lastname"] .
", " . $name[
"firstname"];
1305 $banner_height =
"";
1306 if ($blga_set->get(
"banner")) {
1308 $banner_width = $blga_set->get(
"banner_width");
1309 $banner_height = $blga_set->get(
"banner_height");
1311 $banner = basename($banner);
1316 if ($this->
object->hasProfilePicture()) {
1318 if ($this->id_type === self::REPOSITORY_NODE_ID) {
1320 if ($this->blpg > 0 && !$a_export) {
1322 $author_id =
$post->getAuthor();
1324 $ppic = $this->profile_gui->getPicturePath($author_id);
1325 $name = $this->profile_gui->getNamePresentation($author_id);
1334 $ppic = basename($ppic);
1339 $a_tpl->setBanner($banner);
1342 if ($this->id_type === self::REPOSITORY_NODE_ID) {
1355 $author_found =
false;
1359 if ($this->author &&
1360 ($posting[
"author"] == $this->author ||
1361 (is_array($posting[
"editors"] ??
false) && in_array($this->author, $posting[
"editors"])))) {
1362 $author_found =
true;
1365 $month = substr($posting[
"created"]->
get(
IL_CAL_DATE), 0, 7);
1366 $items[
$month][$posting[
"id"]] = $posting;
1369 if ($this->author && !$author_found) {
1370 $this->author = null;
1381 string $a_cmd =
"preview",
1382 string $a_link_template =
"",
1383 bool $a_show_inactive =
false,
1384 string $a_export_directory =
"" 1392 $wtpl =
new ilTemplate(
"tpl.blog_list.html",
true,
true,
"Modules/Blog");
1395 if ($this->prt_id > 0 &&
1398 $ilCtrl->setParameterByClass(
"ilportfoliopagegui",
"ppage", $this->user_page);
1399 $link = $ilCtrl->getLinkTargetByClass(array(
"ilportfoliopagegui",
"ilobjbloggui"),
"render");
1400 $ilCtrl->setParameterByClass(
"ilportfoliopagegui",
"ppage",
"");
1401 $b = $this->
ui->factory()->button()->standard(
1402 $this->
lng->txt(
"blog_edit"),
1412 foreach ($items as $item) {
1415 if (!$is_active && !$a_show_inactive) {
1422 if (!$this->keyword && !$this->author) {
1423 $month = substr($item[
"created"]->
get(
IL_CAL_DATE), 0, 7);
1426 if (!$last_month || $last_month != $month) {
1428 $wtpl->setCurrentBlock(
"month_bl");
1429 $wtpl->parseCurrentBlock();
1433 if ($this->keyword) {
1435 } elseif ($this->author) {
1436 $title =
$lng->
txt(
"blog_author") .
": " . $this->profile_gui->getNamePresentation($this->author);
1438 $title = $this->gui->presentation()->util()->getMonthPresentation($month);
1442 $wtpl->setVariable(
"TXT_CURRENT_MONTH", $title);
1445 if (!$a_link_template) {
1446 $ilCtrl->setParameterByClass(
"ilblogpostinggui",
"bmn", $this->month);
1447 $ilCtrl->setParameterByClass(
"ilblogpostinggui",
"blpg", $item[
"id"]);
1448 $preview = $ilCtrl->getLinkTargetByClass(
"ilblogpostinggui", $a_cmd);
1450 $preview = $this->
buildExportLink($a_link_template,
"posting", (
string) $item[
"id"]);
1452 $more_link = $preview;
1455 $posting_edit = $this->blog_access->mayEditPosting($item[
"id"], $item[
"author"]);
1456 if (($posting_edit || $is_admin) && !$a_link_template && $a_cmd ===
"preview") {
1459 if ($is_active && $this->
object->hasApproval() && !$item[
"approved"]) {
1461 $ilCtrl->setParameter($this,
"apid", $item[
"id"]);
1464 $ilCtrl->getLinkTarget($this,
"approve")
1466 $ilCtrl->setParameter($this,
"apid",
"");
1469 $wtpl->setVariable(
"APPROVAL",
$lng->
txt(
"blog_needs_approval"));
1472 if ($posting_edit) {
1475 $ilCtrl->getLinkTargetByClass(
"ilblogpostinggui",
"edit")
1477 $more_link = $ilCtrl->getLinkTargetByClass(
"ilblogpostinggui",
"edit");
1482 $lng->
txt(
"blog_toggle_draft"),
1483 $ilCtrl->getLinkTargetByClass(
"ilblogpostinggui",
"deactivatePageToList")
1487 $lng->
txt(
"blog_toggle_final"),
1488 $ilCtrl->getLinkTargetByClass(
"ilblogpostinggui",
"activatePageToList")
1494 $ilCtrl->getLinkTargetByClass(
"ilblogpostinggui",
"edittitle")
1497 if ($this->
object->hasKeywords()) {
1499 $lng->
txt(
"blog_edit_keywords"),
1500 $ilCtrl->getLinkTargetByClass(
"ilblogpostinggui",
"editKeywords")
1506 $ilCtrl->getLinkTargetByClass(
"ilblogpostinggui",
"editdate")
1511 $ilCtrl->getLinkTargetByClass(
"ilblogpostinggui",
"deleteBlogPostingConfirmationScreen")
1513 } elseif ($is_admin) {
1516 $ilCtrl->setParameter($this,
"apid", $item[
"id"]);
1518 $lng->
txt(
"blog_toggle_draft_admin"),
1519 $ilCtrl->getLinkTarget($this,
"deactivateAdmin")
1521 $ilCtrl->setParameter($this,
"apid",
"");
1526 $ilCtrl->getLinkTargetByClass(
"ilblogpostinggui",
"deleteBlogPostingConfirmationScreen")
1530 $dd =
$ui_factory->dropdown()->standard($actions)->withLabel($this->
lng->txt(
"actions"));
1532 $wtpl->setCurrentBlock(
"actions");
1533 $wtpl->setVariable(
"ACTION_SELECTOR",
$ui_renderer->render($dd));
1534 $wtpl->parseCurrentBlock();
1540 $notes_context = $this->notes
1547 $count = $this->notes
1549 ->getNrOfCommentsForContext($notes_context);
1551 if ($a_cmd !==
"preview") {
1552 $wtpl->setCurrentBlock(
"comments");
1553 $wtpl->setVariable(
"TEXT_COMMENTS",
$lng->
txt(
"blog_comments"));
1554 $wtpl->setVariable(
"URL_COMMENTS", $preview);
1555 $wtpl->setVariable(
"COUNT_COMMENTS", $count);
1556 $wtpl->parseCurrentBlock();
1561 if ($this->node_id !== null &&
1562 $a_cmd !==
"preview" &&
1563 $a_cmd !==
"previewEmbedded") {
1564 if ($this->id_type === self::WORKSPACE_NODE_ID) {
1565 $goto = $this->gui->permanentLink(0, (
int) $this->node_id)->getPermanentLink((
int) $item[
"id"]);
1567 $goto = $this->gui->permanentLink((
int) $this->node_id)->getPermanentLink((
int) $item[
"id"]);
1569 $wtpl->setCurrentBlock(
"permalink");
1570 $wtpl->setVariable(
"URL_PERMALINK", $goto);
1571 $wtpl->setVariable(
"TEXT_PERMALINK",
$lng->
txt(
"blog_link"));
1572 $wtpl->parseCurrentBlock();
1577 $this->
object->hasAbstractShorten(),
1578 $this->
object->getAbstractShortenLength(),
1580 $this->
object->hasAbstractImage(),
1581 $this->
object->getAbstractImageWidth(),
1582 $this->
object->getAbstractImageHeight(),
1587 $wtpl->setCurrentBlock(
"more");
1588 $wtpl->setVariable(
"URL_MORE", $more_link);
1589 $wtpl->setVariable(
"TEXT_MORE",
$lng->
txt(
"blog_list_more"));
1590 $wtpl->parseCurrentBlock();
1596 $wtpl->setCurrentBlock(
"draft_text");
1597 $wtpl->setVariable(
"DRAFT_TEXT",
$lng->
txt(
"blog_draft_text"));
1598 $wtpl->parseCurrentBlock();
1599 $wtpl->setVariable(
"DRAFT_CLASS",
" ilBlogListItemDraft");
1603 $reading_time = $this->reading_time_manager->getReadingTime(
1607 if (!is_null($reading_time)) {
1608 $this->
lng->loadLanguageModule(
"copg");
1609 $wtpl->setCurrentBlock(
"reading_time");
1612 $this->
lng->txt(
"copg_est_reading_time") .
": " .
1613 sprintf($this->
lng->txt(
"copg_x_minutes"), $reading_time)
1615 $wtpl->parseCurrentBlock();
1618 $wtpl->setCurrentBlock(
"posting");
1621 if ($this->id_type === self::REPOSITORY_NODE_ID) {
1624 $author_id = $item[
"author"];
1626 $authors[] = $this->profile_gui->getNamePresentation($author_id);
1629 if (isset($item[
"editors"])) {
1630 foreach ($item[
"editors"] as $editor_id) {
1631 $authors[] = $this->profile_gui->getNamePresentation($editor_id);
1636 $author = implode(
", ", $authors) .
" - ";
1641 $wtpl->setVariable(
"URL_TITLE", $preview);
1642 $wtpl->setVariable(
"TITLE", $item[
"title"]);
1646 $keywords = (count($kw) > 0)
1647 ?
"<br>" . $this->
lng->txt(
"keywords") .
": " . implode(
", ", $kw)
1650 $wtpl->setVariable(
"DATETIME", $author .
1654 $wtpl->setVariable(
"CONTENT", $snippet);
1656 $wtpl->parseCurrentBlock();
1660 if ($a_cmd ===
"previewFullscreen") {
1661 $ref_id = ($this->id_type === self::WORKSPACE_NODE_ID)
1664 $wsp_id = ($this->id_type === self::WORKSPACE_NODE_ID)
1667 $this->gui->permanentLink(
$ref_id, $wsp_id)->setPermanentLink();
1670 if (!$is_empty || $a_show_inactive) {
1671 return $wtpl->get();
1684 return \ILIAS\Blog\Export\BlogHtmlExport::buildExportLink($a_template, $a_type, $a_id, $this->
getKeywords(
false));
1693 string $a_list_cmd =
"render",
1694 string $a_posting_cmd =
"preview",
1695 ?
string $a_link_template = null,
1696 bool $a_show_inactive =
false,
1701 $blpg = ($a_blpg > 0)
1707 foreach ($a_items as $month => $postings) {
1708 foreach (array_keys($postings) as
$id) {
1710 if (!$a_show_inactive && !$active) {
1711 unset($a_items[$month][
$id]);
1713 $a_items[
$month][
$id][
"active"] = $active;
1716 if (!count($a_items[$month])) {
1717 unset($a_items[$month]);
1724 $max_months = $this->
object->getNavModeListMonths();
1726 $wtpl =
new ilTemplate(
"tpl.blog_list_navigation_by_date.html",
true,
true,
"Modules/Blog");
1728 $ilCtrl->setParameter($this,
"blpg",
"");
1730 $counter = $mon_counter = $last_year = 0;
1731 foreach ($a_items as $month => $postings) {
1732 if (!$a_link_template && $max_months && $mon_counter >= $max_months) {
1737 $year = substr($month, 0, 4);
1738 if (!$last_year || $year != $last_year) {
1747 if (!$a_link_template) {
1748 $ilCtrl->setParameter($this,
"bmn", $month);
1749 $month_url = $ilCtrl->getLinkTarget($this, $a_list_cmd);
1751 $month_url = $this->
buildExportLink($a_link_template,
"list", (
string) $month);
1756 if ($mon_counter <= $this->
object->getNavModeListMonthsWithPostings()) {
1758 $wtpl->setCurrentBlock(
"navigation_year_details");
1759 $wtpl->setVariable(
"YEAR", $year);
1760 $wtpl->parseCurrentBlock();
1763 foreach ($postings as
$id => $posting) {
1774 if (!$a_link_template) {
1775 $ilCtrl->setParameterByClass(
"ilblogpostinggui",
"bmn", $month);
1776 $ilCtrl->setParameterByClass(
"ilblogpostinggui",
"blpg",
$id);
1777 $url = $ilCtrl->getLinkTargetByClass(
"ilblogpostinggui", $a_posting_cmd);
1782 if (!$posting[
"active"]) {
1783 $wtpl->setVariable(
"NAV_ITEM_DRAFT", $this->
lng->txt(
"blog_draft"));
1784 } elseif ($this->
object->hasApproval() && !$posting[
"approved"]) {
1785 $wtpl->setVariable(
"NAV_ITEM_APPROVAL", $this->
lng->txt(
"blog_needs_approval"));
1788 $wtpl->setCurrentBlock(
"navigation_item");
1789 $wtpl->setVariable(
"NAV_ITEM_URL",
$url);
1790 $wtpl->setVariable(
"NAV_ITEM_CAPTION", $caption);
1791 $wtpl->parseCurrentBlock();
1794 $wtpl->setCurrentBlock(
"navigation_month_details");
1795 $wtpl->setVariable(
"NAV_MONTH", $month_name);
1796 $wtpl->setVariable(
"URL_MONTH", $month_url);
1801 $wtpl->setCurrentBlock(
"navigation_year");
1802 $wtpl->setVariable(
"YEAR", $year);
1803 $wtpl->parseCurrentBlock();
1806 $wtpl->setCurrentBlock(
"navigation_month");
1807 $wtpl->setVariable(
"MONTH_NAME", $month_name);
1808 $wtpl->setVariable(
"URL_MONTH", $month_url);
1809 $wtpl->setVariable(
"MONTH_COUNT", count($postings));
1811 $wtpl->parseCurrentBlock();
1813 if (!$a_link_template) {
1814 $this->
ctrl->setParameterByClass(self::class,
"bmn", null);
1815 $url = $this->
ctrl->getLinkTargetByClass(self::class, $a_list_cmd);
1817 $url =
"index.html";
1822 $this->
ui->renderer()->render(
1823 $this->
ui->factory()->link()->standard(
1824 $this->
lng->txt(
"blog_starting_page"),
1832 $wtpl =
new ilTemplate(
"tpl.blog_list_navigation_month.html",
true,
true,
"Modules/Blog");
1834 $ilCtrl->setParameter($this,
"blpg",
"");
1836 $month_options = array();
1837 foreach ($a_items as $month => $postings) {
1838 $month_name = $this->gui->presentation()->util()->getMonthPresentation($month);
1840 $month_options[
$month] = $month_name;
1842 if ($month == $this->month) {
1843 if (!$a_link_template) {
1844 $ilCtrl->setParameter($this,
"bmn", $month);
1845 $month_url = $ilCtrl->getLinkTarget($this, $a_list_cmd);
1847 $month_url = $this->
buildExportLink($a_link_template,
"list", (
string) $month);
1850 foreach ($postings as
$id => $posting) {
1854 if (!$a_link_template) {
1855 $ilCtrl->setParameterByClass(
"ilblogpostinggui",
"bmn", $month);
1856 $ilCtrl->setParameterByClass(
"ilblogpostinggui",
"blpg",
$id);
1857 $url = $ilCtrl->getLinkTargetByClass(
"ilblogpostinggui", $a_posting_cmd);
1862 if (!$posting[
"active"]) {
1863 $wtpl->setVariable(
"NAV_ITEM_DRAFT", $this->
lng->txt(
"blog_draft"));
1864 } elseif ($this->
object->hasApproval() && !$posting[
"approved"]) {
1865 $wtpl->setVariable(
"NAV_ITEM_APPROVAL", $this->
lng->txt(
"blog_needs_approval"));
1868 $wtpl->setCurrentBlock(
"navigation_item");
1869 $wtpl->setVariable(
"NAV_ITEM_URL",
$url);
1870 $wtpl->setVariable(
"NAV_ITEM_CAPTION", $caption);
1871 $wtpl->parseCurrentBlock();
1874 $wtpl->setCurrentBlock(
"navigation_month_details");
1876 $wtpl->setVariable(
"NAV_MONTH", $month_name);
1877 $wtpl->setVariable(
"URL_MONTH", $month_url);
1879 $wtpl->parseCurrentBlock();
1884 $wtpl->setCurrentBlock(
"option_bl");
1885 foreach ($month_options as $value => $caption) {
1886 $wtpl->setVariable(
"OPTION_VALUE", $value);
1887 $wtpl->setVariable(
"OPTION_CAPTION", $caption);
1888 if ($value == $this->month) {
1889 $wtpl->setVariable(
"OPTION_SEL",
' selected="selected"');
1891 $wtpl->parseCurrentBlock();
1894 $wtpl->setVariable(
"FORM_ACTION", $ilCtrl->getFormAction($this, $a_list_cmd));
1897 $ilCtrl->setParameter($this,
"bmn", $this->month);
1898 $ilCtrl->setParameterByClass(
"ilblogpostinggui",
"bmn",
"");
1899 return $wtpl->get();
1906 string $a_list_cmd =
"render",
1907 bool $a_show_inactive =
false,
1908 string $a_link_template =
"",
1913 $blpg = ($a_blpg > 0)
1917 $keywords = $this->
getKeywords($a_show_inactive, $blpg);
1919 $wtpl =
new ilTemplate(
"tpl.blog_list_navigation_keywords.html",
true,
true,
"Modules/Blog");
1921 $max = max($keywords);
1923 $wtpl->setCurrentBlock(
"keyword");
1924 foreach ($keywords as $keyword => $counter) {
1925 if (!$a_link_template) {
1926 $ilCtrl->setParameter($this,
"kwd", urlencode((
string) $keyword));
1927 $url = $ilCtrl->getLinkTarget($this, $a_list_cmd);
1928 $ilCtrl->setParameter($this,
"kwd",
"");
1933 $wtpl->setVariable(
"TXT_KEYWORD", $keyword);
1935 $wtpl->setVariable(
"URL_KEYWORD",
$url);
1936 $wtpl->parseCurrentBlock();
1939 return $wtpl->get();
1946 string $a_list_cmd =
"render",
1947 bool $a_show_inactive =
false 1952 foreach ($a_items as $month => $items) {
1953 foreach ($items as $item) {
1955 if ($item[
"author"]) {
1956 $authors[] = $item[
"author"];
1959 if (isset($item[
"editors"])) {
1960 foreach ($item[
"editors"] as $editor_id) {
1961 if ($editor_id != $item[
"author"]) {
1962 $authors[] = $editor_id;
1970 $authors = array_unique($authors);
1973 $authors = array_filter($authors,
function (
$id) {
1977 if (count($authors) > 1) {
1979 foreach ($authors as $user_id) {
1981 $ilCtrl->setParameter($this,
"ath", $user_id);
1982 $url = $ilCtrl->getLinkTarget($this, $a_list_cmd);
1983 $ilCtrl->setParameter($this,
"ath",
"");
1986 if (substr($base_name, 0, 1) ==
"[") {
2000 $sort = $name_arr[
"lastname"] .
" " . $name_arr[
"firstname"];
2003 $idx = trim(strip_tags($sort)) .
"///" . $user_id;
2004 $list[$idx] = array($name,
$url);
2009 $wtpl =
new ilTemplate(
"tpl.blog_list_navigation_authors.html",
true,
true,
"Modules/Blog");
2011 $wtpl->setCurrentBlock(
"author");
2012 foreach ($list as $author) {
2013 $wtpl->setVariable(
"TXT_AUTHOR", $author[0]);
2014 $wtpl->setVariable(
"URL_AUTHOR", $author[1]);
2015 $wtpl->parseCurrentBlock();
2018 return $wtpl->get();
2028 bool $single_posting =
false 2030 $nav_renderer = $this->gui->navigation()->toolbarNavigationRenderer();
2031 $nav_renderer->renderToolbarNavigation(
2046 string $a_list_cmd =
"render",
2047 string $a_posting_cmd =
"preview",
2048 string $a_link_template = null,
2049 bool $a_show_inactive =
false,
2054 $blpg = ($a_blpg > 0)
2058 if ($this->
object->getOrder()) {
2059 $order = array_flip($this->
object->getOrder());
2068 $wtpl =
new ilTemplate(
"tpl.blog_list_navigation.html",
true,
true,
"Modules/Blog");
2073 if (count($a_items)) {
2074 $blocks[$order[
"navigation"]] = array(
2075 $this->
lng->txt(
"blog_navigation"),
2076 $this->
renderNavigationByDate($a_items, $a_list_cmd, $a_posting_cmd, $a_link_template, $a_show_inactive, $a_blpg)
2080 if ($this->
object->hasKeywords()) {
2082 $may_edit_keywords = ($blpg > 0 &&
2083 $this->blog_access->mayEditPosting($blpg) &&
2084 $a_list_cmd !==
"preview" &&
2085 $a_list_cmd !==
"gethtml" &&
2088 if ($keywords || $may_edit_keywords) {
2090 $keywords = $this->
lng->txt(
"blog_no_keywords");
2093 $blocks[$order[
"keywords"]] = array(
2094 $this->
lng->txt(
"blog_keywords"),
2097 ? array($cmd, $this->
lng->txt(
"blog_edit_keywords"))
2104 if (!$a_link_template) {
2106 if ($this->id_type === self::REPOSITORY_NODE_ID &&
2107 $this->
object->hasAuthors()) {
2110 $blocks[$order[
"authors"]] = array($this->
lng->txt(
"blog_authors"), $authors);
2115 if ($this->
object->hasRSS() &&
2117 $a_list_cmd ===
"preview") {
2120 if ($this->id_type !== self::WORKSPACE_NODE_ID) {
2123 $url = ILIAS_HTTP_PATH .
"/feed.php?blog_id=" . $blog_id .
2124 "&client_id=" . rawurlencode(
CLIENT_ID);
2130 if (count($blocks)) {
2137 foreach ($blocks as $block) {
2140 $content = $block[1];
2144 if (isset($block[2]) && is_array($block[2])) {
2145 $link =
$ui_factory->button()->shy($block[2][1], $block[2][0]);
2146 $secondary_panel = $secondary_panel->withFooter($link);
2149 $wtpl->setCurrentBlock(
"block_bl");
2150 $wtpl->setVariable(
"BLOCK",
$ui_renderer->render($secondary_panel));
2151 $wtpl->parseCurrentBlock();
2155 return $wtpl->get();
2162 bool $a_show_inactive,
2163 ?
int $a_posting_id = null
2165 $keywords = array();
2166 if ($a_posting_id) {
2168 if (isset($keywords[$keyword])) {
2175 foreach ($this->items as $month => $items) {
2176 foreach ($items as $item) {
2179 if (isset($keywords[$keyword])) {
2192 foreach ($keywords as $keyword => $counter) {
2193 $tmp[] = array(
"keyword" => $keyword,
"counter" => $counter);
2197 $keywords = array();
2198 foreach ($tmp as $item) {
2199 $keywords[(string) $item[
"keyword"]] = $item[
"counter"];
2208 bool $a_include_comments =
false,
2209 bool $print_version =
false 2212 $format = explode(
"_", $this->blog_request->getFormat());
2213 if (($format[1] ??
"") ===
"comments" || $a_include_comments) {
2214 $a_include_comments =
true;
2215 $type =
"html_comments";
2222 $subdir = $this->
object->getType() .
"_" . $this->
object->getId();
2223 if ($print_version) {
2227 $blog_export = new \ILIAS\Blog\Export\BlogHtmlExport($this, $exp_dir, $subdir);
2228 $blog_export->setPrintVersion($print_version);
2229 $blog_export->includeComments($a_include_comments);
2230 return $blog_export->exportHTML();
2240 $this->disable_notes = $a_value;
2249 if ($a_cmd ===
"preview" || $a_cmd ===
"previewEmbedded" || $a_cmd ===
"previewFullscreen" || $this->prvm) {
2257 $ilCtrl->setParameter($this,
"prvm",
"");
2266 ?
string $sub_type = null,
2267 ?
int $sub_id = null,
2268 bool $is_preview =
false 2272 if (!$this->obj_id) {
2275 $sub_type = $sub_id = null;
2276 if ($this->blpg > 0) {
2281 $lg = parent::initHeaderAction($sub_type, $sub_id);
2285 $lg->enableComments(
false);
2286 $lg->enableNotes(
false);
2289 if ($this->blpg > 0) {
2291 $lg->enableComments(
true);
2293 $lg->enableNotes(
true);
2295 $lg->enableTags(
false);
2297 if (!$this->prtf_embed) {
2299 $ilCtrl->setParameter($this,
"ntf", 1);
2300 $link = $ilCtrl->getLinkTarget($this,
"setNotification");
2301 $ilCtrl->setParameter($this,
"ntf",
"");
2303 $lg->addCustomCommand($link,
"blog_notification_toggle_off");
2309 $this->
lng->txt(
"blog_notification_activated")
2312 $ilCtrl->setParameter($this,
"ntf", 2);
2313 $link = $ilCtrl->getLinkTarget($this,
"setNotification");
2314 $ilCtrl->setParameter($this,
"ntf",
"");
2315 $lg->addCustomCommand($link,
"blog_notification_toggle_on");
2320 $this->
lng->txt(
"blog_notification_deactivated")
2326 if ($this->blog_access->mayContribute()) {
2327 $ilCtrl->setParameter($this,
"prvm",
"");
2329 $ilCtrl->setParameter($this,
"bmn",
"");
2330 $ilCtrl->setParameter($this,
"blpg",
"");
2331 $link = $ilCtrl->getLinkTarget($this,
"");
2332 $ilCtrl->setParameter($this,
"blpg", $sub_id);
2333 $ilCtrl->setParameter($this,
"bmn", $this->month);
2334 $lg->addCustomCommand($link,
"blog_edit");
2336 if ($sub_id && $this->blog_access->mayEditPosting($sub_id)) {
2337 $link = $ilCtrl->getLinkTargetByClass(
"ilblogpostinggui",
"edit");
2338 $lg->addCustomCommand($link,
"blog_edit_posting");
2341 $ilCtrl->setParameter($this,
"prvm",
"fsc");
2344 $ilCtrl->setParameter($this,
"ntf",
"");
2355 switch ($this->ntf) {
2365 $ilCtrl->redirect($this,
"preview");
2377 if (
$post->getBlogId() === $a_blog_id) {
2378 return $post->getTitle();
2388 foreach ($this->items as $month => $postings) {
2389 foreach ($postings as
$id => $item) {
2391 unset($this->items[$month][
$id]);
2392 } elseif ($this->
object->hasApproval() && !$item[
"approved"]) {
2393 unset($this->items[$month][
$id]);
2396 if (!count($this->items[$month])) {
2397 unset($this->items[$month]);
2401 if ($this->items && !isset($this->items[$this->month])) {
2402 $keys = array_keys($this->items);
2403 $this->month = array_shift($keys);
2412 foreach ($a_items as $month => $items) {
2413 foreach ($items as $item) {
2438 if (is_object($this->
object)) {
2445 if ($this->
isAdmin() && $this->apid > 0) {
2447 $post->setApproved(
true);
2448 $post->setBlogNodeId($this->node_id, ($this->id_type == self::WORKSPACE_NODE_ID));
2449 $post->update(
true,
false,
true,
"new");
2451 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"settings_saved"),
true);
2454 $this->
ctrl->redirect($this,
"render");
2474 $ilTabs->activateTab(
"contributors");
2476 $local_roles = $this->
object->getAllLocalRoles($this->node_id);
2483 'auto_complete_name' =>
$lng->
txt(
'user'),
2484 'submit_name' =>
$lng->
txt(
'add'),
2485 'add_search' =>
true,
2487 'user_type' => $local_roles
2492 $other_roles = $this->
object->getRolesWithContributeOrRedact($this->node_id);
2494 $this->tpl->setOnScreenMessage(
'info', sprintf(
$lng->
txt(
"blog_contribute_other_roles"), implode(
", ", $other_roles)));
2497 $tbl = $this->gui->contributor()->ilContributorTableGUI(
2500 $this->
object->getAllLocalRoles($this->node_id)
2513 $user_login = $this->blog_request->getUserLogin();
2514 $user_type = $this->blog_request->getUserType();
2516 if (trim($user_login) ===
'') {
2517 $this->tpl->setOnScreenMessage(
'failure',
$lng->
txt(
'msg_no_search_string'));
2521 $users = explode(
',', $user_login);
2523 $user_ids = array();
2524 foreach ($users as
$user) {
2528 $this->tpl->setOnScreenMessage(
'failure',
$lng->
txt(
'user_not_known'));
2533 $user_ids[] = (
int) $user_id;
2543 array $a_user_ids = array(),
2544 ?
string $a_user_type = null
2550 $a_user_type = (
int) $a_user_type;
2556 if (!count($a_user_ids) || !$a_user_type) {
2557 $this->tpl->setOnScreenMessage(
'failure',
$lng->
txt(
"no_checkbox"));
2563 $local_roles = array_keys($this->
object->getAllLocalRoles($this->node_id));
2564 if (!in_array($a_user_type, $local_roles)) {
2565 $this->tpl->setOnScreenMessage(
'failure',
$lng->
txt(
"missing_perm"));
2570 foreach ($a_user_ids as $user_id) {
2571 $user_id = (
int) $user_id;
2572 $a_user_type = (
int) $a_user_type;
2573 if (!$rbacreview->isAssigned($user_id, $a_user_type)) {
2574 $rbacadmin->
assignUser($a_user_type, $user_id);
2578 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"settings_saved"),
true);
2579 $ilCtrl->redirect($this,
"contributors");
2587 $ids = $this->blog_request->getIds();
2589 if (count($ids) === 0) {
2590 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"select_one"),
true);
2591 $this->
ctrl->redirect($this,
"contributors");
2595 $confirm->setHeaderText($this->
lng->txt(
'blog_confirm_delete_contributors'));
2596 $confirm->setFormAction($this->
ctrl->getFormAction($this,
'removeContributor'));
2597 $confirm->setConfirm($this->
lng->txt(
'delete'),
'removeContributor');
2598 $confirm->setCancel($this->
lng->txt(
'cancel'),
'contributors');
2600 foreach ($ids as $user_id) {
2604 $this->profile_gui->getNamePresentation($user_id,
false,
"",
true)
2608 $this->tpl->setContent($confirm->getHTML());
2617 $ids = $this->blog_request->getIds();
2619 if (count($ids) === 0) {
2620 $this->tpl->setOnScreenMessage(
'failure',
$lng->
txt(
"select_one"),
true);
2621 $ilCtrl->redirect($this,
"contributors");
2625 $local_roles = array_keys($this->
object->getAllLocalRoles($this->node_id));
2626 if (!$local_roles) {
2627 $this->tpl->setOnScreenMessage(
'failure',
$lng->
txt(
"missing_perm"));
2632 foreach ($ids as $user_id) {
2633 foreach ($local_roles as $role_id) {
2638 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"settings_saved"),
true);
2639 $this->
ctrl->redirect($this,
"contributors");
2647 $post->setApproved(
false);
2648 $post->setActive(
false);
2649 $post->update(
true,
false,
false);
2651 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"settings_saved"),
true);
2654 $this->
ctrl->redirect($this,
"render");
2673 $this->content_style_gui->
addCss(
2675 $this->
object->getRefId(),
2676 $this->
object->getId()
2683 public static function _goto(
string $a_target): void
2687 $ilCtrl = $DIC->ctrl();
2690 $id = explode(
"_", $a_target);
2691 if (substr($a_target, -3) ===
"wsp") {
2692 $ilCtrl->setParameterByClass(
"ilSharedResourceGUI",
"wsp_id",
$id[0]);
2694 if (count(
$id) >= 2) {
2695 if (is_numeric(
$id[1])) {
2696 $ilCtrl->setParameterByClass(
"ilSharedResourceGUI",
"gtp",
$id[1]);
2698 $ilCtrl->setParameterByClass(
"ilSharedResourceGUI",
"kwd",
$id[1]);
2700 if ((
$id[2] ??
"") ===
"edit") {
2701 $ilCtrl->setParameterByClass(
"ilSharedResourceGUI",
"edt",
$id[2]);
2704 $ilCtrl->redirectByClass(
"ilSharedResourceGUI",
"");
2706 $ilCtrl->setParameterByClass(
"ilRepositoryGUI",
"ref_id",
$id[0]);
2708 if (count(
$id) >= 2) {
2709 if (is_numeric(
$id[1])) {
2710 $ilCtrl->setParameterByClass(
"ilRepositoryGUI",
"gtp",
$id[1]);
2712 $ilCtrl->setParameterByClass(
"ilRepositoryGUI",
"kwd",
$id[1]);
2715 if ((
$id[2] ??
"") ===
"edit") {
2716 $ilCtrl->setParameterByClass(
"ilRepositoryGUI",
"edt",
$id[2]);
2720 $ilCtrl->redirectByClass(
"ilRepositoryGUI",
"preview");
2723 $ilCtrl->redirectByClass(
"ilRepositoryGUI",
"infoScreen");
2742 $style_sheet_id = $this->content_style_domain->getEffectiveStyleId();
2746 $provider = new \ILIAS\Blog\BlogPrintViewProviderGUI(
2751 $this->access_handler,
2753 $this->blog_request->getObjIds()
2756 return new \ILIAS\Export\PrintProcessGUI(
2766 $view = $this->getPrintView();
2772 $print_view = $this->getPrintView();
2773 $print_view->sendPrintView();
2778 $this->
ctrl->redirectByClass(ilExportGUI::class);
ilNavigationHistory $nav_history
checkPermission(string $perm, string $cmd="", string $type="", int $ref_id=null)
ILIAS Blog InternalDomainService $domain
filterInactivePostings()
Filter inactive items from items list.
export(bool $a_with_comments=false)
Build and deliver export file.
ilRbacReview $rbac_review
const ABSTRACT_DEFAULT_IMAGE_WIDTH
static _lookupActive(int $a_id, string $a_parent_type, bool $a_check_scheduled_activation=false, string $a_lang="-")
lookup activation status
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addUserFromAutoComplete()
Autocomplete submit.
setLocator()
Insert locator.
renderNavigationByKeywords(string $a_list_cmd="render", bool $a_show_inactive=false, string $a_link_template="", int $a_blpg=0)
Build navigation by keywords block.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
preview()
Render fullscreen presentation.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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...
redirect(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
ILIAS Blog ReadingTime ReadingTimeManager $reading_time_manager
static getAllPostings(int $a_blog_id, int $a_limit=1000, int $a_offset=0)
Get all postings of blog.
New implementation of ilObjectGUI.
GUI class for the workflow of copying objects.
static _numericMonthToString(int $a_month, bool $a_long=true)
numeric month to string
addHeaderActionForCommand(string $a_cmd)
buildPostingList(int $a_obj_id)
Gather all blog postings.
insertHeaderAction(?ilObjectListGUI $list_gui=null)
Insert header action into main template.
renderNavigationByDate(array $a_items, string $a_list_cmd="render", string $a_posting_cmd="preview", ?string $a_link_template=null, bool $a_show_inactive=false, int $a_blpg=0)
Build navigation by date block.
Class ilBlogPosting GUI class.
static exists(int $a_blog_id, int $a_posting_id)
Checks whether a posting exists.
checkAccess(string $a_permission, string $a_cmd, int $a_ref_id, string $a_type="", ?int $a_obj_id=null, ?int $a_tree_id=null)
check access for an object (provide $a_type and $a_obj_id if available for better performance) ...
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
setContentStyleSheet(ilGlobalTemplateInterface $a_tpl=null)
renderNavigationByAuthors(array $a_items, string $a_list_cmd="render", bool $a_show_inactive=false)
assignUser(int $a_rol_id, int $a_usr_id)
Assigns an user to a role.
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
StandardGUIRequest $blog_request
exportWithComments()
Handle export choice.
resetHeaderBlock(bool $a_reset_header_action=true)
Reset all header properties: title, icon, description, alerts, action menu.
static _lookupName(int $a_user_id)
lookup user name
static _lookupId($a_user_str)
prepareOutput(bool $show_sub_objects=true)
static _lookupOwner(int $obj_id)
Lookup owner user ID for object ID.
static _goto(string $a_target)
Deep link.
updateCustom(ilPropertyFormGUI $form)
ILIAS Blog InternalGUIService $gui
static getRelevanceClass(int $cnt, int $max)
const ABSTRACT_DEFAULT_SHORTEN_LENGTH
renderFullScreen(string $a_content, string $a_navigation)
Build fullscreen context.
setTitleIcon(string $a_icon_path, string $a_icon_desc="")
set title icon
static _getExportDirectory(int $a_obj_id, string $a_type="xml", string $a_obj_type="", string $a_entity="")
Get export directory for an repository object.
initEditCustomForm(ilPropertyFormGUI $a_form)
ILIAS Blog Access BlogAccess $blog_access
catch(\Exception $e) $req
static deliverFileLegacy(string $a_file, ?string $a_filename=null, ?string $a_mime=null, ?bool $isInline=false, ?bool $removeAfterDelivery=false, ?bool $a_exit_after=true)
ILIAS Style Content GUIService $content_style_gui
getEditFormCustomValues(array &$a_values)
Export User Interface Class.
getListItems(bool $a_show_inactive=false)
Filter blog postings by month, keyword or author.
initHeaderAction(?string $sub_type=null, ?int $sub_id=null, bool $is_preview=false)
checkForParentType(int $a_ref_id, string $a_type, bool $a_exclude_source_check=false)
Check for parent type e.g check if a folder (ref_id 3) is in a parent course obj => checkForParentTyp...
ILIAS Repository Profile ProfileAdapter $profile
static http()
Fetches the global http state from ILIAS.
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $node_id=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:
disableNotes(bool $a_value=false)
setContent(string $a_html)
Sets content for standard template.
static setNotification(int $type, int $user_id, int $id, bool $status=true)
Set notification status for object and user.
const ABSTRACT_DEFAULT_IMAGE_HEIGHT
confirmRemoveContributor()
Used in ilContributorTableGUI.
static _createExportDirectory(int $a_obj_id, string $a_export_type="xml", string $a_obj_type="")
static _getStaticLink(?int $a_ref_id, string $a_type='', bool $a_fallback_goto=true, string $append="")
static _recordReadEvent(string $a_type, int $a_ref_id, int $obj_id, int $usr_id, bool $isCatchupWriteEvents=true, $a_ext_rc=null, $a_ext_time=null)
static isCommentsExportPossible(int $blog_id)
ILIAS Style Content Object ObjectFacade $content_style_domain
ilGlobalTemplateInterface $tpl
afterSave(ilObject $new_object)
render()
Render object context.
ContextServices $tool_context
static fillAutoCompleteToolbar(object $parent_object, ilToolbarGUI $toolbar=null, array $a_options=[], bool $a_sticky=false)
array( auto_complete_name = $lng->txt('user'), auto_complete_size = 15, user_type = array(ilCoursePar...
initCreationForms(string $new_type)
loadStandardTemplate()
This loads the standard template "tpl.adm_content.html" and "tpl.statusline.html" the CONTENT and STA...
getParentId(int $a_node_id)
get parent id of given node
buildExportFile(bool $a_include_comments=false, bool $print_version=false)
Build export file.
setSettingsSubTabs(string $a_active)
setTitle(string $a_title, bool $hidden=false)
Sets title in standard template.
getKeywords(bool $a_show_inactive, ?int $a_posting_id=null)
Get keywords for single posting or complete blog.
renderFullscreenHeader(ilGlobalTemplateInterface $a_tpl, int $a_user_id, bool $a_export=false)
Render banner, user name.
addOnLoadCode(string $a_code, int $a_batch=2)
Add on load code.
Last visited history for repository items.
createPosting()
Create new posting.
static _getPersonalPicturePath(int $a_usr_id, string $a_size="small", bool $a_force_pic=false, bool $a_prevent_no_photo_image=false, bool $html_export=false)
static lookupBlogId(int $a_posting_id)
ILIAS Blog ReadingTime BlogSettingsGUI $reading_time_gui
activateTab(string $a_id)
renderNavigation(string $a_list_cmd="render", string $a_posting_cmd="preview", string $a_link_template=null, bool $a_show_inactive=false, int $a_blpg=0)
Build navigation blocks.
infoScreen()
this one is called from the info button in the repository
isAdmin()
Check if user has admin access (approve, may edit & deactivate all postings)
ILIAS HTTP Services $http
addContributor(array $a_user_ids=array(), ?string $a_user_type=null)
Centralized method to add contributors.
ILIAS Repository Profile ProfileGUI $profile_gui
setDescription(string $a_descr)
Sets description below title in standard template.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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.
addItem(string $a_title, string $a_link, string $a_frame="", int $a_ref_id=0, ?string $type=null)
static hasNotification(int $type, int $user_id, int $id)
Check notification status for object and user.
static lookupSubObjectTitle(int $a_blog_id, int $a_posting_id)
Get title for blog posting (used in ilNotesGUI)
static signFile(string $path_to_file)
static getKeywords(int $a_obj_id, int $a_posting_id)
filterItemsByKeyword(array $a_items, string $a_keyword)
setRightContent(string $a_html)
Sets content of right column.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
renderToolbarNavigation(array $a_items, bool $single_posting=false)
Toolbar navigation.
Class ilRbacAdmin Core functions for role based access control.
buildEmbedded(string $a_content, string $a_nav)
Combine content (list/posting) and navigation to html chunk.
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
renderList(array $items, string $a_cmd="preview", string $a_link_template="", bool $a_show_inactive=false, string $a_export_directory="")
Build posting month list.
static _lookupType(int $id, bool $reference=false)
addHeaderAction()
Add header action menu.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
buildExportLink(string $a_template, string $a_type, string $a_id)
Build export link.
__construct(int $a_id=0, int $a_id_type=self::REPOSITORY_NODE_ID, int $a_parent_node_id=0)
deassignUser(int $a_rol_id, int $a_usr_id)
Deassigns a user from a role.
ILIAS Notes Service $notes
getHTML()
Return embeddable HTML chunk.
addCss(string $a_css_file, string $media="screen")
Add a css file that should be included in the header.
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
static hasOptOut(int $obj_id)
Is opt out (disable notification) allowed?