Пример #1
0
 /**
  * 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
0
Файл: Rank.php Проект: jager/cms
 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
0
 /**
  * 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
0
 /**
  * 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;
                                             }
                                         }
                                     }
                                 }
                             }
                             $modelRank->save();
                         }
                     }
                 } else {
                     if ($item->placar_casa == $item->placar_visitante && $model->placar_casa == $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 = 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();
                     }
                 }
             }
         }
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('update', array('model' => $model));
 }
Пример #5
0
 $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();