コード例 #1
0
ファイル: summary_view.php プロジェクト: Gnafu/wiz
<?php

$attributes = array('id', array('label' => $model->getAttributeLabel('phase'), 'value' => $model->phaseHR), array('label' => $model->getAttributeLabel('status'), 'value' => $model->statusIconHistory, 'type' => 'raw'), array('label' => $model->getAttributeLabel('timestamp'), 'value' => Yii::app()->dateFormatter->format('dd MMMM yyyy, HH:mm', $model->timestamp)), 'user.first_name', 'user.last_name', 'user.title', 'description', 'note', array('label' => $model->getAttributeLabel('water_demand'), 'value' => Utilities::printWD($model->total_water_demand)));
if (isset($model->parent_phase)) {
    $attr = array('label' => $model->getAttributeLabel('parent_water_request'), 'type' => 'raw', 'value' => CHtml::link($model->parent_wr->project, array('waterRequests/view', 'id' => $model->parent_wr->id)));
    array_push($attributes, $attr);
    $attr = array('label' => $model->getAttributeLabel('parent_water_demand'), 'value' => Utilities::printWD($model->parent_wr->total_water_demand));
    array_push($attributes, $attr);
    $attr = array('label' => $model->getAttributeLabel('parent_water_demand_usage'), 'value' => Math::wd_percentage_round($model->total_water_demand / $model->parent_wr->total_water_demand * 100) . ' %');
    array_push($attributes, $attr);
}
if ($model->phase == 2) {
    $attr = array('label' => $model->getAttributeLabel('expiration_date'), 'value' => $model->expiration_date);
    array_push($attributes, $attr);
}
// TODO: Perche' solo i WRU possono vedere il costo? Il costo viene assegnato da WRU quando approva una richiesta.
if (Yii::app()->user->isWRU) {
    $attr = array('label' => $model->getAttributeLabel('cost'), 'value' => $model->cost . ' ' . Yii::app()->params['currency']);
    array_push($attributes, $attr);
    $attr = array('label' => $model->getAttributeLabel('file_link'), 'type' => 'raw', 'value' => CHtml::link($model->file_link, Yii::app()->params['transition']['upload_dir'] . '/' . $model->file_link));
    array_push($attributes, $attr);
}
if (Yii::app()->user->checkAccess('updateWaterDemandInWaterRequest')) {
    $attr = array('label' => $model->getAttributeLabel('effective_water_demand'), 'value' => Math::wd_round($model->effective_water_demand));
    array_push($attributes, $attr);
}
$this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => $attributes));
?>
<script type="text/javascript">
/* <![CDATA[ */
function infoHistory(elem, wr_id) {
コード例 #2
0
ファイル: parent_percent.php プロジェクト: Gnafu/wiz
<div id="parent_percent">
<?php 
$usage = $model->getParentWDUsage();
if ($model->parent_wr->total_water_demand <= 0) {
    $percentage = 100;
} else {
    $percentage = Math::wd_percentage_round($usage / $model->parent_wr->total_water_demand * 100);
}
$amount = Math::wd_round($usage) . ' ' . Yii::app()->params['water_demand_unit'] . ' / ' . Math::wd_percentage_round($model->parent_wr->total_water_demand) . ' ' . Yii::app()->params['water_demand_unit'] . ' ( ' . $percentage . '%)';
if ($percentage < 35) {
    $pb_class = 'pb_ok';
} else {
    if ($percentage < 70) {
        $pb_class = 'pb_notice';
    } else {
        $pb_class = 'pb_ko';
    }
}
$this->widget('zii.widgets.jui.CJuiProgressBar', array('id' => 'progress', 'value' => $percentage, 'htmlOptions' => array('style' => 'height:22px;width:300px;float:left; margin-right: 10px;', 'class' => $pb_class)));
echo '<div id="amount" style="padding:3px;">' . $amount . '</div>';
?>
</div>