本文整理汇总了PHP中Member::findByMemberId方法的典型用法代码示例。如果您正苦于以下问题:PHP Member::findByMemberId方法的具体用法?PHP Member::findByMemberId怎么用?PHP Member::findByMemberId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Member
的用法示例。
在下文中一共展示了Member::findByMemberId方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
public static function add($member_id, $date, $reason, $comment)
{
$member = Member::findByMemberId($member_id);
$sql = "INSERT INTO " . self::$table . " ( member_id, date_end, reason, comment, game_id ) VALUES ( {$member_id}, '{$date}', '{$reason}', '{$comment}', {$member->game_id} )";
Flight::aod()->sql($sql)->one();
return array('success' => true);
}
示例2: generate
public function generate()
{
// header
$division_structure = "[table='align:center,width: {$this->info_width}']";
$division_structure .= "[tr][td]";
// banner
$division_structure .= "[center][img]http://puu.sh/kGjU9/4f331d1a99.jpg[/img][/center]\r\n";
/**
* ------division leaders-----
*/
$division_structure .= "\r\n\r\n[center][size=5][color={$this->div_name_color}][b][i][u]Division Leaders[/u][/i][/b][/color][/size][/center]\r\n";
$division_structure .= "[center][size=4]";
$division_leaders = Division::findDivisionLeaders($this->game_id);
foreach ($division_leaders as $player) {
$player_name = Rank::convert($player->rank_id)->abbr . " " . $player->forum_name;
$aod_url = Member::createAODlink(array('member_id' => $player->member_id, 'forum_name' => $player_name, 'color' => $this->division_leaders_color));
$division_structure .= "{$aod_url} - {$player->position_desc}\r\n";
}
$division_structure .= "[/size][/center]\r\n\r\n";
/**
* -----general sergeants-----
*/
$division_structure .= "[center][size=3][color={$this->platoon_pos_color}]General Sergeants[/color]\r\n";
$general_sergeants = Division::findGeneralSergeants($this->game_id);
foreach ($general_sergeants as $player) {
$player_name = Rank::convert($player->rank_id)->abbr . " " . $player->forum_name;
$aod_url = Member::createAODlink(array('member_id' => $player->member_id, 'forum_name' => $player_name));
$division_structure .= "{$aod_url}\r\n";
}
$division_structure .= "[/size][/center]";
$division_structure .= "[/td][/tr][/table]";
/**
* ---------platoons----------
*/
$division_structure .= "\r\n\r\n[table='align:center,width: {$this->players_width}']";
$platoons = $this->platoons;
$i = 1;
foreach ($platoons as $platoon) {
$countMembers = Platoon::countPlatoon($platoon->id);
if ($i == 1) {
$division_structure .= "[tr]";
$division_structure .= "[td]";
} else {
$division_structure .= "[td]";
}
$division_structure .= "[size=5]{$platoon->name}[/size]\r\n\r\n";
// Legion Commander
$player = Member::findByMemberId($platoon->leader_id);
// is a Legion Commander assigned?
if ($platoon->leader_id != 0) {
$player_name = Rank::convert($player->rank_id)->abbr . " " . $player->forum_name;
$aod_url = Member::createAODlink(array('member_id' => $player->member_id, 'forum_name' => $player_name, 'color' => $this->platoon_leaders_color));
$division_structure .= "[size=3][color={$this->platoon_pos_color}]Legion Commander[/color]\r\n{$aod_url}[/size]\r\n\r\n";
} else {
$division_structure .= "[size=3][color={$this->platoon_pos_color}]Legion Commander[/color]\r\n[color={$this->platoon_leaders_color}]TBA[/color][/size]\r\n\r\n";
}
// Regimental Leaders
$squads = Squad::findAll($this->game_id, $platoon->id);
foreach ($squads as $squad) {
if ($squad->leader_id != 0) {
$squad_leader = Member::findById($squad->leader_id);
$player_name = Rank::convert($squad_leader->rank_id)->abbr . " " . $squad_leader->forum_name;
$aod_url = Member::createAODlink(array('member_id' => $squad_leader->member_id, 'forum_name' => $player_name, 'color' => $this->squad_leaders_color));
$division_structure .= "[size=3][color={$this->platoon_pos_color}]Regimental Leader[/color]\r\n{$aod_url}[/size]\r\n\r\n";
$division_structure .= "[size=1]";
// direct recruits
$recruits = arrayToObject(Member::findRecruits($squad_leader->member_id, $squad_leader->platoon_id, $squad->id, true));
if (count((array) $recruits)) {
$division_structure .= "[list=1]";
foreach ($recruits as $player) {
$player_name = Rank::convert($player->rank_id)->abbr . " " . $player->forum_name;
$aod_url = Member::createAODlink(array('member_id' => $player->member_id, 'forum_name' => $player_name));
$division_structure .= "[*]{$aod_url}\r\n";
}
$division_structure .= "[/list]";
}
} else {
$division_structure .= "[size=3][color={$this->platoon_pos_color}]Regimental Leader[/color]\r\n[color={$this->squad_leaders_color}]TBA[/color][/size]\r\n";
$division_structure .= "[size=1]";
}
$division_structure .= "\r\n";
// squad members
$squadMembers = arrayToObject(Squad::findSquadMembers($squad->id, true, $squad_leader->member_id));
if (count((array) $squadMembers)) {
foreach ($squadMembers as $player) {
$player_name = Rank::convert($player->rank_id)->abbr . " " . $player->forum_name;
$aod_url = Member::createAODlink(array('member_id' => $player->member_id, 'forum_name' => $player_name));
$division_structure .= "{$aod_url}\r\n";
}
}
$division_structure .= "[/size]\r\n";
}
$division_structure .= "\r\n\r\n";
if ($i % $this->num_columns == 0) {
$division_structure .= "[/td][/tr][tr]";
}
$division_structure .= "[/td]";
$i++;
}
// end last platoon
//.........这里部分代码省略.........
示例3: _doUpdateMember
public static function _doUpdateMember()
{
// user attempting to make changes
$respUser = User::find(intval($_SESSION['userid']));
$respMember = Member::find(intval($_SESSION['memberid']));
// member being changed
$memberData = $_POST['memberData'];
$member = Member::findByMemberId($memberData['member_id']);
$user = User::findByMemberId(Member::findId($memberData['member_id']));
// only update values allowed by role
if (!User::isDev()) {
if ($respUser->role < 2) {
unset($memberData['squad_id'], $memberData['position_id'], $memberData['platoon_id']);
}
if ($respUser->role < 3) {
unset($memberData['platoon_id']);
}
}
// only continue if we have permission to edit the user
if (User::canEdit($memberData['member_id'], $respUser, $member) == true) {
// don't log if user edits their own profile
if ($respMember->member_id != $member->member_id) {
UserAction::create(array('type_id' => 3, 'date' => date("Y-m-d H:i:s"), 'user_id' => $respMember->member_id, 'target_id' => $member->member_id));
}
// validate recruiter
if ($memberData['recruiter'] != 0 && !Member::exists($memberData['recruiter'])) {
$data = array('success' => false, 'message' => "Recruiter id is invalid.");
// validate squad leader / squad_id setting
} else {
if ($respMember->member_id != $member->member_id && $memberData['position_id'] == 5 && $memberData['squad_id'] != 0) {
$data = array('success' => false, 'message' => "Squad leaders cannot be in a squad.");
} else {
// update member info
Member::modify($memberData);
}
}
// update games
if (isset($_POST['played_games'])) {
$games = $_POST['played_games'];
foreach ($games as $game) {
$params = new stdClass();
$params->member_id = $member->id;
$params->game_id = $game;
MemberGame::add($params);
}
}
// update user
if (isset($_POST['userData'])) {
$userData = $_POST['userData'];
// wish I had a better way to do this... yuck
$userData['developer'] = isset($userData['developer']) ? $userData['developer'] : 0;
if (!User::isDev()) {
unset($userData['developer']);
}
if ($respMember->member_id != $member->member_id && $user->role >= $respUser->role && !User::isDev()) {
$data = array('success' => false, 'message' => "You are not authorized to make that change.");
} else {
User::modify($userData);
}
}
// update aliases
if (isset($_POST['userAliases'])) {
$aliases = $_POST['userAliases'];
foreach ($aliases as $type => $value) {
$type = Handle::findByName($type)->id;
if ($value != '') {
$params = array('member_id' => $memberData['id'], 'handle_type' => $type, 'handle_value' => trim($value), 'handle_account_id' => '0', 'invalid' => '0', 'invalid_date' => '0000-00-00');
$id = MemberHandle::hasAlias($type, $memberData['id']);
if ($id) {
$params['id'] = $id;
MemberHandle::modify($params);
} else {
MemberHandle::add($params);
}
}
}
}
} else {
$data = array('success' => false, 'message' => 'You do not have permission to modify this player.');
}
if (!isset($data['success'])) {
$data = array('success' => true, 'message' => "Member information updated!");
}
// print out a pretty response
echo json_encode($data);
}
示例4: canEdit
/**
* checks user's editing abilities for a specific member
* @param int $mid the member id of the member being edited
* @param int $user the user object of the user doing the editing
* @param int $member the member object of the user doing the editing
* @return boolean self explanatory
*/
public static function canEdit($mid, $myUser, $myMember)
{
$player = Member::findByMemberId($mid);
$squad = $player->squad_id != 0 ? Squad::find($player->squad_id) : false;
// is the user a dev or clan administrator?
if (self::isDev()) {
return true;
// is the user the assigned squad leader?
} elseif ($myUser->role == 1 && $squad && $squad->leader_id == $myMember->id) {
return true;
// is the user the platoon leader of the user?
} elseif ($myUser->role == 2 && $myMember->platoon_id == $player->platoon_id) {
return true;
// is the user the division leader of the user?
} elseif ($myUser->role == 3 && $myMember->game_id == $player->game_id) {
return true;
// is the user editing someone of a lesser role, or himself?
} elseif ($mid == $myMember->member_id) {
return true;
} else {
return false;
}
}
示例5: generate
public function generate()
{
// header
$division_structure = "[table='width: {$this->info_width}']";
$division_structure .= "[tr][td]";
// banner
$division_structure .= "[center][img]http://i.imgur.com/iWpjGZG.png[/img][/center]\r\n";
/**
* ------division leaders-----
*/
$division_structure .= "\r\n\r\n[center][size=5][color={$this->div_name_color}][b][i][u]Division Leaders[/u][/i][/b][/color][/size][/center]\r\n";
$division_structure .= "[center][size=4]";
$division_leaders = Division::findDivisionLeaders($this->game_id);
foreach ($division_leaders as $leader) {
$leader_name = Rank::convert($leader->rank_id)->abbr . " " . $leader->forum_name;
$memberHandle = MemberHandle::findHandle($leader->id, $this->division->primary_handle);
$leader->handle = $memberHandle->handle_value;
$aod_url = "[url=" . CLANAOD . $leader->member_id . "]";
$bl_url = "[url=" . $memberHandle->url . $leader->handle . "][BL][/url]";
$division_structure .= "{$aod_url}[color={$this->division_leaders_color}]{$leader_name}[/url] {$bl_url}[/color] - {$leader->position_desc}\r\n";
}
$division_structure .= "[/size][/center]\r\n\r\n";
/**
* -----general sergeants-----
*/
$genSgts = Division::findGeneralSergeants($this->game_id);
$division_structure .= "[center][size=3][color={$this->platoon_pos_color}]General Sergeants[/color]\r\n";
foreach ($genSgts as $sgt) {
$sgt_name = Rank::convert($sgt->rank_id)->abbr . " " . $sgt->forum_name;
$memberHandle = MemberHandle::findHandle($sgt->id, $this->division->primary_handle);
$sgt->handle = $memberHandle->handle_value;
$aod_url = "[url=" . CLANAOD . $sgt->member_id . "]";
$bl_url = "[url=" . $memberHandle->url . $sgt->handle . "][BL][/url]";
$division_structure .= "{$aod_url}{$sgt_name}[/url] {$bl_url}\r\n";
}
$division_structure .= "[/size][/center]";
$division_structure .= "[/td][/tr][/table]";
/**
* ---------platoons----------
*/
$division_structure .= "\r\n\r\n[table='width: {$this->players_width}']";
$platoons = $this->platoons;
$i = 1;
foreach ($platoons as $platoon) {
$countMembers = Platoon::countPlatoon($platoon->id);
if ($i == 1) {
$division_structure .= "[tr]";
$division_structure .= "[td]";
} else {
$division_structure .= "[td]";
}
$division_structure .= "[size=5][color={$this->platoon_num_color}]" . ordsuffix($i) . " Platoon[/color][/size] \r\n[i][size=3]{$platoon->name} [/size][/i]\r\n\r\n";
// platoon leaders
$leader = Member::findByMemberId($platoon->leader_id);
if ($platoon->leader_id != 0) {
$memberHandle = MemberHandle::findHandle($leader->id, $this->division->primary_handle);
$leader->handle = $memberHandle->handle_value;
$aod_url = "[url=" . CLANAOD . $leader->member_id . "]";
$bl_url = "[url=" . $memberHandle->url . $leader->handle . "][BL][/url]";
$leader_name = Rank::convert($leader->rank_id)->abbr . " " . ucwords($leader->forum_name);
$division_structure .= "{$aod_url}[size=3][color={$this->platoon_pos_color}]Platoon Leader[/color]\r\n[color={$this->platoon_leaders_color}]{$leader_name}[/color][/url] {$bl_url}[/size]\r\n\r\n";
} else {
$division_structure .= "[size=3][color={$this->platoon_pos_color}]Platoon Leader[/color]\r\n[color={$this->platoon_leaders_color}]TBA[/color][/size]\r\n\r\n";
}
// squad leaders
$squads = Squad::findAll($this->game_id, $platoon->id);
foreach ($squads as $squad) {
if ($squad->leader_id != 0) {
$leader = Member::findById($squad->leader_id);
$memberHandle = MemberHandle::findHandle($leader->id, $this->division->primary_handle);
$leader->handle = $memberHandle->handle_value;
$aod_url = "[url=" . CLANAOD . $leader->member_id . "]";
$bl_url = "[url=" . $memberHandle->url . $leader->handle . "][BL][/url]";
$division_structure .= "[size=3][color={$this->platoon_pos_color}]Squad Leader[/color]\r\n{$aod_url}[color={$this->squad_leaders_color}]" . Rank::convert($leader->rank_id)->abbr . " {$leader->forum_name}[/color][/url] {$bl_url}[/size]\r\n\r\n";
$division_structure .= "[size=1]";
// direct recruits
$recruits = arrayToObject(Member::findRecruits($leader->member_id, $leader->platoon_id, $squad->id, true));
if (count((array) $recruits)) {
$division_structure .= "[list=1]";
foreach ($recruits as $recruit) {
$memberHandle = MemberHandle::findHandle($recruit->id, $this->division->primary_handle);
// does member have a member handle?
if (count((array) $memberHandle)) {
$recruit->handle = $memberHandle->handle_value;
$bl_url = "[url=" . $memberHandle->url . $recruit->handle . "][BL][/url]";
$aod_url = "[url=" . CLANAOD . $recruit->member_id . "]";
$division_structure .= "[*]{$aod_url}" . Rank::convert($recruit->rank_id)->abbr . " {$recruit->forum_name}[/url]";
$division_structure .= "{$bl_url}\r\n";
} else {
$division_structure .= " [color=red]XX[/color]\r\n";
}
}
$division_structure .= "[/list]";
}
} else {
$division_structure .= "[size=3][color={$this->platoon_pos_color}]Squad Leader[/color]\r\n[color={$this->squad_leaders_color}]TBA[/color][/size]\r\n";
$division_structure .= "[size=1]";
}
$division_structure .= "\r\n";
// squad members
//.........这里部分代码省略.........
示例6: foreach
<div class='panel-heading'>Currently Active <?php
echo Locality::run('Platoons', $division->id);
?>
</div>
<div class='list-group'>
<?php
$platoons = Platoon::find_all($division->id);
?>
<?php
if (count($platoons)) {
?>
<?php
foreach ($platoons as $platoon) {
?>
<?php
$leader = Member::findByMemberId($platoon->leader_id);
?>
<a href='divisions/<?php
echo $division->short_name;
?>
/platoon/<?php
echo $platoon->number;
?>
'
class='list-group-item platoon' data-platoon-id="<?php
echo $platoon->id;
?>
">
<div class="platoon-target"><i class="fa fa-arrow-right fa-2x"></i></div>
<h5 class='pull-right text-muted big-num count-animated'><?php
echo Platoon::countPlatoon($platoon->id);
示例7: getLoas
/**
* @param $division_structure
* @return string
*/
private function getLoas($division_structure)
{
if (count((array) LeaveOfAbsence::find_all($this->game_id))) {
$i = 1;
// header
$division_structure .= "\r\n\r\n\r\n[table='align:center,width: 500']";
$division_structure .= "[tr][td]\r\n[center][size=3][b]Leaves of Absence[/b][/size][/center][/td][/tr]";
$division_structure .= "[/table]\r\n\r\n";
// players
$division_structure .= "[table='align:center,width: 500']";
$loas = LeaveOfAbsence::find_all($this->game_id);
foreach ($loas as $player) {
$date_end = strtotime($player->date_end) < strtotime('now') ? "[COLOR='#FF0000']Expired " . formatTime(strtotime($player->date_end)) . "[/COLOR]" : date("M d, Y", strtotime($player->date_end));
$profile = Member::findByMemberId($player->member_id);
$aod_url = Member::createAODlink(array('member_id' => $player->member_id, 'forum_name' => "AOD_" . $profile->forum_name));
$division_structure .= "[tr][td]{$aod_url}[/td][td]{$date_end}[/td][td]{$player->reason}[/td][/tr]";
$i++;
}
$division_structure .= "[/table]";
return $division_structure;
}
return $division_structure;
}