本文整理汇总了PHP中JFormHelper::loadFieldType方法的典型用法代码示例。如果您正苦于以下问题:PHP JFormHelper::loadFieldType方法的具体用法?PHP JFormHelper::loadFieldType怎么用?PHP JFormHelper::loadFieldType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JFormHelper
的用法示例。
在下文中一共展示了JFormHelper::loadFieldType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadField
/**
* Method to load, setup and return a JFormField object based on field data.
*
* @param string $element The XML element object representation of the form field.
* @param string $group The optional dot-separated form group path on which to find the field.
* @param mixed $value The optional value to use as the default for the field.
*
* @return mixed The JFormField object for the field or boolean false on error.
*
* @since 11.1
*/
protected function loadField($element, $group = null, $value = null)
{
// Get the field type.
$type = $element['type'] ? (string) $element['type'] : 'text';
// Load the JFormField object for the field.
/** @var $field JFormField */
$field = JFormHelper::loadFieldType($type, true);
// If the object could not be loaded, get a text field object.
if ($field === false) {
$field = JFormHelper::loadFieldType('text', true);
}
// Get the value for the form field if not set.
// Default to the translated version of the 'default' attribute
// if 'translate_default' attribute if set to 'true' or '1'
// else the value of the 'default' attribute for the field.
if ($value === null) {
$default = (string) $element['default'];
if (($translate = $element['translate_default']) && ((string) $translate == 'true' || (string) $translate == '1')) {
$lang = JFactory::getLanguage();
if ($lang->hasKey($default)) {
$debug = $lang->setDebug(false);
$default = JText::_($default);
$lang->setDebug($debug);
} else {
$default = JText::_($default);
}
}
}
if ($field->setup($element, $value, $group)) {
return $field;
} else {
return false;
}
}
示例2: createStatuses
public static function createStatuses()
{
$app = JFactory::getApplication();
$filter_steps = $app->getUserStateFromRequest('com_imc.issues.filter.steps', 'steps', array());
//get issue statuses
JFormHelper::addFieldPath(JPATH_ROOT . '/components/com_imc/models/fields');
$step = JFormHelper::loadFieldType('Step', false);
$statuses = $step->getOptions();
if (empty($filter_steps)) {
$str = '<ul class="imc_ulist imc_ulist_inline">';
foreach ($statuses as $status) {
$str .= '<li>';
$str .= '<input type="checkbox" name="steps[]" value="' . $status->value . '" ' . 'checked="checked"' . '>';
$str .= '<span class="root">' . ' ' . $status->text . '</span>';
$str .= '</li>';
}
$str .= '</ul>';
} else {
$str = '<ul class="imc_ulist imc_ulist_inline">';
foreach ($statuses as $status) {
$str .= '<li>';
$str .= '<input type="checkbox" name="steps[]" value="' . $status->value . '" ' . (in_array($status->value, $filter_steps) ? 'checked="checked"' : '') . '>';
$str .= '<span class="root">' . ' ' . $status->text . '</span>';
$str .= '</li>';
}
$str .= '</ul>';
}
return $str;
}
示例3: getInput
/**
* Method to get the field input markup.
*
* @return string The field input markup.
* @since 1.6
*/
protected function getInput()
{
// use as type here the default basic data field type (as example: Text/Calendar/Textarea/Editor)
// see http://docs.joomla.org/Standard_form_field_types
$field = JFormHelper::loadFieldType('Calendar');
$field->setForm($this->form);
$field->setup($this->element, $this->value);
return $field->getInput();
}
示例4: getInput
/**
* Method to get the field input markup.
*
* @return string The field input markup.
* @since 1.6
*/
protected function getInput()
{
global $jlistConfig;
$app = JFactory::getApplication();
JHtml::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . '/helpers');
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');
$field = JFormHelper::loadFieldType('Text');
$field->setForm($this->form);
if ($this->value != '') {
$field->setup($this->element, $this->value);
} else {
$field->setup($this->element, htmlspecialchars(trim($jlistConfig['custom.field.10.values']), ENT_COMPAT, 'UTF-8'));
}
return $field->getInput();
}
示例5: getField
/**
* Method to get the HTML of a certain field
*
* @param null
* @return string
*/
public static function getField($type, $name, $value = null, $array = 'magebridge')
{
jimport('joomla.form.helper');
jimport('joomla.form.form');
$fileType = preg_replace('/^magebridge\\./', '', $type);
include_once JPATH_ADMINISTRATOR . '/components/com_magebridge/fields/' . $fileType . '.php';
$form = new JForm('magebridge');
$field = JFormHelper::loadFieldType($type);
if (is_object($field) == false) {
$message = JText::sprintf('COM_MAGEBRIDGE_UNKNOWN_FIELD', $type);
JFactory::getApplication()->enqueueMessage($message, 'error');
return null;
}
$field->setName($name);
$field->setValue($value);
return $field->getHtmlInput();
}
示例6: getField
public static function getField($type, $name, $value = null, $array = 'magebridge')
{
if (MageBridgeHelper::isJoomla15()) {
require_once JPATH_ADMINISTRATOR . '/components/com_magebridge/elements/' . $type . '.php';
$fake = null;
$class = 'JElement' . ucfirst($type);
$object = new $class();
return call_user_func(array($object, 'fetchElement'), $name, $value, $fake, $array);
} else {
jimport('joomla.form.helper');
jimport('joomla.form.form');
require_once JPATH_ADMINISTRATOR . '/components/com_magebridge/fields/' . $type . '.php';
$form = new JForm('magebridge');
$field = JFormHelper::loadFieldType($type);
$field->setName($name);
$field->setValue($value);
return $field->getHtmlInput();
}
}
示例7: getItems
function getItems()
{
$items = array();
foreach ($this->element->children() as $element) {
// clone element to make it as field
$fdata = preg_replace('/<(\\/?)item(\\s|>)/mi', '<\\1field\\2', $element->asXML());
$felement = new SimpleXMLElement($fdata);
$field = JFormHelper::loadFieldType((string) $felement['type']);
if ($field === false) {
$field = JFormHelper::loadFieldType('text');
}
// Setup the JFormField object.
$field->setForm($this->form);
if ($field->setup($felement, null, $this->group . '.' . $this->fieldname)) {
$items[] = $field;
}
}
return $items;
}
示例8: testConstruct
/**
* Tests the JForm::__construct method
*/
public function testConstruct()
{
$form = new JForm('form1');
$this->assertThat($form->load(JFormDataHelper::$loadFieldDocument), $this->isTrue(), 'Line:' . __LINE__ . ' XML string should load successfully.');
$field = new JFormFieldInspector($form);
$this->assertThat($field instanceof JFormField, $this->isTrue(), 'Line:' . __LINE__ . ' The JFormField constuctor should return a JFormField object.');
$this->assertThat($field->getForm(), $this->identicalTo($form), 'Line:' . __LINE__ . ' The internal form should be identical to the variable passed in the contructor.');
// Add custom path.
JForm::addFieldPath(__DIR__ . '/_testfields');
JFormHelper::loadFieldType('foo.bar');
$field = new FooFormFieldBar($form);
$this->assertEquals($field->type, 'FooBar', 'Line:' . __LINE__ . ' The field type should have been guessed by the constructor.');
JFormHelper::loadFieldType('foo');
$field = new JFormFieldFoo($form);
$this->assertEquals($field->type, 'Foo', 'Line:' . __LINE__ . ' The field type should have been guessed by the constructor.');
JFormHelper::loadFieldType('modal_foo');
$field = new JFormFieldModal_Foo($form);
$this->assertEquals($field->type, 'Modal_Foo', 'Line:' . __LINE__ . ' The field type should have been guessed by the constructor.');
}
示例9: addToolbar
protected function addToolbar()
{
$state = $this->get('State');
$canDo = SimplefilemanagerHelper::getActions($state->get('filter.category_id'));
$user = JFactory::getUser();
$bar = JToolBar::getInstance('toolbar');
JToolbarHelper::title(JText::_('COM_SIMPLEFILEMANAGER_MANAGER_SIMPLEFILEMANAGERS'), 'file-2');
// User should be authorized to publish at least in a category
if ($canDo->get('core.create') && count($user->getAuthorisedCategories('com_simplefilemanager', 'core.create')) > 0) {
JToolbarHelper::addNew('simplefilemanager.add');
}
if ($canDo->get('core.edit')) {
JToolbarHelper::editList('simplefilemanager.edit');
}
if ($canDo->get('core.edit.state')) {
JToolbarHelper::publish('simplefilemanagers.publish', 'JTOOLBAR_PUBLISH', true);
JToolbarHelper::unpublish('simplefilemanagers.unpublish', 'JTOOLBAR_UNPUBLISH', true);
JToolbarHelper::archiveList('simplefilemanagers.archive');
JToolbarHelper::checkin('simplefilemanagers.checkin');
}
$state = $this->get('State');
if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) {
JToolbarHelper::deleteList('', 'simplefilemanagers.delete', 'JTOOLBAR_EMPTY_TRASH');
} elseif ($canDo->get('core.edit.state')) {
JToolbarHelper::trash('simplefilemanagers.trash');
}
if ($canDo->get('core.admin')) {
JToolbarHelper::preferences('com_simplefilemanager');
}
JToolBarHelper::help('COM_SIMPLEFILEMANAGER_HELP_VIEW_SIMPLEFILEMANANGERS', false, 'http://www.simplefilemanager.eu/support');
JHtmlSidebar::setAction('index.php?option=com_simplefilemanager&view=simplefilemanagers');
JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_state', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.state'), true));
$this->category = JFormHelper::loadFieldType('catid', false);
$this->categoryOptions = $this->category->getOptions();
JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_CATEGORY'), 'filter_category', JHtml::_('select.options', $this->categoryOptions, 'value', 'text', $this->state->get('filter.category')));
$this->visibilityOptions = array(1 => JText::_('COM_SIMPLEFILEMANAGER_VISIBILITY_PUBLIC'), 2 => JText::_('COM_SIMPLEFILEMANAGER_VISIBILITY_REGISTRED'), 3 => JText::_('COM_SIMPLEFILEMANAGER_VISIBILITY_USER'), 4 => JText::_('COM_SIMPLEFILEMANAGER_VISIBILITY_GROUP'), 5 => JText::_('COM_SIMPLEFILEMANAGER_VISIBILITY_AUTHOR'));
JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_VISIBILITY'), 'filter_visibility', JHtml::_('select.options', $this->visibilityOptions, 'value', 'text', $this->state->get('filter.visibility')));
}
示例10: getItems
function getItems()
{
$items = array();
foreach ($this->element->children() as $element) {
// clone element to make it as field
$fdata = preg_replace('/<(\\/?)item(\\s|>)/mi', '<\\1field\\2', $element->asXML());
// remove cols, rows, size attributes
$fdata = preg_replace('/\\s(cols|rows|size)=(\'|")\\d+(\'|")/mi', '', $fdata);
// change type text to textarea
$fdata = str_replace('type="text"', 'type="textarea"', $fdata);
$felement = new JXMLElement($fdata);
$field = JFormHelper::loadFieldType((string) $felement['type']);
if ($field === false) {
$field = $this->loadFieldType('text');
}
// Setup the JFormField object.
$field->setForm($this->form);
if ($field->setup($felement, null, $this->name)) {
$items[] = $field;
}
}
return $items;
}
示例11: element
/**
* $type, $domId, $value, $options = array(), $formName = null, $disabled = false
*/
public static function element()
{
list($type, $domId, $value, $options) = func_get_args();
$options = (array) $options;
// Load the JFormField object for the field.
JFormHelper::addFieldPath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'models' . DS . 'fields');
$field = JFormHelper::loadFieldType($type, true);
// If the object could not be loaded, get a text field object.
if ($field === false) {
throw new Exception('Cannot load field type ' . $type);
}
$element = new JXMLElement('<field></field>');
$element->addAttribute('id', $domId);
if (!empty($options)) {
foreach ($options as $name => $val) {
$element->addAttribute($name, $val);
}
}
if (!$field->setup($element, $value, null)) {
throw new Exception('Cannot setup field ' . $type);
}
return $field->input;
}
示例12: addToolbar
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
require_once JPATH_COMPONENT . '/helpers/imc.php';
$state = $this->get('State');
$canDo = ImcHelper::getActions($state->get('filter.category_id'));
JToolBarHelper::title(JText::_('COM_IMC_TITLE_ISSUES'), 'drawer');
//Check if the form exists before showing the add/edit buttons
$formPath = JPATH_COMPONENT_ADMINISTRATOR . '/views/issue';
if (file_exists($formPath)) {
if ($canDo->get('core.create')) {
JToolBarHelper::addNew('issue.add', 'JTOOLBAR_NEW');
}
if ($canDo->get('core.edit') && isset($this->items[0])) {
JToolBarHelper::editList('issue.edit', 'JTOOLBAR_EDIT');
}
}
if ($canDo->get('core.edit.state')) {
if (isset($this->items[0]->state)) {
JToolBarHelper::divider();
JToolBarHelper::custom('issues.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true);
JToolBarHelper::custom('issues.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true);
} else {
if (isset($this->items[0])) {
//If this component does not use state then show a direct delete button as we can not trash
JToolBarHelper::deleteList('', 'issues.delete', 'JTOOLBAR_DELETE');
}
}
if (isset($this->items[0]->state)) {
JToolBarHelper::divider();
JToolBarHelper::archiveList('issues.archive', 'JTOOLBAR_ARCHIVE');
}
if (isset($this->items[0]->checked_out)) {
JToolBarHelper::custom('issues.checkin', 'checkin.png', 'checkin_f2.png', 'JTOOLBAR_CHECKIN', true);
}
}
//Show trash and delete for components that uses the state field
if (isset($this->items[0]->state)) {
if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) {
JToolBarHelper::deleteList('', 'issues.delete', 'JTOOLBAR_EMPTY_TRASH');
JToolBarHelper::divider();
} else {
if ($canDo->get('core.edit.state')) {
JToolBarHelper::trash('issues.trash', 'JTOOLBAR_TRASH');
JToolBarHelper::divider();
}
}
}
if ($canDo->get('core.admin')) {
JToolBarHelper::preferences('com_imc');
}
//Set sidebar action - New in 3.0
JHtmlSidebar::setAction('index.php?option=com_imc&view=issues');
$this->extra_sidebar = '';
JHtmlSidebar::addFilter(JText::_("JOPTION_SELECT_CATEGORY"), 'filter_catid', JHtml::_('select.options', JHtml::_('category.options', 'com_imc'), "value", "text", $this->state->get('filter.catid')));
//Get custom field
JFormHelper::addFieldPath(JPATH_ROOT . '/components/com_imc/models/fields');
$steps = JFormHelper::loadFieldType('Step', false);
$options = $steps->getOptions();
JHtmlSidebar::addFilter(JText::_("COM_IMC_ISSUES_STEPID_FILTER"), 'filter_stepid', JHtml::_('select.options', $options, "value", "text", $this->state->get('filter.stepid'), true));
JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), "value", "text", $this->state->get('filter.state'), true));
}
示例13: addToolBar
/**
* Setting the toolbar
*/
protected function addToolBar()
{
JToolBarHelper::title(JText::_('COM_COMPONENTBUILDER_HELP_DOCUMENTS'), 'support');
JHtmlSidebar::setAction('index.php?option=com_componentbuilder&view=help_documents');
JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields');
if ($this->canCreate) {
JToolBarHelper::addNew('help_document.add');
}
// Only load if there are items
if (ComponentbuilderHelper::checkArray($this->items)) {
if ($this->canEdit) {
JToolBarHelper::editList('help_document.edit');
}
if ($this->canState) {
JToolBarHelper::publishList('help_documents.publish');
JToolBarHelper::unpublishList('help_documents.unpublish');
JToolBarHelper::archiveList('help_documents.archive');
if ($this->canDo->get('core.admin')) {
JToolBarHelper::checkin('help_documents.checkin');
}
}
// Add a batch button
if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) {
// Get the toolbar object instance
$bar = JToolBar::getInstance('toolbar');
// set the batch button name
$title = JText::_('JTOOLBAR_BATCH');
// Instantiate a new JLayoutFile instance and render the batch button
$layout = new JLayoutFile('joomla.toolbar.batch');
// add the button to the page
$dhtml = $layout->render(array('title' => $title));
$bar->appendButton('Custom', $dhtml, 'batch');
}
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) {
JToolbarHelper::deleteList('', 'help_documents.delete', 'JTOOLBAR_EMPTY_TRASH');
} elseif ($this->canState && $this->canDelete) {
JToolbarHelper::trash('help_documents.trash');
}
if ($this->canDo->get('core.export') && $this->canDo->get('help_document.export')) {
JToolBarHelper::custom('help_documents.exportData', 'download', '', 'COM_COMPONENTBUILDER_EXPORT_DATA', true);
}
}
if ($this->canDo->get('core.import') && $this->canDo->get('help_document.import')) {
JToolBarHelper::custom('help_documents.importData', 'upload', '', 'COM_COMPONENTBUILDER_IMPORT_DATA', false);
}
// set help url for this view if found
$help_url = ComponentbuilderHelper::getHelpUrl('help_documents');
if (ComponentbuilderHelper::checkString($help_url)) {
JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url);
}
// add the options comp button
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) {
JToolBarHelper::preferences('com_componentbuilder');
}
if ($this->canState) {
JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true));
// only load if batch allowed
if ($this->canBatch) {
JHtmlBatch_::addListSelection(JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), 'batch[published]', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true));
}
}
JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_ACCESS'), 'filter_access', JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')));
if ($this->canBatch && $this->canCreate && $this->canEdit) {
JHtmlBatch_::addListSelection(JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), 'batch[access]', JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text'));
}
// Set Type Selection
$this->typeOptions = $this->getTheTypeSelections();
if ($this->typeOptions) {
// Type Filter
JHtmlSidebar::addFilter('- Select ' . JText::_('COM_COMPONENTBUILDER_HELP_DOCUMENT_TYPE_LABEL') . ' -', 'filter_type', JHtml::_('select.options', $this->typeOptions, 'value', 'text', $this->state->get('filter.type')));
if ($this->canBatch && $this->canCreate && $this->canEdit) {
// Type Batch Selection
JHtmlBatch_::addListSelection('- Keep Original ' . JText::_('COM_COMPONENTBUILDER_HELP_DOCUMENT_TYPE_LABEL') . ' -', 'batch[type]', JHtml::_('select.options', $this->typeOptions, 'value', 'text'));
}
}
// Set Location Selection
$this->locationOptions = $this->getTheLocationSelections();
if ($this->locationOptions) {
// Location Filter
JHtmlSidebar::addFilter('- Select ' . JText::_('COM_COMPONENTBUILDER_HELP_DOCUMENT_LOCATION_LABEL') . ' -', 'filter_location', JHtml::_('select.options', $this->locationOptions, 'value', 'text', $this->state->get('filter.location')));
if ($this->canBatch && $this->canCreate && $this->canEdit) {
// Location Batch Selection
JHtmlBatch_::addListSelection('- Keep Original ' . JText::_('COM_COMPONENTBUILDER_HELP_DOCUMENT_LOCATION_LABEL') . ' -', 'batch[location]', JHtml::_('select.options', $this->locationOptions, 'value', 'text'));
}
}
// Set Admin View Selection
$this->admin_viewOptions = JFormHelper::loadFieldType('Adminviewfolderlist')->getOptions();
if ($this->admin_viewOptions) {
// Admin View Filter
JHtmlSidebar::addFilter('- Select ' . JText::_('COM_COMPONENTBUILDER_HELP_DOCUMENT_ADMIN_VIEW_LABEL') . ' -', 'filter_admin_view', JHtml::_('select.options', $this->admin_viewOptions, 'value', 'text', $this->state->get('filter.admin_view')));
if ($this->canBatch && $this->canCreate && $this->canEdit) {
// Admin View Batch Selection
JHtmlBatch_::addListSelection('- Keep Original ' . JText::_('COM_COMPONENTBUILDER_HELP_DOCUMENT_ADMIN_VIEW_LABEL') . ' -', 'batch[admin_view]', JHtml::_('select.options', $this->admin_viewOptions, 'value', 'text'));
}
}
// Set Site View Selection
$this->site_viewOptions = JFormHelper::loadFieldType('Siteviewfolderlist')->getOptions();
//.........这里部分代码省略.........
示例14: blockElementStartHTML
function blockElementStartHTML($isGroup = false)
{
$output = '';
$maxRepeatLength = isset($this->element['maxrepeatlength']) ? (int) $this->element['maxrepeatlength'] : 0;
$buttons = '';
if ($maxRepeatLength !== 1) {
$buttons .= '<a href="#" onclick="javascript:gjVariablefield.delete_current_slide(this); return(false);" class="variablefield_buttons delete_current_slide" >-</a>';
$buttons .= '<a href="#" onclick="javascript:gjVariablefield.add_new_slide(this, ' . $maxRepeatLength . '); return(false);" class="variablefield_buttons add_new_slide" >+</a>';
$buttons .= '<a href="#" onclick="javascript:gjVariablefield.move_up_slide(this); return(false);" class="variablefield_buttons move_up_slide" >⇑</a>';
$buttons .= '<a href="#" onclick="javascript:gjVariablefield.move_down_slide(this); return(false);" class="variablefield_buttons move_down_slide" >⇓</a>';
}
if ($isGroup) {
// Group name consist of specially prepared below Label and text Input with class .hide
// Prepare Label
$formfield = JFormHelper::loadFieldType('text');
$formfield->setup($this->element, '');
//Load current XML to get all XML attributes in $formfield
$formfield->labelClass = 'groupSlider ';
$formfield->labelclass = 'groupSlider ';
// Need to set class like this in J3.2+
$formfield->class = 'groupSlider ';
// Need to set class like this in J3.2+
if (!empty($this->group_header)) {
//We get Label text either from stored plugin params, or from XML attributes
$text = $this->group_header;
} else {
$text = $formfield->element['label'] ? (string) $formfield->element['label'] : (string) $formfield->element['name'];
}
$goupname = 'variablegroup__' . str_replace('{', '', $this->element['name']);
//Is needed for toggler JS
$output .= '<div class="variablefield_div repeating_group ' . $goupname . '" >' . '<div class="buttons_container">';
$text = JText::_($text);
$formfield->element['label'] = '';
// Prepare buttons
$editbutton = '<a href="#" onclick="javascript:gjVariablefield.editGroupName(this); return(false);" class="hasTip editGroupName editGroupNameButton" title="' . JText::_('JACTION_EDIT') . '::">✍</a>';
$editbutton .= '<a href="#" onclick="javascript:gjVariablefield.cancelGroupNameEdit(this); return(false);" class="hasTip cancelGroupNameEdit editGroupNameButton hide " title="' . JText::_('JCANCEL') . '::">✕</a>';
$output .= $formfield->getLabel() . $editbutton . '<span style="float:right;">' . $buttons . '</span>';
//$formfield->getLabel();
//$output .= $editbutton.$buttons;
// Prepare input field for group name
$formfield->element['size'] = '';
$formfield->element['class'] = 'groupnameEditField';
$formfield->class = 'groupnameEditField';
// Need to set class like this in J3.2+
//$formfield->value = htmlspecialchars($text, ENT_COMPAT, 'UTF-8');
//$formfield->value = addslashes($text);
$formfield->value = $text;
$formfield->name = 'jform[params][' . $this->fieldname . '][' . (string) $this->fieldname . '][]';
// Remake field name to use group name
$formfield->element['readonly'] = 'true';
$formfield->readonly = 'true';
// Need to set class like this in J3.2+
$output .= '<span class="hdr-wrppr">' . $formfield->getInput() . '</span>' . PHP_EOL;
$output .= '</div><!-- buttons_container -->';
//Field to store group status - opened or closed
$formfield = JFormHelper::loadFieldType('hidden');
$formfield->setup($this->element, '');
$formfield->name = 'jform[params][' . $this->fieldname . '][' . (string) $this->fieldname . '][]';
// Remake field name to use group name
$formfield->element['class'] = 'groupState';
$formfield->class = 'groupState';
// Need to set class like this in J3.2+
$formfield->element['disabled'] = null;
$formfield->element['onchange'] = null;
$formfield->value = $this->open;
$output .= $formfield->getInput() . PHP_EOL;
//Let show the script, that the group has ended
$formfield = JFormHelper::loadFieldType('hidden');
$formfield->setup($this->element, '');
$formfield->name = 'jform[params][' . $this->fieldname . '][' . (string) $this->fieldname . '][]';
// Remake field name to use group name
$formfield->value = 'variablefield::' . $this->fieldname;
$output .= $formfield->getInput() . PHP_EOL;
} else {
$output .= '<div class="variablefield_div repeating_element" >' . '<div class="buttons_container">' . $buttons . '</div><!-- buttons_container -->';
}
return $output;
return $output . '<span class="cleaner"></span>';
}
示例15: addToolBar
/**
* Setting the toolbar
*/
protected function addToolBar()
{
JToolBarHelper::title(JText::_('COM_COSTBENEFITPROJECTION_INTERVENTIONS'), 'wand');
JHtmlSidebar::setAction('index.php?option=com_costbenefitprojection&view=interventions');
JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields');
if ($this->canCreate) {
JToolBarHelper::addNew('intervention.add');
}
// Only load if there are items
if (CostbenefitprojectionHelper::checkArray($this->items)) {
if ($this->canEdit) {
JToolBarHelper::editList('intervention.edit');
}
if ($this->canState) {
JToolBarHelper::publishList('interventions.publish');
JToolBarHelper::unpublishList('interventions.unpublish');
JToolBarHelper::archiveList('interventions.archive');
if ($this->canDo->get('core.admin')) {
JToolBarHelper::checkin('interventions.checkin');
}
}
// Add a batch button
if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) {
// Get the toolbar object instance
$bar = JToolBar::getInstance('toolbar');
// set the batch button name
$title = JText::_('JTOOLBAR_BATCH');
// Instantiate a new JLayoutFile instance and render the batch button
$layout = new JLayoutFile('joomla.toolbar.batch');
// add the button to the page
$dhtml = $layout->render(array('title' => $title));
$bar->appendButton('Custom', $dhtml, 'batch');
}
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) {
JToolbarHelper::deleteList('', 'interventions.delete', 'JTOOLBAR_EMPTY_TRASH');
} elseif ($this->canState && $this->canDelete) {
JToolbarHelper::trash('interventions.trash');
}
if ($this->canDo->get('core.export') && $this->canDo->get('intervention.export')) {
JToolBarHelper::custom('interventions.exportData', 'download', '', 'COM_COSTBENEFITPROJECTION_EXPORT_DATA', true);
}
}
if ($this->canDo->get('core.import') && $this->canDo->get('intervention.import')) {
JToolBarHelper::custom('interventions.importData', 'upload', '', 'COM_COSTBENEFITPROJECTION_IMPORT_DATA', false);
}
// set help url for this view if found
$help_url = CostbenefitprojectionHelper::getHelpUrl('interventions');
if (CostbenefitprojectionHelper::checkString($help_url)) {
JToolbarHelper::help('COM_COSTBENEFITPROJECTION_HELP_MANAGER', false, $help_url);
}
// add the options comp button
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) {
JToolBarHelper::preferences('com_costbenefitprojection');
}
if ($this->canState) {
JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true));
// only load if batch allowed
if ($this->canBatch) {
JHtmlBatch_::addListSelection(JText::_('COM_COSTBENEFITPROJECTION_KEEP_ORIGINAL_STATE'), 'batch[published]', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true));
}
}
JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_ACCESS'), 'filter_access', JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')));
if ($this->canBatch && $this->canCreate && $this->canEdit) {
JHtmlBatch_::addListSelection(JText::_('COM_COSTBENEFITPROJECTION_KEEP_ORIGINAL_ACCESS'), 'batch[access]', JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text'));
}
// Set Company Name Selection
$this->companyNameOptions = JFormHelper::loadFieldType('Company')->getOptions();
if ($this->companyNameOptions) {
// Company Name Filter
JHtmlSidebar::addFilter('- Select ' . JText::_('COM_COSTBENEFITPROJECTION_INTERVENTION_COMPANY_LABEL') . ' -', 'filter_company', JHtml::_('select.options', $this->companyNameOptions, 'value', 'text', $this->state->get('filter.company')));
if ($this->canBatch && $this->canCreate && $this->canEdit) {
// Company Name Batch Selection
JHtmlBatch_::addListSelection('- Keep Original ' . JText::_('COM_COSTBENEFITPROJECTION_INTERVENTION_COMPANY_LABEL') . ' -', 'batch[company]', JHtml::_('select.options', $this->companyNameOptions, 'value', 'text'));
}
}
// Set Type Selection
$this->typeOptions = $this->getTheTypeSelections();
if ($this->typeOptions) {
// Type Filter
JHtmlSidebar::addFilter('- Select ' . JText::_('COM_COSTBENEFITPROJECTION_INTERVENTION_TYPE_LABEL') . ' -', 'filter_type', JHtml::_('select.options', $this->typeOptions, 'value', 'text', $this->state->get('filter.type')));
if ($this->canBatch && $this->canCreate && $this->canEdit) {
// Type Batch Selection
JHtmlBatch_::addListSelection('- Keep Original ' . JText::_('COM_COSTBENEFITPROJECTION_INTERVENTION_TYPE_LABEL') . ' -', 'batch[type]', JHtml::_('select.options', $this->typeOptions, 'value', 'text'));
}
}
// Set Coverage Selection
$this->coverageOptions = $this->getTheCoverageSelections();
if ($this->coverageOptions) {
// Coverage Filter
JHtmlSidebar::addFilter('- Select ' . JText::_('COM_COSTBENEFITPROJECTION_INTERVENTION_COVERAGE_LABEL') . ' -', 'filter_coverage', JHtml::_('select.options', $this->coverageOptions, 'value', 'text', $this->state->get('filter.coverage')));
if ($this->canBatch && $this->canCreate && $this->canEdit) {
// Coverage Batch Selection
JHtmlBatch_::addListSelection('- Keep Original ' . JText::_('COM_COSTBENEFITPROJECTION_INTERVENTION_COVERAGE_LABEL') . ' -', 'batch[coverage]', JHtml::_('select.options', $this->coverageOptions, 'value', 'text'));
}
}
// Set Duration Selection
$this->durationOptions = $this->getTheDurationSelections();
//.........这里部分代码省略.........