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


PHP block::extension_block方法代码示例

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


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

示例1: block_group_extension_block_options

function block_group_extension_block_options($block_group, $block_extension, $block_id, $block_uid, $status)
{
    global $layout;
    global $website;
    global $theme;
    if (empty($block_extension)) {
        throw new Exception("Unknown extension: {" . $block_extension . "} for block with uid:" . $block_uid);
    }
    $extension = new extension();
    $extension->load($block_extension);
    $block = block::extension_block($extension, $block_id);
    $properties = $block->properties;
    if (empty($properties)) {
        return;
    }
    $layout = null;
    $layout = new layout('navigate');
    if ($status !== null) {
        if ($status) {
            $layout->navigate_notification(t(53, "Data saved successfully."), false, false, 'fa fa-check');
        } else {
            $layout->navigate_notification(t(56, "Unexpected error"), true, true);
        }
    }
    $navibars = new navibars();
    $naviforms = new naviforms();
    $navibars->title(t(437, 'Block') . ' [' . $block_extension . ' / ' . $block_id . ']');
    $layout->navigate_media_browser();
    // we can use media browser in this function
    $navibars->add_actions(array('<a href="#" onclick="javascript: navigate_media_browser();">
                <img height="16" align="absmiddle" width="16" src="img/icons/silk/images.png"> ' . t(36, 'Media') . '</a>'));
    $navibars->add_actions(array('<a href="#" onclick="navigate_tabform_submit(0);">
                <img height="16" align="absmiddle" width="16" src="img/icons/silk/accept.png"> ' . t(34, 'Save') . '</a>'));
    $navibars->form();
    $navibars->add_tab(t(200, 'Options'));
    $navibars->add_tab_content($naviforms->hidden('form-sent', 'true'));
    // show a language selector (only if it's a multi language website)
    if (count($website->languages) > 1) {
        $website_languages_selector = $website->languages();
        $website_languages_selector = array_merge(array('' => '(' . t(443, 'All') . ')'), $website_languages_selector);
        $navibars->add_tab_content_row(array('<label>' . t(63, 'Languages') . '</label>', $naviforms->buttonset('language_selector', $website_languages_selector, '', "navigate_tabform_language_selector(this);")));
    }
    $properties_values = property::load_properties(NULL, $block_id, "extension_block", $block_group, $block_uid);
    foreach ($properties as $option) {
        $property = new property();
        $property_value = '';
        foreach ($properties_values as $pv) {
            if ($pv->id == $option->id) {
                $property_value = $pv->value;
            }
        }
        $property->load_from_object($option, $property_value, $extension);
        if ($property->type == 'tab') {
            $navibars->add_tab($property->name);
            if (count($website->languages) > 1) {
                $website_languages_selector = $website->languages();
                $website_languages_selector = array_merge(array('' => '(' . t(443, 'All') . ')'), $website_languages_selector);
                $navibars->add_tab_content_row(array('<label>' . t(63, 'Languages') . '</label>', $naviforms->buttonset('language_selector', $website_languages_selector, '', "navigate_tabform_language_selector(this);")));
            }
        }
        $navibars->add_tab_content(navigate_property_layout_field($property, $extension));
    }
    $layout->add_content('<div id="navigate-content" class="navigate-content ui-corner-all">' . $navibars->generate() . '</div>');
    navigate_property_layout_scripts();
    $layout->navigate_additional_scripts();
    $layout->add_script('
        $("html").css("background", "transparent");
    ');
    $out = $layout->generate();
    return $out;
}
开发者ID:NavigateCMS,项目名称:Navigate-CMS,代码行数:71,代码来源:blocks.php

示例2: nvweb_list


//.........这里部分代码省略.........
        $total = $DB->foundRows();
    }
    // now we have all elements that will be shown in the list
    // let's apply the nvlist template to each one
    for ($i = 0; $i < count($rs); $i++) {
        // ignore empty objects
        if ($vars['source'] != 'gallery' && empty($rs[$i]->id) || $vars['source'] == 'gallery' && empty($rs[$i]['file'])) {
            continue;
        }
        // prepare a standard  $item  with the current element
        if ($vars['source'] == 'comments' || $vars['source'] == 'comment') {
            $item = $rs[$i];
        } else {
            if ($vars['source'] == 'structure' || $vars['source'] == 'category') {
                $item = new structure();
                $item->load($rs[$i]->id);
                $item->date_to_display = $rs[$i]->pdate;
            } else {
                if ($vars['source'] == 'rss' || $vars['source'] == 'twitter' || $vars['source'] == 'block_link') {
                    // item is virtually created
                    $item = $rs[$i];
                } else {
                    if ($vars['source'] == 'block' || $vars['source'] == 'block_group') {
                        if (get_class($rs[$i]) == 'block') {
                            // standard block
                            $item = $rs[$i];
                        } else {
                            if (isset($rs[$i]->_object_type) && $rs[$i]->_object_type == "block_group_block_type") {
                                // block type definition (mainly used to add a title before a list of blocks of the same type)
                                $item = $rs[$i];
                            } else {
                                if (isset($rs[$i]->extension)) {
                                    // extension block
                                    $item = block::extension_block($rs[$i]->extension, $rs[$i]->id);
                                    $item->type = "extension";
                                    $item->extension = $rs[$i]->extension;
                                    $item->uid = $rs[$i]->uid;
                                } else {
                                    // block from block group
                                    $item = new block();
                                    $item->load_from_block_group($vars['type'], $rs[$i]->id, $rs[$i]->uid);
                                }
                            }
                        }
                    } else {
                        if ($vars['source'] == 'gallery') {
                            $item = $rs[$i];
                        } else {
                            $item = new item();
                            $item->load($rs[$i]->id);
                            // if the item comes from a custom source, save the original query result
                            // this allows getting a special field without extra work ;)
                            $item->_query = $rs[$i];
                        }
                    }
                }
            }
        }
        // get the nv list template
        $item_html = $vars['template'];
        // first we need to isolate the nested nv lists/searches
        unset($nested_lists_fragments);
        list($item_html, $nested_lists_fragments) = nvweb_list_isolate_lists($item_html);
        // now, parse the nvlist_conditional tags (with html source code inside (and other nvlist tags))
        unset($nested_condition_fragments);
        list($item_html, $nested_conditional_fragments) = nvweb_list_isolate_conditionals($item_html);
开发者ID:NavigateCMS,项目名称:Navigate-CMS,代码行数:67,代码来源:list.php


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