diff options
author | Dominique Martinet <asmadeus@codewreck.org> | 2015-05-24 17:58:04 +0200 |
---|---|---|
committer | Dominique Martinet <asmadeus@codewreck.org> | 2015-11-08 14:27:59 +0100 |
commit | 4e981a14177ae6efc7caf83949c3cb55432b118e (patch) | |
tree | 9f893d3ebcb355e03f1e957ad3e05753be7cb2e6 | |
parent | fa9590837823e1a7a5dd739b079005788f9f35a2 (diff) |
bonus: add list of all bonuses for admin and update individual pages to display
-rw-r--r-- | admin/index.php | 6 | ||||
-rw-r--r-- | admin/listbonus.php | 59 | ||||
-rw-r--r-- | common.php | 1 | ||||
-rw-r--r-- | templates/default/listbonus.html | 29 | ||||
-rw-r--r-- | templates/default/viewmember.html | 26 | ||||
-rw-r--r-- | viewmember.php | 32 |
6 files changed, 149 insertions, 4 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 . '&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']) : ' ',
+ '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.'&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)
+);
+?>
@@ -106,6 +106,7 @@ define('NEWS_TABLE', $table_prefix . 'news'); define('PLUGINS_TABLE', $table_prefix . 'plugins');
define('RAID_ATTENDEES_TABLE', $table_prefix . 'raid_attendees');
define('RAIDS_TABLE', $table_prefix . 'raids');
+define('BONUS_TABLE', $table_prefix . 'bonus');
define('SESSIONS_TABLE', $table_prefix . 'sessions');
define('STYLES_CONFIG_TABLE', $table_prefix . 'style_config');
define('STYLES_TABLE', $table_prefix . 'styles');
diff --git a/templates/default/listbonus.html b/templates/default/listbonus.html new file mode 100644 index 0000000..ee721aa --- /dev/null +++ b/templates/default/listbonus.html @@ -0,0 +1,29 @@ +<!-- INCLUDE page_header.html -->
+<table width="100%" border="0" cellspacing="1" cellpadding="2" class="borderless">
+ <tr>
+ <td align="center" class="menu">{BONUS_PAGINATION}</td>
+ </tr>
+</table>
+<table width="100%" border="0" cellspacing="1" cellpadding="2">
+ <tr>
+ <th align="left" width="70" nowrap="nowrap">{L_DATE}</th>
+ <th align="left" width="100%">{L_NAME}</th>
+ <th align="left" width="60" nowrap="nowrap">{L_VALUE}</th>
+ </tr>
+ <!-- BEGIN bonus_row -->
+ <tr class="{bonus_row.ROW_CLASS}">
+ <td width="70" nowrap="nowrap">{bonus_row.DATE}</td>
+ <td width="100%"><a href="{U_VIEW_MEMBER}{bonus_row.NAME}">{bonus_row.NAME}</a></td>
+ <td width="60" nowrap="nowrap" class="positive" align="right">{bonus_row.VALUE}</td>
+ </tr>
+ <!-- END bonus_row -->
+ <tr>
+ <th colspan="4" class="footer">{LISTBONUS_FOOTCOUNT}</th>
+ </tr>
+</table>
+<table width="100%" border="0" cellspacing="1" cellpadding="2" class="borderless">
+ <tr>
+ <td align="center" class="menu">{BONUS_PAGINATION}</td>
+ </tr>
+</table>
+<!-- INCLUDE page_tail.html -->
diff --git a/templates/default/viewmember.html b/templates/default/viewmember.html index b48f5ea..d35e0cc 100644 --- a/templates/default/viewmember.html +++ b/templates/default/viewmember.html @@ -80,6 +80,30 @@ <br />
<table width="100%" border="0" cellspacing="1" cellpadding="2">
<tr>
+ <th align="center" colspan="5">Bonus History</th>
+ </tr>
+ <tr>
+ <th align="left" width="70" nowrap="nowrap">{L_DATE}</th>
+ <th align="left" width="60" nowrap="nowrap">Value</th>
+ </tr>
+ <!-- BEGIN bonus_row -->
+ <tr class="{bonus_row.ROW_CLASS}">
+ <td width="70" nowrap="nowrap">{bonus_row.DATE}</td>
+ <td width="60" nowrap="nowrap" class="positive">{bonus_row.VALUE}</td>
+ </tr>
+ <!-- END bonus_row -->
+ <tr>
+ <th colspan="5" class="footer">{BONUS_FOOTCOUNT}</th>
+ </tr>
+</table>
+<table width="100%" border="0" cellspacing="1" cellpadding="2" class="borderless">
+ <tr>
+ <td align="center" class="menu">{BONUS_PAGINATION}</td>
+ </tr>
+</table>
+<br />
+<table width="100%" border="0" cellspacing="1" cellpadding="2">
+ <tr>
<th align="center" colspan="3">{L_INDIVIDUAL_ADJUSTMENT_HISTORY}</th>
</tr>
<tr>
@@ -118,4 +142,4 @@ <th colspan="2"> </th>
</tr>
</table>
-<!-- INCLUDE page_tail.html -->
\ No newline at end of file +<!-- INCLUDE page_tail.html -->
diff --git a/viewmember.php b/viewmember.php index 4ce6eee..cbb94f0 100644 --- a/viewmember.php +++ b/viewmember.php @@ -169,6 +169,32 @@ if ( (isset($_GET[URI_NAME])) && (strval($_GET[URI_NAME] != '')) ) $total_purchased_items = $db->query_first('SELECT count(*) FROM ' . ITEMS_TABLE . " WHERE item_buyer='" . $member['member_name'] . "' ORDER BY item_date DESC");
//
+ // Bonus History
+ //
+ $bstart = ( isset($_GET['bstart']) ) ? $_GET['bstart'] : 0;
+
+ $sql = 'SELECT b.bonus_date, b.bonus_value
+ FROM ' . BONUS_TABLE . " b
+ WHERE (b.member_name='" . $member['member_name'] . "')
+ ORDER BY b.bonus_date DESC
+ LIMIT " . $bstart . ',' . $user->data['user_rlimit'];
+ if ( !($bonus_result = $db->query($sql)) )
+ {
+ message_die('Could not obtain bonus information', 'Database error', __FILE__, __LINE__, $sql);
+ }
+ while ( $bonus = $db->fetch_record($bonus_result) )
+ {
+ $tpl->assign_block_vars('bonus_row', array(
+ 'ROW_CLASS' => $eqdkp->switch_row_class(),
+ 'DATE' => ( !empty($bonus['bonus_date']) ) ? date($user->style['date_notime_short'], $bonus['bonus_date']) : ' ',
+ 'VALUE' => $bonus['bonus_value'],
+ ));
+ }
+ $db->free_result($bonus_result);
+
+ $total_bonus = $db->query_first('SELECT count(*) FROM ' . BONUS_TABLE . " WHERE member_name='".$member['member_name']."'");
+
+ //
// Individual Adjustment History
//
$sql = 'SELECT adjustment_value, adjustment_date, adjustment_reason
@@ -311,9 +337,11 @@ if ( (isset($_GET[URI_NAME])) && (strval($_GET[URI_NAME] != '')) ) 'C_RAIDS_LIFETIME' => color_item($percent_of_raids['lifetime'], true),
'RAID_FOOTCOUNT' => sprintf($user->lang['viewmember_raid_footcount'], $total_attended_raids, $user->data['user_rlimit']),
- 'RAID_PAGINATION' => generate_pagination('viewmember.php'.$SID.'&name='.$member['member_name'].'&istart='.$istart, $total_attended_raids, $user->data['user_rlimit'], $rstart, 'rstart'),
+ 'RAID_PAGINATION' => generate_pagination('viewmember.php'.$SID.'&name='.$member['member_name']."&istart=$istart&bstart=$bstart", $total_attended_raids, $user->data['user_rlimit'], $rstart, 'rstart'),
'ITEM_FOOTCOUNT' => sprintf($user->lang['viewmember_item_footcount'], $total_purchased_items, $user->data['user_ilimit']),
- 'ITEM_PAGINATION' => generate_pagination('viewmember.php'.$SID.'&name='.$member['member_name'].'&rstart='.$rstart, $total_purchased_items, $user->data['user_ilimit'], $istart, 'istart'),
+ 'ITEM_PAGINATION' => generate_pagination('viewmember.php'.$SID.'&name='.$member['member_name']."&rstart=$rstart&bstart=$bstart", $total_purchased_items, $user->data['user_ilimit'], $istart, 'istart'),
+ 'BONUS_FOOTCOUNT' => sprintf('... found %d bonus / %d per page', $total_bonus, $user->data['user_rlimit']),
+ 'BONUS_PAGINATION' => generate_pagination('viewmember.php'.$SID.'&name='.$member['member_name']."&rstart=$rstart&istart=$istart", $total_bonus, $user->data['user_rlimit'], $bstart, 'bstart'),
'ADJUSTMENT_FOOTCOUNT' => sprintf($user->lang['viewmember_adjustment_footcount'], $db->num_rows($adjustments_result)),
'U_VIEW_MEMBER' => 'viewmember.php' . $SID . '&' . URI_NAME . '=' . $member['member_name'] . '&')
|