本文整理汇总了PHP中Team类的典型用法代码示例。如果您正苦于以下问题:PHP Team类的具体用法?PHP Team怎么用?PHP Team使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Team类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: with
/**
* Only include matches where a specific team played
*
* @param Team $team Team The team which played the matches
* @param string $result string|null The outcome of the matches (win, draw or loss)
* @return self
*/
public function with($team, $result = null)
{
if (!$team || !$team->isValid()) {
return $this;
}
switch ($result) {
case "wins":
case "win":
case "victory":
case "victories":
$query = "(team_a = ? AND team_a_points > team_b_points) OR (team_b = ? AND team_b_points > team_a_points)";
break;
case "loss":
case "lose":
case "losses":
case "defeat":
case "defeats":
$query = "(team_a = ? AND team_b_points > team_a_points) OR (team_b = ? AND team_a_points > team_b_points)";
break;
case "draw":
case "draws":
case "tie":
case "ties":
$query = "(team_a = ? OR team_b = ?) AND team_a_points = team_b_points";
break;
default:
$query = "team_a = ? OR team_b = ?";
}
$this->conditions[] = $query;
$this->parameters[] = $team->getId();
$this->parameters[] = $team->getId();
$this->types .= 'ii';
return $this;
}
开发者ID:kleitz,项目名称:bzion,代码行数:41,代码来源:MatchQueryBuilder.php
示例2: BuildPostedItem
/**
* Re-build from data posted by this control a single data object which this control is editing
*
* @param int $i_counter
* @param int $i_id
*/
protected function BuildPostedItem($i_counter = null, $i_id = null)
{
$s_key = $this->GetNamingPrefix() . 'Points' . $i_counter;
$s_award_key = $this->GetNamingPrefix() . 'Awarded' . $i_counter;
$i_points = (int) (isset($_POST[$s_key]) and is_numeric($_POST[$s_key])) ? $_POST[$s_key] : 0;
if (isset($_POST[$s_award_key]) and $_POST[$s_award_key] == '2') {
$i_points = $i_points - $i_points * 2;
}
$s_key = $this->GetNamingPrefix() . 'PointsTeam' . $i_counter;
$o_team = null;
$o_team = new Team($this->GetSettings());
if (isset($_POST[$s_key]) and is_numeric($_POST[$s_key])) {
$o_team->SetId($_POST[$s_key]);
}
$s_key = $this->GetNamingPrefix() . 'Reason' . $i_counter;
$s_reason = (isset($_POST[$s_key]) and strlen($_POST[$s_key]) <= 200) ? $_POST[$s_key] : '';
if ($i_points != 0 or $o_team->GetId() or $s_reason) {
$o_adjust = new PointsAdjustment($i_id, $i_points, $o_team, $s_reason);
$i_date = $this->BuildPostedItemModifiedDate($i_counter, $o_adjust);
$o_adjust->SetDate($i_date);
$this->DataObjects()->Add($o_adjust);
} else {
$this->IgnorePostedItem($i_counter);
}
}
开发者ID:stoolball-england,项目名称:stoolball-england-website,代码行数:31,代码来源:points-adjustments-editor.class.php
示例3: __construct
function __construct($team_id, $jm)
{
$this->team_id = $team_id;
$this->jm = $jm;
$team = new Team($_GET["teamid"]);
$this->games = $team->mv_won + $team->mv_lost + $team->mv_draw;
$this->players = $team->getPlayers();
$this->name = $team->name;
$this->race = $team->f_rname;
$this->race_id = $team->f_race_id;
$this->coach_name = $team->f_cname;
$this->rerolls = $team->rerolls;
$this->fan_factor = $team->rg_ff;
$this->ass_coaches = $team->ass_coaches;
$this->cheerleaders = $team->cheerleaders;
$this->apothecary = $team->apothecary;
$this->apothecary = $this->apothecary == "1" ? "true" : "false";
$this->treasury = $team->treasury;
$this->tv = $team->value;
#for cyanide roster only
if (!$this->checkJourneymen()) {
return false;
}
$this->name = $team->name;
$this->coach_name = $team->f_cname;
$this->createRoster();
}
开发者ID:nicholasmr,项目名称:obblm,代码行数:27,代码来源:class_xml_botocs.php
示例4: _ops_delete
function _ops_delete($OID = 0, $CID = 0)
{
$OID = max(0, intval($OID));
$CID = max(0, intval($CID));
$msg = '';
loginRequireMgmt();
if (!loginCheckPermission(USER::MGMT_TEAM)) {
redirect("errors/401");
}
$itemName = "Team";
$urlPrefix = "mgmt_team";
$object = new Team($OID, $CID);
if (!$object->exists()) {
$msg = "{$itemName} not found!";
} else {
transactionBegin();
if ($object->delete()) {
transactionCommit();
$msg = "{$itemName} deleted!";
} else {
TransactionRollback();
$msg = "{$itemName} delete failed!";
}
}
redirect("{$urlPrefix}/manage", $msg);
}
开发者ID:brata-hsdc,项目名称:brata.masterserver,代码行数:26,代码来源:ops_delete.php
示例5: get_teams_wct_slam
function get_teams_wct_slam($linescorebox, $gender)
{
$players_html = $linescorebox->next_sibling();
while ($players_html->tag != 'table') {
$players_html = $players_html->next_sibling();
}
$stats_html = $players_html->find(".stats_row");
$players_html = $players_html->find(".stats_fourthrow");
$player_count = 0;
$team1 = new Team();
$team2 = new Team();
//Go through each player and get their name, position and stats.
for ($i = 0; $i < count($stats_html) / 6; $i++) {
$position = preg_replace("/[^0-9]/", "", $stats_html[$i * 6]);
$first_name = str_replace(" ", "", trim(substr($players_html[$i]->plaintext, 0, stripos($players_html[$i]->innertext, " "))));
$last_name = trim(substr($players_html[$i]->plaintext, stripos($players_html[$i]->innertext, " ")));
$percentage = preg_replace("/[^0-9]/", "", $stats_html[$i * 6 + 5]);
$number_of_shots = preg_replace("/[^0-9]/", "", $stats_html[$i * 6 + 1]);
if ($player_count < 4) {
$team1->add_player(new Player($first_name, $last_name, $position, new Stats($percentage, $number_of_shots), $gender));
} else {
if ($player_count < 8) {
$team2->add_player(new Player($first_name, $last_name, $position, new Stats($percentage, $number_of_shots), $gender));
} else {
echo "ERROR: More than 8 players";
}
}
$player_count++;
}
$team1->gender = $gender;
$team2->gender = $gender;
return array($team1, $team2);
}
开发者ID:brthiess,项目名称:rockstat_final,代码行数:33,代码来源:wct_score.php
示例6: _ops_update_score
function _ops_update_score()
{
$OID = max(0, intval($_POST['OID']));
$CID = max(0, intval($_POST['CID']));
$msg = "";
loginRequireMgmt();
if (!loginCheckPermission(USER::MGMT_TEAM)) {
redirect("errors/401");
}
$itemName = "Team";
$urlPrefix = "mgmt_team";
$object = new Team();
if ($OID) {
$object->retrieve($OID, $CID);
if (!$object->exists()) {
$msg = "{$itemName} not found!";
} else {
transactionBegin();
if ($object->updateTotalScore()) {
Event::createEvent(EVENT::TYPE_EDIT, $object, Station::getRegistrationStation(), 0, $_POST);
// just put the post data into the event
transactionCommit();
$msg = "{$itemName} updated!";
} else {
transactionRollback();
$msg = "{$itemName} update failed";
}
}
} else {
$msg = "attempting to create team from ops_update_score which is not supported";
}
redirect("{$urlPrefix}/manage", $msg);
}
开发者ID:brata-hsdc,项目名称:brata.masterserver,代码行数:33,代码来源:ops_update_score.php
示例7: _edit_score
function _edit_score($OID = 0, $CID = 0)
{
loginRequireMgmt();
if (!loginCheckPermission(USER::MGMT_TEAM)) {
redirect("errors/401");
}
$item = "Team";
$urlPrefix = "mgmt_team";
$object = new Team();
$object->retrieve($OID, $CID);
if (!$object->exists()) {
$data['body'][] = "<p>{$item} Not Found!</p>";
} else {
$fdata['form_heading'] = "Edit {$item} Score";
$fdata['object'] = $object;
$fdata['actionUrl'] = myUrl("{$urlPrefix}/ops_update_score");
$fdata['actionLabel'] = "Submit";
$fdata['cancelUrl'] = myUrl("{$urlPrefix}/manage");
$fdata['cancelLabel'] = "Cancel";
$form = View::do_fetch(VIEW_PATH . "{$urlPrefix}/score_form.php", $fdata);
$data['head'][] = View::do_fetch(VIEW_PATH . "{$urlPrefix}/score_form_js.php");
$data['body'][] = "<h2>Edit {$item} Score</h2>";
$data['body'][] = $form;
}
View::do_dump(VIEW_PATH . 'layouts/mgmtlayout.php', $data);
}
开发者ID:brata-hsdc,项目名称:brata.masterserver,代码行数:26,代码来源:edit_score.php
示例8: BuildPostedItem
/**
* Re-build from data posted by this control a single data object which this control is editing
*
* @param int $i_counter
* @param int $i_id
*/
protected function BuildPostedItem($i_counter = null, $i_id = null)
{
$match = new Match($this->GetSettings());
$match->SetMatchType(MatchType::TOURNAMENT_MATCH);
$key = $this->GetNamingPrefix() . 'MatchId' . $i_counter;
if (isset($_POST[$key]) and is_numeric($_POST[$key])) {
$match->SetId($_POST[$key]);
}
$key = $this->GetNamingPrefix() . 'MatchOrder' . $i_counter;
if (isset($_POST[$key]) and is_numeric($_POST[$key])) {
$match->SetOrderInTournament($_POST[$key]);
}
$key = $this->GetNamingPrefix() . 'MatchIdValue' . $i_counter;
if (isset($_POST[$key])) {
$match->SetTitle($_POST[$key]);
}
$key = $this->GetNamingPrefix() . 'HomeTeamId' . $i_counter;
if (isset($_POST[$key]) and $_POST[$key]) {
$team = new Team($this->GetSettings());
$team->SetId($_POST[$key]);
$match->SetHomeTeam($team);
}
$key = $this->GetNamingPrefix() . 'AwayTeamId' . $i_counter;
if (isset($_POST[$key]) and $_POST[$key]) {
$team = new Team($this->GetSettings());
$team->SetId($_POST[$key]);
$match->SetAwayTeam($team);
}
if ($match->GetId() or $match->GetHomeTeamId() and $match->GetAwayTeamId()) {
$this->DataObjects()->Add($match);
} else {
$this->IgnorePostedItem($i_counter);
}
}
开发者ID:stoolball-england,项目名称:stoolball-england-website,代码行数:40,代码来源:matches-in-tournament-editor.class.php
示例9: store
/**
* Store a newly created resource in storage.
* POST /group
*
* @return Response
*/
public function store($id)
{
//create sub team
//return Redirect::action('SubController@create',$id)->with( 'notice', 'This action cannot be perform at this moment, please comeback soon.');
$user = Auth::user();
$club = $user->clubs()->FirstOrFail();
$parent_team = Team::find($id);
$uuid = Uuid::generate();
$validator = Validator::make(Input::all(), Team::$rules_group);
if ($validator->passes()) {
$team = new Team();
$team->id = $uuid;
$team->name = Input::get('name');
$team->season_id = $parent_team->season_id;
$team->program_id = $parent_team->program_id;
$team->description = $parent_team->description;
$team->early_due = $parent_team->getOriginal('early_due');
$team->early_due_deadline = $parent_team->early_due_deadline;
$team->due = $parent_team->getOriginal('due');
$team->plan_id = $parent_team->plan_id;
$team->open = $parent_team->open;
$team->close = $parent_team->close;
$team->max = Input::get('max');
$team->status = $parent_team->getOriginal('status');
$team->parent_id = $parent_team->id;
$team->club_id = $club->id;
$team->allow_plan = 1;
$status = $team->save();
if ($status) {
return Redirect::action('TeamController@show', $parent_team->id)->with('messages', 'Group created successfully');
}
}
$error = $validator->errors()->all(':message');
return Redirect::action('SubController@create', $id)->withErrors($validator)->withInput();
}
开发者ID:illuminate3,项目名称:league-production,代码行数:41,代码来源:SubController.php
示例10: delete
function delete()
{
$this->is_loggedin();
global $runtime;
$to_trash = new Team($runtime['ident']);
$to_trash->delete();
redirect('teams/all');
}
开发者ID:stas,项目名称:bebuntu,代码行数:8,代码来源:teams-controller.php
示例11: action
public function action()
{
$team = new Team();
$team->initById($this->parameters->teamId);
$teamInJSON = JSONPrepare::team($team);
$teamInJSON["footballers"] = JSONPrepare::footballers(FootballerSatellite::initForTeam($team));
$teamInJSON["sponsors"] = JSONPrepare::sponsors(SponsorSatellite::initForTeam($team));
$this->result['team'] = $teamInJSON;
}
开发者ID:rootree,项目名称:vk-footboller-server,代码行数:9,代码来源:TeamProfileController.php
示例12: createByName
public function createByName($name)
{
print_r('[' . $name . ']');
$document = new Team();
$document->setName($name);
$document->setSlug();
$document->save();
$document = $this->findOneBySlug($document->getSlug());
return $document;
}
开发者ID:bigjoevtrj,项目名称:codeigniter-bootstrap,代码行数:10,代码来源:levelrepository.php
示例13: _clear_scores
function _clear_scores()
{
$team = new Team();
$allTeams = $team->retrieve_many("OID>?", array(0));
foreach ($allTeams as $team) {
$team->clearScore();
}
Event::clearEvents();
redirect('mgmt_main', 'Scores cleared');
}
开发者ID:brata-hsdc,项目名称:brata.masterserver,代码行数:10,代码来源:clear_scores.php
示例14: lamtech_preprocess_node
function lamtech_preprocess_node(&$vars)
{
// kpr($vars);
if (isset($vars['content']['field_category']) && count($vars['content']['field_category'])) {
$vars['category'] = $vars['content']['field_category'][0];
unset($vars['content']['field_category']);
}
$helper = NULL;
switch ($vars['type']) {
case 'cta':
require_once DRUPAL_ROOT . '/' . drupal_get_path('theme', 'lamtech') . '/tpl/anb/cta/CTA.php';
$helper = new CTA();
$helper->preprocess($vars);
break;
case 'features_intro':
require_once DRUPAL_ROOT . '/' . drupal_get_path('theme', 'lamtech') . '/tpl/anb/fi/FeaturesIntro.php';
$helper = new FeaturesIntro();
$helper->preprocess($vars);
break;
case 'gallery':
require_once DRUPAL_ROOT . '/' . drupal_get_path('theme', 'lamtech') . '/tpl/anb/gallery/Gallery.php';
$helper = new Gallery();
$helper->preprocess($vars);
break;
case 'testimonials':
require_once DRUPAL_ROOT . '/' . drupal_get_path('theme', 'lamtech') . '/tpl/anb/testimonials/Testimonials.php';
$helper = new Testimonials();
$helper->preprocess($vars);
break;
case 'hero':
require_once DRUPAL_ROOT . '/' . drupal_get_path('theme', 'lamtech') . '/tpl/anb/hero/Hero.php';
$helper = new Hero();
$helper->preprocess($vars);
break;
case 'team':
require_once DRUPAL_ROOT . '/' . drupal_get_path('theme', 'lamtech') . '/tpl/anb/team/Team.php';
$helper = new Team();
$helper->preprocess($vars);
break;
case 'statistic':
require_once DRUPAL_ROOT . '/' . drupal_get_path('theme', 'lamtech') . '/tpl/anb/statistic/Statistic.php';
$helper = new Statistic();
$helper->preprocess($vars);
break;
case 'contact_info':
require_once DRUPAL_ROOT . '/' . drupal_get_path('theme', 'lamtech') . '/tpl/anb/contact-info/ContactInfo.php';
$helper = new ContactInfo();
$helper->preprocess($vars);
break;
case 'advanced_page':
unset($vars['content']['field_hide_title']);
break;
}
// kpr($vars);
}
开发者ID:LamTechConsult,项目名称:lamtechsl,代码行数:55,代码来源:template.php
示例15: getAllTeams
private function getAllTeams()
{
$teams = array();
$result = db_select('team', 't')->fields('t')->orderBy('name')->execute();
while ($record = $result->fetchAssoc()) {
$team = new Team($record['teamid'], $record['name'], $record['active_yn']);
$team->setSavedDateTimeAndUser($record['saved_datetime'], $record['saved_userid']);
array_push($teams, $team);
}
return $teams;
}
开发者ID:andrewfahl,项目名称:Hockey-Stats,代码行数:11,代码来源:Application.php
示例16: getPlannedTeamGames
public static function getPlannedTeamGames(Team $oTeam, $bIncludeEvents = true)
{
$query = "SELECT Game.*\r\n\t\t\t\t\t\tFROM Game\t\t\t\t\t\t\r\n\t\t\t\t\t\tWHERE Game.date >= CURDATE()\r\n\t\t\t\t\t\tAND\r\n\t\t\t\t\t\t(\r\n\t\t\t\t\t\t\tGame.team1_nefub_id = '" . $oTeam->nefub_id . "'\r\n\t\t\t\t\t\t\tOR\r\n\t\t\t\t\t\t\tGame.team2_nefub_id = '" . $oTeam->nefub_id . "'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tOR\r\n\t\t\t\t\t\t\tGame.nefub_id IN\r\n\t\t\t\t\t\t\t(\r\n\t\t\t\t\t\t\t\tSELECT Referee.game_nefub_id\r\n\t\t\t\t\t\t\t\tFROM Referee\r\n\t\t\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t\tReferee.team_nefub_id = '" . $oTeam->nefub_id . "'\r\n\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t)\r\n\t\t\t\t\t\tAND Game.date IS NOT NULL\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\tORDER BY Game.date ASC,\r\n\t\t\t\t\tGame.time ASC";
$aGames = Game::getAllFromQuery($query);
if ($bIncludeEvents) {
$oGender = $oTeam->getCompetition()->getGender();
$oGenre = $oTeam->getCompetition()->getGenre();
$aEvents = Event::getAll(array('gender_id' => $oGender->getId(), 'genre_id' => $oGenre->getId(), 'season_nefub_id' => Season::getInstance()->nefub_id), 'date');
}
return $aGames;
}
开发者ID:rjpijpker,项目名称:nefub-mobile,代码行数:11,代码来源:Calendar.php
示例17: action
public function action()
{
$this->result['teams'] = array();
track_stats();
// Отслеживаем производительность
$sql_template = "SELECT\n *, unix_timestamp(tour_bonus_time) as tour_bonus_time \n FROM teams\n WHERE \n%d < param_sum AND param_sum < %d AND MOD(vk_id, %d) = 0 AND able_to_choose = 1\n LIMIT 30";
$sql = sprintf($sql_template, $this->teamProfile->getParameterSum() - GlobalParameters::ENEMY_RANGE, $this->teamProfile->getParameterSum() + GlobalParameters::ENEMY_RANGE, rand(0, 29));
$teamResult = SQL::getInstance()->query($sql);
if ($teamResult instanceof ErrorPoint) {
return $teamResult;
}
track_stats();
// Отслеживаем производительность
if ($teamResult->num_rows) {
while ($teamObject = $teamResult->fetch_object()) {
if (empty($teamObject->user_name) || $teamObject->vk_id == $this->teamProfile->getSocialUserId()) {
continue;
}
$team = new Team();
$team->initFromDB($teamObject);
$chnase = Utils::detectChanceOfWin($this->teamProfile, $team);
$teamInJSON = JSONPrepare::team($team);
$teamInJSON["score"] = md5($chnase . $team->getSocialUserId() . SECRET_KEY);
$this->result['teams'][] = $teamInJSON;
}
track_stats();
// Отслеживаем производительность
} else {
$sql_template = "SELECT\n *, unix_timestamp(tour_bonus_time) as tour_bonus_time\nFROM teams\n WHERE\n%d < (param_sum) AND\n(param_sum) < %d AND\nMOD(vk_id, %d) = 0 and able_to_choose = 1\n LIMIT 30";
$sql = sprintf($sql_template, $this->teamProfile->getParameterSum() - GlobalParameters::ENEMY_RANGE * 3, $this->teamProfile->getParameterSum() + GlobalParameters::ENEMY_RANGE * 3, rand(0, 29));
$teamResult = SQL::getInstance()->query($sql);
if ($teamResult instanceof ErrorPoint) {
return $teamResult;
}
track_stats();
// Отслеживаем производительность
if ($teamResult->num_rows) {
while ($teamObject = $teamResult->fetch_object()) {
if (empty($teamObject->user_name) || $teamObject->vk_id == $this->teamProfile->getSocialUserId()) {
continue;
}
$team = new Team();
$team->initFromDB($teamObject);
$teamInJSON = JSONPrepare::team($team);
$chnase = Utils::detectChanceOfWin($this->teamProfile, $team);
//$teamInJSON["score"] = Utils::detectChanceOfWin($this->teamProfile, $team);
$teamInJSON["score"] = md5($chnase . $team->getSocialUserId() . SECRET_KEY);
$this->result['teams'][] = $teamInJSON;
}
track_stats();
// Отслеживаем производительность
}
}
}
开发者ID:rootree,项目名称:vk-footboller-server,代码行数:54,代码来源:EnemyController.php
示例18: Test
/**
* (non-PHPdoc)
* @see data/validation/DataValidator#Test($s_input, $a_keys)
*/
public function Test($a_data, $a_keys)
{
/* Only way to be sure of testing name against what it will be matched against is to use the code that transforms it when saving */
$team = new Team($this->GetSiteSettings());
$team->SetName($a_data[$a_keys[1]]);
$team->SetPlayerType($a_data[$a_keys[2]]);
$team_manager = new TeamManager($this->GetSiteSettings(), $this->GetDataConnection());
$team = $team_manager->MatchExistingTeam($team);
unset($team_manager);
$current_id = isset($a_data[$a_keys[0]]) ? $a_data[$a_keys[0]] : null;
return !$team->GetId() or $team->GetId() == $current_id;
}
开发者ID:stoolball-england,项目名称:stoolball-england-website,代码行数:16,代码来源:team-name-validator.class.php
示例19: getTeamsArray
public static function getTeamsArray($rowSets)
{
// Returns an array of User objects extracted from $rowSets
$teams = array();
if (!empty($rowSets)) {
foreach ($rowSets as $teamRow) {
$team = new Team($teamRow);
$team->setTeamId($teamRow['id']);
array_push($teams, $team);
}
}
return $teams;
}
开发者ID:Trivette,项目名称:cs4413,代码行数:13,代码来源:TeamDB.class.php
示例20: getOrCreateTeam
protected function getOrCreateTeam($name, $nickname)
{
$nickname = trim($nickname);
$name = trim(str_replace($nickname, '', $name));
$slug = $this->CI->slugify->simple($name);
$team = $this->CI->_team->findOneBySlug($slug);
if (!$team) {
$team = new Team();
$team->setName($name);
$team->setNickname($nickname);
$team->save();
}
return $team;
}
开发者ID:bigjoevtrj,项目名称:codeigniter-bootstrap,代码行数:14,代码来源:PointstreakParse.php
注:本文中的Team类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论