/** * Function for getting the list of languages * * @return array Language list */ public static function getList() { $app = JFactory::getApplication(); $languages = JLanguageHelper::getLanguages(); $db = JFactory::getDbo(); $Itemid = $app->input->getInt('Itemid', 0); $uri = new JURI(Juri::current()); $uri->delVar('lang'); $uri->delVar('Itemid'); $location = htmlspecialchars($uri->getQuery()); if (!empty($location)) { $location .= '&'; } if (!$Itemid) { $active = $app->getMenu()->getActive(); if ($active) { $Itemid = $active->id; } } // For every language we load menu items language specific alias and params foreach ($languages as $i => $language) { $db->forceLanguageTranslation = $language->lang_code; RMenu::resetJoomlaMenuItems(); $db->forceLanguageTranslation = false; $languages[$i]->active = $language->lang_code == JFactory::getLanguage()->getTag(); $languages[$i]->link = RRoute::_('index.php?' . $location . 'lang=' . $language->sef . ($Itemid > 0 ? '&Itemid=' . $Itemid : '')); } // After we are done we reset it the way it was RMenu::resetJoomlaMenuItems(); return $languages; }
/** * Ajax call to get logs tab content. * * @return void */ public function ajaxlogs() { $app = JFactory::getApplication(); $input = $app->input; $paymentId = $input->getInt('id'); if ($paymentId) { /** @var RedcoreModelPayment_Logs $logsModel */ $logsModel = RModelAdmin::getAdminInstance('Payment_Logs', array(), 'com_redcore'); $state = $logsModel->getState(); $logsModel->setState('filter.payment_id', $paymentId); $app->setUserState('log.payment_id', $paymentId); $formName = 'logsForm'; $pagination = $logsModel->getPagination(); $pagination->set('formName', $formName); echo RLayoutHelper::render('payment.logs', array('state' => $state, 'items' => $logsModel->getItems(), 'pagination' => $pagination, 'filterForm' => $logsModel->getForm(), 'activeFilters' => $logsModel->getActiveFilters(), 'formName' => $formName, 'showToolbar' => true, 'action' => RRoute::_('index.php?option=com_redcore&view=payment&model=payment_logs'), 'return' => base64_encode('index.php?option=com_redcore&view=payment&layout=edit&id=' . $paymentId . '&tab=logs&from_payment=1'))); } $app->close(); }
/** * Sets a custom route class * * @param object $setCustomRouteClass The class corresponding to a redCORE based app * * @return void */ public static function setCustomRoute($setCustomRouteClass) { self::$customRouteClass = $setCustomRouteClass; }
/** * Gets logged In user or redirect to login page * * @return JUser Instance of the logged in user */ public function getLoggedUser() { $user = JFactory::getUser(); // If user is not logged in we redirect him to the login page if (empty($user->id)) { $currentUri = JUri::getInstance(); $returnUrl = JUri::root() . 'index.php?' . $currentUri->getQuery(); $loginLink = RRoute::_(JUri::root() . 'index.php?option=com_users&view=login'); $loginPage = new JUri($loginLink); $loginPage->setVar('return', base64_encode(htmlspecialchars($returnUrl))); JFactory::getApplication()->redirect($loginPage); JFactory::getApplication()->close(); } return $user; }
if ($return) { $itemUrl .= '&return=' . $return; } ?> <tr class="<?php echo RApiPaymentStatus::getStatusLabelClass($item->status); ?> "> <td> <?php echo JHtml::_('rgrid.id', $i, $item->id, false, 'cid', $formName); ?> </td> <td> <a href="<?php echo RRoute::_($itemUrl); ?> "> <?php echo JHtml::_('date', $item->created_date, JText::_('DATE_FORMAT_LC2')); ?> </a> </td> <td> <?php echo RHelperCurrency::getFormattedPrice($item->amount, $item->currency); ?> </td> <td> <?php echo $item->message_text;