--- /dev/null
+<html>\r
+\r
+<head>\r
+<title>Moodle Docs: Coding Guidelines</title>\r
+<link rel="stylesheet" href="../theme/standard/styles.php" type="TEXT/CSS">\r
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">\r
+<style type="text/css">\r
+\r
+<!--\r
+li {\r
+ padding-top: 10px;\r
+}\r
+\r
+.question {\r
+\r
+ font-size: medium;\r
+\r
+ font-weight: bold;\r
+\r
+ font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;\r
+\r
+ border: 1px dotted;\r
+\r
+ padding: 10px;\r
+\r
+ background-color: #EEEEEE;\r
+\r
+}\r
+\r
+.answer {\r
+\r
+ font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;\r
+\r
+ font-size: medium;\r
+\r
+ border: none;\r
+\r
+ padding-left: 40px;\r
+\r
+}\r
+\r
+-->\r
+\r
+</style>\r
+<style type="text/css">\r
+\r
+<!--\r
+\r
+.normaltext {\r
+\r
+ font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;\r
+\r
+ font-size: medium;\r
+\r
+ border: none;\r
+\r
+ padding-left: 10px;\r
+\r
+}\r
+\r
+.answercode {\r
+\r
+ font-family: "Courier New", Courier, mono;\r
+\r
+ font-size: small;\r
+\r
+ border: none;\r
+\r
+ padding-left: 60px;\r
+\r
+}\r
+\r
+.questionlink {\r
+\r
+ font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;\r
+\r
+ font-size: medium;\r
+\r
+ border: none;\r
+\r
+ padding-left: 40px;\r
+\r
+}\r
+\r
+-->\r
+\r
+</style>\r
+<style type="text/css">\r
+<!--\r
+.examplecode {\r
+ font-family: "Courier New", Courier, mono;\r
+ font-size: small;\r
+ border: thin dashed #999999;\r
+ background-color: #FBFBFB;\r
+ margin: auto;\r
+ padding: 30px;\r
+ height: auto;\r
+ width: auto;\r
+}\r
+-->\r
+</style>\r
+</head>\r
+\r
+\r
+\r
+<body bgcolor="#FFFFFF">\r
+\r
+<h2>Moodle Coding Guidelines</h2>\r
+\r
+<h2 class="normaltext">General Rules</h2>\r
+ \r
+<ol class="normaltext">\r
+ <li>All files should use the .php extension.</li>\r
+ <li>All copyright notices should be retained. You can add your own if necessary.</li>\r
+ <li>Each file should include the main config.php file.</li>\r
+ <li>Each file should check that the user is authenticated correctly, using require_login() \r
+ and isadmin(), isteacher(), iscreator() or isstudent().</li>\r
+ <li>All access to databases should use the functions in lib/datalib.php whenever \r
+ possible - this allows compatibility across a wide range of databases. You \r
+ should find that almost anything is possible using these functions. Any other \r
+ SQL statements should be: cross-platform; restricted to specific functions \r
+ within your code (usally a lib.php file); and clearly marked.</li>\r
+ <li>All strings should be translatable - create new texts in the "lang/en" \r
+ files and call them using get_string() or print_string().</li>\r
+ <li>All help files should be translatable - create new texts in the "en/help" \r
+ directory and call them using helpbutton().</li>\r
+</ol>\r
+<p> </p>\r
+<h2 class="normaltext">Coding Style</h2>\r
+ \r
+<ol class="normaltext">\r
+ <li>Don't use tabs at all. Use consistent indenting with 4 spaces.</li>\r
+ <li>Braces must always be used for blocks of code (even if there is only one \r
+ line). Moodle uses this style: \r
+ <p class="examplecode"> </font><font color="#006600">if (</font><font color="#0000CC">$quiz</font><font color="#006600">-></font><font color="#0000CC">attempts</font><font color="#006600">) \r
+ {<br />\r
+ if (</font><font color="#0000CC">$numattempts </font><font color="#006600">> \r
+ </font><font color="#0000CC">$quiz</font><font color="#006600">-></font><font color="#0000CC">attempts</font><font color="#006600">) \r
+ {<br />\r
+ </font><font color="#0000CC">error</font><font color="#006600">(</font><font color="#CC0000">$strtoomanyattempts</font><font color="#006600">, \r
+ </font><font color="#CC0000">"view.php?id=$cm</font><font color="#006600">-></font><font color="#CC0000">id"</font><font color="#006600">);<br />\r
+ }<br />\r
+ }</font></p>\r
+ </li>\r
+ <li>more to come here .... this document is not nearly finished yet!</li>\r
+ </ol>\r
+\r
+\r
+\r
+<p align="center" class="normaltext"> </p>\r
+\r
+<hr>\r
+<p align="CENTER"><font size="1"><a href="." target="_top">Moodle Documentation</a></font></p>\r
+\r
+<p align="CENTER"><font size="1">Version: $Id: faq.html,v 1.6 2003/03/30 13:54:28 \r
+\r
+ moodler Exp $</font></p>\r
+\r
+\r
+\r
+</body>\r
+\r
+</html>\r
+\r