33 protected \ILIAS\Notes\Service
$notes;
62 protected \ILIAS\HTTP\Services
$http;
63 protected \ILIAS\DI\UIServices
$ui;
69 int $a_id_type = self::REPOSITORY_NODE_ID,
70 int $a_parent_node_id = 0
75 $this->
help = $DIC[
"ilHelp"];
76 $this->
tabs = $DIC->tabs();
77 $this->nav_history = $DIC[
"ilNavigationHistory"];
78 $this->
user = $DIC->user();
79 $this->
toolbar = $DIC->toolbar();
80 $this->tree = $DIC->repositoryTree();
81 $this->
locator = $DIC[
"ilLocator"];
82 $this->rbac_review = $DIC->rbac()->review();
83 $this->rbacadmin = $DIC->rbac()->admin();
84 $this->
http = $DIC->http();
85 $this->
ui = $DIC->ui();
87 $lng = $DIC->language();
88 $ilCtrl = $DIC->ctrl();
90 $this->blog_request = $DIC->blog()
97 $this->gtp =
$req->getGotoPage();
98 $this->edt =
$req->getEditing();
99 $this->blpg =
$req->getBlogPage();
100 $this->old_nr =
$req->getOldNr();
101 $this->ppage =
$req->getPPage();
102 $this->user_page =
$req->getUserPage();
103 $this->new_type =
$req->getNewType();
104 $this->prvm =
$req->getPreviewMode();
105 $this->ntf =
$req->getNotification();
106 $this->apid =
$req->getApId();
107 $this->month =
$req->getMonth();
108 $this->keyword =
$req->getKeyword();
109 $this->author =
$req->getAuthor();
110 $this->prt_id =
$req->getPrtId();
112 $this->tool_context = $DIC->globalScreen()->tool()->context();
116 $blog_page = $this->blog_request->getBlogPage();
117 if ($blog_page > 0 &&
119 throw new ilException(
"Posting ID does not match blog.");
128 if (!$this->month || !$this->items[$this->month]) {
129 $m = array_keys($this->items);
130 $this->month = array_shift($m);
131 $this->month_default =
true;
135 $ilCtrl->setParameter($this,
"bmn", $this->month);
136 $blog_id = $this->
object->getId();
140 $ilCtrl->saveParameter($this,
"prvm");
142 $cs = $DIC->contentStyle();
143 $this->content_style_gui = $cs->gui();
144 if (is_object($this->
object)) {
145 if ($this->id_type !== self::REPOSITORY_NODE_ID) {
146 $this->content_style_domain = $cs->domain()->styleForObjId($this->
object->getId());
148 $this->content_style_domain = $cs->domain()->styleForRefId($this->
object->getRefId());
152 $this->reading_time_gui = new \ILIAS\Blog\ReadingTime\BlogSettingsGUI($blog_id);
153 $this->reading_time_manager = new \ILIAS\Blog\ReadingTime\ReadingTimeManager();
154 $this->notes = $DIC->notes();
170 $forms = parent::initCreationForms($new_type);
172 if ($this->id_type === self::WORKSPACE_NODE_ID) {
173 unset($forms[self::CFORM_IMPORT], $forms[self::CFORM_CLONE]);
183 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"object_added"),
true);
191 $tree = $DIC->repositoryTree();
195 $this->tabs_gui->addSubTab(
197 $this->
lng->txt(
"blog_properties"),
198 $this->
ctrl->getLinkTarget($this,
'edit')
201 $this->tabs_gui->addSubTab(
203 $this->
lng->txt(
"obj_sty"),
204 $this->
ctrl->getLinkTargetByClass(
"ilobjectcontentstylesettingsgui",
"")
208 if ($this->id_type === self::REPOSITORY_NODE_ID) {
212 if ($grp_ref_id > 0 || $crs_ref_id > 0) {
214 $this->tabs_gui->addSubTab(
216 $this->
lng->txt(
"notifications"),
217 $this->
ctrl->getLinkTargetByClass(
"ilobjnotificationsettingsgui",
'')
223 $this->tabs_gui->activateSubTab($a_active);
235 if ($this->id_type === self::REPOSITORY_NODE_ID) {
244 if (
$ilSetting->get(
'enable_global_profiles')) {
254 $nav->setTitle(
$lng->
txt(
"blog_settings_navigation"));
263 $nav_mode->addOption($opt);
267 $mon_num->
setInfo(
$lng->
txt(
"blog_nav_mode_month_list_num_month_info"));
268 $mon_num->setSize(3);
269 $mon_num->setMinValue(1);
270 $opt->addSubItem($mon_num);
272 $detail_num =
new ilNumberInputGUI(
$lng->
txt(
"blog_nav_mode_month_list_num_month_with_post"),
"nav_list_mon_with_post");
273 $detail_num->
setInfo(
$lng->
txt(
"blog_nav_mode_month_list_num_month_with_post_info"));
275 $detail_num->setSize(3);
277 $opt->addSubItem($detail_num);
281 $nav_mode->addOption($opt);
283 $order_options = array();
284 if ($this->
object->getOrder()) {
285 foreach ($this->
object->getOrder() as $item) {
286 $order_options[] =
$lng->
txt(
"blog_" . $item);
290 if (!in_array(
$lng->
txt(
"blog_navigation"), $order_options)) {
291 $order_options[] =
$lng->
txt(
"blog_navigation");
294 if ($this->id_type === self::REPOSITORY_NODE_ID) {
295 if (!in_array(
$lng->
txt(
"blog_authors"), $order_options)) {
296 $order_options[] =
$lng->
txt(
"blog_authors");
300 $auth->setInfo(
$lng->
txt(
"blog_enable_nav_authors_info"));
308 if (!in_array(
$lng->
txt(
"blog_keywords"), $order_options)) {
309 $order_options[] =
$lng->
txt(
"blog_keywords");
314 $order->setValue(array_shift($order_options));
315 $order->setMulti(
true,
true,
false);
322 $pres->setTitle(
$lng->
txt(
"blog_presentation_frame"));
325 if ($this->id_type === self::REPOSITORY_NODE_ID) {
326 $obj_service->commonSettings()->legacyForm($a_form, $this->
object)->addTileImage();
332 if ($this->id_type === self::REPOSITORY_NODE_ID) {
333 $ppic->setInfo(
$lng->
txt(
"blog_profile_picture_repository_info"));
337 if ($blga_set->get(
"banner")) {
338 $dimensions =
" (" . $blga_set->get(
"banner_width") .
"x" .
339 $blga_set->get(
"banner_height") .
")";
345 $file = $this->
object->getImageFullPath(
true);
351 $this->reading_time_gui->addSettingToForm($a_form);
364 $list->setTitle(
$lng->
txt(
"blog_presentation_overview"));
370 $post_num->setSize(3);
371 $post_num->setMinValue(1);
372 $post_num->setRequired(
true);
376 $a_form->
addItem($abs_shorten);
380 $abs_shorten_len->setRequired(
true);
381 $abs_shorten_len->setSuffix(
$lng->
txt(
"blog_abstract_shorten_characters"));
382 $abs_shorten_len->setMinValue(50,
true);
383 $abs_shorten->addSubItem($abs_shorten_len);
391 $abs_img_width->setRequired(
true);
392 $abs_img_width->setSuffix(
$lng->
txt(
"blog_abstract_image_pixels"));
393 $abs_img_width->setMinValue(32,
true);
394 $abs_img->addSubItem($abs_img_width);
398 $abs_img_height->setRequired(
true);
399 $abs_img_height->setSuffix(
$lng->
txt(
"blog_abstract_image_pixels"));
400 $abs_img_height->setMinValue(32,
true);
401 $abs_img->addSubItem($abs_img_height);
406 if ($this->id_type === self::REPOSITORY_NODE_ID) {
407 $a_values[
"approval"] = $this->
object->hasApproval();
408 $a_values[
"nav_authors"] = $this->
object->hasAuthors();
410 $a_values[
"keywords"] = $this->
object->hasKeywords();
411 $a_values[
"notes"] = $this->
object->getNotesStatus();
412 $a_values[
"ppic"] = $this->
object->hasProfilePicture();
417 $a_values[
"banner"] = $this->
object->getImage();
418 $a_values[
"rss"] = $this->
object->hasRSS();
419 $a_values[
"abss"] = $this->
object->hasAbstractShorten();
420 $a_values[
"absi"] = $this->
object->hasAbstractImage();
421 $a_values[
"nav"] = $this->
object->getNavMode();
422 $a_values[
"nav_list_mon_with_post"] = $this->
object->getNavModeListMonthsWithPostings();
423 $a_values[
"nav_list_mon"] = $this->
object->getNavModeListMonths();
424 $a_values[
"ov_list_post_num"] = $this->
object->getOverviewPostings();
430 $a_values = $this->reading_time_gui->addValueToArray($a_values);
438 if ($this->id_type === self::REPOSITORY_NODE_ID) {
439 $this->
object->setApproval($form->
getInput(
"approval"));
440 $this->
object->setAuthors($form->
getInput(
"nav_authors"));
441 $obj_service->commonSettings()->legacyForm($form, $this->
object)->saveTileImage();
443 $this->
object->setKeywords($form->
getInput(
"keywords"));
444 $this->
object->setNotesStatus($form->
getInput(
"notes"));
445 $this->
object->setProfilePicture($form->
getInput(
"ppic"));
446 $this->
object->setRSS($form->
getInput(
"rss"));
447 $this->
object->setAbstractShorten($form->
getInput(
"abss"));
448 $this->
object->setAbstractShortenLength($form->
getInput(
"abssl"));
449 $this->
object->setAbstractImage($form->
getInput(
"absi"));
450 $this->
object->setAbstractImageWidth($form->
getInput(
"absiw"));
451 $this->
object->setAbstractImageHeight($form->
getInput(
"absih"));
452 $this->
object->setNavMode($form->
getInput(
"nav"));
453 $this->
object->setNavModeListMonthsWithPostings($form->
getInput(
"nav_list_mon_with_post"));
454 $this->
object->setNavModeListMonths($form->
getInput(
"nav_list_mon"));
455 $this->
object->setOverviewPostings($form->
getInput(
"ov_list_post_num"));
456 $this->reading_time_gui->saveSettingFromForm($form);
458 $order = (array) $form->
getInput(
"order");
460 foreach ($order as $idx => $value) {
461 if ($value ==
$lng->
txt(
"blog_navigation")) {
462 $order[$idx] =
"navigation";
463 } elseif ($value ==
$lng->
txt(
"blog_keywords")) {
464 $order[$idx] =
"keywords";
466 $order[$idx] =
"authors";
469 $this->
object->setOrder($order);
473 if ($_FILES[
"banner"][
"tmp_name"]) {
474 $this->
object->uploadImage($_FILES[
"banner"]);
475 } elseif ($banner->getDeletionFlag()) {
476 $this->
object->deleteImage();
486 if ($this->id_type === self::WORKSPACE_NODE_ID) {
487 $this->
ctrl->setParameter($this,
"wsp_id", $this->node_id);
490 $ilHelp->setScreenIdComponent(
"blog");
493 $this->
ctrl->setParameterByClass(self::class,
"bmn", null);
494 $this->tabs_gui->addTab(
497 $this->
ctrl->getLinkTarget($this,
"")
501 $this->tabs_gui->addTab(
504 $this->
ctrl->getLinkTargetByClass(array(
"ilobjbloggui",
"ilinfoscreengui"),
"showSummary")
509 $this->tabs_gui->addTab(
512 $this->
ctrl->getLinkTarget($this,
"edit")
515 if (!$this->prtf_embed) {
516 if ($this->id_type === self::REPOSITORY_NODE_ID) {
517 $this->tabs_gui->addTab(
519 $lng->
txt(
"blog_contributors"),
520 $this->
ctrl->getLinkTarget($this,
"contributors")
524 if ($this->id_type === self::REPOSITORY_NODE_ID) {
525 $this->tabs_gui->addTab(
528 $this->
ctrl->getLinkTargetByClass(
"ilexportgui",
"")
534 if (!$this->prtf_embed) {
536 $this->tabs_gui->addNonTabbedLink(
539 $this->
ctrl->getLinkTarget($this,
"preview")
555 $next_class = $ilCtrl->getNextClass($this);
557 if ($next_class !==
"ilexportgui") {
562 if ($this->gtp > 0) {
566 $ilCtrl->setCmdClass(
"ilblogpostinggui");
567 $ilCtrl->setParameterByClass(
"ilblogpostinggui",
"blpg", $page_id);
568 if ($this->edt ===
"edit") {
569 $ilCtrl->redirectByClass(
"ilblogpostinggui",
"edit");
571 $ilCtrl->redirectByClass(
"ilblogpostinggui",
"previewFullscreen");
574 $this->tpl->setOnScreenMessage(
'failure',
$lng->
txt(
"blog_posting_not_found"));
579 $cmd = $ilCtrl->getCmd();
582 if (($this->id_type === self::REPOSITORY_NODE_ID) && !$this->
getCreationMode() &&
585 $link = $ilCtrl->getLinkTargetByClass([
"ilrepositorygui",
"ilObjBlogGUI"],
"preview");
586 $ilNavigationHistory->addItem($this->node_id, $link,
"blog");
588 switch ($next_class) {
589 case 'ilblogpostinggui':
590 $this->
ctrl->saveParameter($this,
"user_page");
591 if (!$this->prtf_embed) {
596 $this->tpl->setOnScreenMessage(
'info',
$lng->
txt(
"no_permission"));
601 if ($this->id_type === self::REPOSITORY_NODE_ID) {
605 $style_sheet_id = $this->content_style_domain->getEffectiveStyleId();
620 case "previewFullscreen":
621 $ilCtrl->setParameter($this,
"prvm",
"fsc");
625 case "previewEmbedded":
626 $ilCtrl->setParameter($this,
"prvm",
"emb");
634 if (!$this->prtf_embed) {
635 $this->
ctrl->setParameterByClass(
"ilblogpostinggui",
"blpg", $this->blpg);
636 $this->tabs_gui->addNonTabbedLink(
639 $this->
ctrl->getLinkTargetByClass(
"ilblogpostinggui",
"previewFullscreen")
641 $this->
ctrl->setParameterByClass(
"ilblogpostinggui",
"blpg",
"");
643 $this->
ctrl->setParameterByClass(
"ilobjportfoliogui",
"user_page", $this->ppage);
644 $this->tabs_gui->addNonTabbedLink(
647 $this->
ctrl->getLinkTargetByClass(
"ilobjportfoliogui",
"preview")
649 $this->
ctrl->setParameterByClass(
"ilobjportfoliogui",
"user_page",
"");
656 $cmd =
"preview" . (($this->prvm ===
"fsc") ?
"Fullscreen" :
"Embedded");
658 if (in_array($cmd, array(
"previewFullscreen",
"previewEmbedded"))) {
661 $ret = $ilCtrl->forwardCommand($bpost_gui);
662 if (!$ilTabs->back_target) {
663 $ilCtrl->setParameter($this,
"bmn",
"");
664 $ilTabs->setBackTarget(
666 $ilCtrl->getLinkTarget($this,
"")
674 $is_active = $bpost_gui->getBlogPosting()->getActive();
677 if (($cmd ===
"previewFullscreen" || $cmd ===
"previewEmbedded")
678 && !$is_owner && !$is_active) {
679 $this->
ctrl->redirect($this,
"preview");
684 case "previewFullscreen":
692 case "previewEmbedded":
706 if ($this->id_type === self::WORKSPACE_NODE_ID) {
707 $info[] =
$lng->
txt(
"blog_draft_info");
709 $info[] =
$lng->
txt(
"blog_draft_info_contributors");
712 $public_action =
false;
713 if ($cmd !==
"history" && $cmd !==
"edit" && $is_active && empty($info)) {
714 $info[] =
$lng->
txt(
"blog_new_posting_info");
715 $public_action =
true;
717 if ($this->
object->hasApproval() && !$bpost_gui->getBlogPosting()->isApproved()) {
719 $info[] =
$lng->
txt(
"blog_posting_edit_approval_info");
721 if ($public_action) {
722 $this->tpl->setOnScreenMessage(
'success', implode(
"<br />", $info));
724 if (count($info) > 0) {
725 $this->tpl->setOnScreenMessage(
'info', implode(
"<br />", $info));
731 if ($cmd !==
"edit") {
736 $this->
tabs->setBackTarget(
"",
"");
743 case "ilinfoscreengui":
753 case "ilcommonactiondispatchergui":
755 $gui->enableCommentsSettings(
false);
757 $this->
ctrl->forwardCommand($gui);
760 case "ilpermissiongui":
762 $ilTabs->activateTab(
"id_permissions");
764 $this->
ctrl->forwardCommand($perm_gui);
767 case "ilobjectcopygui":
770 $cp->setType(
"blog");
771 $this->
ctrl->forwardCommand($cp);
774 case 'ilrepositorysearchgui':
776 $ilTabs->activateTab(
"contributors");
778 $rep_search->setTitle($this->
lng->txt(
"blog_add_contributor"));
779 $rep_search->setCallback($this,
'addContributor', $this->
object->getAllLocalRoles($this->node_id));
780 $this->
ctrl->setReturn($this,
'contributors');
781 $this->
ctrl->forwardCommand($rep_search);
786 $ilTabs->activateTab(
"export");
788 $exp_gui->addFormat(
"xml");
789 $exp_gui->addFormat(
"html",
"", $this,
"buildExportFile");
791 $exp_gui->addFormat(
"html_comments",
"HTML (" . $this->
lng->txt(
"blog_incl_comments") .
")", $this,
"buildExportFile");
793 $ilCtrl->forwardCommand($exp_gui);
796 case "ilobjectcontentstylesettingsgui":
800 $ilTabs->activateTab(
"settings");
804 if ($this->id_type === self::REPOSITORY_NODE_ID) {
805 $settings_gui = $this->content_style_gui
806 ->objectSettingsGUIForRefId(
811 $settings_gui = $this->content_style_gui
812 ->objectSettingsGUIForObjId(
817 $this->
ctrl->forwardCommand($settings_gui);
821 case "ilblogexercisegui":
822 $this->
ctrl->setReturn($this,
"render");
824 $this->
ctrl->forwardCommand($gui);
827 case 'ilobjnotificationsettingsgui':
829 $ilTabs->activateTab(
"settings");
832 $this->
ctrl->forwardCommand($gui);
836 if ($cmd !==
"gethtml") {
838 if ($cmd ===
"addToDesk" || $cmd ===
"removeFromDesk") {
839 $this->{$cmd .
"Object"}();
845 $ilCtrl->setCmd($cmd);
849 if (!$this->prtf_embed) {
850 parent::executeCommand();
859 $this->rendered_content = (string) $this->$cmd();
872 $assignments = $be->getAssignmentsOfBlog();
873 if (count($assignments) > 0) {
874 $ass_ids = array_map(
static function (
$i) {
879 $this->tool_context->current()->addAdditionalData(
881 $be_gui->getActionButtons()
891 $this->
ctrl->setCmd(
"showSummary");
892 $this->
ctrl->setCmdClass(
"ilinfoscreengui");
906 if ($this->id_type !== self::WORKSPACE_NODE_ID) {
907 $info->enablePrivateNotes();
915 $info->enableNewsEditing(
false);
918 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
920 if ($enable_internal_rss) {
921 $info->setBlockProperty(
"news",
"settings",
true);
922 $info->setBlockProperty(
"news",
"public_notifications_option",
true);
927 $info->addMetaDataSections($this->
object->getId(), 0, $this->
object->getType());
929 if ($this->id_type === self::WORKSPACE_NODE_ID) {
933 $this->
ctrl->forwardCommand($info);
944 $title = $this->blog_request->
getTitle();
948 $posting->setTitle($title);
949 $posting->setBlogId($this->
object->getId());
950 $posting->setActive(
false);
951 $posting->setAuthor(
$ilUser->getId());
952 $posting->create(
false);
955 $ilCtrl->setParameter($this,
"bmn", date(
"Y-m"));
957 $ilCtrl->setParameterByClass(
"ilblogpostinggui",
"blpg", $posting->getId());
958 $ilCtrl->redirectByClass(
"ilblogpostinggui",
"edit");
960 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"msg_no_title"),
true);
961 $ilCtrl->redirect($this,
"render");
977 $this->tpl->setOnScreenMessage(
'info',
$lng->
txt(
"no_permission"));
981 $ilTabs->activateTab(
"content");
985 $ilToolbar->setFormAction($ilCtrl->getFormAction($this,
"createPosting"));
989 $ilToolbar->addStickyItem($title,
$lng->
txt(
"title"));
991 document.getElementById('title').setAttribute('data-blog-input', 'posting-title'); 992 document.getElementById('title').setAttribute('placeholder', ' '); 996 $button->setCaption(
"blog_add_posting");
997 $button->setCommand(
"createPosting");
998 $ilToolbar->addStickyItem($button);
1001 $keys = array_keys($this->items);
1002 $first = array_shift(
$keys);
1003 if ($first != $this->month) {
1004 $ilToolbar->addSeparator();
1006 $ilCtrl->setParameter($this,
"bmn", $first);
1007 $url = $ilCtrl->getLinkTarget($this,
"");
1008 $ilCtrl->setParameter($this,
"bmn", $this->month);
1011 $button->setCaption(
"blog_show_latest");
1012 $button->setUrl(
$url);
1013 $ilToolbar->addButtonInstance($button);
1017 $print_view = $this->getPrintView();
1018 $modal_elements = $print_view->getModalElements(
1019 $this->
ctrl->getLinkTarget(
1021 "printViewSelection" 1024 $ilToolbar->addSeparator();
1025 $ilToolbar->addComponent($modal_elements->button);
1026 $ilToolbar->addComponent($modal_elements->modal);
1036 $list = $this->
renderList($list_items,
"preview",
"", $is_owner);
1056 if ($this->id_type === self::REPOSITORY_NODE_ID) {
1068 $list = $this->
renderList($list_items,
"previewEmbedded");
1072 elseif ($this->prt_id) {
1076 $ilCtrl->setParameterByClass(
"ilportfoliopagegui",
"ppage", $this->user_page);
1077 $link = $ilCtrl->getLinkTargetByClass(array(
"ilportfoliopagegui",
"ilobjbloggui"),
"render");
1078 $ilCtrl->setParameterByClass(
"ilportfoliopagegui",
"ppage",
"");
1080 $this->
toolbar->addComponent($this->
ui->factory()->button()->standard(
1081 $this->
lng->txt(
"blog_edit"),
1094 bool $a_show_inactive =
false 1096 if ($this->author) {
1097 $list_items = array();
1098 foreach ($this->items as $month => $items) {
1099 foreach ($items as
$id => $item) {
1100 if ($item[
"author"] == $this->author ||
1101 (isset($item[
"editors"]) && in_array($this->author, $item[
"editors"]))) {
1102 $list_items[
$id] = $item;
1106 } elseif ($this->keyword) {
1109 $max = $this->
object->getOverviewPostings();
1110 if ($this->month_default && $max) {
1111 $list_items = array();
1112 foreach ($this->items as $month => $postings) {
1113 foreach ($postings as
$id => $item) {
1114 if (!$a_show_inactive &&
1118 $list_items[
$id] = $item;
1120 if (count($list_items) >= $max) {
1139 $lng = $DIC->language();
1143 $this->tpl->setOnScreenMessage(
'info',
$lng->
txt(
"no_permission"));
1153 $list = $this->
renderList($list_items,
"previewFullscreen");
1166 bool $a_with_comments =
false 1182 $wtpl =
new ilTemplate(
"tpl.blog_embedded.html",
true,
true,
"Modules/Blog");
1183 $wtpl->setVariable(
"VAL_LIST", $a_content);
1184 $wtpl->setVariable(
"VAL_NAVIGATION", $a_nav);
1185 return $wtpl->get();
1193 string $a_navigation
1200 $owner = $this->
object->getOwner();
1202 $ilTabs->clearTargets();
1209 if ($owner ===
$ilUser->getId()) {
1211 if ($this->id_type === self::WORKSPACE_NODE_ID) {
1212 $back =
"ilias.php?baseClass=ilDashboardGUI&cmd=jumpToWorkspace&wsp_id=" .
$this->node_id;
1216 $this->
ctrl->setParameter($this,
"prvm",
"");
1217 if ($this->blpg === 0) {
1218 $back = $this->
ctrl->getLinkTarget($this,
"");
1220 $this->
ctrl->setParameterByClass(
"ilblogpostinggui",
"bmn", $this->month);
1221 $this->
ctrl->setParameterByClass(
"ilblogpostinggui",
"blpg", $this->blpg);
1222 $back = $this->
ctrl->getLinkTargetByClass(
"ilblogpostinggui",
"preview");
1224 $this->
ctrl->setParameter($this,
"prvm", $this->prvm);
1227 $back_caption = $this->
lng->txt(
"blog_back_to_blog_owner");
1232 if ($this->id_type === self::WORKSPACE_NODE_ID) {
1233 $back =
"ilias.php?baseClass=ilDashboardGUI&cmd=jumpToWorkspace&dsh=" . $owner;
1237 $back = $this->
ctrl->getLinkTarget($this,
"");
1238 $back_caption = $this->
lng->txt(
"blog_back_to_blog_owner");
1251 $this->
ctrl->setParameter($this,
"bmn",
"");
1253 $this->
ctrl->setParameter($this,
"bmn", $this->month);
1268 bool $a_export =
false 1274 $this->
object->getType(),
1276 $this->
object->getId(),
1283 if ($this->id_type !== self::REPOSITORY_NODE_ID) {
1285 $name = $name[
"lastname"] .
", " . $name[
"firstname"];
1292 $banner_height =
"";
1293 if ($blga_set->get(
"banner")) {
1295 $banner_width = $blga_set->get(
"banner_width");
1296 $banner_height = $blga_set->get(
"banner_height");
1298 $banner = basename($banner);
1303 if ($this->
object->hasProfilePicture()) {
1305 if ($this->id_type === self::REPOSITORY_NODE_ID) {
1307 if ($this->blpg > 0 && !$a_export) {
1309 $author_id =
$post->getAuthor();
1314 $name = $name[
"lastname"] .
", " . $name[
"firstname"];
1322 $ppic = basename($ppic);
1328 $a_tpl->setBanner($banner);
1331 if ($this->id_type === self::REPOSITORY_NODE_ID) {
1344 $author_found =
false;
1348 if ($this->author &&
1349 ($posting[
"author"] == $this->author ||
1350 (is_array($posting[
"editors"] ??
false) && in_array($this->author, $posting[
"editors"])))) {
1351 $author_found =
true;
1354 $month = substr($posting[
"created"]->
get(
IL_CAL_DATE), 0, 7);
1355 $items[
$month][$posting[
"id"]] = $posting;
1358 if ($this->author && !$author_found) {
1359 $this->author = null;
1370 string $a_cmd =
"preview",
1371 string $a_link_template =
"",
1372 bool $a_show_inactive =
false,
1373 string $a_export_directory =
"" 1379 $wtpl =
new ilTemplate(
"tpl.blog_list.html",
true,
true,
"Modules/Blog");
1382 if ($this->prt_id > 0 &&
1385 $ilCtrl->setParameterByClass(
"ilportfoliopagegui",
"ppage", $this->user_page);
1386 $link = $ilCtrl->getLinkTargetByClass(array(
"ilportfoliopagegui",
"ilobjbloggui"),
"render");
1387 $ilCtrl->setParameterByClass(
"ilportfoliopagegui",
"ppage",
"");
1388 $b = $this->
ui->factory()->button()->standard(
1389 $this->
lng->txt(
"blog_edit"),
1399 foreach ($items as $item) {
1402 if (!$is_active && !$a_show_inactive) {
1409 if (!$this->keyword && !$this->author) {
1410 $month = substr($item[
"created"]->
get(
IL_CAL_DATE), 0, 7);
1413 if (!$last_month || $last_month != $month) {
1415 $wtpl->setCurrentBlock(
"month_bl");
1416 $wtpl->parseCurrentBlock();
1420 if ($this->keyword) {
1422 } elseif ($this->author) {
1426 " " . substr($month, 0, 4);
1431 $wtpl->setVariable(
"TXT_CURRENT_MONTH", $title);
1434 if (!$a_link_template) {
1435 $ilCtrl->setParameterByClass(
"ilblogpostinggui",
"bmn", $this->month);
1436 $ilCtrl->setParameterByClass(
"ilblogpostinggui",
"blpg", $item[
"id"]);
1437 $preview = $ilCtrl->getLinkTargetByClass(
"ilblogpostinggui", $a_cmd);
1444 $posting_edit = $this->
mayEditPosting($item[
"id"], $item[
"author"]);
1445 if (($posting_edit || $is_admin) && !$a_link_template && $a_cmd ===
"preview") {
1447 $alist->setId($item[
"id"]);
1448 $alist->setListTitle(
$lng->
txt(
"actions"));
1450 if ($is_active && $this->
object->hasApproval() && !$item[
"approved"]) {
1452 $ilCtrl->setParameter($this,
"apid", $item[
"id"]);
1456 $ilCtrl->getLinkTarget($this,
"approve")
1458 $ilCtrl->setParameter($this,
"apid",
"");
1461 $wtpl->setVariable(
"APPROVAL",
$lng->
txt(
"blog_needs_approval"));
1464 if ($posting_edit) {
1468 $ilCtrl->getLinkTargetByClass(
"ilblogpostinggui",
"edit")
1470 $more_link = $ilCtrl->getLinkTargetByClass(
"ilblogpostinggui",
"edit");
1475 $lng->
txt(
"blog_toggle_draft"),
1477 $ilCtrl->getLinkTargetByClass(
"ilblogpostinggui",
"deactivatePageToList")
1481 $lng->
txt(
"blog_toggle_final"),
1483 $ilCtrl->getLinkTargetByClass(
"ilblogpostinggui",
"activatePageToList")
1490 $ilCtrl->getLinkTargetByClass(
"ilblogpostinggui",
"edittitle")
1493 if ($this->
object->hasKeywords()) {
1495 $lng->
txt(
"blog_edit_keywords"),
1497 $ilCtrl->getLinkTargetByClass(
"ilblogpostinggui",
"editKeywords")
1504 $ilCtrl->getLinkTargetByClass(
"ilblogpostinggui",
"editdate")
1509 $ilCtrl->getLinkTargetByClass(
"ilblogpostinggui",
"deleteBlogPostingConfirmationScreen")
1511 } elseif ($is_admin) {
1514 $ilCtrl->setParameter($this,
"apid", $item[
"id"]);
1516 $lng->
txt(
"blog_toggle_draft_admin"),
1518 $ilCtrl->getLinkTarget($this,
"deactivateAdmin")
1520 $ilCtrl->setParameter($this,
"apid",
"");
1526 $ilCtrl->getLinkTargetByClass(
"ilblogpostinggui",
"deleteBlogPostingConfirmationScreen")
1530 $wtpl->setCurrentBlock(
"actions");
1531 $wtpl->setVariable(
"ACTION_SELECTOR", $alist->getHTML());
1532 $wtpl->parseCurrentBlock();
1538 $notes_context = $this->notes
1545 $count = $this->notes
1547 ->getNrOfCommentsForContext($notes_context);
1549 if ($a_cmd !==
"preview") {
1550 $wtpl->setCurrentBlock(
"comments");
1551 $wtpl->setVariable(
"TEXT_COMMENTS",
$lng->
txt(
"blog_comments"));
1552 $wtpl->setVariable(
"URL_COMMENTS",
$preview);
1553 $wtpl->setVariable(
"COUNT_COMMENTS", $count);
1554 $wtpl->parseCurrentBlock();
1559 if ($a_cmd !==
"preview" && $a_cmd !==
"previewEmbedded") {
1560 if ($this->id_type === self::WORKSPACE_NODE_ID) {
1561 $goto = $this->
getAccessHandler()->getGotoLink($this->node_id, $this->obj_id,
"_" . $item[
"id"]);
1565 $wtpl->setCurrentBlock(
"permalink");
1566 $wtpl->setVariable(
"URL_PERMALINK", $goto);
1567 $wtpl->setVariable(
"TEXT_PERMALINK",
$lng->
txt(
"blog_link"));
1568 $wtpl->parseCurrentBlock();
1573 $this->
object->hasAbstractShorten(),
1574 $this->
object->getAbstractShortenLength(),
1576 $this->
object->hasAbstractImage(),
1577 $this->
object->getAbstractImageWidth(),
1578 $this->
object->getAbstractImageHeight(),
1583 $wtpl->setCurrentBlock(
"more");
1584 $wtpl->setVariable(
"URL_MORE", $more_link);
1585 $wtpl->setVariable(
"TEXT_MORE",
$lng->
txt(
"blog_list_more"));
1586 $wtpl->parseCurrentBlock();
1592 $wtpl->setCurrentBlock(
"draft_text");
1593 $wtpl->setVariable(
"DRAFT_TEXT",
$lng->
txt(
"blog_draft_text"));
1594 $wtpl->parseCurrentBlock();
1595 $wtpl->setVariable(
"DRAFT_CLASS",
" ilBlogListItemDraft");
1599 $reading_time = $this->reading_time_manager->getReadingTime(
1603 if (!is_null($reading_time)) {
1604 $this->
lng->loadLanguageModule(
"copg");
1605 $wtpl->setCurrentBlock(
"reading_time");
1608 $this->
lng->txt(
"copg_est_reading_time") .
": " .
1609 sprintf($this->
lng->txt(
"copg_x_minutes"), $reading_time)
1611 $wtpl->parseCurrentBlock();
1614 $wtpl->setCurrentBlock(
"posting");
1617 if ($this->id_type === self::REPOSITORY_NODE_ID) {
1620 $author_id = $item[
"author"];
1625 if (isset($item[
"editors"])) {
1626 foreach ($item[
"editors"] as $editor_id) {
1632 $author = implode(
", ", $authors) .
" - ";
1637 $wtpl->setVariable(
"URL_TITLE",
$preview);
1638 $wtpl->setVariable(
"TITLE", $item[
"title"]);
1642 $keywords = (count($kw) > 0)
1643 ?
"<br>" . $this->
lng->txt(
"keywords") .
": " . implode(
", ", $kw)
1646 $wtpl->setVariable(
"DATETIME", $author .
1650 $wtpl->setVariable(
"CONTENT", $snippet);
1652 $wtpl->parseCurrentBlock();
1656 if ($a_cmd ===
"previewFullscreen") {
1657 $this->tpl->setPermanentLink(
1660 ($this->id_type === self::WORKSPACE_NODE_ID)
1666 if (!$is_empty || $a_show_inactive) {
1667 return $wtpl->get();
1680 return \ILIAS\Blog\Export\BlogHtmlExport::buildExportLink($a_template, $a_type, $a_id, $this->
getKeywords(
false));
1689 string $a_list_cmd =
"render",
1690 string $a_posting_cmd =
"preview",
1691 ?
string $a_link_template = null,
1692 bool $a_show_inactive =
false,
1697 $blpg = ($a_blpg > 0)
1703 foreach ($a_items as $month => $postings) {
1704 foreach (array_keys($postings) as
$id) {
1706 if (!$a_show_inactive && !$active) {
1707 unset($a_items[$month][
$id]);
1709 $a_items[
$month][
$id][
"active"] = $active;
1712 if (!count($a_items[$month])) {
1713 unset($a_items[$month]);
1720 $max_months = $this->
object->getNavModeListMonths();
1722 $wtpl =
new ilTemplate(
"tpl.blog_list_navigation_by_date.html",
true,
true,
"Modules/Blog");
1724 $ilCtrl->setParameter($this,
"blpg",
"");
1726 $counter = $mon_counter = $last_year = 0;
1727 foreach ($a_items as $month => $postings) {
1728 if (!$a_link_template && $max_months && $mon_counter >= $max_months) {
1733 $year = substr($month, 0, 4);
1734 if (!$last_year || $year != $last_year) {
1744 if (!$a_link_template) {
1745 $ilCtrl->setParameter($this,
"bmn", $month);
1746 $month_url = $ilCtrl->getLinkTarget($this, $a_list_cmd);
1748 $month_url = $this->
buildExportLink($a_link_template,
"list", $month);
1753 if ($mon_counter <= $this->
object->getNavModeListMonthsWithPostings()) {
1755 $wtpl->setCurrentBlock(
"navigation_year_details");
1756 $wtpl->setVariable(
"YEAR", $year);
1757 $wtpl->parseCurrentBlock();
1760 foreach ($postings as
$id => $posting) {
1771 if (!$a_link_template) {
1772 $ilCtrl->setParameterByClass(
"ilblogpostinggui",
"bmn", $month);
1773 $ilCtrl->setParameterByClass(
"ilblogpostinggui",
"blpg",
$id);
1774 $url = $ilCtrl->getLinkTargetByClass(
"ilblogpostinggui", $a_posting_cmd);
1779 if (!$posting[
"active"]) {
1780 $wtpl->setVariable(
"NAV_ITEM_DRAFT", $this->
lng->txt(
"blog_draft"));
1781 } elseif ($this->
object->hasApproval() && !$posting[
"approved"]) {
1782 $wtpl->setVariable(
"NAV_ITEM_APPROVAL", $this->
lng->txt(
"blog_needs_approval"));
1785 $wtpl->setCurrentBlock(
"navigation_item");
1786 $wtpl->setVariable(
"NAV_ITEM_URL",
$url);
1787 $wtpl->setVariable(
"NAV_ITEM_CAPTION", $caption);
1788 $wtpl->parseCurrentBlock();
1791 $wtpl->setCurrentBlock(
"navigation_month_details");
1792 $wtpl->setVariable(
"NAV_MONTH", $month_name);
1793 $wtpl->setVariable(
"URL_MONTH", $month_url);
1798 $wtpl->setCurrentBlock(
"navigation_year");
1799 $wtpl->setVariable(
"YEAR", $year);
1800 $wtpl->parseCurrentBlock();
1803 $wtpl->setCurrentBlock(
"navigation_month");
1804 $wtpl->setVariable(
"MONTH_NAME", $month_name);
1805 $wtpl->setVariable(
"URL_MONTH", $month_url);
1806 $wtpl->setVariable(
"MONTH_COUNT", count($postings));
1808 $wtpl->parseCurrentBlock();
1811 if (!$a_link_template) {
1812 $this->
ctrl->setParameterByClass(self::class,
"bmn", null);
1813 $url = $this->
ctrl->getLinkTargetByClass(self::class, $a_list_cmd);
1815 $url =
"index.html";
1819 $this->
ui->renderer()->render(
1820 $this->
ui->factory()->link()->standard(
1821 $this->
lng->txt(
"blog_starting_page"),
1829 $wtpl =
new ilTemplate(
"tpl.blog_list_navigation_month.html",
true,
true,
"Modules/Blog");
1831 $ilCtrl->setParameter($this,
"blpg",
"");
1833 $month_options = array();
1834 foreach ($a_items as $month => $postings) {
1836 " " . substr($month, 0, 4);
1838 $month_options[
$month] = $month_name;
1840 if ($month == $this->month) {
1841 if (!$a_link_template) {
1842 $ilCtrl->setParameter($this,
"bmn", $month);
1843 $month_url = $ilCtrl->getLinkTarget($this, $a_list_cmd);
1845 $month_url = $this->
buildExportLink($a_link_template,
"list", $month);
1848 foreach ($postings as
$id => $posting) {
1852 if (!$a_link_template) {
1853 $ilCtrl->setParameterByClass(
"ilblogpostinggui",
"bmn", $month);
1854 $ilCtrl->setParameterByClass(
"ilblogpostinggui",
"blpg",
$id);
1855 $url = $ilCtrl->getLinkTargetByClass(
"ilblogpostinggui", $a_posting_cmd);
1860 if (!$posting[
"active"]) {
1861 $wtpl->setVariable(
"NAV_ITEM_DRAFT", $this->
lng->txt(
"blog_draft"));
1862 } elseif ($this->
object->hasApproval() && !$posting[
"approved"]) {
1863 $wtpl->setVariable(
"NAV_ITEM_APPROVAL", $this->
lng->txt(
"blog_needs_approval"));
1866 $wtpl->setCurrentBlock(
"navigation_item");
1867 $wtpl->setVariable(
"NAV_ITEM_URL",
$url);
1868 $wtpl->setVariable(
"NAV_ITEM_CAPTION", $caption);
1869 $wtpl->parseCurrentBlock();
1872 $wtpl->setCurrentBlock(
"navigation_month_details");
1874 $wtpl->setVariable(
"NAV_MONTH", $month_name);
1875 $wtpl->setVariable(
"URL_MONTH", $month_url);
1877 $wtpl->parseCurrentBlock();
1882 $wtpl->setCurrentBlock(
"option_bl");
1883 foreach ($month_options as $value => $caption) {
1884 $wtpl->setVariable(
"OPTION_VALUE", $value);
1885 $wtpl->setVariable(
"OPTION_CAPTION", $caption);
1886 if ($value == $this->month) {
1887 $wtpl->setVariable(
"OPTION_SEL",
' selected="selected"');
1889 $wtpl->parseCurrentBlock();
1892 $wtpl->setVariable(
"FORM_ACTION", $ilCtrl->getFormAction($this, $a_list_cmd));
1895 $ilCtrl->setParameter($this,
"bmn", $this->month);
1896 $ilCtrl->setParameterByClass(
"ilblogpostinggui",
"bmn",
"");
1897 return $wtpl->get();
1904 string $a_list_cmd =
"render",
1905 bool $a_show_inactive =
false,
1906 string $a_link_template =
"",
1911 $blpg = ($a_blpg > 0)
1915 $keywords = $this->
getKeywords($a_show_inactive, $blpg);
1917 $wtpl =
new ilTemplate(
"tpl.blog_list_navigation_keywords.html",
true,
true,
"Modules/Blog");
1919 $max = max($keywords);
1921 $wtpl->setCurrentBlock(
"keyword");
1922 foreach ($keywords as $keyword => $counter) {
1923 if (!$a_link_template) {
1924 $ilCtrl->setParameter($this,
"kwd", urlencode((
string) $keyword));
1925 $url = $ilCtrl->getLinkTarget($this, $a_list_cmd);
1926 $ilCtrl->setParameter($this,
"kwd",
"");
1931 $wtpl->setVariable(
"TXT_KEYWORD", $keyword);
1933 $wtpl->setVariable(
"URL_KEYWORD",
$url);
1934 $wtpl->parseCurrentBlock();
1937 return $wtpl->get();
1944 string $a_list_cmd =
"render",
1945 bool $a_show_inactive =
false 1950 foreach ($a_items as $month => $items) {
1951 foreach ($items as $item) {
1953 if ($item[
"author"]) {
1954 $authors[] = $item[
"author"];
1957 if (isset($item[
"editors"])) {
1958 foreach ($item[
"editors"] as $editor_id) {
1959 if ($editor_id != $item[
"author"]) {
1960 $authors[] = $editor_id;
1968 $authors = array_unique($authors);
1971 $authors = array_filter($authors,
function (
$id) {
1975 if (count($authors) > 1) {
1977 foreach ($authors as $user_id) {
1979 $ilCtrl->setParameter($this,
"ath", $user_id);
1980 $url = $ilCtrl->getLinkTarget($this, $a_list_cmd);
1981 $ilCtrl->setParameter($this,
"ath",
"");
1984 if (substr($base_name, 0, 1) ==
"[") {
1998 $sort = $name_arr[
"lastname"] .
" " . $name_arr[
"firstname"];
2001 $idx = trim(strip_tags($sort)) .
"///" . $user_id;
2007 $wtpl =
new ilTemplate(
"tpl.blog_list_navigation_authors.html",
true,
true,
"Modules/Blog");
2009 $wtpl->setCurrentBlock(
"author");
2010 foreach ($list as $author) {
2011 $wtpl->setVariable(
"TXT_AUTHOR", $author[0]);
2012 $wtpl->setVariable(
"URL_AUTHOR", $author[1]);
2013 $wtpl->parseCurrentBlock();
2016 return $wtpl->get();
2026 bool $single_posting =
false 2031 $lng = $DIC->language();
2032 $ctrl = $DIC->ctrl();
2034 $f = $DIC->ui()->factory();
2038 :
"previewFullscreen";
2040 if ($single_posting) {
2042 if ($latest_posting > 0 && $this->blpg !== $latest_posting) {
2044 $mb =
$f->button()->standard(
2045 $lng->
txt(
"blog_latest_posting"),
2049 $mb =
$f->button()->standard(
$lng->
txt(
"blog_latest_posting"),
"#")->withUnavailableAction();
2053 if ($prev_posting > 0) {
2055 $pb =
$f->button()->standard(
2060 $pb =
$f->button()->standard(
$lng->
txt(
"previous"),
"#")->withUnavailableAction();
2064 if ($next_posting > 0) {
2066 $nb =
$f->button()->standard(
2071 $nb =
$f->button()->standard(
$lng->
txt(
"next"),
"#")->withUnavailableAction();
2074 $vc =
$f->viewControl()->section($pb, $mb, $nb);
2098 if ($latest_month !==
"" && $this->month !== $latest_month) {
2100 $mb =
$f->button()->standard(
2101 $lng->
txt(
"blog_latest_posting"),
2105 $mb =
$f->button()->standard(
$lng->
txt(
"blog_latest_posting"),
"#")->withUnavailableAction();
2109 if ($prev_month !==
"") {
2113 $pb =
$f->button()->standard(
$lng->
txt(
"previous"),
"#")->withUnavailableAction();
2117 if ($next_month !==
"") {
2121 $nb =
$f->button()->standard(
$lng->
txt(
"next"),
"#")->withUnavailableAction();
2124 $vc =
$f->viewControl()->section($pb, $mb, $nb);
2149 foreach ($a_items as $month => $items) {
2150 if ($month > $this->month) {
2162 foreach ($a_items as $month => $items) {
2163 if ($month < $this->month && $found ===
"") {
2177 return key($a_items);
2191 foreach ($a_items as $month => $items) {
2192 foreach ($items as $item) {
2193 if ($item[
"id"] == $this->blpg) {
2197 $next_blpg = (
int) $item[
"id"];
2215 foreach ($a_items as $month => $items) {
2216 foreach ($items as $item) {
2217 if ($found && $prev_blpg === 0) {
2218 $prev_blpg = (
int) $item[
"id"];
2237 $month = current($a_items);
2238 if (is_array($month)) {
2239 return (
int) current($month)[
"id"];
2248 string $a_list_cmd =
"render",
2249 string $a_posting_cmd =
"preview",
2250 string $a_link_template = null,
2251 bool $a_show_inactive =
false,
2257 $blpg = ($a_blpg > 0)
2261 if ($this->
object->getOrder()) {
2262 $order = array_flip($this->
object->getOrder());
2271 $wtpl =
new ilTemplate(
"tpl.blog_list_navigation.html",
true,
true,
"Modules/Blog");
2276 if (count($a_items)) {
2277 $blocks[$order[
"navigation"]] = array(
2278 $this->
lng->txt(
"blog_navigation"),
2279 $this->
renderNavigationByDate($a_items, $a_list_cmd, $a_posting_cmd, $a_link_template, $a_show_inactive, $a_blpg)
2283 if ($this->
object->hasKeywords()) {
2285 $may_edit_keywords = ($blpg > 0 &&
2287 $a_list_cmd !==
"preview" &&
2288 $a_list_cmd !==
"gethtml" &&
2291 if ($keywords || $may_edit_keywords) {
2293 $keywords = $this->
lng->txt(
"blog_no_keywords");
2296 $blocks[$order[
"keywords"]] = array(
2297 $this->
lng->txt(
"blog_keywords"),
2300 ? array($cmd, $this->
lng->txt(
"blog_edit_keywords"))
2307 if (!$a_link_template) {
2309 if ($this->id_type === self::REPOSITORY_NODE_ID &&
2310 $this->
object->hasAuthors()) {
2313 $blocks[$order[
"authors"]] = array($this->
lng->txt(
"blog_authors"), $authors);
2318 if ($this->
object->hasRSS() &&
2320 $a_list_cmd ===
"preview") {
2323 if ($this->id_type !== self::WORKSPACE_NODE_ID) {
2326 $url = ILIAS_HTTP_PATH .
"/feed.php?blog_id=" . $blog_id .
2327 "&client_id=" . rawurlencode(
CLIENT_ID);
2333 if (count($blocks)) {
2336 $ui_factory = $DIC->ui()->factory();
2337 $ui_renderer = $DIC->ui()->renderer();
2340 foreach ($blocks as $block) {
2343 $content = $block[1];
2345 $secondary_panel = $ui_factory->panel()->secondary()->legacy($title, $ui_factory->legacy($content));
2347 if (isset($block[2]) && is_array($block[2])) {
2348 $link = $ui_factory->button()->shy($block[2][1], $block[2][0]);
2349 $secondary_panel = $secondary_panel->withFooter($link);
2352 $wtpl->setCurrentBlock(
"block_bl");
2353 $wtpl->setVariable(
"BLOCK", $ui_renderer->render($secondary_panel));
2354 $wtpl->parseCurrentBlock();
2358 return $wtpl->get();
2365 bool $a_show_inactive,
2366 ?
int $a_posting_id = null
2368 $keywords = array();
2369 if ($a_posting_id) {
2371 if (isset($keywords[$keyword])) {
2378 foreach ($this->items as $month => $items) {
2379 foreach ($items as $item) {
2382 if (isset($keywords[$keyword])) {
2395 foreach ($keywords as $keyword => $counter) {
2396 $tmp[] = array(
"keyword" => $keyword,
"counter" => $counter);
2400 $keywords = array();
2401 foreach ($tmp as $item) {
2402 $keywords[(string) $item[
"keyword"]] = $item[
"counter"];
2411 bool $a_include_comments =
false,
2412 bool $print_version =
false 2415 $format = explode(
"_", $this->blog_request->getFormat());
2416 if ((
$format[1] ??
"") ===
"comments" || $a_include_comments) {
2417 $a_include_comments =
true;
2418 $type =
"html_comments";
2425 $subdir = $this->
object->getType() .
"_" . $this->
object->getId();
2426 if ($print_version) {
2430 $blog_export = new \ILIAS\Blog\Export\BlogHtmlExport($this, $exp_dir, $subdir);
2431 $blog_export->setPrintVersion($print_version);
2432 $blog_export->includeComments($a_include_comments);
2433 return $blog_export->exportHTML();
2443 $this->disable_notes = $a_value;
2452 if ($a_cmd ===
"preview" || $a_cmd ===
"previewEmbedded" || $a_cmd ===
"previewFullscreen" || $this->prvm) {
2460 $ilCtrl->setParameter($this,
"prvm",
"");
2469 ?
string $sub_type = null,
2470 ?
int $sub_id = null,
2471 bool $is_preview =
false 2475 if (!$this->obj_id) {
2478 $sub_type = $sub_id = null;
2479 if ($this->blpg > 0) {
2484 $lg = parent::initHeaderAction($sub_type, $sub_id);
2488 $lg->enableComments(
false);
2489 $lg->enableNotes(
false);
2492 if ($this->blpg > 0) {
2494 $lg->enableComments(
true);
2496 $lg->enableNotes(
true);
2498 $lg->enableTags(
false);
2500 if (!$this->prtf_embed) {
2502 $ilCtrl->setParameter($this,
"ntf", 1);
2503 $link = $ilCtrl->getLinkTarget($this,
"setNotification");
2504 $ilCtrl->setParameter($this,
"ntf",
"");
2506 $lg->addCustomCommand($link,
"blog_notification_toggle_off");
2512 $this->
lng->txt(
"blog_notification_activated")
2515 $ilCtrl->setParameter($this,
"ntf", 2);
2516 $link = $ilCtrl->getLinkTarget($this,
"setNotification");
2517 $ilCtrl->setParameter($this,
"ntf",
"");
2518 $lg->addCustomCommand($link,
"blog_notification_toggle_on");
2523 $this->
lng->txt(
"blog_notification_deactivated")
2530 $ilCtrl->setParameter($this,
"prvm",
"");
2532 $ilCtrl->setParameter($this,
"bmn",
"");
2533 $ilCtrl->setParameter($this,
"blpg",
"");
2534 $link = $ilCtrl->getLinkTarget($this,
"");
2535 $ilCtrl->setParameter($this,
"blpg", $sub_id);
2536 $ilCtrl->setParameter($this,
"bmn", $this->month);
2537 $lg->addCustomCommand($link,
"blog_edit");
2540 $link = $ilCtrl->getLinkTargetByClass(
"ilblogpostinggui",
"edit");
2541 $lg->addCustomCommand($link,
"blog_edit_posting");
2544 $ilCtrl->setParameter($this,
"prvm",
"fsc");
2547 $ilCtrl->setParameter($this,
"ntf",
"");
2558 switch ($this->ntf) {
2568 $ilCtrl->redirect($this,
"preview");
2580 if (
$post->getBlogId() === $a_blog_id) {
2581 return $post->getTitle();
2591 foreach ($this->items as $month => $postings) {
2592 foreach ($postings as
$id => $item) {
2594 unset($this->items[$month][
$id]);
2595 } elseif ($this->
object->hasApproval() && !$item[
"approved"]) {
2596 unset($this->items[$month][
$id]);
2599 if (!count($this->items[$month])) {
2600 unset($this->items[$month]);
2604 if ($this->items && !isset($this->items[$this->month])) {
2605 $keys = array_keys($this->items);
2606 $this->month = array_shift(
$keys);
2615 foreach ($a_items as $month => $items) {
2616 foreach ($items as $item) {
2642 int $a_author_id = null
2647 if ($this->id_type === self::WORKSPACE_NODE_ID) {
2661 if (!$a_author_id) {
2663 $a_author_id =
$post->getAuthor();
2665 return $ilUser->getId() === $a_author_id;
2676 if ($this->id_type == self::WORKSPACE_NODE_ID) {
2688 if (is_object($this->
object)) {
2695 if ($this->
isAdmin() && $this->apid > 0) {
2697 $post->setApproved(
true);
2698 $post->setBlogNodeId($this->node_id, ($this->id_type == self::WORKSPACE_NODE_ID));
2699 $post->update(
true,
false,
true,
"new");
2701 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"settings_saved"),
true);
2704 $this->
ctrl->redirect($this,
"render");
2724 $ilTabs->activateTab(
"contributors");
2726 $local_roles = $this->
object->getAllLocalRoles($this->node_id);
2733 'auto_complete_name' =>
$lng->
txt(
'user'),
2734 'submit_name' =>
$lng->
txt(
'add'),
2735 'add_search' =>
true,
2737 'user_type' => $local_roles
2742 $other_roles = $this->
object->getRolesWithContributeOrRedact($this->node_id);
2744 $this->tpl->setOnScreenMessage(
'info', sprintf(
$lng->
txt(
"blog_contribute_other_roles"), implode(
", ", $other_roles)));
2759 $user_login = $this->blog_request->getUserLogin();
2760 $user_type = $this->blog_request->getUserType();
2762 if (trim($user_login) ===
'') {
2763 $this->tpl->setOnScreenMessage(
'failure',
$lng->
txt(
'msg_no_search_string'));
2767 $users = explode(
',', $user_login);
2769 $user_ids = array();
2770 foreach ($users as
$user) {
2774 $this->tpl->setOnScreenMessage(
'failure',
$lng->
txt(
'user_not_known'));
2779 $user_ids[] = (
int) $user_id;
2789 array $a_user_ids = array(),
2790 ?
string $a_user_type = null
2796 $a_user_type = (
int) $a_user_type;
2802 if (!count($a_user_ids) || !$a_user_type) {
2803 $this->tpl->setOnScreenMessage(
'failure',
$lng->
txt(
"no_checkbox"));
2809 $local_roles = array_keys($this->
object->getAllLocalRoles($this->node_id));
2810 if (!in_array($a_user_type, $local_roles)) {
2811 $this->tpl->setOnScreenMessage(
'failure',
$lng->
txt(
"missing_perm"));
2816 foreach ($a_user_ids as $user_id) {
2817 if (!$rbacreview->isAssigned($user_id, $a_user_type)) {
2818 $rbacadmin->
assignUser($a_user_type, $user_id);
2822 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"settings_saved"),
true);
2823 $ilCtrl->redirect($this,
"contributors");
2831 $ids = $this->blog_request->getIds();
2833 if (count($ids) === 0) {
2834 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"select_one"),
true);
2835 $this->
ctrl->redirect($this,
"contributors");
2839 $confirm->setHeaderText($this->
lng->txt(
'blog_confirm_delete_contributors'));
2840 $confirm->setFormAction($this->
ctrl->getFormAction($this,
'removeContributor'));
2841 $confirm->setConfirm($this->
lng->txt(
'delete'),
'removeContributor');
2842 $confirm->setCancel($this->
lng->txt(
'cancel'),
'contributors');
2844 foreach ($ids as $user_id) {
2852 $this->tpl->setContent($confirm->getHTML());
2861 $ids = $this->blog_request->getIds();
2863 if (count($ids) === 0) {
2864 $this->tpl->setOnScreenMessage(
'failure',
$lng->
txt(
"select_one"),
true);
2865 $ilCtrl->redirect($this,
"contributors");
2869 $local_roles = array_keys($this->
object->getAllLocalRoles($this->node_id));
2870 if (!$local_roles) {
2871 $this->tpl->setOnScreenMessage(
'failure',
$lng->
txt(
"missing_perm"));
2876 foreach ($ids as $user_id) {
2877 foreach ($local_roles as $role_id) {
2882 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"settings_saved"),
true);
2883 $this->
ctrl->redirect($this,
"contributors");
2891 $post->setApproved(
false);
2892 $post->setActive(
false);
2893 $post->update(
true,
false,
false);
2895 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"settings_saved"),
true);
2898 $this->
ctrl->redirect($this,
"render");
2917 $this->content_style_gui->
addCss(
2919 $this->
object->getRefId(),
2920 $this->
object->getId()
2927 public static function _goto(
string $a_target): void
2931 $ilCtrl = $DIC->ctrl();
2934 $id = explode(
"_", $a_target);
2935 if (substr($a_target, -3) ===
"wsp") {
2936 $ilCtrl->setParameterByClass(
"ilSharedResourceGUI",
"wsp_id",
$id[0]);
2938 if (count(
$id) >= 2) {
2939 if (is_numeric(
$id[1])) {
2940 $ilCtrl->setParameterByClass(
"ilSharedResourceGUI",
"gtp",
$id[1]);
2942 $ilCtrl->setParameterByClass(
"ilSharedResourceGUI",
"kwd",
$id[1]);
2944 if ((
$id[2] ??
"") ===
"edit") {
2945 $ilCtrl->setParameterByClass(
"ilSharedResourceGUI",
"edt",
$id[2]);
2948 $ilCtrl->redirectByClass(
"ilSharedResourceGUI",
"");
2950 $ilCtrl->setParameterByClass(
"ilRepositoryGUI",
"ref_id",
$id[0]);
2952 if (count(
$id) >= 2) {
2953 if (is_numeric(
$id[1])) {
2954 $ilCtrl->setParameterByClass(
"ilRepositoryGUI",
"gtp",
$id[1]);
2956 $ilCtrl->setParameterByClass(
"ilRepositoryGUI",
"kwd",
$id[1]);
2959 if ((
$id[2] ??
"") ===
"edit") {
2960 $ilCtrl->setParameterByClass(
"ilRepositoryGUI",
"edt",
$id[2]);
2964 $ilCtrl->redirectByClass(
"ilRepositoryGUI",
"preview");
2967 $ilCtrl->redirectByClass(
"ilRepositoryGUI",
"infoScreen");
2986 $style_sheet_id = $this->content_style_domain->getEffectiveStyleId();
2990 $provider = new \ILIAS\Blog\BlogPrintViewProviderGUI(
2995 $this->access_handler,
2997 $this->blog_request->getObjIds()
3000 return new \ILIAS\Export\PrintProcessGUI(
3010 $view = $this->getPrintView();
3016 $print_view = $this->getPrintView();
3017 $print_view->sendPrintView();
3022 $this->
ctrl->redirectByClass(ilExportGUI::class);
ilNavigationHistory $nav_history
checkPermission(string $perm, string $cmd="", string $type="", int $ref_id=null)
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.
getNextPosting(array $a_items)
Get next posting.
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.
getLinkTargetByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
mayContribute()
Check if user may contribute at all.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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:
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.
getPreviousMonth(array $a_items)
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
getLatestMonth(array $a_items)
static _lookupId($a_user_str)
setParameterByClass(string $a_class, string $a_parameter, $a_value)
prepareOutput(bool $show_sub_objects=true)
static _lookupOwner(int $obj_id)
Lookup owner user ID for object ID.
loadLanguageModule(string $a_module)
Load language module.
static _goto(string $a_target)
Deep link.
updateCustom(ilPropertyFormGUI $form)
getPreviousPosting(array $a_items)
Get previous posting.
static getRelevanceClass(int $cnt, int $max)
const ABSTRACT_DEFAULT_SHORTEN_LENGTH
renderFullScreen(string $a_content, string $a_navigation)
Build fullscreen context.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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)
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)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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...
static http()
Fetches the global http state from ILIAS.
getNextMonth(array $a_items)
Get next month.
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $node_id=null)
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="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getStaticLink(?int $a_ref_id, string $a_type='', bool $a_fallback_goto=true, string $append="")
Get static link.
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)
mayEditPosting(int $a_posting_id, int $a_author_id=null)
Check if user may edit posting.
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.
Navigation History of 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)
getPermanentLinkWidget(string $append=null, bool $center=false)
static lookupBlogId(int $a_posting_id)
ILIAS Blog ReadingTime BlogSettingsGUI $reading_time_gui
activateTab(string $a_id)
getLatestPosting(array $a_items)
Get previous posting.
getLinkTarget(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
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)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS HTTP Services $http
addContributor(array $a_user_ids=array(), ?string $a_user_type=null)
Centralized method to add contributors.
__construct(Container $dic, ilPlugin $plugin)
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.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__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?