static function construye($posts, $temas, $avisos) { $post = $posts[0]; require_once 'libs/Scriptlets.php'; $titulo = "Modificacion de este Post"; $ruta = DIR_RAIZ_APP . INDEX; // recibe una lista de avisos de errores en la lógica de negocio en formato csv (con #) // la conviete a array y la "pinta" if (!empty($avisos)) { $avisos = explode('#', $avisos); } else { $avisos = array(); } $listaAvisos = Scriptlets::generaListaMensajes($avisos); $contenido = <<<CONT <h1>{$titulo}</h1> \t <div id="avisos" style="color:red">{$listaAvisos}</div> <form action="{$ruta}post/modificaPost"> <!-- <label for="fecha">Fecha</label> <input type="text" name="fecha" /><br /> --> \t <input type="hidden" name="fecha" id="fecha" value="{$post->devuelveFecha()}" /> \t\t<label for="titulo">Título</label> <input type="text" name="titulo" id="titulo" value="{$post->devuelveTitulo()}" /><br /></br> \t <label for="cuerpo">Cuerpo</label> <textarea name="cuerpo" id="cuerpo">{$post->devuelveCuerpo()}</textarea><br /></br> \t\t<label for = "tema">Tema</label> \t\t <input type="hidden" name="id" id="id" value="{$post->devuelveId()}" /> \t\t CONT; $contenido .= Scriptlets::generaSelectConPost("temas", $temas, $post) . '</br></br>'; $contenido .= <<<CONT \t\t <input type="submit" /> </form> <script> document.getElementById("titulo").focus(); \t fecha = new Date(); \t\tdia = '' + fecha.getDate(); \t\tmes = '' + (fecha.getMonth() + 1); // los meses van de 0 a 11 \t\tanio = '' + fecha.getFullYear(); \t\tif (dia.length == 1) dia = '0' + dia; \t\tif (mes.length == 1) mes = '0' + mes; \t\tfechaFormateada = anio + '-' + mes + '-' + dia; \t document.getElementById('fecha').value = fechaFormateada; // document.write(fechaFormateada);\t\t </script> CONT; return $contenido; }