Example #1
0
 public function executeUpdateSystemParameters(sfWebRequest $request)
 {
     $this->forward404Unless($request->isMethod(sfRequest::POST));
     //If the HTTP method is "post", get the values entered by the user:
     $this->values = array('ip_address' => $this->getRequestParameter('ip_address'), 'srv_port' => $this->getRequestParameter('srv_port'), 'dbms' => $this->getRequestParameter('dbms') + 1, 'db_name' => $this->getRequestParameter('db_name'), 'db_user_name' => $this->getRequestParameter('db_user_name'), 'db_password' => $this->getRequestParameter('db_password'), '_csrf_token' => $this->getRequestParameter('_csrf_token'));
     //Build the form with theses values:
     $this->form = new SystemParametersForm($this->values);
     //Execute the validators of this form:
     $this->form->bind($this->values);
     //If everything is fine:
     if ($this->form->isValid()) {
         //Insert the new values in the xml configuration file:
         ParametersConfiguration::setUserPrefix(sfContext::getInstance()->getUser()->getAttribute('login'));
         ParametersConfiguration::setAll($this->values);
         //Indicate to the template that the values are correct and have been updated:
         $request->setAttribute('update_system', true);
     }
     $this->forward('configuration', 'parameters');
 }