<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.moodle.org/31/en/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Davidbalch</id>
	<title>MoodleDocs - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://docs.moodle.org/31/en/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Davidbalch"/>
	<link rel="alternate" type="text/html" href="https://docs.moodle.org/31/en/Special:Contributions/Davidbalch"/>
	<updated>2026-04-22T04:52:52Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://docs.moodle.org/31/en/index.php?title=Add_fonts_for_embedding&amp;diff=124865</id>
		<title>Add fonts for embedding</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/31/en/index.php?title=Add_fonts_for_embedding&amp;diff=124865"/>
		<updated>2016-08-11T11:23:59Z</updated>

		<summary type="html">&lt;p&gt;Davidbalch: Add reference to online font conversion via http://fonts.snm-portal.com/&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Certificate}}&lt;br /&gt;
Additional fonts can be included in Moodle and used by the Certificate module, embedding them in the PDF (when using an &amp;quot;embedded&amp;quot; certificate type).&lt;br /&gt;
&lt;br /&gt;
== Add a font from TTF file ==&lt;br /&gt;
Assuming you have a font licensed for converting and embedding...&lt;br /&gt;
&lt;br /&gt;
=== Using an online converter ===&lt;br /&gt;
You can upload TTF (or OTF) fonts to http://fonts.snm-portal.com/, and download converted versions.&lt;br /&gt;
&lt;br /&gt;
Fonts created this way seem to handle accented characters better than converting locally.&lt;br /&gt;
&lt;br /&gt;
=== Converting locally ===&lt;br /&gt;
&lt;br /&gt;
Fonts created this way may not handle accented characters correctly; this is probably dependant on the specific software versions. If you encounter this problem, you might want to try using an online converter (above).&lt;br /&gt;
&lt;br /&gt;
1. Copy the .ttf file to /lib/tcpdf/fonts&lt;br /&gt;
&lt;br /&gt;
2. Create a &amp;quot;convertfont.php&amp;quot; file in /lib/tcpdf/fonts (and ensure the web server has permissions to run it), containing:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
include(&#039;../tcpdf.php&#039;);&lt;br /&gt;
$pdf = new TCPDF_FONTS(&#039;P&#039;, &#039;mm&#039;, &#039;A4&#039;, true, &#039;UTF-8&#039;, false);&lt;br /&gt;
$pdf-&amp;gt;addTTFfont(&#039;./MyFont.ttf&#039;, &#039;TrueTypeUnicode&#039;);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
3. View the file at http://&#039;&#039;hostname&#039;&#039;/lib/tcpdf/fonts/convertfont.php (it should just show a blank page).&lt;br /&gt;
&lt;br /&gt;
4. Verify that new files have been created in /lib/tcpdf:&lt;br /&gt;
* myfont.ctg.z&lt;br /&gt;
* myfont.php&lt;br /&gt;
* myfont.z&lt;br /&gt;
&lt;br /&gt;
See below for using the font in a certificate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Add all TCPDF fonts ==&lt;br /&gt;
&lt;br /&gt;
From /lib/tcpdf/fonts/readme_moodle.txt:&lt;br /&gt;
&lt;br /&gt;
:This directory contains just selected set of original tcpdf fonts in order to keep the standard Moodle distribution lightweight. You may want to manually download tcpdf package and extract its fonts/ directory into your $CFG-&amp;gt;dataroot/fonts/. In such case, pdflib.php will use this directory.  In the future, we plan to have fonts downloadable in a same way as languages are. (TODO MDL-18663).&lt;br /&gt;
&lt;br /&gt;
== Using a new font ==&lt;br /&gt;
&lt;br /&gt;
Once added, there are two ways to use the new font:&lt;br /&gt;
# Go to the Certificate module setting page and set it as the new Serif or Sans-serif font. This will apply to all standard certificates.&lt;br /&gt;
# Create a custom certificate type in /mod/certificate/type, and replace the $fontserif and $fontsans variables, as needed.&lt;br /&gt;
&lt;br /&gt;
* Replacing font for the whole file:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
// $fontsans = get_config(&#039;certificate&#039;, &#039;fontsans&#039;); // Comment out old code&lt;br /&gt;
&lt;br /&gt;
$fontsans = &#039;myfont&#039;; // Add new code.&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Replacing font for just the student name:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
//certificate_print_text($pdf, $x, $y + 36, &#039;C&#039;, $fontsans, &#039;&#039;, 30, fullname($USER)); // Comment out old code&lt;br /&gt;
&lt;br /&gt;
certificate_print_text($pdf, $x, $y + 36, &#039;C&#039;, &#039;myfont&#039;, &#039;&#039;, 30, fullname($USER)); // Add new code.&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Certificate]]&lt;/div&gt;</summary>
		<author><name>Davidbalch</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/31/en/index.php?title=Add_fonts_for_embedding&amp;diff=124864</id>
		<title>Add fonts for embedding</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/31/en/index.php?title=Add_fonts_for_embedding&amp;diff=124864"/>
		<updated>2016-08-11T10:31:02Z</updated>

		<summary type="html">&lt;p&gt;Davidbalch: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Certificate}}&lt;br /&gt;
Additional fonts can be included in Moodle and used by the Certificate module, embedding them in the PDF (when using an &amp;quot;embedded&amp;quot; certificate type).&lt;br /&gt;
&lt;br /&gt;
== Add a font from TTF file ==&lt;br /&gt;
Assuming you have a font licensed for converting and embedding...&lt;br /&gt;
&lt;br /&gt;
1. Copy the .ttf file to /lib/tcpdf/fonts&lt;br /&gt;
&lt;br /&gt;
2. Create a &amp;quot;convertfont.php&amp;quot; file in /lib/tcpdf/fonts (and ensure the web server has permissions to run it), containing:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
include(&#039;../tcpdf.php&#039;);&lt;br /&gt;
$pdf = new TCPDF_FONTS(&#039;P&#039;, &#039;mm&#039;, &#039;A4&#039;, true, &#039;UTF-8&#039;, false);&lt;br /&gt;
$pdf-&amp;gt;addTTFfont(&#039;./MyFont.ttf&#039;, &#039;TrueTypeUnicode&#039;);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
3. View the file at http://&#039;&#039;hostname&#039;&#039;/lib/tcpdf/fonts/convertfont.php (it should just show a blank page).&lt;br /&gt;
&lt;br /&gt;
4. Verify that new files have been created in /lib/tcpdf:&lt;br /&gt;
* myfont.ctg.z&lt;br /&gt;
* myfont.php&lt;br /&gt;
* myfont.z&lt;br /&gt;
&lt;br /&gt;
See below for using the font in a certificate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Add all TCPDF fonts ==&lt;br /&gt;
&lt;br /&gt;
From /lib/tcpdf/fonts/readme_moodle.txt:&lt;br /&gt;
&lt;br /&gt;
:This directory contains just selected set of original tcpdf fonts in order to keep the standard Moodle distribution lightweight. You may want to manually download tcpdf package and extract its fonts/ directory into your $CFG-&amp;gt;dataroot/fonts/. In such case, pdflib.php will use this directory.  In the future, we plan to have fonts downloadable in a same way as languages are. (TODO MDL-18663).&lt;br /&gt;
&lt;br /&gt;
== Using a new font ==&lt;br /&gt;
&lt;br /&gt;
Once added, there are two ways to use the new font:&lt;br /&gt;
# Go to the Certificate module setting page and set it as the new Serif or Sans-serif font. This will apply to all standard certificates.&lt;br /&gt;
# Create a custom certificate type in /mod/certificate/type, and replace the $fontserif and $fontsans variables, as needed.&lt;br /&gt;
&lt;br /&gt;
* Replacing font for the whole file:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
// $fontsans = get_config(&#039;certificate&#039;, &#039;fontsans&#039;); // Comment out old code&lt;br /&gt;
&lt;br /&gt;
$fontsans = &#039;myfont&#039;; // Add new code.&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Replacing font for just the student name:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
//certificate_print_text($pdf, $x, $y + 36, &#039;C&#039;, $fontsans, &#039;&#039;, 30, fullname($USER)); // Comment out old code&lt;br /&gt;
&lt;br /&gt;
certificate_print_text($pdf, $x, $y + 36, &#039;C&#039;, &#039;myfont&#039;, &#039;&#039;, 30, fullname($USER)); // Add new code.&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Certificate]]&lt;/div&gt;</summary>
		<author><name>Davidbalch</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/31/en/index.php?title=Template:Certificate&amp;diff=124863</id>
		<title>Template:Certificate</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/31/en/index.php?title=Template:Certificate&amp;diff=124863"/>
		<updated>2016-08-11T10:24:15Z</updated>

		<summary type="html">&lt;p&gt;Davidbalch: Link to page for custom fonts.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;sideblock right&amp;quot; style=&amp;quot;width: 12em;&amp;quot;&amp;gt;	&lt;br /&gt;
&amp;lt;div class=&amp;quot;header&amp;quot;&amp;gt;[[Certificate module|Certificate]]&amp;lt;/div&amp;gt;	&lt;br /&gt;
&amp;lt;div class=&amp;quot;content&amp;quot;&amp;gt;&lt;br /&gt;
* [[Add/edit certificate module|Certificate settings]]&lt;br /&gt;
* [[Certificate customizing|Customizing]]&lt;br /&gt;
* [[Add fonts for embedding|Adding new fonts]]&lt;br /&gt;
* [[Certificate reports]]&lt;br /&gt;
* [[Certificate FAQ]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>Davidbalch</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/31/en/index.php?title=Add_fonts_for_embedding&amp;diff=124861</id>
		<title>Add fonts for embedding</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/31/en/index.php?title=Add_fonts_for_embedding&amp;diff=124861"/>
		<updated>2016-08-11T10:14:43Z</updated>

		<summary type="html">&lt;p&gt;Davidbalch: Tweak formatting under &amp;quot;Add all TCPDF fonts&amp;quot;. Add  Category:Certificate&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Certificate}}&lt;br /&gt;
Additional fonts can be included in Moodle and used by the Certificate module, embedding them in the PDF (when using an &amp;quot;embedded&amp;quot; certificate type).&lt;br /&gt;
&lt;br /&gt;
== Add a font from TTF file ==&lt;br /&gt;
Assuming you have a font licensed for converting and embedding...&lt;br /&gt;
&lt;br /&gt;
1. Copy the .ttf file to /lib/tcpdf/fonts&lt;br /&gt;
&lt;br /&gt;
2. Create a &amp;quot;convertfont.php&amp;quot; file in /lib/tcpdf/fonts (and ensure the web server has permissions to run it), containing:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
include(&#039;../tcpdf.php&#039;);&lt;br /&gt;
$pdf = new TCPDF_FONTS(&#039;P&#039;, &#039;mm&#039;, &#039;A4&#039;, true, &#039;UTF-8&#039;, false);&lt;br /&gt;
$pdf-&amp;gt;addTTFfont(&#039;./MyFont.ttf&#039;, &#039;TrueTypeUnicode&#039;);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
3. View the file at http://&#039;&#039;hostname&#039;&#039;/lib/tcpdf/fonts/convertfont.php&lt;br /&gt;
&lt;br /&gt;
4. Verify that new files have been created in /lib/tcpdf:&lt;br /&gt;
* myfont.ctg.z&lt;br /&gt;
* myfont.php&lt;br /&gt;
* myfont.z&lt;br /&gt;
&lt;br /&gt;
See below for using the font in a certificate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Add all TCPDF fonts ==&lt;br /&gt;
&lt;br /&gt;
From /lib/tcpdf/fonts/readme_moodle.txt:&lt;br /&gt;
&lt;br /&gt;
:This directory contains just selected set of original tcpdf fonts in order to keep the standard Moodle distribution lightweight. You may want to manually download tcpdf package and extract its fonts/ directory into your $CFG-&amp;gt;dataroot/fonts/. In such case, pdflib.php will use this directory.  In the future, we plan to have fonts downloadable in a same way as languages are. (TODO MDL-18663).&lt;br /&gt;
&lt;br /&gt;
== Using a new font ==&lt;br /&gt;
&lt;br /&gt;
Once added, there are two ways to use the new font:&lt;br /&gt;
# Go to the Certificate module setting page and set it as the new Serif or Sans-serif font. This will apply to all standard certificates.&lt;br /&gt;
# Create a custom certificate type in /mod/certificate/type, and replace the $fontserif and $fontsans variables, as needed.&lt;br /&gt;
&lt;br /&gt;
* Replacing font for the whole file:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
// $fontsans = get_config(&#039;certificate&#039;, &#039;fontsans&#039;); // Comment out old code&lt;br /&gt;
&lt;br /&gt;
$fontsans = &#039;myfont&#039;; // Add new code.&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Replacing font for just the student name:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
//certificate_print_text($pdf, $x, $y + 36, &#039;C&#039;, $fontsans, &#039;&#039;, 30, fullname($USER)); // Comment out old code&lt;br /&gt;
&lt;br /&gt;
certificate_print_text($pdf, $x, $y + 36, &#039;C&#039;, &#039;myfont&#039;, &#039;&#039;, 30, fullname($USER)); // Add new code.&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Certificate]]&lt;/div&gt;</summary>
		<author><name>Davidbalch</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/31/en/index.php?title=Add_fonts_for_embedding&amp;diff=124860</id>
		<title>Add fonts for embedding</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/31/en/index.php?title=Add_fonts_for_embedding&amp;diff=124860"/>
		<updated>2016-08-11T09:52:51Z</updated>

		<summary type="html">&lt;p&gt;Davidbalch: Initial add.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Certificate}}&lt;br /&gt;
Additional fonts can be included in Moodle and used by the Certificate module, embedding them in the PDF (when using an &amp;quot;embedded&amp;quot; certificate type).&lt;br /&gt;
&lt;br /&gt;
== Add a font from TTF file ==&lt;br /&gt;
Assuming you have a font licensed for converting and embedding...&lt;br /&gt;
&lt;br /&gt;
1. Copy the .ttf file to /lib/tcpdf/fonts&lt;br /&gt;
&lt;br /&gt;
2. Create a &amp;quot;convertfont.php&amp;quot; file in /lib/tcpdf/fonts (and ensure the web server has permissions to run it), containing:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
include(&#039;../tcpdf.php&#039;);&lt;br /&gt;
$pdf = new TCPDF_FONTS(&#039;P&#039;, &#039;mm&#039;, &#039;A4&#039;, true, &#039;UTF-8&#039;, false);&lt;br /&gt;
$pdf-&amp;gt;addTTFfont(&#039;./MyFont.ttf&#039;, &#039;TrueTypeUnicode&#039;);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
3. View the file at http://&#039;&#039;hostname&#039;&#039;/lib/tcpdf/fonts/convertfont.php&lt;br /&gt;
&lt;br /&gt;
4. Verify that new files have been created in /lib/tcpdf:&lt;br /&gt;
* myfont.ctg.z&lt;br /&gt;
* myfont.php&lt;br /&gt;
* myfont.z&lt;br /&gt;
&lt;br /&gt;
See below for using the font in a certificate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Add all TCPDF fonts ==&lt;br /&gt;
&lt;br /&gt;
From /lib/tcpdf/fonts/readme_moodle.txt:&lt;br /&gt;
&lt;br /&gt;
  This directory contains just selected set of original tcpdf fonts in order to keep the standard Moodle distribution lightweight. You may want to manually download tcpdf package and extract its fonts/ directory into your &amp;lt;code php&amp;gt;$CFG-&amp;gt;dataroot/fonts/&amp;lt;/code&amp;gt;. In such case, pdflib.php will use this directory.  In the future, we plan to have fonts downloadable in a same way as languages are. (TODO MDL-18663).&lt;br /&gt;
&lt;br /&gt;
== Using a new font ==&lt;br /&gt;
&lt;br /&gt;
Once added, there are two ways to use the new font:&lt;br /&gt;
# Go to the Certificate module setting page and set it as the new Serif or Sans-serif font. This will apply to all standard certificates.&lt;br /&gt;
# Create a custom certificate type in /mod/certificate/type, and replace the $fontserif and $fontsans variables, as needed.&lt;br /&gt;
&lt;br /&gt;
* Replacing font for the whole file:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
// $fontsans = get_config(&#039;certificate&#039;, &#039;fontsans&#039;); // Comment out old code&lt;br /&gt;
&lt;br /&gt;
$fontsans = &#039;myfont&#039;; // Add new code.&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Replacing font for just the student name:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
//certificate_print_text($pdf, $x, $y + 36, &#039;C&#039;, $fontsans, &#039;&#039;, 30, fullname($USER)); // Comment out old code&lt;br /&gt;
&lt;br /&gt;
certificate_print_text($pdf, $x, $y + 36, &#039;C&#039;, &#039;myfont&#039;, &#039;&#039;, 30, fullname($USER)); // Add new code.&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Davidbalch</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/31/en/index.php?title=Block_layout&amp;diff=122698</id>
		<title>Block layout</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/31/en/index.php?title=Block_layout&amp;diff=122698"/>
		<updated>2016-03-30T13:25:49Z</updated>

		<summary type="html">&lt;p&gt;Davidbalch: Update reset code for deprecated get_context_instance()&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Blocks}}&lt;br /&gt;
==Default block layout for new courses==&lt;br /&gt;
&lt;br /&gt;
To amend the default block layout for new courses, one or more of the following lines (omitting the forward slashes) from &#039;&#039;config-dist.php&#039;&#039; may be added to &#039;&#039;[[Configuration_file|config.php]]&#039;&#039;, amending the block names as required.&lt;br /&gt;
&lt;br /&gt;
 // These variables define DEFAULT block variables for new courses&lt;br /&gt;
 // If this one is set it overrides all others and is the only one used.&lt;br /&gt;
 //      $CFG-&amp;gt;defaultblocks_override =    &#039;participants,activity_modules,search_forums,course_list:news_items,calendar_upcoming,recent_activity&#039;;&lt;br /&gt;
 //&lt;br /&gt;
 // These variables define the specific settings for defined course formats.&lt;br /&gt;
 // They override any settings defined in the formats own config file.&lt;br /&gt;
 //      $CFG-&amp;gt;defaultblocks_site = &#039;site_main_menu,course_list:course_summary,calendar_month&#039;;&lt;br /&gt;
 //      $CFG-&amp;gt;defaultblocks_social =  &#039;participants,search_forums,calendar_month,calendar_upcoming,social_activities,recent_activity,course_list&#039;;&lt;br /&gt;
 //      $CFG-&amp;gt;defaultblocks_topics =  &#039;participants,activity_modules,search_forums,course_list:news_items,calendar_upcoming,recent_activity&#039;;&lt;br /&gt;
 //      $CFG-&amp;gt;defaultblocks_weeks =  &#039;participants,activity_modules,search_forums,course_list:news_items,calendar_upcoming,recent_activity&#039;;&lt;br /&gt;
 // These blocks are used when no other default setting is found.&lt;br /&gt;
 //      $CFG-&amp;gt;defaultblocks = &#039;participants,activity_modules,search_forums,course_list:news_items,calendar_upcoming,recent_activity&#039;;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example, to set the default block layout for topics format courses to People, Tags and Administration on the left, and Messages, Online users and Recent activity on the right, simply add the following line to your &#039;&#039;config.php&#039;&#039; file:&lt;br /&gt;
&lt;br /&gt;
 $CFG-&amp;gt;defaultblocks_topics =  &#039;participants,tags:messages,online_users,recent_activity&#039;;&lt;br /&gt;
&lt;br /&gt;
Note how the colon is used to separate those blocks appearing on the left, from those appearing on the right.&lt;br /&gt;
&lt;br /&gt;
==Resetting the block layout for existing courses==&lt;br /&gt;
&lt;br /&gt;
The block layout for existing courses may be reset by copying the following script into a text file, saving it as &#039;&#039;resetblocks.php&#039;&#039;, copying it into the Moodle root directory, then visiting &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://yourmoodlesite.org/resetblocks.php&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning&#039;&#039;&#039;: This script may change the layout of your course pages and also remove blocks from those pages if they have not been specified in the config.php line. Check which of your courses has blocks which are not in the config.php line and be prepared to spend time adding blocks to your course pages again. &#039;&#039;Please note that a database backup is recommended before using the script&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;M2.2 and later:&#039;&#039;&#039;&lt;br /&gt;
 &amp;lt;?php&lt;br /&gt;
 //moodle 2.2+&lt;br /&gt;
 require_once(&#039;config.php&#039;);&lt;br /&gt;
 require_once($CFG-&amp;gt;libdir.&#039;/blocklib.php&#039;);&lt;br /&gt;
 $courses = get_courses();//can be feed categoryid to just effect one category&lt;br /&gt;
 foreach($courses as $course) {&lt;br /&gt;
    $context = get_context_instance(CONTEXT_COURSE,$course-&amp;gt;id);&lt;br /&gt;
    $context = context_course::instance($course-&amp;gt;id);&lt;br /&gt;
    blocks_delete_all_for_context($context-&amp;gt;id);&lt;br /&gt;
    blocks_add_default_course_blocks($course);&lt;br /&gt;
 } &lt;br /&gt;
 ?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;M2.0 to M2.2:&#039;&#039;&#039;&lt;br /&gt;
 &amp;lt;?php&lt;br /&gt;
 //moodle 2.0 - 2.2&lt;br /&gt;
 require_once(&#039;config.php&#039;);&lt;br /&gt;
 require_once($CFG-&amp;gt;libdir.&#039;/blocklib.php&#039;);&lt;br /&gt;
 $courses = get_courses();//can be feed categoryid to just effect one category&lt;br /&gt;
 foreach($courses as $course) {&lt;br /&gt;
    $context = get_context_instance(CONTEXT_COURSE,$course-&amp;gt;id);&lt;br /&gt;
    blocks_delete_all_for_context($context-&amp;gt;id);&lt;br /&gt;
    blocks_add_default_course_blocks($course);&lt;br /&gt;
 } &lt;br /&gt;
 ?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[es:Diseño de bloque]]&lt;br /&gt;
[[ja:ブロックレイアウト]]&lt;/div&gt;</summary>
		<author><name>Davidbalch</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/31/en/index.php?title=Creating_custom_roles&amp;diff=112779</id>
		<title>Creating custom roles</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/31/en/index.php?title=Creating_custom_roles&amp;diff=112779"/>
		<updated>2014-05-27T15:24:46Z</updated>

		<summary type="html">&lt;p&gt;Davidbalch: /* Role archetypes */  Add list of archetypes.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Roles}}&lt;br /&gt;
==Creating a new role==&lt;br /&gt;
&lt;br /&gt;
To create a custom role:&lt;br /&gt;
#Go to &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Users &amp;gt; Permissions &amp;gt; Define roles&#039;&#039;. &lt;br /&gt;
#Click the &amp;quot;Add a new role&amp;quot; button.&lt;br /&gt;
#Select template for the new role or upload a preset&lt;br /&gt;
#Give the role a Short name e.g. &#039;Parent&#039;.The short name is necessary for other plugins in Moodle that may need to refer to the role (e.g. when uploading users from a file or setting enrolments via an enrolment plugin).&lt;br /&gt;
#You must provide a full name for all custom roles. If you need to name the role for multiple languages you can use [[Multi language content|multi-lang syntax]] if you wish.&lt;br /&gt;
#Give the role a description (optional).&lt;br /&gt;
#Select an appropriate role archetype (see below for further information).&lt;br /&gt;
#Select the contexts where the role may be assigned e.g. &#039;User&#039; for Parent role.&lt;br /&gt;
#Set permissions as required.&lt;br /&gt;
#Scroll to the top or bottom of the page and click the &amp;quot;Create this role&amp;quot; button.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
| [[Image:addinganewrole26.png|thumb|Adding a new role and setting context types]]&lt;br /&gt;
| [[Image:permissions125.png|thumb|Choose &amp;quot;Allow&amp;quot; where required]]&lt;br /&gt;
| [[Image:permissions225.png|thumb|Extra options with &amp;quot;Show advanced&amp;quot; enabled]]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Role archetypes==&lt;br /&gt;
&lt;br /&gt;
A role archetype&lt;br /&gt;
&lt;br /&gt;
* Is a hard-coded template for a role&lt;br /&gt;
* Is used during upgrades when adding defaults for new capabilities - no archetype = no new capabilities during upgrade&lt;br /&gt;
* Is used during when resetting a role to determine the defaults - no archetype = reset removes all capabilities&lt;br /&gt;
&lt;br /&gt;
There is no need to set a role archetype for custom roles used for overrides or if the site admin wants to specify new capabilities manually after upgrading.&lt;br /&gt;
&lt;br /&gt;
The archetypes (which relate directly to the built-in roles) are:&lt;br /&gt;
* manager&lt;br /&gt;
* coursecreator&lt;br /&gt;
* editingteacher&lt;br /&gt;
* teacher&lt;br /&gt;
* guest&lt;br /&gt;
* user&lt;br /&gt;
* frontpage&lt;br /&gt;
&lt;br /&gt;
==Creating a duplicate role==&lt;br /&gt;
&lt;br /&gt;
To create a duplicate role:&lt;br /&gt;
#Go to &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Users &amp;gt; Permissions &amp;gt; Define roles&#039;&#039;. &lt;br /&gt;
#Click the &amp;quot;Add a new role&amp;quot; button.&lt;br /&gt;
#Select existing role as a template&lt;br /&gt;
#Give a name and set permissions for your new role; scroll down and click &amp;quot;Create this role&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==New role considerations==&lt;br /&gt;
&lt;br /&gt;
A new role is not automatically listed in course descriptions even if was created by copying a role that is listed, such as Teacher. If you want the new role to appear in the course listing, you must set it explicitly via &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Appearance &amp;gt; Course managers&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Testing a new role==&lt;br /&gt;
&#039;&#039;Administration &amp;gt; Switch role to&#039;&#039;&lt;br /&gt;
Use the &amp;quot;Switch role to&amp;quot; link to see what another role will see in that context.  &lt;br /&gt;
&lt;br /&gt;
Since switching roles confines you to those roles you can assign in a course context, this method is only useful for testing course-scoped capabilities (i.e. it will not be useful for testing permissions that apply outside the course context, like moodle/user:edit).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tip:&#039;&#039; You can always create test user and assign the new role to them.  Then logout as admin and login as the test user.  This is really the best way to test a new role.&lt;br /&gt;
&lt;br /&gt;
==Example custom roles==&lt;br /&gt;
&lt;br /&gt;
*[[Parent role|Parent]] - for providing parents/mentors/tutors with permission to view certain information about their children/mentees/tutees&lt;br /&gt;
*[[Demo teacher role|Demo teacher]] - for providing a demonstration teacher account with a password which can&#039;t be changed&lt;br /&gt;
*[[Forum moderator role|Forum moderator]] - for providing a user with permission in a particular forum to edit or delete forum posts, split discussions and move discussions to other forums&lt;br /&gt;
*[[Calendar editor role|Calendar editor]] - for enabling a user to add site or course events to the calendar&lt;br /&gt;
*[[Blogger role|Blogger]] - for limiting blogging to specific users only&lt;br /&gt;
*[[Quiz user with unlimited time role|Quiz user with unlimited time]] - for allowing a user unlimited time to attempt a quiz which has a time limit set&lt;br /&gt;
*[[Question creator role|Question creator]] - for enabling students to create questions for use in quizzes&lt;br /&gt;
*[[Question sharer]] - for allowing teachers to share questions between courses&lt;br /&gt;
*[[Course requester role]] - for restricting users who can make course requests&lt;br /&gt;
*[[Cohort enroller]] - for allowing teachers to enrol category cohorts into their course&lt;br /&gt;
*[[Feedback template creator]] - for allowing teachers to save as &amp;quot;Public&amp;quot; a Feedback template.&lt;br /&gt;
*[[Grading forms publisher]] for allowing teachers to share Advanced grading forms with others&lt;br /&gt;
*[[Grading forms manager]] for allowing teachers to share Advanced grading forms with others and to delete templates others have created.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
Using Moodle forum discussions:&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=66782 What happens if a user has multiple roles in a course?]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=90140 logged in: what role am I?]&lt;br /&gt;
* For more information, Ask questions and get answers on the [http://moodle.org/mod/forum/view.php?id=6826 &amp;quot;Roles and Permissions&amp;quot;] forum.&lt;br /&gt;
&lt;br /&gt;
[[Category:Site administration]]&lt;br /&gt;
&lt;br /&gt;
[[de:Neue Rollen anlegen]]&lt;br /&gt;
[[es:Crear roles personalizados]]&lt;br /&gt;
[[fr:Création_de_rôles_personnalisés]]&lt;/div&gt;</summary>
		<author><name>Davidbalch</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/31/en/index.php?title=Database_templates&amp;diff=107860</id>
		<title>Database templates</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/31/en/index.php?title=Database_templates&amp;diff=107860"/>
		<updated>2013-11-18T12:37:06Z</updated>

		<summary type="html">&lt;p&gt;Davidbalch: /* Javascript template */  Better JS &amp;amp; YUI approach - ref https://moodle.org/mod/forum/discuss.php?d=243477#p1056563&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Database}}&lt;br /&gt;
Templates for the [[Database activity module]] allow you to control the visual layout of information when listing, viewing or editing database entries. It is a similar to the technique used to &#039;&#039;mail merge&#039;&#039; letters in word processors such as Open Office Writer or Microsoft Word. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Tag usage ==&lt;br /&gt;
&lt;br /&gt;
The content of each [[Database fields|field]] you create for your database and some special tags (listed below) can be inserted into the output template by the use of tags.&lt;br /&gt;
&lt;br /&gt;
Fields have the format &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;[[fieldname]]&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. All other tags have the format &amp;lt;code&amp;gt;##sometag##&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To use the tags in the box on the left of the page, use the HTML viewer, place your cursor in the text area of your target edit and then click on the tag you want to place. Alternatively, you may simply type the appropriate name within the required symbols like &amp;lt;code&amp;gt;##this##&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;[[this]]&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, respectively.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;##edit##&amp;lt;/code&amp;gt; creates a clickable icon link that allows you to edit the current entry (only appears if you have the rights to do this)&lt;br /&gt;
* &amp;lt;code&amp;gt;##delete##&amp;lt;/code&amp;gt; creates a link that lets you delete the current entry (only appears if you have the rights to do this)&lt;br /&gt;
* &amp;lt;code&amp;gt;##approve##&amp;lt;/code&amp;gt; create a link that lets you approve the current database entry (only appears if you have the rights to do this)&lt;br /&gt;
* &amp;lt;code&amp;gt;##more##&amp;lt;/code&amp;gt; creates a link to the single view, which may contain more detailed info&lt;br /&gt;
* &amp;lt;code&amp;gt;##moreurl##&amp;lt;/code&amp;gt; creates just the URL for the above link, useful for creating your own links. You can click on the link icon and type &amp;lt;code&amp;gt;##moreurl##&amp;lt;/code&amp;gt; into URL field or in source view type &amp;lt;pre&amp;gt;&amp;lt;a href=&amp;quot;##moreurl##&amp;quot;&amp;gt;[[fieldname]]&amp;lt;/a&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;##comments##&amp;lt;/code&amp;gt; creates a link to the view/edit comments page, the link text is the current number of comments (only appears if comments are turned on)&lt;br /&gt;
* &amp;lt;code&amp;gt;##user##&amp;lt;/code&amp;gt; creates a link to the user page of the user who submitted the entry, link text is their name&lt;br /&gt;
* &amp;lt;code&amp;gt;##timeadded##&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;##timemodified##&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== List template ==&lt;br /&gt;
&lt;br /&gt;
This template allows you to control the fields used and their layout when viewing multiple entries at once (e.g. search results). It is possible that this view may simply provide an overview with more detailed information available by clicking on an entry to access the single view of the entry.&lt;br /&gt;
&lt;br /&gt;
See [http://tracker.moodle.org/secure/attachment/23333/moodle_databse_activity_list_formatting.pdf Designing a list view in Moodle database activity] for instructions on how to create a list template table.&lt;br /&gt;
&lt;br /&gt;
The list template can also be used as a way to [[Database export|export your database]] as a CSV file.&lt;br /&gt;
&lt;br /&gt;
== Single template ==&lt;br /&gt;
This is used to display a single entry at a time and so has more space for display and can use, for example, larger versions of images or optionally provide more information than shown in the list view.&lt;br /&gt;
&lt;br /&gt;
[[Image:Databasesingletemplate.png]]&lt;br /&gt;
&lt;br /&gt;
== Advanced search template ==&lt;br /&gt;
&lt;br /&gt;
An advanced search template is for creating the interface form used in the advanced search. &lt;br /&gt;
&lt;br /&gt;
== Add template ==&lt;br /&gt;
&lt;br /&gt;
This template creates the interface form used when adding or editing database entries. &lt;br /&gt;
&lt;br /&gt;
== RSS template ==&lt;br /&gt;
&lt;br /&gt;
Lets you control the content of the [[RSS]] feed for database entries.&lt;br /&gt;
&lt;br /&gt;
== CSS template ==&lt;br /&gt;
&lt;br /&gt;
If any of the [[HTML in Moodle|HTML]] in your other templates requires [[CSS]] to provide visual style you can specify it here.&lt;br /&gt;
&lt;br /&gt;
== Javascript template ==&lt;br /&gt;
&lt;br /&gt;
You can use javascript to manipulate the way elements are displayed in either the List, Single or Add templates. Basically you need to enclose the part you want to manipulate in some named html element. The naming is essential as it allows you to identify the element for manipulation. &lt;br /&gt;
&lt;br /&gt;
Let&#039;s say, for example, you have a field in your database that stores a person&#039;s name and when you display the names in the List View you want to count the times a name matches some criteria and display the result.&lt;br /&gt;
&lt;br /&gt;
Your database will contain a field which we will call &amp;quot;name&amp;quot;. In your List template you will be able to display the contents of that field by using the &amp;lt;nowiki&amp;gt;[[name]]&amp;lt;/nowiki&amp;gt; construct at the place where you want that information displayed. For example in the &#039;&#039;Repeated entry&#039;&#039; on the list template you will have&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &amp;lt;table&amp;gt;&lt;br /&gt;
   &amp;lt;tr&amp;gt;&lt;br /&gt;
     &amp;lt;td&amp;gt;Name: [[name]]&amp;lt;/td&amp;gt;&lt;br /&gt;
   &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;table&amp;gt;  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You now need to modify that entry to ensure that the part you want to manipulate is a named element.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &amp;lt;table&amp;gt;&lt;br /&gt;
   &amp;lt;tr&amp;gt;&lt;br /&gt;
     &amp;lt;td name=&amp;quot;named&amp;quot;&amp;gt;Name: [[name]]&amp;lt;/td&amp;gt;&lt;br /&gt;
   &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;table&amp;gt;  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The footer of your list view can then contain another named element to display the result.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;div name=&amp;quot;result&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Your javascript template can now look as follows&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 var cnt = 0;&lt;br /&gt;
 var re = /foo|Foo/;&lt;br /&gt;
 &lt;br /&gt;
 function init(){&lt;br /&gt;
   var namedElements = document.getElementsByName(&amp;quot;named&amp;quot;);&lt;br /&gt;
   for (i=0; i &amp;lt; namedElements.length; i++) {&lt;br /&gt;
       if(re.test(namedElements[i].innerHTML)) cnt++;&lt;br /&gt;
     }&lt;br /&gt;
   var namedResult = document.getElementsByName(&amp;quot;result&amp;quot;);&lt;br /&gt;
   namedResult[0].innerHTML = cnt;&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
 window.onload = init;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will display a table of names as is usual in the list view. Now at the bottom there will also be the count of the names that matched foo or Foo.&lt;br /&gt;
&lt;br /&gt;
Note that window.onload does not handle any dependencies on [https://docs.moodle.org/dev/Javascript_FAQ#What_JavaScript_library_does_Moodle_use.3F YUI] code, so any YUI modules required by your init() code may not be loaded, and your code will fail.&lt;br /&gt;
&lt;br /&gt;
In this case, instead of onload, use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
YUI().use(&#039;node&#039;, &#039;other&#039;, &#039;dependencies&#039;, function(Y) {&lt;br /&gt;
&lt;br /&gt;
  // Your code here.&lt;br /&gt;
&lt;br /&gt;
  // This function is a closure so the Y object you define in the function definition is yours and nothing else on the page should be able to break it.&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Reset templates button ==&lt;br /&gt;
&lt;br /&gt;
When you first create a database the templates will be pre-filled with appropriate HTML. If you later add fields then you can press the &#039;&#039;reset templates&#039;&#039; button and it will add HTML for the new fields in a similar fashion. If you have edited any of the templates in the meantime then your changes will be lost. It is recommended that you finalize the database fields before changing the template code.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*[[Database presets]]&lt;br /&gt;
*[http://video.google.com/videoplay?docid=7026851446099005477 Video demonstrating tag usage]&lt;br /&gt;
&lt;br /&gt;
Using Moodle forum discussions: &lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=55338 Look of the database module]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=74243 How can I list database information horizontally instead of vertically?]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=61179 For those who want the display of Moodle Site&#039;s Modules and plugins]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=84050 Can&#039;t get columns to line up in list view]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=86927 Time stamp for database entries?]&lt;br /&gt;
&lt;br /&gt;
[[de:Datenbank-Vorlagen]]&lt;br /&gt;
[[fr:Modèles]]&lt;br /&gt;
[[ru:Шаблоны]]&lt;br /&gt;
[[ja:データベーステンプレート]]&lt;/div&gt;</summary>
		<author><name>Davidbalch</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/31/en/index.php?title=Database_templates&amp;diff=107844</id>
		<title>Database templates</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/31/en/index.php?title=Database_templates&amp;diff=107844"/>
		<updated>2013-11-15T11:26:06Z</updated>

		<summary type="html">&lt;p&gt;Davidbalch: /* Javascript template */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Database}}&lt;br /&gt;
Templates for the [[Database activity module]] allow you to control the visual layout of information when listing, viewing or editing database entries. It is a similar to the technique used to &#039;&#039;mail merge&#039;&#039; letters in word processors such as Open Office Writer or Microsoft Word. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Tag usage ==&lt;br /&gt;
&lt;br /&gt;
The content of each [[Database fields|field]] you create for your database and some special tags (listed below) can be inserted into the output template by the use of tags.&lt;br /&gt;
&lt;br /&gt;
Fields have the format &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;[[fieldname]]&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. All other tags have the format &amp;lt;code&amp;gt;##sometag##&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To use the tags in the box on the left of the page, use the HTML viewer, place your cursor in the text area of your target edit and then click on the tag you want to place. Alternatively, you may simply type the appropriate name within the required symbols like &amp;lt;code&amp;gt;##this##&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;[[this]]&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, respectively.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;##edit##&amp;lt;/code&amp;gt; creates a clickable icon link that allows you to edit the current entry (only appears if you have the rights to do this)&lt;br /&gt;
* &amp;lt;code&amp;gt;##delete##&amp;lt;/code&amp;gt; creates a link that lets you delete the current entry (only appears if you have the rights to do this)&lt;br /&gt;
* &amp;lt;code&amp;gt;##approve##&amp;lt;/code&amp;gt; create a link that lets you approve the current database entry (only appears if you have the rights to do this)&lt;br /&gt;
* &amp;lt;code&amp;gt;##more##&amp;lt;/code&amp;gt; creates a link to the single view, which may contain more detailed info&lt;br /&gt;
* &amp;lt;code&amp;gt;##moreurl##&amp;lt;/code&amp;gt; creates just the URL for the above link, useful for creating your own links. You can click on the link icon and type &amp;lt;code&amp;gt;##moreurl##&amp;lt;/code&amp;gt; into URL field or in source view type &amp;lt;pre&amp;gt;&amp;lt;a href=&amp;quot;##moreurl##&amp;quot;&amp;gt;[[fieldname]]&amp;lt;/a&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;##comments##&amp;lt;/code&amp;gt; creates a link to the view/edit comments page, the link text is the current number of comments (only appears if comments are turned on)&lt;br /&gt;
* &amp;lt;code&amp;gt;##user##&amp;lt;/code&amp;gt; creates a link to the user page of the user who submitted the entry, link text is their name&lt;br /&gt;
* &amp;lt;code&amp;gt;##timeadded##&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;##timemodified##&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== List template ==&lt;br /&gt;
&lt;br /&gt;
This template allows you to control the fields used and their layout when viewing multiple entries at once (e.g. search results). It is possible that this view may simply provide an overview with more detailed information available by clicking on an entry to access the single view of the entry.&lt;br /&gt;
&lt;br /&gt;
See [http://tracker.moodle.org/secure/attachment/23333/moodle_databse_activity_list_formatting.pdf Designing a list view in Moodle database activity] for instructions on how to create a list template table.&lt;br /&gt;
&lt;br /&gt;
The list template can also be used as a way to [[Database export|export your database]] as a CSV file.&lt;br /&gt;
&lt;br /&gt;
== Single template ==&lt;br /&gt;
This is used to display a single entry at a time and so has more space for display and can use, for example, larger versions of images or optionally provide more information than shown in the list view.&lt;br /&gt;
&lt;br /&gt;
[[Image:Databasesingletemplate.png]]&lt;br /&gt;
&lt;br /&gt;
== Advanced search template ==&lt;br /&gt;
&lt;br /&gt;
An advanced search template is for creating the interface form used in the advanced search. &lt;br /&gt;
&lt;br /&gt;
== Add template ==&lt;br /&gt;
&lt;br /&gt;
This template creates the interface form used when adding or editing database entries. &lt;br /&gt;
&lt;br /&gt;
== RSS template ==&lt;br /&gt;
&lt;br /&gt;
Lets you control the content of the [[RSS]] feed for database entries.&lt;br /&gt;
&lt;br /&gt;
== CSS template ==&lt;br /&gt;
&lt;br /&gt;
If any of the [[HTML in Moodle|HTML]] in your other templates requires [[CSS]] to provide visual style you can specify it here.&lt;br /&gt;
&lt;br /&gt;
== Javascript template ==&lt;br /&gt;
&lt;br /&gt;
You can use javascript to manipulate the way elements are displayed in either the List, Single or Add templates. Basically you need to enclose the part you want to manipulate in some named html element. The naming is essential as it allows you to identify the element for manipulation. &lt;br /&gt;
&lt;br /&gt;
Let&#039;s say, for example, you have a field in your database that stores a person&#039;s name and when you display the names in the List View you want to count the times a name matches some criteria and display the result.&lt;br /&gt;
&lt;br /&gt;
Your database will contain a field which we will call &amp;quot;name&amp;quot;. In your List template you will be able to display the contents of that field by using the &amp;lt;nowiki&amp;gt;[[name]]&amp;lt;/nowiki&amp;gt; construct at the place where you want that information displayed. For example in the &#039;&#039;Repeated entry&#039;&#039; on the list template you will have&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &amp;lt;table&amp;gt;&lt;br /&gt;
   &amp;lt;tr&amp;gt;&lt;br /&gt;
     &amp;lt;td&amp;gt;Name: [[name]]&amp;lt;/td&amp;gt;&lt;br /&gt;
   &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;table&amp;gt;  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You now need to modify that entry to ensure that the part you want to manipulate is a named element.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &amp;lt;table&amp;gt;&lt;br /&gt;
   &amp;lt;tr&amp;gt;&lt;br /&gt;
     &amp;lt;td name=&amp;quot;named&amp;quot;&amp;gt;Name: [[name]]&amp;lt;/td&amp;gt;&lt;br /&gt;
   &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;table&amp;gt;  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The footer of your list view can then contain another named element to display the result.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;div name=&amp;quot;result&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Your javascript template can now look as follows&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 var cnt = 0;&lt;br /&gt;
 var re = /foo|Foo/;&lt;br /&gt;
 &lt;br /&gt;
 function init(){&lt;br /&gt;
   var namedElements = document.getElementsByName(&amp;quot;named&amp;quot;);&lt;br /&gt;
   for (i=0; i &amp;lt; namedElements.length; i++) {&lt;br /&gt;
       if(re.test(namedElements[i].innerHTML)) cnt++;&lt;br /&gt;
     }&lt;br /&gt;
   var namedResult = document.getElementsByName(&amp;quot;result&amp;quot;);&lt;br /&gt;
   namedResult[0].innerHTML = cnt;&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
 window.onload = init;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will display a table of names as is usual in the list view. Now at the bottom there will also be the count of the names that matched foo or Foo.&lt;br /&gt;
&lt;br /&gt;
Note that window.onload does not handle any dependencies on [https://docs.moodle.org/dev/Javascript_FAQ#What_JavaScript_library_does_Moodle_use.3F YUI] code, so any YUI modules required by your init() code may not be loaded, and your code will fail. In this case, use a Y.use() call.&lt;br /&gt;
&lt;br /&gt;
== Reset templates button ==&lt;br /&gt;
&lt;br /&gt;
When you first create a database the templates will be pre-filled with appropriate HTML. If you later add fields then you can press the &#039;&#039;reset templates&#039;&#039; button and it will add HTML for the new fields in a similar fashion. If you have edited any of the templates in the meantime then your changes will be lost. It is recommended that you finalize the database fields before changing the template code.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*[[Database presets]]&lt;br /&gt;
*[http://video.google.com/videoplay?docid=7026851446099005477 Video demonstrating tag usage]&lt;br /&gt;
&lt;br /&gt;
Using Moodle forum discussions: &lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=55338 Look of the database module]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=74243 How can I list database information horizontally instead of vertically?]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=61179 For those who want the display of Moodle Site&#039;s Modules and plugins]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=84050 Can&#039;t get columns to line up in list view]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=86927 Time stamp for database entries?]&lt;br /&gt;
&lt;br /&gt;
[[de:Datenbank-Vorlagen]]&lt;br /&gt;
[[fr:Modèles]]&lt;br /&gt;
[[ru:Шаблоны]]&lt;br /&gt;
[[ja:データベーステンプレート]]&lt;/div&gt;</summary>
		<author><name>Davidbalch</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/31/en/index.php?title=Database_templates&amp;diff=107822</id>
		<title>Database templates</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/31/en/index.php?title=Database_templates&amp;diff=107822"/>
		<updated>2013-11-15T10:31:11Z</updated>

		<summary type="html">&lt;p&gt;Davidbalch: /* Javascript template */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Database}}&lt;br /&gt;
Templates for the [[Database activity module]] allow you to control the visual layout of information when listing, viewing or editing database entries. It is a similar to the technique used to &#039;&#039;mail merge&#039;&#039; letters in word processors such as Open Office Writer or Microsoft Word. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Tag usage ==&lt;br /&gt;
&lt;br /&gt;
The content of each [[Database fields|field]] you create for your database and some special tags (listed below) can be inserted into the output template by the use of tags.&lt;br /&gt;
&lt;br /&gt;
Fields have the format &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;[[fieldname]]&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. All other tags have the format &amp;lt;code&amp;gt;##sometag##&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To use the tags in the box on the left of the page, use the HTML viewer, place your cursor in the text area of your target edit and then click on the tag you want to place. Alternatively, you may simply type the appropriate name within the required symbols like &amp;lt;code&amp;gt;##this##&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;[[this]]&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, respectively.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;##edit##&amp;lt;/code&amp;gt; creates a clickable icon link that allows you to edit the current entry (only appears if you have the rights to do this)&lt;br /&gt;
* &amp;lt;code&amp;gt;##delete##&amp;lt;/code&amp;gt; creates a link that lets you delete the current entry (only appears if you have the rights to do this)&lt;br /&gt;
* &amp;lt;code&amp;gt;##approve##&amp;lt;/code&amp;gt; create a link that lets you approve the current database entry (only appears if you have the rights to do this)&lt;br /&gt;
* &amp;lt;code&amp;gt;##more##&amp;lt;/code&amp;gt; creates a link to the single view, which may contain more detailed info&lt;br /&gt;
* &amp;lt;code&amp;gt;##moreurl##&amp;lt;/code&amp;gt; creates just the URL for the above link, useful for creating your own links. You can click on the link icon and type &amp;lt;code&amp;gt;##moreurl##&amp;lt;/code&amp;gt; into URL field or in source view type &amp;lt;pre&amp;gt;&amp;lt;a href=&amp;quot;##moreurl##&amp;quot;&amp;gt;[[fieldname]]&amp;lt;/a&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;##comments##&amp;lt;/code&amp;gt; creates a link to the view/edit comments page, the link text is the current number of comments (only appears if comments are turned on)&lt;br /&gt;
* &amp;lt;code&amp;gt;##user##&amp;lt;/code&amp;gt; creates a link to the user page of the user who submitted the entry, link text is their name&lt;br /&gt;
* &amp;lt;code&amp;gt;##timeadded##&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;##timemodified##&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== List template ==&lt;br /&gt;
&lt;br /&gt;
This template allows you to control the fields used and their layout when viewing multiple entries at once (e.g. search results). It is possible that this view may simply provide an overview with more detailed information available by clicking on an entry to access the single view of the entry.&lt;br /&gt;
&lt;br /&gt;
See [http://tracker.moodle.org/secure/attachment/23333/moodle_databse_activity_list_formatting.pdf Designing a list view in Moodle database activity] for instructions on how to create a list template table.&lt;br /&gt;
&lt;br /&gt;
The list template can also be used as a way to [[Database export|export your database]] as a CSV file.&lt;br /&gt;
&lt;br /&gt;
== Single template ==&lt;br /&gt;
This is used to display a single entry at a time and so has more space for display and can use, for example, larger versions of images or optionally provide more information than shown in the list view.&lt;br /&gt;
&lt;br /&gt;
[[Image:Databasesingletemplate.png]]&lt;br /&gt;
&lt;br /&gt;
== Advanced search template ==&lt;br /&gt;
&lt;br /&gt;
An advanced search template is for creating the interface form used in the advanced search. &lt;br /&gt;
&lt;br /&gt;
== Add template ==&lt;br /&gt;
&lt;br /&gt;
This template creates the interface form used when adding or editing database entries. &lt;br /&gt;
&lt;br /&gt;
== RSS template ==&lt;br /&gt;
&lt;br /&gt;
Lets you control the content of the [[RSS]] feed for database entries.&lt;br /&gt;
&lt;br /&gt;
== CSS template ==&lt;br /&gt;
&lt;br /&gt;
If any of the [[HTML in Moodle|HTML]] in your other templates requires [[CSS]] to provide visual style you can specify it here.&lt;br /&gt;
&lt;br /&gt;
== Javascript template ==&lt;br /&gt;
&lt;br /&gt;
You can use javascript to manipulate the way elements are displayed in either the List, Single or Add templates. Basically you need to enclose the part you want to manipulate in some named html element. The naming is essential as it allows you to identify the element for manipulation. &lt;br /&gt;
&lt;br /&gt;
Let&#039;s say, for example, you have a field in your database that stores a person&#039;s name and when you display the names in the List View you want to count the times a name matches some criteria and display the result.&lt;br /&gt;
&lt;br /&gt;
Your database will contain a field which we will call &amp;quot;name&amp;quot;. In your List template you will be able to display the contents of that field by using the &amp;lt;nowiki&amp;gt;[[name]]&amp;lt;/nowiki&amp;gt; construct at the place where you want that information displayed. For example in the &#039;&#039;Repeated entry&#039;&#039; on the list template you will have&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &amp;lt;table&amp;gt;&lt;br /&gt;
   &amp;lt;tr&amp;gt;&lt;br /&gt;
     &amp;lt;td&amp;gt;Name: [[name]]&amp;lt;/td&amp;gt;&lt;br /&gt;
   &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;table&amp;gt;  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You now need to modify that entry to ensure that the part you want to manipulate is a named element.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &amp;lt;table&amp;gt;&lt;br /&gt;
   &amp;lt;tr&amp;gt;&lt;br /&gt;
     &amp;lt;td name=&amp;quot;named&amp;quot;&amp;gt;Name: [[name]]&amp;lt;/td&amp;gt;&lt;br /&gt;
   &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;table&amp;gt;  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The footer of your list view can then contain another named element to display the result.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;div name=&amp;quot;result&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Your javascript template can now look as follows&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 var cnt = 0;&lt;br /&gt;
 var re = /foo|Foo/;&lt;br /&gt;
 &lt;br /&gt;
 function init(){&lt;br /&gt;
   var namedElements = document.getElementsByName(&amp;quot;named&amp;quot;);&lt;br /&gt;
   for (i=0; i &amp;lt; namedElements.length; i++) {&lt;br /&gt;
       if(re.test(namedElements[i].innerHTML)) cnt++;&lt;br /&gt;
     }&lt;br /&gt;
   var namedResult = document.getElementsByName(&amp;quot;result&amp;quot;);&lt;br /&gt;
   namedResult[0].innerHTML = cnt;&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
 window.onload = init;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will display a table of names as is usual in the list view. Now at the bottom there will also be the count of the names that matched foo or Foo.&lt;br /&gt;
&lt;br /&gt;
Note that window.onload does not handle any dependencies on [https://docs.moodle.org/dev/Javascript_FAQ#What_JavaScript_library_does_Moodle_use.3F YUI] code, so any YUI modules required by your init() code may not be loaded, and your code will fail.&lt;br /&gt;
&lt;br /&gt;
== Reset templates button ==&lt;br /&gt;
&lt;br /&gt;
When you first create a database the templates will be pre-filled with appropriate HTML. If you later add fields then you can press the &#039;&#039;reset templates&#039;&#039; button and it will add HTML for the new fields in a similar fashion. If you have edited any of the templates in the meantime then your changes will be lost. It is recommended that you finalize the database fields before changing the template code.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*[[Database presets]]&lt;br /&gt;
*[http://video.google.com/videoplay?docid=7026851446099005477 Video demonstrating tag usage]&lt;br /&gt;
&lt;br /&gt;
Using Moodle forum discussions: &lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=55338 Look of the database module]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=74243 How can I list database information horizontally instead of vertically?]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=61179 For those who want the display of Moodle Site&#039;s Modules and plugins]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=84050 Can&#039;t get columns to line up in list view]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=86927 Time stamp for database entries?]&lt;br /&gt;
&lt;br /&gt;
[[de:Datenbank-Vorlagen]]&lt;br /&gt;
[[fr:Modèles]]&lt;br /&gt;
[[ru:Шаблоны]]&lt;br /&gt;
[[ja:データベーステンプレート]]&lt;/div&gt;</summary>
		<author><name>Davidbalch</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/31/en/index.php?title=Embedding_content&amp;diff=88984</id>
		<title>Embedding content</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/31/en/index.php?title=Embedding_content&amp;diff=88984"/>
		<updated>2011-08-31T13:38:14Z</updated>

		<summary type="html">&lt;p&gt;Davidbalch: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Working with media}}&lt;br /&gt;
&amp;lt;p class=&amp;quot;note&amp;quot;&amp;gt;&#039;&#039;&#039;Please refer to [[Page_notes#Embedding content|these notes]] before editing this page.&#039;&#039;&#039;&amp;lt;/p&amp;gt;&lt;br /&gt;
{{Improve}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Embedding media files ==&lt;br /&gt;
When adding content to a course with a [[Page]] resource, media files can be embedded using [[Multimedia_plugins|multimedia plugins]] to take media file URLs entered in the HTML editor and convert them into relevant player software embedded in the page.&lt;br /&gt;
&lt;br /&gt;
== Embedding uploaded resources ==&lt;br /&gt;
&lt;br /&gt;
When adding a File resource to a course, there are several options for how the file will be displayed to the user: Automatic, Embed, Force download, Open, In pop-up, and disabled by default: In frame, and New window. (See [[mod/file/mod|file mod]] for more details on all of these.)&lt;br /&gt;
&lt;br /&gt;
The options relevant to embedding are Embed and In frame:&lt;br /&gt;
=== Embed ===&lt;br /&gt;
This uses a HTML &amp;lt;code&amp;gt;object&amp;lt;/code&amp;gt; element, or &amp;lt;code&amp;gt;iframe&amp;lt;/code&amp;gt; element for older versions of Internet Explorer.&lt;br /&gt;
&lt;br /&gt;
The resource is embedded at a default size 800x600, and automatically resized to fill available space by javascript on page load and resize. Due to the variety of different content that might be embedded (e.g. Flash, PDFs, HTML pages) the resized embed may not maximise use of available screen space, e.g. unused space below the footer.&lt;br /&gt;
&lt;br /&gt;
=== In frame ===&lt;br /&gt;
This uses a resizable HTML &amp;lt;code&amp;gt;frameset&amp;lt;/code&amp;gt; with an upper &amp;lt;code&amp;gt;frame&amp;lt;/code&amp;gt; to show the Moodle heading (with navigation) and the file description, with the file displayed in a &amp;lt;code&amp;gt;frame&amp;lt;/code&amp;gt; below.&lt;br /&gt;
&lt;br /&gt;
Disabled by default, In frame is not recommended as frames have been depreciated in recent versions of the HTML standard, due to the problems they create for accessibility.&lt;br /&gt;
It can be enabled via &#039;&#039;Site administration &amp;gt; Plugins &amp;gt; Activity modules &amp;gt; File&#039;&#039;.&lt;/div&gt;</summary>
		<author><name>Davidbalch</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/31/en/index.php?title=Embedding_content&amp;diff=88981</id>
		<title>Embedding content</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/31/en/index.php?title=Embedding_content&amp;diff=88981"/>
		<updated>2011-08-31T12:56:56Z</updated>

		<summary type="html">&lt;p&gt;Davidbalch: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Working with media}}&lt;br /&gt;
&amp;lt;p class=&amp;quot;note&amp;quot;&amp;gt;&#039;&#039;&#039;Please refer to [[Page_notes#Embedding content|these notes]] before editing this page.&#039;&#039;&#039;&amp;lt;/p&amp;gt;&lt;br /&gt;
{{Improve}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Embedding media files ==&lt;br /&gt;
When adding content to a course with a [[Page]] resource, media files can be embedded using [[Multimedia_plugins|multimedia plugins]] to take media file URLs entered in the HTML editor and convert them into relevant player software embedded in the page.&lt;br /&gt;
&lt;br /&gt;
== Embedding uploaded resources ==&lt;br /&gt;
&lt;br /&gt;
When adding a File resource to a course, there are several options for how the file will be displayed to the user: Automatic, Embed, Force download, Open, In pop-up, and disabled by default: In frame, and New window. (See [[mod/file/mod|file mod]] for more details on all of these.)&lt;br /&gt;
&lt;br /&gt;
The options relevant to embedding are Embed and In frame:&lt;br /&gt;
=== Embed ===&lt;br /&gt;
This uses a HTML &amp;lt;code&amp;gt;object&amp;lt;/code&amp;gt; element, or &amp;lt;code&amp;gt;iframe&amp;lt;/code&amp;gt; element for older versions of Internet Explorer. The resource is embedded at a default size 800x600, and automatically resized to fill available space by javascript on page load and resize.&lt;br /&gt;
&lt;br /&gt;
=== In frame ===&lt;br /&gt;
This uses a resizable HTML &amp;lt;code&amp;gt;frameset&amp;lt;/code&amp;gt; with an upper &amp;lt;code&amp;gt;frame&amp;lt;/code&amp;gt; to show the Moodle heading (with navigation) and the file description, with the file displayed in a &amp;lt;code&amp;gt;frame&amp;lt;/code&amp;gt; below.&lt;br /&gt;
&lt;br /&gt;
Disabled by default, In frame is not recommended as frames have been depreciated in recent versions of the HTML standard, due to the problems they create for accessibility.&lt;br /&gt;
It can be enabled via &#039;&#039;Site administration &amp;gt; Plugins &amp;gt; Activity modules &amp;gt; File&#039;&#039;.&lt;/div&gt;</summary>
		<author><name>Davidbalch</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/31/en/index.php?title=Embedding_content&amp;diff=88978</id>
		<title>Embedding content</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/31/en/index.php?title=Embedding_content&amp;diff=88978"/>
		<updated>2011-08-31T11:37:14Z</updated>

		<summary type="html">&lt;p&gt;Davidbalch: First pass.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Working with media}}&lt;br /&gt;
&amp;lt;p class=&amp;quot;note&amp;quot;&amp;gt;&#039;&#039;&#039;Please refer to [[Page_notes#Embedding content|these notes]] before editing this page.&#039;&#039;&#039;&amp;lt;/p&amp;gt;&lt;br /&gt;
{{Improve}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Embedding media files ==&lt;br /&gt;
When adding content to a course with a [[Page]] resource, media files can be embedded using [[Multimedia_plugins|multimedia plugins]] to take media file URLs entered in the HTML editor and convert them into relevant player software embedded in the page.&lt;br /&gt;
&lt;br /&gt;
== Embedding uploaded resources ==&lt;br /&gt;
&lt;br /&gt;
When adding a File resource to a course, there are several options for how the file will be displayed to the user: Automatic, Embed, Force download, Open, In pop-up, and disabled by default: In frame, and New window. (See [[mod/file/mod|file mod]] for more details on all of these.)&lt;br /&gt;
&lt;br /&gt;
The options relevant to embedding are Embed and In frame:&lt;br /&gt;
=== Embed ===&lt;br /&gt;
This uses a HTML &amp;lt;code&amp;gt;object&amp;lt;/code&amp;gt; element, or &amp;lt;code&amp;gt;iframe&amp;lt;/code&amp;gt; element for older versions of Internet Explorer.&lt;br /&gt;
&lt;br /&gt;
=== In frame ===&lt;br /&gt;
This uses a resizable HTML &amp;lt;code&amp;gt;frameset&amp;lt;/code&amp;gt; with an upper &amp;lt;code&amp;gt;frame&amp;lt;/code&amp;gt; to show the Moodle heading (with navigation) and the file description, with the file displayed in a &amp;lt;code&amp;gt;frame&amp;lt;/code&amp;gt; below.&lt;br /&gt;
&lt;br /&gt;
Disabled by default, In frame is not recommended due to accessibility problems caused by HTML frames.&lt;br /&gt;
It can be enabled via &#039;&#039;Site administration &amp;gt; Plugins &amp;gt; Activity modules &amp;gt; File&#039;&#039;.&lt;/div&gt;</summary>
		<author><name>Davidbalch</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/31/en/index.php?title=Upload_users&amp;diff=76307</id>
		<title>Upload users</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/31/en/index.php?title=Upload_users&amp;diff=76307"/>
		<updated>2010-09-29T09:15:55Z</updated>

		<summary type="html">&lt;p&gt;Davidbalch: Change &amp;quot;Enrolment field names&amp;quot; layout to make it more comprehensible&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Location: &#039;&#039;Administration &amp;gt; Users &amp;gt; Accounts &amp;gt; Upload users&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Upload users preview.png|thumb|Upload users preview in Moodle 1.9]]&lt;br /&gt;
Firstly, note that it is usually not necessary to import users in bulk - to keep maintenance work down you should first explore forms of authentication that do not require manual maintenance, such as [[External database authentication|connecting to existing external databases]] or letting the [[Internal enrolment|users create their own accounts]]. See [[Manage authentication]] for more information.&lt;br /&gt;
&lt;br /&gt;
If you are sure you want to import multiple user accounts from a text file, then you need to format your text file as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Upload file format==&lt;br /&gt;
&lt;br /&gt;
* Each line of the file contains one record&lt;br /&gt;
* Each record is a series of data separated by commas (or other delimiters)&lt;br /&gt;
* The first record of the file is special, and contains a list of fieldnames. This defines the format of the rest of the file.&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;&#039;Required fieldnames&#039;&#039;&#039;: These fields must be included in the first record, and defined for each user&lt;br /&gt;
:&amp;lt;p&amp;gt;&amp;lt;code&amp;gt;username, password, firstname, lastname, email&amp;lt;/code&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
:&amp;lt;p&amp;gt;Remember that validity checks for the username, password, and email fields will be performed.Usernames can only contain alphabetical letters in lowercase, numbers, hypen &#039;-&#039;, underscore &#039;_&#039;, period &#039;.&#039;, or at sign &#039;@&#039;. Passwords should meet the requirements specified for the site&#039;s [[Site_policies#Password_policy|Password policy]]. Emails should be in the format of a valid email.&amp;lt;/p&amp;gt; &lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;&#039;Optional fieldnames&#039;&#039;&#039;: If a value is present for the field in the file, then that value is used; else, the default value for that field is used&lt;br /&gt;
:&amp;lt;p&amp;gt;&amp;lt;code&amp;gt;institution, department, city, country, lang, auth, ajax, timezone, idnumber, icq, phone1, phone2, address, url, description, mailformat, maildisplay, htmleditor, autosubscribe, emailstop&amp;lt;/code&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;&#039;Custom profile field names&#039;&#039;&#039;: Optional, xxxxx is the real custom user profile field name (i.e. the unique short name)&lt;br /&gt;
:&amp;lt;p&amp;gt;&amp;lt;code&amp;gt;profile_field_xxxxx&amp;lt;/code&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
:&#039;&#039;&#039;Warning:&#039;&#039;&#039;: If you want to create custom profile fields, you need to follow the standard header in your .csv file to import users. You must create the custom fields BEFORE importing users from list. The &amp;quot;shortname&amp;quot; for your custom field is xxxxx, and the header collumn to all users data in .csv file have standard notation &amp;quot;profile_field_xxxxx&amp;quot;.&lt;br /&gt;
:&#039;&#039;&#039;Example&#039;&#039;&#039;: If you want to create a custom field &amp;quot;genre&amp;quot; in your Moodle site, you must write a shortname &amp;quot;genre&amp;quot; in the new field, and write &amp;quot;profile_field_genre&amp;quot; in the header of the .csv file.&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;&#039;Special field names&#039;&#039;&#039;: Used for changing of usernames and deleting of users&lt;br /&gt;
:&amp;lt;p&amp;gt;&amp;lt;code&amp;gt;deleted, oldusername&amp;lt;/code&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
:&#039;&#039;&#039;Enrolment field names&#039;&#039;&#039;: Optional:&lt;br /&gt;
** The course names are the &amp;quot;shortnames&amp;quot; of the courses - if present then the user will be enrolled in those courses.&lt;br /&gt;
** &amp;quot;Type&amp;quot; means type of role to be used for associated course enrolment. Value 1 is default course role, 2 is legacy Teacher role and 3 is legacy Non-editing Teacher.&lt;br /&gt;
** You can use role field instead to specify roles directly - use either role short name or id (numeric names of roles are not supported).&lt;br /&gt;
** Users may be also assigned to groups in course (group1 in course1, group2 in course2, etc.).&lt;br /&gt;
** Groups are again identified by its names or ids (numeric names of groups are not supported).&lt;br /&gt;
** From Moodle 2.0, you can also set the enrolment duration in days for each course (enrolperiod1 for course1, enrolperiod2 for course 2, etc.).&lt;br /&gt;
:&amp;lt;p&amp;gt;&amp;lt;code&amp;gt;course1, type1, role1, group1, enrolperiod1, course2, type2, role2, group2, enrolperiod2&amp;lt;/code&amp;gt; etc.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Commas within the data should be encoded as &amp;amp;#44 - the script will automatically decode these back to commas.&lt;br /&gt;
* For Boolean fields, use 0 for false and 1 for true.&lt;br /&gt;
* Force password change: Set the password field for desired users to &#039;&#039;&#039;changeme&#039;&#039;&#039;.&lt;br /&gt;
* Turn email off: The parameter &#039;&#039;&#039;emailstop&#039;&#039;&#039; must be set to 1 if the email address should not work. If you set it to 0 then the email address is switched on. If you want to have all the email addresses active then you do not need the additional parameter in your upload file.&lt;br /&gt;
* In order to prevent users from receiving a larger number of emails from courses and forced subscription forums use the &#039;&#039;&#039;maildigest&#039;&#039;&#039; fieldname.  The options for this fieldname are 0 = No digest, 1 = Complete digest and 2 = Digest with just subjects.&lt;br /&gt;
&lt;br /&gt;
Here is an example of a valid import file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;username, password, firstname, lastname, email, lang, idnumber, maildisplay, course1, group1, type1&amp;lt;br /&amp;gt;&lt;br /&gt;
jonest, verysecret, Tom, Jones, jonest@someplace.edu, en, 3663737, 1, Junk102, Section 1, 1&amp;lt;br /&amp;gt;&lt;br /&gt;
reznort, somesecret, Trent, Reznor, reznort@someplace.edu, en_us, 6736733, 0, Junk102, Section 3, 3&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Templates==&lt;br /&gt;
&lt;br /&gt;
The default values are processed as templates in which the following codes are allowed:&lt;br /&gt;
&lt;br /&gt;
* %l - will be replaced by the lastname&lt;br /&gt;
* %f - will be replaced by the firstname&lt;br /&gt;
* %u - will be replaced by the username&lt;br /&gt;
* %% - will be replaced by the %&lt;br /&gt;
&lt;br /&gt;
Between the percent sign (%) and any code letter (l, f or u) the following modifiers are allowed:&lt;br /&gt;
&lt;br /&gt;
* (-) minus sign - the information specified by the code letter will be converted to lowercase&lt;br /&gt;
* (+) plus sign - the information specified by the code letter will be converted to UPPERCASE&lt;br /&gt;
* (~) tilde sign - the information specified by the code letter will be converted to Title Case&lt;br /&gt;
* a decimal number - the information specified by the code letter will be truncated to that many characters&lt;br /&gt;
&lt;br /&gt;
For example, if the firstname is John and the lastname is Doe, the following values will be obtained with the specified templates:&lt;br /&gt;
&lt;br /&gt;
* %l%f = DoeJohn&lt;br /&gt;
* %l%1f = DoeJ&lt;br /&gt;
* %-l%+f = doeJOHN&lt;br /&gt;
* %-f_%-l = john_doe&lt;br /&gt;
* http://www.example.com/~%u/ = http://www.example.com/~jdoe/ (if the username is jdoe or %-1f%-l)&lt;br /&gt;
&lt;br /&gt;
Template processing is done only on default values, and not on the values retrieved from the CSV file.&lt;br /&gt;
&lt;br /&gt;
In order to create correct Moodle usernames, the username is always converted to lowercase. Moreover, if the &amp;quot;Allow extended characters in usernames&amp;quot; option in the Site policies page is off, characters different to letters, digits, dash (-) and dot (.) are removed. For example if the firstname is John Jr. and the lastname is Doe, the username %-f_%-l will produce john jr._doe when Allow extended characters in usernames is on, and johnjr.doe when off.&lt;br /&gt;
&lt;br /&gt;
When the &amp;quot;New username duplicate handling&amp;quot; setting is set to Append counter, an auto-increment counter will be append to duplicate usernames produced by the template. For example, if the CSV file contains the users named John Doe, Jane Doe and Jenny Doe without explicit usernames, the default username is %-1f%-l and New username duplicate handling is set to Append counter, then the usernames produced will be jdoe, jdoe2 and jdoe3. &lt;br /&gt;
&lt;br /&gt;
==Updating existing accounts==&lt;br /&gt;
&lt;br /&gt;
By default Moodle assumes that you will be creating new user accounts, and skips records where the username matches an existing account. However, if you set &amp;quot;Update existing accounts&amp;quot; to &#039;&#039;&#039;Yes&#039;&#039;&#039;, the existing user account will be updated.&lt;br /&gt;
&lt;br /&gt;
When updating existing accounts you can change usernames as well. Set &amp;quot;Allow renames&amp;quot; to &#039;&#039;&#039;Yes&#039;&#039;&#039; and include in your file a field called &amp;lt;code&amp;gt;oldusername&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning&#039;&#039;&#039;: any errors updating existing accounts can affect your users badly. Be careful when using the options to update.&lt;br /&gt;
&lt;br /&gt;
==Deleting accounts==&lt;br /&gt;
&lt;br /&gt;
If the &amp;lt;code&amp;gt;deleted&amp;lt;/code&amp;gt; field is present, users with value 1 for it will be deleted. In this case, all the fields may be omitted, except for &amp;lt;code&amp;gt;username&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Deleting and uploading accounts could be done with a single CSV file. For example, the following file will add the user Tom Jones and delete the user reznort:&lt;br /&gt;
&lt;br /&gt;
 username, firstname, lastname, deleted&lt;br /&gt;
 jonest, Tom, Jones, 0&lt;br /&gt;
 reznort, , , 1 &lt;br /&gt;
&lt;br /&gt;
==Encoding==&lt;br /&gt;
&lt;br /&gt;
In Moodle 1.8 the file must be UTF-8. In Moodle 1.9 onwards, the encoding may be selected from a large list, including ISO-8859-1.&lt;br /&gt;
&lt;br /&gt;
==Hints==&lt;br /&gt;
&lt;br /&gt;
===Spreadsheet===&lt;br /&gt;
&lt;br /&gt;
If you use a spreadsheet program such as Excel to create your .csv file, check the resulting output in a text editor before you upload it.  It is possible to get trailing commas on each line from an empty field if you have added and deleted columns of information prior to saving the final file. Also check the character encoding. A csv file is a simple text file (ASCII or Unicode) that can be used to upload user accounts.&lt;br /&gt;
&lt;br /&gt;
Excel translates passwords that begin with - (minus) or + (plus) as zero. Even when saving as .csv and saying &amp;quot;Yes&amp;quot; to &amp;quot;Keep this format, and leave out any incompatible features.&amp;quot; Check for this before uploading, as a zero halts the upload process.&lt;br /&gt;
&lt;br /&gt;
If you use a formula in Excel to create fields (for example, the concatenate function to create a user name), then remember to copy the cells with the formula and use special paste with values checked to make them into an acceptable data for a csv file.&lt;br /&gt;
&lt;br /&gt;
===Country===&lt;br /&gt;
The country should be written as a two letter code, in capitals. For example, use BE for Belgium or NL for the Netherlands.  Using &amp;quot;be&amp;quot; or &amp;quot;nl&amp;quot; as a country code will result in a database error.&lt;br /&gt;
:&#039;&#039;Tip:&#039;&#039;  If you are having trouble working out the two-letter code for a country, you can consult this Moodle source code file /moodle/lang/en_utf8/countries.php [http://cvs.moodle.org/moodle/lang/en_utf8/countries.php?view=markup&amp;amp;pathrev=MOODLE_19_STABLE or click here for a 1.9 STABLE list].&lt;br /&gt;
ISO Website: [http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm]&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
Moodle Docs:&lt;br /&gt;
*[[Flat file]]&lt;br /&gt;
&lt;br /&gt;
Using Moodle forum discussions:&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=36851 Can I auto enroll from Excel?]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=58215 Making Email Optional]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=97903 Uploading users to custom roles]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=144569 Matriculacion con flat file csv] - discussion in Spanish&lt;br /&gt;
&lt;br /&gt;
[[Category:Authentication]]&lt;br /&gt;
[[Category:Enrolment]]&lt;br /&gt;
[[Category:Groups]]&lt;br /&gt;
&lt;br /&gt;
[[fr:Importer des utilisateurs]]&lt;br /&gt;
[[ja:ユーザのアップロード]]&lt;br /&gt;
[[zh:上传用户]]&lt;br /&gt;
[[ru:Загрузка пользователей]]&lt;/div&gt;</summary>
		<author><name>Davidbalch</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/31/en/index.php?title=Development:NEWMODULE_Documentation&amp;diff=63422</id>
		<title>Development:NEWMODULE Documentation</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/31/en/index.php?title=Development:NEWMODULE_Documentation&amp;diff=63422"/>
		<updated>2009-09-22T09:20:56Z</updated>

		<summary type="html">&lt;p&gt;Davidbalch: Changed icon dimensions, as the files are 16x16. Added description of index.php&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Work in progress}}&lt;br /&gt;
{{New_Module}}&lt;br /&gt;
&lt;br /&gt;
This first draft of Moodle Docs page about the creation of  a new module is divided into the following sections:&lt;br /&gt;
&lt;br /&gt;
*[[Development:NEWMODULE Tutorial]]&lt;br /&gt;
*[[Development:NEWMODULE Reference]]&lt;br /&gt;
*[[Development:NEWMODULE FAQ]]&lt;br /&gt;
*[[Development:NEWMODULE Adding capabilities]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Daniele, did you know about [[Development:Modules]], which is linked to from [[Developer_documentation#Make_a_new_plugin]]? You may be better off editing that, rather than starting a new page. However don&#039;t let me discourage you. That documentation is very limited, and badly needs to be expanded, so it is absolutely brilliant that you want to work on it.--[[User:Tim Hunt|Tim Hunt]] 12:03, 28 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
::Good point Tim! Anyway... I think we can use this as temporary root for Daniele&#039;s work and then, simply, move things to their final place. Let&#039;s see how this evolves. -- [[User:Eloy Lafuente (stronk7)|Eloy Lafuente (stronk7)]] 12:33, 28 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
[http://lyceum.open.ac.uk/temp/creating_moodle_modules.ppt My powerpoint about creating moodle modules] is a bit old (1.8) and maybe not that comprehensible but I use it when I&#039;m trying to explain things to people. It includes a list of all the things you need to have in a module, except the ones I forgot (backuplib iirc is missing). [[User:sam marshall|sam marshall]] 12:52, 28 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
::That&#039;s really great, Sam. For sure that presentation will help.Thanks! -- [[User:Eloy Lafuente (stronk7)|Eloy Lafuente (stronk7)]] 13:08, 28 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dear Tim, Sam and Eloy, I wrote what was my learning path on these issues. I wrote whatever I found in your powerpoint guide (thanks again, Sam) and whatever I got mainly from Tim, Eloy and Petr. A lot of issues are still obscure to me like: grades, groups, groupings, backup and so forth. Please let me know your opinion to make all together a plan to carry on in the best way. Thanks. -- [[User:Daniele Cordella|Daniele Cordella]] 11:55, 10 September 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
==Getting started==&lt;br /&gt;
&lt;br /&gt;
To download the newmodule package, please refer to:&lt;br /&gt;
:* 1.8: http://download.moodle.org/plugins18/mod/NEWMODULE.zip&lt;br /&gt;
:* 1.9: http://download.moodle.org/plugins19/mod/NEWMODULE.zip&lt;br /&gt;
:* HEAD: http://download.moodle.org/plugins/mod/NEWMODULE.zip&lt;br /&gt;
&lt;br /&gt;
Although you can download the newmodule package for moodle 1.8, such as 1.9 and head, this tutorial is intended for the newmodule development in Moodle 1.9 ONLY.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s start by getting an idea about what you find in the newmodule folder taken from http://download.moodle.org/plugins19/mod/NEWMODULE.zip&lt;br /&gt;
&amp;lt;pre&amp;gt;NEWMODULE:&lt;br /&gt;
01)    db/install.xml&lt;br /&gt;
02)    db/upgrade.php&lt;br /&gt;
03)    icon.gif&lt;br /&gt;
04)    index.php&lt;br /&gt;
05)    lang/en_utf8/help/newmodule/index.html&lt;br /&gt;
06)    lang/en_utf8/help/newmodule/mods.html&lt;br /&gt;
07)    lang/en_utf8/newmodule.php&lt;br /&gt;
08)    lib.php&lt;br /&gt;
09)    mod_form.php&lt;br /&gt;
10)    README.txt&lt;br /&gt;
11)    version.php&lt;br /&gt;
12)    view.php&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The path where you find each file is the correct one. So don&#039;t change the path of files and folders in this newmodule package.&lt;br /&gt;
&lt;br /&gt;
Inside the db folder, at the beginning, you can only find install.xml and upgrade.php but sooner you will start to always add the new file &amp;quot;access.php&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
01) &#039;&#039;&#039;db/install.xml&#039;&#039;&#039; is the file to write the xml describing the tables needed by the module. Tables are at least two, one named with the same name of the module, one named &amp;quot;log_display&amp;quot;. They follow a strict syntax that you can learn by editing one of the several example you can find inside moodle modules. Ultimately the only thing to take care is the &amp;lt;&amp;lt;previous&amp;gt;&amp;gt; &amp;lt;&amp;lt;next&amp;gt;&amp;gt; connection between tables and fields. This is the mandatory file where you MUST write the structure of the tables your module is going to use. Tha table &amp;quot;log_display&amp;quot; is the tables where you are requested to list all the &amp;quot;actions&amp;quot; that you will add to the logs of your module.&lt;br /&gt;
&lt;br /&gt;
02) &#039;&#039;&#039;db/upgrade.php&#039;&#039;&#039; is the file that you will write each time you need to change the structure of the tables of your module. To learn how to write this file, please refer to the examples you may find in the file itself.&lt;br /&gt;
&lt;br /&gt;
03) &#039;&#039;&#039;icon.gif&#039;&#039;&#039;, it is a 16px per 16px icon identifying each instance of your module in the frame of a course&lt;br /&gt;
&lt;br /&gt;
04) &#039;&#039;&#039;index.php&#039;&#039;&#039; is a page to list all instances of the functionality the module provides in a course.&lt;br /&gt;
&lt;br /&gt;
05) &#039;&#039;&#039;lang&#039;&#039;&#039; is the folder reserved to language packs. A module language pack is a folder named &amp;quot;xx_utf8&amp;quot; containing, in turn, a folder named &amp;quot;help&amp;quot; and a language file named with the same name of the module. xx is the two char long name of the language, i.e. en, de, es, it, fr and so forth.&lt;br /&gt;
:Each language file is dedicated to a specific language. The lang folder may contain as much language packs as provided by different translators. The lang/xx_utf8/newmodule/ folder contains all the help files you want to provide to your module. In order to link a help file from inside the code of your module pages try:&lt;br /&gt;
:* helpbutton(&#039;&amp;lt;&amp;lt;name of your help file saved in lang/xx_utf8/newmodule/&amp;gt;&amp;gt;&#039;, get_string(&#039;your_string&#039;,&#039;newmodule&#039;), &#039;newmodule&#039;);&lt;br /&gt;
:or, in mod_form.php,&lt;br /&gt;
:* $mform-&amp;gt;setHelpButton as stated in&lt;br /&gt;
&lt;br /&gt;
08) &#039;&#039;&#039;lib.php&#039;&#039;&#039; is the pre-filled file with &amp;quot;core&amp;quot; functions needed by each module.&lt;br /&gt;
Let me start by remembering the convention to name functions into lib.php and locallib.php.&lt;br /&gt;
:See: https://docs.moodle.org/en/Development:Coding_style#Functions_and_Methods&lt;br /&gt;
:or&lt;br /&gt;
:https://docs.moodle.org/en/Development:Modules&lt;br /&gt;
&lt;br /&gt;
:Mandatory function are, at least:&lt;br /&gt;
:*&#039;&#039;&#039;function newmodule_add_instance($newmodule)&#039;&#039;&#039;&lt;br /&gt;
:This function is executed after an editing teacher create an instance of newmodule&lt;br /&gt;
:See, lib.php for more details just above the function.&lt;br /&gt;
&lt;br /&gt;
:*&#039;&#039;&#039;function newmodule_update_instance($newmodule)&#039;&#039;&#039;&lt;br /&gt;
:This function is executed after an editing teacher update an instance of newmodule&lt;br /&gt;
:See, lib.php for more details just above the function.&lt;br /&gt;
&lt;br /&gt;
:*&#039;&#039;&#039;function newmodule_delete_instance($id)&#039;&#039;&#039;&lt;br /&gt;
:This function is executed after an editing teacher delete an instance of newmodule&lt;br /&gt;
:See, lib.php for more details just above the function.&lt;br /&gt;
&lt;br /&gt;
:*&#039;&#039;&#039;function newmodule_user_outline()&#039;&#039;&#039;&lt;br /&gt;
:See, lib.php for more details just above the function.&lt;br /&gt;
&lt;br /&gt;
:*&#039;&#039;&#039;function newmodule_user_complete($course, $user, $mod, $newmodule)&#039;&#039;&#039;&lt;br /&gt;
:See, lib.php for more details just above the function.&lt;br /&gt;
&lt;br /&gt;
:*&#039;&#039;&#039;function newmodule_print_recent_activity($course, $isteacher, $timestart)&#039;&#039;&#039;&lt;br /&gt;
:See, lib.php for more details just above the function.&lt;br /&gt;
&lt;br /&gt;
:*&#039;&#039;&#039;function newmodule_cron()&#039;&#039;&#039;&lt;br /&gt;
:Take care with this function.&lt;br /&gt;
:Differently by all the other functions, this function is not called by passing it the $newmodule record. This means that this function, called by moodle core cron has to look for each newmodule instance id before operating.&lt;br /&gt;
:Don&#039;t worry, even if you have more than a single instance of your module among moodle courses, this function will be executed just one time.&lt;br /&gt;
&lt;br /&gt;
:*&#039;&#039;&#039;function newmodule_get_participants($newmoduleid)&#039;&#039;&#039;&lt;br /&gt;
:See, lib.php for more details just above the function.&lt;br /&gt;
&lt;br /&gt;
:*&#039;&#039;&#039;function newmodule_scale_used($newmoduleid, $scaleid)&#039;&#039;&#039;&lt;br /&gt;
:See, lib.php for more details just above the function.&lt;br /&gt;
&lt;br /&gt;
:*&#039;&#039;&#039;function newmodule_scale_used_anywhere($scaleid)&#039;&#039;&#039;&lt;br /&gt;
:See, lib.php for more details just above the function.&lt;br /&gt;
&lt;br /&gt;
:*&#039;&#039;&#039;function newmodule_install()&#039;&#039;&#039;&lt;br /&gt;
:See, lib.php for more details just above the function.&lt;br /&gt;
&lt;br /&gt;
:*&#039;&#039;&#039;function newmodule_uninstall()&#039;&#039;&#039;&lt;br /&gt;
:See, lib.php for more details just above the function.&lt;br /&gt;
&lt;br /&gt;
:In my honest opinion some more functions should be added. Among these I want to list:&lt;br /&gt;
&lt;br /&gt;
:*&#039;&#039;&#039;function newmodule_reset_course_form_definition(&amp;amp;$mform)&#039;&#039;&#039;&lt;br /&gt;
:*&#039;&#039;&#039;function newmodule_reset_course_form_defaults($course)&#039;&#039;&#039;&lt;br /&gt;
:*&#039;&#039;&#039;function newmodule_reset_userdata($data)&#039;&#039;&#039;&lt;br /&gt;
:These last three functions are responsible for the mewmodule reset process during the more general course reset process. Please, refer to mod/data/lib.php or to mod/feedback/lib.php, for instance, to understand them better.&lt;br /&gt;
&lt;br /&gt;
:Two more functions should be added to lib.php are, in my opinion:&lt;br /&gt;
:*&#039;&#039;&#039;function newmodule_get_view_actions()&#039;&#039;&#039;&lt;br /&gt;
:*&#039;&#039;&#039;function newmodule_get_post_actions()&#039;&#039;&#039;&lt;br /&gt;
:They distinguish between &amp;quot;read&amp;quot; and &amp;quot;post&amp;quot; log actions.&lt;br /&gt;
:These functions are used by moodle core during log gather.&lt;br /&gt;
:The actions you list inside these two functions, must match the ones you listed in the table &amp;quot;log_display&amp;quot; in install.xml&lt;br /&gt;
&lt;br /&gt;
Still about the lib.php file, it is important to read what is stated at the end of lib.php: &amp;lt;pre&amp;gt;//////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;
/// Any other newmodule functions go here.  Each of them must have a name that&lt;br /&gt;
/// starts with newmodule_&lt;br /&gt;
/// Remember (see note in first lines) that, if this section grows, it&#039;s HIGHLY&lt;br /&gt;
/// recommended to move all functions below to a new &amp;quot;locallib.php&amp;quot; file.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:One important issue is about the connection between &#039;&#039;&#039;lib.php&#039;&#039;&#039; and &#039;&#039;&#039;locallib.php&#039;&#039;&#039;&lt;br /&gt;
:Who has to call the other, how and why?&lt;br /&gt;
:It has to be locallib.php to call lib.php through: &amp;lt;pre&amp;gt;require_once(&amp;quot;$CFG-&amp;gt;dirroot/mod/newmodule/lib.php&amp;quot;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
:as first line.&lt;br /&gt;
&lt;br /&gt;
:In this way, if moodle core calls function inside mod/newmodule/lib.php no module specific function will be loaded in memory.&lt;br /&gt;
:If it is your newmodule to call a function, it has to require_once(&#039;locallib.php&#039;); that, in turn, will require_once(&#039;lib.php&#039;) so that your module will &amp;quot;see&amp;quot; all its available functions.&lt;br /&gt;
&lt;br /&gt;
09) &#039;&#039;&#039;mod_form.php&#039;&#039;&#039; is the file describing the form you get at the module instance creation or at the instance editing time.&lt;br /&gt;
The syntax is very simple and by reading the file it is simple to change it on your need.&lt;br /&gt;
:It uses the syntax you can learn in:&lt;br /&gt;
:https://docs.moodle.org/en/Development:lib/formslib.php_Form_Definition&lt;br /&gt;
&lt;br /&gt;
:At date, there is a missing detail by the end of the file.&lt;br /&gt;
:You can read:&lt;br /&gt;
&amp;lt;pre&amp;gt;//------------------------------------------------------------------------------&lt;br /&gt;
        // add standard elements, common to all modules&lt;br /&gt;
        $this-&amp;gt;standard_coursemodule_elements();&lt;br /&gt;
//------------------------------------------------------------------------------&amp;lt;/pre&amp;gt;&lt;br /&gt;
:This part is responsible for the common modules section at the end of your newmodule editing instance page. (the section related to groups)&lt;br /&gt;
:This code can be customized by changing it as described below:&lt;br /&gt;
&amp;lt;pre&amp;gt;//------------------------------------------------------------------------------&lt;br /&gt;
        // add standard elements, common to all modules&lt;br /&gt;
        $features = new object();&lt;br /&gt;
        $features-&amp;gt;groups           = false;&lt;br /&gt;
        $features-&amp;gt;groupings        = false;&lt;br /&gt;
        $features-&amp;gt;groupmembersonly = true;&lt;br /&gt;
        $this-&amp;gt;standard_coursemodule_elements($features);&lt;br /&gt;
//------------------------------------------------------------------------------&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One more tip about this file.&lt;br /&gt;
:Once you submit the form described by this file, your module executes the function: newmodule_add_instance or newmodule_update_instance both pre-written in lib.php.&lt;br /&gt;
:It seems that check boxes in the editing instance form don&#039;t work. To test this, please verify the passed parameter $newmodule inside your function newmodule_update_instance through a simple: &amp;lt;pre&amp;gt;print_object($newmodule);&amp;lt;/pre&amp;gt;&lt;br /&gt;
:You will find that even by selecting or unselecting the check box in the newmodule instance editing form, the corresponding value in the array doesn&#039;t change. This is not an error, but at least a lack of code.&lt;br /&gt;
:By adding a simple code like: &amp;lt;pre&amp;gt;$checkboxes = array(&#039;myfirstcheckboxfield&#039;, &#039;mysecondcheckboxfield&#039;, and so fort with all your checkbox field);&lt;br /&gt;
foreach ($checkboxes as $checkbox) {&lt;br /&gt;
    if (empty($newmodule-&amp;gt;{$checkbox})) {&lt;br /&gt;
        $newmodule-&amp;gt;{$checkbox} = 0;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:at the beginning of both functions, you will find that all works fine.&lt;br /&gt;
&lt;br /&gt;
10) &#039;&#039;&#039;README.txt&#039;&#039;&#039; is the file where you are welcome to write what your newmodule does.&lt;br /&gt;
&lt;br /&gt;
11) &#039;&#039;&#039;version.php&#039;&#039;&#039; is a really very simple file as simple as important.&lt;br /&gt;
To understand why it is important, you need to know that there are a bunch of actions that moodle performs for your newmodule ONLY (with only one exception) at the newmodule installation. They are, at least, db tables editing and load of capability. If during the development of your module (that you already installed on your development environment or that you already shared with remote users) you need to change the structure of your newmodule tables or you need to change the capability used by your newmodule, you need to force moodle to edit tables and reload capability. This is done by:&lt;br /&gt;
:* adding the proper code in newmodule/db/upgrade.php (to do this, use XMLDB as stated in this same page below)&lt;br /&gt;
:* increasing the newmodule version.&lt;br /&gt;
:* visiting the notification page of your installation of Moodle.&lt;br /&gt;
&lt;br /&gt;
12) &#039;&#039;&#039;view.php&#039;&#039;&#039; is the first executed code of your module. By selecting the link of the instance of your module, the code of newmodule/view.php is executed.&lt;br /&gt;
&lt;br /&gt;
== Some very important missing files ==&lt;br /&gt;
There are five files that are not present in the newmodule package that 90% of times you will go to add to your newmodule.&lt;br /&gt;
&lt;br /&gt;
1. The first one is locallib.php already described before.&lt;br /&gt;
&lt;br /&gt;
2. The second one is access.php that has to be saved inside newmodule/db/ folder.&lt;br /&gt;
:In this file you will add all the capability used by your newmodule and loaded at the installation time or upgrade time. To learn the syntax of the capability, please refer to the same file in other modules or to: https://docs.moodle.org/en/Development:NEWMODULE_Adding_capabilities&lt;br /&gt;
3. The third missing file must be added to newmodule/ folder. It is settings.php and describes the form that can be accessed from: Site Administration block -&amp;gt; Modules -&amp;gt; Activities -&amp;gt; &amp;lt;&amp;lt;your newmodule name&amp;gt;&amp;gt;&lt;br /&gt;
:This form stores general settings for your newmodule into the site wide $CFG object. Because of this, it is strongly recommended to give to your newmodule general settings with names starting with &amp;quot;newmodule_&amp;quot;. This file is useful when there is a setting that doesn&#039;t depend from the instance. I.e., if your newmodule simulates a telephone, you will probably save your telephone number in this newmodule setting site wide form instead of typing it each time you add a new instance of your newmodule into a course. In this case, to refer to you telephone number inside your newmodule you will use: $CFG-&amp;gt;newmodule_telephonenumber&lt;br /&gt;
4. Directly in the newmodule folder, you need to add backuplib.php that is responsible for the backup of each instance of your module and of its log.&lt;br /&gt;
:To learn how to code it, start by stealing it from some other module and read it.&lt;br /&gt;
5. Again in the newmodule folder, you need to add restorelib.php that is responsible for the restore of each instance your module and of its log.&lt;br /&gt;
:To learn how to code it, start by stealing it from some other module and read it.&lt;br /&gt;
&lt;br /&gt;
==Let&#039;s start==&lt;br /&gt;
To start using a downloaded package, please perform the 7 actions described in https://docs.moodle.org/en/Development:NEWMODULE_Tutorial in How to Begin the Creation of a New Module paragraph.&lt;br /&gt;
&lt;br /&gt;
Then, draw the structure of your tables on a sheet, edit the file db/install.xml according to your project, save, put your renamed newmodule folder in moodle/mod/ and visit the moodle notification page.&lt;br /&gt;
&lt;br /&gt;
To add code to db/upgrade.php never do it manually. I always make use of Site Administration block -&amp;gt; Miscellaneous -&amp;gt; XMLDB editor and I ask it to write the code for me. It never fails.&lt;br /&gt;
&lt;br /&gt;
Please remember: within your module, never use &amp;quot;embedded messages&amp;quot; like:&lt;br /&gt;
&amp;lt;pre&amp;gt;echo &#039;Welcome to this newmodule&#039;;&amp;lt;/pre&amp;gt;&lt;br /&gt;
but make use of get_string or print_string. In this way your module will be multilang with a really small effort.&lt;br /&gt;
Use, for instance:&lt;br /&gt;
&amp;lt;pre&amp;gt;print_string(&#039;welcomemessage&#039;,&#039;newmodule&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
saving in newmodule/lang/en_utf8/newmodule.php&lt;br /&gt;
&amp;lt;pre&amp;gt;$string[&#039;welcomemessage&#039;] = &#039;Welcome to this newmodule&#039;;&amp;lt;/pre&amp;gt;&lt;br /&gt;
==Some code snippets that I find useful==&lt;br /&gt;
&#039;&#039;&#039;**To check the capability of a user&#039;&#039;&#039;, try:&lt;br /&gt;
&amp;lt;pre&amp;gt;if (newmodule_hascapabilitytodothis()) {&lt;br /&gt;
    //user is allowed&lt;br /&gt;
} else {&lt;br /&gt;
    // user is not allowed&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
typing in locallib.php&lt;br /&gt;
&amp;lt;pre&amp;gt;function newmodule_hascapabilitytodothis($cm) {&lt;br /&gt;
    $context = get_context_instance(CONTEXT_MODULE, $cm-&amp;gt;id);&lt;br /&gt;
&lt;br /&gt;
    return (has_capability(&#039;mod/newmodule:candothis&#039;, $context));&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
typing in db/access.php&lt;br /&gt;
&amp;lt;pre&amp;gt;$mod_newmodule_capabilities = array(&lt;br /&gt;
    &#039;mod/newmodule:candothis&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;captype&#039; =&amp;gt; &#039;read&#039;,&lt;br /&gt;
        &#039;contextlevel&#039; =&amp;gt; CONTEXT_MODULE,&lt;br /&gt;
        &#039;legacy&#039; =&amp;gt; array(&lt;br /&gt;
            &#039;teacher&#039; =&amp;gt; CAP_ALLOW,&lt;br /&gt;
            &#039;editingteacher&#039; =&amp;gt; CAP_ALLOW,&lt;br /&gt;
            &#039;admin&#039; =&amp;gt; CAP_ALLOW&lt;br /&gt;
        )&lt;br /&gt;
    )&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;To edit the tables in use by your newmodule&#039;&#039;&#039;, try:&lt;br /&gt;
* edit install.xml manually by editing fields and or tables in the xml structure.&lt;br /&gt;
* go to Site Administration block -&amp;gt; Miscellaneous -&amp;gt; XMLDB editor and load the tables of your module&lt;br /&gt;
* ask to the XMLDB editor the snippets of code you need to add to db/upgrade.php&lt;br /&gt;
* copy and paste in db/upgrade.php&lt;br /&gt;
* in the line: if ($result &amp;amp;&amp;amp; $oldversion &amp;lt; xxxxxxxxxxxx), (replace xxxxxxxxxxxx with the version number you are going to give to your newmodule)&lt;br /&gt;
* change (increase) the version number&lt;br /&gt;
* visit the Moodle notification page&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;To add a single line to logs from your mewmodule&#039;&#039;&#039;, try:&lt;br /&gt;
&amp;lt;pre&amp;gt;add_to_log($course-&amp;gt;id, &#039;newmodule&#039;, &#039;&amp;lt;&amp;lt;action already listed in log_display&amp;gt;&amp;gt;&#039;, &amp;quot;view.php?id=$cm-&amp;gt;id&amp;quot;, &amp;quot;$newmodule-&amp;gt;id&amp;quot;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;To be sure that remote user will not be able to contact your pages by typing their URL directly in the address bar&#039;&#039;&#039;, try:&lt;br /&gt;
&lt;br /&gt;
as first line of each of your php script&lt;br /&gt;
&amp;lt;pre&amp;gt;defined(&#039;NEWMODULE_INCLUDE_TEST&#039;) OR die(&#039;not allowed&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
typing in lib.php, at the beginning&lt;br /&gt;
&amp;lt;pre&amp;gt;define(&#039;NEWMODULE_INCLUDE_TEST&#039;, 1);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Some suggestion I find useful==&lt;br /&gt;
&#039;&#039;&#039;To include php scripts&#039;&#039;&#039;, try:&lt;br /&gt;
&amp;lt;pre&amp;gt;require_once(myscript.php);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;To include php library&#039;&#039;&#039;, try:&lt;br /&gt;
&amp;lt;pre&amp;gt;require_once(&#039;locallib.php&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;To periodically execute function newmodule_cron()&#039;&#039;&#039;, try:&lt;br /&gt;
&amp;lt;pre&amp;gt;$module-&amp;gt;cron = xxxx;&amp;lt;/pre&amp;gt;&lt;br /&gt;
providing some code in: &amp;lt;pre&amp;gt;function newmodule_cron()&amp;lt;/pre&amp;gt;&lt;br /&gt;
Your function newmodule_cron() will be executed about each xxxx seconds&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Do not include config when it is not needed&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;require_once(&#039;config.php&#039;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
is not needed in library scripts&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Do not use global $cm or $newmodule in your function&#039;&#039;&#039;&lt;br /&gt;
but use proper function parameters.&lt;br /&gt;
&lt;br /&gt;
So, never use:&lt;br /&gt;
&amp;lt;pre&amp;gt;function newmodule_lookatthesky() {&lt;br /&gt;
    global $cm, $newmodule;&lt;br /&gt;
    &lt;br /&gt;
    // your stuff&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
but use: &lt;br /&gt;
&amp;lt;pre&amp;gt;function newmodule_lookatthesky($cm, $newmodule) {&lt;br /&gt;
    &lt;br /&gt;
    // your stuff&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [http://dev.moodle.org/course/view.php?id=2 Moodle Developers&#039; Course]&lt;br /&gt;
* [[Development:Modules]]&lt;br /&gt;
* [[Development:Places to search for lang strings|Where to put language strings for your plugin]]&lt;br /&gt;
* [[Development:Installing and upgrading plugin database tables|Defining the database tables for your plugin]]&lt;br /&gt;
&lt;br /&gt;
{{CategoryDeveloper}}&lt;br /&gt;
[[Category:Developer|Modules]]&lt;/div&gt;</summary>
		<author><name>Davidbalch</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/31/en/index.php?title=IMS_content_package&amp;diff=54545</id>
		<title>IMS content package</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/31/en/index.php?title=IMS_content_package&amp;diff=54545"/>
		<updated>2009-04-20T16:00:53Z</updated>

		<summary type="html">&lt;p&gt;Davidbalch: /* IMS content package repository */  Added notes about deployment size and deploying IMSCPs from a repository.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Resources}}&lt;br /&gt;
{{Moodle 1.6}}&lt;br /&gt;
&lt;br /&gt;
IMS is a body which helps define technical standards for various things, including e-learning material. The [http://www.imsglobal.org/content/packaging/ IMS Content Packaging specification] makes it possible to store chunks of material in a standard format which can be re-used in different systems, without having to convert the material into new formats.&lt;br /&gt;
&lt;br /&gt;
The IMS content package in Moodle 1.6 enables such content packages to be uploaded and included in Moodle courses. There are various options for displaying content in a pop-up window, with a navigation menu or buttons etc. In addition, the resource type supports an optional repository, enabling content packages to be shared between courses.&lt;br /&gt;
&lt;br /&gt;
==IMS content package repository==&lt;br /&gt;
&lt;br /&gt;
The IMS content package repository enables access to a repository of IMS and SCORM packages within Moodle.&lt;br /&gt;
&lt;br /&gt;
Using the repository will save disk space (and any corresponding backup resources if you copy the filesystem as part of your backup strategy) compared to uploading content packages directly into a course. The repository only needs an unzipped copy of the package, whereas within a course there will be the unzipped copy, plus two zipped copies just taking up space.&lt;br /&gt;
&lt;br /&gt;
===Using the repository===&lt;br /&gt;
&lt;br /&gt;
The repository is disabled by default. It may be enabled as follows:&lt;br /&gt;
&lt;br /&gt;
# Find repository_config.php in &#039;&#039;moodle/mod/resource/type/ims&#039;&#039; and change &amp;lt;code&amp;gt;$CFG-&amp;gt;repositoryactivate = false;&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;$CFG-&amp;gt;repositoryactivate = true&amp;lt;/code&amp;gt;&lt;br /&gt;
# Create a folder named &#039;&#039;ims_repository&#039;&#039; in the webroot or somewhere underneath your webroot.&lt;br /&gt;
# Change &amp;lt;code&amp;gt;$CFG-&amp;gt;repository = &amp;quot;C:/public/www/html/ims_repository&amp;quot;;&amp;lt;/code&amp;gt; to point to this folder on your file system&lt;br /&gt;
# If your ims_repository is not located directly in your webroot, edit &amp;lt;code&amp;gt;$CFG-&amp;gt;repositorywebroot = &amp;quot;/ims_repository&amp;quot;;&amp;lt;/code&amp;gt; to point to the location of your repository.&lt;br /&gt;
&lt;br /&gt;
Content packages should be extracted to the folder &#039;&#039;ims_repository&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
To use a repository package in a course:&lt;br /&gt;
# Create/edit an IMS CP resource.&lt;br /&gt;
# Click the &amp;quot;Browse repository&amp;quot; button, opening a window listing the packages in &#039;&#039;ims_repository&#039;&#039;. If you can&#039;t see your content package, check it&#039;s in the right directory and has been unzipped.&lt;br /&gt;
# Find your package in the list and click Deploy, and you get a chance to preview the resource. Close the window.&lt;br /&gt;
# Click the &amp;quot;Browse repository&amp;quot; button again, and then and Choose the package.&lt;br /&gt;
# Save your IMS CP resource.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [http://www.nln.ac.uk/?p=Moodle NLN Materials - Support: Using the NLN Materials in Moodle]&lt;br /&gt;
&lt;br /&gt;
Using Moodle forum discussions:&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=31011 New resource type: IMS CP]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=86101 What is an IMS package?]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=48684 Trying to add NLN Materials via IMS CP]&lt;br /&gt;
&lt;br /&gt;
[[Category:Administrator]]&lt;br /&gt;
[[Category:Resource]]&lt;br /&gt;
&lt;br /&gt;
[[de:IMS-Paket]]&lt;br /&gt;
[[eu:Baliabidea:IMS]]&lt;br /&gt;
[[es:Recurso: IMS]]&lt;/div&gt;</summary>
		<author><name>Davidbalch</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/31/en/index.php?title=Development:Filters_schema&amp;diff=23036</id>
		<title>Development:Filters schema</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/31/en/index.php?title=Development:Filters_schema&amp;diff=23036"/>
		<updated>2007-05-04T08:37:21Z</updated>

		<summary type="html">&lt;p&gt;Davidbalch: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The objective of this page is to document all the ideas and improvements to be implemented in the &amp;quot;Filters&amp;quot; functionality of Moodle.&lt;br /&gt;
&lt;br /&gt;
Every idea will be documented here, including its associated &amp;quot;thoughts&amp;quot; and potential &amp;quot;implementations&amp;quot;. Feel free to add/modify everything as you want!&lt;br /&gt;
&lt;br /&gt;
These are the main areas to discuss/analyse/implement:&lt;br /&gt;
&lt;br /&gt;
* [[Course/site filters | Enable/Disable Filters by Course and Site]]&lt;br /&gt;
* [[Course/site filter config | Optional Configuration of Filters by Course and Site]]&lt;br /&gt;
* [[Multilang filter | Changes in the Caching System to Support the Multilang Filter]]&lt;br /&gt;
* [[Enable/Disable Filters by Activities]]&lt;br /&gt;
* Allow filtering data before it will save in database? It will do possible exclude some data from text (like TeX formulas) and save in separate table. It will allow change formula by clicking on it and open popup window.&lt;br /&gt;
* It&#039;d be great if you could set the text cache lifetime for individual filters. This would be handy for filters that use external resources (e.g., Wikipedia) that sometimes have slow response times. I&#039;d guess that you could use a cache lifetime of a week or more for a Wikipedia filter without causing major usability problems.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*[http://moodle.org/bugs/bug.php?op=show&amp;amp;bugid=2400 Bug 2400] - a lot of ideas and request have been written here&lt;br /&gt;
http://tracker.moodle.org/browse/MDL-9443 - add support for filtering XHTML resources as well as HTML.&lt;br /&gt;
[[Category:Developer]]&lt;/div&gt;</summary>
		<author><name>Davidbalch</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/31/en/index.php?title=Development:Course/site_filter_config&amp;diff=22516</id>
		<title>Development:Course/site filter config</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/31/en/index.php?title=Development:Course/site_filter_config&amp;diff=22516"/>
		<updated>2007-04-18T10:37:14Z</updated>

		<summary type="html">&lt;p&gt;Davidbalch: Added config idea.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This topic is to define how to add the possibility of &amp;quot;configure&amp;quot; filters both at site and course level.&lt;br /&gt;
&lt;br /&gt;
* The mp3player may be configured at site level to only start downloading when the play button is pressed.&lt;br /&gt;
* The filters could configured to apply to classes of files by MIME type and/or file extension.&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer]]&lt;/div&gt;</summary>
		<author><name>Davidbalch</name></author>
	</entry>
</feed>