7); $_result['visibility'] = array(); $_initialvars = arrayExclude(get_defined_vars(), array("_*", "form_*", "s_*", "GLOBALS", "Link", "thisname")); } require('../main/base.events.php'); $_morecolumns = ""; if( !isset($_id) and $id != '' ) $_id = rand(1, 100000000); $editor_planos = sessionget('form_rect_editor_planos' . $_id); //logToFile('editor_planos: ' . print_r($editor_planos, true)); if( empty($_x) or in('onopen', $_x) ) { if( $id != "" and $id != "0" ) { $editor_planos = loadObject($Link, "planos.editor_planos", $id); } else { $editor_planos = newObject($Link, "planos.editor_planos"); //fillobjectfromrequest($editor_planos); } } if( isormObject($editor_planos) ) updateObjectFromRequest($Link, $editor_planos); //makeglobals($editor_planos, array('id', 'editor_planos')); if( isset($_x) ) $_initialvars = arrayExclude(get_defined_vars(), array("_*", "form_*", "s_*", "GLOBALS", "Link", "thisname")); //$_initialvars['editor_planos'] = objectToStructure($editor_planos); if( isormObject($editor_planos) ) $_initialvars = array_merge($_initialvars, objectToStructure($editor_planos)); if( isormObject($editor_planos) ) $editor_planos->makeglobals(); //logToFile('editor_planos after uofr: ' . print_r($editor_planos, true)); // isbasewindow: // PHP Vars while( ($__action == "" or $__action == "executedonopen") and isset($_GET['_x']) and empty($_x) ) { $__row0 = array(); $__row0['__editor_planos__1'] = ($id != "" and $id != "0" ) ? 'form-readonly readonly' : '' ; $__row0['__editor_planos__2'] = ($id == "" ) ? 'listmode' : 'editmode' ; $__row0['__editor_planos__3'] = $_id ; $__row0['__editor_planos__4'] = $id == '0' ? 'Nuevo ' : '' ; $__row0['__editor_planos__5'] = $id > 0 ? ('#' . $id) : '' ; $__row0['__editor_planos__6'] = buildUrlQueryFromGet(array('id' => '0', 'message' => '_delete_', 'errors' => '_delete_')) ; $__row0['__editor_planos__7'] = buildUrlQueryFromGet(array('id' => '_delete_', 'message' => '_delete_', 'errors' => '_delete_')) ; $__row0['__editor_planos__8'] = $s_perfil != 'Superusuario' ? 'display: none !important;' : '' ; $__row0['__editor_planos__9'] = $s_access['modificacion'] ; $__row0['__editor_planos__10'] = buildUrlQueryFromGet(array('id' => '_delete_', 'message' => '_delete_', 'errors' => '_delete_')) ; $__row0['__plano__1'] = $editor_planos->plano->id ; $__row0['__plano__2'] = genSelectOptionsDb($Link, "select id , nombre,tipo,activo from planos order by nombre, tipo, activo", "", "- Seleccionar -"); ; $__row0['__unidad__1'] = $editor_planos->unidad->id ; $__row0['__unidad__2'] = genSelectOptionsDb($Link, "select id , denominacion from Unidades where (emprendimientoId = '" . mysql_escape($proyecto) . "') order by denominacion", "", "- Seleccionar -"); ; $__row0['__x__1'] = $editor_planos->x ; $__row0['__y__1'] = $editor_planos->y ; $__row0['__w__1'] = $editor_planos->w ; $__row0['__h__1'] = $editor_planos->h ; $_result['morevars'] = $__row0; break; } if( has($_x, 'pdf') or has($_x, 'pdfprint') or has($_x, 'pdfprint2') ) { require_once('../include/fpdfreport.php'); $_pdf = new PDF((isset($_orientation) ? $_orientation : 'P'),'pt', (isset($_size) ? $_size : 'A4' )); $_pdf->initialPage = ($_page != '' ? $_page : 1); //$_pdf->SetAutoPageBreak(true); $_pdf->title = ""; $_pdf->SetTopMargin(50); $_pdf->AliasNbPages(); $_pdf->AddPage(); } if( has($_x, 'pdf') or has($_x, 'pdfprint') or has($_x, 'pdfprint2') ) { $_pdf->title = "Editor de planos "; //$_pdf->drawText("Editor de planos ",'Arial','',14); } if( has($_x, 'editor_planos_list') ) { if( $_reorder != '' ) { $_changes = split('/', $_reorder); foreach($_changes as $_change) { $_change0 = split('-', $_change); $_id = $_change0[0]; $_position = $_change0[1]; $_table = 'rect'; sqlexec($Link, "update $_table set position = $_position where id = $_id"); } } //logToFile('[editor_planos_list] ' . print_r($_REQUEST, true) ); $q = $search['value']; $_order = "order by " . ($order[0]['column'] + 1) . " " . $order[0]['dir']; if( $order[0]['column'] == '' ) $_order = $orderby ; if( $start == '' ) $start = 0; if( $length == '' ) $length = 50; else if( $length == '-1' ) $length = 10000; $_additionalfilter = substr(getaccess(getSelfWindow(), 'buscar'), 14); if( trim($_additionalfilter) == '' ) $_additionalfilter = '1 = 1'; if( hasfeature('planos.editor_planos', 'procesos') ) $_morecolumns = ", status"; if( isset($my) and $my == 'mine' ) { if( isset($status) ) $_order = " and (select count(*) from emresp where form = 'planos.editor_planos' and objeto = rect.id and usuario = '$s_idusuario' and estado = '$status') > 0 " . $_order; else $_order = " and (select count(*) from emresp where form = 'planos.editor_planos' and objeto = rect.id and usuario = '$s_idusuario') > 0 " . $_order; } if( isset($status) ) $_result['data'] = sqltotablearray($Link, "select SQL_CALC_FOUND_ROWS rect.id, (select temp.nombre from planos as temp where temp.id = rect.plano) as plano, (select concat(ifnull(temp.denominacion, '')) from Unidades as temp where temp.id = rect.unidad) as unidad, rect.x, rect.y, rect.w, rect.h $_morecolumns from rect where ($_additionalfilter) and (rect.status = '" . mysql_escape($status) . "') and ((select denominacion from Unidades where id = rect.unidad) like '%" . mysql_escape($q) . "%') and ((rect.plano = '" . mysql_escape($plano_filter) . "' or '" . mysql_escape($plano_filter) . "' = '' or '" . mysql_escape($plano_filter) . "' = 'null')) $_order limit $start, $length"); else $_result['data'] = sqltotablearray($Link, "select SQL_CALC_FOUND_ROWS rect.id, (select temp.nombre from planos as temp where temp.id = rect.plano) as plano, (select concat(ifnull(temp.denominacion, '')) from Unidades as temp where temp.id = rect.unidad) as unidad, rect.x, rect.y, rect.w, rect.h $_morecolumns from rect where ($_additionalfilter) and ((select denominacion from Unidades where id = rect.unidad) like '%" . mysql_escape($q) . "%') and ((rect.plano = '" . mysql_escape($plano_filter) . "' or '" . mysql_escape($plano_filter) . "' = '' or '" . mysql_escape($plano_filter) . "' = 'null')) $_order limit $start, $length"); $_result['draw'] = 0; $_result['recordsTotal'] = sqlget($Link, "select found_rows()"); $_result['recordsFiltered'] = $_result['recordsTotal']; //sizeof($_result['data']); //$_result['recordsFiltered'] = 50; print(json_encode($_result)); disconnectDb($Link); exit(0); } // aca iba session get, uofr y load/saveobject while( has($_x, 'editor_planos_init') ) { $_result['editor_planos'] = $editor_planos->toarray(false); break; } while( has($_x, 'editor_planos') ) { $editor_planos->saveChanges(); //if( $errors == "" ) // validateeditor_planos(); if( $errors == "" ) { //logToFile("BEFORE SAVE: " . objectToHtml($editor_planos)); saveObject($Link, $editor_planos); if( hasfeature('planos.editor_planos', 'procesos') ) { require_once('../include/easyflexa.php'); if( $id == 0 ) setresponsables($editor_planos); controlstatus($editor_planos); } $id = $editor_planos->id; //logToFile(objectToText($editor_planos)); if( $_redirect != "" ) redirect($_redirect); sessionset('form_rect_editor_planos' . $_id, $editor_planos); if( $_result['redirect'] == '' ) redirect("?id=$id"); } break; } while( has($_x, 'editor_planos__delete') ) { //if( $errors == "" ) // validateeditor_planos(); if( $errors == "" ) { //logToFile("BEFORE SAVE: " . objectToHtml($editor_planos)); deleteObject($Link, $editor_planos); //logToFile(objectToText($editor_planos)); if( $_redirect != "" ) redirect($_redirect); sessionset('form_rect_editor_planos' . $_id, null); if( $_result['redirect'] == '' ) { $_result['redirect'] = "?message=Editor de planos eliminado"; } } break; } while( has($_x, 'editor_planos_unload') ) { // Not used sessionclear('form_rect_editor_planos' . $_id); break; } if( has($_x, 'plano_select') ) { list($_result['plano_select'], $_result['plano_columns'], $_result['plano_types']) = sqltoarraydd($Link, "select id , nombre,tipo,activo from planos order by nombre, tipo, activo limit 500"); } if( has($_x, 'unidad_select') ) { list($_result['unidad_select'], $_result['unidad_columns'], $_result['unidad_types']) = sqltoarraydd($Link, "select id , denominacion from Unidades where (emprendimientoId = '" . mysql_escape($proyecto) . "') order by denominacion limit 500"); } sessionset('form_rect_editor_planos' . $_id, $editor_planos); //$editor_planos -> ['changes'] if( isormObject($editor_planos) ) $editor_planos->makeglobals(); if( has($_x, 'pdf') or has($_x, 'pdfprint') or has($_x, 'pdfprint2') ) { $_pdf->Output(); } ?> '); //echo(''); echo(''); ?> class="popup" >
data-toplural="yes" data-editable="title">Editor de planos