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(); } } } }
public function display() { if (!$this->visible) { return; } if ($this->tag_list === null) { return; } parent::display(); $div_tag = new SwatHtmlTag('div'); $div_tag->class = 'pinhole-tag-list-view'; $div_tag->id = $this->id; $div_tag->open(); $this->displayHomeLink(); echo 'Browsing: '; if (count($this->tag_list) > 0) { $this->displayTagList($this->tag_list); } else { echo Pinhole::_('All Photos'); } $this->displayCount(); echo ' '; $this->displayAtomLink(); $div_tag->close(); }
protected function displayDetails(BuildingBlock $block) { $parts = array(); ob_start(); $this->displayTitle($block); $title = ob_get_clean(); if ($title != '') { $parts[] = $title; } ob_start(); $this->displayDescription($block); $description = ob_get_clean(); if ($description != '') { $parts[] = $description; } if (count($parts) > 0) { $span = new SwatHtmlTag('span'); $span->class = 'building-block-image-details'; $span->open(); foreach ($parts as $part) { echo $part; } $span->close(); } }
protected function displayContent(BuildingBlock $block) { if (!$block->attachment instanceof SiteAttachment) { throw new InvalidArgumentException(sprintf('The view %s can only display blocks with attachments.', get_class($this))); } $link = $this->getLink('content'); if ($link === false) { $wrapper = new SwatHtmlTag('span'); } else { $wrapper = new SwatHtmlTag('a'); if ($link === true) { $wrapper->href = $block->attachment->getUri(); } else { $wrapper->href = $link; } } $wrapper->class = 'building-block-attachment-wrapper'; $wrapper->open(); $this->displayIcon($block); ob_start(); $this->displayTitle($block); $title = ob_get_clean(); ob_start(); $this->displayDetails($block); $details = ob_get_clean(); if ($title != '' || $details != '') { echo '<span class="building-block-attachment-description">'; echo $title, $details; echo '</span>'; } $wrapper->close(); }
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('¢er=%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 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(); } }
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(); }
protected function displayContent() { $div_tag = new SwatHtmlTag('div'); $div_tag->id = $this->id; $div_tag->open(); $div_tag->close(); Swat::displayInlineJavaScript($this->getInlineJavaScript()); }
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')); }
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(); }
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(); }
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(); }
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 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>'; } }
/** * 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>'; } }
public function display() { if (!$this->visible) { return; } if ($this->tag_list === null || $this->photo === null) { return; } parent::display(); $photos = $this->tag_list->getNextPrevPhotos($this->photo); $div_tag = new SwatHtmlTag('div'); $div_tag->id = $this->id; $div_tag->class = 'pinhole-photo-next-prev'; $div_tag->open(); $this->displayPrev($photos['prev']); $this->displayCurrent($this->photo); $this->displayNext($photos['next']); $div_tag->close(); }
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(); }
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()); }
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(); }
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>'; } }
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(); } }
/** * 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()); }
protected function displayImage(BlorgPost $post) { // borrow display mode from bodytext part if ($this->getMode('bodytext') > SiteView::MODE_NONE) { $image = $this->getImage($post); if ($image !== null) { // borrow link mode from title part $link = $this->getLink('title'); echo '<div class="entry-image">'; if ($link !== false) { $a_tag = new SwatHtmlTag('a'); if (is_string($link)) { $a_tag->href = $link; } else { $a_tag->href = $this->getRelativeUri($post); } $a_tag->title = $post->getTitle(); $a_tag->open(); } $img_tag = $image->getImgTag('thumb'); if ($image->description !== null) { $img_tag->title = $image->description; } $img_tag->display(); if ($link !== false) { $a_tag->close(); } ob_start(); $this->displayAuthor($post); $author = ob_get_clean(); if ($author != '') { echo '<span>'; printf(Blorg::_('Review by %s'), $author); echo '</span>'; } echo '</div>'; } } }
public function display() { $this->createEmbeddedWidgets(); $form_tag = new SwatHtmlTag('form'); $form_tag->id = $this->id . '_form'; $form_tag->class = 'swat-form'; $form_tag->method = 'post'; $form_tag->action = $this->action; $form_tag->enctype = 'multipart/form-data'; $form_tag->open(); $div_tag = new SwatHtmlTag('div'); $div_tag->open(); $hidden_input_tag = new SwatHtmlTag('input'); $hidden_input_tag->type = 'hidden'; $hidden_input_tag->id = $this->id . '_identifier'; $hidden_input_tag->name = 'UPLOAD_IDENTIFIER'; $hidden_input_tag->value = $this->id . '_' . uniqid(); $hidden_input_tag->display(); parent::display(); echo ' '; $button_input_tag = new SwatHtmlTag('input'); $button_input_tag->type = 'submit'; $button_input_tag->id = $this->id . '_button'; $button_input_tag->class = 'pinhole-photo-uploader-submit-button'; $button_input_tag->value = $this->title; $button_input_tag->display(); $div_tag->close(); $progress_bar_div_tag = new SwatHtmlTag('div'); $progress_bar_div_tag->class = 'pinhole-photo-uploader-progress-bar'; $progress_bar_div_tag->open(); $this->progress_bar->display(); $progress_bar_div_tag->close(); $processing_div_tag = new SwatHtmlTag('div'); $processing_div_tag->id = $this->id . '_processing'; $processing_div_tag->class = 'pinhole-photo-uploader-processing'; $processing_div_tag->open(); echo Pinhole::_('Processing'); $processing_div_tag->close(); $form_tag->close(); Swat::displayInlineJavaScript($this->getInlineJavaScript()); }
protected function displayComments() { if ($this->post->comment_status != SiteCommentStatus::CLOSED) { Blorg::displayAd($this->app, 'post_comments'); $div_tag = new SwatHtmlTag('div'); $div_tag->id = 'comments'; $div_tag->class = 'entry-comments'; $div_tag->open(); $comments = $this->post->getVisibleComments(); $view = SiteViewFactory::get($this->app, 'post-comment'); $count = count($comments); if ($count > 0) { echo '<h3 class="comments-title">', Blorg::_('Comments'), '</h3>'; } // display message for locked comments if ($this->post->comment_status == SiteCommentStatus::LOCKED) { $div_tag = new SwatHtmlTag('div'); $div_tag->class = 'comments-locked-message'; $div_tag->setContent(Blorg::_('Comments are locked. No additional comments may be ' . 'posted.')); $div_tag->display(); } foreach ($comments as $i => $comment) { if ($i == $count - 1) { $div_tag = new SwatHtmlTag('div'); $div_tag->id = 'last_comment'; $div_tag->open(); $view->display($comment); $div_tag->close(); } else { $view->display($comment); } } $div_tag->close(); } }
protected function displayCloud(PinholeTagList $tag_list) { $sorted_tag_list = array(); foreach ($tag_list as $tag) { $sorted_tag_list[] = $tag; } usort($sorted_tag_list, array(&$this, 'sortTagsByTitle')); $max = null; $min = null; foreach ($tag_list as $tag) { $max = max($max, $tag->photo_count); $min = min($min, $tag->photo_count); } $div_tag = new SwatHtmlTag('div'); $div_tag->class = 'pinhole-tag-cloud'; $div_tag->open(); $span_tag = new SwatHtmlTag('span'); foreach ($sorted_tag_list as $tag) { $scale = ceil(($tag->photo_count - $min) / ($max - $min) * 200) + 100; $span_tag->style = sprintf('font-size: %s%%;', $scale); $span_tag->open(); $this->displayTag($tag); $span_tag->close(); echo ' '; } $div_tag->close(); }
protected function displayPosts() { $view = SiteViewFactory::get($this->app, 'post'); $view->setPartMode('extended_bodytext', SiteView::MODE_SUMMARY); $first = true; foreach ($this->posts as $post) { if ($first) { $first_div = new SwatHtmlTag('div'); $first_div->class = 'entry-first'; $first_div->open(); $view->display($post); $first_div->close(); $first = false; } else { $view->display($post); } } }
protected function displayHeader(BuildingBlock $block) { $parts = array(); ob_start(); $this->displaySummary($block); $summary = ob_get_clean(); if ($summary != '') { $parts[] = $summary; } ob_start(); $this->displayEditLink($block); $link = ob_get_clean(); if ($link != '') { $parts[] = $link; } ob_start(); $this->displayDeleteLink($block); $link = ob_get_clean(); if ($link != '') { $parts[] = $link; } if (count($parts) > 0) { $span = new SwatHtmlTag('span'); $span->class = 'building-block-admin-links'; $span->open(); foreach ($parts as $part) { echo $part; } $span->close(); } }
protected function displayContent() { $path = $this->app->config->blorg->path . 'tag'; $tags = $this->getTags(); if (count($tags) > 0) { $ul_tag = new SwatHtmlTag('ul'); if ($this->getValue('cloud_view')) { $ul_tag->class = 'blorg-tag-cloud'; } $ul_tag->open(); $max = 0; foreach ($tags as $tag) { if ($tag->post_count > $max) { $max = $tag->post_count; } } $locale = SwatI18NLocale::get(); foreach ($tags as $tag) { if ($tag->post_count > 0 || $this->getValue('show_empty')) { $popularity = $tag->post_count / $max; $li_tag = new SwatHtmlTag('li'); $li_tag->open(); $tag_span_tag = new SwatHtmlTag('span'); $tag_span_tag->class = $this->getTagClass($popularity); $tag_span_tag->open(); $anchor_tag = new SwatHtmlTag('a'); $anchor_tag->href = $path . '/' . $tag->shortname; $anchor_tag->setContent($tag->title); $anchor_tag->display(); if ($this->getValue('show_post_counts')) { echo ' '; $span_tag = new SwatHtmlTag('span'); $span_tag->setContent(sprintf(Blorg::ngettext('(%s post)', '(%s posts)', $tag->post_count), $locale->formatNumber($tag->post_count))); $span_tag->display(); } if ($this->getValue('show_feed_links')) { echo ' '; $span_tag = new SwatHtmlTag('span'); $span_tag->class = 'feed'; $span_tag->open(); echo '('; $anchor_tag = new SwatHtmlTag('a'); $anchor_tag->class = 'feed'; $anchor_tag->href = $path . '/' . $tag->shortname . '/feed'; $anchor_tag->setContent('Feed'); $anchor_tag->display(); echo ')'; $span_tag->close(); } $tag_span_tag->close(); // breaking space for inline list items in cloud view if ($this->getValue('cloud_view')) { echo ' '; } $li_tag->close(); } } $ul_tag->close(); } }
protected function displayFiles(BlorgPost $post) { if ($this->getMode('files') > SiteView::MODE_NONE) { $files = $post->getVisibleFiles(); if (count($files) > 0) { $link = $this->getLink('files'); echo '<ul class="attachments">'; foreach ($files as $file) { $li_tag = new SwatHtmlTag('li'); $li_tag->class = 'type-' . $file->mime_type; $li_tag->open(); if ($link === false) { $span_tag = new SwatHtmlTag('span'); $span_tag->setContent($file->getDescription()); $span_tag->display(); } else { $a_tag = new SwatHtmlTag('a'); $a_tag->href = $file->getRelativeUri($this->app->config->blorg->path, $this->path_prefix); $a_tag->setContent($file->getDescription()); $a_tag->display(); } echo ' ' . SwatString::byteFormat($file->filesize); $li_tag->close(); } echo '</ul>'; } } }