Exemple #1
0
    /**
     * This is the 'isAvaliableGround' validator as declared in rules().
     * @param unknown $attribute
     * @param unknown $params
     */
    public function isAvaliableGround($attribute, $params)
    {
        $end_time = strtotime('+' . $this->tOURNAMENT->MATCH_LONG_TIME . ' minutes', strtotime($this->TIME));
        $start_time = strtotime('-' . $this->tOURNAMENT->MATCH_LONG_TIME . ' minutes', strtotime($this->TIME));
        $end_time = date('Y-m-d H:i:s', $end_time);
        $start_time = date('Y-m-d H:i:s', $start_time);
        $avaliable = MatchGame::model()->findAll(array('condition' => 'ID <>:id AND
						  PLAY_GROUND_ID = :id_play_ground AND
						  STATUS < 6 AND
						  TIME BETWEEN :start_time AND :end_time', 'params' => array(':id' => $this->ID, ':id_play_ground' => $this->PLAY_GROUND_ID, ':start_time' => $start_time, ':end_time' => $end_time)));
        if (count($avaliable)) {
            $this->addError($attribute, 'La cancha ya esta ocupada para otro encuentro');
        }
    }
 /**
  * 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 the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = MatchGame::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
 /**
  * Retrieves a board ranking
  * @param integer $id
  * @return multitype:
  */
 protected function getRankingBoard($model, $matchType)
 {
     $SCORE_KEY = 1;
     $board = array();
     $sortList = array();
     $matchs = MatchGame::model()->findAllByAttributes(array('TOURNAMENT_ID' => $model->ID, 'TYPE' => $matchType));
     foreach ($model->teams as $team) {
         $board[$team->ID_TEAM]['POINTS'] = 0;
         $board[$team->ID_TEAM]['JJ'] = 0;
         $board[$team->ID_TEAM]['JG'] = 0;
         $board[$team->ID_TEAM]['JE'] = 0;
         $board[$team->ID_TEAM]['JP'] = 0;
         $board[$team->ID_TEAM]['NAME'] = $team->iDTEAM->NAME;
         $sortList[$team->ID_TEAM] = 0;
     }
     foreach ($matchs as $matchGame) {
         foreach ($matchGame->matchResults as $result) {
             if ($result->RESULT_ID == $SCORE_KEY) {
                 $board[$matchGame->LOCAL]['JJ'] += 1;
                 $board[$matchGame->VISITOR]['JJ'] += 1;
                 $board[$matchGame->LOCAL]['ID'] = $matchGame->LOCAL;
                 $board[$matchGame->VISITOR]['ID'] = $matchGame->VISITOR;
                 if ($result->TOTAL_LOCAL > $result->TOTAL_VISITOR) {
                     $board[$matchGame->LOCAL]['POINTS'] += 3;
                     $sortList[$matchGame->LOCAL] += 3;
                     $board[$matchGame->LOCAL]['JG'] += 1;
                     $board[$matchGame->VISITOR]['JP'] += 1;
                 } elseif ($result->TOTAL_LOCAL == $result->TOTAL_VISITOR) {
                     $board[$matchGame->LOCAL]['POINTS'] += 1;
                     $board[$matchGame->VISITOR]['POINTS'] += 1;
                     $sortList[$matchGame->VISITOR] += 1;
                     $sortList[$matchGame->LOCAL] += 1;
                     $board[$matchGame->LOCAL]['JE'] += 1;
                     $board[$matchGame->VISITOR]['JE'] += 1;
                 } else {
                     $board[$matchGame->VISITOR]['POINTS'] += 3;
                     $sortList[$matchGame->VISITOR] += 3;
                     $board[$matchGame->LOCAL]['JP'] += 1;
                     $board[$matchGame->VISITOR]['JG'] += 1;
                 }
             }
         }
     }
     arsort($sortList);
     $ranking = array();
     foreach ($sortList as $key => $value) {
         $ranking[] = $board[$key];
     }
     return $ranking;
 }
Exemple #4
0
//	'block'=>false, // display a larger alert block?
//	'fade'=>true, // use transitions?
//	'closeText'=>'&times;', // close link text - if set to false, no close link is displayed
//));
?>
<p class="muted">
	Los campos con: <span class="required">*</span> son requeridos.
</p>
<div class="view">





	<?php 
$this->widget('bootstrap.widgets.TbDetailView', array('type' => 'striped bordered condensed', 'data' => $matchGames[0], 'attributes' => array(array('name' => 'STATUS', 'label' => 'ESTATUS', 'value' => MatchGame::model()->aStatus[$matchGames[0]->STATUS]), array('name' => 'START', 'label' => 'Inicio torneo', 'value' => $model->START_DATE))));
?>

</div>




	<?php 
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'verticalForm', 'htmlOptions' => array()));
?>



	<fieldset>
		<table class="table table-hover">