Beispiel #1
0
 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);
 }
Beispiel #2
0
 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();
 }
Beispiel #3
0
    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);
    }
Beispiel #4
0
 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;
 }