$completion = new completion_info($course); $completion->set_module_viewed($cm); $PAGE->set_url('/mod/webex/view.php', array('id' => $cm->id)); // Make sure webex exists before generating output - some older sites may contain empty webexs // Do not use PARAM_webex here, it is too strict and does not support general URIs! $extwebex = trim($url->externalurl); if (empty($extwebex) or $extwebex === 'http://') { webex_print_header($url, $cm, $course); webex_print_heading($url, $cm, $course); webex_print_intro($url, $cm, $course); notice(get_string('invalidstoredwebex', 'webex'), new moodle_url('/course/view.php', array('id' => $cm->course))); die; } unset($extwebex); if ($redirect) { // coming from course page or webex index page, // the redirection is needed for completion tracking and logging $fullurl = webex_get_full_webex($url, $cm, $course); redirect(str_replace('&', '&', $fullurl)); } switch (webex_get_final_display_type($url)) { case RESOURCELIB_DISPLAY_EMBED: webex_display_embed($url, $cm, $course); break; case RESOURCELIB_DISPLAY_FRAME: webex_display_frame($url, $cm, $course); break; default: webex_print_workaround($url, $cm, $course); break; }
function webex_print_workaround($url, $cm, $course) { global $OUTPUT; webex_print_header($url, $cm, $course); webex_print_heading($url, $cm, $course, true); webex_print_intro($url, $cm, $course, true); $fullurl = webex_get_full_webex($url, $cm, $course); $display = webex_get_final_display_type($url); if ($display == RESOURCELIB_DISPLAY_POPUP) { $jsfullwebex = addslashes_js($fullurl); $options = empty($url->displayoptions) ? array() : unserialize($url->displayoptions); $width = empty($options['popupwidth']) ? 620 : $options['popupwidth']; $height = empty($options['popupheight']) ? 450 : $options['popupheight']; $wh = "width={$width},height={$height},toolbar=no,location=no,menubar=no,copyhistory=no,status=no,directories=no,scrollbars=yes,resizable=yes"; $extra = "onclick=\"window.open('{$jsfullwebex}', '', '{$wh}'); return false;\""; } else { if ($display == RESOURCELIB_DISPLAY_NEW) { $extra = "onclick=\"this.target='_blank';\""; } else { $extra = ''; } } echo '<div class="urlworkaround"><a href="' . $fullurl . '" >'; //get_string('clicktoopen', 'webex'); print_string('clicktoopen', 'webex', ""); echo '</a></div>'; echo $OUTPUT->footer(); die; }
/** * Given a course_module object, this function returns any * "extra" information that may be needed when printing * this activity in a course listing. * * See {@link get_array_of_activities()} in course/lib.php * * @param object $coursemodule * @return object info */ function webex_get_coursemodule_info($coursemodule) { global $CFG, $DB; require_once "{$CFG->dirroot}/mod/webex/locallib.php"; if (!($url = $DB->get_record('webex', array('id' => $coursemodule->instance), 'id, name, display, displayoptions, externalurl, parameters, intro, introformat'))) { return NULL; } $info = new cached_cm_info(); $info->name = $url->name; $display = webex_get_final_display_type($url); if ($display == RESOURCELIB_DISPLAY_POPUP) { $fullurl = "{$CFG->wwwroot}/mod/webex/view.php?id={$coursemodule->id}&redirect=1"; $options = empty($url->displayoptions) ? array() : unserialize($url->displayoptions); $width = empty($options['popupwidth']) ? 620 : $options['popupwidth']; $height = empty($options['popupheight']) ? 450 : $options['popupheight']; $wh = "width={$width},height={$height},toolbar=no,location=no,menubar=no,copyhistory=no,status=no,directories=no,scrollbars=yes,resizable=yes"; $info->onclick = "window.open('{$fullurl}', '', '{$wh}'); return false;"; } else { if ($display == RESOURCELIB_DISPLAY_NEW) { $fullurl = "{$CFG->wwwroot}/mod/webex/view.php?id={$coursemodule->id}&redirect=1"; $info->onclick = "window.open('{$fullurl}'); return false;"; } } if ($coursemodule->showdescription) { // Convert intro to html. Do not filter cached version, filters run at display time. $info->content = format_module_intro('webex', $url, $coursemodule->id, false); } return $info; }