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


PHP moodle_page::set_url方法代码示例

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


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

示例1: test_update_user_profile_image

 /**
  * Test the update user profile image function.
  */
 public function test_update_user_profile_image()
 {
     global $DB, $CFG;
     // Set the profile image.
     \enrol_lti\helper::update_user_profile_image($this->user1->id, $this->getExternalTestFileUrl('/test.jpg'));
     // Get the new user record.
     $this->user1 = $DB->get_record('user', array('id' => $this->user1->id));
     // Set the page details.
     $page = new moodle_page();
     $page->set_url('/user/profile.php');
     $page->set_context(context_system::instance());
     $renderer = $page->get_renderer('core');
     $usercontext = context_user::instance($this->user1->id);
     // Get the user's profile picture and make sure it is correct.
     $userpicture = new user_picture($this->user1);
     $this->assertSame($CFG->wwwroot . '/pluginfile.php/' . $usercontext->id . '/user/icon/clean/f2?rev=' . $this->user1->picture, $userpicture->get_url($page, $renderer)->out(false));
 }
开发者ID:janeklb,项目名称:moodle,代码行数:20,代码来源:helper_test.php

示例2: if

if ($reset and confirm_sesskey()) {
    theme_reset_all_caches();

} else if ($choose && $device && !$unsettheme && confirm_sesskey()) {
    // Load the theme to make sure it is valid.
    $theme = theme_config::load($choose);
    // Get the config argument for the chosen device.
    $themename = get_device_cfg_var_name($device);
    set_config($themename, $theme->name);

    // Create a new page for the display of the themes readme.
    // This ensures that the readme page is shown using the new theme.
    $confirmpage = new moodle_page();
    $confirmpage->set_context($PAGE->context);
    $confirmpage->set_url($PAGE->url);
    $confirmpage->set_pagelayout($PAGE->pagelayout);
    $confirmpage->set_pagetype($PAGE->pagetype);
    $confirmpage->set_title($PAGE->title);
    $confirmpage->set_heading($PAGE->heading);

    // Get the core renderer for the new theme.
    $output = $confirmpage->get_renderer('core');

    echo $output->header();
    echo $output->heading(get_string('themesaved'));
    echo $output->box_start();
    echo format_text(get_string('choosereadme', 'theme_'.$theme->name), FORMAT_MOODLE);
    echo $output->box_end();
    echo $output->continue_button($CFG->wwwroot . '/theme/index.php');
    echo $output->footer();
开发者ID:verbazend,项目名称:AWFA,代码行数:30,代码来源:index.php

示例3: test_qualified_me

 public function test_qualified_me()
 {
     global $PAGE, $FULLME, $CFG;
     $this->resetAfterTest();
     $PAGE = new moodle_page();
     $FULLME = $CFG->wwwroot . '/course/view.php?id=1&xx=yy';
     $this->assertSame($FULLME, qualified_me());
     $PAGE->set_url('/course/view.php', array('id' => 1));
     $this->assertSame($CFG->wwwroot . '/course/view.php?id=1', qualified_me());
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:10,代码来源:weblib_test.php

示例4: process_url_edit

 /**
  * Handle showing/processing the submission from the block editing form.
  * @return boolean true if the form was submitted and the new config saved. Does not
  *      return if the editing form was displayed. False otherwise.
  */
 public function process_url_edit()
 {
     global $CFG, $DB, $PAGE, $OUTPUT;
     $blockid = optional_param('bui_editid', null, PARAM_INT);
     if (!$blockid) {
         return false;
     }
     require_sesskey();
     require_once $CFG->dirroot . '/blocks/edit_form.php';
     $block = $this->find_instance($blockid);
     if (!$block->user_can_edit() && !$this->page->user_can_edit_blocks()) {
         throw new moodle_exception('nopermissions', '', $this->page->url->out(), get_string('editblock'));
     }
     $editpage = new moodle_page();
     $editpage->set_pagelayout('admin');
     $editpage->set_course($this->page->course);
     //$editpage->set_context($block->context);
     $editpage->set_context($this->page->context);
     if ($this->page->cm) {
         $editpage->set_cm($this->page->cm);
     }
     $editurlbase = str_replace($CFG->wwwroot . '/', '/', $this->page->url->out_omit_querystring());
     $editurlparams = $this->page->url->params();
     $editurlparams['bui_editid'] = $blockid;
     $editpage->set_url($editurlbase, $editurlparams);
     $editpage->set_block_actions_done();
     // At this point we are either going to redirect, or display the form, so
     // overwrite global $PAGE ready for this. (Formslib refers to it.)
     $PAGE = $editpage;
     //some functions like MoodleQuickForm::addHelpButton use $OUTPUT so we need to replace that to
     $output = $editpage->get_renderer('core');
     $OUTPUT = $output;
     $formfile = $CFG->dirroot . '/blocks/' . $block->name() . '/edit_form.php';
     if (is_readable($formfile)) {
         require_once $formfile;
         $classname = 'block_' . $block->name() . '_edit_form';
         if (!class_exists($classname)) {
             $classname = 'block_edit_form';
         }
     } else {
         $classname = 'block_edit_form';
     }
     $mform = new $classname($editpage->url, $block, $this->page);
     $mform->set_data($block->instance);
     if ($mform->is_cancelled()) {
         redirect($this->page->url);
     } else {
         if ($data = $mform->get_data()) {
             $bi = new stdClass();
             $bi->id = $block->instance->id;
             // This may get overwritten by the special case handling below.
             $bi->pagetypepattern = $data->bui_pagetypepattern;
             $bi->showinsubcontexts = (bool) $data->bui_contexts;
             if (empty($data->bui_subpagepattern) || $data->bui_subpagepattern == '%@NULL@%') {
                 $bi->subpagepattern = null;
             } else {
                 $bi->subpagepattern = $data->bui_subpagepattern;
             }
             $systemcontext = context_system::instance();
             $frontpagecontext = context_course::instance(SITEID);
             $parentcontext = context::instance_by_id($data->bui_parentcontextid);
             // Updating stickiness and contexts.  See MDL-21375 for details.
             if (has_capability('moodle/site:manageblocks', $parentcontext)) {
                 // Check permissions in destination
                 // Explicitly set the default context
                 $bi->parentcontextid = $parentcontext->id;
                 if ($data->bui_editingatfrontpage) {
                     // The block is being edited on the front page
                     // The interface here is a special case because the pagetype pattern is
                     // totally derived from the context menu.  Here are the excpetions.   MDL-30340
                     switch ($data->bui_contexts) {
                         case BUI_CONTEXTS_ENTIRE_SITE:
                             // The user wants to show the block across the entire site
                             $bi->parentcontextid = $systemcontext->id;
                             $bi->showinsubcontexts = true;
                             $bi->pagetypepattern = '*';
                             break;
                         case BUI_CONTEXTS_FRONTPAGE_SUBS:
                             // The user wants the block shown on the front page and all subcontexts
                             $bi->parentcontextid = $frontpagecontext->id;
                             $bi->showinsubcontexts = true;
                             $bi->pagetypepattern = '*';
                             break;
                         case BUI_CONTEXTS_FRONTPAGE_ONLY:
                             // The user want to show the front page on the frontpage only
                             $bi->parentcontextid = $frontpagecontext->id;
                             $bi->showinsubcontexts = false;
                             $bi->pagetypepattern = 'site-index';
                             // This is the only relevant page type anyway but we'll set it explicitly just
                             // in case the front page grows site-index-* subpages of its own later
                             break;
                     }
                 }
             }
             $bits = explode('-', $bi->pagetypepattern);
//.........这里部分代码省略.........
开发者ID:Burick,项目名称:moodle,代码行数:101,代码来源:blocklib.php

示例5: test_get_url

 public function test_get_url()
 {
     global $DB, $CFG;
     $this->resetAfterTest();
     // Force SVG on so that we have predictable URL's.
     $CFG->svgicons = true;
     // verify new install contains expected defaults
     $this->assertEquals('standard', $CFG->theme);
     $this->assertEquals(1, $CFG->slasharguments);
     $this->assertEquals(1, $CFG->themerev);
     $this->assertEquals(0, $CFG->themedesignermode);
     $this->assertEquals('http://www.example.com/moodle', $CFG->wwwroot);
     $this->assertEquals($CFG->wwwroot, $CFG->httpswwwroot);
     $this->assertEquals(0, $CFG->enablegravatar);
     $this->assertEquals('mm', $CFG->gravatardefaulturl);
     // create some users
     $page = new moodle_page();
     $page->set_url('/user/profile.php');
     $page->set_context(context_system::instance());
     $renderer = $page->get_renderer('core');
     $user1 = $this->getDataGenerator()->create_user(array('picture' => 11, 'email' => 'user1@example.com'));
     $context1 = context_user::instance($user1->id);
     $user2 = $this->getDataGenerator()->create_user(array('picture' => 0, 'email' => 'user2@example.com'));
     $context2 = context_user::instance($user2->id);
     $user3 = $this->getDataGenerator()->create_user(array('picture' => 1, 'deleted' => 1, 'email' => 'user3@example.com'));
     $context3 = context_user::instance($user3->id, IGNORE_MISSING);
     $this->assertEquals($user3->picture, 0);
     $this->assertNotEquals($user3->email, 'user3@example.com');
     $this->assertFalse($context3);
     // try legacy picture == 1
     $user1->picture = 1;
     $up1 = new user_picture($user1);
     $this->assertEquals($CFG->wwwroot . '/pluginfile.php/' . $context1->id . '/user/icon/standard/f2?rev=1', $up1->get_url($page, $renderer)->out(false));
     $user1->picture = 11;
     // try valid user with picture when user context is not cached - 1 query expected
     context_helper::reset_caches();
     $reads = $DB->perf_get_reads();
     $up1 = new user_picture($user1);
     $this->assertEquals($reads, $DB->perf_get_reads());
     $this->assertEquals($CFG->wwwroot . '/pluginfile.php/' . $context1->id . '/user/icon/standard/f2?rev=11', $up1->get_url($page, $renderer)->out(false));
     $this->assertEquals($reads + 1, $DB->perf_get_reads());
     // try valid user with contextid hint - no queries expected
     $user1->contextid = $context1->id;
     context_helper::reset_caches();
     $reads = $DB->perf_get_reads();
     $up1 = new user_picture($user1);
     $this->assertEquals($reads, $DB->perf_get_reads());
     $this->assertEquals($CFG->wwwroot . '/pluginfile.php/' . $context1->id . '/user/icon/standard/f2?rev=11', $up1->get_url($page, $renderer)->out(false));
     $this->assertEquals($reads, $DB->perf_get_reads());
     // try valid user without image - no queries expected
     context_helper::reset_caches();
     $reads = $DB->perf_get_reads();
     $up2 = new user_picture($user2);
     $this->assertEquals($reads, $DB->perf_get_reads());
     $this->assertEquals($CFG->wwwroot . '/theme/image.php/standard/core/1/u/f2', $up2->get_url($page, $renderer)->out(false));
     $this->assertEquals($reads, $DB->perf_get_reads());
     // try guessing of deleted users - no queries expected
     unset($user3->deleted);
     context_helper::reset_caches();
     $reads = $DB->perf_get_reads();
     $up3 = new user_picture($user3);
     $this->assertEquals($reads, $DB->perf_get_reads());
     $this->assertEquals($CFG->wwwroot . '/theme/image.php/standard/core/1/u/f2', $up3->get_url($page, $renderer)->out(false));
     $this->assertEquals($reads, $DB->perf_get_reads());
     // try incorrectly deleted users (with valid email and pciture flag) - some DB reads expected
     $user3->email = 'user3@example.com';
     $user3->picture = 1;
     $reads = $DB->perf_get_reads();
     $up3 = new user_picture($user3);
     $this->assertEquals($reads, $DB->perf_get_reads());
     $this->assertEquals($CFG->wwwroot . '/theme/image.php/standard/core/1/u/f2', $up3->get_url($page, $renderer)->out(false));
     $this->assertTrue($reads < $DB->perf_get_reads());
     // test gravatar
     set_config('enablegravatar', 1);
     // deleted user can not have gravatar
     $user3->email = 'deleted';
     $user3->picture = 0;
     $up3 = new user_picture($user3);
     $this->assertEquals($CFG->wwwroot . '/theme/image.php/standard/core/1/u/f2', $up3->get_url($page, $renderer)->out(false));
     // verify defaults to misteryman (mm)
     $up2 = new user_picture($user2);
     $this->assertEquals('http://www.gravatar.com/avatar/ab53a2911ddf9b4817ac01ddcd3d975f?s=35&d=mm', $up2->get_url($page, $renderer)->out(false));
     // without gravatardefaulturl, verify we pick own file
     set_config('gravatardefaulturl', '');
     $up2 = new user_picture($user2);
     $this->assertEquals('http://www.gravatar.com/avatar/ab53a2911ddf9b4817ac01ddcd3d975f?s=35&d=http%3A%2F%2Fwww.example.com%2Fmoodle%2Fpix%2Fu%2Ff2.png', $up2->get_url($page, $renderer)->out(false));
     // uploaded image takes precedence before gravatar
     $up1 = new user_picture($user1);
     $this->assertEquals($CFG->wwwroot . '/pluginfile.php/' . $context1->id . '/user/icon/standard/f2?rev=11', $up1->get_url($page, $renderer)->out(false));
     // https version
     $CFG->httpswwwroot = str_replace('http:', 'https:', $CFG->wwwroot);
     $up1 = new user_picture($user1);
     $this->assertEquals($CFG->httpswwwroot . '/pluginfile.php/' . $context1->id . '/user/icon/standard/f2?rev=11', $up1->get_url($page, $renderer)->out(false));
     $up3 = new user_picture($user3);
     $this->assertEquals($CFG->httpswwwroot . '/theme/image.php/standard/core/1/u/f2', $up3->get_url($page, $renderer)->out(false));
     $up2 = new user_picture($user2);
     $this->assertEquals('https://secure.gravatar.com/avatar/ab53a2911ddf9b4817ac01ddcd3d975f?s=35&d=https%3A%2F%2Fwww.example.com%2Fmoodle%2Fpix%2Fu%2Ff2.png', $up2->get_url($page, $renderer)->out(false));
     // now test gravatar with one theme having own images (afterburner)
     $CFG->httpswwwroot = $CFG->wwwroot;
     $this->assertTrue(file_exists("{$CFG->dirroot}/theme/afterburner/config.php"));
//.........这里部分代码省略.........
开发者ID:masaterutakeno,项目名称:MoodleMobile,代码行数:101,代码来源:outputcomponents_test.php

示例6: test_navbar_prepend_and_add

 public function test_navbar_prepend_and_add()
 {
     global $PAGE;
     // Unfortunate hack needed because people use global $PAGE around the place.
     $PAGE->set_url('/');
     // We need to reset after this test because we using the generator.
     $this->resetAfterTest();
     $generator = self::getDataGenerator();
     $cat1 = $generator->create_category();
     $cat2 = $generator->create_category(array('parent' => $cat1->id));
     $course = $generator->create_course(array('category' => $cat2->id));
     $page = new moodle_page();
     $page->set_course($course);
     $page->set_url(new moodle_url('/course/view.php', array('id' => $course->id)));
     $page->navbar->prepend('test 1');
     $page->navbar->prepend('test 2');
     $page->navbar->add('test 3');
     $page->navbar->add('test 4');
     $items = $page->navbar->get_items();
     foreach ($items as $item) {
         $this->assertInstanceOf('navigation_node', $item);
     }
     $i = 0;
     $this->assertSame('test 1', $items[$i++]->text);
     $this->assertSame('test 2', $items[$i++]->text);
     $this->assertSame('home', $items[$i++]->key);
     $this->assertSame('courses', $items[$i++]->key);
     $this->assertSame($cat1->id, $items[$i++]->key);
     $this->assertSame($cat2->id, $items[$i++]->key);
     $this->assertSame($course->id, $items[$i++]->key);
     $this->assertSame('test 3', $items[$i++]->text);
     $this->assertSame('test 4', $items[$i++]->text);
     return $page;
 }
开发者ID:alanaipe2015,项目名称:moodle,代码行数:34,代码来源:navigationlib_test.php

示例7: fullname

// print all users
foreach ($students as $student) {
    ?>
                    <li id="student_<?php 
    echo $student->id;
    ?>
" data-prof="<?php 
    echo $student->roleid == 5 ? 'b' : 'a';
    ?>
" data-order="<?php 
    echo $studentNum++;
    ?>
">
                        <?php 
    $page = new moodle_page();
    $page->set_url('/user/profile.php');
    $page->set_context(context_system::instance());
    $renderer = $page->get_renderer('core');
    $up3 = new user_picture($student);
    $up3->size = 100;
    $image = $up3->get_url($page, $renderer)->out(false);
    ?>
                        <img src="<?php 
    echo $image;
    ?>
" alt="<?php 
    echo $student->firstname;
    ?>
">
                        <span class="user-name no-text"><?php 
    echo fullname($student);
开发者ID:EduardoKrausME,项目名称:mod_superchat,代码行数:31,代码来源:view.php

示例8: process_url_edit

 /**
  * Handle showing/processing the submission from the block editing form.
  * @return boolean true if the form was submitted and the new config saved. Does not
  *      return if the editing form was displayed. False otherwise.
  */
 public function process_url_edit()
 {
     global $CFG, $DB, $PAGE;
     $blockid = optional_param('bui_editid', null, PARAM_INTEGER);
     if (!$blockid) {
         return false;
     }
     confirm_sesskey();
     require_once $CFG->dirroot . '/blocks/edit_form.php';
     $block = $this->find_instance($blockid);
     if (!$block->user_can_edit() && !$this->page->user_can_edit_blocks()) {
         throw new moodle_exception('nopermissions', '', $this->page->url->out(), get_string('editblock'));
     }
     $editpage = new moodle_page();
     $editpage->set_generaltype('form');
     $editpage->set_course($this->page->course);
     $editpage->set_context($block->context);
     $editurlbase = str_replace($CFG->wwwroot . '/', '', $this->page->url->out(true));
     $editurlparams = $this->page->url->params();
     $editurlparams['bui_editid'] = $blockid;
     $editpage->set_url($editurlbase, $editurlparams);
     $editpage->_block_actions_done = true;
     // At this point we are either going to redirect, or display the form, so
     // overwrite global $PAGE ready for this. (Formslib refers to it.)
     $PAGE = $editpage;
     $formfile = $CFG->dirroot . '/blocks/' . $block->name() . '/edit_form.php';
     if (is_readable($formfile)) {
         require_once $formfile;
         $classname = 'block_' . $block->name() . '_edit_form';
     } else {
         $classname = 'block_edit_form';
     }
     $mform = new $classname($editpage->url, $block, $this->page);
     $mform->set_data($block->instance);
     if ($mform->is_cancelled()) {
         redirect($this->page->url);
     } else {
         if ($data = $mform->get_data()) {
             $bi = new stdClass();
             $bi->id = $block->instance->id;
             $bi->showinsubcontexts = $data->bui_showinsubcontexts;
             $bi->pagetypepattern = $data->bui_pagetypepattern;
             if (empty($data->bui_subpagepattern) || $data->bui_subpagepattern == '%@NULL@%') {
                 $bi->subpagepattern = null;
             } else {
                 $bi->subpagepattern = $data->bui_subpagepattern;
             }
             $bi->defaultregion = $data->bui_defaultregion;
             $bi->defaultweight = $data->bui_defaultweight;
             $DB->update_record('block_instances', $bi);
             if (!empty($block->config)) {
                 $config = clone $block->config;
             } else {
                 $config = new stdClass();
             }
             foreach ($data as $configfield => $value) {
                 if (strpos($configfield, 'config_') !== 0) {
                     continue;
                 }
                 $field = substr($configfield, 7);
                 $config->{$field} = $value;
             }
             $block->instance_config_save($config);
             $bp = new stdClass();
             $bp->visible = $data->bui_visible;
             $bp->region = $data->bui_region;
             $bp->weight = $data->bui_weight;
             $needbprecord = !$data->bui_visible || $data->bui_region != $data->bui_defaultregion || $data->bui_weight != $data->bui_defaultweight;
             if ($block->instance->blockpositionid && !$needbprecord) {
                 $DB->delete_records('block_positions', array('id' => $block->instance->blockpositionid));
             } else {
                 if ($block->instance->blockpositionid && $needbprecord) {
                     $bp->id = $block->instance->blockpositionid;
                     $DB->update_record('block_positions', $bp);
                 } else {
                     if ($needbprecord) {
                         $bp->blockinstanceid = $block->instance->id;
                         $bp->contextid = $this->page->context->id;
                         $bp->pagetype = $this->page->pagetype;
                         if ($this->page->subpage) {
                             $bp->subpage = $this->page->subpage;
                         } else {
                             $bp->subpage = '';
                         }
                         $DB->insert_record('block_positions', $bp);
                     }
                 }
             }
             redirect($this->page->url);
         } else {
             $strheading = get_string('editinga', $block->name());
             if (strpos($strheading, '[[') === 0) {
                 $strheading = get_string('blockconfiga', 'moodle', $block->get_title());
             }
             $editpage->set_title($strheading);
//.........这里部分代码省略.........
开发者ID:ajv,项目名称:Offline-Caching,代码行数:101,代码来源:blocklib.php

示例9: process_url_edit

 /**
  * Handle showing/processing the submission from the block editing form.
  * @return boolean true if the form was submitted and the new config saved. Does not
  *      return if the editing form was displayed. False otherwise.
  */
 public function process_url_edit()
 {
     global $CFG, $DB, $PAGE;
     $blockid = optional_param('bui_editid', null, PARAM_INTEGER);
     if (!$blockid) {
         return false;
     }
     require_sesskey();
     require_once $CFG->dirroot . '/blocks/edit_form.php';
     $block = $this->find_instance($blockid);
     if (!$block->user_can_edit() && !$this->page->user_can_edit_blocks()) {
         throw new moodle_exception('nopermissions', '', $this->page->url->out(), get_string('editblock'));
     }
     $editpage = new moodle_page();
     $editpage->set_pagelayout('admin');
     $editpage->set_course($this->page->course);
     $editpage->set_context($block->context);
     if ($this->page->cm) {
         $editpage->set_cm($this->page->cm);
     }
     $editurlbase = str_replace($CFG->wwwroot . '/', '/', $this->page->url->out_omit_querystring());
     $editurlparams = $this->page->url->params();
     $editurlparams['bui_editid'] = $blockid;
     $editpage->set_url($editurlbase, $editurlparams);
     $editpage->set_block_actions_done();
     // At this point we are either going to redirect, or display the form, so
     // overwrite global $PAGE ready for this. (Formslib refers to it.)
     $PAGE = $editpage;
     $formfile = $CFG->dirroot . '/blocks/' . $block->name() . '/edit_form.php';
     if (is_readable($formfile)) {
         require_once $formfile;
         $classname = 'block_' . $block->name() . '_edit_form';
         if (!class_exists($classname)) {
             $classname = 'block_edit_form';
         }
     } else {
         $classname = 'block_edit_form';
     }
     $mform = new $classname($editpage->url, $block, $this->page);
     $mform->set_data($block->instance);
     if ($mform->is_cancelled()) {
         redirect($this->page->url);
     } else {
         if ($data = $mform->get_data()) {
             $bi = new stdClass();
             $bi->id = $block->instance->id;
             $bi->pagetypepattern = $data->bui_pagetypepattern;
             if (empty($data->bui_subpagepattern) || $data->bui_subpagepattern == '%@NULL@%') {
                 $bi->subpagepattern = null;
             } else {
                 $bi->subpagepattern = $data->bui_subpagepattern;
             }
             $parentcontext = get_context_instance_by_id($data->bui_parentcontextid);
             $systemcontext = get_context_instance(CONTEXT_SYSTEM);
             // Updating stickiness and contexts.  See MDL-21375 for details.
             if (has_capability('moodle/site:manageblocks', $parentcontext)) {
                 // Check permissions in destination
                 // Explicitly set the context
                 $bi->parentcontextid = $parentcontext->id;
                 // If the context type is > 0 then we'll explicitly set the block as sticky, otherwise not
                 $bi->showinsubcontexts = (int) (!empty($data->bui_contexts));
                 // If the block wants to be system-wide, then explicitly set that
                 if ($data->bui_contexts == 2) {
                     // Only possible on a frontpage or system page
                     $bi->parentcontextid = $systemcontext->id;
                 } else {
                     // The block doesn't want to be system-wide, so let's ensure that
                     if ($parentcontext->id == $systemcontext->id) {
                         // We need to move it to the front page
                         $frontpagecontext = get_context_instance(CONTEXT_COURSE, SITEID);
                         $bi->parentcontextid = $frontpagecontext->id;
                         $bi->pagetypepattern = '*';
                         // Just in case
                     }
                 }
             }
             $bi->defaultregion = $data->bui_defaultregion;
             $bi->defaultweight = $data->bui_defaultweight;
             $DB->update_record('block_instances', $bi);
             if (!empty($block->config)) {
                 $config = clone $block->config;
             } else {
                 $config = new stdClass();
             }
             foreach ($data as $configfield => $value) {
                 if (strpos($configfield, 'config_') !== 0) {
                     continue;
                 }
                 $field = substr($configfield, 7);
                 $config->{$field} = $value;
             }
             $block->instance_config_save($config);
             $bp = new stdClass();
             $bp->visible = $data->bui_visible;
             $bp->region = $data->bui_region;
//.........这里部分代码省略.........
开发者ID:vuchannguyen,项目名称:web,代码行数:101,代码来源:blocklib.php

示例10: VARCHAR

        if (!empty($CFG->debug) and $CFG->debug >= DEBUG_DEVELOPER) {
            print_error('notlocalisederrormessage', 'error', '', $ex->__toString());
        } else {
            print_error('unexpectederror', 'block_sharing_cart', $returnurl);
        }
    }
}
$orderby = 'tree,weight,modtext';
if ($DB->get_dbfamily() == 'mssql' || $DB->get_dbfamily() == 'oracle') {
    // SQL Server and Oracle do not support ordering by TEXT field.
    $orderby = 'tree,weight,CAST(modtext AS VARCHAR(255))';
}
$items = $DB->get_records(sharing_cart\record::TABLE, array('userid' => $USER->id), $orderby);
$title = get_string('bulkdelete', 'block_sharing_cart');
$PAGE->set_pagelayout('standard');
$PAGE->set_url('/blocks/sharing_cart/bulkdelete.php', array('course' => $courseid));
$PAGE->set_title($title);
$PAGE->set_heading($title);
$PAGE->navbar->add(get_string('pluginname', 'block_sharing_cart'))->add($title, '');
echo $OUTPUT->header();
echo $OUTPUT->heading($title);
echo '
	<div style="width:100%; text-align:center;">';
if (empty($items)) {
    echo '
		<div>
			<input type="button" onclick="history.back();" value="', get_string('back'), '" />
		</div>';
} else {
    echo '
		<script type="text/javascript">
开发者ID:edurenye,项目名称:sharing_cart,代码行数:31,代码来源:bulkdelete.php


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