コード例 #1
0
/**
 * Update an WebEx Meeting instance.
 *
 * @param stdClass              $data Form data
 * @param mod_assign_mod_form   $form The form
 * @return bool                 If the update passed (true) or failed
 */
function webexactivity_update_instance($data, $mform)
{
    global $PAGE;
    $cmid = $data->coursemodule;
    $cm = get_coursemodule_from_id('webexactivity', $cmid, 0, false, MUST_EXIST);
    $meeting = \mod_webexactivity\meeting::load($cm->instance);
    $meeting->starttime = $data->starttime;
    $meeting->duration = $data->duration;
    if (isset($data->longavailability)) {
        $meeting->endtime = $data->endtime;
    } else {
        $meeting->endtime = null;
    }
    $meeting->intro = $data->intro;
    $meeting->introformat = $data->introformat;
    $meeting->name = $data->name;
    $meeting->course = $data->course;
    if (isset($data->password) && !empty($data->password)) {
        $meeting->password = $data->password;
    } else {
        $meeting->password = null;
    }
    if (isset($data->studentdownload) && $data->studentdownload) {
        $meeting->studentdownload = 1;
    } else {
        $meeting->studentdownload = 0;
    }
    try {
        return $meeting->save();
    } catch (Exception $e) {
        $collision = $e instanceof \mod_webexactivity\exception\webex_user_collision;
        $password = $e instanceof \mod_webexactivity\exception\bad_password;
        if ($collision || $password) {
            \mod_webexactivity\webex::password_redirect($PAGE->url);
        } else {
            throw $e;
        }
        throw $e;
    }
}
コード例 #2
0
     if ($webexmeeting->is_admin_created()) {
         // New style.
         $webexmeeting->change_webexuser_host($webexuser);
         $params = array('id' => $id, 'action' => 'hostmeetingerror');
         $failurl = new moodle_url($returnurl, $params);
         $authurl = $webexmeeting->get_authed_host_url($failurl->out(false), $returnurl->out(false));
     } else {
         // Old style (pre 0.2.0).
         $webexmeeting->add_webexuser_host($webexuser);
         $hosturl = $webexmeeting->get_host_url($returnurl);
         $params = array('id' => $id, 'action' => 'hostmeetingerror');
         $failurl = new moodle_url($returnurl, $params);
         try {
             $authurl = $webexuser->get_login_url($failurl->out(false), $hosturl);
         } catch (\mod_webexactivity\local\exception\bad_password $e) {
             \mod_webexactivity\webex::password_redirect($returnurl);
         }
     }
     if (empty($SESSION->mod_webexactivity_sestype) || $SESSION->mod_webexactivity_sestype != $webexmeeting::TYPE_CODE) {
         $SESSION->mod_webexactivity_sestype = $webexmeeting::TYPE_CODE;
         $hostreturnurl = $returnurl . "&action=hostmeeting";
         $switchmturl = $webexmeeting->get_switch_meeting_type_ulr($webexmeeting::TYPE_CODE, $hostreturnurl);
         redirect($switchmturl);
     } else {
         redirect($authurl);
     }
     break;
 case 'joinmeeting':
     if (!$webexmeeting->is_available()) {
         break;
     }