public function render() { for ($bfi = 0; $bfi < sizeof($this->before_tabbing_cmps); $bfi++) { parent::addComponent($this->before_tabbing_cmps[$bfi]); } /** * * Create tab header * **/ if (sizeof($this->tabs) > 0) { $h = "<table style='margin-top:10px' class=\"tabs\" ><tr>"; for ($ti = 0; $ti < sizeof($this->tabs); $ti++) { $h .= "<td style='max-width:84px' id='atab_" . $this->tabs[$ti]["title"] . "' >\n\t\t\t\t\t\t<a href='#" . $this->tabs[$ti]["title"] . "'>" . $this->tabs[$ti]["title"] . "</a>\n\t\t\t\t\t</td>"; } $h .= "<td class=\"dummy\"></td></tr></table>"; parent::addComponent($h); /** * * Actual wrapped tabs * **/ $tabs_for_js = ""; for ($ti = 0; $ti < sizeof($this->tabs); $ti++) { parent::addComponent("<div class='gTab' id='tab_" . $this->tabs[$ti]["title"] . "'>"); $tabs_for_js .= "'" . $this->tabs[$ti]["title"] . "',"; for ($ti_cmps = 0; $ti_cmps < sizeof($this->tabs[$ti]["components"]); $ti_cmps++) { parent::addComponent($this->tabs[$ti]["components"][$ti_cmps]); } parent::addComponent("</div>"); } $h = "<script>\n\t\t\t\tvar TabPage = TabPage || {};\n\t\t\t\tTabPage.tabs = [{$tabs_for_js}];\n\t\t\t\t\n\t\t\t\tTabPage.currentTab = '';\n\t\t\t\t</script>"; parent::addComponent($h); } //throw new Exception ("there are no tabs in your tabpage"); parent::render(); }
<?php define("BYPASS_INSTANCE_CHECK", false); require_once "../../../server/bootstrap.php"; $page = new GerenciaComponentPage(); $page->addComponent(new TitleComponent("Proveedores")); $page->addComponent(new MessageComponent("Lista de proveedores")); $proveedoresLista = ProveedoresController::Lista(); $tabla = new TableComponent(array("nombre" => "Nombre", "id_categoria_contacto" => "Clasificacion de proveedor", "activo" => "Activo", "consignatario" => "Consignatario"), $proveedoresLista["resultados"]); $tabla->addColRender("id_categoria_contacto", "funcion_clasificacion_proveedor"); $tabla->addColRender("activo", "funcion_activo"); $tabla->addColRender("consignatario", "funcion_consignatario"); $tabla->addOnClick("id_usuario", "(function(a){ window.location = 'proveedores.ver.php?pid=' + a; })"); $page->addComponent($tabla); $page->render();
define("BYPASS_INSTANCE_CHECK", false); require_once "../../../server//bootstrap.php"; function funcion_producto($id_producto) { return ProductoDAO::getByPK($id_producto) ? ProductoDAO::getByPK($id_producto)->getNombreProducto() : "---------"; } $page = new GerenciaComponentPage(); // // Requerir parametros // $page->requireParam("cid", "GET", "Esta compra no existe."); $esta_compra = CompraDAO::getByPK($_GET["cid"]); if ($esta_compra === null) { $page->addComponent("<p>Esta compra no existe</p>"); $page->render(0); exit; } // // Titulo de la pagina // $page->addComponent(new TitleComponent("Detalles de la compra " . $esta_compra->getIdCompra(), 2)); // // Menu de opciones // if (!$esta_compra->getCancelada()) { $menu = new MenuComponent(); if ($esta_compra->getTipoDeCompra() == "credito") { $menu->addItem("Abonar a esta compra", "cargos_y_abonos.nuevo.abono.php?cid=" . $_GET["cid"] . "&did=" . $esta_compra->getIdVendedorCompra()); } $btn_eliminar = new MenuItem("Cancelar esta compra", null);