/**
  * swap the ordering of a record in the Xref tables
  * @param  $direction , 1/-1 The increment to reorder by
  */
 function move($direction, $where = '', $orderingkey = 0)
 {
     if (empty($this->_skey)) {
         vmError('No secondary keys defined in VmTableXarray ' . $this->_tbl);
         return false;
     }
     $skeyId = vRequest::getInt($this->_skey, 0);
     // Initialize variables
     $db = JFactory::getDBO();
     $cid = vRequest::getInt($this->_pkey);
     $order = vRequest::getInt('order');
     //I found now two times "order" instead of ordering.
     //This sql is broken
     $query = 'SELECT `id` FROM `' . $this->_tbl . '` WHERE ' . $this->_pkey . ' = ' . (int) $cid[0] . ' AND `tsmart_category_id` = ' . (int) $skeyId;
     $db->setQuery($query);
     $id = $db->loadResult();
     $keys = array_keys($order);
     // TODO next 2 lines not used ????
     if ($direction > 0) {
         $idToSwap = $order[$keys[array_search($id, $keys)] + 1];
     } else {
         $idToSwap = $order[$keys[array_search($id, $keys)] - 1];
     }
     if (isset($cid[0])) {
         $query = 'UPDATE `' . $this->_tbl . '` ' . ' SET `' . $this->_orderingKey . '` = `' . $this->_orderingKey . '` + ' . $direction . ' WHERE `' . $this->_pkey . '` = ' . (int) $cid[0] . ' AND `' . $this->_skey . '`  = ' . (int) $skeyId;
         $db->setQuery($query);
         if (!$db->execute()) {
             $err = $db->getErrorMsg();
             JError::raiseError(500, get_class($this) . ':: move ' . $err);
         }
     }
 }
Exemple #2
0
 function display($tpl = null)
 {
     // Load the helper(s)
     if (!class_exists('VmHTML')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
     }
     $model = tmsModel::getModel();
     $this->setLayout('default');
     $config = JFactory::getConfig();
     $layoutName = vRequest::getCmd('layout', 'default');
     JToolBarHelper::publishList();
     JToolBarHelper::unpublishList();
     JToolBarHelper::editList();
     JToolBarHelper::addNew();
     JToolBarHelper::deleteList();
     $this->SetViewTitle();
     $this->addStandardDefaultViewLists($model, 0, 'ASC');
     $this->items = $model->getItemList(vRequest::getCmd('search', false));
     $this->pagination = $model->getPagination();
     $cid = vRequest::getInt('cid');
     $model->setId($cid);
     $this->item = $model->getItem();
     $this->SetViewTitle('', $this->item->title);
     parent::display($tpl);
 }
Exemple #3
0
 /**
  * Retireve a list of currencies from the database.
  * This function is used in the backend for the currency listing, therefore no asking if enabled or not
  * @author Max Milbers
  * @return object List of currency objects
  */
 function getItemList($search = '')
 {
     $select = ' supplier.* FROM #__tsmart_supplier AS supplier';
     $where = array();
     $user = JFactory::getUser();
     $shared = '';
     if (vmAccess::manager()) {
         $shared = 'OR `supplier.shared`="1"';
     }
     if (empty($search)) {
         $search = vRequest::getString('search', false);
     }
     // add filters
     if ($search) {
         $db = JFactory::getDBO();
         $search = '"%' . $db->escape($search, true) . '%"';
         $where[] = '`supplier.supplier_name` LIKE ' . $search;
     }
     $whereString = '';
     if (count($where) > 0) {
         $whereString = ' WHERE ' . implode(' AND ', $where);
     }
     $data = $this->exeSortSearchListQuery(0, $select, '', $whereString, '', $this->_getOrdering());
     return $data;
 }
Exemple #4
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);
	}
Exemple #5
0
 function getListQuery()
 {
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('language.*')->from('#__tsmart_language AS language');
     $user = JFactory::getUser();
     $shared = '';
     if (vmAccess::manager()) {
         //$query->where('transferaddon.shared=1','OR');
     }
     $search = vRequest::getCmd('search', false);
     if (empty($search)) {
         $search = vRequest::getString('search', false);
     }
     // add filters
     if ($search) {
         $db = JFactory::getDBO();
         $search = '"%' . $db->escape($search, true) . '%"';
         $query->where('language.language_name LIKE ' . $search);
     }
     // Add the list ordering clause.
     $orderCol = $this->state->get('list.ordering', 'language.tsmart_language_id');
     $orderDirn = $this->state->get('list.direction', 'asc');
     if ($orderCol == 'language.ordering') {
         $orderCol = $db->quoteName('language.language_name') . ' ' . $orderDirn . ', ' . $db->quoteName('language.ordering');
     }
     $query->order($db->escape($orderCol . ' ' . $orderDirn));
     return $query;
 }
Exemple #6
0
 function updateOrderItems()
 {
     vRequest::vmCheckToken();
     $model = VmModel::getModel('report');
     $model->updateOrderItems();
     $this->setRedirect($this->redirectPath, 'Order Items updated');
 }
Exemple #7
0
 function display($tpl = null)
 {
     // Load the helper(s)
     if (!class_exists('VmHTML')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'html.php';
     }
     $model = VmModel::getModel();
     $config = JFactory::getConfig();
     $layoutName = vRequest::getCmd('layout', 'default');
     if ($layoutName == 'edit') {
         $cid = vRequest::getInt('cid');
         $task = vRequest::getCmd('task', 'add');
         if ($task != 'add' && !empty($cid) && !empty($cid[0])) {
             $cid = (int) $cid[0];
         } else {
             $cid = 0;
         }
         $model->setId($cid);
         $currency = $model->getCurrency();
         $this->SetViewTitle('', $currency->currency_name);
         $this->assignRef('currency', $currency);
         $this->addStandardEditViewCommands();
     } else {
         $this->SetViewTitle();
         $this->addStandardDefaultViewCommands();
         $this->addStandardDefaultViewLists($model, 0, 'ASC');
         $currencies = $model->getCurrenciesList(vRequest::getCmd('search', false));
         $this->assignRef('currencies', $currencies);
         $pagination = $model->getPagination();
         $this->assignRef('pagination', $pagination);
     }
     parent::display($tpl);
 }
Exemple #8
0
 function save($data = 0)
 {
     $fileModel = VmModel::getModel('media');
     //Now we try to determine to which this media should be long to
     $data = array_merge(vRequest::getRequest(), vRequest::get('media'));
     //$data['file_title'] = vRequest::getVar('file_title','','post','STRING',JREQUEST_ALLOWHTML);
     if (!empty($data['file_description'])) {
         $data['file_description'] = JComponentHelper::filterText($data['file_description']);
         //vRequest::filter(); vRequest::getHtml('file_description','');
     }
     /*$data['media_action'] = vRequest::getCmd('media[media_action]');
     		$data['media_attributes'] = vRequest::getCmd('media[media_attributes]');
     		$data['file_type'] = vRequest::getCmd('media[file_type]');*/
     if (empty($data['file_type'])) {
         $data['file_type'] = $data['media_attributes'];
     }
     $msg = '';
     if ($id = $fileModel->store($data)) {
         $msg = vmText::_('COM_VIRTUEMART_FILE_SAVED_SUCCESS');
     }
     $cmd = vRequest::getCmd('task');
     if ($cmd == 'apply') {
         $redirection = 'index.php?option=com_virtuemart&view=media&task=edit&virtuemart_media_id=' . $id;
     } else {
         $redirection = 'index.php?option=com_virtuemart&view=media';
     }
     $this->setRedirect($redirection, $msg);
 }
Exemple #9
0
	function display($tpl = null) {

		// Load the helper(s)


		if (!class_exists('VmHTML'))
			require(VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php');

		$this->SetViewTitle();


		$model = VmModel::getModel();

//		$stateId = vRequest::getVar('virtuemart_state_id');
//		$model->setId($stateId);
		$state = $model->getSingleState();

		$countryId = vRequest::getInt('virtuemart_country_id', 0);
		if(empty($countryId)) $countryId = $state->virtuemart_country_id;
		$this->assignRef('virtuemart_country_id',	$countryId);

        $isNew = (count($state) < 1);

		if(empty($countryId) && $isNew){
			vmWarn('Country id is 0');
			return false;
		}

		$country = VmModel::getModel('country');
		$country->setId($countryId);
		$this->assignRef('country_name', $country->getData()->country_name);


		$layoutName = vRequest::getCmd('layout', 'default');
		if ($layoutName == 'edit') {


			$this->assignRef('state', $state);

			$zoneModel = VmModel::getModel('Worldzones');
			$wzsList = $zoneModel->getWorldZonesSelectList();
			$this->assignRef('worldZones', $wzsList);

			$this->addStandardEditViewCommands();

		} else {

			$this->addStandardDefaultViewCommands();
			$this->addStandardDefaultViewLists($model);

			$states = $model->getStates($countryId);
			$this->assignRef('states',	$states);

			$pagination = $model->getPagination();
			$this->assignRef('pagination', $pagination);

		}

		parent::display($tpl);
	}
Exemple #10
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);
 }
Exemple #11
0
 function display($tpl = null)
 {
     // Load the helper(s)
     if (!class_exists('VmConfig')) {
         require JPATH_COMPONENT_ADMINISTRATOR . '/helpers/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 = vRequest::getCmd('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 = vRequest::getCmd('filter_country', false);
         $countries = $model->getCountries(false, false, $filter_country);
         $this->assignRef('countries', $countries);
         $pagination = $model->getPagination();
         $this->assignRef('pagination', $pagination);
     }
     parent::display($tpl);
 }
Exemple #12
0
 function getListQuery()
 {
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('state.*, countries.flag AS country_flag,countries.country_name,COUNT(cityarea.tsmart_cityarea_id) AS total_city')->from('#__tsmart_states AS state')->leftJoin('#__tsmart_countries AS countries   using (tsmart_country_id)')->leftJoin('#__tsmart_cityarea AS cityarea using (tsmart_state_id)')->group('state.tsmart_state_id')->leftJoin('#__tsmart_states AS states ON states.tsmart_state_id=cityarea.tsmart_state_id')->leftJoin('#__tsmart_airport AS airport ON airport.tsmart_cityarea_id=cityarea.tsmart_cityarea_id')->select('GROUP_CONCAT(airport.airport_name,"(",airport.ata_code,")") AS list_airport_name');
     $user = JFactory::getUser();
     $shared = '';
     if (vmAccess::manager()) {
         //$query->where('transferaddon.shared=1','OR');
     }
     $search = vRequest::getCmd('search', false);
     if (empty($search)) {
         $search = vRequest::getString('search', false);
     }
     // add filters
     if ($search) {
         $db = JFactory::getDBO();
         $search = '"%' . $db->escape($search, true) . '%"';
         $query->where('state.state_name LIKE ' . $search);
     }
     // Add the list ordering clause.
     $orderCol = $this->state->get('list.ordering', 'state.tsmart_state_id');
     $orderDirn = $this->state->get('list.direction', 'asc');
     if ($orderCol == 'state.ordering') {
         $orderCol = $db->quoteName('state.tsmart_state_id') . ' ' . $orderDirn . ', ' . $db->quoteName('state.ordering');
     }
     $query->order($db->escape($orderCol . ' ' . $orderDirn));
     return $query;
 }
 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);
 }
 function getListQuery()
 {
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('excursion_addon.*')->from('#__tsmart_excursion_addon AS excursion_addon')->leftJoin('me1u8_tsmart_cityarea AS cityarea USING(tsmart_cityarea_id)')->select('cityarea.city_area_name AS city_area_name');
     $user = JFactory::getUser();
     $shared = '';
     if (vmAccess::manager()) {
         //$query->where('excursionaddon.shared=1','OR');
     }
     $search = vRequest::getCmd('search', false);
     if (empty($search)) {
         $search = vRequest::getString('search', false);
     }
     // add filters
     if ($search) {
         $db = JFactory::getDBO();
         $search = '"%' . $db->escape($search, true) . '%"';
         $query->where('excursion_addon.excursion_addon_name LIKE ' . $search);
     }
     if (empty($this->_selectedOrdering)) {
         vmTrace('empty _getOrdering');
     }
     if (empty($this->_selectedOrderingDir)) {
         vmTrace('empty _selectedOrderingDir');
     }
     $query->order($this->_selectedOrdering . ' ' . $this->_selectedOrderingDir);
     return $query;
 }
Exemple #15
0
 function display($tpl = null)
 {
     // Load the helper(s)
     if (!class_exists('VmHTML')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
     }
     $model = tmsModel::getModel();
     $config = JFactory::getConfig();
     $layoutName = vRequest::getCmd('layout', 'default');
     if ($layoutName == 'edit') {
         $cid = vRequest::getInt('cid');
         $task = vRequest::getCmd('task', 'add');
         if ($task != 'add' && !empty($cid) && !empty($cid[0])) {
             $cid = (int) $cid[0];
         } else {
             $cid = 0;
         }
         $model->setId($cid);
         $this->departure = $model->getdeparture();
         $this->SetViewTitle('', $this->departure->departure_name);
         $this->addStandardEditViewCommands();
     } else {
         $model_product = tmsModel::getModel('product');
         $model_tour_class = tmsModel::getModel('tourclass');
         $this->list_tour = $model_product->getProductListing(false, false, false, false);
         $this->list_tour_class = $model_tour_class->getTourClassList();
         $this->SetViewTitle();
         $this->addStandardDefaultViewCommands();
         $this->addStandardDefaultViewLists($model, 0, 'ASC');
         $this->departures = $model->getdepartureList(vRequest::getCmd('search'));
         $this->pagination = $model->getPagination();
     }
     parent::display($tpl);
 }
Exemple #16
0
 function fetchElement($name, $value, &$node, $control_name)
 {
     $cid = vRequest::getvar('cid', NULL, 'array');
     if (is_Array($cid)) {
         $virtuemart_paymentmethod_id = $cid[0];
     } else {
         $virtuemart_paymentmethod_id = $cid;
     }
     $http = JURI::root() . 'index.php?option=com_virtuemart&view=vmplg&task=notify&nt=ipn&tmpl=component&pm=' . $virtuemart_paymentmethod_id;
     $https = str_replace('http://', 'https://', $http);
     $class = $node->attributes('class') ? 'class="' . $node->attributes('class') . '"' : 'class="text_area"';
     if ($node->attributes('editable') == 'true') {
         $size = $node->attributes('size') ? 'size="' . $node->attributes('size') . '"' : '';
         return '<input type="text" name="' . $control_name . '[' . $name . ']" id="' . $control_name . $name . '" value="' . $value . '" ' . $class . ' ' . $size . ' />';
     } else {
         $string = "<div " . $class . ">";
         $string .= '<div class="ipn-sandbox">' . $http . ' <br /></div>';
         if (strcmp($https, $http) !== 0) {
             $string .= '<div class="ipn-sandbox">' . vmText::_('VMPAYMENT_AMAZON_OR') . '<br /></div>';
             $string .= $https;
             $string .= "</div>";
         }
         return $string;
     }
 }
Exemple #17
0
 function getListQuery()
 {
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('faq.*,categoryfaq.categoryfaq_name')->from('#__tsmart_faq AS faq')->leftJoin('#__tsmart_categoryfaq AS categoryfaq ON categoryfaq.tsmart_categoryfaq_id=faq.tsmart_categoryfaq_id');
     $user = JFactory::getUser();
     $shared = '';
     if (vmAccess::manager()) {
         //$query->where('transferaddon.shared=1','OR');
     }
     $search = vRequest::getCmd('search', false);
     if (empty($search)) {
         $search = vRequest::getString('search', false);
     }
     // add filters
     if ($search) {
         $db = JFactory::getDBO();
         $search = '"%' . $db->escape($search, true) . '%"';
         $query->where('faq.title LIKE ' . $search);
     }
     if (empty($this->_selectedOrdering)) {
         vmTrace('empty _getOrdering');
     }
     if (empty($this->_selectedOrderingDir)) {
         vmTrace('empty _selectedOrderingDir');
     }
     $query->order($this->_selectedOrdering . ' ' . $this->_selectedOrderingDir);
     return $query;
 }
Exemple #18
0
	/**
	 *
	 * Task for disabling dangerous database tools, used after install
	 * @author Max Milbers
	 */
	public function disableDangerousTools(){

		$data = vRequest::getRequest();
		$config = VmModel::getInstance('config', 'VirtueMartModel');
		$config->setDangerousToolsOff();
		$this->display();
	}
Exemple #19
0
 /**
  * Retireve a list of currencies from the database.
  * This function is used in the backend for the currency listing, therefore no asking if enabled or not
  * @author Max Milbers
  * @return object List of currency objects
  */
 function getCurrenciesList($search, $vendorId = 1)
 {
     $where = array();
     $user = JFactory::getUser();
     $shared = '';
     if (vmAccess::manager()) {
         $shared = 'OR `shared`="1"';
     }
     $vendorId = vmAccess::isSuperVendor();
     if ($vendorId) {
         $where[] = '(`virtuemart_vendor_id` = "' . (int) $vendorId . '" ' . $shared . ')';
     }
     if (empty($search)) {
         $search = vRequest::getString('search', false);
     }
     // add filters
     if ($search) {
         $db = JFactory::getDBO();
         $search = '"%' . $db->escape($search, true) . '%"';
         $where[] = '`currency_name` LIKE ' . $search . ' OR `currency_code_2` LIKE ' . $search . ' OR `currency_code_3` LIKE ' . $search;
     }
     $whereString = '';
     if (count($where) > 0) {
         $whereString = ' WHERE ' . implode(' AND ', $where);
     }
     $data = $this->exeSortSearchListQuery(0, '*', ' FROM `#__virtuemart_currencies`', $whereString, '', $this->_getOrdering());
     return $data;
 }
Exemple #20
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);
 }
Exemple #21
0
 function getListQuery()
 {
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('product.*,products_en_gb.product_name,tour_type.title AS tour_type,tour_style.title AS tour_style_name')->from('#__tsmart_products AS product')->leftJoin('#__tsmart_products_en_gb AS products_en_gb USING(tsmart_product_id)')->leftJoin('#__tsmart_tour_type AS tour_type USING(tsmart_tour_type_id)')->leftJoin('#__tsmart_tour_style AS tour_style USING(tsmart_tour_style_id)');
     $user = JFactory::getUser();
     $shared = '';
     if (vmAccess::manager()) {
         //$query->where('transferaddon.shared=1','OR');
     }
     $search = vRequest::getCmd('search', false);
     if (empty($search)) {
         $search = vRequest::getString('search', false);
     }
     // add filters
     if ($search) {
         $db = JFactory::getDBO();
         $search = '"%' . $db->escape($search, true) . '%"';
         $query->where('product.product_name LIKE ' . $search);
     }
     // Add the list ordering clause.
     $orderCol = $this->state->get('list.ordering', 'product.tsmart_product_id');
     $orderDirn = $this->state->get('list.direction', 'asc');
     if ($orderCol == 'product.ordering') {
         $orderCol = $db->quoteName('product.tsmart_product_id') . ' ' . $orderDirn . ', ' . $db->quoteName('product.ordering');
     }
     $query->order($db->escape($orderCol . ' ' . $orderDirn));
     return $query;
 }
Exemple #22
0
 function getListQuery()
 {
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('country.*,COUNT(states.tsmart_state_id) AS total_state')->from('#__tsmart_countries AS country')->leftJoin('#__tsmart_states AS states using (tsmart_country_id)')->leftJoin('#__tsmart_currencies AS currency using (tsmart_currency_id)')->select('currency.currency_name')->leftJoin('#__tsmart_language AS language using (tsmart_language_id)')->select('language.language_name')->group('country.tsmart_country_id');
     $user = JFactory::getUser();
     $shared = '';
     if (vmAccess::manager()) {
         //$query->where('transferaddon.shared=1','OR');
     }
     $search = vRequest::getCmd('search', false);
     if (empty($search)) {
         $search = vRequest::getString('search', false);
     }
     // add filters
     if ($search) {
         $db = JFactory::getDBO();
         $search = '"%' . $db->escape($search, true) . '%"';
         $query->where('country.country_name LIKE ' . $search);
     }
     // Add the list ordering clause.
     $orderCol = $this->state->get('list.ordering', 'country.tsmart_country_id');
     $orderDirn = $this->state->get('list.direction', 'asc');
     if ($orderCol == 'country.ordering') {
         $orderCol = $db->quoteName('country.tsmart_country_id') . ' ' . $orderDirn . ', ' . $db->quoteName('country.ordering');
     }
     $query->order($db->escape($orderCol . ' ' . $orderDirn));
     return $query;
 }
Exemple #23
0
 function display($tpl = null)
 {
     $document = JFactory::getDocument();
     $document->setMimeEncoding('application/json');
     if ($virtuemart_media_id = vRequest::getInt('virtuemart_media_id')) {
         //JResponse::setHeader( 'Content-Disposition', 'attachment; filename="media'.$virtuemart_media_id.'.json"' );
         $model = VmModel::getModel('Media');
         $image = $model->createMediaByIds($virtuemart_media_id);
         // 			echo '<pre>'.print_r($image,1).'</pre>';
         $this->json = $image[0];
         //echo json_encode($this->json);
         if (isset($this->json->file_url)) {
             $this->json->file_root = JURI::root(true) . '/';
             $this->json->msg = 'OK';
             echo @json_encode($this->json);
         } else {
             $this->json->msg = '<b>' . vmText::_('COM_VIRTUEMART_NO_IMAGE_SET') . '</b>';
             echo @json_encode($this->json);
         }
     } else {
         if (!class_exists('VmMediaHandler')) {
             require VMPATH_ADMIN . DS . 'helpers' . DS . 'mediahandler.php';
         }
         $start = vRequest::getInt('start', 0);
         $type = vRequest::getCmd('mediatype', 0);
         $list = VmMediaHandler::displayImages($type, $start);
         echo @json_encode($list);
     }
     jExit();
 }
 function display($tpl = null)
 {
     if (!class_exists('VmHTML')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
     }
     $this->SetViewTitle();
     $model = VmModel::getModel();
     $this->state = $model->getSingleState();
     $this->virtuemart_country_id = vRequest::getInt('virtuemart_country_id', $this->state->virtuemart_country_id);
     $isNew = count($this->state) < 1;
     if (empty($countryId) && $isNew) {
         vmWarn('Country id is 0');
         return false;
     }
     $country = VmModel::getModel('country');
     $country->setId($this->virtuemart_country_id);
     $this->country_name = $country->getData()->country_name;
     $layoutName = vRequest::getCmd('layout', 'default');
     if ($layoutName == 'edit') {
         $zoneModel = VmModel::getModel('Worldzones');
         $this->worldZones = $zoneModel->getWorldZonesSelectList();
         $this->addStandardEditViewCommands();
     } else {
         $this->addStandardDefaultViewCommands();
         $this->addStandardDefaultViewLists($model);
         $this->states = $model->getStates($this->virtuemart_country_id);
         $this->pagination = $model->getPagination();
     }
     parent::display($tpl);
 }
Exemple #25
0
 function getListQuery()
 {
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('payment.*')->from('#__tsmart_payment AS payment')->leftJoin('#__tsmart_currencies AS currencies USING(tsmart_currency_id)')->select('CONCAT(currencies.currency_code_3," ",currencies.currency_symbol) AS currency_symbol');
     //get list tour apply
     $query1 = $db->getQuery(true);
     $query1->select('GROUP_CONCAT(products_en_gb.product_name)')->from('#__tsmart_tour_id_payment_id AS tour_id_payment_id')->leftJoin('#__tsmart_products_en_gb AS products_en_gb USING(tsmart_product_id)')->where('tour_id_payment_id.tsmart_payment_id=payment.tsmart_payment_id');
     $query->select("({$query1}) AS list_tour");
     //end get list tour apply
     $user = JFactory::getUser();
     $shared = '';
     if (vmAccess::manager()) {
         //$query->where('payment.shared=1','OR');
     }
     $search = vRequest::getCmd('search', false);
     if (empty($search)) {
         $search = vRequest::getString('search', false);
     }
     // add filters
     if ($search) {
         $db = JFactory::getDBO();
         $search = '"%' . $db->escape($search, true) . '%"';
         $query->where('payment.title LIKE ' . $search);
     }
     if (empty($this->_selectedOrdering)) {
         vmTrace('empty _getOrdering');
     }
     if (empty($this->_selectedOrderingDir)) {
         vmTrace('empty _selectedOrderingDir');
     }
     $query->order($this->_selectedOrdering . ' ' . $this->_selectedOrderingDir);
     return $query;
 }
Exemple #26
0
 function getListQuery()
 {
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('hotel.*')->from('#__tsmart_hotel AS hotel')->leftJoin('#__tsmart_cityarea AS cityarea USING(tsmart_cityarea_id)')->leftJoin('#__tsmart_states AS states ON states.tsmart_state_id=cityarea.tsmart_state_id')->leftJoin('#__tsmart_countries AS countries ON countries.tsmart_country_id=states.tsmart_country_id')->select('CONCAT(cityarea.city_area_name,",",states.state_name,",",countries.country_name) AS location');
     $user = JFactory::getUser();
     $shared = '';
     if (vmAccess::manager()) {
         //$query->where('transferaddon.shared=1','OR');
     }
     $search = vRequest::getCmd('search', false);
     if (empty($search)) {
         $search = vRequest::getString('search', false);
     }
     // add filters
     if ($search) {
         $db = JFactory::getDBO();
         $search = '"%' . $db->escape($search, true) . '%"';
         $query->where('hotel.title LIKE ' . $search);
     }
     if (empty($this->_selectedOrdering)) {
         vmTrace('empty _getOrdering');
     }
     if (empty($this->_selectedOrderingDir)) {
         vmTrace('empty _selectedOrderingDir');
     }
     $query->order($this->_selectedOrdering . ' ' . $this->_selectedOrderingDir);
     //echo $query->dump();
     return $query;
 }
Exemple #27
0
 function display($tpl = null)
 {
     // Load the helper(s)
     if (!class_exists('VmHTML')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
     }
     $model = tmsModel::getModel();
     $config = JFactory::getConfig();
     $layoutName = vRequest::getCmd('layout', 'default');
     if ($layoutName == 'edit') {
         $cid = vRequest::getInt('cid');
         $task = vRequest::getCmd('task', 'add');
         if ($task != 'add' && !empty($cid) && !empty($cid[0])) {
             $cid = (int) $cid[0];
         } else {
             $cid = 0;
         }
         $model->setId($cid);
         $this->item = $model->getItem();
         $this->SetViewTitle('', $this->item->title);
         $this->addStandardEditViewCommandsPopup();
     } else {
         $this->SetViewTitle();
         $this->addStandardDefaultViewCommandsEditInline();
         $this->addStandardDefaultViewLists($model, 0, 'ASC');
         $this->items = $model->getItemList(vRequest::getCmd('search', false));
         $this->pagination = $model->getPagination();
     }
     parent::display($tpl);
 }
Exemple #28
0
 /**
  * We want to allow html so we need to overwrite some request data
  *
  * @author Max Milbers
  */
 function save($data = 0)
 {
     $data = vRequest::getRequest();
     $data['currency_positive_style'] = vRequest::getHtml('currency_positive_style', '');
     $data['currency_negative_style'] = vRequest::getHtml('currency_negative_style', '');
     parent::save($data);
 }
Exemple #29
0
 function display($tpl = null)
 {
     // Load the helper(s)
     if (!class_exists('VmHTML')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
     }
     $this->setLayout('default');
     $model = tmsModel::getModel();
     $app = JFactory::getApplication();
     $task = $app->input->getString('task', '');
     $config = JFactory::getConfig();
     $layoutName = vRequest::getCmd('layout', 'default');
     $this->tsmart_product_id = $app->input->get('tsmart_product_id', 0, 'int');
     require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmproduct.php';
     $this->SetViewTitle();
     JToolBarHelper::publishList();
     JToolBarHelper::unpublishList();
     JToolBarHelper::editList();
     JToolBarHelper::addNew();
     JToolBarHelper::deleteList();
     $model->setDefaultValidOrderingFields('itinerary');
     $this->addStandardDefaultViewLists($model, 0, 'ASC');
     $this->state = $model->getState();
     $this->filterForm = $this->getFilterForm();
     $this->items = $model->getItemList(vRequest::getCmd('search', false));
     $this->pagination = $model->getPagination();
     if ($task == 'edit' || $task == 'add') {
         require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/vmcities.php';
         $this->item = $model->getItem();
         $cities = tsmcities::get_cities();
         $this->assignRef('cities', $cities);
     }
     parent::display($tpl);
 }
Exemple #30
0
 function getListQuery()
 {
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('group_size.*')->from('#__tsmart_group_size AS group_size');
     $user = JFactory::getUser();
     $shared = '';
     if (vmAccess::manager()) {
         //$query->where('transferaddon.shared=1','OR');
     }
     $search = vRequest::getCmd('search', false);
     if (empty($search)) {
         $search = vRequest::getString('search', false);
     }
     // add filters
     if ($search) {
         $db = JFactory::getDBO();
         $search = '"%' . $db->escape($search, true) . '%"';
         $query->where('group_size.group_name LIKE ' . $search);
     }
     if (empty($this->_selectedOrdering)) {
         vmTrace('empty _getOrdering');
     }
     if (empty($this->_selectedOrderingDir)) {
         vmTrace('empty _selectedOrderingDir');
     }
     $query->order('group_size.' . $this->_selectedOrdering . ' ' . $this->_selectedOrderingDir);
     //echo $query->dump();
     return $query;
 }