1: <?php
2: /**
3: * Defines the AJAX interface for Ansel.
4: *
5: * Copyright 2010-2012 Horde LLC (http://www.horde.org/)
6: *
7: * See the enclosed file COPYING for license information (GPL). If you
8: * did not receive this file, see http://www.horde.org/licenses/gpl.
9: *
10: * @author Michael J Rubinsky <mrubinsk@horde.org>
11: * @package Ansel
12: */
13: class Ansel_Ajax_Application extends Horde_Core_Ajax_Application
14: {
15: /**
16: * Determines if notification information is sent in response.
17: *
18: * @var boolean
19: */
20: public $notify = true;
21:
22: /**
23: * Obtain a gallery
24: *
25: * @return mixed False on failure, object representing the gallery with
26: * the following structure:
27: * @see Ansel_Gallery::toJson()
28: */
29: public function getGallery()
30: {
31: $id = $this->_vars->id;
32: try {
33: return $GLOBALS['injector']
34: ->getInstance('Ansel_Storage')
35: ->getGallery($id)
36: ->toJson(true);
37: } catch (Exception $e) {
38: Horde::logMessage($e, 'ERR');
39: return false;
40: }
41: }
42:
43: }
44: