コード例 #1
0
 /**
  * Check if this meeting type requires a password.
  *
  * @return bool  True if a meeting password is required, false if not.
  */
 public static function is_password_required()
 {
     return \mod_webexactivity\meeting::get_meeting_type_password_required(static::TYPE);
 }
コード例 #2
0
 /**
  * Perform minimal validation on the settings form.
  *
  * @param array $data
  * @param array $files
  */
 public function validation($data, $files)
 {
     $errors = parent::validation($data, $files);
     if ($data['instance'] == 0) {
         // Check that the passed type is valid.
         if (!isset($data['type']) || !\mod_webexactivity\meeting::is_valid_type($data['type'], $this->context)) {
             $errors['type'] = get_string('invalidtype', 'webexactivity');
         }
     }
     return $errors;
 }
コード例 #3
0
// Code to view the passed webex.
require '../../config.php';
require_once $CFG->libdir . '/completionlib.php';
$id = optional_param('id', 0, PARAM_INT);
// Course module ID.
$action = optional_param('action', false, PARAM_ALPHA);
$view = optional_param('view', false, PARAM_ALPHA);
$error = false;
// WebEx response codes.
$webexres = array();
$webexres['AT'] = optional_param('AT', false, PARAM_ALPHA);
$webexres['ST'] = optional_param('ST', false, PARAM_ALPHA);
$webexres['RS'] = optional_param('RS', false, PARAM_ALPHA);
$cm = get_coursemodule_from_id('webexactivity', $id, 0, false, MUST_EXIST);
$webexrecord = $DB->get_record('webexactivity', array('id' => $cm->instance), '*', MUST_EXIST);
$webexmeeting = \mod_webexactivity\meeting::load($webexrecord);
$webex = new \mod_webexactivity\webex();
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
// Basic completion tracking.
$completion = new completion_info($course);
$completion->set_module_viewed($cm);
require_course_login($course, true, $cm);
$context = context_module::instance($cm->id);
require_capability('mod/webexactivity:view', $context);
$canhost = has_capability('mod/webexactivity:hostmeeting', $context);
$returnurl = new moodle_url('/mod/webexactivity/view.php', array('id' => $id));
$PAGE->set_url($returnurl);
// Errors from the WebEx URL API docs.
if ($webexres['ST'] === 'FAIL') {
    $error = true;
    if ($webexres['AT'] === 'JM') {
コード例 #4
0
/**
 * Delete a WebEx instance.
 *
 * @param int   $id     Record id to delete.
 * @return bool
 */
function webexactivity_delete_instance($id)
{
    $meeting = \mod_webexactivity\meeting::load($id);
    return $meeting->delete();
}
コード例 #5
0
 /**
  * Check and update open sessions/meetings from WebEx.
  *
  * @return bool  True on success, false on failure.
  */
 public function update_open_sessions()
 {
     global $DB;
     $xml = type\base\xml_gen::list_open_sessions();
     $response = $this->get_response($xml);
     if ($response === false) {
         return false;
     }
     $processtime = time();
     $cleartime = $processtime - 60;
     if (is_array($response) && isset($response['ep:services'])) {
         foreach ($response['ep:services'] as $service) {
             foreach ($service['#']['ep:sessions'] as $session) {
                 $session = $session['#'];
                 $meetingkey = $session['ep:sessionKey'][0]['#'];
                 if ($meetingrecord = $DB->get_record('webexactivity', array('meetingkey' => $meetingkey))) {
                     if ($meetingrecord->status !== self::WEBEXACTIVITY_STATUS_IN_PROGRESS) {
                         $meeting = meeting::load($meetingrecord);
                         $meeting->status = self::WEBEXACTIVITY_STATUS_IN_PROGRESS;
                         $meeting->laststatuscheck = $processtime;
                         $meeting->save();
                     }
                 }
             }
         }
     }
     $select = 'laststatuscheck < ? AND status = ?';
     $params = array('lasttime' => $cleartime, 'status' => self::WEBEXACTIVITY_STATUS_IN_PROGRESS);
     if ($meetings = $DB->get_records_select('webexactivity', $select, $params)) {
         foreach ($meetings as $meetingrecord) {
             $meeting = meeting::load($meetingrecord);
             $meeting->status = self::WEBEXACTIVITY_STATUS_STOPPED;
             $meeting->laststatuscheck = $processtime;
             $meeting->save();
         }
     }
 }