예제 #1
0
 function display($tpl = null)
 {
     $this->config = JBFactory::getConfig();
     $input = JFactory::getApplication()->input;
     AImporter::model('tour');
     $cart = JModelLegacy::getInstance('TourCart', 'bookpro');
     $cart->load();
     $cart->clear();
     $model = new BookProModelTour();
     $id = $input->getInt('id');
     $this->tour = $model->getComplexItem($id);
     $this->itineraries = TourHelper::buildItinerary($id);
     //$this->packages	= $packages;
     $date = TourHelper::getDateFirstInPackagerateFromTourid($this->tour->id);
     $this->date = JFactory::getDate($date)->format(DateHelper::getConvertDateFormat('P'));
     $this->tour->rdate = $this->date;
     $dispatcher = JDispatcher::getInstance();
     //$this->_prepareDocument();
     //		$dispatcher		= JDispatcher::getInstance();
     //		$this->event 	= new stdClass();
     //		JPluginHelper::importPlugin('bookpro');
     //		$results 		= $dispatcher->trigger('onBookproProductAfterTitle', array ($this->tour));
     //		$this->event->afterDisplayTitle=isset($results[0])?$results[0]:null;
     parent::display($tpl);
 }
예제 #2
0
 function display($tpl = null)
 {
     $this->input = JFactory::getApplication()->input;
     $order_number = $this->input->getString('order_number');
     $email = $this->input->getString('email');
     if ($order_number) {
         $orderModel = new BookProModelOrder();
         $order = $orderModel->getByOrderNumber($order_number);
         $order_id = $order->id;
         $model = new BookProModelOrder();
         $this->orderComplex = $model->getComplexItem($order_id);
         if ($this->orderComplex->customer->email == $email) {
             $this->config = JBFactory::getConfig();
             $this->order = $this->orderComplex->order;
             $this->customer = $this->orderComplex->customer;
             $this->orderinfo = $this->orderComplex->orderinfo;
             $this->passengers = $this->orderComplex->passengers;
             $this->tour = $this->orderComplex->tour;
         } else {
             JFactory::getApplication()->enqueueMessage(JText::_('COM_BOOKPRO_WRONG_ORDER_NUMBER_OR_EMAIL_WARN'));
             $this->setLayout('check');
         }
     } else {
         $this->setLayout('check');
     }
     parent::display($tpl);
 }
예제 #3
0
 function display($tpl = null)
 {
     $this->document = JFactory::getDocument();
     $user = JFactory::getUser();
     $config = JBFactory::getConfig();
     if ($user->id && in_array($config->get('supplier_usergroup'), $user->groups)) {
         JFactory::getApplication()->redirect(JUri::base() . 'index.php?option=com_bookpro&view=supplierpage&Itemid=' . JRequest::getVar('Itemid'));
     }
     $this->document->setTitle(JText::_('COM_BOOKPRO_REGISTER_VIEW'));
     parent::display($tpl);
 }
예제 #4
0
 public function EmailHelper($order_id = null)
 {
     $this->config = JBFactory::getConfig();
     if ($order_id) {
         AImporter::model('order', 'customer', 'orderinfos');
         $orderModel = new BookProModelOrder();
         $this->orderComplex = $orderModel->getComplexItem($order_id);
         $this->order = $this->orderComplex->order;
         $this->orderinfo = $this->orderComplex->orderinfo;
         $this->customer = $this->orderComplex->customer;
         $applicationModel = new BookProModelApplication();
         $this->app = $applicationModel->getItemByCode($this->order->type);
         $config = jcomponenthelper::getParams('com_bookpro');
         $cdct = JTable::getInstance('Content', 'JTable');
         $cdct->load(array('id' => $config->get('term_content_id')));
         $this->app->cdct = $cdct;
     }
 }
예제 #5
0
 public function display($tpl = null)
 {
     $model = new BookProModelOrders();
     $this->setModel($model, true);
     $this->state = $this->get('State');
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     $this->orderstatus = $this->getOrderStatusSelect($this->state->get('filter.order_status'));
     $this->paystatus = $this->getPayStatusSelect($this->state->get('filter.pay_status'));
     $this->ordertypes = $this->getOrderTypeSelect($this->state->get('filter.order_type'));
     $this->agent = JBFactory::getAccount();
     $this->state->set('filter.user_id', $this->agent->id);
     $this->config = JBFactory::getConfig();
     $this->authorise = $this->agent->authorise;
     $group_id = $this->state->get('filter.group_id');
     if (is_null($group_id)) {
         $this->state->set('filter.group_id', $this->config->agent_usergroup);
     }
     parent::display($tpl);
 }
예제 #6
0
/**
 * @package 	Bookpro
 * @author 		Ngo Van Quan
 * @link 		http://joombooking.com
 * @copyright 	Copyright (C) 2011 - 2012 Ngo Van Quan
 * @license 	GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 * @version 	$Id: bookpro.php 80 2012-08-10 09:25:35Z quannv $
 **/
// no direct access
defined('_JEXEC') or die('Restricted access');
AImporter::helper('date');
JHtml::_('bootstrap.tooltip');
JHtml::_('behavior.multiselect');
JHtml::_('dropdown.init');
JHtml::_('formbehavior.chosen', 'select');
$config = JBFactory::getConfig();
BookProHelper::setSubmenu(1);
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$sortFields = array();
if ($config->ps_gender) {
    $sortFields['a.gender'] = JText::_('COM_BOOKPRO_PASSENGER_GENDER');
}
if ($config->ps_firstname) {
    $sortFields['a.firstname'] = JText::_('COM_BOOKPRO_PASSENGER_FIRSTNAME');
}
if ($config->ps_lastname) {
    $sortFields['a.lastname'] = JText::_('COM_BOOKPRO_PASSENGER_LASTNAME');
}
if ($config->ps_birthday) {
    $sortFields['a.birthday'] = JText::_('COM_BOOKPRO_PASSENGER_BIRTHDAY');
예제 #7
0
 function register()
 {
     AImporter::helper('bookpro');
     JSession::checkToken() or die(JText::_('Invalid Token'));
     $config = JBFactory::getConfig();
     $mainframe = JFactory::getApplication();
     $user = JFactory::getUser();
     $params = JComponentHelper::getParams('com_users');
     $useractivation = $params->get('useractivation');
     $input = $mainframe->input;
     $post = $input->getArray($_POST);
     $db = JFactory::getDbo();
     try {
         $db->transactionStart();
         $post['name'] = $post['firstname'] . ' ' . $post['lastname'];
         $cuser = new JUser();
         $cuser->bind($post);
         $cuser->name = $post['name'];
         //check Username
         if (!$this->checkUsernamePHP($post['username'])) {
             $mainframe->enqueueMessage(JText::_('COM_BOOKPRO_USERNAME_EXISTS'), 'warning');
             $view = $this->getView('register', 'html', 'BookProView');
             $view->assign('customer', (object) $post);
             $view->display();
             return;
         }
         if (!$this->checkEmailPHP($post['email'])) {
             $mainframe->enqueueMessage(JText::_('COM_BOOKPRO_EMAIL_EXISTS'), 'warning');
             $view = $this->getView('register', 'html', 'BookProView');
             $view->assign('obj', (object) $post);
             $view->display();
             return;
         }
         $cuser->activation = $useractivation;
         if ($post['group_id']) {
             $cuser->groups = array($post['group_id']);
         } else {
             $cuser->groups = array($config->get('customer_usergroup', 2));
         }
         $cuser->sendEmail = 1;
         $cuser->registerDate = JFactory::getDate()->toSql();
         $cuser->save();
         AImporter::classes('customer');
         $jbuser = new BookproCustomer();
         $post['user'] = $cuser->id;
         $post['state'] = 1;
         $jbuser->saveNewCustomer($post);
         $db->transactionCommit();
     } catch (Exception $e) {
         $mainframe->enqueueMessage($e->getMessage());
         $db->transactionRollback();
         $this->setRedirect(JUri::base() . 'index.php?option=com_bookpro&view=register');
     }
     if ($useractivation == 1 || $useractivation == 2) {
         $post['activation'] = JApplication::getHash(JUserHelper::genRandomPassword());
         $post['block'] = 1;
     }
     //handle email notification
     if ($useractivation == 1) {
         $config = JFactory::getConfig();
         $post['fromname'] = $config->get('fromname');
         $post['mailfrom'] = $config->get('mailfrom');
         $post['sitename'] = $config->get('sitename');
         $post['siteurl'] = JUri::root();
         $post['activate'] = JUri::base() . 'index.php?option=com_users&task=registration.activate&token=' . $post['activation'];
         $emailSubject = JText::sprintf('COM_BOOKPRO_EMAIL_ACCOUNT_DETAILS', $post['name'], JUri::base());
         $emailBody = JText::sprintf('COM_BOOKPRO_EMAIL_REGISTERED_WITH_ACTIVATION_BODY', $post['name'], $post['sitename'], $post['activate'], JUri::base(), $post['username']);
         $return = JFactory::getMailer()->sendMail($post['mailfrom'], $post['fromname'], $post['email'], $emailSubject, $emailBody);
     }
     //redirect to complete view
     if ($useractivation == 1 || $useractivation == 2) {
         $this->setMessage(JText::_('COM_USERS_REGISTRATION_COMPLETE_ACTIVATE'));
         $this->setRedirect(JRoute::_('index.php?option=com_users&view=registration&layout=complete', false));
         return;
     }
     AImporter::helper('email');
     $mailer = new EmailHelper();
     if (isset($config->sendRegistrationsEmails) && $config->sendRegistrationsEmails > 0) {
         $mailer->registerNotify($id);
     }
     if ($config->get('auto_login')) {
         $options = array();
         $options['remember'] = JRequest::getBool('remember', true);
         $credentials['username'] = JRequest::getVar('username', '', 'method', 'username');
         $credentials['password'] = JRequest::getString('password', '', 'post', JREQUEST_ALLOWRAW);
         $error = $mainframe->login($credentials, $options);
     }
     $return = JRequest::getVar('return');
     if ($return) {
         $mainframe->redirect(base64_decode($return));
     } else {
         $mainframe->redirect(JURI::base() . 'index.php');
     }
 }
예제 #8
0
 private function _checkUserRight($vName, $views)
 {
     $customer = JBFactory::getAccount();
     $config = JBFactory::getConfig();
     $checked = false;
     //echo "<pre>";print_r($views);die;
     if (in_array($vName, $views[$config->get('supplier_usergroup')]) && $customer->isSupplier) {
         $checked = true;
     }
     if (in_array($vName, $views[$config->get('customer_usergroup')]) && $customer->isNormal) {
         $checked = true;
     }
     if (in_array($vName, $views[$config->get('agent_usergroup')]) && $customer->isAgent) {
         $checked = true;
     }
     return $checked;
 }