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


PHP moodle_url::get_query_string方法代码示例

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


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

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

示例2: process_url_add

 /**
  * Handle adding a block.
  * @return boolean true if anything was done. False if not.
  */
 public function process_url_add()
 {
     global $CFG, $PAGE, $OUTPUT;
     $blocktype = optional_param('bui_addblock', null, PARAM_PLUGIN);
     if ($blocktype === null) {
         return false;
     }
     require_sesskey();
     if (!$this->page->user_can_edit_blocks()) {
         throw new moodle_exception('nopermissions', '', $this->page->url->out(), get_string('addblock'));
     }
     $addableblocks = $this->get_addable_blocks();
     if ($blocktype === '') {
         // Display add block selection.
         $addpage = new moodle_page();
         $addpage->set_pagelayout('admin');
         $addpage->blocks->show_only_fake_blocks(true);
         $addpage->set_course($this->page->course);
         $addpage->set_context($this->page->context);
         if ($this->page->cm) {
             $addpage->set_cm($this->page->cm);
         }
         $addpagebase = str_replace($CFG->wwwroot . '/', '/', $this->page->url->out_omit_querystring());
         $addpageparams = $this->page->url->params();
         $addpage->set_url($addpagebase, $addpageparams);
         $addpage->set_block_actions_done();
         // At this point we are going to display the block selector, overwrite global $PAGE ready for this.
         $PAGE = $addpage;
         // Some functions use $OUTPUT so we need to replace that too.
         $OUTPUT = $addpage->get_renderer('core');
         $site = get_site();
         $straddblock = get_string('addblock');
         $PAGE->navbar->add($straddblock);
         $PAGE->set_title($straddblock);
         $PAGE->set_heading($site->fullname);
         echo $OUTPUT->header();
         echo $OUTPUT->heading($straddblock);
         if (!$addableblocks) {
             echo $OUTPUT->box(get_string('noblockstoaddhere'));
             echo $OUTPUT->container($OUTPUT->action_link($addpage->url, get_string('back')), 'm-x-3 m-b-1');
         } else {
             $url = new moodle_url($addpage->url, array('sesskey' => sesskey()));
             echo $OUTPUT->render_from_template('core/add_block_body', ['blocks' => array_values($addableblocks), 'url' => '?' . $url->get_query_string(false)]);
             echo $OUTPUT->container($OUTPUT->action_link($addpage->url, get_string('cancel')), 'm-x-3 m-b-1');
         }
         echo $OUTPUT->footer();
         // Make sure that nothing else happens after we have displayed this form.
         exit;
     }
     if (!array_key_exists($blocktype, $addableblocks)) {
         throw new moodle_exception('cannotaddthisblocktype', '', $this->page->url->out(), $blocktype);
     }
     $this->add_block_at_end_of_default_region($blocktype);
     // If the page URL was a guess, it will contain the bui_... param, so we must make sure it is not there.
     $this->page->ensure_param_not_in_url('bui_addblock');
     return true;
 }
开发者ID:stronk7,项目名称:moodle,代码行数:61,代码来源:blocklib.php

示例3: sesskey

}
// if we have a verse to save then save or confirm it is correct
if (optional_param('startbookid', false, PARAM_INT) !== false) {
    $startbookid = required_param('startbookid', PARAM_INT);
    $startchapter = required_param('startchapter', PARAM_INT);
    $startverse = required_param('startverse', PARAM_INT);
    $endbookid = required_param('endbookid', PARAM_INT);
    $endchapter = required_param('endchapter', PARAM_INT);
    $endverse = required_param('endverse', PARAM_INT);
    $versionid = required_param('versionid', PARAM_INT);
    $currenturl = new moodle_url(qualified_me());
    $currenturl->params(array('startbookid' => $startbookid, 'startchapter' => $startchapter, 'startverse' => $startverse, 'endbookid' => $endbookid, 'endchapter' => $endchapter, 'endverse' => $endverse, 'versionid' => $versionid, 'sesskey' => sesskey()));
    $versetext = lookup_bible_verse($versionid, $startbookid, $startchapter, $startverse, $endbookid, $endchapter, $endverse);
    if (!optional_param('confirm', 0, PARAM_BOOL)) {
        $linkyes = $currenturl->out(false, array('confirm' => '1'));
        $linkno = $CFG->wwwroot . '/mod/memorization/view.php?' . $currenturl->get_query_string();
        $message = '<div class="confirm-verse">' . get_string('confirmverse', 'memorization') . '</div>' . '<div class="verse">' . $versetext . '</div>';
        print_header_simple(get_string('notice'));
        notice_yesno($message, $linkyes, $linkno);
        print_footer();
        exit;
    }
    $versionname = get_field('memorization_version', 'name', 'id', $versionid);
    $verse = (object) array('userid' => $userid, 'startbookid' => $startbookid, 'startchapter' => $startchapter, 'startverse' => $startverse, 'endbookid' => $endbookid, 'endchapter' => $endchapter, 'endverse' => $endverse, 'text' => $versetext, 'versionid' => $versionid, 'repetitions' => 0);
    $verse = addslashes_recursive($verse);
    if (!insert_record('memorization_verse', $verse)) {
        print_header();
        error('There was an error adding your verse. Please try again');
    }
    redirect('view.php?' . $currenturl->get_query_string());
}
开发者ID:NextEinstein,项目名称:riverhills,代码行数:31,代码来源:addverse.php


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