private function homeAlliance()
 {
     global $USER, $UNI, $LNG, $ALLIANCE;
     require_once 'includes/functions/BBCode.php';
     if ($this->allianceData['ally_owner'] == $USER['id']) {
         $rankName = $this->allianceData['ally_owner_range'] != '' ? $this->allianceData['ally_owner_range'] : $LNG['al_founder_rank_text'];
     } elseif ($USER['ally_rank_id'] != 0) {
         $rankName = $GLOBALS['DATABASE']->getFirstCell("SELECT rankName FROM " . ALLIANCE_RANK . " WHERE rankID = " . $USER['ally_rank_id'] . ";");
     }
     if (empty($rankName)) {
         $rankName = $LNG['al_new_member_rank_text'];
     }
     $StatsData = $GLOBALS['DATABASE']->getFirstRow("SELECT SUM(wons) as wons, SUM(loos) as loos, SUM(draws) as draws, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\tSUM(kbmetal) as kbmetal, SUM(kbcrystal) as kbcrystal, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\tSUM(lostunits) as lostunits, SUM(desunits) as desunits \n\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . USERS . " WHERE ally_id = " . $this->allianceData['id'] . ";");
     $ApplyCount = $GLOBALS['DATABASE']->getFirstCell("SELECT COUNT(*) FROM " . ALLIANCE_REQUEST . " WHERE allianceID = " . $this->allianceData['id'] . ";");
     $ally_events = array();
     if (!empty($this->allianceData['ally_events'])) {
         $sql = "\n\t\t\tSELECT\n\t\t\t\t`id`,\n\t\t\t\t`username`\n\t\t\tFROM\n\t\t\t\t`" . USERS . "`\n\t\t\tWHERE\n\t\t\t\t`ally_id` = " . $this->allianceData['id'] . ";";
         $result = $GLOBALS['DATABASE']->query($sql);
         require_once 'includes/classes/class.FlyingFleetsTable.php';
         $FlyingFleetsTable = new FlyingFleetsTable();
         $this->tplObj->loadscript('overview.js');
         while ($row = $result->fetch_assoc()) {
             $FlyingFleetsTable->setUser($row['id']);
             $FlyingFleetsTable->setMissions($this->allianceData['ally_events']);
             $ally_events[$row['username']] = $FlyingFleetsTable->renderTable();
         }
         $ally_events = array_filter($ally_events);
     }
     $this->tplObj->assign_vars(array('DiploInfo' => $this->getDiplomatic(), 'ally_web' => $this->allianceData['ally_web'], 'ally_tag' => $this->allianceData['ally_tag'], 'ally_members' => $this->allianceData['ally_members'], 'ally_max_members' => $this->allianceData['ally_members'], 'ally_name' => $this->allianceData['ally_name'], 'ally_image' => $this->allianceData['ally_image'], 'ally_description' => bbcode($this->allianceData['ally_description']), 'ally_text' => bbcode($this->allianceData['ally_text']), 'rankName' => $rankName, 'requests' => sprintf($LNG['al_new_requests'], $ApplyCount), 'applyCount' => $ApplyCount, 'totalfight' => $StatsData['wons'] + $StatsData['loos'] + $StatsData['draws'], 'fightwon' => $StatsData['wons'], 'fightlose' => $StatsData['loos'], 'fightdraw' => $StatsData['draws'], 'unitsshot' => pretty_number($StatsData['desunits']), 'unitslose' => pretty_number($StatsData['lostunits']), 'dermetal' => pretty_number($StatsData['kbmetal']), 'dercrystal' => pretty_number($StatsData['kbcrystal']), 'isOwner' => $this->allianceData['ally_owner'] == $USER['id'], 'ally_events' => $ally_events, 'fraction' => $this->allianceData['fraction'], 'points' => $this->allianceData['alliance_points'], 'Durchschnitt' => $this->allianceData['alliance_points'] / $this->allianceData['ally_members']));
     $this->display('page.alliance.home.tpl');
 }
Esempio n. 2
0
 private function homeAlliance()
 {
     global $USER, $UNI, $LNG;
     require_once 'includes/functions/BBCode.php';
     if ($this->allianceData['ally_owner'] == $USER['id']) {
         $rankName = $this->allianceData['ally_owner_range'] != '' ? $this->allianceData['ally_owner_range'] : $LNG['al_founder_rank_text'];
     } elseif ($USER['ally_rank_id'] != 0) {
         $rankName = $GLOBALS['DATABASE']->getFirstCell("SELECT rankName FROM " . ALLIANCE_RANK . " WHERE rankID = " . $USER['ally_rank_id'] . ";");
     }
     if (empty($rankName)) {
         $rankName = $LNG['al_new_member_rank_text'];
     }
     $StatsData = $GLOBALS['DATABASE']->getFirstRow("SELECT SUM(wons) as wons, SUM(loos) as loos, SUM(draws) as draws, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\tSUM(kbmetal) as kbmetal, SUM(kbcrystal) as kbcrystal, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\tSUM(lostunits) as lostunits, SUM(desunits) as desunits \n\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . USERS . " WHERE ally_id = " . $this->allianceData['id'] . ";");
     $StatsDataBis = $GLOBALS['DATABASE']->getFirstRow("SELECT total_rank, total_points FROM uni1_statpoints WHERE id_owner = " . $this->allianceData['id'] . " AND stat_type = '2';");
     $allyCount = $GLOBALS['DATABASE']->getFirstCell("SELECT COUNT(*) FROM uni1_alliance WHERE id > '0';");
     $ApplyCount = $GLOBALS['DATABASE']->getFirstCell("SELECT COUNT(*) FROM " . ALLIANCE_REQUEST . " WHERE allianceID = " . $this->allianceData['id'] . ";");
     $ally_events = array();
     if (!empty($this->allianceData['ally_events'])) {
         $sql = "\n\t\t\tSELECT\n\t\t\t\t`id`,\n\t\t\t\t`username`\n\t\t\tFROM\n\t\t\t\t`" . USERS . "`\n\t\t\tWHERE\n\t\t\t\t`ally_id` = " . $this->allianceData['id'] . ";";
         $result = $GLOBALS['DATABASE']->query($sql);
         require_once 'includes/classes/class.FlyingFleetsTable.php';
         $FlyingFleetsTable = new FlyingFleetsTable();
         $this->tplObj->loadscript('overview.js');
         while ($row = $result->fetch_assoc()) {
             $FlyingFleetsTable->setUser($row['id']);
             $FlyingFleetsTable->setMissions($this->allianceData['ally_events']);
             $ally_events[$row['username']] = $FlyingFleetsTable->renderTable();
         }
         $ally_events = array_filter($ally_events);
     }
     $defcontext = '';
     if ($this->allianceData['defcon'] == 5) {
         $defcontext = 'Normal preparation in peacetime';
     } elseif ($this->allianceData['defcon'] == 4) {
         $defcontext = 'Normal preparation, but increased and enhanced information security measures';
         //vert
     } elseif ($this->allianceData['defcon'] == 3) {
         $defcontext = 'Increased preparation of forces beyond the normal preparation';
         //jaune
     } elseif ($this->allianceData['defcon'] == 2) {
         $defcontext = 'Further increase in the preparation of forces, but less than the maximum preparation';
         //oramnge
     } elseif ($this->allianceData['defcon'] == 1) {
         $defcontext = 'State of War: Maximum forces Preparation';
         //rouge
     }
     $this->tplObj->assign_vars(array('DiploInfo' => $this->getDiplomatic(), 'ally_web' => $this->allianceData['ally_web'], 'ally_tag' => $this->allianceData['ally_tag'], 'ally_members' => $this->allianceData['ally_members'], 'defcon' => $this->allianceData['defcon'], 'ally_max_members' => $this->allianceData['ally_members'], 'ally_name' => $this->allianceData['ally_name'], 'ally_image' => $this->allianceData['ally_image'], 'ally_description' => bbcode($this->allianceData['ally_description']), 'ally_text' => bbcode($this->allianceData['ally_text']), 'rankName' => $rankName, 'defcontext' => $defcontext, 'requests' => sprintf($LNG['al_new_requests'], $ApplyCount), 'applyCount' => $ApplyCount, 'allyCount' => $allyCount, 'total_rank' => $StatsDataBis['total_rank'], 'total_points' => pretty_number($StatsDataBis['total_points']), 'total_points_average' => pretty_number(round($StatsDataBis['total_points'] / $this->allianceData['ally_members'])), 'totalfight' => $StatsData['wons'] + $StatsData['loos'] + $StatsData['draws'], 'fightwon' => $StatsData['wons'], 'fightlose' => $StatsData['loos'], 'fightdraw' => $StatsData['draws'], 'unitsshot' => pretty_number($StatsData['desunits']), 'unitslose' => pretty_number($StatsData['lostunits']), 'dermetal' => pretty_number($StatsData['kbmetal']), 'dercrystal' => pretty_number($StatsData['kbcrystal']), 'isOwner' => $this->allianceData['ally_owner'] == $USER['id'], 'ally_owner' => $this->getUsername($this->allianceData['ally_owner']), 'ally_owner2' => $this->allianceData['ally_owner'], 'ally_events' => $ally_events, 'recruit_on' => $this->allianceData['ally_request_notallow'] == 1 ? '<span class="rouge">No</span>' : '<span class="vert">Yes</span>', 'ally_register_time' => str_replace(' ', '&nbsp;', _date($LNG['php_tdformat'], $this->allianceData['ally_register_time']), $USER['timezone'])));
     $this->display('page.alliance.home.tpl');
 }
Esempio n. 3
0
 private function homeAlliance()
 {
     global $USER, $LNG;
     require 'includes/classes/BBCode.class.php';
     $db = Database::get();
     if ($this->allianceData['ally_owner'] == $USER['id']) {
         $rankName = $this->allianceData['ally_owner_range'] != '' ? $this->allianceData['ally_owner_range'] : $LNG['al_founder_rank_text'];
     } elseif ($USER['ally_rank_id'] != 0) {
         $sql = "SELECT rankName FROM &&ALLIANCE_RANK&& WHERE rankID = :UserRankID;";
         $rankName = $db->selectSingle($sql, array(':UserRankID' => $USER['ally_rank_id']), 'rankName');
     }
     if (empty($rankName)) {
         $rankName = $LNG['al_new_member_rank_text'];
     }
     $sql = "SELECT SUM(wons) as wons, SUM(loos) as loos, SUM(draws) as draws, SUM(kbmetal) as kbmetal, SUM(kbcrystal) as kbcrystal, SUM(lostunits) as lostunits, SUM(desunits) as desunits FROM %%USERS%% WHERE ally_id = :AllianceID;";
     $statisticResult = $db->selectSingle($sql, array(':AllianceID' => $this->allianceData['id']));
     $sql = "SELECT COUNT(*) as count FROM %%ALLIANCE_REQUEST%% WHERE allianceId = :AllianceID;";
     $ApplyCount = $db->selectSingle($sql, array(':AllianceID' => $this->allianceData['id']), 'count');
     $ally_events = array();
     if (!empty($this->allianceData['ally_events'])) {
         $sql = "SELECT id, username FROM %%USERS%% WHERE ally_id = :AllianceID;";
         $result = $db->select($sql, array(':AllianceID' => $this->allianceData['id']));
         require_once 'includes/classes/class.FlyingFleetsTable.php';
         $FlyingFleetsTable = new FlyingFleetsTable();
         $this->tplObj->loadscript('overview.js');
         foreach ($result as $row) {
             $FlyingFleetsTable->setUser($row['id']);
             $FlyingFleetsTable->setMissions($this->allianceData['ally_events']);
             $ally_events[$row['username']] = $FlyingFleetsTable->renderTable();
         }
         $ally_events = array_filter($ally_events);
     }
     $this->assign(array('DiploInfo' => $this->getDiplomatic(), 'ally_web' => $this->allianceData['ally_web'], 'ally_tag' => $this->allianceData['ally_tag'], 'ally_members' => $this->allianceData['ally_members'], 'ally_max_members' => $this->allianceData['ally_members'], 'ally_name' => $this->allianceData['ally_name'], 'ally_image' => $this->allianceData['ally_image'], 'ally_description' => BBCode::parse($this->allianceData['ally_description']), 'ally_text' => BBCode::parse($this->allianceData['ally_text']), 'rankName' => $rankName, 'requests' => sprintf($LNG['al_new_requests'], $ApplyCount), 'applyCount' => $ApplyCount, 'totalfight' => $statisticResult['wons'] + $statisticResult['loos'] + $statisticResult['draws'], 'fightwon' => $statisticResult['wons'], 'fightlose' => $statisticResult['loos'], 'fightdraw' => $statisticResult['draws'], 'unitsshot' => pretty_number($statisticResult['desunits']), 'unitslose' => pretty_number($statisticResult['lostunits']), 'dermetal' => pretty_number($statisticResult['kbmetal']), 'dercrystal' => pretty_number($statisticResult['kbcrystal']), 'isOwner' => $this->allianceData['ally_owner'] == $USER['id'], 'ally_events' => $ally_events));
     $this->display('page.alliance.home.tpl');
 }