示例#1
0
 protected function getOptions()
 {
     //check com_vituemart existed
     $path = JPATH_ADMINISTRATOR . '/components/com_virtuemart';
     if (!is_dir($path) || !file_exists(JPATH_ADMINISTRATOR . '/components/com_virtuemart/helpers/config.php')) {
         $this->options[] = JHtml::_('select.option', '', JText::_('COM_VIRTUEMART_NOT_EXIST'));
     } else {
         // Initialize variables
         require_once JPATH_ADMINISTRATOR . '/components/com_virtuemart/helpers/config.php';
         require_once JPATH_ADMINISTRATOR . '/components/com_virtuemart/models/category.php';
         VmConfig::loadConfig();
         $categoryModel = new VirtueMartModelCategory();
         $categoryModel->_noLimit = true;
         $categories = $categoryModel->getCategories();
         if (count($categories)) {
             // iterating
             $temp_options = array();
             foreach ($categories as $item) {
                 array_push($temp_options, array($item->virtuemart_category_id, $item->category_name, $item->category_parent_id));
             }
             foreach ($temp_options as $option) {
                 if ($option[2] == 0) {
                     $this->options[] = JHtml::_('select.option', $option[0], $option[1]);
                     $this->recursive_options($temp_options, 1, $option[0]);
                 }
             }
         }
     }
     return $this->options;
 }
示例#2
0
文件: php.php 项目: naka211/compac
 /**
  * Save the file to the specified path
  * @return boolean TRUE on success
  */
 function save($path, $filename)
 {
     $input = fopen("php://input", "r");
     $temp = tmpfile();
     $realSize = stream_copy_to_stream($input, $temp);
     fclose($input);
     if ($realSize != $this->getSize()) {
         return false;
     }
     $target = fopen($path, "w");
     fseek($temp, 0, SEEK_SET);
     stream_copy_to_stream($temp, $target);
     fclose($target);
     //insert data into attachment table
     if (!class_exists('VmConfig')) {
         require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php';
     }
     $thumb_width = VmConfig::loadConfig()->get('img_width');
     $user_s =& JFactory::getUser();
     $user_id = $user_s->id;
     $product_vm_id = JRequest::getInt('virtuemart_product_id');
     $database =& JFactory::getDBO();
     $gallery = new stdClass();
     $gallery->id = 0;
     $gallery->virtuemart_user_id = $user_id;
     $gallery->virtuemart_product_id = $product_vm_id;
     $gallery->file_name = $filename;
     $gallery->created_on = date('Y-m-d,H:m:s');
     if (!$database->insertObject('#__virtuemart_product_attachments', $gallery, 'id')) {
         echo $database->stderr();
         return false;
     }
     // end of insert data
     return true;
 }
示例#3
0
 /**
  * Method to get the field input markup.
  *
  * @return	string	The field input markup.
  * @since	1.6
  */
 function getInput()
 {
     $key = $this->element['key_field'] ? $this->element['key_field'] : 'value';
     $val = $this->element['value_field'] ? $this->element['value_field'] : $this->name;
     VmConfig::loadConfig();
     return JHtml::_('select.genericlist', $this->_getProducts(), $this->name, 'class="inputbox"   ', 'value', 'text', $this->value, $this->id);
 }
 function linkIcon($link, $altText = '', $boutonName, $verifyConfigValue = false, $modal = true, $use_icon = true, $use_text = false)
 {
     if ($this->document->_type == 'pdf') {
         return;
     }
     if ($verifyConfigValue) {
         if (!VmConfig::get($verifyConfigValue, 0)) {
             return '';
         }
     }
     // $folder = '/media/system/images/'; // use of relative path, $folder is not needed in j3
     $text = '';
     // if ( $use_icon ) $text .= JHtml::_('image', $boutonName.'.png', JText::_($altText),  null, true);
     if ($use_icon) {
         $text .= '<span class="' . $boutonName . '"> </span>';
     }
     //JHtml::_('image', $boutonName.'.png', JText::_($altText),  null, true);
     if ($use_text) {
         $text .= '&nbsp;' . JText::_($altText);
     }
     if ($text == '') {
         $text .= '&nbsp;' . JText::_($altText);
     }
     if ($modal) {
         return '<a class="modal btn btn-default" rel="{handler: \'iframe\', size: {x: 700, y: 550}}" title="' . JText::_($altText) . '" href="' . JRoute::_($link) . '">' . $text . '</a>';
     } else {
         return '<a class="btn btn-default" title="' . JText::_($altText) . '" href="' . JRoute::_($link, FALSE) . '">' . $text . '</a>';
     }
 }
示例#5
0
	public function __construct()
	{
		parent::__construct();
		$this->useSSL = VmConfig::get('useSSL',0);
		$this->useXHTML = true;

	}
 function onAfterRoute()
 {
     if (JFactory::getApplication()->isAdmin()) {
         return;
     }
     $input = JFactory::getApplication()->input;
     $document = JFactory::getDocument();
     $app = JFactory::getApplication();
     $template = $app->getTemplate(true);
     if (!class_exists('VmConfig')) {
         require JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_virtuemart' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'config.php';
     }
     VmConfig::loadConfig();
     $uri = JFactory::getURI();
     $input = JFactory::getApplication()->input;
     $post = $input->post->getArray();
     $_option = $input->getString('option');
     $_view = $input->getString('view');
     $_format = $input->getString('format');
     $_task = $input->getString('task');
     $_tmpl = $input->getString('tmpl');
     if ($_option == 'com_virtuemart' && $_view == 'cart' && $_format != 'json') {
         require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'cart' . DIRECTORY_SEPARATOR . 'view.html.php';
     } else {
         if ($_option == 'com_virtuemart' && $_view == 'vmplg' && $_task == "pluginUserPaymentCancel") {
             require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'cart' . DIRECTORY_SEPARATOR . 'view.html.php';
         } else {
             if ($_option == 'com_virtuemart' && $_view == 'pluginresponse' && $_task == "pluginUserPaymentCancel") {
                 require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'cart' . DIRECTORY_SEPARATOR . 'view.html.php';
             }
         }
     }
 }
 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);
 }
示例#8
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;
 }
示例#9
0
文件: vmview.php 项目: lenard112/cms
 function linkIcon($link, $altText = '', $boutonName, $verifyConfigValue = false, $modal = true, $use_icon = true, $use_text = false, $class = '')
 {
     if ($verifyConfigValue) {
         if (!VmConfig::get($verifyConfigValue, 0)) {
             return '';
         }
     }
     $folder = 'media/system/images/';
     //shouldn't be root slash before media, as it automatically tells to look in root directory, for media/system/ which is wrong it should append to root directory.
     $text = '';
     if ($use_icon) {
         $text .= JHtml::_('image', $folder . $boutonName . '.png', vmText::_($altText), null, false, false);
     }
     //$folder shouldn't be as alt text, here it is: image(string $file, string $alt, mixed $attribs = null, boolean $relative = false, mixed $path_rel = false) : string, you should change first false to true if images are in templates media folder
     if ($use_text) {
         $text .= '&nbsp;' . vmText::_($altText);
     }
     if ($text == '') {
         $text .= '&nbsp;' . vmText::_($altText);
     }
     if ($modal) {
         return '<a ' . $class . ' class="modal" rel="{handler: \'iframe\', size: {x: 700, y: 550}}" title="' . vmText::_($altText) . '" href="' . JRoute::_($link, FALSE) . '">' . $text . '</a>';
     } else {
         return '<a ' . $class . ' title="' . vmText::_($altText) . '" href="' . JRoute::_($link, FALSE) . '">' . $text . '</a>';
     }
 }
示例#10
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);
 }
示例#11
0
 function __construct()
 {
     parent::__construct();
     // Load the database and execute our sql file
     $this->db = JFactory::getDBO();
     // Get information of our plugin so we can pass it on to MDS Collivery for Logs
     $sel_query = "SELECT * FROM `#__extensions` where type = 'plugin' and element = 'mds_shipping' and folder = 'vmshipment';";
     $this->db->setQuery($sel_query);
     $this->db->query();
     $this->extension_id = $this->db->loadObjectList()[0]->extension_id;
     $this->app_name = $this->db->loadObjectList()[0]->extension_id;
     $this->app_info = json_decode($this->db->loadObjectList()[0]->manifest_cache);
     // Get our login information
     $config_query = "SELECT * FROM `#__mds_collivery_config` where id = 1;";
     $this->db->setQuery($config_query);
     $this->db->query();
     $this->password = $this->db->loadObjectList()[0]->password;
     $this->username = $this->db->loadObjectList()[0]->username;
     $this->risk_cover = $this->db->loadObjectList()[0]->risk_cover;
     $version = new JVersion();
     require_once preg_replace('|com_installer|i', "", JPATH_COMPONENT_ADMINISTRATOR) . '/helpers/config.php';
     $config = array('app_name' => $this->app_info->name, 'app_version' => $this->app_info->version, 'app_host' => "Joomla: " . $version->getShortVersion() . ' - Virtuemart: ' . VmConfig::getInstalledVersion(), 'app_url' => JURI::base(), 'user_email' => $this->username, 'user_password' => $this->password);
     // Use the MDS API Files
     require_once JPATH_PLUGINS . '/vmshipment/mds_shipping/Mds/Cache.php';
     require_once JPATH_PLUGINS . '/vmshipment/mds_shipping/Mds/Collivery.php';
     $this->collivery = new Mds\Collivery($config);
     // Get some information from the API
     $this->towns = $this->collivery->getTowns();
     $this->services = $this->collivery->getServices();
     $this->location_types = $this->collivery->getLocationTypes();
     $this->suburbs = $this->collivery->getSuburbs(null);
 }
示例#12
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);
	}
示例#13
0
 /**
 *   Constructor - requires following vars:
 *
 *	@param string $filename			image path
 *
 *	These are additional vars:
 *
 *	@param int $newxsize			new maximum image width
 *	@param int $newysize			new maximum image height
 *	@param string $fileout			output image path
 *	@param int $thumbMaxSize		whether thumbnail should have background fill to make it exactly $newxsize x $newysize
 *	@param int $bgred				0-255 - red color variable for background filler
 *	@param int $bggreen				0-255 - green color variable for background filler
 *	@param int $bgblue				0-255 - blue color variable for background filler
 *
 */
 function Img2Thumb($filename, $newxsize = 60, $newysize = 60, $fileout = '', $thumbMaxSize = 0, $bgred = 0, $bggreen = 0, $bgblue = 0)
 {
     //Some big pictures need that
     VmConfig::ensureMemoryLimit(128);
     //	New modification - checks color int to be sure within range
     if ($thumbMaxSize) {
         $this->maxSize = true;
     } else {
         $this->maxSize = false;
     }
     if ($bgred >= 0 || $bgred <= 255) {
         $this->bg_red = $bgred;
     } else {
         $this->bg_red = 0;
     }
     if ($bggreen >= 0 || $bggreen <= 255) {
         $this->bg_green = $bggreen;
     } else {
         $this->bg_green = 0;
     }
     if ($bgblue >= 0 || $bgblue <= 255) {
         $this->bg_blue = $bgblue;
     } else {
         $this->bg_blue = 0;
     }
     $this->NewImgCreate($filename, $newxsize, $newysize, $fileout);
 }
示例#14
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);
 }
示例#15
0
 function display($tpl = null)
 {
     $db = JFactory::getDBO();
     if ($field = JRequest::getVar('field')) {
         if (strpos($field, 'plugin') !== false) {
             if (JVM_VERSION === 1) {
                 $table = '#__plugins';
                 //$ext_id = 'id';
             } else {
                 $table = '#__extensions';
                 //$ext_id = 'extension_id';
             }
             $field = substr($field, 6);
             $q = 'SELECT `params`,`element` FROM `' . $table . '` WHERE `element` = "' . $field . '"';
             $db->setQuery($q);
             $this->plugin = $db->loadObject();
             if (!class_exists('vmParameters')) {
                 require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'parameterparser.php';
             }
             $parameters = new vmParameters($this->plugin, $this->plugin->element, 'plugin', 'vmuserfield');
             $lang = JFactory::getLanguage();
             $filename = 'plg_vmuserfield_' . $this->plugin->element;
             if (VmConfig::get('enableEnglish', 1)) {
                 $lang->load($filename, JPATH_ADMINISTRATOR, 'en-GB', true);
             }
             $lang->load($filename, JPATH_ADMINISTRATOR, $lang->getDefault(), true);
             $lang->load($filename, JPATH_ADMINISTRATOR, null, true);
             echo $parameters->render();
             //echo '<input type="hidden" value="'.$this->plugin->element.'" name="custom_value">';
             jExit();
         }
     }
     jExit();
 }
示例#16
0
	/**
	 * Handle the save task
	 */
	function save($data = 0){

		vRequest::vmCheckToken();
		$model = VmModel::getModel('config');

		$data = vRequest::getPost();

		if(strpos($data['offline_message'],'|')!==false){
			$data['offline_message'] = str_replace('|','',$data['offline_message']);
		}

		$msg = '';
		if ($model->store($data)) {
			$msg = vmText::_('COM_VIRTUEMART_CONFIG_SAVED');
			// Load the newly saved values into the session.
			VmConfig::loadConfig();
		}

		$redir = 'index.php?option=com_virtuemart';
		if(vRequest::getCmd('task') == 'apply'){
			$redir = $this->redirectPath;
		}

		$this->setRedirect($redir, $msg);


	}
示例#17
0
 function display($tpl = null)
 {
     if (!class_exists('VmHTML')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
     }
     $this->vendorId = VmConfig::isSuperVendor();
     // TODO add icon for media view
     $this->SetViewTitle();
     $model = VmModel::getModel('media');
     $layoutName = vRequest::getCmd('layout', 'default');
     if ($layoutName == 'edit') {
         $this->media = $model->getFile();
         $this->addStandardEditViewCommands();
     } else {
         $virtuemart_product_id = vRequest::getInt('virtuemart_product_id');
         if (is_array($virtuemart_product_id) && count($virtuemart_product_id) > 0) {
             $virtuemart_product_id = (int) $virtuemart_product_id[0];
         } else {
             $virtuemart_product_id = (int) $virtuemart_product_id;
         }
         $cat_id = vRequest::getInt('virtuemart_category_id', 0);
         JToolBarHelper::custom('synchronizeMedia', 'new', 'new', vmText::_('COM_VIRTUEMART_TOOLS_SYNC_MEDIA_FILES'), false);
         $this->addStandardDefaultViewCommands();
         $this->addStandardDefaultViewLists($model, null, null, 'searchMedia');
         $options = array('' => vmText::_('COM_VIRTUEMART_LIST_ALL_TYPES'), 'product' => vmText::_('COM_VIRTUEMART_PRODUCT'), 'category' => vmText::_('COM_VIRTUEMART_CATEGORY'), 'manufacturer' => vmText::_('COM_VIRTUEMART_MANUFACTURER'), 'vendor' => vmText::_('COM_VIRTUEMART_VENDOR'));
         $this->lists['search_type'] = VmHTML::selectList('search_type', vRequest::getVar('search_type'), $options, 1, '', 'onchange="this.form.submit();"');
         $options = array('' => vmText::_('COM_VIRTUEMART_LIST_ALL_ROLES'), 'file_is_displayable' => vmText::_('COM_VIRTUEMART_FORM_MEDIA_DISPLAYABLE'), 'file_is_downloadable' => vmText::_('COM_VIRTUEMART_FORM_MEDIA_DOWNLOADABLE'), 'file_is_forSale' => vmText::_('COM_VIRTUEMART_FORM_MEDIA_SET_FORSALE'));
         $this->lists['search_role'] = VmHTML::selectList('search_role', vRequest::getVar('search_role'), $options, 1, '', 'onchange="this.form.submit();"');
         $this->files = $model->getFiles(false, false, $virtuemart_product_id, $cat_id);
         $this->pagination = $model->getPagination();
     }
     parent::display($tpl);
 }
示例#18
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);
 }
 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;
 }
 /**
  * Paste the table  in json format
  *
  */
 public function paste()
 {
     // TODO Test user ?
     $json = array();
     $json['fields'] = 'error';
     $json['msg'] = 'Invalid Token';
     $json['structure'] = 'empty';
     if (!JSession::checkToken('get')) {
         echo json_encode($json);
         jexit();
     }
     $lang = JRequest::getvar('lg');
     $langs = VmConfig::get('active_languages', array());
     $language = JFactory::getLanguage();
     if (!in_array($lang, $langs)) {
         $json['msg'] = 'Invalid language ! ' . $lang;
         $json['langs'] = $langs;
         echo json_encode($json);
         jexit();
     }
     $lang = strtolower($lang);
     // Remove tag if defaut or
     // if ($language->getDefault() == $lang ) $dblang ='';
     $dblang = strtr($lang, '-', '_');
     $id = JRequest::getInt('id', 0);
     $viewKey = JRequest::getWord('editView');
     // we have here 2 access user & vendor give same results
     if ($viewKey == 'user') {
         $viewKey = 'vendor';
     }
     // Not needed , vendor is checked in constructor
     //if ($viewKey == 'vendor') $id = 1 ;
     $tables = array('category' => 'categories', 'product' => 'products', 'manufacturer' => 'manufacturers', 'manufacturercategories' => 'manufacturercategories', 'vendor' => 'vendors', 'paymentmethod' => 'paymentmethods', 'shipmentmethod' => 'shipmentmethods');
     if (!isset($tables[$viewKey])) {
         $json['msg'] = "Invalid view " . $viewKey;
         echo json_encode($json);
         jExit();
     }
     $tableName = '#__virtuemart_' . $tables[$viewKey] . '_' . $dblang;
     $db = JFactory::getDBO();
     $q = 'select * FROM `' . $tableName . '` where `virtuemart_' . $viewKey . '_id` =' . $id;
     $db->setQuery($q);
     if ($json['fields'] = $db->loadAssoc()) {
         $json['structure'] = 'filled';
         $json['msg'] = jText::_('COM_VIRTUEMART_SELECTED_LANG') . ':' . $lang;
     } else {
         $json['structure'] = 'empty';
         $db->setQuery('SHOW COLUMNS FROM ' . $tableName);
         $tableDescribe = $db->loadAssocList();
         array_shift($tableDescribe);
         $fields = array();
         foreach ($tableDescribe as $key => $val) {
             $fields[$val['Field']] = $val['Field'];
         }
         $json['fields'] = $fields;
         $json['msg'] = JText::sprintf('COM_VIRTUEMART_LANG_IS_EMPTY', $lang, jText::_('COM_VIRTUEMART_' . strtoupper($viewKey)));
     }
     echo json_encode($json);
     jExit();
 }
示例#21
0
	/**
	 * Handle the save task
	 *
	 * @author RickG
	 */
	function save($data = 0){

		JRequest::checkToken() or jexit( 'Invalid Token' );
		$model = VmModel::getModel('config');

		$data = JRequest::get('post');
		$data['offline_message'] = JRequest::getVar('offline_message','','post','STRING',JREQUEST_ALLOWHTML);

		if(strpos($data['offline_message'],'|')!==false){
			$data['offline_message'] = str_replace('|','',$data['offline_message']);
		}

		if ($model->store($data)) {
			$msg = JText::_('COM_VIRTUEMART_CONFIG_SAVED');
			// Load the newly saved values into the session.
			VmConfig::loadConfig();
		}
		else {
			$msg = $model->getError();
		}

		$redir = 'index.php?option=com_virtuemart';
		if(JRequest::getCmd('task') == 'apply'){
			$redir = $this->redirectPath;
		}

		$this->setRedirect($redir, $msg);


	}
示例#22
0
 function fetchElement()
 {
     $db = JFactory::getDBO();
     $query = '';
     require JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_virtuemart' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'config.php';
     VmConfig::loadConfig();
     $query = 'SELECT a.virtuemart_category_id AS id, b.category_parent_id AS parent_id, b.category_parent_id AS parent, c. category_name AS title ' . 'FROM #__virtuemart_categories AS a ' . 'LEFT JOIN #__virtuemart_category_categories AS b ON a.virtuemart_category_id = b.category_child_id ' . 'LEFT JOIN #__virtuemart_categories_' . VMLANG . ' AS c ON a.virtuemart_category_id = c.virtuemart_category_id ' . 'WHERE a.published = 1 ' . 'ORDER BY a.ordering';
     $db->setQuery($query);
     $menuItems = $db->loadObjectList();
     $children = array();
     if ($menuItems) {
         foreach ($menuItems as $v) {
             $pt = $v->parent_id;
             $list = isset($children[$pt]) ? $children[$pt] : array();
             array_push($list, $v);
             $children[$pt] = $list;
         }
     }
     jimport('joomla.html.html.menu');
     $options = JHTML::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0);
     $this->_xml->addChild('option', 'Root')->addAttribute('value', 0);
     if (count($options)) {
         foreach ($options as $option) {
             $this->_xml->addChild('option', htmlspecialchars(' - ' . $option->treename))->addAttribute('value', $option->id);
         }
     }
     $this->_value = $this->_form->get($this->_name, $this->_default);
     return parent::fetchElement();
 }
示例#23
0
 protected function getOptions()
 {
     // if VM is not installed
     if (!JFolder::exists(JPATH_ROOT . '/administrator/components/com_virtuemart') or !class_exists('ShopFunctions')) {
         // add the root item
         $option = new stdClass();
         $option->text = JText::_('MOD_ACCORDEONCK_VIRTUEMART_NOTFOUND');
         $option->value = '0';
         $options[] = $option;
         // Merge any additional options in the XML definition.
         $options = array_merge(parent::getOptions(), $options);
         return $options;
     }
     VmConfig::loadConfig();
     $categorylist = ShopFunctions::categoryListTree();
     // $categorylist = 'testced';
     $categorylist = trim($categorylist, '</option>');
     $categorylist = explode("</option><option", $categorylist);
     // add the root item
     $option = new stdClass();
     $option->text = JText::_('MOD_ACCORDEONCK_VIRTUEMART_ROOTNODE');
     $option->value = '0';
     $options[] = $option;
     foreach ($categorylist as $cat) {
         $option = new stdClass();
         $text = explode(">", $cat);
         $option->text = trim($text[1]);
         $option->value = strval(trim(trim(trim($text[0]), '"'), 'value="'));
         $options[] = $option;
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
示例#24
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);
 }
 function onBeforeRender()
 {
     if ($this->app->isAdmin()) {
         return;
     }
     $app = JFactory::getApplication();
     $option = $app->input->get('option');
     $view = $app->input->get('view');
     $tmpl = $app->input->get('tmpl');
     $document = JFactory::getDocument();
     if ($app->isSite() && $tmpl != 'component') {
         if (!defined('SMART_JQUERY') && (int) $this->params->get('include_jquery', '1')) {
             $document->addScript(JURI::root(true) . '/plugins/system/plg_sj_vm_quickview/assets/js/jquery-1.8.2.min.js');
             $document->addScript(JURI::root(true) . '/plugins/system/plg_sj_vm_quickview/assets/js/jquery-noconflict.js');
             define('SMART_JQUERY', 1);
         }
         if (!class_exists('VmConfig')) {
             require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php';
         }
         VmConfig::loadConfig();
         if (class_exists('vmJsApi')) {
             vmJsApi::jPrice();
         }
         $document->addScript(JURI::root(true) . '/plugins/system/plg_sj_vm_quickview/assets/js/jquery.fancybox.js');
         $document->addStyleSheet(JURI::root(true) . '/plugins/system/plg_sj_vm_quickview/assets/css/jquery.fancybox.css');
         $document->addStyleSheet(JURI::root(true) . '/plugins/system/plg_sj_vm_quickview/assets/css/quickview.css');
     }
     return true;
 }
示例#26
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);
 }
 public function display($tpl = null)
 {
     if (!class_exists('VmConfig')) {
         require JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'config.php';
     }
     VmConfig::loadConfig();
     // Load the CSS
     $config = LiveUpdateConfig::getInstance();
     $this->assign('config', $config);
     if (JVM_VERSION === 2) {
         JHtml::_('bootstrap.loadCss');
     }
     if (!$config->addMedia()) {
         // No custom CSS overrides were set; include our own
         // $document = JFactory::getDocument();
         // $url = JURI::base().'/components/'.JRequest::getCmd('option','').'/liveupdate/assets/liveupdate.css';
         // $document->addStyleSheet($url, 'text/css');
     }
     $requeryURL = 'index.php?option=' . JRequest::getCmd('option', '') . '&view=' . JRequest::getCmd('view', 'liveupdate') . '&force=1';
     $this->assign('requeryURL', $requeryURL);
     $extInfo = (object) $config->getExtensionInformation();
     JToolBarHelper::title($extInfo->title . ' &ndash; ' . JText::_('LIVEUPDATE_TASK_OVERVIEW'), 'liveupdate');
     if (version_compare(JVERSION, '1.6.0', 'ge')) {
         $msg = 'JTOOLBAR_BACK';
     } else {
         $msg = 'Back';
     }
     JToolBarHelper::back($msg, 'index.php?option=' . JRequest::getCmd('option', ''));
     switch (JRequest::getCmd('task', 'default')) {
         case 'startupdate':
             $this->setLayout('startupdate');
             $this->assign('url', 'index.php?option=' . JRequest::getCmd('option', '') . '&view=' . JRequest::getCmd('view', 'liveupdate') . '&task=download');
             break;
         case 'install':
             $this->setLayout('install');
             // Get data from the model
             $state =& $this->get('State');
             // Are there messages to display ?
             $showMessage = false;
             if (is_object($state)) {
                 $message1 = $state->get('message');
                 $message2 = $state->get('extension.message');
                 $showMessage = $message1 || $message2;
             }
             $this->assign('showMessage', $showMessage);
             $this->assignRef('state', $state);
             break;
         case 'overview':
         default:
             $this->setLayout('overview');
             $force = JRequest::getInt('force', 0);
             $this->assign('updateInfo', LiveUpdate::getUpdateInformation($force));
             $this->assign('runUpdateURL', 'index.php?option=' . JRequest::getCmd('option', '') . '&view=' . JRequest::getCmd('view', 'liveupdate') . '&task=startupdate');
             $needsAuth = !$config->getAuthorization() && $config->requiresAuthorization();
             $this->assign('needsAuth', $needsAuth);
             break;
     }
     parent::display($tpl);
 }
示例#28
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);
 }
示例#29
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;
 }
示例#30
0
 public function display($tpl = null)
 {
     $user =& JFactory::getUser();
     $db =& JFactory::getDBO();
     $session = JFactory::getSession();
     $cmp = $session->get('compare', '');
     $listpid = explode(",", $cmp);
     if (empty($cmp)) {
         $valid = 0;
         $this->assignRef('valid', $valid);
         //$app =& JFactory::getApplication();
         //$app->enqueueMessage('Your Wishlist is Empty Please Add any product to Wishlist', 'error');
         //$app->redirect('index.php');
         //exit;
     } else {
         $valid = 1;
         $this->assignRef('valid', $valid);
         $this->assignRef('wids', $wids);
         $productModel = VmModel::getModel('product');
         $products = $productModel->getProducts($listpid);
         //echo "<pre>";
         //print_r($wishlist);
         //exit;
         $productModel->addImages($products, 1);
         $this->assignRef('products', $products);
         foreach ($products as $product) {
             $product->stock = $productModel->getStockIndicator($product);
         }
         $show_prices = VmConfig::get('show_prices', 1);
         if ($show_prices == '1') {
             if (!class_exists('calculationHelper')) {
                 require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php';
             }
         }
         $this->assignRef('show_prices', $show_prices);
         if (!class_exists('Permissions')) {
             require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
         }
         $showBasePrice = Permissions::getInstance()->check('admin');
         //todo add config settings
         $this->assignRef('showBasePrice', $showBasePrice);
         $currency = CurrencyDisplay::getInstance();
         $this->assignRef('currency', $currency);
         $pagination = $productModel->getPagination(3);
         $this->assignRef('vmPagination', $pagination);
         /*** rating ***/
         $ratingModel = VmModel::getModel('ratings');
         $showRating = $ratingModel->showRating($product->virtuemart_product_id);
         $this->assignRef('showRating', $showRating);
         if ($showRating) {
             $vote = $ratingModel->getVoteByProduct($product->virtuemart_product_id);
             $this->assignRef('vote', $vote);
             $rating = $ratingModel->getRatingByProduct($product->virtuemart_product_id);
             $this->assignRef('rating', $rating);
         }
     }
     parent::display($tpl);
 }