*/ /** * @package AlbumSelect * @subpackage UserInterface */ class AlbumSelectSiteAdminController extends GalleryController { /** * @see GalleryController::handleRequest */ function handleRequest($form) { $ret = GalleryCoreApi::assertUserIsSiteAdministrator(); if ($ret) { return array($ret->wrap(__FILE__, __LINE__), null); } $status = $error = array(); if (isset($form['action']['save'])) { foreach (array('sort', 'treeLines', 'treeIcons', 'treeCookies', 'treeExpandCollapse', 'treeCloseSameLevel') as $key) { $ret = GalleryCoreApi::setPluginParameter('module', 'albumselect', $key, ($key == 'sort') ? $form['sort'] : ((isset($form[$key]) && $form[$key]) ? 1 : 0)); if ($ret) { return array($ret->wrap(__FILE__, __LINE__), null); } } $status['saved'] = 1; /* Flush our cache */ GalleryDataCache::removeFromDisk( array('type' => 'module-data', 'module' => 'albumselect')); } $results = array('redirect' => array('view' => 'core.SiteAdmin', 'subView' => 'albumselect.AlbumSelectSiteAdmin'), 'status' => $status, 'error' => $error); return array(null, $results); } } /** * @package AlbumSelect * @subpackage UserInterface */ class AlbumSelectSiteAdminView extends GalleryView { /** * @see GalleryView::loadTemplate */ function loadTemplate(&$template, &$form) { $ret = GalleryCoreApi::assertUserIsSiteAdministrator(); if ($ret) { return array($ret->wrap(__FILE__, __LINE__), null); } foreach (array('sort', 'treeLines', 'treeIcons', 'treeCookies', 'treeExpandCollapse', 'treeCloseSameLevel') as $key) { if (!isset($form[$key])) { $form[$key] = false; } } if ($form['formName'] != 'AlbumSelectSiteAdmin') { $form['formName'] = 'AlbumSelectSiteAdmin'; list ($ret, $params) = GalleryCoreApi::fetchAllPluginParameters('module', 'albumselect'); if ($ret) { return array($ret->wrap(__FILE__, __LINE__), null); } foreach ($params as $key => $value) { $form[$key] = $value; } } $template->setVariable('controller', 'albumselect.AlbumSelectSiteAdmin'); return array(null, array('body' => 'modules/albumselect/templates/AlbumSelectSiteAdmin.tpl')); } } ?>