New Module Template Code for Moodle 1.7

New Module Template Code for Moodle 1.7

by Chris Stones -
Number of replies: 16
 
                        
Average of ratings:Useful (1)
In reply to Chris Stones

Re: New Module Template Code for Moodle 1.7

by Helen Foster -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Hi Chris,

Many thanks for posting your new module template code for Moodle 1.7. approve

Please could you also post it in the Tracker - MDLSITE-75 - to ensure it gets reviewed and put in CVS.
In reply to Helen Foster

Re: New Module Template Code for Moodle 1.7

by Sarah Abd ElAzim -
i'm sorry but i wanna ask.. if i had made a new feature as Virtual Classroom & i wanted to add it as a new activity module for moodle, how can i do that??
i'm working locally, my pc is my server so is there any help for me because i should deliver this module within 3 days..
pleaseeeee ???
In reply to Chris Stones

回复: New Module Template Code for Moodle 1.7

by 海涛 谭 -

hello Chris:

      Thank you for the template of module. I'm from China. And now I want to develop a new module.And I don't use moodle before.I've some questions about it.

      When I put the folder in the ".../Moodle/Mod/" and edit the files of the template, it still can't work .Which should I do except changing the name  "newmodule" ? Is it necessary to finish the file "Lib.php" or other files?

      Thank you for your help.

In reply to Chris Stones

Re: New Module Template Code for Moodle 1.7

by Juan M Torres -
Hey thanks for your contribution,

I am going to check it out and test it, I need the template to integrate a project that a coworker has been working on for several months. I'll let you know my results and how well your template worked for us.

Juan
In reply to Chris Stones

Re: New Module Template Code for Moodle 1.7

by Joan Maria Talarn Espelta -

Hello,

in this new template model (New Module Template Code for Moodle 1.7)there is a mod.html file like the older new module template. But in the latest Moodle distribution (Moodle 1.8) there isn't the mod.html file in the mods folders, instead of mod.html theres is a mod_form.php.

What's the reason?The old mod.html is still usable in Moodle 1.8? or only can be used the mod_form.php? And another question about this, what difference is between this two files?

Thank you for your attention!!

In reply to Joan Maria Talarn Espelta

Re: New Module Template Code for Moodle 1.7

by Adrien Nicolet -
Hello,

I'm asking the same as you, Joan!

I developed a module with this model:
http://download.moodle.org/download.php/plugins/mod/NEWMODULE.zip

I'm working with Moodle 1.8 and I don't have any problems. But when I try to install the module on Moodle 1.7.1, I get this error:

This module cannot be added to this course yet!
(No file found at: ../mod/amcontent/mod.html)


Of course, I don't have any mod.html file... Because mod_html.php works perfectly.

Do I have to rewrite the form for version 1.7, in mod.html?

Thanks for any help!


Adrien
In reply to Chris Stones

Why this template doesn't work on v1.8.2?

by TATSUO MIWA -

Hi chris.

I tried to add this module onto latest version moodle1.8.2 without changing.(it means that I moved this skelton folder to mod/ along README.txt).
But the moodle did not recognize this module at all.

I don't know the reason why the system could not find module.
Following is the all what I did.
Please tell me what do I have to do so that I can work this module.

1. decompressed MODULE2.zip
2. copied to directory mod/
3. I logged in moodle 1.8.2 system as Administrator.
Then I clicked link labeled Notification(admin/index.php) but nothing was displayed.
4. I checked module page(admin/module.php) but the system didn't find newmodule.

thank you.

In reply to TATSUO MIWA

Solved by myself

by TATSUO MIWA -

Hi All.

this trouble was caused by the conflict of module's ID on the databese.

I checked the module table of database.
Then I found that the last module ID was 17.
So I edited lib.php and set 18 to the variable named $newmodule_CONSTANT.

Then I tried again.
the newmodule was recognized successfully.

I apologize that I bothered this forum with this tiny trouble.

Thanx

In reply to TATSUO MIWA

Re: Solved by myself

by Peter Bloomfield -
There must have been something else which solved your problem. The "$newmodule_CONSTANT" is just an example of how to declare something in "lib.php". The Module ID should never be hard-coded, as it will be different on another installation.
In reply to Chris Stones

Re: New Module Template Code for Moodle 1.7

by joao santos -
Hello

I've tried your template with moodle 1.6.5 but i'm having some problems..
I changed all 'newmodule' keywords to my module's name (let's call it 'xx') but two things happen:
1. i don't know what to do with file db/install.xml
2. Under the activity module column in the Modules configuration page, the module is listed as 'newmodule', not xx.

There were some database errors so i created two files under db:

mysql.sql
CREATE TABLE `prefix_xx` (
`id` int(10) unsigned NOT NULL auto_increment,
`name` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`),
KEY `course` (`course`)
)
# --------------------------------------------------------

INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('xx', 'view', 'xx', 'name');


and mysql.php (copy paste from other file and deleted all lines
<?php // $Id: mysql.php,v 1.13 2006/04/24 08:43:29 vyshane Exp $
?>

any suggestion would be much appreciated smile

joao

In reply to joao santos

Re: New Module Template Code for Moodle 1.7

by Jason Mellen -
There might be some issues running 1.7 module code on a 1.6x install. I am working with 1.8 so can't really help there.

The naming of your module comes from two places. First is the directory name containing the template files. ie. /mod/modulename. Many links refer to the directory. Second are the string files in the "lang" folder. There are a few strings that are used by Moodle to identify your module on the admin page and when adding a resource. Those are included and you can look for the get_string () functions in the code to see where they come from.

db/install.xml is from one of my beloved features of the latest versions which is the XMLDB editor. In the admin tools there is an option for XMLDB that loads all the install.xml files and allows you to edit the database structure for your module. That tool then will generate PHP code to be placed in install.php. Each time you visit the notifications page, it checks the version.php file and upgrades your module if needed. Included in this upgrade is the migration of database tables to a new format if needed. It takes a short time to get used to but is far better than having to figure it our by yourself.

Perhaps reviewing these two items will fix your sql problems but I am not sure.

Jason
In reply to Jason Mellen

Re: New Module Template Code for Moodle 1.7

by joao santos -
Hey Jason

Thks a lot for your reply. I was already diving into the implementation of get_string function cause i discovered it is used in modules.php to print the module name but i couldn't figure out where the 'identifiers' were coming from.
The name of my module is now displayed correctly.

Concerning the db/install.xml stuff, i'll look at it later and maybe bug you or someelse about it later on.

Again, many thks smile
Joao
In reply to Chris Stones

Re: New Module Template Code for Moodle 1.7

by Paul 'Fire' Preibisch -
Hi Chris, I've been working on my own module for the SLOODLE project, and am almost finished. What I would like to know is: how can I ad those nifty buttons that read: "Update this ____" in the module view? Any ideas?
In reply to Chris Stones

Re: New Module Template Code for Moodle 1.7

by Paul 'Fire' Preibisch -
Thanks for newmodule2.zip, major difference than newmodule.zip is the fact that it has db table mysql code for you - very nice. thanks
In reply to Chris Stones

Re: New Module Template Code for Moodle 1.7

by Sarah Abd ElAzim -
I wanna ask about something, please?
I have a flash cs4 with AS3 file, can i integrate it in this template & use it as a new module ???

Thank in advance...

Sarah...