1<?php
2/*
3 * Gallery - a web based photo album viewer and editor
4 * Copyright (C) 2000-2008 Bharat Mediratta
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or (at
9 * your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA  02110-1301, USA.
19 */
20
21/**
22 * Standard gallery theme
23 * @package Themes
24 * @subpackage Matrix
25 * @author Bharat Mediratta <bharat@menalto.com>
26 * @version $Revision: 18172 $
27 */
28class MatrixTheme extends GalleryTheme {
29
30    function MatrixTheme() {
31	global $gallery;
32
33	$this->setId('matrix');
34	$this->setName($gallery->i18n('Matrix'));
35	$this->setDescription($gallery->i18n('Standard Gallery2 look and feel'));
36	$this->setVersion('1.1.6');
37	$this->setRequiredCoreApi(array(7, 20));
38	$this->setRequiredThemeApi(array(2, 4));
39	$this->setStandardSettings(
40	    array('rows' => 3, 'columns' => 3,
41		  'showImageOwner' => 0, 'showAlbumOwner' => 1,
42		  'albumFrame' => '', 'itemFrame' => '', 'photoFrame' => '',
43		  'colorpack' => '', 'showMicroThumbs' => 0, 'dynamicLinks' => 'browse',
44		  'sidebarBlocks' => serialize(array(
45			array('search.SearchBlock', array('showAdvancedLink' => true)),
46			array('core.ItemLinks', array('useDropdown' => false)),
47			array('core.PeerList', array()),
48			array('imageblock.ImageBlock', array()))),
49		  'albumBlocks' => serialize(array(
50			array('comment.ViewComments', array()))),
51		  'photoBlocks' => serialize(array(
52			array('exif.ExifInfo', array()),
53			array('comment.ViewComments', array())))));
54    }
55
56    /**
57     * @see GalleryTheme::showAlbumPage
58     */
59    function showAlbumPage(&$template, $item, $params, $childIds) {
60	$ret = $this->loadCommonTemplateData(
61	    $template, $item, $params,
62	    array('owner', 'viewCount', 'childCount', 'descendentCount', 'parents',
63		  'systemLinks', 'itemLinks', 'itemSummaries', 'permissions',
64		  'thumbnails', 'pageNavigator', 'jumpRange'),
65	     $childIds);
66	if ($ret) {
67	    return array($ret, null);
68	}
69
70	/* Add in our extra stuff */
71	$theme =& $template->getVariableByReference('theme');
72	$theme['columnWidthPct'] = floor(100 / $params['columns']);
73
74	/* Add our header and styles */
75	return array(null, 'theme.tpl');
76    }
77
78    /**
79     * @see GalleryTheme::showPhotoPage
80     */
81    function showPhotoPage(&$template, $item, $params) {
82	$dataTypes = array('owner', 'parents', 'systemLinks', 'itemLinks', 'permissions',
83			   'itemLinksDetailed', 'itemNavigator', 'imageViews');
84	if (!empty($params['showMicroThumbs'])) {
85	    $dataTypes[] = 'navThumbnails';
86	}
87	$ret = $this->loadCommonTemplateData($template, $item, $params, $dataTypes);
88	if ($ret) {
89	    return array($ret, null);
90	}
91
92	return array(null, 'theme.tpl');
93    }
94
95    /**
96     * @see GalleryTheme::showModulePage
97     */
98    function showModulePage(&$template, $item, $params, $templateFile) {
99	$ret = $this->loadCommonTemplateData(
100	    $template, $item, $params, array('parents', 'systemLinks'));
101	if ($ret) {
102	    return array($ret, null);
103	}
104
105	return array(null, 'theme.tpl');
106    }
107
108    /**
109     * @see GalleryTheme::showAdminPage
110     */
111    function showAdminPage(&$template, $item, $params, $templateFile) {
112	$ret = $this->loadCommonTemplateData(
113	    $template, $item, $params, array('parents', 'systemLinks'));
114	if ($ret) {
115	    return array($ret, null);
116	}
117
118	return array(null, 'theme.tpl');
119    }
120
121    /**
122     * @see GalleryTheme::showErrorPage
123     */
124    function showErrorPage(&$template) {
125	return array(null, 'error.tpl');
126    }
127
128    /**
129     * @see GalleryTheme::showProgressBarPage
130     */
131    function showProgressBarPage(&$template, $item, $params) {
132	$ret = $this->loadCommonTemplateData(
133	    $template, $item, $params, array('parents', 'systemLinks'));
134	if ($ret) {
135	    return array($ret, null);
136	}
137
138	return array(null, 'theme.tpl');
139    }
140}
141?>
142