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


PHP blocks_execute_action函数代码示例

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


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

示例1: print_header

 /**
  * Prints the page header.
  */
 function print_header()
 {
     global $CFG, $USER, $PAGE;
     require_once $CFG->libdir . '/blocklib.php';
     require_once $CFG->dirroot . '/course/lib.php';
     require_once $CFG->dirroot . '/my/pagelib.php';
     /// My Moodle arguments:
     $edit = optional_param('edit', -1, PARAM_BOOL);
     $blockaction = optional_param('blockaction', '', PARAM_ALPHA);
     $mymoodlestr = get_string('mymoodle', 'my');
     if (isguest()) {
         $wwwroot = $CFG->wwwroot . '/login/index.php';
         if (!empty($CFG->loginhttps)) {
             $wwwroot = str_replace('http:', 'https:', $wwwroot);
         }
         print_header($mymoodlestr);
         notice_yesno(get_string('noguest', 'my') . '<br /><br />' . get_string('liketologin'), $wwwroot, $CFG->wwwroot);
         print_footer();
         die;
     }
     /// Add curriculum stylesheets...
     if (file_exists($CFG->dirroot . '/curriculum/styles.css')) {
         $CFG->stylesheets[] = $CFG->wwwroot . '/curriculum/styles.css';
     }
     /// Fool the page library into thinking we're in My Moodle.
     $CFG->pagepath = $CFG->wwwroot . '/my/index.php';
     $PAGE = page_create_instance($USER->id);
     if ($section = optional_param('section', '', PARAM_ALPHAEXT)) {
         $PAGE->section = $section;
     }
     $this->pageblocks = blocks_setup($PAGE, BLOCKS_PINNED_BOTH);
     /// Make sure that the curriculum block is actually on this
     /// user's My Moodle page instance.
     if ($cablockid = get_field('block', 'id', 'name', 'curr_admin')) {
         if (!record_exists('block_pinned', 'blockid', $cablockid, 'pagetype', 'my-index')) {
             blocks_execute_action($PAGE, $this->pageblocks, 'add', (int) $cablockid, true, false);
         }
     }
     if ($edit != -1 and $PAGE->user_allowed_editing()) {
         $USER->editing = $edit;
     }
     //$PAGE->print_header($mymoodlestr);
     $title = $this->get_title();
     print_header($title, $title, build_navigation($this->get_navigation()));
     echo '<table border="0" cellpadding="3" cellspacing="0" width="100%" id="layout-table">';
     echo '<tr valign="top">';
     $blocks_preferred_width = bounded_number(180, blocks_preferred_width($this->pageblocks[BLOCK_POS_LEFT]), 210);
     if (blocks_have_content($this->pageblocks, BLOCK_POS_LEFT) || $PAGE->user_is_editing()) {
         echo '<td style="vertical-align: top; width: ' . $blocks_preferred_width . 'px;" id="left-column">';
         blocks_print_group($PAGE, $this->pageblocks, BLOCK_POS_LEFT);
         echo '</td>';
     }
     echo '<td valign="top" id="middle-column">';
     if (blocks_have_content($this->pageblocks, BLOCK_POS_CENTRE) || $PAGE->user_is_editing()) {
         blocks_print_group($PAGE, $this->pageblocks, BLOCK_POS_CENTRE);
     }
 }
开发者ID:remotelearner,项目名称:elis.cm,代码行数:60,代码来源:newpage.class.php

示例2: blocks_execute_url_action

function blocks_execute_url_action(&$PAGE, &$pageblocks, $pinned = false)
{
    $blockaction = optional_param('blockaction', '', PARAM_ALPHA);
    if (empty($blockaction) || !$PAGE->user_allowed_editing() || !confirm_sesskey()) {
        return;
    }
    $instanceid = optional_param('instanceid', 0, PARAM_INT);
    $blockid = optional_param('blockid', 0, PARAM_INT);
    if (!empty($blockid)) {
        blocks_execute_action($PAGE, $pageblocks, strtolower($blockaction), $blockid, $pinned);
    } else {
        if (!empty($instanceid)) {
            $instance = blocks_find_instance($instanceid, $pageblocks);
            blocks_execute_action($PAGE, $pageblocks, strtolower($blockaction), $instance, $pinned);
        }
    }
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:17,代码来源:blocklib.php

示例3: object

                     $newcourse = new object();
                     $newcourse->id = $course->id;
                     $newcourse->marker = $value;
                     if (!update_record('course', $newcourse)) {
                         error_log('AJAX commands.php: Failed to update course marker for course ' . $newcourse->id);
                         die;
                     }
                     break;
             }
             break;
     }
     break;
 case 'DELETE':
     switch ($class) {
         case 'block':
             blocks_execute_action($PAGE, $pageblocks, 'delete', $blockinstance);
             break;
         case 'resource':
             if (!($cm = get_record('course_modules', 'id', $id, 'course', $course->id))) {
                 error_log('AJAX rest.php: Bad course module ID ' . $id);
                 die;
             }
             if (!($mod = get_record('modules', 'id', $cm->module))) {
                 error_log('AJAX rest.php: Bad module ID ' . $cm->module);
                 die;
             }
             $mod->name = clean_param($mod->name, PARAM_SAFEDIR);
             // For safety
             $modlib = "{$CFG->dirroot}/mod/{$mod->name}/lib.php";
             if (file_exists($modlib)) {
                 include_once $modlib;
开发者ID:r007,项目名称:PMoodle,代码行数:31,代码来源:rest.php

示例4: page_map_class

if (empty($CFG->adminblocks_initialised)) {
    require_once "{$CFG->dirroot}/{$CFG->admin}/pagelib.php";
    require_once $CFG->libdir . '/blocklib.php';
    page_map_class(PAGE_ADMIN, 'page_admin');
    $page = page_create_object(PAGE_ADMIN, 0);
    // there must be some id number
    blocks_repopulate_page($page);
    //add admin_tree block to site if not already present
    if ($admintree = get_record('block', 'name', 'admin_tree')) {
        $page = page_create_object(PAGE_COURSE_VIEW, SITEID);
        $pageblocks = blocks_get_by_page($page);
        blocks_execute_action($page, $pageblocks, 'add', (int) $admintree->id, false, false);
        if ($admintreeinstance = get_record('block_instance', 'pagetype', $page->type, 'pageid', SITEID, 'blockid', $admintree->id)) {
            $pageblocks = blocks_get_by_page($page);
            // Needs to be re-got, since has just changed
            blocks_execute_action($page, $pageblocks, 'moveleft', $admintreeinstance, false, false);
        }
    }
    set_config('adminblocks_initialised', 1);
}
/// Define the unique site ID code if it isn't already set. This getter does that as a side-effect.
get_site_identifier();
/// Check if the guest user exists.  If not, create one.
if (!record_exists("user", "username", "guest")) {
    if (!($guest = create_guest_record())) {
        notify("Could not create guest user record !!!");
    }
}
/// Set up the admin user
if (empty($CFG->rolesactive)) {
    build_context_path();
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:31,代码来源:index.php

示例5: bounded_number

if ($PAGE->user_allowed_editing()) {
    $editing = $PAGE->user_is_editing();
}
// Calculate the preferred width for left, right and center (both center positions will use the same)
$preferred_width_left = bounded_number(BLOCK_L_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), BLOCK_L_MAX_WIDTH);
$preferred_width_right = bounded_number(BLOCK_R_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), BLOCK_R_MAX_WIDTH);
// Display the blocks and allow blocklib to handle any block action requested
$pageblocks = blocks_get_by_page($PAGE);
if ($editing) {
    if (!empty($blockaction) && confirm_sesskey()) {
        if (!empty($blockid)) {
            blocks_execute_action($PAGE, $pageblocks, strtolower($blockaction), intval($blockid));
        } else {
            if (!empty($instanceid)) {
                $instance = blocks_find_instance($instanceid, $pageblocks);
                blocks_execute_action($PAGE, $pageblocks, strtolower($blockaction), $instance);
            }
        }
        // This re-query could be eliminated by judicious programming in blocks_execute_action(),
        // but I'm not sure if it's worth the complexity increase...
        $pageblocks = blocks_get_by_page($PAGE);
    }
    $missingblocks = blocks_get_missing($PAGE, $pageblocks);
}
if (!empty($tagid)) {
    $taginstance = get_record('tag', 'id', $tagid);
} elseif (!empty($tag)) {
    $taginstance = tag_id($tag);
}
/// navigations
/// site blogs - sitefullname -> blogs -> (?tag)
开发者ID:nagyistoce,项目名称:moodle-Teach-Pilot,代码行数:31,代码来源:header.php

示例6: page_map_class

    }
}
// initialise default blocks on admin and site page if needed
if (empty($CFG->adminblocks_initialised)) {
    require_once "{$CFG->dirroot}/{$CFG->admin}/pagelib.php";
    require_once $CFG->libdir . '/blocklib.php';
    page_map_class(PAGE_ADMIN, 'page_admin');
    $page = page_create_object(PAGE_ADMIN, 0);
    // there must be some id number
    blocks_repopulate_page($page);
    //add admin_tree block to site if not already present
    if ($admintree = get_record('block', 'name', 'admin_tree')) {
        $page = page_create_object(PAGE_COURSE_VIEW, SITEID);
        blocks_execute_action($page, blocks_get_by_page($page), 'add', (int) $admintree->id, false, false);
        if ($admintreeinstance = get_record('block_instance', 'pagetype', $page->type, 'pageid', SITEID, 'blockid', $admintree->id)) {
            blocks_execute_action($page, blocks_get_by_page($page), 'moveleft', $admintreeinstance, false, false);
        }
    }
    set_config('adminblocks_initialised', 1);
}
/// Define the unique site ID code if it isn't already
if (empty($CFG->siteidentifier)) {
    // Unique site identification code
    set_config('siteidentifier', random_string(32) . $_SERVER['HTTP_HOST']);
}
/// Check if the guest user exists.  If not, create one.
if (!record_exists("user", "username", "guest")) {
    if (!($guest = create_guest_record())) {
        notify("Could not create guest user record !!!");
    }
}
开发者ID:veritech,项目名称:pare-project,代码行数:31,代码来源:index.php

示例7: page_create_instance

    $CFG->stylesheets[] = $CFG->wwwroot . '/curriculum/styles.css';
}
/// Fool the page library into thinking we're in My Moodle.
$CFG->pagepath = $CFG->wwwroot . '/my/index.php';
$PAGE = page_create_instance($USER->id);
if ($section = optional_param('section', '', PARAM_ALPHAEXT)) {
    $PAGE->section = $section;
}
$pageblocks = blocks_setup($PAGE, BLOCKS_PINNED_BOTH);
/// Make sure that the curriculum block is actually on this user's My Moodle page instance.
if ($cablockid = get_field('block', 'id', 'name', 'curr_admin')) {
    //        if (!record_exists('block_instance', 'blockid', $cablockid, 'pageid', $USER->id,
    //                           'pagetype', 'my-index')) {
    if (!record_exists('block_pinned', 'blockid', $cablockid, 'pagetype', 'my-index')) {
        //print_object('cablockid: ' . $cablockid);
        blocks_execute_action($PAGE, $pageblocks, 'add', (int) $cablockid, true, false);
    }
}
if ($edit != -1 and $PAGE->user_allowed_editing()) {
    $USER->editing = $edit;
}
$PAGE->print_header($mymoodlestr);
echo '<table border="0" cellpadding="3" cellspacing="0" width="100%" id="layout-table">';
echo '<tr valign="top">';
$blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), 210);
if (blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $PAGE->user_is_editing()) {
    echo '<td style="vertical-align: top; width: ' . $blocks_preferred_width . 'px;" id="left-column">';
    blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
    echo '</td>';
}
echo '<td valign="top" id="middle-column">';
开发者ID:remotelearner,项目名称:elis.cm,代码行数:31,代码来源:mymoodlepagestart.php


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