本文整理汇总了PHP中Math::wd_percentage_round方法的典型用法代码示例。如果您正苦于以下问题:PHP Math::wd_percentage_round方法的具体用法?PHP Math::wd_percentage_round怎么用?PHP Math::wd_percentage_round使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Math
的用法示例。
在下文中一共展示了Math::wd_percentage_round方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
<?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: array
<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>