function display($tpl = null, $preparecontent = false)
 {
     // Initialise variables
     $config = JComponentHelper::getParams('com_bookingforconnector');
     $state = $this->get('State');
     $items = $this->get('Items');
     $pagination = $this->get('Pagination');
     $ordering = $state->get('list.ordering');
     $direction = $state->get('list.direction');
     $document = JFactory::getDocument();
     $language = $document->getLanguage();
     $params = $state->params;
     // add stylesheet
     $document->addStyleSheet('components/com_bookingforconnector/assets/css/bookingfor.css');
     $document->addStyleSheet('components/com_bookingforconnector/assets/css/bookingfor-responsive.css');
     $document->addScript('components/com_bookingforconnector/assets/js/bf.js');
     $document->addScript('components/com_bookingforconnector/assets/js/jquery.xml2json.js');
     $document->addScript('components/com_bookingforconnector/assets/js/jquery.shorten.js');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     $pagination->setAdditionalUrlParam("filter_order", $ordering);
     $pagination->setAdditionalUrlParam("filter_order_Dir", $direction);
     $this->assignRef('state', $state);
     $this->assignRef('params', $params);
     $this->assignRef('items', $items);
     $this->assignRef('pagination', $pagination);
     $this->assignRef('language', $language);
     $this->assignRef('config', $config);
     // Display the view
     parent::display($tpl);
 }
 function display($tpl = NULL, $preparecontent = false)
 {
     $document = JFactory::getDocument();
     // load scripts
     $document->addStyleSheet('components/com_bookingforconnector/assets/css/jquery.validate.css');
     // load scripts
     $document->addScript('components/com_bookingforconnector/assets/js/jquery.form.js');
     $document->addScript('components/com_bookingforconnector/assets/js/jquery.validate.min.js');
     $document->addScript('components/com_bookingforconnector/assets/js/additional-methods.min.js');
     //load scripts wizard
     $document->addScript('components/com_bookingforconnector/assets/js/bbq.js');
     $document->addScript('components/com_bookingforconnector/assets/js/jquery.form.wizard.js');
     // Initialise variables
     $state = $this->get('State');
     $actionform = JRequest::getVar('actionform', "");
     $item = $this->get('Item');
     if ($actionform == "insert") {
         $item = $this->getModel()->setCrew();
         /*$item = $this->get('Item');*/
     }
     $params = $state->params;
     $language = $document->getLanguage();
     $this->assignRef('state', $state);
     $this->assignRef('params', $params);
     $this->assignRef('language', $language);
     $this->assignRef('actionform', $actionform);
     $this->assignRef('item', $item);
     // Display the view
     parent::display($tpl, true);
 }
Example #3
0
 function display($tpl = null, $preparecontent = false)
 {
     // Initialise variables
     $state = $this->get('State');
     $item = $this->get('Item');
     $document = JFactory::getDocument();
     $language = $document->getLanguage();
     $params = $state->params;
     $stay = $this->get('Stay');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     $this->setBreadcrumb($item, 'resources', $language);
     $this->assignRef('state', $state);
     $this->assignRef('params', $params);
     $this->assignRef('item', $item);
     $this->assignRef('stay', $stay);
     $this->assignRef('document', $document);
     $this->assignRef('language', $language);
     // Display the view
     //parent::display($tpl);
     parent::display($tpl, true);
 }
Example #4
0
 function display($tpl = null)
 {
     // Initialise variables
     $state = $this->get('State');
     $item = $this->get('Item');
     $document = JFactory::getDocument();
     $language = $document->getLanguage();
     $params = $state->params;
     if (JRequest::getString('layout') == 'resourcesajax') {
         $items = $this->get('ItemsResourcesAjax');
     }
     if (JRequest::getString('layout') == 'resources') {
         $items = $this->get('Items');
         $pagination = $this->get('Pagination');
     }
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     $this->assignRef('state', $state);
     $this->assignRef('params', $params);
     $this->assignRef('item', $item);
     $this->assignRef('items', $items);
     $this->assignRef('document', $document);
     $this->assignRef('language', $language);
     // Display the view
     //parent::display($tpl);
     parent::display($tpl, true);
 }
 function display($tpl = NULL, $preparecontent = false)
 {
     // Initialise variables
     $state = $this->get('State');
     $items = $this->get('Items');
     $pagination = $this->get('Pagination');
     $sortColumn = $state->get('list.ordering');
     $sortDirection = $state->get('list.direction');
     $document = JFactory::getDocument();
     // load scripts
     $document->addStyleSheet('components/com_bookingforconnector/assets/css/jquery.validate.css');
     // load scripts
     $document->addScript('components/com_bookingforconnector/assets/js/jquery.form.js');
     $document->addScript('components/com_bookingforconnector/assets/js/jquery.validate.min.js');
     $document->addScript('components/com_bookingforconnector/assets/js/additional-methods.min.js');
     //load scripts wizard
     $document->addScript('components/com_bookingforconnector/assets/js/bbq.js');
     $document->addScript('components/com_bookingforconnector/assets/js/jquery.form.wizard.js');
     // Initialise variables
     $pagination->setAdditionalUrlParam("filter_order", $sortColumn);
     $pagination->setAdditionalUrlParam("filter_order_Dir", $sortDirection);
     //		$params = $state->params;
     $language = $document->getLanguage();
     $this->assignRef('state', $state);
     //		$this->assignRef('params', $params);
     $this->assignRef('language', $language);
     $this->assignRef('items', $items);
     $this->assignRef('pagination', $pagination);
     // Display the view
     parent::display($tpl, true);
 }
 function display($tpl = null)
 {
     // Initialise variables
     $state = $this->get('State');
     $items = $this->get('Items');
     $pagination = $this->get('Pagination');
     $sortColumn = $state->get('list.ordering');
     $sortDirection = $state->get('list.direction');
     $document = JFactory::getDocument();
     $language = $document->getLanguage();
     $params = $state->params;
     // add stylesheet
     $document->addStylesheet(COM_BOOKINGFORCONNECTOR_SCRIPT_PATH . 'assets/css/bookingfor.css');
     $document->addStylesheet(COM_BOOKINGFORCONNECTOR_SCRIPT_PATH . 'assets/css/bookingfor-responsive.css');
     // load scripts
     $document->addScript(COM_BOOKINGFORCONNECTOR_SCRIPT_PATH . 'assets/js/bf.js');
     $document->addScript(COM_BOOKINGFORCONNECTOR_SCRIPT_PATH . 'assets/js/jquery.xml2json.js');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     $pagination->setAdditionalUrlParam("filter_order", $ordering);
     $pagination->setAdditionalUrlParam("filter_order_Dir", $direction);
     $this->assignRef('state', $state);
     $this->assignRef('params', $params);
     $this->assignRef('items', $items);
     $this->assignRef('pagination', $pagination);
     $this->assignRef('language', $language);
     // Display the view
     parent::display($tpl);
 }
Example #7
0
 function display($tpl = NULL, $preparecontent = false)
 {
     // Initialise variables
     $state = $this->get('State');
     $items = $this->get('Items');
     $pagination = $this->get('Pagination');
     $sortColumn = $state->get('list.ordering');
     $sortDirection = $state->get('list.direction');
     $typologies = $this->getModel()->getMasterTypologies();
     $document = JFactory::getDocument();
     $language = $document->getLanguage();
     $params = $state->params;
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     $pagination->setAdditionalUrlParam("filter_order", $sortColumn);
     $pagination->setAdditionalUrlParam("filter_order_Dir", $sortDirection);
     $pagination->setAdditionalUrlParam("searchid", $params['searchid']);
     $this->assignRef('state', $state);
     $this->assignRef('params', $params);
     $this->assignRef('items', $items);
     $this->assignRef('pagination', $pagination);
     $this->assignRef('language', $language);
     $this->assignRef('typologies', $typologies);
     // Display the view
     parent::display($tpl, true);
 }
    function display($tpl = null, $preparecontent = false)
    {
        $document = JFactory::getDocument();
        $language = $document->getLanguage();
        $config = JComponentHelper::getParams('com_bookingforconnector');
        $app = JFactory::getApplication();
        // add stylesheet
        $document->addStyleSheet('components/com_bookingforconnector/assets/css/bookingfor.css');
        $document->addStyleSheet('components/com_bookingforconnector/assets/css/bookingfor-responsive.css');
        $document->addStyleSheet('//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css');
        // load scripts
        $document->addScript('//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js');
        $document->addScript('components/com_bookingforconnector/assets/js/bf.js');
        $document->addScript('components/com_bookingforconnector/assets/js/jquery.xml2json.js');
        $document->addScript('components/com_bookingforconnector/assets/js/jquery.shorten.js');
        // Initialise variables
        $state = $this->get('State');
        $params = $state->params;
        $items = $this->get('Items');
        $pagination = $this->get('Pagination');
        $sortColumn = $state->get('list.ordering');
        $sortDirection = $state->get('list.direction');
        $startswith = $params['startswith'];
        $searchseed = $params['searchseed'];
        // Check for errors.
        if (count($errors = $this->get('Errors'))) {
            JError::raiseWarning(500, implode("\n", $errors));
            return false;
        }
        $merchantsCriteo = isset($items) && !empty($items) ? array_unique(array_map(function ($a) {
            return $a->MerchantId;
        }, $items)) : array();
        $criteoConfig = BFCHelper::getCriteoConfiguration(1, $merchantsCriteo);
        if (isset($criteoConfig) && isset($criteoConfig->enabled) && $criteoConfig->enabled && count($criteoConfig->merchants) > 0) {
            $document->addScript('//static.criteo.net/js/ld/ld.js');
            $document->addScriptDeclaration('window.criteo_q = window.criteo_q || []; 
			window.criteo_q.push( 
				{ event: "setAccount", account: ' . $criteoConfig->campaignid . '}, 
				{ event: "setSiteType", type: "d" }, 
				{ event: "setEmail", email: "" }, 
				{ event: "viewList", item: ' . json_encode($criteoConfig->merchants) . ' }
			);');
        }
        $analyticsEnabled = count($items) > 0 && $this->checkAnalytics("Merchants List") && $config->get('eecenabled', 0) == 1;
        $pagination->setAdditionalUrlParam("filter_order", $sortColumn);
        $pagination->setAdditionalUrlParam("filter_order_Dir", $sortDirection);
        $pagination->setAdditionalUrlParam("startswith", $startswith);
        $pagination->setAdditionalUrlParam("searchseed", $searchseed);
        $this->assignRef('state', $state);
        $this->assignRef('params', $params);
        $this->assignRef('items', $items);
        $this->assignRef('pagination', $pagination);
        $this->assignRef('language', $language);
        $this->assignRef('config', $config);
        $this->assignRef('analyticsEnabled', $analyticsEnabled);
        // Display the view
        parent::display($tpl);
    }
 function display($tpl = NULL, $preparecontent = false)
 {
     $document = JFactory::getDocument();
     $app = JFactory::getApplication();
     $sitename = $app->get('sitename');
     $config = JComponentHelper::getParams('com_bookingforconnector');
     // load scripts
     $document->addStyleSheet('components/com_bookingforconnector/assets/css/jquery.validate.css');
     $document->addScript('components/com_bookingforconnector/assets/js/jquery.maskedinput.min.js');
     $document->addScript('components/com_bookingforconnector/assets/js/jquery.validate.min.js');
     $document->addScript('components/com_bookingforconnector/assets/js/additional-methods.min.js');
     $document->addScript('components/com_bookingforconnector/assets/js/jquery.validate.additional-custom-methods.js');
     // Initialise variables
     $state = $this->get('State');
     $actionform = JRequest::getVar('actionform', "");
     if ($actionform == "login") {
         $item = $this->get('Item');
         /*$item = "fet";*/
     }
     //inserimeto dell'email dell'ordine altrimnenti non si può continuare con i pagamenti
     if ($actionform == "insertemail") {
         $orderId = JRequest::getVar('orderId', "");
         $email = JRequest::getVar('email', "");
         $model = $this->getModel();
         $item = $model->updateEmail($orderId, $email);
         /*$item = "fet";*/
     }
     $params = $state->params;
     $language = $document->getLanguage();
     $this->assignRef('state', $state);
     $this->assignRef('params', $params);
     $this->assignRef('language', $language);
     $this->assignRef('item', $item);
     $this->assignRef('sitename', $sitename);
     $this->assignRef('config', $config);
     $this->assignRef('actionform', $actionform);
     /*
     		$items		= $this->get('Items');
     		$pagination	= $this->get('Pagination');
     		$sortColumn 	= $state->get('list.ordering');
     		$sortDirection 	= $state->get('list.direction');
     
     // Check for errors.
     		if (count($errors = $this->get('Errors'))) {
     			JError::raiseWarning(500, implode("\n", $errors));
     			return false;
     		}
     $pagination->setAdditionalUrlParam("filter_order", $ordering);
     		$pagination->setAdditionalUrlParam("filter_order_Dir", $direction);
     
     
     $this->assignRef('items', $items);
     		$this->assignRef('pagination', $pagination);
     */
     // Display the view
     parent::display($tpl, true);
 }
Example #10
0
 function display($tpl = NULL, $preparecontent = false)
 {
     // Initialise variables
     $document = JFactory::getDocument();
     $language = $document->getLanguage();
     $config = JComponentHelper::getParams('com_bookingforconnector');
     $state = $this->get('State');
     $params = $state->params;
     $hashunsubscribe = JRequest::getVar('hash');
     // controllo per eventuale redirect in caso la pagina sia chiamata ma non ci siano parametri corretti
     if (!isset($params) && empty($hashunsubscribe)) {
         header("Location: " . JURI::root());
         $app = JFactory::getApplication();
         $app->close();
     }
     $items = $this->get('Items');
     $pagination = $this->get('Pagination');
     $sortColumn = $state->get('list.ordering');
     $sortDirection = $state->get('list.direction');
     $typologies = $this->getModel()->getMasterTypologies(true, $language);
     // add stylesheet
     JHTML::stylesheet('components/com_bookingforconnector/assets/css/bookingfor.css');
     JHTML::stylesheet('components/com_bookingforconnector/assets/css/bookingfor-responsive.css');
     // load scripts
     $document->addScript('components/com_bookingforconnector/assets/js/bf.js');
     $document->addScript('components/com_bookingforconnector/assets/js/jquery.xml2json.js');
     $document->addScript('components/com_bookingforconnector/assets/js/jquery.shorten.js');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     $pagination->setAdditionalUrlParam("filter_order", $sortColumn);
     $pagination->setAdditionalUrlParam("filter_order_Dir", $sortDirection);
     $pagination->setAdditionalUrlParam("searchid", $params['searchid']);
     if (!empty($params['zoneIds'])) {
         $pagination->setAdditionalUrlParam("zoneIds", $params['zoneIds']);
     }
     if (!empty($params['zoneId'])) {
         $pagination->setAdditionalUrlParam("zoneId", $params['zoneId']);
     }
     $this->assignRef('state', $state);
     $this->assignRef('params', $params);
     $this->assignRef('items', $items);
     $this->assignRef('pagination', $pagination);
     $this->assignRef('document', $document);
     $this->assignRef('language', $language);
     $this->assignRef('hashunsubscribe', $hashunsubscribe);
     $this->assignRef('typologies', $typologies);
     $this->assignRef('config', $config);
     // Display the view
     parent::display($tpl, true);
 }
Example #11
0
 function display($tpl = null, $preparecontent = false)
 {
     $config = JComponentHelper::getParams('com_bookingforconnector');
     $document = JFactory::getDocument();
     $language = $document->getLanguage();
     // add stylesheet
     JHTML::stylesheet('components/com_bookingforconnector/assets/css/bookingfor.css');
     JHTML::stylesheet('components/com_bookingforconnector/assets/css/bookingfor-responsive.css');
     // load scripts
     $document->addScript('components/com_bookingforconnector/assets/js/bf.js');
     $document->addScript('components/com_bookingforconnector/assets/js/jquery.xml2json.js');
     $document->addScript('components/com_bookingforconnector/assets/js/jquery.shorten.js');
     // Initialise variables
     $state = $this->get('State');
     $params = $state->params;
     $sortColumn = $state->get('list.ordering');
     $sortDirection = $state->get('list.direction');
     $currentLayout = JRequest::getString('layout');
     if ($currentLayout == 'favorites') {
         $items = $this->get('ItemsFavorites');
     } else {
         $show_latest = JRequest::getVar('show_latest', 0);
         $params['show_latest'] = $show_latest;
         //		$isportal = JRequest::getString('isportal');
         $isportal = $config->get('isportal', 1);
         if (!$isportal) {
             $this->setLayout("merchantdefault");
         }
         if ($params['show_latest']) {
             $items = $this->get('ItemsLatest');
             $pagination = $this->get('PaginationLatest');
         } else {
             $items = $this->get('Items');
             $pagination = $this->get('Pagination');
         }
         $pagination->setAdditionalUrlParam("filter_order", $sortColumn);
         $pagination->setAdditionalUrlParam("filter_order_Dir", $sortDirection);
         $pagination->setAdditionalUrlParam("locationzones", $params['locationzones']);
     }
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     $this->assignRef('state', $state);
     $this->assignRef('params', $params);
     $this->assignRef('items', $items);
     $this->assignRef('pagination', $pagination);
     $this->assignRef('language', $language);
     $this->assignRef('config', $config);
     // Display the view
     parent::display($tpl);
 }
Example #12
0
 function display($tpl = null, $preparecontent = false)
 {
     // Initialise variables
     $document = JFactory::getDocument();
     $language = $document->getLanguage();
     $config = JComponentHelper::getParams('com_bookingforconnector');
     $app = JFactory::getApplication();
     $session = JFactory::getSession();
     $state = $this->get('State');
     $params = $state->params;
     if (!isset($params) || empty($params['checkin'])) {
         header("Location: " . JURI::root());
         $app->close();
     }
     $items = $this->get('Items');
     $pagination = $this->get('Pagination');
     $sortColumn = $state->get('list.ordering');
     $sortDirection = $state->get('list.direction');
     $typologies = $this->getModel()->getMasterTypologies(true, $language);
     // add stylesheet
     JHTML::stylesheet('components/com_bookingforconnector/assets/css/bookingfor.css');
     JHTML::stylesheet('components/com_bookingforconnector/assets/css/bookingfor-responsive.css');
     $document->addStyleSheet('components/com_bookingforconnector/assets/css/jquery.validate.css');
     // load scripts
     $document->addScript('components/com_bookingforconnector/assets/js/bf.js');
     $document->addScript('components/com_bookingforconnector/assets/js/jquery.xml2json.js');
     $document->addScript('components/com_bookingforconnector/assets/js/jquery.shorten.js');
     $document->addScript('components/com_bookingforconnector/assets/js/jquery.validate.min.js');
     $document->addScript('components/com_bookingforconnector/assets/js/additional-methods.min.js');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     $pagination->setAdditionalUrlParam("filter_order", $sortColumn);
     $pagination->setAdditionalUrlParam("filter_order_Dir", $sortDirection);
     $pagination->setAdditionalUrlParam("searchid", $params['searchid']);
     $pagination->setAdditionalUrlParam("newsearch", 0);
     $this->assignRef('state', $state);
     $this->assignRef('params', $params);
     $this->assignRef('items', $items);
     $this->assignRef('pagination', $pagination);
     $this->assignRef('language', $language);
     $this->assignRef('typologies', $typologies);
     $this->assignRef('config', $config);
     // Display the view
     parent::display($tpl, true);
 }
 function display($tpl = null)
 {
     // Initialise variables
     $state = $this->get('State');
     $item = $this->get('Item');
     $params = $state->params;
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     $this->assignRef('state', $state);
     $this->assignRef('params', $params);
     $this->assignRef('items', $items);
     // Display the view
     $this->setLayout('json');
     parent::display($tpl);
 }
 function display($tpl = NULL, $preparecontent = false)
 {
     $document = JFactory::getDocument();
     $language = $document->getLanguage();
     $config = JComponentHelper::getParams('com_bookingforconnector');
     $app = JFactory::getApplication();
     // Initialise variables
     $state = $this->get('State');
     $items = $this->get('Items');
     $pagination = $this->get('Pagination');
     $sortColumn = $state->get('list.ordering');
     $sortDirection = $state->get('list.direction');
     $params = $state->params;
     $typologies = $this->getModel()->getMasterTypologies(true, $language);
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     $pagination->setAdditionalUrlParam("filter_order", $sortColumn);
     $pagination->setAdditionalUrlParam("filter_order_Dir", $sortDirection);
     $pagination->setAdditionalUrlParam("searchid", $params['searchid']);
     $filters = BFCHelper::getFilterSearchParamsSession();
     if (!empty($filters)) {
         foreach ($filters as $key => $value) {
             $pagination->setAdditionalUrlParam("filters[" . $key . "]", $value);
         }
     }
     $hidesort = false;
     $this->assignRef('state', $state);
     $this->assignRef('params', $params);
     $this->assignRef('items', $items);
     $this->assignRef('pagination', $pagination);
     $this->assignRef('language', $language);
     $this->assignRef('typologies', $typologies);
     $this->assignRef('config', $config);
     $this->assignRef('hidesort', $hidesort);
     $maxItemsView = 3;
     $this->assignRef('maxItemsView', $maxItemsView);
     $analyticsEnabled = $this->checkAnalytics("");
     $this->assignRef('analyticsEnabled', $analyticsEnabled);
     // Display the view
     parent::display($tpl, true);
 }
 function display($tpl = null, $preparecontent = false)
 {
     // Initialise variables
     $state = $this->get('State');
     $params = $state->params;
     //$items		= $this->get('Items');
     $model = $this->getModel();
     $items = $model->getMapResourcesFromService(true);
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     $this->assignRef('state', $state);
     $this->assignRef('params', $params);
     $this->assignRef('items', $items);
     // Display the view
     $this->setLayout('json');
     parent::display($tpl);
 }
 function display($tpl = null, $preparecontent = false)
 {
     $config = JComponentHelper::getParams('com_bookingforconnector');
     // Initialise variables
     $state = $this->get('State');
     //$items		= $this->get('Items');
     $model = $this->getModel();
     $items = $model->getItems(true, true);
     $params = $state->params;
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     $this->assignRef('state', $state);
     $this->assignRef('params', $params);
     $this->assignRef('items', $items);
     // Display the view
     $this->setLayout('json');
     parent::display($tpl, $preparecontent);
 }
 function display($tpl = NULL, $preparecontent = false)
 {
     $document = JFactory::getDocument();
     $language = $document->getLanguage();
     $document->addStyleSheet('components/com_bookingforconnector/assets/css/font-awesome.min.css');
     //		$document->addStyleSheet('components/com_bookingforconnector/assets/css/bootstrap.min.css');
     $document->addStyleSheet('components/com_bookingforconnector/assets/css/bookingfor.css');
     $document->addStyleSheet('components/com_bookingforconnector/assets/css/bookingfor-responsive.css');
     $document->addStyleSheet('components/com_bookingforconnector/assets/css/jquery.validate.css');
     JHTML::stylesheet('components/com_bookingforconnector/assets/css/datepicker.css');
     // load scripts
     $document->addScript('components/com_bookingforconnector/assets/js/jquery.form.js');
     $document->addScript('components/com_bookingforconnector/assets/js/jquery.validate.min.js');
     $document->addScript('components/com_bookingforconnector/assets/js/additional-methods.min.js');
     //load scripts wizard
     $document->addScript('components/com_bookingforconnector/assets/js/bbq.js');
     $document->addScript('components/com_bookingforconnector/assets/js/jquery.form.wizard.js');
     $document->addScript('//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js');
     if (substr($language, 0, 2) != 'en') {
         //			$document->addScript('//jquery-ui.googlecode.com/svn/tags/legacy/ui/i18n/ui.datepicker-' . substr($language,0,2) . '.js');
         $document->addScript('//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/i18n/datepicker-' . substr($language, 0, 2) . '.min.js?ver=1.11.4');
     }
     // Initialise variables
     $state = $this->get('State');
     $actionform = JRequest::getVar('actionform', "");
     $item = $this->get('Item');
     if ($actionform == "insert") {
         $item = $this->getModel()->setCrew();
         /*$item = $this->get('Item');*/
     }
     $params = $state->params;
     $this->assignRef('state', $state);
     $this->assignRef('params', $params);
     $this->assignRef('language', $language);
     $this->assignRef('actionform', $actionform);
     $this->assignRef('item', $item);
     // Display the view
     parent::display($tpl, true);
 }
 function display($tpl = NULL, $preparecontent = false)
 {
     // Initialise variables
     $state = $this->get('State');
     $item = $this->get('Item');
     if ($item->HasResources) {
         if (JRequest::getString('layout') == 'resourcesajax') {
             $items = $this->get('ItemsResourcesAjax');
         }
     }
     if ($item->HasResources) {
         if (JRequest::getString('layout') == 'resources') {
             $items = $this->get('Items');
             $pagination = $this->get('Pagination');
         }
     }
     if (JRequest::getString('layout') == 'offers') {
         $items = $this->get('ItemsOffer');
         $pagination = $this->get('Pagination');
     }
     $document = JFactory::getDocument();
     $language = $document->getLanguage();
     $params = $state->params;
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     $this->setBreadcrumb($item, JRequest::getString('layout'));
     $this->assignRef('params', $params);
     $this->assignRef('item', $item);
     $this->assignRef('items', $items);
     $this->assignRef('pagination', $pagination);
     $this->assignRef('document', $document);
     $this->assignRef('language', $language);
     // Display the view
     parent::display($tpl, true);
 }
Example #19
0
 function display($tpl = null, $preparecontent = false)
 {
     $document = JFactory::getDocument();
     $language = $document->getLanguage();
     // add stylesheet
     $document->addStyleSheet('components/com_bookingforconnector/assets/css/bookingfor.css');
     $document->addStyleSheet('components/com_bookingforconnector/assets/css/bookingfor-responsive.css');
     $document->addStyleSheet('//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css');
     // load scripts
     $document->addScript('//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js');
     $document->addScript('components/com_bookingforconnector/assets/js/bf.js');
     $document->addScript('components/com_bookingforconnector/assets/js/jquery.xml2json.js');
     $document->addScript('components/com_bookingforconnector/assets/js/jquery.shorten.js');
     // Initialise variables
     $state = $this->get('State');
     $params = $state->params;
     $items = $this->get('Items');
     $pagination = $this->get('Pagination');
     $sortColumn = $state->get('list.ordering');
     $sortDirection = $state->get('list.direction');
     $startswith = $params['startswith'];
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     $pagination->setAdditionalUrlParam("filter_order", $sortColumn);
     $pagination->setAdditionalUrlParam("filter_order_Dir", $sortDirection);
     $pagination->setAdditionalUrlParam("startswith", $startswith);
     $this->assignRef('state', $state);
     $this->assignRef('params', $params);
     $this->assignRef('items', $items);
     $this->assignRef('pagination', $pagination);
     $this->assignRef('language', $language);
     // Display the view
     parent::display($tpl);
 }
 function display($tpl = NULL, $preparecontent = false)
 {
     // Initialise variables
     $document = JFactory::getDocument();
     $language = $document->getLanguage();
     $config = JComponentHelper::getParams('com_bookingforconnector');
     $state = $this->get('State');
     $params = $state->params;
     $hashunsubscribe = JRequest::getVar('hash');
     // controllo per eventuale redirect in caso la pagina sia chiamata ma non ci siano parametri corretti
     if (!isset($params) && empty($hashunsubscribe)) {
         header("Location: " . JURI::root());
         $app = JFactory::getApplication();
         $app->close();
     }
     $items = $this->get('Items');
     $pagination = $this->get('Pagination');
     $sortColumn = $state->get('list.ordering');
     $sortDirection = $state->get('list.direction');
     $typologies = $this->getModel()->getMasterTypologies(true, $language);
     // add stylesheet
     JHTML::stylesheet('components/com_bookingforconnector/assets/css/bookingfor.css');
     JHTML::stylesheet('components/com_bookingforconnector/assets/css/bookingfor-responsive.css');
     // load scripts
     $document->addScript('components/com_bookingforconnector/assets/js/bf.js');
     $document->addScript('components/com_bookingforconnector/assets/js/jquery.xml2json.js');
     $document->addScript('components/com_bookingforconnector/assets/js/jquery.shorten.js');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     $pagination->setAdditionalUrlParam("filter_order", $sortColumn);
     $pagination->setAdditionalUrlParam("filter_order_Dir", $sortDirection);
     $pagination->setAdditionalUrlParam("searchid", $params['searchid']);
     if (!empty($params['zoneIds'])) {
         $pagination->setAdditionalUrlParam("zoneIds", $params['zoneIds']);
     }
     if (!empty($params['zoneId'])) {
         $pagination->setAdditionalUrlParam("zoneId", $params['zoneId']);
     }
     $analyticsEnabled = $this->checkAnalytics("Sales Resource List");
     if (count($items) > 0 && $analyticsEnabled && $config->get('eecenabled', 0) == 1) {
         $allobjects = array();
         foreach ($items as $key => $value) {
             $obj = new stdClass();
             $obj->id = "" . $value->ResourceId . " - Sales Resource";
             $obj->name = $value->Name;
             $obj->category = $value->MerchantCategoryName;
             $obj->brand = $value->MerchantName;
             $obj->position = $key;
             $allobjects[] = $obj;
         }
         $document->addScriptDeclaration('callAnalyticsEEc("addImpression", ' . json_encode($allobjects) . ', "list");');
     }
     $this->assignRef('state', $state);
     $this->assignRef('params', $params);
     $this->assignRef('items', $items);
     $this->assignRef('pagination', $pagination);
     $this->assignRef('document', $document);
     $this->assignRef('language', $language);
     $this->assignRef('hashunsubscribe', $hashunsubscribe);
     $this->assignRef('typologies', $typologies);
     $this->assignRef('config', $config);
     $this->assignRef('analyticsEnabled', $analyticsEnabled);
     // Display the view
     parent::display($tpl, true);
 }
Example #21
0
 function display($tpl = null, $preparecontent = false)
 {
     // Initialise variables
     $state = $this->get('State');
     $item = $this->get('Item');
     $document = JFactory::getDocument();
     $language = $document->getLanguage();
     $params = $state->params;
     $app = JFactory::getApplication();
     $sitename = $app->get('sitename');
     $config = JComponentHelper::getParams('com_bookingforconnector');
     // add stylesheet
     $document->addStyleSheet('components/com_bookingforconnector/assets/css/bookingfor.css');
     $document->addStyleSheet('components/com_bookingforconnector/assets/css/bookingfor-responsive.css');
     $document->addStyleSheet('//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css');
     $document->addScript('//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js');
     $document->addScript('components/com_bookingforconnector/assets/js/jquery.shorten.js');
     $document->addScript('components/com_bookingforconnector/assets/js/jquery.validate.min.js');
     $document->addScript('components/com_bookingforconnector/assets/js/additional-methods.min.js');
     if (!isset($item)) {
         header("Location: " . JURI::root());
         $app->close();
     }
     if ($item->HasResources) {
         if (JRequest::getString('layout') == 'resourcesajax') {
             $items = $this->get('ItemsResourcesAjax');
         }
     }
     if ($item->HasResources) {
         if (JRequest::getString('layout') == 'resources') {
             $items = $this->get('Items');
             $pagination = $this->get('Pagination');
         }
     }
     if (JRequest::getString('layout') == 'offers') {
         $items = $this->get('ItemsOffer');
         $pagination = $this->get('Pagination');
     }
     if (JRequest::getString('layout') == 'offer') {
         $items = array($this->get('Offer'));
         BFCHelper::setState($items, 'offers', 'merchant');
     }
     if (JRequest::getString('layout') == 'onsellunits') {
         $items = $this->get('ItemsOnSellUnit');
         $pagination = $this->get('PaginationOnSellUnits');
     }
     if (JRequest::getString('layout') == 'onsellunit') {
         $items = array($this->get('OnSellUnit'));
         BFCHelper::setState($items, 'onsellunits', 'merchant');
     }
     if (JRequest::getString('layout') == 'ratings') {
         $items = $this->get('ItemsRating');
         $pagination = $this->get('PaginationRatings');
         // load scripts
         $document->addScript('components/com_bookingforconnector/assets/js/jquery.expander.min.js');
     }
     if (JRequest::getString('layout') == 'rating') {
         // load css
         $document->addStyleSheet('components/com_bookingforconnector/assets/css/jquery.rating.css');
         $document->addStyleSheet('components/com_bookingforconnector/assets/css/jquery.validate.css');
         // load scripts
         $document->addScript('components/com_bookingforconnector/assets/js/jquery.rating.pack.js');
         $document->addScript('components/com_bookingforconnector/assets/js/jquery.form.js');
         $document->addScript('components/com_bookingforconnector/assets/js/jquery.blockUI.js');
     }
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     BFCHelper::setState($item, 'merchant', 'merchant');
     $this->setBreadcrumb($item, JRequest::getString('layout'));
     $this->assignRef('params', $params);
     $this->assignRef('item', $item);
     $this->assignRef('items', $items);
     $this->assignRef('pagination', $pagination);
     $this->assignRef('document', $document);
     $this->assignRef('language', $language);
     $this->assignRef('sitename', $sitename);
     $this->assignRef('config', $config);
     // Display the view
     parent::display($tpl, true);
 }
    function display($tpl = null, $preparecontent = false)
    {
        // Initialise variables
        $state = $this->get('State');
        $item = $this->get('Item');
        $document = JFactory::getDocument();
        $language = $document->getLanguage();
        $params = $state->params;
        $app = JFactory::getApplication();
        $sitename = $app->get('sitename');
        $config = JComponentHelper::getParams('com_bookingforconnector');
        $orderid = 0;
        // add stylesheet
        JHTML::stylesheet('components/com_bookingforconnector/assets/css/font-awesome.css');
        JHTML::stylesheet('components/com_bookingforconnector/assets/bootstrap/css/bootstrap.css');
        $document->addStyleSheet('components/com_bookingforconnector/assets/css/bookingfor.css');
        $document->addStyleSheet('components/com_bookingforconnector/assets/css/bookingfor-responsive.css');
        $document->addStyleSheet('//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css');
        $document->addScript('//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js');
        $document->addScript('components/com_bookingforconnector/assets/js/jquery.shorten.js');
        $document->addScript('components/com_bookingforconnector/assets/js/jquery.validate.min.js');
        $document->addScript('components/com_bookingforconnector/assets/js/additional-methods.min.js');
        $document->addScript('components/com_bookingforconnector/assets/js/jquery.expander.min.js');
        if (substr($language, 0, 2) != 'en') {
            //			$document->addScript('//jquery-ui.googlecode.com/svn/tags/legacy/ui/i18n/ui.datepicker-' . substr($language,0,2) . '.js');
            $document->addScript('//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/i18n/datepicker-' . substr($language, 0, 2) . '.min.js?ver=1.11.4');
        }
        $checkAnalytics = false;
        if (!isset($item)) {
            header("Location: " . JURI::root());
            $app->close();
        }
        if ($item->HasResources) {
            if (JRequest::getString('layout') == 'resourcesajax') {
                $items = $this->get('ItemsResourcesAjax');
            }
        }
        if ($item->HasResources) {
            if (JRequest::getString('layout') == 'resources') {
                $items = $this->get('Items');
                $checkAnalytics = true;
                $pagination = $this->get('Pagination');
            }
        }
        if (JRequest::getString('layout') == 'packages') {
            $items = $this->get('ItemsPackages');
            $checkAnalytics = true;
            $pagination = $this->get('PaginationPackages');
        }
        if (JRequest::getString('layout') == 'package') {
            $items = $this->get('Package');
            $checkAnalytics = true;
            BFCHelper::setState($items, 'packages', 'merchant');
        }
        if (JRequest::getString('layout') == 'offers') {
            $items = $this->get('ItemsOffer');
            $checkAnalytics = true;
            $pagination = $this->get('PaginationOffers');
        }
        if (JRequest::getString('layout') == 'offer') {
            $items = $this->get('Offer');
            $checkAnalytics = true;
            BFCHelper::setState($items, 'offers', 'merchant');
        }
        if (JRequest::getString('layout') == 'onsellunits') {
            $items = $this->get('ItemsOnSellUnit');
            $checkAnalytics = true;
            $pagination = $this->get('PaginationOnSellUnits');
        }
        if (JRequest::getString('layout') == 'onsellunit') {
            $items = array($this->get('OnSellUnit'));
            $checkAnalytics = true;
            BFCHelper::setState($items, 'onsellunits', 'merchant');
        }
        if (JRequest::getString('layout') == 'ratings') {
            $items = $this->get('ItemsRating');
            $pagination = $this->get('PaginationRatings');
            // load scripts
            $document->addScript('components/com_bookingforconnector/assets/js/jquery.expander.min.js');
        }
        if (JRequest::getString('layout', 'default') == 'default') {
            $checkAnalytics = true;
        }
        if (JRequest::getString('layout', 'default') == 'thanks') {
            $checkAnalytics = true;
        }
        if (JRequest::getString('layout') == 'rating') {
            // load css
            $document->addStyleSheet('components/com_bookingforconnector/assets/css/jquery.rating.css');
            $document->addStyleSheet('components/com_bookingforconnector/assets/css/jquery.validate.css');
            // load scripts
            $document->addScript('components/com_bookingforconnector/assets/js/jquery.rating.pack.js');
            $document->addScript('components/com_bookingforconnector/assets/js/jquery.form.js');
            $document->addScript('components/com_bookingforconnector/assets/js/jquery.blockUI.js');
        }
        $listName = "";
        if ($checkAnalytics) {
            $checkAnalytics = false;
            $itemType = 0;
            $totalItems = array();
            $type = "";
            switch (JRequest::getString('layout', 'default')) {
                case "resources":
                    $listName = "Resources List";
                    $type = "Resource";
                    $itemType = 1;
                    foreach ($items as $key => $value) {
                        $obj = new stdClass();
                        $obj->Id = $value->ResourceId;
                        $obj->Name = $value->Name;
                        $totalItems[] = $obj;
                    }
                    break;
                case "packages":
                    $listName = "Packages List";
                    $type = "Package";
                    $itemType = 1;
                    foreach ($items as $key => $value) {
                        $obj = new stdClass();
                        $obj->Id = $value->PackageId;
                        $obj->Name = $value->Name;
                        $totalItems[] = $obj;
                    }
                    break;
                case "offers":
                    $listName = "Offers List";
                    $type = "Offer";
                    $itemType = 1;
                    foreach ($items as $key => $value) {
                        $obj = new stdClass();
                        $obj->Id = $value->VariationPlanId;
                        $obj->Name = $value->Name;
                        $totalItems[] = $obj;
                    }
                    break;
                case "onsellunits":
                    $listName = "Sales Resources Merchant List";
                    $type = "Sales Resource";
                    $itemType = 1;
                    foreach ($items as $key => $value) {
                        $obj = new stdClass();
                        $obj->Id = $value->ResourceId;
                        $obj->Name = $value->Name;
                        $totalItems[] = $obj;
                    }
                    break;
                case "package":
                    $listName = "Packages Page";
                    $type = "Package";
                    $itemType = 0;
                    $obj = new stdClass();
                    $obj->Id = $items->PackageId;
                    $obj->Name = $items->Name;
                    $totalItems[] = $obj;
                    break;
                case "offer":
                    $listName = "Offers Page";
                    $type = "Offer";
                    $itemType = 0;
                    $obj = new stdClass();
                    $obj->Id = $items->VariationPlanId;
                    $obj->Name = $items->Name;
                    $totalItems[] = $obj;
                    break;
                case "onsellunit":
                    $listName = "Sales Resources Merchant Page";
                    $type = "Sales Resource";
                    $itemType = 0;
                    $obj = new stdClass();
                    $obj->Id = $items->ResourceId;
                    $obj->Name = $items->Name;
                    $totalItems[] = $obj;
                    break;
                case "thanks":
                    $itemType = 2;
                    break;
                case "default":
                    $listName = "Merchants Page";
                    $type = "Merchant";
                    $itemType = 0;
                    $obj = new stdClass();
                    $obj->Id = $item->MerchantId;
                    $obj->Name = $item->Name;
                    $totalItems[] = $obj;
                    break;
            }
            if ($this->checkAnalytics($listName) && $config->get('eecenabled', 0) == 1) {
                $checkAnalytics = true;
                switch ($itemType) {
                    case 0:
                        $value = $totalItems[0];
                        $obj = new stdClass();
                        $obj->id = "" . $value->Id . " - " . $type;
                        $obj->name = $value->Name;
                        $obj->category = $item->MainCategoryName;
                        $obj->brand = $item->Name;
                        $obj->variant = 'NS';
                        $document->addScriptDeclaration('callAnalyticsEEc("addProduct", [' . json_encode($obj) . '], "item");');
                        break;
                    case 1:
                        $allobjects = array();
                        foreach ($totalItems as $key => $value) {
                            $obj = new stdClass();
                            $obj->id = "" . $value->Id . " - " . $type;
                            $obj->name = $value->Name;
                            $obj->category = $item->MainCategoryName;
                            $obj->brand = $item->Name;
                            $obj->position = $key;
                            $allobjects[] = $obj;
                        }
                        $document->addScriptDeclaration('callAnalyticsEEc("addImpression", ' . json_encode($allobjects) . ', "list");');
                        break;
                    case 2:
                        $orderid = JRequest::getString('orderid');
                        if (!empty($orderid)) {
                            $order = BFCHelper::getSingleOrderFromService($orderid);
                            $purchaseObject = new stdClass();
                            $purchaseObject->id = "" . $order->OrderId;
                            $purchaseObject->affiliation = "" . $order->Label;
                            $purchaseObject->revenue = $order->TotalAmount;
                            $purchaseObject->tax = 0.0;
                            $allobjects = array();
                            $allservices = array();
                            $svcTotal = 0;
                            if (!empty($order->NotesData) && !empty(simpledom_load_string($order->NotesData)->xpath("//price"))) {
                                $allservices = array_values(array_filter(simpledom_load_string($order->NotesData)->xpath("//price"), function ($prc) {
                                    return (string) $prc->tag == "extrarequested";
                                }));
                                if (!empty($allservices)) {
                                    foreach ($allservices as $svc) {
                                        $svcObj = new stdClass();
                                        $svcObj->id = "" . (int) $svc->priceId . " - Service";
                                        $svcObj->name = (string) $svc->name;
                                        $svcObj->category = "Services";
                                        $svcObj->brand = $item->Name;
                                        $svcObj->variant = (string) BFCHelper::getItem($order->NotesData, 'nome', 'unita');
                                        $svcObj->price = round((double) $svc->discountedamount / (int) $svc->quantity, 2);
                                        $svcObj->quantity = (int) $svc->quantity;
                                        $allobjects[] = $svcObj;
                                        $svcTotal += (double) $svc->discountedamount;
                                    }
                                }
                                $mainObj = new stdClass();
                                $mainObj->id = "" . $order->RequestedItemId . " - Resource";
                                $mainObj->name = (string) BFCHelper::getItem($order->NotesData, 'nome', 'unita');
                                $mainObj->variant = (string) BFCHelper::getItem($order->NotesData, 'refid', 'rateplan');
                                $mainObj->category = $item->MainCategoryName;
                                $mainObj->brand = $item->Name;
                                $mainObj->price = $order->TotalAmount - $svcTotal;
                                $mainObj->quantity = 1;
                                $allobjects[] = $mainObj;
                                $document->addScriptDeclaration('callAnalyticsEEc("addProduct", ' . json_encode($allobjects) . ', "purchase", "", ' . json_encode($purchaseObject) . ');');
                            }
                        }
                        break;
                }
            }
        }
        // Check for errors.
        if (count($errors = $this->get('Errors'))) {
            JError::raiseWarning(500, implode("\n", $errors));
            return false;
        }
        $layout = JRequest::getString('layout', "default");
        if ($layout == "thanks" || $layout == "default") {
            $merchants = array();
            $merchants[] = $item->MerchantId;
            if ($layout == "thanks") {
                $orderid = JRequest::getString('orderid');
                $criteoConfig = BFCHelper::getCriteoConfiguration(4, $merchants, $orderid);
            } else {
                if ($layout == "") {
                    $criteoConfig = BFCHelper::getCriteoConfiguration(2, $merchants);
                }
            }
            if (isset($criteoConfig) && isset($criteoConfig->enabled) && $criteoConfig->enabled && count($criteoConfig->merchants) > 0) {
                $document->addScript('//static.criteo.net/js/ld/ld.js');
                if ($layout == "thanks") {
                    $document->addScriptDeclaration('window.criteo_q = window.criteo_q || []; 
					window.criteo_q.push( 
						{ event: "setAccount", account: ' . $criteoConfig->campaignid . '}, 
						{ event: "setSiteType", type: "d" }, 
						{ event: "setEmail", email: "" }, 
						{ event: "trackTransaction", id: "' . $criteoConfig->transactionid . '",  item: [' . json_encode($criteoConfig->orderdetails) . '] }
					);');
                } else {
                    if ($layout == "default") {
                        $document->addScriptDeclaration('window.criteo_q = window.criteo_q || []; 
					window.criteo_q.push( 
						{ event: "setAccount", account: ' . $criteoConfig->campaignid . '}, 
						{ event: "setSiteType", type: "d" }, 
						{ event: "setEmail", email: "" }, 
						{ event: "viewItem", item: "' . $criteoConfig->merchants[0] . '" }
					);');
                    }
                }
            }
        }
        BFCHelper::setState($item, 'merchant', 'merchant');
        $this->setBreadcrumb($item, JRequest::getString('layout'));
        $this->assignRef('params', $params);
        $this->assignRef('item', $item);
        $this->assignRef('items', $items);
        $this->assignRef('pagination', $pagination);
        $this->assignRef('document', $document);
        $this->assignRef('language', $language);
        $this->assignRef('sitename', $sitename);
        $this->assignRef('config', $config);
        $this->assignRef('state', $state);
        $this->assignRef('checkAnalytics', $checkAnalytics);
        $this->assignRef('analyticsListName', $listName);
        // Display the view
        parent::display($tpl, true);
    }
 function display($tpl = null, $preparecontent = false)
 {
     $config = JComponentHelper::getParams('com_bookingforconnector');
     $document = JFactory::getDocument();
     $language = $document->getLanguage();
     $app = JFactory::getApplication();
     $sitename = $app->get('sitename');
     $item = $this->get('Item');
     $state = $this->get('State');
     $params = $state->params;
     $this->assignRef('document', $document);
     $this->assignRef('language', $language);
     $this->assignRef('config', $config);
     $this->assignRef('sitename', $sitename);
     $this->assignRef('item', $item);
     //		$params =  null;
     //		JModelLegacy::addIncludePath(JPATH_ROOT. DIRECTORY_SEPARATOR .'components' . DIRECTORY_SEPARATOR . 'com_bookingforconnector'. DIRECTORY_SEPARATOR . 'models', 'BookingForConnectorModel');
     //		$model = JModelLegacy::getInstance('Resource', 'BookingForConnectorModel');
     //
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     $overrideFilters = array();
     $toExclude = array();
     $requiredOffers = array();
     //		$parentId = isset($item->CondominiumId) ? $item->CondominiumId : null;
     $parentId = null;
     $offer = null;
     if (!empty($state->params["offerId"])) {
         $requiredOffers[] = $state->params["offerId"];
         $offer = $this->get('Offer');
     }
     if (isset($offer) && $offer->HasValidSearch) {
         $daySpan = '+' . $offer->MinDuration . ' day';
         $dateparsed = BFCHelper::parseJsonDate($offer->FirstAvailableDate, 'Y-m-d');
         $overrideFilters['checkin'] = DateTime::createFromFormat('Y-m-d', $dateparsed);
         $checkInParsed = clone $overrideFilters['checkin'];
         $overrideFilters['checkout'] = $checkInParsed->modify($daySpan);
         $overrideFilters['duration'] = $offer->MinDuration;
         $params['checkin'] = $overrideFilters['checkin'];
         $params['duration'] = $offer->MinDuration;
         $params['checkout'] = $overrideFilters['checkout'];
     }
     $this->assignRef('params', $params);
     $alternatRes = BFCHelper::GetAlternateResources(0, 5, null, null, $item->MerchantId, $parentId, false, false, $toExclude, $requiredOffers, $overrideFilters);
     if (!isset($alternatRes)) {
         $alternatRes = array();
     }
     $allratePlans = array();
     foreach ($alternatRes as $ratePlanStay) {
         $rs = $ratePlanStay->RatePlan;
         $rs->ResourceId = $ratePlanStay->ResourceId;
         $rs->ResName = $ratePlanStay->ResName;
         $rs->MinCapacityPaxes = $ratePlanStay->MinPaxes;
         $rs->MaxCapacityPaxes = $ratePlanStay->MaxPaxes;
         $rs->MrcCategoryName = $ratePlanStay->DefaultLangMrcCategoryName;
         $rs->Availability = $ratePlanStay->Availability;
         $rs->ImageUrl = $ratePlanStay->ImageUrl;
         if ($ratePlanStay != null) {
             $rs->CalculatedPricesDetails = json_decode($rs->CalculatedPricesString);
             $rs->SelectablePrices = json_decode($rs->CalculablePricesString);
             $rs->CalculatedPackages = json_decode($rs->PackagesString);
             $rs->DiscountVariation = null;
             if (!empty($rs->Discount)) {
                 $rs->DiscountVariation = $rs->Discount;
             }
             $rs->SupplementVariation = null;
             if (!empty($rs->Supplement)) {
                 $rs->SupplementVariation = $rs->Supplement;
             }
             $allVar = json_decode($rs->AllVariationsString);
             $rs->Variations = [];
             $rs->SimpleDiscountIds = [];
             foreach ($allVar as $currVar) {
                 $rs->Variations[] = $currVar;
                 $rs->SimpleDiscountIds[] = $currVar->VariationPlanId;
                 /*
                 if(empty($currVar->IsExclusive)){
                 }
                 */
             }
         }
         $allratePlans[] = $rs;
     }
     //		echo "<pre>allratePlans";
     //		echo print_r($allratePlans);
     //		echo "</pre>";
     function cmp($a, $b)
     {
         return $a->SortOrder - $b->SortOrder;
     }
     $merchants = array();
     $merchants[] = $item->MerchantId;
     $criteoConfig = BFCHelper::getCriteoConfiguration(2, $merchants);
     usort($allratePlans, "cmp");
     $this->assignRef('allstays', $allratePlans);
     $analyticsEnabled = $this->checkAnalytics("");
     $this->assignRef('analyticsEnabled', $analyticsEnabled);
     $this->assignRef('criteoConfig', $criteoConfig);
     //
     //		$PriceTypes = $model->getPriceTypesFromServiceRatePlan($allstays);	//$this->get('PriceTypesFromServiceRatePlan');
     //		$MerchantBookingTypes = $this->get('MerchantBookingTypesFromService');
     //		$this->assignRef('Extras', $Extras);
     //		$this->assignRef('PriceTypes', $PriceTypes);
     //		$this->assignRef('MerchantBookingTypes', $MerchantBookingTypes);
     $this->setLayout('search');
     parent::display($tpl, $preparecontent);
 }
 function display($tpl = null, $preparecontent = false)
 {
     $config = JComponentHelper::getParams('com_bookingforconnector');
     $document = JFactory::getDocument();
     $language = $document->getLanguage();
     // add stylesheet
     JHTML::stylesheet('components/com_bookingforconnector/assets/css/bookingfor.css');
     JHTML::stylesheet('components/com_bookingforconnector/assets/css/bookingfor-responsive.css');
     // load scripts
     $document->addScript('components/com_bookingforconnector/assets/js/bf.js');
     $document->addScript('components/com_bookingforconnector/assets/js/jquery.xml2json.js');
     $document->addScript('components/com_bookingforconnector/assets/js/jquery.shorten.js');
     // Initialise variables
     $state = $this->get('State');
     $params = $state->params;
     $sortColumn = $state->get('list.ordering');
     $sortDirection = $state->get('list.direction');
     $currentLayout = JRequest::getString('layout');
     if ($currentLayout == 'favorites') {
         $items = $this->get('ItemsFavorites');
     } else {
         $show_latest = JRequest::getVar('show_latest', 0);
         $params['show_latest'] = $show_latest;
         //		$isportal = JRequest::getString('isportal');
         $isportal = $config->get('isportal', 1);
         //			if(!$isportal){
         //				$this->setLayout("merchantdefault");
         //			}
         if ($params['show_latest']) {
             $items = $this->get('ItemsLatest');
             $pagination = $this->get('PaginationLatest');
         } else {
             $items = $this->get('Items');
             $pagination = $this->get('Pagination');
         }
         $pagination->setAdditionalUrlParam("filter_order", $sortColumn);
         $pagination->setAdditionalUrlParam("filter_order_Dir", $sortDirection);
         $pagination->setAdditionalUrlParam("locationzones", $params['locationzones']);
     }
     if (count($items) && $this->checkAnalytics('Sales Resource List' . ($params['show_latest'] ? ' - Latest' : '')) && $config->get('eecenabled', 0) == 1) {
         $allobjects = array();
         foreach ($items as $key => $value) {
             $obj = new stdClass();
             $obj->id = "" . $value->ResourceId . " - Sales Resource";
             $obj->name = $value->Name;
             $obj->category = $value->MerchantCategoryName;
             $obj->brand = $value->MerchantName;
             $obj->position = $key;
             $allobjects[] = $obj;
         }
         $document->addScriptDeclaration('callAnalyticsEEc("addImpression", ' . json_encode($allobjects) . ', "list");');
     }
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     $this->assignRef('state', $state);
     $this->assignRef('params', $params);
     $this->assignRef('items', $items);
     $this->assignRef('pagination', $pagination);
     $this->assignRef('language', $language);
     $this->assignRef('config', $config);
     // Display the view
     parent::display($tpl);
 }
    function display($tpl = NULL, $preparecontent = false)
    {
        $document = JFactory::getDocument();
        $language = $document->getLanguage();
        // load scripts
        $document->addScript('components/com_bookingforconnector/assets/js/jquery.validate.min.js');
        $document->addScript('components/com_bookingforconnector/assets/js/additional-methods.min.js');
        // Initialise variables
        $trackorder = false;
        $state = $this->get('State');
        $actionmode = JRequest::getVar('actionmode', "");
        $item = $this->get('Item');
        $params =& $state->params;
        $this->assignRef('state', $state);
        $this->assignRef('params', $params);
        $this->assignRef('language', $language);
        $this->assignRef('item', $item);
        $this->assignRef('actionmode', $actionmode);
        if ($actionmode == "orderpayment") {
            //recupero quanti pagamenti sono stati effettuati
            $item->paymentCount = BFCHelper::getTotalOrderPayments($item->order->OrderId);
            $item->overrideAmount = JRequest::getFloat('overrideAmount');
            //sostituisco i dati dell'ordine da pagare con i dati passati e l'ordine con un suffisso in più
            /*$item = $this->get('Item');*/
            /*$item = "fet";*/
        }
        if ($actionmode == "orderpaid") {
            $trackorder = true;
        }
        if ($actionmode != '' && $actionmode != 'cancel' && $actionmode != 'donation' && $actionmode != 'orderpayment') {
            if ($item->order->Status != 5) {
                $hasPayed = $this->processPayment($actionmode, $item->order->OrderId);
                /* eccezione per setefi che pretende un url di ritorno */
            } else {
                //$hasPayed = true;
                $hasPayed = $this->processOrderPayment($actionmode, $item->order->OrderId, $language);
            }
            /*
            $link = '';
            if ($hasPayed){
             	
            }
            $app = JFactory::getApplication();
            $app->redirect($link, $msg);
            */
        }
        if ($actionmode == '' && $actionmode != 'donation') {
            if ($item->order->Status != 5) {
                $this->inizializePayment($item->order->OrderId);
            }
        }
        if ($actionmode == 'orderpaid') {
            $hasPayed = $item->order->Status == 5;
        }
        if (isset($trackorder) && $trackorder) {
            $merchants = array();
            $merchants[] = $item->order->MerchantId;
            $criteoConfig = BFCHelper::getCriteoConfiguration(4, $merchants, $item->order->OrderId);
            if (isset($criteoConfig) && isset($criteoConfig->enabled) && $criteoConfig->enabled && count($criteoConfig->merchants) > 0) {
                $document->addScript('//static.criteo.net/js/ld/ld.js');
                $document->addScriptDeclaration('window.criteo_q = window.criteo_q || []; 
				window.criteo_q.push( 
					{ event: "setAccount", account: ' . $criteoConfig->campaignid . '}, 
					{ event: "setSiteType", type: "d" }, 
					{ event: "setEmail", email: "" }, 
					{ event: "trackTransaction", id: "' . $criteoConfig->transactionid . '",  item: [' . json_encode($criteoConfig->orderdetails) . '] }
				);');
            }
            $analyticsEnabled = $this->checkAnalytics("Sales Resource List");
            if ($analyticsEnabled && $config->get('eecenabled', 0) == 1) {
                $purchaseObject = new stdClass();
                $purchaseObject->id = "" . $item->order->OrderId;
                $purchaseObject->affiliation = "" . $item->order->Label;
                $purchaseObject->revenue = "" . $item->order->TotalAmount;
                $purchaseObject->tax = 0.0;
                $allobjects = array();
                $svcTotal = 0;
                $allservices = array_values(array_filter(simpledom_load_string($order->NotesData)->xpath("//price"), function ($prc) {
                    return (string) $prc->tag == "extrarequested";
                }));
                foreach ($allservices as $svc) {
                    $svcObj = new stdClass();
                    $svcObj->id = "" . (int) $svc->priceId . " - Service";
                    $svcObj->name = (string) $svc->name;
                    $svcObj->category = "Services";
                    $svcObj->brand = $item->Name;
                    $svcObj->variant = (string) BFCHelper::getItem($order->NotesData, 'nome', 'unita');
                    $svcObj->price = round((double) $svc->discountedamount / (int) $svc->quantity, 2);
                    $svcObj->quantity = (int) $svc->quantity;
                    $allobjects[] = $svcObj;
                    $svcTotal += (double) $svc->discountedamount;
                }
                $mainObj = new stdClass();
                $mainObj->id = "" . $item->order->RequestedItemId . " - Resource";
                $mainObj->name = (string) BFCHelper::getItem($order->NotesData, 'nome', 'unita');
                $mainObj->variant = (string) BFCHelper::getItem($order->NotesData, 'refid', 'rateplan');
                $mainObj->category = $item->MainCategoryName;
                $mainObj->brand = $item->Name;
                $mainObj->price = $item->order->TotalAmount - $svcTotal;
                $mainObj->quantity = 1;
                $allobjects[] = $mainObj;
                $document->addScriptDeclaration('callAnalyticsEEc("addProduct", ' . json_encode($allobjects) . ', "purchase", "", ' . json_encode($purchaseObject) . ');');
            }
        }
        // assegno il riferimento dopo gli altri altrimenti non ho nessuna associazione
        $this->assignRef('hasPayed', $hasPayed);
        /*
        		$items		= $this->get('Items');
        		$pagination	= $this->get('Pagination');
        		$sortColumn 	= $state->get('list.ordering');
        		$sortDirection 	= $state->get('list.direction');
        
        // Check for errors.
        		if (count($errors = $this->get('Errors'))) {
        			JError::raiseWarning(500, implode("\n", $errors));
        			return false;
        		}
        $pagination->setAdditionalUrlParam("filter_order", $ordering);
        		$pagination->setAdditionalUrlParam("filter_order_Dir", $direction);
        
        
        $this->assignRef('items', $items);
        		$this->assignRef('pagination', $pagination);
        */
        // Display the view
        parent::display($tpl);
    }
    function display($tpl = null, $preparecontent = false)
    {
        // Initialise variables
        $document = JFactory::getDocument();
        $language = $document->getLanguage();
        $config = JComponentHelper::getParams('com_bookingforconnector');
        $app = JFactory::getApplication();
        $session = JFactory::getSession();
        $maxItemsView = 3;
        $this->assignRef('maxItemsView', $maxItemsView);
        $state = $this->get('State');
        $params = $state->params;
        if (!isset($params) || empty($params['checkin'])) {
            header("Location: " . JURI::root());
            $app->close();
        }
        $items = $this->get('Items');
        $pagination = $this->get('Pagination');
        $sortColumn = $state->get('list.ordering');
        $sortDirection = $state->get('list.direction');
        $typologies = $this->getModel()->getMasterTypologies(true, $language);
        // add stylesheet
        JHTML::stylesheet('https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css');
        JHTML::stylesheet('components/com_bookingforconnector/assets/css/bookingfor.css');
        JHTML::stylesheet('components/com_bookingforconnector/assets/css/bookingfor-responsive.css');
        $document->addStyleSheet('components/com_bookingforconnector/assets/css/jquery.validate.css');
        $document->addStyleSheet('//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css');
        // load scripts
        $document->addScript('//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js');
        $document->addScript('components/com_bookingforconnector/assets/js/bf.js');
        $document->addScript('components/com_bookingforconnector/assets/js/jquery.xml2json.js');
        $document->addScript('components/com_bookingforconnector/assets/js/jquery.shorten.js');
        $document->addScript('components/com_bookingforconnector/assets/js/jquery.validate.min.js');
        $document->addScript('components/com_bookingforconnector/assets/js/additional-methods.min.js');
        $document->addScript('components/com_bookingforconnector/assets/js/jquery.form.js');
        $document->addScript('components/com_bookingforconnector/assets/js/jquery.blockUI.js');
        $document->addScript('components/com_bookingforconnector/assets/js/jquery.ui.touch-punch.min.js');
        // Check for errors.
        if (count($errors = $this->get('Errors'))) {
            JError::raiseWarning(500, implode("\n", $errors));
            return false;
        }
        $merchants = array();
        if (!empty($items)) {
            $merchants = array_unique(array_map(function ($a) {
                return $a->MerchantId;
            }, $items));
        }
        $criteoConfig = BFCHelper::getCriteoConfiguration(1, $merchants);
        if (isset($criteoConfig) && isset($criteoConfig->enabled) && $criteoConfig->enabled && count($criteoConfig->merchants) > 0) {
            $document->addScript('//static.criteo.net/js/ld/ld.js');
            $document->addScriptDeclaration('window.criteo_q = window.criteo_q || []; 
			window.criteo_q.push( 
				{ event: "setAccount", account: ' . $criteoConfig->campaignid . '}, 
				{ event: "setSiteType", type: "d" }, 
				{ event: "setEmail", email: "" }, 
				{ event: "viewSearch", checkin_date: "' . $params["checkin"]->format('Y-m-d') . '", checkout_date: "' . $params["checkout"]->format('Y-m-d') . '"},
				{ event: "viewList", item: ' . json_encode($criteoConfig->merchants) . ' }
			);');
        }
        $totalItems = array();
        $merchantResults = $params['merchantResults'];
        $condominiumsResults = $params['condominiumsResults'];
        $listName = "";
        if (!empty($items)) {
            if ($merchantResults) {
                $resIndex = 0;
                $listName = "Resources Group List";
                foreach ($items as $mrckey => $mrcValue) {
                    $obj = new stdClass();
                    $obj->Id = $mrcValue->MerchantId . " - Merchant";
                    $obj->MerchantId = $mrcValue->MerchantId;
                    $obj->Name = $mrcValue->Name;
                    $obj->MrcCategoryName = $mrcValue->MrcCategoryName;
                    $obj->MrcName = $mrcValue->Name;
                    $obj->Position = $mrckey;
                    $totalItems[] = $obj;
                    foreach ($mrcValue->Resources as $resKey => $resValue) {
                        $objRes = new stdClass();
                        $objRes->Id = $resValue->ResourceId . " - Resource";
                        $objRes->MerchantId = $mrcValue->MerchantId;
                        $objRes->Name = $resValue->ResName;
                        $objRes->MrcName = $mrcValue->Name;
                        $objRes->MrcCategoryName = $mrcValue->MrcCategoryName;
                        $objRes->Position = $resIndex;
                        if ($resKey >= $maxItemsView) {
                            $objRes->ExcludeInitial = true;
                        }
                        $totalItems[] = $objRes;
                        $resIndex++;
                    }
                }
            } else {
                if ($condominiumsResults) {
                    $resIndex = 0;
                    $listName = "Resources Group List";
                    foreach ($items as $mrckey => $mrcValue) {
                        $obj = new stdClass();
                        $obj->Id = $mrcValue->CondominiumId . " - Resource Group";
                        $obj->MerchantId = $mrcValue->MerchantId;
                        $obj->Name = $mrcValue->Name;
                        $obj->MrcCategoryName = $mrcValue->MrcCategoryName;
                        $obj->MrcName = $mrcValue->MerchantName;
                        $obj->Position = $mrckey;
                        $totalItems[] = $obj;
                        foreach ($mrcValue->Resources as $resKey => $resValue) {
                            $objRes = new stdClass();
                            $objRes->Id = $resValue->ResourceId . " - Resource";
                            $objRes->MerchantId = $mrcValue->MerchantId;
                            $objRes->Name = $resValue->ResName;
                            $objRes->MrcName = $mrcValue->Name;
                            $objRes->MrcCategoryName = $mrcValue->MrcCategoryName;
                            $objRes->Position = $resIndex;
                            if ($resKey >= $maxItemsView) {
                                $objRes->ExcludeInitial = true;
                            }
                            $totalItems[] = $objRes;
                            $resIndex++;
                        }
                    }
                } else {
                    $listName = "Resources Search List";
                    foreach ($items as $mrckey => $mrcValue) {
                        $obj = new stdClass();
                        $obj->Id = $mrcValue->ResourceId . " - Resource";
                        $obj->MerchantId = $mrcValue->MerchantId;
                        $obj->MrcCategoryName = $mrcValue->DefaultLangMrcCategoryName;
                        $obj->Name = $mrcValue->ResName;
                        $obj->MrcName = $mrcValue->MrcName;
                        $obj->Position = $mrckey;
                        $totalItems[] = $obj;
                    }
                }
            }
        }
        $analyticsEnabled = $this->checkAnalytics($listName) && $config->get('eecenabled', 0) == 1;
        if (count($totalItems) > 0 && $analyticsEnabled) {
            $allobjects = array();
            $initobjects = array();
            foreach ($totalItems as $key => $value) {
                $obj = new stdClass();
                $obj->id = "" . $value->Id;
                $obj->name = $value->Name;
                $obj->category = $value->MrcCategoryName;
                $obj->brand = $value->MrcName;
                $obj->position = $value->Position;
                if (!isset($value->ExcludeInitial) || !$value->ExcludeInitial) {
                    $initobjects[] = $obj;
                } else {
                    ///$obj->merchantid = $value->MerchantId;
                    //$allobjects[] = $obj;
                }
            }
            $document->addScriptDeclaration('var currentResources = ' . json_encode($allobjects) . ';
			callAnalyticsEEc("addImpression", ' . json_encode($initobjects) . ', "list");');
        }
        //event tracking
        $pagination->setAdditionalUrlParam("filter_order", $sortColumn);
        $pagination->setAdditionalUrlParam("filter_order_Dir", $sortDirection);
        $pagination->setAdditionalUrlParam("searchid", $params['searchid']);
        $pagination->setAdditionalUrlParam("newsearch", 0);
        $hidesort = true;
        $this->assignRef('state', $state);
        $this->assignRef('params', $params);
        $this->assignRef('items', $items);
        $this->assignRef('pagination', $pagination);
        $this->assignRef('language', $language);
        $this->assignRef('typologies', $typologies);
        $this->assignRef('config', $config);
        $this->assignRef('hidesort', $hidesort);
        $this->assignRef('analyticsEnabled', $analyticsEnabled);
        // Display the view
        parent::display($tpl, true);
    }
 function display($tpl = NULL, $preparecontent = false)
 {
     // Initialise variables
     $state = $this->get('State');
     $item = $this->get('Item');
     $params = $state->params;
     $sortColumn = $state->get('list.ordering');
     $sortDirection = $state->get('list.direction');
     $document = JFactory::getDocument();
     $language = $document->getLanguage();
     $app = JFactory::getApplication();
     $sitename = $app->get('sitename');
     $config = JComponentHelper::getParams('com_bookingforconnector');
     $this->assignRef('state', $state);
     $this->assignRef('language', $language);
     $this->assignRef('item', $item);
     $this->assignRef('sitename', $sitename);
     $this->assignRef('config', $config);
     $category = 0;
     if (!empty($item)) {
         $category = $item->SelectionCategory;
         $show_grouped = JRequest::getVar('show_grouped', 0);
         $params['show_grouped'] = $show_grouped;
         $params['onlystay'] = 'false';
         if ($category == 1) {
             $items = $this->get('ItemsMerchants');
             $pagination = $this->get('Pagination');
         }
         if ($category == 2) {
             $items = $this->get('ItemsOnSellUnit');
             $pagination = $this->get('Pagination');
         }
         if ($category == 4) {
             $items = $this->get('ItemsResources');
             $pagination = $this->get('Pagination');
         }
         $this->assignRef('items', $items);
         $this->assignRef('pagination', $pagination);
         $pagination->setAdditionalUrlParam("filter_order", $sortColumn);
         $pagination->setAdditionalUrlParam("filter_order_Dir", $sortDirection);
         $pagination->setAdditionalUrlParam("newsearch", 0);
     }
     $this->assignRef('category', $category);
     $this->assignRef('params', $params);
     JHTML::stylesheet('https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css');
     JHTML::stylesheet('components/com_bookingforconnector/assets/css/bookingfor.css');
     JHTML::stylesheet('components/com_bookingforconnector/assets/css/bookingfor-responsive.css');
     $document->addStyleSheet('components/com_bookingforconnector/assets/css/jquery.validate.css');
     // load scripts
     $document->addScript('components/com_bookingforconnector/assets/js/bf.js');
     $document->addScript('components/com_bookingforconnector/assets/js/jquery.xml2json.js');
     $document->addScript('components/com_bookingforconnector/assets/js/jquery.shorten.js');
     $document->addScript('components/com_bookingforconnector/assets/js/jquery.validate.min.js');
     $document->addScript('components/com_bookingforconnector/assets/js/additional-methods.min.js');
     $document->addScript('components/com_bookingforconnector/assets/js/jquery.form.js');
     $document->addScript('components/com_bookingforconnector/assets/js/jquery.blockUI.js');
     $document->addScript('components/com_bookingforconnector/assets/js/jquery.ui.touch-punch.min.js');
     // Initialise variables
     //		$params = $state->params;
     // Display the view
     parent::display($tpl, true);
 }
Example #28
0
 function display($tpl = NULL, $preparecontent = false)
 {
     $document = JFactory::getDocument();
     $language = $document->getLanguage();
     // load scripts
     $document->addScript('components/com_bookingforconnector/assets/js/jquery.validate.min.js');
     $document->addScript('components/com_bookingforconnector/assets/js/additional-methods.min.js');
     // Initialise variables
     $state = $this->get('State');
     $actionmode = JRequest::getVar('actionmode', "");
     $item = $this->get('Item');
     $params =& $state->params;
     $this->assignRef('state', $state);
     $this->assignRef('params', $params);
     $this->assignRef('language', $language);
     $this->assignRef('item', $item);
     $this->assignRef('actionmode', $actionmode);
     if ($actionmode == "orderpayment") {
         //recupero quanti pagamenti sono stati effettuati
         $item->paymentCount = BFCHelper::getTotalOrderPayments($item->order->OrderId);
         $item->overrideAmount = JRequest::getFloat('overrideAmount');
         //sostituisco i dati dell'ordine da pagare con i dati passati e l'ordine con un suffisso in più
         /*$item = $this->get('Item');*/
         /*$item = "fet";*/
     }
     if ($actionmode != '' && $actionmode != 'cancel' && $actionmode != 'donation' && $actionmode != 'orderpayment') {
         if ($item->order->Status != 5) {
             $hasPayed = $this->processPayment($actionmode, $item->order->OrderId);
             /* eccezione per setefi che pretende un url di ritorno */
         } else {
             //$hasPayed = true;
             $hasPayed = $this->processOrderPayment($actionmode, $item->order->OrderId, $language);
         }
         /*
         $link = '';
         if ($hasPayed){
          	
         }
         $app = JFactory::getApplication();
         $app->redirect($link, $msg);
         */
     }
     if ($actionmode == '' && $actionmode != 'donation') {
         if ($item->order->Status != 5) {
             $this->inizializePayment($item->order->OrderId);
         }
     }
     if ($actionmode == 'orderpaid') {
         $hasPayed = $item->order->Status == 5;
     }
     // assegno il riferimento dopo gli altri altrimenti non ho nessuna associazione
     $this->assignRef('hasPayed', $hasPayed);
     /*
     		$items		= $this->get('Items');
     		$pagination	= $this->get('Pagination');
     		$sortColumn 	= $state->get('list.ordering');
     		$sortDirection 	= $state->get('list.direction');
     
     // Check for errors.
     		if (count($errors = $this->get('Errors'))) {
     			JError::raiseWarning(500, implode("\n", $errors));
     			return false;
     		}
     $pagination->setAdditionalUrlParam("filter_order", $ordering);
     		$pagination->setAdditionalUrlParam("filter_order_Dir", $direction);
     
     
     $this->assignRef('items', $items);
     		$this->assignRef('pagination', $pagination);
     */
     // Display the view
     parent::display($tpl);
 }