Example #1
0
 /**
  * Display method
  *
  * @param string $tpl
  * @return null
  */
 public function display($tpl = null)
 {
     // Fetch this item
     $this->fetchItem();
     // Initialize the form-file
     $file = JPATH_ADMINISTRATOR . '/components/com_magebridge/models/product.xml';
     // Prepare the params-form
     $params = YireoHelper::toRegistry($this->item->params)->toArray();
     $params_form = JForm::getInstance('params', $file);
     $params_form->bind(array('params' => $params));
     $this->params_form = $params_form;
     // Prepare the actions-form
     $actions = YireoHelper::toRegistry($this->item->actions)->toArray();
     $actions_form = JForm::getInstance('actions', $file);
     JPluginHelper::importPlugin('magebridgeproduct');
     JFactory::getApplication()->triggerEvent('onMageBridgeProductPrepareForm', array(&$actions_form, (array) $this->item));
     $actions_form->bind(array('actions' => $actions));
     $this->actions_form = $actions_form;
     // Build the fields
     $this->lists['product'] = MageBridgeFormHelper::getField('magebridge.product', 'sku', $this->item->sku, null);
     // Check for a previous connector-value
     if (!empty($this->item->connector)) {
         $plugin = JPluginHelper::getPlugin('magebridgeproduct', $this->item->connector);
         if (empty($plugin)) {
             $plugin_warning = JText::sprintf('COM_MAGEBRIDGE_PRODUCT_PLUGIN_WARNING', $this->item->connector);
             JError::raiseWarning(500, $plugin_warning);
         }
     }
     parent::display($tpl);
 }
Example #2
0
 public function getUsergroupLabel($joomla_group)
 {
     $usergroups = MageBridgeFormHelper::getUsergroupOptions();
     if (!empty($usergroups)) {
         foreach ($usergroups as $usergroup) {
             if ($usergroup->value == $joomla_group) {
                 return $usergroup->text;
             }
         }
     }
 }
Example #3
0
 /**
  * Method to get the HTML of this element
  *
  * @param null
  * @return string
  */
 protected function getInput()
 {
     $name = $this->name;
     $fieldName = $name;
     $value = $this->value;
     $usergroups = MageBridgeFormHelper::getUsergroupOptions();
     $html = null;
     $multiple = (string) $this->element['multiple'];
     if (!empty($multiple)) {
         $size = count($usergroups);
         $html = 'multiple="multiple" size="' . $size . '"';
     }
     $allownone = (bool) $this->element['allownone'];
     if ($allownone) {
         array_unshift($usergroups, array('value' => '', 'text' => ''));
     }
     return JHTML::_('select.genericlist', $usergroups, $fieldName, $html, 'value', 'text', $value);
 }
Example #4
0
 /**
  * Helper method to get the HTML-formelement for a storegroup
  *
  * @param string $default
  * @return string
  */
 protected function getFieldStoregroup($default = null)
 {
     return MageBridgeFormHelper::getField('magebridge.storegroup', 'name', $value, null);
 }
 public function getFieldUsergroup()
 {
     $usergroups = MageBridgeFormHelper::getUsergroupOptions();
     return JHTML::_('select.genericlist', $usergroups, 'usergroup', null, 'value', 'text', MagebridgeModelConfig::load('usergroup'));
 }
 public function getFieldJoomlaGroup($value = null)
 {
     $usergroups = MageBridgeFormHelper::getUsergroupOptions();
     return JHTML::_('select.genericlist', $usergroups, 'joomla_group', null, 'value', 'text', $value);
 }