XPressME Integration Kit

Trac

source: trunk/blocks/popular_posts_block.php @ 118

Last change on this file since 118 was 109, checked in by toemon, 16 years ago

カレンダーブロック、人気記事リストの実装、インデックスページテンプレート実装

File size: 2.4 KB
Line 
1<?php
2if( ! defined( 'XOOPS_ROOT_PATH' ) ) exit ;
3$mydirname = basename( dirname( dirname( __FILE__ ) ) ) ;
4
5eval( '
6function b_'.$mydirname.'_popular_show($options){
7        return _b_popular_show($options) ;
8}
9function b_'.$mydirname.'_popular_edit($options){
10        return _b_popular_edit($options) ;
11}
12' ) ;
13
14if( ! defined( 'XPRESS_POPULAR_BLOCK_INCLUDED' ) ) {
15        define( 'XPRESS_POPULAR_BLOCK_INCLUDED' , 1 ) ;
16        function _b_popular_edit($options)
17        {
18                $mydirname = empty( $options[0] ) ? 'xpress' : $options[0] ;
19                $disp_count = empty( $options[1] ) ? '10' : $options[1] ;
20                $show_month_range = empty( $options[2] ) ? '0' : $options[2] ;
21                $tag_select = $options[3] ;
22                $selected = array_slice($options, 4); // get allowed cats
23                $this_template = empty( $options[5] ) ? 'db:'.$mydirname.'_block_popular.html' : trim( $options[5] );
24                $mydirpath = XOOPS_ROOT_PATH . '/modules/' . $mydirname;
25               
26                require_once(XOOPS_ROOT_PATH.'/modules/'.$mydirname.'/blocks/block_common.php');
27
28                $form  = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />\n";
29                $form .= _MB_XPRESS_COUNT .": <input type='text' name='options[1]' value='" . $disp_count . "' /><br />\n";
30                $form .= _MB_MONTH_RANGE .": <input type='text' name='options[2]' value='" . $show_month_range . "' /><br />\n";
31                $form .= "<br />\n";
32
33                $form .= _MB_XPRESS_TAGS_SELECT .": <input type='text' name='options[3]' value='" . $tag_select . "' /><br />\n";       
34            $form .= _MB_XPRESS_CATS_SELECT ."<br />\n";
35            $isAll = (count($selected)==0||empty($selected[0]))?true:false;
36            $form .= "<br />&nbsp;&nbsp;<select name=\"options[]\" multiple=\"multiple\">";
37            $form .= "<option value=\"0\" ";
38            if ($isAll) $form .= " selected=\"selected\"";
39            $form .= ">"._MB_XPRESS_ALL ."</option>";
40                ob_start();
41                dropdown_cats_options('ID','asc',$selected);
42                $list_str = ob_get_contents();
43                ob_end_clean();
44            $form .= $list_str. "</select><br />";
45//          $form .="<br /><input type='text' size='60' name='options[5]' value='".htmlspecialchars($this_template,ENT_QUOTES)."' />";
46
47                return $form;
48        }
49
50        function _b_popular_show($options)
51        {
52                $mydirname = empty( $options[0] ) ? 'xpress' : $options[0] ;
53                $mydirpath = XOOPS_ROOT_PATH . '/modules/' . $mydirname;
54                $block_function_name = basename( __FILE__ );
55               
56                require_once $mydirpath.'/include/xpress_block_render.php';
57                return xpress_block_render($mydirname,$block_function_name,$options);
58        }
59}
60?>
Note: See TracBrowser for help on using the repository browser.