本文整理汇总了PHP中Zend_Locale_Format类的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Locale_Format类的具体用法?PHP Zend_Locale_Format怎么用?PHP Zend_Locale_Format使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zend_Locale_Format类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: smarty_modifier_number
/**
* Returns a number in local specific format.
*
* @link http://framework.zend.com/manual/de/zend.locale.parsing.html
* @param int|float $value
* @param array $format
* @return mixed
*/
function smarty_modifier_number($value, $format = array())
{
if (empty($format['locale'])) {
$format['locale'] = Enlight_Application::Instance()->Locale();
}
return Zend_Locale_Format::toNumber($value, $format);
}
开发者ID:nvdnkpr,项目名称:Enlight,代码行数:15,代码来源:modifier.number.php
示例2: get
/**
* Return a value for get, using some validations from the table data.
*
* @param string $type Type of field.
* @param mixed $value Value to transform.
*
* @return mixed Value of the var.
*/
public static function get($type, $value)
{
switch ($type) {
case 'float':
$value = Zend_Locale_Format::toFloat($value, array('precision' => 2));
break;
case 'time':
if (!empty($value)) {
$value = date("H:i:s", Phprojekt_Converter_Time::utcToUser($value));
}
break;
case 'datetime':
case 'timestamp':
if (!empty($value)) {
$value = date("Y-m-d H:i:s", Phprojekt_Converter_Time::utcToUser($value));
}
break;
case 'text':
// Get html only if the text contain some html code
if (preg_match("/([\\<])([^\\>]{1,})*([\\>])/i", $value)) {
$value = stripslashes($value);
}
break;
}
return $value;
}
开发者ID:RainyBlueSky,项目名称:PHProjekt,代码行数:34,代码来源:Value.php
示例3: createForm
public function createForm($id_hopdong)
{
$kh = new Model_Hopdong();
$hopdong = $kh->getWhereIdHopDong($id_hopdong);
$this->setDisableLoadDefaultDecorators(true);
$this->setDecorators(array(array('ViewScript', array('viewScript' => 'formnoindex/hopdong_layout.phtml')), 'Form'));
$data = new My_Data();
$opMau = $data->getOptionMau();
$opLoaiVai = $data->getOptionLoaiVai();
$opNCC = $data->getOptionNCC();
$tenhopdong = $this->createElement('text', 'tenhopdong', array('decorators' => array('ViewHelper')));
$mota = $this->createElement('text', 'mota', array('decorators' => array('ViewHelper')));
$ngayky = $this->createElement('text', 'ngayky', array('decorators' => array('ViewHelper')));
$sotansoi = $this->createElement('text', 'sotansoi', array('decorators' => array('ViewHelper')));
$thanhtien = $this->createElement('text', 'thanhtien', array('decorators' => array('ViewHelper')));
$mamau = $this->createElement('select', 'mamau', array('multioptions' => $opMau, 'decorators' => array('ViewHelper')));
$maloaivai = $this->createElement('select', 'maloaivai', array('multioptions' => $opLoaiVai, 'decorators' => array('ViewHelper')));
$manhacungcap = $this->createElement('select', 'manhacungcap', array('multioptions' => $opNCC, 'decorators' => array('ViewHelper')));
$them = $this->createElement('submit', 'them', array('decorators' => array('ViewHelper'), 'label' => 'Chỉnh sửa'));
$mydate = Zend_Locale_Format::getDate($hopdong['NgayKy'], array("date_format" => "yyyy.MM.dd"));
$date_str = $mydate['day'] . "/" . $mydate['month'] . "/" . $mydate['year'];
$tenhopdong->setAttrib('class', 'formEdit')->setValue($hopdong['TenHopDong']);
$mota->setAttrib('class', 'formEdit')->setValue($hopdong['MoTa']);
$ngayky->setAttrib('class', 'formEdit')->setValue($date_str);
$sotansoi->setAttrib('class', 'formEdit')->setValue($hopdong['SoTanSoi']);
$thanhtien->setAttrib('class', 'formEdit')->setValue($hopdong['ThanhTien']);
$mamau->setAttrib('class', 'formEdit')->setValue($hopdong['MaMau']);
$maloaivai->setAttrib('class', 'formEdit')->setValue($hopdong['MaLoaiVai']);
$manhacungcap->setAttrib('class', 'formEdit')->setValue($hopdong['MaNhaCungCap']);
$this->addElement($tenhopdong)->addElement($mota)->addElement($ngayky)->addElement($sotansoi)->addElement($thanhtien)->addElement($mamau)->addElement($maloaivai)->addElement($manhacungcap)->addElement($them);
}
开发者ID:LongNguyen-51101909,项目名称:Dimopla,代码行数:31,代码来源:hopdong.php
示例4: startLocale
protected function startLocale()
{
require_once "Zend/Translate.php";
// silenciando strict até arrumar zend_locale
date_default_timezone_set("America/Sao_Paulo");
$i18n = new Zend_Translate('gettext', $this->config->system->path->base . '/lang/pt_BR.mo', 'pt_BR');
Zend_Registry::set('i18n', $i18n);
$translation_files = $this->config->system->path->base . "/lang/";
foreach (scandir($translation_files) as $filename) {
// Todos os arquivos .php devem ser classes de descrição de modulos
if (preg_match("/.*\\.mo\$/", $filename)) {
$translation_id = basename($filename, '.mo');
if ($translation_id != "pt_BR") {
$i18n->addTranslation($translation_files . "/{$filename}", $translation_id);
}
}
}
require_once "Zend/Locale.php";
if (Zend_Locale::isLocale($this->config->system->locale)) {
$locale = $this->config->system->locale;
} else {
$locale = "pt_BR";
}
Zend_Registry::set('Zend_Locale', new Zend_Locale($locale));
Zend_Locale::setDefault($locale);
Zend_Locale_Format::setOptions(array("locale" => $locale));
$i18n->setLocale($locale);
Zend_Registry::set("Zend_Translate", $i18n);
$zend_validate_translator = new Zend_Translate_Adapter_Array($this->config->system->path->base . "/lang/Zend_Validate/{$locale}/Zend_Validate.php", $locale);
Zend_Validate_Abstract::setDefaultTranslator($zend_validate_translator);
}
开发者ID:rootzig,项目名称:SNEP,代码行数:31,代码来源:Bootstrap.php
示例5: dataValue
/**
* extracts the
* @return type
*/
public function dataValue()
{
require_once THIRDPARTY_PATH . "/Zend/Locale/Format.php";
$locale = new Zend_Locale(i18n::get_locale());
$number = Zend_Locale_Format::getNumber($this->value, array('locale' => $locale));
return $number;
}
开发者ID:spekulatius,项目名称:silverstripe-bootstrap_extra_fields,代码行数:11,代码来源:BootstrapCurrencyField.php
示例6: _getValueToSaveFromPostData
protected function _getValueToSaveFromPostData($postData)
{
$ret = parent::_getValueToSaveFromPostData($postData);
$l = $this->_floatValidator->getLocale();
$ret = Zend_Locale_Format::getNumber($ret, array('locale' => $l));
return $ret;
}
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:7,代码来源:NumberField.php
示例7: format
/**
* Formats a given value
* @see library/Bvb/Grid/Formatter/Bvb_Grid_Formatter_FormatterInterface::format()
*/
public function format($value)
{
if (!is_numeric($value)) {
return $value;
}
return Zend_Locale_Format::toNumber($value, $this->_options);
}
开发者ID:Aeryris,项目名称:grid,代码行数:11,代码来源:Number.php
示例8: getUserDate
/**
* return date in user timezone
*/
public function getUserDate()
{
// get user session
$session = new Zend_Session_Namespace('user');
// return date with user timezone in locale format
return $this->getDate($session->timezone)->toString(Zend_Locale_Format::getDateTimeFormat($session->language));
}
开发者ID:asmaklad,项目名称:knowledgeroot,代码行数:10,代码来源:Date.php
示例9: _createRowObject
/**
* Converts map array to microdata Object
*
* @param array $map map array returned by the generator
* @return null|Varien_Object
*/
protected function _createRowObject($map)
{
if (empty($map['price']) || empty($map['availability']) || empty($map['title'])) {
return null;
}
$microdata = new Varien_Object();
$microdata->setName($map['title']);
$microdata->setId($map['id']);
if (!empty($map['sale_price'])) {
$price = $map['sale_price'];
} else {
$price = $map['price'];
}
$microdata->setPrice(Zend_Locale_Format::toNumber($price, array('precision' => 2, 'number_format' => '#0.00')));
$microdata->setCurrency(Mage::app()->getStore()->getCurrentCurrencyCode());
if ($map['availability'] == 'in stock') {
$microdata->setAvailability('http://schema.org/InStock');
} else {
$microdata->setAvailability('http://schema.org/OutOfStock');
}
if (array_key_exists('condition', $map)) {
if (strcasecmp('new', $map['condition']) == 0) {
$microdata->setCondition('http://schema.org/NewCondition');
} else {
if (strcasecmp('used', $map['condition']) == 0) {
$microdata->setCondition('http://schema.org/UsedCondition');
} else {
if (strcasecmp('refurbished', $map['condition']) == 0) {
$microdata->setCondition('http://schema.org/RefurbishedCondition');
}
}
}
}
return $microdata;
}
开发者ID:brandontamm,项目名称:api-merchant-center,代码行数:41,代码来源:Microdata.php
示例10: getAnualPercentageRate
public function getAnualPercentageRate($format = true)
{
$s = Zend_Locale_Format::toNumber($this->_anualPercentageRate, array('precision' => 2));
if ($format) {
return $s . '%';
} else {
return $s;
}
}
开发者ID:xiaoguizhidao,项目名称:bilderrahmen,代码行数:9,代码来源:Calculation.php
示例11: getForm
protected function getForm()
{
// Create object Snep_Form
$form = new Snep_Form();
// Set form action
$form->setAction($this->getFrontController()->getBaseUrl() . '/services-report/index');
$form_xml = new Zend_Config_Xml('./modules/default/forms/services_report.xml');
$config = Zend_Registry::get('config');
$period = new Snep_Form_SubForm($this->view->translate("Period"), $form_xml->period);
$validatorDate = new Zend_Validate_Date(Zend_Locale_Format::getDateFormat(Zend_Registry::get('Zend_Locale')));
$locale = Snep_Locale::getInstance()->getLocale();
$now = Zend_Date::now();
if ($locale == 'en_US') {
$now = $now->toString('YYYY-MM-dd HH:mm');
} else {
$now = $now->toString('dd/MM/YYYY HH:mm');
}
$yesterday = Zend_Date::now()->subDate(1);
$initDay = $period->getElement('init_day');
$initDay->setValue($now);
//$initDay->addValidator($validatorDate);
$tillDay = $period->getElement('till_day');
$tillDay->setValue($now);
//$tillDay->addValidator($validatorDate);
$form->addSubForm($period, "period");
$exten = new Snep_Form_SubForm($this->view->translate("Extensions"), $form_xml->exten);
$groupLib = new Snep_GruposRamais();
$groupsTmp = $groupLib->getAll();
$groupsData = array();
foreach ($groupsTmp as $key => $group) {
switch ($group['name']) {
case 'administrator':
$groupsData[$this->view->translate('Administrators')] = $group['name'];
break;
case 'users':
$groupsData[$this->view->translate('Users')] = $group['name'];
break;
case 'all':
$groupsData[$this->view->translate('All')] = $group['name'];
break;
default:
$groupsData[$group['name']] = $group['name'];
}
}
$selectGroup = $exten->getElement('group_select');
$selectGroup->addMultiOption(null, '----');
foreach ($groupsData as $key => $value) {
$selectGroup->addMultiOption($value, $key);
}
$selectGroup->setAttrib('onSelect', "enableField('exten-group_select', 'exten-exten_select');");
$form->addSubForm($exten, "exten");
$service = new Snep_Form_SubForm($this->view->translate("Services"), $form_xml->service);
$form->addSubForm($service, "service");
$form->getElement('submit')->setLabel($this->view->translate("Show Report"));
$form->removeElement("cancel");
return $form;
}
开发者ID:rootzig,项目名称:SNEP,代码行数:57,代码来源:ServicesReportController.php
示例12: getFormattedTaxRate
/**
* Retrieves formatted string of tax rate for user output
*
* @return string
*/
public function getFormattedTaxRate()
{
if ($this->getTaxRate() === null || $this->getProduct()->getTypeId() == 'bundle') {
return '';
}
$locale = Mage::app()->getLocale()->getLocaleCode();
$taxRate = Zend_Locale_Format::toFloat($this->getTaxRate(), array('locale' => $locale));
return $this->__('%s%%', $taxRate);
}
开发者ID:nhp,项目名称:firegento-germansetup,代码行数:14,代码来源:Price.php
示例13: isValid
/**
* Defined by Zend_Validate_Interface
*
* Returns true if and only if $value is a floating-point value
*
* @todo http://framework.zend.com/issues/browse/ZF-2895
* @param string $value
* @return boolean
*/
public function isValid($value)
{
$valueString = (string) $value;
$this->_setValue($valueString);
if (!Zend_Locale_Format::isFloat($valueString, $this->_options)) {
$this->_error();
return false;
}
return true;
}
开发者ID:BGCX262,项目名称:zym-svn-to-git,代码行数:19,代码来源:Float.php
示例14: dataValue
/**
* Extracts the number value from the localised string value
*
* @return string number value
*/
public function dataValue()
{
require_once "Zend/Locale/Format.php";
if (!$this->isNumeric()) {
return 0;
}
$locale = new Zend_Locale($this->getLocale());
$number = Zend_Locale_Format::getNumber($this->clean($this->value), array('locale' => $locale));
return $number;
}
开发者ID:jakedaleweb,项目名称:AtomCodeChallenge,代码行数:15,代码来源:NumericField.php
示例15: LocalizedToNormalized
public function LocalizedToNormalized($value)
{
if (substr(Mage::app()->getLocale()->getLocaleCode(), 0, 2) != 'en') {
$dateFormatIso = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
} else {
$dateFormatIso = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_LONG);
}
$_options = array('locale' => Mage::app()->getLocale()->getLocaleCode(), 'date_format' => $dateFormatIso, 'precision' => null);
return Zend_Locale_Format::getDate($value, $_options);
}
开发者ID:votanlean,项目名称:Magento-Pruebas,代码行数:10,代码来源:Data.php
示例16: getDateFormat
public function getDateFormat()
{
if (!$this->_dateFormat) {
if ($locale = $this->getLocale()) {
$this->setDateFormat(\Zend_Locale_Format::getDateFormat($locale));
} else {
$this->setDateFormat(\Zend_Date::DATE_SHORT);
}
}
return $this->_dateFormat;
}
开发者ID:GemsTracker,项目名称:MUtil,代码行数:11,代码来源:DateAbstract.php
示例17: number
public static function number($number, $precision = "", $locale = "")
{
global $config;
$locale == "" ? $locale = new Zend_Locale($config->local->locale) : ($locale = $locale);
$load_precision = $config->local->precision;
$precision == "" ? $precision = $load_precision : ($precision = $precision);
$formatted_number = Zend_Locale_Format::toNumber($number, array('precision' => $precision, 'locale' => $locale));
//trim zeros from decimal point if enabled
//if ($config->local->trim_zeros == "y") { $formatted_number = rtrim(trim($formatted_number, '0'), '.'); }
return $formatted_number;
}
开发者ID:alachaum,项目名称:simpleinvoices,代码行数:11,代码来源:siLocal.php
示例18: checkDate
public static function checkDate($date, $format = '')
{
if (empty($format)) {
if (Zend_Registry::isRegistered('date_format')) {
$format = Zend_Registry::get('date_format');
} else {
$format = self::MYSQL_DATE_FORMAT;
}
}
return Zend_Locale_Format::checkDateFormat($date, array('date_format' => $format));
}
开发者ID:gatorv,项目名称:gecko_fw1,代码行数:11,代码来源:Date.php
示例19: convertToPHPValue
public function convertToPHPValue($value, AbstractPlatform $platform)
{
if ($value === null) {
return null;
}
$dateTimeFormatString = \Zend_Locale_Format::convertPhpToIsoFormat($platform->getDateTimeFormatString());
$val = new \Zend_Date($value, $dateTimeFormatString);
if (!$val) {
throw ConversionException::conversionFailed($value, $this->getName());
}
return $val;
}
开发者ID:giuliaries,项目名称:DoctrineExtensions,代码行数:12,代码来源:ZendDateType.php
示例20: validate
public function validate($validator)
{
if (!$this->value && !$validator->fieldIsRequired($this->name)) {
return true;
}
require_once THIRDPARTY_PATH . "/Zend/Locale/Format.php";
$valid = Zend_Locale_Format::isNumber(trim($this->value), array('locale' => i18n::get_locale()));
if (!$valid) {
$validator->validationError($this->name, _t('NumericField.VALIDATION', "'{value}' is not a number, only numbers can be accepted for this field", array('value' => $this->value)), "validation");
return false;
}
return true;
}
开发者ID:8secs,项目名称:cocina,代码行数:13,代码来源:NumericField.php
注:本文中的Zend_Locale_Format类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论