function _submit($stationTag = null) { if ($stationTag === null) { trace("brata missing stationId", __FILE__, __LINE__, __METHOD__); rest_sendBadRequestResponse(400, "missing stationId"); // doesn't return } $station = Station::getFromTag($stationTag); if ($station === false) { trace("brata can't find station stationTag=" . $stationTag, __FILE__, __LINE__, __METHOD__); rest_sendBadRequestResponse(404, "can't find station stationTag=" . $stationTag); // doesn't return } $json = json_getObjectFromRequest("POST"); // won't return if an error happens json_checkMembers("message,team_id", $json); $team = Team::getFromPin($json['team_id']); if ($team === false) { trace("can't find team from team " . $json['team_id']); rest_sendBadRequestResponse(404, "can't find team pin=" . $json['team_id']); } $stationType = new StationType($station->get('typeId'), -1); if ($stationType === false) { trace("can't find station type stationTag = " . $stationTag, __FILE__, __LINE__, __METHOD__); rest_sendBadRequestResponse(500, "can't find station type stationTag=" . $stationTag); } try { $xxxData = XXXData::factory($stationType->get('typeCode')); $msg = $xxxData->brataSubmit($json['message'], $team, $station, $stationType); json_sendObject(array('message' => $msg)); } catch (InternalError $ie) { rest_sendBadRequestResponse($ie->getCode(), $ie->getMessage()); } }
/** * 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; }
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(); }
/** * 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); } }
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); }
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); }
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); }
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); }
/** * 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); } }
/** * 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(); }
function delete() { $this->is_loggedin(); global $runtime; $to_trash = new Team($runtime['ident']); $to_trash->delete(); redirect('teams/all'); }
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; }
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'); }
public function createByName($name) { print_r('[' . $name . ']'); $document = new Team(); $document->setName($name); $document->setSlug(); $document->save(); $document = $this->findOneBySlug($document->getSlug()); return $document; }
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); }
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; }
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(); // Отслеживаем производительность } } }
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; }
/** * (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; }
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; }
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; }
function get_home_team() { $CI = & get_instance(); if (isset($CI->fs_loaded->home_team)) return $CI->fs_loaded->home_team; $hometeam = get_setting('fs_gen_default_team'); $team = new Team(); $team->where('name', $hometeam)->limit(1)->get(); if ($team->result_count() < 1) { $team = new Team(); $team->limit(1)->get(); } return $team; }
public function add_joint_via_name($teams) { $result = array(); foreach ($teams as $team) { $tea = new Team(); $tea->where('name', $team)->get(); if ($tea->result_count() == 0) { set_notice('error', _('One of the named teams doesn\'t exist.')); log_message('error', 'add_joint_via_name: team does not exist'); return false; } $result[] = $tea->id; } return $this->add_joint($result); }
/** * Comodity get() function that fetches extra data for the chapter selected. * It doesn't get the pages. For pages, see: $this->get_pages() * * @author Woxxy * @param integer|NULL $limit Limit the number of results. * @param integer|NULL $offset Offset the results when limiting. * @return DataMapper Returns self for method chaining. */ public function get_bulk($limit = NULL, $offset = NULL) { // Call the get() $result = $this->get($limit, $offset); // Return instantly on false. if (!$result) { return $result; } // For each item we fetched, add the data, beside the pages foreach ($this->all as $item) { $item->comic = new Comic($this->comic_id); $teams = new Team(); $item->teams = $teams->get_teams($this->team_id, $this->joint_id); } return $result; }
function process() { global $lr_session; $this->title = $this->team->name; $this->template_name = 'pages/team/view.tpl'; $this->smarty->assign('team', $this->team); if ($this->team->home_field) { $field = Field::load(array('fid' => $this->team->home_field)); $this->smarty->assign('home_field', $field); } $teamSBF = $this->team->calculate_sbf(); if ($teamSBF) { $this->smarty->assign('team_sbf', $teamSBF); $league = League::load(array('league_id' => $this->team->league_id)); $this->smarty->assign('league_sbf', $league->calculate_sbf()); } if ($lr_session->has_permission('team', 'player shirts', $this->team->team_id)) { $this->smarty->assign('display_shirts', true); } $rosterPositions = Team::get_roster_positions(); $this->smarty->assign('roster_positions', $rosterPositions); $this->team->get_roster(); $this->team->check_roster_conflict(); foreach ($this->team->roster as $player) { $player->status = $rosterPositions[$player->status]; } $min_roster = $league->min_roster_size; if ($this->team->roster_count < $min_roster && ($lr_session->is_captain_of($this->team->team_id) || $lr_session->is_admin()) && $this->team->roster_deadline > 0) { $this->smarty->assign('roster_requirement', $min_roster); $this->smarty->assign('display_roster_note', true); } return true; }
/** * @return Team */ public function getTeam() { if (!$this->team) { $this->team = Team::getByNefubId($this->team_nefub_id); } return $this->team; }
public function getTeam() { if ($this->teamObj == UNPREPARED) { $this->teamObj = Team::getTeam($this->team); } return $this->teamObj; }
function process() { global $CONFIG; $this->template_name = 'pages/team/ical.tpl'; $this->smarty->assign('team', $this->team); $this->smarty->assign('short_league_name', variable_get('app_org_short_name', 'League')); # Our timezone is specified as US/Eastern, but ical wants US-Eastern. bleh. $timezone = preg_replace("!/!", "-", $CONFIG['localization']['local_tz']); $this->smarty->assign('timezone', $timezone); /* * Grab schedule info */ $games = Game::load_many(array('either_team' => $this->team->team_id, 'published' => 1, '_order' => 'g.game_date DESC,g.game_start,g.game_id')); // We'll be outputting an ical header('Content-type: text/calendar; charset=UTF-8'); // Prevent caching header("Cache-Control: no-cache, must-revalidate"); // get domain URL for signing games $arr = explode('@', variable_get('app_admin_email', "@{$short_league_name}")); $this->smarty->assign('domain_url', $arr[1]); // date stamp this file // MUST be in UTC $this->smarty->assign('now', gmstrftime('%Y%m%dT%H%M%SZ')); while (list(, $game) = each($games)) { $opponent_id = $game->home_id == $this->team->team_id ? $game->away_id : $game->home_id; $game->opponent = Team::load(array('team_id' => $opponent_id)); $game->field = Field::load(array('fid' => $game->fid)); } $this->smarty->assign('games', $games); }
function __construct() { parent::__construct(); $this->load->model('classes_model', 'classes'); $this->list_args = array('class.id' => array('heading' => '名称', 'cell' => '<a href = "#classes/{id}">{name}</a>', 'title' => '编号:{id}'), 'depart' => array('heading' => '部门'), 'extra_course_name' => array('heading' => '加一'), 'class_teacher_name' => array('heading' => '班主任')); $this->load->view_path['edit'] = 'classes/edit'; }
public function __construct($seasonId, $requestedWeek = null) { $this->season = Season::getByLink($seasonId); $this->week = 1; $time = time(); while($this->week < $this->season->getWeeksCount() && $this->season->weekIsPublished($this->week)) { $this->week++; } $maxWeekMatch = Match::findOne('seasonid = ? order by week desc limit 1', [$this->season->seasonid]); $this->maxWeek = $maxWeekMatch->week; if (!Team::isMember()) { while (!$this->season->weekIsPublic($this->maxWeek)) { $this->maxWeek--; } } if ($requestedWeek && $requestedWeek <= $this->maxWeek) { $this->week = $requestedWeek; } else if ($requestedWeek) { HTMLResponse::exitWithRoute("/"); } $this->canVote = ($this->season->getPublishTimeForWeek($this->week) - $time > 3600); }