4 include_once(
"./Services/COPage/classes/class.ilPageObjectGUI.php");
5 include_once(
"./Modules/Blog/classes/class.ilBlogPosting.php");
76 public function __construct($a_node_id, $a_access_handler = null, $a_id = 0, $a_old_nr = 0, $a_enable_public_notes =
true, $a_may_contribute =
true, $a_style_sheet_id = 0)
80 $this->tabs = $DIC->tabs();
81 $this->locator = $DIC[
"ilLocator"];
83 $this->
user = $DIC->user();
85 $lng = $DIC->language();
87 $lng->loadLanguageModule(
"blog");
89 $this->node_id = $a_node_id;
90 $this->access_handler = $a_access_handler;
91 $this->enable_public_notes = (bool) $a_enable_public_notes;
93 parent::__construct(
"blp", $a_id, $a_old_nr);
100 $this->may_contribute = (bool) $a_may_contribute;
104 include_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
106 $tpl->setCurrentBlock(
"SyntaxStyle");
108 "LOCATION_SYNTAX_STYLESHEET",
111 $tpl->parseCurrentBlock();
114 $tpl->setCurrentBlock(
"ContentStyle");
116 "LOCATION_CONTENT_STYLESHEET",
119 $tpl->parseCurrentBlock();
124 $this->blpg = (int)
$_GET[
"blpg"];
125 $this->fetchall = (bool)
$_GET[
"fetchall"];
139 $next_class =
$ilCtrl->getNextClass($this);
143 $ilCtrl->setParameter($this,
"blpg", $posting->getId());
145 switch ($next_class) {
153 if (
$ilCtrl->getCmd() ==
"deactivatePageToList") {
154 ilUtil::sendSuccess($this->lng->txt(
"blog_draft_info"),
true);
155 } elseif (
$ilCtrl->getCmd() ==
"activatePageToList") {
156 ilUtil::sendSuccess($this->lng->txt(
"blog_new_posting_info"),
true);
161 $posting->getTitle());
164 $this->lng->txt(
"obj_blog")
168 $posting->getTitle(),
169 $ilCtrl->getLinkTarget($this,
"preview")
172 return parent::executeCommand();
204 if ($a_cmd ==
"contribute") {
207 return $this->access_handler->checkAccess($a_cmd,
"", $this->node_id);
221 $toolbar = $DIC->toolbar();
226 "tpl.blog_page_view_main_column.html",
235 $this->ctrl->redirect($this,
"previewFullscreen");
255 $callback = array($this,
"observeNoteAction");
259 $may_delete_comments = ($this->
checkAccess(
"contribute") &&
262 $wtpl->setVariable(
"TOOLBAR", $toolbar->getHTML());
267 $this->enable_public_notes,
268 $may_delete_comments,
274 if ($a_mode !=
"embedded") {
275 $append = ($this->blpg > 0)
281 $tpl->setPermanentLink(
"blog", $this->node_id, $append);
284 $wtpl->setVariable(
"PAGE", parent::preview());
286 $tpl->setLoginTargetPar(
"blog_" . $this->node_id . $append);
300 return $this->
preview(
"embedded");
310 $this->add_date =
true;
311 return $this->
preview(
"fullscreen");
324 if ($a_title !=
"") {
332 return parent::showPage();
343 if (is_object($this->access_handler)) {
344 $class = get_class($this->access_handler);
347 return stristr($class,
"workspace");
366 include_once
"Services/User/classes/class.ilUserUtil.php";
371 if ($editor[
"user_id"] != $author_id) {
377 $author = implode(
", ", $authors) .
" - ";
384 $prefix =
"<div class=\"il_BlockInfo\" style=\"text-align:right\">" .
389 $a_output = $prefix . $a_output;
406 parent::getTabs($a_activate);
419 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
421 $confirmation_gui->setFormAction(
$ilCtrl->getFormAction($this));
422 $confirmation_gui->setHeaderText(
$lng->txt(
"blog_posting_deletion_confirmation"));
423 $confirmation_gui->setCancel(
$lng->txt(
"cancel"),
"cancelBlogPostingDeletion");
424 $confirmation_gui->setConfirm(
$lng->txt(
"delete"),
"confirmBlogPostingDeletion");
427 "tpl.blog_posting_deletion_confirmation.html",
433 $dtpl->setVariable(
"PAGE_TITLE", $this->
getBlogPosting()->getTitle());
436 include_once(
"./Services/Notes/classes/class.ilNote.php");
443 "TXT_NUMBER_USERS_NOTES_OR_COMMENTS",
444 $lng->txt(
"blog_number_users_notes_or_comments")
446 $dtpl->setVariable(
"TXT_NR_NOTES_COMMENTS", $cnt_note_users);
448 $confirmation_gui->addItem(
"",
"", $dtpl->get());
450 $tpl->setContent($confirmation_gui->getHTML());
461 $ilCtrl->redirect($this,
"preview");
475 foreach ($md_section->getKeywordIds() as
$id) {
476 $md_key = $md_section->getKeyword(
$id);
481 ilUtil::sendSuccess(
$lng->txt(
"blog_posting_deleted"),
true);
484 $ilCtrl->setParameterByClass(
"ilobjbloggui",
"blpg",
"");
485 $ilCtrl->redirectByClass(
"ilobjbloggui",
"render");
493 $ilTabs->clearTargets();
494 $ilTabs->setBackTarget($this->lng->txt(
"back"), $this->ctrl->getLinkTargetByClass(
"ilobjblogGUI"));
496 $ilTabs->activateTab(
"edit");
502 $tpl->setContent($a_form->getHTML());
511 if (
$form->checkInput()) {
514 $page->setTitle(
$form->getInput(
"title"));
517 $page->handleNews(
true);
519 ilUtil::sendSuccess(
$lng->txt(
"settings_saved"),
true);
521 $this->ctrl->redirectByClass(
"ilObjBlogGUI",
"");
525 $form->setValuesByPost();
534 include_once(
'Services/Form/classes/class.ilPropertyFormGUI.php');
537 $form->setTitle(
$lng->txt(
'blog_rename_posting'));
540 $title->setRequired(
true);
545 $form->addCommandButton(
'updateTitle',
$lng->txt(
'save'));
546 $form->addCommandButton(
'cancelEdit',
$lng->txt(
'cancel'));
556 $ilTabs->clearTargets();
557 $ilTabs->setBackTarget($this->lng->txt(
"back"), $this->ctrl->getLinkTargetByClass(
"ilobjblogGUI"));
559 $ilTabs->activateTab(
"edit");
565 $tpl->setContent($a_form->getHTML());
574 if (
$form->checkInput()) {
576 $dt =
$form->getItemByPostVar(
"date");
577 $dt = $dt->getDate();
580 $page->setCreated($dt);
583 ilUtil::sendSuccess(
$lng->txt(
"settings_saved"),
true);
585 $this->ctrl->redirectByClass(
"ilObjBlogGUI",
"");
589 $form->setValuesByPost();
598 include_once(
'Services/Form/classes/class.ilPropertyFormGUI.php');
601 $form->setTitle(
$lng->txt(
'blog_edit_date'));
605 $date->setShowTime(
true);
606 $date->setInfo(
$lng->txt(
'blog_edit_date_info'));
607 $form->addItem($date);
611 $form->addCommandButton(
'updateDate',
$lng->txt(
'save'));
612 $form->addCommandButton(
'cancelEdit',
$lng->txt(
'cancel'));
625 $this->ctrl->redirectByClass(
"ilObjBlogGUI",
"");
632 include_once
"Services/Notes/classes/class.ilNote.php";
633 $note =
new ilNote($a_note_id);
634 $note = $note->getText();
635 include_once
"Modules/Blog/classes/class.ilObjBlog.php";
643 return array(
"deactivatePage" =>
$lng->txt(
"blog_toggle_draft"),
644 "activatePage" =>
$lng->txt(
"blog_toggle_final"));
659 $this->ctrl->redirect($this,
"edit");
661 $this->ctrl->setParameterByClass(
"ilobjbloggui",
"blpg",
"");
662 $this->ctrl->redirectByClass(
"ilobjbloggui",
"");
674 include_once
"Modules/Blog/classes/class.ilObjBlog.php";
682 $this->ctrl->redirect($this,
"edit");
684 $this->ctrl->setParameterByClass(
"ilobjbloggui",
"blpg",
"");
685 $this->ctrl->redirectByClass(
"ilobjbloggui",
"");
697 $renderer = $DIC->ui()->renderer();
702 $ilTabs->clearTargets();
703 $ilTabs->setBackTarget($this->lng->txt(
"back"), $this->ctrl->getLinkTargetByClass(
"ilobjblogGUI"));
709 $ilTabs->activateTab(
"pg");
715 $tpl->setContent($renderer->render($a_form));
722 $ui_factory = $DIC->ui()->factory();
728 foreach ($ids = $md_section->getKeywordIds() as
$id) {
729 $md_key = $md_section->getKeyword(
$id);
730 if (trim($md_key->getKeyword()) !=
"") {
733 $keywords[] = $md_key->getKeyword();
752 $other = array_unique($other);
753 sort($other, SORT_LOCALE_STRING);
754 if (is_array($keywords[$ulang])) {
755 $other = array_diff($other, $keywords[$ulang]);
758 $input_tag = $ui_factory->input()->field()->tag($this->lng->txt(
"blog_keywords"), $other, $this->lng->txt(
"blog_keyword_enter"));
759 $input_tag = $input_tag->withValue($keywords);
761 $DIC->ctrl()->setParameter(
767 $section = $ui_factory->input()->field()->section([$input_tag], $this->lng->txt(
"blog_edit_keywords"),
"");
769 $form_action = $DIC->ctrl()->getFormAction($this,
"saveKeywordsForm");
770 $form = $ui_factory->input()->container()->form()->standard($form_action, [
"tags" =>
$section]);
777 if ($this->node_id) {
779 return $this->access_handler->getTree()->lookupObjectId($this->node_id);
794 &&
$request->getQueryParams()[
'tags'] ==
'tags_processing') {
799 $keywords =
$result[
"tags"][0];
802 if (is_array($keywords)) {
809 $this->ctrl->redirectByClass(
"ilObjBlogGUI",
"");
825 public static function getSnippet($a_id, $a_truncate =
false, $a_truncate_length = 500, $a_truncate_sign =
"...", $a_include_picture =
false, $a_picture_width = 144, $a_picture_height = 144, $a_export_directory = null)
827 $bpgui =
new self(0, null, $a_id);
830 if ($a_include_picture) {
831 $img = $bpgui->getFirstMediaObjectAsTag($a_picture_width, $a_picture_height, $a_export_directory);
834 $bpgui->setRawPageContent(
true);
835 $bpgui->setAbstractOnly(
true);
838 $bpgui->setFileDownloadLink(
".");
839 $bpgui->setFullscreenLink(
".");
840 $bpgui->setSourcecodeDownloadScript(
".");
843 $page = $bpgui->showPage();
850 $page =
'<div>' .
$img . $page .
'</div><div style="clear:both;"></div>';
858 $this->obj->buildDom();
859 $mob_ids = $this->obj->collectMediaObjects();
861 require_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
862 foreach ($mob_ids as $mob_id) {
864 $mob_item = $mob_obj->getMediaItem(
"Standard");
865 if (stristr($mob_item->getFormat(),
"image")) {
866 $mob_size = $mob_item->getOriginalSize();
867 if ($mob_size[
"width"] >= $a_width ||
868 $mob_size[
"height"] >= $a_height) {
869 if (!$a_export_directory) {
873 $mob_dir =
"./mobs/mm_" . $mob_obj->getId();
875 $mob_res = self::parseImage(
883 $location = $mob_item->getLocationType() ==
"Reference" 884 ? $mob_item->getLocation()
885 : $mob_dir .
"/" . $mob_item->getLocation();
889 ' width="' . $mob_res[0] .
'"' .
890 ' height="' . $mob_res[1] .
'"' .
891 ' class="ilBlogListItemSnippetPreviewImage ilFloatLeft noMirror"' .
899 protected static function parseImage($src_width, $src_height, $tgt_width, $tgt_height)
901 $ratio_width = $ratio_height = 1;
902 if ($src_width > $tgt_width) {
903 $ratio_width = $tgt_width / $src_width;
905 if ($src_height > $tgt_height) {
906 $ratio_height = $tgt_height / $src_height;
908 $shrink_ratio = min($ratio_width, $ratio_height);
911 (
int) round($src_width * $shrink_ratio),
912 (
int) round($src_height * $shrink_ratio)
924 return $this->lng->txt(
"blog_draft_text");
previewEmbedded()
Needed for portfolio/blog handling.
getPageObject()
Get Page Object.
setTemplateOutput($a_output=true)
foreach($paths as $path) $request
getTabs($a_activate="")
Get tabs.
Class ilBlogPosting GUI class.
getDisabledText()
Get disabled text.
if(!array_key_exists('StateId', $_REQUEST)) $id
static getPageContributors($a_parent_type, $a_page_id, $a_lang="-")
Get all contributors for parent object.
__construct($a_node_id, $a_access_handler=null, $a_id=0, $a_old_nr=0, $a_enable_public_notes=true, $a_may_contribute=true, $a_style_sheet_id=0)
Constructor.
static setUseRelativeDates($a_status)
set use relative dates
static _lookupTitle($a_id)
lookup object title
setEnableEditing($a_enableediting)
Set Enable Editing.
static getKeywords($a_obj_id, $a_posting_id)
postOutputProcessing($a_output)
Finalizing output processing.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
static useRelativeDates()
check if relative dates are used
static getAllPostings($a_blog_id, $a_limit=1000, $a_offset=0)
Get all postings of blog.
getFirstMediaObjectAsTag($a_width=144, $a_height=144, $a_export_directory=null)
previewFullscreen()
Needed for portfolio/blog handling.
static getUserCount($a_rep_obj_id, $a_obj_id, $a_type)
How many users have attached a note/comment to a given object?
setBlogPosting(ilBlogPosting $a_posting)
Set blog posting.
if(isset($_POST['submit'])) $form
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static getSnippet($a_id, $a_truncate=false, $a_truncate_length=500, $a_truncate_sign="...", $a_include_picture=false, $a_picture_width=144, $a_picture_height=144, $a_export_directory=null)
Get first text paragraph of page.
getEnableEditing()
Get Enable Editing.
getBlogPosting()
Get blog posting.
static _lookupObjId($a_id)
setPageObject(ilPageObject $a_pg_obj)
Set Page Object.
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
setPresentationTitle($a_title="")
showPage($a_title="")
Embedded posting in portfolio.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static getNamePresentation( $a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
static getSyntaxStylePath()
get syntax style path
getAbstractOnly()
Get abstract only.
static getContentStylePath($a_style_id, $add_random=true)
get content style path
preview($a_mode=null)
Preview blog posting.
cancelEdit()
Cancel editing.
confirmBlogPostingDeletion()
Delete the blog posting.
static truncateHTML($a_text, $a_length=100, $a_ending='...', $a_exact=false, $a_consider_html=true)
Truncate (html) string.
setStyleId($a_styleid)
Set Style Id.
static parseImage($src_width, $src_height, $tgt_width, $tgt_height)
deactivatePage($a_to_list=false)
isInWorkspace()
Is current page part of personal workspace blog?
editKeywords(ilPropertyFormGUI $a_form=null)
Diplay the form.
checkAccess($a_cmd)
Centralized access management.
static sendNotification($a_action, $a_in_wsp, $a_blog_node_id, $a_posting_id, $a_comment=null)
observeNoteAction($a_blog_id, $a_posting_id, $a_type, $a_news_id, $a_action, $a_note_id)
executeCommand()
execute command
getNotesHTML($a_content_object=null, $a_enable_private_notes=true, $a_enable_public_notes=false, $a_enable_notes_deletion=false, $a_callback=null)
Get html for public and/or private notes.
activatePage($a_to_list=false)
deleteBlogPostingConfirmationScreen()
Delete blog posting confirmation screen.
cancelBlogPostingDeletion()
Cancel blog posting deletion.
Confirmation screen class.