当前位置: 首页>>代码示例>>PHP>>正文


PHP JFormHelper类代码示例

本文整理汇总了PHP中JFormHelper的典型用法代码示例。如果您正苦于以下问题:PHP JFormHelper类的具体用法?PHP JFormHelper怎么用?PHP JFormHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了JFormHelper类的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;
     }
 }
开发者ID:networksoft,项目名称:networksoft.com.co,代码行数:45,代码来源:JoomlaFieldWrapper.php

示例2: renderInput

 function renderInput($values = null, $options = array())
 {
     if (!$this->_isCompatible) {
         return '';
     }
     $tags = array();
     if (!empty($values)) {
         foreach ($values as $v) {
             if (is_object($v)) {
                 $tags[] = $v->tag_id;
             } else {
                 $tags[] = (int) $v;
             }
         }
     }
     if (empty($options['name'])) {
         $options['name'] = 'tags';
     }
     if (empty($options['mode'])) {
         $options['mode'] = 'ajax';
     }
     if (!isset($options['class'])) {
         $options['class'] = 'inputbox span12 small';
     }
     if (!isset($options['multiple'])) {
         $options['multiple'] = true;
     }
     $xmlConf = new SimpleXMLElement('<field name="' . $options['name'] . '" type="tag" mode="' . $options['mode'] . '" label="" class="' . $options['class'] . '" multiple="' . ($options['multiple'] ? 'true' : 'false') . '"></field>');
     JFormHelper::loadFieldClass('tag');
     $jform = new JForm('hikashop');
     $fieldTag = new JFormFieldTag();
     $fieldTag->setForm($jform);
     $fieldTag->setup($xmlConf, $tags);
     return $fieldTag->input;
 }
开发者ID:q0821,项目名称:esportshop,代码行数:35,代码来源:tags.php

示例3: getField

 public function getField($type, $attributes = array(), $field_value = '')
 {
     static $types = null;
     $defaults = array('name' => '', 'id' => '');
     if (!$types) {
         jimport('joomla.form.helper');
         $types = array();
     }
     if (!in_array($type, $types)) {
         JFormHelper::loadFieldClass($type);
     }
     try {
         $attributes = array_merge($defaults, $attributes);
         $xml = new JXMLElement('<?xml version="1.0" encoding="utf-8"?><field />');
         foreach ($attributes as $key => $value) {
             if ('_options' == $key) {
                 foreach ($value as $_opt_value) {
                     $xml->addChild('option', $_opt_value->text)->addAttribute('value', $_opt_value->value);
                 }
                 continue;
             }
             $xml->addAttribute($key, $value);
         }
         $class = 'JFormField' . $type;
         $field = new $class();
         $field->setup($xml, $field_value);
         return $field;
     } catch (Exception $e) {
         return false;
     }
 }
开发者ID:rcorral,项目名称:com_jm,代码行数:31,代码来源:helper.php

示例4: 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;
 }
开发者ID:Ricardolau,项目名称:imc,代码行数:29,代码来源:helper.php

示例5: display

 function display($tpl = null)
 {
     JFormHelper::addFormPath(JPATH_ADMINISTRATOR . '/components/com_j2store/models/forms');
     JFormHelper::addFieldPath(JPATH_ADMINISTRATOR . '/components/com_j2store/models/fields');
     $this->form = JForm::getInstance('storeprofile', 'storeprofile');
     $this->addToolBar();
     parent::display();
 }
开发者ID:ForAEdesWeb,项目名称:AEW4,代码行数:8,代码来源:view.html.php

示例6: 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();
 }
开发者ID:madcsaba,项目名称:li-de,代码行数:15,代码来源:jdcustomfield11.php

示例7: display

 /**
  * display method of Cp view
  * @return void
  **/
 function display($tpl = null)
 {
     // Initialiase variables.
     $this->form = $this->get('Form');
     $this->item = $this->get('Item');
     $this->state = $this->get('State');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     JRequest::setVar('hidemainmenu', true);
     $user = JFactory::getUser();
     $isNew = empty($this->item->product_id);
     $document = JFactory::getDocument();
     if (JRequest::getVar('tmpl', '') != 'component') {
         $document->addScript(JURI::base(true) . '/components/com_cp/assets/js/jquery-1.10.1.min.js');
         $document->addScriptDeclaration('jQuery.noConflict();');
         $document->addScript(JURI::base(true) . '/components/com_cp/assets/js/jquery-ui-1.10.3.custom.min.js');
         $document->addScript(JURI::base(true) . '/components/com_cp/assets/js/scripts.js');
         $document->addStyleSheet(JURI::base(true) . '/components/com_cp/assets/css/style.css');
         $document->addStyleSheet(JURI::base(true) . '/components/com_cp/assets/css/smoothness/jquery-ui-1.8.21.custom.css');
         $document->addStyleDeclaration('body { min-width: 1170px; }');
     }
     // Create the form
     JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields');
     $text = $isNew ? JText::_('COM_CP_NEW') : JText::_('COM_CP_EDIT');
     JToolBarHelper::title($text . ' ' . JText::_('COM_CP_PRODUCT_PAGE_TITLE'));
     if ($isNew && $user->authorise('core.create', 'com_cp')) {
         JToolBarHelper::apply('cpproducts.apply');
         JToolBarHelper::save('cpproducts.save');
         JToolBarHelper::save2new('cpproducts.save2new');
         JToolBarHelper::cancel('cpproducts.cancel');
     } else {
         if ($user->authorise('core.edit', 'com_cp')) {
             JToolBarHelper::apply('cpproducts.apply');
             JToolBarHelper::save('cpproducts.save');
             if ($user->authorise('core.edit', 'com_cp')) {
                 JToolBarHelper::save2new('cpproducts.save2new');
             }
             JToolBarHelper::cancel('cpproducts.cancel', 'COM_CP_CLOSE');
         }
     }
     $helper = new CPHelper();
     if ($isNew) {
         $countFiles = 0;
     } else {
         $countFiles = count($this->item->media);
     }
     // Initialize media files script
     $document->addScriptDeclaration('var mediaCount = ' . $countFiles . '; var delText = "' . JText::_('COM_CP_DELETE') . '"; var siteURL = "' . JURI::root() . '";');
     $params = JComponentHelper::getParams('com_cp');
     $this->assignRef('params', $params);
     $this->item->cities = $helper->listCities($this->item->country_code, $this->item->city, 'jform[city]', 'jform_city');
     parent::display($tpl);
 }
开发者ID:jmangarret,项目名称:webtuagencia24,代码行数:60,代码来源:view.html.php

示例8: __construct

 public function __construct(&$subject, $config)
 {
     if (!class_exists('joomlamailerMCAPI')) {
         return;
     }
     parent::__construct($subject, $config);
     JFormHelper::addFieldPath(__DIR__ . '/fields');
     $this->api = $this->getApiInstance();
     $this->debug = JFactory::getConfig()->get('debug');
     $this->listId = $this->params->get('listid');
 }
开发者ID:rodhoff,项目名称:MNW,代码行数:11,代码来源:joomlamailer.php

示例9: populateState

 protected function populateState($ordering = null, $direction = null)
 {
     $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
     $this->setState('filter.search', $search);
     $published = $this->getUserStateFromRequest($this->context . '.filter.state', 'filter_state', '', 'string');
     $this->setState('filter.state', $published);
     JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields');
     $catID = $this->getUserStateFromRequest($this->context . '.filter.category', 'filter_category');
     $this->setState('filter.category', $catID);
     $visibility = $this->getUserStateFromRequest($this->context . '.filter.visibility', 'filter_visibility');
     $this->setState('filter.category', $visibility);
     parent::populateState('a.ordering', 'asc');
 }
开发者ID:gmansillo,项目名称:simplefilemanager,代码行数:13,代码来源:simplefilemanagers.php

示例10: displayAll

 function displayAll($id, $map, $color)
 {
     if (HIKASHOP_J25) {
         $xmlConf = new SimpleXMLElement('<field name="' . $map . '" type="color" label=""></field>');
         JFormHelper::loadFieldClass('color');
         $jform = new JForm('hikashop');
         $fieldTag = new JFormFieldColor();
         $fieldTag->setForm($jform);
         $fieldTag->setup($xmlConf, $color);
         return $fieldTag->input;
     }
     $code = '<input type="text" name="' . $map . '" id="color' . $id . '" onchange=\'applyColorExample' . $id . '()\' class="inputbox" size="10" value="' . $color . '" />' . ' <input size="10" maxlength="0" style=\'cursor:pointer;background-color:' . $color . '\' onclick="if(document.getElementById(\'colordiv' . $id . '\').style.display == \'block\'){document.getElementById(\'colordiv' . $id . '\').style.display = \'none\';}else{document.getElementById(\'colordiv' . $id . '\').style.display = \'block\';}" id=\'colorexample' . $id . '\' />' . '<div id=\'colordiv' . $id . '\' style=\'display:none;position:absolute;background-color:white;border:1px solid grey;z-index:999\'>' . $this->display($id) . '</div>';
     return $code;
 }
开发者ID:rodhoff,项目名称:MNW,代码行数:14,代码来源:color.php

示例11: 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();
 }
开发者ID:madcsaba,项目名称:li-de,代码行数:21,代码来源:jdcustomfield10.php

示例12: 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();
 }
开发者ID:apiceweb,项目名称:MageBridgeCore,代码行数:23,代码来源:form.php

示例13: onAfterInitialise

 /**
  * Method to register custom library.
  *
  * @return  void
  */
 public function onAfterInitialise()
 {
     if (!$this->isRedcoreComponent()) {
         return;
     }
     $redcoreLoader = JPATH_LIBRARIES . '/redcore/bootstrap.php';
     if (file_exists($redcoreLoader)) {
         require_once $redcoreLoader;
         // For Joomla! 2.5 compatibility we add some core functions
         if (version_compare(JVERSION, '3.0', '<')) {
             RLoader::registerPrefix('J', JPATH_LIBRARIES . '/redcore/joomla', false, true);
         }
     }
     // Make available the fields
     JFormHelper::addFieldPath(JPATH_LIBRARIES . '/redcore/form/fields');
     // Make available the rules
     JFormHelper::addRulePath(JPATH_LIBRARIES . '/redcore/form/rules');
 }
开发者ID:prox91,项目名称:joomla-dev,代码行数:23,代码来源:redcore.php

示例14: 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;
 }
开发者ID:anawu2006,项目名称:PeerLearning,代码行数:19,代码来源:jaitems.php

示例15: onAfterInitialise

 /**
  * Method to register custom library.
  *
  * @return  void
  */
 public function onAfterInitialise()
 {
     $isAdmin = JFactory::getApplication()->isAdmin();
     if (!$isAdmin || !$this->isRedradComponent()) {
         return;
     }
     $redradLoader = JPATH_LIBRARIES . '/redrad/bootstrap.php';
     if (file_exists($redradLoader) && !class_exists('Inflector')) {
         require_once $redradLoader;
         // For Joomla! 2.5 compatibility we add some core functions
         if (version_compare(JVERSION, '3.0', '<')) {
             RLoader::registerPrefix('J', JPATH_LIBRARIES . '/redrad/joomla', false, true);
         }
     }
     // Make available the fields
     JFormHelper::addFieldPath(JPATH_LIBRARIES . '/redrad/form/fields');
     // Make available the rules
     JFormHelper::addRulePath(JPATH_LIBRARIES . '/redrad/form/rules');
 }
开发者ID:prox91,项目名称:joomla-dev,代码行数:24,代码来源:redrad.php


注:本文中的JFormHelper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。