Ejemplo n.º 1
0
function display_bpblock($guild_id)
{
    global $config, $user, $phpbb_root_path, $template, $phpEx;
    //include the guilds class
    if (!class_exists('\\bbdkp\\controller\\guilds\\Guilds')) {
        require "{$phpbb_root_path}includes/bbdkp/controller/guilds/Guilds.{$phpEx}";
    }
    $Guild = new \bbdkp\controller\guilds\Guilds($guild_id);
    if (!class_exists('\\bbdkp\\controller\\raids\\GuildProgress')) {
        require "{$phpbb_root_path}includes/bbdkp/controller/raids/BossProgress.{$phpEx}";
    }
    $bp = new \bbdkp\controller\Raids\GuildProgress();
    $igame = new \bbdkp\controller\games\Game();
    $igame->game_id = $Guild->game_id;
    $igame->Get();
    $data = $bp->GetProgress($Guild);
    //loop the zones
    foreach ($data as $zone_id => $zone) {
        if ((int) $zone['zonecomplete'] <= 0) {
            $cssclass = 'bpprogress00';
        } elseif ((int) $zone['zonecomplete'] <= 25) {
            $cssclass = 'bpprogress25';
        } elseif ((int) $zone['zonecomplete'] <= 50) {
            $cssclass = 'bpprogress50';
        } elseif ((int) $zone['zonecomplete'] <= 75) {
            $cssclass = 'bpprogress75';
        } elseif ((int) $zone['zonecomplete'] <= 99) {
            $cssclass = 'bpprogress99';
        } elseif ((int) $zone['zonecomplete'] >= 100) {
            $cssclass = 'bpprogress100';
        }
        $template->assign_block_vars('zone', array('ZONE_NAME' => $zone['zonename'], 'ZONE_ID' => $zone['zoneid'], 'ZONECOMPLETE' => $zone['zonecomplete'], 'ZONEKILLS' => $zone['zonekills'], 'BOSSCOUNT' => $zone['zonebosses'], 'ZONE_URL' => sprintf($igame->getZonebaseurl(), $zone['webid']), 'CSSCLASS' => $cssclass));
        foreach ($zone['bosses'] as $boss_id => $boss) {
            $template->assign_block_vars('zone.boss', array('BOSS_NAME' => $boss['bossname'], 'BOSS_URL' => sprintf($igame->getBossbaseurl(), $boss['webid']), 'BOSS_KILLED' => $boss['bosskilled'] == "1" ? "1" : "0"));
        }
    }
}
Ejemplo n.º 2
0
 /**
  * View Bossprogress page
  * @param viewNavigation $Navigation
  */
 public function buildpage(viewNavigation $Navigation)
 {
     global $phpbb_root_path, $phpEx, $user, $template, $config;
     $igame = new \bbdkp\controller\games\Game();
     $igame->game_id = $Navigation->getGameId();
     $igame->Get();
     $Guild = new \bbdkp\controller\guilds\Guilds($Navigation->getGuildId());
     $bp = new \bbdkp\controller\Raids\GuildProgress();
     $data = $bp->GetProgress($Guild);
     $numzones = 0;
     foreach ($data as $zone_id => $zone) {
         $numzones += 1;
     }
     $start = request_var('start', 0);
     $template->assign_vars(array('S_STYLE' => $config['bbdkp_zone_style'], 'S_BPSHOW' => true, 'GAMELOGO' => $phpbb_root_path . 'images/bbdkp/gameworld/' . $Guild->game_id . '/' . $Guild->game_id . '.png', 'F_BP' => \append_sid("{$phpbb_root_path}dkp.{$phpEx}", 'page=bossprogress&amp;guild_id=' . $Navigation->getGuildId()), 'GAME_ID' => $Navigation->getGameId(), 'GAME_NAME' => $igame->getName(), 'GUILD_ID' => $Guild->guildid, 'PAGE_NUMBER' => \on_page($numzones, 2, $start), 'PAGINATION' => \generate_pagination(append_sid("{$phpbb_root_path}dkp.{$phpEx}", "page=bossprogress&amp;guild_id=" . $Guild->guildid), $numzones, 2, $start, true), 'U_BPIMG' => "{$phpbb_root_path}images/bbdkp/gameworld/{$Navigation->getGameId()}/{$Navigation->getGameId()}.png"));
     $i = 0;
     $j = 0;
     //loop the zones
     foreach ($data as $zone_id => $zone) {
         $i += 1;
         if ($i >= $start) {
             $j += 1;
             //show max 2 zones per page
             if ($j <= 2) {
                 $template->assign_block_vars('zone', array('ZONE_NAME' => $zone['zonename'], 'ZONE_ID' => $zone['zoneid'], 'ZONE_PROGRESSIMG' => $zone['zoneimage'], 'ZONE_BACKGROUNDIMG' => $zone['zonebackground'], 'ZONECOMPLETE' => $zone['zonecomplete'], 'ZONESTATS' => $zone['zonestats']));
                 foreach ($zone['bosses'] as $boss_id => $boss) {
                     $killdate = '';
                     if ($boss['bosskilldate'] != '') {
                         $killdate = date($config['bbdkp_date_format'], $boss['bosskilldate']);
                         // convert UNIX timestamp to PHP DateTime
                     }
                     if ($boss['bosskilled'] == 0) {
                         $bossimg = "{$phpbb_root_path}images/bbdkp/gameworld/" . $Guild->game_id . '/bosses/' . $boss['imagename'] . '_b.png';
                     } else {
                         $bossimg = "{$phpbb_root_path}images/bbdkp/gameworld/" . $Guild->game_id . '/bosses/' . $boss['imagename'] . '.png';
                     }
                     $template->assign_block_vars('zone.boss', array('BOSS_NAME' => $boss['bossname'], 'BOSS_IMAGENAME' => $bossimg, 'BOSS_ID' => $boss['id'], 'BOSS_WEBID' => $boss['webid'], 'BOSS_TYPE' => $boss['type'], 'BOSS_URL' => sprintf($igame->getBossbaseurl(), $boss['webid']), 'BOSS_URLVIEW' => $phpbb_root_path . "images/bbdkp/icons/view.gif", 'BOSS_KILLED' => $boss['bosskilled'] == 1 ? 'checked="checked"' : '', 'BOSS_SHOW' => $boss['bossshow'] == 1 ? "checked=checked" : '', 'BOSS_KILLDATE' => $killdate, 'BOSS_COUNTER' => $boss['bosscounter'], 'S_BOSS_KILLED' => $boss['bosskilled']));
                 }
             }
         }
     }
     page_header($user->lang['MENU_BOSS']);
 }