当前位置: 首页>>代码示例>>PHP>>正文


PHP print_box_end函数代码示例

本文整理汇总了PHP中print_box_end函数的典型用法代码示例。如果您正苦于以下问题:PHP print_box_end函数的具体用法?PHP print_box_end怎么用?PHP print_box_end使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了print_box_end函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sloodle_display_config_form

function sloodle_display_config_form($sloodleauthid, $auth_obj)
{
    //--------------------------------------------------------
    // SETUP
    // Determine which course is being accessed
    $courseid = $auth_obj->course->get_course_id();
    // We need to fetch a list of visible choices on the course
    // Get the ID of the choice type
    $rec = get_record('modules', 'name', 'choice');
    if (!$rec) {
        sloodle_debug("Failed to get choice module type.");
        exit;
    }
    $choicemoduleid = $rec->id;
    // Get all visible choices in the current course
    $recs = get_records_select('course_modules', "course = {$courseid} AND module = {$choicemoduleid} AND visible = 1");
    if (!$recs) {
        error(get_string('nochoices', 'sloodle'));
        exit;
    }
    $choices = array();
    foreach ($recs as $cm) {
        // Fetch the choice instance
        $inst = get_record('choice', 'id', $cm->instance);
        if (!$inst) {
            continue;
        }
        // Store the choice details
        $choices[$cm->id] = $inst->name;
    }
    // Sort the list by name
    natcasesort($choices);
    //--------------------------------------------------------
    // FORM
    // Get the current object configuration
    $settings = SloodleController::get_object_configuration($sloodleauthid);
    // Setup our default values
    $sloodlemoduleid = (int) sloodle_get_value($settings, 'sloodlemoduleid', 0);
    $sloodlerefreshtime = (int) sloodle_get_value($settings, 'sloodlerefreshtime', 600);
    $sloodlerelative = (int) sloodle_get_value($settings, 'sloodlerelative', 0);
    ///// GENERAL CONFIGURATION /////
    print_box_start('generalbox boxaligncenter');
    echo '<h3>' . get_string('generalconfiguration', 'sloodle') . '</h3>';
    // Ask the user to select a choice
    echo get_string('selectchoice', 'sloodle') . ': ';
    choose_from_menu($choices, 'sloodlemoduleid', $sloodlemoduleid, '');
    echo "<br><br>\n";
    // Ask the user for a refresh period (# seconds between automatic updates)
    echo get_string('refreshtimeseconds', 'sloodle') . ': ';
    echo '<input type="text" name="sloodlerefreshtime" value="' . $sloodlerefreshtime . '" size="8" maxlength="8" />';
    echo "<br><br>\n";
    // Show relative results
    echo get_string('relativeresults', 'sloodle') . ': ';
    choose_from_menu_yesno('sloodlerelative', $sloodlerelative);
    echo "<br>\n";
    print_box_end();
    ///// ACCESS LEVELS /////
    sloodle_print_access_level_options($settings, true, false, true);
}
开发者ID:nagyistoce,项目名称:moodle-Teach-Pilot,代码行数:59,代码来源:object_config.php

示例2: memorization_print_new_verse_box

function memorization_print_new_verse_box()
{
    global $CFG, $USER;
    print_box_start('add-verse-box generalbox box');
    print_heading(get_string('newverse', 'memorization'));
    $biblebooks = biblebooks_array();
    // create the book selector
    $biblebookoptions = '';
    foreach ($biblebooks as $booknumber => $bookofbible) {
        if ($booknumber == 0) {
            continue;
        }
        $biblebookoptions .= '<option value="' . $booknumber . '">' . $bookofbible . '</option>';
    }
    $startbookid = '<select name="startbookid">' . $biblebookoptions . '</select>';
    $endbookid = '<select name="endbookid">' . $biblebookoptions . '</select>';
    // create the chapter inputs
    $startchapter = '<input type="text" name="startchapter" size="5" />';
    $endchapter = '<input type="text" name="endchapter" size="5"/>';
    // create the verse inputs
    $startverse = '<input type="text" name="startverse" size="5"/>';
    $endverse = '<input type="text" name="endverse" size="5"/>';
    // create the version chooser
    $versions = get_records('memorization_version');
    if (!empty($versions)) {
        $versionselect = '<select name="versionid">';
        $lastversionid = get_field_sql("SELECT versionid FROM {$CFG->prefix}memorization_verse WHERE userid={$USER->id} ORDER BY id DESC");
        foreach ($versions as $versionid => $version) {
            $selected = $versionid == $lastversionid ? ' SELECTED="selected" ' : '';
            $versionselect .= '<option ' . $selected . ' value="' . $versionid . '">' . $version->value . '</option>';
        }
        $versionselect .= '</select>';
    }
    $currenturl = new moodle_url(qualified_me());
    echo '<form method="POST" action="addverse.php?' . $currenturl->get_query_string() . '">
          <input type="hidden" name="sesskey" value="' . sesskey() . '">
          <table>
            <tr>
              <td>' . get_string('fromverse', 'memorization') . '</td>
              <td>' . $startbookid . ' ' . $startchapter . ':' . $startverse . '</td>
            </tr>

            <tr>
              <td>' . get_string('toverse', 'memorization') . '</td>
              <td>' . $endbookid . ' ' . $endchapter . ':' . $endverse . '</td>
            </tr>

            <tr>
              <td>' . get_string('version', 'memorization') . '</td>
              <td>' . $versionselect . '</td>
            </tr>
          </table>
          <input type="submit">
          </form>';
    print_box_end();
}
开发者ID:NextEinstein,项目名称:riverhills,代码行数:56,代码来源:locallib.php

示例3: notice_okcancel

/**
 * Print a message along with "Ok" link for the user to continue and "Cancel" link to close window.
 *
 * @param string $message The text to display
 * @param string $linkok The link to take the user to if they choose "Ok"
 * TODO Document remaining arguments
 */
function notice_okcancel($message, $linkok, $optionsok = NULL, $methodok = 'post')
{
    global $CFG;
    $message = clean_text($message);
    $linkok = clean_text($linkok);
    print_box_start('generalbox', 'notice');
    echo '<p>' . $message . '</p>';
    echo '<div class="buttons">';
    print_single_button($linkok, $optionsok, get_string('ok'), $methodok, $CFG->framename);
    close_window_button('cancel');
    echo '</div>';
    print_box_end();
}
开发者ID:hit-moodle,项目名称:onlinejudge,代码行数:20,代码来源:rejudge.php

示例4: print_form

 function print_form()
 {
     if ($this->path == 'all') {
         $sports = $this->sql_sports;
     } else {
         $sports = array($this->sql_sports[$this->path]);
     }
     print_box_start();
     echo '<form method="POST">
             ' . array_reduce($sports, array($this, 'reduce_sport'), '') . '
             <input type="hidden" name="type" value="' . $this->type . '">
             <input type="hidden" name="path" value="' . $this->path . '">
             <input type="hidden" name="userid" value="' . $this->userid . '">
             <input type="submit" value="' . get_string('submit') . '">
           </form>';
     print_box_end();
 }
开发者ID:rrusso,项目名称:EARS,代码行数:17,代码来源:admin_name.php

示例5: sloodle_print_access_level_options

/**
 * Outputs the standard form elements for access levels in object configuration.
 * Each part can be optionally hidden, and default values can be provided.
 * (Note: the server access level must be communicated from the object back to Moodle... rubbish implementation, but it works!)
 * @param array $current_config An associative array of setting names to values, containing defaults. (Ignored if null).
 * @param bool $show_use_object Determines whether or not the "Use Object" setting is shown
 * @param bool $show_control_object Determines whether or not the "Control Object" setting is shown
 * @param bool $show_server Determines whether or not the server access setting is shown
 * @return void
 */
function sloodle_print_access_level_options($current_config, $show_use_object = true, $show_control_object = true, $show_server = true)
{
    // Quick-escape: if everything is being suppressed, then do nothing
    if (!($show_use_object || $show_control_object || $show_server)) {
        return;
    }
    // Fetch default values from the configuration, if possible
    $sloodleobjectaccessleveluse = sloodle_get_value($current_config, 'sloodleobjectaccessleveluse', SLOODLE_OBJECT_ACCESS_LEVEL_PUBLIC);
    $sloodleobjectaccesslevelctrl = sloodle_get_value($current_config, 'sloodleobjectaccesslevelctrl', SLOODLE_OBJECT_ACCESS_LEVEL_OWNER);
    $sloodleserveraccesslevel = sloodle_get_value($current_config, 'sloodleserveraccesslevel', SLOODLE_SERVER_ACCESS_LEVEL_PUBLIC);
    // Define our object access level array
    $object_access_levels = array(SLOODLE_OBJECT_ACCESS_LEVEL_PUBLIC => get_string('accesslevel:public', 'sloodle'), SLOODLE_OBJECT_ACCESS_LEVEL_GROUP => get_string('accesslevel:group', 'sloodle'), SLOODLE_OBJECT_ACCESS_LEVEL_OWNER => get_string('accesslevel:owner', 'sloodle'));
    // Define our server access level array
    $server_access_levels = array(SLOODLE_SERVER_ACCESS_LEVEL_PUBLIC => get_string('accesslevel:public', 'sloodle'), SLOODLE_SERVER_ACCESS_LEVEL_COURSE => get_string('accesslevel:course', 'sloodle'), SLOODLE_SERVER_ACCESS_LEVEL_SITE => get_string('accesslevel:site', 'sloodle'), SLOODLE_SERVER_ACCESS_LEVEL_STAFF => get_string('accesslevel:staff', 'sloodle'));
    // Display box and a heading
    print_box_start('generalbox boxaligncenter');
    echo '<h3>' . get_string('accesslevel', 'sloodle') . '</h3>';
    // Print the object settings
    if ($show_use_object || $show_control_object) {
        // Object access
        echo '<b>' . get_string('accesslevelobject', 'sloodle') . '</b><br><i>' . get_string('accesslevelobject:desc', 'sloodle') . '</i><br><br>';
        // Use object
        if ($show_use_object) {
            echo get_string('accesslevelobject:use', 'sloodle') . ': ';
            choose_from_menu($object_access_levels, 'sloodleobjectaccessleveluse', $sloodleobjectaccessleveluse, '');
            echo '<br><br>';
        }
        // Control object
        if ($show_control_object) {
            echo get_string('accesslevelobject:control', 'sloodle') . ': ';
            choose_from_menu($object_access_levels, 'sloodleobjectaccesslevelctrl', $sloodleobjectaccesslevelctrl, '');
            echo '<br><br>';
        }
    }
    // Print the server settings
    if ($show_server) {
        // Server access
        echo '<b>' . get_string('accesslevelserver', 'sloodle') . '</b><br><i>' . get_string('accesslevelserver:desc', 'sloodle') . '</i><br><br>';
        echo get_string('accesslevel', 'sloodle') . ': ';
        choose_from_menu($server_access_levels, 'sloodleserveraccesslevel', $sloodleserveraccesslevel, '');
        echo '<br>';
    }
    print_box_end();
}
开发者ID:nagyistoce,项目名称:moodle-Teach-Pilot,代码行数:54,代码来源:general.php

示例6: question_showbank

/**
 * Shows the question bank editing interface.
 *
 * The function also processes a number of actions:
 *
 * Actions affecting the question pool:
 * move           Moves a question to a different category
 * deleteselected Deletes the selected questions from the category
 * Other actions:
 * category      Chooses the category
 * displayoptions Sets display options
 *
 * @author Martin Dougiamas and many others. This has recently been extensively
 *         rewritten by Gustav Delius and other members of the Serving Mathematics project
 *         {@link http://maths.york.ac.uk/serving_maths}
 * @param moodle_url $pageurl object representing this pages url.
 */
function question_showbank($tabname, $contexts, $pageurl, $cm, $page, $perpage, $sortorder, $sortorderdecoded, $cat, $recurse, $showhidden, $showquestiontext)
{
    global $COURSE;
    if (optional_param('deleteselected', false, PARAM_BOOL)) {
        // teacher still has to confirm
        // make a list of all the questions that are selected
        $rawquestions = $_REQUEST;
        // This code is called by both POST forms and GET links, so cannot use data_submitted.
        $questionlist = '';
        // comma separated list of ids of questions to be deleted
        $questionnames = '';
        // string with names of questions separated by <br /> with
        // an asterix in front of those that are in use
        $inuse = false;
        // set to true if at least one of the questions is in use
        foreach ($rawquestions as $key => $value) {
            // Parse input for question ids
            if (preg_match('!^q([0-9]+)$!', $key, $matches)) {
                $key = $matches[1];
                $questionlist .= $key . ',';
                question_require_capability_on($key, 'edit');
                if (record_exists('quiz_question_instances', 'question', $key)) {
                    $questionnames .= '* ';
                    $inuse = true;
                }
                $questionnames .= get_field('question', 'name', 'id', $key) . '<br />';
            }
        }
        if (!$questionlist) {
            // no questions were selected
            redirect($pageurl->out());
        }
        $questionlist = rtrim($questionlist, ',');
        // Add an explanation about questions in use
        if ($inuse) {
            $questionnames .= '<br />' . get_string('questionsinuse', 'quiz');
        }
        notice_yesno(get_string("deletequestionscheck", "quiz", $questionnames), $pageurl->out_action(), $pageurl->out(true), array('deleteselected' => $questionlist, 'confirm' => md5($questionlist)), $pageurl->params(), 'post', 'get');
        echo '</td></tr>';
        echo '</table>';
        print_footer($COURSE);
        exit;
    }
    // starts with category selection form
    print_box_start('generalbox questionbank');
    print_heading(get_string('questionbank', 'question'), '', 2);
    question_category_form($contexts->having_one_edit_tab_cap($tabname), $pageurl, $cat, $recurse, $showhidden, $showquestiontext);
    // continues with list of questions
    question_list($contexts->having_one_edit_tab_cap($tabname), $pageurl, $cat, isset($cm) ? $cm : null, $recurse, $page, $perpage, $showhidden, $sortorder, $sortorderdecoded, $showquestiontext, $contexts->having_cap('moodle/question:add'));
    print_box_end();
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:68,代码来源:editlib.php

示例7: print_item

    function print_item($item, $value = false, $readonly = false, $edit = false, $highlightrequire = false)
    {
        $align = get_string('thisdirection') == 'ltr' ? 'left' : 'right';
        //get the range
        $range_from_to = explode('|', $item->presentation);
        //get the min-value
        $range_from = isset($range_from_to[0]) ? intval($range_from_to[0]) : 0;
        //get the max-value
        $range_to = isset($range_from_to[1]) ? intval($range_from_to[1]) : 0;
        if ($highlightrequire and !$this->check_value($value, $item)) {
            $highlight = 'bgcolor="#FFAAAA" class="missingrequire"';
        } else {
            $highlight = '';
        }
        $requiredmark = $item->required == 1 ? '<span class="feedback_required_mark">*</span>' : '';
        ?>
        <td <?php 
        echo $highlight;
        ?>
 valign="top" align="<?php 
        echo $align;
        ?>
">
            <?php 
        echo format_text(stripslashes_safe($item->name) . $requiredmark, true, false, false);
        switch (true) {
            case $range_from === 0 and $range_to > 0:
                echo ' (' . get_string('maximal', 'feedback') . ': ' . $range_to . ')';
                break;
            case $range_from > 0 and $range_to === 0:
                echo ' (' . get_string('minimal', 'feedback') . ': ' . $range_from . ')';
                break;
            case $range_from === 0 and $range_to === 0:
                break;
            default:
                echo ' (' . $range_from . '-' . $range_to . ')';
                break;
        }
        ?>
        </td>
        <td valign="top" align="<?php 
        echo $align;
        ?>
">
    <?php 
        if ($readonly) {
            // print_simple_box_start($align);
            print_box_start('generalbox boxalign' . $align);
            echo $value ? $value : '&nbsp;';
            // print_simple_box_end();
            print_box_end();
        } else {
            ?>
            <input type="text" name="<?php 
            echo $item->typ . '_' . $item->id;
            ?>
"
                                    size="10"
                                    maxlength="10"
                                    value="<?php 
            echo $value ? $value : '';
            ?>
" />
    <?php 
        }
        ?>
        </td>
    <?php 
    }
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:69,代码来源:lib.php

示例8: feedback_print_errors

/** 
 *  print some errors to inform users about this.
 *  @return void
 */
function feedback_print_errors()
{
    global $SESSION;
    if (empty($SESSION->feedback->errors)) {
        return;
    }
    // print_simple_box_start("center", "60%", "#FFAAAA", 20, "noticebox");
    print_box_start('generalbox errorboxcontent boxaligncenter boxwidthnormal');
    print_heading(get_string('handling_error', 'feedback'));
    echo '<p align="center"><b><font color="black"><pre>';
    print_r($SESSION->feedback->errors) . "\n";
    echo '</pre></font></b></p>';
    // print_simple_box_end();
    print_box_end();
    echo '<br /><br />';
    $SESSION->feedback->errors = array();
    //remove errors
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:22,代码来源:lib.php

示例9: view


//.........这里部分代码省略.........
	val=sender.options[sender.selectedIndex].value;
	lang="";

	if (val=="1") lang="pas"; else
	if (val=="0") lang="cpp"; else
	if (val=="2") lang="java"; else
	if (val=="3") lang="python"; else
	if (val=="4") lang="cpp"
	editAreaLoader.execCommand(\'id_programtext\',"change_syntax",lang);
	return lang;
};
function add_onchange()
{
	sel=document.getElementById(\'id_langid\')
	sel.onchange=function(){change_style(this)};
	lang=change_style(sel)
editAreaLoader.init({
        id : "id_programtext"        // textarea id
        ,syntax: lang          // syntax to be uses for highlight mode on start-up
        ,start_highlight: true  // to display with highlight mode on start-up
});
	if (_onload!=null) _onload();
};
_onload=window.onload;
window.onload=add_onchange;
</script>
';
        }
        $this->view_intro();
        $this->view_dates();
        if ($saved) {
            notify(get_string('submissionsaved', 'problemstatement'), 'notifysuccess');
        }
        if (has_capability('mod/problemstatement:submit', $context)) {
            if ($editmode) {
                print_box_start('generalbox', 'online');
                $mform->display();
            } else {
                print_box_start('generalbox boxwidthwide boxaligncenter', 'online');
                if ($submission) {
                    echo highlight_syntax($submission->programtext, $submission->langid);
                    $msg = "";
                    switch ($submission->processed) {
                        case "0":
                            $msg .= get_string("unprocessed", "problemstatement");
                            break;
                        case "1":
                            switch ($submission->succeeded) {
                                case "0":
                                    $msg .= get_string("unsuccess", "problemstatement");
                                    break;
                                case "1":
                                    $msg .= get_string("success", "problemstatement");
                                    break;
                                case "2":
                                    $msg .= get_string("compilationerror", "problemstatement") . "\n" . $submission->submissioncomment;
                                    break;
                                case "3":
                                    $msg .= get_string("internalerror", "problemstatement");
                                    break;
                                case "4":
                                    $msg .= get_string("timeout", "problemstatement");
                                    break;
                                case "5":
                                    $msg .= get_string("memoryout", "problemstatement");
                                    break;
                                case "6":
                                    $msg .= get_string("runtimeerror", "problemstatement") . "\n" . $submission->submissioncomment;
                                    break;
                            }
                            break;
                        case "2":
                            $msg .= get_string("inprocess", "problemstatement");
                            break;
                    }
                    echo "<div style='text-align:left'>" . nl2br($msg) . "</div>";
                    //echo format_text($submission->programtext, 0);//$submission->data2);
                } else {
                    if (!has_capability('mod/problemstatement:submit', $context)) {
                        //fix for #4604
                        echo '<div style="text-align:center">' . get_string('guestnosubmit', 'problemstatement') . '</div>';
                    } else {
                        if ($this->isopen()) {
                            //fix for #4206
                            echo '<div style="text-align:center">' . get_string('emptysubmission', 'problemstatement') . '</div>';
                        }
                    }
                }
            }
            print_box_end();
            if (!$editmode && $editable) {
                echo "<div style='text-align:center'>";
                print_single_button('view.php', array('id' => $this->cm->id, 'edit' => '1'), get_string('editmysubmission', 'problemstatement'));
                echo "</div>";
            }
        }
        $this->view_feedback();
        $this->view_footer();
        //echo "end of view";
    }
开发者ID:Anna-Sentyakova,项目名称:runningcat,代码行数:101,代码来源:problemstatement.class.php

示例10: print_maintenance_message

/**
 * Prints a maintenance message from /maintenance.html
 */
function print_maintenance_message()
{
    global $CFG, $SITE;
    $PAGE->set_pagetype('maintenance-message');
    print_header(strip_tags($SITE->fullname), $SITE->fullname, 'home');
    print_box_start();
    print_heading(get_string('sitemaintenance', 'admin'));
    @(include $CFG->dataroot . '/1/maintenance.html');
    print_box_end();
    print_footer();
}
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:14,代码来源:weblib.php

示例11: prepareQuizAttempt

function prepareQuizAttempt($q)
{
    global $DB;
    if ($id) {
        if (!($cm = get_coursemodule_from_id('quiz', $id))) {
            print_error('invalidcoursemodule');
        }
        if (!($course = $DB->get_record('course', array('id' => $cm->course)))) {
            print_error('coursemisconf');
        }
        if (!($quiz = $DB->get_record('quiz', array('id' => $cm->instance)))) {
            print_error('invalidcoursemodule');
        }
    } else {
        if (!($quiz = $DB->get_record('quiz', array('id' => $q)))) {
            print_error('invalidquizid', 'quiz');
        }
        if (!($course = $DB->get_record('course', array('id' => $quiz->course)))) {
            print_error('invalidcourseid');
        }
        if (!($cm = get_coursemodule_from_instance("quiz", $quiz->id, $course->id))) {
            print_error('invalidcoursemodule');
        }
    }
    /// Check login and get context.
    require_login($course->id, false, $cm);
    $context = get_context_instance(CONTEXT_MODULE, $cm->id);
    require_capability('mod/quiz:view', $context);
    /// Cache some other capabilites we use several times.
    $canattempt = has_capability('mod/quiz:attempt', $context);
    $canreviewmine = has_capability('mod/quiz:reviewmyattempts', $context);
    $canpreview = has_capability('mod/quiz:preview', $context);
    /// Create an object to manage all the other (non-roles) access rules.
    $timenow = time();
    $accessmanager = new quiz_access_manager(new quiz($quiz, $cm, $course), $timenow, has_capability('mod/quiz:ignoretimelimits', $context, NULL, false));
    /// Print information about the student's best score for this quiz if possible.
    $moreattempts = $unfinished || !$accessmanager->is_finished($numattempts, $lastfinishedattempt);
    /// Determine if we should be showing a start/continue attempt button,
    /// or a button to go back to the course page.
    print_box_start('quizattempt');
    $buttontext = '';
    // This will be set something if as start/continue attempt button should appear.
    if (!$quiz->questions) {
        print_heading(get_string("noquestions", "quiz"));
    } else {
        if ($unfinished) {
            if ($canattempt) {
                $buttontext = get_string('continueattemptquiz', 'quiz');
            } else {
                if ($canpreview) {
                    $buttontext = get_string('continuepreview', 'quiz');
                }
            }
        } else {
            if ($canattempt) {
                $messages = $accessmanager->prevent_new_attempt($numattempts, $lastfinishedattempt);
                if ($messages) {
                    $accessmanager->print_messages($messages);
                } else {
                    if ($numattempts == 0) {
                        $buttontext = get_string('attemptquiznow', 'quiz');
                    } else {
                        $buttontext = get_string('reattemptquiz', 'quiz');
                    }
                }
            } else {
                if ($canpreview) {
                    $buttontext = get_string('previewquiznow', 'quiz');
                }
            }
        }
        // If, so far, we think a button should be printed, so check if they will be allowed to access it.
        if ($buttontext) {
            if (!$moreattempts) {
                $buttontext = '';
            } else {
                if ($canattempt && ($messages = $accessmanager->prevent_access())) {
                    $accessmanager->print_messages($messages);
                    $buttontext = '';
                }
            }
        }
    }
    /// Now actually print the appropriate button.
    if ($buttontext) {
        $accessmanager->print_start_attempt_button($canpreview, $buttontext, $unfinished);
    } else {
        print_continue($CFG->wwwroot . '/course/view.php?id=' . $course->id);
    }
    print_box_end();
}
开发者ID:arshanam,项目名称:Moodle-ITScholars-LMS,代码行数:91,代码来源:test_view.php

示例12: quiz_grade_item_update

/**
 * Create grade item for given quiz
 *
 * @param object $quiz object with extra cmidnumber
 * @param mixed optional array/object of grade(s); 'reset' means reset grades in gradebook
 * @return int 0 if ok, error code otherwise
 */
function quiz_grade_item_update($quiz, $grades = NULL)
{
    global $CFG;
    if (!function_exists('grade_update')) {
        //workaround for buggy PHP versions
        require_once $CFG->libdir . '/gradelib.php';
    }
    if (array_key_exists('cmidnumber', $quiz)) {
        //it may not be always present
        $params = array('itemname' => $quiz->name, 'idnumber' => $quiz->cmidnumber);
    } else {
        $params = array('itemname' => $quiz->name);
    }
    if ($quiz->grade > 0) {
        $params['gradetype'] = GRADE_TYPE_VALUE;
        $params['grademax'] = $quiz->grade;
        $params['grademin'] = 0;
    } else {
        $params['gradetype'] = GRADE_TYPE_NONE;
    }
    /* description by TJ:
    1/ If the quiz is set to not show scores while the quiz is still open, and is set to show scores after
       the quiz is closed, then create the grade_item with a show-after date that is the quiz close date.
    2/ If the quiz is set to not show scores at either of those times, create the grade_item as hidden.
    3/ If the quiz is set to show scores, create the grade_item visible.
    */
    if (!($quiz->review & QUIZ_REVIEW_SCORES & QUIZ_REVIEW_CLOSED) and !($quiz->review & QUIZ_REVIEW_SCORES & QUIZ_REVIEW_OPEN)) {
        $params['hidden'] = 1;
    } else {
        if ($quiz->review & QUIZ_REVIEW_SCORES & QUIZ_REVIEW_CLOSED and !($quiz->review & QUIZ_REVIEW_SCORES & QUIZ_REVIEW_OPEN)) {
            if ($quiz->timeclose) {
                $params['hidden'] = $quiz->timeclose;
            } else {
                $params['hidden'] = 1;
            }
        } else {
            // a) both open and closed enabled
            // b) open enabled, closed disabled - we can not "hide after", grades are kept visible even after closing
            $params['hidden'] = 0;
        }
    }
    if ($grades === 'reset') {
        $params['reset'] = true;
        $grades = NULL;
    }
    $gradebook_grades = grade_get_grades($quiz->course, 'mod', 'quiz', $quiz->id);
    if (!empty($gradebook_grades->items)) {
        $grade_item = $gradebook_grades->items[0];
        if ($grade_item->locked) {
            $confirm_regrade = optional_param('confirm_regrade', 0, PARAM_INT);
            if (!$confirm_regrade) {
                $message = get_string('gradeitemislocked', 'grades');
                $back_link = $CFG->wwwroot . '/mod/quiz/report.php?q=' . $quiz->id . '&amp;mode=overview';
                $regrade_link = qualified_me() . '&amp;confirm_regrade=1';
                print_box_start('generalbox', 'notice');
                echo '<p>' . $message . '</p>';
                echo '<div class="buttons">';
                print_single_button($regrade_link, null, get_string('regradeanyway', 'grades'), 'post', $CFG->framename);
                print_single_button($back_link, null, get_string('cancel'), 'post', $CFG->framename);
                echo '</div>';
                print_box_end();
                return GRADE_UPDATE_ITEM_LOCKED;
            }
        }
    }
    return grade_update('mod/quiz', $quiz->course, 'mod', 'quiz', $quiz->id, 0, $grades, $params);
}
开发者ID:e-rasvet,项目名称:reader,代码行数:74,代码来源:lib.php

示例13: print_item

    function print_item($item, $value = false, $readonly = false, $edit = false, $highlightrequire = false)
    {
        $align = get_string('thisdirection') == 'ltr' ? 'left' : 'right';
        $presentation = explode("|", $item->presentation);
        if ($highlightrequire and $item->required and strval($value) == '') {
            $highlight = 'bgcolor="#FFAAAA" class="missingrequire"';
        } else {
            $highlight = '';
        }
        $requiredmark = $item->required == 1 ? '<span class="feedback_required_mark">*</span>' : '';
        ?>
        <td <?php 
        echo $highlight;
        ?>
 valign="top" align="<?php 
        echo $align;
        ?>
">
        <?php 
        if ($edit or $readonly) {
            echo '(' . $item->label . ') ';
        }
        echo format_text($item->name . $requiredmark, true, false, false);
        ?>
        </td>
        <td valign="top" align="<?php 
        echo $align;
        ?>
">
    <?php 
        if ($readonly) {
            // print_simple_box_start($align);
            print_box_start('generalbox boxalign' . $align);
            echo $value ? str_replace("\n", '<br />', $value) : '&nbsp;';
            // print_simple_box_end();
            print_box_end();
        } else {
            ?>
            <textarea name="<?php 
            echo $item->typ . '_' . $item->id;
            ?>
"
                        cols="<?php 
            echo $presentation[0];
            ?>
"
                        rows="<?php 
            echo $presentation[1];
            ?>
"><?php 
            echo $value ? htmlspecialchars($value) : '';
            ?>
</textarea>
    <?php 
        }
        ?>
        </td>
    <?php 
    }
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:59,代码来源:lib.php

示例14: render_edit

 /**
  * Render the Edit mode of the Presenter (lists all the slides and allows re-ordering).
  * Called from with the {@link render()} function when necessary.
  */
 function render_edit()
 {
     //display any feedback
     if (!empty($this->feedback)) {
         echo $this->feedback;
     }
     global $CFG;
     $streditpresenter = get_string('presenter:edit', 'sloodle');
     $strviewanddelete = get_string('presenter:viewanddelete', 'sloodle');
     $strnoentries = get_string('noentries', 'sloodle');
     $strnoslides = get_string('presenter:empty', 'sloodle');
     $strdelete = get_string('delete', 'sloodle');
     $stradd = get_string('presenter:add', 'sloodle');
     $straddatend = get_string('presenter:addatend', 'sloodle');
     $straddbefore = get_string('presenter:addbefore', 'sloodle');
     $strtype = get_string('type', 'sloodle');
     $strurl = get_string('url', 'sloodle');
     $strname = get_string('name', 'sloodle');
     $stryes = get_string('yes');
     $strno = get_string('no');
     $strmove = get_string('move');
     $stredit = get_string('edit', 'sloodle');
     $strview = get_string('view', 'sloodle');
     $strdelete = get_string('delete');
     $strmoveslide = get_string('presenter:moveslide', 'sloodle');
     $streditslide = get_string('presenter:editslide', 'sloodle');
     $strviewslide = get_string('presenter:viewslide', 'sloodle');
     $strdeleteslide = get_string('presenter:deleteslide', 'sloodle');
     // Get a list of entry URLs
     $entries = $this->presenter->get_slides();
     if (!is_array($entries)) {
         $entries = array();
     }
     $numentries = count($entries);
     // Any images to display?
     if ($entries === false || count($entries) == 0) {
         echo '<h4>' . $strnoslides . '</h4>';
         echo '<h4><a href="' . SLOODLE_WWWROOT . '/view.php?id=' . $this->cm->id . '&amp;mode=addslide">' . $stradd . '</a></h4><br>';
     } else {
         // Are we being asked to confirm the deletion of a slide?
         if ($this->presenter_mode == 'confirmdeleteslide') {
             // Make sure the session key is specified and valid
             if (required_param('sesskey') != sesskey()) {
                 error('Invalid session key');
                 exit;
             }
             // Determine which slide is being deleted
             $entryid = (int) required_param('entry', PARAM_INT);
             // Make sure the specified entry is recognised
             if (isset($entries[$entryid])) {
                 // Construct our links
                 $linkYes = SLOODLE_WWWROOT . "/view.php?id={$this->cm->id}&amp;mode=deleteslide&amp;entry={$entryid}&amp;sesskey=" . sesskey();
                 $linkNo = SLOODLE_WWWROOT . "/view.php?id={$this->cm->id}&amp;mode=edit";
                 // Output our confirmation form
                 notice_yesno(get_string('presenter:confirmdelete', 'sloodle', $entries[$entryid]->name), $linkYes, $linkNo);
                 echo "<br/>";
             }
         }
         // Are we being asked to confirm the deletion of multiple slides?
         $deletingentries = array();
         if ($this->presenter_mode == 'confirmdeletemultiple') {
             // Make sure the session key is specified and valid
             if (required_param('sesskey') != sesskey()) {
                 error('Invalid session key');
                 exit;
             }
             // Grab the array of entries to be deleted
             if (isset($_REQUEST['entries'])) {
                 $deletingentries = $_REQUEST['entries'];
             }
             if (is_array($deletingentries) && count($deletingentries) > 0) {
                 // Construct our links
                 $entriesparam = '';
                 foreach ($deletingentries as $de) {
                     $entriesparam .= "entries[]={$de}&amp;";
                 }
                 $linkYes = SLOODLE_WWWROOT . "/view.php?id={$this->cm->id}&amp;mode=deletemultiple&amp;{$entriesparam}sesskey=" . sesskey();
                 $linkNo = SLOODLE_WWWROOT . "/view.php?id={$this->cm->id}&amp;mode=edit";
                 // Output our confirmation form
                 notice_yesno(get_string('presenter:confirmdeletemultiple', 'sloodle', count($deletingentries)), $linkYes, $linkNo);
                 echo "<br/>";
             } else {
                 // No slides selected.
                 // Inform the user to select slides first, and then click the button again.
                 notify(get_string('presenter:noslidesfordeletion', 'sloodle'));
             }
         }
         // Are we currently moving a slide?
         if ($this->presenter_mode == 'moveslide') {
             $linkCancel = SLOODLE_WWWROOT . "/view.php?id={$this->cm->id}&amp;mode=edit";
             $strcancel = get_string('cancel');
             // Display a message and an optional 'cancel' link
             print_box_start('generalbox', 'notice');
             echo "<p>", get_string('presenter:movingslide', 'sloodle', $entries[$this->movingentryid]->name), "</p>\n";
             echo "<p>(<a href=\"{$linkCancel}\">{$strcancel}</a>)</p>\n";
             print_box_end();
//.........这里部分代码省略.........
开发者ID:nagyistoce,项目名称:moodle-Teach-Pilot,代码行数:101,代码来源:presenter.php

示例15: page_print_jump_menu

/**
 * Prints a menu for jumping from page to page
 *
 * @return void
 **/
function page_print_jump_menu()
{
    global $PAGE;
    if ($pages = page_get_all_pages($PAGE->get_id(), 'flat')) {
        $current = $PAGE->get_formatpage();
        $options = array();
        foreach ($pages as $page) {
            $options[$page->id] = page_name_menu($page->nameone, $page->depth);
        }
        print_box_start('centerpara pagejump');
        popup_form($PAGE->url_build('page'), $options, 'editpage', $current->id, get_string('choosepagetoedit', 'format_page'));
        print_box_end();
    }
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:19,代码来源:lib.php


注:本文中的print_box_end函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。