本文整理汇总了PHP中JForm::render方法的典型用法代码示例。如果您正苦于以下问题:PHP JForm::render方法的具体用法?PHP JForm::render怎么用?PHP JForm::render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JForm
的用法示例。
在下文中一共展示了JForm::render方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* Render (NOTE when rendering admin settings I *think* the repeat group is set with $this->counter_override)
*
* @param string $name The name of the control, or the default text area if a setup file is not found
* @param string $group Group
* @param bool $write Write out or return
* @param int $repeatSingleVal If set and group is repeat only return int row from rendered params
*
* @return string HTML
*
* @since 1.5
*/
public function render($name = 'params', $group = '_default', $write = true, $repeatSingleVal = null)
{
$return = '';
$this->_group = $group;
// $$$rob experimental again
/**
* Problem - when rendering plugin params - e.g. calendar vis - params like the table drop down
* are repeated n times. I think the best way to deal with this is to get the data recorded for
* the viz and update this objects _xml array duplicate the relevant JSimpleXMLElement Objects
* for the required number of table drop downs
*/
$repeat = false;
$repeatControls = true;
$repeatMin = 0;
if (is_array($this->_xml)) {
if (array_key_exists($group, $this->_xml)) {
$repeat = $this->_xml[$group]->attributes('repeat');
$repeatMin = (int) $this->_xml[$group]->attributes('repeatmin');
$repeatControls = $this->_xml[$group]->attributes('repeatcontrols');
}
}
if ($repeat) {
// Get the name of the first element in the group
$children = $this->_xml[$group]->children();
if (empty($children)) {
$firstElName = '';
$allParamData = '';
$value = '';
} else {
$firstElName = str_replace("[]", "", $children[0]->attributes('name'));
$allParamData = $this->_registry['_default']['data'];
$value = $this->get($firstElName, array(), $group, 'array');
}
$c = 0;
// Limit the number of groups of repeated params written out
if (!is_null($repeatSingleVal) && is_int($repeatSingleVal)) {
$total = $repeatSingleVal + 1;
$start = $repeatSingleVal;
} else {
$total = count($value);
$start = 0;
}
$return .= '<div id="container' . $this->_identifier . '">';
// Add in the 'add' button to duplicate the group
// Only show for first added group
if ($repeatControls && $repeatSingleVal == 0) {
$return .= "<a href='#' class='addButton'>" . FText::_('COM_FABRIK_ADD') . "</a>";
}
for ($x = $start; $x < $total; $x++) {
// Call render for the number of time the group is repeated
$return .= '<div class="repeatGroup" id="' . $this->_identifier . 'group-' . $x . '">';
$params = $this->getParams($name, $group, 'array', $x);
$html = array();
$html[] = '<table width="100%" class="paramlist admintable" cellspacing="1">';
if ($description = $this->_xml[$group]->attributes('description')) {
// Add the params description to the display
$desc = FText::_($description);
$html[] = '<tr><td class="paramlist_description" colspan="2">' . $desc . '</td></tr>';
}
foreach ($params as $param) {
$html[] = '<tr>';
if ($param[0]) {
$html[] = '<td width="40%" class="paramlist_key"><span class="editlinktip">' . $param[0] . '</span></td>';
$html[] = '<td class="paramlist_value">' . $param[1] . '</td>';
} else {
$html[] = '<td class="paramlist_value" colspan="2">' . $param[1] . '</td>';
}
$html[] = '</tr>';
}
if (count($params) < 1) {
$html[] = "<tr><td colspan=\"2\"><i>" . FText::_('COM_FABRIK_THERE_ARE_NO_PARAMETERS_FOR_THIS_ITEM') . "</i></td></tr>";
}
$html[] = '</table>';
if ($repeatControls) {
$html[] = "<a href='#' class=\"removeButton delete\">" . FText::_('COM_FABRIK_DELETE') . "</a>";
}
$return .= implode("\n", $html);
$c++;
$return .= "</div>";
}
$return .= "</div>";
} else {
$return .= parent::render($name, $group);
}
if ($repeat && $repeatControls && ($repeatSingleVal == null || $repeatSingleVal == 0)) {
FabrikHelperHTML::script('components/com_fabrik/libs/params.js');
// Watch add and remove buttons
$document = JFactory::getDocument();
//.........这里部分代码省略.........