summaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authorDominique Martinet <asmadeus@codewreck.org>2015-05-24 17:58:04 +0200
committerDominique Martinet <asmadeus@codewreck.org>2015-11-08 14:27:59 +0100
commit4e981a14177ae6efc7caf83949c3cb55432b118e (patch)
tree9f893d3ebcb355e03f1e957ad3e05753be7cb2e6 /admin
parentfa9590837823e1a7a5dd739b079005788f9f35a2 (diff)
bonus: add list of all bonuses for admin and update individual pages to display
Diffstat (limited to 'admin')
-rw-r--r--admin/index.php6
-rw-r--r--admin/listbonus.php59
2 files changed, 64 insertions, 1 deletions
diff --git a/admin/index.php b/admin/index.php
index 0f84580..44d9411 100644
--- a/admin/index.php
+++ b/admin/index.php
@@ -626,7 +626,11 @@ else
0 => $user->lang['styles'],
1 => array('link' => 'admin/styles.php' . $SID . '&amp;mode=create', 'text' => $user->lang['create'], 'check' => 'a_styles_man'),
2 => array('link' => 'admin/styles.php' . $SID, 'text' => $user->lang['manage'], 'check' => 'a_styles_man')
- )
+ ),
+ 'bonus' => array(
+ 0 => "Bonus",
+ 1 => array('link' => 'admin/listbonus.php' . $SID, 'text' => $user->lang['list'], 'check' => 'a_raid_add')
+ ),
);
// Now get plugin hooks for the menu
diff --git a/admin/listbonus.php b/admin/listbonus.php
new file mode 100644
index 0000000..fc15868
--- /dev/null
+++ b/admin/listbonus.php
@@ -0,0 +1,59 @@
+<?php
+/******************************
+ * EQdkp
+ * Licensed under WTFPLv2
+ * ------------------
+ * listbonus.php
+ * Began: Fri May 08 2015
+ *
+ ******************************/
+
+define('EQDKP_INC', true);
+define('IN_ADMIN', true);
+$eqdkp_root_path = './../';
+include_once($eqdkp_root_path . 'common.php');
+
+$user->check_auth('a_raid_add');
+
+$total_bonus = $db->query_first('SELECT count(*) FROM ' . BONUS_TABLE);
+
+$start = ( isset($_GET['start']) ) ? $_GET['start'] : 0;
+
+$sql = 'SELECT bonus_date, bonus_value, member_name
+ FROM ' . BONUS_TABLE . '
+ ORDER BY bonus_date desc,member_name
+ LIMIT '.$start.','.$user->data['user_rlimit'];
+
+if ( !($bonus_result = $db->query($sql)) )
+{
+ message_die('Could not obtain bonus information', '', __FILE__, __LINE__, $sql);
+}
+while ( $row = $db->fetch_record($bonus_result) )
+{
+ $tpl->assign_block_vars('bonus_row', array(
+ 'ROW_CLASS' => $eqdkp->switch_row_class(),
+ 'DATE' => ( !empty($row['bonus_date']) ) ? date($user->style['date_notime_short'], $row['bonus_date']) : '&nbsp;',
+ 'NAME' => stripslashes($row['member_name']),
+ 'VALUE' => $row['bonus_value'])
+ );
+}
+
+$tpl->assign_vars(array(
+ 'L_DATE' => $user->lang['date'],
+ 'L_NAME' => $user->lang['name'],
+ 'L_NOTE' => $user->lang['note'],
+ 'L_VALUE' => $user->lang['value'],
+
+ 'U_VIEW_MEMBER' => '../viewmember.php'.$SID.'&amp;name=',
+
+ 'START' => $start,
+ 'LISTBONUS_FOOTCOUNT' => sprintf('... found %d bonus / %d per page', $total_bonus, $user->data['user_rlimit']),
+ 'BONUS_PAGINATION' => generate_pagination('listbonus.php'.$SID, $total_bonus, $user->data['user_rlimit'], $start))
+);
+
+$eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['admin_title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': Bonus Listing',
+ 'template_file' => 'listbonus.html',
+ 'display' => true)
+);
+?>