4 include_once(
"./Services/COPage/classes/class.ilPageObjectGUI.php");
5 include_once(
"./Modules/Blog/classes/class.ilBlogPosting.php");
36 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)
40 $lng->loadLanguageModule(
"blog");
42 $this->node_id = $a_node_id;
43 $this->access_handler = $a_access_handler;
44 $this->enable_public_notes = (bool)$a_enable_public_notes;
46 parent::__construct(
"blp", $a_id, $a_old_nr);
52 $this->may_contribute = (bool)$a_may_contribute;
56 include_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
58 $tpl->setCurrentBlock(
"SyntaxStyle");
59 $tpl->setVariable(
"LOCATION_SYNTAX_STYLESHEET",
61 $tpl->parseCurrentBlock();
64 $tpl->setCurrentBlock(
"ContentStyle");
65 $tpl->setVariable(
"LOCATION_CONTENT_STYLESHEET",
67 $tpl->parseCurrentBlock();
80 $next_class = $ilCtrl->getNextClass($this);
81 $cmd = $ilCtrl->getCmd();
84 $ilCtrl->setParameter($this,
"blpg", $posting->getId());
104 case "ilpageobjectgui":
105 die(
"Deprecated. Blog Posting gui forwarding to ilpageobject");
114 $posting->getTitle());
116 $this->lng->txt(
"obj_blog"));
118 $ilLocator->addItem($posting->getTitle(),
119 $ilCtrl->getLinkTarget($this,
"preview"));
121 return parent::executeCommand();
153 if($a_cmd ==
"contribute")
157 return $this->access_handler->checkAccess($a_cmd,
"", $this->node_id);
169 $wtpl =
new ilTemplate(
"tpl.blog_page_view_main_column.html",
170 true,
true,
"Modules/Blog");
177 $this->ctrl->redirect($this,
"previewFullscreen");
199 $callback =
array($this,
"observeNoteAction");
203 $may_delete_comments = ($this->
checkAccess(
"contribute") &&
204 $ilSetting->get(
"comments_del_tutor", 1));
207 false, $this->enable_public_notes, $may_delete_comments, $callback));
211 if($a_mode !=
"embedded")
213 $append = (
$_GET[
"blpg"] !=
"")
220 $tpl->setPermanentLink(
"blog", $this->node_id, $append);
223 $wtpl->setVariable(
"PAGE", parent::preview());
225 $tpl->setLoginTargetPar(
"blog_".$this->node_id.$append);
239 return $this->
preview(
"embedded");
249 $this->add_date =
true;
250 return $this->
preview(
"fullscreen");
268 return parent::showPage();
278 return stristr(get_class($this->access_handler),
"workspace");
300 include_once
"Services/User/classes/class.ilUserUtil.php";
306 if($editor[
"user_id"] != $author_id)
314 $author = implode(
", ", $authors).
" - ";
321 $prefix =
"<div class=\"il_BlockInfo\" style=\"text-align:right\">".
322 $author.ilDatePresentation::formatDate($this->
getBlogPosting()->getCreated()).
326 $a_output = $prefix.$a_output;
343 parent::getTabs($a_activate);
355 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
357 $confirmation_gui->setFormAction($ilCtrl->getFormAction($this));
358 $confirmation_gui->setHeaderText($lng->txt(
"blog_posting_deletion_confirmation"));
359 $confirmation_gui->setCancel($lng->txt(
"cancel"),
"cancelBlogPostingDeletion");
360 $confirmation_gui->setConfirm($lng->txt(
"delete"),
"confirmBlogPostingDeletion");
362 $dtpl =
new ilTemplate(
"tpl.blog_posting_deletion_confirmation.html",
true,
363 true,
"Modules/Blog");
365 $dtpl->setVariable(
"PAGE_TITLE", $this->
getBlogPosting()->getTitle());
368 include_once(
"./Services/Notes/classes/class.ilNote.php");
371 $dtpl->setVariable(
"TXT_NUMBER_USERS_NOTES_OR_COMMENTS",
372 $lng->txt(
"blog_number_users_notes_or_comments"));
373 $dtpl->setVariable(
"TXT_NR_NOTES_COMMENTS", $cnt_note_users);
375 $confirmation_gui->addItem(
"",
"", $dtpl->get());
377 $tpl->setContent($confirmation_gui->getHTML());
388 $ilCtrl->redirect($this,
"preview");
402 foreach($md_section->getKeywordIds() as $id)
404 $md_key = $md_section->getKeyword($id);
412 $ilCtrl->setParameterByClass(
"ilobjbloggui",
"blpg",
"");
413 $ilCtrl->redirectByClass(
"ilobjbloggui",
"render");
418 global
$tpl, $ilTabs;
420 $ilTabs->activateTab(
"edit");
427 $tpl->setContent($a_form->getHTML());
435 if($form->checkInput())
440 $page->setTitle($form->getInput(
"title"));
443 $page->handleNews(
true);
446 $ilCtrl->redirect($this,
"preview");
450 $form->setValuesByPost();
458 include_once(
'Services/Form/classes/class.ilPropertyFormGUI.php');
460 $form->setFormAction($ilCtrl->getFormAction($this));
461 $form->setTitle($lng->txt(
'blog_rename_posting'));
464 $title->setRequired(
true);
469 $form->addCommandButton(
'updateTitle', $lng->txt(
'save'));
470 $form->addCommandButton(
'preview', $lng->txt(
'cancel'));
477 global
$tpl, $ilTabs;
479 $ilTabs->activateTab(
"edit");
486 $tpl->setContent($a_form->getHTML());
494 if($form->checkInput())
498 $dt = $form->getItemByPostVar(
"date");
499 $dt = $dt->getDate();
502 $page->setCreated($dt);
506 $ilCtrl->redirect($this,
"preview");
510 $form->setValuesByPost();
518 include_once(
'Services/Form/classes/class.ilPropertyFormGUI.php');
520 $form->setFormAction($ilCtrl->getFormAction($this));
521 $form->setTitle($lng->txt(
'blog_edit_date'));
525 $date->setShowTime(
true);
526 $date->setInfo($lng->txt(
'blog_edit_date_info'));
527 $form->addItem($date);
531 $form->addCommandButton(
'updateDate', $lng->txt(
'save'));
532 $form->addCommandButton(
'preview', $lng->txt(
'cancel'));
540 include_once
"Services/Notes/classes/class.ilNote.php";
541 $note =
new ilNote($a_note_id);
542 $note = $note->getText();
544 include_once
"Modules/Blog/classes/class.ilObjBlog.php";
552 return array(
"deactivatePage" => $lng->txt(
"blog_toggle_draft"),
553 "activatePage" => $lng->txt(
"blog_toggle_final"));
570 $this->ctrl->redirect($this,
"edit");
574 $this->ctrl->setParameterByClass(
"ilobjbloggui",
"blpg",
"");
575 $this->ctrl->redirectByClass(
"ilobjbloggui",
"");
587 include_once
"Modules/Blog/classes/class.ilObjBlog.php";
597 $this->ctrl->redirect($this,
"edit");
601 $this->ctrl->setParameterByClass(
"ilobjbloggui",
"blpg",
"");
602 $this->ctrl->redirectByClass(
"ilobjbloggui",
"");
608 global $ilTabs,
$tpl;
615 $ilTabs->activateTab(
"pg");
622 $tpl->setContent($a_form->getHTML());
629 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
631 $form->setFormAction($this->ctrl->getFormAction($this,
"saveKeywordsForm"));
632 $form->setTitle($this->lng->txt(
"blog_edit_keywords"));
636 $txt->setMulti(
true);
637 $txt->setDataSource($this->ctrl->getLinkTarget($this,
"keywordAutocomplete",
"",
true));
638 $txt->setMaxLength(200);
640 $txt->setInfo($this->lng->txt(
"blog_keywords_info"));
641 $form->addItem(
$txt);
646 foreach($ids = $md_section->getKeywordIds() as $id)
648 $md_key = $md_section->getKeyword($id);
649 if (trim($md_key->getKeyword()) !=
"")
651 $keywords[$md_key->getKeywordLanguageCode()][]
652 = $md_key->getKeyword();
657 $ulang = $ilUser->getLanguage();
658 if($keywords[$ulang])
660 asort($keywords[$ulang]);
661 $txt->setValue($keywords[$ulang]);
674 $other = array_unique($other);
675 sort($other, SORT_LOCALE_STRING);
676 if(is_array($keywords[$ulang]))
678 $other = array_diff($other, $keywords[$ulang]);
683 foreach($other as $item)
685 $html .=
'<span class="ilTag">'.$item.
'</span>';
688 $info->setInfo($this->lng->txt(
"blog_keywords_other_info"));
690 $form->addItem(
$info);
693 $form->addCommandButton(
"saveKeywordsForm", $this->lng->txt(
"save"));
694 $form->addCommandButton(
"preview", $this->lng->txt(
"cancel"));
705 return $this->access_handler->getTree()->lookupObjectId($this->node_id);
717 if($form->checkInput())
721 $keywords = $form->getInput(
"keywords");
722 if (is_array($keywords))
728 $this->ctrl->redirect($this,
"preview");
731 $form->setValuesByPost();
737 $force_all = (bool)
$_GET[
"fetchall"];
739 include_once(
"./Services/MetaData/classes/class.ilMDKeyword.php");
743 include_once(
"./Services/Search/classes/class.ilSearchSettings.php");
751 sizeof(
$result[
"items"]) >= $cut)
756 $entry =
new stdClass();
762 $result[
"hasMoreResults"] = $has_more;
764 include_once
'./Services/JSON/classes/class.ilJsonUtil.php';
781 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)
783 $bpgui =
new self(0, null, $a_id);
786 if($a_include_picture)
788 $img = $bpgui->getFirstMediaObjectAsTag($a_picture_width, $a_picture_height, $a_export_directory);
791 $bpgui->setRawPageContent(
true);
792 $bpgui->setAbstractOnly(
true);
795 $bpgui->setFileDownloadLink(
".");
796 $bpgui->setFullscreenLink(
".");
797 $bpgui->setSourcecodeDownloadScript(
".");
800 $page = $bpgui->showPage();
809 $page =
'<div>'.$img.$page.
'</div><div style="clear:both;"></div>';
817 $this->obj->buildDom();
818 $mob_ids = $this->obj->collectMediaObjects();
821 require_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
822 foreach($mob_ids as $mob_id)
825 $mob_item = $mob_obj->getMediaItem(
"Standard");
826 if(stristr($mob_item->getFormat(),
"image"))
828 $mob_size = $mob_item->getOriginalSize();
829 if($mob_size[
"width"] >= $a_width ||
830 $mob_size[
"height"] >= $a_height)
832 if(!$a_export_directory)
839 $mob_dir =
"./mobs/mm_".$mob_obj->getId();
841 $mob_res = self::parseImage($mob_size[
"width"],
842 $mob_size[
"height"], $a_width, $a_height);
845 $location = $mob_item->getLocationType() ==
"Reference" 846 ? $mob_item->getLocation()
847 : $mob_dir.
"/".$mob_item->getLocation();
850 ' src="'.$location.
'"'.
851 ' width="'.$mob_res[0].
'"'.
852 ' height="'.$mob_res[1].
'"'.
853 ' class="ilBlogListItemSnippetPreviewImage ilFloatLeft noMirror"'.
861 protected static function parseImage($src_width, $src_height, $tgt_width, $tgt_height)
863 $ratio_width = $ratio_height = 1;
864 if($src_width > $tgt_width)
866 $ratio_width = $tgt_width / $src_width;
868 if($src_height > $tgt_height)
870 $ratio_height = $tgt_height / $src_height;
872 $shrink_ratio = min($ratio_width, $ratio_height);
875 (
int)round($src_width*$shrink_ratio),
876 (
int)round($src_height*$shrink_ratio)
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
previewEmbedded()
Needed for portfolio/blog handling.
getPageObject()
Get Page Object.
setTemplateOutput($a_output=true)
observeNoteAction($a_blog_id, $a_posting_id, $a_type, $a_action, $a_note_id)
getTabs($a_activate="")
Get tabs.
Class ilBlogPosting GUI class.
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.
setPageObject($a_pg_obj)
Set Page Object.
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 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)
Default behaviour is:
static encode($mixed, $suppress_native=false)
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.
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)
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
setPresentationTitle($a_title="")
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static getSyntaxStylePath()
get syntax style path
getAbstractOnly()
Get abstract only.
preview($a_mode=null)
Preview blog posting.
Create styles array
The data for the language used.
confirmBlogPostingDeletion()
Delete the blog posting.
static truncateHTML($a_text, $a_length=100, $a_ending='...', $a_exact=false, $a_consider_html=true)
Truncate (html) string.
static getContentStylePath($a_style_id)
get content style path
showPage()
Embedded posting in portfolio.
static _getMatchingKeywords($a_query, $a_type, $a_rbac_id=0)
Search for keywords.
setStyleId($a_styleid)
Set Style Id.
static parseImage($src_width, $src_height, $tgt_width, $tgt_height)
deactivatePage($a_to_list=false)
This class represents a non editable value in a property form.
isInWorkspace()
Is current page part of personal workspace blog?
editKeywords(ilPropertyFormGUI $a_form=null)
checkAccess($a_cmd)
Centralized access management.
static sendNotification($a_action, $a_in_wsp, $a_blog_node_id, $a_posting_id, $a_comment=null)
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.