├── .sams ├── README ├── allposts.php ├── amd ├── build │ ├── accordion.min.js │ ├── accordion.min.js.map │ ├── export.min.js │ ├── export.min.js.map │ ├── main.min.js │ ├── main.min.js.map │ ├── modal.min.js │ ├── modal.min.js.map │ ├── savecheck.min.js │ ├── savecheck.min.js.map │ ├── statsupdate.min.js │ ├── statsupdate.min.js.map │ ├── tagselector.min.js │ └── tagselector.min.js.map └── src │ ├── accordion.js │ ├── export.js │ ├── main.js │ ├── modal.js │ ├── savecheck.js │ ├── statsupdate.js │ └── tagselector.js ├── approve.php ├── atomlib.php ├── backup └── moodle2 │ ├── backup_oublog_activity_task.class.php │ ├── backup_oublog_settingslib.php │ ├── backup_oublog_stepslib.php │ ├── restore_oublog_activity_task.class.php │ └── restore_oublog_stepslib.php ├── bloglogin.php ├── classes ├── completion │ └── custom_completion.php ├── event │ ├── comment_approved.php │ ├── comment_created.php │ ├── comment_deleted.php │ ├── course_module_instance_list_viewed.php │ ├── course_module_viewed.php │ ├── participation_viewed.php │ ├── post_created.php │ ├── post_deleted.php │ ├── post_imported.php │ ├── post_updated.php │ ├── post_viewed.php │ ├── save_failed.php │ └── site_entries_viewed.php ├── files_mask.php ├── hook_callbacks.php ├── portfolio_caller.php ├── privacy │ └── provider.php ├── search │ ├── activity.php │ ├── comments.php │ └── post.php ├── task │ ├── cron_task.php │ └── settings_task.php └── tool_datamasking.php ├── comment_form.php ├── confirmloggedin.php ├── db ├── access.php ├── hooks.php ├── install.php ├── install.xml ├── log.php ├── services.php ├── tasks.php └── upgrade.php ├── deletecomment.php ├── deletelink.php ├── deletepost.php ├── deletepost_form.php ├── editcomment.php ├── editinstance.php ├── editlink.php ├── editpost.php ├── export.php ├── externallib.php ├── feed.php ├── import.php ├── index.php ├── internaldoc ├── participation.txt ├── testcase.access.txt ├── testcase.basic.txt ├── testcase.delete.txt ├── testcase.importpages.txt ├── testcase.oualertreport.txt ├── testcase.participation.txt ├── testcase.rating.txt ├── testcase.readonlytime.txt ├── testcase.socialmedia.txt └── testcase.usagestats.txt ├── lang ├── README.txt ├── ca │ ├── help │ │ └── oublog │ │ │ ├── allowcomments.html │ │ │ ├── completion.html │ │ │ ├── feed.html │ │ │ ├── tags.html │ │ │ └── visibility.html │ └── oublog.php ├── de │ ├── help │ │ └── oublog │ │ │ ├── allowcomments.html │ │ │ ├── completion.html │ │ │ ├── feeds.html │ │ │ ├── tags.html │ │ │ └── visibility.html │ └── oublog.php ├── en │ └── oublog.php ├── es │ ├── help │ │ └── oublog │ │ │ ├── allowcomments.html │ │ │ ├── completion.html │ │ │ ├── feed.html │ │ │ ├── tags.html │ │ │ └── visibility.html │ └── oublog.php ├── ja │ ├── help │ │ └── oublog │ │ │ ├── allowcomments.html │ │ │ ├── completion.html │ │ │ ├── feed.html │ │ │ ├── tags.html │ │ │ └── visibility.html │ └── oublog.php └── pt_br │ └── oublog.php ├── lib.php ├── link_form.php ├── locallib.php ├── mod_form.php ├── movelink.php ├── participation.php ├── participation_table.php ├── participationlist.php ├── pix ├── close_button_rgb_30px.svg ├── export_logo.svg ├── monologo.svg └── tick.svg ├── pluginfile.php ├── post_form.php ├── renderer.php ├── restrictcomments.php ├── savegrades.php ├── settings.php ├── stats_update.php ├── styles.css ├── templates └── modal.mustache ├── tests ├── behat │ ├── basic.feature │ ├── behat_mod_oublog.php │ ├── importblog.feature │ ├── lastupdated.feature │ ├── multiple_export.feature │ ├── personalblog.feature │ ├── rate_individuals.feature │ ├── separate_individuals.feature │ ├── sharedblog.feature │ ├── statsupdate.feature │ ├── time.period.feature │ └── totalvisitcount.feature ├── cron_task_test.php ├── externallib_test.php ├── fixtures │ └── pd-frog.jpg ├── generator │ ├── behat_mod_oublog_generator.php │ └── lib.php ├── generator_test.php ├── locallib_test.php ├── oublog_import_getallposts_test.php ├── oublog_import_getbloginfo_test.php ├── oublog_import_getblogs_test.php ├── oublog_import_getposts_test.php ├── oublog_search_test.php ├── oublog_shared.php ├── oublog_test_lib.php ├── participation_test.php ├── privacy_provider_test.php └── tool_datamasking_test.php ├── userparticipation.php ├── version.php ├── view.php ├── viewedit.php └── viewpost.php /.sams: -------------------------------------------------------------------------------- 1 | 2 | OPTIONAL_SAMS 3 | 4 | 5 | OPTIONAL_SAMS 6 | 7 | 8 | OPTIONAL_SAMS 9 | 10 | 11 | OPTIONAL_SAMS 12 | 13 | 14 | OPTIONAL_SAMS 15 | 16 | 17 | OPTIONAL_SAMS 18 | 19 | 20 | DISABLE_SAMS 21 | 22 | 23 | DISABLE_SAMS 24 | 25 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | OU blog 2 | ======= 3 | 4 | Copyright 2012 The Open University 5 | 6 | 7 | This is an alternative blog that you can install into standard Moodle. 8 | 9 | It does not replace the standard blog, and operates alongside it. There 10 | are two modes of use: 11 | 12 | 1) As a course activity. In this case you can use it the same way as any 13 | other module. You can have course-wide blogs (everyone in the course posts 14 | to the same blog), group blogs, or individual blogs; the latter are 15 | useful for assessed activities (where the student is supposed to keep 16 | a journal which only they and their tutor can read). 17 | 18 | 2) As a replacement for standard Moodle personal blogs. In this case it would 19 | be a good idea to turn off the standard Moodle blog system, or it'll be 20 | very confusing. You then need to MANUALLY provide students with a link 21 | to mod/oublog/view.php which will automatically take them to their 22 | personal blog. 23 | 24 | When using for personal blogs, one feature of interest may be moderated public 25 | comments; when you allow comments from people who are not logged in, all such 26 | comments are moderated. 27 | 28 | 29 | Branch: 30 | 31 | This is the development branch including latest, untested code. If you would 32 | like a tested version equivalent to an OU live release, please switch to a 33 | branch that matches your Moodle version (e.g. MOODLE_22_STABLE) using the 34 | above dropdown. 35 | 36 | Support: 37 | 38 | We cannot offer direct support. Please do not contact me directly. If you 39 | need assistance, try the blog forum on moodle.org. (Remember to make clear 40 | that you are using OU blog and not the standard blog.) 41 | 42 | Documentation: 43 | 44 | None. Please feel free to contribute documentation in the relevant area of 45 | the MoodleDocs wiki. 46 | 47 | Bug reports: 48 | 49 | Please report bugs using the GitHub 'Issues' tab (experimental). Before 50 | reporting a bug, please try the latest version to verify that the problem 51 | hasn't already been fixed. In each bug, please remember to give: 52 | 53 | 1. Exact steps to reproduce your problem, starting from creating a new wiki 54 | with default or specified settings. 55 | 2. The ouwiki version you are using (from version.php or Modules admin screen). 56 | 57 | Reliability: 58 | 59 | Please note that this code is tested on OU systems but we rely on the 60 | community for testing on other systems. 61 | 62 | Requires: 63 | 64 | Moodle 2.2+ 65 | Postgres / MySQL 66 | 67 | Install: 68 | 69 | Place the contents of this source tree into your Moodle installation so that 70 | within your Moodle root, this file is mod/oublog/README. Then visit the 71 | Moodle notifications page to install. 72 | 73 | If you want the blogs to be searchable, you also need to install the 74 | local_ousearch plugin. (It is best to do this before using OU blog much, 75 | otherwise it takes ages to install as it builds indexes for everything.) 76 | When you install the ousearch plugin, a search box will automatically appear. 77 | -------------------------------------------------------------------------------- /amd/build/accordion.min.js: -------------------------------------------------------------------------------- 1 | define("mod_oublog/accordion",["exports","core_user/repository"],(function(_exports,_repository){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0; 2 | /* 3 | * Handle expand/collapse of areas within the blog usage block. 4 | * 5 | * @package mod_oublog/accordion 6 | * @copyright 2024 The Open University 7 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 8 | */ 9 | let id=0;_exports.init=(containerClass,defaultOpen)=>{const container=document.querySelector("ul.oublog-accordion-"+containerClass);if(!container)return;container.setAttribute("tabindex",0);let counter=1;const tabs=container.querySelectorAll("li");(!defaultOpen||tabs.length{const generateID=getNextId();tab.dataset.containerClass=containerClass,tab.dataset.number=counter,tab.dataset.state=1;const title=tab.querySelector(".oublog_statsview_title h2");title.style.userSelect="none",title.setAttribute("aria-controls",generateID),title.setAttribute("role","tab"),title.setAttribute("tabindex",0);const content=tab.querySelector(".oublog_statsview_content");content.setAttribute("aria-labeledby",generateID),content.setAttribute("role","tabpanel"),parseInt(defaultOpen)!==counter?closeTab(tab,content):(content.classList.add("oublog-accordion-open"),tab.classList.add("oublog-accordion-open")),title.addEventListener("click",(e=>{e.preventDefault(),toggleAccordion(tab,content)})),title.addEventListener("keydown",(e=>{13===e.keyCode&&(e.preventDefault(),toggleAccordion(tab,content))})),counter++}));const headings=container.querySelectorAll(".oublog_statsview_title h2");headings.forEach((heading=>{heading.addEventListener("focus",(e=>{e.target.parentNode.classList.add("focus")}))})),container.addEventListener("keydown",(e=>{const focusedElement=document.activeElement,index=[...headings].indexOf(focusedElement);38===e.keyCode&&"H2"===focusedElement.nodeName&&(e.preventDefault(),index>0?headings[index-1].focus():headings[headings.length-1].focus()),40===e.keyCode&&"H2"===focusedElement.nodeName&&(e.preventDefault(),index===headings.length-1?headings[0].focus():headings[index+1].focus())}))};const toggleAccordion=(tab,content)=>1===parseInt(tab.dataset.state)?closeTab(tab,content):openTab(tab,content),getNextId=()=>"oublog_accordion_"+id++,closeTab=(tab,content)=>{tab.classList.remove("oublog-accordion-open"),tab.classList.add("oublog-accordion-closed"),content.classList.remove("oublog-accordion-open"),content.classList.add("oublog-accordion-closed"),tab.dataset.state=0},openTab=(tab,content)=>{tab.parentNode.querySelectorAll("li.oublog-accordion-open").forEach((tabRef=>{const content=tabRef.querySelector(".oublog_statsview_content");closeTab(tabRef,content)})),tab.classList.remove("oublog-accordion-closed"),tab.classList.add("oublog-accordion-open"),content.classList.remove("oublog-accordion-closed"),content.classList.add("oublog-accordion-open"),tab.dataset.state=1,document.body.classList.contains("notloggedin")||(0,_repository.setUserPreference)("oublog_accordion_"+tab.dataset.containerClass+"_open",tab.dataset.number)}})); 10 | 11 | //# sourceMappingURL=accordion.min.js.map -------------------------------------------------------------------------------- /amd/build/export.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * JavaScript to manage export feature. 3 | * 4 | * @package mod_oublog 5 | * @copyright 2018 The Open University 6 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 7 | */ 8 | define("mod_oublog/export",["jquery"],(function($){var t;return t={CSS:{SELECTALLPOST:'button[name="oublog-export-select-all"]',SELECTNONE:'button[name="oublog-export-select-none"]',CHECKBOXS:'.oublog-posts-table input[type="checkbox"]',EXPORTSELECTED:'button[name="oublog-export-selected"]',EXPORTTYPE:"#oublog-export-type"},mconfig:null,contentIds:[],init:function(options){t.mconfig=options,null!==sessionStorage.getItem("contentIds")&&!0!==t.mconfig.newsession&&(t.contentIds=JSON.parse(sessionStorage.getItem("contentIds"))),$(t.CSS.SELECTALLPOST).on("click",t.selectAll.bind(t)),$(t.CSS.SELECTNONE).on("click",t.selectNone.bind(t)),$(t.CSS.CHECKBOXS).on("click",t.selectPost.bind(t)),$(t.CSS.EXPORTSELECTED).on("click",t.exportSelected.bind(t)),t.initSelectedPost(),t.initButtonState()},selectAll:function(){$(t.CSS.CHECKBOXS).prop("checked",!0),$(t.CSS.SELECTALLPOST).prop("disabled",!0),$(t.CSS.SELECTALLPOST).blur(),$(t.CSS.SELECTNONE).prop("disabled",!1),$(t.CSS.EXPORTSELECTED).prop("disabled",!1),$(t.CSS.CHECKBOXS).each((function(){$(this).prop("checked")&&t.addPost($(this).val())}))},selectNone:function(){$(t.CSS.CHECKBOXS).prop("checked",!1),$(t.CSS.SELECTALLPOST).prop("disabled",!1),$(t.CSS.SELECTNONE).prop("disabled",!0),$(t.CSS.SELECTNONE).blur(),$(t.CSS.EXPORTSELECTED).prop("disabled",!0),$(t.CSS.CHECKBOXS).each((function(){$(this).prop("checked")||t.removePost($(this).val())}))},selectPost:function(event){1==event.target.checked?t.addPost(event.target.value):t.removePost(event.target.value),t.initButtonState()},initSelectedPost:function(){$(t.CSS.CHECKBOXS).each((function(){-1!==t.contentIds.indexOf($(this).val())&&$(this).prop("checked",!0)}))},exportSelected:function(){if(t.contentIds.length>0){var exportUrl=$(t.CSS.EXPORTSELECTED).data("url"),exportType=$(t.CSS.EXPORTTYPE).val();exportUrl=this.updateQueryStringParameter(exportUrl,"instance",String(exportType)),exportUrl=this.updateQueryStringParameter(exportUrl,"ca_postids",t.contentIds.join("|")),sessionStorage.removeItem("contentIds"),t.contentIds=[],window.location.href=exportUrl}},removePost:function(postId){var index=t.contentIds.indexOf(postId);-1!==index&&(t.contentIds.splice(index,1),sessionStorage.setItem("contentIds",JSON.stringify(t.contentIds)))},addPost:function(postId){-1===t.contentIds.indexOf(postId)&&(t.contentIds.push(postId),sessionStorage.setItem("contentIds",JSON.stringify(t.contentIds)))},initButtonState:function(){var uncheckBoxes=0,boxquantity=0;$(t.CSS.CHECKBOXS).each((function(){0==$(this).prop("checked")&&uncheckBoxes++,boxquantity++})),$(t.CSS.SELECTALLPOST).prop("disabled",0==uncheckBoxes),$(t.CSS.SELECTNONE).prop("disabled",uncheckBoxes==boxquantity),$(t.CSS.EXPORTSELECTED).prop("disabled",0==t.contentIds.length)},updateQueryStringParameter:function(uri,key,value){var re=new RegExp("([?&])"+key+"=.*?(&|$)","i"),separator=-1!==uri.indexOf("?")?"&":"?";return uri.match(re)?uri.replace(re,"$1"+key+"="+value+"$2"):uri+separator+key+"="+value}}})); 9 | 10 | //# sourceMappingURL=export.min.js.map -------------------------------------------------------------------------------- /amd/build/modal.min.js: -------------------------------------------------------------------------------- 1 | define("mod_oublog/modal",["exports","core/modal"],(function(_exports,_modal){var obj;function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_modal=(obj=_modal)&&obj.__esModule?obj:{default:obj};class DeleteModal extends _modal.default{registerEventListeners(){super.registerEventListeners(),this.registerCloseOnDelete(),this.registerCloseOnCancel()}configure(modalConfig){modalConfig.show=!0,modalConfig.removeOnClose=!0,modalConfig.isVerticallyCentered=!0,super.configure(modalConfig)}}return _exports.default=DeleteModal,_defineProperty(DeleteModal,"TYPE","mod_oublog/modal"),_defineProperty(DeleteModal,"TEMPLATE","mod_oublog/modal"),DeleteModal.registerModalType(),_exports.default})); 2 | 3 | //# sourceMappingURL=modal.min.js.map -------------------------------------------------------------------------------- /amd/build/modal.min.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"modal.min.js","sources":["../src/modal.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/**\n * Delete post Modal for OUBlog.\n *\n * @module mod_oublog/modal\n * @copyright 2024 The Open University\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Modal from 'core/modal';\nexport default class DeleteModal extends Modal {\n static TYPE = 'mod_oublog/modal';\n static TEMPLATE = 'mod_oublog/modal';\n\n registerEventListeners() {\n // Call the parent registration.\n super.registerEventListeners();\n\n // Register to close on save/cancel.\n this.registerCloseOnDelete();\n this.registerCloseOnCancel();\n }\n\n configure(modalConfig) {\n modalConfig.show = true;\n modalConfig.removeOnClose = true;\n modalConfig.isVerticallyCentered = true;\n\n super.configure(modalConfig);\n }\n}\n\nDeleteModal.registerModalType();\n"],"names":["DeleteModal","Modal","registerEventListeners","registerCloseOnDelete","registerCloseOnCancel","configure","modalConfig","show","removeOnClose","isVerticallyCentered","registerModalType"],"mappings":"sYAwBqBA,oBAAoBC,eAIrCC,+BAEUA,8BAGDC,6BACAC,wBAGTC,UAAUC,aACNA,YAAYC,MAAO,EACnBD,YAAYE,eAAgB,EAC5BF,YAAYG,sBAAuB,QAE7BJ,UAAUC,kEAlBHN,mBACH,oCADGA,uBAEC,oBAoBtBA,YAAYU"} -------------------------------------------------------------------------------- /amd/build/savecheck.min.js: -------------------------------------------------------------------------------- 1 | define("mod_oublog/savecheck",["exports","core/str","core/notification","core/config","core/pending","core_form/changechecker"],(function(_exports,_str,_notification,_config,_pending,FormChangeChecker){function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap,t=new WeakMap;return(_getRequireWildcardCache=function(e){return e?t:r})(e)}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}} 2 | /** 3 | * JS for save check on mod_oublog plugin. 4 | * 5 | * @module mod_oublog/savecheck 6 | * @copyright 2024 The Open University 7 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 8 | */Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0,_notification=_interopRequireDefault(_notification),_config=_interopRequireDefault(_config),_pending=_interopRequireDefault(_pending),FormChangeChecker=function(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache(r);if(t&&t.has(e))return t.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&{}.hasOwnProperty.call(e,u)){var i=a?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=e[u]}return n.default=e,t&&t.set(e,n),n}(FormChangeChecker);class SaveCheck{constructor(contextId){this.contextId=contextId,this.init()}init=()=>{const btns=document.querySelectorAll("#id_submitbutton");btns.forEach((btn=>{btn.addEventListener("click",(e=>{this.handleButtonClick(e,btns)}))}))};handleButtonClick=(e,btns)=>{e.preventDefault();const pendingPromise=new _pending.default("mod/oublog:savecheck");this.sendCheckRequest((response=>{this.checkSave(response,e,btns),pendingPromise.resolve()}),(error=>{this.checkFailure(error,btns),pendingPromise.resolve()}))};saveFail=async(stringName,info,btns)=>{let content=await(0,_str.getString)("savefailtext","oublog",await(0,_str.getString)(stringName,"oublog"));info&&(content+=`[${info}]`),btns.forEach((btn=>{btn.disabled=!0})),_notification.default.alert(await(0,_str.getString)("savefailtitle","oublog"),content);const cancel=document.querySelector("#id_cancel");cancel&&cancel.addEventListener("click",(()=>{const form=document.querySelector("#region-main .mform");if(form){const text=form.querySelector("#fitem_id_message"),attach=form.querySelector("#fitem_id_attachments");text&&text.remove(),attach&&attach.remove(),form.method="get"}}))};checkSave=(response,e,btns)=>{if(-1===response.responseText.search("ok"))this.saveFail("savefailsession",response.responseText,btns);else{const form=e.target.closest("form");form&&(FormChangeChecker.disableAllChecks(),form.requestSubmit(e.target))}};checkFailure=(error,btns)=>{this.saveFail("savefailnetwork",error.statusText,btns)};sendCheckRequest=(onSuccess,onFailure)=>{const xhr=new XMLHttpRequest,params=`sesskey=${_config.default.sesskey}&contextid=${this.contextId}`;xhr.open("POST","confirmloggedin.php",!0),xhr.timeout=3e4,xhr.onreadystatechange=()=>{xhr.readyState===XMLHttpRequest.DONE&&(200===xhr.status?onSuccess(xhr):onFailure(xhr))},xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),xhr.send(params)}}_exports.init=contextId=>new SaveCheck(contextId)})); 9 | 10 | //# sourceMappingURL=savecheck.min.js.map -------------------------------------------------------------------------------- /amd/build/statsupdate.min.js: -------------------------------------------------------------------------------- 1 | define("mod_oublog/statsupdate",["exports","core/pending","core_form/changechecker"],(function(_exports,_pending,FormChangeChecker){var e; 2 | /** 3 | * Moodle renderer used to display special elements of the blog 4 | * 5 | * @module mod_oublog/statusupdate 6 | * @copyright 2024 The Open University 7 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 8 | **/function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap,t=new WeakMap;return(_getRequireWildcardCache=function(e){return e?t:r})(e)}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0,_pending=(e=_pending)&&e.__esModule?e:{default:e},FormChangeChecker=function(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache(r);if(t&&t.has(e))return t.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&{}.hasOwnProperty.call(e,u)){var i=a?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=e[u]}return n.default=e,t&&t.set(e,n),n}(FormChangeChecker);_exports.init=container_class=>{let content=document.querySelector(".oublog_statsview_content_"+container_class);if(content){const form=content.querySelector("form.mform");form.addEventListener("submit",(event=>{event.preventDefault();const pendingPromiseAjax=new _pending.default("mod_oublog/statsupdate");let div=document.createElement("div");div.classList.add("ajaxworking");let pos=event.target.querySelector("div.row.fitem:last-child div:last-child");pos&&pos.appendChild(div);const id=form.querySelector("input[name=id]"),currentcmid=form.querySelector("input[name=currentcmid]");let args={type:form.querySelector("input[name=type]").value,id:0,currentcmid:0};id&&(args.id=id.value),currentcmid&&(args.currentcmid=currentcmid.value);const formData=new FormData(form);fetch("stats_update.php",{method:"POST",body:formData}).then((response=>response.json())).then((response=>{statsupdate_killspinner(!1);try{if(response.containerclass&&!content.classList.contains(response.containerclass)&&(content=document.querySelector("."+response.containerclass)),response.subtitle&&response.subtitleclass){const subtitle=content.querySelector("."+response.subtitleclass);subtitle&&(subtitle.innerHTML=response.subtitle)}if(response.info&&response.infoclass){const info=content.querySelector("."+response.infoclass);info&&(info.innerHTML=response.info)}if((response.content||""===response.content)&&response.contentclass){const innercontent=content.querySelector("."+response.contentclass);innercontent&&(innercontent.innerHTML=response.content)}}catch(e){return statsupdate_killspinner(!0),console.log(e),void pendingPromiseAjax.resolve()}pendingPromiseAjax.resolve()})).catch((()=>{statsupdate_killspinner(!0),pendingPromiseAjax.resolve()}));const statsupdate_killspinner=submit=>{const spinner=form.querySelector(".ajaxworking");spinner&&spinner.remove(!0),submit&&(FormChangeChecker.disableAllChecks(),form.submit())}}))}}})); 9 | 10 | //# sourceMappingURL=statsupdate.min.js.map -------------------------------------------------------------------------------- /amd/src/modal.js: -------------------------------------------------------------------------------- 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 . 15 | 16 | /** 17 | * Delete post Modal for OUBlog. 18 | * 19 | * @module mod_oublog/modal 20 | * @copyright 2024 The Open University 21 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 22 | */ 23 | 24 | import Modal from 'core/modal'; 25 | export default class DeleteModal extends Modal { 26 | static TYPE = 'mod_oublog/modal'; 27 | static TEMPLATE = 'mod_oublog/modal'; 28 | 29 | registerEventListeners() { 30 | // Call the parent registration. 31 | super.registerEventListeners(); 32 | 33 | // Register to close on save/cancel. 34 | this.registerCloseOnDelete(); 35 | this.registerCloseOnCancel(); 36 | } 37 | 38 | configure(modalConfig) { 39 | modalConfig.show = true; 40 | modalConfig.removeOnClose = true; 41 | modalConfig.isVerticallyCentered = true; 42 | 43 | super.configure(modalConfig); 44 | } 45 | } 46 | 47 | DeleteModal.registerModalType(); 48 | -------------------------------------------------------------------------------- /approve.php: -------------------------------------------------------------------------------- 1 | . 16 | // Script used to approve moderated comments. This can be called in two ways; 17 | // from email (which is a GET request) and from the web (which is POST). 18 | require_once('../../config.php'); 19 | require_once('locallib.php'); 20 | 21 | // Shared parameter 22 | $mcommentid = required_param('mcomment', PARAM_INT); 23 | 24 | // Parameters for each type 25 | if ($_SERVER['REQUEST_METHOD'] == 'GET') { 26 | $email = true; 27 | // Check request parameters from email 28 | $key = required_param('key', PARAM_ALPHANUM); 29 | $approve = required_param('approve', PARAM_INT) ? true : false; 30 | } else { 31 | $email = false; 32 | // Check request parameters from web 33 | require_sesskey(); 34 | if (optional_param('bapprove', false, PARAM_TEXT)) { 35 | $approve = true; 36 | } else { 37 | required_param('breject', PARAM_TEXT); // Sanity check 38 | $approve = false; 39 | } 40 | $redirectlower = optional_param('last', 0, PARAM_INT) ? false : true; 41 | } 42 | 43 | // Load comment and check it 44 | if (!($mcomment = $DB->get_record('oublog_comments_moderated', array('id'=> $mcommentid)))) { 45 | throw new moodle_exception('invalidrequest', 'error'); 46 | } 47 | 48 | // Use post page for continue on error messages 49 | $backlink = $CFG->wwwroot . '/mod/oublog/viewpost.php?post=' . 50 | $mcomment->postid; 51 | 52 | // Load post, blog, etc 53 | if (!$post = oublog_get_post($mcomment->postid, false)) { 54 | throw new moodle_exception('error_unspecified', 'oublog', $backlink, 'A1'); 55 | } 56 | if (!($oublog = oublog_get_blog_from_postid($post->id))) { 57 | throw new moodle_exception('error_unspecified', 'oublog', $backlink, 'A2'); 58 | } 59 | if (!$cm = get_coursemodule_from_instance('oublog', $oublog->id)) { 60 | throw new moodle_exception('invalidcoursemodule', 'error', $backlink); 61 | } 62 | if (!$course = $DB->get_record("course", array("id"=>$cm->course))) { 63 | throw new moodle_exception('coursemisconf', 'error', $backlink); 64 | } 65 | 66 | // Check state 67 | if ($mcomment->approval) { 68 | throw new moodle_exception('error_alreadyapproved', 'oublog', $backlink); 69 | } 70 | if ($email && $key !== $mcomment->secretkey) { 71 | throw new moodle_exception('error_wrongkey', 'oublog', $backlink); 72 | } 73 | 74 | // Require login, it to be your own post, and commenting permission 75 | require_login($course, $cm); 76 | $context = context_module::instance($cm->id); 77 | oublog_check_view_permissions($oublog, $context, $cm); 78 | if ($USER->id !== $post->userid || 79 | !oublog_can_view_post($post, $USER, $context, $cm, $oublog) || 80 | !oublog_can_comment($cm, $oublog, $post)) { 81 | throw new moodle_exception('accessdenied', 'oublog', $backlink); 82 | } 83 | 84 | // The post must (still) allow public comments 85 | if ($post->allowcomments < OUBLOG_COMMENTS_ALLOWPUBLIC || 86 | $oublog->allowcomments < OUBLOG_COMMENTS_ALLOWPUBLIC) { 87 | throw new moodle_exception('error_moderatednotallowed', 'oublog', $backlink); 88 | } 89 | 90 | // OK they are actually allowed to approve / reject this 91 | if (!$approvedcomment = oublog_approve_comment($mcomment, $approve)) { 92 | throw new moodle_exception('error_unspecified', 'oublog', 'A5', $backlink); 93 | } 94 | 95 | // Redirect back to view post 96 | $target = 'viewpost.php?post=' . $post->id; 97 | if (!$email && $redirectlower) { 98 | $target .= '#awaiting'; 99 | } 100 | 101 | if ($approvedcomment > 0 ) { 102 | // Log approved comment event. 103 | $params = array( 104 | 'context' => $context, 105 | 'objectid' => $approvedcomment, 106 | 'other' => array( 107 | 'postid' => $mcomment->postid, 108 | 'mcommentid' => $mcommentid, 109 | 'oublogid' => $oublog->id 110 | ) 111 | ); 112 | $event = \mod_oublog\event\comment_approved::create($params); 113 | $event->trigger(); 114 | } 115 | redirect($target); 116 | -------------------------------------------------------------------------------- /backup/moodle2/backup_oublog_activity_task.class.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * @package moodlecore 19 | * @subpackage backup-moodle2 20 | * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} 21 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 22 | */ 23 | 24 | require_once($CFG->dirroot . '/mod/oublog/backup/moodle2/backup_oublog_stepslib.php'); // Because it exists (must) 25 | require_once($CFG->dirroot . '/mod/oublog/backup/moodle2/backup_oublog_settingslib.php'); // Because it exists (optional) 26 | 27 | /** 28 | * oublog backup task that provides all the settings and steps to perform one 29 | * complete backup of the activity 30 | */ 31 | class backup_oublog_activity_task extends backup_activity_task { 32 | 33 | /** 34 | * Define (add) particular settings this activity can have 35 | */ 36 | protected function define_my_settings() { 37 | // No particular settings for this activity 38 | } 39 | 40 | /** 41 | * Define (add) particular steps this activity can have 42 | */ 43 | protected function define_my_steps() { 44 | $this->add_step(new backup_oublog_activity_structure_step('oublog structure', 'oublog.xml')); 45 | } 46 | 47 | /** 48 | * Code the transformations to perform in the activity in 49 | * order to get transportable (encoded) links 50 | */ 51 | static public function encode_content_links($content) { 52 | global $CFG; 53 | 54 | $base = preg_quote($CFG->wwwroot, "/"); 55 | 56 | // Link to the list of oublog 57 | $search="/(".$base."\/mod\/oublog\/index.php\?id\=)([0-9]+)/"; 58 | $content= preg_replace($search, '$@OUBLOGINDEX*$2@$', $content); 59 | 60 | // Link to oublog view by moduleid 61 | $search="/(".$base."\/mod\/oublog\/view.php\?id\=)([0-9]+)/"; 62 | $content= preg_replace($search, '$@OUBLOGVIEW*$2@$', $content); 63 | 64 | $search = "/(".$base."\/mod\/oublog\/view.php\?user\=)([0-9]+)/"; 65 | $content = preg_replace($search, '$@OUBLOGVIEWUSER*$2@$', $content); 66 | 67 | $search = "/(".$base."\/mod\/oublog\/viewpost.php\?post\=)([0-9]+)/"; 68 | $content = preg_replace($search, '$@OUBLOGVIEWPOST*$2@$', $content); 69 | 70 | return $content; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /backup/moodle2/backup_oublog_settingslib.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * @package moodlecore 19 | * @subpackage backup-moodle2 20 | * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} 21 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 22 | */ 23 | 24 | // This activity has not particular settings but the inherited from the generic 25 | // backup_activity_task so here there isn't any class definition, like the ones 26 | // existing in /backup/moodle2/backup_settingslib.php (activities section) 27 | -------------------------------------------------------------------------------- /bloglogin.php: -------------------------------------------------------------------------------- 1 | . 16 | require_once('../../config.php'); 17 | global $CFG; 18 | // This script requires login so users have a chance to log into (a) blogs 19 | // that don't let you see anything without a login, (b) blogs that might let 20 | // you see more with a login 21 | 22 | $returnurl = optional_param('returnurl', $CFG->wwwroot . '/mod/oublog/view.php', PARAM_RAW); 23 | // Security check on URL, allow redirect to only php scripts in blog folder 24 | if (!strpos($returnurl, $CFG->wwwroot . '/mod/oublog/') === 0) { 25 | $returnurl=''; 26 | } 27 | 28 | if ($CFG->autologinguests) { 29 | $SESSION->wantsurl = $returnurl; 30 | redirect($CFG->wwwroot.'/login/'); 31 | } else { 32 | require_login(); 33 | 34 | // Default returns to blog default view (which will automatically jump to user 35 | // now they are logged in) 36 | redirect($returnurl); 37 | } 38 | -------------------------------------------------------------------------------- /classes/completion/custom_completion.php: -------------------------------------------------------------------------------- 1 | . 16 | declare(strict_types=1); 17 | 18 | namespace mod_oublog\completion; 19 | 20 | require_once($CFG->dirroot . '/mod/oublog/lib.php'); 21 | use core_completion\activity_custom_completion; 22 | 23 | /** 24 | * Activity custom completion subclass for the data activity. 25 | * 26 | * Class for defining mod_oucontent's custom completion rules and fetching the completion statuses 27 | * of the custom completion rules for a given data instance and a user. 28 | * 29 | * @package mod_oublog 30 | * @copyright 2022 The Open University 31 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 32 | */ 33 | class custom_completion extends activity_custom_completion { 34 | /** 35 | * @param string $rule 36 | * @return int 37 | * @throws \coding_exception 38 | */ 39 | public function get_state(string $rule): int { 40 | $this->validate_rule($rule); 41 | $userid = $this->userid; 42 | $cm = $this->cm; 43 | $status = oublog_get_completion_state_lib($this->cm, $userid, $rule); 44 | return $status ? COMPLETION_COMPLETE : COMPLETION_INCOMPLETE; 45 | } 46 | /** 47 | * Fetch the list of custom completion rules that this module defines. 48 | * 49 | * @return array 50 | */ 51 | public static function get_defined_custom_rules(): array { 52 | return [ 53 | 'completionposts', 54 | 'completioncomments' 55 | ]; 56 | } 57 | 58 | /** 59 | * Returns an associative array of the descriptions of custom completion rules. 60 | * 61 | * @return array 62 | */ 63 | public function get_custom_rule_descriptions(): array { 64 | global $DB; 65 | $completionposts = $this->cm->customdata->customcompletionrules['completionposts'] ?? 0; 66 | $completioncomments = $this->cm->customdata->customcompletionrules['completioncomments'] ?? 0; 67 | 68 | // Get oublog details 69 | if (!($oublog = $DB->get_record('oublog', array('id' => $this->cm->instance)))) { 70 | throw new \moodle_exception("Can't find oublog {$this->cm->instance}"); 71 | } 72 | 73 | $a = (object) [ 74 | 'number' => $completionposts, 75 | 'name' => oublog_get_displayname($oublog) 76 | ]; 77 | 78 | return [ 79 | 'completionposts' => get_string('completiondetail:posts', 'oublog', $a), 80 | 'completioncomments' => get_string('completiondetail:comments', 'oublog', $completioncomments), 81 | ]; 82 | } 83 | 84 | /** 85 | * Returns an array of all completion rules, in the order they should be displayed to users. 86 | * 87 | * @return array 88 | */ 89 | public function get_sort_order(): array { 90 | return [ 91 | 'completionview', 92 | 'completionposts', 93 | 'completioncomments', 94 | 'completionusegrade' 95 | ]; 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /classes/event/comment_approved.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * The mod_oublog comment approved event. 19 | * 20 | * @package mod_oublog 21 | * @copyright 2014 The Open University 22 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 | */ 24 | 25 | namespace mod_oublog\event; 26 | 27 | defined('MOODLE_INTERNAL') || die(); 28 | 29 | /** 30 | * The mod_oublog comment approved event class. 31 | * 32 | * @property-read array $other { 33 | * Extra information about the event. 34 | * 35 | * - int blogid: The oublog the post is part of. 36 | * 37 | * } 38 | * 39 | * @package mod_oublog 40 | * @since Moodle 2.7 41 | * @copyright 2014 The Open University 42 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 43 | */ 44 | class comment_approved extends \core\event\base { 45 | 46 | /** 47 | * Init method. 48 | * 49 | * @return void 50 | */ 51 | protected function init() { 52 | $this->data['crud'] = 'u'; 53 | $this->data['edulevel'] = self::LEVEL_PARTICIPATING; 54 | $this->data['objecttable'] = 'oublog_comments'; 55 | } 56 | 57 | /** 58 | * Returns description of what happened. 59 | * 60 | * @return string 61 | */ 62 | public function get_description() { 63 | return "The user with id '$this->userid' has approved the moderated comment 64 | '{$this->other['mcommentid']}' upon post with id '{$this->other['postid']}' 65 | to be added with id '$this->objectid' to the oublog with the course module id 66 | '$this->contextinstanceid'."; 67 | } 68 | 69 | /** 70 | * Return localised event name. 71 | * 72 | * @return string 73 | */ 74 | public static function get_name() { 75 | return get_string('event:commentapproved', 'mod_oublog'); 76 | } 77 | 78 | /** 79 | * Get URL related to the action 80 | * 81 | * @return \moodle_url 82 | */ 83 | public function get_url() { 84 | $url = new \moodle_url('/mod/oublog/viewpost.php', array('post' => $this->other['postid'])); 85 | $url->set_anchor('cid' . $this->objectid); 86 | return $url; 87 | } 88 | 89 | /** 90 | * Custom validation. 91 | * 92 | * @throws \coding_exception 93 | * @return void 94 | */ 95 | protected function validate_data() { 96 | parent::validate_data(); 97 | 98 | if (!isset($this->objectid)) { 99 | throw new \coding_exception('The \'commentid\' value must be set in the object.'); 100 | } 101 | 102 | if (!isset($this->other['postid'])) { 103 | throw new \coding_exception('The \'postid\' value must be set in other.'); 104 | } 105 | 106 | if (!isset($this->other['mcommentid'])) { 107 | throw new \coding_exception('The \'mcommentid\' value must be set in other.'); 108 | } 109 | 110 | if (!isset($this->other['oublogid'])) { 111 | throw new \coding_exception('The \'oublogid\' value must be set in other.'); 112 | } 113 | 114 | if ($this->contextlevel != CONTEXT_MODULE) { 115 | throw new \coding_exception('Context level must be CONTEXT_MODULE.'); 116 | } 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /classes/event/comment_created.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * The mod_oublog comment created event. 19 | * 20 | * @package mod_oublog 21 | * @copyright 2014 The Open University 22 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 | */ 24 | 25 | namespace mod_oublog\event; 26 | 27 | defined('MOODLE_INTERNAL') || die(); 28 | 29 | /** 30 | * The mod_oublog comment created event class. 31 | * 32 | * @property-read array $other { 33 | * Extra information about the event. 34 | * 35 | * - int oublogid: The oublog which the post is part of. 36 | * - int postid: The post which this comment is part of. 37 | * } 38 | * 39 | * @package mod_oublog 40 | * @since Moodle 2.7 41 | * @copyright 2014 The Open University 42 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 43 | */ 44 | class comment_created extends \core\event\base { 45 | /** 46 | * Init method. 47 | * 48 | * @return void 49 | */ 50 | protected function init() { 51 | $this->data['crud'] = 'c'; 52 | $this->data['edulevel'] = self::LEVEL_PARTICIPATING; 53 | $this->data['objecttable'] = 'oublog_comments'; 54 | } 55 | 56 | /** 57 | * Returns description of what happened. 58 | * 59 | * @return string 60 | */ 61 | public function get_description() { 62 | return "The user with id '$this->userid' has created the comment with id 63 | '$this->objectid' on the post with id '{$this->other['postid']}' 64 | in the oublog with the course module id '$this->contextinstanceid'."; 65 | } 66 | 67 | /** 68 | * Return localised event name. 69 | * 70 | * @return string 71 | */ 72 | public static function get_name() { 73 | return get_string('event:commentcreated', 'mod_oublog'); 74 | } 75 | 76 | /** 77 | * Get URL related to the action 78 | * 79 | * @return \moodle_url 80 | */ 81 | public function get_url() { 82 | $url = new \moodle_url('/mod/oublog/viewpost.php', array('post' => $this->other['postid'])); 83 | $url->set_anchor('cid' . $this->objectid); 84 | return $url; 85 | } 86 | 87 | /** 88 | * Custom validation. 89 | * 90 | * @throws \coding_exception 91 | * @return void 92 | */ 93 | protected function validate_data() { 94 | parent::validate_data(); 95 | 96 | if (!isset($this->other['oublogid'])) { 97 | throw new \coding_exception('The \'oublogid\' value must be set in other.'); 98 | } 99 | 100 | if (!isset($this->other['postid'])) { 101 | throw new \coding_exception('The \'postid\' value must be set in other.'); 102 | } 103 | 104 | if (!isset($this->objectid)) { 105 | throw new \coding_exception('The \'commentid\' value must be set.'); 106 | } 107 | 108 | if ($this->contextlevel != CONTEXT_MODULE) { 109 | throw new \coding_exception('Context level must be CONTEXT_MODULE.'); 110 | } 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /classes/event/comment_deleted.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * The mod_oublog comment deleted event. 19 | * 20 | * @package mod_oublog 21 | * @copyright 2014 The Open University 22 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 | */ 24 | 25 | namespace mod_oublog\event; 26 | 27 | defined('MOODLE_INTERNAL') || die(); 28 | 29 | /** 30 | * The mod_oublog comment deleted event class. 31 | * 32 | * @property-read array $other { 33 | * Extra information about the event. 34 | * 35 | * - int oublogid: The oublog which the post is part of. 36 | * - int postid: The post which this comment is part of. 37 | * } 38 | * 39 | * @package mod_oublog 40 | * @since Moodle 2.7 41 | * @copyright 2014 The Open University 42 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 43 | */ 44 | class comment_deleted extends \core\event\base { 45 | 46 | /** 47 | * Init method. 48 | * 49 | * @return void 50 | */ 51 | protected function init() { 52 | $this->data['crud'] = 'd'; 53 | $this->data['edulevel'] = self::LEVEL_OTHER; 54 | $this->data['objecttable'] = 'oublog_comments'; 55 | } 56 | 57 | /** 58 | * Returns description of what happened. 59 | * 60 | * @return string 61 | */ 62 | public function get_description() { 63 | return "The user with id '$this->userid' has deleted the comment with id 64 | '$this->objectid' on the post with id '{$this->other['postid']}' 65 | in the oublog with the course module id '$this->contextinstanceid'."; 66 | } 67 | 68 | /** 69 | * Return localised event name. 70 | * 71 | * @return string 72 | */ 73 | public static function get_name() { 74 | return get_string('event:commentdeleted', 'mod_oublog'); 75 | } 76 | 77 | /** 78 | * Get URL related to the action 79 | * 80 | * @return \moodle_url 81 | */ 82 | public function get_url() { 83 | $url = new \moodle_url('/mod/oublog/viewpost.php', array('post' => $this->other['postid'])); 84 | $url->set_anchor('cid' . $this->objectid); 85 | return $url; 86 | } 87 | 88 | /** 89 | * Custom validation. 90 | * 91 | * @throws \coding_exception 92 | * @return void 93 | */ 94 | protected function validate_data() { 95 | parent::validate_data(); 96 | 97 | if (!isset($this->other['oublogid'])) { 98 | throw new \coding_exception('The \'oublogid\' value must be set in other.'); 99 | } 100 | 101 | if (!isset($this->other['postid'])) { 102 | throw new \coding_exception('The \'postid\' value must be set in other.'); 103 | } 104 | 105 | if (!isset($this->objectid)) { 106 | throw new \coding_exception('The \'commentid\' value must be set.'); 107 | } 108 | 109 | if ($this->contextlevel != CONTEXT_MODULE) { 110 | throw new \coding_exception('Context level must be CONTEXT_MODULE.'); 111 | } 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /classes/event/course_module_instance_list_viewed.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * The mod_oublog instance list viewed event. 19 | * 20 | * @package mod_oublog 21 | * @copyright 2014 The Open University 22 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 | */ 24 | 25 | namespace mod_oublog\event; 26 | 27 | defined('MOODLE_INTERNAL') || die(); 28 | 29 | /** 30 | * The mod_oublog instance list viewed event class. 31 | * 32 | * @package mod_oublog 33 | * @since Moodle 2.7 34 | * @copyright 2014 The Open University 35 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 36 | */ 37 | class course_module_instance_list_viewed extends \core\event\course_module_instance_list_viewed { 38 | // No need for any code here as everything is handled by the parent class. 39 | } 40 | -------------------------------------------------------------------------------- /classes/event/course_module_viewed.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * The mod_oublog course module viewed event. 19 | * 20 | * @package mod_oublog 21 | * @copyright 2014 The Open University 22 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 | */ 24 | 25 | namespace mod_oublog\event; 26 | 27 | defined('MOODLE_INTERNAL') || die(); 28 | 29 | /** 30 | * The mod_oublog course module viewed event class. 31 | * 32 | * @package mod_oublog 33 | * @since Moodle 2.7 34 | * @copyright 2014 The Open University 35 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 36 | */ 37 | class course_module_viewed extends \core\event\course_module_viewed { 38 | 39 | /** 40 | * Init method. 41 | * 42 | * @return void 43 | */ 44 | protected function init() { 45 | $this->data['crud'] = 'r'; 46 | $this->data['edulevel'] = self::LEVEL_PARTICIPATING; 47 | $this->data['objecttable'] = 'oublog'; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /classes/event/participation_viewed.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * The mod_oublog course module viewed event. 19 | * 20 | * @package mod_oublog 21 | * @copyright 2014 The Open University 22 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 | */ 24 | 25 | namespace mod_oublog\event; 26 | 27 | defined('MOODLE_INTERNAL') || die(); 28 | 29 | /** 30 | * The mod_oublog course module viewed event class. 31 | * 32 | * @package mod_oublog 33 | * @since Moodle 2.7 34 | * @copyright 2014 OU 35 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 36 | */ 37 | class participation_viewed extends \core\event\course_module_viewed { 38 | 39 | /** 40 | * Init method. 41 | * 42 | * @return void 43 | */ 44 | protected function init() { 45 | $this->data['crud'] = 'r'; 46 | $this->data['edulevel'] = self::LEVEL_PARTICIPATING; 47 | $this->data['objecttable'] = 'oublog'; 48 | } 49 | 50 | /** 51 | * Returns description of what happened. 52 | * 53 | * @return string 54 | */ 55 | public function get_description() { 56 | return "The user with id '$this->userid' viewed '{$this->other['info']}' " . 57 | "on the blog with the course module id '$this->contextinstanceid'."; 58 | } 59 | 60 | /** 61 | * Return localised event name. 62 | * 63 | * @return string 64 | */ 65 | public static function get_name() { 66 | return get_string('event:participationviewed', 'mod_oublog'); 67 | } 68 | 69 | /** 70 | * Get URL related to the action 71 | * 72 | * @return \moodle_url 73 | */ 74 | public function get_url() { 75 | return new \moodle_url('\\mod\\oublog\\' . $this->other['logurl']); 76 | } 77 | 78 | /** 79 | * Custom validation. 80 | * 81 | * @throws \coding_exception 82 | * @return void 83 | */ 84 | protected function validate_data() { 85 | parent::validate_data(); 86 | 87 | if (!isset($this->objectid)) { 88 | throw new \coding_exception('The \'cmid\' value must be set.'); 89 | } 90 | 91 | if (!isset($this->other['info'])) { 92 | throw new \coding_exception('The \'info\' value must be set in other.'); 93 | } 94 | 95 | if (!isset($this->other['logurl'])) { 96 | throw new \coding_exception('The \'logurl\' value must be set in other.'); 97 | } 98 | 99 | if ($this->contextlevel != CONTEXT_MODULE) { 100 | throw new \coding_exception('Context level must be CONTEXT_MODULE.'); 101 | } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /classes/event/post_created.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * The mod_oublog post created event. 19 | * 20 | * @package mod_oublog 21 | * @copyright 2014 The Open University 22 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 | */ 24 | 25 | namespace mod_oublog\event; 26 | 27 | defined('MOODLE_INTERNAL') || die(); 28 | 29 | /** 30 | * The mod_oublog post created event class. 31 | * 32 | * @property-read array $other { 33 | * Extra information about the event. 34 | * 35 | * - int oublogid: The oublog which the post is part of. 36 | * } 37 | * 38 | * @package mod_oublog 39 | * @since Moodle 2.7 40 | * @copyright 2014 The Open University 41 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 42 | */ 43 | class post_created extends \core\event\base { 44 | /** 45 | * Init method. 46 | * 47 | * @return void 48 | */ 49 | protected function init() { 50 | $this->data['crud'] = 'c'; 51 | $this->data['edulevel'] = self::LEVEL_PARTICIPATING; 52 | $this->data['objecttable'] = 'oublog_posts'; 53 | } 54 | 55 | /** 56 | * Returns description of what happened. 57 | * 58 | * @return string 59 | */ 60 | public function get_description() { 61 | return "The user with id '$this->userid' added a new post '$this->objectid' " . 62 | "on the oublog with the course module id '$this->contextinstanceid'."; 63 | } 64 | 65 | /** 66 | * Return localised event name. 67 | * 68 | * @return string 69 | */ 70 | public static function get_name() { 71 | return get_string('event:postcreated', 'mod_oublog'); 72 | } 73 | 74 | /** 75 | * Get URL related to the action 76 | * 77 | * @return \moodle_url 78 | */ 79 | public function get_url() { 80 | $url = new \moodle_url('/mod/oublog/viewpost.php', array('post' => $this->objectid)); 81 | return $url; 82 | } 83 | 84 | /** 85 | * Custom validation. 86 | * 87 | * @throws \coding_exception 88 | * @return void 89 | */ 90 | protected function validate_data() { 91 | parent::validate_data(); 92 | 93 | if (!isset($this->other['oublogid'])) { 94 | throw new \coding_exception('The \'oublogid\' value must be set in other.'); 95 | } 96 | 97 | if (!isset($this->objectid)) { 98 | throw new \coding_exception('The \'postid\' value must be set.'); 99 | } 100 | 101 | if ($this->contextlevel != CONTEXT_MODULE) { 102 | throw new \coding_exception('Context level must be CONTEXT_MODULE.'); 103 | } 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /classes/event/post_deleted.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * The mod_oublog post deleted event. 19 | * 20 | * @package mod_oublog 21 | * @copyright 2014 The Open University 22 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 | */ 24 | 25 | namespace mod_oublog\event; 26 | 27 | defined('MOODLE_INTERNAL') || die(); 28 | 29 | /** 30 | * The mod_oublog post deleted event class. 31 | * 32 | * @property-read array $other { 33 | * Extra information about the event. 34 | * 35 | * - int oublogid: The oublog id the post is part of. 36 | * 37 | * } 38 | * 39 | * @package mod_oublog 40 | * @since Moodle 2.7 41 | * @copyright 2014 The Open University 42 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 43 | */ 44 | class post_deleted extends \core\event\base { 45 | 46 | /** 47 | * Init method. 48 | * 49 | * @return void 50 | */ 51 | protected function init() { 52 | $this->data['crud'] = 'd'; 53 | $this->data['edulevel'] = self::LEVEL_OTHER; 54 | $this->data['objecttable'] = 'oublog_posts'; 55 | } 56 | 57 | /** 58 | * Returns description of what happened. 59 | * 60 | * @return string 61 | */ 62 | public function get_description() { 63 | return "The user with id '$this->userid' has deleted the post with id 64 | '$this->objectid' on the oublog with the course module id '$this->contextinstanceid'."; 65 | } 66 | 67 | /** 68 | * Return localised event name. 69 | * 70 | * @return string 71 | */ 72 | public static function get_name() { 73 | return get_string('event:postdeleted', 'mod_oublog'); 74 | } 75 | 76 | /** 77 | * Get URL related to the action 78 | * 79 | * @return \moodle_url 80 | */ 81 | public function get_url() { 82 | $url = new \moodle_url('/mod/oublog/viewpost.php', array('post' => $this->objectid)); 83 | return $url; 84 | } 85 | 86 | /** 87 | * Custom validation. 88 | * 89 | * @throws \coding_exception 90 | * @return void 91 | */ 92 | protected function validate_data() { 93 | parent::validate_data(); 94 | 95 | if (!isset($this->other['oublogid'])) { 96 | throw new \coding_exception('The \'oublogid\' value must be set in other.'); 97 | } 98 | 99 | if (!isset($this->objectid)) { 100 | throw new \coding_exception('The \'postid\' value must be set.'); 101 | } 102 | 103 | if ($this->contextlevel != CONTEXT_MODULE) { 104 | throw new \coding_exception('Context level must be CONTEXT_MODULE.'); 105 | } 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /classes/event/post_imported.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * The mod_oublog import post event. 19 | * 20 | * @package mod_oublog 21 | * @copyright 2014 The Open University 22 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 | */ 24 | 25 | namespace mod_oublog\event; 26 | 27 | defined('MOODLE_INTERNAL') || die(); 28 | 29 | /** 30 | * The mod_oublog import post event class. 31 | * 32 | * @package mod_oublog 33 | * @since Moodle 2.7 34 | * @copyright 2014 The Open University 35 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 36 | */ 37 | class post_imported extends \core\event\base { 38 | 39 | /** 40 | * Init method. 41 | * 42 | * @return void 43 | */ 44 | protected function init() { 45 | $this->data['crud'] = 'c'; 46 | $this->data['edulevel'] = self::LEVEL_PARTICIPATING; 47 | $this->data['objecttable'] = 'oublog'; 48 | } 49 | 50 | /** 51 | * Returns description of what happened. 52 | * 53 | * @return string 54 | */ 55 | public function get_description() { 56 | return "The user with id '$this->userid' imported '{$this->other['info']}' posts 57 | to the oublog with the course module id '$this->contextinstanceid'"; 58 | } 59 | 60 | /** 61 | * Return localised event name. 62 | * 63 | * @return string 64 | */ 65 | public static function get_name() { 66 | return get_string('event:postimported', 'mod_oublog'); 67 | } 68 | 69 | /** 70 | * Get URL related to the action 71 | * 72 | * @return \moodle_url 73 | */ 74 | public function get_url() { 75 | $url = new \moodle_url('/mod/oublog/view.php', array('id' => $this->contextinstanceid)); 76 | return $url; 77 | } 78 | 79 | /** 80 | * Custom validation. 81 | * 82 | * @throws \coding_exception 83 | * @return void 84 | */ 85 | protected function validate_data() { 86 | parent::validate_data(); 87 | 88 | if (!isset($this->objectid)) { 89 | throw new \coding_exception('The \'objectid\' value must be set in the object.'); 90 | } 91 | 92 | if (!isset($this->other['info'])) { 93 | throw new \coding_exception('The \'info\' value must be set in other.'); 94 | } 95 | 96 | if ($this->contextlevel != CONTEXT_MODULE) { 97 | throw new \coding_exception('Context level must be CONTEXT_MODULE.'); 98 | } 99 | } 100 | 101 | } 102 | -------------------------------------------------------------------------------- /classes/event/post_updated.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * The mod_oublog post updated event. 19 | * 20 | * @package mod_oublog 21 | * @copyright 2014 The Open University 22 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 | */ 24 | 25 | namespace mod_oublog\event; 26 | 27 | defined('MOODLE_INTERNAL') || die(); 28 | 29 | /** 30 | * The mod_oublog post updated event class. 31 | * 32 | * @property-read array $other { 33 | * Extra information about the event. 34 | * 35 | * - int oublogid: The oublog the post is part of. 36 | * 37 | * } 38 | * 39 | * @package mod_oublog 40 | * @since Moodle 2.7 41 | * @copyright 2014 The Open University 42 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 43 | */ 44 | class post_updated extends \core\event\base { 45 | 46 | /** 47 | * Init method. 48 | * 49 | * @return void 50 | */ 51 | protected function init() { 52 | $this->data['crud'] = 'u'; 53 | $this->data['edulevel'] = self::LEVEL_PARTICIPATING; 54 | $this->data['objecttable'] = 'oublog_posts'; 55 | } 56 | 57 | /** 58 | * Returns description of what happened. 59 | * 60 | * @return string 61 | */ 62 | public function get_description() { 63 | return "The user with id '$this->userid' has updated the post with id 64 | '$this->objectid' on the oublog with the course module id '$this->contextinstanceid'."; 65 | } 66 | 67 | /** 68 | * Return localised event name. 69 | * 70 | * @return string 71 | */ 72 | public static function get_name() { 73 | return get_string('event:postupdated', 'mod_oublog'); 74 | } 75 | 76 | /** 77 | * Get URL related to the action 78 | * 79 | * @return \moodle_url 80 | */ 81 | public function get_url() { 82 | $url = new \moodle_url('/mod/oublog/viewpost.php', array('post' => $this->objectid)); 83 | return $url; 84 | } 85 | 86 | /** 87 | * Custom validation. 88 | * 89 | * @throws \coding_exception 90 | * @return void 91 | */ 92 | protected function validate_data() { 93 | parent::validate_data(); 94 | 95 | if (!isset($this->objectid)) { 96 | throw new \coding_exception('The \'postid\' value must be set in the object.'); 97 | } 98 | 99 | if (!isset($this->other['oublogid'])) { 100 | throw new \coding_exception('The \'oublogid\' value must be set in other.'); 101 | } 102 | 103 | if ($this->contextlevel != CONTEXT_MODULE) { 104 | throw new \coding_exception('Context level must be CONTEXT_MODULE.'); 105 | } 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /classes/event/post_viewed.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * The mod_oublog view post event. 19 | * 20 | * @package mod_oublog 21 | * @copyright 2014 The Open University 22 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 | */ 24 | 25 | namespace mod_oublog\event; 26 | 27 | defined('MOODLE_INTERNAL') || die(); 28 | 29 | /** 30 | * The mod_oublog view post event class. 31 | * 32 | * @package mod_oublog 33 | * @since Moodle 2.7 34 | * @copyright 2014 The Open University 35 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 36 | */ 37 | class post_viewed extends \core\event\base { 38 | 39 | /** 40 | * Init method. 41 | * 42 | * @return void 43 | */ 44 | protected function init() { 45 | $this->data['crud'] = 'r'; 46 | $this->data['edulevel'] = self::LEVEL_PARTICIPATING; 47 | $this->data['objecttable'] = 'oublog_posts'; 48 | } 49 | 50 | /** 51 | * Returns description of what happened. 52 | * 53 | * @return string 54 | */ 55 | public function get_description() { 56 | return "The user with id '$this->userid' viewed post $this->objectid 57 | on the oublog with the course module id '$this->contextinstanceid'"; 58 | } 59 | 60 | /** 61 | * Return localised event name. 62 | * 63 | * @return string 64 | */ 65 | public static function get_name() { 66 | return get_string('event:postviewed', 'mod_oublog'); 67 | } 68 | 69 | /** 70 | * Get URL related to the action 71 | * 72 | * @return \moodle_url 73 | */ 74 | public function get_url() { 75 | $url = new \moodle_url('/mod/oublog/viewpost.php', array('post' => $this->objectid)); 76 | return $url; 77 | } 78 | 79 | /** 80 | * Custom validation. 81 | * 82 | * @throws \coding_exception 83 | * @return void 84 | */ 85 | protected function validate_data() { 86 | parent::validate_data(); 87 | 88 | if (!isset($this->objectid)) { 89 | throw new \coding_exception('The \'postid\' value must be set in the object.'); 90 | } 91 | 92 | if (!isset($this->other['oublogid'])) { 93 | throw new \coding_exception('The \'oublogid\' value must be set in other.'); 94 | } 95 | 96 | if ($this->contextlevel != CONTEXT_MODULE) { 97 | throw new \coding_exception('Context level must be CONTEXT_MODULE.'); 98 | } 99 | } 100 | 101 | } 102 | -------------------------------------------------------------------------------- /classes/event/save_failed.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * 19 | * @package mod_oublog 20 | * @copyright 2015 The Open University 21 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 22 | */ 23 | 24 | namespace mod_oublog\event; 25 | 26 | defined('MOODLE_INTERNAL') || die(); 27 | 28 | /** 29 | * The mod_oublog post saving failed event class. 30 | * 31 | * @package mod_oublog 32 | * @since Moodle 2.7 33 | * @copyright 2015 The Open University 34 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 35 | */ 36 | class save_failed extends \core\event\base { 37 | 38 | /** 39 | * Init method. 40 | * 41 | * @return void 42 | */ 43 | protected function init() { 44 | $this->data['crud'] = 'u'; 45 | $this->data['edulevel'] = self::LEVEL_OTHER; 46 | } 47 | 48 | /** 49 | * Returns description of what happened. 50 | * 51 | * @return string 52 | */ 53 | public function get_description() { 54 | $string = 'OUBlog post create/update failed due to session error.'; 55 | if (!empty($this->other['pid'])) { 56 | $string .= " Post id '{$this->other['pid']}'."; 57 | } 58 | return $string; 59 | } 60 | 61 | /** 62 | * Return localised event name. 63 | * 64 | * @return string 65 | */ 66 | public static function get_name() { 67 | return get_string('event:savefailed', 'mod_oublog'); 68 | } 69 | 70 | /** 71 | * Get URL related to the action 72 | * 73 | * @return \moodle_url 74 | */ 75 | public function get_url() { 76 | return new \moodle_url($this->other['page']); 77 | } 78 | 79 | /** 80 | * Custom validation. 81 | * 82 | * @throws \coding_exception 83 | * @return void 84 | */ 85 | protected function validate_data() { 86 | parent::validate_data(); 87 | 88 | if (!isset($this->other['page'])) { 89 | throw new \coding_exception('The \'page\' value must be set in other.'); 90 | } 91 | } 92 | 93 | } 94 | -------------------------------------------------------------------------------- /classes/event/site_entries_viewed.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * The mod_oublog personal blog site entries vewed event. 19 | * 20 | * @package mod_oublog 21 | * @copyright 2014 The Open University 22 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 | */ 24 | 25 | namespace mod_oublog\event; 26 | 27 | defined('MOODLE_INTERNAL') || die(); 28 | 29 | /** 30 | * The mod_oublog site_entries_viewed event class. 31 | * 32 | * @property-read array $other { 33 | * Extra information about the event. 34 | * 35 | * - int pageid: The page id the oublog posts viewed. 36 | * 37 | * } 38 | * 39 | * @package mod_oublog 40 | * @since Moodle 2.7 41 | * @copyright 2014 The Open University 42 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 43 | */ 44 | class site_entries_viewed extends \core\event\base { 45 | /** 46 | * Init method. 47 | * 48 | * @return void 49 | */ 50 | protected function init() { 51 | $this->data['crud'] = 'c'; 52 | $this->data['edulevel'] = self::LEVEL_PARTICIPATING; 53 | $this->data['objecttable'] = 'oublog'; 54 | } 55 | 56 | /** 57 | * Returns description of what happened. 58 | * 59 | * @return string 60 | */ 61 | public function get_description() { 62 | return "The user with id '$this->userid' viewed site entries page 63 | '{$this->other['pageid']}' of the personal oublogs with 64 | course module id '$this->contextinstanceid'."; 65 | } 66 | 67 | /** 68 | * Return localised event name. 69 | * 70 | * @return string 71 | */ 72 | public static function get_name() { 73 | return get_string('event:siteentriesviewed', 'mod_oublog'); 74 | } 75 | 76 | /** 77 | * Get URL related to the action 78 | * 79 | * @return \moodle_url 80 | */ 81 | public function get_url() { 82 | $url = new \moodle_url('/mod/oublog/allposts.php', array('page' => $this->other['pageid'])); 83 | return $url; 84 | } 85 | 86 | /** 87 | * Custom validation. 88 | * 89 | * @throws \coding_exception 90 | * @return void 91 | */ 92 | protected function validate_data() { 93 | parent::validate_data(); 94 | 95 | if (!isset($this->objectid)) { 96 | throw new \coding_exception('The \'objectid\' value must be set.'); 97 | } 98 | 99 | if (!isset($this->other['pageid'])) { 100 | throw new \coding_exception('The \'pageid\' value must be set in other.'); 101 | } 102 | 103 | if ($this->contextlevel != CONTEXT_MODULE) { 104 | throw new \coding_exception('Context level must be CONTEXT_MODULE.'); 105 | } 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /classes/files_mask.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | namespace mod_oublog; 18 | 19 | /** 20 | * Implementation of file data masking for this plugin. 21 | * 22 | * The corresponding test script tool_datamasking_test.php checks every masked field. 23 | * 24 | * @package mod_oublog 25 | * @copyright 2024 The Open University 26 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 27 | */ 28 | class files_mask extends \tool_datamasking\files_mask { 29 | protected function replace_filename(\stdClass $rec, string $newfilename): void { 30 | global $DB; 31 | if ($rec->filearea == 'message') { 32 | // Update posts. 33 | $sql = "UPDATE {oublog_posts} 34 | SET message = REPLACE(message, ?, ?) 35 | WHERE id = ?"; 36 | $DB->execute($sql, [$rec->filename, $newfilename, $rec->itemid]); 37 | if ($rec->filename != rawurlencode($rec->filename)) { 38 | $DB->execute($sql, [rawurlencode($rec->filename), rawurlencode($newfilename), $rec->itemid]); 39 | } 40 | // Update edits. 41 | $sql = "UPDATE {oublog_edits} 42 | SET oldmessage = REPLACE(oldmessage, ?, ?) 43 | WHERE postid = ?"; 44 | $DB->execute($sql, [$rec->filename, $newfilename, $rec->itemid]); 45 | if ($rec->filename != rawurlencode($rec->filename)) { 46 | $DB->execute($sql, [rawurlencode($rec->filename), rawurlencode($newfilename), $rec->itemid]); 47 | } 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /classes/hook_callbacks.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | namespace mod_oublog; 18 | 19 | /** 20 | * Hook callbacks. 21 | * 22 | * @package mod_oublog 23 | * @copyright 2024 The Open University 24 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 25 | */ 26 | class hook_callbacks { 27 | 28 | /** 29 | * Called when the system wants to find out if an activity is searchable, to decide whether to 30 | * display a search box in the header. 31 | * 32 | * @param \local_moodleglobalsearch\hook\activity_search_info $hook 33 | */ 34 | public static function activity_search_info(\local_moodleglobalsearch\hook\activity_search_info $hook) { 35 | if ($hook->is_page('mod-oublog-view', 'mod-oublog-viewpost', 'mod-oublog-allposts')) { 36 | // This is a total hack, but I don't want to waste extra effort retrieving the data 37 | // that we already got. 38 | global $oublog; 39 | if ($oublog) { 40 | $strblogsearch = get_string('searchthisblog', 'oublog', oublog_get_displayname($oublog)); 41 | $hook->enable_search($strblogsearch); 42 | } 43 | } 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /classes/search/activity.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * Search area for mod_oublog activities. 19 | * 20 | * @package mod_oublog 21 | * @copyright 2017 The Open University 22 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 | */ 24 | namespace mod_oublog\search; 25 | 26 | defined('MOODLE_INTERNAL') || die(); 27 | 28 | /** 29 | * Search area for mod_oublog activities. 30 | * 31 | * @package mod_oublog 32 | * @copyright 2017 The Open University 33 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 34 | */ 35 | class activity extends \core_search\base_activity { 36 | 37 | /** 38 | * File area related to document 39 | */ 40 | const FILEAREA = [ 41 | 'INTRO_AREA' => 'intro' 42 | ]; 43 | 44 | /** 45 | * Returns the document associated with this activity. 46 | * 47 | * Overwriting base_activity method as page contents field is required, 48 | * description field is not. 49 | * 50 | * @param \stdClass $record 51 | * @param array $options 52 | * @return \core_search\document 53 | */ 54 | public function get_document($record, $options = array()) { 55 | try { 56 | $cm = $this->get_cm($this->get_module_name(), $record->id, $record->course); 57 | $context = \context_module::instance($cm->id); 58 | } catch (\dml_missing_record_exception $ex) { 59 | // Notify it as we run here as admin, we should see everything. 60 | debugging('Error retrieving ' . $this->areaid . ' ' . $record->id . 61 | ' document, not all required data is available: ' . $ex->getMessage(), DEBUG_DEVELOPER); 62 | return false; 63 | } catch (\dml_exception $ex) { 64 | // Notify it as we run here as admin, we should see everything. 65 | debugging('Error retrieving ' . $this->areaid . ' ' . $record->id . ' document: ' . $ex->getMessage(), 66 | DEBUG_DEVELOPER); 67 | return false; 68 | } 69 | 70 | // Prepare associative array with data from DB. 71 | $doc = \core_search\document_factory::instance($record->id, $this->componentname, $this->areaname); 72 | $doc->set('title', content_to_text($record->name, false)); 73 | 74 | $intro = file_rewrite_pluginfile_urls($record->intro, 'pluginfile.php', $context->id, 75 | $this->componentname, self::FILEAREA['INTRO_AREA'], null); 76 | $intro = content_to_text($intro, $record->introformat); 77 | 78 | $doc->set('content', $intro); 79 | 80 | $doc->set('contextid', $context->id); 81 | $doc->set('courseid', $record->course); 82 | $doc->set('owneruserid', \core_search\manager::NO_OWNER_ID); 83 | $doc->set('modified', $record->timemodified); 84 | 85 | return $doc; 86 | } 87 | 88 | /** 89 | * Returns true if this area uses file indexing. 90 | * 91 | * @return bool 92 | */ 93 | public function uses_file_indexing() { 94 | return true; 95 | } 96 | 97 | /** 98 | * Add the attached description files. 99 | * 100 | * @param \core_search\document $document The current document 101 | * @return null 102 | */ 103 | public function attach_files($document) { 104 | $fs = get_file_storage(); 105 | $files = array(); 106 | 107 | foreach (self::FILEAREA as $area) { 108 | $files = array_merge($files, $fs->get_area_files($document->get('contextid'), $this->componentname, $area, 109 | 0, 'sortorder DESC, id ASC', false)); 110 | } 111 | 112 | foreach ($files as $file) { 113 | $document->add_stored_file($file); 114 | } 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /classes/task/cron_task.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * A scheduled task for oublog cron. 19 | * 20 | * @package mod_oublog 21 | * @copyright 2014 22 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 | */ 24 | namespace mod_oublog\task; 25 | 26 | class cron_task extends \core\task\scheduled_task { 27 | 28 | /** 29 | * Get a descriptive name for this task (shown to admins). 30 | * 31 | * @return string 32 | */ 33 | public function get_name() { 34 | return get_string('oublogcrontask', 'mod_oublog'); 35 | } 36 | 37 | /** 38 | * Run oublog cron. 39 | * Function to be run periodically according to the moodle cron. 40 | * This function runs every 4 hours. 41 | */ 42 | public function execute() { 43 | global $DB; 44 | 45 | // Delete outdated (> 30 days) moderated comments. 46 | $outofdate = time() - 30 * 24 * 3600; 47 | $DB->delete_records_select('oublog_comments_moderated', "timeposted < ?", array($outofdate)); 48 | 49 | // Delete outdated (> 90 days) personal blog posts that has been deleted. 50 | $fs = get_file_storage(); 51 | $timeframe = strtotime('-90 days'); 52 | if ($personalblog = $DB->get_record('oublog', ['global' => 1], '*', IGNORE_MULTIPLE)) { 53 | $cm = get_coursemodule_from_instance('oublog', $personalblog->id); 54 | if (!$cm) { 55 | return; 56 | } 57 | $context = \context_module::instance($cm->id); 58 | $instancesql = " 59 | SELECT op.id 60 | FROM {oublog_instances} bi 61 | INNER JOIN {oublog_posts} op ON bi.id = op.oubloginstancesid 62 | WHERE bi.oublogid = :blogid AND op.timedeleted < :timeframe "; 63 | $posts = $DB->get_recordset_sql($instancesql, ['blogid' => $personalblog->id, 64 | 'timeframe' => $timeframe]); 65 | foreach ($posts as $post) { 66 | $transaction = $DB->start_delegated_transaction(); 67 | // Delete files from this post. 68 | $params = ['postid' => $post->id]; 69 | $fs->delete_area_files_select($context->id, 'mod_oublog', 'message', 70 | 'IN (:postid)', $params); 71 | $fs->delete_area_files_select($context->id, 'mod_oublog', 'attachment', 72 | 'IN (:postid)', $params); 73 | 74 | $commentids = $DB->get_records('oublog_comments', $params, '', 'id'); 75 | if ($commentids) { 76 | list($insql, $paramsinsql) = $DB->get_in_or_equal(array_keys($commentids), SQL_PARAMS_NAMED); 77 | $fs->delete_area_files_select($context->id, 'mod_oublog', 'messagecomment', 78 | $insql, $paramsinsql); 79 | $DB->delete_records_select('oublog_comments', "id $insql", $paramsinsql); 80 | } 81 | 82 | $DB->delete_records_select('oublog_comments_moderated', 'postid IN (:postid)', $params); 83 | 84 | // Delete all edits (including files) on posts owned by these users 85 | $editids = $DB->get_records('oublog_edits', $params, '', 'id'); 86 | if ($editids) { 87 | list($insql, $paramsinsql) = $DB->get_in_or_equal(array_keys($editids), SQL_PARAMS_NAMED); 88 | $fs->delete_area_files_select($context->id, 'mod_oublog', 'edit', 89 | $insql, $paramsinsql); 90 | $DB->delete_records_select('oublog_edits', "id $insql", $paramsinsql); 91 | } 92 | 93 | // Delete tag instances from all these posts. 94 | $DB->delete_records_select('oublog_taginstances', 'postid IN (:postid)', $params); 95 | 96 | // Delete the actual posts. 97 | $DB->delete_records_select('oublog_posts', 'id IN (:postid)', $params); 98 | $transaction->allow_commit(); 99 | } 100 | $posts->close(); 101 | } 102 | } 103 | 104 | } 105 | -------------------------------------------------------------------------------- /classes/task/settings_task.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * A scheduled task for oublog settings page. 19 | * 20 | * @package mod_oublog 21 | * @copyright 2014 22 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 | */ 24 | namespace mod_oublog\task; 25 | 26 | class settings_task extends \core\task\adhoc_task { 27 | 28 | /** 29 | * Get a descriptive name for this task (shown to admins). 30 | * 31 | * @return string 32 | */ 33 | public function get_name() { 34 | return get_string('oublogsettingstask', 'mod_oublog'); 35 | } 36 | 37 | public function execute() { 38 | global $DB, $CFG; 39 | require_once($CFG->dirroot . '/course/lib.php'); 40 | 41 | $pbcm = get_coursemodule_from_instance('oublog', 1 , SITEID, true); 42 | if (empty($pbcm->sectionnum)) { 43 | $mod = new \stdClass(); 44 | $mod->id= $pbcm->id; 45 | $mod->section = course_add_cm_to_section($pbcm->course, $pbcm->id, 1); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /classes/tool_datamasking.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | namespace mod_oublog; 18 | 19 | /** 20 | * Implementation of data masking for this plugin. 21 | * 22 | * The corresponding test script tool_datamasking_test.php checks every masked field. 23 | * 24 | * @package mod_oublog 25 | * @copyright 2021 The Open University 26 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 27 | */ 28 | class tool_datamasking implements \tool_datamasking\plugin { 29 | 30 | public function build_plan(\tool_datamasking\plan $plan): void { 31 | $plan->table('oublog')->add(new \tool_datamasking\unique_email_mask('reportingemail')); 32 | $plan->table('oublog_comments')->add(new \tool_datamasking\fixed_value_mask( 33 | 'authorname', 'Masked User')); 34 | $plan->table('oublog_comments')->add(new \tool_datamasking\similar_text_mask( 35 | 'message', true, \tool_datamasking\similar_text_mask::MODEL_POST)); 36 | $plan->table('oublog_comments')->add(new \tool_datamasking\similar_text_mask( 37 | 'title', false, \tool_datamasking\similar_text_mask::MODEL_SUBJECT)); 38 | $plan->table('oublog_comments_moderated')->add(new \tool_datamasking\fixed_value_mask( 39 | 'authorname', 'Masked User')); 40 | $plan->table('oublog_comments_moderated')->add(new \tool_datamasking\similar_text_mask( 41 | 'message', true, \tool_datamasking\similar_text_mask::MODEL_POST)); 42 | $plan->table('oublog_comments_moderated')->add(new \tool_datamasking\similar_text_mask( 43 | 'title', false, \tool_datamasking\similar_text_mask::MODEL_SUBJECT)); 44 | $plan->table('oublog_edits')->add(new \tool_datamasking\similar_text_mask( 45 | 'oldmessage', true, \tool_datamasking\similar_text_mask::MODEL_POST)); 46 | $plan->table('oublog_edits')->add(new \tool_datamasking\similar_text_mask( 47 | 'oldtitle', false, \tool_datamasking\similar_text_mask::MODEL_SUBJECT)); 48 | // Do blog instances after user names. 49 | $plan->table('oublog_instances', 200); 50 | $plan->table('oublog_instances')->add(new \tool_datamasking\user_name_mask( 51 | 'name', 'userid', '', '\'s blog', 'Masked User', 'Masked blog name')); 52 | $plan->table('oublog_instances')->add(new \tool_datamasking\similar_text_mask( 53 | 'summary', true, \tool_datamasking\similar_text_mask::MODEL_POST)); 54 | $plan->table('oublog_posts')->add(new \tool_datamasking\similar_text_mask( 55 | 'message', true, \tool_datamasking\similar_text_mask::MODEL_POST)); 56 | $plan->table('oublog_posts')->add(new \tool_datamasking\similar_text_mask( 57 | 'title', false, \tool_datamasking\similar_text_mask::MODEL_SUBJECT)); 58 | 59 | $plan->table('files')->add(new \tool_datamasking\files_mask('mod_oublog', 'attachment')); 60 | $plan->table('files')->add(new \tool_datamasking\files_mask('mod_oublog', 'edit')); 61 | $plan->table('files')->add(new files_mask('mod_oublog', 'message')); 62 | $plan->table('files')->add(new \tool_datamasking\files_mask('mod_oublog', 'messagecomment', 'oublog_comments', 'message')); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /comment_form.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | require_once($CFG->libdir.'/formslib.php'); 18 | 19 | class mod_oublog_comment_form extends moodleform { 20 | 21 | public function definition() { 22 | 23 | global $CFG; 24 | 25 | $maxvisibility = $this->_customdata['maxvisibility']; 26 | $edit = $this->_customdata['edit']; 27 | $moderated = $this->_customdata['moderated']; 28 | $confirmed = $this->_customdata['confirmed']; 29 | $blogid = $this->_customdata['blogid']; 30 | $postid = $this->_customdata['postid']; 31 | $maxbytes = $this->_customdata['maxbytes']; 32 | $postrender = $this->_customdata['postrender']; 33 | $referurl = $this->_customdata['referurl']; 34 | $cmid = $this->_customdata['cmid']; 35 | $mform =& $this->_form; 36 | 37 | if (!$edit) { 38 | $mform->addElement('header', 'posttext', get_string('postmessage', 'oublog')); 39 | $mform->setExpanded('posttext', false); 40 | $mform->addElement('html', $postrender); 41 | } 42 | 43 | $mform->addElement('header', 'general', ''); 44 | $mform->setExpanded('general', true); 45 | 46 | if ($moderated) { 47 | $mform->addElement('static', '', '', 48 | get_string('moderated_info', 'oublog', $CFG->wwwroot . 49 | '/mod/oublog/bloglogin.php?returnurl=editcomment.php?blog=' . 50 | $blogid . '%26post=' . $postid)); 51 | 52 | $mform->addElement('text', 'authorname', 53 | get_string('moderated_authorname', 'oublog'), 'size="48"'); 54 | $mform->setType('authorname', PARAM_TEXT); 55 | $mform->addRule('authorname', null, 'required', null, 'client'); 56 | } 57 | 58 | $mform->addElement('text', 'title', get_string('title', 'oublog'), 'size="48"'); 59 | $mform->setType('title', PARAM_TEXT); 60 | 61 | $messagetype = 'editor'; 62 | if ($moderated) { 63 | $messagetype = 'textarea'; 64 | } 65 | 66 | $mform->addElement($messagetype, 'messagecomment', get_string('comment', 'oublog'), 67 | array('cols' => 50, 'rows' => 30), 68 | array('maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes' => $maxbytes)); 69 | if (editors_get_preferred_editor() instanceof \editor_tiny\editor) { 70 | $mform->addHelpButton('messagecomment', 'messageshortcuts', 'oublog'); 71 | } 72 | $mform->setType('messagecomment', PARAM_CLEANHTML); 73 | $mform->addRule('messagecomment', null, 'required', null, 'server'); 74 | 75 | // When using moderation, we include the world's dumbest capcha (the 76 | // user is told to type 'yes' into the box). Because there is moderation 77 | // we do not really need a capcha; this is only meant to exclude the 78 | // stupidest spam robots and reduce the quantity of email sent to 79 | // moderators. A cookie can skip this step. 80 | if ($moderated && !$confirmed) { 81 | $mform->addElement('static', '', '', 82 | get_string('moderated_confirminfo', 'oublog')); 83 | $mform->addElement('text', 'confirm', get_string('moderated_confirm', 'oublog')); 84 | $mform->setType('confirm', PARAM_TEXT); 85 | } 86 | 87 | if ($edit) { 88 | $submitstring = get_string('savechanges'); 89 | } else { 90 | $submitstring = get_string('addcomment', 'oublog'); 91 | } 92 | 93 | $this->add_action_buttons(true, $submitstring); 94 | 95 | // Hidden form vars. 96 | $mform->addElement('hidden', 'blog'); 97 | $mform->setType('blog', PARAM_INT); 98 | 99 | $mform->addElement('hidden', 'post'); 100 | $mform->setType('post', PARAM_INT); 101 | 102 | $mform->addElement('hidden', 'referurl', $referurl); 103 | $mform->setType('referurl', PARAM_LOCALURL); 104 | 105 | $mform->addElement('hidden', 'cmid', $cmid); 106 | $mform->setType('cmid', PARAM_INT); 107 | 108 | } 109 | 110 | public function validation($data, $files) { 111 | $moderated = $this->_customdata['moderated']; 112 | $confirmed = $this->_customdata['confirmed']; 113 | 114 | $errors = array(); 115 | if ($moderated && !$confirmed && (empty($data['confirm']) || 116 | $data['confirm'] !== get_string('moderated_confirmvalue', 'oublog'))) { 117 | $errors['confirm'] = get_string('error_noconfirm', 'oublog'); 118 | } 119 | return $errors; 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /confirmloggedin.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * This script is called through AJAX. It confirms that a user is still 19 | * logged in and has a valid session before saving edits to a blog page 20 | * 21 | * @package mod 22 | * @subpackage oublog 23 | * @copyright 2014 The Open University 24 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 25 | */ 26 | define('AJAX_SCRIPT', true); 27 | require_once(dirname(__FILE__) . '/../../config.php'); 28 | 29 | header('Content-Type: text/plain'); 30 | 31 | try { 32 | // Test session - These functions throw exceptions so trap and exit if they fail. 33 | // This saves 404 errors and sends a smaller page. 34 | $contextid = required_param('contextid', PARAM_INT); 35 | list($context, $course, $cm) = get_context_info_array($contextid); 36 | $PAGE->set_url('/mod/oublog/confirmloggedin.php'); 37 | $PAGE->set_context($context); 38 | require_login($course, false, $cm, true, true); 39 | require_sesskey(); 40 | } catch (Exception $e) { 41 | echo str_replace('ok', 'OK', $e->getMessage()); 42 | $pid = 0; 43 | $url = '/mod/oublog/editpost.php'; 44 | if (!empty($_SERVER['HTTP_REFERER'])) { 45 | $url = new moodle_url($_SERVER['HTTP_REFERER']); 46 | $rpid = $url->get_param('post'); 47 | if (!empty($rpid)) { 48 | $pid = $rpid; 49 | } 50 | $url = $url->out_as_local_url(); 51 | } 52 | $params = array( 53 | 'context' => context_system::instance(), 54 | 'other' => array('page' => $url, 'pid' => $pid, 'msg' => $e->getMessage()) 55 | ); 56 | $event = \mod_oublog\event\save_failed::create($params); 57 | $event->trigger(); 58 | exit; 59 | } 60 | 61 | echo 'ok'; 62 | -------------------------------------------------------------------------------- /db/hooks.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * Hook callbacks. 19 | * 20 | * @package mod_oublog 21 | * @copyright 2024 The Open University 22 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 | */ 24 | 25 | defined('MOODLE_INTERNAL') || die(); 26 | 27 | $callbacks = [ 28 | [ 29 | 'hook' => \local_moodleglobalsearch\hook\activity_search_info::class, 30 | 'callback' => \mod_oublog\hook_callbacks::class . '::activity_search_info', 31 | 'priority' => 500, 32 | ], 33 | ]; 34 | -------------------------------------------------------------------------------- /db/install.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * Creates personal blog instance (on site front page) after install 19 | * 20 | * @package mod 21 | * @subpackage oublog 22 | * @copyright 2013 The open University 23 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 24 | */ 25 | 26 | defined('MOODLE_INTERNAL') || die(); 27 | 28 | function xmldb_oublog_install() { 29 | global $DB, $CFG; 30 | 31 | require_once($CFG->dirroot . '/course/lib.php'); 32 | 33 | // Setup the global blog. 34 | $oublog = new stdClass; 35 | $oublog->course = SITEID; 36 | $oublog->name = 'Personal Blogs'; 37 | $oublog->intro = ''; 38 | $oublog->introformat = FORMAT_HTML; 39 | $oublog->accesstoken = md5(uniqid(rand(), true)); 40 | $oublog->maxvisibility = 300;// OUBLOG_VISIBILITY_PUBLIC. 41 | $oublog->global = 1; 42 | $oublog->allowcomments = 2;// OUBLOG_COMMENTS_ALLOWPUBLIC. 43 | $oublog->timemodified = time(); 44 | if (!$oublog->id = $DB->insert_record('oublog', $oublog)) { 45 | return false; 46 | } 47 | 48 | $mod = new stdClass; 49 | $mod->course = SITEID; 50 | $mod->module = $DB->get_field('modules', 'id', array('name'=>'oublog')); 51 | $mod->instance = $oublog->id; 52 | $mod->visible = 1; 53 | $mod->visibleold = 0; 54 | $mod->section = 1; 55 | 56 | if (!$cm = add_course_module($mod)) { 57 | return true; 58 | } 59 | set_config('oublogsetup', null); 60 | 61 | // For unit tests to work, it's necessary to create context now. 62 | context_module::instance($cm); 63 | 64 | return true; 65 | } 66 | -------------------------------------------------------------------------------- /db/log.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * Definition of log events 19 | * 20 | * @package mod 21 | * @subpackage lesson 22 | * @copyright 2010 Petr Skoda (http://skodak.org) 23 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 24 | */ 25 | 26 | defined('MOODLE_INTERNAL') || die(); 27 | 28 | $logs = array( 29 | array('module'=>'oublog', 'action'=> 'add', 'mtable'=>'oublog', 'field'=>'name'), 30 | array('module'=>'oublog', 'action'=> 'update', 'mtable'=>'oublog', 'field'=>'name'), 31 | array('module'=>'oublog', 'action'=>'view', 'mtable'=>'oublog', 'field'=>'name'), 32 | array('module'=>'oublog', 'action'=> 'view all', 'mtable'=>'oublog', 'field'=>'name'), 33 | array('module'=>'oublog', 'action'=>'add post', 'mtable'=>'oublog', 'field'=>'name'), 34 | array('module'=>'oublog', 'action'=>'edit post', 'mtable'=>'oublog', 'field'=>'name'), 35 | array('module'=>'oublog', 'action'=>'add comment', 'mtable'=>'oublog', 'field'=>'name'), 36 | array('module'=>'oublog', 'action'=> 'extdashadd', 'mtable'=>'oublog', 'field'=>'name'), 37 | array('module'=>'oublog', 'action'=> 'extdashremove', 'mtable'=>'oublog', 'field'=>'name'), 38 | array('module'=>'oublog', 'action'=> 'allposts', 'mtable'=>'oublog', 'field'=>'name'), 39 | array('module'=>'oublog', 'action'=> 'approve comment', 'mtable'=>'oublog', 'field'=>'name'), 40 | array('module'=>'oublog', 'action'=> 'delete comment', 'mtable'=>'oublog', 'field'=>'name'), 41 | array('module'=>'oublog', 'action'=> 'delete post', 'mtable'=>'oublog', 'field'=>'name'), 42 | array('module'=>'oublog', 'action'=> 'view post', 'mtable'=>'oublog', 'field'=>'name'), 43 | array('module'=>'oublog', 'action'=> 'import post', 'mtable'=>'oublog', 'field'=>'name'), 44 | ); -------------------------------------------------------------------------------- /db/services.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * Web service definition. 19 | * 20 | * @package mod_oublog 21 | * @copyright 2013 The Open University 22 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 | */ 24 | 25 | defined('MOODLE_INTERNAL') || die(); 26 | 27 | $functions = [ 28 | 'mod_oublog_get_user_blogs' => [ 29 | 'classname' => 'mod_oublog_external', 30 | 'methodname' => 'get_user_blogs', 31 | 'classpath' => 'mod/oublog/externallib.php', 32 | 'description' => 'Get all user\'s blogs on system', 33 | 'type' => 'read', 34 | ], 35 | 'mod_oublog_get_blog_info' => [ 36 | 'classname' => 'mod_oublog_external', 37 | 'methodname' => 'get_blog_info', 38 | 'classpath' => 'mod/oublog/externallib.php', 39 | 'description' => 'Get info on blog, inc access check', 40 | 'type' => 'read', 41 | ], 42 | 'mod_oublog_get_blog_allposts' => [ 43 | 'classname' => 'mod_oublog_external', 44 | 'methodname' => 'get_blog_allposts', 45 | 'classpath' => 'mod/oublog/externallib.php', 46 | 'description' => 'Get importable user posts from blog', 47 | 'type' => 'read', 48 | ], 49 | 'mod_oublog_get_blog_posts' => [ 50 | 'classname' => 'mod_oublog_external', 51 | 'methodname' => 'get_blog_posts', 52 | 'classpath' => 'mod/oublog/externallib.php', 53 | 'description' => 'Get selected user posts from blog', 54 | 'type' => 'read', 55 | ], 56 | 'mod_oublog_get_user_blogs2' => [ 57 | 'classname' => 'mod_oublog_external', 58 | 'methodname' => 'get_user_blogs2', 59 | 'classpath' => 'mod/oublog/externallib.php', 60 | 'description' => 'Get all user\'s blogs on system', 61 | 'type' => 'read', 62 | ], 63 | 'mod_oublog_get_blog_info2' => [ 64 | 'classname' => 'mod_oublog_external', 65 | 'methodname' => 'get_blog_info2', 66 | 'classpath' => 'mod/oublog/externallib.php', 67 | 'description' => 'Get info on blog, inc access check', 68 | 'type' => 'read', 69 | ], 70 | 'mod_oublog_get_blog_allposts2' => [ 71 | 'classname' => 'mod_oublog_external', 72 | 'methodname' => 'get_blog_allposts2', 73 | 'classpath' => 'mod/oublog/externallib.php', 74 | 'description' => 'Get importable user posts from blog', 75 | 'type' => 'read', 76 | ], 77 | 'mod_oublog_get_blog_posts2' => [ 78 | 'classname' => 'mod_oublog_external', 79 | 'methodname' => 'get_blog_posts2', 80 | 'classpath' => 'mod/oublog/externallib.php', 81 | 'description' => 'Get selected user posts from blog', 82 | 'type' => 'read', 83 | ], 84 | ]; 85 | 86 | $services = [ 87 | 'OUBlog import' => [ 88 | 'shortname' => 'oublogimport', 89 | 'functions' => ['mod_oublog_get_user_blogs', 'mod_oublog_get_blog_info', 90 | 'mod_oublog_get_blog_allposts', 'mod_oublog_get_blog_posts', 91 | 'mod_oublog_get_user_blogs2', 'mod_oublog_get_blog_info2', 92 | 'mod_oublog_get_blog_allposts2', 'mod_oublog_get_blog_posts2'], 93 | 'requiredcapability' => '', 94 | 'restrictedusers' => 1, 95 | 'enabled' => 1, 96 | 'downloadfiles' => 1 97 | ] 98 | ]; 99 | -------------------------------------------------------------------------------- /db/tasks.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * Definition of OUblog scheduled tasks. 19 | * 20 | * @package mod_oublog 21 | * @category task 22 | * @copyright 2014 The Open University 23 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 24 | */ 25 | 26 | defined('MOODLE_INTERNAL') || die(); 27 | 28 | $tasks = array( 29 | array( 30 | 'classname' => 'mod_oublog\task\cron_task', 31 | 'blocking' => 0, 32 | 'minute' => '0', 33 | 'hour' => '*/4', 34 | 'day' => '*', 35 | 'month' => '*', 36 | 'dayofweek' => '*' 37 | ) 38 | ); 39 | -------------------------------------------------------------------------------- /deletelink.php: -------------------------------------------------------------------------------- 1 | . 16 | /** 17 | * This page allows a user to delete a blog comments 18 | * 19 | * @author Matt Clarkson 20 | * @package oublog 21 | */ 22 | require_once("../../config.php"); 23 | require_once("locallib.php"); 24 | 25 | $linkid = required_param('link', PARAM_INT); // Link ID to delete 26 | $confirm = optional_param('confirm', 0, PARAM_INT); // Confirm that it is ok to delete link 27 | $cmid = optional_param('cmid', null, PARAM_INT); 28 | 29 | if (!$link = $DB->get_record('oublog_links', array('id'=> $linkid))) { 30 | throw new moodle_exception('invalidlink', 'oublog'); 31 | } 32 | 33 | if (!$cm = get_coursemodule_from_instance('oublog', $link->oublogid)) { 34 | throw new moodle_exception('invalidcoursemodule'); 35 | } 36 | 37 | if (!$course = $DB->get_record("course", array("id"=> $cm->course))) { 38 | throw new moodle_exception('coursemisconf'); 39 | } 40 | 41 | if (!$oublog = $DB->get_record("oublog", array("id"=> $cm->instance))) { 42 | throw new moodle_exception('invalidcoursemodule'); 43 | } 44 | 45 | $url = new moodle_url('/mod/oublog/deletelink.php', array('link'=>$linkid, 'confirm'=>$confirm)); 46 | $PAGE->set_url($url); 47 | 48 | // Check security. 49 | $context = context_module::instance($cm->id); 50 | $childdata = oublog_get_blog_data_base_on_cmid_of_childblog($cmid, $oublog); 51 | $childoublog = null; 52 | $childcourse = null; 53 | if (!empty($childdata)) { 54 | $context = $childdata['context']; 55 | $childoublog = $childdata['ousharedblog']; 56 | $childcourse = $childdata['course']; 57 | oublog_check_view_permissions($childdata['ousharedblog'], $childdata['context'], $childdata['cm']); 58 | 59 | } else { 60 | oublog_check_view_permissions($oublog, $context, $cm); 61 | } 62 | $correctglobal = isset($childoublog->global) ? $childoublog->global : $oublog->global; 63 | $oubloginstance = $link->oubloginstancesid ? $DB->get_record('oublog_instances', array('id'=>$link->oubloginstancesid)) : null; 64 | oublog_require_userblog_permission('mod/oublog:managelinks', $childoublog ? $childoublog : $oublog, $oubloginstance, $context); 65 | 66 | if ($correctglobal) { 67 | $blogtype = 'personal'; 68 | $oubloguser = $USER; 69 | } else { 70 | $blogtype = 'course'; 71 | } 72 | 73 | $viewurl = new moodle_url('/mod/oublog/view.php', array('id' => $cmid ? $cmid : $cm->id)); 74 | 75 | if (!empty($linkid) && !empty($confirm)) { 76 | oublog_delete_link($childoublog ? $childoublog : $oublog, $link); 77 | redirect($viewurl); 78 | exit; 79 | } 80 | 81 | // Get Strings. 82 | $stroublogs = get_string('modulenameplural', 'oublog'); 83 | $stroublog = get_string('modulename', 'oublog'); 84 | 85 | // Print the header. 86 | if ($blogtype == 'personal') { 87 | $PAGE->navbar->add(fullname($oubloguser), new moodle_url('/user/view.php', array('id'=>$oubloguser->id))); 88 | $PAGE->navbar->add(format_string($oublog->name)); 89 | } 90 | $PAGE->set_title(format_string(!empty($childoublog->name) ? $childoublog->name : $oublog->name)); 91 | $PAGE->set_heading(format_string(!empty($childcourse->fullname) ? $childcourse->fullname : $course->fullname)); 92 | echo $OUTPUT->header(); 93 | echo $OUTPUT->confirm(get_string('confirmdeletelink', 'oublog'), 94 | new moodle_url('/mod/oublog/deletelink.php', array('link'=>$linkid, 'confirm'=>'1', 'cmid' => $cmid)), 95 | $viewurl); 96 | echo $OUTPUT->footer(); 97 | -------------------------------------------------------------------------------- /deletepost_form.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | require_once($CFG->libdir.'/formslib.php'); 18 | 19 | /** 20 | * Form for sending an email to the author of a post when deleting 21 | * @package mod 22 | * @subpackage oublog 23 | * @copyright 2013 The Open University 24 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 25 | */ 26 | class mod_oublog_deletepost_form extends moodleform { 27 | 28 | public function definition() { 29 | $mform =& $this->_form; 30 | $cmid = $this->_customdata->cmid; 31 | 32 | // Header. 33 | $mform->addElement('header', 'general', get_string('deleteandemail', 'oublog')); 34 | 35 | // Message box. 36 | $mform->addElement('editor', 'message', 37 | get_string('emailmessage', 'oublog'), array('size'=>'64', 'id' => 'id_oublog_delete_msg')); 38 | $mform->setType('message', PARAM_RAW); 39 | $mform->addRule('message', null, 'required', null, 'client'); 40 | 41 | // Send a copy to self. 42 | $mform->addElement('checkbox', 'copyself', get_string('copytoself', 'oublog')); 43 | 44 | // Adding optional text field 'Email address of other recipients'. 45 | $mform->addElement('text', 'emailadd', get_string('extra_emails', 'oublog'), 46 | array('size' => '48')); 47 | $mform->addHelpButton('emailadd', 'extra_emails', 'oublog'); 48 | $mform->setType('emailadd', PARAM_RAW); 49 | 50 | // Include a copy of the post. 51 | $mform->addElement('checkbox', 'includepost', get_string('includepost', 'oublog')); 52 | 53 | // Hidden fields for return url. 54 | $mform->addElement('hidden', 'blog', $this->_customdata->blog); 55 | $mform->setType('blog', PARAM_INT); 56 | 57 | $mform->addElement('hidden', 'post', $this->_customdata->post); 58 | $mform->setType('post', PARAM_INT); 59 | 60 | $mform->addElement('hidden', 'email', $this->_customdata->email); 61 | $mform->setType('email', PARAM_INT); 62 | 63 | $mform->addElement('hidden', 'delete', $this->_customdata->delete); 64 | $mform->setType('delete', PARAM_INT); 65 | 66 | $mform->addElement('hidden', 'referurl', $this->_customdata->referurl); 67 | $mform->setType('referurl', PARAM_LOCALURL); 68 | 69 | $mform->addElement('hidden', 'confirm', 1); 70 | $mform->setType('confirm', PARAM_INT); 71 | 72 | $mform->addElement('hidden', 'cmid', $cmid); 73 | $mform->setType('cmid', PARAM_INT); 74 | // Add some buttons. 75 | $this->add_action_buttons(true, get_string('sendanddelete', 'oublog')); 76 | 77 | } 78 | 79 | public function validation($data, $files) { 80 | $errors = parent::validation($data, $files); 81 | if (!empty($data['emailadd'])) { 82 | $emails = preg_split('~[; ]+~', $data['emailadd']); 83 | if (count($emails) < 1) { 84 | $errors['emailadd'] = get_string('invalidemails', 'oublog'); 85 | } else { 86 | foreach ($emails as $email) { 87 | if (!validate_email($email)) { 88 | $errors['emailadd'] = get_string('invalidemails', 'oublog'); 89 | break; 90 | } 91 | } 92 | } 93 | } 94 | return $errors; 95 | } 96 | 97 | } 98 | -------------------------------------------------------------------------------- /editinstance.php: -------------------------------------------------------------------------------- 1 | . 16 | /** 17 | * This page allows a user to edit their personal blog 18 | * 19 | * @author Matt Clarkson 20 | * @author Sam Marshall 21 | * @package oublog 22 | */ 23 | define('OUBLOG_EDIT_INSTANCE', true); 24 | 25 | require_once('../../config.php'); 26 | require_once('locallib.php'); 27 | require_once('lib.php'); 28 | require_once('mod_form.php'); 29 | 30 | $bloginstancesid = required_param('instance', PARAM_INT); // Bloginstance 31 | $postid = optional_param('post', 0, PARAM_INT); // Post ID for editing 32 | 33 | if (!$oubloginstance = $DB->get_record('oublog_instances', array('id'=>$bloginstancesid))) { 34 | throw new moodle_exception('invalidblog', 'oublog'); 35 | } 36 | if (!$oublog = $DB->get_record("oublog", array("id"=>$oubloginstance->oublogid))) { 37 | throw new moodle_exception('invalidblog', 'oublog'); 38 | } 39 | if (!$oublog->global) { 40 | throw new moodle_exception('invalidblog', 'oublog'); 41 | } 42 | if (!$cm = get_coursemodule_from_instance('oublog', $oublog->id)) { 43 | throw new moodle_exception('invalidcoursemodule'); 44 | } 45 | if (!$course = $DB->get_record("course", array("id"=>$oublog->course))) { 46 | throw new moodle_exception('invalidcoursemodule'); 47 | } 48 | 49 | // Check security. 50 | if (!$oublog->global) { 51 | throw new moodle_exception('onlyworkspersonal', 'oublog'); 52 | } 53 | $url = new moodle_url('/mod/oublog/editinstance.php', array('instance'=>$bloginstancesid, 'post'=>$postid)); 54 | $PAGE->set_url($url); 55 | 56 | $context = context_module::instance($cm->id); 57 | oublog_check_view_permissions($oublog, $context, $cm); 58 | $oubloguser = $DB->get_record('user', array('id'=>$oubloginstance->userid)); 59 | $viewurl = 'view.php?user='.$oubloginstance->userid; 60 | 61 | if ($USER->id != $oubloginstance->userid && !has_capability('mod/oublog:manageposts', $context)) { 62 | throw new moodle_exception('accessdenied', 'oublog'); 63 | } 64 | 65 | // Get strings. 66 | $stroublogs = get_string('modulenameplural', 'oublog'); 67 | $stroublog = get_string('modulename', 'oublog'); 68 | $streditpost = get_string('editpost', 'oublog'); 69 | $strblogoptions = get_string('blogoptions', 'oublog'); 70 | 71 | // Set-up groups. 72 | $currentgroup = oublog_get_activity_group($cm, true); 73 | $groupmode = oublog_get_activity_groupmode($cm, $course); 74 | 75 | $mform = new mod_oublog_mod_form('editinstance.php', array('maxvisibility' => $oublog->maxvisibility, 'edit' => !empty($postid), 76 | 'postperpage' => $oublog->postperpage)); 77 | 78 | if ($mform->is_cancelled()) { 79 | redirect($viewurl); 80 | exit; 81 | } 82 | 83 | $textfieldoptions = array( 84 | 'maxfiles' => EDITOR_UNLIMITED_FILES, 85 | 'maxbytes' => $CFG->maxbytes, 86 | 'context' => $context, 87 | ); 88 | 89 | if (!$frmoubloginstance = $mform->get_data()) { 90 | 91 | $oubloginstance->instance = $oubloginstance->id; 92 | $oubloginstance->summaryformat = FORMAT_HTML; 93 | $oubloginstance = file_prepare_standard_editor($oubloginstance, 'summary', $textfieldoptions, $context, 94 | 'mod_oublog', 'summary', $oubloginstance->id); 95 | $mform->set_data($oubloginstance); 96 | 97 | // Print the header. 98 | oublog_build_navigation($oublog, $oubloginstance, $oubloguser); 99 | $PAGE->navbar->add($strblogoptions); 100 | $PAGE->set_title(format_string($oublog->name)); 101 | echo $OUTPUT->header(); 102 | 103 | echo '
'; 104 | $mform->display(); 105 | 106 | echo $OUTPUT->footer(); 107 | 108 | } else { 109 | // Handle form submission. 110 | $frmoubloginstance->id = $frmoubloginstance->instance; 111 | $frmoubloginstance->summaryformat = FORMAT_HTML; 112 | $frmoubloginstance = file_postupdate_standard_editor($frmoubloginstance, 'summary', $textfieldoptions, $context, 113 | 'mod_oublog', 'summary', $frmoubloginstance->id); 114 | $DB->update_record('oublog_instances', $frmoubloginstance); 115 | 116 | redirect($viewurl); 117 | } -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | . 16 | /** 17 | * This page prints the blog index page 18 | * 19 | * @author Matt Clarkson 20 | * @package oublog 21 | */ 22 | 23 | require_once("../../config.php"); 24 | require_once("locallib.php"); 25 | 26 | $id = required_param('id', PARAM_INT); // course 27 | 28 | if (! $course = $DB->get_record('course', array('id'=>$id))) { 29 | throw new moodle_exception('coursemisconf'); 30 | } 31 | 32 | // Support for OU shared activities system, if installed 33 | $grabindex=$CFG->dirroot.'/course/format/sharedactv/grabindex.php'; 34 | if (file_exists($grabindex)) { 35 | require_once($grabindex); 36 | } 37 | 38 | require_course_login($course); 39 | 40 | // Trigger instances list viewed event. 41 | $params = array( 42 | 'context' => context_course::instance($course->id) 43 | ); 44 | $event = \mod_oublog\event\course_module_instance_list_viewed::create($params); 45 | $event->add_record_snapshot('course', $course); 46 | $event->trigger(); 47 | 48 | $strweek = get_string('week'); 49 | $strtopic = get_string('topic'); 50 | $strname = get_string('name'); 51 | $strdata = get_string('modulename', 'oublog'); 52 | $strdataplural = get_string('modulenameplural', 'oublog'); 53 | $url = new moodle_url('/mod/oublog/index.php', array('id' => $course->id)); 54 | $PAGE->navbar->add($strdata, $url); 55 | $PAGE->set_title($strdata); 56 | $PAGE->set_heading(format_string($course->fullname)); 57 | $PAGE->set_url($url); 58 | echo $OUTPUT->header(); 59 | 60 | // Print the list of blogs. 61 | if (!$blogs = get_all_instances_in_course('oublog', $course)) { 62 | notice(get_string('thereareno', 'moodle', $strdataplural) , "$CFG->wwwroot/course/view.php?id=$course->id"); 63 | } 64 | 65 | // Get the post count 66 | $sql = "SELECT o.id, COUNT(p.id) as postcount 67 | FROM {oublog} o 68 | INNER JOIN {oublog_instances} i ON i.oublogid = o.id 69 | INNER JOIN {oublog_posts} p ON p.oubloginstancesid = i.id 70 | WHERE o.course = ? AND p.deletedby IS NULL 71 | GROUP BY o.id "; 72 | $counts = $DB->get_records_sql($sql, array($course->id)); 73 | 74 | $timenow = time(); 75 | $strname = get_string('name'); 76 | $strweek = get_string('week'); 77 | $strtopic = get_string('topic'); 78 | $strdescription = get_string('blogsummary', 'oublog'); 79 | $strentries = get_string('posts', 'oublog'); 80 | $table = new html_table(); 81 | 82 | if ($course->format == 'weeks') { 83 | $table->head = array ($strweek, $strname, $strdescription, $strentries); 84 | $table->align = array ('center', 'center', 'center', 'center'); 85 | } else if ($course->format == 'topics') { 86 | $table->head = array ($strtopic, $strname, $strdescription, $strentries); 87 | $table->align = array ('center', 'center', 'center', 'center'); 88 | } else { 89 | $table->head = array ($strname, $strdescription, $strentries); 90 | $table->align = array ('center', 'center', 'center'); 91 | } 92 | 93 | $currentsection = ''; 94 | 95 | foreach ($blogs as $blog) { 96 | 97 | $printsection = ''; 98 | 99 | // Calculate the href. 100 | if (!$blog->visible) { 101 | // Show dimmed if the mod is hidden. 102 | $link = "coursemodule\">".format_string($blog->name, true).""; 103 | } else { 104 | // Show normal if the mod is visible. 105 | $link = "coursemodule\">".format_string($blog->name, true).""; 106 | } 107 | 108 | $numposts = isset($counts[$blog->id]) ? $counts[$blog->id]->postcount : 0; 109 | 110 | if ($course->format == 'weeks' || $course->format == 'topics') { 111 | if ($blog->section !== $currentsection) { 112 | if ($blog->section) { 113 | $printsection = $blog->section; 114 | } 115 | if ($currentsection !== '') { 116 | $table->data[] = 'hr'; 117 | } 118 | $currentsection = $blog->section; 119 | } 120 | $row = array ($printsection, $link, format_string($blog->intro, true), $numposts); 121 | 122 | } else { 123 | $row = array ($link, format_string($blog->intro, true), $numposts); 124 | } 125 | 126 | $table->data[] = $row; 127 | } 128 | 129 | echo "
"; 130 | echo html_writer::table($table); 131 | echo $OUTPUT->footer(); -------------------------------------------------------------------------------- /internaldoc/participation.txt: -------------------------------------------------------------------------------- 1 | == OU Blog Participation Feature == 2 | 3 | === Description === 4 | 5 | Display user participation within blogs. 6 | 7 | Participation is defined as: 8 | 9 | * Posts created 10 | * Comments created 11 | 12 | === Capability Requirements === 13 | 14 | A user will be considered to be participating in the blog if the blog is a course blog (not a global blog), 15 | the blog is not a group blog or the user belongs to the current group and the user has access to post 16 | or comment on the blog. 17 | 18 | A user who has the capability '''mod/oublog:viewparticipation''' and has access to the current blog 19 | can view all user participation, subject to the groupmode settings and their membership of those groups. 20 | (A user who has the capability '''moodle/site:accessallgroups''' will be able to see all groups regardless of 21 | personal membership). 22 | 23 | === Participation Page Display === 24 | 25 | The button displayed to the user to access the participation screens will display accordingly. 26 | A user with access to all users participation will see a button labelled '''Participation by user''' 27 | This appears above the topmost blog post visible (below the group selector if applicable). 28 | A user with access to only their participation, will see in the Blog usage panel 29 | '''My participation summary'''. 30 | 31 | 32 | These will allow the user two different views respectively - one showing all participants 33 | and an overview of their participation and one only showing a single users participation but with more detail 34 | for their actual participation. 35 | 36 | If a user has access to all users they can also view detailed information per user via a '''Detail''' 37 | link which appears next to the users full name in the user participation table. 38 | 39 | The participants to display is as follows: 40 | 41 | !Groups 42 | !Is current group member 43 | !mod/oublog:viewparticipation 44 | !moodle/site:accessallgroups 45 | !Visible Participants: 46 | |- 47 | | None 48 | | - 49 | | Allow 50 | | - 51 | | ''All enrolled'' 52 | |- 53 | | None 54 | | - 55 | | - 56 | | - 57 | | ''Own participation only'' 58 | |- 59 | | Visible/Separate 60 | | No 61 | | Allow 62 | | Allow 63 | | ''All enrolled'' 64 | |- 65 | | Visible/Separate 66 | | No 67 | | Allow 68 | | - 69 | | ''No participants'' 70 | |- 71 | | Visible/Separate 72 | | Yes 73 | | Allow 74 | | - 75 | | ''Current group members'' 76 | |- 77 | | Visible/Separate 78 | | Yes 79 | | - 80 | | - 81 | | ''Own participation only'' 82 | |} 83 | 84 | === Back to blog link === 85 | A button (link) reading as "< [blog-name]", where [blog-name] is the name of 86 | the oublog will redirect the user from participation-page or viewpost-page to 87 | the main-blog-page 88 | 89 | === Grading === 90 | 91 | A user with the capability ''mod/oublog:grade'' in relation to the current blog has the ability to add grade values. 92 | This can either be done as a bulk action on the '''Participation by user''' page or as a single update on the more detailed 93 | single user page. 94 | 95 | Grading will only be available if it has been set for the particular blog instance in the 96 | '''OU blog administration''' '''edit''' screen. 97 | -------------------------------------------------------------------------------- /lang/README.txt: -------------------------------------------------------------------------------- 1 | At time of writing only the following lang folders have been updated since 2 | Moodle 2 conversion: 3 | 4 | en 5 | pt_br 6 | 7 | Other folders are the versions from Moodle 1.9, so may partially work but 8 | the help will be missing. 9 | -------------------------------------------------------------------------------- /lang/ca/help/oublog/allowcomments.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |

OU blog

10 |

Comentaris

11 |

Quan escriu una notícia (o l'edita) pot 12 | decidir qui 13 | està autoritzat per a poder afegir comentaris a la seva 14 | notícia.

15 |

Si escull l'opció No, ningú 16 | podrà afegir 17 | comentaris. Això es pot fer en casos especials. com 18 | en el cas d'un lloc polèmic on es podrien crear problemes a 19 | l'entrar en confrontació amb qualsevol altra 20 | secció de 21 | comentaris.

22 |

Si escull l'opció , els 23 | usuaris podran 24 | comentar les notícies si tenen accés al blog i 25 | poden accedir al 26 | sistema. Si el blog el pot veure qualsevol usuari malgrat no estigui 27 | registrat, aquest no podrà afegir comentaris.

28 | 29 | -------------------------------------------------------------------------------- /lang/ca/help/oublog/completion.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |

OU blog

11 |

Opcions de finalització

12 |
    13 |
  • 14 |

    Si escull 15 | “Missatge requerit”, aleshores el blog es 16 | marcarà com a que s'ha completat per a un usuari que ha 17 | realizat el nombre especificat de trameses.

    18 |
  • 19 |
  • 20 |

    Si escull “Comentari requerit”, el 21 | blog quedarà marcat com a completat per l'usuari 22 | una vegada hagi cumplimentat els seus comentaris. Els 23 | comentaris poden estar en el post d'algú mentre 24 | està dins d'aquest bloc.

    25 |
  • 26 |
27 |

28 | Tingueu 29 | en compte que els cursos i els blocs personals són 30 | independents. Correus 31 | i comentaris als blocs personals no compten per als requisits de 32 | finalització d'un bloc del curs.

33 | 34 | -------------------------------------------------------------------------------- /lang/ca/help/oublog/feed.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |

OU blog

11 |

Notícies

12 |

Notificacions automàtiques

13 |

Si vostè utilitza un programa lector de 14 | notícies o un lloc web, es 15 | pot afegir l'URL Atom o RSS per rebre les 16 | actualitzacions dels missatges del blog.

17 |

Una segona opció de notícies poden ser 18 | activades pels 19 | propietaris del blog mitjançant les que es poden llegir els 20 | comentaris 21 | realitzats.

22 |

El 23 | seu curs no requereix l'ús d'aquesta funció. 24 |

25 |

Atom i RSS

26 |

Atom i RSS són dos formats que tenen la mateixa 27 | finalitat. 28 | La 29 | majoria dels lectors de notícies suporten qualsevol dels 30 | dos. Si un d'ells no funciona correctament, haurà de provar 31 | amb l'altre.

32 | 33 | -------------------------------------------------------------------------------- /lang/ca/help/oublog/tags.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |

OU blog

11 |

Etiquetes

12 |

Que són las etiquetes?

13 |

Les etiquetes són paraules 14 | “clau” que poden 15 | utilitzar-se per crear categories en els missatges del blog. 16 | Són 17 | frases senzilles, normalment d'una única paraula malgrat es 18 | poden utilitzar múltiples paraules.

19 |

Vostè introdueix les etiquetes mentre 20 | està editant una 21 | notícia o pot deixar aquest camp en blanc, ja que 22 | no es 23 | obligatori.

24 |

Per exemple: Si està escrivint una 25 | notícia sobre l'escalfament global, es poden utilitzar 26 | etiquetes com: ecologia, 27 | ecosistema, escalfament global, efecte hivernacle.

28 |

Etiquetes múltiples

29 |

Es poden afegir varies etiquetes separades por comes.

30 |

Exemple: ecologia, ecosistema, escalfament 31 | global, efecte hivernacle

32 |

Buscant per etiquetes

33 |

Quan s'utilitzen les etiquetes en els missatges, apareix un 34 | bloc que mostra les etiquetes com hipervincles. Cada 35 | etiqueta ve acompanyada d'un número que indica el 36 | nombre de missatges en el blog que contenen aquesta etiqueta. Si 37 | seleccionem l'hipervincle corresponent, es mostraran els 38 | missatges continguts en aquesta etiqueta.

39 | 40 | -------------------------------------------------------------------------------- /lang/ca/help/oublog/visibility.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

OU blog

9 |

Visibilitat

10 |

Els missatges del blog tenen l'opció de mostrar qui 11 | està autoritzat a llegir-los. Hi ha tres opcions en ordre 12 | creixent d'usuaris autoritzats.

13 |
    14 |
  1. 15 |

    En un blog personal: Visible 16 | únicament pel propietari (privat) – 17 | ningú* podrà veure les notícies.

    18 |

    En un blog d'un curs: Els 19 | participants del curs – Les 20 | notícies seran visibles pels usuaris del curs, en el que 21 | està inclòs el blog, que disposin d'un rol.

    22 |
  2. 23 |
  3. 24 |

    Qualsevol 25 | usuari registrat en el sistema 26 | – 27 | Qualsevol que tingui un compte d'usuari podrà 28 | veure les notícies sense necessitat de disposar d'un rol 29 | específic en el 30 | curs.

    31 |
  4. 32 |
  5. 33 |

    Qualsevol en el món 34 | – Qualsevol usuari d'Internet podrà veure les 35 | notícies si coneix l'adreça web del blog.

    36 |
  6. 37 |
38 |

* Els administradors del sistema tenen accés total 39 | al missatges inclús els que estan marcats com a 40 | “privats”.

41 | 42 | -------------------------------------------------------------------------------- /lang/de/help/oublog/allowcomments.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | - no title specified

OU Blog

Kommentare

Wenn Sie einen Blogeintrag erstellen (oder einen Blog aufbauen) können Sie wählen ob es anderen Leuten erlaubt ist diesem Eintrag Kommentare hinzu zu fügen.

Wenn Sie die Option auf Nein setzen wird niemand kommentieren können. Vielleicht möchten Sie das in ganz speziellen Fällen tun, vielleicht wenn ein umstrittener Beitrag Ärger in einem Kommentarabschnitt hervorrufen sollte.

Wenn Sie die Option auf Ja setzen, können Leute kommentieren, falls sie Zugang zum System und Blog haben. Selbst in Fällen, in denen Internet Nutzer das Blog sehen können ohne sich einloggen zu müssen, ist es ihnen nicht möglich einen Kommentar zu hinterlassen ohne sich einzuloggen.

 

21 | -------------------------------------------------------------------------------- /lang/de/help/oublog/completion.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | - no title specified

OU Blog

Vervollständigungsoptionen

  • •.Wenn Sie 'Einträge erforderlich' wählen, dann wird das Blog als abgeschlossen gekennzeichnet werden für Nutzer sobald sie die entsprechende Anzahl an Einträgen gemacht haben.  

  • •.Wenn Sie 'Kommentare erforderlich' wählen, dann wird das Blog als abgeschlossen gekennzeichnet werden für Nutzer sobald sie die entsprechende Anzahl an Kommentaren gemacht haben. Die Kommentare können in jeglichem Beitrag enthalten sein, solange sie in diesem Blog sind.  

Beachten Sie, dass Kurs und persönliche Blogs separat sind. Beiträge und Kommentare zu persönlichen Blogs haben keinen Einfluss auf Kursblogs.

 

23 | -------------------------------------------------------------------------------- /lang/de/help/oublog/feeds.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | - no title specified

OU Blog

Feeds

Automatische Benachrichtigung

Wenn Sie ein News-Reader-Programm oder eine Website benutzen, können Sie die Internetadresse des Atom oder RSS Links angeben, um auf den neuesten Stand gebracht zu werden wenn neue Beiträge in diesem Blog erstellt wurden.

Wenn es das Blog erlaubt Kommentare gegen individuelle Beiträge abzugeben, sind zusätzliche ‘Nur Kommentare’ Atom und RSS Links möglich. Sie können diese nutzen, um sich auf den neuesten Stand zu bringen, sobald ein neuer Kommentar zu einem der Beiträge in diesem Blog hinzugefügt wurde.

Sie müssen aber dieses Feature nicht nutzen.

Atom und RSS

Atom und RSS sind zwei Formate für die selbe Sache. Das erste ist in technisch besserer Form, das letztere dafür bekannter. Probieren Sie den Atom-Feed, wenn dieser nicht funktionieren sollte, benutzen Sie den RSS-Feed.

 

 

22 | -------------------------------------------------------------------------------- /lang/de/help/oublog/tags.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | - no title specified

OU Blog

Tags

Was sind Tags?

Tags sind kurze Textstücke, die verwendet werden, um Ihre Blog-Beiträge zu kategorisieren. Sie werden im Allgemeinen in Kleinbuchstaben angezeigt. Die meisten Tags bestehen aus einem einzigen Wort, aber Sie können auch mehrere Wörter benutzen, wenn Sie möchten.

Setzen Sie Tags in das Tags Feld wenn Sie einen Beitrag erstellen oder bearbeiten. Tags sind optional, Sie können das Feld auch leer lassen.

Beispiel: Wenn Sie oft über Ihre Katze Fluffy schreiben, möchten Sie vielleicht den Tag Fluffy für diese Beiträge verwenden.

Mehrfach Tags

Sie können Mehrfach Tags in Ihrem Beitrag benutzen indem Sie sie durch Kommata trennen. Dies kann nützlich sein, wenn Ihr Beitrag mehr als ein Thema abdeckt.

Beispiel: Fluffy, Globale Erwärmung

Nach Tags suchen

Wenn Sie Tags in Ihren Beiträgen benutzen, erscheint der Tags Block auf der Hauptseite des Blocks. Dies zeigt alle von Ihnen benutzten Tags. Sie können dann auf einen Tag klicken um alle Stellen zu sehen, die diesen Tag enthalten.

Beispiel: ein Leser, der an globaler Erwärmung interessiert ist, mag den Globale Erwärmung Tag anklicken so dass er all die Stellen über globale Erwärmung liest, ohne zu viele Beiträge über Ihre Katze lesen zu müssen.

 

 

 

23 | -------------------------------------------------------------------------------- /lang/de/help/oublog/visibility.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | - no title specified

OU Blog

Sichtbarkeit

Blog-Beiträge haben eine Option, die steuert, wer die Beiträge sehen darf. Es gibt bis zu drei Möglichkeiten in aufsteigender Reihenfolge die Sichtbarkeit zu erlauben. Die erste Möglichkeit ist, dass ein persönliches Blog anders ist als das in einem Kurs.

  1. 1.In einem persönlichen Blog: Sichtbar nur für den Blogbesitzer (privat) – niemand* anderes kann diesen Beitrag sehen. 

    In einem Kurs Blog: Sichtbar für Teilnehmer des Kurses – um den Beitrag sehen zu können, müssen Sie Zugang zu dem Blog haben, normalerweise indem Sie in den Kurs eingeschrieben sind, in dem dieses Blog enthalten ist. 

  2. 2.Sichtbar für jedermann, der in das System eingeloggt ist – jedermann, der eingeloggt ist, kann den Beitrag sehen, selbst ohne Einschreibung in einen bestimmten Kurs.  

  3. 3.Sichtbar für jedermann weltweit – jeder Internet Nutzer kann den Beitrag sehen, wenn Sie die Blogadresse veröffentlichen.  

Diese Option besteht für das komplette Blog wie auch für individuelle Beiträge. Wenn die Option für das ganze Blog gesetzt ist, ist sie vorrangig. Zum Beispiel, wenn das ganze Blog auf die erste Stufe gesetzt wird, können Sie nicht die Stufen der individuellen Beiträge verändern.

* Systemadministratoren haben Zugriff zu allen gespeicherten Daten dieses speziellen EDV-Systems einschließlich der als 'privat' markierten Beiträge.

 

25 | -------------------------------------------------------------------------------- /lang/es/help/oublog/allowcomments.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

OU blog

13 |

Comentarios

14 |

Cuando escribes una noticia (o la editas) puedes decidir quiénes 15 | están autorizados para poder añadir comentarios a tu 16 | noticia.

17 |

Si se elige la opción No, nadie podrá añadir 18 | comentarios. Esto lo debes hacer en casos especiales. such as if a 19 | controversial post might cause trouble to erupt in any comments 20 | section.

21 |

Si se elige la opción Sí, los usuarios pueden 22 | comentar las noticias si tienen acceso al blog y pueden acceder al 23 | sistema. Si el blog lo puede ver cualquier usuario aunque no esté 24 | registrado, éste no podrá añadir comentarios.

25 | 26 | 27 | -------------------------------------------------------------------------------- /lang/es/help/oublog/completion.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

OU blog

13 |

Opciones Completion

14 |
    15 |
  • Si se elige “Mensaje 16 | requerido”, entonces el blog se marcará como que se ha 17 | completado para un usuario que ha realizado el número 18 | especificado de envíos. 19 |

    20 |
  • Si se elige “Comenario requerido”, el blog 21 | quedará marcado como completado para el usuario una vez que 22 | haya cumplimentado sus comenarios. The comments can be on anyone's 23 | post as long as it is within this blog. 24 |

    25 |
26 |

Note that course and personal blogs are separate. Posts and 27 | comments to personal blogs don't count toward completion requirements 28 | for a course blog. 29 |

30 | 31 | 32 | -------------------------------------------------------------------------------- /lang/es/help/oublog/feed.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

OU blog

13 |

Noticias

14 |

Notificaciones automáticas

15 |

Si usted utiliza un programa lector de noticias o un sitio web, se 16 | puede añadir la dirección Atom o RSS para recibir las 17 | actualizaciones de los mensajes del blog. 18 |

19 |

Una segunda opción de noticias pueden ser activadas por los 20 | propietarios del blog mediante las que se pueden leer los comentarios 21 | realizados. 22 |

23 |

Your course doesn't require you to use this feature. 24 |

25 |

Atom y RSS

26 |

Atom and RSS son dos formatos que tienen la misma finalidad. La 27 | mayoría de los lectores de noticias soportan cualquiera de los 28 | dos. Si uno de ellos no funciona correctamente, habrá que 29 | intentarlo con el otro. 30 |

31 | 32 | 33 | -------------------------------------------------------------------------------- /lang/es/help/oublog/tags.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moodleou/moodle-mod_oublog/892713e2fc31b4b0a6f1ae0dac41207cb568692a/lang/es/help/oublog/tags.html -------------------------------------------------------------------------------- /lang/es/help/oublog/visibility.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

OU blog

13 |

Visibilidad

14 |

Los mensaje del blog contienen la opción de mostrar quiénes 15 | están autorizados a leerlos. Hay tres opciones en orden 16 | creciente de usuarios autorizados.

17 |
    18 |
  1. En un blog personal: Visible únicamente 19 | por el propietario (privado) – nadie* podrá 20 | ver las noticias.

    21 |

    En un blog de un curso: Los miembros de este 22 | curso – Las noticias serán visibles para los 23 | usuarios del curso en el que está incluido el blog que 24 | dispongan de algún rol.

    25 |
  2. Cualquier usuario 26 | registrado del sistema – Cualquiera que tenga una 27 | cuenta de usuario podrá ver los post sin necesidad de 28 | disponer de un rol en el curso específico. 29 |

    30 |
  3. Cualquier en el mundo – Cualquier 31 | usuario de internet podrá ver las noticias si conoce la 32 | dirección url del blog. 33 |

    34 |
35 |

* Los administradores del sistema tienen acceso total a los 36 | mensajes incluidos los que estén marcados como “privados”.

37 | 38 | 39 | -------------------------------------------------------------------------------- /lang/es/oublog.php: -------------------------------------------------------------------------------- 1 | editby}, {$a->editdate}'; 39 | $string['editonsummary'] = 'Editado {$a->editdate}'; 40 | 41 | $string['edit'] = 'Editar'; 42 | $string['delete'] = 'Borrar'; 43 | 44 | $string['olderposts'] = '< Mensajes antiguos'; 45 | $string['newerposts'] = 'Mensaje recientes >'; 46 | $string['extranavolderposts'] = 'Mensajes antiguos: {$a->from}-{$a->to}'; 47 | $string['extranavtag'] = 'Filtrar: {$a}'; 48 | 49 | $string['comments'] = 'Comentarios'; 50 | $string['ncomments'] = '{$a} comments'; 51 | $string['1comment'] = '1 comentario'; 52 | $string['comment'] = 'Comenta esta noticia'; 53 | $string['lastcomment'] = '(Último comentario por {$a->fullname}, {$a->timeposted})'; 54 | $string['addcomment'] = 'Publicar comentario'; 55 | 56 | $string['confirmdeletepost'] = '¿Seguro que quieres eliminar este mensaje?'; 57 | $string['confirmdeletecomment'] = '¿Seguro que quieres eliminar este comentario?'; 58 | $string['confirmdeletelink'] = '¿Seguro de querer eliminar este enlace?'; 59 | 60 | $string['viewedit'] = 'Ver edición'; 61 | $string['views'] = 'Visitas a este blog:'; 62 | 63 | $string['addlink'] = 'Nuevo enlace'; 64 | $string['links'] = 'Enlaces relacionados'; 65 | 66 | $string['subscribefeed'] = 'Suscribir a las noticias (requiere el software apropiado) para recibir notificaciones cuando este blog se actualice. '; 67 | $string['feeds'] = 'Noticias'; 68 | $string['filter'] = 'Filtrar:'; 69 | $string['filter-tooltip'] = 'Haga clic para eliminar la etiqueta de filtro'; 70 | $string['blogfeed'] = 'Noticias de blog'; 71 | $string['commentsfeed'] = 'Solo comentarios'; 72 | $string['atom'] = 'Atom'; 73 | $string['rss'] = 'RSS'; 74 | $string['atomfeed'] = 'Atom feed'; 75 | $string['rssfeed'] = 'RSS feed'; 76 | 77 | $string['newblogposts'] = 'Nuevos mensajes de blog'; 78 | 79 | $string['blogsummary'] = 'Resumen de blog'; 80 | $string['posts'] = 'Mensajes'; 81 | 82 | $string['defaultpersonalblogname'] = '{$a}\'s blog'; 83 | 84 | $string['numposts'] = '{$a} posts'; 85 | 86 | $string['noblogposts'] = 'No hay mensajes de blog'; 87 | 88 | $string['blogoptions'] = 'Opciones de blog'; 89 | 90 | $string['postedby'] = 'por {$a}'; 91 | 92 | $string['deletedby'] = 'Eliminado por {$a->fullname}, {$a->timedeleted}'; 93 | 94 | $string['newcomment'] = 'Nuevo comentario'; 95 | 96 | $string['searchthisblog'] = 'Buscar en el blog'; 97 | 98 | $string['url']='Dirección web completa'; 99 | 100 | $string['bloginfo']='Información del blog'; 101 | 102 | $string['feedhelp']='Noticias'; 103 | 104 | $string['unsupportedbrowser']='

Tu navegador no puede mostrar noticias Atom o RSS directamente.

105 |

Feeds are most useful in separate computer programs or websites. If you want 106 | to use this feed in such a program, copy and paste the address from your browser\'s 107 | address bar.

'; 108 | 109 | $string['completionpostsgroup']='Se requiere mensaje'; 110 | $string['completionposts']='El usuario puede crear noticias:'; 111 | $string['completionpostshelp']='Se requiere noticia para completar'; 112 | $string['completioncommentsgroup']='Se requiere comentario'; 113 | $string['completioncomments']='El usuario puede hacer comentarios a las noticias:'; 114 | $string['completioncommentshelp']='Se requiere comentario para completar'; 115 | 116 | $string['maybehiddenposts']='Este blog contiene mensajes que Únicamente son visibles para los usuarios inscritos. Si usted tiene una cuenta de usuario, por favor acceda para poder verlos.'; 117 | $string['noposts']='No hay mensajes visibles en este blog.'; 118 | -------------------------------------------------------------------------------- /lang/ja/help/oublog/allowcomments.html: -------------------------------------------------------------------------------- 1 |

OU blog

2 | 3 |

コメント

4 | 5 |

ブログ記事を作成する場合 (またはブログをセットアップする場合)、あなたは、他のユーザがその記事にコメントを追加できるかどうか、設定することができます。

6 | 7 |

あなたがオプションを「No」にした場合、誰もコメントを追加することはできません。議論を巻き起こすような投稿により、コメントセクションでトラブルが噴出しそうな場合等、特別なケースに対して、あなたはこのオプションを「No」にすることができます。

8 | 9 |

あなたがオプションを「Yes」にした場合、システムにログインしてブログを閲覧できるユーザがコメントを投稿できることを意味します。インターネットユーザがログインなしにブログを閲覧できる場合でも、ログインなしにコメントを残すことはできません。

10 | -------------------------------------------------------------------------------- /lang/ja/help/oublog/completion.html: -------------------------------------------------------------------------------- 1 |

OU blog

2 | 3 |

完了オプション

4 | 5 |
    6 |
  • 7 | あなたが「記事を必須とする」を選択した場合、ユーザが指定された記事数を投稿することで、完了がマークされます。 8 |
  • 9 | 10 |
  • 11 | あなたが「コメントを必須とする」を選択した場合、ユーザが指定されたコメント数を投稿することで、完了がマークされます。このブログ内である限り、誰の記事に対してもコメントすることができます。 12 |
  • 13 |
14 | 15 |

16 | コースおよびパーソナルブログは、分けて考えられることに留意してください。パーソナルブログの記事およびコメントは、コースブログに要求される完了条件としてカウントされません。 17 |

18 | -------------------------------------------------------------------------------- /lang/ja/help/oublog/feed.html: -------------------------------------------------------------------------------- 1 |

OU blog

2 | 3 |

フィード

4 | 5 |

自動通知

6 | 7 |

8 | あなたがニュースリーダープログラムまたはウェブサイトを使用する場合、このブログへの新しい記事の作成を通知するため、AtomまたはRSSのURIを追加することができます。 9 |

10 |

11 | それぞれの記事に対して、ブログがコメントを許可する場合、「コメントのみ」のAtomまたはRSSリンクを利用することができます。あなたは、「コメントのみ」のAtomまたはRSSリンクを、このブログすべての記事に対して追加された新しいコメントの閲覧に使用することができます。 12 |

13 |

14 | あなたのコースは、あなたに対して、この機能の使用を強制することはありません。 15 |

16 |

AtomおよびRSS

17 |

18 | AtomおよびRSSは、同じ内容に対する2つのフォーマットです。前者は技術的に優れたフォーマットです。後者は良く知られたフォーマットです。ほとんどのニュースリーダーでは、両方のフォーマットをサポートします。まずは、Atomリンクをお試しください。Atomリンクが動作しない場合、RSSをお試しください. 19 |

20 | -------------------------------------------------------------------------------- /lang/ja/help/oublog/tags.html: -------------------------------------------------------------------------------- 1 |

OU blog

2 | 3 |

タグ

4 | 5 |

タグとは?

6 | 7 |

タグは、あなたのブログ記事を分類するための短いテキストです。タグは、一般的に半角英数字の小文字で表示されます。ほとんどのタグは、単一の言葉ですが、あなたは任意で複数の言葉を使用することもできます。

8 | 9 |

記事を編集する場合、あなたは「タグ」ボックスにタグを入力します。タグの入力は任意です。ですから、「タグ」ボックスを空白のままにすることもできます。

10 | 11 |

例: あなたの猫がフワフワしていることに関して、頻繁に記事を書いている場合、「フワフワ」というタグをそれらの記事に使っても良いでしょう。

12 | 13 |

複数タグ

14 | 15 |

カンマで区切ることにより、あなたは、複数のタグを記事に含むことができます。これは、あなたの記事が複数の話題をカバーする場合に有用です。

16 | 17 |

例: フワフワ, 地球温暖化

18 | 19 |

タグを検索する

20 | 21 |

あなたが記事にタグを使用する場合、メインページのブロックに「タグ」ブロックが表示されます。ここでは、あなたが使用したタグすべてが表示されます。あなたは、タグをクリックして、そのタグが含まれる記事すべてを表示することができます。

22 | 23 |

例: 地球温暖化に興味のある閲覧者は、「地球温暖化」タグをクリックすることで、あなたのブログ内にある猫に関する多くの記事を閲覧せずに、地球温暖化に関する記事のみを閲覧することができます。

24 | -------------------------------------------------------------------------------- /lang/ja/help/oublog/visibility.html: -------------------------------------------------------------------------------- 1 |

OU blog

2 | 3 |

最大可視性

4 | 5 |

ブログ記事には、誰が記事を閲覧できるかコントロールするオプションがあります。可視性の順序に関して、3つの選択肢があります。最初の選択肢は、パーソナルブログおよびコースブログにおいて異なります。

6 | 7 |
    8 |
  1. 9 |

    パーソナルブログ: ブログオーナー (プライベート) のみ閲覧することができます。 – 他のユーザ*は、このブログを閲覧することはできません。

    10 |

    コースブログ: このコースの参加者が閲覧することができます。 – この記事を閲覧するには、あなたは、ブログにアクセスできる権限を持つ必要があります。通常、コースに受講登録することで、この権限が与えられます。

    11 |
  2. 12 |
  3. システムにログインしている誰でも閲覧できる – たとえ特定のコースに受講登録していないとしても、システムにログインした誰でも記事を閲覧することができます。
  4. 13 |
  5. 世界中の誰でも閲覧できる – あなたがブログアドレスを伝えた場合、インターネットユーザが、この記事を閲覧することができます。
  6. 14 |
15 | 16 |

このオプションは、それぞれの記事と同様にブログ全体にも存在します。オプションがブログ全体に設定された場合、その設定が最大となります。例えば、ブログ全体に最初のレベルが設定された場合、あなたは、それぞれの記事のレベルを変更することはできません。

17 | 18 |

* システム管理者は、「プライベート」にマークされたブログ記事を含む、このコンピュータシステムに保存された、すべてのデータにアクセスすることができます。

19 | -------------------------------------------------------------------------------- /lang/ja/oublog.php: -------------------------------------------------------------------------------- 1 | fullname} - 削除日時: {$a->timedeleted}'; 30 | $string['edit'] = '編集'; 31 | $string['editonsummary'] = '編集日時: {$a->editdate}'; 32 | $string['editpost'] = 'ブログ記事を更新する'; 33 | $string['editsummary'] = '編集者: {$a->editby} - 編集日時: {$a->editdate}'; 34 | $string['extranavolderposts'] = '古い記事: {$a->from}-{$a->to}'; 35 | $string['extranavtag'] = 'フィルター: {$a}'; 36 | $string['feedhelp'] = 'フィード'; 37 | $string['feeds'] = 'フィード'; 38 | $string['filter'] = 'フィルター:'; 39 | $string['filter-tooltip'] = 'クリックしてフィルタータグを削除'; 40 | $string['guestblog'] = 'あなたがシステムにアカウントを登録している場合、ブログにフルアクセスするには、ログインしてください。'; 41 | $string['lastcomment'] = '(最終コメント by {$a->fullname} - {$a->timeposted})'; 42 | $string['links'] = '関連リンク'; 43 | $string['maxvisibility'] = '最大可視性'; 44 | $string['maybehiddenposts'] = 'このブログには、ログインユーザのみ閲覧できる記事が含まれています。あなたがシステムにアカウントを登録している場合、ブログにフルアクセスするには、ログインしてください。'; 45 | $string['message'] = 'メッセージ'; 46 | $string['modulename'] = 'OU blog'; 47 | $string['modulenameplural'] = 'OU blog'; 48 | $string['ncomments'] = '{$a} コメント'; 49 | $string['newblogposts'] = '新しいブログ記事'; 50 | $string['newcomment'] = '新しいブログコメント'; 51 | $string['newerposts'] = '新しい記事 >'; 52 | $string['newpost'] = '新しいブログ記事'; 53 | $string['no'] = 'No'; 54 | $string['noblogposts'] = 'ブログ記事はありません。'; 55 | $string['nocomments'] = 'コメントを許可しない'; 56 | $string['noposts'] = 'このブログには、表示できる記事はありません。'; 57 | $string['numposts'] = '{$a} 記事'; 58 | $string['olderposts'] = '< 古い記事'; 59 | $string['oublog'] = 'OU blog'; 60 | $string['oublog:audit'] = '削除記事および古いバージョンを閲覧する'; 61 | $string['oublog:comment'] = '記事にコメントする'; 62 | $string['oublog:contributepersonal'] = 'パーソナルブログの記事およびコメント'; 63 | $string['oublog:managecomments'] = 'コメントを管理する'; 64 | $string['oublog:managelinks'] = 'リンクを管理する'; 65 | $string['oublog:manageposts'] = '記事を管理する'; 66 | $string['oublog:post'] = '新しい記事を作成する'; 67 | $string['oublog:view'] = '記事を表示する'; 68 | $string['oublog:viewpersonal'] = 'パーソナルブログの記事を閲覧する'; 69 | $string['overviewnumentrylog'] = '最終ログイン以降のエントリ'; 70 | $string['overviewnumentrylog1'] = '最終ログイン以降のエントリ'; 71 | $string['overviewnumentryvw'] = '最終閲覧以降のエントリ'; 72 | $string['overviewnumentryvw1'] = '最終閲覧以降のエントリ'; 73 | $string['postedby'] = 'by {$a}'; 74 | $string['posts'] = '記事'; 75 | $string['rss'] = 'RSS'; 76 | $string['rssfeed'] = 'RSSフィード'; 77 | $string['searchthisblog'] = 'このブログを検索する'; 78 | $string['siteentries'] = 'サイトエントリを表示する'; 79 | $string['subscribefeed'] = 'このブログが更新された場合、通知を受け取るには、フィードを購読登録してください (適切なソフトウェアが必要です)。'; 80 | $string['summary'] = '要約'; 81 | $string['tags'] = 'タグ'; 82 | $string['tagsfield'] = 'タグ (カンマ区切り)'; 83 | $string['title'] = 'タイトル'; 84 | $string['unsupportedbrowser'] = '

あなたのブラウザでは、AtomまたはRSSフィードを直接表示できません。

85 |

フィードは、離れたコンピュータプログラムまたはウェブサイトに最も有用です。あなたがそのようなプログラムを使用して、このフィードを利用したい場合、あなたのブラウザのアドレスバーにURIをコピーおよび貼り付けしてください。

'; 86 | $string['url'] = '完全なウェブアドレス'; 87 | $string['viewedit'] = '編集を表示する'; 88 | $string['views'] = 'このブログへの合計アクセス数:'; 89 | $string['visibility'] = '誰がこの記事を閲覧できますか?'; 90 | $string['visibleblogusers'] = 'このブログのメンバーのみ閲覧できる'; 91 | $string['visiblecourseusers'] = 'このコースの参加者が閲覧できる'; 92 | $string['visibleloggedinusers'] = 'システムにログインしている誰でも閲覧できる'; 93 | $string['visiblepublic'] = '世界中の誰でも閲覧できる'; 94 | $string['visibleyou'] = 'ブログオーナーのみ閲覧できる (プライベート)'; 95 | $string['yes'] = 'Yes'; 96 | -------------------------------------------------------------------------------- /link_form.php: -------------------------------------------------------------------------------- 1 | . 16 | require_once($CFG->libdir.'/formslib.php'); 17 | 18 | class mod_oublog_link_form extends moodleform { 19 | 20 | public function definition() { 21 | 22 | global $CFG; 23 | $edit = $this->_customdata['edit']; 24 | $cmid = $this->_customdata['cmid']; 25 | 26 | $mform =& $this->_form; 27 | 28 | $mform->addElement('header', 'general', ''); 29 | 30 | $mform->addElement('text', 'title', get_string('title', 'oublog'), 'size="48"'); 31 | $mform->setType('title', PARAM_TEXT); 32 | $mform->addRule('title', null, 'required', null, 'client'); 33 | 34 | $mform->addElement('text', 'url', get_string('url', 'oublog'), 'size="48"'); 35 | $mform->setType('url', PARAM_URL); 36 | $mform->addRule('url', null, 'required', null, 'client'); 37 | 38 | if ($edit) { 39 | $submitstring = get_string('savechanges'); 40 | } else { 41 | $submitstring = get_string('addlink', 'oublog'); 42 | } 43 | 44 | $this->add_action_buttons(true, $submitstring); 45 | 46 | // Hidden form vars. 47 | $mform->addElement('hidden', 'blog'); 48 | $mform->setType('blog', PARAM_INT); 49 | 50 | $mform->addElement('hidden', 'bloginstance'); 51 | $mform->setType('bloginstance', PARAM_INT); 52 | 53 | $mform->addElement('hidden', 'link'); 54 | $mform->setType('link', PARAM_INT); 55 | 56 | $mform->addElement('hidden', 'cmid', $cmid); 57 | $mform->setType('cmid', PARAM_INT); 58 | 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /movelink.php: -------------------------------------------------------------------------------- 1 | . 16 | /** 17 | * This page allows a user to change a links position in the list 18 | * 19 | * @author Matt Clarkson 20 | * @package oublog 21 | */ 22 | 23 | require_once("../../config.php"); 24 | require_once("locallib.php"); 25 | 26 | $link = required_param('link', PARAM_INT); 27 | $down = required_param('down', PARAM_INT); 28 | $returnurl = required_param('returnurl', PARAM_RAW); 29 | 30 | if (!$link = $DB->get_record('oublog_links', array('id'=>$link))) { 31 | throw new moodle_exception('invalidlink', 'oublog'); 32 | } 33 | if (!$oublog = $DB->get_record("oublog", array("id"=>$link->oublogid))) { 34 | throw new moodle_exception('invalidblog', 'oublog'); 35 | } 36 | if (!$cm = get_coursemodule_from_instance('oublog', $link->oublogid)) { 37 | throw new moodle_exception('invalidcoursemodule'); 38 | } 39 | 40 | require_sesskey(); 41 | 42 | $context = context_module::instance($cm->id); 43 | 44 | $oubloginstance = $link->oubloginstancesid ? $DB->get_record('oublog_instances', array('id'=>$link->oubloginstancesid)) : null; 45 | oublog_require_userblog_permission('mod/oublog:managelinks', $oublog, $oubloginstance, $context); 46 | 47 | $params = array(); 48 | if ($oublog->global) { 49 | $where = "oubloginstancesid = ? "; 50 | $params[] = $link->oubloginstancesid; 51 | } else { 52 | $where = "oublogid = ? "; 53 | $params[] = $link->oublogid; 54 | } 55 | 56 | // Get the max sort order 57 | $maxsortorder = $DB->get_field_sql("SELECT MAX(sortorder) FROM {oublog_links} WHERE $where", $params); 58 | 59 | if ($down == 1) { // Move link down 60 | if ($link->sortorder != $maxsortorder) { 61 | $sql = "UPDATE {oublog_links} SET sortorder = ? 62 | WHERE $where AND sortorder = ?"; 63 | 64 | $DB->execute($sql, array_merge(array($link->sortorder), $params, array($link->sortorder+1))); 65 | 66 | $sql = "UPDATE {oublog_links} SET sortorder = ? 67 | WHERE id = ? "; 68 | 69 | $DB->execute($sql, array($link->sortorder+1, $link->id)); 70 | } 71 | } else { // Move link up 72 | if ($link->sortorder != 1) { 73 | $sql = "UPDATE {oublog_links} SET sortorder = ? 74 | WHERE $where AND sortorder = ?"; 75 | 76 | $DB->execute($sql, array_merge(array($link->sortorder), $params, array($link->sortorder-1))); 77 | 78 | $sql = "UPDATE {oublog_links} SET sortorder = ? 79 | WHERE id = ? "; 80 | 81 | $DB->execute($sql, array($link->sortorder-1, $link->id)); 82 | } 83 | } 84 | 85 | redirect($returnurl); 86 | -------------------------------------------------------------------------------- /pix/close_button_rgb_30px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /pix/export_logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 14 | 16 | 17 | 18 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /pix/monologo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /pix/tick.svg: -------------------------------------------------------------------------------- 1 | 3 | ]> -------------------------------------------------------------------------------- /pluginfile.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * A script to serve files from OU Blog client ONLY 19 | * Used so can apply restrictions on core pluginfile, but leave this open to world 20 | * 21 | * @package mod 22 | * @subpackage oublog 23 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 24 | */ 25 | 26 | require_once('../../config.php'); 27 | require_once($CFG->dirroot . '/lib/filelib.php'); 28 | 29 | $relativepath = get_file_argument(); 30 | 31 | // Relative path must start with '/'. 32 | if (!$relativepath) { 33 | throw new moodle_exception('invalidargorconf'); 34 | } else if ($relativepath[0] != '/') { 35 | throw new moodle_exception('pathdoesnotstartslash'); 36 | } 37 | 38 | // Extract relative path components. 39 | $args = explode('/', ltrim($relativepath, '/')); 40 | 41 | if (count($args) == 0) { // Always at least user id. 42 | throw new moodle_exception('invalidarguments'); 43 | } 44 | $contextid = (int)array_shift($args); 45 | $component = array_shift($args); 46 | $filearea = array_shift($args); 47 | $draftid = (int)array_shift($args); 48 | 49 | if ($component !== 'mod_oublog' && ($filearea !== 'message' || $filearea !== 'attachment' 50 | || $filearea !== 'messagecomment' || $filearea !== 'summary')) { 51 | send_file_not_found(); 52 | } 53 | // Following code must match root pluginfile.php (can't include, so must duplicate). 54 | $forcedownload = optional_param('forcedownload', 0, PARAM_BOOL); 55 | $preview = optional_param('preview', null, PARAM_ALPHANUM); 56 | 57 | file_pluginfile($relativepath, $forcedownload, $preview); 58 | -------------------------------------------------------------------------------- /savegrades.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * Page for saving grades for all or one user participation 19 | * 20 | * @package mod 21 | * @subpackage oublog 22 | * @copyright 2011 The Open University 23 | * @author Stacey Walker 24 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 25 | */ 26 | 27 | require_once(dirname(__FILE__) . '/../../config.php'); 28 | require_once($CFG->dirroot.'/mod/oublog/locallib.php'); 29 | 30 | $id = required_param('id', PARAM_INT); // Course Module ID 31 | $groupid = optional_param('group', 0, PARAM_INT); 32 | $userid = optional_param('user', 0, PARAM_INT); 33 | 34 | $params = array(); 35 | $params['id'] = $id; 36 | $params['group'] = $groupid; 37 | $url = new moodle_url('/mod/oublog/savegrades.php'); 38 | if ($id) { 39 | $cm = get_coursemodule_from_id('oublog', $id, 0, false, MUST_EXIST); 40 | $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST); 41 | $oublog = $DB->get_record('oublog', array('id' => $cm->instance), '*', MUST_EXIST); 42 | 43 | $PAGE->set_cm($cm); 44 | } 45 | $context = context_module::instance($cm->id); 46 | require_course_login($course, true, $cm); 47 | require_sesskey(); 48 | 49 | // participation capability check 50 | $canview = oublog_can_view_participation($course, $oublog, $cm, $groupid); 51 | if ($canview != OUBLOG_USER_PARTICIPATION) { 52 | throw new moodle_exception('nopermissiontoshow'); 53 | } 54 | 55 | // grading capability check 56 | if (!oublog_can_grade($course, $oublog, $cm, $groupid)) { 57 | throw new moodle_exception('nopermissiontoshow'); 58 | } 59 | 60 | $mode = ''; 61 | if (!empty($_POST['menu'])) { 62 | $gradeinfo = $_POST['menu']; 63 | $oldgrades = oublog_get_participation($oublog, $context, $groupid, $cm, $course); 64 | } else if ($userid && !empty($_POST['grade'])) { 65 | $gradeinfo[$userid] = $_POST['grade']; 66 | $user = oublog_get_user_participation($oublog, $context, $userid, $groupid, $cm, $course); 67 | $oldgrades = array($userid => $user); 68 | } 69 | 70 | // Update grades. 71 | if (!empty($gradeinfo)) { 72 | oublog_update_manual_grades($gradeinfo, $oldgrades, $cm, $oublog, $course); 73 | } 74 | 75 | // redirect 76 | redirect('participation.php?id=' . $id . '&group=' . $groupid); 77 | -------------------------------------------------------------------------------- /settings.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | // Dodgy hack to setup the global blog instance (section not created yet on install). 18 | if (!isset($CFG->oublogsetup)) { 19 | if ($pbcm = get_coursemodule_from_instance('oublog', 1 , SITEID, 1)) { 20 | $task = new \mod_oublog\task\settings_task(); 21 | \core\task\manager::queue_adhoc_task($task, true); 22 | } 23 | set_config('oublogsetup', true); 24 | } 25 | 26 | $plugin = new stdClass(); 27 | require($CFG->dirroot . '/mod/oublog/version.php'); 28 | $settings->add(new admin_setting_heading('oublog_version', '', 29 | get_string('displayversion', 'oublog', $plugin->release))); 30 | 31 | if (isset($CFG->maxbytes)) { 32 | // Default maximum size for attachments allowed per post per oublog. 33 | $settings->add(new admin_setting_configselect('mod_oublog/maxbytes', 34 | get_string('maxattachmentsize', 'oublog'), 35 | get_string('configmaxbytes', 'oublog'), 512000, get_max_upload_sizes($CFG->maxbytes))); 36 | } 37 | 38 | // Default number of attachments allowed per post in all oublogs. 39 | $settings->add(new admin_setting_configtext('mod_oublog/maxattachments', 40 | get_string('maxattachments', 'oublog'), 41 | get_string('configmaxattachments', 'oublog'), 9, PARAM_INT)); 42 | 43 | $settings->add(new admin_setting_configcheckbox('oublogallpostslogin', 44 | get_string('oublogallpostslogin', 'oublog'), get_string('oublogallpostslogin_desc', 'oublog'), 1)); 45 | 46 | $settings->add(new admin_setting_configtext('mod_oublog/globalusageexclude', 47 | get_string('globalusageexclude', 'oublog'), get_string('globalusageexclude_desc', 'oublog'), '')); 48 | 49 | $settings->add(new admin_setting_configtext('mod_oublog/remoteserver', 50 | get_string('remoteserver', 'oublog'), 51 | get_string('configremoteserver', 'oublog'), '', PARAM_URL)); 52 | $settings->add(new admin_setting_configtext('mod_oublog/remotetoken', 53 | get_string('remotetoken', 'oublog'), 54 | get_string('configremotetoken', 'oublog'), '', PARAM_ALPHANUM)); 55 | 56 | $settings->add(new admin_setting_configcheckbox('mod_oublog/savecheck', 57 | get_string('savecheck', 'oublog'), 58 | get_string('savecheck_desc', 'oublog'), 1)); 59 | -------------------------------------------------------------------------------- /stats_update.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * Called via ajax when updating blog stats. 19 | * cmid (id param) must be sent unless a personal blog page. 20 | * 21 | * @package mod 22 | * @subpackage oublog 23 | * @copyright 2013 The open University 24 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 25 | */ 26 | 27 | define('AJAX_SCRIPT', true); 28 | header('Content-Type: application/json'); 29 | require_once(dirname(__FILE__) . '/../../config.php'); 30 | require_once($CFG->dirroot . '/mod/oublog/locallib.php'); 31 | 32 | require_sesskey(); 33 | $type = required_param('type', PARAM_ALPHA); 34 | $id = optional_param('id', 0, PARAM_INT); 35 | $currentcmid = optional_param('currentcmid', 0, PARAM_INT); 36 | 37 | if ($id) { 38 | // Load efficiently (and with full $cm data) using get_fast_modinfo. 39 | $course = $DB->get_record_select('course', 40 | 'id = (SELECT course FROM {course_modules} WHERE id = ?)', array($id), 41 | '*', MUST_EXIST); 42 | 43 | $modinfo = get_fast_modinfo($course); 44 | $cm = $modinfo->get_cm($id); 45 | if ($cm->modname !== 'oublog') { 46 | throw new moodle_exception('invalidcoursemodule'); 47 | } 48 | 49 | if (!$oublog = $DB->get_record('oublog', array('id' => $cm->instance))) { 50 | throw new moodle_exception('invalidcoursemodule'); 51 | } 52 | } else { 53 | // Global personal blog. 54 | if (!$oublog = $DB->get_record('oublog', array('global' => 1))) { 55 | throw new moodle_exception('personalblognotsetup', 'oublog'); 56 | } 57 | 58 | if (!$cm = get_coursemodule_from_instance('oublog', $oublog->id)) { 59 | throw new moodle_exception('invalidcoursemodule'); 60 | } 61 | $masterblog = null; 62 | $cmmaster = null; 63 | } 64 | $childdata = oublog_get_blog_data_base_on_cmid_of_childblog($currentcmid, $oublog); 65 | 66 | $currentoublog = $oublog; 67 | $currentcontext = context_module::instance($cm->id); 68 | $currentcm = $cm; 69 | $childblog = null; 70 | $childcm = null; 71 | if (!empty($childdata)) { 72 | $currentoublog = $childdata['ousharedblog']; 73 | $currentcontext = $childdata['context']; 74 | $currentcm = $childdata['cm']; 75 | $childblog = $oublog; 76 | $childcm = $cm; 77 | } 78 | 79 | oublog_check_view_permissions($currentoublog, $currentcontext, $currentcm); 80 | 81 | $func = "oublog_stats_output_$type"; 82 | 83 | if (function_exists($func)) { 84 | echo json_encode($func($currentoublog, $currentcm, null, true, $childblog, $childcm)); 85 | } 86 | -------------------------------------------------------------------------------- /templates/modal.mustache: -------------------------------------------------------------------------------- 1 | {{! 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 . 16 | }} 17 | {{! 18 | @template mod_oublog/modal 19 | 20 | Moodle modal template with delete, deleteandmail and cancel buttons. 21 | 22 | The purpose of this template is to render a modal. 23 | 24 | Classes required for JS: 25 | * none 26 | 27 | Data attributes required for JS: 28 | * none 29 | 30 | Context variables required for this template: 31 | * title A cleaned string (use clean_text()) to display. 32 | * body HTML content for the boday 33 | 34 | Example context (json): 35 | { 36 | "content": "Example content" 37 | } 38 | }} 39 | 40 | {{< core/modal }} 41 | {{$classes}}oublog-delete-modal{{/classes}} 42 | {{$title}} 43 | {{#str}} confirm, moodle {{/str}} 44 | {{/title}} 45 | 46 | {{$body}} 47 | {{content}} 48 | {{/body}} 49 | 50 | {{$footer}} 51 | 52 | 53 | 54 | {{/footer}} 55 | {{/ core/modal }} 56 | -------------------------------------------------------------------------------- /tests/behat/rate_individuals.feature: -------------------------------------------------------------------------------- 1 | @ou @ou_vle @mod @mod_oublog @oublog_rate 2 | Feature: Test rate individual posts 3 | In order to provide student grades 4 | As a teacher 5 | I need to be able to set ratings on individual posts 6 | 7 | Background: 8 | Given the following "users" exist: 9 | | username | firstname | lastname | email | 10 | | teacher1 | Teacher | 1 | teacher1@asd.com | 11 | | student1 | Student1 | 1 | student1@asd.com | 12 | And the following "courses" exist: 13 | | fullname | shortname | category | 14 | | Course 1 | C1 | 0 | 15 | And the following "course enrolments" exist: 16 | | user | course | role | 17 | | teacher1 | C1 | editingteacher | 18 | | student1 | C1 | student | 19 | And the following "activities" exist: 20 | | activity | name | intro | course | idnumber | 21 | | oublog | Testing rate individuals posts | Testing separate blogs as multipe users | C1 | oublog1 | 22 | 23 | # Admin changes settings 24 | And I log in as "admin" 25 | And I am on "Course 1" course homepage 26 | And I follow "Testing rate individuals posts" 27 | And I follow "Settings" 28 | # Maximum points of more than 10 gets very slow 29 | And I set the following fields to these values: 30 | | Grading | Use ratings | 31 | | Aggregate type | Average of ratings | 32 | | scale[modgrade_type] | Point | 33 | | scale[modgrade_point] | 10 | 34 | And I press "Save and display" 35 | And I log out 36 | 37 | Scenario: Teacher tests the rate post widget 38 | Given I log in as "teacher1" 39 | And I am on homepage 40 | And I am on "Course 1" course homepage 41 | And I follow "Testing rate individuals posts" 42 | And I press "New blog post" 43 | And I should see "New blog post" 44 | And I set the following fields to these values: 45 | | Title | SC06 teacher post01 | 46 | | Message | SC06 teacher post01 content visible to admin and teacher | 47 | And I press "Add post" 48 | Then I should see "SC06 teacher post01" 49 | And I should see "SC06 teacher post01 content visible to admin and teacher" 50 | And "span.rating-aggregate-label" "css_element" should exist 51 | And I should see "Average of ratings:" 52 | And I log out 53 | 54 | # Student1 user posts 55 | Given I log in as "student1" 56 | And I am on "Course 1" course homepage 57 | And I follow "Testing rate individuals posts" 58 | Given I press "New blog post" 59 | And I should see "New blog post" 60 | And I set the following fields to these values: 61 | | Title | SC06 student1 post01 | 62 | | Message | SC06 student1 post01 content | 63 | And I press "Add post" 64 | And I wait to be redirected 65 | Then I should see "SC06 student1 post01" 66 | And I should see "SC06 student1 post01 content" 67 | And I log out 68 | 69 | # Teacher checks visibility 70 | Given I log in as "teacher1" 71 | And I am on homepage 72 | And I am on "Course 1" course homepage 73 | And I follow "Testing rate individuals posts" 74 | Then I should see "SC06 student1 post01" 75 | And I should see "SC06 student1 post01 content" 76 | And I should see "SC06 teacher post01" 77 | And I should see "SC06 teacher post01 content visible to admin and teacher" 78 | 79 | # Identify rating label & selector for student (wont see teachers selector) 80 | And ".rating-aggregate-label" "css_element" should exist 81 | And I should see "Average of ratings:" 82 | And "//div[@class='oublog-post-rating']/form/div/input[@class='ratinginput']" "xpath_element" should exist 83 | And the "rating" select box should contain "0" 84 | 85 | # Teacher sets ratings for student 86 | Given I set the field "rating" to "10" 87 | And I click on "Rate" "button" 88 | Then the "rating" select box should contain "10" 89 | And "span.rating-aggregate-label" "css_element" should exist 90 | And I should see "Average of ratings: 10 (1)" 91 | -------------------------------------------------------------------------------- /tests/behat/time.period.feature: -------------------------------------------------------------------------------- 1 | @ou @ou_vle @mod @mod_oublog @oublog_time 2 | Feature: Test time limited posts and comments 3 | In order to limit students posts and comments to time periods 4 | As a teacher 5 | I need to be able to set time limits 6 | 7 | Background: 8 | Given the following "users" exist: 9 | | username | firstname | lastname | email | 10 | | student1 | Student1 | 1 | student1@asd.com | 11 | And the following "courses" exist: 12 | | fullname | shortname | category | 13 | | Course 1 | C1 | 0 | 14 | And the following "course enrolments" exist: 15 | | user | course | role | 16 | | student1 | C1 | student | 17 | And the following "activities" exist: 18 | | activity | name | intro | course | idnumber | postfrom | postuntil | commentfrom | commentuntil | 19 | | oublog | blog post start past | A blog when posts start in past | C1 | oublog1 | 1262307600 | 0 | 1262307600 | 0 | 20 | | oublog | blog post start future | A blog when posts start in future | C1 | oublog2 | 2524611600 | 0 | 2524611600 | 0 | 21 | | oublog | blog post end past | A blog when posts start in past | C1 | oublog3 | 0 | 1262307600 | 0 | 1262307600 | 22 | | oublog | blog post end future | A blog when posts start in future | C1 | oublog4 | 0 | 2524611600 | 0 | 2524611600 | 23 | Given I log in as "admin" 24 | And I am on "Course 1" course homepage 25 | And I follow "blog post start future" 26 | And I press "New blog post" 27 | And I set the field "Message" to "Test" 28 | And I press "Add post" 29 | And I am on "Course 1" course homepage 30 | And I follow "blog post end past" 31 | And I press "New blog post" 32 | And I set the field "Message" to "Test" 33 | And I press "Add post" 34 | And I log out 35 | 36 | Scenario: Admin tests timed blogs 37 | Given I log in as "admin" 38 | And I am on "Course 1" course homepage 39 | # Test blog1. 40 | When I follow "blog post start past" 41 | Then I should not see "Students cannot create their own posts until" 42 | And I should not see "Students cannot comment on posts until" 43 | And "New blog post" "button" should exist 44 | Given I am on "Course 1" course homepage 45 | # Test blog2. 46 | When I follow "blog post start future" 47 | Then I should see "Students cannot create their own posts until" 48 | And I should see "Students cannot comment on posts until" 49 | And "New blog post" "button" should exist 50 | And "Add your comment" "link" should exist 51 | Given I am on "Course 1" course homepage 52 | # Test blog3. 53 | When I follow "blog post end past" 54 | Then I should see "Students were able to create their own posts until" 55 | And I should see "Students were able to comment on posts until" 56 | And "New blog post" "button" should exist 57 | And "Add your comment" "link" should exist 58 | Given I am on "Course 1" course homepage 59 | # Test blog4. 60 | When I follow "blog post end future" 61 | Then I should see "Students are able to create their own posts until" 62 | # Test no comment message as no posts. 63 | And I should not see "Students are able to comment on posts until" 64 | And "New blog post" "button" should exist 65 | Given I log out 66 | 67 | Scenario: Admin tests timed blogs as student 68 | Given I log in as "student1" 69 | And I am on "Course 1" course homepage 70 | # Test blog1. 71 | When I follow "blog post start past" 72 | Then I should not see "You cannot create posts at this time" 73 | And I should not see "You cannot comment on posts at this time" 74 | And "New blog post" "button" should exist 75 | Given I am on "Course 1" course homepage 76 | # Test blog2. 77 | When I follow "blog post start future" 78 | Then I should see "You cannot create posts at this time" 79 | And I should see "You cannot comment on posts at this time" 80 | And "New blog post" "button" should not exist 81 | And "Add your comment" "link" should not exist 82 | Given I am on "Course 1" course homepage 83 | # Test blog3. 84 | When I follow "blog post end past" 85 | Then I should see "You cannot create posts at this time" 86 | And I should see "You cannot comment on posts at this time" 87 | And "New blog post" "button" should not exist 88 | And "Add your comment" "link" should not exist 89 | Given I am on "Course 1" course homepage 90 | # Test blog4. 91 | When I follow "blog post end future" 92 | Then I should see "You can only create posts until" 93 | # Test no comment message as no posts. 94 | And I should not see "You can only comment on posts until" 95 | And "New blog post" "button" should exist 96 | Given I am on "Course 1" course homepage 97 | -------------------------------------------------------------------------------- /tests/fixtures/pd-frog.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moodleou/moodle-mod_oublog/892713e2fc31b4b0a6f1ae0dac41207cb568692a/tests/fixtures/pd-frog.jpg -------------------------------------------------------------------------------- /tests/generator/behat_mod_oublog_generator.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * Behat data generator for mod_oublog. 19 | * 20 | * @package mod_oublog 21 | * @category test 22 | * @copyright 2024 The Open University 23 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 24 | */ 25 | class behat_mod_oublog_generator extends behat_generator_base { 26 | 27 | /** 28 | * Get a list of the entities that Behat can create using the generator step. 29 | * 30 | * @return array 31 | */ 32 | protected function get_creatable_entities(): array { 33 | return [ 34 | 'posts' => [ 35 | 'singular' => 'post', 36 | 'datagenerator' => 'behat_post', 37 | 'required' => ['blog', 'user'], 38 | 'switchids' => ['blog' => 'blog', 'user' => 'userid', 'time' => 'timeposted'], 39 | ], 40 | 'comments' => [ 41 | 'singular' => 'comment', 42 | 'datagenerator' => 'behat_comment', 43 | 'required' => ['blog', 'post'], 44 | 'switchids' => ['blog' => 'blog', 'post' => 'postid', 'user' => 'userid', 'time' => 'timeposted'], 45 | ], 46 | ]; 47 | } 48 | 49 | /** 50 | * Get the blog id using an activity idnumber or name. 51 | * 52 | * @param string $idnumberorname The blog activity idnumber or name. 53 | * @return int The blog id 54 | */ 55 | protected function get_blog_id(string $idnumberorname): int { 56 | return $this->get_cm_by_activity_name('oublog', $idnumberorname)->instance; 57 | } 58 | 59 | protected function get_post_id(string $title): int { 60 | global $DB; 61 | $result = $DB->get_record('oublog_posts', ['title' => $title], 'id'); 62 | if ($result) { 63 | return $result->id; 64 | } else { 65 | throw new \coding_exception('Cannot find comment with subject text'); 66 | } 67 | } 68 | 69 | protected function get_time_id(string $time): int { 70 | // Convert string time to unix timestamp - take care as timezone not considered. 71 | if (empty($time)) { 72 | return time(); 73 | } 74 | return strtotime($time); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /version.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * Code fragment to define the version of oublog 19 | * This fragment is called by moodle_needs_upgrading() and /admin/index.php 20 | * 21 | * @author Matt Clarkson 22 | * @author Sam Marshall 23 | * @package oublog 24 | **/ 25 | 26 | $plugin->version = 2025030100; 27 | $plugin->requires = 2022041900; 28 | $plugin->component = 'mod_oublog';// Full name of the plugin (used for diagnostics) 29 | $plugin->maturity = MATURITY_STABLE; 30 | $plugin->release = '4.4 r1'; 31 | --------------------------------------------------------------------------------