当前位置: 首页>>代码示例>>PHP>>正文


PHP Match::save方法代码示例

本文整理汇总了PHP中Match::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Match::save方法的具体用法?PHP Match::save怎么用?PHP Match::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Match的用法示例。


在下文中一共展示了Match::save方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: generate_vars

function generate_vars($section, &$vars)
{
    if (!$vars['is_logged'] || !$vars['is_admin']) {
        return;
    }
    $matches = Match::find_all();
    $vars['matches'] = $matches;
    $vars['arenas'] = Arena::filter('');
    if (isset($_POST['description0'])) {
        for ($i = 0; $i < count($matches); $i++) {
            $match = $matches[$i];
            if (isset($_POST['delete' . $i])) {
                $match->delete();
                continue;
            }
            if ($match->description != $_POST['description' . $i] || $match->date != $_POST['date' . $i] || $match->arena != $_POST['arena' . $i] || $match->prix != $_POST['prix' . $i]) {
                $match->description = $_POST['description' . $i];
                $match->date = $_POST['date' . $i];
                $match->arena = $_POST['arena' . $i];
                $match->prix = $_POST['prix' . $i];
                $match->save();
            }
        }
    }
    if (!empty($_POST['description-nouveau']) && !empty($_POST['date-nouveau']) && !empty($_POST['arena-nouveau']) && !empty($_POST['prix-nouveau'])) {
        $match = new Match();
        $match->description = $_POST['description-nouveau'];
        $match->date = $_POST['date-nouveau'];
        $match->arena = $_POST['arena-nouveau'];
        $match->prix = $_POST['prix-nouveau'];
        $match->save();
    }
    $matches = Match::find_all();
    $vars['matches'] = $matches;
}
开发者ID:pheze,项目名称:ydtp3,代码行数:35,代码来源:admin_matches.php

示例2: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Match();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Match'])) {
         $model->attributes = $_POST['Match'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->matchId));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:first-lab,项目名称:tebing,代码行数:17,代码来源:MatchController.php

示例3: actionCreate

 /**
  * 录入
  *
  */
 public function actionCreate()
 {
     parent::_acl('match_create');
     $model = new Match();
     if (isset($_POST['Match'])) {
         $model->attributes = $_POST['Match'];
         if ($model->save()) {
             AdminLogger::_create(array('catalog' => 'create', 'intro' => '录入房屋配套,ID:' . $model->id));
             $this->redirect(array('index'));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:zywh,项目名称:maplecity,代码行数:17,代码来源:MatchController.php

示例4: postCreate

 /**
  * Creates our section when POSTed to. Performs snazzy validation.
  * @return [type] [description]
  */
 public function postCreate()
 {
     $rules = array('league_id' => 'required|integer|exists:leagues,id', 'teamA_id' => 'required|integer|exists:teams,id', 'teamB_id' => 'required|integer|exists:teams,id', 'start_time' => 'required', 'rounds' => 'required|integer|min:1');
     $validatior = Validator::make(Input::all(), $rules);
     if ($validatior->fails()) {
         return Redirect::action('Admin_MatchesController@getCreate')->withInput()->withErrors($validatior);
     } else {
         $match = new Match();
         $match->league_id = Input::get('league_id');
         $match->teamA_id = Input::get('teamA_id');
         $match->teamB_id = Input::get('teamB_id');
         $match->start_time = date("Y-m-d H:i:s", strtotime(Input::get('start_time')));
         $match->stream_url = Input::get('stream_url');
         $match->chat_url = Input::get('chat_url');
         $match->rounds = Input::get('rounds');
         $match->message = Input::get('message');
         $match->save();
         return Redirect::action('Admin_MatchesController@getIndex');
     }
 }
开发者ID:TsunamiNori,项目名称:Raffles,代码行数:24,代码来源:MatchesController.php

示例5: actionStartTournament

 public function actionStartTournament($id)
 {
     $model = $this->loadModel($id);
     $c = new ChallongeAPI(Yii::app()->params['challonge_api']);
     $params = array('include_matches' => 1, 'include_participants' => 1);
     $tournament_id = $model->challonge_id;
     $tournament = $c->startTournament($tournament_id, $params)->tournament;
     $model->started = date('Y-m-d H:i:s');
     $model->save();
     // echo "<pre>";print_r($tournament);echo "</pre>";//exit;
     if (count($c->errors)) {
         foreach ($c->errors as $error) {
             Yii::app()->user->setFlash('error', 'Challonge Error: ' . $error);
         }
         $this->redirect(array('teams', 'id' => $id));
     }
     foreach ($tournament->matches as $k => $match) {
         // print $k."<br />";
         // print_r($match);
         // print "<br />-------------------<br />";
         try {
             $_match = new Match();
             $_match->tournament_id = $id;
             $_match->challonge_tournament_id = $model->challonge_id;
             $_match->challonge_match_id = $match->match->id;
             $_match->team_1 = strlen($match->match->player1_id) ? $match->match->player1_id : '';
             $_match->team_2 = strlen($match->match->player2_id) ? $match->match->player2_id : '';
             $_match->identifier = $match->match->identifier;
             $_match->round = $match->match->round;
             $_match->state = $match->match->state;
             $_match->save();
         } catch (CDbException $e) {
             continue;
         }
     }
     $model->updateMatchesFromChallonge();
     // exit;
     $this->redirect(array('matches', 'id' => $id));
 }
开发者ID:cfletcher1856,项目名称:austinblinddraw,代码行数:39,代码来源:TournamentController.php

示例6: createNewMatch

 public function createNewMatch($match_table, $found)
 {
     Log::info("*********************[Creating new match]*********************");
     Log::info("********[found]************");
     Log::info($found);
     $match = new Match();
     $match->fip_id = $this->id;
     $match->match_table_id = $found['id'];
     // TODO try $found->id
     if ($match_table == ArmyUpdates::TABLE_NAME) {
         $match->match_army_update = true;
     } elseif ($match_table == FoundPeople::TABLE_NAME) {
         $match->match_found_person = true;
     }
     $match->save();
 }
开发者ID:riddhi1212,项目名称:Laravel-app-1,代码行数:16,代码来源:FindPeople.php

示例7: setMatchWinner

 /**
  * Set a winner for a match.
  *
  * @return void
  **/
 public function setMatchWinner(Match $match, Team $team)
 {
     $match->completed_at = date('Y-m-d H:i:s', time());
     $match->winning_team_id = $team->id;
     return $match->save();
 }
开发者ID:kleitz,项目名称:brackets,代码行数:11,代码来源:tournament.php


注:本文中的Match::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。