public function testResolveDateFormat() { $dateFormat = 'dd.MM.yy'; $this->assertEquals('dd.mm.y', YiiToJqueryUIDatePickerLocalization::resolveDateFormat($dateFormat)); $dateFormat = 'M/d/yy'; $this->assertEquals('m/d/y', YiiToJqueryUIDatePickerLocalization::resolveDateFormat($dateFormat)); $dateFormat = 'dd/MM/yy'; $this->assertEquals('dd/mm/y', YiiToJqueryUIDatePickerLocalization::resolveDateFormat($dateFormat)); $dateFormat = 'd.M.yyyy'; $this->assertEquals('d.m.yy', YiiToJqueryUIDatePickerLocalization::resolveDateFormat($dateFormat)); $dateFormat = 'd.M.yy.'; $this->assertEquals('d.m.y.', YiiToJqueryUIDatePickerLocalization::resolveDateFormat($dateFormat)); $dateFormat = 'd-M-yy'; $this->assertEquals('d-m-y', YiiToJqueryUIDatePickerLocalization::resolveDateFormat($dateFormat)); $dateFormat = 'dd/MM/yyyy'; $this->assertEquals('dd/mm/yy', YiiToJqueryUIDatePickerLocalization::resolveDateFormat($dateFormat)); $dateFormat = 'yy-M-d'; $this->assertEquals('y-m-d', YiiToJqueryUIDatePickerLocalization::resolveDateFormat($dateFormat)); $dateFormat = 'yy/MM/dd'; $this->assertEquals('y/mm/dd', YiiToJqueryUIDatePickerLocalization::resolveDateFormat($dateFormat)); $dateFormat = 'yyyy/MM/dd'; $this->assertEquals('yy/mm/dd', YiiToJqueryUIDatePickerLocalization::resolveDateFormat($dateFormat)); $dateFormat = 'dd-MM-yy'; $this->assertEquals('dd-mm-y', YiiToJqueryUIDatePickerLocalization::resolveDateFormat($dateFormat)); $dateFormat = 'd/MM/yy'; $this->assertEquals('d/mm/y', YiiToJqueryUIDatePickerLocalization::resolveDateFormat($dateFormat)); $dateFormat = 'dd.MM.yyyy'; $this->assertEquals('dd.mm.yy', YiiToJqueryUIDatePickerLocalization::resolveDateFormat($dateFormat)); }
protected function resolveDefaultOptions() { $this->options['showOn'] = 'both'; $this->options['buttonText'] = ZurmoHtml::tag('span', array(), '<!--Date-->'); $this->options['showButtonPanel'] = true; $this->options['buttonImageOnly'] = false; $this->options['dateFormat'] = YiiToJqueryUIDatePickerLocalization::resolveDateFormat(DateTimeUtil::getLocaleDateFormatForInput()); }
/** * Render a date JUI widget * @return The element's content as a string. */ protected function renderControlEditable() { $themePath = Yii::app()->baseUrl . '/themes/' . Yii::app()->theme->name; $value = DateTimeUtil::resolveValueForDateLocaleFormattedDisplay($this->model->{$this->attribute}); $cClipWidget = new CClipWidget(); $cClipWidget->beginClip("EditableDateElement"); $cClipWidget->widget('ext.zurmoinc.framework.widgets.JuiDatePicker', array('attribute' => $this->attribute, 'value' => $value, 'language' => YiiToJqueryUIDatePickerLocalization::getLanguage(), 'htmlOptions' => array('id' => $this->getEditableInputId(), 'name' => $this->getEditableInputName()), 'options' => array('showOn' => 'both', 'buttonText' => ZurmoHtml::tag('span', array(), '<!--Date-->'), 'showButtonPanel' => true, 'buttonImageOnly' => false, 'dateFormat' => YiiToJqueryUIDatePickerLocalization::resolveDateFormat(DateTimeUtil::getLocaleDateFormat())))); $cClipWidget->endClip(); $content = $cClipWidget->getController()->clips['EditableDateElement']; return ZurmoHtml::tag('div', array('class' => 'has-date-select'), $content); }
/** * Render a datetime JUI widget * @return The element's content as a string. */ protected function renderControlEditable() { $themePath = Yii::app()->baseUrl . '/themes/' . Yii::app()->theme->name; $value = DateTimeUtil::convertDbFormattedDateTimeToLocaleFormattedDisplay($this->model->{$this->attribute}); $cClipWidget = new CClipWidget(); $cClipWidget->beginClip("EditableDateTimeElement"); $cClipWidget->widget('application.extensions.timepicker.EJuiDateTimePicker', array('attribute' => $this->attribute, 'language' => YiiToJqueryUIDatePickerLocalization::getLanguage(), 'value' => $value, 'htmlOptions' => array('id' => $this->getEditableInputId(), 'name' => $this->getEditableInputName(), 'style' => 'position:relative;z-index:10000;'), 'options' => array('stepMinute' => 5, 'timeText' => Yii::t('Default', 'Time'), 'hourText' => Yii::t('Default', 'Hour'), 'minuteText' => Yii::t('Default', 'Minute'), 'secondText' => Yii::t('Default', 'Second'), 'currentText' => Yii::t('Default', 'Now'), 'closeText' => Yii::t('Default', 'Done'), 'showOn' => 'both', 'buttonImageOnly' => false, 'buttonText' => ZurmoHtml::tag('span', array(), '<!--Date-->'), 'dateFormat' => YiiToJqueryUIDatePickerLocalization::resolveDateFormat(DateTimeUtil::getLocaleDateFormat()), 'timeFormat' => YiiToJqueryUIDatePickerLocalization::resolveTimeFormat(DateTimeUtil::getLocaleTimeFormat()), 'ampm' => DateTimeUtil::isLocaleTimeDisplayedAs12Hours()))); $cClipWidget->endClip(); $content = $cClipWidget->getController()->clips['EditableDateTimeElement']; return ZurmoHtml::tag('div', array('class' => 'has-date-select'), $content); }
/** * Renders content for a calendar. * @return A string containing the element's content. */ protected function renderContent() { $content = $this->renderViewToolBar(); $cClipWidget = new CClipWidget(); $cClipWidget->beginClip("Calendar"); $cClipWidget->widget('ext.zurmoinc.framework.widgets.Calendar', array('language' => YiiToJqueryUIDatePickerLocalization::getLanguage(), 'htmlOptions' => array('id' => 'calendar' . $this->uniqueLayoutId, 'name' => 'calendar' . $this->uniqueLayoutId), 'options' => array('dateFormat' => YiiToJqueryUIDatePickerLocalization::resolveDateFormat(DateTimeUtil::getLocaleDateFormat()), 'onChangeMonthYear' => $this->getOnChangeMonthScript(), 'onSelect' => $this->getOnSelectScript(), 'altFormat' => 'yy-mm-dd', 'altField' => '#calendarSelectedDate' . $this->uniqueLayoutId), 'dayEvents' => $this->makeDayEvents())); $cClipWidget->endClip(); $content .= $cClipWidget->getController()->clips['Calendar']; $content .= ZurmoHtml::textField('calendarSelectedDate' . $this->uniqueLayoutId, null, array('id' => 'calendarSelectedDate' . $this->uniqueLayoutId, 'style' => 'display:none;')); return $content; }
protected function resolveDefaultOptions() { $this->options['stepMinute'] = 5; $this->options['timeText'] = Zurmo::t('Core', 'Time'); $this->options['hourText'] = Zurmo::t('Core', 'Hour'); $this->options['minuteText'] = Zurmo::t('Core', 'Minute'); $this->options['secondText'] = Zurmo::t('Core', 'Second'); $this->options['showOn'] = 'both'; $this->options['buttonText'] = ZurmoHtml::tag('span', array(), '<!--Date-->'); $this->options['buttonImageOnly'] = false; $this->options['timeFormat'] = $this->getTimeFormat(); $this->options['dateFormat'] = YiiToJqueryUIDatePickerLocalization::resolveDateFormat(DateTimeUtil::getLocaleDateFormatForInput()); }