<?php define("BYPASS_INSTANCE_CHECK", false); require_once "../../../server/bootstrap.php"; $page = new GerenciaComponentPage(); $page->addComponent(new TitleComponent("Nueva Sucursal")); $page->addComponent(new TitleComponent("Datos de la sucursal", 3)); $sucursal_form = new DAOFormComponent(new Sucursal()); $sucursal_form->hideField(array("id_sucursal", "id_direccion", "activa", "fecha_baja", "fecha_apertura")); $sucursal_form->renameField(array("id_gerente" => "id_usuario")); $sucursal_form->createComboBoxJoin("id_usuario", "nombre", UsuarioDAO::getAll()); $sucursal_form->createComboBoxJoin("id_tarifa", "nombre", TarifaDAO::getAll()); $sucursal_form->makeObligatory(array("descripcion")); $page->addComponent($sucursal_form); $page->addComponent(new TitleComponent("Direccion", 3)); $direccion_form = new DAOFormComponent(new Direccion()); $direccion_form->hideField(array("id_direccion", "ultima_modificacion", "id_usuario_ultima_modificacion")); $direccion_form->createComboBoxJoin("id_ciudad", "nombre", CiudadDAO::getAll()); $direccion_form->renameField(array("id_ciudad" => "ciudad")); $js = "(function(){\n\t\t\t\tPOS.API.POST(\"api/sucursal/nueva/\",{\n\t\t\t\t\tdescripcion\t\t: Ext.get(\"" . $sucursal_form->getGuiComponentId() . "descripcion\").getValue(),\n\t\t\t\t\tid_gerente\t: Ext.get(\"" . $sucursal_form->getGuiComponentId() . "id_usuario\").getValue(),\n\t\t\t\t\tid_tarifa\t: Ext.get(\"" . $sucursal_form->getGuiComponentId() . "id_tarifa\").getValue(),\n\t\t\t\t\tdireccion : Ext.JSON.encode({\n\t\t\t\t\t\t \tcalle\t\t\t: Ext.get(\"" . $direccion_form->getGuiComponentId() . "calle\").getValue(),\n\t\t\t\t\t\t\tnumero_exterior\t: Ext.get(\"" . $direccion_form->getGuiComponentId() . "numero_exterior\").getValue(),\n\t\t\t\t\t\t numero_interior\t: Ext.get(\"" . $direccion_form->getGuiComponentId() . "numero_interior\").getValue(),\n\t\t\t\t\t\t colonia\t\t\t: Ext.get(\"" . $direccion_form->getGuiComponentId() . "colonia\").getValue(),\n\t\t\t\t\t\t codigo_postal\t: Ext.get(\"" . $direccion_form->getGuiComponentId() . "codigo_postal\").getValue(),\n\t\t\t\t\t\t telefono1\t\t: Ext.get(\"" . $direccion_form->getGuiComponentId() . "telefono\").getValue(),\n\t\t\t\t\t\t telefono2\t\t: Ext.get(\"" . $direccion_form->getGuiComponentId() . "telefono2\").getValue(),\n\t\t\t\t\t\t id_ciudad\t\t: Ext.get(\"" . $direccion_form->getGuiComponentId() . "ciudad\").getValue(),\n\t\t\t\t\t\t referencia\t\t: Ext.get(\"" . $direccion_form->getGuiComponentId() . "referencia\").getValue()\n\t\t\t\t\t})\n\t\t\t\t},{ callback : function(a,b){\n\t\t\t\t\twindow.onbeforeunload = function(){ return;\t};\n\t\t\t\t\twindow.location = \"sucursales.ver.php?sid=\"+ a.id_sucursal;\n\t\t\t\t}});\n\t\t\t})()"; $direccion_form->addOnClick("Crear sucursal", $js); $page->addComponent($direccion_form); $page->render();
<?php define("BYPASS_INSTANCE_CHECK", false); require_once "../../../server/bootstrap.php"; $page = new GerenciaComponentPage(); // Parametros necesarios $page->requireParam("sid", "GET", "Esta sucursal no existe."); $esta_sucursal = SucursalDAO::getByPK($_GET["sid"]); $esta_direccion = DireccionDAO::getByPK($esta_sucursal->getIdDireccion()); // Titulo de la pagina $page->addComponent(new TitleComponent("Editar sucursal " . $esta_sucursal->getDescripcion(), 2)); //forma de nueva empresa $sucursal_form = new DAOFormComponent($esta_sucursal); $sucursal_form->hideField(array("id_sucursal", "id_direccion", "fecha_apertura", "fecha_baja")); $sucursal_form->renameField(array("id_gerente" => "id_usuario")); $sucursal_form->createComboBoxJoin("id_usuario", "nombre", UsuarioDAO::getAll(), $esta_sucursal->getIdGerente()); $sucursal_form->createComboBoxJoin("id_tarifa", "nombre", TarifaDAO::getAll(), $esta_sucursal->getIdTarifa()); $sucursal_form->createComboBoxJoin("activa", "activa", array(array("id" => false, "caption" => "No"), array("id" => true, "caption" => "Sí")), $esta_sucursal->getActiva()); $page->addComponent($sucursal_form); $page->addComponent(new TitleComponent("Direccion", 3)); $direccion_form = new DAOFormComponent($esta_direccion); $direccion_form->hideField(array("id_direccion", "ultima_modificacion", "id_usuario_ultima_modificacion")); $direccion_form->createComboBoxJoin("id_ciudad", "nombre", CiudadDAO::getAll(), $esta_direccion->getIdDireccion()); $direccion_form->renameField(array("id_ciudad" => "ciudad")); $js = "(function(){\n\t\t\t\tPOS.API.POST(\"api/sucursal/editar/\",{\n\t\t\t\t\tid_sucursal\t\t: " . $_GET['sid'] . ",\n\t\t\t\t\tdescripcion\t\t: Ext.get(\"" . $sucursal_form->getGuiComponentId() . "descripcion\").getValue(),\n\t\t\t\t\tid_gerente\t\t: Ext.get(\"" . $sucursal_form->getGuiComponentId() . "id_usuario\").getValue(),\n\t\t\t\t\tid_tarifa\t\t: Ext.get(\"" . $sucursal_form->getGuiComponentId() . "id_tarifa\").getValue(),\n\t\t\t\t\tactivo\t\t\t: Ext.get(\"" . $sucursal_form->getGuiComponentId() . "activa\").getValue(),\n\t\t\t\t\tdireccion : Ext.JSON.encode({\n\t\t\t\t\t\t \tcalle\t\t\t: Ext.get(\"" . $direccion_form->getGuiComponentId() . "calle\").getValue(),\n\t\t\t\t\t\t\tnumero_exterior\t: Ext.get(\"" . $direccion_form->getGuiComponentId() . "numero_exterior\").getValue(),\n\t\t\t\t\t\t numero_interior\t: Ext.get(\"" . $direccion_form->getGuiComponentId() . "numero_interior\").getValue(),\n\t\t\t\t\t\t colonia\t\t\t: Ext.get(\"" . $direccion_form->getGuiComponentId() . "colonia\").getValue(),\n\t\t\t\t\t\t codigo_postal\t: Ext.get(\"" . $direccion_form->getGuiComponentId() . "codigo_postal\").getValue(),\n\t\t\t\t\t\t telefono1\t\t: Ext.get(\"" . $direccion_form->getGuiComponentId() . "telefono\").getValue(),\n\t\t\t\t\t\t telefono2\t\t: Ext.get(\"" . $direccion_form->getGuiComponentId() . "telefono2\").getValue(),\n\t\t\t\t\t\t id_ciudad\t\t: Ext.get(\"" . $direccion_form->getGuiComponentId() . "ciudad\").getValue(),\n\t\t\t\t\t\t referencia\t\t: Ext.get(\"" . $direccion_form->getGuiComponentId() . "referencia\").getValue()\n\t\t\t\t\t})\n\t\t\t\t},{ callback : function(a,b){\n\t\t\t\t\twindow.onbeforeunload = function(){ return;\t};\n\t\t\t\t\twindow.location = \"sucursales.ver.php?sid=\"+ " . $_GET['sid'] . ";\n\t\t\t\t}});\n\t\t\t})()"; $direccion_form->addOnClick("Editar sucursal", $js); $page->addComponent($direccion_form); $page->render();
$page->addComponent("<td>" . $c->meta->{'syscall-count'} . " </td>"); } else { $page->addComponent("<td> - </td>"); } $page->addComponent("<td><strong>" . $c->meta->status . "</strong></td>"); $page->addComponent("</tr>"); $page->addComponent("</table>"); $page->addComponent("</td></tr>"); } } $page->addComponent("</td>"); $page->addComponent("</tr>"); } $page->addComponent("</table>"); $aV = ContestsDAO::getByAlias($_GET["alias"]); $eContest = new DAOFormComponent($aV); $eContest->setEditable(false); $page->addComponent($eContest); $page->nextTab("Envios"); $page->nextTab("Chavos"); $page->addComponent("Enviar correos, bannear, nuevos weyes, etc"); $page->nextTab("Stats"); $page->addComponent("GAnalitics u otras cosas, mostrar los auth tokens de los weyes que entraron al concurso con los diferentes ip's"); $page->nextTab("Editar"); $page->addComponent("<script>\n\t\tfunction doEditar(){\n\t\t\t\t var toSend = {};\n\t\t\t\t //upadateContes\n\t\t\t\t \$(\"table input\").each( function (n, el ){ \n\t\t\t\t \t\tif(el.value.length == 0 ) return;\n\t\t\t\t\t\ttoSend[ el.name ] = el.value;\n\t\t\t\t });\n\t\t\t\t\n\n\t\t\t\t\$.ajax({\n url: \"../api/contest/\" + toSend.alias + \"/update/\",\n dataType: \"json\",\n type:\"POST\",\n data: toSend,\n beforeSend: function( xhr ) {\n //\$(\"#submit\").hide();\n },\n success: function(a,b,c){\n \$(\"<p title='OmegaUp'>Success !</p>\").dialog({\n\t\t\t\t\t\t\t\tmodal: true,\n\t\t\t\t\t\t\t\tbuttons: {\n\t\t\t\t\t\t\t\t\tOk: function() {\n\t\t\t\t\t\t\t\t\t\t\$( this ).dialog( \"close\" );\n\t\t\t\t\t\t\t\t\t\twindow.location = \"contest.php?alias=\" + \$(\"#_alias\").val();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n },\n error:function(a,b,c){\n r = \$.parseJSON(a.responseText);\n \$(\"<p title='OmegaUp'>\"+r.error+\"</p>\").dialog({\n\t\t\t\t\t\t\t\tmodal: true,\n\t\t\t\t\t\t\t\tbuttons: {\n\t\t\t\t\t\t\t\t\tOk: function() {\n\t\t\t\t\t\t\t\t\t\t\$( this ).dialog( \"close\" );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n }\n \n });\n\t\t\t\tconsole.log(toSend);\n\n\t\t}</script>"); $eContest = new DAOFormComponent($aV); $eContest->setEditable(true); $eContest->hideField("contest_id"); $eContest->addOnClick("Editar concurso", "doEditar()"); $page->addComponent($eContest); $page->render();