39da5eb9 by logesh

notes plugin

1 parent c1ef11fc
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 Mynotes Block
2 --------------
3 A simpler mynotes system that integrates as moodle block to save user's notes
4 from different areas such as site, course, modules, etc.
5
6 This is a free plugin for Moodle that help to preserve uesr's notes.
7
8 Settings
9 --------
10 * Set the position for display editing icon.
11 * Set the number of records to be display
12
13 Appearances
14 ----------------------
15 * This block display on site page, any course-* and user page.
16
17 Features
18 --------
19
20 Any authenticated users can:
21
22 * Save new notes
23 * View saved notes by him/her
24 * Delete own notes
25
26 Requirements
27 ------------
28
29 * Moodle version 3.4
30
31 Installation
32 ------------
33
34 Within the ZIP file is a folder named mynotes, copy this folder into
35 your Moodle blocks folder (e.g /var/moodle/htdocs/blocks/ ). Once the folder
36 has been copied into your blocks folder, login to Moodle as admin and it should
37 detect the new block and install it.
38
39 Note that if you download the ZIP from Github the mynotes folder is called
40 'moodle-block_mynotes' and needs to be renamed after extraction to 'mynotes'.
41
42 Once installed this block, automatically added to page while installing. There is no need to add to every page.
...\ No newline at end of file ...\ No newline at end of file
1 define(['jquery', 'core/yui', 'core/str', 'core/config', 'core/notification'], function($, Y, str, config, notification) { var CONFIG; var NODES = { DELETE_ICON: '<span class="delete">&#x274C;</span>', }; var SELECTORS = { MYNOTES_BASE: '#mynotes_base', MYNOTES_OPENER: '.mynotes-opener', MYNOTES_LISTS: '.mynotes_list', }; var CSS = { MYNOTES_BASE: 'mynotes_base', MYNOTES_OPENER: 'mynotes-opener', MYNOTES_LISTS: 'mynotes_list', }; var panel = null; var initnotes = null; var strdeletenote = M.util.get_string('deletemynotes', 'block_mynotes'); var getMynotesValidatedUrl = function(baseurl) { var a = document.createElement('a'); a.href = baseurl; return (a.search.length > 0) ? baseurl : baseurl + '?'; }; var mynotes = { getMynotesValidatedUrl: function(baseurl) { var a = document.createElement('a'); a.href = baseurl; return (a.search.length > 0) ? baseurl : baseurl + '?'; }, getWarnings: function(status) { if (status == false) { $('#addmynote-label-' + CONFIG.instanceid + ' span.warning').html(CONFIG.maxallowedcharacters_warning); } else { var ta = $('#id_mynotecontent-' + CONFIG.instanceid); if (ta.val() == '') { $('#addmynote-label-' + CONFIG.instanceid + ' span.warning').html(''); } else { var cl = CONFIG.maxallowedcharacters - ta.val().length; $('#addmynote-label-' + CONFIG.instanceid + ' span.warning').html(M.util.get_string('charactersleft', 'block_mynotes') + cl); } } }, checkInputText: function() { var ta = $('#id_mynotecontent-' + CONFIG.instanceid); if (ta.val().length <= CONFIG.maxallowedcharacters) { $('#addmynote_submit').removeAttr('disabled', ''); return true; } else { $('#addmynote_submit').attr('disabled', 'disabled'); return false; } return true; }, toggle_textarea: function(e) { var ta = $('#id_mynotecontent-' + CONFIG.instanceid); if (!ta) { return false; } var focus = (e.type == 'focusin'); if (focus) { if (ta.val() == M.util.get_string('placeholdercontent', 'block_mynotes')) { ta.val(''); $('.textarea').css('border-color', 'black'); } } else{ if (ta.val() == '') { ta.val(M.util.get_string('placeholdercontent', 'block_mynotes')); $('.textarea').css('border-color', 'gray'); $('#addmynote-label-' + CONFIG.instanceid + ' span.warning').html(''); } } }, request: function(args) { var params = {}; var scope = this; if (args['scope']) { scope = args['scope']; } params['contextarea'] = scope.currenttab.replace(CONFIG.prefix, ''); params['contextarea'] = params['contextarea'].replace('#', ''); if (args.params) { for (i in args.params) { params[i] = args.params[i]; } } params['sesskey'] = M.cfg.sesskey; var cfg = { method: 'POST', on: { start: function() { }, complete: function(id,o,p) { if (!o) { alert('IO FATAL'); return false; } var data = Y.JSON.parse(o.responseText); if (data.error) { if (data.error == 'require_login') { args.callback(id,data,p); return true; } alert(data.error); return false; } else { args.callback(id,data,p); return true; } } }, arguments: { scope: scope }, headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' }, data: build_querystring(params) }; if (args.form) { cfg.form = args.form; } Y.io(this.api, cfg); }, saveMynotes: function(e) { e.preventDefault(); var scope = this; if (scope.checkInputText() == false) { return false; } var ta = $('#id_mynotecontent-' + CONFIG.instanceid); if (ta.val() == "" || ta.val() == M.util.get_string('placeholdercontent', 'block_mynotes')) { return false; } var arg = { contextid: CONFIG.contextid, content: ta.val(), action: 'add', contextarea: scope.currenttabindex, }; ta.attr('disabled', true); ta.css({ 'backgroundImage': 'url(' + M.util.image_url('i/loading_small', 'core') + ')', 'backgroundRepeat': 'no-repeat', 'backgroundPosition': 'center center' }); this.request({ params: arg, callback: function(id, ret, args) { if (!ret.notes) { return false; } $('#addmynote-label-' + CONFIG.instanceid + ' span.warning').html(''); $('#id_mynotecontent-' + CONFIG.instanceid).val(M.util.get_string('placeholdercontent', 'block_mynotes')); $('#id_mynotecontent-' + CONFIG.instanceid).removeAttr('disabled'); $('#id_mynotecontent-' + CONFIG.instanceid).css({backgroundImage: ''}); if (scope.currenttab != scope.defaulttab) { scope.currenttab = scope.defaulttab; var tab = scope.currenttab.replace('#', '#tab-'); $(SELECTORS.MYNOTES_BASE + ' ul.tabs-menu li').removeClass("current"); $(SELECTORS.MYNOTES_BASE + ' ' + tab).addClass('current'); $(SELECTORS.MYNOTES_BASE + ' .tab-content').has(scope.currenttab).addClass('current'); $(SELECTORS.MYNOTES_BASE + ' .tab-content').not(scope.currenttab).css("display", "none"); $(SELECTORS.MYNOTES_BASE + ' ' + scope.currenttab + '.tab-content').css("display", "block"); } scope.addToList(ret, 'add'); scope.displayMynotes(); $(SELECTORS.MYNOTES_BASE).find('.responsetext').html(M.util.get_string('savedsuccess', 'block_mynotes')); } } ); }, addToList: function(notesobj, action='') { var scope = this; var el = $(SELECTORS.MYNOTES_BASE).find(scope.currenttab + '-list'); if (action == 'add') { el.prepend(scope.renderMynotes(notesobj.notes)); } else { el.append(scope.renderMynotes(notesobj.notes)); $(el).find('li').sort(sort_li) .appendTo(el); function sort_li(a, b){ return ($(b).data('itemid')) > ($(a).data('itemid')) ? 1 : -1; } } $(SELECTORS.MYNOTES_BASE).find(scope.currenttab).attr('notes-count', notesobj.count); }, getMynotes: function(page=0) { var scope = this; page = parseInt(page); var el = $(SELECTORS.MYNOTES_BASE).find(scope.currenttab + '-list'); var notescount = el.find('li').length; var lastpage = Math.ceil(notescount / CONFIG.perpage); if (notescount > 0 && lastpage > page) { scope.displayMynotes(); return false; } var arg = { contextid: CONFIG.contextid, action: 'get', page: page, }; this.request({ params: arg, callback: function(id, ret, args) { scope.addToList(ret); scope.displayMynotes(); } }); }, updateMynotesInfo: function(mynotescount, page) { page = parseInt(page); mynotescount = parseInt(mynotescount); var scope = this; var paging = ''; if (mynotescount > CONFIG.perpage) { var pagenum = page - 1; var prevlink = ''; var nextlink = ''; if (page > 0) { prevlink = scope.createLink(pagenum, M.util.get_string('previouspage', 'block_mynotes'), 'previous'); } if (CONFIG.perpage > 0) { var lastpage = Math.ceil(mynotescount / CONFIG.perpage); } else { var lastpage = 1; } pagenum = page + 1; if (pagenum != lastpage) { nextlink = scope.createLink(pagenum, M.util.get_string('nextpage', 'block_mynotes'), 'next'); } paging = prevlink; if (prevlink != '' && nextlink != '') { paging += '<span class="separator"></span>'; } paging += nextlink; paging = '<span class="paging">' + paging + '</span>'; } var noteinfo = $(SELECTORS.MYNOTES_BASE).find(scope.currenttab); if (mynotescount > 0) { noteinfo.find('.count').html(M.util.get_string('mynotescount', 'block_mynotes') + '' + mynotescount); } else { noteinfo.find('.count').html(M.util.get_string('nothingtodisplay', 'block_mynotes')); } noteinfo.find('.mynotes-paging').html(paging); }, renderMynotes: function(notes) { if (notes.length < 1) { return false; } var lists = ''; var x = ''; for (x in notes) { $('#mynote-'+ CONFIG.instanceid + '-' + notes[x].id).remove(); var deletelink = '<a href="#" id="mynote-delete-' + CONFIG.instanceid + '-' + notes[x].id + '" class="mynote-delete" title="'+ strdeletenote +'">'+ NODES.DELETE_ICON +'</a>'; var notedetail = ''; if (notes[x].coursename != '') { notedetail = '<div class="note-detail">' + notes[x].coursename + ' - ' + '</div>'; } var userdate = '<div class="time">' + notes[x].timecreated + '</div>'; var note_html = '<div class="content">' + deletelink + notes[x].content + '</div>'; lists += '<li id="mynote-' + CONFIG.instanceid + '-' + notes[x].id + '" data-itemid="' + notes[x].id + '">' + note_html + notedetail + userdate + '</li>'; } return lists; }, createLink: function(page, text, classname) { var classattribute = (typeof(classname) != 'undefined') ? ' class="'+classname+'"' : ''; return '<a href="' + this.api + '&page=' + page + '"' + classattribute + '>' + text + '</a>'; }, displayMynotes: function() { var scope = this; var page = parseInt($(SELECTORS.MYNOTES_BASE).find(scope.currenttab).attr('onpage')); var mynotescount = parseInt($(SELECTORS.MYNOTES_BASE).find(scope.currenttab).attr('notes-count')); var el = $(SELECTORS.MYNOTES_BASE).find(' ' + scope.currenttab + '-list'); var notescount = el.find('li').length; var lastpage = Math.ceil(notescount / CONFIG.perpage); if (notescount > 0 && lastpage <= page) { page = lastpage - 1; } var upperlimit = page * CONFIG.perpage + CONFIG.perpage; var lowerlimit = page * CONFIG.perpage; el.find('li').css('display', 'none'); el.find('li').each(function(i, el) { if (i>=lowerlimit && i<upperlimit) { $(el).css('display', 'block'); } }); scope.updateMynotesInfo(mynotescount, page); }, registerActions: function() { var scope = this; $('body').delegate('#addmynote_cancel', 'click', function() {panel.hide()}); $('body').delegate('#addmynote_submit', 'click', function(e) {scope.saveMynotes(e)}); $('body').delegate(SELECTORS.MYNOTES_BASE + ' ul.tabs-menu li', 'click', function(e) { $(this).addClass("current"); $(this).siblings().removeClass("current"); var tab = $(this).attr("id").replace('tab-', ''); $(SELECTORS.MYNOTES_BASE + ' .tab-content').not('#' + tab).css("display", "none"); $(SELECTORS.MYNOTES_BASE + ' #' + tab + '.tab-content').css("display", "block"); scope.currenttab = '#'+tab; var isloaded = $(scope.currenttab).attr('data-loaded'); if (typeof isloaded == 'undefined' || isloaded == false) { $(SELECTORS.MYNOTES_BASE).find(scope.currenttab).attr('data-loaded', "true"); scope.getMynotes(0); } }); $('body').delegate('#id_mynotecontent-' + CONFIG.instanceid, 'focus blur', function(e) { scope.toggle_textarea(e); }); $('body').delegate('#id_mynotecontent-' + CONFIG.instanceid, 'change keypress keyup', function(e) { scope.getWarnings(scope.checkInputText()); }); $('body').delegate(SELECTORS.MYNOTES_BASE + ' .mynotes-paging .paging a', 'click', function(e) { e.preventDefault(); var regex = new RegExp(/[\?&]page=(\d+)/); var results = regex.exec($(this).attr('href')); var page = 0; if (results[1]) { page = results[1]; } $(SELECTORS.MYNOTES_BASE).find(scope.currenttab).attr('onpage', parseInt(page)); scope.getMynotes(page); }); $('body').delegate(SELECTORS.MYNOTES_BASE + ' a.mynote-delete', 'click', function(e) { e.preventDefault(); var nid = $(this).attr('id'); if (nid != '' || nid != 'undefined') { var notescount = $(SELECTORS.MYNOTES_BASE).find(SELECTORS.MYNOTES_LISTS + '-' + scope.currenttab + ' > li').length; var id = nid.replace('mynote-delete-'+ CONFIG.instanceid + '-', ''); var arg = { contextid: CONFIG.contextid, action: 'delete', noteid: id, lastnotecounts: notescount, }; scope.request({ params: arg, callback: function(id, ret, args) { args.scope.addToList(ret); $('#mynote-'+ CONFIG.instanceid + '-' + ret.noteid).remove(); args.scope.displayMynotes(); } }); } }); }, displayDialogue: function(e) { var scope = mynotes; if (panel === null) { str.get_strings([ {key : 'mynotes', component : 'block_mynotes'}, {key : 'nocharacterlimit', component : 'block_mynotes'}, {key : 'save', component : 'block_mynotes'}, {key : 'cancel'}, {key : 'mynotessavedundertab', component : 'block_mynotes', param: CONFIG.contextareas[scope.currenttabindex]}, {key : 'placeholdercontent', component : 'block_mynotes'} ]).done(function(s) { var el = $('<div></div>').append($('<div id="' + CSS.MYNOTES_BASE + '" class="' + CSS.MYNOTES_BASE + '"></div>') .append('<div class="inputarea"><div id="addmynote-label-' + CONFIG.instanceid + '">' + s[1] + ' ' +'' + '</div>' + '<div class="textarea"><textarea id="id_mynotecontent-' + CONFIG.instanceid + '" name="mynotecontent" rows="2">' + s[5] + '</textarea></div>' + '<p><br></p>' + '<p class="mdl-align"><input type="submit" id="addmynote_submit"/></p>' + '</div>' ) .append($('<ul class="tabs-menu"></ul>')) .append($('<div class="tab"></div>')) ); el.find('#addmynote_submit').attr('value', s[2]); el.find('#addmynote_cancel').attr('value', s[3]); var tabsmenu = ''; var tabcontents = ''; var i = ''; for (i in CONFIG.contextareas) { if (scope.currenttabindex == i) { tabsmenu += '<li class="current" id="tab-' + CONFIG.prefix + i + '"><div class="menu-item">' + CONFIG.contextareas[i] + '</div></li>'; } else { tabsmenu += '<li class="" id="tab-' + CONFIG.prefix + i + '"><div class="menu-item">' + CONFIG.contextareas[i] + '</div></li>'; } tabcontents += '<div class="tab-content" id="' + CONFIG.prefix + i + '" onpage="0" notes-count="0">' + '<div class="notes-info"><div class="mynotes-paging"></div><div class="count"></div></div>' + '<ul id="' + CONFIG.prefix + i + '-list" class="mynotes_lists"></ul>' + '</div>'; } el.find('.tabs-menu').append(tabsmenu); el.find('.tab').append($(tabcontents)); Y.use('moodle-core-notification-dialogue', function() { panel = new M.core.dialogue({ draggable: true, modal: true, closeButton: true, headerContent: M.util.get_string('mynotes', 'block_mynotes'), responsive: true, }); panel.set('bodyContent', el.html()); if (initnotes === null) { initnotes = true; scope.getMynotes(0); $(SELECTORS.MYNOTES_BASE).find(scope.currenttab).attr('data-loaded', "true"); $(SELECTORS.MYNOTES_BASE).find(scope.currenttab).css('display', 'block'); } panel.show(); }); scope.registerActions(); }); } else { panel.show(); } }, init: function(args) { CONFIG = args; CONFIG.prefix = 'mynotes_'; this.perpage = parseInt(CONFIG.perpage); this.currenttab = '#mynotes_' + args.currenttabindex; this.defaulttab = '#mynotes_' + args.currenttabindex; this.currenttabindex = args.currenttabindex; this.api = this.getMynotesValidatedUrl(M.cfg.wwwroot+'/blocks/mynotes/mynotes_ajax.php'); var strtitle = M.util.get_string('showmynotes', 'block_mynotes'); if (!CONFIG.editing) { var handler = $('<div class="'+ CSS.MYNOTES_OPENER +'" title="' + strtitle + '" alt="' + strtitle+ '">' + M.util.get_string('mynotes', 'block_mynotes') + '</div>'); handler.addClass(CONFIG.editingicon_pos); $('body').append(handler); handler.html('<span class="pencil" id="mynotepencil">&#x270D;</span>'); } else { var handler = $('<div class="'+ CSS.MYNOTES_OPENER +'" title="' + strtitle + '" alt="' + strtitle+ '">' + M.util.get_string('mynotes', 'block_mynotes') + '</div>'); handler.addClass(CONFIG.editingicon_pos); handler.html('<span class="pencil">&#x270D;</span>'); $('.inline-'+ CSS.MYNOTES_OPENER).html(handler); $('.inline-'+ CSS.MYNOTES_OPENER).append('<div class="mynotes-pos-inline-text '+ CSS.MYNOTES_OPENER +'">' + strtitle + '</div>'); } var body = $('body'); body.delegate(SELECTORS.MYNOTES_OPENER, 'click', this.displayDialogue); } }; return mynotes; });
...\ No newline at end of file ...\ No newline at end of file
1 // This file is part of Moodle - http://moodle.org/
2 //
3 // Moodle is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, either version 3 of the License, or
6 // (at your option) any later version.
7 //
8 // Moodle is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
15
16 /**
17 * Javascript controller for the mynotes panel at the bottom of the page.
18 *
19 * @module block_mynotes/mynotesblock
20 * @package block_mynotes
21 * @author Gautam Kumar Das<gautam.arg@gmail.com>
22 */
23 define(['jquery', 'core/yui', 'core/str', 'core/config', 'core/notification'], function($, Y, str, config, notification) {
24 var CONFIG;
25 var NODES = {
26 DELETE_ICON: '<span class="delete">&#x274C;</span>',
27 };
28 var SELECTORS = {
29 MYNOTES_BASE: '#mynotes_base',
30 MYNOTES_OPENER: '.mynotes-opener',
31 MYNOTES_LISTS: '.mynotes_list',
32 };
33 var CSS = {
34 MYNOTES_BASE: 'mynotes_base',
35 MYNOTES_OPENER: 'mynotes-opener',
36 MYNOTES_LISTS: 'mynotes_list',
37 };
38 var panel = null;
39 var initnotes = null;
40 var strdeletenote = M.util.get_string('deletemynotes', 'block_mynotes');
41
42 var getMynotesValidatedUrl = function(baseurl) {
43 var a = document.createElement('a');
44 a.href = baseurl;
45 return (a.search.length > 0) ? baseurl : baseurl + '?';
46 };
47
48 var mynotes = { /** @alias module:blocks/mynotes */
49
50 getMynotesValidatedUrl: function(baseurl) {
51 var a = document.createElement('a');
52 a.href = baseurl;
53 return (a.search.length > 0) ? baseurl : baseurl + '?';
54 },
55 /*
56 * Validation for textarea input text
57 */
58 getWarnings: function(status) {
59 if (status == false) {
60 $('#addmynote-label-' + CONFIG.instanceid + ' span.warning').html(CONFIG.maxallowedcharacters_warning);
61 } else {
62 var ta = $('#id_mynotecontent-' + CONFIG.instanceid);
63 if (ta.val() == '') {
64 $('#addmynote-label-' + CONFIG.instanceid + ' span.warning').html('');
65 } else {
66 var cl = CONFIG.maxallowedcharacters - ta.val().length;
67 $('#addmynote-label-' + CONFIG.instanceid + ' span.warning').html(M.util.get_string('charactersleft', 'block_mynotes') + cl);
68 }
69 }
70 },
71 checkInputText: function() {
72 var ta = $('#id_mynotecontent-' + CONFIG.instanceid);
73 if (ta.val().length <= CONFIG.maxallowedcharacters) {
74 $('#addmynote_submit').removeAttr('disabled', '');
75 return true;
76 } else {
77 $('#addmynote_submit').attr('disabled', 'disabled');
78 return false;
79 }
80 return true;
81 },
82 toggle_textarea: function(e) {
83 var ta = $('#id_mynotecontent-' + CONFIG.instanceid);
84
85 if (!ta) {
86 return false;
87 }
88 var focus = (e.type == 'focusin');
89 if (focus) {
90 if (ta.val() == M.util.get_string('placeholdercontent', 'block_mynotes')) {
91 ta.val('');
92 $('.textarea').css('border-color', 'black');
93 }
94 } else{
95 if (ta.val() == '') {
96 ta.val(M.util.get_string('placeholdercontent', 'block_mynotes'));
97 $('.textarea').css('border-color', 'gray');
98 $('#addmynote-label-' + CONFIG.instanceid + ' span.warning').html('');
99 }
100 }
101 },
102 request: function(args) {
103 var params = {};
104 var scope = this;
105 if (args['scope']) {
106 scope = args['scope'];
107 }
108 params['contextarea'] = scope.currenttab.replace(CONFIG.prefix, '');
109 params['contextarea'] = params['contextarea'].replace('#', '');
110 if (args.params) {
111 for (i in args.params) {
112 params[i] = args.params[i];
113 }
114 }
115 params['sesskey'] = M.cfg.sesskey;
116
117 var cfg = {
118 method: 'POST',
119 on: {
120 start: function() {
121 //'<div class="mdl-align"><img src="'+M.util.image_url('i/loading', 'core')+'" /></div>';
122 },
123 complete: function(id,o,p) {
124 if (!o) {
125 alert('IO FATAL');
126 return false;
127 }
128 var data = Y.JSON.parse(o.responseText);
129 if (data.error) {
130 if (data.error == 'require_login') {
131 args.callback(id,data,p);
132 return true;
133 }
134 alert(data.error);
135 return false;
136 } else {
137 args.callback(id,data,p);
138 return true;
139 }
140 }
141 },
142 arguments: {
143 scope: scope
144 },
145 headers: {
146 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
147 },
148 data: build_querystring(params)
149 };
150 if (args.form) {
151 cfg.form = args.form;
152 }
153 Y.io(this.api, cfg);
154 },
155 saveMynotes: function(e) {
156 e.preventDefault();
157 var scope = this;
158
159 if (scope.checkInputText() == false) {
160 return false;
161 }
162 var ta = $('#id_mynotecontent-' + CONFIG.instanceid);
163 if (ta.val() == "" || ta.val() == M.util.get_string('placeholdercontent', 'block_mynotes')) {
164 return false;
165 }
166 var arg = {
167 contextid: CONFIG.contextid,
168 content: ta.val(),
169 action: 'add',
170 contextarea: scope.currenttabindex,
171 };
172 ta.attr('disabled', true);
173 ta.css({
174 'backgroundImage': 'url(' + M.util.image_url('i/loading_small', 'core') + ')',
175 'backgroundRepeat': 'no-repeat',
176 'backgroundPosition': 'center center'
177 });
178 this.request({
179 params: arg,
180 callback: function(id, ret, args) {
181 if (!ret.notes) {
182 return false;
183 }
184 $('#addmynote-label-' + CONFIG.instanceid + ' span.warning').html('');
185 $('#id_mynotecontent-' + CONFIG.instanceid).val(M.util.get_string('placeholdercontent', 'block_mynotes'));
186 $('#id_mynotecontent-' + CONFIG.instanceid).removeAttr('disabled');
187 $('#id_mynotecontent-' + CONFIG.instanceid).css({backgroundImage: ''});
188 if (scope.currenttab != scope.defaulttab) {
189 scope.currenttab = scope.defaulttab;
190 var tab = scope.currenttab.replace('#', '#tab-');
191 $(SELECTORS.MYNOTES_BASE + ' ul.tabs-menu li').removeClass("current");
192 $(SELECTORS.MYNOTES_BASE + ' ' + tab).addClass('current');
193 $(SELECTORS.MYNOTES_BASE + ' .tab-content').has(scope.currenttab).addClass('current');
194 $(SELECTORS.MYNOTES_BASE + ' .tab-content').not(scope.currenttab).css("display", "none");
195 $(SELECTORS.MYNOTES_BASE + ' ' + scope.currenttab + '.tab-content').css("display", "block");
196 }
197 scope.addToList(ret, 'add');
198 scope.displayMynotes();
199 $(SELECTORS.MYNOTES_BASE).find('.responsetext').html(M.util.get_string('savedsuccess', 'block_mynotes'));
200 }
201 }
202 );
203 },
204 addToList: function(notesobj, action='') {
205 var scope = this;
206 var el = $(SELECTORS.MYNOTES_BASE).find(scope.currenttab + '-list');
207 if (action == 'add') {
208 el.prepend(scope.renderMynotes(notesobj.notes));
209 } else {
210 el.append(scope.renderMynotes(notesobj.notes));
211 $(el).find('li').sort(sort_li) // sort elements
212 .appendTo(el); // append again to the list
213 // sort function callback
214 function sort_li(a, b){
215 return ($(b).data('itemid')) > ($(a).data('itemid')) ? 1 : -1;
216 }
217 }
218 $(SELECTORS.MYNOTES_BASE).find(scope.currenttab).attr('notes-count', notesobj.count);
219 },
220 getMynotes: function(page=0) {
221 var scope = this;
222 page = parseInt(page);
223 var el = $(SELECTORS.MYNOTES_BASE).find(scope.currenttab + '-list');
224 var notescount = el.find('li').length;
225 var lastpage = Math.ceil(notescount / CONFIG.perpage);
226 if (notescount > 0 && lastpage > page) {
227 scope.displayMynotes();
228 return false;
229 }
230 var arg = {
231 contextid: CONFIG.contextid,
232 action: 'get',
233 page: page,
234 };
235 this.request({
236 params: arg,
237 callback: function(id, ret, args) {
238 scope.addToList(ret);
239 scope.displayMynotes();
240 }
241 });
242 },
243 updateMynotesInfo: function(mynotescount, page) {
244 page = parseInt(page);
245 mynotescount = parseInt(mynotescount);
246 var scope = this;
247 var paging = '';
248 if (mynotescount > CONFIG.perpage) {
249 var pagenum = page - 1;
250 var prevlink = '';
251 var nextlink = '';
252
253 if (page > 0) {
254 prevlink = scope.createLink(pagenum, M.util.get_string('previouspage', 'block_mynotes'), 'previous');
255 }
256 if (CONFIG.perpage > 0) {
257 var lastpage = Math.ceil(mynotescount / CONFIG.perpage);
258 } else {
259 var lastpage = 1;
260 }
261 // Uncomment this line if you want to display page number
262 //paging += '<span class="current-page">' + (page + 1) + '</span>';
263 pagenum = page + 1;
264 if (pagenum != lastpage) {
265 nextlink = scope.createLink(pagenum, M.util.get_string('nextpage', 'block_mynotes'), 'next');
266 }
267 paging = prevlink;
268 if (prevlink != '' && nextlink != '') {
269 paging += '<span class="separator"></span>';
270 }
271 paging += nextlink;
272
273 paging = '<span class="paging">' + paging + '</span>';
274 }
275 var noteinfo = $(SELECTORS.MYNOTES_BASE).find(scope.currenttab);
276 if (mynotescount > 0) {
277 noteinfo.find('.count').html(M.util.get_string('mynotescount', 'block_mynotes') + '' + mynotescount);
278 } else {
279 noteinfo.find('.count').html(M.util.get_string('nothingtodisplay', 'block_mynotes'));
280 }
281 noteinfo.find('.mynotes-paging').html(paging);
282 },
283 /*
284 * Render notes as html ul li element
285 */
286 renderMynotes: function(notes) {
287 if (notes.length < 1) {
288 return false;
289 }
290 var lists = '';
291 var x = '';
292 for (x in notes) {
293 $('#mynote-'+ CONFIG.instanceid + '-' + notes[x].id).remove();
294 var deletelink = '<a href="#" id="mynote-delete-' + CONFIG.instanceid + '-' + notes[x].id + '" class="mynote-delete" title="'+ strdeletenote +'">'+ NODES.DELETE_ICON +'</a>';
295 var notedetail = '';
296 if (notes[x].coursename != '') {
297 notedetail = '<div class="note-detail">' + notes[x].coursename + ' - ' + '</div>';
298 }
299 var userdate = '<div class="time">' + notes[x].timecreated + '</div>';
300 var note_html = '<div class="content">' + deletelink + notes[x].content + '</div>';
301 lists += '<li id="mynote-' + CONFIG.instanceid + '-' + notes[x].id + '" data-itemid="' + notes[x].id + '">' + note_html + notedetail + userdate + '</li>';
302 }
303 return lists;
304 },
305 createLink: function(page, text, classname) {
306 var classattribute = (typeof(classname) != 'undefined') ? ' class="'+classname+'"' : '';
307 return '<a href="' + this.api + '&page=' + page + '"' + classattribute + '>' + text + '</a>';
308 },
309 displayMynotes: function() {
310 var scope = this;
311 var page = parseInt($(SELECTORS.MYNOTES_BASE).find(scope.currenttab).attr('onpage'));
312 var mynotescount = parseInt($(SELECTORS.MYNOTES_BASE).find(scope.currenttab).attr('notes-count'));
313 var el = $(SELECTORS.MYNOTES_BASE).find(' ' + scope.currenttab + '-list');
314 var notescount = el.find('li').length;
315 var lastpage = Math.ceil(notescount / CONFIG.perpage);
316
317 if (notescount > 0 && lastpage <= page) {
318 page = lastpage - 1;
319 }
320 var upperlimit = page * CONFIG.perpage + CONFIG.perpage;
321 var lowerlimit = page * CONFIG.perpage;
322 el.find('li').css('display', 'none');
323 el.find('li').each(function(i, el) {
324 if (i>=lowerlimit && i<upperlimit) {
325 $(el).css('display', 'block');
326 }
327 });
328 scope.updateMynotesInfo(mynotescount, page);
329 //panel.centerDialogue();
330 },
331 registerActions: function() {
332 var scope = this;
333
334 $('body').delegate('#addmynote_cancel', 'click', function() {panel.hide()});
335 $('body').delegate('#addmynote_submit', 'click', function(e) {scope.saveMynotes(e)});
336
337 $('body').delegate(SELECTORS.MYNOTES_BASE + ' ul.tabs-menu li', 'click', function(e) {
338 $(this).addClass("current");
339 $(this).siblings().removeClass("current");
340 var tab = $(this).attr("id").replace('tab-', '');
341 $(SELECTORS.MYNOTES_BASE + ' .tab-content').not('#' + tab).css("display", "none");
342 $(SELECTORS.MYNOTES_BASE + ' #' + tab + '.tab-content').css("display", "block");
343 scope.currenttab = '#'+tab;
344
345 var isloaded = $(scope.currenttab).attr('data-loaded');
346 if (typeof isloaded == 'undefined' || isloaded == false) {
347 $(SELECTORS.MYNOTES_BASE).find(scope.currenttab).attr('data-loaded', "true");
348 scope.getMynotes(0);
349 }
350 });
351
352 $('body').delegate('#id_mynotecontent-' + CONFIG.instanceid, 'focus blur', function(e) {
353 scope.toggle_textarea(e);
354 });
355 $('body').delegate('#id_mynotecontent-' + CONFIG.instanceid, 'change keypress keyup', function(e) {
356 scope.getWarnings(scope.checkInputText());
357 });
358
359 $('body').delegate(SELECTORS.MYNOTES_BASE + ' .mynotes-paging .paging a', 'click', function(e) {
360 e.preventDefault();
361 var regex = new RegExp(/[\?&]page=(\d+)/);
362 var results = regex.exec($(this).attr('href'));
363 var page = 0;
364 if (results[1]) {
365 page = results[1];
366 }
367 $(SELECTORS.MYNOTES_BASE).find(scope.currenttab).attr('onpage', parseInt(page));
368 scope.getMynotes(page);
369 });
370 $('body').delegate(SELECTORS.MYNOTES_BASE + ' a.mynote-delete', 'click', function(e) {
371 e.preventDefault();
372 var nid = $(this).attr('id');
373 if (nid != '' || nid != 'undefined') {
374 var notescount = $(SELECTORS.MYNOTES_BASE).find(SELECTORS.MYNOTES_LISTS + '-' + scope.currenttab + ' > li').length;
375 var id = nid.replace('mynote-delete-'+ CONFIG.instanceid + '-', '');
376 var arg = {
377 contextid: CONFIG.contextid,
378 action: 'delete',
379 noteid: id,
380 lastnotecounts: notescount,
381 };
382 scope.request({
383 params: arg,
384 callback: function(id, ret, args) {
385 args.scope.addToList(ret);
386 $('#mynote-'+ CONFIG.instanceid + '-' + ret.noteid).remove();
387 args.scope.displayMynotes();
388 }
389 });
390 }
391 });
392 },
393 displayDialogue: function(e) {
394 var scope = mynotes;
395 if (panel === null) {
396 str.get_strings([
397 {key : 'mynotes', component : 'block_mynotes'},
398 {key : 'characterlimit', component : 'block_mynotes'},
399 {key : 'save', component : 'block_mynotes'},
400 {key : 'cancel'},
401 {key : 'mynotessavedundertab', component : 'block_mynotes', param: CONFIG.contextareas[scope.currenttabindex]},
402 {key : 'placeholdercontent', component : 'block_mynotes'}
403 ]).done(function(s) {
404 // Create basic tab structure
405 var el = $('<div></div>').append($('<div id="' + CSS.MYNOTES_BASE + '" class="' + CSS.MYNOTES_BASE + '"></div>')
406 .append('<div class="inputarea"><div class="responsetext"></div><div id="addmynote-label-' + CONFIG.instanceid + '">' + s[1] + ' ' + CONFIG.maxallowedcharacters + '<span class="warning"></span></div>' +
407 '<div class="textarea"><textarea id="id_mynotecontent-' + CONFIG.instanceid + '" name="mynotecontent" rows="2">' + s[5] + '</textarea></div>' +
408 '<p class="notesavedhint">' + s[4] + '</p>' +
409 '<p class="mdl-align"><input type="submit" id="addmynote_submit"/></p>' +
410 '</div>'
411 )
412 .append($('<ul class="tabs-menu"></ul>'))
413 .append($('<div class="tab"></div>'))
414 );
415 el.find('#addmynote_submit').attr('value', s[2]);
416 el.find('#addmynote_cancel').attr('value', s[3]);
417 var tabsmenu = '';
418 var tabcontents = '';
419 var i = '';
420 for (i in CONFIG.contextareas) {
421 if (scope.currenttabindex == i) {
422 tabsmenu += '<li class="current" id="tab-' + CONFIG.prefix + i + '"><div class="menu-item">' + CONFIG.contextareas[i] + '</div></li>';
423 } else {
424 tabsmenu += '<li class="" id="tab-' + CONFIG.prefix + i + '"><div class="menu-item">' + CONFIG.contextareas[i] + '</div></li>';
425 }
426 tabcontents += '<div class="tab-content" id="' + CONFIG.prefix + i + '" onpage="0" notes-count="0">'
427 + '<div class="notes-info"><div class="mynotes-paging"></div><div class="count"></div></div>'
428 + '<ul id="' + CONFIG.prefix + i + '-list" class="mynotes_lists"></ul>'
429 + '</div>';
430 }
431 el.find('.tabs-menu').append(tabsmenu);
432 el.find('.tab').append($(tabcontents));
433 Y.use('moodle-core-notification-dialogue', function() {
434 panel = new M.core.dialogue({
435 draggable: true,
436 modal: true,
437 closeButton: true,
438 headerContent: M.util.get_string('mynotes', 'block_mynotes'),
439 responsive: true,
440 });
441 panel.set('bodyContent', el.html());
442 if (initnotes === null) {
443 initnotes = true;
444 // Get initial notes
445 scope.getMynotes(0);
446 $(SELECTORS.MYNOTES_BASE).find(scope.currenttab).attr('data-loaded', "true");
447 $(SELECTORS.MYNOTES_BASE).find(scope.currenttab).css('display', 'block');
448 }
449 panel.show();
450 });
451 scope.registerActions();
452
453 });
454 } else {
455 panel.show();
456 }
457 },
458 /**
459 * Initialize mynotes
460 * @access public
461 * @param {int} instanceid
462 * @param {int} contextid
463 * @param {int} maxallowedcharacters
464 * @param {int} perpage
465 * @param {string} editingicon_pos
466 * @param {bool} editing
467 * @param {string} adminurl
468 * @param {array} contextareas
469 * @param {string} currenttabindex
470 */
471 init: function(args) {
472 CONFIG = args;
473 CONFIG.prefix = 'mynotes_';
474 this.perpage = parseInt(CONFIG.perpage);
475 this.currenttab = '#mynotes_' + args.currenttabindex;
476 this.defaulttab = '#mynotes_' + args.currenttabindex;
477 this.currenttabindex = args.currenttabindex;
478 this.api = this.getMynotesValidatedUrl(M.cfg.wwwroot+'/blocks/mynotes/mynotes_ajax.php');
479
480 var strtitle = M.util.get_string('showmynotes', 'block_mynotes');
481 if (!CONFIG.editing) {
482 var handler = $('<div class="'+ CSS.MYNOTES_OPENER +'" title="' + strtitle + '" alt="' + strtitle+ '">' + M.util.get_string('mynotes', 'block_mynotes') + '</div>');
483 handler.addClass(CONFIG.editingicon_pos);
484 $('body').append(handler);
485 handler.html('<span class="pencil">&#x270D;</span>');
486 } else {
487 var handler = $('<div class="'+ CSS.MYNOTES_OPENER +'" title="' + strtitle + '" alt="' + strtitle+ '">' + M.util.get_string('mynotes', 'block_mynotes') + '</div>');
488 handler.addClass(CONFIG.editingicon_pos);
489 handler.html('<span class="pencil">&#x270D;</span>');
490 $('.inline-'+ CSS.MYNOTES_OPENER).html(handler);
491 $('.inline-'+ CSS.MYNOTES_OPENER).append('<div class="mynotes-pos-inline-text '+ CSS.MYNOTES_OPENER +'">' + strtitle + '</div>');
492 }
493 var body = $('body');
494 body.delegate(SELECTORS.MYNOTES_OPENER, 'click', this.displayDialogue);
495 }
496 };
497 return mynotes;
498 });
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 // This file is part of Moodle - http://moodle.org/
3 //
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
16
17 /**
18 * The mynotes block
19 *
20 * @package block_mynotes
21 * @author Gautam Kumar Das<gautam.arg@gmail.com>
22 */
23
24 defined('MOODLE_INTERNAL') || die();
25
26 require_once($CFG->dirroot . '/blocks/mynotes/lib.php');
27
28 /**
29 * Mynotes block.
30 *
31 * @package block_mynotes
32 *
33 */
34 class block_mynotes extends block_base {
35
36 public function init() {
37 $this->title = get_string('pluginname', 'block_mynotes');
38 }
39
40 public function has_config() {
41 return true;
42 }
43
44 public function applicable_formats() {
45 return array('all' => true);
46 }
47
48 public function instance_allow_multiple() {
49 return false;
50 }
51
52 public function hide_header() {
53 global $PAGE;
54 if (!$PAGE->user_is_editing()) {
55 return true;
56 }
57 }
58
59 /**
60 * The content object.
61 *
62 * @return stdObject
63 */
64 public function get_content() {
65 global $CFG, $PAGE;
66
67 static $jscount = 0;
68 if ($this->content !== null) {
69 return $this->content;
70 }
71
72 if (!isloggedin() or isguestuser()) {
73 return ''; // Never useful unless you are logged in as real users
74 }
75
76 if (!in_array($PAGE->context->contextlevel, array(CONTEXT_COURSE, CONTEXT_SYSTEM, CONTEXT_MODULE, CONTEXT_USER))) {
77 return '';
78 }
79
80 $this->content = new stdClass();
81 $this->content->footer = '';
82 $this->content->text = '';
83 if (empty($this->instance)) {
84 return $this->content;
85 }
86
87 $this->content = new stdClass();
88 $this->content->text = '';
89 if ($PAGE->user_is_editing()) {
90 $this->content->text = '<div class="inline-mynotes-opener">'.get_string('showmynotes', 'block_mynotes').'</div>';
91 }
92 $this->content->footer = '';
93
94 if ($jscount == 0) {
95 $this->block_mynotes_get_required_javascript();
96 $jscount++;
97 }
98 return $this->content;
99 }
100
101 /*
102 * load JS that requires into the page.
103 */
104 private function block_mynotes_get_required_javascript() {
105 global $PAGE, $CFG;
106 list($context, $course, $cm) = get_context_info_array($PAGE->context->id);
107 $config = get_config('block_mynotes');
108
109 $mm = new block_mynotes_manager();
110 $currenttabindex = $mm->get_current_tab($context, $PAGE);
111 $arguments = array( 'arg'=> array(
112 'instanceid' => $this->instance->id,
113 'editing' => ($PAGE->user_is_editing()),
114 'editingicon_pos' => ($PAGE->user_is_editing()) ? 'mynotes-pos-inline' : $config->icondisplayposition,
115 'maxallowedcharacters' => $config->characterlimit,
116 'contextid' => $context->id,
117 'maxallowedcharacters_warning' => get_string('notmorethan', 'block_mynotes', $config->characterlimit),
118 'contextareas' => $mm->get_available_contextareas(),
119 'currenttabindex' => ($currenttabindex == null ? 'site' : $currenttabindex),
120 'perpage' => $config->mynotesperpage,
121 ),
122 );
123 // $PAGE->requires->string_for_js('charactersleft', 'block_mynotes');
124 $PAGE->requires->string_for_js('notmorethan', 'block_mynotes');
125 $PAGE->requires->string_for_js('mynotes', 'block_mynotes');
126 $PAGE->requires->string_for_js('showmynotes', 'block_mynotes');
127 $PAGE->requires->string_for_js('savedsuccess', 'block_mynotes');
128 $PAGE->requires->string_for_js('save', 'block_mynotes');
129 $PAGE->requires->string_for_js('placeholdercontent', 'block_mynotes');
130 $PAGE->requires->string_for_js('deletemynotes', 'block_mynotes');
131 $PAGE->requires->string_for_js('mynotescount', 'block_mynotes');
132 $PAGE->requires->string_for_js('previouspage', 'block_mynotes');
133 $PAGE->requires->string_for_js('nextpage', 'block_mynotes');
134 $PAGE->requires->string_for_js('nothingtodisplay', 'block_mynotes');
135 $PAGE->requires->string_for_js('mynotessavedundertab', 'block_mynotes');
136 $PAGE->requires->string_for_js('cancel', 'moodle');
137 $this->page->requires->js_call_amd('block_mynotes/mynotesblock', 'init', $arguments);
138 }
139 }
...\ No newline at end of file ...\ No newline at end of file
1 if (url.includes('/mod/hvp/')){
2 $(document).ready(function(){
3 var m = document.getElementsByClassName("h5p-iv-hotkey-instructions");
4 console.log(m);
5 var check=$("div.h5p-iv-hotkey-instructions").html();
6 var check1=$('div.h5p-iv-hotkey-instructions').text();
7 console.log(check);
8 console.log(check1);
9 setTimeout(function(){
10 $('#mynotepencil').click(function(){
11
12 var check=$('.h5p-iv-hotkey-instructions').html();
13 var check1=$('.h5p-iv-hotkey-instructions').text();
14 console.log(check);
15 console.log(check1);
16 alert(check);
17 // var valuetime= $(".h5p-control, .h5p-simple-time, .h5p-current, span.human-time").text();
18 // var newvalue= $('.h5p-control, .h5p-simple-time, .h5p-current, span.human-time').text();
19 var valuetime1= $(".h5p-controls-right .h5p-control .h5p-time .h5p-current .human-time").text();
20 var newvalue1= $('.h5p-controls-right .h5p-control .h5p-time .h5p-current .human-time').text();
21 // console.log(" click notes"+newvalue);
22 // var y =$('.human-time').html();
23 // console.log("first"+valuetime);console.log("second"+newvalue);
24 console.log("first"+valuetime1);console.log("second"+newvalue1);
25 // alert("hi");
26 });
27 }, 0500);
28 });
29 }
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 // This file is part of Moodle - http://moodle.org/
3 //
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
16
17 /**
18 * Mynotes block caps.
19 *
20 * @package block_mynotes
21 * @author Gautam Kumar Das<gautam.arg@gmail.com>
22 */
23
24 defined('MOODLE_INTERNAL') || die();
25
26 $capabilities = array(
27
28 'block/mynotes:myaddinstance' => array(
29 'captype' => 'write',
30 'contextlevel' => CONTEXT_SYSTEM,
31 'archetypes' => array(
32 'user' => CAP_ALLOW
33 ),
34
35 'clonepermissionsfrom' => 'moodle/my:manageblocks'
36 ),
37
38 'block/mynotes:addinstance' => array(
39 'riskbitmask' => RISK_SPAM | RISK_XSS,
40
41 'captype' => 'write',
42 'contextlevel' => CONTEXT_BLOCK,
43 'archetypes' => array(
44 'editingteacher' => CAP_ALLOW,
45 'manager' => CAP_ALLOW
46 ),
47
48 'clonepermissionsfrom' => 'moodle/site:manageblocks'
49 ),
50 );
1 <?php
2 // This file is part of Moodle - http://moodle.org/
3 //
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
16
17 defined('MOODLE_INTERNAL') || die();
18
19 /**
20 * Mynotes block installation.
21 *
22 * @package block_mynotes
23 */
24
25 function xmldb_block_mynotes_install() {
26 global $DB;
27
28 $obj = new stdClass();
29 $obj->blockname = 'mynotes';
30 $obj->parentcontextid = SITEID;
31 $obj->showinsubcontexts = 1;
32 $obj->pagetypepattern = '*';
33 $obj->defaultweight = 0;
34 $obj->defaultregion = BLOCK_POS_LEFT;
35 $obj->configdata = '';
36 $obj->timecreated = time();
37 $obj->timemodified = time();
38 $DB->insert_record('block_instances', $obj);
39
40 }
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 <?xml version="1.0" encoding="UTF-8" ?>
3 <XMLDB PATH="blocks/mynotes/db" VERSION="20160404" COMMENT="XMLDB file for my notes"
4 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5 xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd">
6 <TABLES>
7 <TABLE NAME="block_mynotes" COMMENT="My Notes">
8 <FIELDS>
9 <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
10 <FIELD NAME="contextid" TYPE="int" LENGTH="10" 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"/>
13 <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
14 <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="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
17 </FIELDS>
18 <KEYS>
19 <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
20 </KEYS>
21 </TABLE>
22 </TABLES>
23 </XMLDB>
1 <?php
2
3 // This file is part of Moodle - http://moodle.org/
4 //
5 // Moodle is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // Moodle is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
17
18 /**
19 * Strings for component 'block_mynotes', language 'en', branch 'MOODLE_29_STABLE'
20 *
21 * @package block_mynotes
22 * @author Gautam Kumar Das<gautam.arg@gmail.com>
23 */
24
25 $string['mynotes:myaddinstance'] = 'Add a new mynotes block to Dashboard';
26 $string['mynotes:addinstance'] = 'Add a new mynotes block';
27 $string['mynotes:post'] = 'Add a new note';
28 $string['mynotes:view'] = 'View own notes';
29 $string['mynotes:delete'] = 'Delete own notes';
30 $string['pluginname'] = 'My Notes';
31 $string['disabledmynotes'] = 'Disabled my notes';
32 $string['showmynotes'] = 'Show my notes';
33 $string['addnotes'] = 'Add notes';
34 $string['mynotes'] = 'My notes';
35 $string['mynotescount'] = 'Total count: ';
36 $string['mynotesrequirelogin'] = 'You must login to add/view your notes';
37 $string['deletemynotes'] = 'Delete note';
38 $string['site'] = 'Site';
39 $string['course'] = 'Course';
40 $string['mod'] = 'Modules';
41 $string['user'] = 'Personal';
42 $string['save'] = 'Save';
43 $string['savedsuccess'] = 'Your note has been added successfully';
44 $string['mynotessavedundertab'] = 'For this page, your notes will be saved under <strong>{$a} tab</strong>.';
45 $string['placeholdercontent'] = 'Enter note content...';
46 $string['charactersleft'] = 'Characters left: ';
47 $string['characterlimit'] = 'Characters limit: ';
48 $string['characterlimit_help'] = 'This setting defines the maximum characters limit to write a note.';
49 $string['notmorethan'] = 'Can not enter more than {$a} characters';
50 $string['bottomright'] = 'Bottom-Right';
51 $string['bottomleft'] = 'Bottom-Left';
52 $string['topright'] = 'Top-Right';
53 $string['topleft'] = 'Top-Left';
54 $string['icondisplayposition'] = 'Icon position';
55 $string['icondisplayposition_help'] = 'Choose the position for Note-Icon which will used to open popup.';
56 $string['mynotesperpage'] = 'Per page';
57 $string['mynotesperpage_help'] = 'Limit the notes display on per page';
58 $string['deletefailed'] = 'Delete action failed';
59 $string['nopermissiontodelete'] = 'You do not have permission to delete this note';
60 $string['previouspage'] = '<< Previous page';
61 $string['nextpage'] = 'Next page >>';
62 $string['nothingtodisplay'] = 'Nothing to display';
63 $string['nocharacterlimit'] = ' ';
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 // This file is part of Moodle - http://moodle.org/
3 //
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
16
17 /**
18 * The mynotes block helper functions and callbacks
19 *
20 * @package block_mynotes
21 * @author Gautam Kumar Das<gautam.arg@gmail.com>
22 */
23
24 defined('MOODLE_INTERNAL') || die();
25
26
27 class block_mynotes_manager {
28
29 public $perpage = 5;
30 private $config = null;
31
32 /*
33 * Constructor.
34 */
35 public function __construct() {
36 $this->config = get_config('block_mynotes');
37 $this->perpage = $this->config->mynotesperpage;
38 }
39
40 /**
41 * Returns matched mynotes
42 *
43 * @param int $page
44 * @return array
45 */
46 public function get_mynotes($options) {
47 global $DB, $CFG, $USER, $OUTPUT;
48
49 $page = (!isset($options->page) || !$options->page) ? 0 : $options->page;
50 $perpage = $this->perpage;
51
52 $params = array();
53 $start = $page * $perpage;
54 $ufields = 'u.id';
55
56 $where = ' m.userid = :userid';
57 $params['userid'] = $USER->id;
58 /* if (isset($options->contextarea) && !empty($options->contextarea)) {
59 $where .= ' AND m.contextarea = :contextarea';
60 $params['contextarea'] = $options->contextarea;
61 }
62 if (isset($options->courseid) && $options->courseid) {
63 $where .= ' AND m.courseid = :courseid';
64 $params['courseid'] = $options->courseid;
65 } */
66 if(isset($options->contextid) && $options->contextid){
67 $where .= ' AND m.contextid = :contextid';
68 $params['contextid'] = $options->contextid;
69
70 }
71 $sql = "SELECT $ufields,
72 m.id AS mynoteid, m.content AS ccontent, m.contextarea, m.contextid, m.format AS cformat,
73 m.timecreated AS timecreated, c.fullname as coursename, m.courseid
74 FROM {block_mynotes} m
75 JOIN {user} u ON u.id = m.userid
76 LEFT JOIN {course} c ON c.id = m.courseid
77 WHERE $where
78 ORDER BY m.timecreated DESC";
79 $strftime = get_string('strftimerecentfull', 'langconfig');
80 $mynotes = array();
81 $formatoptions = array('overflowdiv' => true);
82 $start = (isset($options->limitfrom)) ? $options->limitfrom : $start;
83 $rs = $DB->get_recordset_sql($sql, $params, $start, $perpage);
84 foreach ($rs as $u) {
85 $c = new stdClass();
86 $c->id = $u->mynoteid;
87 $c->userid = $u->id;
88 if ($u->courseid != SITEID) {
89 $c->coursename = html_writer::link(course_get_url($u->courseid), $u->coursename);
90 } else {
91 $c->coursename = '';
92 }
93 $c->content = $u->ccontent;
94 $c->contextarea = $u->contextarea;
95 $c->format = $u->cformat;
96 $c->timecreated = userdate($u->timecreated, $strftime);
97 $c->content = format_text($c->content, $c->format, $formatoptions);
98 $c->delete = true;
99 $mynotes[] = $c;
100 }
101 $rs->close();
102 return $mynotes;
103 }
104
105 /**
106 * Returns count of the mynotes in a table where all the given conditions met.
107 *
108 * @param object $options
109 * @return int The count of records
110 */
111 public function count_mynotes($options) {
112 global $DB, $USER;
113 $params = array();
114 // $params ['contextid']= $options->contextid;
115 // $params= $options->contextid;
116 $sql='select COUNT(contextarea) from {block_mynotes} where contextid= :contextid';
117 $params ['contextid']= $options->contextid;
118 return $DB->count_records_sql($sql,$params);
119 /* $params['userid'] = $USER->id;
120 if (isset($options->contextarea) && !empty($options->contextarea)) {
121 $params['contextarea'] = $options->contextarea;
122 }
123 if (isset($options->contextid) && !empty($options->contextid)) {
124 $params['contextid'] = $options->contextid;
125 }
126 return $DB->count_records('block_mynotes',$params); */
127
128 }
129
130 /*
131 * Returns paging bar for mynotes
132 *
133 * @param object $options must contain properties(contextid, count, page, perpage)
134 * @return html
135 */
136 public function get_pagination($options) {
137 global $OUTPUT;
138 $baseurl = new moodle_url('/blocks/mynotes/mynotes_ajax.php',
139 array(
140 'contextid' => $options->contextid)
141 );
142 return $OUTPUT->paging_bar($options->count, $options->page, $this->perpage, $baseurl);
143 }
144
145 /*
146 * Adding new record of mynote.
147 *
148 * @return object of single mynote record if insert to DB else false
149 */
150 public function addmynote($context, $contextarea, $course, $content, $format = FORMAT_MOODLE) {
151 global $CFG, $DB, $USER, $OUTPUT;
152
153 $newnote = new stdClass;
154 $newnote->contextid = $context->id;
155 $newnote->contextarea = $contextarea;
156 $newnote->content = $content;
157 $newnote->courseid = $course->id;
158 $newnote->format = $format;
159 $newnote->userid = $USER->id;
160 $newnote->timecreated = time();
161
162 if ($cmtid = $DB->insert_record('block_mynotes', $newnote)) {
163 $newnote->id = $cmtid;
164 $newnote->content = format_text($newnote->content, $newnote->format, array('overflowdiv' => true));
165 $newnote->timecreated = userdate($newnote->timecreated, get_string('strftimerecentfull', 'langconfig'));
166 $newnote->coursename = ($newnote->courseid == SITEID) ? '' : $course->fullname;
167 if (!empty($newnote->coursename)) {
168 $newnote->coursename = html_writer::link(course_get_url($course), $newnote->coursename);
169 }
170 return $newnote;
171 } else {
172 return false;
173 }
174 }
175
176 /*
177 * Find all available context areas which is used to store and retrieve mynotes.
178 *
179 * @return array
180 */
181 public function get_available_contextareas() {
182 return array(
183 // 'site' => get_string('site', 'block_mynotes'),
184 // 'course' => get_string('course', 'block_mynotes'),
185 // 'mod' => get_string('mod', 'block_mynotes'),
186 'user' => get_string('user', 'block_mynotes'),
187 );
188 }
189 /*
190 * Find context area using context level.
191 *
192 * @param object $context
193 * @retrun string
194 */
195 public function get_current_tab($context, $page) {
196
197 /* if ($page->url->compare(new moodle_url('/user/view.php'), URL_MATCH_BASE)) {
198 return 'user';
199
200 } else if ($page->url->compare(new moodle_url('/user/profile.php'), URL_MATCH_BASE)) {
201 return 'user';
202
203 } else if ($context->contextlevel == CONTEXT_SYSTEM) {
204 return 'site';
205
206 } else if ($context->contextlevel == CONTEXT_COURSE) {
207 if ($context->instanceid == SITEID) {
208 return 'site';
209 }
210 return 'course';
211
212 } else if ($context->contextlevel == CONTEXT_MODULE) {
213 return 'mod';
214
215 } else if ($context->contextlevel == CONTEXT_USER) {
216 return 'user';
217
218 } else if ($context->contextlevel == CONTEXT_BLOCK) {
219 $parent = $context->get_parent_context();
220
221 if ($parent->contextlevel == CONTEXT_COURSE) {
222 return 'course';
223 } else if ($parent->contextlevel == CONTEXT_MODULE) {
224 return 'mod';
225 }
226 } */
227 return 'user';
228 }
229
230 /**
231 * Delete a note
232 *
233 * @param int $mynoteid
234 * @return bool
235 */
236 public function delete($mynoteid) {
237 global $DB, $USER;
238 if (!$mynote = $DB->get_record('block_mynotes', array('id' => $mynoteid))) {
239 throw new mynotes_exception('deletefailed', 'block_mynotes');
240 }
241 if ($USER->id != $mynote->userid) {
242 throw new mynotes_exception('nopermissiontodelete', 'block_mynotes');
243 }
244 return $DB->delete_records('block_mynotes', array('id' => $mynoteid));
245 }
246 }
247
248 /**
249 * Mynotes exception class
250 */
251 class mynotes_exception extends moodle_exception {
252 }
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 // This file is part of Moodle - http://moodle.org/
3 //
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
16
17 /*
18 * Handling all ajax request for mynotes API
19 *
20 * @package block_mynotes
21 * @author Gautam Kumar Das<gautam.arg@gmail.com>
22 */
23 define('AJAX_SCRIPT', true);
24 define('NO_DEBUG_DISPLAY', true);
25
26 require_once('../../config.php');
27 require_once($CFG->dirroot.'/course/lib.php');
28 require_once($CFG->dirroot . '/blocks/mynotes/lib.php');
29
30 $contextid = optional_param('contextid', SYSCONTEXTID, PARAM_INT);
31 $contextarea = optional_param('contextarea', 'site', PARAM_ALPHA);
32 $action = optional_param('action', '', PARAM_ALPHA);
33 $page = optional_param('page', 0, PARAM_INT);
34
35 list($context, $course, $cm) = get_context_info_array($contextid);
36
37 if ( $contextid == SYSCONTEXTID || $context->contextlevel == CONTEXT_USER) {
38 $course = get_site();
39 }
40
41 $PAGE->set_url('/blocks/mynotes/mynotes_ajax.php');
42
43 require_course_login($course, true, $cm);
44
45 $PAGE->set_context($context);
46 if (!empty($cm)) {
47 $PAGE->set_cm($cm, $course);
48 } else if (!empty($course)) {
49 $PAGE->set_course($course);
50 }
51
52 if (!confirm_sesskey()) {
53 $error = array('error' => get_string('invalidsesskey', 'error'));
54 die(json_encode($error));
55 }
56
57 if (!isloggedin()) {
58 echo json_encode(array('error' => 'require_login'));
59 die();
60 }
61 $config = get_config('block_mynotes');
62
63 echo $OUTPUT->header(); //...send headers
64 // process ajax request
65 switch ($action) {
66 case 'add':
67 $content = optional_param('content', '', PARAM_RAW);
68 $manager = new block_mynotes_manager();
69 if ($note = $manager->addmynote($context, $contextarea, $course, $content)) {
70 $options = new stdClass();
71 $options->page = $page;
72 $options->courseid = $course->id;
73 $options->contextid = $context->id;
74 $options->context = $context;
75 $options->contextarea = $contextarea;
76 unset($options->courseid);
77 $count = $manager->count_mynotes($options);
78 echo json_encode(array('notes' => array($note), 'count' => $count));
79 } else {
80 echo json_encode(array('error' => 'Unable to add note'));
81 }
82 die();
83 break;
84 case 'get':
85 $manager = new block_mynotes_manager();
86 $options = new stdClass();
87 $options->page = $page;
88 $options->contextid = $context->id;
89 $options->contextarea = $contextarea;
90 $count = $manager->count_mynotes($options);
91 $notes = $manager->get_mynotes($options);
92 echo json_encode(array('notes' => $notes, 'count' => $count));
93 die();
94 break;
95 case 'delete':
96 $noteid = required_param('noteid', PARAM_INT);
97 $limitfrom = optional_param('lastnotecounts', 0, PARAM_INT);
98 $manager = new block_mynotes_manager();
99 if ($manager->delete($noteid)) {
100 $options = new stdClass();
101 $options->page = $page;
102 $options->contextarea = $contextarea;
103 $count = $manager->count_mynotes($options);
104 if ($limitfrom) {
105 $options->limitfrom = $limitfrom - 1;
106 }
107 $notes = $manager->get_mynotes($options);
108 echo json_encode(array('notes' => $notes, 'count' => $count, 'noteid' => $noteid));
109 }
110 die();
111 break;
112 }
113 die();
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 // This file is part of Moodle - http://moodle.org/
3 //
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
16
17 /**
18 * Settings for the Mynotes block
19 *
20 * @package block_mynotes
21 * @author Gautam Kumar Das<gautam.arg@gmail.com>
22 */
23
24 defined('MOODLE_INTERNAL') || die;
25
26 if ($ADMIN->fulltree) {
27
28 $perpageoptions = array();
29 for ($i = 1; $i < 20; $i++) {
30 $perpageoptions[$i] = $i;
31 }
32 $settings->add(new admin_setting_configselect('block_mynotes/mynotesperpage', get_string('mynotesperpage', 'block_mynotes'),
33 get_string('mynotesperpage_help', 'block_mynotes'), 5, $perpageoptions));
34
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));
37
38 $positionoptions = array();
39 $positionoptions['mynotes-pos-rb'] = get_string('bottomright', 'block_mynotes');
40 $positionoptions['mynotes-pos-lb'] = get_string('bottomleft', 'block_mynotes');
41 $positionoptions['mynotes-pos-rt'] = get_string('topright', 'block_mynotes');
42 $positionoptions['mynotes-pos-lt'] = get_string('topleft', 'block_mynotes');
43 $settings->add(new admin_setting_configselect('block_mynotes/icondisplayposition', get_string('icondisplayposition', 'block_mynotes'),
44 get_string('icondisplayposition_help', 'block_mynotes'), 'mynotes-pos-rb', $positionoptions));
45 }
...\ No newline at end of file ...\ No newline at end of file
1 #mynotes-opener { position: absolute; bottom:0px; background: #443355; width: 25px; height: 25px; }
2 div.mdl-align { min-height: 470px; }
3 .mynotes-pos-inline-text { padding: 10px; margin-left: 35px; cursor: pointer; }
4 .mynotes-pos-inline,
5 .mynotes-pos-rb,
6 .mynotes-pos-lb,
7 .mynotes-pos-rt,
8 .mynotes-pos-lt { width: 40px; height: 40px; position: fixed; background: #b31b1b; padding: 0; border-radius: 30px; text-align: center; }
9 .mynotes-pos-rb { bottom: 5px; right: 20px; }
10 .mynotes-pos-lb { bottom: 5px; left: 20px; }
11 .mynotes-pos-rt { top: 100px; right: 20px; }
12 .mynotes-pos-lt { top: 100px; left: 20px; }
13 .mynotes-pos-inline { position: relative; float: left; }
14 .mynotes-pos-inline >span.pencil, .mynotes-pos-rb >span.pencil, .mynotes-pos-lb>span.pencil, .mynotes-pos-rt>span.pencil, .mynotes-pos-lt>span.pencil { color: #fff; font-size: 29px; margin: 0; display: inline-block; font-weight: bold; cursor: pointer; line-height: 40px; }
15
16 .mynotes_base { display: inline-block; width: 100%; }
17 .mynotes_base .inputarea { background: #fff4d5; padding: 5px; margin-bottom: 10px; }
18 .mynotes_base .inputarea p {margin: 0; font-size: 13px; }
19 .mynotes_base .textarea { border: 1px solid gray; padding: 5px; background: #fff; }
20 .mynotes_base textArea:focus { border: none; box-shadow: none; }
21 .mynotes_base textArea {width:100%; max-width: 100%; margin: 0; padding: 0; max-height: 125px; border: none; box-shadow: none; }
22 .mynotes_base input[type="submit"], .mynotes_base input[type="submit"]:hover { margin: 0; padding: 3px 10px; border: none; background: #63ab36; color: #fff; }
23 .mynotes_base input[type="submit"][disabled="disabled"]:hover { background: #63ab36; cursor: not-allowed; }
24 .mynotes_base span.warning { color: #bd3c2f; margin-left: 15px; }
25 .mynotes_base .responsetext { color: #33b733; line-height: 20px; }
26 .mynotes_base .tabs-menu { height: 30px; float: left; clear: both; margin-bottom: 1px; }
27 .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; }
28 .mynotes_base .tabs-menu li:first-child { border-radius: 7px 0 0 0; }
29 .mynotes_base .tabs-menu li:last-child { border-radius: 0 7px 0 0; }
30 .mynotes_base .tabs-menu li.current { position: relative; background-color: #ffe6a4; border-bottom: 1px solid #fff; z-index: 5; border-bottom: 2px solid #ffe6a4; }
31 .mynotes_base .tabs-menu li:first-child.current { border-left: 1px solid #d4d4d1; border-top: 1px solid #d4d4d4; }
32 .mynotes_base .tabs-menu li:last-child.current { border-right: 1px solid #d4d4d1; border-top: 1px solid #d4d4d4; }
33 .mynotes_base .tabs-menu li .menu-item { text-transform: uppercase; color: #fff; text-decoration: none; }
34 .mynotes_base .tabs-menu .current .menu-item { color: #000; }
35
36 .mynotes_base .tab { border: 1px solid #d4d4d1; clear: both; width: auto; background: #f7f7f4; }
37 .mynotes_base .tab .tab-content { display: none; }
38 .mynotes_base .tab .tab-content .notes-info { background: #ffe6a4; padding: 5px; position: relative; }
39 .mynotes_base .tab .tab-content .notes-info .count { color: #000; }
40 .mynotes_base .tab .tab-content .notes-info .mynotes-paging { position: absolute; right: 0; }
41 .mynotes_base .tab .tab-content .notes-info .mynotes-paging .paging a { margin: 5px; background: #c1621e; padding: 4px 10px; border-radius: 15px; color: #fff; }
42 .mynotes_base .tab .tab-content .notes-info .mynotes-paging .paging .separator { border-left: 1px solid gray; }
43 .mynotes_base .tab .tab-content ul.mynotes_lists { margin:0; clear: both; }
44 .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; }
45 .mynotes_base .tab .tab-content ul.mynotes_lists li .content { margin-right: 10px; word-wrap: break-word; }
46 .mynotes_base .tab .tab-content ul.mynotes_lists li .note-detail { display: inline-block; font-size: 11px; }
47 .mynotes_base .tab .tab-content ul.mynotes_lists li .time { color: #888; font-style: italic; display: inline-block; margin-left: 5px; font-size: 11px; }
48 .mynotes_base .tab .tab-content ul.mynotes_lists li a.mynote-delete { position: absolute; right: 0; margin:0 4px; }
49 .mynotes_base .tab .tab-content ul.mynotes_lists li a.mynote-delete span { color: #bbb; }
50
1 <?php
2 // This file is part of Moodle - http://moodle.org/
3 //
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
16
17 /**
18 * Version details
19 *
20 * @package block_mynotes
21 * @author Gautam Kumar Das<gautam.arg@gmail.com>
22 */
23
24 defined('MOODLE_INTERNAL') || die();
25
26 $plugin->version = 2018011200; // The current plugin version (Date: YYYYMMDDXX)
27 $plugin->requires = 2015050500; // Requires this Moodle version
28 $plugin->component = 'block_mynotes'; // Full name of the plugin (used for diagnostics)
29 $plugin->release = 'V3.4 r1';
30 $plugin->maturity = MATURITY_STABLE;
...\ 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!