XPressME Integration Kit

Trac

source: trunk/blocks/recent_posts_content_block.php @ 103

Last change on this file since 103 was 100, checked in by toemon, 16 years ago

「最近の記事」ブロックの実装

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