当前位置: 首页>>代码示例>>PHP>>正文


PHP Formatter::formatAMPM方法代码示例

本文整理汇总了PHP中Formatter::formatAMPM方法的典型用法代码示例。如果您正苦于以下问题:PHP Formatter::formatAMPM方法的具体用法?PHP Formatter::formatAMPM怎么用?PHP Formatter::formatAMPM使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Formatter的用法示例。


在下文中一共展示了Formatter::formatAMPM方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: renderTab

 public function renderTab($viewParams)
 {
     // set date, time, and region format for when javascript replaces datetimepicker
     // datetimepicker is replaced in the calendar module when the user clicks on a day
     $dateformat = Formatter::formatDatePicker('medium');
     $timeformat = Formatter::formatTimePicker();
     $ampmformat = Formatter::formatAMPM();
     $region = Yii::app()->locale->getLanguageId(Yii::app()->locale->getId());
     if ($region == 'en') {
         $region = '';
     }
     // save default values of fields for when the publisher is submitted and then reset
     Yii::app()->clientScript->registerScript('defaultValues', '
         // set date and time format for when datetimepicker is recreated
         $("#publisher-form").data("dateformat", "' . $dateformat . '");
         $("#publisher-form").data("timeformat", "' . $timeformat . '");
         $("#publisher-form").data("ampmformat", "' . $ampmformat . '");
         $("#publisher-form").data("region", "' . $region . '");
     ', CClientScript::POS_READY);
     parent::renderTab($viewParams);
 }
开发者ID:keyeMyria,项目名称:CRM,代码行数:21,代码来源:PublisherEventTab.php

示例2: renderModelInput

    public static function renderModelInput(CModel $model, $field, $htmlOptions = array())
    {
        if (!$field->asa('CommonFieldsBehavior')) {
            throw new Exception('$field must have CommonFieldsBehavior');
        }
        if ($field->required) {
            if (isset($htmlOptions['class'])) {
                $htmlOptions['class'] .= ' x2-required';
            } else {
                $htmlOptions = array_merge(array('class' => 'x2-required'), $htmlOptions);
            }
        }
        $fieldName = $field->fieldName;
        if (!isset($field)) {
            return null;
        }
        switch ($field->type) {
            case 'text':
                return CHtml::activeTextArea($model, $field->fieldName, array_merge(array('title' => $field->attributeLabel), array_merge(array('encode' => false), $htmlOptions)));
            case 'date':
                $oldDateVal = $model->{$fieldName};
                $model->{$fieldName} = Formatter::formatDate($model->{$fieldName}, 'medium');
                Yii::import('application.extensions.CJuiDateTimePicker.CJuiDateTimePicker');
                $pickerOptions = array('dateFormat' => Formatter::formatDatePicker(), 'changeMonth' => false, 'changeYear' => true);
                if (Yii::app()->getLanguage() === 'fr') {
                    $pickerOptions['monthNamesShort'] = Formatter::getPlainAbbrMonthNames();
                }
                $input = Yii::app()->controller->widget('CJuiDateTimePicker', array('model' => $model, 'attribute' => $fieldName, 'mode' => 'date', 'options' => $pickerOptions, 'htmlOptions' => array_merge(array('title' => $field->attributeLabel), $htmlOptions), 'language' => Yii::app()->language == 'en' ? '' : Yii::app()->getLanguage()), true);
                $model->{$fieldName} = $oldDateVal;
                return $input;
            case 'dateTime':
                $oldDateTimeVal = $model->{$fieldName};
                $pickerOptions = array('dateFormat' => Formatter::formatDatePicker('medium'), 'timeFormat' => Formatter::formatTimePicker(), 'ampm' => Formatter::formatAMPM(), 'changeMonth' => true, 'changeYear' => true);
                if (Yii::app()->getLanguage() === 'fr') {
                    $pickerOptions['monthNamesShort'] = Formatter::getPlainAbbrMonthNames();
                }
                $model->{$fieldName} = Formatter::formatDateTime($model->{$fieldName});
                Yii::import('application.extensions.CJuiDateTimePicker.CJuiDateTimePicker');
                $input = Yii::app()->controller->widget('CJuiDateTimePicker', array('model' => $model, 'attribute' => $fieldName, 'mode' => 'datetime', 'options' => $pickerOptions, 'htmlOptions' => array_merge(array('title' => $field->attributeLabel), $htmlOptions), 'language' => Yii::app()->language == 'en' ? '' : Yii::app()->getLanguage()), true);
                $model->{$fieldName} = $oldDateTimeVal;
                return $input;
            case 'dropdown':
                // Note: if desired to translate dropdown options, change the seecond argument to
                // $model->module
                $om = $field->getDropdownOptions();
                $multi = (bool) $om['multi'];
                $dropdowns = $om['options'];
                $curVal = $multi ? CJSON::decode($model->{$field->fieldName}) : $model->{$field->fieldName};
                $ajaxArray = array();
                if ($field instanceof Fields) {
                    $dependencyCount = X2Model::model('Dropdowns')->countByAttributes(array('parent' => $field->linkType));
                    $fieldDependencyCount = X2Model::model('Fields')->countByAttributes(array('modelName' => $field->modelName, 'type' => 'dependentDropdown', 'linkType' => $field->linkType));
                    if ($dependencyCount > 0 && $fieldDependencyCount > 0) {
                        $ajaxArray = array('ajax' => array('type' => 'GET', 'url' => Yii::app()->controller->createUrl('/site/dynamicDropdown'), 'data' => 'js:{
                                "val":$(this).val(),
                                "dropdownId":"' . $field->linkType . '",
                                "field":true, "module":"' . $field->modelName . '"
                            }', 'success' => '
                                function(data){
                                    if(data){
                                        data=JSON.parse(data);
                                        if(data[0] && data[1]){
                                            $("#' . $field->modelName . '_"+data[0]).html(data[1]);
                                        }
                                    }
                                }'));
                    }
                }
                $htmlOptions = array_merge($htmlOptions, $ajaxArray, array('title' => $field->attributeLabel));
                if ($multi) {
                    $multiSelectOptions = array();
                    if (!is_array($curVal)) {
                        $curVal = array();
                    }
                    foreach ($curVal as $option) {
                        $multiSelectOptions[$option] = array('selected' => 'selected');
                    }
                    $htmlOptions = array_merge($htmlOptions, array('options' => $multiSelectOptions, 'multiple' => 'multiple'));
                } elseif ($field->includeEmpty) {
                    $htmlOptions = array_merge($htmlOptions, array('empty' => Yii::t('app', "Select an option")));
                }
                return CHtml::activeDropDownList($model, $field->fieldName, $dropdowns, $htmlOptions);
            case 'dependentDropdown':
                return CHtml::activeDropDownList($model, $field->fieldName, array('' => '-'), array_merge(array('title' => $field->attributeLabel), $htmlOptions));
            case 'link':
                $linkSource = null;
                $linkId = '';
                $name = '';
                if (class_exists($field->linkType)) {
                    // Create a model for autocompletion:
                    if (!empty($model->{$fieldName})) {
                        list($name, $linkId) = Fields::nameAndId($model->{$fieldName});
                        $linkModel = X2Model::getLinkedModelMock($field->linkType, $name, $linkId, true);
                    } else {
                        $linkModel = X2Model::model($field->linkType);
                    }
                    if ($linkModel instanceof X2Model && $linkModel->asa('X2LinkableBehavior') instanceof X2LinkableBehavior) {
                        $linkSource = Yii::app()->controller->createUrl($linkModel->autoCompleteSource);
                        $linkId = $linkModel->id;
                        $oldLinkFieldVal = $model->{$fieldName};
//.........这里部分代码省略.........
开发者ID:tymiles003,项目名称:X2CRM,代码行数:101,代码来源:X2Model.php

示例3: array

'>
    <div class="cell action-duration">
        <div class="action-duration-input">
            <label for="timetrack-hours"><?php 
echo Yii::t('actions', 'Hours');
?>
</label>
            <input class="action-duration-display" type="number" min="0" max="99" 
             name="timetrack-hours" />
        </div>
        <span class="action-duration-display">:</span>
        <div class="action-duration-input">
            <label for="timetrack-minutes"><?php 
echo Yii::t('actions', 'Minutes');
?>
</label>
            <input class="action-duration-display" type="number" min="0" max="59" 
             name="timetrack-minutes" />
        </div>
    </div>

    <div class="cell">
        <?php 
echo CHtml::activeLabel($this->model, $this->startDateAttribute, array('class' => 'action-start-time-label'));
echo X2Html::activeDatePicker($this->model, $this->startDateAttribute, array('onClick' => "\$('#ui-datepicker-div').css('z-index', '100');", 'class' => 'action-due-date', 'id' => $this->resolveId('action-due-date')), 'datetime', array_merge(array('dateFormat' => Formatter::formatDatePicker('medium'), 'timeFormat' => Formatter::formatTimePicker(), 'ampm' => Formatter::formatAMPM()), $this->options));
echo CHtml::activeLabel($this->model, $this->endDateAttribute, array('class' => 'action-end-time-label'));
echo X2Html::activeDatePicker($this->model, $this->endDateAttribute, array('onClick' => "\$('#ui-datepicker-div').css('z-index', '100');", 'class' => 'action-complete-date', 'id' => $this->resolveId('action-complete-date')), 'datetime', array_merge(array('dateFormat' => Formatter::formatDatePicker('medium'), 'timeFormat' => Formatter::formatTimePicker(), 'ampm' => Formatter::formatAMPM()), $this->options));
?>
    </div>
</div>
开发者ID:tymiles003,项目名称:X2CRM,代码行数:30,代码来源:activeDateRangeInput.php

示例4: registerDateFormats

 /**
  * Passes locale-specific date format strings to JS. 
  */
 private function registerDateFormats()
 {
     $this->registerScript('registerDateFormats', "\n            x2.dateFormats = {\n                dateFormat: '" . Formatter::formatDatePicker() . "',\n                timeFormat: '" . Formatter::formatTimePicker() . "',\n                ampm: '" . Formatter::formatAMPM() . "'\n            };\n        ", CClientScript::POS_END);
 }
开发者ID:shuvro35,项目名称:X2CRM,代码行数:7,代码来源:X2ClientScript.php

示例5: array

                <label for="timetrack-hours"><?php 
echo Yii::t('actions', 'Hours');
?>
</label>
                <input class="action-duration-display" type="number" min="0" max="99" 
                 name="timetrack-hours" />
            </div>
            <span class="action-duration-display">:</span>
            <div class="action-duration-input">
                <label for="timetrack-minutes"><?php 
echo Yii::t('actions', 'Minutes');
?>
</label>
                <input class="action-duration-display" type="number" min="0" max="59" 
                 name="timetrack-minutes" />
            </div>
        </div>

        <div class="cell">

            <?php 
$model->type = 'call';
echo CHtml::activeLabel($model, 'dueDate', array('class' => 'action-start-time-label'));
echo X2Html::activeDatePicker($model, 'dueDate', array('onClick' => "\$('#ui-datepicker-div').css('z-index', '100');", 'class' => 'action-due-date', 'id' => $this->resolveId('call-form-action-due-date')), 'datetime', array('dateFormat' => Formatter::formatDatePicker('medium'), 'timeFormat' => Formatter::formatTimePicker(), 'ampm' => Formatter::formatAMPM()));
echo CHtml::activeLabel($model, 'completeDate', array('class' => 'action-end-time-label'));
echo X2Html::activeDatePicker($model, 'completeDate', array('onClick' => "\$('#ui-datepicker-div').css('z-index', '100');", 'class' => 'action-complete-date', 'id' => $this->resolveId('call-form-action-complete-date')), 'datetime', array('dateFormat' => Formatter::formatDatePicker('medium'), 'timeFormat' => Formatter::formatTimePicker(), 'ampm' => Formatter::formatAMPM()));
?>
        </div>
    </div><!-- #action-event-panel -->
</div>
开发者ID:keyeMyria,项目名称:CRM,代码行数:30,代码来源:_callForm.php

示例6:

 * Section 5 of the GNU Affero General Public License version 3.
 * 
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * X2Engine" logo. If the display of the logo is not reasonably feasible for
 * technical reasons, the Appropriate Legal Notices must display the words
 * "Powered by X2Engine".
 *****************************************************************************************/
// TODO: move this out of iframe to simplify dependency registration
Yii::import('application.extensions.CJuiDateTimePicker.CJuiDateTimePicker');
$jsVersion = '?' . Yii::app()->params->buildDate;
$themeUrl = Yii::app()->theme->getBaseUrl();
$baseUrl = Yii::app()->request->getBaseUrl();
$dateFormat = Formatter::formatDatePicker('medium');
$timeFormat = Formatter::formatTimePicker();
$amPm = Formatter::formatAMPM() ? 'true' : 'false';
$language = Yii::app()->language == 'en' ? '' : Yii::app()->getLanguage();
?>
<!DOCTYPE html>
<!--[if lt IE 9]>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php 
echo Yii::app()->language;
?>
" lang="<?php 
echo Yii::app()->language;
?>
" class="lt-ie9">
<![endif]-->
<!--[if gt IE 8]>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php 
echo Yii::app()->language;
开发者ID:dsyman2,项目名称:X2CRM,代码行数:31,代码来源:_viewFrame.php

示例7: array

            <div class="cell">
                <?php 
    echo $form->labelEx($actionModel, 'startDate');
    $actionModel->dueDate = Formatter::formatDateTime($actionModel->dueDate);
    echo X2Html::activeDatePicker($actionModel, 'dueDate', $form->resolveHtmlOptions($actionModel, 'dueDate', array('onClick' => "\$('#ui-datepicker-div').css('z-index', '20');")), 'datetime', array('dateFormat' => Formatter::formatDatePicker('medium'), 'timeFormat' => Formatter::formatTimePicker(), 'ampm' => Formatter::formatAMPM(), 'changeMonth' => false));
    ?>
            </div>
            <?php 
}
if ($actionModel->complete == 'Yes' || $actionModel->isTimedType) {
    ?>
                <div class="cell">
                    <?php 
    echo $form->labelEx($actionModel, $actionModel->isTimedType ? 'endDate' : 'completeDate');
    $actionModel->completeDate = Formatter::formatDateTime($actionModel->completeDate);
    echo X2Html::activeDatePicker($actionModel, 'completeDate', $form->resolveHtmlOptions($actionModel, 'completeDate', array('onClick' => "\$('#ui-datepicker-div').css('z-index', '20');")), 'datetime', array('dateFormat' => Formatter::formatDatePicker('medium'), 'timeFormat' => Formatter::formatTimePicker(), 'ampm' => Formatter::formatAMPM(), 'changeMonth' => false));
    ?>
                </div>
            <?php 
}
?>
        </div><!-- #action-backdating -->
</div><!-- .form -->
<?php 
if (!$backdating && file_exists(__DIR__ . DIRECTORY_SEPARATOR . '_actionTimersForm.php') && $actionModel->complete == 'Yes') {
    $this->renderPartial('_actionTimersForm', array('model' => $actionModel, 'form' => $form));
}
?>
</div>
<?php 
$this->endWidget();
开发者ID:keyeMyria,项目名称:CRM,代码行数:31,代码来源:_form.php

示例8: array

<div class="row">
    <div class="cell dialog-cell">
        <?php 
echo $form->label($model, $isEvent ? 'startDate' : 'dueDate', array('class' => 'dialog-label'));
$defaultDate = Formatter::formatDate($model->dueDate, 'medium');
$model->dueDate = Formatter::formatDateTime($model->dueDate);
//format date from DATETIME
Yii::import('application.extensions.CJuiDateTimePicker.CJuiDateTimePicker');
$this->widget('CJuiDateTimePicker', array('model' => $model, 'attribute' => 'dueDate', 'mode' => 'datetime', 'options' => array('dateFormat' => Formatter::formatDatePicker('medium'), 'timeFormat' => Formatter::formatTimePicker(), 'defaultDate' => $defaultDate, 'ampm' => Formatter::formatAMPM()), 'language' => Yii::app()->language == 'en' ? '' : Yii::app()->getLanguage(), 'htmlOptions' => array('onClick' => "\$('#ui-datepicker-div').css('z-index', '10020');", 'id' => 'dialog-Actions_dueDate', 'readonly' => 'readonly', 'onChange' => 'giveSaveButtonFocus();')));
if ($isEvent) {
    echo $form->label($model, 'endDate', array('class' => 'dialog-label'));
    $defaultDate = Formatter::formatDate($model->completeDate, 'medium');
    $model->completeDate = Formatter::formatDateTime($model->completeDate);
    //format date from DATETIME
    $this->widget('CJuiDateTimePicker', array('model' => $model, 'attribute' => 'completeDate', 'mode' => 'datetime', 'options' => array('dateFormat' => Formatter::formatDatePicker('medium'), 'timeFormat' => Formatter::formatTimePicker(), 'defaultDate' => $defaultDate, 'ampm' => Formatter::formatAMPM()), 'language' => Yii::app()->language == 'en' ? '' : Yii::app()->getLanguage(), 'htmlOptions' => array('onClick' => "\$('#ui-datepicker-div').css('z-index', '10020');", 'id' => 'dialog-Actions_startDate', 'readonly' => 'readonly', 'onChange' => 'giveSaveButtonFocus();')));
}
?>


        <?php 
echo $form->label($model, 'allDay', array('class' => 'dialog-label'));
?>
        <?php 
echo $form->checkBox($model, 'allDay', array('onChange' => 'giveSaveButtonFocus();'));
?>
    </div>

    <div class="cell dialog-cell">
        <?php 
echo $form->label($model, 'priority', array('class' => 'dialog-label'));
开发者ID:dsyman2,项目名称:X2CRM,代码行数:30,代码来源:editAction.php


注:本文中的Formatter::formatAMPM方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。