本文整理汇总了PHP中Math::wd_round方法的典型用法代码示例。如果您正苦于以下问题:PHP Math::wd_round方法的具体用法?PHP Math::wd_round怎么用?PHP Math::wd_round使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Math
的用法示例。
在下文中一共展示了Math::wd_round方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: printWD
public static function printWD($wd)
{
if ($wd) {
return Math::wd_round($wd) . ' ' . Yii::app()->params['water_demand_unit'];
}
return '0 ' . Yii::app()->params['water_demand_unit'];
}
示例2: foreach
</thead>
<tbody>
<?php
foreach ($geom->zones() as $zone) {
?>
<tr>
<td><?php
echo CHtml::encode($zone->zoneDescription) . ' - ' . CHtml::encode($zone->zone_name);
?>
</td>
<td><?php
echo CHtml::encode(Math::pe_round($zone->pe));
?>
</td>
<td><?php
echo CHtml::encode(Math::wd_round($zone->water_demand)) . ' ' . Yii::app()->params['water_demand_unit'];
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</page>
<?php
}
?>
</div>
</page>
示例3: array
<?php
$ret = array();
foreach ($model->zones() as $zone) {
$z = array('wr_id' => $model->wr->id, 'geom_id' => $model->id, 'id' => $zone->id, 'zone' => $zone->zoneDescription, 'pe' => Math::pe_round($zone->pe), 'wd' => Math::wd_round($zone->water_demand) . ' ' . Yii::app()->params['water_demand_unit']);
array_push($ret, $z);
}
echo htmlspecialchars(json_encode($ret), ENT_NOQUOTES);
示例4: array
?>
:</b>
<?php
echo CHtml::encode(Math::wd_round($data->total_water_demand) . ' ' . Yii::app()->params['water_demand_unit']);
?>
<br />
<?php
if (Yii::app()->user->checkAccess('updateWaterDemandInWaterRequest')) {
?>
<b><?php
echo CHtml::encode($data->getAttributeLabel('effective_water_demand'));
?>
:</b>
<?php
echo CHtml::encode(Math::wd_round($data->effective_water_demand) . ' ' . Yii::app()->params['water_demand_unit']);
?>
<br />
<?php
}
?>
<?php
if ($data->phase == 1 and ($data->status == WaterRequests::SW_NODE(WaterRequests::SUBMITTED_STATUS) and Yii::app()->user->isPlanner)) {
echo CHtml::link(Yii::t('waterrequest', 'Move on Executive Phase'), array('waterRequests/create', 'phase' => 2, 'parent' => $data->id));
}
?>
<div class="water_request_operation">
<?php
示例5:
}
?>
<div class="accordion" id="geom_<?php
echo $geom->id;
?>
">
<h6 class="<?php
echo $class;
?>
">
<?php
echo $geom->name;
?>
–
<?php
echo Math::wd_round($geom->geom_water_demand) . ' ' . Yii::app()->params['water_demand_unit'];
?>
</h6>
<span style="display: inline-block; text-align: right; float:right;">
<?php
if (!$view) {
/*
echo CHtml::ajaxLink(
' ',
array('waterRequestGeometryZones/popup', 'wr_id'=>$model->id,'type'=>'zone','geom_or_id'=>$geom->id),
array(
'success'=>'function(html) {
//$("#add_zone_popup").find(".overlayContent").html(html);
$("#mycontent").html(html);
doOverlayOpen("zone","'.$geom->id.'");
}'
示例6: updatePEAndWD
//.........这里部分代码省略.........
if (stripos($formula->formula,Yii::app()->params['formulas']['da'])!==false) {
$fformula = str_ireplace(Yii::app()->params['formulas']['da'],$da,$fformula);
}*/
foreach ($this->properties() as $property) {
if (stripos($formula->formula, $property->parameter) !== false) {
$fformula = str_ireplace($property->parameter, $property->value, $fformula);
}
}
if (stripos($formula->formula, Yii::app()->params['formulas']['da']) !== false) {
$fformula = str_ireplace(Yii::app()->params['formulas']['da'], $da, $fformula);
}
if (stripos($formula->formula, Yii::app()->params['formulas']['dg']) !== false) {
$fformula = str_ireplace(Yii::app()->params['formulas']['dg'], $dg, $fformula);
}
$fformula_with_pe = null;
if (stripos($formula->formula, Yii::app()->params['formulas']['pe']) !== false) {
$fformula_with_pe = $fformula;
$fformula = str_ireplace(Yii::app()->params['formulas']['pe'], $this->pe, $fformula);
}
try {
$ret = Math::safe_eval($fformula);
if (is_numeric($ret)) {
$this->water_demand = $ret;
} else {
$this->water_demand = -1;
}
} catch (Exception $e) {
$this->water_demand = 0;
Yii::log('WD Error. $fformula=' . $fformula, CLogger::LEVEL_INFO, 'updatePEAndWD');
// DEBUG
}
if (isset($info)) {
$info['city'] = ucwords(strtolower($city_state));
$info['water_demand'] = Math::wd_round($this->water_demand) . ' ' . Yii::app()->params['water_demand_unit'];
if ($service_area == null) {
$info['service_area'] = '--';
$operative_margin = DummyOperativeMargin::model()->findAll('lower(area)=:area', array(':area' => strtolower($city_state)));
if (count($operative_margin) == 0) {
Yii::log('Manca il margine operativo del comune. area=' . $city_state, CLogger::LEVEL_INFO, 'updatePEAndWD');
// DEBUG
return;
}
} else {
//var_dump($service_area);
$info['service_area'] = ucwords(strtolower($service_area['desc_area']));
/*TODO: cambiare il $service_area*/
$operative_margin = DummySAOperativeMargin::model()->findAll('lower(area)=:area', array(':area' => strtolower($service_area['area'])));
if (count($operative_margin) == 0) {
Yii::log('Manca il margine operativo dell\'area di servizio. area=' . $city_state, CLogger::LEVEL_INFO, 'updatePEAndWD');
// DEBUG
return;
}
}
$actual_margin = null;
foreach ($operative_margin as $op) {
if ($op->scenario == null) {
$actual_margin = Math::margin_round($op->margin);
break;
}
}
if ($actual_margin == null) {
Yii::log('Manca il margine operativo attuale. area=' . $city_state, CLogger::LEVEL_INFO, 'updatePEAndWD');
// DEBUG
$actual_margin = 0;
}
if ($this->water_demand > $actual_margin) {
示例7: getRounded_water_demand
/**
*
*/
public function getRounded_water_demand()
{
return Math::wd_round($this->total_water_demand);
}
示例8: feasibilityCheck
public static function feasibilityCheck($geom_id, $wd)
{
//Yii::log('geom_id= '.print_r($geom_id, true).' wd= '.print_r($wd, true), CLogger::LEVEL_INFO, 'feasibilitycheck()'); // DEBUG
$ret = array();
$service_area = Geometry::Get_Service_Area_Detailed($geom_id);
$city_state = Geometry::Get_City_State($geom_id);
//Yii::log('city_state= '.print_r($city_state, true).' wd= '.print_r($wd, true), CLogger::LEVEL_INFO, 'feasibilitycheck()'); // DEBUG
if ($city_state == null || $wd == null) {
$ret['sarea'] = null;
$ret['city'] = '--';
$ret['scenari'] = null;
$ret['margin'] = -1;
$ret['maximum_water_supply'] = -1;
return $ret;
}
$ret['city'] = ucwords(strtolower($city_state));
// uso city_state ma potrei usare service_area->desc_area se Get_Service_Area ritornasse un array
if (!$service_area) {
$ret['sarea'] = null;
$water_supply = DummyOperativeMargin::model()->findAll('lower(area)=:area', array(':area' => strtolower($city_state)), array('limit' => 3));
if (!$water_supply) {
Yii::log('Cannot find Operative Margin for $city_state=' . $city_state, CLogger::LEVEL_INFO, 'feasibilityCheck');
// DEBUG
$ret['scenari'] = null;
$ret['margin'] = -1;
$ret['maximum_water_supply'] = -1;
return $ret;
}
} else {
$ret['sarea'] = $service_area['desc_area'];
$water_supply = DummySAOperativeMargin::model()->findAll('lower(area)=:area', array(':area' => strtolower($service_area['area'])), array('limit' => 3));
}
$ret['scenari'] = array();
foreach ($water_supply as $ws) {
//Yii::log(print_r($ws->attributes, true), CLogger::LEVEL_INFO, 'foreach'); // DEBUG
$operative_margin = $ws->margin;
if ($ws->scenario == null) {
$ret['maximum_water_supply'] = Math::wd_round($operative_margin);
if ($wd > $operative_margin) {
$ret['margin'] = -1;
} else {
if ($wd > $operative_margin - (int) Yii::app()->params['water_demand_range']) {
$ret['margin'] = 0;
} else {
$ret['margin'] = 1;
}
}
} else {
$item = array();
$item['scenario'] = $ws->scenario;
$item['maximum_water_supply'] = Math::wd_round($operative_margin);
if ($wd > $operative_margin) {
$item['margin'] = -1;
} else {
if ($wd > $operative_margin - (int) Yii::app()->params['water_demand_range']) {
$item['margin'] = 0;
} else {
$item['margin'] = 1;
}
}
array_push($ret['scenari'], $item);
}
}
return $ret;
}
示例9: array
$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) {
$('.info_history').remove();
var url = <?php
echo CJSON::encode(CController::createUrl('waterRequests/infoHistory'));
?>
;
$.ajax({
url: url,
cache: false,
示例10: 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>