本文整理汇总了PHP中i18n::format_measurement方法的典型用法代码示例。如果您正苦于以下问题:PHP i18n::format_measurement方法的具体用法?PHP i18n::format_measurement怎么用?PHP i18n::format_measurement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类i18n
的用法示例。
在下文中一共展示了i18n::format_measurement方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
</h4>
</div>
<div class="modal-body">
<div class="list-group">
<?php
foreach ($auto_locats as $loc) {
?>
<a href="<?php
echo Route::url('default');
?>
" class="list-group-item" data-id="<?php
echo $loc->id_location;
?>
"><span class="pull-right"><span class="glyphicon glyphicon-chevron-right"></span></span> <?php
echo $loc->name;
?>
(<?php
echo i18n::format_measurement($loc->distance);
?>
)</a>
<?php
}
?>
</div>
</div>
</div>
</div>
</div>
<?php
}
}
示例2: action_get
public function action_get()
{
try {
if (is_numeric($id_ad = $this->request->param('id'))) {
$ad = new Model_Ad();
//get distance to the ad
if (isset($this->_params['latitude']) and isset($this->_params['longitude'])) {
$ad->select(array(DB::expr('degrees(acos(sin(radians(' . $this->_params['latitude'] . ')) * sin(radians(`latitude`)) + cos(radians(' . $this->_params['latitude'] . ')) * cos(radians(`latitude`)) * cos(radians(abs(' . $this->_params['longitude'] . ' - `longitude`))))) * 69.172'), 'distance'));
}
$ad->where('id_ad', '=', $id_ad)->where('status', '=', Model_Ad::STATUS_PUBLISHED)->cached()->find();
if ($ad->loaded()) {
$a = $ad->as_array();
$a['price'] = i18n::money_format($ad->price);
$a['images'] = array_values($ad->get_images());
$a['category'] = $ad->category->as_array();
$a['location'] = $ad->location->as_array();
$a['user'] = Controller_Api_Users::get_user_array($ad->user);
$a['customfields'] = Model_Field::get_by_category($ad->id_category);
//sorting by distance, lets add it!
if (isset($ad->distance)) {
$a['distance'] = i18n::format_measurement($ad->distance);
}
$a['url'] = Route::url('ad', array('category' => $ad->category->seoname, 'seotitle' => $ad->seotitle));
$this->rest_output(array('ad' => $a));
} else {
$this->_error(__('Advertisement not found'), 404);
}
} else {
$this->_error(__('Advertisement not found'), 404);
}
} catch (Kohana_HTTP_Exception $khe) {
$this->_error($khe);
}
}
示例3: http_build_query
<div class="btn-group pull-right">
<button
class="btn btn-sm btn-default <?php
echo core::request('userpos') == 1 ? 'active' : NULL;
?>
"
id="myLocationBtn"
type="button"
data-toggle="modal"
data-target="#myLocation"
data-href="?<?php
echo http_build_query(['userpos' => 1] + Request::current()->query());
?>
">
<i class="glyphicon glyphicon-map-marker"></i> <?php
echo sprintf(__('%s from you'), i18n::format_measurement(Core::config('advertisement.auto_locate_distance', 1)));
?>
</button>
</div>
<div class="clearfix"></div>
<?php
}
?>
<!-- Case when we dont have ads for specific category / location -->
<div class="page-header">
<h3><?php
echo __('We do not have any advertisements in this category');
?>
</h3>
</div>
<?php
示例4: array
</li>
<li>
<a href="#" data-value="50"><?php
echo i18n::format_measurement(50);
?>
</a>
</li>
<li>
<a href="#" data-value="250"><?php
echo i18n::format_measurement(250);
?>
</a>
</li>
<li>
<a href="#" data-value="500"><?php
echo i18n::format_measurement(500);
?>
</a>
</li>
</ul>
</div>
<input type="hidden" name="distance" id="myDistance" value="<?php
echo Core::cookie('mydistance', Core::config('advertisement.auto_locate_distance', 2));
?>
" disabled>
<input type="hidden" name="latitude" id="myLatitude" value="" disabled>
<input type="hidden" name="longitude" id="myLongitude" value="" disabled>
<?php
echo FORM::input('myAddress', Request::current()->post('address'), array('class' => 'form-control', 'id' => 'myAddress', 'placeholder' => __('Where do you want to search?')));
?>
<span class="input-group-btn">