@@ -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" style="display:none">'."\n"; |
|
| 63 | - $out .= ' <option value="record-audio">Audio</option>'."\n"; |
|
| 64 | - $out .= ' </select>'."\n"; |
|
| 65 | - $out .= ' <select class="media-container-format" style="display:none">'."\n"; |
|
| 66 | - $out .= ' <option>Ogg</option>'."\n"; |
|
| 67 | - $out .= ' </select>'."\n"; |
|
| 68 | - $out .= ' <button class="btn btn-primary btn-lg btn-danger">Start Recording</button>'."\n"; |
|
| 69 | - $out .= ' </div>'."\n"; |
|
| 70 | - $out .= ' <div style="display:none;">'."\n"; |
|
| 71 | - $out .= ' <button class="btn btn-primary btn-md" id="upload-to-server">Upload Recording to Server</button>'."\n"; |
|
| 72 | - $out .= ' </div>'."\n"; |
|
| 73 | - $out .= ' <video width="1" height="1" 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" style="display:none">'."\n"; |
|
| 63 | + $out .= ' <option value="record-audio">Audio</option>'."\n"; |
|
| 64 | + $out .= ' </select>'."\n"; |
|
| 65 | + $out .= ' <select class="media-container-format" style="display:none">'."\n"; |
|
| 66 | + $out .= ' <option>Ogg</option>'."\n"; |
|
| 67 | + $out .= ' </select>'."\n"; |
|
| 68 | + $out .= ' <button class="btn btn-primary btn-lg btn-danger">Start Recording</button>'."\n"; |
|
| 69 | + $out .= ' </div>'."\n"; |
|
| 70 | + $out .= ' <div style="display:none;">'."\n"; |
|
| 71 | + $out .= ' <button class="btn btn-primary btn-md" id="upload-to-server">Upload Recording to Server</button>'."\n"; |
|
| 72 | + $out .= ' </div>'."\n"; |
|
| 73 | + $out .= ' <video width="1" height="1" 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,16 +19,16 @@ |
||
| 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/RecordRTC.js') ); |
|
| 31 | -$PAGE->requires->js( new moodle_url($CFG->wwwroot.MOODLE_TINYMCE_RECORDRTC_ROOT.'tinymce/js/gumadapter.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/RecordRTC.js')); |
|
| 31 | +$PAGE->requires->js(new moodle_url($CFG->wwwroot.MOODLE_TINYMCE_RECORDRTC_ROOT.'tinymce/js/gumadapter.js')); |
|
| 32 | 32 | |
| 33 | 33 | $jsVars = array( |
| 34 | 34 | 'contextid' => $contextid, |
@@ -38,15 +38,15 @@ |
||
| 38 | 38 | // Prepare file record object |
| 39 | 39 | $user_context = context_user::instance($USER->id); |
| 40 | 40 | $fileinfo = array( |
| 41 | - 'contextid' => $user_context->id, // ID of context |
|
| 42 | - 'component' => 'tinymce_recordrtc', // usually = table name |
|
| 43 | - 'filearea' => 'annotation', // usually = table name |
|
| 44 | - 'itemid' => time(), // usually = ID of row in table |
|
| 45 | - 'filepath' => '/', // any path beginning and ending in / |
|
| 46 | - 'filename' => $fileName, // any filename |
|
| 47 | - 'author' => fullname($USER), |
|
| 48 | - 'licence' => $CFG->sitedefaultlicense |
|
| 49 | - ); |
|
| 41 | + 'contextid' => $user_context->id, // ID of context |
|
| 42 | + 'component' => 'tinymce_recordrtc', // usually = table name |
|
| 43 | + 'filearea' => 'annotation', // usually = table name |
|
| 44 | + 'itemid' => time(), // usually = ID of row in table |
|
| 45 | + 'filepath' => '/', // any path beginning and ending in / |
|
| 46 | + 'filename' => $fileName, // any filename |
|
| 47 | + 'author' => fullname($USER), |
|
| 48 | + 'licence' => $CFG->sitedefaultlicense |
|
| 49 | + ); |
|
| 50 | 50 | $fileSaved = $fs->create_file_from_pathname($fileinfo, $fileTmp); |
| 51 | 51 | |
| 52 | 52 | //// OK response |
@@ -20,12 +20,12 @@ discard block |
||
| 20 | 20 | require_sesskey(); |
| 21 | 21 | |
| 22 | 22 | //foreach(array('video', 'audio') as $type) { //Only works with audio |
| 23 | -foreach(array('audio') as $type) { |
|
| 24 | - if ( !isset($_FILES["${type}-blob"]) ) { |
|
| 23 | +foreach (array('audio') as $type) { |
|
| 24 | + if (!isset($_FILES["${type}-blob"])) { |
|
| 25 | 25 | error_log("Blob not included"); |
| 26 | 26 | header("HTTP/1.0 400 Bad Request"); |
| 27 | 27 | return; |
| 28 | - } else if ( !isset($_POST["${type}-filename"]) ) { |
|
| 28 | + } else if (!isset($_POST["${type}-filename"])) { |
|
| 29 | 29 | error_log("Filename not included"); |
| 30 | 30 | header("HTTP/1.0 400 Bad Request"); |
| 31 | 31 | return; |
@@ -38,12 +38,12 @@ discard block |
||
| 38 | 38 | // Prepare file record object |
| 39 | 39 | $user_context = context_user::instance($USER->id); |
| 40 | 40 | $fileinfo = array( |
| 41 | - 'contextid' => $user_context->id, // ID of context |
|
| 41 | + 'contextid' => $user_context->id, // ID of context |
|
| 42 | 42 | 'component' => 'tinymce_recordrtc', // usually = table name |
| 43 | - 'filearea' => 'annotation', // usually = table name |
|
| 44 | - 'itemid' => time(), // usually = ID of row in table |
|
| 45 | - 'filepath' => '/', // any path beginning and ending in / |
|
| 46 | - 'filename' => $fileName, // any filename |
|
| 43 | + 'filearea' => 'annotation', // usually = table name |
|
| 44 | + 'itemid' => time(), // usually = ID of row in table |
|
| 45 | + 'filepath' => '/', // any path beginning and ending in / |
|
| 46 | + 'filename' => $fileName, // any filename |
|
| 47 | 47 | 'author' => fullname($USER), |
| 48 | 48 | 'licence' => $CFG->sitedefaultlicense |
| 49 | 49 | ); |
@@ -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')) { |
@@ -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'); |
|
@@ -11,8 +11,8 @@ |
||
| 11 | 11 | |
| 12 | 12 | defined('MOODLE_INTERNAL') || die(); |
| 13 | 13 | |
| 14 | -$plugin->version = 2016120102; // 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 = 2016120102; // 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-a3'; |