本文整理匯總了PHP中sfWidgetFormInput::generateId方法的典型用法代碼示例。如果您正苦於以下問題:PHP sfWidgetFormInput::generateId方法的具體用法?PHP sfWidgetFormInput::generateId怎麽用?PHP sfWidgetFormInput::generateId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sfWidgetFormInput
的用法示例。
在下文中一共展示了sfWidgetFormInput::generateId方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: render
/**
* @param string $name The element name
* @param string $value The date displayed in this widget
* @param array $attributes An array of HTML attributes to be merged with the default HTML attributes
* @param array $errors An array of errors for the field
*
* @return string An HTML tag string
*
* @see sfWidgetForm
*/
public function render($name, $value = null, $attributes = array(), $errors = array())
{
$attributes = $this->getAttributes();
$input = new sfWidgetFormInput(array(), $attributes);
$date = new DateTime($value);
$html = $input->render($name, $date->format('m/d/Y'));
$id = $input->generateId($name);
$culture = $this->getOption('culture');
$cm = $this->getOption("change_month") ? "true" : "false";
$cy = $this->getOption("change_year") ? "true" : "false";
$nom = $this->getOption("number_of_months");
$sbp = $this->getOption("show_button_panel") ? "true" : "false";
$showOn = $this->getOption("show_on");
$buttonImage = $this->getOption("button_image");
$bio = $this->getOption("button_image_only") ? "true" : "false";
if ($culture != 'en') {
$html .= <<<EOHTML
<script type="text/javascript">
\t\$(function() {
var params = \$.datepicker.regional['{$culture}'];
params.dateFormat = 'mm/dd/yy';
params.changeMonth = {$cm};
params.changeYear = {$cy};
params.numberOfMonths = {$nom};
params.showButtonPanel = {$sbp};
params.showOn = '{$showOn}';
params.buttonImage = '{$buttonImage}';
\t\tparams.buttonImageOnly = {$bio};
\$("#{$id}").datepicker(params);
\t});
</script>
EOHTML;
} else {
$html .= <<<EOHTML
<script type="text/javascript">
\t\$(function() {
var params = {
dateFormat: 'mm/dd/yy',
changeMonth : {$cm},
changeYear : {$cy},
numberOfMonths : {$nom},
showButtonPanel : {$sbp},
showOn : '{$showOn}',
buttonImage: '{$buttonImage}',
buttonImageOnly: {$bio}
};
\$("#{$id}").datepicker(params);
\t});
</script>
EOHTML;
}
return $html;
}
示例2: render
/**
* @param string $name The element name
* @param string $value The date displayed in this widget
* @param array $attributes An array of HTML attributes to be merged with the default HTML attributes
* @param array $errors An array of errors for the field
*
* @return string An HTML tag string
*
* @see sfWidgetForm
*/
public function render($name, $value = null, $attributes = array(), $errors = array())
{
$attributes = $this->getAttributes();
// Set date to requested format
if ($this->getOption('date_format') && $value) {
$value = date($this->getOption('date_format'), strtotime($value));
}
$input = new sfWidgetFormInput(array(), $attributes);
$html = $input->render($name, $value);
$id = $input->generateId($name);
$culture = $this->getOption('culture');
$cm = $this->getOption("change_month") ? "true" : "false";
$cy = $this->getOption("change_year") ? "true" : "false";
$nom = $this->getOption("number_of_months");
$sbp = $this->getOption("show_button_panel") ? "true" : "false";
if ($culture != 'en') {
$html .= <<<EOHTML
<script type="text/javascript">
\t\$(function() {
var params = \$.datepicker.regional['{$culture}'];
params.changeMonth = {$cm};
params.changeYear = {$cy};
params.numberOfMonths = {$nom};
params.showButtonPanel = {$sbp};
\$("#{$id}").datepicker(params);
\t});
</script>
EOHTML;
} else {
$html .= <<<EOHTML
<script type="text/javascript">
\t\$(function() {
var params = {
changeMonth : {$cm},
changeYear : {$cy},
numberOfMonths : {$nom},
showButtonPanel : {$sbp} };
\$("#{$id}").datepicker(params);
\t});
</script>
EOHTML;
}
return $html;
}
示例3: render
/**
* @param string $name The element name
* @param string $value The date displayed in this widget
* @param array $attributes An array of HTML attributes to be merged with the default HTML attributes
* @param array $errors An array of errors for the field
*
* @return string An HTML tag string
*
* @see sfWidgetFormInput
*/
public function render($name, $value = null, $attributes = array(), $errors = array()) {
$attributes = $this->getAttributes();
$input = new sfWidgetFormInput(array(), $attributes);
$html = $input->render($name, $value);
$id = $input->generateId($name);
$culture = $this->getOption('culture');
$cm = $this->getOption("change_month") ? "true" : "false";
$cy = $this->getOption("change_year") ? "true" : "false";
$nom = $this->getOption("number_of_months");
$sbp = $this->getOption("show_button_panel") ? "true" : "false";
$altField = $this->getOption('altField');
$dateFormat = $this->getOption('dateFormat');
$minDate = $this->getOption('minDate');
$maxDate = $this->getOption('maxDate');
if($this->getOption('defaultDate') == null) {
$defaultDate = $value;
} else {
$defaultDate = $this->getOption('defaultDate');
}
if ($culture != 'en') {
$html .= <<<EOHTML
<script type="text/javascript">
jQuery(function() {
var params = {
changeMonth : $cm,
changeYear : $cy,
numberOfMonths : $nom,
showButtonPanel : $sbp,
altField : '$altField',
dateFormat : '$dateFormat',
minDate : '$minDate',
maxDate : '$maxDate',
defaultDate : '$defaultDate'};
jQuery("#$id").datepicker(params);
jQuery( "#$id" ).datepicker( "option",
jQuery.datepicker.regional['$culture'] );
jQuery( "#$id" ).datepicker( "option", 'dateFormat', '$dateFormat');
});
</script>
EOHTML;
} else {
$html .= <<<EOHTML
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery.datepicker.setDefaults(jQuery.datepicker.regional['']);
var params = {
changeMonth : $cm,
changeYear : $cy,
numberOfMonths : $nom,
showButtonPanel : $sbp,
altField : '$altField',
dateFormat : '$dateFormat',
minDate : '$minDate',
maxDate : '$maxDate',
defaultDate : '$defaultDate'};
jQuery("#$id").datepicker(params);
});
</script>
EOHTML;
}
return $html;
}