summaryrefslogtreecommitdiffstats
path: root/listevents.php
blob: b0572f1a94dd121dd86837a75a94edd84f4f310d (plain)
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
<?php
/******************************
 * EQdkp
 * Copyright 2002-2003
 * Licensed under the GNU GPL.  See COPYING for full terms.
 * ------------------
 * listevents.php
 * Began: Fri December 20 2002
 *
 * $Id: listevents.php 4 2006-05-08 17:01:47Z tsigo $
 *
 ******************************/

define('EQDKP_INC', true);
$eqdkp_root_path = './';
include_once($eqdkp_root_path . 'common.php');

$user->check_auth('u_event_list');

$sort_order = array(
    0 => array('event_name', 'event_name desc'),
    1 => array('event_value desc', 'event_value')
);

$current_order = switch_order($sort_order);

$total_events = $db->query_first('SELECT count(*) FROM ' . EVENTS_TABLE);

$start = ( isset($_GET['start']) ) ? $_GET['start'] : 0;

$sql = 'SELECT event_id, event_name, event_value
        FROM ' . EVENTS_TABLE . '
        ORDER BY '.$current_order['sql']. '
        LIMIT '.$start.','.$user->data['user_elimit'];

if ( !($events_result = $db->query($sql)) )
{
    message_die('Could not obtain event information', '', __FILE__, __LINE__, $sql);
}
while ( $event = $db->fetch_record($events_result) )
{
    $tpl->assign_block_vars('events_row', array(
        'ROW_CLASS' => $eqdkp->switch_row_class(),
        'U_VIEW_EVENT' => 'viewevent.php'.$SID . '&amp;' . URI_EVENT . '='.$event['event_id'],
        'NAME' => stripslashes($event['event_name']),
        'VALUE' => $event['event_value'])
    );
}
$db->free_result($events_result);

$tpl->assign_vars(array(
    'L_NAME' => $user->lang['name'],
    'L_VALUE' => $user->lang['value'],

    'O_NAME' => $current_order['uri'][0],
    'O_VALUE' => $current_order['uri'][1],

    'U_LIST_EVENTS' => 'listevents.php'.$SID.'&amp;',

    'START' => $start,
    'LISTEVENTS_FOOTCOUNT' => sprintf($user->lang['listevents_footcount'], $total_events, $user->data['user_elimit']),
    'EVENT_PAGINATION' => generate_pagination('listevents.php'.$SID.'&amp;o='.$current_order['uri']['current'], $total_events, $user->data['user_elimit'], $start))
);

$eqdkp->set_vars(array(
    'page_title'    => sprintf($user->lang['title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['listevents_title'],
    'template_file' => 'listevents.html',
    'display'       => true)
);
?>