示例#1
0
文件: Edit.php 项目: nburka/blorg
 protected function buildNavBar()
 {
     parent::buildNavBar();
     if ($this->post->id !== null) {
         $entry = $this->layout->navbar->popEntry();
         $this->layout->navbar->createEntry($this->post->getTitle(), sprintf('Post/Details?id=%s', $this->post->id));
         $this->layout->navbar->addEntry($entry);
     }
 }
示例#2
0
 protected function buildPost(XML_Atom_Feed $feed, BlorgPost $post)
 {
     $site_base_href = $this->app->getBaseHref();
     $blorg_base_href = $site_base_href . $this->app->config->blorg->path;
     $path = $blorg_base_href . 'archive';
     $date = clone $post->publish_date;
     $date->convertTZ($this->app->default_time_zone);
     $year = $date->getYear();
     $month_name = BlorgPageFactory::$month_names[$date->getMonth()];
     $post_uri = sprintf('%s/%s/%s/%s', $path, $year, $month_name, $post->shortname);
     $entry = new XML_Atom_Entry($post_uri, $post->getTitle(), $post->publish_date);
     if ($post->extended_bodytext != '') {
         $full_bodytext = $post->bodytext . $post->extended_bodytext;
         $entry->setSummary($post->bodytext, 'html');
         $entry->setContent($full_bodytext, 'html');
     } else {
         $entry->setContent($post->bodytext, 'html');
     }
     foreach ($post->getTags() as $tag) {
         $entry->addCategory($tag->shortname, $blorg_base_href, $tag->title);
     }
     $entry->addLink($post_uri, 'alternate', 'text/html');
     foreach ($post->getVisibleFiles() as $file) {
         $link = new XML_Atom_Link($site_base_href . $file->getRelativeUri($this->app->config->blorg->path), 'enclosure', $file->mime_type);
         $link->setTitle($file->getDescription());
         $link->setLength($file->filesize);
         $entry->addLink($link);
     }
     if ($post->author->visible) {
         $author_uri = $blorg_base_href . 'author/' . $post->author->shortname;
     } else {
         $author_uri = '';
     }
     $entry->addAuthor($post->author->name, $author_uri, $post->author->email);
     $visible_comment_count = $post->getVisibleCommentCount();
     if ($post->comment_status == SiteCommentStatus::OPEN || $post->comment_status == SiteCommentStatus::MODERATED || $post->comment_status == SiteCommentStatus::LOCKED && $visible_comment_count > 0) {
         $entry->addLink($post_uri . '#comments', 'comments', 'text/html');
     }
     $feed->addEntry($entry);
 }
示例#3
0
 protected function displayTitle(BlorgPost $post)
 {
     $title = '';
     switch ($this->getMode('title')) {
         case SiteView::MODE_ALL:
             $title = $post->title;
             break;
         case SiteView::MODE_SUMMARY:
             $title = $post->getTitle();
             break;
     }
     if ($title != '') {
         $link = $this->getLink('title');
         $header_tag = new SwatHtmlTag('h3');
         $header_tag->class = 'entry-title';
         if ($link === false) {
             $header_tag->setContent($title);
             $header_tag->display();
         } else {
             $header_tag->open();
             $anchor_tag = new SwatHtmlTag('a');
             if (is_string($link)) {
                 $anchor_tag->href = $link;
             } else {
                 $anchor_tag->href = $this->getRelativeUri($post);
             }
             $anchor_tag->setContent($title);
             $anchor_tag->display();
             $header_tag->close();
         }
     }
 }
示例#4
0
 protected function buildTitle()
 {
     $this->layout->data->html_title = $this->post->getTitle();
 }
示例#5
0
 protected function buildHeader(XML_Atom_Feed $feed)
 {
     parent::buildHeader($feed);
     $feed->addLink($this->getPostUri($this->post), 'alternate', 'text/html');
     $feed->setSubTitle(sprintf(Blorg::_('Comments on “%s”'), $this->post->getTitle()));
 }