function display($tpl = null) { // Load the helper(s) if (!class_exists('VmHTML')) { require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'html.php'; } if (!class_exists('vmCustomPlugin')) { require JPATH_VM_PLUGINS . 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(); $customPlugin = ''; $this->custom = $model->getCustom(); $customfields = VmModel::getModel('customfields'); //vmdebug('VirtuemartViewCustom',$this->custom); JPluginHelper::importPlugin('vmcustom'); $dispatcher = JDispatcher::getInstance(); $retValue = $dispatcher->trigger('plgVmOnDisplayEdit', array($this->custom->virtuemart_custom_id, &$customPlugin)); $this->SetViewTitle('PRODUCT_CUSTOM_FIELD', $this->custom->custom_title); $selected = 0; if (!empty($this->custom->custom_jplugin_id)) { VmConfig::loadJLang('plg_vmpsplugin', false); JForm::addFieldPath(JPATH_VM_ADMINISTRATOR . DS . 'fields'); $selected = $this->custom->custom_jplugin_id; // Get the payment XML. $formFile = JPath::clean(JPATH_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::getVarsToPushByXML($formFile, 'customForm'); $this->custom->params->custom_params = $this->custom->custom_params; VmTable::bindParameterable($this->custom->params, 'custom_params', $varsToPush); $this->custom->form->bind($this->custom); } else { $this->custom->form = null; } } $this->pluginList = self::renderInstalledCustomPlugins($selected); $this->assignRef('customPlugin', $customPlugin); $this->assignRef('customfields', $customfields); } 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); $customs = $model->getCustoms(vRequest::getInt('custom_parent_id'), vRequest::getCmd('keyword')); $this->assignRef('customs', $customs); $pagination = $model->getPagination(); $this->assignRef('pagination', $pagination); } parent::display($tpl); }
function display($tpl = null) { $db = JFactory::getDBO(); if ( $virtuemart_media_id = vRequest::getInt('virtuemart_media_id') ) { //$db = JFactory::getDBO(); $query='SELECT `file_url`,`file_title` FROM `#__virtuemart_medias` where `virtuemart_media_id`='.$virtuemart_media_id; $db->setQuery( $query ); $json = $db->loadObject(); if (isset($json->file_url)) { $json->file_url = JURI::root().$json->file_url; $json->msg = 'OK'; echo json_encode($json); } else { $json->msg = '<b>'.vmText::_('COM_VIRTUEMART_NO_IMAGE_SET').'</b>'; echo json_encode($json); } } elseif ( $custom_jplugin_id = vRequest::getInt('custom_jplugin_id') ) { $table = '#__extensions'; $ext_id = 'extension_id'; $q = 'SELECT `params`,`element` FROM `' . $table . '` WHERE `' . $ext_id . '` = "'.$custom_jplugin_id.'"'; $db ->setQuery($q); $this->jCustom = $db ->loadObject(); $customModel = VmModel::getModel('custom'); $this->custom = $customModel -> getCustom(); // Get the payment XML. $formFile = JPath::clean( VMPATH_ROOT .DS. 'plugins' .DS. 'vmcustom' .DS . $this->jCustom->element . DS . $this->jCustom->element . '.xml'); if (file_exists($formFile)){ VmConfig::loadJLang('plg_vmpsplugin', false); if (!class_exists('vmPlugin')) require(VMPATH_PLUGINLIBS . DS . 'vmplugin.php'); $filename = 'plg_vmcustom_' . $this->jCustom->element; vmPlugin::loadJLang($filename,'vmcustom',$this->jCustom->element); $this->custom = VmModel::getModel('custom')->getCustom(); $varsToPush = vmPlugin::getVarsToPushByXML($formFile,'customForm'); $this->custom->form = JForm::getInstance($this->jCustom->element, $formFile, array(),false, '//vmconfig | //config[not(//vmconfig)]'); $this->custom->params = new stdClass(); foreach($varsToPush as $k => $field){ if(strpos($k,'_')!=0){ $this->custom->params->$k = $field[0]; } } $this->custom->form->bind($this->custom->getProperties()); $form = $this->custom->form; include(VMPATH_ADMIN.DS.'fields'.DS.'formrenderer.php'); echo '<input type="hidden" value="'.$this->jCustom->element.'" name="custom_value">'; } else { $this->custom->form = null; VmConfig::$echoDebug = 1; vmdebug ('File does not exist '.$formFile); } } jExit(); }
function display($tpl = null) { $db = JFactory::getDBO(); if ($field = vRequest::getVar('field')) { if (strpos($field, 'plugin') !== false) { JForm::addFieldPath(JPATH_VM_ADMINISTRATOR . 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 JPATH_VM_PLUGINS . DS . 'vmplugin.php'; } vmPlugin::loadJLang('plg_vmuserfield_' . $this->userField->element, 'vmuserfield', $this->userField->element); $path = JPATH_ROOT . DS . 'plugins' . DS . 'vmuserfield' . DS . $this->userField->element . DS . $this->userField->element . '.xml'; // Get the payment XML. $formFile = JPath::clean($path); if (file_exists($formFile)) { if (!class_exists('VmConfig')) { require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php'; } if (!class_exists('VmTable')) { require JPATH_VM_ADMINISTRATOR . 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::getVarsToPushByXML($formFile, 'customForm'); /* $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 = ''; } $this->userField->params->userfield_params = $this->userField->userfield_params; VmTable::bindParameterable($this->userField->params, 'userfield_params', $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 JPATH_VM_ADMINISTRATOR . DS . 'fields' . DS . 'formrenderer.php'; $body = ob_get_contents(); ob_end_clean(); echo $body; } } } jExit(); }
function display($tpl = null) { // Load the helper(s) $this->addHelperPath(JPATH_VM_ADMINISTRATOR . DS . 'helpers'); if (!class_exists('VmHTML')) { require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'html.php'; } if (!class_exists('vmPSPlugin')) { require JPATH_VM_PLUGINS . DS . 'vmpsplugin.php'; } $this->user = JFactory::getUser(); $model = VmModel::getModel('paymentmethod'); // TODO logo $this->SetViewTitle(); $layoutName = vRequest::getCmd('layout', 'default'); $vendorModel = VmModel::getModel('vendor'); $vendorModel->setId(1); $vendor = $vendorModel->getVendor(); $currencyModel = VmModel::getModel('currency'); $currencyModel = $currencyModel->getCurrency($vendor->vendor_currency); $this->assignRef('vendor_currency', $currencyModel->currency_symbol); if ($layoutName == 'edit') { // Load the helper(s) if (!class_exists('VmImage')) { require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'image.php'; } VmConfig::loadJLang('plg_vmpsplugin', false); JForm::addFieldPath(JPATH_VM_ADMINISTRATOR . DS . 'fields'); $payment = $model->getPayment(); // Get the payment XML. $formFile = JPath::clean(JPATH_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::getVarsToPushByXML($formFile, 'paymentForm'); $payment->params->payment_params = $payment->payment_params; VmTable::bindParameterable($payment->params, 'payment_params', $varsToPush); $payment->form->bind($payment); } else { $payment->form = null; } $this->assignRef('payment', $payment); $this->assignRef('vmPPaymentList', self::renderInstalledPaymentPlugins($payment->payment_jplugin_id)); $this->assignRef('shopperGroupList', ShopFunctions::renderShopperGroupList($payment->virtuemart_shoppergroup_ids, true)); if (Vmconfig::get('multix', 'none') !== 'none') { $vendorList = ShopFunctions::renderVendorList($payment->virtuemart_vendor_id); $this->assignRef('vendorList', $vendorList); } $this->addStandardEditViewCommands($payment->virtuemart_paymentmethod_id); } else { JToolBarHelper::custom('clonepayment', 'copy', 'copy', vmText::_('COM_VIRTUEMART_PAYMENT_CLONE'), true); $this->addStandardDefaultViewCommands(); $this->addStandardDefaultViewLists($model); $this->payments = $model->getPayments(); foreach ($this->payments as &$data) { // Write the first 5 shoppergroups in the list $data->paymShoppersList = shopfunctions::renderGuiList($data->virtuemart_shoppergroup_ids, 'shoppergroups', 'shopper_group_name', 'payment'); } $pagination = $model->getPagination(); $this->assignRef('pagination', $pagination); } parent::display($tpl); }
function renderUserfieldPlugin() { if (!class_exists('vmUserfieldPlugin')) { require JPATH_VM_PLUGINS . DS . 'vmuserfieldtypeplugin.php'; } VmConfig::loadJLang('plg_vmpsplugin', false); JForm::addFieldPath(JPATH_VM_ADMINISTRATOR . 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 = JPATH_ROOT . DS . 'plugins' . DS . 'vmuserfield' . DS . $this->userField->element . DS . $this->userField->element . '.xml'; // Get the payment XML. $formFile = JPath::clean($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::getVarsToPushByXML($formFile, 'customForm'); $this->userField->params->userfield_params = $this->userField->userfield_params; VmTable::bindParameterable($this->userField->params, 'userfield_params', $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 JPATH_VM_ADMINISTRATOR . DS . 'fields' . DS . 'formrenderer.php'; $body = ob_get_contents(); ob_end_clean(); return $body; } return; }