/** * The method to generate a plugin-style report XLS from an already * prepared statistics page OA_Admin_Statistics_Common object. */ function export() { // Prepare the report name // Get system navigation $oMenu = OA_Admin_Menu::singleton(); // Get section by pageId $oCurrentSection = $oMenu->get($this->oStatsController->pageId); if ($oCurrentSection == null) { phpAds_Die($GLOBALS['strErrorOccurred'], 'Menu system error: <strong>' . OA_Permission::getAccountType(true) . '::' . htmlspecialchars($ID) . '</strong> not found for the current user'); } // Get name $reportName = $oCurrentSection->getName(); $this->_name = $reportName; // Prepare the output writer for generation $reportFileName = 'Exported Statistics - ' . $reportName; if (!empty($this->oStatsController->aDates['day_begin'])) { $oStartDate = new Date($this->oStatsController->aDates['day_begin']); $reportFileName .= ' from ' . $oStartDate->format($GLOBALS['date_format']); } if (!empty($this->oStatsController->aDates['day_end'])) { $oEndDate = new Date($this->oStatsController->aDates['day_end']); $reportFileName .= ' to ' . $oEndDate->format($GLOBALS['date_format']); } $reportFileName .= '.xls'; $this->_oReportWriter->openWithFilename($reportFileName); // Get the header and data arrays from the same statistics controllers // that prepare stats for the user interface stats pages list($aHeaders, $aData) = $this->getHeadersAndDataFromStatsController(null, $this->oStatsController); // Add the worksheet $name = ucfirst($this->oStatsController->entity) . ' ' . ucfirst($this->oStatsController->breakdown); $this->createSubReport($reportName, $aHeaders, $aData); // Close the report writer and send the report to the user $this->_oReportWriter->closeAndSend(); }
public function startMVC() { $oRequest = new OX_Admin_UI_Controller_Request(); //setup controller $oController = $this->createController(); ob_start(); $oController->process($oRequest); $actionContent = ob_get_contents(); ob_end_clean(); //create view if ($oController->hasViewScript()) { $view = $this->createView($oController->getAction()); //pass model variables to view $oController->assignModelToView($view); } //LAYOUT // setup dummy installer section display $oMenu = OA_Admin_Menu::singleton(); $oMenu->add(new OA_Admin_Menu_Section('install', '', '')); if ($oController->hasLayout()) { //layout $oPageHeader = $oController->getModelProperty('pageHeader'); phpAds_PageHeader('install', $oPageHeader, $imgPath, false, true, false); } if ($view) { $view->display(); } echo $actionContent; if ($oController->hasLayout()) { phpAds_PageFooter($imgPath); // Do not remove. This is a marker that AJAX response parsers look for to // determine whether the response did not redirect to the installer. echo "<!-- install -->"; } }
function testSingleton() { //nimm 2 ;-) $menu1 =& OA_Admin_Menu::singleton(); $menu2 =& OA_Admin_Menu::singleton(); $this->assertReference($menu1, $menu2); $this->assertIdentical($menu1, $menu2); //add sth $section = $this->generateSection(); $menu1->add($section); $sections1 = $menu1->getRootSections(); $sections2 = $menu2->getRootSections(); $this->assertSectionListsEqual($sections1, $sections2); }
/** * Process input from user and creates/upgrades DB etc.... * * @param OA_Admin_UI_Component_Form $oForm * @param OX_Admin_UI_Install_Wizard $oWizard */ protected function processDatabaseAction($oForm, $oWizard) { $oUpgrader = $this->getUpgrader(); $upgraderSuccess = false; $aDbConfig = $oForm->populateDbConfig(); if ($oUpgrader->canUpgradeOrInstall()) { $installStatus = $oUpgrader->existing_installation_status; define('DISABLE_ALL_EMAILS', 1); OA_Permission::switchToSystemProcessUser('Installer'); if ($installStatus == OA_STATUS_NOT_INSTALLED) { if ($oUpgrader->install($aDbConfig)) { $message = $GLOBALS['strDBInstallSuccess']; $upgraderSuccess = true; } } else { if ($oUpgrader->upgrade($oUpgrader->package_file)) { // Timezone support - hack if ($oUpgrader->versionInitialSchema['tables_core'] < 538 && empty($aDbConfig['noTzAlert'])) { OA_Dal_ApplicationVariables::set('utc_update', OA::getNowUTC()); } // Clear the menu cache to built a new one with the new settings OA_Admin_Menu::_clearCache(OA_ACCOUNT_ADMIN); OA_Admin_Menu::_clearCache(OA_ACCOUNT_MANAGER); OA_Admin_Menu::_clearCache(OA_ACCOUNT_ADVERTISER); OA_Admin_Menu::_clearCache(OA_ACCOUNT_TRAFFICKER); OA_Admin_Menu::singleton(); $message = $GLOBALS['strDBUpgradeSuccess']; $upgraderSuccess = true; } } OA_Permission::switchToSystemProcessUser(); //get back to normal user previously logged in } else { if ($oUpgrader->existing_installation_status == OA_STATUS_CURRENT_VERSION) { $upgraderSuccess = true; //rare but can occur if DB has been installed and user revisits the screen } } $dbSuccess = $upgraderSuccess && !$oUpgrader->oLogger->errorExists; if ($dbSuccess) { //show success status OA_Admin_UI::getInstance()->queueMessage($message, 'global', 'info'); } else { //sth went wrong, display messages from upgrader $aMessages = OX_Admin_UI_Install_InstallUtils::getMessagesWithType($oUpgrader->getMessages()); $this->setModelProperty('aMessages', $aMessages); } return $dbSuccess; }
function _deleteCacheMenu() { $accountTypes = array(OA_ACCOUNT_ADMIN, OA_ACCOUNT_MANAGER, OA_ACCOUNT_ADVERTISER, OA_ACCOUNT_TRAFFICKER); foreach ($accountTypes as $accountType) { OA_Admin_Menu::singleton()->_clearCache($accountType); } }
/** * Method that returns the top level page of the page passed as parameter. * * @param string $sectionId The page that we want to know its parent page. * @return string A string with the parent page, it will be null if the page * doesn't have a parent page. */ function getTopLevelPage($sectionId = null) { $sectionId = OA_Admin_UI::getID($sectionId); $oMenu = OA_Admin_Menu::singleton(); $parentSections = $oMenu->getParentSections($sectionId); return count($parentSections) ? $parentSections[0]->link : ''; }
function getHeaderModel() { $builder = new OA_Admin_UI_Model_InventoryPageHeaderModelBuilder(); $oMenu = OA_Admin_Menu::singleton(); $oMenu->_setLinkParams($this->aPageParams); $oCurrentSection = $oMenu->get($this->pageId); $oHeader = new OA_Admin_UI_Model_PageHeaderModel($oCurrentSection->getName()); $oHeader->setIconClass('iconTargetingChannelsLarge'); foreach ($this->aPageBreadcrumbs as $v) { $headerMeta = $builder->getEntityHeaderMeta($v['type']); $oSegment = new OA_Admin_UI_Model_EntityBreadcrumbSegment(); $oSegment->setEntityName($v['name']); $oSegment->setEntityLabel($headerMeta['label']); $oSegment->setCssClass($headerMeta['class']); $oHeader->addSegment($oSegment); } return $oHeader; }
$activeNav[OA_UPGRADE_LOGIN] = '45'; } ksort($activeNav); // setup the nav to determine whether or not to show a valid link $navLinks = array(); foreach ($activeNav as $key => $val) { if ($val <= $activeNav[$action] && $action <= OA_UPGRADE_DBSETUP) { $navLinks[$key] = 'javascript: changePage(' . $key . ')'; } else { $navLinks[$key] = ''; } } // Setup array for navigation $aInstallerSections = array('10' => new OA_Admin_Menu_Section('10', 'Welcome', $navLinks[OA_UPGRADE_WELCOME], false, "qsg-install"), '20' => new OA_Admin_Menu_Section('20', 'Terms', $navLinks[OA_UPGRADE_TERMS], false, "qsg-install"), '25' => new OA_Admin_Menu_Section('25', 'Policy', $navLinks[OA_UPGRADE_POLICY], false, "qsg-install"), '30' => new OA_Admin_Menu_Section('30', 'System Check', $navLinks[OA_UPGRADE_SYSCHECK], false, "qsg-install"), '40' => new OA_Admin_Menu_Section('40', 'Application Check', $navLinks[OA_UPGRADE_APPCHECK], false, "qsg-install"), '45' => new OA_Admin_Menu_Section('45', 'Login', $navLinks[OA_UPGRADE_LOGIN], false, "qsg-install"), '50' => new OA_Admin_Menu_Section('50', 'Database', $navLinks[OA_UPGRADE_DBSETUP], false, "qsg-install"), '60' => new OA_Admin_Menu_Section('60', 'Configuration', $navLinks[OA_UPGRADE_CONFIGSETUP], false, "qsg-install"), '70' => new OA_Admin_Menu_Section('70', 'Admin', $navLinks[OA_UPGRADE_ADMINSETUP], false, "qsg-install"), '80' => new OA_Admin_Menu_Section('80', 'Plugins', $navLinks[OA_UPGRADE_PLUGINS], false, "qsg-install"), '90' => new OA_Admin_Menu_Section('90', 'Tasks', $navLinks[OA_UPGRADE_POST], false, "qsg-install"), '100' => new OA_Admin_Menu_Section('100', 'Finished', '')); // setup which sections to display $oMenu = OA_Admin_Menu::singleton(); //since we display installer nav as horizontal tabs we need to add two fake levels above $firstLevelNavID = 'l1' . $activeNav[$action]; $secondLevelNavID = 'l2' . $activeNav[$action]; $oMenu->add(new OA_Admin_Menu_Section($firstLevelNavID, '', '')); $oMenu->addTo($firstLevelNavID, new OA_Admin_Menu_Section($secondLevelNavID, '', '')); //$currentSectionID = $firstLevelNavID; $currentSectionID = $secondLevelNavID; foreach ($activeNav as $val) { if (!array_key_exists($val, $oMenu->aAllSections)) { $oMenu->addTo($secondLevelNavID, $aInstallerSections[$val]); // $oMenu->addTo($firstLevelNavID, $aInstallerSections[$val]); } } // display header and navigation, with proper 'active page' marked using $activeNav[$action] phpAds_PageHeader($activeNav[$action], new OA_Admin_UI_Model_PageHeaderModel(), $imgPath, false, true, false);