-
Notifications
You must be signed in to change notification settings - Fork 4
/
view.php
57 lines (52 loc) · 1.87 KB
/
view.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
/**
* Delegates to the correct view.
*
* Copyright 2001-2017 Horde LLC (http://www.horde.org/)
*
* See the enclosed file LICENSE for license information (GPL). If you
* did not receive this file, see http://www.horde.org/licenses/gpl.
*
* @author Chuck Hagenbuch <[email protected]>
*/
require_once __DIR__ . '/lib/Application.php';
Horde_Registry::appInit('ansel');
$viewname = basename(Horde_Util::getFormData('view', 'Gallery'));
$view = 'Ansel_View_' . $viewname;
if (!class_exists($view)) {
throw new Ansel_Exception(sprintf("Could not load class definition of %s", $view));
}
/*
* All parameters get passed into the View via a $params array so we can
* pass the same parameters easily via API calls.
*/
$params['page'] = Horde_Util::getFormData('page', 0);
$params['sort'] = Horde_Util::getFormData('sort');
$params['sort_dir'] = Horde_Util::getFormData('sort_dir', 0);
$params['year'] = Horde_Util::getFormData('year', 0);
$params['month'] = Horde_Util::getFormData('month', 0);
$params['day'] = Horde_Util::getFormData('day', 0);
$params['view'] = $viewname;
$params['gallery_view'] = Horde_Util::getFormData('gallery_view');
$params['gallery_id'] = Horde_Util::getFormData('gallery');
$params['gallery_slug'] = Horde_Util::getFormData('slug');
$params['force_grouping'] = Horde_Util::getFormData('force_grouping');
$params['image_id'] = Horde_Util::getFormData('image');
try {
$view = new $view($params);
} catch (Horde_Exception $e) {
$page_output->header();
$notification->notify(array('listeners' => 'status'));
echo '<br /><em>' . htmlspecialchars($e->getMessage()) . '</em>';
$page_output->footer();
exit;
}
Ansel::initJSVariables();
$page_output->growler = true;
$page_output->header(array(
'title' => $view->getTitle(),
'ajax' => true,
));
$notification->notify(array('listeners' => 'status'));
echo $view->html();
$page_output->footer();