diff --git a/lang/fr/docs/coding.html b/lang/fr/docs/coding.html new file mode 100755 index 00000000000..47eeed3c638 --- /dev/null +++ b/lang/fr/docs/coding.html @@ -0,0 +1,227 @@ + +
+Tout projet où l'on travaille en collaboration +nécessite une cohérence et une stabilité fortes.
+L'objectif de ces directives est de +fournir un cadre à respecter pour tout le code de Moodle. Il +est vrai que certaines parties plus anciennes du code ne +les respectent pas toujours ; le code sera corrigé. Tout le +nouveau code doit absolument respecter ces directives +aussi précisément que possible.
++
Je suis conscient qu'il est ennuyeux de changer +votre style si vous avez d'autres habitudes, mais comparez cet embêtement +avec les gros ennuis qu'ont ultérieurement les personnes qui +essaient de comprendre un code composé avec des styles différents. Bien +sûr il y a des avantages et des inconvénients à n'importe quel style, +mais le style de Moodle existe, alors tenez-vous y, +s'il vous plaît.
+BON : $quiz
+ BON : $errorstring
+ BON : $assignments (pour un tableau d'objets)
+ BON : $i (mais seulement dans de petites boucles)
+
+ MAUVAIS : $Quiz
+ MAUVAIS : $aReallyLongVariableNameWithoutAGoodReason
+ MAUVAIS : $error_string
define("FORUM_MODE_FLATOLDEST", + 1);
+ function forum_set_display_mode($mode=0)
+ {
+ global $USER,
+ $CFG;
+
+ if ($mode)
+ {
+ $USER->mode
+ = $mode;
+ } else if (empty($USER->mode))
+ {
+ $USER->mode
+ = $CFG->forum_displaymode;
+ }
+ }
if ($quiz->attempts)
+ {
+ if ($numattempts >
+ $quiz->attempts)
+ {
+ error($strtoomanyattempts,
+ "view.php?id=$cm->id");
+ }
+ }
$var = 'some text without any
+ variables';
+ $var = "with special characters like a new line \n";
+ $var = 'a very, very long string with a '.$single.' variable in it';
+ $var = "some $text with $many variables $within it";
function forum_get_ratings_mean($postid,
+ $scale, $ratings=NULL)
+ {
+ /// Return the mean rating of a post given
+ to the current user by others.
+ /// Scale is an array of possible ratings in the scale
+ /// Ratings is an optional simple array of actual ratings (just integers)
+
+ if (!$ratings)
+ {
+ $ratings
+ = array(); //
+ Initialize the empty array
+ if ($rates
+ = get_records("forum_ratings",
+ "post", $postid))
+ {
+ //
+ Process each rating in turn
+ foreach
+ ($rates as $rate)
+ {
+ ... etc.
foreach ($objects
+ as $key =>
+ $thing) {
+ process($thing);
+
+ }
+
+ if ($x ==
+ $y)
+ {
+ $a
+ = $b;
+ } else if ($x ==
+ $z) {
+ $a
+ = $c;
+ } else {
+ $a
+ = $d;
+ }
+
Version: $Id$
+ +