<?php if (isset($_SESSION['tipoUsuario']) and $_SESSION['tipoUsuario'] == 1) { // Administrador $mensaje = ''; $an = new anno(); $an->consultaE('', 'anno'); if (!isset($_POST['enviar'])) { $_POST['enviar'] = ''; } if (!isset($_GET['accion'])) { $_GET['accion'] = ''; } // $nAn=$_SESSION['anno']+1; $nP = 0; $nI = 0; // $nAn=$an->annoUltimo()+1; if ($_SERVER['REQUEST_METHOD'] == "POST") { if ($_POST['enviar'] == 'Nuevo') { if (!$an->existeAnno($_POST['annoHacia']) and $_POST['annoHacia'] != '') { $an->nuevo('', $_POST['annoHacia'], 0); $mensaje = 'Año insertado'; } else { $mensaje = 'No es correcto'; } } $an->consultaE('', 'anno'); } if ($_SERVER['REQUEST_METHOD'] == "GET") { if ($_GET['accion'] == 'B') { if (!$an->referenciaAnno($_GET['anno'])) {
} $pagecontent .= '<h3>New article</h3>' . $redmsg . $greenmsg . ' <form method="post" action="admin.php?action=news&new"> <h4>Title:<h4> <input type="text" size="50" name="title" value="' . $title . '"> <h4>Content:</h4> <div class="large"><textarea name="content" class="large" id="large">' . $content . '</textarea></div> <span class="html">HTML enabled - useful tags: p, a and img.</span> <input type="hidden" name="save" value="yes"> <p><input type="submit" value="Save" size="35"> or <span class="cancel"><a href="admin.php?action=news">cancel</a></span></p> </form>'; } elseif (isset($_GET['del'])) { $pagecontent .= '<h3>Delete Article</h3>'; $news = new anno($sql); $news->id = intval($_GET['del']); if ($news->load()) { if ($news->divid == 0) { if ($sql->query("DELETE FROM wolfvtc_announcements WHERE id=" . intval($_GET['del']))) { $pagecontent .= '<div class="notification green"><p>The article has been deleted.</p></div>'; } else { $pagecontent .= '<div class="notification red"><p>Failed to delete article.</p></div>'; } } else { $pagecontent .= '<div class="notification red"><p>Article does not exist.</p></div>'; } } else { $pagecontent .= '<div class="notification red"><p>Article does not exist.</p></div>'; } $pagecontent .= '<p><span class="cancel"><a href="admin.php?action=news">Back</a></span></p>';
if ($an->anno == $_POST['annoDesde']) { echo 'selected'; } ?> ><?php echo $an->anno; ?> </option> <?php } ?> </select></td> <td align="center"> <select name="annoHasta" > <?php $an = new anno(); $an->consultaE('', 'anno'); for ($i = 0; $i < $an->numFilas; $i++) { $an->siguiente(); ?> <option value="<?php echo $an->anno; ?> " <?php if ($an->anno == $_POST['annoHasta']) { echo 'selected'; } ?> ><?php echo $an->anno; ?>
?> </td> </tr> <tr> <td class="linCuerpo" colspan="2" align="center" valign="top"> <form action="" method="post"> <table class="login" width="300" > <tr class="login" align="center" valign="middle"> <td colspan="2"></td> </tr> <tr> <td align="right" >Año activo: </td> <td> <select name="anno" id="anno"> <?php $an = new anno(); $an->consultaE(); for ($i = 0; $i < $an->numFilas; $i++) { $an->siguiente(); ?> <option value="<?php echo $an->anno; ?> " <?php if ($an->anno == $_SESSION['anno']) { echo 'selected'; } ?> ><?php echo $an->anno; ?>
<?php $mensaje = ''; $an = new anno(); $nAn = $_SESSION['anno'] + 1; $nP = 0; $nI = 0; // $nAn=$an->annoUltimo()+1; if ($_SERVER['REQUEST_METHOD'] == "POST") { if ($_POST['enviar'] == 'Construir') { if (!$an->existeAnno($_POST['annoHacia'])) { $an->nuevo('', $_POST['annoHacia'], 0); $mensaje = 'Año insertado'; $an = new anno(); } else { $mensaje = 'Ya existe'; } } } ?> <table width="300" class="cuerpo"> <tr> <td colspan="2" class="cabCuerpo">Mantenimiento de los años</td> <td colspan="2" align="right"></td> </tr> <form action="" method="post"> <tr> <td align="right">Años</td> <td align="right"><input class="boton" type="submit" name="enviar" value="Nuevo" ></td> <td colspan="2"><input name="annoHacia" type="text" size="4" value="<?php if ($an->anno == '') {