--- /dev/null
+<html>
+<head>
+<title>Moodle Dokumentation: Coding Guidelines</title>
+<link rel="stylesheet" href="docstyles.css" type="TEXT/CSS">
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+<body bgcolor="#FFFFFF">
+<h1>Moodle Coding Guidelines</h1>
+<p class="normaltext">Die Stabilität eines Programms wie Moodle hängt weesentlich davon ab, dass alle Entwickler des Programmcodes bestimmte Grundregeln einheitlich anwenden. Diese sind hier definert.</p>
+<p class="normaltext">Dieser Text wird vorläufig nicht ins Deustche übersetzt. Wir gehen davon aus, dass alle Anwender, dier selber Programmteile für Moodle bearbeiten wollen so viel Englisch lesen und verstehen können dass sie diesen Text im Original verstehen. </p>
+<p class="normaltext">Any collaborative project needs consistency and stability
+ to stay strong.</p>
+<p class="normaltext">These guidelines are to provide a goal for all Moodle code
+ to strive to. It's true that some of the older existing code falls short in
+ a few areas, but it will all be fixed eventually. All new code definitely must
+ adhere to these standards as closely as possible.</p>
+<h2>General Rules</h2>
+<ol class="normaltext">
+ <li class="spaced">All code files should use the .php extension.</li>
+ <li class="spaced">All template files should use the .html extension.</li>
+ <li class="spaced">All text files should use Unix-style text format (most text
+ editors have this as an option).</li>
+ <li class="spaced">All php tags must be 'full' tags like <font color="#339900"><?php
+ ?></font> ... not 'short' tags like <font color="#339900"><? ?></font>.
+ </li>
+ <li class="spaced">All existing copyright notices must be retained. You can
+ add your own if necessary.</li>
+ <li class="spaced">Each file should include the main config.php file.</li>
+ <li class="spaced">Each file should check that the user is authenticated correctly,
+ using require_login() and isadmin(), isteacher(), iscreator() or isstudent().</li>
+ <li class="spaced">All access to databases should use the functions in lib/datalib.php
+ whenever possible - this allows compatibility across a wide range of databases.
+ You should find that almost anything is possible using these functions. If you must write SQL code then make sure it is: cross-platform; restricted to specific functions
+ within your code (usually a lib.php file); and clearly marked.</li>
+ <li class="spaced">Don't create or use global variables except for the standard
+ $CFG, $SESSION, $THEME and $USER.</li>
+ <li class="spaced">All variables should be initialised or at least tested for
+ existence using isset() or empty() before they are used.</li>
+ <li class="spaced">All strings should be translatable - create new texts in
+ the "lang/en" files and call them using get_string() or print_string().</li>
+ <li class="spaced">All help files should be translatable - create new texts
+ in the "en/help" directory and call them using helpbutton().</li>
+</ol>
+<p> </p>
+<h2>Coding Style</h2>
+<p class="normaltext">I know it can be a little annoying to change your style
+ if you're used to something else, but balance that annoyance against the annoyance
+ of all the people trying later on to make sense of Moodle code with mixed styles.
+ There are obviously many good points for and against any style that people use,
+ but the current style just <strong>is</strong>, so please stick to it. </p>
+<ol class="normaltext">
+ <li class="spaced"><strong>Indenting</strong> should be consistently 4 spaces.
+ Don't use tabs AT ALL. </li>
+ <li class="spaced"><strong>Variable names</strong> should always be easy-to-read,
+ meaningful lowercase English words. If you really need more than one word
+ then run them together, but keep them short as possible. Use
+plural names for arrays of objects.
+ <p class="examplecode"><font color="#006600">GOOD: $quiz<br>
+ GOOD: $errorstring<br>
+GOOD: $assignments (for an array of objects)<br>
+ GOOD: $i (but only in little loops)<br>
+ <br />
+ BAD: $Quiz <br>
+ BAD: $aReallyLongVariableNameWithoutAGoodReason<br>
+ BAD: $error_string</font></p>
+ </li>
+ <li class="spaced"><strong>Constants</strong> should always be in upper case,
+ and always start with the name of the module. They should have words separated
+ by underscores.
+ <p class="examplecode"><font color="#006600">define("FORUM_MODE_FLATOLDEST",
+ 1);</font></p>
+ </li>
+ <li class="spaced"><strong>Function names</strong> should be simple English
+ words, and start with the name of the module to avoid conflicts between modules.
+ Words should be separated by underscores. Parameters should always have sensible
+ defaults if possible. Note there is no space between the function name and
+ the following (brackets). <br>
+ <p class="examplecode"> <font color="#007700">function </font><font color="#0000BB">forum_set_display_mode</font><font color="#007700">(</font><font color="#0000BB">$mode</font><font color="#007700">=</font><font color="#0000BB">0</font><font color="#007700">)
+ {<br />
+ global </font><font color="#0000BB">$USER</font><font color="#007700">,
+ </font><font color="#0000BB">$CFG</font><font color="#007700">;<br />
+ <br />
+ if (</font><font color="#0000BB">$mode</font><font color="#007700">)
+ {<br />
+ </font><font color="#0000BB">$USER</font><font color="#007700">-></font><font color="#0000BB">mode
+ </font><font color="#007700">= </font><font color="#0000BB">$mode</font><font color="#007700">;<br />
+ } else if (empty(</font><font color="#0000BB">$USER</font><font color="#007700">-></font><font color="#0000BB">mode</font><font color="#007700">))
+ {<br />
+ </font><font color="#0000BB">$USER</font><font color="#007700">-></font><font color="#0000BB">mode
+ </font><font color="#007700">= </font><font color="#0000BB">$CFG</font><font color="#007700">-></font><font color="#0000BB">forum_displaymode</font><font color="#007700">;<br />
+ }<br />
+ }</font></p>
+ </li>
+ <li class="spaced"><strong>Blocks</strong> must always be enclosed in curly
+ braces (even if there is only one line). Moodle uses this style:
+ <p class="examplecode"> <font color="#006600">if (</font><font color="#0000CC">$quiz</font><font color="#006600">-></font><font color="#0000CC">attempts</font><font color="#006600">)
+ {<br />
+ if (</font><font color="#0000CC">$numattempts </font><font color="#006600">>
+ </font><font color="#0000CC">$quiz</font><font color="#006600">-></font><font color="#0000CC">attempts</font><font color="#006600">)
+ {<br />
+ </font><font color="#0000CC">error</font><font color="#006600">(</font><font color="#0000BB">$strtoomanyattempts</font><font color="#006600">,
+ </font><font color="#CC0000">"view.php?id=$cm</font><font color="#006600">-></font><font color="#CC0000">id"</font><font color="#006600">);<br />
+ }<br />
+ }</font></p>
+ </li>
+ <li class="spaced"><strong>Strings</strong> should be defined using single quotes
+ where possible, for increased speed.<br>
+ <p class="examplecode"> <font color="#006600">$var = 'some text without any
+ variables';<br>
+ $var = "with special characters like a new line \n";<br>
+ $var = 'a very, very long string with a '.$single.' variable in it';<br>
+ $var = "some $text with $many variables $within it"; </font></p>
+ </li>
+ <li class="spaced"><strong>Comments</strong> should use two or three slashes
+ and line up nicely with the code.
+ <p class="examplecode"><font color="#006600">function </font><font color="#0000BB">forum_get_ratings_mean</font><font color="#007700">(</font><font color="#0000BB">$postid</font><font color="#007700">,
+ </font><font color="#0000BB">$scale</font><font color="#007700">, </font><font color="#0000BB">$ratings</font><font color="#007700">=</font><font color="#0000BB">NULL</font><font color="#007700">)
+ {<br />
+ </font><font color="#FF8000">/// Return the mean rating of a post given
+ to the current user by others.<br />
+ /// Scale is an array of possible ratings in the scale<br />
+ /// Ratings is an optional simple array of actual ratings (just integers)<br />
+ <br />
+ </font><font color="#007700">if (!</font><font color="#0000BB">$ratings</font><font color="#007700">)
+ {<br />
+ </font><font color="#0000BB">$ratings
+ </font><font color="#007700">= array(); </font><font color="#FF8000">//
+ Initialize the empty array</font><font color="#007700"><br />
+ if (</font><font color="#0000BB">$rates
+ </font><font color="#007700">= </font><font color="#0000BB">get_records</font><font color="#007700">(</font><font color="#DD0000">"forum_ratings"</font><font color="#007700">,
+ </font><font color="#DD0000">"post"</font><font color="#007700">, </font><font color="#0000BB">$postid</font><font color="#007700">))
+ {<br>
+ </font><font color="#FF8000">//
+ Process each rating in turn</font><font color="#007700"><br />
+ foreach
+ (</font><font color="#0000BB">$rates </font><font color="#007700">as </font><font color="#0000BB">$rate</font><font color="#007700">)
+ {</font> <br>
+ ....etc </p>
+ </li>
+ <li class="spaced"><strong>Space</strong> should be used liberally - don't be
+ afraid to spread things out a little to gain some clarity. Generally, there
+ should be one space between brackets and normal statements, but no space between
+ brackets and variables or functions:<br>
+ <p class="examplecode"> <font color="#007700">foreach (</font><font color="#0000BB">$objects
+ </font><font color="#007700">as </font><font color="#0000BB">$key </font><font color="#007700">=></font><font color="#0000BB">
+ $thing</font><font color="#007700">)</font><font color="#006600"> {<br>
+ </font><font color="#007700"> </font><font color="#0000BB">process($thing);</font><font color="#006600">
+ <br>
+ } <br>
+ <br>
+ </font><font color="#007700">if (</font><font color="#0000BB">$x </font><font color="#007700">==
+ </font><font color="#0000BB">$y</font><font color="#007700">)</font><font color="#006600">
+ {<br>
+ </font><font color="#007700"> </font><font color="#0000BB">$a
+ </font><font color="#007700">= </font><font color="#0000BB">$b</font><font color="#007700">;</font><font color="#006600"><br>
+ } else if (</font><font color="#0000BB">$x </font><font color="#007700">==
+ </font><font color="#0000BB">$z</font><font color="#006600">) {<br>
+ </font><font color="#007700"> </font><font color="#0000BB">$a
+ </font><font color="#007700">= </font><font color="#0000BB">$c</font><font color="#007700">;</font><font color="#006600"><br>
+ } else {<br>
+ </font><font color="#007700"> </font><font color="#0000BB">$a
+ </font><font color="#007700">= </font><font color="#0000BB">$d</font><font color="#007700">;</font><font color="#006600"><br>
+ } </font></p>
+ </li>
+</ol>
+<p> </p>
+<h2>Database structures</h2>
+<ol class="normaltext">
+ <li class="spaced">Every table must have an auto-incrementing <strong>id</strong> field (INT10) as primary index.</li>
+ <li class="spaced">The main table containing instances of each module must have the same name as the module (eg <strong>widget</strong>) and contain the following minimum fields:
+ <ul>
+ <li><strong>id</strong> - as described above</li>
+ <li><strong>course</strong> - the id of the course that each instance belongs to</li>
+ <li><strong>name</strong> - the full name of each instance of the module</li>
+ </ul>
+ </li>
+ <li class="spaced">Other tables associated with a module that contain information about 'things' should be named <strong>widget_things</strong> (note the plural).</li>
+ <li class="spaced">Column names should be simple and short, following the same rules as for variable names.</li>
+ <li class="spaced">Where possible, columns that contain a reference to the id field of another table (eg <strong>widget</strong>) should be called <strong>widgetid</strong>. (Note that this convention is newish and not followed in some older tables)</li>
+ <li class="spaced">Boolean fields should be implemented as small integer fields (eg INT4) containing 0 or 1, to allow for later expansion of values if necessary.</li>
+ <li class="spaced">Most tables should have a <strong>timemodified</strong> field (INT10) which is updated with a current timestamp obtained with the PHP <strong>time</strong>() function.</li>
+</ol>
+<hr>
+<p align="CENTER"><font size="1"><a href="." target="_top">Moodle Documentation</a></font></p>
+<p align="CENTER"><font size="1">Version: $Id$</font></p>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<head>
+ <title>Moodle Dokumentation: Apache, MySQL und PHP installieren</title>
+ <link rel="stylesheet" href="docstyles.css" type="TEXT/CSS">
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<h1>Installation von Apache, MySQL und PHP</h1>
+<blockquote>
+ <p>Moodle <br>
+ Moodle ist in einer Scriptsprache namens PHP geschrieben, und speichert die meisten Daten in einer Datenbank. Die favorisierte Datenbank ist MySQL. Bevor Moodle installiert werden kann ist es erforderlich eine PHP-Installation eingerichtet zu haben und eine Datenbank auf einem WebServer einzurichten. Diese Softwarepakete zu installieren kann agnz schön knifflig sein, diese Seite erklärt mit einfachen Worten wie dies auf verschiedenen Plattformen möglich ist:</p>
+ <ul>
+ <li><a href="#host" class="questionlink">Hosting Service</a></li>
+ <li><a href="#mac" class="questionlink">Mac OS X</a></li>
+ <li><a href="#redhat" class="questionlink">Redhat Linux</a></li>
+ <li><a href="#windows" class="questionlink">Windows</a></li>
+ </ul>
+ <p class="questionlink"> </p>
+ <h3 class="sectionheading"><a name="host" id="host"></a>Hosting Service</h3>
+ <blockquote>
+ <p>Leider gibt es große Unterschiede zwiscehn den verschiedenen Webhostinganbietern. Einige bieten an Moodle für Sie zu installieren. </p>
+ <p>Die meisten bieten eine Onlineoberfläche zur Verwaltung der Seite, zum Einrichten von Datenbanken und zur Aktivierung von Cron-Jobs an. Einige bieten einen terminal access via ssh an. Dann können Sie die command shell nutzen.</p>
+ <p>Arbeiten Sie die <a href="./?file=install.html">Installationsanweisung
+</a> Stück für Stück durch. Fragen Sie Ihren Provider wenn Probleme auftauchen.
+ </p>
+ <p> </p>
+ </blockquote>
+ <h3 class="sectionheading"><a name="mac" id="mac"></a>Mac OS X</h3>
+ <blockquote>
+ <p>Der einfachste Weg ist die Nutzung des Apache Servers, der auch Apple unterstützt. Und ergänzen Sie PHP und MySQL aus Marc Liyanage's Paket. Beide unten aufgeführten Seiten verfügen über eine gute Anleitung, die wir hier nicht wiederholen:</p>
+ <blockquote>
+ <p><strong>PHP</strong>: Download: <a href="http://www.entropy.ch/software/macosx/php/" target="_top">http://www.entropy.ch/software/macosx/php/</a></p>
+ <p><strong>MySQL</strong>: Download: <a href="http://www.entropy.ch/software/macosx/mysql/" target="_top">http://www.entropy.ch/software/macosx/mysql/</a></p>
+ </blockquote>
+ <p>Wenn diese installiert sind, sollte die Standard- <a href="./?file=install.html">Installationsanleitung</a> ausreichen.</p>
+ <p>Eine ausführliche Anleitung finden Sie hier: <a href="http://moodle.org/wiki/index.php/InstallingMoodle">http://moodle.org/wiki/index.php/InstallingMoodle</a></p>
+ <p> </p>
+ </blockquote>
+ <h3 class="sectionheading"><a name="redhat"></a>Redhat Linux</h3>
+ <blockquote>
+ <p>Installieren Sie alle verfügbaren RPM packages für Apache, PHP und MySQL.
+ Ein Paket, das immer wieder vergessen wird ist das php-mysql Paket. Es wird für die Kommunikation von PHP mit MySQL benötigt.</p>
+ <p>Danach sollte die Standard-<a href="./?file=install.html">Installationsanleitung
+</a> weiterhelfen.</p>
+ <p>Eine ausführlichere Anleitung hier:: <a href="http://moodle.org/wiki/index.php/InstallingMoodle">http://moodle.org/wiki/index.php/InstallingMoodle</a></p>
+ </blockquote>
+ <p> </p>
+ <h3 class="sectionheading"><a name="windows" id="windows"></a>Windows</h3>
+ <blockquote>
+ <p>Der einfachste Weg erfolgt über das <a href="http://www.easyphp.org/" target="_blank">EasyPHP</a>-Paket. Das Paket bündelt alle erforderlichen Softwareprogramme in einer Windowsanwendung. Hier nun die Schritte von Anfang an:</p>
+ <ol>
+ <li> Zunächst, wenn Sie bereits früher MySQL installiert haben, deinstallieren Sie alles. Lösceh sie alle MySQL-Dateien und auch die Dateien <strong>c:\my.cnf</strong> und <strong>c:\windows\my.ini</strong>. Führe Sie eine Dateisuche nach den Dateien: <strong>my.cnf</strong>
+ oder <strong>my.ini</strong> durch und löschen Sie sie vollständig.</li>
+ <li> Wenn Sie früher bereits PHP installiert haben, löschen Sie auf die gleiche Art alle Dateien mit dem Namen <strong>php4ts.dll</strong>
+ aus dem Windows Verzeichnis, sowie alle Dateien mit dem Namen <strong>php.ini</strong>.</li>
+ <li> Downloaden sie EasyPHP hier: <a href="http://www.easyphp.org/telechargements/dn.php?F=easyphp1-7">http://www.easyphp.org/telechargements/dn.php?F=easyphp1-7</a>
+ (approx 10 Mb)</li>
+ <li> Führen Sie die Datei <strong>easyphp1-7_setup.exe</strong> aus. Der Installationsprozess wird auf französisch ausgeführt. Er verläuft jedoch auf die gleiche Art und Weise wie bei anderen Windowsprogrammen auch. Akzeptieren Sie alle Hinweise und führen Sie eine vollständige Installation durch. Anmerkung:
+ "Suivant" bedeutet 'Weiter' und "Oui" bedeutet 'Ja'.</li>
+ <li>Am Ende der Installation lassen Sie die Auswahl der Checkbox auf "Lancer
+ EasyPHP" (Start EasyPHP) stehen und klicken Sie auf den 'Terminer" Button. Sie werden nun zu einer Informationsseite egführt, die Sie ignorieren können. </li>
+ <li>Gratulation, wenn alles geklappt hat! Apache, PHP und MySQL sind komplett installiert und laufen. Sie sollten in der Toolbar ein schwarzes E vorfinden. Klicken Sie mit der rechten Maustaste darauf und Sie erhalten ein Kontrollmenu über die laufenden Programme.</li>
+ <li>Einige Einträge werden auf französisch sein. Den englischen Sprachfile finden Sie unter: <a href="http://www.easyphp.org/telechargements/dn.php?F=indexUS_1.7">http://www.easyphp.org/telechargements/dn.php?F=indexUS_1.7</a>. Diese können über die vorhandenen Dateien kopiert werden.</li>
+ <li> Als nächstes müssen Sie eine Datenbank für Moodle einrichten.
+ Rechts-klick am schwäzen E in der Toolbar und Administration auswählen, dann auch DB Management klicken (neben PHPMyAdmin).</li>
+ <li>Wenn Sie nach einem username gefragt werden, geben Sie "<strong>root</strong>" mit einem <strong>leeren Passwort</strong> ein. Sie sollten nun die Oberfläche von phpMyAdmin sehen, wo sie neue Datenbanken und Nutzer einrichten können. </li>
+ <li>Erstellen Sie eine neue Datenbank durch Eingabe von "moodle" im Feld und bestätigen unter im "Create" Button. Das war einfach!</li>
+ <li>Sie könne zugleich neue Anwender mit Zugriff auf diese Datenbank einrichten, wenn Sie wollen. Dies ist etwas aufwendiger wenn Sie es zum ersten Mal machen. Benutzen Sie daher zunächst den vorhandenen Anwender "root" ohne Passwort in Ihrer Konfiguration für Moodle ud nehmen sie später Änderungen vor. .</li>
+ <li> Sie haben nun alles für die Installation von Moodle vorbereitet. Downloaden Sie sich nun die aktuellste Version von Moodle von <a href="http://moodle.org/download" target="_blank">http://moodle.org/download</a>,
+ und unzippen Sie das Archiv.</li>
+ <li>Kopieren Sie Ihre Moodle-Dateien nach <strong>C:\Program Files\EasyPHP\www. </strong>Sie können entweder das gesamte Moodle-Verzeichnis (z.B. C:\Program Files\EasyPHP\www\moodle)
+ oder den <em>Inhalt</em> des moodle Verzeichnisses kopieren. Wenn Sie die zweite Option wählen, erreichen Sie den Zugnag zu Ihrem Moodle mit der Eingabe von http://localhost/ an Stelle von http://localhost/moodle/.</li>
+ <li> Erstellen Sie einen leeren Ordner an anderer Stelle für die Ablage von hochgeladenen Dateien in Moodle, z.B. : <strong>C:\moodledata</strong></li>
+ <li> Gehen Sie in Ihen Moodle-Ordner und erstellen Sie eine Kopie der Datei config-dist.php mit dem Namen config.php</li>
+ <li> Bearbeiten Sie config.php mit einem Texteditor (z.B. mit Notepad oder einem HTML Editor). </li>
+ <li>Geben Sie folgenden Datenbankinformationen ein:<br>
+ $CFG->dbtype = 'mysql';<br>
+ $CFG->dbhost = 'localhost';<br>
+ $CFG->dbname = 'moodle';<br>
+ $CFG->dbuser = 'root'; <br>
+ $CFG->dbpass = '';<br>
+ $CFG->dbpersist = true;<br>
+ $CFG->prefix = 'mdl_';</li>
+ <li>Und fügen Sie die Pfade ein:<br>
+ $CFG->wwwroot = 'http://localhost/moodle'; // Use an external address
+ if you know it. <br>
+ $CFG->dirroot = 'C:\Program Files\EasyPHP\www\moodle'; <br>
+ $CFG->dataroot = 'C:\moodledata';</li>
+ <li>Speichern Sie die config.php - alle anderen Einstellungen können Sie ignorieren.</li>
+ <li>Sie sind nun fast fertig. Die weiteren Schritte des Setup nehmen Sie mit Ihrem Browser vor. Rufen Sie <a href="http://localhost/moodle/admin/" target="_blank">http://localhost/moodle/admin/</a>
+ mit Ihem Browser auf, um das Setup abzuschließen.</li>
+ <li>Um zip-files mit Moodle zu verwenden (z.B. nutzen die Backups zip-Dateien) sollten Sie "zlib" enablen. Sie können dies in Ihrem EasyPHP
+ Verzeichnis (<strong>C:\Program Files\EasyPHP</strong>) durch das Ausführen des Programms phpini.exe. Markieren Sie die Checkbox neben "zlib.dll".
+ Schließen Sie das Fenster, gehen Sie zum schwarzen E in Ihrer Toolbar und öffnen Sie mit der rechten Maustaste das Menu, wählen Sie "Restart" in diesm Menu aus..</li>
+ <li>Zum Schluß können Sie noch Cron-Jobs einrichten. Beachten Sie auch die <a href="./?file=install.html">Installationsanleitung
+ guide</a> für weitere Details.</li>
+ </ol>
+ <p>Wenn Sie EasyPHP nicht benutzen können oder wollen, habe ich hier einige Hinweise für Sie:</p>
+ <ul>
+ <li>Prüfen Sie, ob das GD Modul enabled ist, damit Moodle, Bilder verarbeiten kann. Sie können die Datei php.ini bearbeiten und den Kommentar (;) von dieser Zeile entfernen: 'extension=php_gd2.dll'.
+ </li>
+ <li>Prüfen sie, ob das Zlib Module enabled ist, damit Sie ZIP-Files erstellen u d entpacken können in Moodle.</li>
+ <li>Stellen Sie sicher, dass sessions auf der Einstellung 'turned on'. Bearbeiten Sie dazu die Datei edit php.ini und legen sie das Verzeichnis für <strong>session.save_path</strong> fest. Ändern Sie dazu das als Standard eingestellte Verzeichnis "/tmp" auf folgende Einstellung wie z.B. "c:/temp".</li>
+ </ul>
+ <p> </p>
+ </blockquote>
+</blockquote>
+<p align="CENTER"><font size="1"><a href="." target="_top">Moodle Dokumentation</a></font></p>
+<p align="CENTER"><font size="1">Version: $Id$</font></p>
+
+</body>
+</html>
\ No newline at end of file