Exemplo n.º 1
0
 public function buildpage(viewNavigation $Navigation)
 {
     global $db, $config, $phpbb_root_path, $phpEx, $user, $template;
     $loot = new \bbdkp\controller\loot\Loot();
     $total_items = $loot->countloot('history', $Navigation->getGuildId(), $Navigation->getDkpsysId());
     if ($Navigation->getDkpsysId() > 0) {
         $u_list_items = append_sid("{$phpbb_root_path}dkp.{$phpEx}", 'page=loothistory&guild_id=' . $Navigation->getGuildId() . '&' . URI_DKPSYS . '=' . $Navigation->getDkpsysId());
     } else {
         $u_list_items = append_sid("{$phpbb_root_path}dkp.{$phpEx}", 'page=loothistory&guild_id=' . $Navigation->getGuildId());
     }
     $listitems_footcount = sprintf($user->lang['LISTPURCHASED_FOOTCOUNT'], $total_items, $config['bbdkp_user_ilimit']);
     $sort_order = array(0 => array('item_date desc, item_value desc', 'item_date asc, item_value desc'), 1 => array('member_name asc, item_value desc', 'member_name desc, item_value desc'), 2 => array('item_name asc, item_value desc', 'item_name desc, item_value desc'), 3 => array('event_name asc, item_value desc', 'event_name desc, item_value desc'), 4 => array('item_value desc', 'item_value asc'));
     $current_order = $Navigation->switch_order($sort_order);
     $start = request_var('start', 0);
     $pagination = generate_pagination($u_list_items . '&o=' . $current_order['uri']['current'], $total_items, $config['bbdkp_user_ilimit'], $start, true);
     $items_result = $loot->GetAllLoot($current_order['sql'], $Navigation->getGuildId(), $Navigation->getDkpsysId(), 0, $start, 0);
     $number_items = 0;
     $item_value = 0.0;
     $item_decay = 0.0;
     $item_total = 0.0;
     while ($item = $db->sql_fetchrow($items_result)) {
         if ($Navigation->bbtips == true && $item['item_gameid'] == 'wow') {
             $valuename = '<strong>' . $Navigation->bbtips->parse('[itemdkp]' . $item['item_name'] . '[/itemdkp]') . '</strong>';
         } else {
             $valuename = $item['item_name'];
         }
         $member = new \bbdkp\controller\members\Members($item['member_id']);
         $template->assign_block_vars('items_row', array('DATE' => !empty($item['item_date']) ? date($config['bbdkp_date_format'], $item['item_date']) : '&nbsp;', 'ITEMNAME' => $valuename, 'U_VIEW_ITEM' => append_sid("{$phpbb_root_path}dkp.{$phpEx}", "page=item&amp;" . URI_ITEM . '=' . $item['item_id']), 'RAID' => !empty($item['event_name']) ? $item['event_name'] : '&lt;<i>' . $user->lang['NOT_AVAILABLE'] . '</i>&gt;', 'U_VIEW_RAID' => append_sid("{$phpbb_root_path}dkp.{$phpEx}", "page=raid&amp;" . URI_RAID . '=' . $item['raid_id']), 'EVENT_COLOR' => !empty($item['event_color']) ? $item['event_color'] : '#254689', 'ITEMVALUE' => sprintf("%.2f", $item['item_value']), 'DECAYVALUE' => sprintf("%.2f", $item['item_decay']), 'TOTAL' => sprintf("%.2f", $item['item_net']), 'BUYER' => $item['member_name'], 'U_VIEW_BUYER' => append_sid("{$phpbb_root_path}dkp.{$phpEx}", "page=member&amp;" . URI_NAMEID . '=' . $item['member_id'] . '&amp;' . URI_DKPSYS . '=' . $item['event_dkpid']), 'RACE_IMAGE' => $member->race_image, 'S_RACE_IMAGE_EXISTS' => strlen($member->race_image) > 1 ? true : false, 'CLASSCOLOR' => $member->colorcode, 'CLASS_IMAGE' => $member->class_image, 'S_CLASS_IMAGE_EXISTS' => strlen($member->class_image) > 1 ? true : false));
         unset($member);
         $number_items++;
         $item_value += $item['item_value'];
         $item_decay += $item['item_decay'];
         $item_total += $item['item_net'];
     }
     $db->sql_freeresult($items_result);
     // breadcrumbs menu
     $navlinks_array = array(array('DKPPAGE' => $user->lang['MENU_ITEMHIST'], 'U_DKPPAGE' => $u_list_items));
     foreach ($navlinks_array as $name) {
         $template->assign_block_vars('dkpnavlinks', array('DKPPAGE' => $name['DKPPAGE'], 'U_DKPPAGE' => $name['U_DKPPAGE']));
     }
     $template->assign_vars(array('F_LISTITEM' => $u_list_items, 'O_DATE' => $u_list_items . '&amp;o=' . $current_order['uri'][0] . '&amp;start=' . $start, 'O_BUYER' => $u_list_items . '&amp;o=' . $current_order['uri'][1] . '&amp;start=' . $start, 'O_ITEMNAME' => $u_list_items . '&amp;o=' . $current_order['uri'][2] . '&amp;start=' . $start, 'O_RAID' => $u_list_items . '&amp;o=' . $current_order['uri'][3] . '&amp;start=' . $start, 'O_VALUE' => $u_list_items . '&amp;o=' . $current_order['uri'][4] . '&amp;start=' . $start, 'S_SHOWTIME' => $config['bbdkp_timebased'] == '1' ? true : false, 'S_SHOWDECAY' => $config['bbdkp_decay'] == '1' ? true : false, 'S_SHOWEPGP' => $config['bbdkp_epgp'] == '1' ? true : false, 'TOTAL_ITEMVALUE' => sprintf("%.2f", $item_value), 'TOTAL_ITEMDECAY' => sprintf("%.2f", $item_decay), 'TOTAL_ITEMTOTAL' => sprintf("%.2f", $item_total), 'LISTITEMS_FOOTCOUNT' => $listitems_footcount, 'ITEM_PAGINATION' => $pagination, 'S_DISPLAY_LOOTHISTORY' => true));
     $title = $user->lang['MENU_ITEMHIST'];
     // Output page
     page_header($title);
 }
Exemplo n.º 2
0
 /**
  * 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));
 }
Exemplo n.º 3
0
    public function buildpage(viewNavigation $Navigation)
    {
        global $db, $config, $phpbb_root_path, $phpEx, $user, $template;
        if (!isset($_GET[URI_NAMEID])) {
            trigger_error($user->lang['MNOTFOUND']);
        }
        $member_id = request_var(URI_NAMEID, 0);
        $member = new \bbdkp\controller\members\Members($member_id);
        $points = new \bbdkp\controller\points\Points($member_id, $Navigation->getDkpsysId());
        $Raids = new \bbdkp\controller\raids\Raids();
        $Adjustments = new \bbdkp\controller\adjustments\Adjust($Navigation->getDkpsysId());
        /* Get attendance */
        $range1 = $config['bbdkp_list_p1'];
        $range2 = $config['bbdkp_list_p2'];
        $range3 = $config['bbdkp_list_p3'];
        //member raidcount
        $mc1 = $Raids->raidcount($Navigation->getDkpsysId(), $range1, $member_id, 0, false, $member->member_guild_id);
        $mc2 = $Raids->raidcount($Navigation->getDkpsysId(), $range2, $member_id, 0, false, $member->member_guild_id);
        $mc3 = $Raids->raidcount($Navigation->getDkpsysId(), $range3, $member_id, 0, false, $member->member_guild_id);
        $mclife = $Raids->raidcount($Navigation->getDkpsysId(), 0, $member_id, 0, true, $member->member_guild_id);
        //guild raidcount
        $pc1 = $Raids->raidcount($Navigation->getDkpsysId(), $range1, $member_id, 1, false, $member->member_guild_id);
        $pc2 = $Raids->raidcount($Navigation->getDkpsysId(), $range2, $member_id, 1, false, $member->member_guild_id);
        $pc3 = $Raids->raidcount($Navigation->getDkpsysId(), $range3, $member_id, 1, false, $member->member_guild_id);
        $pclife = $Raids->raidcount($Navigation->getDkpsysId(), 0, $member_id, 1, true, $member->member_guild_id);
        //attendances
        $pct1 = $pc1 > 0 ? round($mc1 / $pc1 * 100, 1) : 0;
        $pct2 = $pc2 > 0 ? round($mc2 / $pc2 * 100, 1) : 0;
        $pct3 = $pc3 > 0 ? round($mc3 / $pc3 * 100, 1) : 0;
        $pctlife = $pclife > 0 ? round($mclife / $pclife * 100, 1) : 0;
        /**
         *
         * RAID history
         *
         *
         **/
        $rstart = request_var('rstart', 0);
        if ($config['bbdkp_epgp'] == '1') {
            $current_earned = $points->earned_net;
        } else {
            $current_earned = $points->earned_net;
        }
        $raids_result = $Raids->getRaids('r.raid_start DESC', $Navigation->getDkpsysId(), 0, $rstart, $member_id);
        while ($raid = $db->sql_fetchrow($raids_result)) {
            $template->assign_block_vars('raids_row', array('DATE' => !empty($raid['raid_start']) ? date($config['bbdkp_date_format'], $raid['raid_start']) : '&nbsp;', 'U_VIEW_RAID' => append_sid("{$phpbb_root_path}dkp.{$phpEx}", 'page=raid&amp;' . URI_RAID . '=' . $raid['raid_id']), 'NAME' => $raid['event_name'], 'NOTE' => !empty($raid['raid_note']) ? $raid['raid_note'] : '&nbsp;', 'RAIDVAL' => $raid['raid_value'], 'TIMEBONUS' => $raid['time_value'], 'ZSBONUS' => $raid['zs_value'], 'RAIDDECAY' => $raid['raiddecay'], 'EARNED' => $raid['net_earned'], 'CURRENT_EARNED' => sprintf("%.2f", $current_earned)));
            $current_earned = $current_earned - $raid['net_earned'];
        }
        /**
         *
         * Adjustments
         *
         */
        $sort_order = array(0 => array('adjustment_id desc', 'adjustment_id asc'), 1 => array('adjustment_date desc, member_name asc', 'adjustment_date asc, member_name asc'), 2 => array('adjustment_dkpid', 'adjustment_dkpid desc'), 3 => array('dkpsys_name', 'dkpsys_name desc'), 4 => array('member_name', 'member_name desc'), 5 => array('adjustment_reason', 'adjustment_reason desc'), 6 => array('adjustment_value desc', 'adjustment_value'), 7 => array('adjustment_added_by', 'adjustment_added_by desc'));
        $result2 = $Adjustments->countadjust($member_id);
        $total_adjustments = (int) $db->sql_fetchfield('total_adjustments');
        $db->sql_freeresult($result2);
        $current_order = $Navigation->switch_order($sort_order);
        $astart = request_var('astart', 0);
        $current_adj = $points->adjustment - $points->adj_decay;
        $result = $Adjustments->ListAdjustments($current_order['sql'], $member_id, $astart);
        while ($adj = $db->sql_fetchrow($result)) {
            $template->assign_block_vars('adjustments_row', array('DATE' => date($config['bbdkp_date_format'], $adj['adjustment_date']), 'ADJID' => $adj['adjustment_id'], 'DKPID' => $adj['adjustment_dkpid'], 'DKPPOOL' => $adj['dkpsys_name'], 'REASON' => isset($adj['adjustment_reason']) ? $adj['adjustment_reason'] : '', 'COLOR' => $adj['adjustment_value'] < 0 ? 'negative' : 'positive', 'ADJUSTMENT' => $adj['adjustment_value'] == 0 ? '' : number_format($adj['adjustment_value'], 2), 'CAN_DECAY' => $adj['can_decay'], 'ADJ_DECAY' => -1 * $adj['adj_decay'] == 0 ? '0.00' : -1 * $adj['adj_decay'], 'ADJUSTMENT_NET' => $adj['adjustment_value'] - $adj['adj_decay'] == 0 ? '' : number_format($adj['adjustment_value'] - $adj['adj_decay'], 2), 'CURRENT_ADJ' => sprintf("%.2f", $current_adj), 'COLORCURRENT' => $current_adj > 0 ? 'positive' : 'nagative', 'ADDED_BY' => $adj['adjustment_added_by']));
            $current_adj = $current_adj - ($adj['adjustment_value'] - $adj['adj_decay']);
        }
        $db->sql_freeresult($result);
        $listadj_footcount = sprintf($user->lang['LISTADJ_FOOTCOUNT'], $total_adjustments, $config['bbdkp_user_alimit']);
        $adjpagination = $Navigation->generate_pagination2(append_sid("{$phpbb_root_path}dkp.{$phpEx}", 'page=member&amp;' . URI_DKPSYS . '=' . $Navigation->getDkpsysId() . '&amp;' . URI_NAMEID . '=' . $member_id . '&amp;astart=' . $astart), $total_adjustments, $config['bbdkp_user_alimit'], $astart, 1, 'astart');
        $template->assign_vars(array('S_SHOW' => $total_adjustments > 0 ? true : false, 'O_ADJID' => $current_order['uri'][0], 'O_DATE' => $current_order['uri'][1], 'O_DKPID' => $current_order['uri'][2], 'O_DKPPOOL' => $current_order['uri'][3], 'O_MEMBER' => $current_order['uri'][4], 'O_REASON' => $current_order['uri'][5], 'O_ADJUSTMENT' => $current_order['uri'][6], 'O_ADDED_BY' => $current_order['uri'][7], 'ASTART' => $astart, 'LISTADJ_FOOTCOUNT' => $listadj_footcount, 'ADJUSTMENTS_PAGINATION' => $adjpagination, 'PAGE_NUMBER' => on_page($total_adjustments, $config['bbdkp_user_alimit'], $astart)));
        /**
         *
         * loot history
         *
         *
         **/
        $istart = request_var('istart', 0);
        if ($config['bbdkp_epgp'] == '1') {
            $current_spent = $points->gp_net;
        } else {
            $current_spent = $points->item_net;
        }
        $loot = new \bbdkp\controller\loot\Loot();
        $lootdetails = $loot->GetAllLoot(' i.item_date DESC ', 0, $Navigation->getDkpsysId(), 0, $istart, $member_id);
        while ($item = $db->sql_fetchrow($lootdetails)) {
            if ($Navigation->bbtips == true && $item['item_gameid'] == 'wow') {
                if ($item['wowhead_id'] > 0) {
                    $item_name = '<strong>' . $Navigation->bbtips->parse('[itemdkp]' . $item['wowhead_id'] . '[/itemdkp]') . '</strong>';
                } else {
                    $item_name = '<strong>' . $Navigation->bbtips->parse('[itemdkp]' . $item['item_name'] . '[/itemdkp]') . '</strong>';
                }
            } else {
                $item_name = '<strong>' . $item['item_name'] . '</strong>';
            }
            $template->assign_block_vars('items_row', array('DATE' => !empty($item['item_date']) ? date($config['bbdkp_date_format'], $item['item_date']) : $item['item_date'] . '&nbsp;', 'U_VIEW_ITEM' => append_sid("{$phpbb_root_path}dkp.{$phpEx}", 'page=item&amp;' . URI_ITEM . '=' . $item['item_id']), 'U_VIEW_RAID' => append_sid("{$phpbb_root_path}dkp.{$phpEx}", 'page=raid&amp;' . URI_RAID . '=' . $item['raid_id']), 'NAME' => $item_name, 'RAID' => !empty($item['event_name']) ? $item['event_name'] : '&lt;<i>Not Found</i>&gt;', 'SPENT' => sprintf("%.2f", $item['item_value']), 'DECAY' => sprintf("%.2f", $item['item_decay']), 'SPENT_NET' => sprintf("%.2f", $item['item_net']), 'CURRENT_SPENT' => sprintf("%.2f", $current_spent)));
            $current_spent -= $item['item_net'];
        }
        $db->sql_freeresult($lootdetails);
        $sql_array = array('SELECT' => 'count(*) as itemcount	', 'FROM' => array(EVENTS_TABLE => 'e', RAIDS_TABLE => 'r', RAID_ITEMS_TABLE => 'i'), 'WHERE' => " e.event_id = r.event_id\n\t\tAND e.event_dkpid=" . (int) $Navigation->getDkpsysId() . '
		AND r.raid_id = i.raid_id
		AND i.member_id  = ' . $member_id);
        $sql6 = $db->sql_build_query('SELECT', $sql_array);
        $result6 = $db->sql_query($sql6);
        $total_purchased_items = $db->sql_fetchfield('itemcount');
        $db->sql_freeresult($result6);
        $raidpag = $Navigation->generate_pagination2(append_sid("{$phpbb_root_path}dkp.{$phpEx}", 'page=member&amp;' . URI_DKPSYS . '=' . $Navigation->getDkpsysId() . '&amp;' . URI_NAMEID . '=' . $member_id . '&amp;istart=' . $istart), $points->raidcount, $config['bbdkp_user_rlimit'], $rstart, 1, 'rstart');
        $itpag = $Navigation->generate_pagination2(append_sid("{$phpbb_root_path}dkp.{$phpEx}", 'page=member&amp;' . URI_DKPSYS . '=' . $Navigation->getDkpsysId() . '&amp;' . URI_NAMEID . '=' . $member_id . '&amp;rstart=' . $rstart), $total_purchased_items, $config['bbdkp_user_ilimit'], $istart, 1, 'istart');
        $template->assign_vars(array('RAID_PAGINATION' => $raidpag, 'RSTART' => $rstart, 'RAID_FOOTCOUNT' => sprintf($user->lang['VIEWMEMBER_RAID_FOOTCOUNT'], $points->raidcount, $config['bbdkp_user_rlimit']), 'ITEM_PAGINATION' => $itpag, 'ISTART' => $istart, 'ITEM_FOOTCOUNT' => sprintf($user->lang['VIEWMEMBER_ITEM_FOOTCOUNT'], $total_purchased_items, $config['bbdkp_user_ilimit']), 'ITEMS' => is_null($total_purchased_items) ? false : true));
        //output
        $url = append_sid("{$phpbb_root_path}dkp.{$phpEx}", 'page=member&amp;' . URI_NAMEID . '=' . $member_id . '&amp;' . URI_DKPSYS . '=' . $Navigation->getDkpsysId());
        $template->assign_vars(array('S_DISPLAY_VIEWMEMBER' => true, 'S_SHOWZS' => $config['bbdkp_zerosum'] == '1' ? true : false, 'S_SHOWDECAY' => $config['bbdkp_decay'] == '1' ? true : false, 'S_SHOWEPGP' => $config['bbdkp_epgp'] == '1' ? true : false, 'S_SHOWTIME' => $config['bbdkp_timebased'] == '1' ? true : false, 'NAME' => $member->member_name, 'GUILD' => $member->member_guild_name, 'REGION' => $member->member_region, 'REALM' => $member->member_realm, 'MEMBER_LEVEL' => $member->member_level, 'MEMBER_DKPID' => $Navigation->getDkpsysId(), 'MEMBER_DKPNAME' => $Navigation->getDkpsysName(), 'MEMBER_RACE' => $member->member_race, 'MEMBER_CLASS' => $member->member_class, 'COLORCODE' => $member->colorcode, 'CLASS_IMAGE' => $member->class_image, 'S_CLASS_IMAGE_EXISTS' => strlen($member->class_image) > 1 ? true : false, 'RACE_IMAGE' => $member->race_image, 'S_RACE_IMAGE_EXISTS' => strlen($member->race_image) > 1 ? true : false, 'MEMBER_RANK' => $member->member_rank_id, 'U_VIEW_MEMBER' => $url, 'POINTNAME' => $config['bbdkp_dkp_name']));
        if ($config['bbdkp_epgp'] == '0') {
            $template->assign_vars(array('RAIDVAL' => sprintf("%.2f", $points->raid_value), 'TIMEBONUS' => sprintf("%.2f", $points->time_bonus), 'ZEROSUM' => sprintf("%.2f", $points->zerosum_bonus), 'RAIDDECAY' => sprintf("%.2f", $points->earned_decay), 'EARNED' => sprintf("%.2f", $points->total_earned), 'EARNED_NET' => sprintf("%.2f", $points->earned_net), 'SPENT' => sprintf("%.2f", $points->spent), 'ITEMDECAY' => sprintf("%.2f", $points->item_decay), 'ITEMNET' => sprintf("%.2f", $points->item_net), 'CURRENT' => sprintf("%.2f", $points->total), 'C_CURRENT' => $points->total > 0 ? 'positive' : 'negative', 'ADJUSTMENT' => sprintf("%.2f", $points->adjustment), 'C_ADJUSTMENT' => $points->adjustment > 0 ? 'positive' : 'negative', 'ADJDECAY' => sprintf("%.2f", $points->adj_decay), 'ADJNET' => sprintf("%.2f", $points->adj_net), 'TOTAL_DECAY' => sprintf("%.2f", $points->total_decayed), 'C_TOTAL_DECAY' => $points->total_decayed > 0 ? 'negative' : 'positive', 'NETCURRENT' => sprintf("%.2f", $points->total_net), 'C_NETCURRENT' => $points->total_net > 0 ? 'positive' : 'negative'));
        } elseif ($config['bbdkp_epgp'] == '1') {
            $template->assign_vars(array('EP' => $points->ep, 'EPNET' => (double) $points->ep_net, 'GP' => $points->gp, 'BGP' => $config['bbdkp_basegp'], 'GPNET' => $points->gp_net, 'PR' => $points->pr, 'PRNET' => $points->pr_net));
        }
        $template->assign_vars(array('RAID_FOOTCOUNT' => sprintf($user->lang['VIEWMEMBER_RAID_FOOTCOUNT'], $points->raidcount, $config['bbdkp_user_rlimit']), 'RAIDS_X1_DAYS' => sprintf($user->lang['RAIDS_X_DAYS'], $range1), 'RAIDS_X2_DAYS' => sprintf($user->lang['RAIDS_X_DAYS'], $range2), 'RAIDS_X3_DAYS' => sprintf($user->lang['RAIDS_X_DAYS'], $range3), 'RAIDS_LIFETIME' => sprintf($user->lang['RAIDS_LIFETIME'], date($config['bbdkp_date_format'], $points->firstraid), date($config['bbdkp_date_format'], $points->lastraid)), 'C_RAIDS_X1_DAYS' => $mc1 . '/' . $pc1 . ' : ' . $pct1, 'C_RAIDS_X2_DAYS' => $mc2 . '/' . $pc2 . ' : ' . $pct2, 'C_RAIDS_X3_DAYS' => $mc3 . '/' . $pc3 . ' : ' . $pct3, 'C_RAIDS_LIFETIME' => $mclife . '/' . $pclife . ' : ' . $pctlife));
        $navlinks_array = array(array('DKPPAGE' => $user->lang['MENU_STANDINGS'], 'U_DKPPAGE' => append_sid("{$phpbb_root_path}dkp.{$phpEx}", 'page=standings&amp;' . URI_DKPSYS . '=' . $Navigation->getDkpsysId())), array('DKPPAGE' => sprintf($user->lang['MENU_VIEWMEMBER'], $member->member_name), 'U_DKPPAGE' => $url));
        foreach ($navlinks_array as $name) {
            $template->assign_block_vars('dkpnavlinks', array('DKPPAGE' => $name['DKPPAGE'], 'U_DKPPAGE' => $name['U_DKPPAGE']));
        }
        $template->assign_vars(array());
        // Output page
        page_header($user->lang['MEMBER']);
    }
Exemplo n.º 4
0
 public function buildpage(viewNavigation $Navigation)
 {
     global $db, $config, $phpbb_root_path, $phpEx, $user, $template;
     if (!isset($_GET[URI_RAID])) {
         trigger_error($user->lang['RNOTFOUND']);
     }
     $raid_id = request_var(URI_RAID, 0);
     // breadcrumbs
     $navlinks_array = array(array('DKPPAGE' => $user->lang['MENU_RAIDS'], 'U_DKPPAGE' => append_sid("{$phpbb_root_path}dkp.{$phpEx}", '&amp;page=listraids&amp;guild_id=' . $Navigation->getGuildId())), array('DKPPAGE' => $user->lang['MENU_VIEWRAID'], 'U_DKPPAGE' => append_sid("{$phpbb_root_path}dkp.{$phpEx}", '&amp;page=listraids&amp;' . URI_RAID . '=' . $raid_id . '&amp;guild_id=' . $Navigation->getGuildId())));
     foreach ($navlinks_array as $name) {
         $template->assign_block_vars('dkpnavlinks', array('DKPPAGE' => $name['DKPPAGE'], 'U_DKPPAGE' => $name['U_DKPPAGE']));
     }
     //Raid information block
     $raid = new \bbdkp\controller\raids\Raids($raid_id);
     $title = sprintf($user->lang['RAID_ON'], $raid->event_name, date('F j, Y', $raid->raid_start));
     $template->assign_vars(array('S_DISPLAY_VIEWRAIDS' => true, 'L_RAID_ON' => sprintf($user->lang['RAID_ON'], $raid->event_name, date('F j, Y', $raid->raid_start)), 'RAIDSTART' => date('H:i:s', $raid->raid_start), 'RAIDEND' => date('H:i:s', $raid->raid_end), 'DURATION' => $raid->raid_duration, 'RAID_ADDED_BY' => sprintf($user->lang['ADDED_BY'], $raid->raid_added_by), 'RAID_UPDATED_BY' => trim($raid->raid_updated_by) != '' ? sprintf($user->lang['UPDATED_BY'], $raid->raid_updated_by) : ' ', 'RAID_NOTE' => $raid->raid_note, 'IMAGEPATH' => $phpbb_root_path . "images/bbdkp/event_images/" . $raid->event_imagename . ".png", 'S_EVENT_IMAGE_EXISTS' => strlen($raid->event_imagename) > 1 ? true : false, 'S_SHOWZS' => $config['bbdkp_zerosum'] == '1' ? true : false, 'S_SHOWTIME' => $config['bbdkp_timebased'] == '1' ? true : false, 'S_SHOWDECAY' => $config['bbdkp_decay'] == '1' ? true : false, 'S_SHOWEPGP' => $config['bbdkp_epgp'] == '1' ? true : false, 'F_RAID' => append_sid("{$phpbb_root_path}dkp.{$phpEx}", 'page=raid&amp;' . URI_RAID . '=' . request_var(URI_RAID, 0))));
     // point listing
     $sort_order = array(0 => array('member_name asc', 'member_name desc'), 1 => array('raid_value asc', 'raid_value desc'), 2 => array('time_bonus asc', 'time_bonus desc'), 3 => array('zerosum_bonus asc', 'zerosum_bonus desc'), 4 => array('raid_decay asc', 'raid_decay desc'), 5 => array('total asc', 'total desc'));
     $current_order = $Navigation->switch_order($sort_order);
     $raid_details = new \bbdkp\controller\raids\Raiddetail($raid_id);
     $raid->raid_details = (array) $raid_details->raid_details;
     $raid_value = 0.0;
     $time_bonus = 0.0;
     $zerosum_bonus = 0.0;
     $raid_decay = 0.0;
     $raid_total = 0.0;
     $countattendees = 0;
     foreach ($raid->raid_details as $raid_detail) {
         // fill attendees table
         $template->assign_block_vars('raids_row', array('U_VIEW_ATTENDEE' => append_sid("{$phpbb_root_path}dkp.{$phpEx}", 'page=member&amp;' . URI_NAMEID . "={$raid_detail['member_id']}&amp;" . URI_DKPSYS . "=" . $raid->event_dkpid), 'NAME' => $raid_detail['member_name'], 'COLORCODE' => $raid_detail['colorcode'] == '' ? '#254689' : $raid_detail['colorcode'], 'CLASS_IMAGE' => strlen($raid_detail['imagename']) > 1 ? $phpbb_root_path . "images/bbdkp/class_images/" . $raid_detail['imagename'] . ".png" : '', 'S_CLASS_IMAGE_EXISTS' => strlen($raid_detail['imagename']) > 1 ? true : false, 'RACE_IMAGE' => strlen($raid_detail['raceimage']) > 1 ? $phpbb_root_path . "images/bbdkp/race_images/" . $raid_detail['raceimage'] . ".png" : '', 'S_RACE_IMAGE_EXISTS' => strlen($raid_detail['raceimage']) > 1 ? true : false, 'CLASS_NAME' => $raid_detail['classname'], 'RAIDVALUE' => $raid_detail['raid_value'], 'TIMEVALUE' => $raid_detail['time_bonus'], 'ZSVALUE' => $raid_detail['zerosum_bonus'], 'DECAYVALUE' => $raid_detail['raid_decay'], 'TOTAL' => $raid_detail['raid_value'] + $raid_detail['time_bonus'] + $raid_detail['zerosum_bonus'] - $raid_detail['raid_decay']));
         $raid_value += $raid_detail['raid_value'];
         $time_bonus += $raid_detail['time_bonus'];
         $zerosum_bonus += $raid_detail['zerosum_bonus'];
         $raid_decay += $raid_detail['raid_decay'];
         $countattendees += 1;
     }
     $raid_total = $raid_value + $time_bonus + $zerosum_bonus - $raid_decay;
     //reset the keys
     $raid->raid_details = array_values($raid->raid_details);
     // count blocks
     $blocksize = 7;
     $x = ceil(count($raid->raid_details) / $blocksize);
     //loop blocks
     for ($i = 0; $i < $x; $i++) {
         $block_vars = array();
         //loop columns
         for ($j = 0; $j < $blocksize; $j++) {
             $offset = $i + $x * $j;
             $attendee = isset($raid->raid_details[$offset]) ? $raid->raid_details[$offset] : '';
             if ($attendee != '') {
                 $block_vars += array('COLUMN' . $j . '_NAME' => '<strong><a style="color: ' . $raid->raid_details[$offset]['colorcode'] . ';" href="' . append_sid("{$phpbb_root_path}dkp.{$phpEx}", "page=member&amp;" . URI_NAMEID . '=' . $raid->raid_details[$offset]['member_id'] . '&amp;' . URI_DKPSYS . '=' . $Navigation->getDkpsysId()) . '">' . $raid->raid_details[$offset]['member_name'] . '</a></strong>');
             } else {
                 $block_vars += array('COLUMN' . $j . '_NAME' => '');
             }
             // Are we showing this column?
             $s_column = 's_column' . $j;
             ${$s_column} = true;
         }
         $template->assign_block_vars('attendees_row', $block_vars);
     }
     $column_width = floor(100 / $blocksize);
     $template->assign_vars(array('O_NAME' => $current_order['uri'][0], 'O_RAIDVALUE' => $current_order['uri'][1], 'O_TIMEVALUE' => $current_order['uri'][2], 'O_ZSVALUE' => $current_order['uri'][3], 'O_DECAYVALUE' => $current_order['uri'][4], 'O_TOTALVALUE' => $current_order['uri'][5], 'RAIDVALUE' => sprintf("%.2f", $raid_value), 'TIMEVALUE' => sprintf("%.2f", $time_bonus), 'ZSVALUE' => sprintf("%.2f", $zerosum_bonus), 'RAIDDECAY' => sprintf("%.2f", $raid_decay), 'TOTAL' => sprintf("%.2f", $raid_total), 'S_COLUMN0' => isset($s_column0) ? true : false, 'S_COLUMN1' => isset($s_column1) ? true : false, 'S_COLUMN2' => isset($s_column2) ? true : false, 'S_COLUMN3' => isset($s_column3) ? true : false, 'S_COLUMN4' => isset($s_column4) ? true : false, 'S_COLUMN5' => isset($s_column5) ? true : false, 'S_COLUMN6' => isset($s_column6) ? true : false, 'S_COLUMN7' => isset($s_column7) ? true : false, 'S_COLUMN8' => isset($s_column8) ? true : false, 'S_COLUMN9' => isset($s_column9) ? true : false, 'COLUMN_WIDTH' => isset($column_width) ? $column_width : 0, 'COLSPAN' => $blocksize, 'ATTENDEES_FOOTCOUNT' => sprintf($user->lang['VIEWRAID_ATTENDEES_FOOTCOUNT'], $countattendees)));
     //drops block
     //prepare item list sql
     $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'));
     $icurrent_order = $Navigation->switch_order($isort_order, 'ui');
     $loot = new \bbdkp\controller\loot\Loot();
     $raid->loot_details = $loot->GetAllLoot($icurrent_order['sql'], 0, $Navigation->getDkpsysId(), $raid_id, 0, 0);
     $number_items = 0;
     $item_value = 0.0;
     $item_decay = 0.0;
     $item_total = 0.0;
     while ($item = $db->sql_fetchrow($raid->loot_details)) {
         if ($Navigation->bbtips == true && $item['item_gameid'] == 'wow') {
             $item_name = '<strong>' . $Navigation->bbtips->parse('[itemdkp]' . $item['item_name'] . '[/itemdkp]') . '</strong>';
         } else {
             $item_name = '<strong>' . $item['item_name'] . '</strong>';
         }
         $buyer = new \bbdkp\controller\members\Members($item['member_id']);
         $template->assign_block_vars('items_row', array('DATE' => !empty($item['item_date']) ? $user->format_date($item['item_date']) : '&nbsp;', 'COLORCODE' => $buyer->colorcode, 'CLASS_IMAGE' => $buyer->class_image, 'S_CLASS_IMAGE_EXISTS' => strlen($buyer->class_image) > 1 ? true : false, 'RACE_IMAGE' => $buyer->race_image, 'S_RACE_IMAGE_EXISTS' => strlen($buyer->race_image) > 1 ? true : false, 'BUYER' => $buyer->member_name, 'ITEMNAME' => $item_name, 'ITEM_ID' => $item['item_id'], 'ITEM_ZS' => $item['item_zs'] == 1 ? ' checked="checked"' : '', 'U_VIEW_BUYER' => append_sid("{$phpbb_root_path}dkp.{$phpEx}", "page=member&amp;" . URI_NAMEID . "={$item['member_id']}&amp;" . URI_DKPSYS . "=" . $raid->event_dkpid), 'ITEMVALUE' => $item['item_value'], 'DECAYVALUE' => $item['item_decay'], 'TOTAL' => $item['item_net']));
         unset($buyer);
         $number_items++;
         $item_value += $item['item_value'];
         $item_decay += $item['item_decay'];
         $item_total += $item['item_net'];
     }
     $template->assign_vars(array('S_SHOWITEMPANE' => $number_items > 0 ? true : false, 'ITEM_VALUE' => $item_value, 'ITEMDECAYVALUE' => $item_decay, 'ITEMTOTAL' => $item_total, 'RAIDNET' => $raid_total - $item_total, 'ITEM_FOOTCOUNT' => sprintf($user->lang['VIEWRAID_DROPS_FOOTCOUNT'], $number_items)));
     // Class statistics
     $LootStats = new \bbdkp\controller\loot\LootController();
     $LootStats->ClassLootStats($raid, 0, true, $Navigation->getDkpsysId(), false);
     // Output page
     page_header($title);
 }