Showing with 566 additions and 260 deletions.
  1. +33 −0 assets/css/main.css
  2. +118 −100 calendar.php
  3. +74 −0 forge/events/events-map-generator.php
  4. +10 −132 forge/map-generator/map-generator.php
  5. +104 −4 images/icon.svg
  6. BIN images/past_events.png
  7. +12 −0 index.php
  8. +16 −0 js/calendar.js
  9. +4 −3 js/mappa.js
  10. +195 −21 varie.php
33 changes: 33 additions & 0 deletions assets/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -408,10 +408,43 @@ fieldset {
border-radius: 20px;
}

.calendar_toggler {
margin: auto;
margin-bottom: 20px;
text-align: center;
}

.calendar_style_toggle {
display: inline;
padding: 10px;
width: 100px;
font-size: 20px;
cursor: hand;
cursor: pointer;
font-family: Georgia,"Times New Roman",Times,serif;
}

.calendar_style_toggle_selected {
background-color: #F0F0F0;
}

.calendar_map_tab {
height: 65%;
}

.calendar_map_legend img {
display: inline;
}

.calendar_top {
margin-top: 50px;
width: 100%;
}

.calendar_top caption {
border-bottom: 1px solid #000;
}

.calendar_top td {
vertical-align: top;
text-align: center;
Expand Down
218 changes: 118 additions & 100 deletions calendar.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

require_once ('varie.php');
do_head ('Eventi Linux in Italia', array ('js/calendar.js'));
do_head ('Eventi Linux in Italia', array ('js/calendar.js', 'http://openlayers.org/api/OpenLayers.js', 'js/mappa.js'));

?>

Expand All @@ -16,150 +16,168 @@
</div>
</div>

<?php
<div class="calendar_toggler">
<p id="calendar_map_toggle" class="calendar_style_toggle calendar_style_toggle_selected">Mappa</p>
<p id="calendar_table_toggle" class="calendar_style_toggle">Calendario</p>
</div>

<div class="calendar_map_tab">
<input type="hidden" name="default_zoom" value="5" />
<input type="hidden" name="coords_file" value="forge/events/geoevents.txt" />
<div id="map" class="smallmap"></div>

<p class="calendar_map_legend">
<img alt="Evento passati" src="http://lugmap.it/images/past_events.png" />&nbsp;Evento occorso nell'ultimo mese <img alt="Prossimo evento" src="http://lugmap.it/images/icon.png" />&nbsp;Prossimo evento
</p>
</div>

<div class="calendar_table_tab">
<?php

$month_names = array ('Gennaio', 'Febbraio', 'Marzo', 'Aprile', 'Maggio', 'Giugno',
'Luglio', 'Agosto', 'Settembre', 'Ottobre', 'Novembre', 'Dicembre');

$month_names = array ('Gennaio', 'Febbraio', 'Marzo', 'Aprile', 'Maggio', 'Giugno',
'Luglio', 'Agosto', 'Settembre', 'Ottobre', 'Novembre', 'Dicembre');
$current_month = date ('m');
$current_day = date ('d');
$year = date ('Y');
$month = date ('m', strtotime ('-2 month'));

$current_month = date ('m');
$current_day = date ('d');
$year = date ('Y');
$month = date ('m', strtotime ('-4 month'));
if ($month > $current_month)
$year = $year - 1;

if ($month > $current_month)
$year = $year - 1;
$events = file ("forge/events/$year.txt", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);

$events = file ("forge/events/$year.txt", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
for ($events_index = 0; $events_index < count ($events); $events_index++) {
$row = $events [$events_index];
list ($date, $useless) = explode ('|', $row);
list ($d, $m) = explode ('/', $date);

if ($m < $month) {
$events_index--;
break;
}
}

for ($events_index = 0; $events_index < count ($events); $events_index++) {
$row = $events [$events_index];
list ($date, $useless) = explode ('|', $row);
list ($date, $useless, $location, $what, $url) = explode ('|', $row);
list ($d, $m) = explode ('/', $date);
$events_index--;

if ($m < $month) {
$events_index--;
break;
}
}
/*
Data all'americana: mese/giorno/anno
Non ho voglia di gestire le locale...
*/
$start_day = date ('N', strtotime ("$month/1/$year"));

$row = $events [$events_index];
list ($date, $useless, $location, $what, $url) = explode ('|', $row);
list ($d, $m) = explode ('/', $date);
$eof = false;

/*
Data all'americana: mese/giorno/anno
Non ho voglia di gestire le locale...
*/
$start_day = date ('N', strtotime ("$month/1/$year"));
?>

$eof = false;
<table class="calendar_top">
<tr>

?>
<?php

<table class="calendar_top">
<tr>
for ($i = 0; $i < 4; $i++) {
if ($i % 2 == 0) {
?>

<?php
</tr><tr>

<?php
}

for ($i = 0; $i < 9; $i++) {
if ($i % 3 == 0) {
?>

</tr><tr>
<td>
<table class="calendar_month">
<caption><?php echo $month_names [$month - 1] ?></caption>

<?php
}
<tr>
<?php

?>
for ($a = 1; $a < $start_day; $a++) {
?>
<td>&nbsp;</td>
<?php
}

<td>
<table class="calendar_month">
<caption><?php echo $month_names [$month - 1] ?></caption>
for ($e = 0; $e < cal_days_in_month (CAL_GREGORIAN, $month, $year); $e++, $a++) {
if ($a == 8) {
$a = 1;

<tr>
<?php
?></tr><tr><?php
}

for ($a = 1; $a < $start_day; $a++) {
?>
<td>&nbsp;</td>
<?php
}
$this_day = $e + 1;

for ($e = 0; $e < cal_days_in_month (CAL_GREGORIAN, $month, $year); $e++, $a++) {
if ($a == 8) {
$a = 1;
$td_class = array ('day_cell');
$contents = '';

?></tr><tr><?php
}
if ($this_day == $current_day && $month == $current_month)
$td_class [] = 'today';

$this_day = $e + 1;
if ($eof == false && $this_day == $d && $m == $month) {
$day_id = "${this_day}_${month}_" . rand ();
$td_class [] = 'marked';
array_unshift ($td_class, $day_id);
$contents = '<div class="day_dialog" id="' . $day_id . '">';

$td_class = array ('day_cell');
$contents = '';
do {
$contents .= "<p>$location: <a href=\"$url\">$what</a></p>";

if ($this_day == $current_day && $month == $current_month)
$td_class [] = 'today';
if ($events_index == -1) {
$eof = true;
break;
}

if ($eof == false && $this_day == $d && $m == $month) {
$day_id = "${this_day}_${month}_" . rand ();
$td_class [] = 'marked';
array_unshift ($td_class, $day_id);
$contents = '<div class="day_dialog" id="' . $day_id . '">';
$row = $events [$events_index];
list ($date, $useless, $location, $what, $url) = explode ('|', $row);
list ($d, $m) = explode ('/', $date);
$events_index--;
} while ($this_day == $d && $m == $month);

do {
$contents .= "<p>$location: <a href=\"$url\">$what</a></p>";
$contents .= '</div>';
}

if ($events_index == -1) {
$eof = true;
break;
}
?>

$row = $events [$events_index];
list ($date, $useless, $location, $what, $url) = explode ('|', $row);
list ($d, $m) = explode ('/', $date);
$events_index--;
} while ($this_day == $d && $m == $month);
<td class="<?php echo join (' ', $td_class) ?>"><?php echo $this_day ?><?php echo $contents ?></td>

$contents .= '</div>';
<?php
}

?>
</table>

<td class="<?php echo join (' ', $td_class) ?>"><?php echo $this_day ?><?php echo $contents ?></td>
<?php

<?php
}

?>
</table>

<?php

$month += 1;
$start_day = $a;
$month += 1;
$start_day = $a;

if ($month == 13) {
$month = 1;
$year++;
if ($month == 13) {
$month = 1;
$year++;

unset ($events);
$events = file ("forge/events/$year.txt", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
$events_index = count ($events) - 1;
unset ($events);
$events = file ("forge/events/$year.txt", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
$events_index = count ($events) - 1;

$row = $events [$events_index];
list ($date, $useless) = explode ('|', $row);
list ($d, $m) = explode ('/', $date);
$row = $events [$events_index];
list ($date, $useless) = explode ('|', $row);
list ($d, $m) = explode ('/', $date);

$eof = false;
$eof = false;
}
}
}

?>
?>

</td>
</td>

</tr>
</table>
</tr>
</table>
</div>

<?php
do_foot ();
Expand Down
74 changes: 74 additions & 0 deletions forge/events/events-map-generator.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?php

require_once ('../../varie.php');

init_geocache ();
global $geocache;

$current_year = date ('Y');
$current_month = date ('m');
$current_day = date ('d');

$year = $current_year;
$month = date ('m', strtotime ('-1 month'));
$day = date ('d', strtotime ('-1 month'));

if ($month > $current_month)
$year = $year - 1;

$events = file ("$year.txt", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);

for ($events_index = 0; $events_index < count ($events); $events_index++) {
$row = $events [$events_index];
list ($date, $useless) = explode ('|', $row);
list ($d, $m) = explode ('/', $date);

if ($m < $month || ($m == $month && $d < $day)) {
$events_index--;
break;
}
}

$found_cities = array ();
$icon = "past_events.png";
$rows = array ("lat\tlon\ttitle\tdescription\ticonSize\ticonOffset\ticon");

while (true) {
$row = $events [$events_index];
list ($date, $useless, $location, $what, $url) = explode ('|', $row);
list ($d, $m) = explode ('/', $date);

$c = str_replace (' ', '%20', $location);

$result = ask_coordinates ($c);
if ($result == null)
continue;

list ($lat, $lon) = $result;
$lon = shift_city ($city, $lon, $found_cities);
$found_cities [] = $location;

if (($d > $current_day && $m == $current_month && $year == $current_year) || ($m > $current_month && $year == $current_year) || ($year > $current_year))
$icon = "icon.png";

$rows [] = "$lat\t$lon\t$d/$m\t<a href=\"$url\">$what</a>\t16,19\t-8,-19\thttp://lugmap.it/images/$icon";

$events_index--;

if ($events_index == -1) {
$year++;

if (file_exists ("$year.txt"))
$events = file ("$year.txt", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
else
break;

$events_index = count ($events) - 1;
}
}

write_geo_file ('geoevents.txt', $rows);
save_geocache ();

?>

Loading