require_once('../include/orm.php');
require_once('../include/globals.php');
require_once('../include/util.php');
$_planos_listaplanos_db_connected = $Link == '';
if($_planos_listaplanos_db_connected) $Link = connectDb();
define('DBCONNECTED', 1);
debugstartpage();
if( isset($_x) ) {
//if( $_x != '' ) {
$_x = $_x == '' ? array() : StringTokenize($_x, ",");
$_result = array();
$_result['version'] = array('actual' => 5);
$_result['visibility'] = array();
$_initialvars = arrayExclude(get_defined_vars(), array("_*", "form_*", "s_*", "GLOBALS", "Link", "thisname"));
}
require('../main/base.events.php');
// isbasewindow:
// PHP Vars
while( ($__action == "" or $__action == "executedonopen") and isset($_GET['_x']) and empty($_x) ) {
$__row0 = array();
$__row0['__configuracindeplanos__1'] = $_id ;
$__row0['__configuracindeplanos__2'] = $id == '0' ? 'Nueva ' : '' ;
$_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 = "Configuración de Planos";
//$_pdf->drawText("Configuración de Planos",'Arial','',14);
}
// aca iba session get, uofr y load/saveobject
while( has($_x, 'configuracindeplanos_init') ) {
$_result['configuracindeplanos'] = $configuracindeplanos->toarray(false);
break;
}
while( has($_x, 'configuracindeplanos') ) {
//if( $errors == "" )
// validateconfiguracindeplanos();
if( $errors == "" ) {
if( $_redirect != "" ) redirect($_redirect);
sessionset('form_listaplanos_configuracindeplanos' . $_id, $configuracindeplanos);
if( $_result['redirect'] == '' )
redirect("?id=$id");
}
break;
}
while( has($_x, 'configuracindeplanos__delete') ) {
//if( $errors == "" )
// validateconfiguracindeplanos();
if( $errors == "" ) {
if( $_redirect != "" ) redirect($_redirect);
sessionset('form_listaplanos_configuracindeplanos' . $_id, null);
if( $_result['redirect'] == '' ) {
$_result['redirect'] = "?message=Configuración de Planos eliminada";
}
}
break;
}
while( has($_x, 'configuracindeplanos_unload') ) { // Not used
break;
}
if( has($_x, 'planos') ) {
$_result['planos_table'] = array();
foreach(sqltoarray($Link, "select SQL_CALC_FOUND_ROWS id, nombre
from planos
where emprendimiento = '" . mysql_escape($proyecto) . "'
and tipo = 'Planta'
") as $__row0) {
makeglobals($__row0);
$_result['planos_table'][] = $__row0;
}
}
if( has($_x, 'planos_html') ) {
if( $from == "" ) $from = 0;
$_planos_rows = sqltoarray($Link, "select SQL_CALC_FOUND_ROWS id, nombre
from planos
where emprendimiento = '" . mysql_escape($proyecto) . "'
and tipo = 'Planta'
");
$_planos_total = sqlget($Link, "SELECT FOUND_ROWS()");
foreach($_planos_rows as $_planos_rownumber => $_planos) {
makeglobals($_planos);
?>
data-href="" } ?>
>
$_planos_index = 0;
foreach($_planos as $_planos_name => $_planos_val) {
if( $_planos_name == 'class' or $_planos_name == 'link' ) continue;
?>
|
$_planos_index++; } ?>
}
disconnectDb($Link);
exit(0);
}
if( has($_x, 'planos_list') ) {
if( $from == "" ) $from = 0;
if( $start == "" ) $start = 0;
if( $length == "" or $length < 0 ) $length = 5000;
$_sql = "select SQL_CALC_FOUND_ROWS id, nombre
from planos
where emprendimiento = '" . mysql_escape($proyecto) . "'
and tipo = 'Planta'
limit " . mysql_escape($start) . ", " . mysql_escape($length) . " ";
$_planos_rows = sqltoarray($Link, $_sql);
$_planos_total = sqlget($Link, "SELECT FOUND_ROWS()");
$_result['data'] = array();
$_result['draw'] = 0;
$_result['recordsTotal'] = $_planos_total;
$_result['recordsFiltered'] = $_planos_total;
foreach($_planos_rows as $_planos_rownumber => $_planos) {
$_row = array();
makeglobals($_planos);
$_row = array_values($_planos);
$_result['data'][] = $_row;
}
print(json_encode($_result));
disconnectDb($Link);
exit(0);
}
if( has($_x, 'planos_filterbak') ) {
$_sql = "select SQL_CALC_FOUND_ROWS count(*) as _count, id, nombre
from planos
where emprendimiento = '" . mysql_escape($proyecto) . "'
and tipo = 'Planta' group by $_group";
$_sql = sqladdorderbyifnotpresent( $_sql, "1 asc");
$_planos_rows = sqltoarray($Link, $_sql);
$_planos_total = sqlget($Link, "SELECT FOUND_ROWS()");
$_result['data'] = array();
$_result['draw'] = 0;
$_result['recordsTotal'] = $_planos_total;
$_result['recordsFiltered'] = $_planos_total;
$_result['planos_total'] = $_planos_total;
foreach($_planos_rows as $_planos_rownumber => $_planos) {
$_row = array();
makeglobals($_planos);
$_row['_count'] = $_count;
$_result['data'][] = $_row;
}
print(json_encode($_result));
disconnectDb($Link);
exit(0);
}
if( has($_x, 'planos_filter') ) {
$_sql = "select SQL_CALC_FOUND_ROWS count(*) as _count, id, nombre
from planos
where emprendimiento = '" . mysql_escape($proyecto) . "'
and tipo = 'Planta' group by $_group";
//$_sql = sqladdorderbyifnotpresent( $_sql, "1 desc");
//$_sql = sqladdorderby( $_sql, "_count desc");
$_sql .= " order by _count desc";
$_planos_rows = sqltoarray($Link, $_sql, array($_group - 1 => 'id', 0 => 'badge'));
$_planos_total = sqlget($Link, "SELECT FOUND_ROWS()");
$_result['data'] = array();
$_result['draw'] = 0;
$_result['recordsTotal'] = $_planos_total;
$_result['recordsFiltered'] = $_planos_total;
$_result['planos_total'] = $_planos_total;
$_result['data'] = $_planos_rows;
print(json_encode($_result));
disconnectDb($Link);
exit(0);
}
if( has($_x, 'planos_select') ) {
refresh("planos");
}
//$configuracindeplanos -> ['changes']
if( isormObject($configuracindeplanos) ) $configuracindeplanos->makeglobals();
if( has($_x, 'pdf') or has($_x, 'pdfprint') or has($_x, 'pdfprint2') ) {
$_pdf->Output();
}
?>
if( !isset($_x) ) {
?>
if( isset($_export) ) { ?>
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=listaplanos.xls");
//echo('');
//echo('');
echo('');
?> } else { ?>
require('../main/base.head.php'); ?>
class="popup" } ?>
>