Demo

Probiere ClanSphere aus und teste daran herum. Demo

Nopaste Service - events/list.php
Miraculix

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
// ClanSphere 2009 - www.clansphere.net
// $Id$

$cs_lang = cs_translate('events');
$data = array();

$categories_id = empty($_REQUEST['where']) ? 0 : (int) $_REQUEST['where'];
$where = empty($categories_id) ? 0 : "categories_id = '" . $categories_id . "'";

$start = empty($_REQUEST['start']) ? 0 : $_REQUEST['start'];
$cs_sort[1] = 'evs.events_time DESC';
$cs_sort[2] = 'evs.events_time ASC';
$cs_sort[3] = 'evs.events_name DESC';
$cs_sort[4] = 'evs.events_name ASC';
$sort = empty($_REQUEST['sort']) ? 1 : $_REQUEST['sort'];
$order = $cs_sort[$sort];

$count_all = cs_sql_count(__FILE__,'events',$where);

$data['head']['pages'] = cs_pages('events','list',$count_all,$start,$categories_id,$sort);

$cells = 'evs.events_name AS events_name, evs.events_pictures AS events_flyer, evs.events_url AS events_url, evs.events_time AS events_time, evs.events_venue AS events_venue, evs.events_cancel AS events_cancel';
$tables = 'events evs INNER JOIN {pre}_categories cat ON evs.categories_id = cat.categories_id';
$cond = 'evs.events_time > \'' . cs_time() . '\'';
$data['events_upcoming'] = cs_sql_select(__FILE__,$tables,$cells,$cond,$order,$start,$account['users_limit']);
$events_count = count($data['events_upcoming']);

$path = empty($cs_main['mod_rewrite']) ? '' : 'http://' . $_SERVER['HTTP_HOST'] . str_replace('index.php','',$_SERVER['PHP_SELF']);

for ($u = 0; $u < $events_count; $u++) {
  $data['events_upcoming'][$u]['time'] = cs_date('unix',$data['events_upcoming'][$u]['events_time'],0,1);
  $data['events_upcoming'][$u]['url'] = cs_secure($data['events_upcoming'][$u]['events_url']);
  $data['events_upcoming'][$u]['if']['cancel'] = $data['events_upcoming'][$u]['events_cancel'] == 0 ? FALSE : TRUE;
  $data['events_upcoming'][$u]['if']['pics'] = !empty($data['events_upcoming'][$u]['events_url']) ? TRUE : FALSE;
  $data['events_upcoming'][$u]['flyer'] = cs_secure('uploads/events/picture-' . $data['events_upcoming'][$u]['events_flyer']);
  $data['events_upcoming'][$u]['if']['flyer'] = !empty($data['events_upcoming'][$u]['events_flyer']) ? TRUE : FALSE;
}

$cells2 = 'evs.events_time AS events_time';
$tables2 = 'events evs INNER JOIN {pre}_categories cat ON evs.categories_id = cat.categories_id';
$cond2 = 'evs.events_time <= \'' . cs_time() . '\'';
$years = cs_sql_select(__FILE__,$tables2,$cells2,$cond2,$order,$start,$account['users_limit']);

$index = count($years) - 1;
$year_start = date('Y', $years[$index]['events_time']);
$count = date('Y', $years[0]['events_time']);
$years_count = $count - $year_start;

for($run = 0; $run <= $years_count; $run++) {
  $cells2 = 'evs.events_name AS events_name, evs.events_pictures AS events_flyer, evs.events_url AS events_url, evs.events_time AS events_time, evs.events_venue AS events_venue, evs.events_cancel AS events_cancel';
  $tables2 = 'events evs INNER JOIN {pre}_categories cat ON evs.categories_id = cat.categories_id';
  $min = cs_datereal('U',mktime(0,0,0,1,1,$count));
  $max = cs_datereal('U',mktime(23,59,59,12,31,$count));
  $between = "evs.events_time >= '" . $min . "' AND evs.events_time <= '" . $max . "'";
  $data['years'][$run]['events'] = cs_sql_select(__FILE__,$tables2,$cells2,$between,$order,$start,$account['users_limit']);
  $events_count2 = count($data['years'][$run]['events']);
  
  if(is_array($data['years'][$run]['events'])) {
    $data['years'][$run]['if']['year_event'] = TRUE;
    $data['years'][$run]['year'] = cs_secure($count);
    for ($i = 0; $i < $events_count2; $i++) {
      $data['years'][$run]['events'][$i]['time'] = cs_date('unix',$data['years'][$run]['events'][$i]['events_time'],0,1);
      $data['years'][$run]['events'][$i]['url'] = cs_secure($data['years'][$run]['events'][$i]['events_url']);
      $data['years'][$run]['events'][$i]['if']['cancel'] = $data['years'][$run]['events'][$i]['events_cancel'] == 0 ? FALSE : TRUE;
      $data['years'][$run]['events'][$i]['if']['pics'] = !empty($data['years'][$run]['events'][$i]['events_url']) ? TRUE : FALSE;
      $data['years'][$run]['events'][$i]['flyer'] = cs_secure('uploads/events/picture-' . $data['years'][$run]['events'][$i]['events_flyer']);
      $data['years'][$run]['events'][$i]['if']['flyer'] = !empty($data['years'][$run]['events'][$i]['events_flyer']) ? TRUE : FALSE; 
    }
  }
  else {
    $data['years'][$run]['if']['year_event'] = FALSE;
  }
  
  $count--;
}

echo cs_subtemplate(__FILE__, $data, 'events');