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


PHP blocks_preferred_width函数代码示例

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


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

示例1: print_simple_box

                } else {
                    $courses[$c->id]->lastaccess = 0;
                }
            }
            if (empty($courses)) {
                print_simple_box(get_string('nocourses', 'my'), 'center');
            } else {
                print_overview($courses);
            }
            // if more than 20 courses
            if (count($courses) > 20) {
                echo '<br />...';
            }
            print_container_end();
            echo '</td>';
            break;
        case 'right':
            $blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), 210);
            if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $PAGE->user_is_editing()) {
                echo '<td style="vertical-align: top; width: ' . $blocks_preferred_width . 'px;" id="right-column">';
                print_container_start();
                blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
                print_container_end();
                echo '</td>';
            }
            break;
    }
}
/// Finish the page
echo '</tr></table>';
print_footer();
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:31,代码来源:index.php

示例2: add_to_log

if (!empty($USER->id)) {
    add_to_log(SITEID, 'course', 'view', 'view.php?id=' . SITEID, SITEID);
}
if (empty($CFG->langmenu)) {
    $langmenu = '';
} else {
    $currlang = current_language();
    $langs = get_list_of_languages();
    $langlabel = get_accesshide(get_string('language'));
    $langmenu = popup_form($CFG->wwwroot . '/index.php?lang=', $langs, 'chooselang', $currlang, '', '', '', true, 'self', $langlabel);
}
$PAGE = page_create_object(PAGE_COURSE_VIEW, SITEID);
$pageblocks = blocks_setup($PAGE);
$editing = $PAGE->user_is_editing();
$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);
print_header($SITE->fullname, $SITE->fullname, 'home', '', '<meta name="description" content="' . strip_tags(format_text($SITE->summary, FORMAT_HTML)) . '" />', true, '', user_login_string($SITE) . $langmenu);
?>


<table id="layout-table" summary="layout">
  <tr>
  <?php 
$lt = empty($THEME->layouttable) ? array('left', 'middle', 'right') : $THEME->layouttable;
foreach ($lt as $column) {
    switch ($column) {
        case 'left':
            if (blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $editing) {
                echo '<td style="width: ' . $preferred_width_left . 'px;" id="left-column">';
                print_container_start();
                blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
开发者ID:nagyistoce,项目名称:moodle-Teach-Pilot,代码行数:31,代码来源:index.php

示例3: display_course_blocks_end

 /**
  * Finish displaying the resource with the course blocks
  */
 function display_course_blocks_end()
 {
     global $CFG;
     global $THEME;
     $PAGE = $this->PAGE;
     $pageblocks = blocks_setup($PAGE);
     $blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), 210);
     $lt = empty($THEME->layouttable) ? array('left', 'middle', 'right') : $THEME->layouttable;
     foreach ($lt as $column) {
         if ($column != 'middle') {
             array_shift($lt);
         } else {
             if ($column == 'middle') {
                 break;
             }
         }
     }
     foreach ($lt as $column) {
         switch ($column) {
             case 'left':
                 if (blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $PAGE->user_is_editing()) {
                     echo '<td style="width: ' . $blocks_preferred_width . 'px;" id="left-column">';
                     print_container_start();
                     blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
                     print_container_end();
                     echo '</td>';
                 }
                 break;
             case 'middle':
                 echo '</div>';
                 print_container_end();
                 echo '</td>';
                 break;
             case 'right':
                 if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $PAGE->user_is_editing()) {
                     echo '<td style="width: ' . $blocks_preferred_width . 'px;" id="right-column">';
                     print_container_start();
                     blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
                     print_container_end();
                     echo '</td>';
                 }
                 break;
         }
     }
     echo '</tr></table>';
     print_footer($this->course);
 }
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:50,代码来源:lib.php

示例4: print_footer

 /**
  * Prints the page footer.
  */
 public function print_footer()
 {
     global $PAGE;
     // Can only register if not logged in...
     echo '</td>';
     $blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), 210);
     if (blocks_have_content($this->pageblocks, BLOCK_POS_RIGHT) || $PAGE->user_is_editing()) {
         echo '<td style="vertical-align: top; width: ' . $blocks_preferred_width . 'px;" id="right-column">';
         blocks_print_group($PAGE, $this->pageblocks, BLOCK_POS_RIGHT);
         echo '</td>';
     }
     /// Finish the page
     echo '</tr></table>';
     print_footer();
 }
开发者ID:benavidesrobert,项目名称:elis.base,代码行数:18,代码来源:page.class.php

示例5: page_print_position

/**
 * Prints blocks for a given position
 *
 * @param array $pageblocks An array of blocks organized by position
 * @param char $position Position that we are currently printing
 * @return void
 **/
function page_print_position($pageblocks, $position, $width)
{
    global $PAGE, $THEME;
    $editing = $PAGE->user_is_editing();
    /// Figure out an appropriate ID
    switch ($position) {
        case BLOCK_POS_LEFT:
            $id = 'left';
            break;
        case BLOCK_POS_RIGHT:
            $id = 'right';
            break;
        case BLOCK_POS_CENTER:
            $id = 'middle';
            break;
        default:
            $id = $position;
            break;
    }
    /// Figure out the width - more for routine than being functional.  May want to impose a minimum width though
    $width = bounded_number($width, blocks_preferred_width($pageblocks[$position]), $width);
    $widthstyle = "";
    if ($width > 1) {
        $widthstyle = 'style="width: ' . $width . 'px"';
    }
    if ($editing || blocks_have_content($pageblocks, $position)) {
        /// Print it
        echo "<td {$widthstyle} id=\"{$id}-column\">";
        print_spacer(1, $width, false);
        if (!empty($THEME->roundcorners)) {
            echo '<div class="bt"><div></div></div>';
            echo '<div class="i1"><div class="i2"><div class="i3">';
        }
        page_blocks_print_group($pageblocks, $position);
        if (!empty($THEME->roundcorners)) {
            echo '</div></div></div>';
            echo '<div class="bb"><div></div></div>';
        }
        echo '</td>';
    } else {
        // just print space to keep width consistent
        echo "<td {$widthstyle} id=\"{$id}-column\">";
        print_spacer(1, $width, false);
        echo "</td>";
    }
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:53,代码来源:lib.php

示例6: array

// for choose_from_menu
$options = array();
foreach ($pagetypes as $p) {
    $options[$p['id']] = $p['name'];
}
require_login();
require_capability('moodle/site:manageblocks', get_context_instance(CONTEXT_SYSTEM, SITEID));
// first thing to do is print the dropdown menu
$strtitle = get_string('stickyblocks', 'admin');
$strheading = get_string('adminhelpstickyblocks');
if (!empty($pt)) {
    require_once $CFG->dirroot . $pagetypes[$pt]['lib'];
    define('ADMIN_STICKYBLOCKS', $pt);
    $PAGE = page_create_object($pt, SITEID);
    $blocks = blocks_setup($PAGE, BLOCKS_PINNED_TRUE);
    $blocks_preferred_width = bounded_number(180, blocks_preferred_width($blocks[BLOCK_POS_LEFT]), 210);
    $navlinks = array(array('name' => get_string('administration'), 'link' => "{$CFG->wwwroot}/{$CFG->admin}/index.php", 'type' => 'misc'));
    $navlinks[] = array('name' => $strtitle, 'link' => null, 'type' => 'misc');
    $navigation = build_navigation($navlinks);
    print_header($strtitle, $strtitle, $navigation);
    echo '<table border="0" cellpadding="3" cellspacing="0" width="100%" id="layout-table">';
    echo '<tr valign="top">';
    echo '<td valign="top" style="width: ' . $blocks_preferred_width . 'px;" id="left-column">';
    if (!empty($THEME->customcorners)) {
        print_custom_corners_start();
    }
    blocks_print_group($PAGE, $blocks, BLOCK_POS_LEFT);
    if (!empty($THEME->customcorners)) {
        print_custom_corners_end();
    }
    echo '</td>';
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:31,代码来源:stickyblocks.php

示例7: display_course_blocks_end

 /**
  * Finish displaying the resource with the course blocks
  */
 function display_course_blocks_end()
 {
     global $CFG;
     $PAGE = $this->PAGE;
     $pageblocks = blocks_setup($PAGE);
     $blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), 210);
     echo '</div>';
     if (!empty($THEME->customcorners)) {
         print_custom_corners_end();
     }
     echo '</td>';
     if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $PAGE->user_is_editing()) {
         echo '<td style="width: ' . $blocks_preferred_width . 'px;" id="right-column">';
         if (!empty($THEME->customcorners)) {
             print_custom_corners_start();
         }
         blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
         if (!empty($THEME->customcorners)) {
             print_custom_corners_end();
         }
         echo '</td>';
     }
     echo '</tr></table>';
     print_footer($this->course);
 }
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:28,代码来源:lib.php

示例8: wiki_footer

function wiki_footer()
{
    global $COURSE, $CFG;
    ///document	ending
    $PAGE = wiki_page_info('PAGE');
    $pageblocks = wiki_page_info('pageblocks');
    $editing = $PAGE->user_is_editing();
    wiki_table_end();
    /// The right column
    //if there are not blocks on the right part then don't enter in this condition
    if (!empty($pageblocks[BLOCK_POS_RIGHT])) {
        //to work out the default widths need to check all blocks
        $preferred_width_right = optional_param('preferred_width_right', blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), PARAM_INT);
        //preferred_width_right sizes
        //should be between BLOCK_x_MAX_WIDTH and BLOCK_x_MIN_WIDTH.
        $preferred_width_right = min($preferred_width_right, BLOCK_R_MAX_WIDTH);
        $preferred_width_right = max($preferred_width_right, BLOCK_R_MIN_WIDTH);
    }
    //if there are blocks on the right part, then they are placed
    if (!empty($pageblocks[BLOCK_POS_RIGHT])) {
        //checks if there are blocks to place on the right-hand side
        if (!empty($CFG->showblocksonmodpages) && (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $editing)) {
            $prop = new stdClass();
            $prop->id = "right-column";
            $prop->class = "blockcourse";
            wiki_change_column($prop);
            $prop = new stdClass();
            $prop->width = $preferred_width_right . 'px';
            wiki_table_start($prop);
            blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
            wiki_table_end();
            $prop = new stdClass();
        }
    }
    wiki_table_end();
    // select the teacher
    $cm = wiki_param('cm');
    $dfwiki = wiki_param('dfwiki');
    wiki_print_teacher_selection($cm, $dfwiki);
    wiki_div_end();
    // content wrapper end
    /// Finish the page
    print_footer($COURSE);
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:44,代码来源:web.lib.php

示例9: tao_local_header_hook

/**
* hook function from inside the theme.
* in this case, detect lack of $PAGE and do a horrible hack
* to get a consistent page format.
*/
function tao_local_header_hook()
{
    global $CFG;
    require_once $CFG->libdir . '/blocklib.php';
    require_once $CFG->libdir . '/pagelib.php';
    global $PAGE;
    if (!empty($PAGE)) {
        return true;
    }
    if (defined('ADMIN_STICKYBLOCKS')) {
        return true;
    }
    if (optional_param('inpopup')) {
        return true;
    }
    $lmin = empty($THEME->block_l_min_width) ? 100 : $THEME->block_l_min_width;
    $lmax = empty($THEME->block_l_max_width) ? 210 : $THEME->block_l_max_width;
    $rmin = empty($THEME->block_r_min_width) ? 100 : $THEME->block_r_min_width;
    $rmax = empty($THEME->block_r_max_width) ? 210 : $THEME->block_r_max_width;
    !defined('BLOCK_L_MIN_WIDTH') && define('BLOCK_L_MIN_WIDTH', $lmin);
    !defined('BLOCK_L_MAX_WIDTH') && define('BLOCK_L_MAX_WIDTH', $lmax);
    !defined('BLOCK_R_MIN_WIDTH') && define('BLOCK_R_MIN_WIDTH', $rmin);
    !defined('BLOCK_R_MAX_WIDTH') && define('BLOCK_R_MAX_WIDTH', $rmax);
    $PAGE = new tao_page_class_hack();
    $pageblocks = blocks_setup($PAGE, true);
    // we could replace this with a stickyblocks implementation, this is a proof of concept.
    $preferred_width_left = bounded_number(BLOCK_L_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), BLOCK_L_MAX_WIDTH);
    echo '<table id="layout-table" summary="layout">
      <tr>
    ';
    echo '<td style="width: ' . $preferred_width_left . 'px;" id="left-column">';
    ob_start();
    blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
    $blockscontent = ob_get_clean();
    if (!$blockscontent) {
        $rec = (object) array('id' => 0, 'blockid' => 0, 'pageid' => 0, 'pagetype' => tao_page_class_hack::get_type(), 'position' => BLOCK_POS_LEFT, 'visible' => true, 'configdata' => '', 'weight' => 0);
        $pageblocks = array(BLOCK_POS_LEFT => array(0 => $rec));
        $pageblocks[BLOCK_POS_LEFT][0]->rec = $rec;
        $pageblocks[BLOCK_POS_LEFT][0]->obj = new tao_dummy_block($rec);
        blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
    } else {
        echo $blockscontent;
    }
    echo '</td>';
    echo '<td id="middle-column">';
    define('TAO_HEADER_OVERRIDDEN', 1);
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:52,代码来源:tao.php

示例10: page_print_position

/**
 * Prints blocks for a given position
 *
 * @param array $pageblocks An array of blocks organized by position
 * @param char $position Position that we are currently printing
 * @return void
 **/
function page_print_position($pageblocks, $position, $width)
{
    global $PAGE, $THEME;
    $editing = $PAGE->user_is_editing();
    if ($editing || blocks_have_content($pageblocks, $position)) {
        /// Figure out an appropriate ID
        switch ($position) {
            case BLOCK_POS_LEFT:
                $id = 'left';
                break;
            case BLOCK_POS_RIGHT:
                $id = 'right';
                break;
            case BLOCK_POS_CENTER:
                $id = 'middle';
                break;
            default:
                $id = $position;
                break;
        }
        /// Figure out the width - more for routine than being functional.  May want to impose a minimum width though
        $width = bounded_number($width, blocks_preferred_width($pageblocks[$position]), $width);
        /// Print it
        if (is_numeric($width)) {
            // default to px  MR-263
            $tdwidth = $width . 'px';
        } else {
            $tdwidth = $width;
        }
        echo "<td style=\"width: {$tdwidth}\" id=\"{$id}-column\">";
        if (is_numeric($width) or strpos($width, 'px')) {
            print_spacer(1, $width, false);
        }
        print_container_start();
        if ($position == BLOCK_POS_CENTER) {
            echo skip_main_destination();
            page_frontpage_settings();
        }
        page_blocks_print_group($pageblocks, $position);
        print_container_end();
        echo '</td>';
    } else {
        // Empty column - no class, style or width
        /// Figure out an appropriate ID
        switch ($position) {
            case BLOCK_POS_LEFT:
                $id = 'left';
                break;
            case BLOCK_POS_RIGHT:
                $id = 'right';
                break;
            case BLOCK_POS_CENTER:
                $id = 'middle';
                break;
            default:
                $id = $position;
                break;
        }
        // we still want to preserve values unles
        if ($width != '0') {
            if (is_numeric($width)) {
                // default to px  MR-263
                $tdwidth = $width . 'px';
            } else {
                $tdwidth = $width;
            }
            echo '<td style="width:' . $tdwidth . '" id="' . $id . '-column" > ';
            if ($width != '0' and is_numeric($width) or strpos($width, 'px')) {
                print_spacer(1, $width, false);
            }
            echo "</td>";
        } else {
            echo '<td></td>';
            // 0 means no column anyway
        }
    }
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:84,代码来源:lib.php

示例11: admin_externalpage_print_footer

function admin_externalpage_print_footer($adminroot)
{
    global $CFG, $PAGE, $SITE, $THEME;
    if (!empty($SITE->fullname)) {
        $pageblocks = blocks_setup($PAGE);
        $preferred_width_right = bounded_number(BLOCK_R_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), BLOCK_R_MAX_WIDTH);
        $lt = empty($THEME->layouttable) ? array('left', 'middle', 'right') : $THEME->layouttable;
        foreach ($lt as $column) {
            if ($column != 'middle') {
                array_shift($lt);
            } else {
                if ($column == 'middle') {
                    break;
                }
            }
        }
        foreach ($lt as $column) {
            switch ($column) {
                case 'left':
                    echo '<td style="width: ' . $preferred_width_left . 'px;" id="left-column">';
                    if (!empty($THEME->customcorners)) {
                        print_custom_corners_start();
                    }
                    blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
                    if (!empty($THEME->customcorners)) {
                        print_custom_corners_end();
                    }
                    echo '</td>';
                    break;
                case 'middle':
                    if (!empty($THEME->customcorners)) {
                        print_custom_corners_end();
                    }
                    echo '</td>';
                    break;
                case 'right':
                    if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT)) {
                        echo '<td style="width: ' . $preferred_width_right . 'px;" id="right-column">';
                        if (!empty($THEME->customcorners)) {
                            print_custom_corners_start();
                        }
                        blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
                        if (!empty($THEME->customcorners)) {
                            print_custom_corners_end();
                        }
                        echo '</td>';
                    }
                    break;
            }
        }
        echo '</tr></table>';
    }
    print_footer();
}
开发者ID:veritech,项目名称:pare-project,代码行数:54,代码来源:adminlib.php

示例12: sesskey

    // ---------------------------------------------------------------------------------------------------------------
    echo '<form action="settings.php" method="post" id="adminsettings">';
    echo '<div class="settingsform clearfix">';
    echo $PAGE->url->hidden_params_out();
    echo '<input type="hidden" name="sesskey" value="' . sesskey() . '" />';
    echo '<input type="hidden" name="return" value="' . $return . '" />';
    echo $settingspage->output_html();
    echo '<div class="form-buttons"><input class="form-submit" type="submit" value="' . get_string('savechanges', 'admin') . '" /></div>';
    echo '</div>';
    echo '</form>';
} else {
    // Note: MDL-19010 there will be further changes to printing header and blocks.
    // The code will be much nicer than this eventually.
    $pageblocks = blocks_setup($PAGE);
    $preferred_width_left = blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]);
    $preferred_width_right = blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]);
    if ($PAGE->user_allowed_editing()) {
        $options = $PAGE->url->params();
        if ($PAGE->user_is_editing()) {
            $caption = get_string('blockseditoff');
            $options['adminedit'] = 'off';
        } else {
            $caption = get_string('blocksediton');
            $options['adminedit'] = 'on';
        }
        $buttons = print_single_button($PAGE->url->out(false), $options, $caption, 'get', '', true);
    }
    $visiblepathtosection = array_reverse($settingspage->visiblepath);
    $navlinks = array();
    foreach ($visiblepathtosection as $element) {
        $navlinks[] = array('name' => $element, 'link' => null, 'type' => 'misc');
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:31,代码来源:settings.php


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