本文整理汇总了PHP中Formatter::formatDatePicker方法的典型用法代码示例。如果您正苦于以下问题:PHP Formatter::formatDatePicker方法的具体用法?PHP Formatter::formatDatePicker怎么用?PHP Formatter::formatDatePicker使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Formatter
的用法示例。
在下文中一共展示了Formatter::formatDatePicker方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderDate
public function renderDate($field, array $htmlOptions = array())
{
$model = $this->owner;
$fieldName = $field->fieldName;
$oldDateVal = $model->{$fieldName};
$model->{$fieldName} = Formatter::formatDate($model->{$fieldName}, 'medium');
Yii::import('application.extensions.CJuiDateTimePicker.CJuiDateTimePicker');
$pickerOptions = array('dateFormat' => Formatter::formatDatePicker(), 'changeMonth' => false, 'changeYear' => false);
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, 'class' => 'x2-mobile-datepicker'), $htmlOptions), 'language' => Yii::app()->language == 'en' ? '' : Yii::app()->getLanguage()), true);
$model->{$fieldName} = $oldDateVal;
return $input;
}
示例2: 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);
}
示例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>
示例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);
}
示例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>
示例6: renderFilterCellContent
public function renderFilterCellContent()
{
switch ($this->fieldType) {
case 'boolean':
echo CHtml::activeDropdownList($this->grid->filter, $this->name, array('' => '- ' . Yii::t('app', 'Select') . ' -', '1' => Yii::t('app', 'Yes'), 'false' => Yii::t('app', "No")), array('class' => 'x2-minimal-select-filtercol'));
break;
case 'dropdown':
$dropdown = Dropdowns::model()->findByPk($this->fieldModel['linkType']);
if ($dropdown instanceof Dropdowns) {
$options = json_decode($dropdown->options, 1);
if (!$dropdown->multi) {
$defaultOption = array('' => '- ' . Yii::t('app', 'Select') . ' -');
$options = is_array($options) ? array_merge($defaultOption, $options) : $defaultOption;
}
//$selected = isset($options[$this->grid->filter->{$this->name}]) ?
//$this->grid->filter->{$this->name} : '';
echo CHtml::activeDropdownList($this->grid->filter, $this->name, $options, array('class' => 'x2-minimal-select-filtercol' . ($dropdown->multi ? ' x2-multiselect-dropdown x2-datacolumn-multiselect' : ''), 'multiple' => $dropdown->multi ? 'multiple' : '', 'data-selected-text' => $dropdown->multi ? 'option(s)' : ''));
} else {
parent::renderFilterCellContent();
}
break;
case 'visibility':
echo CHtml::activeDropDownList($this->grid->filter, $this->name, array('' => '- ' . Yii::t('app', 'Select') . ' -', 1 => Yii::t('app', 'Public'), 0 => Yii::t('app', 'Private'), 2 => Yii::t('app', 'User\'s Groups')), array('class' => 'x2-minimal-select-filtercol'));
break;
case 'dateTime':
case 'date':
Yii::import('application.extensions.CJuiDateTimePicker.CJuiDateTimePicker');
$that = $this;
$renderWidget = function () use($that) {
echo Yii::app()->controller->widget('CJuiDateTimePicker', array('model' => $that->grid->filter, 'attribute' => $that->name, 'mode' => 'date', 'options' => array('dateFormat' => Formatter::formatDatePicker('medium')), 'htmlOptions' => array('id' => 'datePicker' . $that->name, 'class' => 'datePicker x2-gridview-filter-datepicker'), 'language' => Yii::app()->language == 'en' ? '' : Yii::app()->getLanguage()), true);
};
if ($this->grid->ajax) {
X2Widget::ajaxRender($renderWidget);
} else {
$renderWidget();
}
break;
default:
parent::renderFilterCellContent();
}
}
示例7: getJSGlobalsSetupScript
/**
* Returns a JS string which declares two global JS dictionaries if they haven't already been
* declared. Additional properties of the yii global are declared if the user has a profile.
* The globals would already have been decalared in the case that this is an AJAX request in
* which registered scripts are being sent back in response to the client.
*
* @param object if set, additional profile specific properties are declared
* @returns string A JS string
*/
public function getJSGlobalsSetupScript($profile = null)
{
if ($profile) {
$where = 'fileName = :notifSound';
$params = array(':notifSound' => $profile->notificationSound);
$uploadedBy = $this->owner->db->createCommand()->select('uploadedBy')->from('x2_media')->where($where, $params)->queryRow();
if (!empty($uploadedBy['uploadedBy'])) {
$notificationSound = $this->owner->baseUrl . '/uploads/media/' . $uploadedBy['uploadedBy'] . '/' . $profile->notificationSound;
} else {
$notificationSound = $this->owner->baseUrl . '/uploads/' . $profile->notificationSound;
}
}
return '
if (typeof yii === "undefined") {
var yii = {
baseUrl: "' . $this->owner->baseUrl . '",
scriptUrl: "' . $this->owner->request->scriptUrl . '",
themeBaseUrl: "' . $this->owner->theme->baseUrl . '",
language: "' . ($this->owner->language == 'en' ? '' : $this->owner->getLanguage()) . '",
datePickerFormat: "' . Formatter::formatDatePicker('medium') . '",
timePickerFormat: "' . Formatter::formatTimePicker() . '"
' . ($profile ? '
, profile: ' . CJSON::encode($profile->getAttributes()) . ',
notificationSoundPath: "' . $notificationSound . '"' : '') . '};
}
if (typeof x2 === "undefined") {
x2 = {};
}
x2.DEBUG = ' . (YII_DEBUG ? 'true' : 'false') . ';
x2.UNIT_TESTING = ' . (YII_UNIT_TESTING ? 'true' : 'false') . ';
x2.notifUpdateInterval = ' . $this->settings->chatPollTime . ';
x2.isAndroid = ' . (IS_ANDROID ? 'true' : 'false') . ';
x2.isIPad = ' . (IS_IPAD ? 'true' : 'false') . ';
';
}
示例8:
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* 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]>
示例9: array
* 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".
*****************************************************************************************/
?>
<div class="cell">
<?php
echo CHtml::label($this->startDateLabel, $this->startDateName);
Yii::import('application.extensions.CJuiDateTimePicker.CJuiDateTimePicker');
$this->widget('CJuiDateTimePicker', array('name' => $this->startDateName, 'value' => Formatter::formatDate($this->startDateValue), 'mode' => 'date', 'options' => array('dateFormat' => Formatter::formatDatePicker(), 'changeMonth' => true, 'changeYear' => true), 'htmlOptions' => array('class' => 'start-date', 'width' => 20), 'language' => Yii::app()->language == 'en' ? '' : Yii::app()->getLanguage()));
?>
</div>
<div class="cell">
<?php
echo CHtml::label($this->endDateLabel, $this->endDateName);
$this->widget('CJuiDateTimePicker', array('name' => $this->endDateName, 'value' => Formatter::formatDate($this->endDateValue), 'mode' => 'date', 'options' => array('dateFormat' => Formatter::formatDatePicker(), 'changeMonth' => true, 'changeYear' => true), 'htmlOptions' => array('class' => 'end-date', 'width' => 20), 'language' => Yii::app()->language == 'en' ? '' : Yii::app()->getLanguage()));
?>
</div>
<div class="cell">
<?php
echo CHtml::label($this->dateRangeLabel, $this->dateRangeName);
echo CHtml::dropDownList($this->dateRangeName, $this->dateRangeValue, array('custom' => Yii::t('charts', 'Custom'), 'thisWeek' => Yii::t('charts', 'This Week'), 'thisMonth' => Yii::t('charts', 'This Month'), 'lastWeek' => Yii::t('charts', 'Last Week'), 'lastMonth' => Yii::t('charts', 'Last Month'), 'thisYear' => Yii::t('charts', 'This Year'), 'lastYear' => Yii::t('charts', 'Last Year'), 'all' => Yii::t('charts', 'All Time')), array('class' => 'date-range'));
?>
</div>
示例10: getJSGlobalsSetupScript
/**
* Returns a JS string which declares two global JS dictionaries if they haven't already been
* declared. Additional properties of the yii global are declared if the user has a profile.
* The globals would already have been decalared in the case that this is an AJAX request in
* which registered scripts are being sent back in response to the client.
*
* @param object if set, additional profile specific properties are declared
* @returns string A JS string
*/
public function getJSGlobalsSetupScript($profile = null)
{
if ($profile) {
$notificationSound = '';
if (!empty($profile->notificationSound) && is_numeric($profile->notificationSound)) {
$notificationSound = Yii::app()->createExternalUrl('/media/media/getFile', array('id' => $profile->notificationSound));
}
}
$yii = array('baseUrl' => $this->owner->baseUrl, 'absoluteBaseUrl' => $this->owner->absoluteBaseUrl, 'scriptUrl' => $this->owner->request->scriptUrl, 'themeBaseUrl' => $this->owner->theme->baseUrl, 'language' => $this->owner->language == 'en' ? '' : $this->owner->getLanguage(), 'datePickerFormat' => Formatter::formatDatePicker('medium'), 'timePickerFormat' => Formatter::formatTimePicker());
if ($profile) {
$yii['profile'] = $profile->getAttributes();
$yii['notificationSoundPath'] = $notificationSound;
}
$x2 = array('DEBUG' => YII_DEBUG, 'DEV_MODE' => X2_DEV_MODE, 'UNIT_TESTING' => YII_UNIT_TESTING, 'isGuest' => !$this->owner->params->noSession && $this->owner->user->getIsGuest(), 'notifUpdateInterval' => $this->settings->chatPollTime, 'isAndroid' => AuxLib::isAndroid(), 'isIPad' => AuxLib::isIPad(), 'isMobileApp' => $this->isMobileApp(), 'isPhoneGap' => $this->isPhoneGap());
$setX2 = '';
foreach ($x2 as $key => $val) {
$setX2 .= "x2.{$key} = " . CJSON::encode($val) . ";\n";
}
return '
;(function () {
if (typeof yii === "undefined") {
yii = ' . CJSON::encode($yii) . ';
}
if (typeof x2 === "undefined") {
x2 = {};
}
' . $setX2 . '
}) ();
';
}
示例11: getJSGlobalsSetupScript
/**
* Returns a JS string which declares two global JS dictionaries if they haven't already been
* declared. Additional properties of the yii global are declared if the user has a profile.
* The globals would already have been decalared in the case that this is an AJAX request in
* which registered scripts are being sent back in response to the client.
*
* @param object if set, additional profile specific properties are declared
* @returns string A JS string
*/
public function getJSGlobalsSetupScript($profile = null)
{
if ($profile) {
$notificationSound = '';
if (!empty($profile->notificationSound)) {
$notificationSound = $this->owner->baseUrl . $this->owner->request->scriptUrl . '/media/media/getFile/' . $profile->notificationSound;
}
}
return '
;(function () {
if (typeof yii === "undefined") {
yii = {
baseUrl: "' . $this->owner->baseUrl . '",
scriptUrl: "' . $this->owner->request->scriptUrl . '",
themeBaseUrl: "' . $this->owner->theme->baseUrl . '",
language: "' . ($this->owner->language == 'en' ? '' : $this->owner->getLanguage()) . '",
datePickerFormat: "' . Formatter::formatDatePicker('medium') . '",
timePickerFormat: "' . Formatter::formatTimePicker() . '"
' . ($profile ? '
, profile: ' . CJSON::encode($profile->getAttributes()) . ',
notificationSoundPath: "' . $notificationSound . '"' : '') . '};
}
if (typeof x2 === "undefined") {
x2 = {};
}
x2.DEBUG = ' . (YII_DEBUG ? 'true' : 'false') . ';
x2.UNIT_TESTING = ' . (YII_UNIT_TESTING ? 'true' : 'false') . ';
x2.notifUpdateInterval = ' . $this->settings->chatPollTime . ';
x2.isAndroid = ' . (IS_ANDROID ? 'true' : 'false') . ';
x2.isIPad = ' . (IS_IPAD ? 'true' : 'false') . ';
}) ();
';
}
示例12: 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();
示例13: 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'));
示例14: array
* 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".
*****************************************************************************************/
?>
<div id="advanced-controls" class="form" style="display:none;">
<?php
Yii::import('application.extensions.CJuiDateTimePicker.CJuiDateTimePicker');
echo CHtml::form();
echo Yii::t('actions', "Show me") . " " . CHtml::dropDownList('complete', !empty($complete) ? $complete : 'No', array('No' => Yii::t('actions', 'unfinished'), 'Yes' => Yii::t('actions', 'complete'), 'all' => Yii::t('actions', 'all'))) . " " . Yii::t('actions', "{actions} assigned to", array('{actions}' => Modules::displayName())) . " " . CHtml::dropDownList('assignedTo', !empty($assignedTo) ? $assignedTo : 'me', array('me' => Yii::t('actions', 'me'), 'both' => Yii::t('actions', 'me or anyone'), 'all' => Yii::t('actions', 'everyone'))) . " " . Yii::t('actions', "that") . " " . CHtml::dropDownList('dateType', !empty($dateType) ? $dateType : 'due', array('due' => Yii::t('actions', 'are due'), 'create' => Yii::t('actions', 'were created'))) . " " . CHtml::dropDownList('dateRange', !empty($dateRange) ? $dateRange : 'today', array('today' => Yii::t('actions', 'today'), 'tomorrow' => Yii::t('actions', 'tomorrow'), 'week' => Yii::t('actions', 'this week'), 'month' => Yii::t('actions', 'this month'), 'all' => Yii::t('actions', 'any time'), 'range' => Yii::t('actions', 'between these dates')));
echo "<span id='date-controls' style='" . (!empty($dateRange) && $dateRange == 'range' ? "" : "display:none") . "'> (";
Yii::app()->controller->widget('CJuiDateTimePicker', array('name' => 'start', 'value' => !empty($start) ? $start : '', 'mode' => 'date', 'options' => array('dateFormat' => Formatter::formatDatePicker(), 'changeMonth' => true, 'changeYear' => true), 'htmlOptions' => array('id' => 'startDate', 'width' => 20), 'language' => Yii::app()->language == 'en' ? '' : Yii::app()->getLanguage()));
echo " and ";
Yii::app()->controller->widget('CJuiDateTimePicker', array('name' => 'end', 'value' => !empty($end) ? $end : '', 'mode' => 'date', 'options' => array('dateFormat' => Formatter::formatDatePicker(), 'changeMonth' => true, 'changeYear' => true), 'htmlOptions' => array('id' => 'endDate', 'width' => 20), 'language' => Yii::app()->language == 'en' ? '' : Yii::app()->getLanguage()));
echo ") </span>";
echo " " . Yii::t('actions', "and order them by") . " " . CHtml::dropDownList('orderType', !empty($orderType) ? $orderType : 'desc', array('desc' => Yii::t('actions', 'descending'), 'asc' => Yii::t('actions', 'ascending'))) . " " . CHtml::dropDownList('order', !empty($order) ? $order : 'due', array('due' => Yii::t('actions', 'due date'), 'create' => Yii::t('actions', 'create date'), 'priority' => Yii::t('actions', 'priority')));
echo " " . CHtml::submitButton(Yii::t('app', 'Go'), array('class' => 'x2-button', 'style' => 'padding: 1px 15px;display:inline;'));
echo CHtml::endForm();
?>
</div>
<script>
$('#dateRange').on('change',function(){
if($('#dateRange').val()=='range'){
$('#date-controls').fadeIn();
}else{
$('#date-controls').fadeOut();
}
});
</script>
示例15: activeDatePicker
/**
* @param CModel $model
* @param string $attribute
* @param array (optional) $htmlOptions
* @return string
*/
public static function activeDatePicker(CModel $model, $attribute, array $htmlOptions = array(), $mode = 'date', array $options = array())
{
$options = array_merge(array('dateFormat' => Formatter::formatDatePicker(), 'changeMonth' => true, 'changeYear' => true), $options);
ob_start();
ob_implicit_flush(false);
Yii::import('application.extensions.CJuiDateTimePicker.CJuiDateTimePicker');
$model->{$attribute} = Formatter::formatDateTime($model->{$attribute});
$renderWidget = function () use($model, $attribute, $htmlOptions, $mode, $options) {
Yii::app()->controller->widget('CJuiDateTimePicker', array('model' => $model, 'attribute' => $attribute, 'mode' => $mode, 'options' => $options, 'htmlOptions' => $htmlOptions, 'language' => Yii::app()->language == 'en' ? '' : Yii::app()->getLanguage()));
};
if (Yii::app()->controller->isAjaxRequest()) {
// process output if this is an ajax request
X2Widget::ajaxRender($renderWidget);
} else {
$renderWidget();
}
return ob_get_clean();
}