/** * Initialize the renderer. This *must* be called before any attempt is made * to display or otherwise interact with the renderer. * */ public function init() { global $prefs, $conf, $registry, $page_output; $this->galleryId = $this->view->gallery->id; $this->gallerySlug = $this->view->gallery->get('slug'); $this->page = $this->view->page; // Number perpage from prefs or config if ($this->view->tilesperpage) { $this->perpage = $this->view->tilesperpage; } else { $this->perpage = min($prefs->getValue('tilesperpage'), $conf['thumbnail']['perpage']); } $this->pagestart = $this->page * $this->perpage + 1; // Fetch the children $this->fetchChildren($this->view->force_grouping); // Do we have an explicit style set from the API? // If not, use the gallery's if (!empty($this->view->style)) { $this->style = Ansel::getStyleDefinition($this->view->style); } else { $this->style = $this->view->gallery->getStyle(); } // Include any widgets if (!empty($this->style->widgets) && !$this->view->api) { // Special case widgets - these are built in if (array_key_exists('Actions', $this->style->widgets)) { // Don't show action widget if no actions if ($registry->getAuth() || !empty($conf['report_content']['driver']) && ($conf['report_content']['allow'] == 'authenticated' && $registry->isAuthenticated() || $conf['report_content']['allow'] == 'all')) { $this->view->addWidget(Ansel_Widget::factory('Actions')); } unset($this->style->widgets['Actions']); } // Gallery widgets always receive an array of image ids for // the current page. $ids = $this->getChildImageIds(); foreach ($this->style->widgets as $wname => $wparams) { $wparams = array_merge($wparams, array('images' => $ids)); $this->view->addWidget(Ansel_Widget::factory($wname, $wparams)); } } if (empty($this->view->api)) { $page_output->addScriptFile('views/common.js'); $page_output->addScriptFile('views/gallery.js'); $page_output->addScriptFile('popup.js', 'horde'); $strings = array('delete_conf' => _("Are you sure you want to delete the selected photos?"), 'choose_gallery_move' => _("You must choose a gallery to move photos to."), 'choose_images' => _("You must first choose photos.")); $urls = array('image_date' => strval(Horde::url('edit_dates.php')->add(array('gallery' => $this->galleryId)))); $js = array('Ansel = window.Ansel || {};', 'Ansel.galleryview_strings = ' . Horde_Serialize::serialize($strings, Horde_Serialize::JSON), 'Ansel.galleryview_urls = ' . Horde_Serialize::serialize($urls, Horde_Serialize::JSON), 'Ansel.has_edit = ' . $this->view->gallery->hasPermission($registry->getAuth(), Horde_Perms::EDIT) ? 1 : 0, 'Ansel.has_delete = ' . $this->view->gallery->hasPermission($registry->getAuth(), Horde_Perms::DELETE) ? 1 : 0); $page_output->addInlineScript($js, true); } // Perform any initialization of the subclasses. $this->_init(); }
/** * Create a new renderer. * * @see Ansel_View_Embedded * * @param array $params * * @return Ansel_View_EmbeddedRenderer The renderer object. */ public function __construct($params = array()) { parent::__construct($params); }