示例#1
0
    include "../bin/yaml/lib/sfYaml.php";
} else {
    echo "NO EXISTE LA CLASE PARA LEER ARCHIVOS YAML";
    exit;
}
// ---------------------------------------------------------------
// CARGO LOS PARAMETROS DE CONFIGURACION.
// ---------------------------------------------------------------
$config = sfYaml::load('../config/config.yml');
$app = $config['config']['app'];
// ---------------------------------------------------------------
// ACTIVAR EL AUTOLOADER DE CLASES Y FICHEROS A INCLUIR
// ---------------------------------------------------------------
define("APP_PATH", $_SERVER['DOCUMENT_ROOT'] . $app['path'] . "/");
include_once "../" . $app['framework'] . "Autoloader.class.php";
Autoloader::setCacheFilePath(APP_PATH . 'tmp/class_path_cache.txt');
Autoloader::excludeFolderNamesMatchingRegex('/^CVS|\\..*$/');
Autoloader::setClassPaths(array('../' . $app['framework'], '../entities/', '../lib/'));
spl_autoload_register(array('Autoloader', 'loadClass'));
$valores = explode("_", $_GET['entidadColumnaPropiedad']);
$modulo = $valores[0];
$columna = $valores[1];
$propiedad = $valores[2];
$var = new CpanVariables('Mod', 'Env', $modulo);
$atributosColumna = $var->getColumn($columna);
$atributosColumna[$propiedad] = $_GET['valor'];
$var->setColumn($columna, $atributosColumna);
$var->save();
unset($var);
$tag = "";
echo $tag;
 /**
  * Edita las variables de entorno de un nodo
  *
  * @return array Array template, values
  */
 public function EditNodeAction()
 {
     if ($_SESSION['usuarioPortal']['IdPerfil'] == '1') {
         switch ($this->request['METHOD']) {
             case 'GET':
                 $tipo = $this->request['3'];
                 $ambito = $this->request['2'];
                 $nombre = $this->request['4'];
                 $columna = $this->request['5'];
                 $titulo = "Variables {$this->request['3']} de '{$columna}'";
                 $variables = new CpanVariables($ambito, $tipo, $nombre);
                 $variablesColumna = $variables->getColumn($columna);
                 unset($variables);
                 $archivoConfig = new Form($nombre);
                 $columnasConfig = $archivoConfig->getNode('columns');
                 unset($archivoConfig);
                 $datos = $this->ponAtributos($variablesColumna, $columnasConfig[$columna]);
                 $this->values['titulo'] = $titulo;
                 $this->values['tipo'] = $tipo;
                 $this->values['ambito'] = $ambito;
                 $this->values['nombre'] = $nombre;
                 $this->values['columna'] = $columna;
                 $this->values['d'] = $datos;
                 $template = $this->entity . '/formPlantillaVariables.html.twig';
                 break;
             case 'POST':
                 $tipo = $this->request['tipo'];
                 $ambito = $this->request['ambito'];
                 $nombre = $this->request['nombre'];
                 $columna = $this->request['columna'];
                 $titulo = "Variables {$tipo} de '{$columna}'";
                 $variables = new CpanVariables($ambito, $tipo, $nombre);
                 $variables->setColumn($columna, $this->request['d']);
                 $variables->save();
                 $this->values['titulo'] = $titulo;
                 $this->values['tipo'] = $tipo;
                 $this->values['ambito'] = $ambito;
                 $this->values['nombre'] = $nombre;
                 $this->values['columna'] = $columna;
                 $this->values['errores'] = $variables->getErrores();
                 $archivoConfig = new Form($nombre);
                 $columnasConfig = $archivoConfig->getNode('columns');
                 unset($archivoConfig);
                 $datos = $this->ponAtributos($variables->getColumn($columna), $columnasConfig[$columna]);
                 $this->values['d'] = $datos;
                 unset($variables);
                 $template = $this->entity . '/formPlantillaVariables.html.twig';
                 break;
         }
     } else {
         $template = '_global/forbiden.html.twig';
     }
     return array('template' => $template, 'values' => $this->values);
 }