⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 editpage.php

📁 很棒的在线教学系统
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?php // $Id: editpage.php,v 1.24 2007/04/08 21:02:17 mark-nielsen Exp $/** *  Action for editing a page.  Prints an HTML form. * * @version $Id: editpage.php,v 1.24 2007/04/08 21:02:17 mark-nielsen Exp $ * @license http://www.gnu.org/copyleft/gpl.html GNU Public License * @package lesson **/     // get the page    $pageid = required_param('pageid', PARAM_INT);    $redirect = optional_param('redirect', '', PARAM_ALPHA);        if (!$page = get_record("lesson_pages", "id", $pageid)) {        error("Edit page: page record not found");    }    $page->qtype = optional_param('qtype', $page->qtype, PARAM_INT);    // set of jump array    $jump = array();    $jump[0] = get_string("thispage", "lesson");    $jump[LESSON_NEXTPAGE] = get_string("nextpage", "lesson");    $jump[LESSON_PREVIOUSPAGE] = get_string("previouspage", "lesson");    if(lesson_display_branch_jumps($lesson->id, $page->id)) {        $jump[LESSON_UNSEENBRANCHPAGE] = get_string("unseenpageinbranch", "lesson");        $jump[LESSON_RANDOMPAGE] = get_string("randompageinbranch", "lesson");    }    if ($page->qtype == LESSON_ENDOFBRANCH || $page->qtype == LESSON_BRANCHTABLE) {        $jump[LESSON_RANDOMBRANCH] = get_string("randombranch", "lesson");    }    if(lesson_display_cluster_jump($lesson->id, $page->id) && $page->qtype != LESSON_BRANCHTABLE && $page->qtype != LESSON_ENDOFCLUSTER) {        $jump[LESSON_CLUSTERJUMP] = get_string("clusterjump", "lesson");    }    $jump[LESSON_EOL] = get_string("endoflesson", "lesson");    if (!$apageid = get_field("lesson_pages", "id", "lessonid", $lesson->id, "prevpageid", 0)) {        error("Edit page: first page not found");    }    while (true) {        if ($apageid) {            if (!$apage = get_record("lesson_pages", "id", $apageid)) {                error("Edit page: apage record not found");            }            // removed != LESSON_ENDOFBRANCH...            if (trim($page->title)) { // ...nor nuffin pages                $jump[$apageid] = strip_tags(format_string($apage->title,true));            }            $apageid = $apage->nextpageid;        } else {            // last page reached            break;        }    }    // give teacher a proforma    ?>    <form id="editpage" method="post" action="lesson.php">    <fieldset class="invisiblefieldset fieldsetfix">    <input type="hidden" name="id" value="<?php echo $cm->id ?>" />    <input type="hidden" name="action" value="updatepage" />    <input type="hidden" name="pageid" value="<?php echo $pageid ?>" />    <input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />            <input type="hidden" name="redirect" value="<?php echo $redirect ?>" />            <input type="hidden" name="redisplay" value="0" />    <center>       <?php        switch ($page->qtype) {            case LESSON_MULTICHOICE :                echo '<b>'.get_string("questiontype", "lesson").":</b> \n";                echo helpbutton("questiontypes", get_string("questiontype", "lesson"), "lesson")."<br />";                lesson_qtype_menu($LESSON_QUESTION_TYPE, $page->qtype,                                   "lesson.php?id=$cm->id&amp;action=editpage&amp;pageid=$page->id",                                  "getElementById('editpage').redisplay.value=1;getElementById('editpage').submit();");                echo "<p><b><label for=\"qoption\">".get_string('multianswer', 'lesson').":</label></b> \n";                if ($page->qoption) {                    echo "<input type=\"checkbox\" id=\"qoption\" name=\"qoption\" value=\"1\" checked=\"checked\" />";                } else {                    echo "<input type=\"checkbox\" id=\"qoption\" name=\"qoption\" value=\"1\" />";                }                helpbutton("questionoption", get_string("questionoption", "lesson"), "lesson");                echo "</p>\n";                break;            case LESSON_SHORTANSWER :                echo '<b>'.get_string("questiontype", "lesson").":</b> \n";                echo helpbutton("questiontypes", get_string("questiontype", "lesson"), "lesson")."<br />";                lesson_qtype_menu($LESSON_QUESTION_TYPE, $page->qtype,                                   "lesson.php?id=$cm->id&amp;action=editpage&amp;pageid=$page->id",                                  "getElementById('editpage').redisplay.value=1;getElementById('editpage').submit();");                echo "<p><b><label for=\"qoption\">".get_string('casesensitive', 'lesson').":</label></b> \n";                if ($page->qoption) {                    echo "<input type=\"checkbox\" id=\"qoption\" name=\"qoption\" value=\"1\" checked=\"checked\" />";                } else {                    echo "<input type=\"checkbox\" id=\"qoption\" name=\"qoption\" value=\"1\" />";                }                helpbutton("questionoption", get_string("questionoption", "lesson"), "lesson");                echo "</p>\n";                break;            case LESSON_TRUEFALSE :            case LESSON_ESSAY :            case LESSON_MATCHING :            case LESSON_NUMERICAL :                echo '<b>'.get_string("questiontype", "lesson").":</b> \n";                echo helpbutton("questiontypes", get_string("questiontype", "lesson"), "lesson")."<br />";                lesson_qtype_menu($LESSON_QUESTION_TYPE, $page->qtype,                                   "lesson.php?id=$cm->id&amp;action=editpage&amp;pageid=$page->id",                                  "getElementById('editpage').redisplay.value=1;getElementById('editpage').submit();");                break;        }    ?>    <table cellpadding="5" class="generalbox" border="1">    <tr valign="top">    <td><b><label for="title"><?php print_string('pagetitle', 'lesson'); ?>:</label></b><br />    <input type="text" id="title" name="title" size="80" maxsize="255" value="<?php p($page->title) ?>" /></td>    </tr>    <?PHP    echo "<tr><td><b>";    echo get_string("pagecontents", "lesson").":</b><br />\n";    print_textarea($usehtmleditor, 25, 70, 630, 400, "contents", $page->contents);    if ($usehtmleditor) {        use_html_editor("contents");    }    echo "</td></tr>\n";    $n = 0;    switch ($page->qtype) {        case LESSON_BRANCHTABLE :            echo "<input type=\"hidden\" name=\"qtype\" value=\"$page->qtype\" />\n";            echo "<tr><td>\n";            echo "<center>";            if ($page->layout) {                echo "<input checked=\"checked\" name=\"layout\" type=\"checkbox\" value=\"1\" />";            } else {                echo "<input name=\"layout\" type=\"checkbox\" value=\"1\" />";            }            echo get_string("arrangebuttonshorizontally", "lesson")."\n";            echo "<br />";            if ($page->display) {                echo "<input name=\"display\" type=\"checkbox\" value=\"1\" checked=\"checked\" />";            } else {                echo "<input name=\"display\" type=\"checkbox\" value=\"1\" />";            }                            echo get_string("displayinleftmenu", "lesson")."\n";            echo "</center></td></tr>\n";            echo "<tr><td><b>".get_string("branchtable", "lesson")."</b> \n";            break;        case LESSON_CLUSTER :            echo "<input type=\"hidden\" name=\"qtype\" value=\"$page->qtype\" />\n";            echo "<tr><td><b>".get_string("clustertitle", "lesson")."</b> \n";            break;                        case LESSON_ENDOFCLUSTER :            echo "<input type=\"hidden\" name=\"qtype\" value=\"$page->qtype\" />\n";            echo "<tr><td><b>".get_string("endofclustertitle", "lesson")."</b> \n";            break;                                    case LESSON_ENDOFBRANCH :            echo "<input type=\"hidden\" name=\"qtype\" value=\"$page->qtype\" />\n";            echo "<tr><td><b>".get_string("endofbranch", "lesson")."</b> \n";            break;        default :            echo "<tr><td>";        break;                 }    echo "</td></tr>\n";    // get the answers in a set order, the id order    if ($answers = get_records("lesson_answers", "pageid", $page->id, "id")) {        foreach ($answers as $answer) {            $flags = intval($answer->flags); // force into an integer            $nplus1 = $n + 1;            echo "<input type=\"hidden\" name=\"answerid[$n]\" value=\"$answer->id\" />\n";            switch ($page->qtype) {                case LESSON_MATCHING:                    if ($n == 0) {                        echo "<tr><td><b><label for=\"edit-answer[$n]\">".get_string('correctresponse', 'lesson').":</label></b>\n";                        if ($flags & LESSON_ANSWER_EDITOR) {                            echo " [<label for=\"answereditor[$n]\">".get_string("useeditor", "lesson")."</label>: ".                                "<input type=\"checkbox\" id=\"answereditor[$n]\" name=\"answereditor[$n]\" value=\"1\" checked=\"checked\" />";                            helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");                            echo "]<br />\n";                            print_textarea($usehtmleditor, 20, 70, 630, 300, "answer[$n]", $answer->answer);                            use_html_editor("answer[$n]"); // switch on the editor                        } else {                            echo " [<label for=\"answereditor[$n]\">".get_string("useeditor", "lesson")."</label>: ".                                "<input type=\"checkbox\" id=\"answereditor[$n]\" name=\"answereditor[$n]\" value=\"1\" />";                            helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");                            echo "]<br />\n";                            print_textarea(false, 6, 70, 630, 300, "answer[$n]", $answer->answer);                        }                    } elseif ($n == 1) {                        echo "<tr><td><b><label for=\"edit-answer[$n]\">".get_string('wrongresponse', 'lesson').":</label></b>\n";                        if ($flags & LESSON_ANSWER_EDITOR) {                            echo " [<label for=\"answereditor[$n]\">".get_string("useeditor", "lesson")."</label>: ".                                "<input type=\"checkbox\" id=\"answereditor[$n]\" name=\"answereditor[$n]\" value=\"1\" checked=\"checked\" />";                            helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");                            echo "]<br />\n";                            print_textarea($usehtmleditor, 20, 70, 630, 300, "answer[$n]", $answer->answer);                            use_html_editor("answer[$n]"); // switch on the editor                        } else {                            echo " [<label for=\"answereditor[$n]\">".get_string("useeditor", "lesson")."</label>: ".                                "<input type=\"checkbox\" id=\"answereditor[$n]\" name=\"answereditor[$n]\" value=\"1\" />";                            helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");                            echo "]<br />\n";                            print_textarea(false, 6, 70, 630, 300, "answer[$n]", $answer->answer);                        }                    } else {                        $ncorrected = $n - 1;                        echo "<tr><td><b><label for=\"edit-answer[$n]\">".get_string('answer', 'lesson')." $ncorrected:</label></b>\n";                        if ($flags & LESSON_ANSWER_EDITOR) {                            echo " [<label for=\"answereditor[$n]\">".get_string("useeditor", "lesson")."</label>: ".                                "<input type=\"checkbox\" id=\"answereditor[$n]\" name=\"answereditor[$n]\" value=\"1\" checked=\"checked\" />";                             helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");                            echo "]<br />\n";                            print_textarea($usehtmleditor, 20, 70, 630, 300, "answer[$n]", $answer->answer);                            use_html_editor("answer[$n]"); // switch on the editor                        } else {                            echo " [<label for=\"answereditor[$n]\">".get_string("useeditor", "lesson")."</label>: ".                                "<input type=\"checkbox\" id=\"answereditor[$n]\" name=\"answereditor[$n]\" value=\"1\" />";                            helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");                            echo "]<br />\n";                            print_textarea(false, 6, 70, 630, 300, "answer[$n]", $answer->answer);                        }                        echo "</td></tr>\n";                        echo "<tr><td><b><label for=\"edit-response[$n]\">".get_string('matchesanswer', 'lesson')." $ncorrected:</label></b>\n";                        if ($flags & LESSON_RESPONSE_EDITOR) {                            echo " [<label for=\"responseeditor[$n]\">".get_string("useeditor", "lesson")."</label>: ".                                "<input type=\"checkbox\" id=\"responseeditor[$n]\" name=\"responseeditor[$n]\" value=\"1\" checked=\"checked\" />";                            helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");                            echo "]<br />\n";                            print_textarea($usehtmleditor, 20, 70, 630, 300, "response[$n]", $answer->response);                            use_html_editor("response[$n]"); // switch on the editor                        } else {                            echo " [<label for=\"responseeditor[$n]\">".get_string("useeditor", "lesson")."</label>: ".                                "<input type=\"checkbox\" id=\"responseeditor[$n]\" name=\"responseeditor[$n]\" value=\"1\" />";                            helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");                            echo "]<br />\n";                            print_textarea(false, 6, 70, 630, 300, "response[$n]", $answer->response);                        }                    }                    echo "</td></tr>\n";                    break;                case LESSON_TRUEFALSE:                case LESSON_MULTICHOICE:                case LESSON_SHORTANSWER:                case LESSON_NUMERICAL:                                        echo "<tr><td><b><label for=\"edit-answer[$n]\">".get_string('answer', 'lesson')." $nplus1:</label></b>\n";

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -