break;
         default:
             debugging('An unknown WebEx error occurred: ' . $webexres['RS'], DEBUG_DEVELOPER);
             $error = get_string('error_unknown', 'webexactivity');
             break;
     }
 } else {
     if ($webexres['AT'] === 'LI') {
         switch ($webexres['RS']) {
             case 'AlreadyLogon':
                 $params = array('id' => $id);
                 if ($action === 'hostmeetingerror') {
                     $params['action'] = 'hostmeeting';
                 }
                 $hosturl = new moodle_url($returnurl, $params);
                 $logouturl = \mod_webexactivity\user::get_logout_url($hosturl->out(false));
                 redirect($logouturl);
                 break;
             case 'AccessDenied':
             case 'AccountLocked':
             case 'AutoLoginDisabled':
             case 'InvalidSessionTicket':
             case 'InvalidTicket':
                 $error = get_string('error_' . $webexres['AT'] . '_' . $webexres['RS'], 'webexactivity');
             default:
                 debugging('An unknown WebEx error occurred: ' . $webexres['RS'], DEBUG_DEVELOPER);
                 $error = get_string('error_unknown', 'webexactivity');
                 break;
         }
     } else {
         if ($webexres['AT'] === 'LO') {
 * @package    mod_webexactvity
 * @author     Eric Merrill <*****@*****.**>
 * @copyright  2014 Oakland University
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
require_once dirname(dirname(dirname(__FILE__))) . '/config.php';
require_once $CFG->libdir . '/adminlib.php';
admin_externalpage_setup('modwebexactivityusers');
$pageurl = new moodle_url('/mod/webexactivity/admin_users.php');
$action = optional_param('action', false, PARAM_ALPHA);
switch ($action) {
    case 'login':
        // First log the user out (in case they are logged in, then bring back to logintrue.
        $webexid = required_param('webexid', PARAM_ALPHAEXT);
        $returnurl = new moodle_url($pageurl, array('action' => 'logintrue', 'webexid' => $webexid));
        redirect(\mod_webexactivity\user::get_logout_url($returnurl->out(false)));
        break;
    case 'logintrue':
        // Actually log the user in.
        $webexid = required_param('webexid', PARAM_ALPHAEXT);
        $webexuser = \mod_webexactivity\user::load_webex_id($webexid);
        redirect($webexuser->get_login_url());
        break;
}
// Setup the table for output.
$table = new \mod_webexactivity\admin_users_table('webexactivityadminrecordingstable');
$table->define_baseurl($pageurl);
$table->set_sql('*', '{webexactivity_user}', '1=1', array());
$table->define_columns(array('firstname', 'lastname', 'email', 'webexid', 'login'));
$table->define_headers(array(get_string('firstname'), get_string('lastname'), get_string('email'), get_string('webexid', 'webexactivity'), ''));
$table->no_sorting('login');