*/ /** * This implements the standard gallery theme * * @package GalleryTheme * @subpackage Theme */ class SiriuxTheme extends GalleryTheme { /** * Constructor */ function SiriuxTheme() { global $gallery; $this->setId('siriux'); $this->setName($gallery->i18n('Siriux')); $this->setDescription($gallery->i18n('Siriux.net Gallery theme')); $this->setVersion('1.1.0'); $this->setRequiredCoreApi(array(7, 0)); $this->setRequiredThemeApi(array(2, 2)); $this->setStandardSettings( array('perPage' => 9, 'contentWidth' => 700, 'albumBlocks' => serialize(array( array('comment.ViewComments', array()))), 'photoBlocks' => serialize(array( array('exif.ExifInfo', array()), array('comment.ViewComments', array()))), 'contentWidth' => 700, 'groupByYear' => 0, 'enableImageMap' => 1)); } /** * @see GalleryTheme::showAlbumPage */ function showAlbumPage(&$template, $item, $params, $childIds) { $ret = $this->loadCommonTemplateData( $template, $item, $params, array('owner', 'viewCount', 'childCount', 'descendentCount', 'parents', 'systemLinks', 'itemLinks', 'itemSummaries', 'permissions', 'thumbnails', 'pageNavigator', 'jumpRange'), $childIds); if ($ret) { return array($ret->wrap(__FILE__, __LINE__), null); } /* Override some navigator settings */ $theme =& $template->getVariableByReference('theme'); if (isset($theme['navigator']['first'])) { unset($theme['navigator']['first']); } if (isset($theme['navigator']['last'])) { unset($theme['navigator']['last']); } /* Find the thumbnail size for this album */ $theme['params']['thumbnailSize'] = 150; list ($ret, $preferences) = GalleryCoreApi::fetchDerivativePreferencesForItem($item->getId()); if ($ret) { return array($ret->wrap(__FILE__, __LINE__), null); } foreach ($preferences as $preference) { if ($preference['derivativeType'] == DERIVATIVE_TYPE_IMAGE_THUMBNAIL && preg_match('/thumbnail\|(\d+)/', $preference['derivativeOperations'], $matches)) { $theme['params']['thumbnailSize'] = $matches[1]; break; } } return array(null, 'theme.tpl'); } /** * @see GalleryTheme::showPhotoPage */ function showPhotoPage(&$template, $item, $params) { $ret = $this->loadCommonTemplateData($template, $item, $params, array('owner', 'parents', 'systemLinks', 'itemLinks', 'permissions', 'itemLinksDetailed', 'itemNavigator', 'imageViews')); if ($ret) { return array($ret->wrap(__FILE__, __LINE__), null); } /* Override some navigator settings */ $theme =& $template->getVariableByReference('theme'); if (isset($theme['navigator']['first'])) { unset($theme['navigator']['first']); } if (isset($theme['navigator']['last'])) { unset($theme['navigator']['last']); } return array(null, 'theme.tpl'); } /** * @see GalleryTheme::showModulePage */ function showModulePage(&$template, $item, $params, $templateFile) { $ret = $this->loadCommonTemplateData( $template, $item, $params, array('parents', 'systemLinks')); if ($ret) { return array($ret->wrap(__FILE__, __LINE__), null); } /* Add in our extra stuff */ $theme =& $template->getVariableByReference('theme'); $theme['moduleTemplate'] = $templateFile; /* Add our header and styles */ return array(null, 'theme.tpl'); } /** * @see GalleryTheme::showAdminPage */ function showAdminPage(&$template, $item, $params, $templateFile) { $ret = $this->loadCommonTemplateData( $template, $item, $params, array('parents', 'systemLinks')); if ($ret) { return array($ret->wrap(__FILE__, __LINE__), null); } /* Add in our extra stuff */ $theme =& $template->getVariableByReference('theme'); $theme['adminTemplate'] = $templateFile; return array(null, 'theme.tpl'); } /** * @see GalleryTheme::showErrorPage */ function showErrorPage(&$template) { return array(null, 'error.tpl'); } /** * @see GalleryTheme::showProgressBarPage */ function showProgressBarPage(&$template, $item, $params) { $ret = $this->loadCommonTemplateData( $template, $item, $params, array('parents', 'systemLinks')); if ($ret) { return array($ret->wrap(__FILE__, __LINE__), null); } return array(null, 'theme.tpl'); } /** * @see GalleryTheme::getSettings() */ function getSettings($itemId=null) { list ($ret, $settings, $params) = parent::getSettings($itemId); if ($ret) { return array($ret->wrap(__FILE__, __LINE__), null); } /* Add in our custom settings */ $settings[] = array('key' => 'contentWidth', 'name' => $this->translate('Width of page content in pixels'), 'type' => 'text-field', 'typeParams' => array('size' => 2), 'value' => $params['contentWidth']); $settings[] = array('key' => 'groupByYear', 'name' => $this->translate( 'Group sub-albums by year (album must be sorted by date!)'), 'type' => 'checkbox', 'value' => $params['groupByYear']); $settings[] = array('key' => 'enableImageMap', 'name' => $this->translate( 'Enable prev/next navigation by clicking in the left/right half of the image'), 'type' => 'checkbox', 'value' => $params['enableImageMap']); return array(null, $settings); } /** * @see GalleryTheme::validateSettings */ function validateSettings($settings) { $error = parent::validateSettings($settings); if (!is_numeric($settings['contentWidth'])) { $error['contentWidth'] = $this->translate('You must enter a number'); } return $error; } } ?>