moodle-mod_newmodule's Introduction
Template Activity Module for Moodle ========================== This is a more modern, and at least for me, more useful template than the others available. It contains admin and instance settings stubs, a renderer.php and a module.js . It also contains activity completion on grade, grade book logic, backup and restore and adhoc/scheduled tasks To Use =========== i) Replace all instances of @@NEWMODULE@@ with your uppercase module name eg WIDGET There are about 3 of these. ii) Replace all instances of MOD_NEWMODULE_ with your module frankenstyle component name eg MOD_WIDGET_ (NB note the trailing underscore. Just to be safe, include that.) There are over 140 of these. iii) Replace all instances of @@newmodule@@ with your lowercase module name eg widget There are over 330 of these. iv) Replace all instances of COPYRIGHTNOTICE with something like "2015 Justin Hunt". There are over 30 of these. It is recommended to use a search and replace tool from a text editor or a command line script to do this. Trying to do this manually is sure to lead to mistakes. Make sure the plugin folder name, and the names of the files in these directories are also changed: lang/en backup/moodle2 classes/task Copy the folder to your [Moodle program dir]/mod directory Install as usual. Enjoy. Justin Hunt [email protected] NB By default the newtemplate supports grading, but since there is nothing to grade ... yet ... when you do update a gradable item, you will need to call: [modulename]_update_grades($moduleinstance, $userid_of_student); NB 2 If you don't want to manually rename, there is a rename.sh file in the NEWMODULE folder. i) move that one directory up, so that it has the same directory as the NEWMODULE folder itself. ii) make it exectuable like this ... chmod 755 rename.sh iii) run ./rename.sh and enter the name of the plugin that should make up the frankenstyle name as directed
moodle-mod_newmodule's People
moodle-mod_newmodule's Issues
global $CFG,$DB; is repeated in lib.php
Line 336 in moodle-mod_newmodule/lib.php defines the @@newmodule@@_is_complete() function.
Line 337 declares
global $CFG,$DB;
That global declaration is then duplicated again on line 339. Is this necessary?
336 function @@newmodule@@_is_complete($course,$cm,$userid,$type) {
337 global $CFG,$DB;
338
339 global $CFG,$DB;
340
341 // Get module object
newmodule still uses the deprecated error() function.
Line 46 in view.php calls the error() function:
if ($id) {
...
} elseif ($n) {
...
} else {
error('You must specify a course_module ID or an instance ID');
}
This triggers a "Debug info: error() is a deprecated function, please call print_error() instead of error()" message.
The error message is also hardcoded into the code. This should be moved into a language string.
So I think the code could be updated with something like:
} else {
-- error('You must specify a course_module ID or an instance ID');
++ print_error('missingiderror', '@@newmodule@@');
}
where 'missingiderror' is a language string that's been defined in /moodle-mod_newmodule/lang/en/NEWMODULE.php. Example:
$string['defaultsettings'] ='Default Settings';
$string['exceededattempts'] ='You have completed the maximum {$a} attempts.';
$string['newmoduletask'] ='newmodule Task';
++ $string['missingiderror'] = 'You must specify a course_module ID or an instance ID';
The someinstancesetting won't show up
Hi Justin,
I justed watched your video this morning, it is great! After I installed your plugin as instructed in your video (Using moodle 3.3.2; replacing a lot of placeholders; copying the folder into mod; installing the plug in via notifications; adding the rugby activity module to a course) I wasn't able to see the $someinstancesetting content when i opened the module. I assume it is because of the renderer, since I was able to print out $someinstancesetting before line 125 in view.php before this command is called "$renderer = $PAGE->get_renderer('mod_rugby');".
Do you have an idea why it is not able to "echo $renderer->show_something($someinstancesetting)
someinstancesetting);" ?
Many thanks in advance!
Best regards,
Matthias
Wrong $plugin->requires version
version.php in this newmodule plugin shows that:
$plugin->requires = 2010031900;
Version 2010031900 is Moodle release 2.0 DEV – a development version of Moodle 2.0.
This plugin contains code for Scheduled Tasks (e.g. \pairwork\classes\task\pairwork_scheduled.php). Scheduled Tasks were a new feature added in Moodle 2.7, so presumably that $plugin->requires line should actually point to a version of Moodle 2.7, e.g.:
$plugin->requires = 2014051200.00;
Is that correct?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.