} else { error('You must specify a course_module ID or an instance ID'); } require_login($course, true, $cm); $context = context_module::instance($cm->id); $noerror = get_string('noerror','wiziq'); $params = array( 'objectid' => $wiziq->class_id, 'relateduserid' => $USER->id, 'courseid' => $wiziq->course, 'context' => $context, 'other' => array( 'error' => '' ) ); $event = \mod_wiziq\event\wiziq_classdetail::create($params); $event->trigger(); //Print the page header $PAGE->set_url('/mod/wiziq/view.php', array('id' => $cm->id)); $PAGE->set_title(format_string($wiziq->name)); $pagetitle = get_string('wiziq_class', 'wiziq'); $pagetitlename = $pagetitle." ".$wiziq->name; $PAGE->set_heading(format_string($pagetitlename)); $PAGE->set_context($context); //------- print output---- echo $OUTPUT->header(); //-------html table just to make the navigation tabs--------
/** * Generates the download recording link after completion of class. * * @param integer $courseid the course id in which the class is scheduled. * @param integer $class_id the class id for which recording link will be generated. * @param string $download_recording_link download recording link for the class. * @param string $errormsg Error description to be shown to user. * */ function wiziq_downloadrecording($courseid, $context, $class_id, &$download_recording_link, &$errormsg) { global $CFG, $wiziq_secretacesskey, $wiziq_access_key, $wiziq_webserviceurl, $USER; $wiziq_secretacesskey = $CFG->wiziq_secretacesskey; $wiziq_access_key = $CFG->wiziq_access_key; $wiziq_webserviceurl = $CFG->wiziq_webserviceurl; require_once("authbase.php"); $wiziq_authbase = new wiziq_authbase($wiziq_secretacesskey, $wiziq_access_key); $method = "download_recording"; $requestparameters["signature"]=$wiziq_authbase->wiziq_generatesignature($method, $requestparameters); $requestparameters["class_id"] = $class_id; $curos=strtolower($_SERVER['HTTP_USER_AGENT']); if (strstr($curos, "win")) { $requestparameters["recording_format"] = "exe"; } else { $requestparameters["recording_format"] = "zip"; } $wiziq_httprequest=new wiziq_httprequest(); try { $xmlreturn=$wiziq_httprequest->wiziq_do_post_request( $wiziq_webserviceurl.'?method=download_recording', $requestparameters); libxml_use_internal_errors(true); $objdom = new SimpleXMLElement($xmlreturn, LIBXML_NOCDATA); $attribnode = (string)$objdom->attributes(); if ($attribnode=="ok") { $download_recording = $objdom->download_recording; $download_status=(string)$download_recording->download_status; if ($download_status == "true") { $rec_statusnode = (string)$download_recording->attributes(); if ($rec_statusnode == "true") { $status_xml_path=(string)$download_recording->status_xml_path; wiziq_download_recording($courseid, $status_xml_path, $download_rec_link_path, $errormsgdown); if (!empty($download_rec_link_path)) { $download_recording_link = $download_rec_link_path; } else { $errormsg = get_string('recnotcreatedyet', 'wiziq'); } } else { $download_recording_link = null; } } } else if ($attribnode=="fail") { $att = 'msg'; $code = 'code'; $error_code = (string)$objdom->error->attributes()->$code; $error_msg = (string)$objdom->error->attributes()->$att; //can be used while debug $errormsg = $error_code." ".$error_msg; $params = array( 'objectid' => $class_id, 'relateduserid' => $USER->id, 'courseid' => $courseid, 'context' => $context, 'other' => array( 'error' => $errormsg ) ); $event = \mod_wiziq\event\wiziq_classdetail::create($params); $event->trigger(); } } catch (Exception $e) { $errormsg = $e->getMessage().'<br />'.get_string('errorinservice', 'wiziq'); $params = array( 'objectid' => $class_id, 'relateduserid' => $USER->id, 'courseid' => $courseid, 'context' => $context, 'other' => array( 'error' => $errormsg ) ); $event = \mod_wiziq\event\wiziq_classdetail::create($params); $event->trigger(); } }//end function