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; }
/** * Gets a string representation of this machine tag * * The string representation is typically 'namespace.name=value'. * * @return string a string representation (tag string) of this machine tag. */ public function __toString() { return sprintf('%s.%s=%s', $this->getNamespace(), $this->getName(), PinholePhotoMetaDataBinding::escapeValue($this->getValue())); }