本文整理汇总了PHP中Division::findByName方法的典型用法代码示例。如果您正苦于以下问题:PHP Division::findByName方法的具体用法?PHP Division::findByName怎么用?PHP Division::findByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Division
的用法示例。
在下文中一共展示了Division::findByName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _manage_platoon
public static function _manage_platoon($div, $plt)
{
$division = Division::findByName(strtolower($div));
$platoonId = Platoon::getIdFromNumber($plt, $division->id);
if (!is_null($platoonId)) {
$user = User::find(intval($_SESSION['userid']));
$member = Member::find(intval($_SESSION['memberid']));
if ($member->platoon_id == $platoonId || $user->role > 2 || User::isDev()) {
$tools = Tool::find_all($user->role);
$divisions = Division::find_all();
$platoon = Platoon::findById($platoonId);
$unassignedMembers = Platoon::unassignedMembers($platoonId, true);
$squads = Squad::findByPlatoonId($platoonId);
$memberCount = count((array) Platoon::members($platoonId));
$js = 'manage';
Flight::render('manage/platoon', compact('division', 'platoon', 'squads', 'unassignedMembers', 'memberCount'), 'content');
Flight::render('layouts/application', compact('js', 'user', 'member', 'tools', 'divisions'));
} else {
// insufficient access
Flight::redirect('404/', 404);
}
} else {
// nonexistent platoon
Flight::redirect('404/', 404);
}
}
示例2: _activity
public static function _activity($findBy = false)
{
$user = User::find(intval($_SESSION['userid']));
$member = Member::find(intval($_SESSION['memberid']));
$tools = Tool::find_all($user->role);
$divisions = Division::find_all();
$division = Division::findById(intval($member->game_id));
if ($findBy) {
$division = Division::findByName($findBy);
}
Flight::render('application/activity', compact('division'), 'content');
Flight::render('layouts/application', compact('user', 'member', 'tools', 'divisions'));
}
示例3: _index
public static function _index($div)
{
$user = User::find(intval($_SESSION['userid']));
$member = Member::find(intval($_SESSION['memberid']));
$tools = Tool::find_all($user->role);
$divisions = Division::find_all();
$division = Division::findByName(strtolower($div));
$js = 'division';
if (property_exists($division, 'id')) {
$division_leaders = Division::findDivisionLeaders($division->id);
Flight::render('division/main/statistics', compact('division'), 'statistics');
Flight::render('division/main/index', compact('user', 'member', 'division', 'division_leaders'), 'content');
Flight::render('layouts/application', compact('user', 'member', 'tools', 'divisions', 'js'));
} else {
Flight::redirect('/404', 404);
}
}
示例4: _generateDivisionTop10
public static function _generateDivisionTop10($division)
{
$division = Division::findByName($division)->id;
// error_reporting(E_ALL);
// ini_set('display_errors', 1);
header('Content-Type: image/png');
date_default_timezone_set('America/New_York');
$im = imagecreatetruecolor(960, 330);
// color
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$darkergrey = imagecolorallocate($im, 30, 30, 30);
$orange = imagecolorallocate($im, 255, 108, 0);
$darkGrey = imagecolorallocate($im, 50, 50, 50);
$im = imagecreatefrompng("assets/images/stats_templates/top10/big-bg.png");
$text = "Battlefield Division";
$dateText = date('d M', strtotime('-30 days')) . " - " . date('d M');
$tinyfont = "assets/fonts/copy0855.ttf";
$tinyboldfont = "assets/fonts/copy0866.ttf";
$bigfont = "assets/fonts/din-black.otf";
// x value positions
$games_col_1 = 190;
$num_col_1 = 23;
$name_col_1 = 45;
$games_col_2 = 465;
$num_col_2 = 300;
$name_col_2 = 320;
$total_count_x = 639;
$total_count_y = 110;
$recruits_x = 639;
$recruits_y = 205;
/**
* get data
*/
try {
$daily = BfActivity::topListTodayByDivision($division);
$monthly = BfActivity::topList30DaysByDivision($division);
if (!$daily) {
throw new Exception($daily['message'], 1);
}
if (!$monthly) {
throw new Exception($monthly['message'], 1);
}
/**
* create elements
*/
// date
// imagettftext($im, 6, 0, 715, 240, $darkGrey, $tinyfont, strtoupper($dateText));
// daily stats
$y = 65;
$i = 1;
imagettftext($im, 6, 0, $num_col_1, $y, $orange, $tinyfont, strtoupper("#"));
imagettftext($im, 6, 0, $name_col_1, $y, $orange, $tinyfont, strtoupper("Player"));
imagettftext($im, 6, 0, $games_col_1, $y, $orange, $tinyfont, strtoupper("AOD Games"));
foreach ($daily as $player) {
$y = $y + 20;
$name = strtoupper($player->rank) . " " . strtoupper($player->forum_name);
// number
imagettftext($im, 6, 0, $num_col_1, $y, $orange, $tinyfont, "{$i}.");
// name
imagettftext($im, 6, 0, $name_col_1, $y, $white, $tinyfont, $name);
// games
imagettftext($im, 6, 0, $games_col_1, $y, $white, $tinyboldfont, "{$player->aod_games}");
$i++;
}
// monthly stats
$y = 65;
$i = 1;
imagettftext($im, 6, 0, $num_col_2, $y, $orange, $tinyfont, strtoupper("#"));
imagettftext($im, 6, 0, $name_col_2, $y, $orange, $tinyfont, strtoupper("Player"));
imagettftext($im, 6, 0, $games_col_2, $y, $orange, $tinyfont, strtoupper("AOD Games"));
foreach ($monthly as $player) {
$y = $y + 20;
$name = strtoupper($player->rank) . " " . strtoupper($player->forum_name);
// number
imagettftext($im, 6, 0, $num_col_2, $y, $orange, $tinyfont, "{$i}.");
// name
imagettftext($im, 6, 0, $name_col_2, $y, $white, $tinyfont, $name);
// games
imagettftext($im, 6, 0, $games_col_2, $y, $white, $tinyboldfont, "{$player->aod_games}");
$i++;
}
// total aod games stat
$personnel = new stdClass();
$personnel->recruitsThisMonth = Division::recruitsThisMonth($division)->count;
$personnel->totalCount = Division::totalCount($division)->count;
$personnel->recruitsThisMonth = sprintf('%03d', $personnel->recruitsThisMonth);
imagettftext($im, 36, 0, $total_count_x, $total_count_y, $white, $bigfont, $personnel->totalCount);
imagettftext($im, 36, 0, $recruits_x, $recruits_y, $white, $bigfont, $personnel->recruitsThisMonth);
} catch (Exception $e) {
$im = imagecreatefrompng("assets/images/stats_templates/top10/big-bg-error.png");
imagettftext($im, 6, 0, 10, 320, $darkGrey, $tinyfont, strtoupper($e->getMessage()));
}
imagepng($im);
imagepng($im, "assets/images/toplist-cache.png");
imagedestroy($im);
}
示例5: _reports
public static function _reports()
{
$user = User::find(intval($_SESSION['userid']));
$member = Member::find(intval($_SESSION['memberid']));
$tools = Tool::find_all($user->role);
$divisions = Division::find_all();
$division = Division::findByName(strtolower($div));
Flight::render('modals/reports');
}