本文整理汇总了PHP中Rank::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Rank::save方法的具体用法?PHP Rank::save怎么用?PHP Rank::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rank
的用法示例。
在下文中一共展示了Rank::save方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Rank();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Rank'])) {
$model->attributes = $_POST['Rank'];
if ($model->save()) {
$this->redirect(array('view', 'id' => $model->id));
}
}
$this->render('create', array('model' => $model));
}
示例2: saveRank
private function saveRank($playerId, $tournamentId, $score, $oRank)
{
if ($oRank instanceof Doctrine_Record) {
$oRank->score = $score;
$oRank->save();
} else {
$rank = new Rank();
$rank->Players_id = $playerId;
$rank->Tournaments_id = $tournamentId;
$rank->score = $score;
$rank->save();
}
}
示例3: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
//
try {
$rank = new Rank();
$rank->title = Input::get('title');
$rank->link = Input::get('link');
$rank->target = Input::get('target');
$rank->sort = Rank::max('sort') + 1;
$rank->save();
return Redirect::route('admin.ranks.index');
} catch (Exception $e) {
return Redirect::back()->withInput()->withErrors('新增失敗');
}
}
示例4: actionUpdate
/**
* Updates a particular model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id the ID of the model to be updated
*/
public function actionUpdate($id)
{
$model = $this->loadModel($id);
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Confronto'])) {
$model->attributes = $_POST['Confronto'];
if ($model->empate == 1) {
$model->vencedor = null;
}
$Criteria = new CDbCriteria();
$Criteria->condition = "id_confronto={$model->id}";
$modelAposta = Aposta::model()->findAll($Criteria);
foreach ($modelAposta as $item) {
if ($item->placar_casa == $model->placar_casa && $item->placar_visitante == $model->placar_visitante) {
$modelRank = new Rank();
$modelRank->id_user = $item->id_user;
$modelRank->data = date('Y-m-d H:i:s');
$modelRank->id_aposta = $item->id;
if ($item->idConfronto->id_grupo == 10) {
$modelRank->id_ponto = 3;
} else {
if ($item->idConfronto->id_grupo == 11) {
$modelRank->id_ponto = 5;
} else {
if ($item->idConfronto->id_grupo == 12) {
$modelRank->id_ponto = 7;
} else {
if ($item->idConfronto->id_grupo == 13) {
$modelRank->id_ponto = 9;
} else {
if ($item->idConfronto->id_grupo == 9) {
$modelRank->id_ponto = 9;
} else {
$modelRank->id_ponto = 1;
}
}
}
}
}
$modelRank->save();
} else {
if ($model->vencedor != null) {
if ($item->placar_casa > $item->placar_visitante && $model->vencedor == $model->id_time_casa) {
$modelRank = new Rank();
$modelRank->id_user = $item->id_user;
$modelRank->data = date('Y-m-d H:i:s');
$modelRank->id_aposta = $item->id;
if ($item->idConfronto->id_grupo == 10) {
$modelRank->id_ponto = 4;
} else {
if ($item->idConfronto->id_grupo == 11) {
$modelRank->id_ponto = 6;
} else {
if ($item->idConfronto->id_grupo == 12) {
$modelRank->id_ponto = 8;
} else {
if ($item->idConfronto->id_grupo == 13) {
$modelRank->id_ponto = 10;
} else {
if ($item->idConfronto->id_grupo == 9) {
$modelRank->id_ponto = 10;
} else {
$modelRank->id_ponto = 2;
}
}
}
}
}
$modelRank->save();
} else {
if ($item->placar_casa < $item->placar_visitante && $model->vencedor == $model->id_time_visitante) {
$modelRank = new Rank();
$modelRank->id_user = $item->id_user;
$modelRank->data = date('Y-m-d H:i:s');
$modelRank->id_aposta = $item->id;
if ($item->idConfronto->id_grupo == 10) {
$modelRank->id_ponto = 4;
} else {
if ($item->idConfronto->id_grupo == 11) {
$modelRank->id_ponto = 6;
} else {
if ($item->idConfronto->id_grupo == 12) {
$modelRank->id_ponto = 8;
} else {
if ($item->idConfronto->id_grupo == 13) {
$modelRank->id_ponto = 10;
} else {
if ($item->idConfronto->id_grupo == 9) {
$modelRank->id_ponto = 10;
} else {
$modelRank->id_ponto = 2;
}
}
}
//.........这里部分代码省略.........
示例5: Rank
$rank->create();
$section->create();
$event->create();
$client->create();
$configuration->put('UPDATE_URL', 'http://update.idleman.fr/yana?callback=?');
$configuration->put('DEFAULT_THEME', 'default');
$configuration->put('COOKIE_NAME', 'yana');
$configuration->put('COOKIE_LIFETIME', '7');
$configuration->put('VOCAL_ENTITY_NAME', 'YANA');
$configuration->put('PROGRAM_VERSION', '3.0.6');
$configuration->put('HOME_PAGE', 'index.php');
$configuration->put('VOCAL_SENSITIVITY', '0.0');
//Création du rang admin
$rank = new Rank();
$rank->setLabel('admin');
$rank->save();
//Déclaration des sections du programme
$sections = array('event', 'vocal', 'user', 'plugin', 'configuration', 'admin');
//Création des sections déclarées et attribution de tous les droits sur toutes ces sections pour l'admin
foreach ($sections as $sectionName) {
$s = new Section();
$s->setLabel($sectionName);
$s->save();
$r = new Right();
$r->setSection($s->getId());
$r->setRead('1');
$r->setDelete('1');
$r->setCreate('1');
$r->setUpdate('1');
$r->setRank($rank->getId());
$r->save();