/** * @return array */ public function getSettings() { $vl = $this->_main->getValidator(); $this->_settings = $this->getDefaultSettings(); $theme = $vl->getVariable('theme', 'value'); $middletext = $vl->getVariable('middletext', 'value'); $hidetime = $vl->getVariable('hidetime', 'value'); $merge = $vl->getVariable('merge', 'value'); $advanced = $vl->getVariable('advanced', 'value'); $quotes = $vl->getVariable('spoiler', 'value'); if ($theme != "" && isset($this->_themes[$theme])) { $this->_settings['theme'] = $theme; } if ($middletext != "") { $this->_settings['middle_text'] = $middletext; } if ($hidetime != '1') { $this->_settings['hide_time'] = false; } if ($merge != '1') { $this->_settings['merge_fleets'] = false; } if ($advanced == '1') { $this->_settings['advanced_summary'] = true; } if ($quotes == '1') { $this->_settings['harvest_spoiler'] = true; } $this->_settings['lang'] = $this->_main->getLang(); return $this->_settings; }
/** * @param Main $main */ public function execute($main) { $crService = new Default_Service_CombatReport($main); if ($main->getValidator()->isValid() && $main->getValidator()->isValidated()) { try { $settings = $crService->getSettings(); $report = $crService->getReport(); $renderer = $crService->getRenderer($settings, $report); $renderedReport = $renderer->renderReport(); $renderedTitle = $renderer->renderTitle(); $renderedPreview = Default_Renderer_Helper::parseBBCode($renderedReport); $main->getStore()->set('result-content', $renderedReport); $main->getStore()->set('result-title', $renderedTitle); $main->getStore()->set('result-preview', $renderedPreview); } catch (Exception $e) { //Debug::arr( $e ); $main->addInfo(new Info($main->getDict()->getVal('Bad Cr'), Info::ERROR)); $main->getStore()->set('error', true); } } }