/**
  * Guarda o borra las variables y sus valores en el proyecto
  *
  * Si se trata de variables web, también actualiza el control
  * de visibilidad de estas en las variables de entorno
  * del módulo correspondiente
  *
  * @return array Array template, values
  */
 public function EditAction()
 {
     if ($this->request['METHOD'] == 'POST') {
         $tipo = $this->request['tipo'];
         $ambito = $this->request['ambito'];
         $nombre = $this->request['nombre'];
         switch ($this->request['accion']) {
             case 'Guardar':
                 if ($this->values['permisos']['permisosModulo']['UP']) {
                     $this->ponValoresDefecto($ambito, $tipo, $nombre, $this->request['d']);
                     $variables = new CpanVariables($ambito, $tipo, $nombre);
                     $variables->setDatosYml($this->request['d']);
                     $variables->save();
                     $this->values['errores'] = $variables->getErrores();
                     if (count($this->values['errores']) == 0) {
                         $_SESSION['VARIABLES'][$tipo . $ambito] = $this->request['d'];
                     }
                     unset($variables);
                     return $this->indexAction($ambito, $tipo, $nombre);
                 } else {
                     return array('template' => '_global/forbiden.html.twig', 'values' => $this->values);
                 }
                 break;
             case 'Borrar':
                 if ($this->values['permisos']['permisosModulo']['DE']) {
                     $variables = new CpanVariables($ambito, $tipo, $nombre);
                     $variables->erase();
                     $this->values['errores'] = $variables->getErrores();
                     unset($variables);
                     return $this->indexAction($ambito, $tipo, $nombre);
                 } else {
                     return array('template' => '_global/forbiden.html.twig', 'values' => $this->values);
                 }
                 break;
         }
     } else {
         return array('template' => '_global/forbiden.html.twig', array());
     }
 }