Exemplo n.º 1
0
 public static function getByBiobank($biobankId, $limit)
 {
     $criteria = new EMongoCriteria();
     $criteria->addCond('biobank_id', '==', $biobankId);
     $criteria->sort('date', EMongoCriteria::SORT_DESC);
     $criteria->limit($limit);
     return BiobankStats::model()->findAll($criteria);
 }
Exemplo n.º 2
0
        <?php 
$this->beginWidget('zii.widgets.CPortlet', array('title' => "<i class = 'icon-share'></i>" . Yii::t('myBiobank', 'filesReceptionActivity') . " - {$model->identifier}"));
$this->widget('application.widgets.charting.CBarsChartWidget', array('id' => 'columnchart-filescount-month', 'theme' => 'Distinctive', 'title' => '', 'data' => StatTools::getCountFilesReceptionByMonthAndBiobank($model->id), 'width' => 310, 'heigth' => 230, 'xAxisRotation' => 0));
$this->endWidget();
?>


    </div>

    <div style="float:left;
         width:330px;
         padding-top: 10px;
         ">

        <?php 
$stats = BiobankStats::model()->findByAttributes(array('biobank_id' => $model->id), array('$sort' => array('date' => -1)));
if ($stats != null) {
    $complete = $stats->globalRate;
} else {
    $complete = 0;
}
$roundcomplete = round($complete);
$uncomplete = 100 - $roundcomplete;
$data = array(array('Complet : ' . $roundcomplete . '%', $roundcomplete), array('Incomplet : ' . $uncomplete . "%", $uncomplete));
$this->beginWidget('zii.widgets.CPortlet', array('title' => "<i class = 'icon-adjust'></i> " . Yii::t('myBiobank', 'samplesCompletionRate') . " -  {$model->identifier}"));
// affichage du graphe de completude des echantillons
$this->widget('application.widgets.charting.CPieChartWidget', array('id' => 'piechart-collab', 'theme' => 'WatersEdge', 'width' => 380, 'height' => 250, 'data' => $data, 'title' => '<a class="detail-button" href="#">détails</a>'));
$this->endWidget();
?>
    </div>
Exemplo n.º 3
0
 public function actionBenchmark()
 {
     if (isset($_GET['limit'])) {
         $limit = $_GET['limit'];
     } else {
         $limit = 60;
     }
     if (Yii::app()->user->isAdmin()) {
         $biobankId = $_SESSION['biobank_id'];
     } else {
         $biobankId = Yii::app()->user->biobank_id;
     }
     $biobankStats = BiobankStats::model()->getByBiobank($biobankId, $limit);
     $globalStats = BiobankStats::model()->getByBiobank("0", $limit);
     if ($biobankStats != null && !empty($biobankStats) && $globalStats != null && !empty($globalStats)) {
         $this->render('benchmarking', array('globalStats' => $globalStats, 'biobankStats' => $biobankStats));
     } else {
         $model = $this->loadModel($biobankId);
         Yii::app()->user->setFlash('error', Yii::t('myBiobank', 'noRequiredStats'));
         $this->render('index', array('model' => $model));
     }
 }
Exemplo n.º 4
0
 /**
  * Recupere le dernier objet biobankStats pour la biobanque id=0 (stats globales) en base si il date du jour même,
  * ou en créé un nouveau
  * @return type
  */
 public function saveAverageRate()
 {
     $averageRate = StatTools::getAverageRate();
     $date = new DateTime();
     $searchDate = $date->format('Y-m-d');
     $globalStats = BiobankStats::model()->findByAttributes(array('biobank_id' => "0", 'date' => new MongoRegex("/{$searchDate}.*/i"))) != null ? BiobankStats::model()->findByAttributes(array('biobank_id' => "0", 'date' => new MongoRegex("/{$searchDate}.*/i"))) : new BiobankStats();
     $globalStats->biobank_id = '0';
     $globalStats->date = $date->format(DateTime::ISO8601);
     $globalStats->globalRate = $averageRate['globalRate'];
     $globalStats->values = $averageRate['values'];
     return $globalStats->save();
 }