5ca8f561 by logesh

dev:changes in notes

1 parent f9077e02
1 define(["jquery"],function(e){return{init:function(){var o=e(location).attr("href");e("document").ready(function(){if(o.includes("/mod/page/view.php")){var n=document.querySelector("iframe"),t=new Vimeo.Player(n);t.on("play",function(){console.log("played the video!"),setTimeout(function(){t.getCurrentTime().then(function(e){console.log("time video played"),console.log(e)})},1500)}),t.getVideoId().then(function(e){console.log("video id"),console.log(e),console.log("*******")}),setTimeout(function(){t.getCurrentTime().then(function(e){console.log("time out function"),console.log(e)})},1500),e("#mynotepencil").click(function(){var o;t.getCurrentTime().then(function(e){o=e}),setTimeout(function(){console.log(o);var n="<div> You have taken notes at ";n+=o;var t=(n+=" in this video.</div>").fontcolor("green");e("#id_mynotecontent-258").val(t)},1e3)}),t.pause().then(function(){alert("the video was paused")})}})}}});
...\ No newline at end of file ...\ No newline at end of file
1 define(["jquery"],function(e){return{init:function(){var n=e(location).attr("href");e("document").ready(function(){if(n.includes("/mod/page/view.php")){var t=document.querySelector("iframe"),i=new Vimeo.Player(t);e("#mynotepencil").click(function(){var e;i.getCurrentTime().then(function(n){e=n}),setTimeout(function(){var n="<div> You have taken notes at ";n+=e;(n+=" in this video.</div>").fontcolor("green")},1e3)}),i.pause().then(function(){alert("the video was paused")})}})}}});
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -12,35 +12,6 @@ define(['jquery'], function($) { ...@@ -12,35 +12,6 @@ define(['jquery'], function($) {
12 12
13 var player = new Vimeo.Player(iframe); 13 var player = new Vimeo.Player(iframe);
14 14
15 player.on("play", function() {
16 console.log('played the video!');
17 setTimeout(function(){
18
19 player.getCurrentTime().then(function(seconds) {
20 console.log("time video played");
21 console.log(seconds);
22 })
23
24 }, 1500);
25 });
26
27 player.getVideoId().then(function(id) {
28 // id = the video id
29 console.log("video id");
30 console.log(id);
31 console.log("*******")
32 })
33
34
35 setTimeout(function(){
36
37 player.getCurrentTime().then(function(seconds) {
38 console.log("time out function");
39 console.log(seconds);
40 })
41
42 }, 1500);
43
44 15
45 $('#mynotepencil').click(function(){ 16 $('#mynotepencil').click(function(){
46 17
...@@ -52,31 +23,22 @@ define(['jquery'], function($) { ...@@ -52,31 +23,22 @@ define(['jquery'], function($) {
52 }) 23 })
53 setTimeout(function(){ 24 setTimeout(function(){
54 25
55 console.log(time);
56 26
57 27 // var str = "<div> You have taken notes at ";
58 var str = "<div> You have taken notes at "; 28 // str +=time;
59 str +=time; 29 // str +=" in this video.</div>"
60 str +=" in this video.</div>" 30 // var result = str.fontcolor("green");
61 var result = str.fontcolor("green"); 31 // $("#id_mynotecontent-258").val(result);
62 $("#id_mynotecontent-258").val(result);
63 32
64 }, 1000); 33 }, 1000);
65 34
66 }); 35 });
67 36
68
69
70 player.pause().then(function() { 37 player.pause().then(function() {
71 alert('the video was paused'); 38 alert('the video was paused');
72 }) 39 })
73 40
74 41
75 /*.catch(function(error) {
76 // an error occurred
77 });*/
78
79
80 } 42 }
81 }); 43 });
82 } 44 }
......
...@@ -147,9 +147,10 @@ class block_mynotes_manager { ...@@ -147,9 +147,10 @@ class block_mynotes_manager {
147 * 147 *
148 * @return object of single mynote record if insert to DB else false 148 * @return object of single mynote record if insert to DB else false
149 */ 149 */
150 public function addmynote($context, $contextarea, $course, $content, $format = FORMAT_MOODLE) { 150 public function addmynote($context, $contextarea, $course, $content,$timer, $format = FORMAT_MOODLE) {
151 global $CFG, $DB, $USER, $OUTPUT; 151 global $CFG, $DB, $USER, $OUTPUT;
152 152 $content=$content.$timer;
153 // print_r($content);
153 $newnote = new stdClass; 154 $newnote = new stdClass;
154 $newnote->contextid = $context->id; 155 $newnote->contextid = $context->id;
155 $newnote->contextarea = $contextarea; 156 $newnote->contextarea = $contextarea;
......
...@@ -65,8 +65,10 @@ echo $OUTPUT->header(); //...send headers ...@@ -65,8 +65,10 @@ echo $OUTPUT->header(); //...send headers
65 switch ($action) { 65 switch ($action) {
66 case 'add': 66 case 'add':
67 $content = optional_param('content', '', PARAM_RAW); 67 $content = optional_param('content', '', PARAM_RAW);
68 $timer = optional_param('notestime', 0, PARAM_TEXT);
69 print_r($timer);
68 $manager = new block_mynotes_manager(); 70 $manager = new block_mynotes_manager();
69 if ($note = $manager->addmynote($context, $contextarea, $course, $content)) { 71 if ($note = $manager->addmynote($context, $contextarea, $course, $content,$timer)) {
70 $options = new stdClass(); 72 $options = new stdClass();
71 $options->page = $page; 73 $options->page = $page;
72 $options->courseid = $course->id; 74 $options->courseid = $course->id;
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!