Example #1
0
 /**
  * Permite cambiar el proyecto del cliente RDI
  * @param toba_proyecto $obj_proyecto
  */
 function set_proyecto(toba_proyecto $obj_proyecto)
 {
     //Si hay cambio de proyecto, elimino la instancia de RDICliente
     if (isset($this->proyecto) && $this->proyecto->get_id() != $obj_proyecto->get_id()) {
         unset($this->clienteRdi);
     }
     $this->proyecto = $obj_proyecto;
 }
Example #2
0
 function __construct($info, $sql = null, $parser_errores = null, $es_comando = false)
 {
     $this->es_comando = $es_comando;
     $this->parser_errores = $parser_errores;
     $this->set_sql_ejecutado($sql);
     //- No se crea un arreglo cuando falla la conexion a la base ya que son propiedades del objeto conexion.
     if (is_array($info->errorInfo)) {
         $this->set_info_error($info->errorInfo);
     } else {
         //- No va a funcionar si se cambia de motor porque se parsea el mensaje de postgres
         $cadena = substr($info->getMessage(), 0, 16);
         if (strpos($cadena, 'SQLSTATE') !== false) {
             $codigo = $this->parsear_mensaje($cadena, '[', ']');
             $this->set_info_error(array($codigo, $info->getCode(), $info->getMessage()));
         } else {
             //- No se pudo parsear el mensaje de error, se arma uno generico.
             $this->set_info_error(array('96669', $info->getCode(), $info->getMessage()));
         }
     }
     if (PHP_SAPI != 'cli') {
         if ($this->get_sqlstate() == 'db_08006' || $this->get_sqlstate() == 'db_96669') {
             $mensaje = "No es posible realizar la conexión a la base.";
         } else {
             //-- Primero se intenta parsear el mensaje para mostrar un mensaje más contextual
             if ($this->es_comando && isset($this->parser_errores)) {
                 $mensaje = $this->parser_errores->parsear($sql, $this->info_error[0], $info->getMessage());
             }
             //-- Si no hay parser, o el mismo no puede deducir nada se intenta mostrar un mensaje generico
             if (!isset($mensaje)) {
                 $datos_error = array();
                 if (toba_proyecto::hay_instancia()) {
                     //El error pudo haber surgido desde la misma creacion de la instancia del proyecto (ciclo infinito)
                     $datos_error = toba::proyecto()->get_mensaje_proyecto($this->get_sqlstate());
                     if (!$datos_error || !is_array($datos_error)) {
                         $datos_error = toba::proyecto()->get_mensaje_toba($this->get_sqlstate());
                     }
                 }
                 if (!is_array($datos_error) || empty($datos_error)) {
                     $mensaje = $info->getMessage();
                 } else {
                     $mensaje = $datos_error['m'];
                 }
             }
         }
     } else {
         $mensaje = $this->get_mensaje_log();
     }
     parent::__construct($mensaje);
 }
Example #3
0
 /**
  *	Indica si la ejecucion actual corresponde a la previsualizacion de un proyecto 
  *		lanzada desde el admin
  */
 static function modo_prueba()
 {
     if (self::activado() && toba::manejador_sesiones()->existe_sesion_activa()) {
         return self::$memoria['proyecto'] == toba_proyecto::get_id();
     }
     return false;
 }
 static function cargar_relaciones($fuente_datos, $proyecto = null)
 {
     self::$relaciones[$fuente_datos] = toba_proyecto::get_info_relacion_entre_tablas($fuente_datos, $proyecto);
 }
Example #5
0
 /**
  * Agregar dinámicamente una dependencia al componente actual utilizando
  *
  * @param string $identificador ID. del componente
  * @param string $proyecto 
  * @param string $tipo Tipo de componente
  */
 function agregar_dependencia_por_indice($identificador_rol, $identificador_componente)
 {
     $proyecto = toba_proyecto::get_id();
     $id = toba::proyecto()->get_id_componente_por_indice($identificador_componente, $proyecto);
     $this->agregar_dependencia($identificador_rol, $proyecto, $id['componente']);
     $this->dep($identificador_rol)->inicializar();
 }
Example #6
0
 static function get_directorio_compilacion()
 {
     if (!self::$dir_compilacion) {
         self::$dir_compilacion = toba_proyecto::get_path() . '/metadatos_compilados';
     }
     return self::$dir_compilacion;
 }
Example #7
0
 /**
  * Retorna un componente por ID
  * @param integer $id
  * @return toba_componente
  */
 static function componente_por_id($id)
 {
     $id_comp['proyecto'] = toba_proyecto::get_id();
     $id_comp['componente'] = $id;
     $comp = toba_constructor::get_runtime($id_comp, null, true);
     if (!$comp->inicializado()) {
         $comp->inicializar();
     }
     return $comp;
 }
Example #8
0
 protected function get_ini_proyecto()
 {
     $resultado = array();
     $path_ini = toba_proyecto::get_path() . '/proyecto.ini';
     if (file_exists($path_ini)) {
         $ini = new toba_ini($path_ini);
         if ($ini->existe_entrada('proyecto')) {
             $resultado = $ini->get_datos_entrada('proyecto');
         }
     }
     return $resultado;
 }
Example #9
0
 /**
  *	Utilizada en el login automatico
  */
 function get_lista_usuarios($proyecto = null)
 {
     if (!isset($proyecto)) {
         $proyecto = toba_proyecto::get_id();
     }
     $proyecto = $this->get_db()->quote($proyecto);
     $sql = "SELECT \tDISTINCT \n\t\t\t\t\t\tu.usuario as usuario, \n\t\t\t\t\t\tu.nombre as nombre\n\t\t\t\tFROM \tapex_usuario u, apex_usuario_proyecto p\n\t\t\t\tWHERE \tu.usuario = p.usuario\n\t\t\t\tAND\t\tp.proyecto = {$proyecto}\n\t\t\t\tORDER BY 1;";
     return $this->get_db()->consultar($sql);
 }
Example #10
0
 function borrar_segmento_proyecto($proyecto = null)
 {
     if (!isset($proyecto)) {
         $proyecto = $this->proyecto;
     }
     unset($_SESSION[TOBA_DIR]['instancias'][$this->instancia]['proyectos'][$proyecto]);
     toba_proyecto::eliminar_instancia();
     toba_memoria::eliminar_instancia();
     toba::logger()->debug('BORRAR segmento memoria PROYECTO: ' . $proyecto, 'toba');
 }
Example #11
0
 static function eliminar_instancia()
 {
     self::$instancia = null;
 }
Example #12
0
 function get_proyecto_actual()
 {
     if (class_exists('toba_proyecto')) {
         try {
             return toba_proyecto::get_id();
         } catch (Exception $e) {
         }
     }
     return 'toba';
 }
Example #13
-1
 static function link_css($archivo = 'toba', $rol = 'screen', $buscar_en_proyecto = true)
 {
     $link = '';
     $version = toba::memoria()->get_dato_instancia('toba_revision_recursos_cliente');
     $agregado_url = !is_null($version) ? "?av={$version}" : '';
     //--- Incluye primero el del nucleo
     $url = toba_recurso::url_toba() . "/css/{$archivo}.css{$agregado_url}";
     $link .= "<link href='{$url}' rel='stylesheet' type='text/css' media='{$rol}'/>\n";
     //--- Incluye el del skin si es el estandar
     if ($archivo == 'toba') {
         $url = toba_recurso::url_skin() . "/toba.css{$agregado_url}";
         $link .= "<link href='{$url}' rel='stylesheet' type='text/css' media='{$rol}'/>\n";
     }
     //--- Incluye el del proyecto, si existe
     if ($buscar_en_proyecto) {
         $version = toba::memoria()->get_dato_instancia('proyecto_revision_recursos_cliente');
         $agregado_url = !is_null($version) ? "?av={$version}" : '';
         $proyecto = toba_proyecto::get_id();
         $path = toba::instancia()->get_path_proyecto($proyecto) . "/www/css/{$archivo}.css";
         if (file_exists($path)) {
             $url = toba_recurso::url_proyecto($proyecto) . "/css/{$archivo}.css{$agregado_url}";
             $link .= "<link href='{$url}' rel='stylesheet' type='text/css' media='{$rol}'/>\n";
         }
         if (toba::proyecto()->personalizacion_activa()) {
             $www = toba::proyecto()->get_www_pers("css/{$archivo}.css");
             if (file_exists($www['path'])) {
                 $url = $www['url'] . $agregado_url;
                 $link .= "<link href='{$url}' rel='stylesheet' type='text/css' media='{$rol}'/>\n";
             }
         }
         $path = toba::instancia()->get_path_proyecto($proyecto) . "/www/css/" . $archivo . "_hack_ie.css";
         if (file_exists($path)) {
             $url = toba_recurso::url_proyecto($proyecto) . "/css/" . $archivo . "_hack_ie.css";
             $link .= "<!--[if lt IE 8]>\n";
             $link .= "<link href='{$url}' rel='stylesheet' type='text/css' media='{$rol}'/>\n\n";
             $link .= "<![endif]-->\n";
         }
     }
     return $link;
 }