public function buildpage(viewNavigation $Navigation) { global $phpbb_root_path, $phpEx, $user, $template; $u_listevents = append_sid("{$phpbb_root_path}dkp.{$phpEx}", 'page=listevents&guild_id=' . $Navigation->getGuildId()); $navlinks_array = array(array('DKPPAGE' => $user->lang['MENU_EVENTS'], 'U_DKPPAGE' => $u_listevents)); foreach ($navlinks_array as $name) { $template->assign_block_vars('dkpnavlinks', array('DKPPAGE' => $name['DKPPAGE'], 'U_DKPPAGE' => $name['U_DKPPAGE'])); } if (!class_exists('\\bbdkp\\controller\\raids\\Events')) { require "{$phpbb_root_path}includes/bbdkp/controller/raids/Events.{$phpEx}"; } $event = new \bbdkp\controller\raids\Events(); $event->countevents($Navigation->getDkpsysId()); $event->viewlistevents($Navigation->getGuildId()); $template->assign_vars(array('U_LIST_EVENTS' => $u_listevents, 'S_DISPLAY_LISTEVENTS' => true)); $title = $user->lang['EVENTS']; // Output page page_header($title); }
/** * fetch the raid and pass it to the view * @param integer $raid_id * @return \bbdkp\controller\raids\Raids */ public function displayraid($raid_id) { global $db; $this->raid = new \bbdkp\controller\raids\Raids($raid_id); $events = new \bbdkp\controller\raids\Events(); $events->countevents($this->raid->event_dkpid); $events->listevents(0, 'event_name', $this->raid->event_dkpid, 1, false); $this->eventinfo = $events->events; $sort_order = array(0 => array('member_name desc', 'member_name desc'), 1 => array('raid_value', 'raid_value desc'), 2 => array('time_bonus', 'time_bonus desc'), 3 => array('zerosum_bonus', 'zerosum_bonus desc'), 4 => array('raid_decay', 'raid_decay desc'), 5 => array('total desc', 'total desc')); $this->raiddetailorder = $this->switch_order($sort_order); $raiddetail = new \bbdkp\controller\raids\Raiddetail($this->raid->raid_id); $raiddetail->Get($this->raid->raid_id, 0, $this->raiddetailorder['sql']); $this->raiddetail = $raiddetail->raid_details; $raiddetail->GetNonAttendees(); $this->nonattendees = $raiddetail->nonattendees; // loot detail $isort_order = array(0 => array('m.member_name', 'm.member_name desc'), 1 => array('i.item_name', 'item_name desc'), 2 => array('i.item_value ', 'item_value desc')); $this->lootlistorder = $this->switch_order($isort_order, 'ui'); $lootlist = new \bbdkp\controller\loot\Loot(); $this->lootlist = $db->sql_fetchrowset($lootlist->GetAllLoot($this->lootlistorder['sql'], 0, 0, $this->raid->raid_id)); }
/** * acp entrypoint * @param int $id * @param int $mode */ function main($id, $mode) { global $user, $template, $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; $this->tpl_name = 'dkp/acp_' . $mode; switch ($mode) { case 'adddkpsys': $add = isset($_POST['add']) ? true : false; if ($add) { if (!check_form_key('adddkpsys')) { trigger_error('FORM_INVALID'); } $this->dkpsys = new \bbdkp\controller\points\Pool(); $this->dkpsys->dkpsys_name = utf8_normalize_nfc(request_var('dkpsys_name', '', true)); $this->dkpsys->dkpsys_status = request_var('dkpsys_status', 'Y'); $this->dkpsys->dkpsys_default = request_var('dkpsys_default', 'Y'); $this->dkpsys->add(); $success_message = sprintf($user->lang['ADMIN_ADD_DKPSYS_SUCCESS'], $this->dkpsys->dkpsys_name); meta_refresh(1, append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_sys&mode=listdkpsys")); trigger_error($success_message . $this->link); } $template->assign_vars(array('L_TITLE' => $user->lang['ACP_ADDDKPSYS'], 'L_EXPLAIN' => $user->lang['ACP_ADDDKPSYS_EXPLAIN'], 'MSG_NAME_EMPTY' => $user->lang['FV_REQUIRED_NAME'], 'MSG_STATUS_EMPTY' => $user->lang['FV_REQUIRED_STATUS'], 'S_ADD' => true)); add_form_key('adddkpsys'); $this->page_title = 'ACP_ADDDKPSYS'; break; case 'addevent': $update = false; $event_id = request_var(URI_EVENT, 0); $event = new \bbdkp\controller\raids\Events($event_id); $url = append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_sys&mode=editdkpsys&" . URI_DKPSYS . "={$event->dkpsys_id}"); $this->link = '<br /><a href="' . $url . '"><h3>' . $user->lang['RETURN_DKPPOOLINDEX'] . '</h3></a>'; if (isset($event->dkpsys)) { foreach ($event->dkpsys as $pool) { if ($pool['id'] == $event->dkpsys_id) { $a = 1; } $template->assign_block_vars('event_dkpid_row', array('VALUE' => $pool['id'], 'SELECTED' => $pool['id'] == $event->dkpsys_id ? ' selected="selected"' : '', 'OPTION' => $pool['name'])); } } else { trigger_error('ERROR_NOPOOLS', E_USER_WARNING); } $add = isset($_POST['add']) ? true : false; $submit = isset($_POST['update']) ? true : false; $delete = isset($_POST['delete']) ? true : false; $addraid = isset($_POST['newraid']) ? true : false; if ($add || $submit || $addraid) { if (!check_form_key('addevent')) { trigger_error('FORM_INVALID'); } } if ($addraid) { redirect(append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_raid&mode=addraid&" . URI_DKPSYS . '=' . $event->dkpsys_id . '&' . URI_EVENT . '=' . $event->event_id)); } if ($add) { /* if (isset($config['bbdkp_gameworld_version'])) { if (isset($config['bbdkp_gameworld_version'])) { $zone= utf8_normalize_nfc(request_var('zoneevent','', true)); if ($zone != "--") { $event->event_name= $zone; } } } */ $event->dkpsys_id = request_var('event_dkpid', 0); $event->event_name = utf8_normalize_nfc(request_var('event_name', '', true)); $event->event_imagename = utf8_normalize_nfc(request_var('event_image', '', true)); $event->event_color = utf8_normalize_nfc(request_var('event_color', '', true)); $event->event_value = request_var('event_value', 0.0); $event->add(); $url = append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_sys&mode=editdkpsys&" . URI_DKPSYS . "={$event->dkpsys_id}"); $success_message = sprintf($user->lang['ADMIN_ADD_EVENT_SUCCESS'], $event->event_value, $event->event_name); meta_refresh(1, $url); trigger_error($success_message . $this->link); } if ($submit) { // get old event name, value from db $oldevent = new \bbdkp\controller\raids\Events($event_id); $newvent = new \bbdkp\controller\raids\Events($event_id); $newvent->event_name = utf8_normalize_nfc(request_var('event_name', '', true)); if (strlen($newvent->event_name) < 3) { trigger_error($user->lang['ERROR_INVALID_EVENT_PROVIDED'] . $this->link, E_USER_WARNING); } /* if (isset($config['bbdkp_gameworld_version'])) { $zone= utf8_normalize_nfc(request_var('zoneevent','', true)); if ($zone != "--") { $new_event_name = $zone; } } */ $newvent->dkpsys_id = request_var('event_dkpid', ''); $newvent->event_imagename = utf8_normalize_nfc(request_var('event_image', '', true)); $newvent->event_color = utf8_normalize_nfc(request_var('event_color', '', true)); $newvent->event_value = request_var('event_value', 0.0); $newvent->update($oldevent); $success_message = sprintf($user->lang['ADMIN_UPDATE_EVENT_SUCCESS'], $newvent->event_value, $newvent->event_name); unset($newvent); unset($oldevent); meta_refresh(1, $url); trigger_error($success_message . $this->link); } if ($delete) { // give a warning that raids cant be without event if (confirm_box(true)) { $event = new \bbdkp\controller\raids\Events(request_var(URI_EVENT, 0)); $url = request_var('url', ''); $event->delete(); $success_message = sprintf($user->lang['ADMIN_DELETE_EVENT_SUCCESS'], $event->event_value, $event->event_name); meta_refresh(1, $url); trigger_error($success_message); } else { $s_hidden_fields = build_hidden_fields(array('delete' => true, 'event_id' => $event->event_id, 'url' => $url)); $template->assign_vars(array('S_HIDDEN_FIELDS' => $s_hidden_fields)); confirm_box(false, $user->lang['CONFIRM_DELETE_EVENT'], $s_hidden_fields); } } add_form_key('addevent'); $template->assign_vars(array('L_TITLE' => $user->lang['ACP_ADDEVENT'], 'L_EXPLAIN' => $user->lang['ACP_ADDEVENT_EXPLAIN'], 'EVENT_ID' => $event->event_id, 'EVENT_DKPPOOLNAME' => $event->dkpsys_name, 'EVENT_NAME' => $event->event_name, 'S_EVENT_STATUS' => $event->event_status == 1 ? true : false, 'EVENT_VALUE' => $event->event_value, 'EVENT_COLOR' => $event->event_color == '' ? '#FFFFFF' : $event->event_color, 'EVENT_IMAGENAME' => $event->event_imagename, 'IMAGEPATH' => $phpbb_root_path . "images/bbdkp/event_images/" . $event->event_imagename . ".png", 'S_EVENT_IMAGE_EXISTS' => strlen($event->event_imagename) > 1 ? true : false, 'L_DKP_VALUE' => sprintf($user->lang['DKP_VALUE'], $config['bbdkp_dkp_name']), 'MSG_NAME_EMPTY' => $user->lang['FV_REQUIRED_NAME'], 'MSG_VALUE_EMPTY' => $user->lang['FV_REQUIRED_VALUE'], 'S_ADD' => $event->event_id == 0 ? true : false)); break; case 'editdkpsys': //edit Pool name, list events, and add event $submit = (isset($_POST['update']) or isset($_POST['dkpsys_status'])) ? true : false; $dkpsys_id = request_var(URI_DKPSYS, 0); $activate = isset($_POST['deactivate']) ? true : false; $addevent = isset($_POST['addevent']) ? true : false; if ($addevent) { redirect(append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_sys&mode=addevent")); break; } if ($submit) { // update point pool if (!check_form_key('editdkpsys')) { trigger_error('FORM_INVALID'); } $this->dkpsys = new \bbdkp\controller\points\Pool($dkpsys_id); $olddkpsys = new \bbdkp\controller\points\Pool($dkpsys_id); $this->dkpsys->dkpsys_name = utf8_normalize_nfc(request_var('dkpsys_name', '', true)); $this->dkpsys->dkpsys_status = request_var('dkpsys_status', 'Y'); $this->dkpsys->dkpsys_default = request_var('dkpsys_default', 'Y'); $this->dkpsys->update($olddkpsys); unset($olddkpsys); $success_message = sprintf($user->lang['ADMIN_UPDATE_DKPSYS_SUCCESS'], $this->dkpsys->dkpsys_id, $this->dkpsys->dkpsys_name, $this->dkpsys->dkpsys_status); meta_refresh(1, append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_sys&mode=editdkpsys&" . URI_DKPSYS . "={$dkpsys_id}")); trigger_error($success_message . $this->link); } $event = new \bbdkp\controller\raids\Events(); $event->countevents($dkpsys_id); if ($activate) { // all events in this window $all_events = explode(',', request_var('idlist', '')); // all checked events in this window $active_events = request_var('activate_ids', array(0)); //activate selected events $event->activateevents(1, $active_events); //deactivate unselected events $event->activateevents(0, array_diff($all_events, $active_events)); } //show pool $this->dkpsys = new \bbdkp\controller\points\Pool($dkpsys_id); $template->assign_vars(array('DKPSYS_ID' => $this->dkpsys->dkpsys_id, 'L_TITLE' => $user->lang['ACP_ADDDKPSYS'], 'L_EXPLAIN' => $user->lang['ACP_ADDDKPSYS_EXPLAIN'], 'DKPSYS_NAME' => $this->dkpsys->dkpsys_name, 'DKPSYS_STATUS' => $this->dkpsys->dkpsys_status, 'MSG_NAME_EMPTY' => $user->lang['FV_REQUIRED_NAME'], 'MSG_STATUS_EMPTY' => $user->lang['FV_REQUIRED_STATUS'], 'S_ADD' => false)); add_form_key('editdkpsys'); // Event list $sort_order = array(0 => array('event_name', 'dkpsys_name, event_name desc'), 1 => array('event_value desc', 'dkpsys_name, event_value desc'), 2 => array('event_status desc', 'dkpsys_name, event_status, event_name desc'), 3 => array('event_status desc', 'dkpsys_name, event_status, event_name desc')); $current_order = $this->switch_order($sort_order); $start = request_var('start', 0); $event->listevents($start, $current_order['sql'], $dkpsys_id, 0, false); $idlist = array(); if (isset($event->events)) { foreach ($event->events as $id => $listevent) { $template->assign_block_vars('events_row', array('EVENT_ID' => $listevent['event_id'], 'U_VIEW_EVENT' => append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_sys&mode=addevent&" . URI_EVENT . "={$id}"), 'COLOR' => $listevent['event_color'], 'IMAGEPATH' => $phpbb_root_path . "images/bbdkp/event_images/" . $listevent['event_imagename'] . ".png", 'S_EVENT_IMAGE_EXISTS' => strlen($listevent['event_imagename']) > 1 ? true : false, 'S_EVENT_STATUS' => $listevent['event_status'] == 1 ? 'checked="checked" ' : '', 'IMAGENAME' => $listevent['event_imagename'], 'NAME' => $listevent['event_name'], 'VALUE' => $listevent['event_value'])); $idlist[] = $listevent['event_id']; } } $template->assign_vars(array('IDLIST' => implode(",", $idlist), 'L_TITLE' => $user->lang['ACP_LISTEVENTS'], 'L_EXPLAIN' => $user->lang['ACP_LISTEVENTS_EXPLAIN'], 'O_DKPSYS' => $current_order['uri'][0], 'O_NAME' => $current_order['uri'][1], 'O_VALUE' => $current_order['uri'][2], 'START' => $start, 'U_LIST_EVENTS' => append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_sys&mode=editdkpsys&" . URI_DKPSYS . "={$dkpsys_id}"), 'LISTEVENTS_FOOTCOUNT' => sprintf($user->lang['LISTEVENTS_FOOTCOUNT'], $event->total_events, $config['bbdkp_user_elimit']), 'EVENT_PAGINATION' => generate_pagination(append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_sys&mode=editdkpsys&" . URI_DKPSYS . "={$dkpsys_id}&" . URI_ORDER . '=' . $current_order['uri']['current']), $event->total_events, $config['bbdkp_user_elimit'], $start, true))); break; case 'listdkpsys': if (count($this->games) == 0) { trigger_error($user->lang['ERROR_NOGAMES'], E_USER_WARNING); } // list of pools $showadd = isset($_POST['dkpsysadd']) ? true : false; $delete = isset($_GET['delete']) && isset($_GET[URI_DKPSYS]) ? true : false; $submit = isset($_POST['defaultsys']) ? true : false; //pulldown js submit //add new pool if ($showadd) { redirect(append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_sys&mode=adddkpsys")); break; } //user clicked on red button if ($delete) { if (confirm_box(true)) { $this->dkpsys = new \bbdkp\controller\points\Pool(request_var('hidden_dkpsys_id', 0)); $this->dkpsys->delete(); $success_message = sprintf($user->lang['ADMIN_DELETE_DKPSYS_SUCCESS'], $this->dkpsys->dkpsys_name); trigger_error($success_message . $this->link); } else { $s_hidden_fields = build_hidden_fields(array('delete' => true, 'hidden_dkpsys_id' => request_var(URI_DKPSYS, 0))); $template->assign_vars(array('S_HIDDEN_FIELDS' => $s_hidden_fields)); confirm_box(false, $user->lang['CONFIRM_DELETE_DKPSYS'], $s_hidden_fields); } } // DEFAULT DKPSYS submit buttonhandler if ($submit) { $this->dkpsys = new \bbdkp\controller\points\Pool(request_var('defaultsys', 0)); $olddkpsys = new \bbdkp\controller\points\Pool(request_var('defaultsys', 0)); $this->dkpsys->dkpsys_default = 'Y'; $this->dkpsys->update($olddkpsys); unset($olddkpsys); $success_message = sprintf($user->lang['ADMIN_DEFAULTPOOL_SUCCESS'], $this->dkpsys->dkpsys_name); meta_refresh(1, append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_sys&mode=listdkpsys")); trigger_error($success_message . $this->link); } // template $this->dkpsys = new \bbdkp\controller\points\Pool(); $listpools = $this->dkpsys->listpools(); foreach ($listpools as $dkpsys_id => $pool) { $template->assign_block_vars('dkpsysdef_row', array('VALUE' => $dkpsys_id, 'SELECTED' => 'Y' == $pool['dkpsys_default'] ? ' selected="selected"' : '', 'OPTION' => $pool['dkpsys_name'])); } $sort_order = array(0 => array('dkpsys_name', 'dkpsys_name desc'), 1 => array('dkpsys_id desc', 'dkpsys_id')); $current_order = $this->switch_order($sort_order); $start = request_var('start', 0); $listpools = $this->dkpsys->listpools($current_order['sql'], $start, 1); foreach ($listpools as $dkpsys_id => $pool) { $template->assign_block_vars('dkpsys_row', array('U_VIEW_DKPSYS' => append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_sys&mode=editdkpsys&" . URI_DKPSYS . "={$dkpsys_id}"), 'U_DELETE_DKPSYS' => append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_sys&mode=listdkpsys&delete=1&" . URI_DKPSYS . "={$dkpsys_id}"), 'ID' => $pool['dkpsys_id'], 'NUMEVENTS' => $pool['numevents'], 'NAME' => $pool['dkpsys_name'], 'STATUS' => $pool['dkpsys_status'], 'DEFAULT' => $pool['dkpsys_default'])); } $template->assign_vars(array('L_TITLE' => $user->lang['ACP_LISTDKPSYS'], 'L_EXPLAIN' => $user->lang['ACP_LISTDKPSYS_EXPLAIN'], 'O_NAME' => $current_order['uri'][0], 'O_STATUS' => $current_order['uri'][1], 'U_LIST_DKPSYS' => append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_sys&mode=listdkpsys&"), 'START' => $start, 'UA_UPDATEPOOLSTATUS' => append_sid($phpbb_admin_path . "style/dkp/updatedefaultpools.{$phpEx}"), 'LISTDKPSYS_FOOTCOUNT' => sprintf($user->lang['LISTDKPSYS_FOOTCOUNT'], $this->dkpsys->poolcount, $config['bbdkp_user_elimit']), 'DKPSYS_PAGINATION' => generate_pagination(append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_sys&mode=listdkpsys&") . "&o=" . $current_order['uri']['current'], $this->dkpsys->poolcount, $config['bbdkp_user_elimit'], $start)), true); $this->page_title = 'ACP_LISTDKPSYS'; break; } }
public function buildpage(viewNavigation $Navigation) { global $db, $config, $phpbb_root_path, $phpEx, $user, $template; $raids = array(); if (!(isset($_GET[URI_EVENT]) && isset($_GET[URI_DKPSYS]))) { trigger_error($user->lang['ERROR_EVENT_UNKNOWN']); } if (!class_exists('\\bbdkp\\controller\\raids\\Events')) { require "{$phpbb_root_path}includes/bbdkp/controller/raids/Events.{$phpEx}"; } $event_id = request_var(URI_EVENT, 0); $url = append_sid("{$phpbb_root_path}dkp.{$phpEx}", 'page=event&' . URI_EVENT . '=' . $event_id . '&' . URI_DKPSYS . '=' . $Navigation->getDkpsysId()); $event = new \bbdkp\controller\raids\Events(); $event->get($event_id); if (strlen($event->event_imagename) > 0) { $eventimg = $phpbb_root_path . "images/bbdkp/event_images/" . $event->event_imagename . ".png"; } else { $eventimg = $phpbb_root_path . "images/bbdkp/event_images/dummy.png"; } $template->assign_vars(array('EVENTNAME' => $event->event_name, 'VALUE' => $event->event_value, 'IMAGEPATH' => $eventimg, 'RECORDED_RAID_HISTORY' => sprintf($user->lang['RECORDED_RAID_HISTORY'], $event->event_name))); $sort_order = array(0 => array('raid_start desc', 'raid_start'), 1 => array('raid_note', 'raid_note desc'), 2 => array('raid_value desc', 'raid_value')); $current_order = $Navigation->switch_order($sort_order); $sql_array = array('SELECT' => ' e.event_dkpid, e.event_name, r.raid_id, r.raid_start, r.raid_note, r.raid_added_by, r.raid_updated_by, SUM(ra.raid_value) as raid_value, SUM(ra.time_bonus) as time_value, SUM(ra.zerosum_bonus) as zs_value, SUM(ra.raid_decay) as raiddecay, SUM(ra.raid_value + ra.time_bonus + ra.zerosum_bonus - ra.raid_decay) as total', 'FROM' => array(EVENTS_TABLE => 'e', RAIDS_TABLE => 'r', RAID_DETAIL_TABLE => 'ra', MEMBER_LIST_TABLE => 'l'), 'WHERE' => ' ra.raid_id = r.raid_id AND r.event_id = e.event_id AND e.event_id = ' . (int) $event_id . ' AND ra.member_id = l.member_id AND l.member_guild_id = ' . $Navigation->getGuildId(), 'GROUP_BY' => 'e.event_dkpid, e.event_name, r.raid_id, r.raid_start, r.raid_note, r.raid_added_by, r.raid_updated_by', 'ORDER_BY' => $current_order['sql']); $sql = $db->sql_build_query('SELECT', $sql_array); $result = $db->sql_query($sql); $raid_count = 0; while ($row = $db->sql_fetchrow($result)) { $raid_count++; } if ($raid_count > 0) { $startr = request_var('startr', 0); // get requested window $raid_ids = array(); $result = $db->sql_query_limit($sql, $config['bbdkp_user_rlimit'], $startr); while ($row = $db->sql_fetchrow($result)) { $raids[$row['raid_id']] = array('event_name' => $row['event_name'], 'raid_id' => $row['raid_id'], 'raid_start' => $row['raid_start'], 'raid_note' => $row['raid_note'], 'raid_value' => $row['raid_value'], 'time_value' => $row['time_value'], 'zs_value' => $row['zs_value'], 'raiddecay' => $row['raiddecay'], 'total' => $row['total']); $raid_ids[] = $row['raid_id']; } $db->sql_freeresult($result); // Find the attendees at each raid $sql = 'SELECT raid_id, count(member_id) AS countatt FROM ' . RAID_DETAIL_TABLE . ' WHERE ' . $db->sql_in_set('raid_id', $raid_ids) . ' GROUP BY raid_id'; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { $raids[$row['raid_id']]['numattendees'] = $row['countatt']; } $db->sql_freeresult($result); //calculate the average event attendance and droprate // Find the item drops for each raid $sql = 'SELECT raid_id, count(item_id) AS countatt FROM ' . RAID_ITEMS_TABLE . ' WHERE ' . $db->sql_in_set('raid_id', $raid_ids) . ' GROUP BY raid_id'; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { $raids[$row['raid_id']]['numitems'] = $row['countatt']; } $db->sql_freeresult($result); $total_drop_count = 0; $total_attendees_count = 0; $total_earned = 0; // Loop through the raids for this event $total_raid_count = sizeof($raids); foreach ($raids as $raid_id => $raid) { $drop_count = isset($raid['numitems']) ? $raid['numitems'] : 0; $attendees_count = isset($raid['numattendees']) ? $raid['numattendees'] : 0; $template->assign_block_vars('raids_row', array('U_VIEW_RAID' => append_sid("{$phpbb_root_path}dkp.{$phpEx}", 'page=raid&' . URI_RAID . '=' . $raid['raid_id']), 'DATE' => date($config['bbdkp_date_format'], $raid['raid_start']), 'ATTENDEES' => $attendees_count, 'DROPS' => $drop_count, 'NOTE' => !empty($raid['raid_note']) ? $raid['raid_note'] : ' ', 'RAIDVALUE' => $raid['raid_value'], 'TIMEVALUE' => $raid['time_value'], 'ZSVALUE' => $raid['zs_value'], 'DECAYVALUE' => $raid['raiddecay'], 'TOTAL' => $raid['total'])); $total_drop_count += $drop_count; $total_attendees_count += $attendees_count; $total_earned += $raid['raid_value']; } // Prevent div by 0 $average_attendees = $total_raid_count > 0 ? round($total_attendees_count / $total_raid_count, 2) : 0; $average_drops = $total_drop_count > 0 ? round($total_drop_count / $total_raid_count, 2) : 0; $raidpagination = $Navigation->generate_pagination2($url . '&o1=' . $current_order['uri']['current'], $raid_count, $config['bbdkp_user_rlimit'], $startr, true, 'startr'); $start = request_var('start', 0); // item selection $sql_array = array('SELECT' => 'i.item_id, i.item_gameid, i.item_name, i.item_gameid, i.member_id, i.item_zs, l.member_name, c.colorcode, c.imagename, l.member_gender_id, a.image_female, a.image_male, i.item_date, i.raid_id, i.item_value, i.item_decay, i.item_value - i.item_decay as item_total', 'FROM' => array(CLASS_TABLE => 'c', RACE_TABLE => 'a', MEMBER_LIST_TABLE => 'l', RAID_ITEMS_TABLE => 'i'), 'WHERE' => 'c.class_id = l.member_class_id AND c.game_id = l.game_id AND l.member_race_id = a.race_id AND a.game_id = l.game_id and l.member_id = i.member_id AND ' . $db->sql_in_set('raid_id', $raid_ids)); $sql = $db->sql_build_query('SELECT', $sql_array); $result = $db->sql_query_limit($sql, $config['bbdkp_user_ilimit'], $start); $number_items = 0; $item_value = 0.0; $item_decay = 0.0; $item_total = 0.0; while ($row = $db->sql_fetchrow($result)) { if ($Navigation->bbtips == true && $row['item_gameid'] == 'wow') { $item_name = '<strong>' . $Navigation->bbtips->parse('[itemdkp]' . $row['item_name'] . '[/itemdkp]') . '</strong>'; } else { $item_name = '<strong>' . $row['item_name'] . '</strong>'; } $race_image = (string) ($row['member_gender_id'] == 0 ? $row['image_male'] : $row['image_female']); $template->assign_block_vars('items_row', array('DATE' => date($config['bbdkp_date_format'], $row['item_date']), 'U_VIEW_RAID' => append_sid("{$phpbb_root_path}dkp.{$phpEx}", 'page=raid&' . URI_RAID . '=' . $row['raid_id']), 'COLORCODE' => $row['colorcode'] == '' ? '#254689' : $row['colorcode'], 'CLASS_IMAGE' => strlen($row['imagename']) > 1 ? $phpbb_root_path . "images/bbdkp/class_images/" . $row['imagename'] . ".png" : '', 'S_CLASS_IMAGE_EXISTS' => strlen($row['imagename']) > 1 ? true : false, 'RACE_IMAGE' => strlen($race_image) > 1 ? $phpbb_root_path . "images/bbdkp/race_images/" . $race_image . ".png" : '', 'S_RACE_IMAGE_EXISTS' => strlen($race_image) > 1 ? true : false, 'BUYER' => !empty($row['member_name']) ? $row['member_name'] : '<<i>Not Found</i>>', 'U_VIEW_MEMBER' => append_sid("{$phpbb_root_path}dkp.{$phpEx}", 'page=member&' . URI_NAMEID . '=' . $row['member_id'] . '&' . URI_DKPSYS . '=' . $Navigation->getDkpsysId()), 'ITEMNAME' => $item_name, 'U_VIEW_ITEM' => append_sid("{$phpbb_root_path}dkp.{$phpEx}", 'page=item&' . URI_ITEM . '=' . $row['item_id']), 'ITEM_ZS' => $row['item_zs'] == 1 ? ' checked="checked"' : '', 'ITEMVALUE' => $row['item_value'], 'DECAYVALUE' => $row['item_decay'], 'TOTAL' => $row['item_total'])); $number_items++; $item_value += $row['item_value']; $item_decay += $row['item_decay']; $item_total += $row['item_total']; } $itempagination = generate_pagination($url, $total_drop_count, $config['bbdkp_user_ilimit'], $start, true); $template->assign_vars(array('RAIDPAGINATION' => $raidpagination, 'O_DATE' => $current_order['uri'][0], 'O_NOTE' => $current_order['uri'][1], 'O_VALUE' => $current_order['uri'][2], 'DKPPOOL' => $event->dkpsys_name, 'AVERAGE_ATTENDEES' => $average_attendees, 'AVERAGE_DROPS' => $average_drops, 'TOTAL_EARNED' => sprintf("%.2f", $total_earned), 'VIEWEVENT_FOOTCOUNT' => sprintf($user->lang['VIEWEVENT_FOOTCOUNT'], $total_raid_count), 'S_SHOWZS' => $config['bbdkp_zerosum'] == '1' ? true : false, 'S_SHOWTIME' => $config['bbdkp_timebased'] == '1' ? true : false, 'S_SHOWDECAY' => $config['bbdkp_decay'] == '1' ? true : false, 'L_RECORDED_DROP_HISTORY' => sprintf($user->lang['RECORDED_DROP_HISTORY'], $event->event_name), 'ITEM_FOOTCOUNT' => sprintf($user->lang['VIEWITEM_FOOTCOUNT'], $total_drop_count, $total_drop_count), 'START' => $start, 'ITEM_PAGINATION' => $itempagination, 'S_DISPLAY_VIEWEVENT' => true, 'S_EPGP' => $config['bbdkp_epgp'] == '1' ? true : false)); } else { $template->assign_vars(array('S_DISPLAY_VIEWEVENT' => true, 'U_VIEW_EVENT' => $url)); } // build breadcrumbs menu $navlinks_array = array(array('DKPPAGE' => $user->lang['MENU_EVENTS'], 'U_DKPPAGE' => append_sid("{$phpbb_root_path}dkp.{$phpEx}", 'page=listevents&guild_id=' . $Navigation->getGuildId())), array('DKPPAGE' => $event->event_name, 'U_DKPPAGE' => $url)); foreach ($navlinks_array as $name) { $template->assign_block_vars('dkpnavlinks', array('DKPPAGE' => $name['DKPPAGE'], 'U_DKPPAGE' => $name['U_DKPPAGE'])); } // Output page page_header($user->lang['MENU_VIEWEVENT'] . ' ' . $event->event_name); }