Beispiel #1
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getGrupoTimes()
 {
     return $this->hasMany(GrupoTime::className(), ['id_time' => 'id']);
 }
Beispiel #2
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return GrupoTime the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = GrupoTime::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Beispiel #3
0
 public function GetPosicaoTime($posicao, $grupo)
 {
     $modelGrupo = new Grupo();
     $Criteria = new CDbCriteria();
     $Criteria->condition = "nome = '{$grupo}'";
     $classificacao = array();
     $modelGrupo = Grupo::model()->find($Criteria);
     $Criteria = new CDbCriteria();
     $Criteria->condition = "id_grupo={$modelGrupo->id}";
     $model = GrupoTime::model()->findAll($Criteria);
     foreach ($model as $item) {
         $itemArray = array("id" => $item->id_time, "id_grupo" => $item->id_grupo, "nome" => $item->idTime->nome, "escudo" => $item->idTime->escudo, "pontos" => ConfrontoController::GetPontosDoTime($item->id_time));
         array_push($classificacao, $itemArray);
     }
     $classificacao = ConfrontoController::aasort($classificacao, "pontos");
     $conta = 1;
     foreach ($classificacao as $item) {
         if ($conta == $posicao) {
             $time = Time::model()->findByPk($item["id"]);
         }
         $conta = $conta + 1;
     }
     return $time;
 }