$view = 'editrecording';
             $data = new stdClass();
             $data->name = $recording->name;
             $data->id = $id;
             $data->recordingid = $recording->id;
             $data->action = 'editrecording';
             $data->visible = $recording->visible;
             $mform->set_data($data);
             break;
         }
     }
     break;
 case 'deleterecording':
     require_capability('mod/webexactivity:hostmeeting', $context);
     $recordingid = required_param('recordingid', PARAM_INT);
     $recording = new \mod_webexactivity\recording($recordingid);
     $recwebexid = $recording->webexid;
     if ($recwebexid !== $cm->instance) {
         throw new invalid_parameter_exception('Recording ID does not match instance.');
         break;
     }
     $confirm = optional_param('confirm', 0, PARAM_INT);
     // If not confirmed, display form below.
     if (!$confirm) {
         $view = 'deleterecording';
         break;
     } else {
         $params = array('context' => $context, 'objectid' => $recordingid);
         $event = \mod_webexactivity\event\recording_deleted::create($params);
         $event->add_record_snapshot('webexactivity_recording', $recording->record);
         $event->trigger();
        $confirm = optional_param('confirm', 0, PARAM_INT);
        $recordingid = required_param('recordingid', PARAM_INT);
        $recording = new \mod_webexactivity\recording($recordingid);
        if (!$confirm) {
            $view = 'deleterecording';
            break;
        } else {
            // TODO Log event.
            $recording->delete();
            redirect($pageurl->out(false));
        }
        break;
    case 'undelete':
        // Mark recording as not deleted.
        $recordingid = required_param('recordingid', PARAM_INT);
        $recording = new \mod_webexactivity\recording($recordingid);
        $recording->undelete();
        redirect($pageurl->out(false));
        break;
}
// Setup the sql table.
$table = new \mod_webexactivity\admin_recordings_table('webexactivityadminrecordingstable');
$table->define_baseurl($pageurl);
// Content.
$table->set_sql('*', '{webexactivity_recording}', '1=1', array());
$table->define_columns(array('name', 'hostid', 'timecreated', 'duration', 'filesize', 'fileurl', 'streamurl', 'deleted', 'webexid'));
$table->define_headers(array(get_string('name'), get_string('host', 'webexactivity'), get_string('date'), get_string('duration', 'search'), get_string('size'), get_string('download'), get_string('stream', 'webexactivity'), get_string('delete'), get_string('activity')));
// Options.
$table->sortable(true, 'timecreated', SORT_DESC);
$table->no_sorting('fileurl');
$table->no_sorting('streamurl');