<?php global $gContent; require_once ENERGYMEASURES_PKG_PATH . 'BitEnergyMeasures.php'; require_once LIBERTY_PKG_PATH . 'lookup_content_inc.php'; // if we already have a gContent, we assume someone else created it for us, and has properly loaded everything up. if (empty($gContent) || !is_object($gContent) || !$gContent->isValid()) { // if energymeasure_id supplied, use that if (@BitBase::verifyId($_REQUEST['energymeasure_id'])) { $gContent = new BitEnergyMeasures($_REQUEST['energymeasure_id']); // if content_id supplied, use that } elseif (@BitBase::verifyId($_REQUEST['content_id'])) { $gContent = new BitEnergyMeasures(NULL, $_REQUEST['content_id']); } elseif (@BitBase::verifyId($_REQUEST['energymeasures']['energymeasure_id'])) { $gContent = new BitEnergyMeasures($_REQUEST['energymeasures']['energymeasure_id']); // otherwise create new object } else { $gContent = new BitEnergyMeasures(); } $gContent->load(); $gBitSmarty->assign_by_ref("gContent", $gContent); }
$formHash['submit_mult'] = 'remove_energymeasures_data'; foreach ($_REQUEST["checked"] as $del) { $tmpPage = new BitEnergyMeasures($del); if ($tmpPage->load() && !empty($tmpPage->mInfo['title'])) { $info = $tmpPage->mInfo['title']; } else { $info = $del; } $formHash['input'][] = '<input type="hidden" name="checked[]" value="' . $del . '"/>' . $info; } $gBitSystem->confirmDialog($formHash, array('warning' => tra('Are you sure you want to delete ') . count($_REQUEST["checked"]) . ' energymeasures records?', 'error' => tra('This cannot be undone!'))); } else { foreach ($_REQUEST["checked"] as $deleteId) { $tmpPage = new BitEnergyMeasures($deleteId); if (!$tmpPage->load() || !$tmpPage->expunge()) { array_merge($errors, array_values($tmpPage->mErrors)); } } if (!empty($errors)) { $gBitSmarty->assign_by_ref('errors', $errors); } } } // Create new energymeasures object $energymeasures = new BitEnergyMeasures(); $energymeasuresList = $energymeasures->getList($_REQUEST); $gBitSmarty->assign_by_ref('energymeasuresList', $energymeasuresList); // getList() has now placed all the pagination information in $_REQUEST['listInfo'] $gBitSmarty->assign_by_ref('listInfo', $_REQUEST['listInfo']); // Display the template $gBitSystem->display('bitpackage:energymeasures/list_energymeasures.tpl', tra('EnergyMeasures'), array('display_mode' => 'list'));
<?php // $Header$ require_once ENERGYMEASURES_PKG_PATH . 'BitEnergyMeasures.php'; $formEnergyMeasuresLists = array("energymeasures_list_energymeasure_id" => array('label' => 'Id', 'note' => 'Display the energymeasures id.'), "energymeasures_list_title" => array('label' => 'Title', 'note' => 'Display the title.'), "energymeasures_list_description" => array('label' => 'Description', 'note' => 'Display the description.'), "energymeasures_list_data" => array('label' => 'Text', 'note' => 'Display the text.')); $gBitSmarty->assign('formEnergyMeasuresLists', $formEnergyMeasuresLists); // Process package preferences if (!empty($_REQUEST['energymeasures_settings'])) { $energymeasuresToggles = array_merge($formEnergyMeasuresLists); foreach ($energymeasuresToggles as $item => $data) { simple_set_toggle($item, ENERGYMEASURES_PKG_NAME); } } // Process javascript re-cache if (!empty($_REQUEST['energymeasures_refresh_js'])) { $em = new BitEnergyMeasures(); $em->writeListJS(); } // Check if game is registered and we have custom settings require_once GAMES_PKG_PATH . 'BitGameSystem.php'; $gameSystem = new BitGameSystem(); $infoFile = ENERGYMEASURES_PKG_PATH . "games.yaml"; $gamesArray = $gameSystem->parseInfoFile($infoFile); // this sucks but I dont feel like writing the loop right now $gameDefaults = $gamesArray[0]; $game = array_merge($gameDefaults, $gameSystem->getGameType('switch')); // Process game settings if (!empty($_REQUEST['game_settings'])) { $gameData = array_merge($game, $_REQUEST['games']['switch']); if ($gameSystem->registerGameType($gameData)) { $game = $gameData;