Esempio n. 1
0
 public function display()
 {
     if (!$this->visible || !$this->api_key) {
         return;
     }
     if ($this->tag_list === null || $this->tag_list->getGeoTaggedPhotoCount() == 0) {
         return;
     }
     parent::display();
     echo '<div class="pinhole-map-link">';
     $a_tag = new SwatHtmlTag('a');
     $a_tag->class = 'pinhole-map-link';
     $a_tag->href = $this->base;
     if (count($this->tag_list) > 0) {
         $a_tag->href .= '?' . $this->tag_list->__toString();
     }
     $a_tag->open();
     $img_tag = new SwatHtmlTag('img');
     $img_tag->width = $this->width;
     $img_tag->height = $this->height;
     $img_tag->src = sprintf('http://maps.google.com/staticmap?' . 'format=png8&sensor=false&maptype=roadmap' . sprintf('&size=%sx%s', $this->width, $this->height) . sprintf('&center=%s,%s', $this->getCenterLatitude(), $this->getCenterLongitude()) . sprintf('&span=%s,%s', $this->getSpanLatitude(), $this->getSpanLongitude()) . sprintf('&markers=%s', implode('|', $this->getMarkers())) . sprintf('&key=%s', $this->api_key));
     $img_tag->display();
     if ($this->show_title) {
         $this->displayTitle();
     }
     $a_tag->close();
     echo '</div>';
 }
 protected function displayContent()
 {
     $stats = $this->getPhotoStats();
     if ($stats->last_date === null) {
         echo Pinhole::_('No photos have been added.');
     } else {
         $locale = SwatI18NLocale::get();
         $first_date = new SwatDate($stats->first_date);
         $last_date = new SwatDate($stats->last_date);
         echo '<ul>';
         $li_tag = new SwatHtmlTag('li');
         $li_tag->setContent(sprintf(Pinhole::_('%s photos have been uploaded since ' . '<a href="%stag?date.date=%s">%s</a>'), $locale->formatNumber($stats->photo_count), $this->app->config->pinhole->path, $first_date->formatLikeIntl('yyyy-MM-dd'), $first_date->formatLikeIntl(SwatDate::DF_DATE)), 'text/xml');
         $li_tag->display();
         $days = $last_date->diff($first_date)->days;
         $avg = round((double) $stats->photo_count / (double) $days, 2);
         $li_tag = new SwatHtmlTag('li');
         $li_tag->setContent(sprintf(Pinhole::_('Approximately %s photos have been uploaded ' . 'per day'), $locale->formatNumber($avg)));
         $li_tag->display();
         $li_tag->setContent(sprintf(Pinhole::_('Last photo uploaded on ' . '<a href="%stag?date=%s">%s</a>'), $this->app->config->pinhole->path, $last_date->formatLikeIntl('yyyy-MM-dd'), $last_date->formatLikeIntl(SwatDate::DF_DATE)), 'text/xml');
         $li_tag->display();
         $tag_stats = $this->getTagStats();
         if ($tag_stats->tag_count > 0) {
             $li_tag = new SwatHtmlTag('li');
             $li_tag->setContent(sprintf(Pinhole::_('<a href="%s/tags/alphabetical">%s tags</a> ' . 'have been added'), $this->app->config->pinhole->path, $locale->formatNumber($tag_stats->tag_count)), 'text/xml');
             $li_tag->display();
             $a_tag = new SwatHtmlTag('a');
             $a_tag->setContent($tag_stats->popular_tag_title);
             $a_tag->href = $this->app->config->pinhole->path . 'tag?' . SwatString::minimizeEntities($tag_stats->popular_tag_name);
             $li_tag = new SwatHtmlTag('li');
             $li_tag->setContent(sprintf(Pinhole::_('The most popular tag “%s” has %s photos'), (string) $a_tag, $locale->formatNumber($tag_stats->popular_tag_count)), 'text/xml');
             $li_tag->display();
         }
         echo '</ul>';
     }
 }
 public function display()
 {
     if (!$this->visible) {
         return;
     }
     if ($this->tag_list === null) {
         return;
     }
     parent::display();
     $div_tag = new SwatHtmlTag('div');
     $div_tag->id = $this->id;
     $div_tag->class = 'pinhole-browser-page-menu';
     $div_tag->open();
     $a_tag = new SwatHtmlTag('a');
     $a_tag->href = $this->appendTagPath(sprintf('%stags/alphabetical', $this->base));
     $a_tag->setContent(Pinhole::_('Alphabetical'));
     $a_tag->display();
     $a_tag = new SwatHtmlTag('a');
     $a_tag->href = $this->appendTagPath(sprintf('%stags/date', $this->base));
     $a_tag->setContent(Pinhole::_('By Date Added'));
     $a_tag->display();
     $a_tag = new SwatHtmlTag('a');
     $a_tag->href = $this->appendTagPath(sprintf('%stags/popular', $this->base));
     $a_tag->setContent(Pinhole::_('By Popularity'));
     $a_tag->display();
     $a_tag = new SwatHtmlTag('a');
     $a_tag->href = $this->appendTagPath(sprintf('%stags/cloud', $this->base));
     $a_tag->setContent(Pinhole::_('Cloud View'));
     $a_tag->display();
     $div_tag->close();
 }
Esempio n. 4
0
 protected function displayAuthor(SiteComment $comment)
 {
     if ($this->getMode('author') > SiteView::MODE_NONE) {
         $link = $this->getLink('author');
         if ($comment->author === null) {
             parent::displayAuthor($comment);
         } else {
             // System author
             //
             // Don't link to non-visible system authors but still show
             // their name on the comment.
             if ($comment->author->visible && $link !== false) {
                 $span_tag = new SwatHtmlTag('span');
                 $span_tag->class = 'vcard author';
                 $span_tag->open();
                 $anchor_tag = new SwatHtmlTag('a');
                 $anchor_tag->class = 'comment-author system-comment-author fn url';
                 if (is_string($link)) {
                     $anchor_tag->href = $link;
                 } else {
                     $anchor_tag->href = $this->getAuthorRelativeUri($comment->author);
                 }
                 $anchor_tag->setContent($comment->author->name);
                 $anchor_tag->display();
                 $span_tag->close();
             } else {
                 $span_tag = new SwatHtmlTag('span');
                 $span_tag->class = 'comment-author system-comment-author';
                 $span_tag->setContent($comment->author->name);
                 $span_tag->display();
             }
         }
     }
 }
Esempio n. 5
0
 protected function displayPermalink(BlorgComment $comment)
 {
     if ($this->getMode('permalink') > SiteView::MODE_NONE) {
         $link = $this->getLink('permalink');
         if ($link === false) {
             $permalink_tag = new SwatHtmlTag('span');
         } else {
             $permalink_tag = new SwatHtmlTag('a');
             if ($link === true) {
                 $permalink_tag->href = $this->getRelativeUri($comment);
             } else {
                 $permalink_tag->href = $link;
             }
         }
         $permalink_tag->class = 'permalink';
         $permalink_tag->open();
         // display machine-readable date in UTC
         $abbr_tag = new SwatHtmlTag('abbr');
         $abbr_tag->class = 'comment-published';
         $abbr_tag->title = $comment->createdate->getISO8601();
         // display human-readable date in local time
         $date = clone $comment->createdate;
         $date->convertTZ($this->app->default_time_zone);
         $abbr_tag->setContent($date->formatLikeIntl('h:mm a  •  d MMMM yyyy'));
         $abbr_tag->display();
         $permalink_tag->close();
     }
 }
 protected function displayContent()
 {
     $comments = $this->getComments();
     if (count($comments) == 0) {
         echo Pinhole::_('No comments have been made.');
     } else {
         $locale = SwatI18NLocale::get();
         echo '<ul>';
         foreach ($comments as $comment) {
             echo '<li>';
             $date = new SwatDate($comment->createdate);
             $date->convertTZById($this->app->config->date->time_zone);
             $date_diff = $date->getHumanReadableDateDiff();
             $author = $comment->photographer === null ? $comment->fullname : $comment->photographer->fullname;
             $a_tag = new SwatHtmlTag('a');
             $a_tag->href = sprintf('photo/%s#comment%s', $comment->getInternalValue('photo'), $comment->id);
             $a_tag->setContent(sprintf('%s ago by %s', $date_diff, $author));
             $a_tag->display();
             $div_tag = new SwatHtmlTag('div');
             $div_tag->setContent(SwatString::ellipsizeRight(SwatString::condense($comment->bodytext), 100));
             $div_tag->display();
             echo '</li>';
         }
         echo '</ul>';
     }
 }
Esempio n. 7
0
 protected function displayContent()
 {
     $div_tag = new SwatHtmlTag('div');
     $div_tag->id = $this->id;
     $div_tag->open();
     $div_tag->close();
     Swat::displayInlineJavaScript($this->getInlineJavaScript());
 }
Esempio n. 8
0
 protected function displayContent()
 {
     $div_tag = new SwatHtmlTag('div');
     $div_tag->id = $this->id;
     $div_tag->open();
     $div_tag->close();
     Swat::displayInlineJavaScript($this->getInlineJavaScript());
     printf('<script src="%s" type="text/javascript"></script>', $this->getValue('uri'));
 }
 public static function displayCalendarMonth(SiteWebApplication $app, SwatDate $date)
 {
     $a_tag = new SwatHtmlTag('a');
     $a_tag->setContent($date->formatLikeIntl('MMMM, yyyy'));
     $a_tag->title = sprintf('View photos taken during %s', $date->formatLikeIntl('MMMM, yyyy'));
     $a_tag->href = sprintf('%stag?date.month=%s/date.year=%s', $app->config->pinhole->path, $date->getMonth(), $date->getYear());
     $h4 = new SwatHtmlTag('h4');
     $h4->setContent((string) $a_tag, 'text/xml');
     $h4->display();
 }
Esempio n. 10
0
 public function display()
 {
     parent::display();
     $span_tag = new SwatHtmlTag('span');
     $span_tag->id = $this->id;
     $span_tag->class = 'blorg-file-attach-status';
     $span_tag->setContent('');
     $span_tag->display();
     Swat::displayInlineJavaScript($this->getInlineJavaScript());
 }
Esempio n. 11
0
 protected function displayHeader()
 {
     $header_div = new SwatHtmlTag('div');
     $header_div->class = 'site-comment-display-header';
     $header_div->open();
     $anchor_tag = new SwatHtmlTag('a');
     $anchor_tag->href = sprintf('Post/Details?id=%s', $this->comment->post->id);
     $anchor_tag->setContent($this->comment->post->getTitle());
     printf(Blorg::_('Comment on %s'), $anchor_tag);
     $this->displayStatusSpan();
     $header_div->close();
 }
Esempio n. 12
0
 public function display($block)
 {
     if (!$block instanceof BuildingBlock) {
         throw new InvalidArgumentException(sprintf('The view %s can only display BuildingBlock objects.', get_class($this)));
     }
     $container = new SwatHtmlTag('div');
     $container->id = 'block_' . $block->id;
     $container->class = implode(' ', $this->getCSSClassNames());
     $container->open();
     $this->displayContent($block);
     $container->close();
 }
Esempio n. 13
0
 public function display()
 {
     if (!$this->visible) {
         return;
     }
     if ($this->tag_list === null) {
         return;
     }
     if ($this->sub_tag_list === null || count($this->sub_tag_list) == 0) {
         return;
     }
     parent::display();
     $div_tag = new SwatHtmlTag('div');
     $div_tag->class = 'pinhole-sub-tag-list-view';
     $div_tag->id = $this->id;
     $div_tag->open();
     if (count($this->tag_list) > 0) {
         $titles = array();
         foreach ($this->tag_list as $tag) {
             $titles[] = $tag->getTitle();
         }
         $header_tag = new SwatHtmlTag('h2');
         $header_tag->setContent(sprintf(Pinhole::_('View photos tagged “%s” and:'), implode('”, “', $titles)));
         $header_tag->display();
     } elseif ($this->title !== null) {
         $header_tag = new SwatHtmlTag('h2');
         $header_tag->setContent($this->title);
         $header_tag->display();
     }
     $ul_tag = new SwatHtmlTag('ul');
     $ul_tag->id = $this->id . '_list';
     $ul_tag->open();
     $li_tag = new SwatHtmlTag('li');
     foreach ($this->sub_tag_list as $tag) {
         $add_list = clone $this->tag_list;
         $add_list->add($tag);
         $li_tag->open();
         $add_anchor_tag = new SwatHtmlTag('a');
         $add_anchor_tag->class = 'pinhole-tag-list-view-tag';
         $add_anchor_tag->rel = 'tag';
         $add_anchor_tag->href = $this->base . '?' . $add_list->__toString();
         $add_anchor_tag->setContent($tag->getTitle());
         if ($tag->photo_count !== null) {
             $add_anchor_tag->title = sprintf('%s %s', SwatString::minimizeEntities(SwatString::numberFormat($tag->photo_count)), SwatString::minimizeEntities(Pinhole::ngettext('Photo', 'Photos', $tag->photo_count)));
         }
         $add_anchor_tag->display();
         $li_tag->close();
         unset($add_list);
     }
     $ul_tag->close();
     $div_tag->close();
 }
Esempio n. 14
0
 protected function displayAuthor(SiteComment $comment)
 {
     if ($this->getMode('author') > SiteView::MODE_NONE) {
         if ($comment->photographer === null) {
             parent::displayAuthor($comment);
         } else {
             // System author
             $span_tag = new SwatHtmlTag('span');
             $span_tag->class = 'comment-author system-comment-author';
             $span_tag->setContent($comment->photographer->fullname);
             $span_tag->display();
         }
     }
 }
Esempio n. 15
0
 public function getBody()
 {
     ob_start();
     echo '<strong>';
     $anchor = new SwatHtmlTag('a');
     $anchor->href = $this->element->{'link-url'};
     $anchor->setContent($this->element->{'link-text'});
     $anchor->display();
     echo '</strong>';
     if (isset($this->element->{'link-description'}) && $this->element->{'link-description'} != '') {
         echo '<p>', $this->element->{'link-description'}, '</p>';
     }
     return ob_get_clean();
 }
Esempio n. 16
0
 protected function displayContent()
 {
     $base_href = $this->app->config->blorg->path;
     echo '<ul class="blorg-syndication"><li>';
     $a_tag = new SwatHtmlTag('a');
     $a_tag->href = $base_href . 'feed';
     $a_tag->setContent(Blorg::_('Recent Posts'));
     $a_tag->display();
     echo '</li><li>';
     $a_tag = new SwatHtmlTag('a');
     $a_tag->href = $base_href . 'feed/comments';
     $a_tag->setContent(Blorg::_('Recent Comments'));
     $a_tag->display();
     echo '</li></ul>';
 }
Esempio n. 17
0
 protected function displayContent()
 {
     $comment = $this->data_object;
     $div_tag = new SwatHtmlTag('div');
     $div_tag->setContent($this->data_object->post->getTitle());
     $div_tag->display();
     $h2_tag = new SwatHtmlTag('h2');
     $h2_tag->setContent($this->data_object->fullname);
     $h2_tag->display();
     $abbr_tag = new SwatHtmlTag('abbr');
     $date = clone $comment->createdate;
     $date->convertTZ($this->app->default_time_zone);
     $abbr_tag->setContent(sprintf(Blorg::_('Posted: %s'), $date->formatLikeIntl(SwatDate::DF_DATE)));
     $abbr_tag->display();
     echo SwatString::toXHTML($comment->bodytext);
 }
Esempio n. 18
0
 protected function displayContent()
 {
     $authors = $this->getAuthors();
     if (count($authors) == 1) {
         $this->displayAuthor($authors->getFirst());
     } else {
         echo '<ul>';
         foreach ($authors as $author) {
             $li_tag = new SwatHtmlTag('li');
             $li_tag->open();
             $this->displayAuthor($author);
             $li_tag->close();
         }
         echo '</ul>';
     }
 }
 protected function displayBody(BuildingBlock $block)
 {
     if ($block->bodytext != '') {
         if ($this->getMode('body') === SiteView::MODE_ALL) {
             $div = new SwatHtmlTag('div');
             $div->class = 'building-block-bodytext';
             $div->setContent($block->bodytext, 'text/xml');
             $div->display();
         } elseif ($this->getMode('body') === SiteView::MODE_SUMMARY) {
             $bodytext = SwatString::condense($block->bodytext, $this->body_summary_length);
             $div = new SwatHtmlTag('div');
             $div->class = 'building-block-bodytext';
             $div->setContent($bodytext, 'text/xml');
             $div->display();
         }
     }
 }
 protected function displayContent()
 {
     $conversations = $this->getActiveConversations();
     if (count($conversations) > 0) {
         // get last visited date based on cookie value
         if ($this->app->hasModule('SiteCookieModule')) {
             $cookie = $this->app->getModule('SiteCookieModule');
             try {
                 if (isset($cookie->last_visit_date)) {
                     $last_visit_date = new SwatDate($cookie->last_visit_date);
                 } else {
                     $last_visit_date = new SwatDate();
                 }
             } catch (SiteCookieException $e) {
                 $last_visit_date = new SwatDate();
             }
         } else {
             $last_visit_date = new SwatDate();
         }
         echo '<ul>';
         $locale = SwatI18NLocale::get();
         $class_name = SwatDBClassMap::get('BlorgPost');
         foreach ($conversations as $conversation) {
             $post = new $class_name($conversation);
             $last_comment_date = new SwatDate($conversation->last_comment_date);
             $last_comment_date->setTZById('UTC');
             $li_tag = new SwatHtmlTag('li');
             // is last comment is later than last visit date, mark as new
             if (SwatDate::compare($last_comment_date, $last_visit_date) > 0) {
                 $li_tag->class = 'new';
             }
             $li_tag->open();
             $anchor_tag = new SwatHtmlTag('a');
             $anchor_tag->href = $this->getPostRelativeUri($post);
             $anchor_tag->setContent($post->getTitle());
             $span_tag = new SwatHtmlTag('span');
             $span_tag->setContent(sprintf(Blorg::ngettext('(%s comment)', '(%s comments)', $post->getVisibleCommentCount()), $locale->formatNumber($post->getVisibleCommentCount())));
             $anchor_tag->display();
             echo ' ';
             $span_tag->display();
             $li_tag->close();
         }
         echo '</ul>';
     }
 }
Esempio n. 21
0
 /**
  * Displays an article as a sub-article
  *
  * @param SiteArticle $article the article to display.
  * @param string $path an optional string containing the path to the
  *                      article being displayed. If no path is provided,
  *                      the path of the current page is used.
  */
 protected function displaySubArticle(SiteArticle $article, $path = null)
 {
     if ($path === null) {
         $path = $this->path;
     }
     $anchor_tag = new SwatHtmlTag('a');
     $anchor_tag->href = 'article/' . $path . '/' . $article->shortname;
     $anchor_tag->class = 'sub-article';
     $anchor_tag->setContent($article->title);
     $dt_tag = new SwatHtmlTag('dt');
     $dt_tag->id = sprintf('sub_article_%s', $article->shortname);
     $dt_tag->open();
     $anchor_tag->display();
     $dt_tag->close();
     if ($article->description != '') {
         echo '<dd>', $article->description, '</dd>';
     }
 }
Esempio n. 22
0
 protected function buildInternal()
 {
     parent::buildInternal();
     $item_list = $this->getItemList('integer');
     $blocks = SwatDB::query($this->app->db, sprintf('select * from Block where id in (%s)', $this->getItemList('integer')), SwatDBClassMap::get('BuildingBlockWrapper'));
     $view = SiteViewFactory::get($this->app, 'building-block');
     $view->getImageView()->setImageDimensionShortname('thumb');
     ob_start();
     $header = new SwatHtmlTag('h1');
     $header->setContent('Delete the following content?');
     $header->display();
     foreach ($blocks as $block) {
         $view->display($block);
     }
     $message = $this->ui->getWidget('confirmation_message');
     $message->content = ob_get_clean();
     $message->content_type = 'text/xml';
 }
Esempio n. 23
0
 protected function getContainer()
 {
     if (isset($this->app->memcache)) {
         $cache_key = sprintf('PinholeMetaDataGadget.getContainer.%s', $this->app->session->isLoggedIn() ? 'private' : 'public');
         $container = $this->app->memcache->getNs('photos', $cache_key);
         if ($container !== false) {
             return $container;
         }
     }
     $sections = $this->getMetaDataSections();
     $values = $this->getMetaDataValues();
     $locale = SwatI18NLocale::get();
     $container = new SwatContainer();
     foreach ($sections as $section) {
         $disclosure = new SwatDisclosure();
         $disclosure->title = $section->title;
         $disclosure->open = false;
         ob_start();
         echo '<ul>';
         foreach ($values as $value) {
             if ($value->meta_data == $section->id) {
                 echo '<li class="clearfix"><div>';
                 $a_tag = new SwatHtmlTag('a');
                 $a_tag->href = sprintf('%stag?meta.%s=%s', $this->app->config->pinhole->path, $section->shortname, PinholePhotoMetaDataBinding::escapeValue($value->value));
                 $a_tag->setContent(PinholePhotoMetaDataBinding::getFormattedValue($section->shortname, $value->value));
                 $a_tag->display();
                 echo ' <span>' . $locale->formatNumber($value->photo_count) . '</span>';
                 echo '</div></li>';
             }
         }
         echo '</ul>';
         $content = new SwatContentBlock();
         $content->content_type = 'text/xml';
         $content->content = ob_get_clean();
         $disclosure->add($content);
         $container->add($disclosure);
     }
     if (isset($this->app->memcache)) {
         $this->app->memcache->setNs('photos', $cache_key, $container);
     }
     return $container;
 }
Esempio n. 24
0
 protected function displayHeaderTitleText()
 {
     $site_title = $this->app->config->site->title;
     $h1_tag = new SwatHtmlTag('h1');
     $h1_tag->title = $site_title;
     $h1_tag->open();
     echo '<span>';
     $source = $this->app->getPage()->getSource();
     if ($source != '') {
         $a_tag = new SwatHtmlTag('a');
         $a_tag->accesskey = '1';
         $a_tag->href = '.';
         $a_tag->open();
     }
     $words = explode(' ', $site_title);
     $count = 0;
     $word_span = new SwatHtmlTag('span');
     $letter_span = new SwatHtmlTag('span');
     $letter_span->class = 'first-letter';
     $num_words = count($words);
     foreach ($words as $word) {
         $word = trim($word);
         if ($word != '') {
             $count++;
             $word_span->class = sprintf('title-%s', $count);
             $word_span->open();
             $letter_span->setContent(substr($word, 0, 1));
             $letter_span->display();
             echo SwatString::minimizeEntities(substr($word, 1));
             $word_span->close();
             // don't display a space for the last word
             if ($count < $num_words) {
                 echo ' ';
             }
         }
     }
     if ($source != '') {
         $a_tag->close();
     }
     echo '</span>';
     $h1_tag->close();
 }
Esempio n. 25
0
 public function display()
 {
     if (!$this->visible) {
         return;
     }
     if ($this->file === null) {
         return;
     }
     parent::display();
     $div_tag = new SwatHtmlTag('div');
     $div_tag->id = $this->id;
     $div_tag->class = 'blorg-header-image-display';
     $div_tag->open();
     $img_tag = new SwatHtmlTag('img');
     $img_tag->src = $this->file->getRelativeUri('../');
     $img_tag->alt = Blorg::_('Header Image');
     $img_tag->display();
     $div_tag->close();
     Swat::displayInlineJavaScript($this->getInlineJavaScript());
 }
Esempio n. 26
0
 public function display()
 {
     if (!$this->visible) {
         return;
     }
     if (!$this->app instanceof SiteApplication) {
         throw new SwatException('Application must be set to display certificate.');
     }
     if (!$this->account instanceof CMEAccount) {
         throw new SwatException('Account must be set to display certificate.');
     }
     if (!$this->credits instanceof CMEAccountEarnedCMECreditWrapper) {
         throw new SwatException('Earned credits must be set to display certificate.');
     }
     parent::display();
     $certificate_div = new SwatHtmlTag('div');
     $certificate_div->id = $this->id;
     $certificate_div->class = $this->getCSSClassString();
     $certificate_div->open();
     $this->displayCertificateContent();
     $certificate_div->close();
 }
Esempio n. 27
0
 protected function displayContent()
 {
     $articles = $this->getArticles();
     if (count($articles) > 0) {
         echo '<ul>';
         $locale = SwatI18NLocale::get();
         foreach ($articles as $article) {
             echo '<li>';
             $title_div = new SwatHtmlTag('div');
             $title_div->open();
             $anchor_tag = new SwatHtmlTag('a');
             $anchor_tag->href = $this->getArticleRelativeUri($article);
             $anchor_tag->setContent($article->title);
             $anchor_tag->display();
             $title_div->close();
             $content_div = new SwatHtmlTag('div');
             $content_div->setContent($article->description, 'text/xml');
             $content_div->display();
             echo '</li>';
         }
         echo '</ul>';
     }
 }
Esempio n. 28
0
 protected function displayContent()
 {
     $range = new SwatDBRange($this->getValue('limit'));
     $cache_module = isset($this->app->memcache) ? $this->app->memcache : null;
     $tag_list = new PinholeTagList($this->app, null, $this->app->session->isLoggedIn());
     $sub_tag_list = $tag_list->getSubTags($range);
     $sub_tag_count = $tag_list->getSubTagCount();
     $this->tag_list_view = new PinholeSubTagListView();
     $base_path = $this->app->config->pinhole->path;
     $this->tag_list_view->base = $base_path . 'tag';
     $this->tag_list_view->setTagList($tag_list);
     $this->tag_list_view->setSubTagList($sub_tag_list);
     $this->tag_list_view->display();
     if ($sub_tag_count > count($sub_tag_list)) {
         $div_tag = new SwatHtmlTag('div');
         $div_tag->class = 'pinhole-sub-tag-more-link';
         $div_tag->open();
         $a_tag = new SwatHtmlTag('a');
         $a_tag->href = $base_path . 'tags/date';
         $a_tag->setContent(sprintf(Pinhole::_('View All %s Tags'), $sub_tag_count));
         $a_tag->display();
         $div_tag->close();
     }
 }
Esempio n. 29
0
 /**
  * Displays this embed markup view
  */
 public function display()
 {
     if (!$this->visible) {
         return;
     }
     parent::display();
     $div_tag = new SwatHtmlTag('div');
     $div_tag->id = $this->id;
     $div_tag->open();
     $label_tag = new SwatHtmlTag('label');
     $label_tag->for = $this->id . '_textarea';
     $label_tag->class = 'blorg-markup-view-label';
     $label_tag->open();
     $span_tag = new SwatHtmlTag('span');
     $span_tag->setContent(Blorg::_('Embed:'));
     $span_tag->display();
     $label_tag->close();
     $first_option = reset($this->getOptions());
     $textarea = $this->getCompositeWidget('textarea');
     $textarea->value = $first_option->value;
     $textarea->display();
     $div_tag->close();
     Swat::displayInlineJavaScript($this->getInlineJavaScript());
 }
Esempio n. 30
0
 public function getBody()
 {
     $best_url = null;
     $best_delta = null;
     $best_width = null;
     foreach ($this->element->{'photo-url'} as $url) {
         $max_width = isset($url['max-width']) ? $url['max-width'] : 400;
         if ($best_url === null) {
             $best_url = (string) $url;
             $best_width = $max_width;
             $best_delta = abs($max_width - $this->width);
         } elseif (abs($max_width - $this->width) < $best_delta || $best_width > $this->width && $max_width <= $this->width) {
             $best_url = (string) $url;
             $best_width = $max_width;
             $best_delta = abs($max_width - $this->width);
         }
     }
     ob_start();
     $image_tag = new SwatHtmlTag('img');
     $image_tag->src = $best_url;
     $image_tag->alt = $this->getTitle();
     $image_tag->display();
     return ob_get_clean();
 }