$this->_params = $params;
}
+ public function __get($property)
+ {
+ if (isset($this->_params[$property])) {
+ return $this->_params[$property];
+ }
+
+ // @TODO: For now return null until we can ensure we have default values for
+ // properties requested from other classes.
+ return null;
+ //throw new Horde_Exception(sprintf("The property %s of Ansel_View not found.", $property));
+ }
+
public function &getGallery($galleryId = null, $slug = '')
{
if (is_null($galleryId) && empty($slug)) {
$this->galleryId = $this->view->gallery->id;
$this->gallerySlug = $this->view->gallery->get('slug');
- if (isset($this->view->_params['page'])) {
- $this->page = $this->view->_params['page'];
- }
+ $this->page = $this->view->page;
/* Number perpage from prefs or config */
$this->perpage = min($prefs->getValue('tilesperpage'),
$this->pagestart = ($this->page * $this->perpage) + 1;
/* Fetch the children */
- $this->fetchChildren($this->view->_params['force_grouping']);
+ $this->fetchChildren($this->view->force_grouping);
/* Do we have an explicit style set? If not, use the gallery's */
- if (!empty($this->view->_params['style'])) {
- $this->style = Ansel::getStyleDefinition($this->view->_params['style']);
+ if (!empty($this->view->style)) {
+ $this->style = Ansel::getStyleDefinition($this->view->style);
} else {
$this->style = $this->view->gallery->getStyle();
}
PERMS_SHOW,
$this->page * $this->perpage,
$this->perpage,
- !empty($this->view->_params['force_grouping']));
+ !empty($this->view->force_grouping));
/* The last tile number to display on the current page */
$this->pageend = min($this->numTiles, $this->pagestart + $this->perpage - 1);
}
/* Only need these if not being called via the api */
- if (empty($this->view->_params['api'])) {
+ if (empty($this->view->api)) {
$option_edit = $this->view->gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT);
$option_select = $option_delete = $this->view->gallery->hasPermission(Horde_Auth::getAuth(), PERMS_DELETE);
$option_move = ($option_delete && $GLOBALS['ansel_storage']->countGalleries(PERMS_EDIT));
/* Set up the pager */
$date_params = Ansel::getDateParameter(
- array('year' => isset($this->view->_params['year']) ? $this->view->_params['year'] : 0,
- 'month' => isset($this->view->_params['month']) ? $this->view->_params['month'] : 0,
- 'day' => isset($this->view->_params['day']) ? $this->view->_params['day'] : 0));
+ array('year' => !empty($this->view->year) ? $this->view->year : 0,
+ 'month' => !empty($this->view->month) ? $this->view->month : 0,
+ 'day' => !empty($this->view->day) ? $this->view->day : 0));
$vars = Horde_Variables::getDefaultVariables();
- if (!empty($this->view->_params['page'])) {
- $vars->add('page', $this->view->_params['page']);
+ if (!empty($this->view->page)) {
+ $vars->add('page', $this->view->page);
}
- if (!empty($this->view->_params['gallery_view_url'])) {
- $pagerurl = str_replace(array('%g', '%s'), array($this->galleryId, $this->gallerySlug), urldecode($this->view->_params['gallery_view_url']));
+ if (!empty($this->view->gallery_view_url)) {
+ $pagerurl = str_replace(array('%g', '%s'), array($this->galleryId, $this->gallerySlug), urldecode($this->view->gallery_view_url));
$pagerurl = Horde_Util::addParameter($pagerurl, $date_params);
} else {
/*
}
/* See what callback to use to tweak the pager urls */
- if (!empty($this->view->_params['urlCallback'])) {
- $callback = $this->view->_params['urlCallback'];
+ if (!empty($this->view->urlCallback)) {
+ $callback = $this->view->urlCallback;
} else {
$callback = null;
}
// Note that we can't use Horde_Util::bufferOutput() here since the include
// file would be included inside that method's scope, and not this one.
ob_start();
- if (!empty($this->view->_params['api'])) {
+ if (!empty($this->view->api)) {
$includes = new Horde_Script_Files();
$includes->disableAutoloadHordeJS();
$includes->_add('prototype.js', 'horde', true, true);
*/
protected function _init()
{
- if (empty($this->view->_params['image_onclick'])) {
- $this->view->_params['image_onclick'] = 'return lb.start(%i);';
+ if (empty($this->view->image_onclick)) {
+ $this->view->image_onclick = 'return lb.start(%i);';
}
// Attach the script and CSS files here if we aren't being called via the api
- if (empty($this->view->_params['api'])) {
+ if (empty($this->view->api)) {
Ansel::attachStylesheet('lightbox.css');
Horde::addScriptFile('effects.js', 'horde', true);
Horde::addScriptFile('lightbox.js', 'ansel', true);
/* Get JSON data for view */
// 0 == normal, 1 == by date
if ($this->mode == 0) {
- $json = $this->view->json(null, !empty($this->view->_params['api']));
+ $json = $this->view->json(null, !empty($this->view->api));
} else {
if (!empty($this->date['day']) && $this->numTiles) {
- $json = $this->view->json(null, !empty($this->view->_params['api']));
+ $json = $this->view->json(null, !empty($this->view->api));
} else {
$json = '[]';
}
}
/* Don't bother if we are being called from the api */
- if (empty($this->view->_params['api'])) {
+ if (empty($this->view->api)) {
$option_edit = $this->view->gallery->hasPermission(Horde_Auth::getAuth(),
PERMS_EDIT);
$option_select = $option_delete = $this->view->gallery->hasPermission(
/* Set up the pager */
$date_params = Ansel::getDateParameter(
- array('year' => isset($this->view->_params['year']) ? $this->view->_params['year'] : 0,
- 'month' => isset($this->view->_params['month']) ? $this->view->_params['month'] : 0,
- 'day' => isset($this->view->_params['day']) ? $this->view->_params['day'] : 0));
+ array('year' => !empty($this->view->year) ? $this->view->year : 0,
+ 'month' => !empty($this->view->month) ? $this->view->month : 0,
+ 'day' => !empty($this->view->day) ? $this->view->day : 0));
$vars = Horde_Variables::getDefaultVariables();
- if (!empty($this->view->_params['page'])) {
- $vars->add('page', $this->view->_params['page']);
- $page = $this->view->_params['page'];
+ if (!empty($this->view->page)) {
+ $vars->add('page', $this->view->page);
+ $page = $this->view->page;
} else {
$page = 0;
}
- if (!empty($this->view->_params['gallery_view_url'])) {
- $pagerurl = str_replace(array('%g', '%s'), array($this->galleryId, $this->gallerySlug), urldecode($this->view->_params['gallery_view_url']));
+ if (!empty($this->view->gallery_view_url)) {
+ $pagerurl = str_replace(array('%g', '%s'), array($this->galleryId, $this->gallerySlug), urldecode($this->view->gallery_view_url));
$pagerurl = Horde_Util::addParameter($pagerurl, $date_params, null, false);
} else {
/*
$pagerurl = Ansel::getUrlfor('view', $pager_params, true);
}
- if (!empty($this->view->_params['urlCallback'])) {
- $callback = $this->view->_params['urlCallback'];
+ if (!empty($this->view->urlCallback)) {
+ $callback = $this->view->urlCallback;
} else {
$callback = null;
}
$jsvars['gallery_url'] = $pagerurl . '&';
}
/* Output js/css here if we are calling via the api */
- if (!empty($this->view->_params['api'])) {
+ if (!empty($this->view->api)) {
Ansel::attachStylesheet('lightbox.css', true);
$includes = new Horde_Script_Files();
$includes->disableAutoloadHordeJS();