本文整理汇总了PHP中FOFModel::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP FOFModel::getName方法的具体用法?PHP FOFModel::getName怎么用?PHP FOFModel::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FOFModel
的用法示例。
在下文中一共展示了FOFModel::getName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderFormRaw
/**
* Renders a raw FOFForm and returns the corresponding HTML
*
* @param FOFForm &$form The form to render
* @param FOFModel $model The model providing our data
* @param FOFInput $input The input object
* @param string $formType The form type e.g. 'edit' or 'read'
*
* @return string The HTML rendering of the form
*/
protected function renderFormRaw(FOFForm &$form, FOFModel $model, FOFInput $input, $formType)
{
$html = '';
foreach ($form->getFieldsets() as $fieldset) {
$fields = $form->getFieldset($fieldset->name);
if (isset($fieldset->class)) {
$class = 'class="' . $fieldset->class . '"';
} else {
$class = '';
}
$html .= "\t" . '<div id="' . $fieldset->name . '" ' . $class . '>' . PHP_EOL;
if (isset($fieldset->label) && !empty($fieldset->label)) {
$html .= "\t\t" . '<h3>' . JText::_($fieldset->label) . '</h3>' . PHP_EOL;
}
foreach ($fields as $field) {
$required = $field->required;
$labelClass = $field->labelClass;
$groupClass = $form->getFieldAttribute($field->fieldname, 'groupclass', '', $field->group);
// Auto-generate label and description if needed
// Field label
$title = $form->getFieldAttribute($field->fieldname, 'label', '', $field->group);
$emptylabel = $form->getFieldAttribute($field->fieldname, 'emptylabel', false, $field->group);
if (empty($title) && !$emptylabel) {
$model->getName();
$title = strtoupper($input->get('option') . '_' . $model->getName() . '_' . $field->id . '_LABEL');
}
// Field description
$description = $form->getFieldAttribute($field->fieldname, 'description', '', $field->group);
/**
* The following code is backwards incompatible. Most forms don't require a description in their form
* fields. Having to use emptydescription="1" on each one of them is an overkill. Removed.
*/
/*
$emptydescription = $form->getFieldAttribute($field->fieldname, 'emptydescription', false, $field->group);
if (empty($description) && !$emptydescription)
{
$description = strtoupper($input->get('option') . '_' . $model->getName() . '_' . $field->id . '_DESC');
}
*/
if ($formType == 'read') {
$inputField = $field->static;
} elseif ($formType == 'edit') {
$inputField = $field->input;
}
if (empty($title)) {
$html .= "\t\t\t" . $inputField . PHP_EOL;
if (!empty($description) && $formType == 'edit') {
$html .= "\t\t\t\t" . '<span class="help-block">';
$html .= JText::_($description) . '</span>' . PHP_EOL;
}
} else {
$html .= "\t\t\t" . '<div class="control-group ' . $groupClass . '">' . PHP_EOL;
$html .= "\t\t\t\t" . '<label class="control-label ' . $labelClass . '" for="' . $field->id . '">' . PHP_EOL;
$html .= "\t\t\t\t" . JText::_($title) . PHP_EOL;
if ($required) {
$html .= ' *';
}
$html .= "\t\t\t\t" . '</label>' . PHP_EOL;
$html .= "\t\t\t\t" . '<div class="controls">' . PHP_EOL;
$html .= "\t\t\t\t" . $inputField . PHP_EOL;
if (!empty($description)) {
$html .= "\t\t\t\t" . '<span class="help-block">';
$html .= JText::_($description) . '</span>' . PHP_EOL;
}
$html .= "\t\t\t\t" . '</div>' . PHP_EOL;
$html .= "\t\t\t" . '</div>' . PHP_EOL;
}
}
$html .= "\t" . '</div>' . PHP_EOL;
}
return $html;
}
示例2: renderFieldset
/**
* Renders a raw fieldset of a FOFForm and returns the corresponding HTML
*
* @param stdClass &$fieldset The fieldset to render
* @param FOFForm &$form The form to render
* @param FOFModel $model The model providing our data
* @param FOFInput $input The input object
* @param string $formType The form type e.g. 'edit' or 'read'
* @param boolean $showHeader Should I render the fieldset's header?
*
* @return string The HTML rendering of the fieldset
*/
protected function renderFieldset(stdClass &$fieldset, FOFForm &$form, FOFModel $model, FOFInput $input, $formType, $showHeader = true)
{
$html = '';
$fields = $form->getFieldset($fieldset->name);
if (isset($fieldset->class)) {
$class = 'class="' . $fieldset->class . '"';
} else {
$class = '';
}
$element = empty($fields) ? 'div' : 'fieldset';
$html .= "\t" . '<' . $element . ' id="' . $fieldset->name . '" ' . $class . '>' . PHP_EOL;
$isTabbedFieldset = $this->isTabFieldset($fieldset);
if (isset($fieldset->label) && !empty($fieldset->label) && !$isTabbedFieldset) {
$html .= "\t\t" . '<h3>' . JText::_($fieldset->label) . '</h3>' . PHP_EOL;
}
foreach ($fields as $field) {
$groupClass = $form->getFieldAttribute($field->fieldname, 'groupclass', '', $field->group);
// Auto-generate label and description if needed
// Field label
$title = $form->getFieldAttribute($field->fieldname, 'label', '', $field->group);
$emptylabel = $form->getFieldAttribute($field->fieldname, 'emptylabel', false, $field->group);
if (empty($title) && !$emptylabel) {
$model->getName();
$title = strtoupper($input->get('option') . '_' . $model->getName() . '_' . $field->id . '_LABEL');
}
// Field description
$description = $form->getFieldAttribute($field->fieldname, 'description', '', $field->group);
/**
* The following code is backwards incompatible. Most forms don't require a description in their form
* fields. Having to use emptydescription="1" on each one of them is an overkill. Removed.
*/
/*
$emptydescription = $form->getFieldAttribute($field->fieldname, 'emptydescription', false, $field->group);
if (empty($description) && !$emptydescription)
{
$description = strtoupper($input->get('option') . '_' . $model->getName() . '_' . $field->id . '_DESC');
}
*/
if ($formType == 'read') {
$inputField = $field->static;
} elseif ($formType == 'edit') {
$inputField = $field->input;
}
if (empty($title)) {
$html .= "\t\t\t" . $inputField . PHP_EOL;
if (!empty($description) && $formType == 'edit') {
$html .= "\t\t\t\t" . '<span class="help-block">';
$html .= JText::_($description) . '</span>' . PHP_EOL;
}
} else {
$html .= "\t\t\t" . '<div class="fof-row ' . $groupClass . '">' . PHP_EOL;
$html .= $this->renderFieldsetLabel($field, $form, $title);
$html .= "\t\t\t\t" . $inputField . PHP_EOL;
if (!empty($description)) {
$html .= "\t\t\t\t" . '<span class="help-block">';
$html .= JText::_($description) . '</span>' . PHP_EOL;
}
$html .= "\t\t\t" . '</div>' . PHP_EOL;
}
}
$element = empty($fields) ? 'div' : 'fieldset';
$html .= "\t" . '</' . $element . '>' . PHP_EOL;
return $html;
}