*/ /** * Print photos on fotokasten.de * * @package Fotokasten */ class FotokastenModule extends GalleryModule { function FotokastenModule() { global $gallery; $this->setId('fotokasten'); $this->setName($gallery->i18n('Fotokasten')); $this->setDescription($gallery->i18n('Fotokasten Photo Printing Module')); $this->setVersion('1.0.4'); $this->setGroup('commerce', $this->translate('Commerce')); $this->setCallbacks('getSiteAdminViews|getItemLinks'); $this->setRequiredCoreApi(array(7, 0)); $this->setRequiredModuleApi(array(3, 0)); } /** * @see GalleryModule::upgrade() */ function upgrade($currentVersion) { global $gallery; list ($ret, $params) = GalleryCoreApi::fetchAllPluginParameters('module', 'fotokasten'); if ($ret) { return $ret->wrap(__FILE__, __LINE__); } foreach (array('affiliateId' => '1927', 'affiliateIdPass' => 'f12a65d90445f95b90e5fd30c75ee74e') as $key => $value) { if (!isset($params[$key])) { $ret = $this->setParameter($key, $value); if ($ret) { return $ret->wrap(__FILE__, __LINE__); } } } if (!isset($currentVersion)) { list ($ret, $coreParams) = GalleryCoreApi::fetchAllPluginParameters('module', 'core'); if ($ret) { return $ret->wrap(__FILE__, __LINE__); } /* Register our permission */ $ret = GalleryCoreApi::registerPermission($this->getId(), 'fotokasten.print', $gallery->i18n('[fotokasten] Print')); if ($ret) { return $ret->wrap(__FILE__, __LINE__); } /* Give everybody print permission by default */ $ret = GalleryCoreApi::addGroupPermission( $coreParams['id.rootAlbum'], $coreParams['id.everybodyGroup'], 'fotokasten.print', true); if ($ret) { return $ret->wrap(__FILE__, __LINE__); } } return null; } /** * @see GalleryModule::performFactoryRegistrations() */ function performFactoryRegistrations() { $ret = GalleryCoreApi::registerFactoryImplementation( 'CartPluginInterface_1_0', 'FotokastenCartPlugin', 'fotokasten', 'modules/fotokasten/classes/FotokastenCartPlugin.class', 'fotokasten', null); if ($ret) { return $ret->wrap(__FILE__, __LINE__); } return null; } /** * @see GalleryModule::getSiteAdminViews() */ function getSiteAdminViews() { return array(null, array(array('name' => $this->translate('Fotokasten'), 'view' => 'fotokasten.FotokastenSiteAdmin'))); } /** * @see GalleryModule::getItemLinks() */ function getItemLinks($items, $wantsDetailedLinks, $permissions) { $links = array(); foreach ($items as $item) { $itemId = $item->getId(); if (isset($wantsDetailedLinks[$itemId]) && isset($permissions[$itemId]['fotokasten.print']) && GalleryUtilities::isA($item, 'GalleryPhotoItem')) { $links[$itemId][] = array('text' => $this->translate('Print on Fotokasten.de'), 'params' => array('controller' => 'fotokasten.PrintPhotos', 'itemId' => $itemId, 'return' => 1)); } } return array(null, $links); } } ?>