<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.moodle.org/dev/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Prnulc</id>
	<title>MoodleDocs - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://docs.moodle.org/dev/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Prnulc"/>
	<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/Special:Contributions/Prnulc"/>
	<updated>2026-06-09T06:33:18Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Activity_modules&amp;diff=724</id>
		<title>Activity modules</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Activity_modules&amp;diff=724"/>
		<updated>2008-06-12T16:13:29Z</updated>

		<summary type="html">&lt;p&gt;Prnulc: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Activity modules&#039;&#039;&#039; reside in the &#039;mod&#039; directory. Each module is in a separate subdirectory and consists of the following mandatory elements (plus extra scripts unique to each module):&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;mod_form.php&#039;&#039; - a form to set up or update an instance of this module&lt;br /&gt;
* &#039;&#039;version.php&#039;&#039; - defines some meta-info&lt;br /&gt;
* &#039;&#039;icon.gif&#039;&#039; - a 16x16 icon for the module&lt;br /&gt;
* &#039;&#039;db/install.xml&#039;&#039; - defines the structure of db tables for all database types. Is used during module installation&lt;br /&gt;
* &#039;&#039;db/upgrade.php&#039;&#039; - defines changes in the structure of db tables. Is used during module upgrade&lt;br /&gt;
* &#039;&#039;db/access.php&#039;&#039; - defines module capabilities&lt;br /&gt;
* &#039;&#039;index.php&#039;&#039; - a page to list all instances in a course&lt;br /&gt;
* &#039;&#039;view.php&#039;&#039; - a page to view a particular instance&lt;br /&gt;
* &#039;&#039;lib.php&#039;&#039; - any/all functions defined by the module should be in here. If the modulename is called widget, then the required functions include:&lt;br /&gt;
:* widget_install() - will be called during the installation of the module&lt;br /&gt;
:* widget_add_instance() - code to add a new instance of widget&lt;br /&gt;
:* widget_update_instance() - code to update an existing instance&lt;br /&gt;
:* widget_delete_instance() - code to delete an instance&lt;br /&gt;
:* widget_user_outline() - given an instance, return a summary of a user&#039;s contribution&lt;br /&gt;
:* widget_user_complete() - given an instance, print details of a user&#039;s contribution&lt;br /&gt;
:* Other functions available but not required are:&lt;br /&gt;
:** widget_delete_course() - code to clean up anything that would be leftover after all instances are deleted&lt;br /&gt;
:** widget_process_options() - code to pre-process the form data from module settings&lt;br /&gt;
:** [[Implementing Reset course functionality in a module|widget_reset_course_form() and widget_delete_userdata()]] - used to implement [[Reset course]] feature.&lt;br /&gt;
:* To avoid possible conflict, any module functions should be named starting with widget_ and any constants you define should start with WIDGET_&lt;br /&gt;
* &#039;&#039;backuplib.php&#039;&#039; and &#039;&#039;restorelib.php&#039;&#039; (optional)&lt;br /&gt;
* &#039;&#039;settings.php&#039;&#039; - (optional) a form definition to set up or update global settings of this module&lt;br /&gt;
* &#039;&#039;lang/en_utf8/widget.php&#039;&#039; - (optional) Lastly, each module will have some language files that contain strings for that module.&lt;br /&gt;
&lt;br /&gt;
IMPORTANT: When creating a new module, the new name of the module must not contain numbers or other special characters!&lt;br /&gt;
&lt;br /&gt;
You need a db table with the same name as your module. This table must have at least three fields: id, course and name.&lt;br /&gt;
&lt;br /&gt;
You should also make sure that your activity module provides appropriate support for groups and metacourses. &lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* Tracker issue [http://tracker.moodle.org/browse/CONTRIB-52 CONTRIB-52 Improvements to make NEWMODULE really useful] - including download link for new module template supporting roles, formslib etc. (unfinished) &lt;br /&gt;
* http://download.moodle.org/plugins16/mod/NEWMODULE.zip - new module template for versions of Moodle prior to 1.7. Please follow the README instructions inside the zip.&lt;br /&gt;
* Using Moodle [http://moodle.org/course/view.php?id=5 Activity modules] forum&lt;br /&gt;
* Using Moodle forum discussions: [http://moodle.org/mod/forum/discuss.php?d=66165 A new resource type: where do I put the language strings?], [http://moodle.org/mod/forum/discuss.php?d=65986 New Module Template Code for Moodle 1.7], [http://moodle.org/mod/forum/discuss.php?d=86837 Third-party module backup]&lt;br /&gt;
&lt;br /&gt;
[[Category:Modules]]&lt;br /&gt;
[[Category:Modules]]&lt;br /&gt;
&lt;br /&gt;
[[es:Módulos de actividades (desarrollador)]]&lt;br /&gt;
[[fr:Modules (développeur)]]&lt;br /&gt;
[[ja:モジュール (開発者)]]&lt;/div&gt;</summary>
		<author><name>Prnulc</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=lib/formslib.php_Usage&amp;diff=5741</id>
		<title>lib/formslib.php Usage</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=lib/formslib.php_Usage&amp;diff=5741"/>
		<updated>2008-06-12T15:55:16Z</updated>

		<summary type="html">&lt;p&gt;Prnulc: /* Defining Your Form Class */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Formslib}}&lt;br /&gt;
==Usage of Formslib==&lt;br /&gt;
&lt;br /&gt;
There are many phpdoc style comments in lib/formslib.php&lt;br /&gt;
&lt;br /&gt;
course/edit.php and the included course/edit_form.php provide a good example of usage of this library.&lt;br /&gt;
&lt;br /&gt;
Also see the PEAR docs for [http://pear.php.net/package/HTML_QuickForm/ HTML_QuickForm docs] I found this [http://pear.php.net/manual/en/package.html.html-quickform.tutorial.php quick tutorial] and this [http://www.midnighthax.com/quickform.php slightly longer one] particularly useful.&lt;br /&gt;
&lt;br /&gt;
We created some special wrapper functions for moodle. $mform-&amp;gt;get_data() returns null if no data has been submitted or validation fails or returns an object with the contents of the submitted data.&lt;br /&gt;
&lt;br /&gt;
===Basic Usage in A Normal Page===&lt;br /&gt;
&lt;br /&gt;
Generally the structure of a page with a form on it looks like this :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require_once(&#039;pathtoformdescription&#039;);&lt;br /&gt;
//you&#039;ll process some page parameters at the top here and get the info about&lt;br /&gt;
//what instance of your module and what course you&#039;re in etc. Make sure you&lt;br /&gt;
//include hidden variable in your forms which have their defaults set in set_data&lt;br /&gt;
//which pass these variables from page to page&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$mform = new yourmod_formfunction_form();//name of the form you defined in file above.&lt;br /&gt;
//default &#039;action&#039; for form is strip_querystring(qualified_me())&lt;br /&gt;
if ($mform-&amp;gt;is_cancelled()){&lt;br /&gt;
    //you need this section if you have a cancel button on your form&lt;br /&gt;
    //here you tell php what to do if your user presses cancel&lt;br /&gt;
    //probably a redirect is called for!&lt;br /&gt;
} else if ($fromform=$mform-&amp;gt;get_data()){&lt;br /&gt;
//this branch is where you process validated data.&lt;br /&gt;
&lt;br /&gt;
} else {&lt;br /&gt;
// this branch is executed if the form is submitted but the data doesn&#039;t validate and the form should be redisplayed&lt;br /&gt;
// or on the first display of the form.&lt;br /&gt;
    //setup strings for heading&lt;br /&gt;
    print_header_simple($streditinga, &#039;&#039;,&lt;br /&gt;
     &amp;quot;&amp;lt;a href=\&amp;quot;$CFG-&amp;gt;wwwroot/mod/$module-&amp;gt;name/index.php?id=$course-&amp;gt;id\&amp;quot;&amp;gt;$strmodulenameplural&amp;lt;/a&amp;gt; -&amp;gt;&lt;br /&gt;
     $strnav $streditinga&amp;quot;, $mform-&amp;gt;focus(), &amp;quot;&amp;quot;, false);&lt;br /&gt;
    //notice use of $mform-&amp;gt;focus() above which puts the cursor &lt;br /&gt;
    //in the first form field or the first field with an error.&lt;br /&gt;
&lt;br /&gt;
    //call to print_heading_with_help or print_heading? then :&lt;br /&gt;
    &lt;br /&gt;
    //put data you want to fill out in the form into array $toform here then :&lt;br /&gt;
&lt;br /&gt;
    $mform-&amp;gt;set_data($toform);&lt;br /&gt;
    $mform-&amp;gt;display();&lt;br /&gt;
    print_footer($course);&lt;br /&gt;
&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Defining Your Form Class===&lt;br /&gt;
&lt;br /&gt;
The form class tells us about the structure of the form. You are encouraged to put this in a file called {function}_form.php probably in the same folder in which the page that uses it is located. The name of your class should be {modname}_{function}_form eg. forum_post_form or course_edit_form. These classes will extend class moodleform.&lt;br /&gt;
&lt;br /&gt;
Note the name you give the class is used as the id attrbute of your form in html (any trailing &#039;_form&#039; is chopped off&#039;). Your form class name should be unique in order for it to selectable in CSS by theme designers who may want to tweak the css just for that form.&lt;br /&gt;
&lt;br /&gt;
====definition()====&lt;br /&gt;
&lt;br /&gt;
[[lib/formslib.php_Form_Definition|Help is here for defining your form]] by defining a function definition() in your form class that sets up your form structure.&lt;br /&gt;
&lt;br /&gt;
===Use in Activity Modules Add / Update Forms===&lt;br /&gt;
&lt;br /&gt;
Syntax is the same in activity modules to create your update / add page. We are still supporting mod.html but if you want to use the new formslib then you can in Moodle 1.8 just include in your module directory the file mod_form.php instead of mod.html and it will be automatically detected. Inside this file you define a class with class name &#039;{modname}__mod_form&#039; which extends the class &#039;moodleform_mod&#039;. See many examples of the core modules which have been converted to use formslib already.&lt;br /&gt;
&lt;br /&gt;
====defaults_preprocessing====&lt;br /&gt;
&lt;br /&gt;
For activity modules you use the same syntax to define your form. You may also want to override method defaults_preprocessing this can be used to take the data from the data base and tell the form how to fill out defaults in the form with this data. For example in the forum module in forum/mod_form.php we needed to tick an enable check box if a date had been selected in the date select. Normally data is loaded from the database and directly loaded into form fields with the same name as the database record you only need to use defaults_preprocessing if there isn&#039;t this one to one relationship. Another example is the lesson/mod_form.php which takes the data from the database and unserializes it. choice/mod_form.php shows an exampe of loading data from another db table referred to by a foreign key, to include in the form.&lt;br /&gt;
&lt;br /&gt;
====Post Processing Still Done in lib.php Functions====&lt;br /&gt;
&lt;br /&gt;
Post processing of data is done in lib.php functions modname_add_instance and modname_update_instance after the data has been validated. When migrating a form often little changes need to be made in the post processing. An exception is that date and date_time_selector fields automatically have their submitted data turned into timestamps so you don&#039;t need to do this in your add and update functions anymore.&lt;br /&gt;
&lt;br /&gt;
====Automatically Including Standard Activity Module Form Elements====&lt;br /&gt;
&lt;br /&gt;
Standard activity module form elements are automatically included using the moodleform_mod method standard_coursemodule_elements(). The default is to include a visibility and groupsmode select box and to include all necessary hidden fields. You can pass a parameter false to tell the method that your module doesn&#039;t support groups and so you don&#039;t want the groupsmode select button.&lt;br /&gt;
&lt;br /&gt;
[[Category:Formslib]]&lt;/div&gt;</summary>
		<author><name>Prnulc</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=How_to_create_a_patch&amp;diff=6776</id>
		<title>How to create a patch</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=How_to_create_a_patch&amp;diff=6776"/>
		<updated>2008-06-11T14:40:30Z</updated>

		<summary type="html">&lt;p&gt;Prnulc: /* Creating a patch using WinMerge */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;If you have made some changes to the code that you would like to share with the community, particularly if you want to send them to one of the core developers for possible inclusion in Moodle Core, it is very helpful if you can provide them as a patch file. Sometimes also called a diff file.&lt;br /&gt;
&lt;br /&gt;
This page explains how you can make a patch file. Patch is a standard format, and there are many options for how to create one. Pick the one that is easiest for you.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note, I have not been able to test most of these instructions. They are about right, but I am hoping that as people use them, they will fill in any gaps, correct any details, and so on.[[User:Tim Hunt|Tim Hunt]] 08:40, 25 June 2007 (CDT)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Introduction: what does a patch file look like==&lt;br /&gt;
&lt;br /&gt;
This is a simple example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
Index: lang/en_utf8/quiz.php&lt;br /&gt;
===================================================================&lt;br /&gt;
RCS file: /cvsroot/moodle/moodle/lang/en_utf8/quiz.php,v&lt;br /&gt;
retrieving revision 1.57.2.10&lt;br /&gt;
diff -u -r1.57.2.10 quiz.php&lt;br /&gt;
--- lang/en_utf8/quiz.php	29 May 2007 17:47:25 -0000	1.57.2.10&lt;br /&gt;
+++ lang/en_utf8/quiz.php	25 Jun 2007 12:58:34 -0000&lt;br /&gt;
@@ -252,7 +255,6 @@&lt;br /&gt;
 $string[&#039;indivresp&#039;] = &#039;Responses of Individuals to Each Item&#039;;&lt;br /&gt;
 $string[&#039;info&#039;] = &#039;Info&#039;;&lt;br /&gt;
 $string[&#039;introduction&#039;] = &#039;Introduction&#039;;&lt;br /&gt;
-$string[&#039;invalidcategory&#039;] = &#039;Category ID is invalid&#039;;&lt;br /&gt;
 $string[&#039;invalidnumericanswer&#039;] = &#039;One of the answers you entered was not a valid number.&#039;;&lt;br /&gt;
 $string[&#039;invalidnumerictolerance&#039;] = &#039;One of the tolerances you entered was not a valid number.&#039;;&lt;br /&gt;
 $string[&#039;invalidsource&#039;] = &#039;The source is not accepted as valid.&#039;;&lt;br /&gt;
@@ -375,8 +377,10 @@&lt;br /&gt;
 $string[&#039;questiontypesetupoptions&#039;] = &#039;Setup options for question types:&#039;;&lt;br /&gt;
 $string[&#039;quiz:attempt&#039;] = &#039;Attempt quizzes&#039;;&lt;br /&gt;
 $string[&#039;quiz:deleteattempts&#039;] = &#039;Delete quiz attempts&#039;;&lt;br /&gt;
+$string[&#039;quiz:emailconfirmsubmission&#039;] = &#039;Receive own quiz submission notification&#039;;&lt;br /&gt;
+$string[&#039;quiz:emailnotifysubmission&#039;] = &#039;Receive student quiz submission notifications&#039;;&lt;br /&gt;
 $string[&#039;quiz:grade&#039;] = &#039;Grade quizzes manually&#039;;&lt;br /&gt;
-$string[&#039;quiz:ignoretimelimits&#039;] = &#039;Ignores time limit on quizzes&#039;;&lt;br /&gt;
+$string[&#039;quiz:ignoretimelimits&#039;] = &#039;Ignores time limit on quizs&#039;;&lt;br /&gt;
 $string[&#039;quiz:manage&#039;] = &#039;Manage quizzes&#039;;&lt;br /&gt;
 $string[&#039;quiz:preview&#039;] = &#039;Preview quizzes&#039;;&lt;br /&gt;
 $string[&#039;quiz:view&#039;] = &#039;View quiz information&#039;;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At the top it says which file is being affected. Changes to several files can be included in one patch. Lines added are shown with a &#039;+&#039;, lines removed are shown with a &#039;-&#039;, lines changed are shown as the old line being removed and the new one added.&lt;br /&gt;
&lt;br /&gt;
Patch files are good because they only show the changed parts of the file. This has two advantages: it easy to understand the change; and if other parts of the same files change between the patch being made an being used, there is no problem, the patch will still apply.&lt;br /&gt;
&lt;br /&gt;
==Creating a patch using diff==&lt;br /&gt;
&lt;br /&gt;
diff is the a linux command line program, and is where patch files originated. It requires that you have two copies of the code, one with your changes, and one without. Suppose these two copies are in folders called &#039;standard_moodle&#039; and &#039;my_moodle&#039; which are subdirectories of the current folder. Then to create the patch, type:&lt;br /&gt;
&lt;br /&gt;
 diff -ur standard_moodle my_moodle &amp;gt; patch.txt&lt;br /&gt;
&lt;br /&gt;
==Creating a patch using CVS (command line)==&lt;br /&gt;
&lt;br /&gt;
It is easier if you are using CVS to manage your development, because you don&#039;t need to keep the copy of &#039;standard_moodle&#039;. CVS takes care of that for you. In you workspace (sandbox) type:&lt;br /&gt;
&lt;br /&gt;
 cvs diff -uN &amp;gt; patch.txt&lt;br /&gt;
&lt;br /&gt;
==Creating a patch using Tortoise CVS==&lt;br /&gt;
&lt;br /&gt;
[http://www.tortoisecvs.org/ Tortoise CVS] is a Windows GUI front end for CVS. To create a patch, right-click on a folder in CVS, and choose &#039;&#039;&#039;CVS -&amp;gt; Make patch ...&#039;&#039;&#039; from the context menu.&lt;br /&gt;
&lt;br /&gt;
==Creating a patch using Eclipse==&lt;br /&gt;
&lt;br /&gt;
See [[Setting_up_Eclipse#Creating_a_patch]]. Eclipse makes creating patches really easy, once you have got it set up correctly.&lt;br /&gt;
&lt;br /&gt;
==Creating a patch using WinMerge==&lt;br /&gt;
&lt;br /&gt;
[http://winmerge.org/ WinMerge] is a nice windows GUI for comparing folders. In this sense it is like the original command-line &#039;diff&#039; program. You need a copy of &#039;standard_moodle&#039; and &#039;my_moodle&#039;. Use &#039;&#039;&#039;File -&amp;gt; Open...&#039;&#039;&#039; to open the two versions for comparison. This will give you a nice view of what you have changed. Then do &#039;&#039;&#039;Tools -&amp;gt; Generate patch ...&#039;&#039;&#039;. In the dialogue box, make sure you select Style: Unified in the Format box.&lt;/div&gt;</summary>
		<author><name>Prnulc</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=How_to_create_a_patch&amp;diff=6775</id>
		<title>How to create a patch</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=How_to_create_a_patch&amp;diff=6775"/>
		<updated>2008-06-11T14:38:46Z</updated>

		<summary type="html">&lt;p&gt;Prnulc: /* Introduction: what does a patch file look like */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;If you have made some changes to the code that you would like to share with the community, particularly if you want to send them to one of the core developers for possible inclusion in Moodle Core, it is very helpful if you can provide them as a patch file. Sometimes also called a diff file.&lt;br /&gt;
&lt;br /&gt;
This page explains how you can make a patch file. Patch is a standard format, and there are many options for how to create one. Pick the one that is easiest for you.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note, I have not been able to test most of these instructions. They are about right, but I am hoping that as people use them, they will fill in any gaps, correct any details, and so on.[[User:Tim Hunt|Tim Hunt]] 08:40, 25 June 2007 (CDT)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Introduction: what does a patch file look like==&lt;br /&gt;
&lt;br /&gt;
This is a simple example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
Index: lang/en_utf8/quiz.php&lt;br /&gt;
===================================================================&lt;br /&gt;
RCS file: /cvsroot/moodle/moodle/lang/en_utf8/quiz.php,v&lt;br /&gt;
retrieving revision 1.57.2.10&lt;br /&gt;
diff -u -r1.57.2.10 quiz.php&lt;br /&gt;
--- lang/en_utf8/quiz.php	29 May 2007 17:47:25 -0000	1.57.2.10&lt;br /&gt;
+++ lang/en_utf8/quiz.php	25 Jun 2007 12:58:34 -0000&lt;br /&gt;
@@ -252,7 +255,6 @@&lt;br /&gt;
 $string[&#039;indivresp&#039;] = &#039;Responses of Individuals to Each Item&#039;;&lt;br /&gt;
 $string[&#039;info&#039;] = &#039;Info&#039;;&lt;br /&gt;
 $string[&#039;introduction&#039;] = &#039;Introduction&#039;;&lt;br /&gt;
-$string[&#039;invalidcategory&#039;] = &#039;Category ID is invalid&#039;;&lt;br /&gt;
 $string[&#039;invalidnumericanswer&#039;] = &#039;One of the answers you entered was not a valid number.&#039;;&lt;br /&gt;
 $string[&#039;invalidnumerictolerance&#039;] = &#039;One of the tolerances you entered was not a valid number.&#039;;&lt;br /&gt;
 $string[&#039;invalidsource&#039;] = &#039;The source is not accepted as valid.&#039;;&lt;br /&gt;
@@ -375,8 +377,10 @@&lt;br /&gt;
 $string[&#039;questiontypesetupoptions&#039;] = &#039;Setup options for question types:&#039;;&lt;br /&gt;
 $string[&#039;quiz:attempt&#039;] = &#039;Attempt quizzes&#039;;&lt;br /&gt;
 $string[&#039;quiz:deleteattempts&#039;] = &#039;Delete quiz attempts&#039;;&lt;br /&gt;
+$string[&#039;quiz:emailconfirmsubmission&#039;] = &#039;Receive own quiz submission notification&#039;;&lt;br /&gt;
+$string[&#039;quiz:emailnotifysubmission&#039;] = &#039;Receive student quiz submission notifications&#039;;&lt;br /&gt;
 $string[&#039;quiz:grade&#039;] = &#039;Grade quizzes manually&#039;;&lt;br /&gt;
-$string[&#039;quiz:ignoretimelimits&#039;] = &#039;Ignores time limit on quizzes&#039;;&lt;br /&gt;
+$string[&#039;quiz:ignoretimelimits&#039;] = &#039;Ignores time limit on quizs&#039;;&lt;br /&gt;
 $string[&#039;quiz:manage&#039;] = &#039;Manage quizzes&#039;;&lt;br /&gt;
 $string[&#039;quiz:preview&#039;] = &#039;Preview quizzes&#039;;&lt;br /&gt;
 $string[&#039;quiz:view&#039;] = &#039;View quiz information&#039;;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At the top it says which file is being affected. Changes to several files can be included in one patch. Lines added are shown with a &#039;+&#039;, lines removed are shown with a &#039;-&#039;, lines changed are shown as the old line being removed and the new one added.&lt;br /&gt;
&lt;br /&gt;
Patch files are good because they only show the changed parts of the file. This has two advantages: it easy to understand the change; and if other parts of the same files change between the patch being made an being used, there is no problem, the patch will still apply.&lt;br /&gt;
&lt;br /&gt;
==Creating a patch using diff==&lt;br /&gt;
&lt;br /&gt;
diff is the a linux command line program, and is where patch files originated. It requires that you have two copies of the code, one with your changes, and one without. Suppose these two copies are in folders called &#039;standard_moodle&#039; and &#039;my_moodle&#039; which are subdirectories of the current folder. Then to create the patch, type:&lt;br /&gt;
&lt;br /&gt;
 diff -ur standard_moodle my_moodle &amp;gt; patch.txt&lt;br /&gt;
&lt;br /&gt;
==Creating a patch using CVS (command line)==&lt;br /&gt;
&lt;br /&gt;
It is easier if you are using CVS to manage your development, because you don&#039;t need to keep the copy of &#039;standard_moodle&#039;. CVS takes care of that for you. In you workspace (sandbox) type:&lt;br /&gt;
&lt;br /&gt;
 cvs diff -uN &amp;gt; patch.txt&lt;br /&gt;
&lt;br /&gt;
==Creating a patch using Tortoise CVS==&lt;br /&gt;
&lt;br /&gt;
[http://www.tortoisecvs.org/ Tortoise CVS] is a Windows GUI front end for CVS. To create a patch, right-click on a folder in CVS, and choose &#039;&#039;&#039;CVS -&amp;gt; Make patch ...&#039;&#039;&#039; from the context menu.&lt;br /&gt;
&lt;br /&gt;
==Creating a patch using Eclipse==&lt;br /&gt;
&lt;br /&gt;
See [[Setting_up_Eclipse#Creating_a_patch]]. Eclipse makes creating patches really easy, once you have got it set up correctly.&lt;br /&gt;
&lt;br /&gt;
==Creating a patch using WinMerge==&lt;br /&gt;
&lt;br /&gt;
[http://winmerge.org/ WinMerge] is a nice windows GUI for comparing folders. It this sense it is like the original command-line &#039;diff&#039; program. You need a copy of &#039;standard_moodle&#039; and &#039;my_moodle&#039;. Use &#039;&#039;&#039;File -&amp;gt; Open...&#039;&#039;&#039; to open the two versions for comparison. This will give you a nice view of what you have changed. Then do &#039;&#039;&#039;Tools -&amp;gt; Generate patch ...&#039;&#039;&#039;. In the dialogue box, make sure you select Style: Unified in the Format box.&lt;/div&gt;</summary>
		<author><name>Prnulc</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Data_manipulation_API&amp;diff=5116</id>
		<title>Data manipulation API</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Data_manipulation_API&amp;diff=5116"/>
		<updated>2008-06-10T16:19:47Z</updated>

		<summary type="html">&lt;p&gt;Prnulc: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this page you&#039;ll access to the available functions under Moodle to be able to access to DB data. You should use &#039;&#039;&#039;exclusively&#039;&#039;&#039; these functions in order to retrieve or modify DB contents because these functions provide an high level of abstraction and guarantee that your DB manipulation will work against different RDBMS.&lt;br /&gt;
&lt;br /&gt;
Where possible, tricks and examples will be documented here in order to make developers&#039;s life a bit easier. Of course, feel free to clarify, complete and add more info to all this documentation. It will be welcome, absolutely!&lt;br /&gt;
&lt;br /&gt;
== Main info ==&lt;br /&gt;
&lt;br /&gt;
== The functions ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      &#039;&#039;&#039;Seeing if any records exist match a given criteria&#039;&#039;&#039;&lt;br /&gt;
          o record_exists($table, $field1=&#039;&#039;, $value1=&#039;&#039;, $field2=&#039;&#039;, $value2=&#039;&#039;, $field3=&#039;&#039;, $value3=&#039;&#039;) &lt;br /&gt;
            Test whether a record exists in a table where all the given fields match the given values.&lt;br /&gt;
          o record_exists_select($table, $select=&#039;&#039;) &lt;br /&gt;
            Test whether any records exists in a table which match a particular WHERE clause.&lt;br /&gt;
          o record_exists_sql($sql) &lt;br /&gt;
            Test whether a SQL SELECT statement returns any records.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      &#039;&#039;&#039;Seeing how many records match a given criteria&#039;&#039;&#039;&lt;br /&gt;
          o count_records($table, $field1=&#039;&#039;, $value1=&#039;&#039;, $field2=&#039;&#039;, $value2=&#039;&#039;, $field3=&#039;&#039;, $value3=&#039;&#039;) &lt;br /&gt;
            Count the records in a table where all the given fields match the given values.&lt;br /&gt;
          o count_records_select($table, $select=&#039;&#039;, $countitem=&#039;COUNT(*)&#039;) &lt;br /&gt;
            Count the records in a table which match a particular WHERE clause.&lt;br /&gt;
          o count_records_sql($sql) &lt;br /&gt;
            Get the result of a SQL SELECT COUNT(...) query.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      &#039;&#039;&#039;Retrieving a single record&#039;&#039;&#039;&lt;br /&gt;
          o get_record($table, $field1, $value1, $field2=&#039;&#039;, $value2=&#039;&#039;, $field3=&#039;&#039;, $value3=&#039;&#039;, $fields=&#039;*&#039;) &lt;br /&gt;
            Get a single record as an object&lt;br /&gt;
          o get_record_select($table, $select=&#039;&#039;, $fields=&#039;*&#039;) &lt;br /&gt;
            Gets one record from a table, as an object&lt;br /&gt;
          o get_record_sql($sql, $expectmultiple=false, $nolimit=false) &lt;br /&gt;
            Get a single record as an object using an SQL statement&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      &#039;&#039;&#039;Getting an array of records&#039;&#039;&#039;&lt;br /&gt;
          o get_records($table, $field=&#039;&#039;, $value=&#039;&#039;, $sort=&#039;&#039;, $fields=&#039;*&#039;, $limitfrom=&#039;&#039;, $limitnum=&#039;&#039;) &lt;br /&gt;
            Get a number of records as an array of objects.&lt;br /&gt;
          o get_records_select($table, $select=&#039;&#039;, $sort=&#039;&#039;, $fields=&#039;*&#039;, $limitfrom=&#039;&#039;, $limitnum=&#039;&#039;) &lt;br /&gt;
            Get a number of records as an array of objects.&lt;br /&gt;
          o get_records_list($table, $field=&#039;&#039;, $values=&#039;&#039;, $sort=&#039;&#039;, $fields=&#039;*&#039;, $limitfrom=&#039;&#039;, $limitnum=&#039;&#039;) &lt;br /&gt;
            Get a number of records as an array of objects.&lt;br /&gt;
          o get_records_sql($sql, $limitfrom=&#039;&#039;, $limitnum=&#039;&#039;) &lt;br /&gt;
            Get a number of records as an array of objects.&lt;br /&gt;
          o get_records_menu($table, $field=&#039;&#039;, $value=&#039;&#039;, $sort=&#039;&#039;, $fields=&#039;*&#039;) &lt;br /&gt;
            Get the first two columns from a number of records as an associative array.&lt;br /&gt;
          o get_records_select_menu($table, $select=&#039;&#039;, $sort=&#039;&#039;, $fields=&#039;*&#039;) &lt;br /&gt;
            Get the first two columns from a number of records as an associative array.&lt;br /&gt;
          o get_records_sql_menu($sql) &lt;br /&gt;
            Get the first two columns from a number of records as an associative array.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      &#039;&#039;&#039;Getting a particular field from the database&#039;&#039;&#039;&lt;br /&gt;
          o get_field($table, $return, $field1, $value1, $field2=&#039;&#039;, $value2=&#039;&#039;, $field3=&#039;&#039;, $value3=&#039;&#039;) &lt;br /&gt;
            Get a single value from a table row where all the given fields match the given values.&lt;br /&gt;
          o get_field_select($table, $return, $select) &lt;br /&gt;
            Get a single value from a table row where a particular select clause is true.&lt;br /&gt;
          o get_field_sql($sql) &lt;br /&gt;
            Get a single value from a table.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      &#039;&#039;&#039;Setting a particular field in the database&#039;&#039;&#039;&lt;br /&gt;
          o set_field($table, $newfield, $newvalue, $field1, $value1, $field2=&#039;&#039;, $value2=&#039;&#039;, $field3=&#039;&#039;, $value3=&#039;&#039;) &lt;br /&gt;
            Set a single field in every table row where all the given fields match the given values.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      &#039;&#039;&#039;Deleting Records&#039;&#039;&#039;&lt;br /&gt;
          o delete_records($table, $field1=&#039;&#039;, $value1=&#039;&#039;, $field2=&#039;&#039;, $value2=&#039;&#039;, $field3=&#039;&#039;, $value3=&#039;&#039;) &lt;br /&gt;
            Delete the records from a table where all the given fields match the given values.&lt;br /&gt;
          o delete_records_select($table, $select=&#039;&#039;) &lt;br /&gt;
            Delete one or more records from a table&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      &#039;&#039;&#039;Inserting Records&#039;&#039;&#039;&lt;br /&gt;
          o insert_record($table, $dataobject, $returnid=true, $primarykey=&#039;id&#039;) &lt;br /&gt;
            Insert a record into a table and return the &amp;quot;id&amp;quot; field if required&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      &#039;&#039;&#039;Updating Records&#039;&#039;&#039;&lt;br /&gt;
          o update_record($table, $dataobject) &lt;br /&gt;
            Update a record in a table&lt;br /&gt;
&lt;br /&gt;
For insert_record and update_record (at least) &#039;&#039;&#039;$table&#039;&#039;&#039; is the table name without any prefix.  This is added in dmllib.php.  --[[User:Paul Ritchings|Paul Ritchings]] 09:09, 10 June 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[DDL functions]]: Where all the functions used to handle DB objects ([[wikipedia:Data_Definition_Language|DDL]]) are defined.&lt;br /&gt;
* [[DML functions - pre 2.0|DML functions - pre 2.0]]: &#039;&#039;&#039;(deprecated!)&#039;&#039;&#039; For information valid before Moodle 2.0.&lt;br /&gt;
&lt;br /&gt;
[[Category:DB]]&lt;br /&gt;
[[Category:XMLDB]]&lt;/div&gt;</summary>
		<author><name>Prnulc</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Data_manipulation_API&amp;diff=5115</id>
		<title>Data manipulation API</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Data_manipulation_API&amp;diff=5115"/>
		<updated>2008-06-10T14:09:36Z</updated>

		<summary type="html">&lt;p&gt;Prnulc: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this page you&#039;ll access to the available functions under Moodle to be able to access to DB data. You should use &#039;&#039;&#039;exclusively&#039;&#039;&#039; these functions in order to retrieve or modify DB contents because these functions provide an high level of abstraction and guarantee that your DB manipulation will work against different RDBMS.&lt;br /&gt;
&lt;br /&gt;
Where possible, tricks and examples will be documented here in order to make developers&#039;s life a bit easier. Of course, feel free to clarify, complete and add more info to all this documentation. It will be welcome, absolutely!&lt;br /&gt;
&lt;br /&gt;
== Main info ==&lt;br /&gt;
&lt;br /&gt;
== The functions ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      &#039;&#039;&#039;Seeing if any records exist match a given criteria&#039;&#039;&#039;&lt;br /&gt;
          o record_exists($table, $field1=&#039;&#039;, $value1=&#039;&#039;, $field2=&#039;&#039;, $value2=&#039;&#039;, $field3=&#039;&#039;, $value3=&#039;&#039;) &lt;br /&gt;
            Test whether a record exists in a table where all the given fields match the given values.&lt;br /&gt;
          o record_exists_select($table, $select=&#039;&#039;) &lt;br /&gt;
            Test whether any records exists in a table which match a particular WHERE clause.&lt;br /&gt;
          o record_exists_sql($sql) &lt;br /&gt;
            Test whether a SQL SELECT statement returns any records.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      &#039;&#039;&#039;Seeing how many records match a given criteria&#039;&#039;&#039;&lt;br /&gt;
          o count_records($table, $field1=&#039;&#039;, $value1=&#039;&#039;, $field2=&#039;&#039;, $value2=&#039;&#039;, $field3=&#039;&#039;, $value3=&#039;&#039;) &lt;br /&gt;
            Count the records in a table where all the given fields match the given values.&lt;br /&gt;
          o count_records_select($table, $select=&#039;&#039;, $countitem=&#039;COUNT(*)&#039;) &lt;br /&gt;
            Count the records in a table which match a particular WHERE clause.&lt;br /&gt;
          o count_records_sql($sql) &lt;br /&gt;
            Get the result of a SQL SELECT COUNT(...) query.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      &#039;&#039;&#039;Retrieving a single record&#039;&#039;&#039;&lt;br /&gt;
          o get_record($table, $field1, $value1, $field2=&#039;&#039;, $value2=&#039;&#039;, $field3=&#039;&#039;, $value3=&#039;&#039;, $fields=&#039;*&#039;) &lt;br /&gt;
            Get a single record as an object&lt;br /&gt;
          o get_record_select($table, $select=&#039;&#039;, $fields=&#039;*&#039;) &lt;br /&gt;
            Gets one record from a table, as an object&lt;br /&gt;
          o get_record_sql($sql, $expectmultiple=false, $nolimit=false) &lt;br /&gt;
            Get a single record as an object using an SQL statement&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      &#039;&#039;&#039;Getting an array of records&#039;&#039;&#039;&lt;br /&gt;
          o get_records($table, $field=&#039;&#039;, $value=&#039;&#039;, $sort=&#039;&#039;, $fields=&#039;*&#039;, $limitfrom=&#039;&#039;, $limitnum=&#039;&#039;) &lt;br /&gt;
            Get a number of records as an array of objects.&lt;br /&gt;
          o get_records_select($table, $select=&#039;&#039;, $sort=&#039;&#039;, $fields=&#039;*&#039;, $limitfrom=&#039;&#039;, $limitnum=&#039;&#039;) &lt;br /&gt;
            Get a number of records as an array of objects.&lt;br /&gt;
          o get_records_list($table, $field=&#039;&#039;, $values=&#039;&#039;, $sort=&#039;&#039;, $fields=&#039;*&#039;, $limitfrom=&#039;&#039;, $limitnum=&#039;&#039;) &lt;br /&gt;
            Get a number of records as an array of objects.&lt;br /&gt;
          o get_records_sql($sql, $limitfrom=&#039;&#039;, $limitnum=&#039;&#039;) &lt;br /&gt;
            Get a number of records as an array of objects.&lt;br /&gt;
          o get_records_menu($table, $field=&#039;&#039;, $value=&#039;&#039;, $sort=&#039;&#039;, $fields=&#039;*&#039;) &lt;br /&gt;
            Get the first two columns from a number of records as an associative array.&lt;br /&gt;
          o get_records_select_menu($table, $select=&#039;&#039;, $sort=&#039;&#039;, $fields=&#039;*&#039;) &lt;br /&gt;
            Get the first two columns from a number of records as an associative array.&lt;br /&gt;
          o get_records_sql_menu($sql) &lt;br /&gt;
            Get the first two columns from a number of records as an associative array.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      &#039;&#039;&#039;Getting a particular field from the database&#039;&#039;&#039;&lt;br /&gt;
          o get_field($table, $return, $field1, $value1, $field2=&#039;&#039;, $value2=&#039;&#039;, $field3=&#039;&#039;, $value3=&#039;&#039;) &lt;br /&gt;
            Get a single value from a table row where all the given fields match the given values.&lt;br /&gt;
          o get_field_select($table, $return, $select) &lt;br /&gt;
            Get a single value from a table row where a particular select clause is true.&lt;br /&gt;
          o get_field_sql($sql) &lt;br /&gt;
            Get a single value from a table.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      &#039;&#039;&#039;Setting a particular field in the database&#039;&#039;&#039;&lt;br /&gt;
          o set_field($table, $newfield, $newvalue, $field1, $value1, $field2=&#039;&#039;, $value2=&#039;&#039;, $field3=&#039;&#039;, $value3=&#039;&#039;) &lt;br /&gt;
            Set a single field in every table row where all the given fields match the given values.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      &#039;&#039;&#039;Deleting Records&#039;&#039;&#039;&lt;br /&gt;
          o delete_records($table, $field1=&#039;&#039;, $value1=&#039;&#039;, $field2=&#039;&#039;, $value2=&#039;&#039;, $field3=&#039;&#039;, $value3=&#039;&#039;) &lt;br /&gt;
            Delete the records from a table where all the given fields match the given values.&lt;br /&gt;
          o delete_records_select($table, $select=&#039;&#039;) &lt;br /&gt;
            Delete one or more records from a table&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      &#039;&#039;&#039;Inserting Records&#039;&#039;&#039;&lt;br /&gt;
          o insert_record($table, $dataobject, $returnid=true, $primarykey=&#039;id&#039;) &lt;br /&gt;
            Insert a record into a table and return the &amp;quot;id&amp;quot; field if required&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      &#039;&#039;&#039;Updating Records&#039;&#039;&#039;&lt;br /&gt;
          o update_record($table, $dataobject) &lt;br /&gt;
            Update a record in a table&lt;br /&gt;
&lt;br /&gt;
For both insert_record and update_record &#039;&#039;&#039;$table&#039;&#039;&#039; is the table name without any prefix.  This is added in dmllib.php.  --[[User:Paul Ritchings|Paul Ritchings]] 09:09, 10 June 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[DDL functions]]: Where all the functions used to handle DB objects ([[wikipedia:Data_Definition_Language|DDL]]) are defined.&lt;br /&gt;
* [[DML functions - pre 2.0|DML functions - pre 2.0]]: &#039;&#039;&#039;(deprecated!)&#039;&#039;&#039; For information valid before Moodle 2.0.&lt;br /&gt;
&lt;br /&gt;
[[Category:DB]]&lt;br /&gt;
[[Category:XMLDB]]&lt;/div&gt;</summary>
		<author><name>Prnulc</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Data_manipulation_API&amp;diff=5114</id>
		<title>Data manipulation API</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Data_manipulation_API&amp;diff=5114"/>
		<updated>2008-06-09T15:56:48Z</updated>

		<summary type="html">&lt;p&gt;Prnulc: /* The functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this page you&#039;ll access to the available functions under Moodle to be able to access to DB data. You should use &#039;&#039;&#039;exclusively&#039;&#039;&#039; these functions in order to retrieve or modify DB contents because these functions provide an high level of abstraction and guarantee that your DB manipulation will work against different RDBMS.&lt;br /&gt;
&lt;br /&gt;
Where possible, tricks and examples will be documented here in order to make developers&#039;s life a bit easier. Of course, feel free to clarify, complete and add more info to all this documentation. It will be welcome, absolutely!&lt;br /&gt;
&lt;br /&gt;
== Main info ==&lt;br /&gt;
&lt;br /&gt;
== The functions ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      &#039;&#039;&#039;Seeing if any records exist match a given criteria&#039;&#039;&#039;&lt;br /&gt;
          o record_exists($table, $field1=&#039;&#039;, $value1=&#039;&#039;, $field2=&#039;&#039;, $value2=&#039;&#039;, $field3=&#039;&#039;, $value3=&#039;&#039;) &lt;br /&gt;
            Test whether a record exists in a table where all the given fields match the given values.&lt;br /&gt;
          o record_exists_select($table, $select=&#039;&#039;) &lt;br /&gt;
            Test whether any records exists in a table which match a particular WHERE clause.&lt;br /&gt;
          o record_exists_sql($sql) &lt;br /&gt;
            Test whether a SQL SELECT statement returns any records.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      &#039;&#039;&#039;Seeing how many records match a given criteria&#039;&#039;&#039;&lt;br /&gt;
          o count_records($table, $field1=&#039;&#039;, $value1=&#039;&#039;, $field2=&#039;&#039;, $value2=&#039;&#039;, $field3=&#039;&#039;, $value3=&#039;&#039;) &lt;br /&gt;
            Count the records in a table where all the given fields match the given values.&lt;br /&gt;
          o count_records_select($table, $select=&#039;&#039;, $countitem=&#039;COUNT(*)&#039;) &lt;br /&gt;
            Count the records in a table which match a particular WHERE clause.&lt;br /&gt;
          o count_records_sql($sql) &lt;br /&gt;
            Get the result of a SQL SELECT COUNT(...) query.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      &#039;&#039;&#039;Retrieving a single record&#039;&#039;&#039;&lt;br /&gt;
          o get_record($table, $field1, $value1, $field2=&#039;&#039;, $value2=&#039;&#039;, $field3=&#039;&#039;, $value3=&#039;&#039;, $fields=&#039;*&#039;) &lt;br /&gt;
            Get a single record as an object&lt;br /&gt;
          o get_record_select($table, $select=&#039;&#039;, $fields=&#039;*&#039;) &lt;br /&gt;
            Gets one record from a table, as an object&lt;br /&gt;
          o get_record_sql($sql, $expectmultiple=false, $nolimit=false) &lt;br /&gt;
            Get a single record as an object using an SQL statement&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      &#039;&#039;&#039;Getting an array of records&#039;&#039;&#039;&lt;br /&gt;
          o get_records($table, $field=&#039;&#039;, $value=&#039;&#039;, $sort=&#039;&#039;, $fields=&#039;*&#039;, $limitfrom=&#039;&#039;, $limitnum=&#039;&#039;) &lt;br /&gt;
            Get a number of records as an array of objects.&lt;br /&gt;
          o get_records_select($table, $select=&#039;&#039;, $sort=&#039;&#039;, $fields=&#039;*&#039;, $limitfrom=&#039;&#039;, $limitnum=&#039;&#039;) &lt;br /&gt;
            Get a number of records as an array of objects.&lt;br /&gt;
          o get_records_list($table, $field=&#039;&#039;, $values=&#039;&#039;, $sort=&#039;&#039;, $fields=&#039;*&#039;, $limitfrom=&#039;&#039;, $limitnum=&#039;&#039;) &lt;br /&gt;
            Get a number of records as an array of objects.&lt;br /&gt;
          o get_records_sql($sql, $limitfrom=&#039;&#039;, $limitnum=&#039;&#039;) &lt;br /&gt;
            Get a number of records as an array of objects.&lt;br /&gt;
          o get_records_menu($table, $field=&#039;&#039;, $value=&#039;&#039;, $sort=&#039;&#039;, $fields=&#039;*&#039;) &lt;br /&gt;
            Get the first two columns from a number of records as an associative array.&lt;br /&gt;
          o get_records_select_menu($table, $select=&#039;&#039;, $sort=&#039;&#039;, $fields=&#039;*&#039;) &lt;br /&gt;
            Get the first two columns from a number of records as an associative array.&lt;br /&gt;
          o get_records_sql_menu($sql) &lt;br /&gt;
            Get the first two columns from a number of records as an associative array.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      &#039;&#039;&#039;Getting a particular field from the database&#039;&#039;&#039;&lt;br /&gt;
          o get_field($table, $return, $field1, $value1, $field2=&#039;&#039;, $value2=&#039;&#039;, $field3=&#039;&#039;, $value3=&#039;&#039;) &lt;br /&gt;
            Get a single value from a table row where all the given fields match the given values.&lt;br /&gt;
          o get_field_select($table, $return, $select) &lt;br /&gt;
            Get a single value from a table row where a particular select clause is true.&lt;br /&gt;
          o get_field_sql($sql) &lt;br /&gt;
            Get a single value from a table.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      &#039;&#039;&#039;Setting a particular field in the database&#039;&#039;&#039;&lt;br /&gt;
          o set_field($table, $newfield, $newvalue, $field1, $value1, $field2=&#039;&#039;, $value2=&#039;&#039;, $field3=&#039;&#039;, $value3=&#039;&#039;) &lt;br /&gt;
            Set a single field in every table row where all the given fields match the given values.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      &#039;&#039;&#039;Deleting Records&#039;&#039;&#039;&lt;br /&gt;
          o delete_records($table, $field1=&#039;&#039;, $value1=&#039;&#039;, $field2=&#039;&#039;, $value2=&#039;&#039;, $field3=&#039;&#039;, $value3=&#039;&#039;) &lt;br /&gt;
            Delete the records from a table where all the given fields match the given values.&lt;br /&gt;
          o delete_records_select($table, $select=&#039;&#039;) &lt;br /&gt;
            Delete one or more records from a table&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      &#039;&#039;&#039;Inserting Records&#039;&#039;&#039;&lt;br /&gt;
          o insert_record($table, $dataobject, $returnid=true, $primarykey=&#039;id&#039;) &lt;br /&gt;
            Insert a record into a table and return the &amp;quot;id&amp;quot; field if required&lt;br /&gt;
$table is the table name without any prefix.  This is added in dmllib.php.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      &#039;&#039;&#039;Updating Records&#039;&#039;&#039;&lt;br /&gt;
          o update_record($table, $dataobject) &lt;br /&gt;
            Update a record in a table&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[DDL functions]]: Where all the functions used to handle DB objects ([[wikipedia:Data_Definition_Language|DDL]]) are defined.&lt;br /&gt;
* [[DML functions - pre 2.0|DML functions - pre 2.0]]: &#039;&#039;&#039;(deprecated!)&#039;&#039;&#039; For information valid before Moodle 2.0.&lt;br /&gt;
&lt;br /&gt;
[[Category:DB]]&lt;br /&gt;
[[Category:XMLDB]]&lt;/div&gt;</summary>
		<author><name>Prnulc</name></author>
	</entry>
</feed>