function onRenderAdminForm(&$item, $type, $tab = '') { $mainframe = JFactory::getApplication(); $manifest = K2_JVERSION == '15' ? JPATH_SITE . DS . 'plugins' . DS . 'k2' . DS . $this->pluginName . '.xml' : JPATH_SITE . DS . 'plugins' . DS . 'k2' . DS . $this->pluginName . DS . $this->pluginName . '.xml'; if (!empty($tab)) { $path = $type . '-' . $tab; } else { $path = $type; } if (!isset($item->plugins)) { $item->plugins = NULL; } if (K2_JVERSION == '15') { $form = new K2Parameter($item->plugins, $manifest, $this->pluginName); $fields = $form->render('plugins', $path); } else { jimport('joomla.form.form'); $form = JForm::getInstance('plg_k2_' . $this->pluginName . '_' . $path, $manifest, array(), true, 'fields[@group="' . $path . '"]'); $values = array(); if ($item->plugins) { foreach (json_decode($item->plugins) as $name => $value) { $count = 1; $values[str_replace($this->pluginName, '', $name, $count)] = $value; } $form->bind($values); } $fields = ''; foreach ($form->getFieldset() as $field) { if (strpos($field->name, '[]') !== false) { $search = 'name="' . $field->name . '"'; $replace = 'name="plugins[' . $this->pluginName . str_replace('[]', '', $field->name) . '][]"'; } else { $search = 'name="' . $field->name . '"'; $replace = 'name="plugins[' . $this->pluginName . $field->name . ']"'; } $input = JString::str_ireplace($search, $replace, $field->__get('input')); $fields .= $field->__get('label') . ' ' . $input; } // Legacy code to maintain compatibillity with existing plugins that use params instead of JForm if (empty($fields) && K2_JVERSION == '25') { $form = new K2Parameter($item->plugins, $manifest, $this->pluginName); $fields = $form->render('plugins', $path); } } if ($fields) { $plugin = new stdClass(); $plugin->name = $this->pluginNameHumanReadable; $plugin->fields = $fields; return $plugin; } }
function onRenderAdminForm(&$item, $type, $tab = '') { $mainframe =& JFactory::getApplication(); $form = new K2Parameter($item->plugins, JPATH_SITE . DS . 'plugins' . DS . 'k2' . DS . $this->pluginName . '.xml', $this->pluginName); if (!empty($tab)) { $path = $type . '-' . $tab; } else { $path = $type; } $fields = $form->render('plugins', $path); if ($fields) { $plugin = new JObject(); $plugin->set('name', $this->pluginNameHumanReadable); $plugin->set('fields', $fields); return $plugin; } }
function onRenderAdminForm(&$item, $type, $tab = '') { $mainframe = JFactory::getApplication(); $manifest = K2_JVERSION == '15' ? JPATH_SITE . DS . 'plugins' . DS . 'k2' . DS . $this->pluginName . '.xml' : JPATH_SITE . DS . 'plugins' . DS . 'k2' . DS . $this->pluginName . DS . $this->pluginName . '.xml'; if (!empty($tab)) { $path = $type . '-' . $tab; } else { $path = $type; } if (!isset($item->plugins)) { $item->plugins = NULL; } $form = new K2Parameter($item->plugins, $manifest, $this->pluginName); $fields = $form->render('plugins', $path); if ($fields) { $plugin = new stdClass(); $plugin->name = $this->pluginNameHumanReadable; $plugin->fields = $fields; return $plugin; } }
function onRenderAdminForm(&$item, $type, $tab = '') { $plugins = new DSCParameter($item->plugins); $tiendaParams = new K2Parameter($item->plugins, JPATH_SITE . '/plugins/k2/' . $this->_name . '.xml', $this->_name); $productID = $tiendaParams->get('productID', 0); JPlugin::loadLanguage(); if ($this->_isInstalled() && $productID && $type == 'item' && $tab == 'content') { $db = JFactory::getDBO(); $query = "SELECT * FROM #__tienda_products WHERE product_id=" . (int) $productID; $db->setQuery($query, 0, 1); $product = $db->loadObject(); if (!is_null($product)) { $tiendaParams->set('tiendaproductID', $product->product_id); $tiendaParams->set('tiendaproductName', $product->product_name); $tiendaParams->set('tiendaproductSKU', $product->product_sku); $tiendaParams->set('tiendaproductManufacturer', $product->manufacturer_id); $tiendaParams->set('tiendaproductWeight', $product->product_weight); $tiendaParams->set('tiendaproductLength', $product->product_length); $tiendaParams->set('tiendaproductWidth', $product->product_width); $tiendaParams->set('tiendaproductHeight', $product->product_height); $tiendaParams->set('tiendaproductShipping', $product->product_ships); $tiendaParams->set('tiendaproductEnabled', $product->product_enabled); $tiendaParams->set('tiendaproductTax', $product->tax_class_id); } else { $tiendaParams->set('tiendaproductID', NULL); $tiendaParams->set('tiendaproductName', NULL); $tiendaParams->set('tiendaproductSKU', NULL); $tiendaParams->set('tiendaproductManufacturer', NULL); $tiendaParams->set('tiendaproductWeight', NULL); $tiendaParams->set('tiendaproductLength', NULL); $tiendaParams->set('tiendaproductWidth', NULL); $tiendaParams->set('tiendaproductHeight', NULL); $tiendaParams->set('tiendaproductShipping', NULL); $tiendaParams->set('tiendaproductEnabled', NULL); } $plugins->merge($tiendaParams); $item->plugins = $plugins->toString(); $document = JFactory::getDocument(); $document->addStyleDeclaration(' .tiendaButton { display:inline-block; padding:0 6px; background:url("../plugins/k2/tienda/images/button.jpg") center center repeat-x; border:1px solid #cccccc; -moz-border-radius:6px; margin:3px;} .tiendaButton a, .tiendaButton a:link, tiendaButton a:visited, tiendaButton a:hover, .tiendaButton a.modal, tiendaButton a.modal:visited, tiendaButton a.modal:hover, tiendaButton span { color:#333333; cursor:pointer; line-height:14px; text-decoration:none;} '); } $form = new K2Parameter($item->plugins, JPATH_SITE . '/plugins/k2/' . $this->_name . '.xml', $this->_name); if (!empty($tab)) { $path = $type . '-' . $tab; } else { $path = $type; } $fields = $form->render('plugins', $path); if ($fields) { $plugin = new JObject(); $plugin->set('name', $this->pluginNameHumanReadable); $plugin->set('fields', $fields); return $plugin; } }
function onRenderAdminForm(&$item, $type, $tab = '') { $app = JFactory::getApplication(); if ($type == 'item' && $tab == 'content') { if (!$app->isSite()) { //render the form if (!empty($tab)) { $path = $type . '-' . $tab; } else { $path = $type; } if (!isset($item->plugins)) { $item->plugins = NULL; } $xml_file = JPATH_SITE . '/plugins/k2/' . $this->pluginName . '/' . $this->pluginName . '.xml'; if (version_compare(JVERSION, '3.0', 'ge')) { jimport('joomla.form.form'); $form = JForm::getInstance('plg_k2_' . $this->pluginName . '_' . $path, $xml_file, array(), true, 'fields[@group="' . $path . '"]'); //print_r($form); $values = array(); if ($item->plugins) { foreach (json_decode($item->plugins) as $name => $value) { $count = 1; $values[str_replace($this->pluginName, '', $name, $count)] = $value; } $form->bind($values); } $fields = ''; foreach ($form->getFieldset() as $field) { $search = 'name="' . $field->name . '"'; $replace = 'name="plugins[' . $this->pluginName . $field->name . ']"'; $input = JString::str_ireplace($search, $replace, $field->__get('input')); $fields .= $field->__get('label') . ' ' . $input; } } else { $form = new K2Parameter($item->plugins, $xml_file, $this->pluginName); $fields = $form->render('plugins', $path); } if ($fields) { $plugin = new JObject(); $plugin->set('name', JText::_('K2Store')); $plugin->set('fields', $fields); return $plugin; } } } }