public function modInvitationList() { $usersInvite = AccountFactory::getModel('usersInvite'); $result = $usersInvite->getList(array('status' => AccountTableUsersInvite::PENDING), '10'); $html = '<ul>'; if (!empty($result)) { foreach ($result as $record) { $date = JXDate::formatDate($record->last_invite_date); $html .= '<li>' . $record->invite_email . ' invited on ' . $date . '</li>'; } } $html .= '</ul>'; return $html; }
/** * Open authorize window * Authorise the app to access user's resource */ public function authenticate() { if ($_POST) { $approved = JRequest::getVar('app_true'); $notApproved = JRequest::getVar('app_false'); $model = AccountFactory::getModel('token'); $mainframe = JFactory::getApplication(); if ($approved) { $user = JFactory::getUser(); if ($model->generateToken($user->id)) { $mainframe->redirect(JRoute::_('index.php?option=com_account&view=account'), JText::_('com_account_ACTION_APPROVED_PERFORMED')); } else { $mainframe->redirect(JRoute::_('index.php?option=com_account&view=account'), JText::_('com_account_ACTION_ERROR'), 'error'); } } else { if ($notApproved) { /* Action for cancel */ echo 'Canceled'; } } } parent::display(); }
public function getPendingEmailCount($all = false) { $inviteModel = AccountFactory::getModel('usersinvite'); $userTbl = JTable::getInstance('AccountUser', 'AccountTable'); $inviteTbl = JTable::getInstance('usersinvite', 'AccountTable'); if ($all) { $filter = array('status' => AccountTableUsersInvite::PENDING); } else { $filter = array('status' => AccountTableUsersInvite::PENDING, 'days_ahead' => '3'); } $num = $inviteModel->getTotal($filter); return $num; }