Valery Fremaux
Kiriman dibuat oleh Valery Fremaux
Hi,
I'm seeking the answer to both questions :
1. What was the original reason to have an evaluated expression as return of get_string_from_file(), and the call to sprintf() ?
2. I'm trying to have a language pack that could switch easily some keywords all through, allowing administrator to switch the semantics of some key concepts at configuration time. The reason is that some Moodle customisaton may introduce some new situations that would need such shifting.
Key words such as "course", "category", "theme", "section", "sudent", "teacher", etc. are defining a small set (about 40 to 50 keywords) that drives the entire application of the platform. Those keywords appear in quite every lang files, and are pretty frequent, so any change for adapting the platform to a contextual situation will require hours in langpack reworking.
There is absolutely no way to inject some recursive call to get_string in lang files, as this introduces a mad loop in the language implementation.
If someone knows whatever genious trick to inject some globals or parametrization in lang strings expressions .... (avoiding using get_string() parm injection that would change all calls to get_string() and all string related functions !!)
Thanks guys.... !!
problème sur l'utilisation de insert_record :
void insert_record (string $table, object $dataobject, [bool $returnid = true], [string $primarykey = 'id'])
il faut l'écrire uniquement avec les deux premiers paramètres, ça suffit, et ne pas fixer de valeur d'id. Placer l'id de la table en autoincrement et laisser la séquence jouer.
le troisième paramètre est intéressant si on veut récupérer l'id inséré pour en faire une clef étrangère ailleurs.
Si tu testes successivement ta page test puis ta fonction, la première enregistre le record en forçant l'id, la deuxième essaie de forcer l'id et n'y arrive pas.... (si j'ai bien compris)
un excellent (normal nous le publions... ) site de doc sur l'API : http://phpdocs.moodle.org
Quentin ,
je crois que le point d'entrée que tu cherches est la ligne §98 :
$enrol->check_entry($form, $course); // Should terminate/redirect in here if it's all OK
dans course/enrol.php
Cette ligne appelle le callback de réalisation de l'enrollement selon le plugin choisi par le cours.
L'objet $enrol a été produit précisément par la fabrique que tu cites.
Pour plus d'infos sur le Design Pattern Fabrique