/** * Retorna una fuente de datos * * @param string $id Id. de la fuente * @param string $proyecto Proyecto al que pertenece la fuente * @return toba_fuente_datos */ function get_fuente($id, $proyecto = null) { if (!isset($proyecto)) { $proyecto = toba::proyecto()->get_id(); } if (!isset($id)) { $id = $this->get_fuente_predeterminada(true, $proyecto); } if (!isset($this->fuentes[$id])) { $parametros = toba::proyecto()->get_info_fuente_datos($id, $proyecto); $clase = isset($parametros['subclase_nombre']) ? $parametros['subclase_nombre'] : 'toba_fuente_datos'; if (isset($parametros['subclase_archivo'])) { $pm = $parametros['punto_montaje']; if (toba::proyecto()->get_id() != $proyecto) { //Si la fuente esta extendida, puede necesitar otros archivos del proyecto, agregar el include path $path_proyecto = toba::instancia()->get_path_proyecto($proyecto) . '/php'; agregar_dir_include_path($path_proyecto); } $archivo = $parametros['subclase_archivo']; toba_cargador::cargar_clase_archivo($pm, $archivo, $proyecto); } $this->fuentes[$id] = new $clase($parametros); } return $this->fuentes[$id]; }
function incluir_path_proyecto_cargado() { if (!self::acceso_recursivo()) { //La subclase puede incluir archivos del proyecto $path_proyecto = toba::instancia()->get_path_proyecto(toba_editor::get_proyecto_cargado()) . '/php'; agregar_dir_include_path($path_proyecto); } }
function get_fuente_proyecto_alterno($id, $proyecto) { $parametros = toba_proyecto_db::get_info_fuente_datos($proyecto, $id); if (isset($parametros['subclase_archivo'])) { if (toba::proyecto()->get_id() != $proyecto) { //Si la fuente esta extendida, puede necesitar otros archivos del proyecto, agregar el include path $path_proyecto = toba::instancia()->get_path_proyecto($proyecto) . '/php'; agregar_dir_include_path($path_proyecto); } $archivo = $parametros['subclase_archivo']; } else { $archivo = 'nucleo/lib/toba_fuente_datos.php'; } if (isset($parametros['subclase_nombre'])) { $clase = $parametros['subclase_nombre']; } else { $clase = "toba_fuente_datos"; } require_once $archivo; return new $clase($parametros); }
protected function agregar_paths() { agregar_dir_include_path(toba_proyecto::get_path_php()); if (toba::proyecto()->es_personalizable()) { agregar_dir_include_path(toba_proyecto::get_path_pers_php()); } }
<?php agregar_dir_include_path(toba_dir() . '/php/3ros/phpExcel'); require_once 'PHPExcel.php'; /** * Genera un pdf a través de una api básica * @package SalidaGrafica * @todo La numeración de páginas no funcionará si se cambia la orientación de la misma. Habría que * implementar un método que en base al tipo de papel y orientación de la página, devuelva las * coordenadas para una correcta visualización de la numeración de páginas. * @todo El método insertar_imagen esta implementado con un método en estado beta de la api ezpdf. Usar * con discreción. */ class toba_vista_excel { /** * @var PHPExcel */ protected $excel; protected $objetos = array(); protected $nombre_archivo = 'salida.xls'; protected $tipo_descarga = 'attachment'; protected $writer = 'Excel5'; protected $cursor_base = array(0, 1); protected $cursor = array(0, 1); protected $temp_salida; function __construct() { $this->excel = new PHPExcel(); $this->inicializar(); }
static function get_casos($categoria = 'nopar') { //Agrega el proyecto al include path if (isset(self::$proyecto)) { $proyecto = self::$proyecto; } else { $proyecto = toba_contexto_info::get_proyecto(); } $path = toba::instancia()->get_path_proyecto($proyecto) . "/php"; agregar_dir_include_path($path); $casos = $casos_sel = array(); $path = self::get_path(); if (file_exists($path . '/test_toba.php')) { require_once $path . '/test_toba.php'; } if ($handle = @opendir($path)) { $casos = self::get_archivos($handle, $path); closedir($handle); } $path_sel = self::get_path('selenium'); if ($handle = @opendir($path_sel)) { $casos_sel = self::get_archivos($handle, $path_sel); closedir($handle); } if (!empty($casos) || !empty($casos_sel)) { $casos = array_merge($casos, $casos_sel); } usort($casos, array("toba_test_lista_casos", "comparar")); if ($categoria == 'todas' || $categoria == 'nopar') { return $casos; } else { $casos_selecc = array(); foreach ($casos as $caso) { if ($caso['categoria'] == $categoria) { $casos_selecc[] = $caso; } } return $casos_selecc; } }
function procesar() { toba::logger_ws()->debug('Servicio Llamado: ' . $this->info['basica']['item']); toba::logger_ws()->set_checkpoint(); set_error_handler('toba_logger_ws::manejador_errores_recuperables', E_ALL); $this->validar_componente(); //-- Pide los datos para construir el componente, WSF no soporta entregar objetos creados $clave = array(); $clave['proyecto'] = $this->info['objetos'][0]['objeto_proyecto']; $clave['componente'] = $this->info['objetos'][0]['objeto']; list($tipo, $clase, $datos) = toba_constructor::get_runtime_clase_y_datos($clave, $this->info['objetos'][0]['clase'], false); agregar_dir_include_path(toba_dir() . '/php/3ros/wsf'); $opciones_extension = toba_servicio_web::_get_opciones($this->info['basica']['item'], $clase); $wsdl = strpos($_SERVER['REQUEST_URI'], "?wsdl") !== false; $sufijo = 'op__'; $metodos = array(); $reflexion = new ReflectionClass($clase); foreach ($reflexion->getMethods() as $metodo) { if (strpos($metodo->name, $sufijo) === 0) { $servicio = substr($metodo->name, strlen($sufijo)); $prefijo = $wsdl ? '' : '_'; $metodos[$servicio] = $prefijo . $metodo->name; } } $opciones = array(); $opciones['serviceName'] = $this->info['basica']['item']; $opciones['classes'][$clase]['operations'] = $metodos; $opciones = array_merge($opciones, $opciones_extension); $this->log->debug("Opciones del servidor: " . var_export($opciones, true), 'toba'); $opciones['classes'][$clase]['args'] = array($datos); toba::logger_ws()->set_checkpoint(); $service = new WSService($opciones); $service->reply(); $this->log->debug("Fin de servicio web", 'toba'); }