示例#1
0
 /**
  * Renders the form for editing.
  *
  * @param Horde_Form_Renderer $renderer  A renderer instance, optional
  *                                       since Horde 3.2.
  * @param Variables $vars                A Variables instance, optional
  *                                       since Horde 3.2.
  * @param string $action                 The form action (url).
  * @param string $method                 The form method, usually either
  *                                       'get' or 'post'.
  * @param string $enctype                The form encoding type. Determined
  *                                       automatically if null.
  * @param boolean $focus                 Focus the first form field?
  */
 public function renderActive($renderer, $vars, $action, $method = 'get', $enctype = null, $focus = true)
 {
     if ($vars->get('old_datatype') === null) {
         $this->_addParameters($vars);
     }
     parent::renderActive($renderer, $vars, $action, $method, $enctype, $focus);
 }
示例#2
0
 public function showNav($ctrl)
 {
     if ($this->limit == 'all') {
         return '';
     }
     $links = 7;
     $start = $this->page - $links > 0 ? $this->page - $links : 1;
     $end = $this->page + $links < $this->num_pages ? $this->page + $links : $this->num_pages;
     $html = '<ul class="pagination pagination-sm">';
     if ($this->page == 1) {
         $class = 'disabled';
         $noClick = '" onclick="return false';
     } else {
         $class = '';
         $noClick = '';
     }
     $html .= '<li class="' . $class . '"><a href="' . Variables::urlAllNews($ctrl) . '&limit=' . $this->limit . '&page=' . ($this->page - 1) . $noClick . '">&laquo;</a></li>';
     if ($start > 1) {
         $html .= '<li><a href="' . Variables::urlAllNews($ctrl) . '&page=1">1</a></li>';
         $html .= '<li class="disabled"><span>...</span></li>';
     }
     for ($i = $start; $i <= $end; $i++) {
         $class = $this->page == $i ? "active" : "";
         $html .= '<li class="' . $class . '"><a href="' . Variables::urlAllNews($ctrl) . '&page=' . $i . '">' . $i . '</a></li>';
     }
     if ($end < $this->num_pages) {
         $html .= '<li class="disabled"><span>...</span></li>';
         $html .= '<li><a href="' . Variables::urlAllNews($ctrl) . '&page=' . $this->num_pages . '">' . $this->num_pages . '</a></li>';
     }
     if ($this->page == $this->num_pages) {
         $class = 'disabled';
         $noClick = '" onclick="return false';
     } else {
         $class = '';
         $noClick = '';
     }
     $html .= '<li class="' . $class . '"><a href="' . Variables::urlAllNews($ctrl) . '&limit=' . $this->limit . '&page=' . ($this->page + 1) . $noClick . '">&raquo;</a></li>';
     $html .= '</ul>';
     return $html;
 }
 /**
  * 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 Variables($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 Variables($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);
 }
示例#4
0
 * Date: 24.07.15
 * Time: 12:32
 */
if (isset($_POST['val'])) {
    class Variables
    {
        public static $data;
    }
    register_shutdown_function(function () {
        $response = ['content' => ob_get_contents()];
        $variables = [];
        foreach (Variables::$data as $k => $v) {
            if (in_array($k, ['_SERVER', '_POST', '_FILES', '_ENV', '_GET', '_COOKIE', '_REQUEST']) === false) {
                ob_clean();
                var_dump($v);
                $variables[] = "<b>" . $k . "</b>" . ob_get_contents();
            }
        }
        ob_clean();
        $response['variables'] = implode("<br>", $variables);
        echo json_encode($response);
    });
    ob_start();
    eval($_POST['val']);
    Variables::$data = get_defined_vars();
    $fr = fopen(getcwd() . '/code.log', 'a+');
    fwrite($fr, date('Y-m-d H:i:s') . "\n" . $_POST['val'] . "\n ------------ \n");
    fclose($fr);
} else {
    throw new Exception('Welcome in WebAIS laboratory');
}
示例#5
0
 private function addTerms(&$node, $postId)
 {
     $terms = array();
     $this->getWpTermsStatement->execute(array(':post_id' => $postId));
     $result = $this->getWpTermsStatement->fetchAll(PDO::FETCH_ASSOC);
     foreach ($result as $row) {
         $terms[] = $row['name'];
     }
     $node->taxonomy['tags'][Variables::getVariable('vocab_id')] = implode(',', $terms);
 }
示例#6
0
 public function createLink($ctrl)
 {
     return ['addNews' => Variables::urlAddNews($ctrl), 'allNews' => Variables::urlAllNews($ctrl), 'delNews' => Variables::urlDelNews($ctrl)];
 }
示例#7
0
            }
        }
    }
}
/* Check if a form is being edited. */
if (!isset($vars->mode) || $vars->retry) {
    if (isset($vars->alias)) {
        $alias = $vars->alias;
        try {
            $addrInfo = $vilma->driver->getAddressInfo($alias, 'alias');
            $address = $vilma->driver->getAddressInfo($addrInfo['destination']);
        } catch (Exception $e) {
            $notification->push(sprintf(_("Error reading address information from backend: %s"), $e->getMessage()), 'horde.error');
            Horde::url('users/index.php', true)->redirect();
        }
        $vars = new Variables($address);
        $vars->mode = 'edit';
        $vars->add('alias_address', $alias);
        $vars->add('alias', $alias);
        $vars->add('address', $address['address']);
    } elseif (isset($vars->address)) {
        try {
            $address = $vilma->driver->getAddressInfo($vars->address, 'all');
        } catch (Exception $e) {
            $notification->push(sprintf(_("Error reading address information from backend: %s"), $e->getMessage()), 'horde.error');
            Horde::url('users/index.php', true)->redirect();
        }
        $vars = new Variables($address);
        $vars->mode = 'new';
    }
    $form = new Vilma_Form_EditAlias($vars);
示例#8
0
文件: Task.php 项目: netresearch/kite
 /**
  * Generate name if it doesn't exist
  *
  * @param mixed $offset The name of the variable
  *
  * @return mixed
  */
 public function &offsetGet($offset)
 {
     if ($offset === 'name' && !parent::offsetGet('name')) {
         parent::offsetSet('name', spl_object_hash($this));
     }
     return parent::offsetGet($offset);
 }
示例#9
0
    asort($out);
    return $out;
}
/* Set up VFS. */
require_once HORDE_LIBS . 'VFS.php';
$vfs_type = $conf['vfs']['type'];
$vfs_args = Horde::getDriverConfig('vfs', $vfs_type);
$vfs_args['user'] = Auth::getAuth();
$vfs =& VFS::singleton($vfs_type, $vfs_args);
@define('TEMPLATES_VFS_PATH', '.horde_templates');
/* Require Horde_Form libs. */
require_once HORDE_LIBS . 'Horde/Form.php';
require_once HORDE_LIBS . 'Horde/Form/Renderer.php';
require_once HORDE_LIBS . 'Horde/Form/Action.php';
/* Set up Horde_Form. */
$vars =& Variables::getDefaultVariables();
$form =& Horde_Form::singleton('TemplatesForm', $vars);
$action =& Horde_Form_Action::factory('submit');
/* Set up form fields. */
$apps = _setValuesToKeys($registry->listApps());
$select_app =& $form->addVariable(_("Application"), 'app', 'enum', true, false, null, array($apps));
$select_app->setAction($action);
$form->addHidden('', 'old_app', 'text', false, false);
/* Set up some variables. */
$formname = $vars->get('formname');
$app = $vars->get('app');
$old_app = $vars->get('old_app');
$template_path = $vars->get('template_path');
$template_orig = $vars->get('template_orig');
$old_template_orig = $vars->get('old_template_orig');
$has_changed = false;
示例#10
0
 /**
  * Returns the values from a single column of the array, identified by the column_key.
  * Optionally, you may provide an index_key to index the values in the returned array by the values from the
  * index_key column in the input array.
  * @param string $columnKey
  * @param string|null $indexKey
  * @return Variables
  */
 public function column($columnKey, $indexKey = null)
 {
     $value = array_column($this->value(), $columnKey, $indexKey);
     return Variables::from($value);
 }
示例#11
0
 /**
  * Generates a blockquote.
  *
  * @param string $content     the blockquote content
  * @param string $citeContent the content of the citation (optional) - this should typically
  *                            include the wildtag '{source}' to embed the cite source
  * @param string $citeTitle   the cite source title (optional)
  * @param string $citeSource  the cite source (optional)
  * @param array  $options     html options for the blockquote
  *
  * Example(s):
  * ~~~
  * echo Html::blockquote(
  *      'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.',
  *      'Someone famous in {source}',
  *      'International Premier League',
  *      'IPL'
  * );
  * ~~~
  *
  * @param array  $options     html options for the blockquote
  *
  * @see http://getbootstrap.com/css/#type-blockquotes
  *
  * @return string
  */
 public static function blockquote($content, $citeContent = '', $citeTitle = '', $citeSource = '', $options = [])
 {
     $content = static::tag('p', $content);
     if (!Variables::isEmpty($citeContent)) {
         $source = static::tag('cite', $citeSource, ['title' => $citeTitle]);
         $content .= "\n<small>" . str_replace('{source}', $source, $citeContent) . "</small>";
     }
     return static::tag('blockquote', $content, $options);
 }
示例#12
0
 public static function urlAllNews($ctrl = 'News')
 {
     return Variables::Host() . "/index.php?ctrl=" . $ctrl . "&act=All";
 }
示例#13
0
文件: setup.php 项目: Artea/freebeer
 function appConfig($is_config_ok)
 {
     if ($is_config_ok) {
         $run_config = $this->cli->prompt(_("All the installed applications seem to be configured, reconfigure any app?"), array('y' => _("Yes"), 'n' => _("No")));
         if ($run_config == 'n') {
             return true;
         }
     }
     global $registry;
     $applist = $registry->listApps(array('hidden', 'notoolbar', 'active'));
     sort($applist);
     $apps = array(0 => _("All applications"));
     foreach ($applist as $app) {
         if (@file_exists($registry->getParam('fileroot', $app) . '/config/conf.xml')) {
             array_push($apps, $app);
         }
     }
     $apps = $apps + array('x' => 'exit');
     $app_choice = $this->cli->prompt(_("Which app do you wish to reconfigure?"), $apps);
     if ($app_choice == 'x') {
         return true;
     }
     if ($app_choice > 0) {
         $apps = array($apps[$app_choice]);
     } else {
         $apps = array_slice($apps, 1, count($apps) - 2);
     }
     $vars = Variables::getDefaultVariables();
     foreach ($apps as $app) {
         $config =& new Horde_Config($app);
         $php = $config->generatePHPConfig($vars);
         $fp = @fopen($registry->getParam('fileroot', $app) . '/config/conf.php', 'w');
         if ($fp) {
             fwrite($fp, String::convertCharset($php, NLS::getCharset(), 'iso-8859-1'));
             fclose($fp);
             $this->log(sprintf(_("Wrote configuration file '%s'."), $registry->getParam('fileroot', $app) . '/config/conf.php'), 'success');
         } else {
             $this->log(sprintf(_("Can not write configuration file '%s'."), $registry->getParam('fileroot', $app) . '/config/conf.php'), 'error');
         }
     }
 }
示例#14
0
 /**
  * Pone las variables de entorno del proyecto/app/modulo en curso
  * relativas al control de visibilidad de sus variables web
  *
  * Respeta los valores que hubiera en el yml del proyecto respecto
  * a las variables web definidas.
  *
  * @return void
  */
 private function ponVisibilidad()
 {
     $variables = new Variables($this->_objeto['ambito'], 'Env', $this->_objeto['nombre']);
     $valoresActuales = $variables->getNode('showVarWeb');
     $valores['globales'] = array();
     $valores['especificas'] = array();
     if (is_array($this->_objeto['datos']['globales'])) {
         foreach ($this->_objeto['datos']['globales'] as $key => $value) {
             if (!isset($valoresActuales['globales'][$key])) {
                 $valores['globales'][$key] = 0;
             } else {
                 $valores['globales'][$key] = $valoresActuales['globales'][$key];
             }
         }
     }
     if (is_array($this->_objeto['datos']['especificas'])) {
         foreach ($this->_objeto['datos']['especificas'] as $key => $value) {
             if (!isset($valoresActuales['especificas'][$key])) {
                 $valores['especificas'][$key] = 0;
             } else {
                 $valores['especificas'][$key] = $valoresActuales['especificas'][$key];
             }
         }
     }
     $variables->setNode('showVarWeb', $valores);
     $variables->save();
     unset($variables);
 }
示例#15
0
 /**
  * get single Variables instance from a DOMElement
  *
  * @param DOMElement $node
  * @return Variables
  */
 public static function fromDOMElement(DOMElement $node)
 {
     $o = new Variables();
     $o->assignByHash(self::domNodeToHash($node, self::$FIELD_NAMES, self::$DEFAULT_VALUES, self::$FIELD_TYPES));
     $o->notifyPristine();
     return $o;
 }
示例#16
0
文件: Node.php 项目: netresearch/kite
 /**
  * Node constructor.
  *
  * @param Variables $parent Parent object (Task/Job/Workflow)
  */
 public function __construct(Variables $parent)
 {
     parent::__construct($parent, array('user' => '', 'pass' => '', 'port' => '', 'url' => '{(this.user ? this.user ~ "@" : "") ~ this.host}', 'sshOptions' => ' -A{this.port ? " -p " ~ this.port : ""}{this.pass ? " -o PubkeyAuthentication=no" : ""}', 'scpOptions' => '{this.port ? " -P " ~ this.port : ""}{this.pass ? " -o PubkeyAuthentication=no" : ""}', 'php' => 'php', 'webRoot' => '{this.deployPath}/current'));
 }
 /**
  * Carga las variables web y de entorno del proyecto, app y módulo
  * @return void
  */
 protected function cargaVariables()
 {
     // Variables de entorno del proyecto
     if (!isset($_SESSION['VARIABLES']['EnvPro'])) {
         $variables = new Variables('Pro', 'Env');
         $this->varEnvPro = $variables->getValores();
         $_SESSION['VARIABLES']['EnvPro'] = $this->varEnvPro;
     } else {
         $this->varEnvPro = $_SESSION['VARIABLES']['EnvPro'];
     }
     $this->values['varEnvPro'] = $this->varEnvPro;
     //if ((count($this->values['varEnvPro']) == 0) and ( $_SESSION['usuarioPortal']['IdPerfil'] == '1'))
     //    $this->values['errores'][] = "No se han definido las variables de entorno del proyecto";
     // Variables web del proyecto
     if (!isset($_SESSION['VARIABLES']['WebPro'])) {
         $variables = new Variables('Pro', 'Web');
         $this->varWebPro = $variables->getValores();
         $_SESSION['VARIABLES']['WebPro'] = $this->varWebPro;
     } else {
         $this->varWebPro = $_SESSION['VARIABLES']['WebPro'];
     }
     $this->values['varWebPro'] = $this->varWebPro;
     //if ((count($this->values['varWebPro']) == 0) and ( $_SESSION['usuarioPortal']['IdPerfil'] == '1'))
     //    $this->values['errores'][] = "No se han definido las variables web del proyecto";
     // Variables de entorno del modulo
     $variables = new Variables('Mod', 'Env', $this->entity);
     $this->varEnvMod = $variables->getValores();
     $this->values['varEnvMod'] = $this->varEnvMod;
     $_SESSION['VARIABLES']['EnvMod'] = $this->varEnvMod;
     //if ((count($this->values['varEnvMod']) == 0) and ( $_SESSION['usuarioPortal']['IdPerfil'] == '1'))
     //    $this->values['errores'][] = "No se han definido las variables de entorno del módulo '{$this->entity}'";
     // Variables web del modulo
     if (!isset($_SESSION['VARIABLES']['WebMod'])) {
         $variables = new Variables('Mod', 'Web', $this->entity);
         $this->varWebMod = $variables->getValores();
         $_SESSION['VARIABLES']['WebMod'] = $this->varWebMod;
     } else {
         $this->varWebMod = $_SESSION['VARIABLES']['WebMod'];
     }
     $this->values['varWebMod'] = $this->varWebMod;
     //if ((count($this->values['varWebMod']) == 0) and ( $_SESSION['usuarioPortal']['IdPerfil'] == '1'))
     //    $this->values['errores'][] = "No se han definido las variables web del módulo '{$this->entity}'";
     // Variables de entorno de la app
     if (!isset($_SESSION['VARIABLES']['EnvApp'])) {
         $variables = new Variables('App', 'Env', $this->app);
         $this->varEnvApp = $variables->getValores();
         $_SESSION['VARIABLES']['EnvApp'] = $this->varEnvApp;
     } else {
         $this->varEnvApp = $_SESSION['VARIABLES']['EnvApp'];
     }
     $this->values['varEnvApp'] = $this->varEnvApp;
     //if ((count($this->values['varEnvApp']) == 0) and ($_SESSION['usuarioPortal']['IdPerfil'] == '1'))
     //    $this->values['errores'][] = "No se han definido las variables de entorno de la App '{$this->app}'";
     // Variables web de la app
     if (!isset($_SESSION['VARIABLES']['WebApp'])) {
         $variables = new Variables('App', 'Web', $this->app);
         $this->varWebApp = $variables->getValores();
         $_SESSION['VARIABLES']['WebApp'] = $this->varWebApp;
     } else {
         $this->varWebApp = $_SESSION['VARIABLES']['WebApp'];
     }
     $this->values['varWebApp'] = $this->varWebApp;
     //if ((count($this->values['varWebApp']) == 0) and ($_SESSION['usuarioPortal']['IdPerfil'] == '1'))
     //    $this->values['errores'][] = "No se han definido las variables web de la App '{$this->app}'";
     unset($variables);
 }
    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 Variables('Mod', 'Env', $modulo);
$atributosColumna = $var->getColumn($columna);
$atributosColumna[$propiedad] = $_GET['valor'];
$var->setColumn($columna, $atributosColumna);
$var->save();
unset($var);
$tag = "";
echo $tag;
示例#19
0
            }
        }
    }
}
/* Check if a form is being edited. */
if (!isset($vars->mode) || $vars->retry) {
    if (isset($vars->forward)) {
        try {
            $addrInfo = $vilma->driver->getAddressInfo($vars->forward, 'forward');
            $address = $vilma->driver->getAddressInfo($addrInfo['destination']);
        } catch (Exception $e) {
            Horde::log($e);
            $notification->push(sprintf(_("Error reading address information from backend: %s"), $e->getMessage()), 'horde.error');
            Horde::url('users/index.php', true)->redirect();
        }
        $vars = new Variables($address);
        $vars->mode = 'edit';
        $vars->add('forward_address', $forward);
        $vars->add('forward', $forward);
        $vars->add('address', $address['address']);
    } elseif (isset($vars->address)) {
        $address = $vilma->driver->getAddressInfo($vars->address, 'all');
        $vars = new Variables($address);
        $vars->mode = 'new';
    }
    $form = new EditforwardForm($vars);
    /*
        if ($form->validate($vars)) {
            $form->getInfo($vars, $info);
            $forward_id = $vilma->driver->saveforward($info);
            if (is_a($forward_id, 'PEAR_Error')) {
示例#20
0
 public function execute()
 {
     $this->createVocab();
     $this->saveTerms();
     Variables::saveVariable('vocab_id', $this->vid);
 }
示例#21
0
 /**
  * This function uses the Variables extension to provide navigation aids such as DPL_firstTitle, DPL_lastTitle, or DPL_findTitle.  These variables can be accessed as {{#var:DPL_firstTitle}} if Extension:Variables is installed.
  *
  * @access	public
  * @param	array	Array of scroll variables with the key as the variable name and the value as the value.  Non-arrays will be casted to arrays.
  * @return	void
  */
 private function defineScrollVariables($scrollVariables)
 {
     $scrollVariables = (array) $scrollVariables;
     foreach ($scrollVariables as $variable => $value) {
         Variables::setVar(['', '', $variable, $value]);
         if (defined('ExtVariables::VERSION')) {
             \ExtVariables::get($this->parser)->setVarValue($variable, $value);
         }
     }
 }
示例#22
0
 /**
  * Devuelve un array con los atributos de cada columna del módulo $modulo
  *
  * Los atributos son: caption, visible, updatable, default, permission, help
  *
  * Los valores de los atributos se obtienen  de las variables de entorno del módulo,
  * y si no existen, se cargan del config.yml correspondiente
  *
  * @param string $modulo El nombre del módulo
  * @return array Array de atributos
  */
 public function getAtributos($modulo)
 {
     $atributos = array();
     // PRIMERO LEO LOS ATRIBUTOS DE LAS COLUMNAS QUE ESTÁN EN CONFIG.YML
     $columnasConfig = $this->getNode('columns');
     foreach ($columnasConfig as $keyColumna => $valueColumna) {
         foreach (VariablesEnv::$varEnvMod as $keyVar => $keyColumnaConfig) {
             $atributos[$keyColumna][$keyVar] = isset($valueColumna[$keyColumnaConfig]) ? $valueColumna[$keyColumnaConfig] : "";
         }
     }
     return $atributos;
     // LUEGO LOS SUSTITUYO POR LOS ESPECIFICOS QUE ESTAN EN LAS VAR DE ENTORNO DE PROYECTO
     // DE TAL MANERA QUE PREVALECEN LOS DEFINIDOS EN LAS VARIABLES DE ENTORNO, PERO
     // SI NO EXISTIERA LA VARIABLE DE ENTORNO CORRESPONDIENTE ENTONCES PONGO LA DEL CONFIG.
     $variables = new Variables('Mod', 'Env', $modulo);
     if (is_array($variables->getDatosYml())) {
         $arrayColumnas = $variables->getNode('columns');
         foreach ($arrayColumnas as $key => $value) {
             $atributos[$key] = $value;
             if (is_array($columnasConfig[$key])) {
                 foreach ($columnasConfig[$key] as $keyConfig => $valueConfig) {
                     if (!isset($atributos[$key][$keyConfig])) {
                         $atributos[$key][$keyConfig] = $valueConfig;
                     }
                 }
             }
         }
     } else {
         // Aún no se han definido las variables, por lo tanto cargo los atributos
         // en base al array de correspondencia de atributos predeterminados
         foreach ($columnasConfig as $keyColumna => $valueColumna) {
             foreach (VariablesEnv::$varEnvMod as $keyVar => $keyColumnaConfig) {
                 $atributos[$keyColumna][$keyVar] = isset($valueColumna[$keyColumnaConfig]) ? $valueColumna[$keyColumnaConfig] : "";
             }
         }
     }
     unset($variables);
     // Si el usuario es super pongo la visibilidad a TRUE
     //if ($_SESSION['usuarioPortal']['Id'] == '1')
     //    foreach ($atributos as $key => $value)
     //        ++$atributos[$key]['visible'];
     /**
      if (!$atributos[$key]['visible']) {
      $atributos[$key]['visible'] = '1';
      $atributos[$key]['caption'] .= " (oculta)";
      }
     */
     return $atributos;
 }
示例#23
0
 /**
  * Returns the submitted or default value of this variable.
  * If an action is attached to this variable, the value will get passed to
  * the action object.
  *
  * @param Variables $vars  The {@link Variables} instance of the submitted
  *                         form.
  * @param integer $index   If the variable is an array variable, this
  *                         specifies the array element to return.
  *
  * @return mixed  The variable or element value.
  */
 function getValue($vars, $index = null)
 {
     if ($this->_arrayVal) {
         $name = str_replace('[]', '', $this->varName);
     } else {
         $name = $this->varName;
     }
     $value = $vars->getExists($name, $wasset);
     if (!$wasset) {
         $value = $this->getDefault();
     }
     if ($this->_arrayVal && !is_null($index)) {
         if (!$wasset && !is_array($value)) {
             $return = $value;
         } else {
             $return = isset($value[$index]) ? $value[$index] : null;
         }
     } else {
         $return = $value;
     }
     if ($this->hasAction()) {
         $this->_action->setValues($vars, $return, $this->_arrayVal);
     }
     return $return;
 }
示例#24
0
 public function apply()
 {
     if ($files = $this->getKitFiles()) {
         foreach ($files as $file => $path) {
             $import = new Imports($path);
             // Make a backup of the file.
             $this->writeFile($import->getSource(), $file, 'source');
             // Now store the compiled file
             $this->writeFile($import->apply(), $file, 'source');
             foreach ($import->getImports() as $key => $value) {
                 $this->imports[$key] = $value;
             }
         }
     }
     $files = array_diff_key($files, $this->imports);
     foreach ($files as $file => $path) {
         $variables = new Variables($path, TRUE);
         $variables->extract();
         $result = $variables->apply();
         $file = preg_replace('/\\.kit$/', '.html', $file);
         $path = $this->writeFile($result, $file);
         $this->exports[$file] = $path;
     }
     return $result;
 }