15); $_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); $contenido = sessionget('form_editacontenido_contenido' . $_id); //logToFile('contenido: ' . print_r($contenido, true)); if( empty($_x) or in('onopen', $_x) ) { if( $id != "" and $id != "0" ) { $contenido = loadObject($Link, "contenidos.contenido", $id); } else { $contenido = newObject($Link, "contenidos.contenido"); //fillobjectfromrequest($contenido); } } if( isormObject($contenido) ) updateObjectFromRequest($Link, $contenido); //makeglobals($contenido, array('id', 'contenido')); if( isset($_x) ) $_initialvars = arrayExclude(get_defined_vars(), array("_*", "form_*", "s_*", "GLOBALS", "Link", "thisname")); //$_initialvars['contenido'] = objectToStructure($contenido); if( isormObject($contenido) ) $_initialvars = array_merge($_initialvars, objectToStructure($contenido)); if( isormObject($contenido) ) $contenido->makeglobals(); //logToFile('contenido after uofr: ' . print_r($contenido, true)); // isbasewindow: // PHP Vars while( ($__action == "" or $__action == "executedonopen") and isset($_GET['_x']) and empty($_x) ) { $__row0 = array(); $__row0['__contenido__1'] = ($id != "" and $id != "0" ) ? 'form-readonly readonly' : '' ; $__row0['__contenido__2'] = ($id == "" ) ? 'listmode' : 'editmode' ; $__row0['__contenido__3'] = $_id ; $__row0['__contenido__4'] = $id == '0' ? 'Nuevo ' : '' ; $__row0['__contenido__5'] = $id > 0 ? ('#' . $id) : '' ; $__row0['__contenido__6'] = buildUrlQueryFromGet(array('id' => '0', 'message' => '_delete_', 'errors' => '_delete_')) ; $__row0['__contenido__7'] = buildUrlQueryFromGet(array('id' => '_delete_', 'message' => '_delete_', 'errors' => '_delete_')) ; $__row0['__contenido__8'] = $s_access['modificacion'] ; $__row0['__contenido__9'] = buildUrlQueryFromGet(array('id' => '_delete_', 'message' => '_delete_', 'errors' => '_delete_')) ; $__row0['__titulo__1'] = $contenido->titulo ; $__row0['__icono__1'] = $contenido->icono ; $__row0['__url__1'] = $contenido->url ; $__row0['__contenido__1'] = encodehtml($contenido->contenido) ; $__row0['__form__1'] = $contenido->form ; $_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 = "Contenido"; //$_pdf->drawText("Contenido",'Arial','',14); } if( has($_x, 'contenido_list') ) { if( $_reorder != '' ) { $_changes = split('/', $_reorder); foreach($_changes as $_change) { $_change0 = split('-', $_change); $_id = $_change0[0]; $_position = $_change0[1]; $_table = 'contenidos'; sqlexec($Link, "update $_table set position = $_position where id = $_id"); } } //logToFile('[contenido_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('contenidos.contenido', 'procesos') ) $_morecolumns = ", status"; if( isset($my) and $my == 'mine' ) { if( isset($status) ) $_order = " and (select count(*) from emresp where form = 'contenidos.contenido' and objeto = contenidos.id and usuario = '$s_idusuario' and estado = '$status') > 0 " . $_order; else $_order = " and (select count(*) from emresp where form = 'contenidos.contenido' and objeto = contenidos.id and usuario = '$s_idusuario') > 0 " . $_order; } if( isset($status) ) $_result['data'] = sqltotablearray($Link, "select SQL_CALC_FOUND_ROWS contenidos.id, contenidos.tipo, contenidos.ubicacion, contenidos.titulo, contenidos.url $_morecolumns from contenidos where ($_additionalfilter) and (form = '" . mysql_escape($form) . "') and (contenidos.status = '" . mysql_escape($status) . "') $_order limit $start, $length"); else $_result['data'] = sqltotablearray($Link, "select SQL_CALC_FOUND_ROWS contenidos.id, contenidos.tipo, contenidos.ubicacion, contenidos.titulo, contenidos.url $_morecolumns from contenidos where ($_additionalfilter) and (form = '" . mysql_escape($form) . "') $_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, 'contenido_init') ) { $_result['contenido'] = $contenido->toarray(false); break; } while( has($_x, 'contenido') ) { $contenido->saveChanges(); //if( $errors == "" ) // validatecontenido(); if( $errors == "" ) { //logToFile("BEFORE SAVE: " . objectToHtml($contenido)); saveObject($Link, $contenido); if( hasfeature('contenidos.contenido', 'procesos') ) { require_once('../include/easyflexa.php'); if( $id == 0 ) setresponsables($contenido); controlstatus($contenido); } $id = $contenido->id; //logToFile(objectToText($contenido)); if( $_redirect != "" ) redirect($_redirect); sessionset('form_editacontenido_contenido' . $_id, $contenido); if( $_result['redirect'] == '' ) redirect("?id=$id"); } break; } while( has($_x, 'contenido__delete') ) { //if( $errors == "" ) // validatecontenido(); if( $errors == "" ) { //logToFile("BEFORE SAVE: " . objectToHtml($contenido)); deleteObject($Link, $contenido); //logToFile(objectToText($contenido)); if( $_redirect != "" ) redirect($_redirect); sessionset('form_editacontenido_contenido' . $_id, null); if( $_result['redirect'] == '' ) { $_result['redirect'] = "?message=Contenido eliminado"; } } break; } while( has($_x, 'contenido_unload') ) { // Not used sessionclear('form_editacontenido_contenido' . $_id); break; } if( has($_x, 'section1') ) { } if( has($_x, 'tipo_select') ) { /** * boton,grupo boton,caja,menu,codigo */ $_result['tipo_select'] = [["boton","boton"],["grupo boton","grupo boton"],["caja","caja"],["menu","menu"],["codigo","codigo"]]; } if( has($_x, 'tipo2_select') ) { /** * titulo,subtitulo,derecha,izquierda,barra,pie */ $_result['tipo2_select'] = [["titulo","titulo"],["subtitulo","subtitulo"],["derecha","derecha"],["izquierda","izquierda"],["barra","barra"],["pie","pie"]]; } sessionset('form_editacontenido_contenido' . $_id, $contenido); //$contenido -> ['changes'] if( isormObject($contenido) ) $contenido->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">Contenido