4 include_once(
"./Services/COPage/classes/class.ilPageObjectGUI.php");
5 include_once(
"./Modules/Blog/classes/class.ilBlogPosting.php");
51 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)
55 $this->tabs = $DIC->tabs();
56 $this->locator = $DIC[
"ilLocator"];
58 $this->
user = $DIC->user();
60 $lng = $DIC->language();
62 $lng->loadLanguageModule(
"blog");
64 $this->node_id = $a_node_id;
65 $this->access_handler = $a_access_handler;
66 $this->enable_public_notes = (bool) $a_enable_public_notes;
68 parent::__construct(
"blp", $a_id, $a_old_nr);
75 $this->may_contribute = (bool) $a_may_contribute;
79 include_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
81 $tpl->setCurrentBlock(
"SyntaxStyle");
83 "LOCATION_SYNTAX_STYLESHEET",
86 $tpl->parseCurrentBlock();
89 $tpl->setCurrentBlock(
"ContentStyle");
91 "LOCATION_CONTENT_STYLESHEET",
94 $tpl->parseCurrentBlock();
110 $next_class =
$ilCtrl->getNextClass($this);
114 $ilCtrl->setParameter($this,
"blpg", $posting->getId());
116 switch ($next_class) {
133 case "ilpageobjectgui":
134 die(
"Deprecated. Blog Posting gui forwarding to ilpageobject");
139 if ($_REQUEST[
"cmd"] ==
"deactivatePageToList") {
141 } elseif ($_REQUEST[
"cmd"] ==
"activatePageToList") {
147 $posting->getTitle());
150 $this->lng->txt(
"obj_blog")
154 $posting->getTitle(),
155 $ilCtrl->getLinkTarget($this,
"preview")
158 return parent::executeCommand();
190 if ($a_cmd ==
"contribute") {
193 return $this->access_handler->checkAccess($a_cmd,
"", $this->node_id);
207 $toolbar = $DIC->toolbar();
212 "tpl.blog_page_view_main_column.html",
221 $this->ctrl->redirect($this,
"previewFullscreen");
241 $callback =
array($this,
"observeNoteAction");
245 $may_delete_comments = ($this->
checkAccess(
"contribute") &&
248 $wtpl->setVariable(
"TOOLBAR", $toolbar->getHTML());
253 $this->enable_public_notes,
254 $may_delete_comments,
260 if ($a_mode !=
"embedded") {
261 $append = (
$_GET[
"blpg"] !=
"")
267 $tpl->setPermanentLink(
"blog", $this->node_id, $append);
270 $wtpl->setVariable(
"PAGE", parent::preview());
272 $tpl->setLoginTargetPar(
"blog_" . $this->node_id . $append);
286 return $this->
preview(
"embedded");
296 $this->add_date =
true;
297 return $this->
preview(
"fullscreen");
310 if ($a_title !=
"") {
318 return parent::showPage();
329 if (is_object($this->access_handler)) {
330 $class = get_class($this->access_handler);
333 return stristr($class,
"workspace");
352 include_once
"Services/User/classes/class.ilUserUtil.php";
357 if ($editor[
"user_id"] != $author_id) {
363 $author = implode(
", ", $authors) .
" - ";
370 $prefix =
"<div class=\"il_BlockInfo\" style=\"text-align:right\">" .
375 $a_output = $prefix . $a_output;
392 parent::getTabs($a_activate);
405 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
407 $confirmation_gui->setFormAction(
$ilCtrl->getFormAction($this));
408 $confirmation_gui->setHeaderText(
$lng->txt(
"blog_posting_deletion_confirmation"));
409 $confirmation_gui->setCancel(
$lng->txt(
"cancel"),
"cancelBlogPostingDeletion");
410 $confirmation_gui->setConfirm(
$lng->txt(
"delete"),
"confirmBlogPostingDeletion");
413 "tpl.blog_posting_deletion_confirmation.html",
419 $dtpl->setVariable(
"PAGE_TITLE", $this->
getBlogPosting()->getTitle());
422 include_once(
"./Services/Notes/classes/class.ilNote.php");
429 "TXT_NUMBER_USERS_NOTES_OR_COMMENTS",
430 $lng->txt(
"blog_number_users_notes_or_comments")
432 $dtpl->setVariable(
"TXT_NR_NOTES_COMMENTS", $cnt_note_users);
434 $confirmation_gui->addItem(
"",
"", $dtpl->get());
436 $tpl->setContent($confirmation_gui->getHTML());
447 $ilCtrl->redirect($this,
"preview");
461 foreach ($md_section->getKeywordIds() as
$id) {
462 $md_key = $md_section->getKeyword(
$id);
470 $ilCtrl->setParameterByClass(
"ilobjbloggui",
"blpg",
"");
471 $ilCtrl->redirectByClass(
"ilobjbloggui",
"render");
479 $ilTabs->activateTab(
"edit");
485 $tpl->setContent($a_form->getHTML());
494 if (
$form->checkInput()) {
497 $page->setTitle(
$form->getInput(
"title"));
500 $page->handleNews(
true);
503 $ilCtrl->redirect($this,
"preview");
507 $form->setValuesByPost();
516 include_once(
'Services/Form/classes/class.ilPropertyFormGUI.php');
519 $form->setTitle(
$lng->txt(
'blog_rename_posting'));
522 $title->setRequired(
true);
527 $form->addCommandButton(
'updateTitle',
$lng->txt(
'save'));
528 $form->addCommandButton(
'preview',
$lng->txt(
'cancel'));
538 $ilTabs->activateTab(
"edit");
544 $tpl->setContent($a_form->getHTML());
553 if (
$form->checkInput()) {
555 $dt =
$form->getItemByPostVar(
"date");
556 $dt = $dt->getDate();
559 $page->setCreated($dt);
563 $ilCtrl->redirect($this,
"preview");
567 $form->setValuesByPost();
576 include_once(
'Services/Form/classes/class.ilPropertyFormGUI.php');
579 $form->setTitle(
$lng->txt(
'blog_edit_date'));
583 $date->setShowTime(
true);
584 $date->setInfo(
$lng->txt(
'blog_edit_date_info'));
585 $form->addItem($date);
589 $form->addCommandButton(
'updateDate',
$lng->txt(
'save'));
590 $form->addCommandButton(
'preview',
$lng->txt(
'cancel'));
598 include_once
"Services/Notes/classes/class.ilNote.php";
599 $note =
new ilNote($a_note_id);
600 $note = $note->getText();
602 include_once
"Modules/Blog/classes/class.ilObjBlog.php";
610 return array(
"deactivatePage" =>
$lng->txt(
"blog_toggle_draft"),
611 "activatePage" =>
$lng->txt(
"blog_toggle_final"));
626 $this->ctrl->redirect($this,
"edit");
628 $this->ctrl->setParameterByClass(
"ilobjbloggui",
"blpg",
"");
629 $this->ctrl->redirectByClass(
"ilobjbloggui",
"");
641 include_once
"Modules/Blog/classes/class.ilObjBlog.php";
649 $this->ctrl->redirect($this,
"edit");
651 $this->ctrl->setParameterByClass(
"ilobjbloggui",
"blpg",
"");
652 $this->ctrl->redirectByClass(
"ilobjbloggui",
"");
665 $ilTabs->activateTab(
"pg");
671 $tpl->setContent($a_form->getHTML());
678 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
680 $form->setFormAction($this->ctrl->getFormAction($this,
"saveKeywordsForm"));
681 $form->setTitle($this->lng->txt(
"blog_edit_keywords"));
685 $txt->setMulti(
true);
686 $txt->setDataSource($this->ctrl->getLinkTarget($this,
"keywordAutocomplete",
"",
true));
687 $txt->setMaxLength(200);
689 $txt->setInfo($this->lng->txt(
"blog_keywords_info"));
695 foreach ($ids = $md_section->getKeywordIds() as
$id) {
696 $md_key = $md_section->getKeyword(
$id);
697 if (trim($md_key->getKeyword()) !=
"") {
698 $keywords[$md_key->getKeywordLanguageCode()][]
699 = $md_key->getKeyword();
704 $ulang =
$ilUser->getLanguage();
705 if ($keywords[$ulang]) {
706 asort($keywords[$ulang]);
707 $txt->setValue($keywords[$ulang]);
718 $other = array_unique($other);
719 sort($other, SORT_LOCALE_STRING);
720 if (is_array($keywords[$ulang])) {
721 $other = array_diff($other, $keywords[$ulang]);
723 if (
sizeof($other)) {
725 foreach ($other as $item) {
726 $html .=
'<span class="ilTag">' . $item .
'</span>';
729 $info->setInfo($this->lng->txt(
"blog_keywords_other_info"));
734 $form->addCommandButton(
"saveKeywordsForm", $this->lng->txt(
"save"));
735 $form->addCommandButton(
"preview", $this->lng->txt(
"cancel"));
742 if ($this->node_id) {
744 return $this->access_handler->getTree()->lookupObjectId($this->node_id);
754 if (
$form->checkInput()) {
756 $keywords =
$form->getInput(
"keywords");
757 if (is_array($keywords)) {
762 $this->ctrl->redirect($this,
"preview");
765 $form->setValuesByPost();
771 $force_all = (bool)
$_GET[
"fetchall"];
773 include_once(
"./Services/MetaData/classes/class.ilMDKeyword.php");
780 include_once(
"./Services/Search/classes/class.ilSearchSettings.php");
787 sizeof(
$result[
"items"]) >= $cut) {
791 $entry =
new stdClass();
797 $result[
"hasMoreResults"] = $has_more;
799 include_once
'./Services/JSON/classes/class.ilJsonUtil.php';
816 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)
818 $bpgui =
new self(0, null, $a_id);
821 if ($a_include_picture) {
822 $img = $bpgui->getFirstMediaObjectAsTag($a_picture_width, $a_picture_height, $a_export_directory);
825 $bpgui->setRawPageContent(
true);
826 $bpgui->setAbstractOnly(
true);
829 $bpgui->setFileDownloadLink(
".");
830 $bpgui->setFullscreenLink(
".");
831 $bpgui->setSourcecodeDownloadScript(
".");
834 $page = $bpgui->showPage();
841 $page =
'<div>' .
$img . $page .
'</div><div style="clear:both;"></div>';
849 $this->obj->buildDom();
850 $mob_ids = $this->obj->collectMediaObjects();
852 require_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
853 foreach ($mob_ids as $mob_id) {
855 $mob_item = $mob_obj->getMediaItem(
"Standard");
856 if (stristr($mob_item->getFormat(),
"image")) {
857 $mob_size = $mob_item->getOriginalSize();
858 if ($mob_size[
"width"] >= $a_width ||
859 $mob_size[
"height"] >= $a_height) {
860 if (!$a_export_directory) {
864 $mob_dir =
"./mobs/mm_" . $mob_obj->getId();
866 $mob_res = self::parseImage(
874 $location = $mob_item->getLocationType() ==
"Reference" 875 ? $mob_item->getLocation()
876 : $mob_dir .
"/" . $mob_item->getLocation();
880 ' width="' . $mob_res[0] .
'"' .
881 ' height="' . $mob_res[1] .
'"' .
882 ' class="ilBlogListItemSnippetPreviewImage ilFloatLeft noMirror"' .
890 protected static function parseImage($src_width, $src_height, $tgt_width, $tgt_height)
892 $ratio_width = $ratio_height = 1;
893 if ($src_width > $tgt_width) {
894 $ratio_width = $tgt_width / $src_width;
896 if ($src_height > $tgt_height) {
897 $ratio_height = $tgt_height / $src_height;
899 $shrink_ratio = min($ratio_width, $ratio_height);
902 (
int) round($src_width*$shrink_ratio),
903 (
int) round($src_height*$shrink_ratio)
915 return $this->lng->txt(
"blog_draft_text");
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.
getDisabledText()
Get disabled text.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date public.
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 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 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?
foreach($_POST as $key=> $value) $res
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.
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 _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.