XPressME Integration Kit

Trac

source: branches/Ver2.4/xpressme_integration_kit/blocks/category_block.php @ 829

Last change on this file since 829 was 495, checked in by toemon, 14 years ago

ブロックオプションでjavascriptの有効性チェック Fixes #274

File size: 4.0 KB
Line 
1<?php
2if( ! defined( 'XOOPS_ROOT_PATH' ) ) exit ;
3$mydirname = basename( dirname( dirname( __FILE__ ) ) ) ;
4
5eval( '
6function b_'.$mydirname.'_category_show($options){
7        return _b_category_show($options) ;
8}
9function b_'.$mydirname.'_category_edit($options){
10        return _b_category_edit($options) ;
11}
12' ) ;           
13       
14if( ! defined( 'XPRESS_CATEGORY_BLOCK_INCLUDED' ) ) {
15        define( 'XPRESS_CATEGORY_BLOCK_INCLUDED' , 1 ) ;
16
17        function _b_category_edit($options)
18        {
19
20                $mydirname = empty( $options[0] ) ? 'xpress' : $options[0] ;
21                $this_template = empty( $options[1] ) ? 'db:'.$mydirname.'_category_block.html' : trim( $options[1] );
22                $show_option_all = empty( $options[2] ) ? '' : $options[2] ;
23                $orderby = empty( $options[3] ) ? 'name' : $options[3] ;
24                $order = empty( $options[4] ) ? 'ASC' : $options[4] ;
25                $show_last_updated = empty( $options[5] ) ? false : true ;
26                $show_count = empty( $options[6] ) ? false : true ;
27                $hide_empty = empty( $options[7] ) ? false : true ;
28                $use_desc_for_title = empty( $options[8] ) ? false : true ;
29                $exclude = empty( $options[9] ) ? '' : $options[9] ;
30                $includes = empty( $options[10] ) ? '' : $options[10] ;
31                $hierarchical = empty( $options[11] ) ? false : true ;
32                $depth  = !is_numeric( $options[12] ) ? 0 : $options[12] ;
33               
34                require_once(XOOPS_ROOT_PATH.'/modules/'.$mydirname.'/blocks/block_common.php');       
35
36                $form  = javascript_check();
37                $form .= "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />\n";
38                $form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES));
39                $form .= "<br />";
40                $form .= _MB_XP2_CAT_ALL_STR . "  <input type='text' name='options[2]' value='" . $show_option_all . "' /><br />";
41                $form .= _MB_XP2_CAT_ORDERBY .": ";
42                $form .=  "<select name='options[3]'>";
43                if ($orderby =='name')
44                        $form .=  "<option value='name' selected='selected'>". _MB_XP2_CAT_NAME;
45                else
46                        $form .=  "<option value='name'>". _MB_XP2_CAT_NAME;
47                if ($orderby =='count')
48                        $form .=  "<option value='count' selected='selected'>". _MB_XP2_CAT_COUNT;
49                else
50                        $form .=  "<option value='count'>". _MB_XP2_CAT_COUNT;
51                if ($orderby =='ID')
52                        $form .=  "<option value='ID' selected='selected'>". _MB_XP2_CAT_ID;
53                else
54                        $form .=  "<option value='ID'>". _MB_XP2_CAT_ID;
55                $form .=  "</select><br/>";
56               
57                $form .= _MB_XP2_SORT_ORDER .": ";
58                $form .=  "<select name='options[4]'>";
59                if ($order =='ASC')
60                        $form .=  "<option value='ASC' selected='selected'>" . _MB_XP2_SORT_ASC;
61                else
62                        $form .=  "<option value='ASC'>" . _MB_XP2_SORT_ASC;
63                if ($order =='DESC')
64                        $form .=  "<option value='DESC' selected='selected'>" . _MB_XP2_SORT_DESC;
65                else
66                        $form .=  "<option value='DESC'>" . _MB_XP2_SORT_DESC;
67                $form .=  "</select><br/>";
68               
69                $form .= yes_no_radio_option('options[5]', _MB_XP2_SHOW_LAST_UPDATE , $show_last_updated) . "<br />" ;
70                $form .= yes_no_radio_option('options[6]', _MB_XP2_SHOW_NUM_OF_POST , $show_count) . "<br />" ;
71                $form .= yes_no_radio_option('options[7]', _MB_XP2_CAT_HIDE_EMPTY , $hide_empty) . "<br />" ;
72                $form .= yes_no_radio_option('options[8]', _MB_XP2_DESC_FOR_TITLE , $use_desc_for_title) . "<br />" ;
73                $form .= _MB_XP2_CAT_EXCLUDE . "  <input type='text' name='options[9]' value='" . $exclude . "' size ='60' /><br />";
74                $form .= _MB_XP2_CAT_INCLUDE . "  <input type='text' name='options[10]' value='" . $includes . "' size ='60' /><br />";
75                $form .= yes_no_radio_option('options[11]', _MB_XP2_CAT_HIERARCHICAL , $hierarchical) . "<br />" ;
76                $form .= _MB_XP2_CAT_DEPTH . "  <input type='text' name='options[12]' value='" . $depth . "' size ='8' /><br />";
77                return $form;
78        }
79       
80        function _b_category_show($options)
81        {
82                $mydirname = empty( $options[0] ) ? 'xpress' : $options[0] ;
83                $mydirpath = XOOPS_ROOT_PATH . '/modules/' . $mydirname;
84                $block_function_name = basename( __FILE__ );
85               
86                require_once $mydirpath.'/include/xpress_block_render.php';
87                return xpress_block_render($mydirname,$block_function_name,$options);
88        }
89       
90}
91
92?>
Note: See TracBrowser for help on using the repository browser.