Moodle帮助ć
楣: 程Źź
ąą则
Moodle程Źź
ąą则
何合ś"Ąą目都śŁŚ一ŁćżłŚł定ćżć棿ćŚ它"źŁć
ź
ąŁż些ą则"目"振为ććś"MoodleŁ ćŹ供一个努力"目ć ććś一些ćŻ"ŁŁ"已ŹŚś"Ł śćśę"ć
ąó尚ćśŁć źŚą它ŹćśąźŁóżćŁćććść
"Ł 都żĄ尽ŹŻŁś遵守Łż些ą则ć
一ŁŹŁż"定
ć朣 ć
ś"当ż" .php ś为ćąćć
ććśćĄćżć
ś"当ż" .html ś为ćąćć
ććść
朏ć
ś"当ż"UnixŁć ź"ć
ćśŹć źźŹ(ńć"ć
朏ź
Łę器都朣ż个选Ąą)ć
ććśphpć Ł都żĄćŚŻśŚć”ć ŁźŚŁŹŚ<?php ?> ... ŁŚć振Ś<? ?>"śź”ć Łć
ććś已ŹŚś"版ćŁćŚ"当Łóż留ćŚćśśćśżŁŚźŚćŹŻĄ ĄŁą"ć
每个ć
ś都"当Ś含config.phpć
ść
每个ć
ś都"当ćŁćźĄ"ć"ŁćŚŻŚćŁĄźŚŹŻĄż"函ćrequire_login()łŚisadmin()ćisteacher()ćiscreator()ć
Łisstudent()ć
ć朣żććć库"ććś都"当ż"lib/datalib.php中"函ć――Łżć ŹŻĄźąćń"ććć库ćśćĄ器ćććś"事ć都"当振ŹŻĄ"Łż些函ć楌ć"źŚŚćśś遇到żĄŁŚąSQLŁ "ćąźŚŁŻŁŹŁż些Ł "当振ŁąłŹ"źŚ"ŻąćŁ 中"ą定函ć(通常ś一个lib.phpć
ś中)ćśćźŚ"Ł 中"ćł释ŁżŁĄŚćŚĄŁŻćŚć
棌立łŚż"ć ąąŹŚŹ$CFGć$SESSIONć$THEMEłŚ$USERąń
"ąŹŚŹć
ć朏ŚŹ都"当Łó初żŚ
ć
ŁŁłęśż"ć"isset()ć
empty()等函棿ŁĄŚćŁćć
ć朏Ś串都"当ŹŻżŁŻę――ś"lang/en"目录中创ć
"ć
朏ć
śźŚŹŚ串"当ż"简ć"Łąć
ŹąćżźŚąś通Łż函ćget_string()ć
print_string()楏
ć
ććś帮助ć
ś"当ŹŻżŁŻę――ś"en/help"目录中创ć
朏ć
śąś"通Łżhelpbutton()函ć楣"它Źć
ŚćśśśŁŚ上ź 一个帮助ć
śź
Żą于Ź"żć"ąźŚćż"żŁŻęć
ść"śŹŻĄżż"ćśźŚŹŻĄ直楣żŁĄŚżć"ąźŚąć"当通źĄtranslation@moodle.org
Żą于ńż"żć"ąźŚ"当创ć
"ć
śźŚć
ć
ś"ć
ść振śźć
ść"ćś尾ć 一个柌ąśśĄ后逐ćóś (Śfilename2.html)źŚŁżć żŁŻę人ꌹŹŻĄć
ążśźĄ道ć
śćśą一个ć
"版朏ć很ćŚ"śźŚć
"Ł łŚ帮助óźć
ś都żĄżć"ąĄćŚęć
版朏"ć
ść
揣ż器ŹęćĄ"żĄćŻ(ĄGETć
POST󟏏ę送)都""ąmagic_quotes(ć ŁPHP"Ł置Ś何)źŚ ćń直楹它ŹćŹłĄ到ććć库中振安"ćććśś它"źżććć(楣ć
ść
ććć库")都żĄśćŹłĄććć库ćż"addslashes()ŁżŁĄŚó"ń"ąć
棌"źMoodle中ććś"ć
朏źŚą别振"ććŹ供"ć
朏źŚ都żĄż"format_text()函ć楣出ćŁżć ąŹŻĄĄżć
朏已ŹćŁĄśŁżćńć
ź
Łć ź
ć꟥道źŚŚćśść已Źą 毹一żćź
Łć źŁŚćęćŁćć"ąŹŚ它振ćś一ąŁŚ"źŚąćŻ"ŁŁŚŁźŚŁżćŻ"ćĄ后ććś人都śŁŚćśćć合Łć ź"MoodleŁ ŁŚĄ一些毹于人Źż""何ź
Łć ź都ćś很ńć"ŻćŚłŚŹćŻą"ć"ŹŁżźŚą现śćŁśż""Łć ź已ŹŚśąźŚ ćńŁŻ坚ćŚ下ć
źŁż"当振4个Łżś"空ć źćŻąćŁŚż"śŁĄŹŚć
ŹŚŹć"当振ąćŚąŁżŁććś含ą"ŹąŁąć
棯ććŚćśśĄśśŁŚń个ć
Ą上"棯柌ŁŻć它ŹŁżśś一ŁźŚąŁŚżćŚćż尽ŹŻŁźćŻą于ć"ŻąŁąĄźŚŁŻż"ńćććżć
Ą": $quiz
Ą": $errorstring
Ą": $assignments ("于ć")
Ą": $i ("于Źś循Ż)
Ź": $Quiz
Ź": $aReallyLongVariableNameWithoutAGoodReason
Ź": $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;
}
}
ŁŻŹĄżĄć振ż"ńżćŹŹ(泿振Źćś一ŁĄŚ)ćMoodleż"Ś下Łć ź:
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";
ś""ćł释"当尽ŹŻŁĄąźŚ"ĄŁżŁ释Ł ć程łŚ函ć与ŹŚŹ"źŁć
每个函泌ą都"ŁŻĄż"棥Ś"phpDocć źźŹź
ąźŚĄżŁ动"źćŁ ć
楣ć
ąŚćł释"ż" // Łć źźŚąś"ć齐布ąźŚżśŁŁśćĄŁ 中ąśłŚŁ Żą齐ć
/**
* The description should be first, with asterisks laid out exactly
* like this example. If you want to refer to a another function,
* do it like this: {@link clean_param()}. Then, add descriptions
* for each parameter as follows.
*
* @param int $postid The PHP type is followed by the variable name
* @param array $scale The PHP type is followed by the variable name
* @param array $ratings The PHP type is followed by the variable name
* @return mixed
*/
function forum_get_ratings_mean($postid,
$scale, $ratings=NULL)
{
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;
}
ććć库ćś"
每个ŁĄć ź都żĄćś一个Łóś"idć(INT10)ś为"ć
Ś含着ćĄ中ćććś例"ŁĄć źżĄłŚćĄŚć(ŁŹŚwidget)źŚąś"ŁłęŚ含Ś下ć:
id - Ś上一ćĄćŁż
course - 每个ś例ćąś"ŁŻ程id
name - 每个ś例"Śććż
与ćĄ相ł"ś它ŁĄć ź"ę棿"则振źŚćśś它Ś含"żĄćŻćŚŻł于śthings”"źŚ则它"ć"当振widget_things(ćłć"Ź采"ńććóźŹ)ć
ććż"当简źźŚ与ŹŚŹć"Łż"则相Ść
śŹŻŁ"ćą下źŚŚ含着Żąś它ŁĄć ź(Świdget)ź""ć"当ęć为widgetidć(ćłć"ŹŁżćŚŻ个ć
Ś定źŚćś一些Ł"ŁĄć źąśćś遵守)
布"ć"当ż"Źććąś(ŚINT4)ąśŚ储为0ć
1źŚŁżć ąŹŻĄśśŁŚćśćą它ć
ńć"ŁĄć ź"当ćś一个timemodifiedć(INT10)źŚąś"PHP"time()函ćŹ
"当ććśćłćĄćć
它ć
安óŚźń"ąŁĄćłŚURLćććź
棌依 śregister_globals”ć每个ŹŚŹżĄśćŻŹ个ćć
śŚćŁĄ初żŚ
揌Ź"ćĄćżĄćŚŁŚćŚŁż
初żŚ
ććś"ć"łŚŻąŁąĄźŚćłż它振空"ć$a = array()ć
$obj = new stdClass();ć
棌ż"optional_variable()函ććż"optional_param()函ććĄćżŁćć ąćććććąś选ć棥"PARAM_XXXXźćż"set_default()函ććŁćźĄłŚŁ置ŹŚŹ"ŹŻ选źć
棌ż"require_variable()函ććż"required_param()ćĄćżŁćć ąćććććąś选ć棥"PARAM_XXXXźć
棌ż"$_GETć$_POSTć
$_REQUESTćć ąććć"śŁŚż"ć合适"required_param()ć
optional_param()
ćŁćźĄ一个动śćśźŚćŁŚż"Źif (isset($_GET['something']))Łżć "Ł 揯Ąż"ŁŻŚź$something = optional_param( 'something','',PARAM_ALPHA )źŚąś""empty()函ćć
źŚćśś'empty'ąźćŚŻ一个合ćłźźisset_param()函ć棯
ś何ŹŻŁ"ćą下źŚććććś"required_param()ćoptional_param()łŚś它"ŹŚŹ初żŚ
一Łć"śćŻŹ个ć
ś"źńźŚŁżć 它ŹźćąćŚŁóć到ć
ż"śsesskey”ćśśżćńŁĄćń"ą函ććŁóć"ć简ćń例ź当"źćŁĄć"ćś候źŚŁŚŚ含<input type="hidden" name="sesskey" value="<?php echo sesskey(); ?>" />ćż"ŁĄććś"if (!confirm_sesskey()) {error('Bad Session Key');}ćŁćźĄć
ććść
śćżĄ"clean_filename()函朣żćń”źŚąŚćśś已Ź适当śż"required_param()ć
optional_param()做ąćńĄąĄśźŚ则濌ćń
ąćć何ććć库ŁŻ出"ćććąśąćźŚżĄ"addslashes()ń"ąć一个Śććć毹ŁąĄŹŻĄ"addslashes_object()一揥濌ń"ąŚćŻć
ś何ŹŻŁ"ćą下źŚŚĄććć库"ćć濥楣POSTćććźąźąćŚŻćĄŁŁĄć"ćććźźŚŁŚćŁćĄŁGETćććźąźąćŚŻćĄŁURL"ćććźć
ŚćśśŁżć"ŁŻźŚćŁŚż"楣$_SERVER"ćććć它źżćńć濌ćĄóŚ
śś它ść
ąćĄćś做"ćą下źŚĄżććśąĄććć库"ććć已ŹŁóclean_param 函ćń"ąźŚąś"łŻąćććąśźŚż"ąć当"PARAM_XXXXć
Śćśśćź
ąąŁ定ą"SQLŁ źŚŁŻĄż它振棥"ćńśŹżśćźę围棌óńąźŹźŚŁżŹŻŁźŚćĄSQLśćłĄ”柏ćść
每个ć
śą都ŁŚćŁćźĄ它ż""ććśćććźńśćŚŻą到ććć库"ćććź"合ćłćżć棌期źć
依Ł
ś它ść
ą已ŹćŁćźĄąć
Łóś它ć
śŚ含"Ł "当朥切定ą"PHPćś"ź例Śą"ŁćŚć函ć定ą等ź""直ćĄćżŁĄŚ"Ł Łż"ŹŚŹćśćŁŚ初żŚ
ć
Moodleć
楣
Version: $Id$
Wyszukiwarka
Podobne podstrony:
C Coding Techniques for Intel Architecture ProcessorscodingstandardsTworzenie Coding profil NCSEXPERTCodingStyle (3)CodingErrorActioncodingBash Style Guide an Coding Standard [EN]codingcodingcodingcoding guidelinescoding03 Coding Plug05d Coding and Programmingcodingcoding coding programmingcoding guidelinescodingwięcej podobnych podstron