Exemplo n.º 1
0
  	   <center>
		<div id="example1" style="height: 90px;" class="form-group"></div>
	   	<div id="example2" style="height: 90px;" class="form-group"></div>
	   	<div id="example3" style="height: 90px;" class="form-group"></div>
  	   </center>
  	</div>
    	<div id="chart-container"></div>


  <?php 
$energiankulutus = 0;
if (isset(Yii::app()->user->id)) {
    $pvm = date("Y-m-d", strtotime($pvm));
    $criteria = new CDbCriteria();
    $criteria->condition = " user_id='" . Yii::app()->user->id . "' AND pvm='" . $pvm . "' ";
    $li = LiikuntaUser::model()->findAll($criteria);
    if (isset($li[0])) {
        foreach ($li as $data) {
            $energiankulutus += (double) $data->energiankulutus;
        }
    }
}
?>

  <input type="hidden" id="energiankulutus" value="<?php 
echo $energiankulutus;
?>
">
  <input type="hidden" id="arvo" value="<?php 
echo $this->arvo();
?>
Exemplo n.º 2
0
 protected function yhteensaLiikunta($k, $kausi)
 {
     $return = array();
     $criteria = new CDbCriteria();
     //$criteria->select = " YEARWEEK(`pvm`) as gramm,t.* ";
     $criteria->condition = "\n\t\t\tuser_id = '" . Yii::app()->user->id . "' \n\t\t";
     //echo $k.'<br>';
     if ($kausi == 'pvm') {
         $criteria->addCondition(" `pvm`='" . $k . "' ");
     } elseif ($kausi == 'viikko') {
         $criteria->addCondition(" YEARWEEK(DATE_ADD(`pvm`, INTERVAL 1 DAY), 3) = '" . $k . "' ");
     } elseif ($kausi == 'kuukausi') {
         $criteria->addCondition(" EXTRACT(YEAR_MONTH FROM `pvm`)='" . $k . "' ");
     } else {
         $criteria->addCondition(" pvm='" . $k . "' ");
     }
     $arr = $this->LiikenneUserArray();
     $m = LiikuntaUser::model()->findAll($criteria);
     if (isset($m[0])) {
         foreach ($arr as $key) {
             foreach ($m as $model) {
                 if (!isset($return[$key])) {
                     $return[$key] = '';
                 }
                 $return[$key] += $model->{$key};
             }
         }
     }
     return $return;
 }
Exemplo n.º 3
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 LiikuntaUser the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = LiikuntaUser::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Exemplo n.º 4
0
<table class="table table-hover table-bordered">
 <thead class="small">
  <tr>
  <th>Pvm</th>
  <?php 
if ($kausi == 'pvm') {
    ?>
  <th>Laji</th>
  <th>Lisätietoja</th>
  <?php 
}
?>

  <?php 
$arr = $this->LiikenneUserArray();
$k1 = new LiikuntaUser();
foreach ($arr as $key) {
    $otsikko = '';
    if ($k1->getAttributeLabel($key)) {
        $otsikko = $k1->getAttributeLabel($key);
    }
    echo '<th>' . $otsikko . '</th>';
}
?>
  </tr>
 </thead>
  <?php 
foreach ($data as $model) {
    $return = array();
    $pvm = date("d.m.Y", strtotime($model->pvm));
    $vko = (int) date("YW", strtotime($model->pvm));