1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13:
14: class Ansel_View_GalleryRenderer_Gallery extends Ansel_View_GalleryRenderer_Base
15: {
16:
17: public function __construct($view)
18: {
19: parent::__construct($view);
20: $this->title = _("Standard Gallery");
21: }
22:
23: 24: 25: 26:
27: protected function _init()
28: {
29: }
30:
31: 32: 33: 34: 35:
36: public function html()
37: {
38: global $conf, $prefs, $registry;
39:
40: $galleryOwner = $this->view->gallery->get('owner');
41: $id = $this->view->gallery->getIdentity();
42: $owner = $id->getValue('fullname');
43: if (!$owner) {
44: $owner = $galleryOwner;
45: }
46:
47: if (empty($this->view->api)) {
48: $option_edit = $this->view->gallery->hasPermission(
49: $GLOBALS['registry']->getAuth(), Horde_Perms::EDIT);
50:
51: $option_select = $option_delete = $this->view->gallery->hasPermission(
52: $GLOBALS['registry']->getAuth(), Horde_Perms::DELETE);
53:
54: $option_move = ($option_delete && $GLOBALS['injector']
55: ->getInstance('Ansel_Storage')
56: ->countGalleries($GLOBALS['registry']->getAuth(), array('perm' => Horde_Perms::EDIT)));
57:
58: $option_copy = ($option_edit && $GLOBALS['injector']
59: ->getInstance('Ansel_Storage')
60: ->countGalleries($GLOBALS['registry']->getAuth(), array('perm' => Horde_Perms::EDIT)));
61:
62:
63: if (Horde_Util::getFormData('actionID', '') == 'show_actions') {
64: $prefs->setValue('show_actions', (int)!$prefs->getValue('show_actions'));
65: }
66: }
67:
68:
69: $date_params = Ansel::getDateParameter(
70: array('year' => !empty($this->view->year) ? $this->view->year : 0,
71: 'month' => !empty($this->view->month) ? $this->view->month : 0,
72: 'day' => !empty($this->view->day) ? $this->view->day : 0));
73:
74: $vars = Horde_Variables::getDefaultVariables();
75: if (!empty($this->view->page)) {
76: $vars->add('page', $this->view->page);
77: }
78: if (!empty($this->view->gallery_view_url)) {
79: $pagerurl = new Horde_Url(str_replace(array('%g', '%s'), array($this->galleryId, $this->gallerySlug), urldecode($this->view->gallery_view_url)));
80: $pagerurl->add($date_params);
81: } else {
82:
83:
84:
85: $pager_params = array_merge(
86: array('gallery' => $this->galleryId,
87: 'view' => 'Gallery',
88: 'slug' => $this->view->gallery->get('slug')),
89: $date_params);
90: $pagerurl = Ansel::getUrlfor('view', $pager_params, true);
91: }
92:
93:
94: $params = array(
95: 'num' => $this->numTiles,
96: 'url' => $pagerurl,
97: 'perpage' => $this->perpage,
98: 'url_callback' => empty($this->view->urlCallback) ? null : $this->view->urlCallback,
99: );
100: $pager = new Horde_Core_Ui_Pager('page', $vars, $params);
101:
102: Horde::startBuffer();
103: if (!empty($this->view->api)) {
104: $includes = $GLOBALS['injector']->createInstance('Horde_Script_Files');
105: $includes->add('prototype.js', 'horde', true, true);
106: $includes->includeFiles();
107: }
108:
109:
110: $tilesperrow = $prefs->getValue('tilesperrow');
111: $cellwidth = round(100 / $tilesperrow);
112: $count = 0;
113: $action_links = array();
114: $url = new Horde_Url('#');
115: if ($GLOBALS['conf']['gallery']['downloadzip'] && $registry->getAuth()) {
116: $action_links[] = $url->link(array('class' => 'widget', 'onclick.raw' => 'downloadSelected(); return false;')) . _("Download selected images") . '</a>';
117: }
118: if (!empty($option_edit)) {
119: $action_links[] = $url->link(array('class' => 'widget', 'onclick.raw' => 'editDates(); return false;')) . _("Edit Dates") . '</a>';
120: }
121: if (!empty($option_delete)) {
122: $action_links[] = $url->link(array('class' => 'widget', 'onclick.raw' => 'deleteSelected(); return false;')) . _("Delete") . '</a>';
123: }
124: if (!empty($option_move)) {
125: $action_links[] = $url->link(array('class' => 'widget', 'onclick.raw' =>'moveSelected(); return false;')) . _("Move") . '</a>';
126: }
127: if (!empty($option_copy)) {
128: $action_links[] = $url->link(array('class' => 'widget', 'onclick.raw' => 'copySelected(); return false;')) . _("Copy") . '</a>';
129: }
130: Horde::addScriptFile('popup.js', 'horde');
131: include ANSEL_TEMPLATES . '/view/gallery.inc';
132: return Horde::endBuffer();
133: }
134:
135: }
136: