'."\n"; echo ''."\n"; echo ''."\n"; class MyCalendar extends Calendar { var $spanishMonths = array("Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"); var $spanishDays = array ("dom", "lun", "mar", "mié", "jue", "vie", "sáb"); var $dias; var $diasMirados = false; var $SERVER = "localhost"; var $USER = "popes80_popes80"; var $PASSWORD = "opera"; var $DATABASE = "popes80_panelcontrol"; var $TABLE = "agenda"; function MyCalendar(){ $this->setMonthNames($this->spanishMonths); $this->setDayNames($this->spanishDays); $this->setStartDay(1); //Establecemos el inicio de la semana en el lunes } function getMonthName($i){ return $this->spanishMonths[$i-1]; } function getDias($month, $year){ if (!($this->diasMirados)){ $dias1[0] = "0"; $link = mysql_connect($this->SERVER, $this->USER, $this->PASSWORD); mysql_select_db($this->DATABASE, $link); $sql = "SELECT * FROM ".$this->TABLE." WHERE (month=$month) AND (year=$year)"; //echo $sql; $result = mysql_query($sql, $link); $encontrados = mysql_num_rows($result); //echo "encontrados= ".$encontrados; $j=0; while ($row = mysql_fetch_array($result)) { if (!mysql_data_seek ($result, $j)) { printf ("Cannot seek to row %d\n", $j); continue; } if(!($row = mysql_fetch_object ($result))) continue; $dias1[$j] = $row->day; $j++; } mysql_free_result ($result); //print_r($dias1); //echo "
".array_values($dias1); $this->set_dias($dias1); $this->diasMirados = true; } } function set_dias($arrayDias){ $this->dias = $arrayDias; } function getDateLink($day, $month, $year) { if (!$this->diasMirados) $this->getDias($month,$year); $link = ""; //Comprobamos si el día está en el array de días con links del mes. if (in_array ($day,$this->dias)) { $s = getenv('SCRIPT_NAME'); $link = "$s?day=$day&month=$month&year=$year"; } return $link; } function getCalendarLink($month, $year) { // Redisplay the current page, but with some parameters // to set the new month and year $s = getenv('SCRIPT_NAME'); return "$s?month=$month&year=$year"; } function mostrarBuscador(){ echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo '
BUSCADOR

'."\n"; echo '
'."\n"; echo '   
'."\n"; echo '
'."\n"; echo '   '."\n"; echo '
'."\n"; echo ' '."\n"; echo '
CALENDARIO
 
'; } } /********************************************************************************************/ $cal = new MyCalendar(); include("header.php"); echo '
'; echo ''; echo ' '; //echo ' '; echo ' '; echo ' '; echo '
'; //include ("izq.php"); //echo ' '; include("notaagenda.php"); function mostrarResultados($cal, $sql, $buscador, $week){ $link = mysql_connect($cal->SERVER, $cal->USER, $cal->PASSWORD); mysql_select_db($cal->DATABASE, $link); //echo $sql; $result = mysql_query($sql, $link); $encontrados = mysql_num_rows($result); //echo "encontrados= ".$encontrados; echo ''; echo ''; echo '
'; echo ''."\n"; echo ' '."\n"; echo ' '."\n"; echo ' '."\n"; echo ' '."\n"; echo ' '."\n"; echo ' '."\n"; if ($encontrados>0){ echo ' '."\n"; echo ' '."\n"; } echo '
'."\n"; if ($buscador) echo " Resultados de la búsqueda\n"; else{ if ($week != true) echo " ".$_GET['day']. " de " . $cal->getMonthName($_GET['month']) . " de " .$_GET['year']."\n"; else { $temp = $_GET['day'] + 7; $daysInMonth = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); $month = $_GET['month']; if ($temp > $daysInMonth[$month]){ $day1 = $temp - ($daysInMonth[$month-1]); echo " Mostrando del ".$_GET['day']. " de " . $cal->getMonthName($_GET['month']) ." al ".$day1. " de " . $cal->getMonthName($_GET['month']+1) . " de " .$_GET['year']."\n"; } else { //$day += 7; echo " Mostrando del ".$_GET['day']. " al " .$temp." de ".$cal->getMonthName($_GET['month']) . " de " .$_GET['year']."\n"; } } } echo '
'."\n"; echo '
'."\n"; echo ' '."\n"; echo ' '."\n"; echo ' '."\n"; echo ' '."\n"; echo ' '."\n"; echo ' '."\n"; echo ' '."\n"; echo ' '."\n"; echo ' '."\n"; } else echo ' '."\n"; echo ' '."\n"; $j=0; while ($row = mysql_fetch_array($result)) { if (!mysql_data_seek ($result, $j)) { printf ("Cannot seek to row %d\n", $j); continue; } if(!($row = mysql_fetch_object ($result))) continue; echo ' '."\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo ' '."\n"; $j++; } mysql_free_result ($result); if ($encontrados>0){ echo '
FechaArtistaRecintoCiudad+ InfoNo se ha encontrado ninguna actuación para el día seleccionado.
".$row->day."/".$row->month."/".$row->year."".$row->artista."".$row->recinto."".$row->ciudad."+ info
'."\n"; echo '
'."\n"; echo "

Popes80 no se hace responsable de la veracidad de las actuaciones publicadas en esta guía.
\n"; echo '
'; $cal->mostrarBuscador(); echo $cal->getMonthView($_GET['month'], $_GET['year']); echo '
'; } /*if ($month == NULL){ $date = getdate(time()); if ($day == NULL) $day = $date['mday']; $month = $date['mon']; $year = $date['year']; }*/ if (isset($_POST['buscar'])){ $buscar = $_POST['buscar']; $select = $_POST['select']; //echo $buscar."
"; //echo $select."
"; $sql = "SELECT * FROM ".$cal->TABLE." WHERE (".$select." LIKE '%$buscar%') AND (year=$year)"; mostrarResultados($cal, $sql, true, false); } else if ($day != NULL){ if ($week != true){ $sql = "SELECT * FROM ".$cal->TABLE." WHERE (day=$day) AND (month=$month) AND (year=$year)"; mostrarResultados($cal, $sql, false, false); } else { $temp = $day+7; $daysInMonth = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); if ($temp > $daysInMonth[$month-1]){ $day1 = $temp - ($daysInMonth[$month-1]); $sql = "SELECT * FROM ".$cal->TABLE." WHERE ((day BETWEEN $day AND ".$daysInMonth[$month-1].") AND (month=".($month).") AND (year=$year)) UNION SELECT * FROM ".$cal->TABLE." WHERE ((day BETWEEN 1 AND $day1 AND (month=".($month+1).")) AND (year=$year)) order by month,year,day"; } else { //$day += 7; $sql = "SELECT * FROM ".$cal->TABLE." WHERE (day BETWEEN $day AND $temp) AND (month=$month) AND (year=$year) ORDER BY day, month, year"; } //$sql = "SELECT * FROM ".$cal->TABLE." WHERE (day BETWEEN ($day - 7) AND ($day)) AND (month=$month) AND (year=$year) ORDER BY day, month, year"; //echo $sql."
"; mostrarResultados($cal, $sql, false, true); // continue 1; } } else{ echo ''; echo ''; echo '
'; echo ''."\n"; echo ' '."\n"; echo ' '."\n"; echo ' '."\n"; echo ' '."\n"; echo ' '."\n"; echo ' '."\n"; // echo ' '."\n"; echo ' '."\n"; echo '
'."\n"; echo " ". $cal->getMonthName($month) . " de " . $year."\n"; echo '
'."\n"; // echo ' '."\n"; // echo ' '."\n"; echo ' '."\n"; // echo ' '."\n"; // echo '
Seleccione un día en el calendario
'."\n"; // echo '
'."\n"; echo '
'; $cal->mostrarBuscador(); echo $cal->getMonthView($_GET['month'], $_GET['year']); echo '
'; } echo '
'; echo "
\n"; include "../footer_copyright.php"; include "footer2.php"; ?>