本文整理匯總了PHP中CActiveForm::dateField方法的典型用法代碼示例。如果您正苦於以下問題:PHP CActiveForm::dateField方法的具體用法?PHP CActiveForm::dateField怎麽用?PHP CActiveForm::dateField使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CActiveForm
的用法示例。
在下文中一共展示了CActiveForm::dateField方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: dateField
/**
* Date Field
*
* Renders a date field for a model attribute (automatically converting timestamps into RFC3339 date format).
* This method is a wrapper of `CHtml::activeDateField` which you should check for detailed information about
* the parameters for this method.
*
* @access public
* @param CModel $model
* @param string $attribute
* @param array $htmlOptions
* @return string
*/
public function dateField($model, $attribute, $htmlOptions = array())
{
$this->convertTimestamp($model, $attribute);
return parent::dateField($model, $attribute, $htmlOptions);
}
示例2: dateField
/**
* @inheritDoc
*/
public function dateField($model, $attribute, $htmlOptions = array())
{
if (!$this->qualifyNames && !isset($htmlOptions['name'])) {
$htmlOptions['name'] = $attribute;
}
if (!isset($htmlOptions['itemprop'])) {
$htmlOptions['itemprop'] = $this->getItemPropName($attribute);
}
if (!isset($htmlOptions['value']) && $model->{$attribute} instanceof \DateTime) {
$htmlOptions['value'] = $model->{$attribute}->format('Y-m-d');
}
return parent::dateField($model, $attribute, $htmlOptions);
}
示例3: dateField
public function dateField($model, $attribute, $htmlOptions = array())
{
return $this->label($model, $attribute) . parent::dateField($model, $attribute, $htmlOptions);
}