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/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");
195 $callback = array($this,
"observeNoteAction");
199 $may_delete_comments = ($this->
checkAccess(
"contribute") &&
200 $ilSetting->get(
"comments_del_tutor", 1));
203 false, $this->enable_public_notes, $may_delete_comments, $callback));
207 if($a_mode !=
"embedded")
209 $append = (
$_GET[
"blpg"] !=
"")
216 $tpl->setPermanentLink(
"blog", $this->node_id, $append);
219 $wtpl->setVariable(
"PAGE", parent::preview());
221 $tpl->setLoginTargetPar(
"blog_".$this->node_id.$append);
235 return $this->
preview(
"embedded");
245 $this->add_date =
true;
246 return $this->
preview(
"fullscreen");
264 return parent::showPage();
274 return stristr(get_class($this->access_handler),
"workspace");
296 include_once
"Services/User/classes/class.ilUserUtil.php";
302 if($editor[
"user_id"] != $author_id)
310 $author = implode(
", ", $authors).
" - ";
317 $prefix =
"<div class=\"il_BlockInfo\" style=\"text-align:right\">".
318 $author.ilDatePresentation::formatDate($this->
getBlogPosting()->getCreated()).
322 $a_output = $prefix.$a_output;
339 parent::getTabs($a_activate);
351 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
353 $confirmation_gui->setFormAction($ilCtrl->getFormAction($this));
354 $confirmation_gui->setHeaderText($lng->txt(
"blog_posting_deletion_confirmation"));
355 $confirmation_gui->setCancel($lng->txt(
"cancel"),
"cancelBlogPostingDeletion");
356 $confirmation_gui->setConfirm($lng->txt(
"delete"),
"confirmBlogPostingDeletion");
358 $dtpl =
new ilTemplate(
"tpl.blog_posting_deletion_confirmation.html",
true,
359 true,
"Modules/Blog");
361 $dtpl->setVariable(
"PAGE_TITLE", $this->
getBlogPosting()->getTitle());
364 include_once(
"./Services/Notes/classes/class.ilNote.php");
367 $dtpl->setVariable(
"TXT_NUMBER_USERS_NOTES_OR_COMMENTS",
368 $lng->txt(
"blog_number_users_notes_or_comments"));
369 $dtpl->setVariable(
"TXT_NR_NOTES_COMMENTS", $cnt_note_users);
371 $confirmation_gui->addItem(
"",
"", $dtpl->get());
373 $tpl->setContent($confirmation_gui->getHTML());
384 $ilCtrl->redirect($this,
"preview");
398 foreach($md_section->getKeywordIds() as $id)
400 $md_key = $md_section->getKeyword($id);
408 $ilCtrl->setParameterByClass(
"ilobjbloggui",
"blpg",
"");
409 $ilCtrl->redirectByClass(
"ilobjbloggui",
"render");
414 global
$tpl, $ilTabs;
416 $ilTabs->activateTab(
"edit");
423 $tpl->setContent($a_form->getHTML());
431 if($form->checkInput())
434 $page->setTitle($form->getInput(
"title"));
438 $ilCtrl->redirect($this,
"preview");
441 $form->setValuesByPost();
449 include_once(
'Services/Form/classes/class.ilPropertyFormGUI.php');
451 $form->setFormAction($ilCtrl->getFormAction($this));
452 $form->setTitle($lng->txt(
'blog_rename_posting'));
456 $form->addItem($title);
460 $form->addCommandButton(
'updateTitle', $lng->txt(
'save'));
461 $form->addCommandButton(
'preview', $lng->txt(
'cancel'));
468 global
$tpl, $ilTabs;
470 $ilTabs->activateTab(
"edit");
477 $tpl->setContent($a_form->getHTML());
485 if($form->checkInput())
487 $dt = $form->getInput(
"date");
491 $page->setCreated($dt);
495 $ilCtrl->redirect($this,
"preview");
498 $form->setValuesByPost();
506 include_once(
'Services/Form/classes/class.ilPropertyFormGUI.php');
508 $form->setFormAction($ilCtrl->getFormAction($this));
509 $form->setTitle($lng->txt(
'blog_edit_date'));
513 $date->setShowTime(
true);
514 $date->setInfo($lng->txt(
'blog_edit_date_info'));
515 $form->addItem($date);
519 $form->addCommandButton(
'updateDate', $lng->txt(
'save'));
520 $form->addCommandButton(
'preview', $lng->txt(
'cancel'));
528 include_once
"Services/Notes/classes/class.ilNote.php";
529 $note =
new ilNote($a_note_id);
530 $note = $note->getText();
532 include_once
"Modules/Blog/classes/class.ilObjBlog.php";
540 return array(
"deactivatePage" => $lng->txt(
"blog_toggle_draft"),
541 "activatePage" => $lng->txt(
"blog_toggle_final"));
556 $this->ctrl->redirect($this,
"edit");
560 $this->ctrl->setParameterByClass(
"ilobjbloggui",
"blpg",
"");
561 $this->ctrl->redirectByClass(
"ilobjbloggui",
"");
573 include_once
"Modules/Blog/classes/class.ilObjBlog.php";
580 $this->ctrl->redirect($this,
"edit");
584 $this->ctrl->setParameterByClass(
"ilobjbloggui",
"blpg",
"");
585 $this->ctrl->redirectByClass(
"ilobjbloggui",
"");
591 global $ilTabs,
$tpl;
598 $ilTabs->activateTab(
"pg");
605 $tpl->setContent($a_form->getHTML());
612 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
614 $form->setFormAction($this->ctrl->getFormAction($this,
"saveKeywordsForm"));
615 $form->setTitle($this->lng->txt(
"blog_edit_keywords"));
619 $txt->setMulti(
true);
620 $txt->setDataSource($this->ctrl->getLinkTarget($this,
"keywordAutocomplete",
"",
true));
621 $txt->setMaxLength(200);
623 $txt->setInfo($this->lng->txt(
"blog_keywords_info"));
624 $form->addItem(
$txt);
629 foreach($ids = $md_section->getKeywordIds() as $id)
631 $md_key = $md_section->getKeyword($id);
632 if (trim($md_key->getKeyword()) !=
"")
634 $keywords[$md_key->getKeywordLanguageCode()][]
635 = $md_key->getKeyword();
640 $ulang = $ilUser->getLanguage();
641 if($keywords[$ulang])
643 asort($keywords[$ulang]);
644 $txt->setValue($keywords[$ulang]);
657 $other = array_unique($other);
658 sort($other, SORT_LOCALE_STRING);
659 if(is_array($keywords[$ulang]))
661 $other = array_diff($other, $keywords[$ulang]);
666 foreach($other as $item)
668 $html .=
'<span class="ilTag">'.$item.
'</span>';
671 $info->setInfo($this->lng->txt(
"blog_keywords_other_info"));
673 $form->addItem(
$info);
676 $form->addCommandButton(
"saveKeywordsForm", $this->lng->txt(
"save"));
677 $form->addCommandButton(
"preview", $this->lng->txt(
"cancel"));
688 return $this->access_handler->getTree()->lookupObjectId($this->node_id);
700 if($form->checkInput())
702 $keywords = $form->getInput(
"keywords");
703 if(is_array($keywords))
708 $this->ctrl->redirect($this,
"preview");
711 $form->setValuesByPost();
717 $force_all = (bool)
$_GET[
"fetchall"];
719 include_once(
"./Services/MetaData/classes/class.ilMDKeyword.php");
723 include_once(
"./Services/Search/classes/class.ilSearchSettings.php");
731 sizeof(
$result[
"items"]) >= $cut)
736 $entry =
new stdClass();
742 $result[
"hasMoreResults"] = $has_more;
744 include_once
'./Services/JSON/classes/class.ilJsonUtil.php';
761 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)
763 $bpgui =
new self(0, null, $a_id);
766 if($a_include_picture)
768 $img = $bpgui->getFirstMediaObjectAsTag($a_picture_width, $a_picture_height, $a_export_directory);
771 $bpgui->setRawPageContent(
true);
772 $bpgui->setAbstractOnly(
true);
775 $bpgui->setFileDownloadLink(
".");
776 $bpgui->setFullscreenLink(
".");
777 $bpgui->setSourcecodeDownloadScript(
".");
780 $page = $bpgui->showPage();
789 $page =
'<div>'.$img.$page.
'</div><div style="clear:both;"></div>';
797 $this->obj->buildDom();
798 $mob_ids = $this->obj->collectMediaObjects();
801 require_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
802 foreach($mob_ids as $mob_id)
805 $mob_item = $mob_obj->getMediaItem(
"Standard");
806 if(stristr($mob_item->getFormat(),
"image"))
808 $mob_size = $mob_item->getOriginalSize();
809 if($mob_size[
"width"] >= $a_width ||
810 $mob_size[
"height"] >= $a_height)
812 if(!$a_export_directory)
819 $mob_dir =
"./mobs/mm_".$mob_obj->getId();
821 $mob_res = self::parseImage($mob_size[
"width"],
822 $mob_size[
"height"], $a_width, $a_height);
825 $location = $mob_item->getLocationType() ==
"Reference" 826 ? $mob_item->getLocation()
827 : $mob_dir.
"/".$mob_item->getLocation();
830 ' src="'.$location.
'"'.
831 ' width="'.$mob_res[0].
'"'.
832 ' height="'.$mob_res[1].
'"'.
833 ' class="ilBlogListItemSnippetPreviewImage ilFloatLeft noMirror"'.
841 protected static function parseImage($src_width, $src_height, $tgt_width, $tgt_height)
843 $ratio_width = $ratio_height = 1;
844 if($src_width > $tgt_width)
846 $ratio_width = $tgt_width / $src_width;
848 if($src_height > $tgt_height)
850 $ratio_height = $tgt_height / $src_height;
852 $shrink_ratio = min($ratio_width, $ratio_height);
855 (
int)round($src_width*$shrink_ratio),
856 (
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.
getSyntaxStylePath()
get syntax style path
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.
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
getAbstractOnly()
Get abstract only.
preview($a_mode=null)
Preview blog posting.
confirmBlogPostingDeletion()
Delete the blog posting.
static truncateHTML($a_text, $a_length=100, $a_ending='...', $a_exact=false, $a_consider_html=true)
Truncate (html) string.
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.
getContentStylePath($a_style_id)
get content style path
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.