-
Notifications
You must be signed in to change notification settings - Fork 4
/
e_list.php
112 lines (98 loc) · 2.91 KB
/
e_list.php
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php
/*
* e107 website system
*
* Copyright (C) 2008-2013 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Calendar e_list Handler
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/calendar_menu/e_list.php,v $
* $Revision$
* $Date$
* $Author$
*
*/
/**
* e107 Event calendar plugin
*
* Calendar e_list Handler
*
* @package e107_plugins
* @subpackage event_calendar
* @version $Id$;
*/
if (!defined('e107_INIT')) { exit; }
class list_calendar_menu
{
function list_calendar_menu($parent)
{
$this->parent = $parent;
}
function getListData()
{
$list_caption = $this->parent->settings['caption'];
$list_display = ($this->parent->settings['open'] ? "" : "none");
require_once('ecal_class.php');
$ecal_class = new ecal_class;
$current_day = $ecal_class->cal_date['mday'];
$current_month = $ecal_class->cal_date['mon'];
$current_year = $ecal_class->cal_date['year'];
$current = mktime(0,0,0,$current_month, $current_day, $current_year);
if($this->parent->mode == "new_page" || $this->parent->mode == "new_menu" )
{
$lvisit = $this->parent->getlvisit();
$qry = " event_datestamp>".intval($lvisit)." AND ";
}
else
{
$qry = "";
}
$bullet = $this->parent->getBullet($this->parent->settings['icon']);
$qry = "
SELECT e.*, c.event_cat_name
FROM #event AS e
LEFT JOIN #event_cat AS c ON c.event_cat_id = e.event_category
WHERE ".$qry." e.event_start>='$current' AND c.event_cat_class REGEXP '".e_CLASS_REGEXP."'
ORDER BY e.event_start ASC LIMIT 0,".intval($this->parent->settings['amount']);
if(!$event_items = $this->parent->e107->sql->db_Select_gen($qry))
{
$list_data = LIST_CALENDAR_2;
}
else
{
while($row = $this->parent->e107->sql->db_Fetch())
{
$record = array();
$tmp = explode(".", $row['event_author']);
if($tmp[0] == "0")
{
$record['author'] = $tmp[1];
}
elseif(is_numeric($tmp[0]) && $tmp[0] != "0")
{
$record['author'] = (USER ? "<a href='".e_BASE."user.php?id.".$tmp[0]."'>".$tmp[1]."</a>" : $tmp[1]);
}
else
{
$record['author'] = "";
}
$rowheading = $this->parent->parse_heading($row['event_title']);
$record['icon'] = $bullet;
$record['heading'] = "<a href='".e_PLUGIN."calendar_menu/event.php?".$row['event_start'].".event.".$row['event_id']."'>".$rowheading."</a>";
$record['category'] = $row['event_cat_name'];
$record['date'] = ($this->parent->settings['date'] ? ($row['event_start'] ? $this->parent->getListDate($row['event_start']) : "") : "");
$record['info'] = '';
$list_data[] = $record;
}
}
//return array with 'records', (global)'caption', 'display'
return array(
'records'=>$list_data,
'caption'=>$list_caption,
'display'=>$list_display
);
}
}
?>