public function html() { global $registry; $view = $GLOBALS['injector']->createInstance('Horde_View'); $view->addTemplatePath(ANSEL_TEMPLATES . '/widgets'); $view->owner = $this->_view->gallery->get('owner'); $view->userfeedurl = Ansel::getUrlFor('rss_user', array('owner' => $view->owner)); $view->slug = $this->_view->gallery->get('slug'); $view->galleryname = $this->_view->gallery->get('name'); $view->galleryfeedurl = Ansel::getUrlFor('rss_gallery', array('gallery' => $this->_view->gallery->id, 'slug' => $view->slug)); $view->title = _("Links"); /* Embed html */ if (empty($this->_view->_params['image_id'])) { /* Gallery view */ $params = array('count' => 10); if (!empty($slug)) { $params['gallery_slug'] = $slug; } else { $params['gallery_id'] = $this->_view->gallery->id; } } else { // This is an image view $params = array('thumbsize' => 'screen', 'images' => $this->_view->_params['image_id'], 'count' => 10); } $view->embed = Ansel::embedCode($params); return $view->render('links'); }
/** */ protected function _content() { try { $gallery = $this->_getGallery(); } catch (Ansel_Exception $e) { return $e->getMessage(); } $params = array('gallery_id' => $gallery->id, 'count' => $this->_params['perpage']); if (!empty($this->_params['use_lightbox'])) { $params['lightbox'] = true; } $html = Ansel::embedCode($params); // Be nice to people with <noscript> $viewurl = Ansel::getUrlFor('view', array('view' => 'Gallery', 'gallery' => $gallery->id, 'slug' => $gallery->get('slug')), true); $html .= '<noscript>'; $html .= $viewurl->link(array('title' => sprintf(_("View %s"), $gallery->get('name')))); if ($iid = $gallery->getKeyImage(Ansel::getStyleDefinition('ansel_default')) && $gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::READ)) { $html .= '<img src="' . Ansel::getImageUrl($gallery->getKeyImage(Ansel::getStyleDefinition('ansel_default')), 'thumb', true) . '" alt="' . htmlspecialchars($gallery->get('name')) . '" />'; } else { $html .= Horde::img('thumb-error.png'); } return $html . '</a></noscript>'; }