Esempio n. 1
0
 function display($tpl = null)
 {
     $app = JFactory::getApplication();
     // get parameters
     $params = clone $app->getParams('com_rsmembership');
     $pathway = $app->getPathway();
     $pathway->addItem(JText::_('COM_RSMEMBERSHIP_RENEW'), '');
     // get the logged user
     $this->user = JFactory::getUser();
     // get the current layout
     $layout = $this->getLayout();
     if ($layout == 'default') {
         $this->payments = RSMembership::getPlugins();
         // get the encoded return url
         $this->return = base64_encode(JURI::getInstance());
         $this->data = $this->get('data');
         // get the membership
         $this->membership = $this->get('membership');
         $this->membershipterms = $this->get('membershipterms');
         $this->fields = RSMembershipHelper::getFields(true);
         $this->fields_validation = RSMembershipHelper::getFieldsValidation($this->membership->id);
         $this->membership_fields = RSMembershipHelper::getMembershipFields($this->membership->id, true, $this->user->id, true, $this->membership->last_transaction_id);
     } elseif ($layout == 'payment') {
         $this->html = $this->get('html');
     }
     // get the extras
     $this->extras = $this->get('extras');
     $this->cid = $this->get('cid');
     $this->config = $this->get('config');
     $this->params = $params;
     $this->token = JHTML::_('form.token');
     $this->currency = RSMembershipHelper::getConfig('currency');
     parent::display();
 }
Esempio n. 2
0
 function display($tpl = null)
 {
     $mainframe =& JFactory::getApplication();
     // get parameters
     $params = clone $mainframe->getParams('com_rsmembership');
     $this->assignRef('params', $params);
     $this->assignRef('config', $this->get('config'));
     $this->assignRef('fields_validation', RSMembershipHelper::getFieldsValidation());
     $this->assignRef('fields', RSMembershipHelper::getFields());
     if (RSMembershipHelper::isJ16()) {
         // Description
         if ($params->get('menu-meta_description')) {
             $this->document->setDescription($params->get('menu-meta_description'));
         }
         // Keywords
         if ($params->get('menu-meta_keywords')) {
             $this->document->setMetadata('keywords', $params->get('menu-meta_keywords'));
         }
         // Robots
         if ($params->get('robots')) {
             $this->document->setMetadata('robots', $params->get('robots'));
         }
     }
     parent::display();
 }
Esempio n. 3
0
 function display($tpl = null)
 {
     $app = JFactory::getApplication();
     // get parameters
     $this->params = clone $app->getParams('com_rsmembership');
     $this->fields = RSMembershipHelper::getFields();
     $this->field = $this->get('RSFieldset');
     $this->fields_validation = RSMembershipHelper::getFieldsValidation();
     // Description
     if ($this->params->get('menu-meta_description')) {
         $this->document->setDescription($this->params->get('menu-meta_description'));
     }
     // Keywords
     if ($this->params->get('menu-meta_keywords')) {
         $this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords'));
     }
     // Robots
     if ($this->params->get('robots')) {
         $this->document->setMetadata('robots', $this->params->get('robots'));
     }
     parent::display();
 }
Esempio n. 4
0
 function display($tpl = null)
 {
     $app = JFactory::getApplication();
     // get parameters
     $params = clone $app->getParams('com_rsmembership');
     $pathway = $app->getPathway();
     $pathway->addItem(JText::_('COM_RSMEMBERSHIP_UPGRADE'), '');
     // token
     $token = JHTML::_('form.token');
     // get the logged user
     $this->user = JFactory::getUser();
     // the new membership id
     $this->cid = $this->get('cid');
     // get the current layout
     $layout = $this->getLayout();
     if ($layout == 'default') {
         $this->payments = RSMembership::getPlugins();
         // get the encoded return url
         $this->return = base64_encode(JURI::getInstance());
         $this->data = $this->get('data');
         // get the upgrade
         $this->upgrade = $this->get('upgrade');
         // price
         $this->total = RSMembershipHelper::getPriceFormat($this->upgrade->price);
         $this->fields = RSMembershipHelper::getFields(true);
         $this->fields_validation = RSMembershipHelper::getFieldsValidation($this->upgrade->membership_to_id);
         $this->membership_fields = RSMembershipHelper::getMembershipFields($this->upgrade->membership_to_id, true, $this->user->id, true);
         $this->membershipterms = $this->get('membershipterms');
     } elseif ($layout == 'payment') {
         $this->html = $this->get('html');
     }
     $this->config = RSMembershipHelper::getConfig();
     $this->params = $params;
     $this->token = $token;
     $this->currency = RSMembershipHelper::getConfig('currency');
     parent::display();
 }
Esempio n. 5
0
 function display($tpl = null)
 {
     $mainframe =& JFactory::getApplication();
     // get parameters
     $params = clone $mainframe->getParams('com_rsmembership');
     // get the membership
     $membership = $this->get('membership');
     // check if the membership exists
     if (empty($membership->id)) {
         JError::raiseWarning(500, JText::_('RSM_MEMBERSHIP_NOT_EXIST'));
         $mainframe->redirect(JRoute::_('index.php?option=com_rsmembership', false));
     }
     if (!$membership->published || $membership->stock == -1) {
         JError::raiseWarning(500, JText::_('RSM_MEMBERSHIP_NOT_PUBLISHED'));
         $mainframe->redirect(JRoute::_('index.php?option=com_rsmembership', false));
     }
     $pathway =& $mainframe->getPathway();
     $pathway->addItem($membership->name, JRoute::_('index.php?option=com_rsmembership&view=membership&cid=' . $membership->id . ':' . JFilterOutput::stringURLSafe($membership->name)));
     $pathway->addItem(JText::_('RSM_SUBSCRIBE'), '');
     // get the extras
     $extras = $this->get('extras');
     // check if the user is logged in
     $user =& JFactory::getUser();
     $logged = $user->get('guest') ? false : true;
     $show_login = RSMembershipHelper::getConfig('show_login');
     // token
     $token = JHTML::_('form.token');
     // get the current task
     $task = JRequest::getVar('task', '');
     $choose_username = RSMembershipHelper::getConfig('choose_username');
     $choose_password = RSMembershipHelper::getConfig('choose_password');
     // get the current layout
     $layout = $this->getLayout();
     if ($layout == 'default') {
         // get the encoded return url
         $return = base64_encode(JRequest::getURI());
         $this->assignRef('return', $return);
         $this->assign('choose_username', $choose_username);
         $this->assign('choose_password', $choose_password);
         $muser = $this->get('user');
         $data = $this->get('data');
         if ($task == 'back' || $task == 'validatesubscribe') {
             $this->assignRef('data', $data);
         }
         $this->assignRef('fields_validation', RSMembershipHelper::getFieldsValidation());
         $this->assignRef('fields', RSMembershipHelper::getFields());
         $this->assign('use_captcha', $this->get('usecaptcha'));
         $this->assign('use_builtin', $this->get('usebuiltin'));
         $this->assign('use_recaptcha', $this->get('userecaptcha'));
         if ($this->get('userecaptcha')) {
             if (!class_exists('JReCAPTCHA')) {
                 require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_rsmembership' . DS . 'helpers' . DS . 'recaptcha' . DS . 'recaptchalib.php';
             }
             $this->assign('show_recaptcha', JReCAPTCHA::getHTML($this->get('recaptchaerror')));
         }
         $this->assign('has_coupons', $this->get('hasCoupons'));
     } elseif ($layout == 'preview') {
         $this->assign('choose_username', $choose_username);
         $this->assign('choose_password', $choose_password);
         $this->assignRef('fields', RSMembershipHelper::getFields(false));
         $this->assign('payments', RSMembership::getPlugins());
         $data = $this->get('data');
         $this->assignRef('data', $data);
     } elseif ($layout == 'payment') {
         $this->assignRef('html', $this->get('html'));
     }
     $this->assignRef('config', $this->get('config'));
     $this->assignRef('params', $params);
     $this->assignRef('membership', $membership);
     $this->assignRef('membershipterms', $this->get('membershipterms'));
     $this->assignRef('extras', $extras);
     $this->assignRef('logged', $logged);
     $this->assignRef('show_login', $show_login);
     $this->assignRef('user', $user);
     $this->assignRef('muser', $muser);
     $this->assignRef('token', $token);
     $this->assign('currency', RSMembershipHelper::getConfig('currency'));
     $this->assign('one_page_checkout', RSMembershipHelper::getConfig('one_page_checkout'));
     if ($this->one_page_checkout) {
         $this->assign('payments', RSMembership::getPlugins());
     }
     $total = 0;
     $total += $membership->price;
     if ($extras) {
         foreach ($extras as $extra) {
             $total += $extra->price;
         }
     }
     $this->assign('total', $total);
     parent::display();
 }
Esempio n. 6
0
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $pathway = $app->getPathway();
     // Assign variables
     $this->membership = $this->get('Membership');
     $this->extras = $this->get('Extras');
     $this->params = clone $app->getParams('com_rsmembership');
     $this->user = JFactory::getUser();
     $this->logged = (bool) (!$this->user->guest);
     $this->token = JHtml::_('form.token');
     // Assign config variables
     $this->config = RSMembershipHelper::getConfig();
     $this->show_login = $this->config->show_login;
     $this->choose_username = $this->config->choose_username;
     $this->choose_password = $this->config->choose_password;
     $this->currency = $this->config->currency;
     $this->one_page_checkout = $this->config->one_page_checkout;
     $this->captcha_case_sensitive = $this->config->captcha_case_sensitive;
     $this->payments = RSMembership::getPlugins();
     // Set pathway
     $pathway->addItem($this->membership->name, JRoute::_(RSMembershipRoute::Membership($this->membership->id, $app->input->getInt('Itemid'))));
     $pathway->addItem(JText::_('COM_RSMEMBERSHIP_SUBSCRIBE'), '');
     switch ($this->getLayout()) {
         default:
             // Get the encoded return url
             $this->return = base64_encode(JURI::getInstance());
             $this->data = (object) $this->get('Data');
             $this->membershipterms = $this->get('MembershipTerms');
             $this->has_coupons = $this->get('HasCoupons');
             $this->fields_validation = RSMembershipHelper::getFieldsValidation($this->membership->id);
             $this->fields = RSMembershipHelper::getFields(true);
             $this->membership_fields = RSMembershipHelper::getMembershipFields($this->membership->id);
             // Handle CAPTCHA
             $this->use_captcha = $this->get('UseCaptcha');
             $this->use_builtin = $this->get('UseBuiltin');
             $this->use_recaptcha = $this->get('UseReCaptcha');
             $this->use_recaptcha_new = $this->get('UseReCaptchaNew');
             if ($this->use_recaptcha) {
                 if (!class_exists('JReCAPTCHA')) {
                     require_once JPATH_ADMINISTRATOR . '/components/com_rsmembership/helpers/recaptcha/recaptchalib.php';
                 }
                 $this->show_recaptcha = JReCAPTCHA::getHTML($this->get('ReCaptchaError'));
             }
             if ($this->use_recaptcha_new) {
                 $doc = JFactory::getDocument();
                 if ($doc->getType() == 'html') {
                     $doc->addScript('https://www.google.com/recaptcha/api.js?hl=' . JFactory::getLanguage()->getTag());
                 }
             }
             $this->assignExtrasView();
             break;
         case 'preview':
             $this->fields = RSMembershipHelper::getFields(false);
             $this->membership_fields = RSMembershipHelper::getMembershipFields($this->membership->id, false);
             $this->data = (object) $this->get('Data');
             break;
         case 'payment':
             $this->html = $this->get('Html');
             break;
     }
     // Calculate the Total
     $this->total = $this->get('Total');
     // Do we need to display the payment options?
     $model = $this->getModel();
     $this->showPayments = $model->showPaymentOptions();
     parent::display();
 }