71    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)
 
   75        $this->tabs = 
$DIC->tabs();
 
   76        $this->locator = 
$DIC[
"ilLocator"];
 
   78        $this->
user = $DIC->user();
 
   82        $lng->loadLanguageModule(
"blog");
 
   84        $this->node_id = $a_node_id;
 
   85        $this->access_handler = $a_access_handler;
 
   86        $this->enable_public_notes = (bool) $a_enable_public_notes;
 
   95        $this->may_contribute = (bool) $a_may_contribute;
 
  100        $tpl->setCurrentBlock(
"SyntaxStyle");
 
  102            "LOCATION_SYNTAX_STYLESHEET",
 
  105        $tpl->parseCurrentBlock();
 
  108        $tpl->setCurrentBlock(
"ContentStyle");
 
  110            "LOCATION_CONTENT_STYLESHEET",
 
  113        $tpl->parseCurrentBlock();
 
  118        $this->blpg = (int) 
$_GET[
"blpg"];
 
  119        $this->fetchall = (bool) 
$_GET[
"fetchall"];
 
  133        $next_class = $ilCtrl->getNextClass($this);
 
  134        $cmd = $ilCtrl->getCmd();
 
  137        $ilCtrl->setParameter($this, 
"blpg", $posting->getId());
 
  139        switch ($next_class) {
 
  147                    if ($ilCtrl->getCmd() == 
"deactivatePageToList") {
 
  148                        ilUtil::sendSuccess($this->lng->txt(
"blog_draft_info"), 
true);
 
  149                    } elseif ($ilCtrl->getCmd() == 
"activatePageToList") {
 
  150                        ilUtil::sendSuccess($this->lng->txt(
"blog_new_posting_info"), 
true);
 
  155                        $posting->getTitle());
 
  158                        $this->lng->txt(
"obj_blog")
 
  162                        $posting->getTitle(),
 
  163                        $ilCtrl->getLinkTarget($this, 
"preview")
 
  166                return parent::executeCommand();
 
  198        if ($a_cmd == 
"contribute") {
 
  201        return $this->access_handler->checkAccess($a_cmd, 
"", $this->node_id);
 
  219            "tpl.blog_page_view_main_column.html",
 
  228                $this->ctrl->redirect($this, 
"previewFullscreen");
 
  248            $callback = array($this, 
"observeNoteAction");
 
  252            $may_delete_comments = ($this->
checkAccess(
"contribute") &&
 
  255            $wtpl->setVariable(
"TOOLBAR", 
$toolbar->getHTML());
 
  260                $this->enable_public_notes,
 
  261                $may_delete_comments,
 
  267        if ($a_mode != 
"embedded") {
 
  268            $append = ($this->blpg > 0)
 
  274            $tpl->setPermanentLink(
"blog", $this->node_id, $append);
 
  277        $wtpl->setVariable(
"PAGE", parent::preview());
 
  279        $tpl->setLoginTargetPar(
"blog_" . $this->node_id . $append);
 
  281        $ilCtrl->setParameter($this, 
"blpg", $this->
getBlogPosting()->getId());
 
  293        return $this->
preview(
"embedded");
 
  303        $this->add_date = 
true;
 
  304        return $this->
preview(
"fullscreen");
 
  317            if ($a_title != 
"") {
 
  325        return parent::showPage();
 
  336        if (is_object($this->access_handler)) {
 
  337            $class = get_class($this->access_handler);
 
  340        return stristr($class, 
"workspace");
 
  363                    if ($editor[
"user_id"] != $author_id) {
 
  369                    $author = implode(
", ", $authors) . 
" - ";
 
  376            $prefix = 
"<div class=\"il_BlockInfo\" style=\"text-align:right\">" .
 
  381            $a_output = $prefix . $a_output;
 
  398        parent::getTabs($a_activate);
 
  412            $confirmation_gui->setFormAction($ilCtrl->getFormAction($this));
 
  413            $confirmation_gui->setHeaderText(
$lng->txt(
"blog_posting_deletion_confirmation"));
 
  414            $confirmation_gui->setCancel(
$lng->txt(
"cancel"), 
"cancelBlogPostingDeletion");
 
  415            $confirmation_gui->setConfirm(
$lng->txt(
"delete"), 
"confirmBlogPostingDeletion");
 
  418                "tpl.blog_posting_deletion_confirmation.html",
 
  424            $dtpl->setVariable(
"PAGE_TITLE", $this->
getBlogPosting()->getTitle());
 
  433                "TXT_NUMBER_USERS_NOTES_OR_COMMENTS",
 
  434                $lng->txt(
"blog_number_users_notes_or_comments")
 
  436            $dtpl->setVariable(
"TXT_NR_NOTES_COMMENTS", $cnt_note_users);
 
  438            $confirmation_gui->addItem(
"", 
"", $dtpl->get());
 
  440            $tpl->setContent($confirmation_gui->getHTML());
 
  451        $ilCtrl->redirect($this, 
"preview");
 
  465            foreach ($md_section->getKeywordIds() as $id) {
 
  466                $md_key = $md_section->getKeyword($id);
 
  471            ilUtil::sendSuccess(
$lng->txt(
"blog_posting_deleted"), 
true);
 
  474        $ilCtrl->setParameterByClass(
"ilobjbloggui", 
"blpg", 
""); 
 
  475        $ilCtrl->redirectByClass(
"ilobjbloggui", 
"render");
 
  483        $ilTabs->clearTargets();
 
  484        $ilTabs->setBackTarget($this->lng->txt(
"back"), $this->ctrl->getLinkTargetByClass(
"ilobjblogGUI"));
 
  486        $ilTabs->activateTab(
"edit");
 
  492        $tpl->setContent($a_form->getHTML());
 
  501        if ($form->checkInput()) {
 
  504                $page->setTitle($form->getInput(
"title"));
 
  507                $page->handleNews(
true);
 
  509                ilUtil::sendSuccess(
$lng->txt(
"settings_saved"), 
true);
 
  511                $this->ctrl->redirectByClass(
"ilObjBlogGUI", 
"");
 
  515        $form->setValuesByPost();
 
  525        $form->setFormAction($ilCtrl->getFormAction($this));
 
  526        $form->setTitle(
$lng->txt(
'blog_rename_posting'));
 
  529        $title->setRequired(
true);
 
  530        $form->addItem($title);
 
  534        $form->addCommandButton(
'updateTitle', 
$lng->txt(
'save'));
 
  535        $form->addCommandButton(
'cancelEdit', 
$lng->txt(
'cancel'));
 
  545        $ilTabs->clearTargets();
 
  546        $ilTabs->setBackTarget($this->lng->txt(
"back"), $this->ctrl->getLinkTargetByClass(
"ilobjblogGUI"));
 
  548        $ilTabs->activateTab(
"edit");
 
  554        $tpl->setContent($a_form->getHTML());
 
  563        if ($form->checkInput()) {
 
  565                $dt = $form->getItemByPostVar(
"date");
 
  566                $dt = $dt->getDate();
 
  569                $page->setCreated($dt);
 
  572                ilUtil::sendSuccess(
$lng->txt(
"settings_saved"), 
true);
 
  574                $this->ctrl->redirectByClass(
"ilObjBlogGUI", 
"");
 
  578        $form->setValuesByPost();
 
  588        $form->setFormAction($ilCtrl->getFormAction($this));
 
  589        $form->setTitle(
$lng->txt(
'blog_edit_date'));
 
  592        $date->setRequired(
true);
 
  593        $date->setShowTime(
true);
 
  594        $date->setInfo(
$lng->txt(
'blog_edit_date_info'));
 
  595        $form->addItem($date);
 
  599        $form->addCommandButton(
'updateDate', 
$lng->txt(
'save'));
 
  600        $form->addCommandButton(
'cancelEdit', 
$lng->txt(
'cancel'));
 
  613        $this->ctrl->redirectByClass(
"ilObjBlogGUI", 
"");
 
  620        $note = 
new ilNote($a_note_id);
 
  621        $note = $note->getText();
 
  629        return array(
"deactivatePage" => 
$lng->txt(
"blog_toggle_draft"),
 
  630                "activatePage" => 
$lng->txt(
"blog_toggle_final"));
 
  645            $this->ctrl->redirect($this, 
"edit");
 
  647            $this->ctrl->setParameterByClass(
"ilobjbloggui", 
"blpg", 
"");
 
  648            $this->ctrl->redirectByClass(
"ilobjbloggui", 
"");
 
  667            $this->ctrl->redirect($this, 
"edit");
 
  669            $this->ctrl->setParameterByClass(
"ilobjbloggui", 
"blpg", 
"");
 
  670            $this->ctrl->redirectByClass(
"ilobjbloggui", 
"");
 
  682        $renderer = 
$DIC->ui()->renderer();
 
  687        $ilTabs->clearTargets();
 
  688        $ilTabs->setBackTarget($this->lng->txt(
"back"), $this->ctrl->getLinkTargetByClass(
"ilobjblogGUI"));
 
  694        $ilTabs->activateTab(
"pg");
 
  700        $tpl->setContent($renderer->render($a_form));
 
  707        $ui_factory = 
$DIC->ui()->factory();
 
  713        foreach ($ids = $md_section->getKeywordIds() as $id) {
 
  714            $md_key = $md_section->getKeyword($id);
 
  715            if (trim($md_key->getKeyword()) != 
"") {
 
  718                $keywords[] = $md_key->getKeyword();
 
  737        $other = array_unique($other);
 
  738        sort($other, SORT_LOCALE_STRING);
 
  739        if (is_array($keywords[$ulang])) {
 
  740            $other = array_diff($other, $keywords[$ulang]);
 
  743        $input_tag = $ui_factory->input()->field()->tag($this->lng->txt(
"blog_keywords"), $other, $this->lng->txt(
"blog_keyword_enter"))->withUserCreatedTagsAllowed(
true);
 
  744        if (count($keywords) > 0) {
 
  745            $input_tag = $input_tag->withValue($keywords);
 
  748        $DIC->ctrl()->setParameter(
 
  754        $section = $ui_factory->input()->field()->section([$input_tag], $this->lng->txt(
"blog_edit_keywords"), 
"");
 
  756        $form_action = 
$DIC->ctrl()->getFormAction($this, 
"saveKeywordsForm");
 
  757        $form = $ui_factory->input()->container()->form()->standard($form_action, [
"tags" => 
$section]);
 
  764        if ($this->node_id) {
 
  766                return $this->access_handler->getTree()->lookupObjectId($this->node_id);
 
  777        $request = 
$DIC->http()->request();
 
  780        if ($request->getMethod() == 
"POST" 
  781            && $request->getQueryParams()[
'tags'] == 
'tags_processing') {
 
  782            $form = $form->withRequest($request);
 
  785            $keywords = 
$result[
"tags"][0];
 
  788                if (is_array($keywords)) {
 
  795            $this->ctrl->redirectByClass(
"ilObjBlogGUI", 
"");
 
  811    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)
 
  813        $bpgui = 
new self(0, 
null, $a_id);
 
  816        if ($a_include_picture) {
 
  817            $img = $bpgui->getFirstMediaObjectAsTag($a_picture_width, $a_picture_height, $a_export_directory);
 
  820        $bpgui->setRawPageContent(
true);
 
  821        $bpgui->setAbstractOnly(
true);
 
  824        $bpgui->setFileDownloadLink(
".");
 
  825        $bpgui->setFullscreenLink(
".");
 
  826        $bpgui->setSourcecodeDownloadScript(
".");
 
  827        $bpgui->setProfileBackUrl(
".");
 
  830        $page = $bpgui->showPage();
 
  837            $page = 
'<div>' . 
$img . $page . 
'</div><div style="clear:both;"></div>';
 
  845        $this->obj->buildDom();
 
  846        $mob_ids = $this->obj->collectMediaObjects();
 
  848            foreach ($mob_ids as $mob_id) {
 
  850                $mob_item = $mob_obj->getMediaItem(
"Standard");
 
  851                if (stristr($mob_item->getFormat(), 
"image")) {
 
  852                    $mob_size = $mob_item->getOriginalSize();
 
  853                    if ($mob_size[
"width"] >= $a_width ||
 
  854                        $mob_size[
"height"] >= $a_height) {
 
  855                        if (!$a_export_directory) {
 
  859                            $mob_dir = 
"./mobs/mm_" . $mob_obj->getId();
 
  869                        $location = $mob_item->getLocationType() == 
"Reference" 
  870                            ? $mob_item->getLocation()
 
  871                            : $mob_dir . 
"/" . $mob_item->getLocation();
 
  875                            ' width="' . $mob_res[0] . 
'"' .
 
  876                            ' height="' . $mob_res[1] . 
'"' .
 
  877                            ' class="ilBlogListItemSnippetPreviewImage ilFloatLeft noMirror"' .
 
  885    protected static function parseImage($src_width, $src_height, $tgt_width, $tgt_height)
 
  887        $ratio_width = $ratio_height = 1;
 
  888        if ($src_width > $tgt_width) {
 
  889            $ratio_width = $tgt_width / $src_width;
 
  891        if ($src_height > $tgt_height) {
 
  892            $ratio_height = $tgt_height / $src_height;
 
  894        $shrink_ratio = min($ratio_width, $ratio_height);
 
  897            (
int) round($src_width * $shrink_ratio),
 
  898            (
int) round($src_height * $shrink_ratio)
 
  910        return $this->lng->txt(
"blog_draft_text");
 
  921            $this->enable_public_notes,
 
  937        $this->ctrl->setParameterByClass(
"ilobjbloggui", 
"bmn", 
"");
 
  938        $this->ctrl->redirectByClass(
"ilobjbloggui", 
"render");
 
An exception for terminatinating execution or to throw for unit testing.
Class ilBlogPosting GUI class.
deactivatePage($a_to_list=false)
preview($a_mode=null)
Preview blog posting.
getActivationCaptions()
Get captions for activation action menu entries.
isInWorkspace()
Is current page part of personal workspace blog?
checkAccess($a_cmd)
Centralized access management.
cancelEdit()
Cancel editing.
previewEmbedded()
Needed for portfolio/blog handling.
getDisabledText()
Get disabled text.
previewFullscreen()
Needed for portfolio/blog handling.
postOutputProcessing($a_output)
Finalizing output processing.
static parseImage($src_width, $src_height, $tgt_width, $tgt_height)
getTabs($a_activate="")
Get tabs.
editKeywords(ilPropertyFormGUI $a_form=null)
Diplay the form.
getFirstMediaObjectAsTag($a_width=144, $a_height=144, $a_export_directory=null)
executeCommand()
execute command
deleteBlogPostingConfirmationScreen()
Delete blog posting confirmation screen.
setBlogPosting(ilBlogPosting $a_posting)
Set blog posting.
cancelBlogPostingDeletion()
Cancel blog posting deletion.
__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.
confirmBlogPostingDeletion()
Delete the blog posting.
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.
activatePage($a_to_list=false)
observeNoteAction($a_blog_id, $a_posting_id, $a_type, $a_action, $a_note_id)
showPage($a_title="")
Embedded posting in portfolio.
showEditToolbar()
Show edit toolbar.
getBlogPosting()
Get blog posting.
static getAllPostings($a_blog_id, $a_limit=1000, $a_offset=0)
Get all postings of blog.
static getKeywords($a_obj_id, $a_posting_id)
Confirmation screen class.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
static setUseRelativeDates($a_status)
set use relative dates
static useRelativeDates()
check if relative dates are used
static getUserCount($a_rep_obj_id, $a_obj_id, $a_type)
How many users have attached a note/comment to a given object?
static sendNotification($a_action, $a_in_wsp, $a_blog_node_id, $a_posting_id, $a_comment=null)
static getSyntaxStylePath()
get syntax style path
static getContentStylePath($a_style_id, $add_random=true, $add_token=true)
get content style path
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
setPresentationTitle($a_title="")
getAbstractOnly()
Get abstract only.
getPageObject()
Get Page Object.
setEnableEditing($a_enableediting)
Set Enable Editing.
setTemplateOutput($a_output=true)
getNotesHTML($a_content_object=null, $a_enable_private_notes=true, $a_enable_public_notes=false, $a_enable_notes_deletion=false, $a_callback=null, $export=false)
Get html for public and/or private notes.
setStyleId($a_styleid)
Set Style Id.
getEnableEditing()
Get Enable Editing.
setPageObject(ilPageObject $a_pg_obj)
Set Page Object.
static getPageContributors($a_parent_type, $a_page_id, $a_lang="-")
Get all contributors for parent object.
static truncateHTML( $a_text, $a_length=100, $a_ending='...', $a_exact=false, $a_consider_html=true)
Truncate (html) string.
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
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 stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc