示例#1
0
 protected function buildSiteLinks()
 {
     $replicator = $this->ui->getWidget('site_link_field');
     foreach ($this->getDimensions() as $dimension) {
         if ($dimension->shortname == 'original') {
             $image = $this->photo->getTitle(true);
             $link = $this->photo->getUri('original');
         } else {
             $image = $this->photo->getImgTag($dimension->shortname);
             $image->src = $this->app->getFrontendBaseHref() . $image->src;
             $link = 'photo/' . $this->photo->id;
         }
         $code = sprintf('<a href="%s%s">%s</a>', $this->app->getFrontendBaseHref(), $link, $image);
         $replicator->getWidget('site_link_code', $dimension->id)->value = $code;
     }
 }
 protected function buildLayout()
 {
     $title = $this->photo->getTitle();
     if (isset($this->layout->navbar)) {
         if ($title == '') {
             $this->layout->navbar->createEntry(Pinhole::_('Photo'));
         } else {
             $this->layout->navbar->createEntry($title);
         }
     }
     // Set YUI Grid CSS class for one full-width column on details page.
     $this->layout->data->yui_grid_class = 'yui-t7';
     // Set photo title.
     if ($title != '') {
         $this->layout->data->html_title .= $title;
     }
     if (count($this->tag_list) > 0) {
         if ($title != '') {
             $this->layout->data->html_title .= ' (';
         }
         $this->layout->data->html_title .= $this->tag_list->getAsList();
         if ($title != '') {
             $this->layout->data->html_title .= ')';
         }
     }
     if ($this->photo->description != '') {
         $this->layout->data->meta_description .= ($this->layout->data->meta_description == '' ? '' : ' ') . strip_tags($this->photo->description);
     }
     if (count($this->photo->tags) != 0) {
         $tags = array();
         foreach ($this->photo->tags as $tag) {
             $tags[] = $tag->title;
         }
         $this->layout->data->meta_keywords .= ($this->layout->data->meta_keywords == '' ? '' : ' ') . implode(', ', $tags);
     }
 }
示例#3
0
 protected function buildNavBar()
 {
     parent::buildNavBar();
     $this->layout->navbar->createEntry($this->photo->getTitle(), 'Photo/Edit?id=' . $this->photo->id);
 }
示例#4
0
 protected function getEntry(PinholePhoto $photo)
 {
     $cache_key = sprintf('PinholeAtomPage.entry.%s.%s.%s.%s', (string) $this->tag_list, $photo->id, $this->dimension->shortname, $this->app->session->isLoggedIn() ? 'private' : 'public');
     $entry = $this->app->getCacheValue($cache_key, 'photos');
     if ($entry !== false) {
         return $entry;
     }
     $uri = sprintf('%sphoto/%s/%s', $this->getPinholeBaseHref(), $photo->id, $this->dimension->shortname);
     if (count($this->tag_list) > 0) {
         $uri .= '?' . $this->tag_list->__toString();
     }
     $entry = new XML_Atom_Entry($uri, $photo->getTitle(), $photo->publish_date);
     $this->app->addCacheValue($entry, $cache_key, 'photos');
     if ($photo->hasDimension($this->dimension->shortname)) {
         $dimension = $this->dimension;
     } else {
         $dimension = $photo->getClosestSelectableDimensionTo($this->dimension->shortname);
     }
     $entry->setContent($this->getPhotoContent($photo, $dimension), 'html');
     foreach ($photo->tags as $tag) {
         $entry->addCategory($tag->name, '', $tag->title);
     }
     //$entry->addAuthor($author_name, $author_uri, $author_email);
     $entry->addAuthor($this->app->config->site->title);
     $uri = sprintf('%sphoto/%s', $this->getPinholeBaseHref(), $photo->id);
     $entry->addLink($uri, 'alternate', 'text/html');
     // add enclosure
     $photo_uri = $photo->getUri($dimension->shortname);
     $link = new XML_Atom_Link($this->app->getBaseHref() . $photo_uri, 'enclosure', $photo->getMimeType($dimension->shortname));
     $link->setTitle($photo->getTitle());
     //$link->setLength();
     $entry->addLink($link);
     return $entry;
 }
 private function displaySinglePhoto(PinholePhoto $photo, $tag_list)
 {
     $a_tag = new SwatHtmlTag('a');
     $a_tag->href = sprintf('%sphoto/%s', $this->app->config->pinhole->path, $photo->id);
     if ($tag_list !== null) {
         $a_tag->href .= '?' . $tag_list;
     }
     $a_tag->open();
     echo $photo->getImgTag('small')->__toString();
     if ($photo->getTitle() != '') {
         $h2_tag = new SwatHtmlTag('div');
         $h2_tag->setContent($photo->getTitle());
         $h2_tag->display();
     }
     $a_tag->close();
 }