Esempio n. 1
0
 public function __construct()
 {
     parent::__construct();
     $this->useSSL = VmConfig::get('useSSL', 0);
     $this->useXHTML = true;
     VmConfig::loadJLang('com_virtuemart_shoppers', TRUE);
 }
Esempio n. 2
0
 /**
  * This shows the plugin for choosing in the payment list of the checkout process.
  *
  * @author Valerie Cartan Isaksen
  */
 public function plgVmDisplayListFEPayment(VirtueMartCart $cart, $selected = 0, &$htmlIn)
 {
     if ($this->getPluginMethods($cart->vendorId) === 0) {
         if (empty($this->_name)) {
             $app = JFactory::getApplication();
             $app->enqueueMessage(vmText::_('COM_VIRTUEMART_CART_NO_' . strtoupper($this->_psType)));
             return false;
         } else {
             return false;
         }
     }
     $html = array();
     $method_name = $this->_psType . '_name';
     VmConfig::loadJLang('com_virtuemart', true);
     vmJsApi::jCreditCard();
     $htmla = '';
     $html = array();
     foreach ($this->methods as $_currentMethod) {
         $this->_currentMethod = $_currentMethod;
         if ($this->checkConditions($cart, $this->_currentMethod, $cart->cartPrices)) {
             $cartPrices = $cart->cartPrices;
             $methodSalesPrice = $this->setCartPrices($cart, $cartPrices, $this->_currentMethod);
             $this->_currentMethod->{$method_name} = $this->renderPluginName($this->_currentMethod);
             $sandbox = $this->_currentMethod->sandbox;
             $html = $this->getPluginHtml($this->_currentMethod, $selected, $methodSalesPrice);
             if ($selected == $this->_currentMethod->virtuemart_paymentmethod_id && $this->hasBillingAddress($cart)) {
                 $html .= $this->displayForm($cart, $sandbox);
             }
             $htmla[] = $html;
         }
     }
     $htmlIn[] = $htmla;
     return true;
 }
 protected function vm_require()
 {
     if (!class_exists('VmConfig')) {
         if (file_exists(JPATH_ADMINISTRATOR . '/components/com_virtuemart/helpers/config.php')) {
             require JPATH_ADMINISTRATOR . '/components/com_virtuemart/helpers/config.php';
         } else {
             $this->error = 'Could not find VmConfig helper';
             return false;
         }
     }
     VmConfig::loadConfig();
     VmConfig::loadJLang('com_virtuemart', true);
     if (!class_exists('VmModel')) {
         if (defined('JPATH_VM_ADMINISTRATOR') && file_exists(JPATH_VM_ADMINISTRATOR . '/helpers/vmmodel.php')) {
             require JPATH_VM_ADMINISTRATOR . '/helpers/vmmodel.php';
         } else {
             $this->error = 'Could not find VmModel helper';
             return false;
         }
     }
     if (defined('JPATH_VM_ADMINISTRATOR')) {
         JTable::addIncludePath(JPATH_VM_ADMINISTRATOR . '/tables');
     }
     if (!class_exists('VirtueMartModelCustom')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'custom.php';
     }
     if (!class_exists('VirtueMartModelCustomfields')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'customfields.php';
     }
     return true;
 }
Esempio n. 4
0
 function display($tpl = null)
 {
     // Load the helper(s)
     if (!class_exists('VmHTML')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
     }
     $model = VmModel::getModel();
     $layoutName = $this->getLayout();
     $task = vRequest::getCmd('task', $layoutName);
     $this->assignRef('task', $task);
     if ($layoutName == 'edit') {
         //For shoppergroup specific price display
         VmConfig::loadJLang('com_virtuemart_config');
         VmConfig::loadJLang('com_virtuemart_shoppers', true);
         $shoppergroup = $model->getShopperGroup();
         $this->SetViewTitle('SHOPPERGROUP', $shoppergroup->shopper_group_name);
         $vendors = ShopFunctions::renderVendorList($shoppergroup->virtuemart_vendor_id);
         $this->assignRef('vendorList', $vendors);
         $this->assignRef('shoppergroup', $shoppergroup);
         $this->addStandardEditViewCommands();
     } else {
         $this->SetViewTitle();
         $showVendors = $this->showVendors();
         $this->assignRef('showVendors', $showVendors);
         $this->addStandardDefaultViewCommands();
         $this->addStandardDefaultViewLists($model);
         $shoppergroups = $model->getShopperGroups(false, true);
         $this->assignRef('shoppergroups', $shoppergroups);
         $pagination = $model->getPagination();
         $this->assignRef('sgrppagination', $pagination);
     }
     parent::display($tpl);
 }
 function fetchElement($name, $value, &$node, $control_name)
 {
     VmConfig::loadJLang('com_virtuemart', false);
     if (!class_exists('VirtueMartModelVendor')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'vendor.php';
     }
     $vendorId = 1;
     //VirtueMartModelVendor::getLoggedVendor();
     $db = JFactory::getDBO();
     $q = 'SELECT `vendor_accepted_currencies`, `vendor_currency` FROM `#__virtuemart_vendors` WHERE `virtuemart_vendor_id`=' . $vendorId;
     $db->setQuery($q);
     $vendor_currency = $db->loadAssoc();
     if (!$vendor_currency['vendor_accepted_currencies']) {
         $vendor_currency['vendor_accepted_currencies'] = $vendor_currency['vendor_currency'];
     }
     $q = 'SELECT `virtuemart_currency_id` AS value ,CONCAT_WS(" ",`currency_name`,`currency_symbol`) as text FROM `#__virtuemart_currencies` WHERE `virtuemart_currency_id` IN (' . $vendor_currency['vendor_accepted_currencies'] . ') and (`virtuemart_vendor_id` = "' . $vendorId . '" OR `shared`="1") AND published = "1" ORDER BY `ordering`,`currency_name`';
     $db->setQuery($q);
     $currencies = $db->loadObjectList();
     $options = array();
     $options[] = array('value' => 0, 'text' => JText::_('COM_VIRTUEMART_DEFAULT_VENDOR_CURRENCY'));
     if (!is_array($currencies)) {
         $currencies = (array) $currencies;
     }
     foreach ($currencies as $currency) {
         $options[] = array('value' => $currency->value, 'text' => $currency->text);
     }
     $class = $node->attributes('class') ? 'class="' . $node->attributes('class') . '"' : '';
     return JHTML::_('select.genericlist', $options, $control_name . '[' . $name . ']', $class, 'value', 'text', $value, $control_name . $name);
 }
Esempio n. 6
0
 function fetchElement($name, $value, &$node, $control_name)
 {
     VmConfig::loadJLang('com_virtuemart');
     $model = VmModel::getModel('Vendor');
     $vendors = $model->getVendors(true, true, false);
     return JHTML::_('select.genericlist', $vendors, $control_name . '[' . $name . ']', '', $name, 'vendor_name', $value, $control_name . $name);
 }
Esempio n. 7
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);
 }
Esempio n. 8
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');
		VmConfig::loadJLang('com_virtuemart_log');

		if ($layoutName == 'edit') {
			$logFile = vRequest::getString('logfile', '');
			$this->SetViewTitle('LOG', $logFile);
			$fileContent = file_get_contents($log_path . DS . $logFile);
			$fileContentByLine = explode("\n", $fileContent);

			$this->assignRef('fileContentByLine', $fileContentByLine);
			JToolBarHelper::cancel();

		} else {
			if(!class_exists('JFolder')) require(VMPATH_LIBS.DS.'joomla'.DS.'filesystem'.DS.'folder.php');

			$logFiles = JFolder::files($log_path, $filter = '.', true, false, array('index.html'));

			$this->SetViewTitle('LOG');
			$this->assignRef('logFiles', $logFiles);
			$this->assignRef('path', $log_path);
		}

		parent::display($tpl);
	}
Esempio n. 9
0
 function display($tpl = null)
 {
     // Load the helper(s)
     if (!class_exists('VmConfig')) {
         require JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'config.php';
     }
     VmConfig::loadConfig();
     VmConfig::loadJLang('com_virtuemart_countries');
     if (!class_exists('VmHTML')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'html.php';
     }
     $model = VmModel::getModel('country');
     $zoneModel = VmModel::getModel('worldzones');
     $this->SetViewTitle();
     $layoutName = JRequest::getWord('layout', 'default');
     if ($layoutName == 'edit') {
         $country = $model->getData();
         $this->assignRef('country', $country);
         $wzsList = $zoneModel->getWorldZonesSelectList();
         $this->assignRef('worldZones', $wzsList);
         $this->addStandardEditViewCommands();
     } else {
         $this->addStandardDefaultViewCommands(true, false);
         //First the view lists, it sets the state of the model
         $this->addStandardDefaultViewLists($model, 0, 'ASC');
         $filter_country = JRequest::getWord('filter_country', false);
         $countries = $model->getCountries(false, false, $filter_country);
         $this->assignRef('countries', $countries);
         $pagination = $model->getPagination();
         $this->assignRef('pagination', $pagination);
     }
     parent::display($tpl);
 }
Esempio n. 10
0
 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);
 }
Esempio n. 11
0
 function getInput()
 {
     VmConfig::loadConfig();
     VmConfig::loadJLang('com_virtuemart');
     $model = VmModel::getModel('Manufacturer');
     $manufacturers = $model->getManufacturers(true, true, false);
     return JHtml::_('select.genericlist', $manufacturers, $this->name, 'class="inputbox"   ', 'value', 'text', $this->value, $this->id);
 }
Esempio n. 12
0
 /**
  * Method to get the field input markup. Use as name the view of the desired layout list + "layout".
  * For example <field name="categorylayout" for all layouts of hte category view.
  *
  * @author   Max Milbers
  * @return	string	The field input markup.
  * @since	2.0.24a
  */
 function getInput()
 {
     VmConfig::loadJLang('com_virtuemart');
     $view = substr($this->fieldname, 0, -6);
     $vmLayoutList = VirtueMartModelConfig::getLayoutList($view);
     $html = JHtml::_('Select.genericlist', $vmLayoutList, $this->name, 'size=1 width=200', 'value', 'text', array($this->value));
     return $html;
 }
Esempio n. 13
0
 protected function getCategories()
 {
     if (is_null($this->categories)) {
         $this->categories = array();
         // set user language
         // $lang = JFactory::getLanguage();
         // JRequest::setVar( 'vmlang', $lang->getTag() );
         VmConfig::loadJLang('com_virtuemart', true);
         VmConfig::loadConfig();
         $categoryModel = VmModel::getModel('category');
         $categoryModel->_noLimit = true;
         $categories = $categoryModel->getCategories(0);
         if (!count($categories)) {
             return $this->categories;
         }
         // render tree
         //usort($categories, create_function('$a, $b', 'return $a->ordering > $b->ordering;'));
         $_categories = array();
         $_children = array();
         foreach ($categories as $i => $category) {
             $_categories[$category->virtuemart_category_id] =& $categories[$i];
         }
         foreach ($categories as $i => $category) {
             $cid = $category->virtuemart_category_id;
             $pid = $category->category_parent_id;
             if (isset($_categories[$pid])) {
                 if (!isset($_children[$pid])) {
                     $_children[$pid] = array();
                 }
                 $_children[$pid][$cid] = $cid;
             }
         }
         if (!count($_categories)) {
             return $this->categories;
         }
         $__categories = array();
         $__levels = array();
         foreach ($_categories as $cid => $category) {
             $pid = $category->category_parent_id;
             if (!isset($_categories[$pid])) {
                 $queue = array($cid);
                 $_categories[$cid]->level = 1;
                 while (count($queue) > 0) {
                     $qid = array_shift($queue);
                     $__categories[$qid] =& $_categories[$qid];
                     if (isset($_children[$qid])) {
                         foreach ($_children[$qid] as $child) {
                             $_categories[$child]->level = $_categories[$qid]->level + 1;
                             array_push($queue, $child);
                         }
                     }
                 }
             }
         }
         $this->categories = $__categories;
     }
     return $this->categories;
 }
Esempio n. 14
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	= 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();
	}
Esempio n. 15
0
 /**
  * Method to get the field input markup. Use as name the view of the desired layout list + "layout".
  * For example <field name="categorylayout" for all layouts of hte category view.
  *
  * @author   Max Milbers
  * @return	string	The field input markup.
  * @since	2.0.24a
  */
 function getInput()
 {
     VmConfig::loadJLang('com_virtuemart');
     $view = substr($this->fieldname, 0, -6);
     $model = vmModel::getModel('config');
     $vmLayoutList = $model->getFieldList('products');
     $html = JHtml::_('Select.genericlist', $vmLayoutList, $this->name, 'size=1 width=200', 'value', 'text', array($this->value));
     return $html;
 }
Esempio n. 16
0
 function getInput()
 {
     VmConfig::loadJLang('com_virtuemart');
     $key = $this->element['key_field'] ? $this->element['key_field'] : 'value';
     $val = $this->element['value_field'] ? $this->element['value_field'] : $this->name;
     $model = VmModel::getModel('vendor');
     $vendors = $model->getVendors(true, true, false);
     return JHTML::_('select.genericlist', $vendors, $this->name, 'class="inputbox"  size="1"', 'virtuemart_vendor_id', 'vendor_name', $this->value, $this->id);
 }
Esempio n. 17
0
 function fetchElement($name, $value, &$node, $control_name)
 {
     VmConfig::loadJLang('com_virtuemart', false);
     $categorylist = ShopFunctions::categoryListTree(array($value));
     $html = '<select class="inputbox"   name="' . $control_name . '[' . $name . ']' . '" >';
     $html .= '<option value="0">' . JText::_('COM_VIRTUEMART_CATEGORY_FORM_TOP_LEVEL') . '</option>';
     $html .= $categorylist;
     $html .= "</select>";
     return $html;
 }
Esempio n. 18
0
    public static function getVMComponent($authCheck = true)
    {
        $lang = JFactory::getLanguage();
        $user = JFactory::getUser();
        $db = JFactory::getDBO();
        $q = 'SELECT m.id, m.title, m.alias, m.link, m.parent_id, m.img, e.element FROM `#__menu` as m
				LEFT JOIN #__extensions AS e ON m.component_id = e.extension_id
		         WHERE m.client_id = 1 AND e.enabled = 1 AND m.id > 1 AND e.element = \'com_virtuemart\'
		         AND (m.parent_id=1 OR m.parent_id =
			                        (SELECT m.id FROM `#__menu` as m
									LEFT JOIN #__extensions AS e ON m.component_id = e.extension_id
			                        WHERE m.parent_id=1 AND m.client_id = 1 AND e.enabled = 1 AND m.id > 1 AND e.element = \'com_virtuemart\'))
		         ORDER BY m.lft';
        $db->setQuery($q);
        $vmComponentItems = $db->loadObjectList();
        $result = new stdClass();
        if ($vmComponentItems) {
            if (!class_exists('VmConfig')) {
                require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php';
            }
            VmConfig::loadJLang('com_virtuemart.sys');
            // Parse the list of extensions.
            foreach ($vmComponentItems as &$vmComponentItem) {
                $vmComponentItem->link = trim($vmComponentItem->link);
                $vmComponentItem->link = JFilterOutput::ampReplace($vmComponentItem->link);
                if ($vmComponentItem->parent_id == 1) {
                    if ($authCheck == false || $authCheck && $user->authorise('core.manage', $vmComponentItem->element)) {
                        $result = $vmComponentItem;
                        if (!isset($result->submenu)) {
                            $result->submenu = array();
                        }
                        if (empty($vmComponentItem->link)) {
                            $vmComponentItem->link = 'index.php?option=' . $vmComponentItem->element;
                        }
                        $vmComponentItem->text = $lang->hasKey($vmComponentItem->title) ? JText::_($vmComponentItem->title) : $vmComponentItem->alias;
                    }
                } else {
                    // Sub-menu level.
                    if (isset($result)) {
                        // Add the submenu link if it is defined.
                        if (isset($result->submenu) && !empty($vmComponentItem->link)) {
                            $vmComponentItem->text = $lang->hasKey($vmComponentItem->title) ? JText::_($vmComponentItem->title) : $vmComponentItem->alias;
                            $class = preg_replace('#\\.[^.]*$#', '', basename($vmComponentItem->img));
                            $class = preg_replace('#\\.\\.[^A-Za-z0-9\\.\\_\\- ]#', '', $class);
                            $vmComponentItem->class = "icon-16-" . $class;
                            $result->submenu[] =& $vmComponentItem;
                        }
                    }
                }
            }
            return $result;
        } else {
            return NULL;
        }
    }
Esempio n. 19
0
 /**
  * Method to get the field input markup.
  *
  * @return	string	The field input markup.
  * @since	1.6
  */
 protected function getInput()
 {
     VmConfig::loadConfig();
     VmConfig::loadJLang('com_virtuemart');
     $categorylist = ShopFunctions::categoryListTree(array($this->value));
     $html = '<select class="inputbox"   name="' . $this->name . '" >';
     $html .= '<option value="0">' . vmText::_('COM_VIRTUEMART_CATEGORY_FORM_TOP_LEVEL') . '</option>';
     $html .= $categorylist;
     $html .= "</select>";
     return $html;
 }
Esempio n. 20
0
 protected function getOptions()
 {
     VmConfig::loadJLang('com_virtuemart', false);
     $cModel = VmModel::getModel('currency');
     $values = $cModel->getVendorAcceptedCurrrenciesList();
     $options[] = JHtml::_('select.option', 0, vmText::_('COM_VIRTUEMART_DEFAULT_VENDOR_CURRENCY'));
     foreach ($values as $v) {
         $options[] = JHtml::_('select.option', $v->virtuemart_currency_id, $v->currency_txt);
     }
     return $options;
 }
Esempio n. 21
0
 function _getPaymentResponseHtml($paymentTable, $payment_name)
 {
     VmConfig::loadJLang('com_virtuemart');
     $html = '<table>' . "\n";
     $html .= $this->getHtmlRow('COM_VIRTUEMART_PAYMENT_NAME', $payment_name);
     if (!empty($paymentTable)) {
         $html .= $this->getHtmlRow('MONEYBOOKERS_ORDER_NUMBER', $paymentTable->order_number);
     }
     $html .= '</table>' . "\n";
     return $html;
 }
Esempio n. 22
0
 public function __construct($params, $module)
 {
     $this->_params = $params;
     $this->_module = $module;
     if (!class_exists('VmConfig')) {
         return;
     }
     VmConfig::loadConfig();
     VmConfig::loadJLang('com_virtuemart', true);
     return $this;
 }
 /**
  * Method to display the view
  *
  * @access	public
  * @author
  */
 function __construct()
 {
     VmConfig::loadJLang('com_virtuemart_config');
     if (!JFactory::getUser()->authorise('core.admin')) {
         $app = JFactory::getApplication();
         JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
         $app->redirect('index.php');
         return;
     }
     parent::__construct();
 }
Esempio n. 24
0
 function getInput()
 {
     $key = $this->element['key_field'] ? $this->element['key_field'] : 'value';
     $val = $this->element['value_field'] ? $this->element['value_field'] : $this->name;
     VmConfig::loadJLang('com_virtuemart', false);
     $categorylist = ShopFunctions::categoryListTree(array($this->value));
     $html = '<select class="inputbox "   name="' . $this->name . '" >';
     $html .= '<option value="0">' . JText::_('COM_VIRTUEMART_CATEGORY_FORM_TOP_LEVEL') . '</option>';
     $html .= $categorylist;
     $html .= "</select>";
     return $html;
 }
Esempio n. 25
0
 /**
  * Builds an enlist for information (not chooseable)
  *
  * //TODO check for misuse by code injection
  *
  * @author Max Milbers
  *
  * @param $fieldnameXref datafield for the xreftable, where the name is stored
  * @param $tableXref xref table
  * @param $fieldIdXref datafield for the xreftable, where the id is stored
  * @param $idXref The id to query in the xref table
  * @param $fieldname the name of the datafield in the main table
  * @param $table main table
  * @param $fieldId the name of the field where the id is stored
  * @param $quantity The number of items in the list
  * @return List as String
  */
 public static function renderGuiList($fieldnameXref, $tableXref, $fieldIdXref, $idXref, $fieldname, $table, $fieldId, $view, $quantity = 4, $translate = 1)
 {
     if (!class_exists('VmConfig')) {
         require JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'config.php';
     }
     VmConfig::loadConfig();
     VmConfig::loadJLang('com_virtuemart_countries');
     // 		'virtuemart_category_id','#__virtuemart_calc_categories','virtuemart_calc_id',$data->virtuemart_calc_id,'category_name','#__virtuemart_categories','virtuemart_category_id','category'
     //Sanitize input
     $quantity = (int) $quantity;
     // 		if (!class_exists('TablePaymentmethods'))
     // 			require(JPATH_VM_ADMINISTRATOR . DS . 'tables' . DS . 'paymentmethods.php');
     // 		$table = new TablePaymentmethods($this->_db); /// we need that?
     // 		$table->load($payment_id);
     $db = JFactory::getDBO();
     $q = 'SELECT ' . $db->getEscaped($fieldnameXref) . ' FROM ' . $db->getEscaped($tableXref) . ' WHERE ' . $db->getEscaped($fieldIdXref) . ' = "' . (int) $idXref . '"';
     $db->setQuery($q);
     $tempArray = $db->loadResultArray();
     //echo $db->_sql;
     if (isset($tempArray)) {
         $links = '';
         $ttip = '';
         $i = 0;
         foreach ($tempArray as $value) {
             if ($translate) {
                 $mainTable = $table . '_' . VMLANG;
                 $q = 'SELECT ' . $db->getEscaped($fieldname) . ' FROM ' . $db->getEscaped($mainTable) . ' JOIN ' . $table . ' using (`' . $fieldnameXref . '`) WHERE ' . $db->getEscaped($fieldId) . ' = "' . (int) $value . '"';
             } else {
                 $q = 'SELECT ' . $db->getEscaped($fieldname) . ' FROM ' . $db->getEscaped($table) . ' WHERE ' . $db->getEscaped($fieldId) . ' = "' . (int) $value . '"';
             }
             $db->setQuery($q);
             $tmp = $db->loadResult();
             if ($i < $quantity) {
                 if ($view != 'user') {
                     $cid = 'cid';
                 } else {
                     $cid = 'virtuemart_user_id';
                 }
                 $links .= JHTML::_('link', JRoute::_('index.php?option=com_virtuemart&view=' . $view . '&task=edit&' . $cid . '[]=' . $value), JText::_($tmp)) . ', ';
             }
             $ttip .= $tmp . ', ';
             //				$list .= $tmp. ', ';
             $i++;
             //if($i==$quantity) break;
         }
         $links = substr($links, 0, -2);
         $ttip = substr($ttip, 0, -2);
         $list = '<span class="hasTip" title="' . $ttip . '" >' . $links . '</span>';
         return $list;
     } else {
         return '';
     }
 }
Esempio n. 26
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;
     VmConfig::loadJLang($filename);
     if (!class_exists('JParameter')) {
         require JPATH_VM_LIBRARIES . DS . 'joomla' . DS . 'html' . DS . 'parameter.php';
     }
     $this->_tablename = '#__virtuemart_' . $this->_psType . '_plg_' . $this->_name;
     $this->_tableChecked = FALSE;
 }
Esempio n. 27
0
 /**
  * Todo do we need that anylonger? that way.
  * @see JController::display()
  */
 public function display($cachable = false, $urlparams = false)
 {
     $format = vRequest::getCmd('format', 'html');
     if ($format == 'pdf') {
         $viewName = 'pdf';
     } else {
         $viewName = 'orders';
     }
     VmConfig::loadJLang('com_virtuemart_orders', TRUE);
     VmConfig::loadJLang('com_virtuemart_shoppers', TRUE);
     $view = $this->getView($viewName, $format);
     // Display it all
     $view->display();
 }
Esempio n. 28
0
 /**
  * Method to get the field input markup.
  *
  * @return  string  The field input markup.
  *
  * @since   11.1
  */
 protected function getInput()
 {
     VmConfig::loadConfig();
     VmConfig::loadJLang('com_virtuemart');
     $option = vRequest::getCmd('option');
     if (!function_exists('curl_init') or !function_exists('curl_exec')) {
         return vmText::_('COM_VIRTUEMART_PS_CURL_LIBRARY_NOT_INSTALLED');
     } else {
         $js = "\n jQuery(document).ready(function( \$ ) {\n   \$( '#vmcurl' ) .closest('.control-group').hide();\n });\n ";
         $doc = JFactory::getDocument();
         $doc->addScriptDeclaration($js);
         return '<span id="vmcurl"></span>';
     }
 }
Esempio n. 29
0
 function display($tpl = null)
 {
     if (!class_exists('VmImage')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'image.php';
     }
     VmConfig::loadJLang('com_virtuemart_orders', TRUE);
     $model = VmModel::getModel('virtuemart');
     $nbrCustomers = $model->getTotalCustomers();
     $this->assignRef('nbrCustomers', $nbrCustomers);
     $nbrActiveProducts = $model->getTotalActiveProducts();
     $this->assignRef('nbrActiveProducts', $nbrActiveProducts);
     $nbrInActiveProducts = $model->getTotalInActiveProducts();
     $this->assignRef('nbrInActiveProducts', $nbrInActiveProducts);
     $nbrFeaturedProducts = $model->getTotalFeaturedProducts();
     $this->assignRef('nbrFeaturedProducts', $nbrFeaturedProducts);
     $ordersByStatus = $model->getTotalOrdersByStatus();
     $this->assignRef('ordersByStatus', $ordersByStatus);
     $recentOrders = $model->getRecentOrders();
     if (!class_exists('CurrencyDisplay')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'currencydisplay.php';
     }
     /* Apply currency This must be done per order since it's vendor specific */
     $_currencies = array();
     // Save the currency data during this loop for performance reasons
     foreach ($recentOrders as $virtuemart_order_id => $order) {
         //This is really interesting for multi-X, but I avoid to support it now already, lets stay it in the code
         if (!array_key_exists('v' . $order->virtuemart_vendor_id, $_currencies)) {
             $_currencies['v' . $order->virtuemart_vendor_id] = CurrencyDisplay::getInstance('', $order->virtuemart_vendor_id);
         }
         $order->order_total = $_currencies['v' . $order->virtuemart_vendor_id]->priceDisplay($order->order_total);
     }
     $this->assignRef('recentOrders', $recentOrders);
     $recentCustomers = $model->getRecentCustomers();
     $this->assignRef('recentCustomers', $recentCustomers);
     if (!class_exists('ShopFunctions')) {
         require JPATH_VM_ADMINISTRATOR . '/helpers/shopfunctions.php';
     }
     $extensionsFeed = ShopFunctions::getExtensionsRssFeed();
     $this->assignRef('extensionsFeed', $extensionsFeed);
     $virtuemartFeed = ShopFunctions::getVirtueMartRssFeed();
     $this->assignRef('virtuemartFeed', $virtuemartFeed);
     // Options button.
     // if ( !JVM_VERSION===1) {
     // if (JFactory::getUser()->authorise('core.admin', 'com_virtuemart')) {
     // JToolBarHelper::preferences('com_virtuemart');
     // }
     // }
     parent::display($tpl);
 }
Esempio n. 30
0
 /**
  * constructs a VmModel
  * setMainTable defines the maintable of the model
  * @author Max Milbers
  */
 function __construct()
 {
     parent::__construct('virtuemart_userfield_id');
     $this->setMainTable('userfields');
     $this->setToggleName('required');
     $this->setToggleName('cart');
     $this->setToggleName('shipment');
     $this->setToggleName('account');
     // Instantiate the Helper class
     self::$_cache_ordered = null;
     self::$_cache_named = array();
     $this->_selectedOrdering = 'ordering';
     $this->_selectedOrderingDir = 'ASC';
     VmConfig::loadJLang('com_virtuemart_shoppers', TRUE);
 }