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
 /**
  * Constructor
  *
  * @param object $subject The object to observe
  * @param array  $config  An array that holds the plugin configuration
  * @since 1.5
  */
 function __construct(&$subject, $config)
 {
     parent::__construct($subject, $config);
     $this->_psType = substr($this->_type, 2);
     $filename = 'plg_' . $this->_type . '_' . $this->_name;
     $this->loadJLangThis($filename);
     $this->_tablename = '#__tsmart_' . $this->_psType . '_plg_' . $this->_name;
     $this->_tableChecked = FALSE;
     $this->_xmlFile = vRequest::filterPath(VMPATH_ROOT . DS . 'plugins' . DS . $this->_type . DS . $this->_name . DS . $this->_name . '.xml');
 }
Beispiel #3
0
 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 = vRequest::filterPath(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();
 }
Beispiel #4
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 #5
0
 function display($tpl = null)
 {
     // Load the helper(s)
     jimport('joomla.filesystem.file');
     $config = JFactory::getConfig();
     $log_path = $config->get('log_path', VMPATH_ROOT . "/log");
     $layoutName = vRequest::getCmd('layout', 'default');
     tsmConfig::loadJLang('com_tsmart_log');
     if ($layoutName == 'edit') {
         $logFile = basename(vRequest::filterPath(vRequest::getString('logfile', '')));
         $this->SetViewTitle('LOG', $logFile);
         $fileContent = file_get_contents($log_path . DS . $logFile);
         $this->fileContentByLine = explode("\n", $fileContent);
         JToolBarHelper::cancel();
     } else {
         if (!class_exists('JFolder')) {
             require VMPATH_LIBS . DS . 'joomla' . DS . 'filesystem' . DS . 'folder.php';
         }
         $this->logFiles = JFolder::files($log_path, $filter = '.', true, false, array('index.html'));
         $this->SetViewTitle('LOG');
         $this->path = $log_path;
     }
     parent::display($tpl);
 }
Beispiel #6
0
 /**
  * Add a directory where JModel should search for models. You may
  * either pass a string or an array of directories.
  *
  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  * @license     GNU General Public License version 2 or later; see LICENSE
  *
  * @param   mixed   $path    A path or array[sting] of paths to search.
  * @param   string  $prefix  A prefix for models.
  *
  * @return  array  An array with directory elements. If prefix is equal to '', all directories are returned.
  *
  * @since   11.1
  */
 public static function addIncludePath($path = '', $prefix = '')
 {
     static $paths;
     if (!isset($paths)) {
         $paths = array();
     }
     if (!isset($paths[$prefix])) {
         $paths[$prefix] = array();
     }
     if (!isset($paths[''])) {
         $paths[''] = array();
     }
     if (!empty($path)) {
         //jimport('joomla.filesystem.path');
         if (!in_array($path, $paths[$prefix])) {
             array_unshift($paths[$prefix], vRequest::filterPath($path));
         }
         if (!in_array($path, $paths[''])) {
             array_unshift($paths[''], vRequest::filterPath($path));
         }
     }
     return $paths[$prefix];
 }
Beispiel #7
0
 /**
  * This function does not allow unicode
  * @param      $string
  * @param bool $forceNoUni
  * @return mixed|string
  */
 static function makeSafe($str, $forceNoUni = false)
 {
     return vRequest::filterPath($str);
 }
Beispiel #8
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 #9
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;
 }
Beispiel #10
0
 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);
 }