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


PHP block::custom_types方法代码示例

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


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

示例1: run


//.........这里部分代码省略.........
                    $out = block_groups_list();
                } else {
                    $layout->navigate_notification(t(56, 'Unexpected error.'), false);
                    $out = block_group_form($item);
                }
                users_log::action($_REQUEST['fid'], $item->id, 'remove', $item->title);
            }
            break;
        case 'block_types_list':
            $out = blocks_types_list();
            break;
        case 'block_types_json':
            // block types: json data retrieval
            $page = intval($_REQUEST['page']);
            $max = intval($_REQUEST['rows']);
            $offset = ($page - 1) * $max;
            $rs = block::types($_REQUEST['sidx'], $_REQUEST['sord']);
            $block_modes = block::modes();
            // translate $rs to an array of ordered fields
            foreach ($rs as $row) {
                $dataset[] = array('id' => $row['id'], 'type' => $block_modes[$row['type']], 'code' => $row['code'], 'title' => $row['title'], 'width' => $row['width'], 'height' => $row['height']);
            }
            $total = count($dataset);
            navitable::jqgridJson($dataset, $page, $offset, $max, $total, 'id');
            session_write_close();
            exit;
            break;
        case 'block_type_edit':
        case 82:
            // edit/create block type
            $item = NULL;
            $position = NULL;
            $max_id = 0;
            $dataset = block::custom_types();
            for ($i = 0; $i < count($dataset); $i++) {
                if ($dataset[$i]['id'] > $max_id) {
                    $max_id = $dataset[$i]['id'];
                }
                if ($dataset[$i]['id'] == $_REQUEST['id']) {
                    $item = $dataset[$i];
                    $position = $i;
                }
            }
            if (empty($item)) {
                $layout->navigate_notification(t(599, "Sorry, can't display a theme block type info."));
                $out = blocks_types_list();
            } else {
                if (isset($_REQUEST['form-sent'])) {
                    if (empty($item)) {
                        $item = array('id' => $max_id + 1);
                    }
                    $item['type'] = $_REQUEST['type'];
                    $item['title'] = $_REQUEST['title'];
                    $item['code'] = $_REQUEST['code'];
                    $item['width'] = $_REQUEST['width'];
                    $item['height'] = $_REQUEST['height'];
                    $item['order'] = $_REQUEST['order'];
                    $item['maximum'] = $_REQUEST['maximum'];
                    $item['notes'] = pquotes($_REQUEST['notes']);
                    if (!is_null($position)) {
                        $dataset[$position] = $item;
                    } else {
                        $dataset[] = $item;
                    }
                    try {
                        // save
开发者ID:NavigateCMS,项目名称:Navigate-CMS,代码行数:67,代码来源:blocks.php

示例2: types

 public static function types($orderby = 'id', $asc = 'asc')
 {
     global $theme;
     global $DB;
     global $website;
     $data = block::custom_types();
     // retrieve block types from theme
     $theme_blocks = json_decode(json_encode($theme->blocks), true);
     if (!is_array($theme_blocks)) {
         $theme_blocks = array();
     } else {
         // retrieve more info for each block (title translation and block count)
         for ($b = 0; $b < count($theme_blocks); $b++) {
             $theme_blocks[$b]['title'] = $theme->t($theme_blocks[$b]['title']);
             $theme_blocks[$b]['count'] = $DB->query_single('COUNT(*) AS total', 'nv_blocks', ' website = ' . $website->id . ' AND 
                   type = ' . protect($theme_blocks[$b]['id']));
         }
     }
     if (!is_array($data)) {
         $data = array();
     }
     $data = array_merge($data, $theme_blocks);
     // Navigate 1.6.6 compatibility (before title/code separation)
     for ($d = 0; $d < count($data); $d++) {
         if (function_exists($theme->t)) {
             $data[$d]['title'] = $theme->t($data[$d]['title']);
         }
         if (empty($data[$d]['code'])) {
             $data[$d]['code'] = $data[$d]['title'];
         }
         if (empty($data[$d]['type'])) {
             $data[$d]['type'] = 'block';
         }
     }
     // Obtain a list of columns
     if (!is_array($data)) {
         $data = array();
     }
     $order = array();
     foreach ($data as $key => $row) {
         $order[$key] = $row[$orderby];
     }
     // Sort the data with volume descending, edition ascending
     // $data as the last parameter, to sort by the common key
     array_multisort($order, $asc == 'asc' ? SORT_ASC : SORT_DESC, $data);
     /*
         $x[] = array( 'id'		=> 1,
                       'title'	=> 'test',
                       'code'    => 'codename',
                       'width'	=> 200,
                       'height'	=> 50,
                       'order'	=> 'theme',
                       'maximum' => 3
                     );
     
         $x = serialize($x);
         var_dump($x);
     */
     return $data;
 }
开发者ID:NavigateCMS,项目名称:Navigate-CMS,代码行数:60,代码来源:block.class.php


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