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();
 }
Example #2
0
 protected function processActions(SwatTableView $view, SwatActions $actions)
 {
     $num = count($view->getSelection());
     $message = null;
     switch ($actions->selected->id) {
         case 'delete':
             $this->app->replacePage('MetaData/Delete');
             $this->app->getPage()->setItems($view->checked_items);
             break;
         case 'show_details':
             SwatDB::updateColumn($this->app->db, 'PinholeMetaData', 'boolean:visible', true, 'id', $view->getSelection());
             $message = new SwatMessage(sprintf(Pinhole::ngettext('One detail has been enabled.', '%s details have been enabled.', $num), SwatString::numberFormat($num)));
             break;
         case 'dont_show_details':
             SwatDB::updateColumn($this->app->db, 'PinholeMetaData', 'boolean:visible', false, 'id', $view->getSelection());
             $message = new SwatMessage(sprintf(Pinhole::ngettext('One detail has been disabled.', '%s details have been disabled.', $num), SwatString::numberFormat($num)));
             break;
         case 'show_machine':
             SwatDB::updateColumn($this->app->db, 'PinholeMetaData', 'boolean:machine_tag', true, 'id', $view->getSelection());
             $message = new SwatMessage(sprintf(Pinhole::ngettext('One machine tag has been enabled.', '%s machine tags have been enabled.', $num), SwatString::numberFormat($num)));
             break;
         case 'dont_show_machine':
             SwatDB::updateColumn($this->app->db, 'PinholeMetaData', 'boolean:machine_tag', false, 'id', $view->getSelection());
             $message = new SwatMessage(sprintf(Pinhole::ngettext('One machine tag has been disabled.', '%s machine tags have been disabled.', $num), SwatString::numberFormat($num)));
             break;
     }
     if ($message !== null) {
         $this->app->messages->add($message);
     }
 }
 /**
  * Gets the title of this tag
  *
  * @return string the title of this tag.
  */
 public function getTitle()
 {
     switch ($this->name) {
         case 'forsale':
             return $this->getValue() ? Pinhole::_('For sale') : Pinhole::_('Not for sale');
     }
 }
 public function process()
 {
     // initialize authentication
     $auth = new Sabre_HTTP_DigestAuth();
     $auth->setRealm($this->app->config->site->auth_realm);
     $auth->init();
     // authenticate and get correct user
     $email = $auth->getUsername();
     $class_name = SwatDBClassMap::get('PinholeAdminUser');
     $user = new $class_name();
     $user->setDatabase($this->app->db);
     if (!$user->loadFromEmail($email) || !$auth->validateA1($user->digest_ha1)) {
         $auth->requireLogin();
         echo Pinhole::_('Authentication required') . "\n";
         exit;
     }
     // create directory for account and object tree for dav server
     $root = new PinholeDavDirectory($this->app, $user);
     $tree = new Sabre_DAV_ObjectTree($root);
     // create server
     $server = new Sabre_DAV_Server($tree);
     $server->setBaseUri($this->getDavBaseUri());
     // don't save temp files in the database
     $tempFilePlugin = new Sabre_DAV_TemporaryFileFilterPlugin($this->getDataDir('dav/temp'));
     $server->addPlugin($tempFilePlugin);
     // set up lock plugin
     $lockBackend = new Sabre_DAV_Locks_Backend_FS($this->getDataDir('dav/locks'));
     $lockPlugin = new Sabre_DAV_Locks_Plugin($lockBackend);
     $server->addPlugin($lockPlugin);
     // also allow regular web browsing
     $browserPlugin = new Sabre_DAV_Browser_Plugin(false);
     $server->addPlugin($browserPlugin);
     // serve it up!
     $server->exec();
 }
Example #5
0
 private function initTag()
 {
     $class_name = SwatDBClassMap::get('PinholeTagDataObject');
     $this->tag = new $class_name();
     $this->tag->setDatabase($this->app->db);
     $this->tag->setInstance($this->app->getInstance());
     if (!$this->tag->load($this->id)) {
         throw new AdminNotFoundException(sprintf(Pinhole::_('Tag with id “%s” not found.'), $this->id));
     }
 }
 protected function displayTitle()
 {
     $list = $this->tag_list;
     if ($list->getGeoTaggedPhotoCount() == $list->getPhotoCount()) {
         $message = Pinhole::_('View all of these photos on a map.');
     } else {
         $locale = SwatI18NLocale::get();
         $message = sprintf(Pinhole::_('View %s of these photos on a map.'), $locale->formatNumber($list->getGeoTaggedPhotoCount()));
     }
     echo SwatString::minimizeEntities($message);
 }
Example #7
0
 protected function initInternal()
 {
     parent::initInternal();
     $this->ui->loadFromXML($this->ui_xml);
     $instance_id = $this->app->getInstanceId();
     // setup tag entry control
     $this->ui->getWidget('search_tags')->setApplication($this->app);
     $this->ui->getWidget('search_tags')->setAllTags();
     // setup status list
     $search_status_flydown = $this->ui->getWidget('search_status');
     $search_status_flydown->addOptionsByArray(array('published' => PinholePhoto::getStatusTitle(PinholePhoto::STATUS_PUBLISHED), 'hidden' => PinholePhoto::getStatusTitle(PinholePhoto::STATUS_UNPUBLISHED), 'private' => Pinhole::_('Private'), 'public' => Pinhole::_('Public'), 'for_sale' => Pinhole::_('For-Sale'), 'not_for_sale' => Pinhole::_('Not For-Sale')));
 }
 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('Photo/Comments?id=%s', $this->comment->photo->id);
     $anchor_tag->setContent($this->comment->photo->getTitle(true));
     printf(Pinhole::_('Comment on %s'), $anchor_tag);
     $this->displayStatusSpan();
     $header_div->close();
 }
Example #9
0
 /**
  * Gets the title of this page tag
  *
  * @return string the title of this page tag.
  */
 public function getTitle()
 {
     switch ($this->name) {
         case 'number':
             $title = sprintf(Pinhole::_('Page %s'), $this->value);
             break;
         default:
             $title = Pinhole::_('Unknown Page Tag');
             break;
     }
     return $title;
 }
Example #10
0
 /**
  * Gets the title of this search tag
  *
  * @return string the title of this search tag.
  */
 public function getTitle()
 {
     switch ($this->name) {
         case 'keywords':
             $title = sprintf(Pinhole::_('Keywords: “%s”'), $this->getValue());
             break;
         default:
             $title = Pinhole::_('Unknown Search Tag');
             break;
     }
     return $title;
 }
 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();
 }
Example #12
0
 public function buildInternal()
 {
     parent::buildInternal();
     $item_list = $this->getItemList('integer');
     $instance_id = $this->app->getInstanceId();
     $where_clause = sprintf('id in (%s) and instance %s %s', $item_list, SwatDB::equalityOperator($instance_id), $this->app->db->quote($instance_id, 'integer'));
     $dep = new AdminListDependency();
     $dep->setTitle(Pinhole::_('photographer'), Pinhole::_('photographers'));
     $dep->entries = AdminListDependency::queryEntries($this->app->db, 'PinholePhotographer', 'integer:id', null, 'text:fullname', 'fullname', $where_clause, AdminDependency::DELETE);
     $message = $this->ui->getWidget('confirmation_message');
     $message->content = $dep->getMessage();
     $message->content_type = 'text/xml';
 }
Example #13
0
 protected function saveDBData()
 {
     $values = $this->ui->getValues(array('fullname', 'description', 'status'));
     $this->photographer->fullname = $values['fullname'];
     $this->photographer->description = $values['description'];
     $this->photographer->status = $values['status'];
     $flush_cache = $this->photographer->isModified() && $this->photographer->id !== null;
     $this->photographer->save();
     if (isset($this->app->memcache) && $flush_cache) {
         $this->app->memcache->flushNs('photos');
     }
     $message = new SwatMessage(sprintf(Pinhole::_('“%s” has been saved.'), $this->photographer->fullname));
     $this->app->messages->add($message);
 }
Example #14
0
 /**
  * Processes photographer actions
  *
  * @param SwatTableView $view the table-view to get selected photographers
  *                             from.
  * @param SwatActions $actions the actions list widget.
  */
 protected function processActions(SwatTableView $view, SwatActions $actions)
 {
     switch ($actions->selected->id) {
         case 'delete':
             $this->app->replacePage('Photographer/Delete');
             $this->app->getPage()->setItems($view->checked_items);
             break;
         case 'status_action':
             $num = count($view->checked_items);
             $status = $this->ui->getWidget('status_flydown')->value;
             SwatDB::updateColumn($this->app->db, 'PinholePhotographer', 'integer:status', $status, 'id', $view->checked_items);
             $message = new SwatMessage(sprintf(Pinhole::ngettext('The status of one photographer has been changed.', 'The status of %s photographers has been changed.', $num), SwatString::numberFormat($num)));
             $this->app->messages->add($message);
             break;
     }
 }
Example #15
0
 protected function getResponse(PinholePhoto $photo)
 {
     $response = array();
     if ($photo->status === PinholePhoto::STATUS_PROCESSING_ERROR) {
         $response['status'] = 'error';
         $response['error_message'] = sprintf(Pinhole::_('Error processing file %s'), $photo->original_filename);
     } elseif ($photo->isProcessed()) {
         $response['status'] = 'processed';
         $response['auto_publish'] = $photo->auto_publish;
         $response['image_uri'] = $photo->getUri('thumb');
         $response['new_tags'] = $this->getNewTags($photo);
         $response['tile'] = $this->getTile($photo);
     } else {
         $response['status'] = 'unknown';
     }
     return $response;
 }
Example #16
0
 protected function saveDBData()
 {
     $values = $this->ui->getValues(array('title', 'visible', 'machine_tag'));
     $this->metadata->title = $values['title'];
     $this->metadata->visible = $values['visible'];
     $this->metadata->machine_tag = $values['machine_tag'];
     if ($this->metadata->id === null) {
         $this->metadata->shortname = $this->generateShortname($this->metadata->title);
     }
     $flush_cache = $this->metadata->isModified() && $this->metadata->id !== null;
     $this->metadata->save();
     if (isset($this->app->memcache) && $flush_cache) {
         $this->app->memcache->flushNs('photos');
     }
     $message = new SwatMessage(sprintf(Pinhole::_('“%s” has been saved.'), $this->metadata->title));
     $this->app->messages->add($message);
 }
Example #17
0
 protected function initPhoto()
 {
     $id = SiteApplication::initVar('id');
     $class_name = SwatDBClassMap::get('PinholePhoto');
     $this->photo = new $class_name();
     $this->photo->setDatabase($this->app->db);
     if ($id === null) {
         throw new AdminNoAccessException(Pinhole::_('A Photo id is required.'));
     } else {
         $instance_id = $this->app->getInstanceId();
         if (!$this->photo->load($id)) {
             throw new AdminNotFoundException(sprintf(Pinhole::_('Photo with id “%s” not found.'), $id));
         } elseif ($this->photo->image_set->instance !== null && $this->photo->image_set->instance->id != $instance_id) {
             throw new AdminNotFoundException(sprintf(Pinhole::_('Photo with id “%s” loaded ' . 'in the wrong instance.'), $id));
         }
     }
 }
Example #18
0
    protected function processDBData()
    {
        parent::processDBData();
        $tags = $this->ui->getWidget('dst_tag')->getSelectedTagArray();
        $dst_tag = new PinholeTagDataObject();
        $dst_tag->setDatabase($this->app->db);
        $dst_tag->loadByName(key($tags), $this->app->getInstance());
        // delete intersection tagged photos
        $sql = sprintf('delete from pinholephototagbinding where tag = %s
			and photo in (select photo from pinholephototagbinding
				where pinholephototagbinding.tag = %s)', $this->app->db->quote($this->source_tag->id, 'integer'), $this->app->db->quote($dst_tag->id, 'integer'));
        SwatDB::exec($this->app->db, $sql);
        // add source_tagged photos to dst_tagged photos
        $sql = sprintf('insert into pinholephototagbinding (photo, tag)
			select pinholephototagbinding.photo, %s
			from pinholephototagbinding where tag = %s', $this->app->db->quote($dst_tag->id, 'integer'), $this->app->db->quote($this->source_tag->id, 'integer'));
        SwatDB::exec($this->app->db, $sql);
        // delete source_tag
        $this->source_tag->delete();
        $this->app->messages->add(new SwatMessage(sprintf(Pinhole::_('“%s” has been merged into “%s”'), $this->source_tag->title, $dst_tag->title)));
    }
Example #19
0
 protected function buildInternal()
 {
     parent::buildInternal();
     if ($this->extended_selected) {
         $message = $this->ui->getWidget('confirmation_message');
         $message->content = Pinhole::_('Are you sure you want ' . 'to delete <strong>all tags</strong>?');
         $message->content_type = 'text/xml';
     } else {
         $item_list = $this->getItemList('integer');
         $instance_id = $this->app->getInstanceId();
         $where_clause = sprintf('id in (%s) and instance %s %s', $item_list, SwatDB::equalityOperator($instance_id), $this->app->db->quote($instance_id, 'integer'));
         $dep = new AdminListDependency();
         $dep->setTitle(Pinhole::_('tag'), Pinhole::_('tags'));
         $dep->entries = AdminListDependency::queryEntries($this->app->db, 'PinholeTag', 'integer:id', null, 'text:title', 'title', $where_clause, AdminDependency::DELETE);
         $message = $this->ui->getWidget('confirmation_message');
         $message->content = $dep->getMessage();
         $message->content_type = 'text/xml';
         if ($dep->getStatusLevelCount(AdminDependency::DELETE) == 0) {
             $this->switchToCancelButton();
         }
     }
 }
Example #20
0
 public function build()
 {
     parent::build();
     $config = $this->app->config;
     $this->layout->startCapture('content');
     if ($config->pinhole->google_maps_api_key === null) {
         echo Pinhole::_('You must specify a google maps api key ' . 'to use geo-tagging features.');
     } elseif ($config->pinhole->google_maps_admin_api_key === null) {
         echo Pinhole::_('You must specify an admin google maps api key ' . 'to use geo-tagging features.');
     } else {
         printf('<iframe src="%s/Search" frameborder="0" ' . 'id="search_iframe"></iframe>', $this->getComponentName());
         echo '<div id="map_frame">';
         echo '<form method="post" action="#">';
         printf('<input type="submit" id="set_gps" value="%s" />', Pinhole::_('Geo-Tag Photo(s)'));
         printf(' <input type="checkbox" id="auto_next" /> ' . '<label for="auto_next">%s</label>', Pinhole::_('Automatically proceed to next photo'));
         echo '</form>';
         echo '<div id="map"></div>';
         echo '</div>';
         echo Swat::displayInlineJavaScript($this->getInlineJavaScript());
     }
     $this->layout->endCapture();
 }
Example #21
0
 protected function buildInternal()
 {
     parent::buildInternal();
     if ($this->extended_selected) {
         // note the only page with an extended-selection that accesses this
         // is the pending photos page - so the message can be more
         // specific.
         $message = $this->ui->getWidget('confirmation_message');
         $message->content_type = 'text/xml';
         $message->content = Pinhole::_('<strong>Update the date/time/' . 'time-zone of all pending photos.</strong>');
     } else {
         $this->ui->getWidget('confirmation_frame')->classes[] = 'two-column';
         $container = $this->ui->getWidget('confirmation_container');
         $photo_view = $this->ui->getWidget('photo_view');
         $store = new SwatTableStore();
         foreach ($this->getPhotos() as $photo) {
             $ds = new SwatDetailsStore();
             $ds->photo = $photo;
             $store->add($ds);
         }
         $photo_view->model = $store;
         $message = $this->ui->getWidget('confirmation_message');
         $message->content_type = 'text/xml';
         $message->content = sprintf(Pinhole::_('<strong>Update the ' . 'date/time/time-zone of the following %s:</strong>'), Pinhole::ngettext('photo', 'photos', count($store)));
     }
 }
    protected function indexPhotos()
    {
        $spell_checker = new NateGoSearchPSpellSpellChecker('en_US', '', '', $this->getCustomWordList());
        $photo_indexer = new NateGoSearchIndexer('photo', $this->db);
        $photo_indexer->setSpellChecker($spell_checker);
        $photo_indexer->addTerm(new NateGoSearchTerm('title', 5));
        $photo_indexer->addTerm(new NateGoSearchTerm('tags', 2));
        $photo_indexer->addTerm(new NateGoSearchTerm('description'));
        $photo_indexer->setMaximumWordLength(32);
        $photo_indexer->addUnindexedWords(NateGoSearchIndexer::getDefaultUnindexedWords());
        $type = NateGoSearch::getDocumentType($this->db, 'photo');
        $sql = sprintf('select PinholePhoto.title, PinholePhoto.id,
				PinholePhoto.description, PinholePhoto.image_set
			from PinholePhoto
				inner join NateGoSearchQueue
					on PinholePhoto.id = NateGoSearchQueue.document_id
					and NateGoSearchQueue.document_type = %s
			order by PinholePhoto.id', $this->db->quote($type, 'integer'));
        $this->debug(Pinhole::_('Indexing photos ... ') . '   ');
        $photos = SwatDB::query($this->db, $sql, SwatDBClassMap::get('PinholePhotoWrapper'));
        $total = count($photos);
        $count = 0;
        $current_photo_id = null;
        foreach ($photos as $photo) {
            $ds = new SwatDetailsStore($photo);
            $ds->title = $photo->getTitle();
            $tags = '';
            foreach ($photo->tags as $tag) {
                $tags .= ' ' . $tag->title . ' ' . $tag->name;
            }
            $ds->tags = $tags;
            if ($count % 10 == 0) {
                $photo_indexer->commit();
                $this->debug(str_repeat(chr(8), 3));
                $this->debug(sprintf('%2d%%', $count / $total * 100));
            }
            $document = new NateGoSearchDocument($ds, 'id');
            $photo_indexer->index($document);
            $current_photo_id = $photo->id;
            $count++;
            $sql = sprintf('delete from NateGoSearchQueue where
				document_type = %s and document_id = %s', $this->db->quote($type, 'integer'), $this->db->quote($photo->id, 'integer'));
            SwatDB::exec($this->db, $sql);
        }
        if (count($photos) > 0 && isset($this->memcache)) {
            $this->memcache->flushNs('photos');
        }
        $this->debug(str_repeat(chr(8), 3) . Pinhole::_('done') . "\n");
        $photo_indexer->commit();
        unset($photo_indexer);
    }
 protected function getSuggestions()
 {
     return array(Pinhole::_('If you typed the URL, check to make sure it is spelled ' . 'correctly.'), Pinhole::_('You can <a href="tag">browse by tag</a> to find what ' . 'you\'re looking for.'));
 }
 /**
  * Creates all internal widgets required for this uploader
  */
 private function createEmbeddedWidgets()
 {
     if (!$this->widgets_created) {
         $this->progress_bar = new SwatProgressBar($this->id . '_progress_bar');
         $this->progress_bar->text = sprintf(Pinhole::_('%s%% complete'), '0');
         $this->widgets_created = true;
     }
 }
Example #25
0
 protected function displayAtomLink()
 {
     $feed_link_tag = new SwatHtmlTag('a');
     $feed_link_tag->class = 'feed';
     $feed_link_tag->title = Pinhole::_('Feed for this set of photos');
     $feed_link_tag->href = str_replace('tag', 'feed/' . $this->feed_dimension_shortname, $this->base);
     if (count($this->tag_list) > 0) {
         $feed_link_tag->href .= '?' . $this->tag_list->__toString();
     }
     $feed_link_tag->setContent(Pinhole::_('Feed'));
     $feed_link_tag->display();
 }
 protected function displayTag(PinholeTag $tag)
 {
     $add_list = clone $this->tag_list;
     $add_list->add($tag);
     $add_anchor_tag = new SwatHtmlTag('a');
     $add_anchor_tag->rel = 'tag';
     $add_anchor_tag->href = $this->app->config->pinhole->path . 'tag?' . $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();
 }
Example #27
0
 protected function buildInternal()
 {
     parent::buildInternal();
     if ($this->extended_selected) {
         // note the only page with an extended-selection that accesses this
         // is the pending photos page - so the message can be more
         // specific.
         $message = $this->ui->getWidget('confirmation_message');
         $message->content_type = 'text/xml';
         $message->content = Pinhole::_('<strong>Are you sure ' . 'you want to delete all pending photos?</strong>');
     } else {
         $container = $this->ui->getWidget('confirmation_container');
         $delete_view = $this->ui->getWidget('delete_view');
         $store = new SwatTableStore();
         foreach ($this->getPhotos() as $photo) {
             $ds = new SwatDetailsStore();
             $ds->photo = $photo;
             $store->add($ds);
         }
         $delete_view->model = $store;
         $message = $this->ui->getWidget('confirmation_message');
         $message->content_type = 'text/xml';
         $message->content = sprintf(Pinhole::_('<strong>Are you sure ' . 'you want to delete the following %s?</strong>'), Pinhole::ngettext('photo', 'photos', count($store)));
     }
 }
 protected function define()
 {
     $this->defineDefaultTitle(Pinhole::_('View Photos By Year'));
     $this->defineDescription(Pinhole::_('Displays a list of years photos were taken.'));
 }
 protected function displayNext(PinholePhoto $photo = null)
 {
     if ($photo === null) {
         $span_tag = new SwatHtmlTag('span');
         $span_tag->class = 'next';
         $span_tag->setContent(Pinhole::_('Next'));
         $span_tag->display();
     } else {
         $a_tag = new SwatHtmlTag('a');
         $href = $this->appendTagPath(sprintf('%sphoto/%s', $this->base, $photo->id));
         $a_tag->href = $href;
         $a_tag->title = $photo->title;
         $a_tag->class = 'next';
         $a_tag->setContent(Pinhole::_('Next'));
         $a_tag->display();
         $this->html_head_entry_set->addEntry(new SwatLinkHtmlHeadEntry($href, 'prefetch', null, null, Pinhole::PACKAGE_ID));
         $this->html_head_entry_set->addEntry(new SwatLinkHtmlHeadEntry($photo->getUri('large'), 'prefetch', null, null, Pinhole::PACKAGE_ID));
         $this->html_head_entry_set->addEntry(new SwatLinkHtmlHeadEntry($href, 'next', null, $photo->title, Pinhole::PACKAGE_ID));
     }
 }
Example #30
0
 /**
  * Gets the metadata for display
  *
  * @return SwatTableModel with metadata information.
  */
 protected function getTableModel(SwatView $view)
 {
     $metadata = $this->getMetaData();
     $store = new SwatTableStore();
     foreach ($metadata as $data) {
         $ds = new SwatDetailsView();
         $ds->title = $data->title;
         $ds->value = $data->value;
         $ds->id = $data->id;
         $ds->visible = $data->visible;
         $ds->machine_tag = $data->machine_tag;
         if ($ds->visible) {
             $ds->group_title = Pinhole::_('Shown');
         } else {
             $ds->group_title = Pinhole::_('Not Shown');
         }
         $store->add($ds);
     }
     return $store;
 }