@@ -14,4 +14,4 @@ |
||
14 | 14 | global $CFG; |
15 | 15 | |
16 | 16 | require_once(dirname(__FILE__).'/lib.php'); |
17 | -require_once($CFG->libdir . '/filelib.php'); |
|
17 | +require_once($CFG->libdir.'/filelib.php'); |
@@ -50,44 +50,44 @@ |
||
50 | 50 | |
51 | 51 | |
52 | 52 | function get_output() { |
53 | - global $CFG; |
|
54 | - |
|
55 | - $out = '<div class="container-fluid">'."\n"; |
|
56 | - $out .= ' <div class="row">'."\n"; |
|
57 | - $out .= ' <div class="col-md-16">'."\n"; |
|
58 | - $out .= ' <div id="alert-info" class="alert alert-info h5 hide">Use Firefox for best experience</div>'."\n"; |
|
59 | - $out .= ' <div id="alert-danger" class="alert alert-danger h5 hide"></div>'."\n"; |
|
60 | - $out .= ' <div class="recordrtc">'."\n"; |
|
61 | - $out .= ' <div class="header">'."\n"; |
|
62 | - $out .= ' <select class="recording-media">'."\n"; |
|
63 | - $out .= ' <option value="record-video">Video</option>'."\n"; |
|
64 | - $out .= ' <option value="record-audio">Audio</option>'."\n"; |
|
65 | - $out .= ' </select>'."\n"; |
|
66 | - $out .= ' <button id="start-stop" class="btn btn-primary btn-lg btn-danger">Start Recording</button>'."\n"; |
|
67 | - $out .= ' </div>'."\n"; |
|
68 | - $out .= ' <div style="display:none;">'."\n"; |
|
69 | - $out .= ' <button id="upload" class="btn btn-primary btn-md">Attach Recording as Annotation</button>'."\n"; |
|
70 | - $out .= ' </div>'."\n"; |
|
71 | - $out .= ' <br>'."\n"; |
|
72 | - $out .= ' <audio id="audio-player" muted></audio>'."\n"; |
|
73 | - $out .= ' <video id="video-player" width="320" height="240" muted></video>'."\n"; |
|
74 | - $out .= ' </div>'."\n"; |
|
75 | - $out .= ' </div>'."\n"; |
|
76 | - $out .= ' </div>'."\n"; |
|
77 | - $out .= '</div>'."\n"; |
|
78 | - |
|
79 | - // Because there is no relative path to TinyMCE, we have to use JavaScript |
|
80 | - // to work out correct path from the .js files from TinyMCE. Only files |
|
81 | - // inside this plugin can be included with relative path (below). |
|
82 | - $out .= '<script type="text/javascript">'."\n"; |
|
83 | - $out .= ' var editor_tinymce_include = function(path) {'."\n"; |
|
84 | - $out .= ' document.write(\'<script type="text/javascript" src="\' + parent.tinyMCE.baseURL + \'/\' + path + \'"></\' + \'script>\');'."\n"; |
|
85 | - $out .= ' };'."\n"; |
|
86 | - $out .= ' editor_tinymce_include(\'tiny_mce_popup.js\');'."\n"; |
|
87 | - $out .= ' editor_tinymce_include(\'utils/validate.js\');'."\n"; |
|
88 | - $out .= ' editor_tinymce_include(\'utils/form_utils.js\');'."\n"; |
|
89 | - $out .= ' editor_tinymce_include(\'utils/editable_selects.js\');'."\n"; |
|
90 | - $out .= '</script>'."\n"; |
|
91 | - |
|
92 | - return $out; |
|
53 | + global $CFG; |
|
54 | + |
|
55 | + $out = '<div class="container-fluid">'."\n"; |
|
56 | + $out .= ' <div class="row">'."\n"; |
|
57 | + $out .= ' <div class="col-md-16">'."\n"; |
|
58 | + $out .= ' <div id="alert-info" class="alert alert-info h5 hide">Use Firefox for best experience</div>'."\n"; |
|
59 | + $out .= ' <div id="alert-danger" class="alert alert-danger h5 hide"></div>'."\n"; |
|
60 | + $out .= ' <div class="recordrtc">'."\n"; |
|
61 | + $out .= ' <div class="header">'."\n"; |
|
62 | + $out .= ' <select class="recording-media">'."\n"; |
|
63 | + $out .= ' <option value="record-video">Video</option>'."\n"; |
|
64 | + $out .= ' <option value="record-audio">Audio</option>'."\n"; |
|
65 | + $out .= ' </select>'."\n"; |
|
66 | + $out .= ' <button id="start-stop" class="btn btn-primary btn-lg btn-danger">Start Recording</button>'."\n"; |
|
67 | + $out .= ' </div>'."\n"; |
|
68 | + $out .= ' <div style="display:none;">'."\n"; |
|
69 | + $out .= ' <button id="upload" class="btn btn-primary btn-md">Attach Recording as Annotation</button>'."\n"; |
|
70 | + $out .= ' </div>'."\n"; |
|
71 | + $out .= ' <br>'."\n"; |
|
72 | + $out .= ' <audio id="audio-player" muted></audio>'."\n"; |
|
73 | + $out .= ' <video id="video-player" width="320" height="240" muted></video>'."\n"; |
|
74 | + $out .= ' </div>'."\n"; |
|
75 | + $out .= ' </div>'."\n"; |
|
76 | + $out .= ' </div>'."\n"; |
|
77 | + $out .= '</div>'."\n"; |
|
78 | + |
|
79 | + // Because there is no relative path to TinyMCE, we have to use JavaScript |
|
80 | + // to work out correct path from the .js files from TinyMCE. Only files |
|
81 | + // inside this plugin can be included with relative path (below). |
|
82 | + $out .= '<script type="text/javascript">'."\n"; |
|
83 | + $out .= ' var editor_tinymce_include = function(path) {'."\n"; |
|
84 | + $out .= ' document.write(\'<script type="text/javascript" src="\' + parent.tinyMCE.baseURL + \'/\' + path + \'"></\' + \'script>\');'."\n"; |
|
85 | + $out .= ' };'."\n"; |
|
86 | + $out .= ' editor_tinymce_include(\'tiny_mce_popup.js\');'."\n"; |
|
87 | + $out .= ' editor_tinymce_include(\'utils/validate.js\');'."\n"; |
|
88 | + $out .= ' editor_tinymce_include(\'utils/form_utils.js\');'."\n"; |
|
89 | + $out .= ' editor_tinymce_include(\'utils/editable_selects.js\');'."\n"; |
|
90 | + $out .= '</script>'."\n"; |
|
91 | + |
|
92 | + return $out; |
|
93 | 93 | } |
@@ -19,15 +19,15 @@ |
||
19 | 19 | $PAGE->set_context($context); |
20 | 20 | $PAGE->set_url(MOODLE_TINYMCE_RECORDRTC_URL); |
21 | 21 | $PAGE->set_cacheable(false); |
22 | -$title = isset($cm->name)? $cm->name: ''; |
|
22 | +$title = isset($cm->name) ? $cm->name : ''; |
|
23 | 23 | $PAGE->set_title($title); |
24 | 24 | $PAGE->set_heading($title); |
25 | 25 | |
26 | 26 | // Reset page layout for inside editor. |
27 | 27 | $PAGE->set_pagelayout('embedded'); |
28 | 28 | |
29 | -$PAGE->requires->css( new moodle_url($CFG->wwwroot.MOODLE_TINYMCE_RECORDRTC_ROOT.'tinymce/css/style.css') ); |
|
30 | -$PAGE->requires->js( new moodle_url($CFG->wwwroot.MOODLE_TINYMCE_RECORDRTC_ROOT.'tinymce/js/detector.js') ); |
|
29 | +$PAGE->requires->css(new moodle_url($CFG->wwwroot.MOODLE_TINYMCE_RECORDRTC_ROOT.'tinymce/css/style.css')); |
|
30 | +$PAGE->requires->js(new moodle_url($CFG->wwwroot.MOODLE_TINYMCE_RECORDRTC_ROOT.'tinymce/js/detector.js')); |
|
31 | 31 | |
32 | 32 | $jsVars = array( |
33 | 33 | 'contextid' => $contextid, |
@@ -41,15 +41,15 @@ |
||
41 | 41 | // Prepare file record object. |
42 | 42 | $user_context = context_user::instance($USER->id); |
43 | 43 | $fileinfo = array( |
44 | - 'contextid' => $user_context->id, // ID of context. |
|
45 | - 'component' => 'tinymce_recordrtc', // Usually = table name. |
|
46 | - 'filearea' => 'annotation', // Usually = table name. |
|
47 | - 'itemid' => time(), // Usually = ID of row in table. |
|
48 | - 'filepath' => '/', // Any path beginning and ending in "/". |
|
49 | - 'filename' => $fileName, // Any filename. |
|
50 | - 'author' => fullname($USER), |
|
51 | - 'licence' => $CFG->sitedefaultlicense |
|
52 | - ); |
|
44 | + 'contextid' => $user_context->id, // ID of context. |
|
45 | + 'component' => 'tinymce_recordrtc', // Usually = table name. |
|
46 | + 'filearea' => 'annotation', // Usually = table name. |
|
47 | + 'itemid' => time(), // Usually = ID of row in table. |
|
48 | + 'filepath' => '/', // Any path beginning and ending in "/". |
|
49 | + 'filename' => $fileName, // Any filename. |
|
50 | + 'author' => fullname($USER), |
|
51 | + 'licence' => $CFG->sitedefaultlicense |
|
52 | + ); |
|
53 | 53 | $fileSaved = $fs->create_file_from_pathname($fileinfo, $fileTmp); |
54 | 54 | |
55 | 55 | //// OK response. |
@@ -19,16 +19,16 @@ discard block |
||
19 | 19 | require_login($course, false, $cm); |
20 | 20 | require_sesskey(); |
21 | 21 | |
22 | -if ( !isset($_FILES["audio-blob"]) && !isset($_FILES["video-blob"]) ) { |
|
22 | +if (!isset($_FILES["audio-blob"]) && !isset($_FILES["video-blob"])) { |
|
23 | 23 | error_log("Blob not included"); |
24 | 24 | header("HTTP/1.0 400 Bad Request"); |
25 | 25 | return; |
26 | -} else if ( !isset($_POST["audio-filename"]) && !isset($_POST["video-filename"]) ) { |
|
26 | +} else if (!isset($_POST["audio-filename"]) && !isset($_POST["video-filename"])) { |
|
27 | 27 | error_log("Filename not included"); |
28 | 28 | header("HTTP/1.0 400 Bad Request"); |
29 | 29 | return; |
30 | 30 | } else { |
31 | - if ( !isset($_FILES["audio-blob"]) || !isset($_POST["audio-filename"]) ) { |
|
31 | + if (!isset($_FILES["audio-blob"]) || !isset($_POST["audio-filename"])) { |
|
32 | 32 | $fileName = $_POST["video-filename"]; |
33 | 33 | $fileTmp = $_FILES["video-blob"]["tmp_name"]; |
34 | 34 | } else { |
@@ -41,12 +41,12 @@ discard block |
||
41 | 41 | // Prepare file record object. |
42 | 42 | $user_context = context_user::instance($USER->id); |
43 | 43 | $fileinfo = array( |
44 | - 'contextid' => $user_context->id, // ID of context. |
|
44 | + 'contextid' => $user_context->id, // ID of context. |
|
45 | 45 | 'component' => 'tinymce_recordrtc', // Usually = table name. |
46 | - 'filearea' => 'annotation', // Usually = table name. |
|
47 | - 'itemid' => time(), // Usually = ID of row in table. |
|
48 | - 'filepath' => '/', // Any path beginning and ending in "/". |
|
49 | - 'filename' => $fileName, // Any filename. |
|
46 | + 'filearea' => 'annotation', // Usually = table name. |
|
47 | + 'itemid' => time(), // Usually = ID of row in table. |
|
48 | + 'filepath' => '/', // Any path beginning and ending in "/". |
|
49 | + 'filename' => $fileName, // Any filename. |
|
50 | 50 | 'author' => fullname($USER), |
51 | 51 | 'licence' => $CFG->sitedefaultlicense |
52 | 52 | ); |
@@ -11,8 +11,8 @@ |
||
11 | 11 | |
12 | 12 | defined('MOODLE_INTERNAL') || die(); |
13 | 13 | |
14 | -$plugin->version = 2016120103; // The current plugin version (Date: YYYYMMDDXX). |
|
15 | -$plugin->requires = 2014051200; // Requires this Moodle version. |
|
16 | -$plugin->component = 'tinymce_recordrtc'; // Full name of the plugin (used for diagnostics). |
|
17 | -$plugin->maturity = MATURITY_ALPHA; // Maturity level. (ALPHA, BETA, RC, STABLE) |
|
14 | +$plugin->version = 2016120103; // The current plugin version (Date: YYYYMMDDXX). |
|
15 | +$plugin->requires = 2014051200; // Requires this Moodle version. |
|
16 | +$plugin->component = 'tinymce_recordrtc'; // Full name of the plugin (used for diagnostics). |
|
17 | +$plugin->maturity = MATURITY_ALPHA; // Maturity level. (ALPHA, BETA, RC, STABLE) |
|
18 | 18 | $plugin->release = '1.0-a4'; |
@@ -40,7 +40,7 @@ |
||
40 | 40 | $this->add_js_plugin($params); |
41 | 41 | |
42 | 42 | // Add parameters for recordrtc. |
43 | - $params['recordrtc'] = array('contextid' => $options['context']->id, 'sesskey' => sesskey() ); |
|
43 | + $params['recordrtc'] = array('contextid' => $options['context']->id, 'sesskey' => sesskey()); |
|
44 | 44 | |
45 | 45 | // Position button in toolbar. |
46 | 46 | if ($row = $this->find_button($params, 'moodlemedia')) { |