06ce11f1 by logesh

dev:changes in notes

1 parent 892007c9
1 Copyright (c) 2013-2016 GitHub, Inc. and contributors
2
3 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
5 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
7 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 define('AJAX_SCRIPT', true);
3 define('NO_DEBUG_DISPLAY', true);
4 require_once('../../config.php');
5 require_once($CFG->dirroot . '/blocks/mynotes/lib.php');
6
7
8 require_login ();
9
10 $context = context_system::instance ();
11 $PAGE->set_context ( $context );
12 $action = optional_param('action', '', PARAM_ALPHA);
13
14 $PAGE->requires->js_call_amd('block_mynotes/script', 'init');
15 $PAGE->set_url('/blocks/mynotes/allnotes_ajax.php');
16
17 switch ($action){
18
19 case 'edit':
20 $noteid = required_param('noteid', PARAM_INT);
21 $notes = required_param('newnotes', PARAM_TEXT);
22 $manager = new block_mynotes_manager();
23
24 if ($manager->edit($noteid,$notes)) {
25 echo json_encode(array('result' => "successfully updated"));
26 }else{
27 echo json_encode(array('error' => 'Unable to update edited note'));
28
29 }
30 die();
31 break;
32
33
34
35 case 'delete':
36 $noteid = required_param('noteid', PARAM_INT);
37 $manager = new block_mynotes_manager();
38 // $noteid=547;
39 if ($manager->delete($noteid)) {
40 echo json_encode(array('noteid' => $noteid, 'result' => "deleted"));
41 }
42 else {
43 echo json_encode(array('error' => 'Unable to delete note'));
44 }
45 die();
46 break;
47
48 }
49 die();
...\ 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 e=document.querySelector("iframe");new Vimeo.Player(e)}})}}});
...\ No newline at end of file ...\ No newline at end of file
1 define(['jquery','core/config',], function($,config) {
2
3 return {
4 init: function() {
5
6 var CONFIG;
7
8
9 $('.notes_overview').hide();
10
11
12 var url= $(location).attr('href');
13
14
15 if(url.includes('/mynotes/view.php')){
16
17 $('.page-header').css('margin-top','2em !important');
18
19 $('.page-title').css('margin-top','inherit !important');
20
21 }
22
23 $(document).ready(function(){
24
25 $(".notes_section").click(function(){
26
27 var eventId=this.id;
28 $('#notes_table_id'+eventId).toggle();
29 });
30
31 $(".notes_section").click(function(){
32 var eventId=this.id;
33
34 var classname=$( "div#"+eventId ).children()[0].className;
35
36 if (classname === 'notes_course fa fa-chevron-circle-right'){
37
38 $( "#icon"+eventId ).removeClass( 'notes_course fa fa-chevron-circle-right' );
39 $( "#icon"+eventId ).addClass( 'notes_course fa fa-chevron-circle-down' );
40 }
41 else if (classname === 'notes_course fa fa-chevron-circle-down'){
42 $( "#icon"+eventId ).removeClass( 'notes_course fa fa-chevron-circle-down' );
43 $( "#icon"+eventId ).addClass( 'notes_course fa fa-chevron-circle-right' );
44 }
45
46 });
47
48
49 $("#excel_download").click(function(){
50 var rootPath = M.cfg.wwwroot
51
52 var arg = {
53 action: 'download',
54
55 };
56
57 $.ajax({
58 url: rootPath+"/blocks/mynotes/notes_excel.php",
59 type: "POST",
60 data: arg,
61 success: function(response){
62 //do action
63 },
64 error: function(){
65 // do action
66 }
67
68 });
69
70 });
71
72
73
74 $("a.delete_note").click(function(){
75
76 var deleteId=this.id;
77
78 var arg = {
79 action: 'delete',
80 noteid: deleteId,
81 };
82
83 var rootPath = M.cfg.wwwroot;
84 $.ajax({
85 type: 'post',
86 url: rootPath+'/blocks/mynotes/allnotes_ajax.php',
87 data:arg,
88 success: function( data ) {
89 var deleteid=data.noteid;
90 $("#notes"+deleteid).remove();
91 },
92 error: function(data, errorThrown)
93 {
94 alert('request failed :'+errorThrown);
95 }
96 });
97
98
99 });
100
101
102
103 $("a.edit_note").click(function(){
104
105 var editId=this.id;
106
107 // notes_content+editId;
108 var vals=document.getElementById('notes_content'+editId).contentEditable = true;
109 document.getElementById('notes_content'+editId).focus();
110 // console.log('notes_content'+editId);
111 $('#notes_content'+editId).keypress(function(event) {
112
113 if (event.keyCode == 13) {
114
115 var newstring= $('#notes_content'+editId).text();
116 // console.log(newstring);
117
118 var vals=document.getElementById('notes_content'+editId).contentEditable = false;
119
120 var arg = {
121 action: 'edit',
122 noteid: editId,
123 newnotes:newstring,
124 };
125
126 var rootPath = M.cfg.wwwroot;
127 $.ajax({
128 type: 'post',
129 url: rootPath+'/blocks/mynotes/allnotes_ajax.php',
130 data:arg,
131 success: function( data ) {
132
133 },
134 error: function(data, errorThrown)
135 {
136 alert('request failed :'+errorThrown);
137 var vals=document.getElementById('notes_content'+editId).contentEditable = true;
138 }
139 });
140
141
142
143
144
145 }
146
147
148
149
150 });
151
152
153
154 });
155
156
157
158
159 });
160
161
162 }
163 };
164 });
......
1 define(['jquery'], function($) { 1 define(['jquery','core/config',], function($,config) {
2 2
3 return { 3 return {
4 init: function() { 4 init: function() {
5 // tab-mynotes_user
6 5
7 // tab-mynotes_user mynotepencil 6 var CONFIG;
8 7
9 console.log('init function got invoked ');
10 8
11 $('#mynotepencil').click(function(){ 9 $('.notes_overview').hide();
12 console.log('init function got invoked '); 10
11
12 var url= $(location).attr('href');
13
14
15 if(url.includes('/mynotes/view.php')){
16
17 $('.page-header').css('margin-top','2em !important');
18
19 $('.page-title').css('margin-top','inherit !important');
20
21 }
22
23 $(document).ready(function(){
24
25 $(".notes_section").click(function(){
26
27 var eventId=this.id;
28 $('#notes_table_id'+eventId).toggle();
29 });
13 30
31 $(".notes_section").click(function(){
32 var eventId=this.id;
33
34 var classname=$( "div#"+eventId ).children()[0].className;
35
36 if (classname === 'notes_course fa fa-chevron-circle-right'){
37
38 $( "#icon"+eventId ).removeClass( 'notes_course fa fa-chevron-circle-right' );
39 $( "#icon"+eventId ).addClass( 'notes_course fa fa-chevron-circle-down' );
40 }
41 else if (classname === 'notes_course fa fa-chevron-circle-down'){
42 $( "#icon"+eventId ).removeClass( 'notes_course fa fa-chevron-circle-down' );
43 $( "#icon"+eventId ).addClass( 'notes_course fa fa-chevron-circle-right' );
44 }
45
46 });
47
48
49 $("#excel_download").click(function(){
50 var rootPath = M.cfg.wwwroot
51
52 var arg = {
53 action: 'download',
54
55 };
56
57 $.ajax({
58 url: rootPath+"/blocks/mynotes/notes_excel.php",
59 type: "POST",
60 data: arg,
61 success: function(response){
62 //do action
63 },
64 error: function(){
65 // do action
66 }
67
68 });
69
70 });
71
72
73
74 $("a.delete_note").click(function(){
75
76 var deleteId=this.id;
77
78 var arg = {
79 action: 'delete',
80 noteid: deleteId,
81 };
82
83 var rootPath = M.cfg.wwwroot;
84 $.ajax({
85 type: 'post',
86 url: rootPath+'/blocks/mynotes/allnotes_ajax.php',
87 data:arg,
88 success: function( data ) {
89 var deleteid=data.noteid;
90 $("#notes"+deleteid).remove();
91 },
92 error: function(data, errorThrown)
93 {
94 alert('request failed :'+errorThrown);
95 }
96 });
97
98
99 });
100
101
102
103 $("a.edit_note").click(function(){
104
105 var editId=this.id;
106
107 // notes_content+editId;
108 var vals=document.getElementById('notes_content'+editId).contentEditable = true;
109 document.getElementById('notes_content'+editId).focus();
110 // console.log('notes_content'+editId);
111 $('#notes_content'+editId).keypress(function(event) {
112
113 if (event.keyCode == 13) {
114
115 var newstring= $('#notes_content'+editId).text();
116 // console.log(newstring);
117
118 var vals=document.getElementById('notes_content'+editId).contentEditable = false;
119
120 var arg = {
121 action: 'edit',
122 noteid: editId,
123 newnotes:newstring,
124 };
125
126 var rootPath = M.cfg.wwwroot;
127 $.ajax({
128 type: 'post',
129 url: rootPath+'/blocks/mynotes/allnotes_ajax.php',
130 data:arg,
131 success: function( data ) {
132
133 },
134 error: function(data, errorThrown)
135 {
136 alert('request failed :'+errorThrown);
137 var vals=document.getElementById('notes_content'+editId).contentEditable = true;
138 }
139 });
140
141
142
143
144
145 }
146
147
148
149
150 });
151
152
153
154 });
155
156
157
158
14 }); 159 });
15 160
16 // document.getElementById("panel").style.display = "none"; Nothing to display 161
17
18 // $("#tab-mynotes_user").removeAttr("style").hide();
19 } 162 }
20 }; 163 };
21 }); 164 });
......
1 <?php
2 require_once (dirname ( __FILE__ ) . '/../../config.php');
3 require_once(dirname( __FILE__ ) .'/../../lib/phpexcel/PHPExcel.php');
4 global $OUTPUT, $title;
5
6 require_login ();
7 $context = context_system::instance ();
8 $PAGE->set_context ( $context );
9
10 function download_excel(){
11 global $DB, $CFG,$USER ,$PAGE;
12
13 $contextid;
14 if (isset($_GET['cid'])) {
15 $contextid=$_GET['cid'];
16 }
17
18 $parameter;
19 if ($contextid){
20 $parameter = array ($USER->id,$contextid);
21 }else{
22 $parameter = array ($USER->id);
23 }
24
25 $sql="select id,courseid from {block_mynotes} where userid=? and contextid=?";
26 $courseids = $DB->get_records_sql ( $sql, $parameter );
27
28 $courseid;
29
30 foreach ( $courseids as $value){
31 $courseid=$value->courseid;
32 }
33
34
35 $param=array($USER->id,$courseid);
36 $sql="select * from {block_mynotes} where userid=? and courseid=?";
37 $allNotes = $DB->get_records_sql ( $sql, $param );
38
39 $fullNotes = array ();
40
41 $i=0;
42 foreach ($allNotes as $notes ) {
43 $courseid=$notes->courseid;
44
45 $parameter = array ($courseid);
46 $sql="select fullname from {course} where id=?";
47 $coursename = $DB->get_record_sql ( $sql, $parameter );
48
49
50
51 $fullNotes [$i]['Sl.no']=$i+1;
52 $fullNotes [$i]['Course']=$coursename->fullname;
53 if($notes->activityname){
54 $fullNotes [$i]['activityname']=$notes->activityname;
55 }
56 $fullNotes [$i]['Content']=$notes->content;
57
58 $time=date('d M Y H:i A (T)', $notes->timecreated);
59 $fullNotes [$i]['Timecreated']=$time;
60 $fullNotes [$i]['Videotime']=$notes->notestime;
61 $fullNotes [$i]['Notesurl']=$notes->notesurl;
62
63 $i=$i+1;
64 }
65
66 if (!empty($fullNotes)){
67
68 $name = "Student_notes";
69
70 $objPHPExcel = new PHPExcel();
71 $objPHPExcel->setActiveSheetIndex(0);
72 $objPHPExcel->getActiveSheet()->setTitle('Notes');
73
74 $default_border = array(
75 'style' => PHPExcel_Style_Border::BORDER_THIN,
76 'color' => array('rgb'=>'9999ff')
77 );
78
79 $style_header = array(
80 'borders' => array(
81 'bottom' => $default_border,
82 'left' => $default_border,
83 'top' => $default_border,
84 'right' => $default_border,
85 ),
86 'fill' => array(
87 'type' => PHPExcel_Style_Fill::FILL_SOLID,
88 'color' => array('rgb'=>'E1E0F7'),
89 ),
90 'font' => array(
91 'bold' => true,
92 )
93 );
94
95
96 $default_border1 = array(
97 'style' => PHPExcel_Style_Border::BORDER_THIN,
98 'color' => array('rgb'=>'ff9999')
99 );
100
101 $style_header1 = array(
102 'borders' => array(
103 'bottom' => $default_border1,
104 'left' => $default_border1,
105 'top' => $default_border1,
106 'right' => $default_border1,
107 ),
108 'fill' => array(
109 'type' => PHPExcel_Style_Fill::FILL_SOLID,
110 'color' => array('rgb'=>'ff9999'),
111 ),
112 'font' => array(
113 'bold' => true,
114 )
115 );
116
117 $objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(8);
118 $objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(25);
119 $objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(30);
120 $objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(25);
121 $objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(20);
122 $objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(25);
123 $objPHPExcel->getActiveSheet()->getColumnDimension('G')->setWidth(50);
124
125 $objPHPExcel->getActiveSheet()->getCell("A1")->setValue("SL.No");
126 $objPHPExcel->getActiveSheet()->getCell("A1")->getStyle('A1')->applyFromArray($style_header);
127 $objPHPExcel->getActiveSheet()->getCell("B1")->setValue("Course");
128 $objPHPExcel->getActiveSheet()->getCell("B1")->getStyle('B1')->applyFromArray($style_header);
129 $objPHPExcel->getActiveSheet()->getCell("C1")->setValue("Activity ");
130 $objPHPExcel->getActiveSheet()->getCell("C1")->getStyle('C1')->applyFromArray($style_header);
131 $objPHPExcel->getActiveSheet()->getCell("D1")->setValue("Note");
132 $objPHPExcel->getActiveSheet()->getCell("D1")->getStyle('D1')->applyFromArray($style_header);
133 $objPHPExcel->getActiveSheet()->getCell("E1")->setValue("Time Created");
134 $objPHPExcel->getActiveSheet()->getCell("E1")->getStyle('E1')->applyFromArray($style_header);
135 $objPHPExcel->getActiveSheet()->getCell("F1")->setValue("Time in clip");
136 $objPHPExcel->getActiveSheet()->getCell("F1")->getStyle('F1')->applyFromArray($style_header);
137 $objPHPExcel->getActiveSheet()->getCell("G1")->setValue("URL");
138 $objPHPExcel->getActiveSheet()->getCell("G1")->getStyle('G1')->applyFromArray($style_header);
139
140
141 for($i=1;$i<=count($fullNotes)+1;$i++){
142
143 $objPHPExcel->getActiveSheet()->getCell('A'.($i+1))->setValue($i);
144 $objPHPExcel->getActiveSheet()->getCell('B'.($i+1))->setValue($fullNotes[$i-1]['Course']);
145 $objPHPExcel->getActiveSheet()->getCell('C'.($i+1))->setValue($fullNotes[$i-1]['activityname']);
146 $objPHPExcel->getActiveSheet()->getCell('D'.($i+1))->setValue($fullNotes[$i-1]['Content']);
147 $objPHPExcel->getActiveSheet()->getCell('E'.($i+1))->setValue($fullNotes[$i-1]['Timecreated']);
148 $objPHPExcel->getActiveSheet()->getCell('F'.($i+1))->setValue($fullNotes[$i-1]['Videotime']);
149 $objPHPExcel->getActiveSheet()->getCell('G'.($i+1))->setValue($fullNotes[$i-1]['Notesurl']);
150
151
152 }
153
154 $objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel);
155 $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
156 ob_end_clean();
157
158 header("Content-Disposition: attachment; filename=$name.xlsx");
159 header('Content-type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
160 $objWriter->save('php://output');
161 exit();
162
163
164 }
165
166
167 }
168
169 download_excel();
170
171
172
173
174
175
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
11 <FIELD NAME="contextarea" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/> 11 <FIELD NAME="contextarea" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
12 <FIELD NAME="content" TYPE="text" NOTNULL="true" SEQUENCE="false"/> 12 <FIELD NAME="content" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
13 <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/> 13 <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
14 <FIELD NAME="activityname" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
14 <FIELD NAME="format" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/> 15 <FIELD NAME="format" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
15 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/> 16 <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
16 <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/> 17 <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
......
...@@ -31,7 +31,7 @@ function xmldb_block_mynotes_upgrade($oldversion) { ...@@ -31,7 +31,7 @@ function xmldb_block_mynotes_upgrade($oldversion) {
31 $dbman = $DB->get_manager(); 31 $dbman = $DB->get_manager();
32 32
33 //Upgrade to add an extra column to local_qharvest_qns_count table 33 //Upgrade to add an extra column to local_qharvest_qns_count table
34 if( $oldversion < 2018011201 ){ 34 if( $oldversion < 2018011203 ){
35 35
36 $table = new xmldb_table('block_mynotes'); 36 $table = new xmldb_table('block_mynotes');
37 37
...@@ -44,6 +44,7 @@ function xmldb_block_mynotes_upgrade($oldversion) { ...@@ -44,6 +44,7 @@ function xmldb_block_mynotes_upgrade($oldversion) {
44 $table->add_field('contextarea', XMLDB_TYPE_CHAR,'255', null, null, null,null); 44 $table->add_field('contextarea', XMLDB_TYPE_CHAR,'255', null, null, null,null);
45 $table->add_field('content', XMLDB_TYPE_TEXT, null, null, null,null); 45 $table->add_field('content', XMLDB_TYPE_TEXT, null, null, null,null);
46 $table->add_field('courseid', XMLDB_TYPE_INTEGER, '10', null, null, null, null); 46 $table->add_field('courseid', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
47 $table->add_field('activityname', XMLDB_TYPE_TEXT, null, null, null,null);
47 $table->add_field('format', XMLDB_TYPE_INTEGER, '10', null, null, null, null); 48 $table->add_field('format', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
48 $table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, null, null, null); 49 $table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
49 $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, null, null, null); 50 $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
......
...@@ -63,9 +63,9 @@ class block_mynotes_manager { ...@@ -63,9 +63,9 @@ class block_mynotes_manager {
63 $where .= ' AND m.courseid = :courseid'; 63 $where .= ' AND m.courseid = :courseid';
64 $params['courseid'] = $options->courseid; 64 $params['courseid'] = $options->courseid;
65 } */ 65 } */
66 if(isset($options->contextid) && $options->contextid){ 66 if(isset($options->courseid) && $options->courseid){
67 $where .= ' AND m.contextid = :contextid'; 67 $where .= ' AND m.courseid = :courseid';
68 $params['contextid'] = $options->contextid; 68 $params['courseid'] = $options->courseid;
69 69
70 } 70 }
71 $sql = "SELECT $ufields, 71 $sql = "SELECT $ufields,
...@@ -86,10 +86,20 @@ class block_mynotes_manager { ...@@ -86,10 +86,20 @@ class block_mynotes_manager {
86 $c->id = $u->mynoteid; 86 $c->id = $u->mynoteid;
87 $c->userid = $u->id; 87 $c->userid = $u->id;
88 if ($u->courseid != SITEID) { 88 if ($u->courseid != SITEID) {
89 // $c->coursename = html_writer::link(course_get_url($u->courseid), $u->coursename); 89 // $c->coursename = html_writer::link(course_get_url($u->courseid), $u->coursename);
90 90 if (!empty($u->notestime)){
91 $c->coursename='<a href="#" class="notes_button_redirect" name="'.$u->notestime.'" id="'.course_get_url(($u->courseid), $u->coursename).'">'.$u->coursename.'</a>';
92 }else{
93 $c->coursename='<a href="#" class="notes_button_redirect" id="'.course_get_url(($u->courseid), $u->coursename).'">'.$u->coursename.'</a>';
94
95 }
91 if (! empty ( $u->notesurl )) { 96 if (! empty ( $u->notesurl )) {
92 $c->coursename = html_writer::link ( $u->notesurl, $u->coursename ); 97 // $c->coursename = html_writer::link ( $u->notesurl, $u->coursename );
98 if (!empty($u->notestime)){
99 $c->coursename='<a href="#" class="notes_button_redirect" name="'.$u->notestime.'" id="'.$u->notesurl.'">'.$u->coursename.'</a>';
100 }else{
101 $c->coursename='<a href="#" class="notes_button_redirect" id="'.$u->notesurl.'">'.$u->coursename.'</a>';
102 }
93 } else { 103 } else {
94 104
95 $c->coursename = $u->coursename; 105 $c->coursename = $u->coursename;
...@@ -153,6 +163,34 @@ class block_mynotes_manager { ...@@ -153,6 +163,34 @@ class block_mynotes_manager {
153 163
154 } */ 164 } */
155 165
166 /* public function count_notes($options) {
167 global $DB, $USER;
168
169 $params = array();
170
171 $userid=$USER->id;
172 $contextarea='';
173 $courseid;
174 if (isset($options->contextarea) && !empty($options->contextarea)) {
175 $contextarea=$options->contextarea;
176 }
177 if (isset($options->courseid) && !empty($options->courseid)) {
178 $courseid=$options->courseid;
179 }
180 $param=array($userid,$contextarea,$courseid);
181 $sql='select count(contextarea) from {block_mynotes} where userid=? and contextarea=? and courseid=?';
182
183 $result=$DB->get_records_sql($sql,$param);
184
185 $count;
186 foreach ($result as $val){
187 $count=$val->count;
188
189 }
190
191 return $count;
192 // return $DB->count_records('block_mynotes', $params);
193 } */
156 194
157 195
158 public function count_mynotes($options) { 196 public function count_mynotes($options) {
...@@ -160,14 +198,20 @@ class block_mynotes_manager { ...@@ -160,14 +198,20 @@ class block_mynotes_manager {
160 198
161 $params = array(); 199 $params = array();
162 $params['userid'] = $USER->id; 200 $params['userid'] = $USER->id;
201 // $userid=$USER->id;
202 // $contextarea='';
203 // $courseid;
163 if (isset($options->contextarea) && !empty($options->contextarea)) { 204 if (isset($options->contextarea) && !empty($options->contextarea)) {
164 $params['contextarea'] = $options->contextarea; 205 $params['contextarea'] = $options->contextarea;
165 } 206 // $contextarea=$options->contextarea;
166 if (isset($options->contextid) && !empty($options->contextid)) {
167 $params['contextid'] = $options->contextid;
168 } 207 }
169 208
170 $sql='select count(contextarea) from {block_mynotes} where userid=? and contextarea=? and contextid=?'; 209 if (isset($options->courseid) && !empty($options->courseid)) {
210 $params['courseid'] = $options->courseid;
211 // $courseid=$options->courseid;
212 }
213 // $param=array($userid,$contextarea,$courseid);
214 $sql='select count(contextarea) from {block_mynotes} where userid=? and contextarea=? and courseid=?';
171 215
172 $result=$DB->get_records_sql($sql,$params); 216 $result=$DB->get_records_sql($sql,$params);
173 217
...@@ -202,7 +246,7 @@ class block_mynotes_manager { ...@@ -202,7 +246,7 @@ class block_mynotes_manager {
202 * 246 *
203 * @return object of single mynote record if insert to DB else false 247 * @return object of single mynote record if insert to DB else false
204 */ 248 */
205 public function addmynote($context, $contextarea, $course, $content,$timer,$activityUrl, $format = FORMAT_MOODLE) { 249 public function addmynote($context, $contextarea, $course, $content,$timer,$activityUrl,$activityname, $format = FORMAT_MOODLE) {
206 global $CFG, $DB, $USER, $OUTPUT; 250 global $CFG, $DB, $USER, $OUTPUT;
207 // $content=$content.$timer; 251 // $content=$content.$timer;
208 252
...@@ -211,6 +255,7 @@ class block_mynotes_manager { ...@@ -211,6 +255,7 @@ class block_mynotes_manager {
211 $newnote->contextarea = $contextarea; 255 $newnote->contextarea = $contextarea;
212 $newnote->content = $content; 256 $newnote->content = $content;
213 $newnote->courseid = $course->id; 257 $newnote->courseid = $course->id;
258 $newnote->activityname = $activityname;
214 $newnote->format = $format; 259 $newnote->format = $format;
215 $newnote->userid = $USER->id; 260 $newnote->userid = $USER->id;
216 $newnote->timecreated = time(); 261 $newnote->timecreated = time();
...@@ -361,6 +406,24 @@ class block_mynotes_manager { ...@@ -361,6 +406,24 @@ class block_mynotes_manager {
361 406
362 } 407 }
363 408
409 public function all_note_edit($mynoteid,$notes){
410 global $DB, $USER;
411
412 if (!$mynote = $DB->get_record('block_mynotes', array('id' => $mynoteid))) {
413 throw new mynotes_exception('editfailed', 'block_mynotes');
414 }
415
416 if ($USER->id != $mynote->userid) {
417 throw new mynotes_exception('nopermissiontoedit', 'block_mynotes');
418 }
419
420 $param = array ($notes,$mynoteid );
421 $sql4 = 'update {block_mynotes} set content=? , timecreated=? where id=? ';
422 return $update_record = $DB->execute ( $sql4, $param );
423
424 }
425
426
364 } 427 }
365 428
366 /** 429 /**
......
...@@ -71,10 +71,11 @@ switch ($action) { ...@@ -71,10 +71,11 @@ switch ($action) {
71 $content = optional_param('content', '', PARAM_RAW); 71 $content = optional_param('content', '', PARAM_RAW);
72 $timer = optional_param('notestime', '', PARAM_TEXT); 72 $timer = optional_param('notestime', '', PARAM_TEXT);
73 $activityUrl = optional_param('urllink', '', PARAM_TEXT); 73 $activityUrl = optional_param('urllink', '', PARAM_TEXT);
74 $activityname = optional_param('activity', '', PARAM_TEXT);
74 75
75 $manager = new block_mynotes_manager(); 76 $manager = new block_mynotes_manager();
76 77
77 if ($note = $manager->addmynote($context, $contextarea, $course, $content,$timer,$activityUrl)) { 78 if ($note = $manager->addmynote($context, $contextarea, $course, $content,$timer,$activityUrl,$activityname)) {
78 $options = new stdClass(); 79 $options = new stdClass();
79 $options->page = $page; 80 $options->page = $page;
80 $options->courseid = $course->id; 81 $options->courseid = $course->id;
...@@ -82,9 +83,10 @@ switch ($action) { ...@@ -82,9 +83,10 @@ switch ($action) {
82 $options->context = $context; 83 $options->context = $context;
83 $options->contextarea = $contextarea; 84 $options->contextarea = $contextarea;
84 // $options->notestime=$timer; 85 // $options->notestime=$timer;
85 unset($options->courseid); 86 // unset($options->courseid);
86 $count = $manager->count_mynotes($options); 87 $count = $manager->count_mynotes($options);
87 88
89
88 echo json_encode(array('notes' => array($note), 'count' => $count)); 90 echo json_encode(array('notes' => array($note), 'count' => $count));
89 } else { 91 } else {
90 echo json_encode(array('error' => 'Unable to add note')); 92 echo json_encode(array('error' => 'Unable to add note'));
......
1 <?php
2 require_once (dirname ( __FILE__ ) . '/../../config.php');
3 require_once(dirname( __FILE__ ) .'/../../lib/phpexcel/PHPExcel.php');
4 global $OUTPUT, $title;
5
6 require_login ();
7 $context = context_system::instance ();
8 $PAGE->set_context ( $context );
9
10 function download_excel(){
11
12 global $DB, $CFG,$USER , $PAGE;
13
14 $parameter = array ($USER->id);
15 $sql="select * from {block_mynotes} where userid=?";
16 $allNotes = $DB->get_records_sql ( $sql, $parameter );
17
18 $fullNotes = array ();
19
20 $i=0;
21 foreach ($allNotes as $notes ) {
22 $courseid=$notes->courseid;
23
24 $parameter = array ($courseid);
25 $sql="select fullname from {course} where id=?";
26 $coursename = $DB->get_record_sql ( $sql, $parameter );
27
28
29
30 $fullNotes [$i]['Sl.no']=$i+1;
31 $fullNotes [$i]['Course']=$coursename->fullname;
32 if($notes->activityname){
33 $fullNotes [$i]['activityname']=$notes->activityname;
34 }
35 $fullNotes [$i]['Content']=$notes->content;
36
37 $time=date('d M Y H:i A (T)', $notes->timecreated);
38 $fullNotes [$i]['Timecreated']=$time;
39 $fullNotes [$i]['Videotime']=$notes->notestime;
40 $fullNotes [$i]['Notesurl']=$notes->notesurl;
41
42 $i=$i+1;
43 }
44
45 /* xls format
46 $fileName = "user_full_notes" . rand(1,100) . ".xls";
47
48 if ($fullNotesssss){
49
50 function filterData(&$str) {
51 $str = preg_replace("/\t/", "\\t", $str);
52 $str = preg_replace("/\r?\n/", "\\n", $str);
53 if(strstr($str, '"')) $str = '"' . str_replace('"', '""', $str) . '"';
54 }
55
56 // headers for download
57 header("Content-Disposition: attachment; filename=\"$fileName\"");
58 header("Content-Type: application/vnd.ms-excel");
59
60 $flag = false;
61 $i=0;
62 foreach($fullNotes as $row) {
63
64 if(!$flag) {
65 // display column names as first row
66 echo implode("\t", array_keys($row)) . "\n";
67
68 $i=$i+1;
69 $flag = true;
70 }
71 // filter data
72 array_walk($row, 'filterData');
73 echo implode("\t", array_values($row)) . "\n";
74 }
75 exit;
76 }
77 */
78
79 $name = "Student_notes";
80
81 $objPHPExcel = new PHPExcel();
82 $objPHPExcel->setActiveSheetIndex(0);
83 $objPHPExcel->getActiveSheet()->setTitle('Notes');
84
85 $default_border = array(
86 'style' => PHPExcel_Style_Border::BORDER_THIN,
87 'color' => array('rgb'=>'9999ff')
88 );
89
90 $style_header = array(
91 'borders' => array(
92 'bottom' => $default_border,
93 'left' => $default_border,
94 'top' => $default_border,
95 'right' => $default_border,
96 ),
97 'fill' => array(
98 'type' => PHPExcel_Style_Fill::FILL_SOLID,
99 'color' => array('rgb'=>'E1E0F7'),
100 ),
101 'font' => array(
102 'bold' => true,
103 )
104 );
105
106
107 $default_border1 = array(
108 'style' => PHPExcel_Style_Border::BORDER_THIN,
109 'color' => array('rgb'=>'ff9999')
110 );
111
112 $style_header1 = array(
113 'borders' => array(
114 'bottom' => $default_border1,
115 'left' => $default_border1,
116 'top' => $default_border1,
117 'right' => $default_border1,
118 ),
119 'fill' => array(
120 'type' => PHPExcel_Style_Fill::FILL_SOLID,
121 'color' => array('rgb'=>'ff9999'),
122 ),
123 'font' => array(
124 'bold' => true,
125 )
126 );
127
128 $objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(5);
129 $objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(25);
130 $objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(30);
131 $objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(25);
132 $objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(25);
133 $objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(20);
134 $objPHPExcel->getActiveSheet()->getColumnDimension('G')->setWidth(50);
135
136 $objPHPExcel->getActiveSheet()->getCell("A1")->setValue("SL.No");
137 $objPHPExcel->getActiveSheet()->getCell("A1")->getStyle('A1')->applyFromArray($style_header);
138 $objPHPExcel->getActiveSheet()->getCell("B1")->setValue("Course");
139 $objPHPExcel->getActiveSheet()->getCell("B1")->getStyle('B1')->applyFromArray($style_header);
140 $objPHPExcel->getActiveSheet()->getCell("C1")->setValue("Activity");
141 $objPHPExcel->getActiveSheet()->getCell("C1")->getStyle('C1')->applyFromArray($style_header);
142 $objPHPExcel->getActiveSheet()->getCell("D1")->setValue("Note");
143 $objPHPExcel->getActiveSheet()->getCell("D1")->getStyle('D1')->applyFromArray($style_header);
144 $objPHPExcel->getActiveSheet()->getCell("E1")->setValue("Time Created");
145 $objPHPExcel->getActiveSheet()->getCell("E1")->getStyle('E1')->applyFromArray($style_header);
146 $objPHPExcel->getActiveSheet()->getCell("F1")->setValue("Time in Clip");
147 $objPHPExcel->getActiveSheet()->getCell("F1")->getStyle('F1')->applyFromArray($style_header);
148 $objPHPExcel->getActiveSheet()->getCell("G1")->setValue("URL");
149 $objPHPExcel->getActiveSheet()->getCell("G1")->getStyle('G1')->applyFromArray($style_header);
150
151
152 for($i=1;$i<=count($fullNotes)+1;$i++){
153
154 $objPHPExcel->getActiveSheet()->getCell('A'.($i+1))->setValue($i);
155 $objPHPExcel->getActiveSheet()->getCell('B'.($i+1))->setValue($fullNotes[$i-1]['Course']);
156 $objPHPExcel->getActiveSheet()->getCell('C'.($i+1))->setValue($fullNotes[$i-1]['activityname']);
157 $objPHPExcel->getActiveSheet()->getCell('D'.($i+1))->setValue($fullNotes[$i-1]['Content']);
158 $objPHPExcel->getActiveSheet()->getCell('E'.($i+1))->setValue($fullNotes[$i-1]['Timecreated']);
159 $objPHPExcel->getActiveSheet()->getCell('F'.($i+1))->setValue($fullNotes[$i-1]['Videotime']);
160 $objPHPExcel->getActiveSheet()->getCell('G'.($i+1))->setValue($fullNotes[$i-1]['Notesurl']);
161
162 }
163
164 $objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel);
165 $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
166 ob_end_clean();
167
168 header("Content-Disposition: attachment; filename=$name.xlsx");
169 header('Content-type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
170 $objWriter->save('php://output');
171 exit();
172
173 }
174 download_excel();
...\ No newline at end of file ...\ No newline at end of file
...@@ -26,14 +26,14 @@ defined('MOODLE_INTERNAL') || die; ...@@ -26,14 +26,14 @@ defined('MOODLE_INTERNAL') || die;
26 if ($ADMIN->fulltree) { 26 if ($ADMIN->fulltree) {
27 27
28 $perpageoptions = array(); 28 $perpageoptions = array();
29 for ($i = 1; $i < 20; $i++) { 29 for ($i = 1; $i < 30; $i++) {
30 $perpageoptions[$i] = $i; 30 $perpageoptions[$i] = $i;
31 } 31 }
32 $settings->add(new admin_setting_configselect('block_mynotes/mynotesperpage', get_string('mynotesperpage', 'block_mynotes'), 32 $settings->add(new admin_setting_configselect('block_mynotes/mynotesperpage', get_string('mynotesperpage', 'block_mynotes'),
33 get_string('mynotesperpage_help', 'block_mynotes'), 5, $perpageoptions)); 33 get_string('mynotesperpage_help', 'block_mynotes'), 20, $perpageoptions));
34 34
35 $settings->add(new admin_setting_configtext('block_mynotes/characterlimit', get_string('characterlimit', 'block_mynotes'), 35 $settings->add(new admin_setting_configtext('block_mynotes/characterlimit', get_string('characterlimit', 'block_mynotes'),
36 get_string('characterlimit_help', 'block_mynotes'), 180, PARAM_INT, 3)); 36 get_string('characterlimit_help', 'block_mynotes'), 450, PARAM_INT, 3));
37 37
38 $positionoptions = array(); 38 $positionoptions = array();
39 $positionoptions['mynotes-pos-rb'] = get_string('bottomright', 'block_mynotes'); 39 $positionoptions['mynotes-pos-rb'] = get_string('bottomright', 'block_mynotes');
......
1 #mynotes-opener { position: absolute; bottom:0px; background: #443355; width: 25px; height: 25px; } 1 #mynotes-opener { position: absolute; bottom:0px; background: #443355; width: 25px; height: 25px; }
2 div.mdl-align { min-height: 470px;} 2 div.mdl-align { min-height: 470px;}
3 #mynote-edit{position: absolute !important;right: 0 !important; margin: 0px 20px !important;} 3 #mynote-edit{display:none;position: absolute;right: 0; margin: 0 28px;}
4 #mynote-update{position: absolute !important; right: 0 !important; margin:0px 40px !important;} 4 #mynote-update{visibility: hidden;position: absolute !important; right: 0 !important; margin:0px 40px !important;}
5 #notes_edit_option{color: #2310c3 !important;} 5 #notes_edit_option{color: #2310c3 !important;}
6 .mdl-align { padding:inherit !important; } 6 .mdl-align { padding:inherit !important; }
7 .mynotes-pos-inline-text { padding: 10px; margin-left: 35px; cursor: pointer; } 7 .mynotes-pos-inline-text { padding: 10px; margin-left: 35px; cursor: pointer; }
...@@ -26,9 +26,9 @@ div.mdl-align { min-height: 470px;} ...@@ -26,9 +26,9 @@ div.mdl-align { min-height: 470px;}
26 .mynotes_base input[type="submit"], .mynotes_base input[type="submit"]:hover { margin: 0; padding: 3px 10px; border: none; background: #63ab36; color: #fff; } 26 .mynotes_base input[type="submit"], .mynotes_base input[type="submit"]:hover { margin: 0; padding: 3px 10px; border: none; background: #63ab36; color: #fff; }
27 .mynotes_base input[type="submit"][disabled="disabled"]:hover { background: #63ab36; cursor: not-allowed; } 27 .mynotes_base input[type="submit"][disabled="disabled"]:hover { background: #63ab36; cursor: not-allowed; }
28 .mynotes_base span.warning { color: #bd3c2f; margin-left: 15px; } 28 .mynotes_base span.warning { color: #bd3c2f; margin-left: 15px; }
29 .mynotes_base .responsetext { color: #33b733; line-height: 20px; } 29 .mynotes_base .responsetext { color: #33b733; line-height: 15px; }
30 .mynotes_base .tabs-menu { height: 30px; float: left; clear: both; margin-bottom: 1px; } 30 .mynotes_base .tabs-menu { height: 30px; float: left; clear: both; margin-bottom: 1px; }
31 .mynotes_base .tabs-menu li { padding: 0 10px; margin-right: 1px; height: 30px; line-height: 30px; float: left; list-style: none; background-color: #d84e36; cursor: pointer; } 31 .mynotes_base .tabs-menu li { padding: 0 10px; margin-right: 1px; height: 30px; line-height: 20px; float: left; list-style: none; background-color: #d84e36; cursor: pointer; }
32 .mynotes_base .tabs-menu li:first-child { border-radius: 7px 0 0 0; } 32 .mynotes_base .tabs-menu li:first-child { border-radius: 7px 0 0 0; }
33 .mynotes_base .tabs-menu li:last-child { border-radius: 0 7px 0 0; } 33 .mynotes_base .tabs-menu li:last-child { border-radius: 0 7px 0 0; }
34 .mynotes_base .tabs-menu li.current { position: relative; background-color: #ffe6a4; border-bottom: 1px solid #fff; z-index: 5; border-bottom: 2px solid #ffe6a4; } 34 .mynotes_base .tabs-menu li.current { position: relative; background-color: #ffe6a4; border-bottom: 1px solid #fff; z-index: 5; border-bottom: 2px solid #ffe6a4; }
...@@ -39,16 +39,103 @@ div.mdl-align { min-height: 470px;} ...@@ -39,16 +39,103 @@ div.mdl-align { min-height: 470px;}
39 39
40 .mynotes_base .tab { border: 1px solid #d4d4d1; clear: both; width: auto; background: #f7f7f4; } 40 .mynotes_base .tab { border: 1px solid #d4d4d1; clear: both; width: auto; background: #f7f7f4; }
41 .mynotes_base .tab .tab-content { display: none; } 41 .mynotes_base .tab .tab-content { display: none; }
42 .mynotes_base .tab .tab-content .notes-info { background: #ffe6a4; padding: 5px; position: relative; } 42 .mynotes_base .tab .tab-content .notes-info { background: #ffe6a4; padding: 3px; position: relative; }
43 .mynotes_base .tab .tab-content .notes-info .count { color: #000; } 43 .mynotes_base .tab .tab-content .notes-info .count { color: #000; }
44 .mynotes_base .tab .tab-content .notes-info .mynotes-paging { position: absolute; right: 0; } 44 .mynotes_base .tab .tab-content .notes-info .mynotes-paging { position: absolute; right: 0;}
45 .mynotes_base .tab .tab-content .notes-info .mynotes-paging .paging a { margin: 5px; background: #c1621e; padding: 4px 10px; border-radius: 15px; color: #fff; } 45 .mynotes_base .tab .tab-content .notes-info .mynotes-paging .paging a { margin: 5px; background: #c1621e; padding: 1px 3px; border-radius: 15px; color: #fff; }
46 .mynotes_base .tab .tab-content .notes-info .mynotes-paging .paging .separator { border-left: 1px solid gray; } 46 .mynotes_base .tab .tab-content .notes-info .mynotes-paging .paging .separator { border-left: 1px solid gray; }
47 .mynotes_base .tab .tab-content ul.mynotes_lists { margin:0; clear: both; } 47 .mynotes_base .tab .tab-content ul.mynotes_lists {overflow: scroll; height: 250px; margin:0; clear: both; }
48 .mynotes_base .tab .tab-content ul.mynotes_lists li { list-style: none; position: relative; margin: 0 0 5px 0; padding: 5px; list-style: none; background-color: #fff; border-top: 1px solid #e3e4e4; } 48 .mynotes_base .tab .tab-content ul.mynotes_lists li { list-style: none; position: relative; margin: 0 0 1px 0; padding: 6px; list-style: none; background-color: #fff; border-top: 1px solid #e3e4e4; }
49 .mynotes_base .tab .tab-content ul.mynotes_lists li .content { margin-right: 10px; word-wrap: break-word; } 49 .mynotes_base .tab .tab-content ul.mynotes_lists li .content { margin-right: 10px; word-wrap: break-word; }
50 .mynotes_base .tab .tab-content ul.mynotes_lists li .note-detail { display: inline-block; font-size: 11px; } 50 .mynotes_base .tab .tab-content ul.mynotes_lists li .note-detail { display: inline-block; font-size: 11px; }
51 .mynotes_base .tab .tab-content ul.mynotes_lists li .time { color: #888; font-style: italic; display: inline-block; margin-left: 5px; font-size: 11px; } 51 .mynotes_base .tab .tab-content ul.mynotes_lists li .time { color: #888; font-style: italic; display: inline-block; margin-left: 5px; font-size: 11px; }
52 .mynotes_base .tab .tab-content ul.mynotes_lists li a.mynote-delete { position: absolute; right: 0; margin:0 -1px; } 52 .mynotes_base .tab .tab-content ul.mynotes_lists li a.mynote-delete { display:none;position: absolute; right: 1px; margin:0px -1px; }
53 .mynotes_base .tab .tab-content ul.mynotes_lists li a.mynote-delete span { color: #bbb; } 53 .mynotes_base .tab .tab-content ul.mynotes_lists li a.mynote-delete span { color: #bbb;}
54 54
55 ul#mynotes_user-list{
56 padding-left: 0rem !important;
57 }
58 /* Overridden style for positioning the notes box */
59 .moodle-dialogue-wrap.moodle-dialogue-content.yui3-widget-stdmod{
60 position: fixed !important;
61 left: 1035px!important;
62 width: 300px !important;
63 top: 70px !important;
64 }
65 :focus{
66 outline: -webkit-focus-ring-color auto 0px !important;
67 }
68 #notes_edit_option{
69
70 outline: -webkit-focus-ring-color auto 2px !important;
71
72 }
73
74
75
76 .notes_overview {
77 /*
78 overflow-x: hidden;
79 overflow-y: scroll;
80 height: 270px; */
81 }
82 .notes_overview {
83 background-color: #f7f7f7;
84 width: 100%;
85 height: 2em;
86 padding: 9px 6px 0;
87
88 /*
89 overflow-x: hidden;
90 overflow-y: scroll;
91 height: 270px; */
92 }
93
94 #notes-slider {
95 /* left: 3px;
96 top: 43px; */
97 }
98
99 .notes_section {
100 padding: 4px 0px 4px 1px;
101 }
102
103 #course_name {
104 /* padding: 4px 0px 0px 8px;
105 font-size: 19px;
106 color: black; */
107 }
108
109 .notes_course {
110 background-color: #dddddd;
111 width: 100%;
112 height: 2em;
113 padding: 9px 6px 0;
114 padding: 4px 0px 0px 8px;
115 font-size: 19px;
116 color: black;
117 }
118
119 .notes_data {
120 /* background-color: #f7f7f7;
121 width: 100%; */
122 border: 2px solid #fff;
123 text-align: left;
124 padding: 8px;
125 }
126
127 #delete_icon.fa.fa-trash{
128 margin-right: 20em;
129 text-decoration: underline;
130
131 }
132 #edit_icon.far.fa-edit{
133 margin-right: 25em;
134 text-decoration: underline;
135 }
136 /* .page-header{
137 margin-top: 2em !important;
138 }
139 .page-title {
140 margin-top: inherit !important;
141 } */
......
1 <?php
2 require_once('/../../config.php');
3 // require_once($CFG->dirroot.'/user/profile/lib.php');
4 // require_once($CFG->dirroot.'/course/lib.php');
5 require_once($CFG->dirroot . '/blocks/mynotes/lib.php');
6 global $USER,$DB;
7
8 // if (!isloggedin()) {
9 // echo json_encode(array('error' => 'require_login'));
10 // die();
11 // }
12
13 $timertext = optional_param('notestime', '', PARAM_TEXT);
14
15 // $myuser=profile_user_record($USER->id);
16
17 if ($timertext){
18
19 echo $timertext;
20
21 }
22 else{
23
24 echo "value fromrhere";
25 }
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
23 23
24 defined('MOODLE_INTERNAL') || die(); 24 defined('MOODLE_INTERNAL') || die();
25 25
26 $plugin->version = 2018011202; // The current plugin version (Date: YYYYMMDDXX) 26 $plugin->version = 2018011203; // The current plugin version (Date: YYYYMMDDXX)
27 $plugin->requires = 2015050500; // Requires this Moodle version 27 $plugin->requires = 2015050500; // Requires this Moodle version
28 $plugin->component = 'block_mynotes'; // Full name of the plugin (used for diagnostics) 28 $plugin->component = 'block_mynotes'; // Full name of the plugin (used for diagnostics)
29 $plugin->release = 'V3.4 r1'; 29 $plugin->release = 'V3.4 r1';
......
1 <?php
2 require_once (dirname ( __FILE__ ) . '/../../config.php');
3 // require_once (dirname ( __FILE__ ) . '/leaderboard_data.php');
4 // require_once ($CFG->dirroot . '/user/profile/lib.php');
5 global $OUTPUT, $title;
6
7 require_login ();
8 $context = context_system::instance ();
9 $PAGE->set_context ( $context );
10
11
12
13 // $PAGE->requires->css ( '/blocks/leaders/css/style.css' );
14
15 $PAGE->set_pagelayout( 'standard' );
16 $PAGE->set_title ( "Notes" );
17 $PAGE->requires->css ( '/blocks/mynotes/style.css' );
18 $PAGE->set_url ( '/blocks/mynotes/view.php' );
19 $PAGE->set_heading ( "User Notes" );
20 $PAGE->navbar->add ( 'Notes', new moodle_url ( '/blocks/mynotes/view.php' ) );
21 $PAGE->requires->js_call_amd ( 'block_mynotes/script', 'init' );
22 echo $OUTPUT->header ();
23
24 class notes{
25
26 public function allnotes(){
27 global $DB, $CFG,$USER , $PAGE;
28
29 $parameter = array ($USER->id);
30 $sql = "select * from {block_mynotes} where userid=? order by courseid asc";
31 $allNotes = $DB->get_records_sql ( $sql, $parameter );
32
33 $sql="select distinct courseid from {block_mynotes} where userid=? order by courseid asc";
34 $allCourses=$DB->get_records_sql ( $sql, $parameter );
35
36 $fullNotes = array ();
37
38 foreach ( $allNotes as $notes ) {
39
40 $fullNotes [] = $notes;
41 }
42
43 $fullCourseIds = array ();
44 foreach ( $allCourses as $courseId ) {
45
46 $fullCourseIds [] = $courseId;
47 }
48 //full notes list
49 $noteslist = array ();
50 for($i = 0; $i < count ( $fullCourseIds ); $i ++) {
51
52 foreach ( $fullNotes as $notes ) {
53 if ($fullCourseIds [$i]->courseid == $notes->courseid) {
54
55 $noteslist [$i] [] = $notes;
56 }
57 }
58 }
59 //coursenames
60 $courseName = array ();
61
62 foreach ( $fullCourseIds as $courseId ) {
63 $param = array (
64 $courseId->courseid
65 );
66 $sql = "select fullname from {course} where id=?";
67 $name = $DB->get_record_sql ( $sql, $param );
68 if ($courseId->courseid == 1) {
69
70 $courseName [] = 'Dashboard Notes';
71 } else {
72
73 $courseName [] = $name->fullname;
74 }
75 }
76 return array($fullCourseIds,$noteslist,$courseName);
77
78
79 }
80
81
82 public function viewNotes(){
83 global $DB ,$CFG ,$USER ,$PAGE;
84
85
86 $getallnotes = new notes ();
87 $Allnotes=$getallnotes->allnotes();
88
89 $CourseIds=$Allnotes[0];
90 $noteslist=$Allnotes[1];
91 $courseNameList=$Allnotes[2];
92
93 if(!empty($noteslist)){
94
95
96 echo '<a href="'.$CFG->wwwroot.'/blocks/mynotes/notes_excel.php" id="excel_download" class="float-md-right" style="text-decoration: none;">Downlaod Notes</a>';
97
98
99 for ($i=0;$i<count($courseNameList);$i++){
100 echo ('<div class="notes_section" id="'.$CourseIds[$i]->courseid.'">
101 <a href="#" class="notes_course fa fa-chevron-circle-right" id="icon'.$CourseIds[$i]->courseid.'" style="text-decoration: none;" >
102 '.' '.$courseNameList[$i].'</a></div>
103 <table class="notes_overview" id="notes_table_id'.$CourseIds[$i]->courseid.'">');
104
105 for ($j=0;$j<count($noteslist[$i]);$j++){
106
107 echo ('<tr class="overall_notes" id="notes'.$noteslist[$i][$j]->id.'">
108 <td class="notes_data">
109 <a href="#" class=" delete_note float-right mr-1 fa fa-trash" id="'.$noteslist[$i][$j]->id.'" style="text-decoration: none;" >delete</a>
110 <a href="#" class=" edit_note float-right mr-5 far fa-edit" id="'.$noteslist[$i][$j]->id.'" style="text-decoration: none;">edit</a>
111 <p id="notes_content'.$noteslist[$i][$j]->id.'">'.$noteslist[$i][$j]->content.'</p>
112
113 </td></tr>');
114
115 }
116 echo '</table>';
117
118 }
119 /* <i class="fa fa-trash" aria-hidden="true">delete</i> */
120
121 }else{
122 echo '<div class="alert alert-danger">
123 <strong> User notes are empty!</strong> User notes are not availale to display. Please make note while working with activities to view all notes.
124 </div>';
125
126
127
128 }
129
130 }
131
132
133
134
135
136
137
138 }
139
140 $viewnotes = new notes ();
141 $viewnotes->viewNotes ();
142
143
144 echo $OUTPUT->footer ();
...\ No newline at end of file ...\ No newline at end of file
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!