本文整理汇总了PHP中Team类的典型用法代码示例。如果您正苦于以下问题:PHP Team类的具体用法?PHP Team怎么用?PHP Team使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Team类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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();
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
示例10: delete
function delete()
{
$this->is_loggedin();
global $runtime;
$to_trash = new Team($runtime['ident']);
$to_trash->delete();
redirect('teams/all');
}
示例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;
}
示例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;
}
示例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');
}
示例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);
}
示例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;
}