Perforce Chronicle 2012.2/486814
API Documentation
|
Handles configuration of the Analytics module. More...
Public Member Functions | |
indexAction () | |
Show form, persist into module config (fetch module, set config) |
Handles configuration of the Analytics module.
Analytics_ConfigureController::indexAction | ( | ) |
Show form, persist into module config (fetch module, set config)
{ $module = P4Cms_Module::fetch('Analytics'); $form = new Analytics_Form_Configure(); $this->view->form = $form; // if request, save; if error, show; if not, show form $request = $this->getRequest(); if ($request->isPost()) { $unvalidatedValues = $request->getPost(); if ($form->isValid($unvalidatedValues)) { $values = $form->getValues(); // save configuration $module->saveConfig( new Zend_Config( array( 'accountNumber' => $values['accountNumber'], 'customVars' => $values['customVars'] ) ) ); P4Cms_Notifications::add('Analytics configuration stored.'); $this->redirector->gotoSimple('index', 'module', 'site'); } else { P4Cms_Notifications::add( 'Invalid value entered for Analytics module configuration.', 'error' ); $form->populate($unvalidatedValues); } } else { $config = $module->getConfig(); $values = $config->toArray(); $form->populate($values); } }