| // +---------------------------------------------------------------------------+ // $Id: AdminPlanetMgr.php,v 1.2 2005/04/17 02:15:02 demian Exp $ require_once 'DB/DataObject.php'; /** * Manage planet links * * @package planet * @author Alexander J. Tarahchanowicz II */ class AdminPlanetMgr extends PlanetMgr { function PlanetMgr() { SGL::logMessage(null, PEAR_LOG_DEBUG); parent::PlanetMgr(); $this->pageTitle = 'Admin Planet Manager'; $this->template = 'planetList.html'; $this->_aActionsMapping = array( 'add' => array('add'), 'insert' => array('insert', 'redirectToDefault'), 'list' => array('list'), ); } function validate($req, &$input) { SGL::logMessage(null, PEAR_LOG_DEBUG); $this->validated = true; $input->error = array(); $input->pageTitle = $this->pageTitle; $input->masterTemplate = $this->masterTemplate; $input->template = $this->template; $input->action = ($req->get('action')) ? $req->get('action') : 'list'; $input->aDelete = $req->get('frmDelete'); $input->submitted = $req->get('submitted'); $input->planet = (object)$req->get('planet'); $input->planetId = $req->get('frmPlanetID'); // if errors have occured if (isset($aErrors) && count($aErrors)) { SGL::raiseMsg('Please fill in the indicated fields'); $input->error = $aErrors; $this->validated = false; } } function display(&$output) { if ($this->conf['PlanetMgr']['showUntranslated'] == false) { $c = &SGL_Config::singleton(); $c->set('debug', array('showUntranslated' => false)); } } function _cmd_add(&$input, &$output) { SGL::logMessage(null, PEAR_LOG_DEBUG); $output->template = 'planetEdit.html'; $output->pageTitle = 'Admin Planet Manager :: Add'; $output->action = 'insert'; $output->wysiwyg = true; } function _cmd_insert(&$input, &$output) { SGL::logMessage(null, PEAR_LOG_DEBUG); $planet = DB_DataObject::factory($this->conf['table']['planet']); $planet->setFrom($input->planet); $planet->planet_id = $this->dbh->nextId($this->conf['table']['planet']); $success = $planet->insert(); if ($success !== false) { SGL::raiseMsg('planet insert successfull', false, SGL_MESSAGE_INFO); } else { SGL::raiseError('planet insert NOT successfull', SGL_ERROR_NOAFFECTEDROWS); } } function _cmd_list(&$input, &$output) { SGL::logMessage(null, PEAR_LOG_DEBUG); $output->template = 'planetList.html'; $output->pageTitle = 'Admin Planet Manager :: List'; // only execute if CRUD option selected if (false) { $query = " SELECT 0, 1 FROM {$this->conf['table']['planet']} "; $limit = $_SESSION['aPrefs']['resPerPage']; $pagerOptions = array( 'mode' => 'Sliding', 'delta' => 3, 'perPage' => $limit, ); $aPagedData = SGL_DB::getPagedData($this->dbh, $query, $pagerOptions); if (PEAR::isError($aPagedData)) { return false; } $output->aPagedData = $aPagedData; $output->totalItems = $aPagedData['totalItems']; if (is_array($aPagedData['data']) && count($aPagedData['data'])) { $output->pager = ($aPagedData['totalItems'] <= $limit) ? false : true; } } } } ?>