本文整理汇总了PHP中FOFModel::getTable方法的典型用法代码示例。如果您正苦于以下问题:PHP FOFModel::getTable方法的具体用法?PHP FOFModel::getTable怎么用?PHP FOFModel::getTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FOFModel
的用法示例。
在下文中一共展示了FOFModel::getTable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderFormEdit
/**
* Renders a FOFForm for an Edit view 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
*
* @return string The HTML rendering of the form
*/
protected function renderFormEdit(FOFForm &$form, FOFModel $model, FOFInput $input)
{
// Get the key for this model's table
$key = $model->getTable()->getKeyName();
$keyValue = $model->getId();
$html = '';
$validate = strtolower($form->getAttribute('validate'));
if (in_array($validate, array('true', 'yes', '1', 'on'))) {
JHTML::_('behavior.framework', true);
JHTML::_('behavior.formvalidation');
$class = ' form-validate';
$this->loadValidationScript($form);
} else {
$class = '';
}
// Check form enctype. Use enctype="multipart/form-data" to upload binary files in your form.
$template_form_enctype = $form->getAttribute('enctype');
if (!empty($template_form_enctype)) {
$enctype = ' enctype="' . $form->getAttribute('enctype') . '" ';
} else {
$enctype = '';
}
// Check form name. Use name="yourformname" to modify the name of your form.
$formname = $form->getAttribute('name');
if (empty($formname)) {
$formname = 'adminForm';
}
// Check form ID. Use id="yourformname" to modify the id of your form.
$formid = $form->getAttribute('name');
if (empty($formid)) {
$formid = 'adminForm';
}
$html .= '<form action="index.php" method="post" name="' . $formname . '" id="' . $formid . '"' . $enctype . ' class="form-horizontal' . $class . '">' . PHP_EOL;
$html .= "\t" . '<input type="hidden" name="option" value="' . $input->getCmd('option') . '" />' . PHP_EOL;
$html .= "\t" . '<input type="hidden" name="view" value="' . $input->getCmd('view', 'edit') . '" />' . PHP_EOL;
$html .= "\t" . '<input type="hidden" name="task" value="" />' . PHP_EOL;
$html .= "\t" . '<input type="hidden" name="' . $key . '" value="' . $keyValue . '" />' . PHP_EOL;
$html .= "\t" . '<input type="hidden" name="' . JFactory::getSession()->getFormToken() . '" value="1" />' . PHP_EOL;
$html .= $this->renderFormRaw($form, $model, $input, 'edit');
$html .= '</form>';
return $html;
}
示例2: renderFormEdit
/**
* Renders a FOFForm for a Browse view 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
*
* @return string The HTML rendering of the form
*/
protected function renderFormEdit(FOFForm &$form, FOFModel $model, FOFInput $input)
{
// Get the key for this model's table
$key = $model->getTable()->getKeyName();
$keyValue = $model->getId();
$html = '';
if ($validate = $form->getAttribute('validate')) {
JHTML::_('behavior.formvalidation');
$class = ' form-validate';
$this->loadValidationScript($form);
} else {
$class = '';
}
// Check form enctype. Use enctype="multipart/form-data" to upload binary files in your form.
$template_form_enctype = $form->getAttribute('enctype');
if (!empty($template_form_enctype)) {
$enctype = ' enctype="' . $form->getAttribute('enctype') . '" ';
} else {
$enctype = '';
}
// Check form name. Use name="yourformname" to modify the name of your form.
$formname = $form->getAttribute('name');
if (empty($formname)) {
$formname = 'adminForm';
}
// Check form ID. Use id="yourformname" to modify the id of your form.
$formid = $form->getAttribute('name');
if (empty($formname)) {
$formid = 'adminForm';
}
$html .= '<form action="index.php" method="post" name="' . $formname . '" id="' . $formid . '"' . $enctype . ' class="form-horizontal' . $class . '">' . PHP_EOL;
$html .= "\t" . '<input type="hidden" name="option" value="' . $input->getCmd('option') . '" />' . PHP_EOL;
$html .= "\t" . '<input type="hidden" name="view" value="' . $input->getCmd('view', 'edit') . '" />' . PHP_EOL;
$html .= "\t" . '<input type="hidden" name="task" value="" />' . PHP_EOL;
$html .= "\t" . '<input type="hidden" name="' . $key . '" value="' . $keyValue . '" />' . PHP_EOL;
$html .= "\t" . '<input type="hidden" name="' . JFactory::getSession()->getFormToken() . '" value="1" />' . PHP_EOL;
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) {
$title = $field->title;
$required = $field->required;
$labelClass = $field->labelClass;
$description = $field->description;
$input = $field->input;
if (!is_null($title)) {
$html .= "\t\t\t" . '<div class="control-group">' . 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" . $input . 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;
} else {
$html .= "\t\t\t\t" . $input . PHP_EOL;
}
}
$html .= "\t" . '</div>' . PHP_EOL;
}
$html .= '</form>';
return $html;
}
示例3: renderFormEdit
/**
* Renders a FOFForm for a Browse view 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
*
* @return string The HTML rendering of the form
*/
protected function renderFormEdit(FOFForm &$form, FOFModel $model, FOFInput $input)
{
// Get the key for this model's table
$key = $model->getTable()->getKeyName();
$keyValue = $model->getId();
JHTML::_('behavior.tooltip');
$html = '';
$validate = $form->getAttribute('validate');
$class = '';
if (!empty($validate)) {
JHTML::_('behavior.formvalidation');
$class = ' class="form-validate"';
$this->loadValidationScript($form);
}
// Check form enctype. Use enctype="multipart/form-data" to upload binary files in your form.
$template_form_enctype = $form->getAttribute('enctype');
if (!empty($template_form_enctype)) {
$enctype = ' enctype="' . $form->getAttribute('enctype') . '" ';
} else {
$enctype = '';
}
// Check form name. Use name="yourformname" to modify the name of your form.
$formname = $form->getAttribute('name');
if (empty($formname)) {
$formname = 'adminForm';
}
// Check form ID. Use id="yourformname" to modify the id of your form.
$formid = $form->getAttribute('name');
if (empty($formname)) {
$formid = 'adminForm';
}
$html .= '<form action="index.php" method="post" name="' . $formname . '" id="' . $formid . '"' . $enctype . ' class="' . $class . '">' . PHP_EOL;
$html .= "\t" . '<input type="hidden" name="option" value="' . $input->getCmd('option') . '" />' . PHP_EOL;
$html .= "\t" . '<input type="hidden" name="view" value="' . $input->getCmd('view', 'edit') . '" />' . PHP_EOL;
$html .= "\t" . '<input type="hidden" name="task" value="" />' . PHP_EOL;
$html .= "\t" . '<input type="hidden" name="' . $key . '" value="' . $keyValue . '" />' . PHP_EOL;
$html .= "\t" . '<input type="hidden" name="' . JFactory::getSession()->getFormToken() . '" value="1" />' . PHP_EOL;
foreach ($form->getFieldsets() as $fieldset) {
$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;
if (isset($fieldset->label) && !empty($fieldset->label)) {
$html .= "\t\t" . '<legend>' . JText::_($fieldset->label) . '</legend>' . PHP_EOL;
}
foreach ($fields as $field) {
$label = $field->label;
$input = $field->input;
if (!is_null($title)) {
$html .= "\t\t\t" . $label . PHP_EOL;
}
$html .= "\t\t\t" . $input . PHP_EOL;
}
$element = empty($fields) ? 'div' : 'fieldset';
$html .= "\t" . '</' . $element . '>' . PHP_EOL;
}
$html .= '</form>';
return $html;
}
示例4: renderFormEdit
/**
* Renders a FOFForm for an Edit view 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
*
* @return string The HTML rendering of the form
*/
protected function renderFormEdit(FOFForm &$form, FOFModel $model, FOFInput $input)
{
// Get the key for this model's table
$key = $model->getTable()->getKeyName();
$keyValue = $model->getId();
JHTML::_('behavior.tooltip');
$html = '';
$validate = strtolower($form->getAttribute('validate'));
$class = '';
if (in_array($validate, array('true', 'yes', '1', 'on'))) {
JHTML::_('behavior.framework', true);
JHTML::_('behavior.formvalidation');
$class = 'form-validate ';
$this->loadValidationScript($form);
}
// Check form enctype. Use enctype="multipart/form-data" to upload binary files in your form.
$template_form_enctype = $form->getAttribute('enctype');
if (!empty($template_form_enctype)) {
$enctype = ' enctype="' . $form->getAttribute('enctype') . '" ';
} else {
$enctype = '';
}
// Check form name. Use name="yourformname" to modify the name of your form.
$formname = $form->getAttribute('name');
if (empty($formname)) {
$formname = 'adminForm';
}
// Check form ID. Use id="yourformname" to modify the id of your form.
$formid = $form->getAttribute('name');
if (empty($formid)) {
$formid = 'adminForm';
}
// Check if we have a custom task
$customTask = $form->getAttribute('customTask');
if (empty($customTask)) {
$customTask = '';
}
// Get the form action URL
$actionUrl = FOFPlatform::getInstance()->isBackend() ? 'index.php' : JUri::root() . 'index.php';
if (FOFPlatform::getInstance()->isFrontend() && $input->getCmd('Itemid', 0) != 0) {
$itemid = $input->getCmd('Itemid', 0);
$uri = new JUri($actionUrl);
if ($itemid) {
$uri->setVar('Itemid', $itemid);
}
$actionUrl = JRoute::_($uri->toString());
}
$html .= '<form action="' . $actionUrl . '" method="post" name="' . $formname . '" id="' . $formid . '"' . $enctype . ' class="' . $class . '">' . PHP_EOL;
$html .= "\t" . '<input type="hidden" name="option" value="' . $input->getCmd('option') . '" />' . PHP_EOL;
$html .= "\t" . '<input type="hidden" name="view" value="' . $input->getCmd('view', 'edit') . '" />' . PHP_EOL;
$html .= "\t" . '<input type="hidden" name="task" value="' . $customTask . '" />' . PHP_EOL;
$html .= "\t" . '<input type="hidden" name="' . $key . '" value="' . $keyValue . '" />' . PHP_EOL;
$html .= "\t" . '<input type="hidden" name="' . JFactory::getSession()->getFormToken() . '" value="1" />' . PHP_EOL;
$html .= $this->renderFormRaw($form, $model, $input, 'edit');
$html .= '</form>';
return $html;
}