function display($tpl = null) { $mainframe =& JFactory::getApplication(); if (!$mainframe->isAdmin()) { $params = $mainframe->getParams('com_rsticketspro'); $this->assignRef('params', $params); } $data = $this->get('data'); $this->assignRef('data', $data); $this->assignRef('custom_fields', $this->get('customfields')); $user = JFactory::getUser(); $this->assign('is_logged', !$user->get('guest')); $this->assign('is_staff', RSTicketsProHelper::isStaff()); $this->assign('permissions', RSTicketsProHelper::getCurrentPermissions()); $this->assignRef('user', $user); $this->assign('use_editor', RSTicketsProHelper::getConfig('allow_rich_editor')); $this->assignRef('editor', JFactory::getEditor()); $show_please_select = true; $lists['priorities'] = JHTML::_('select.genericlist', RSTicketsProHelper::getPriorities($show_please_select), 'priority_id', '', 'value', 'text', @$data['priority_id'], 'submit_priority'); $lists['departments'] = JHTML::_('select.genericlist', RSTicketsProHelper::getDepartments($show_please_select), 'department_id', 'onchange="rst_show_custom_fields(this.value); rst_show_priority(this.value); rst_show_upload(this.value); rst_show_subject(this.value);"', 'value', 'text', @$data['department_id']); $lists['subject'] = JHTML::_('select.genericlist', RSTicketsProHelper::getSubjects(@$data['department_id'], $show_please_select), 'subject', '', 'value', 'text', @$data['subject'], 'submit_subject'); $this->assignRef('lists', $lists); $this->assignRef('departments', $this->get('departments')); $this->assign('can_upload', $this->get('canupload')); $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') && $mainframe->isSite()) { $this->assign('show_recaptcha', JReCAPTCHA::getHTML($this->get('recaptchaerror'))); } $this->assign('show_footer', RSTicketsProHelper::getConfig('rsticketspro_link')); $this->assign('footer', RSTicketsProHelper::getFooter()); $this->assign('use_predefined_subjects', RSTicketsProHelper::getConfig('allow_predefined_subjects')); if ($mainframe->isAdmin()) { $this->assign('checked_create_new_user', JRequest::getVar('submit_type', 1) == 1); $this->assign('checked_existing_user', JRequest::getVar('submit_type', 1) == 2); } if (RSTicketsProHelper::isJ16() && $mainframe->isSite()) { // 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(); }
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(); }
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(); }