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) { throw new Exception("there are no tabs in your tabpage"); } $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<a href='#" . $this->tabs[$ti]["title"] . "'>" . $this->tabs[$ti]["title"] . "</a>\n\t\t\t\t</td>"; } $h .= "<td class=\"dummy\"></td></tr></table>"; parent::addComponent($h); /** * * Actual wrapped tabs * **/ for ($ti = 0; $ti < sizeof($this->tabs); $ti++) { parent::addComponent("<div class='gTab' style='display:none' id='tab_" . $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 currentTab = '';\n\n\t\t\t\tif(window.location.hash.length == 0){\n\t\t\t\t\tExt.get('tab_" . $this->tabs[0]["title"] . "').setStyle('display', 'block');\n\t\t\t\t\tExt.get('atab_" . $this->tabs[0]["title"] . "').toggleCls('selected');\n\t\t\t\t\tcurrentTab = '" . $this->tabs[0]["title"] . "';\n\t\t\t\t}else{\n\t\t\t\t\tcurrentTab = window.location.hash.substr(1);\n\t\t\t\t\tExt.get('tab_'+currentTab).setStyle('display', 'block');\n\t\t\t\t\tExt.get('atab_'+currentTab).toggleCls('selected');\t\t\t\t\t\t\n\t\t\t\t}\n\n\t \t\t\tif ( 'onhashchange' in window ) {\n\t \t\t\t\tconsole.log('`onhashchange` available....');\n\n\t\t\t\t window.onhashchange = function() {\n\n\t\t\t\t\t\tif((currentTab.length > 0) && (Ext.get('tab_'+currentTab) != null)){\n\t\t\t\t\t\t\tExt.get('tab_'+currentTab).setStyle('display', 'none');\n\t\t\t\t\t\t\tExt.get('atab_'+currentTab).toggleCls('selected');\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcurrentTab = window.location.hash.substr(1);\n\t\t\t\t\t\tExt.get('tab_'+currentTab).setStyle('display', 'block');\n\t\t\t\t\t\tExt.get('atab_'+currentTab).toggleCls('selected');\n\t\t\t\t }\n\t\t\t\t}</script>"; parent::addComponent($h); parent::render(); }
<?php if (!class_exists("PHPUnit_Runner_Version")) { define("BYPASS_INSTANCE_CHECK", false); require_once "../../../server/bootstrap.php"; } $page = new ClienteComponentPage("Bienvendio a POS ERP"); $banner = new BannerComponent("POS ERP", "Bienvenido a POS ERP <br>un sistema de gestion empresarial", "../../../media/EAbydW1M_XR.png"); $page->addComponent($banner); //buscar si tiene ordenes de servico a su nombre $sesion_actual = SesionController::Actual(); $ordenes_array = new OrdenDeServicio(array("id_usuario_venta" => $sesion_actual["id_usuario"])); $ordenes = OrdenDeServicioDAO::search($ordenes_array); if (sizeof($ordenes) > 0) { $page->addComponent(new TitleComponent("Sus ordenes de servicio", 2)); $table = new TableComponent(array("id_servicio" => "Servicio", "fecha_orden" => "Fecha"), $ordenes); function renderIdServicio($id) { $serv = ServicioDAO::getByPK($id); return $serv->getNombreServicio(); } $table->addColRender("fecha_orden", "FormatTime"); $table->addOnClick("id_orden_de_servicio", "(function(a){ window.location = 'servicios.detalle.orden.php?oid='+a; })"); $table->addColRender("id_servicio", "renderIdServicio"); $page->addComponent($table); } $page->render();