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


PHP moodle_url::out_action方法代码示例

本文整理汇总了PHP中moodle_url::out_action方法的典型用法代码示例。如果您正苦于以下问题:PHP moodle_url::out_action方法的具体用法?PHP moodle_url::out_action怎么用?PHP moodle_url::out_action使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在moodle_url的用法示例。


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

示例1: 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

示例2: memorization_print_view_method7week_mobile

function memorization_print_view_method7week_mobile($userid)
{
    global $CFG;
    $verseconditions = array();
    $verseconditions['day'] = "(repetitions >= '" . MEMORIZATION_VERSE_DAY_LOWER . "' \n                               AND repetitions < '" . MEMORIZATION_VERSE_DAY_UPPER . "' \n                               AND timemodified < '" . strtotime('midnight') . "')";
    $verseconditions['week'] = "(repetitions >= '" . MEMORIZATION_VERSE_WEEK_LOWER . "' \n                                AND repetitions < '" . MEMORIZATION_VERSE_WEEK_UPPER . "' \n                                AND timemodified < '" . strtotime('last monday midnight') . "')";
    $verseconditions['month'] = "(repetitions >= '" . MEMORIZATION_VERSE_MONTH_LOWER . "' \n                                 AND repetitions < '" . MEMORIZATION_VERSE_MONTH_UPPER . "' \n                                 AND timemodified < '" . strtotime('first day of this month midnight') . "')";
    $verseconditions['quarterly'] = "(repetitions >= '" . MEMORIZATION_VERSE_LIFE_LOWER . "' \n                                     AND repetitions < '" . MEMORIZATION_VERSE_LIFE_UPPER . "' \n                                     AND timemodified < '" . strtotime('midnight 3 months ago') . "')";
    $verseconditionsstring = '(' . implode(' OR ', $verseconditions) . ')';
    $versesrs = get_recordset_select('memorization_verse', "userid = '{$userid}' AND {$verseconditionsstring}", 'repetitions ASC');
    print_box_start('day-verses mobilebox');
    while (($verse = rs_fetch_next_record($versesrs)) !== false) {
        switch (true) {
            case $verse->repetitions >= MEMORIZATION_VERSE_LIFE_LOWER:
                if (!isset($tabprinted[MEMORIZATION_VERSE_LIFE_LOWER])) {
                    print_box(get_string('quarterlyverses', 'memorization'), 'quarter-verse-title generalbox mobilebox');
                    $tabprinted[MEMORIZATION_VERSE_MONTH_LOWER] = true;
                }
                break;
            case $verse->repetitions >= MEMORIZATION_VERSE_MONTH_LOWER:
                if (!isset($tabprinted[MEMORIZATION_VERSE_MONTH_LOWER])) {
                    print_box(get_string('monthverses', 'memorization'), 'month-verse-title generalbox mobilebox');
                    $tabprinted[MEMORIZATION_VERSE_MONTH_LOWER] = true;
                }
                break;
            case $verse->repetitions >= MEMORIZATION_VERSE_WEEK_LOWER:
                if (!isset($tabprinted[MEMORIZATION_VERSE_WEEK_LOWER])) {
                    print_box(get_string('weekverses', 'memorization'), 'week-verse-title generalbox mobilebox');
                    $tabprinted[MEMORIZATION_VERSE_WEEK_LOWER] = true;
                }
                break;
            case $verse->repetitions >= MEMORIZATION_VERSE_DAY_LOWER:
                if (!isset($tabprinted[MEMORIZATION_VERSE_DAY_LOWER])) {
                    $url = new moodle_url('addverse.php', array('userid' => $userid));
                    print_box(get_string('dayverses', 'memorization') . '<div class="add-verse"><a href="' . $url->out_action() . '"><img src="' . $CFG->wwwroot . '/mod/memorization/pix/new.png" /></a></div>', 'day-verse-title generalbox mobilebox');
                    $tabprinted[MEMORIZATION_VERSE_DAY_LOWER] = true;
                }
                break;
        }
        $completion = !empty($verse->repetitions) ? 100 - $verse->repetitions / MEMORIZATION_COMPLETE * 100 : 100;
        echo '<table class="memorization-verse" id="memorization-verse-' . $verse->id . '">
                <tr>
                   <td class="hint"><a class="my-message-box" x="350" y="500" href="ajaxversedisplay.php?verseid=' . $verse->id . '&userid=' . $userid . '&sesskey=' . sesskey() . '"><img src="' . $CFG->wwwroot . '/mod/memorization/pix/bulb.png" /></a></td>
                   <td class="verse">
                        ' . _get_verse_text($verse) . '
                        <div class="progress" style="right: ' . $completion . '%;">&nbsp;</div>
                   </td>
                   <td class="check" id="' . $verse->id . '-' . ($verse->repetitions + 1) . '"> <img src="' . $CFG->pixpath . '/i/tick_green_big.gif" /></td>
                 </tr>
              </table>';
    }
    print_box_end();
    echo '<script type="text/javascript">
            jQuery(document).ready(function () {
                function parse_verse_id_from_repetion_box(elementid) {
                    return elementid.replace(/\\-[0-9]*$/, "");
                }

                function parse_repetition(elementid) {
                    return elementid.replace(/[0-9]+?\\-/, "");
                }

                function parse_verse_id_from_move_to_link(elementid) {
                    firststrip = elementid.replace(/move\\-verse\\-/, "");
                    return firststrip.replace(/\\-[0-9]*$/, "");
                }

                function parse_repetition_value_from_move_to_link(elementid) {
                    return elementid.replace(/.*\\-/, "");
                }

                function update_verse_in_database(verseid, newrepetition) {
                    jQuery.ajax({
                       type: "POST",
                       url: "ajaxupdateverserepetition.php",
                       data: "sesskey=' . sesskey() . '&userid=' . $userid . '&verseid="+verseid+"&newrepetition="+newrepetition,
                     });
                }

                jQuery("td.check").click(function () {
                    newrepetition = parse_repetition(jQuery(this).attr("id"));
                    verseid = parse_verse_id_from_repetion_box(jQuery(this).attr("id"));
                    update_verse_in_database(verseid, newrepetition);
                    jQuery("table#memorization-verse-"+verseid).fadeOut(800);
                });
            });
          </script>';
    return true;
}
开发者ID:NextEinstein,项目名称:riverhills,代码行数:89,代码来源:method7week.php


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