function display($tpl = null) { // Load the helper(s) $this->addHelperPath(VMPATH_ADMIN . DS . 'helpers'); if (!class_exists('vmPSPlugin')) { require VMPATH_PLUGINLIBS . DS . 'vmpsplugin.php'; } if (!class_exists('VmHTML')) { require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php'; } $model = VmModel::getModel(); $layoutName = vRequest::getCmd('layout', 'default'); $this->SetViewTitle(); $layoutName = vRequest::getCmd('layout', 'default'); if ($layoutName == 'edit') { VmConfig::loadJLang('plg_vmpsplugin', false); JForm::addFieldPath(VMPATH_ADMIN . DS . 'fields'); $shipment = $model->getShipment(); // Get the payment XML. $formFile = vRequest::filterPath(VMPATH_ROOT . DS . 'plugins' . DS . 'vmshipment' . DS . $shipment->shipment_element . DS . $shipment->shipment_element . '.xml'); if (file_exists($formFile)) { $shipment->form = JForm::getInstance($shipment->shipment_element, $formFile, array(), false, '//vmconfig | //config[not(//vmconfig)]'); $shipment->params = new stdClass(); $varsToPush = vmPlugin::getVarsToPushFromForm($shipment->form); VmTable::bindParameterableToSubField($shipment, $varsToPush); $shipment->form->bind($shipment->getProperties()); } else { $shipment->form = null; } if (!class_exists('VmImage')) { require VMPATH_ADMIN . DS . 'helpers' . DS . 'image.php'; } if (!class_exists('VirtueMartModelVendor')) { require VMPATH_ADMIN . DS . 'models' . DS . 'vendor.php'; } $vendor_id = 1; $currency = VirtueMartModelVendor::getVendorCurrency($vendor_id); $this->assignRef('vendor_currency', $currency->currency_symbol); if ($this->showVendors()) { $vendorList = ShopFunctions::renderVendorList($shipment->virtuemart_vendor_id); $this->assignRef('vendorList', $vendorList); } $this->pluginList = self::renderInstalledShipmentPlugins($shipment->shipment_jplugin_id); $this->assignRef('shipment', $shipment); $this->shopperGroupList = ShopFunctions::renderShopperGroupList($shipment->virtuemart_shoppergroup_ids, true); $this->addStandardEditViewCommands($shipment->virtuemart_shipmentmethod_id); } else { JToolBarHelper::custom('cloneshipment', 'copy', 'copy', vmText::_('COM_VIRTUEMART_SHIPMENT_CLONE'), true); $this->addStandardDefaultViewCommands(); $this->addStandardDefaultViewLists($model); $this->shipments = $model->getShipments(); VmConfig::loadJLang('com_virtuemart_shoppers', TRUE); foreach ($this->shipments as &$data) { // Write the first 5 shoppergroups in the list $data->shipmentShoppersList = shopfunctions::renderGuiList($data->virtuemart_shoppergroup_ids, 'shoppergroups', 'shopper_group_name', 'shopper'); } $this->pagination = $model->getPagination(); } parent::display($tpl); }
function display($tpl = null) { $db = JFactory::getDBO(); if ($field = vRequest::getVar('field')) { if (strpos($field, 'plugin') !== false) { JForm::addFieldPath(VMPATH_ADMIN . DS . 'fields'); $table = '#__extensions'; $field = substr($field, 6); $q = 'SELECT `params`,`element`,`type` FROM `' . $table . '` WHERE `element` = "' . $field . '"'; $db->setQuery($q); $this->userField = $db->loadObject(); //$this->userField->element = substr($this->userField->type, 6); if (!class_exists('vmPlugin')) { require VMPATH_PLUGINLIBS . DS . 'vmplugin.php'; } vmPlugin::loadJLang('plg_vmuserfield_' . $this->userField->element, 'vmuserfield', $this->userField->element); $path = VMPATH_ROOT . DS . 'plugins' . DS . 'vmuserfield' . DS . $this->userField->element . DS . $this->userField->element . '.xml'; // Get the payment XML. $formFile = vRequest::filterPath($path); if (file_exists($formFile)) { if (!class_exists('VmConfig')) { require JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php'; } if (!class_exists('VmTable')) { require VMPATH_ADMIN . DS . 'helpers' . DS . 'vmtable.php'; } $this->userField->form = JForm::getInstance($this->userField->element, $formFile, array(), false, '//vmconfig | //config[not(//vmconfig)]'); $this->userField->params = new stdClass(); $varsToPush = vmPlugin::getVarsToPushFromForm($this->userField->form); /* $this->userField->params->userfield_params = $this->userField->params; VmTable::bindParameterable($this->userField->params,'userfield_params',$varsToPush);*/ if (empty($this->userField->userfield_params)) { $this->userField->userfield_params = ''; } VmTable::bindParameterableToSubField($this->userField, $varsToPush); $this->userField->form->bind($this->userField); } else { $this->userField->form = false; vmdebug('renderUserfieldPlugin could not find xml for ' . $this->userField->type . ' at ' . $path); } //vmdebug('renderUserfieldPlugin ',$this->userField->form); if ($this->userField->form) { $form = $this->userField->form; ob_start(); include VMPATH_ADMIN . DS . 'fields' . DS . 'formrenderer.php'; $body = ob_get_contents(); ob_end_clean(); echo $body; } } } jExit(); }
/** * This function gets the parameters of a plugin by an xml file. * This is used for the configuration GUI in the BE. * Attention: the xml Params must be always a subset of the varsToPushParams declared in the constructor * @param $xmlFile * @param $name * @return array */ public static function getVarsToPushByXML($xmlFile, $name) { $form = JForm::getInstance($name, $xmlFile, array(), false, '//vmconfig | //config[not(//vmconfig)]'); return vmPlugin::getVarsToPushFromForm($form); }
function display($tpl = null) { // Load the helper(s) if (!class_exists('VmHTML')) { require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php'; } if (!class_exists('vmCustomPlugin')) { require VMPATH_PLUGINLIBS . DS . 'vmcustomplugin.php'; } $model = VmModel::getModel('custom'); // TODO Make an Icon for custom $this->SetViewTitle('PRODUCT_CUSTOM_FIELD'); $layoutName = vRequest::getCmd('layout', 'default'); if ($layoutName == 'edit') { $this->addStandardEditViewCommands(); $this->customPlugin = ''; $this->custom = $model->getCustom(); $this->fieldTypes = VirtueMartModelCustom::getCustomTypes(); $this->customfields = VmModel::getModel('customfields'); //vmdebug('VirtuemartViewCustom',$this->custom); JPluginHelper::importPlugin('vmcustom'); $dispatcher = JDispatcher::getInstance(); $retValue = $dispatcher->trigger('plgVmOnDisplayEdit', array($this->custom->virtuemart_custom_id, &$this->customPlugin)); $this->SetViewTitle('PRODUCT_CUSTOM_FIELD', $this->custom->custom_title); $selected = 0; $this->custom->form = false; if (!empty($this->custom->custom_jplugin_id)) { VmConfig::loadJLang('plg_vmpsplugin', false); JForm::addFieldPath(VMPATH_ADMIN . DS . 'fields'); $selected = $this->custom->custom_jplugin_id; // Get the payment XML. $formFile = vRequest::filterPath(VMPATH_ROOT . DS . 'plugins' . DS . 'vmcustom' . DS . $this->custom->custom_element . DS . $this->custom->custom_element . '.xml'); if (file_exists($formFile)) { $this->custom->form = JForm::getInstance($this->custom->custom_element, $formFile, array(), false, '//vmconfig | //config[not(//vmconfig)]'); $this->custom->params = new stdClass(); $varsToPush = vmPlugin::getVarsToPushFromForm($this->custom->form); VmTable::bindParameterableToSubField($this->custom, $varsToPush); $this->custom->form->bind($this->custom->getProperties()); } } else { $varsToPush = VirtueMartModelCustom::getVarsToPush($this->custom->field_type); if (!empty($varsToPush)) { $formString = '<vmconfig>' . chr(10) . '<fields name="params">' . chr(10) . '<fieldset name="extraParams">' . chr(10); //vmdebug('$varsToPush',$varsToPush); foreach ($varsToPush as $key => $push) { if ('_' == substr($key, 0, 1)) { continue; } //$default = 0; $formString .= '<field name="' . $key . '" id="' . $key . 'Field" label="COM_VIRTUEMART_CUSTOM_PARAM_' . strtoupper($key) . '" description="COM_VIRTUEMART_CUSTOM_PARAM_' . strtoupper($key) . '_DESC" default="' . $push[0] . '" '; if ($push[1] == 'int') { $formString .= 'type="radio" > <option value="0">JNO</option> <option value="1">JYES</option>'; } else { if ($push[1] == 'string') { $formString .= 'type="text" >' . chr(10); } } $formString .= chr(10) . '</field>' . chr(10); } $formString .= '</fieldset>' . chr(10) . '</fields>' . chr(10) . '</vmconfig>'; $this->custom->form = JForm::getInstance($this->custom->field_type, $formString, array(), false, '//vmconfig | //config[not(//vmconfig)]'); $this->custom->params = new stdClass(); VmTable::bindParameterableToSubField($this->custom, $varsToPush); $this->custom->form->bind($this->custom->getProperties()); } } if (!empty($this->custom->custom_parent_id)) { $list = ShopFunctions::renderOrderingList('customs', 'custom_title', $this->custom->ordering, 'WHERE custom_parent_id ="' . (int) $this->custom->custom_parent_id . '" '); $this->ordering = VmHTML::row('raw', 'COM_VIRTUEMART_ORDERING', $list); } else { $this->ordering = ''; $this->addHidden('ordering', $this->custom->ordering); } $this->pluginList = self::renderInstalledCustomPlugins($selected); } else { JToolBarHelper::custom('createClone', 'copy', 'copy', vmText::_('COM_VIRTUEMART_CLONE'), true); JToolBarHelper::custom('toggle.admin_only.1', 'publish', '', vmText::_('COM_VIRTUEMART_TOGGLE_ADMIN'), true); JToolBarHelper::custom('toggle.admin_only.0', 'unpublish', '', vmText::_('COM_VIRTUEMART_TOGGLE_ADMIN'), true); JToolBarHelper::custom('toggle.is_hidden.1', 'publish', '', vmText::_('COM_VIRTUEMART_TOGGLE_HIDDEN'), true); JToolBarHelper::custom('toggle.is_hidden.0', 'unpublish', '', vmText::_('COM_VIRTUEMART_TOGGLE_HIDDEN'), true); $this->addStandardDefaultViewCommands(); $this->addStandardDefaultViewLists($model); $this->custom_parent_id = vRequest::getInt('custom_parent_id', false); $this->customs = $model->getCustoms($this->custom_parent_id, vRequest::getCmd('keyword')); $this->pagination = $model->getPagination(); } parent::display($tpl); }
function renderUserfieldPlugin() { if (!class_exists('vmUserfieldPlugin')) { require VMPATH_PLUGINLIBS . DS . 'vmuserfieldtypeplugin.php'; } VmConfig::loadJLang('plg_vmpsplugin', false); JForm::addFieldPath(VMPATH_ADMIN . DS . 'fields'); //$selected = $this->userField->userfield_jplugin_id; //vmdebug('renderUserfieldPlugin $this->userField->element',$this->userField->type,$this->userField->element); $this->userField->element = substr($this->userField->type, 6); $path = VMPATH_ROOT . DS . 'plugins' . DS . 'vmuserfield' . DS . $this->userField->element . DS . $this->userField->element . '.xml'; // Get the payment XML. $formFile = vRequest::filterPath($path); if (file_exists($formFile)) { $this->userField->form = JForm::getInstance($this->userField->element, $formFile, array(), false, '//vmconfig | //config[not(//vmconfig)]'); $this->userField->params = new stdClass(); $varsToPush = vmPlugin::getVarsToPushFromForm($this->userField->form); VmTable::bindParameterableToSubField($this->userField, $varsToPush); $this->userField->form->bind($this->userField->getProperties()); } else { $this->userField->form = false; vmdebug('renderUserfieldPlugin could not find xml for ' . $this->userField->type . ' at ' . $path); } //vmdebug('renderUserfieldPlugin ',$this->userField->form); if ($this->userField->form) { $form = $this->userField->form; ob_start(); include VMPATH_ADMIN . DS . 'fields' . DS . 'formrenderer.php'; $body = ob_get_contents(); ob_end_clean(); return $body; } return; }
function display($tpl = null) { // Load the helper(s) $this->addHelperPath(VMPATH_ADMIN . DS . 'helpers'); if (!class_exists('VmHTML')) { require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php'; } if (!class_exists('vmPSPlugin')) { require VMPATH_PLUGINLIBS . DS . 'vmpsplugin.php'; } $this->user = JFactory::getUser(); $model = tmsModel::getModel('paymentmethod'); // TODO logo $this->SetViewTitle(); $layoutName = vRequest::getCmd('layout', 'default'); $vendorModel = tmsModel::getModel('vendor'); $vendorModel->setId(1); $vendor = $vendorModel->getVendor(); $currencyModel = tmsModel::getModel('currency'); $currencyModel = $currencyModel->getItemList($vendor->vendor_currency); $this->assignRef('vendor_currency', $currencyModel->currency_symbol); if ($layoutName == 'edit') { // Load the helper(s) if (!class_exists('VmImage')) { require VMPATH_ADMIN . DS . 'helpers' . DS . 'image.php'; } tsmConfig::loadJLang('plg_vmpsplugin', false); JForm::addFieldPath(VMPATH_ADMIN . DS . 'fields'); $payment = $model->getPayment(); // Get the payment XML. $formFile = vRequest::filterPath(VMPATH_ROOT . DS . 'plugins' . DS . 'vmpayment' . DS . $payment->payment_element . DS . $payment->payment_element . '.xml'); if (file_exists($formFile)) { $payment->form = JForm::getInstance($payment->payment_element, $formFile, array(), false, '//vmconfig | //config[not(//vmconfig)]'); $payment->params = new stdClass(); $varsToPush = vmPlugin::getVarsToPushFromForm($payment->form); tsmTable::bindParameterableToSubField($payment, $varsToPush); $payment->form->bind($payment->getProperties()); } else { $payment->form = null; } $this->assignRef('payment', $payment); $this->vmPPaymentList = self::renderInstalledPaymentPlugins($payment->payment_jplugin_id); $this->shopperGroupList = ShopFunctions::renderShopperGroupList($payment->tsmart_shoppergroup_ids, true); if ($this->showVendors()) { $vendorList = ShopFunctions::renderVendorList($payment->tsmart_vendor_id); $this->assignRef('vendorList', $vendorList); } $this->addStandardEditViewCommandsPopup($payment->tsmart_paymentmethod_id); } else { JToolBarHelper::custom('clonepayment', 'copy', 'copy', tsmText::_('com_tsmart_PAYMENT_CLONE'), true); $this->addStandardDefaultViewCommandsPopup(); $this->addStandardDefaultViewLists($model); $this->payments = $model->getPayments(); tsmConfig::loadJLang('com_tsmart_shoppers', TRUE); foreach ($this->payments as &$data) { // Write the first 5 shoppergroups in the list $data->paymShoppersList = shopfunctions::renderGuiList($data->tsmart_shoppergroup_ids, 'shoppergroups', 'shopper_group_name', 'payment'); } $this->pagination = $model->getPagination(); } parent::display($tpl); }