HtmlTemplateFramework
[
class tree: HtmlTemplateFramework
] [
index: HtmlTemplateFramework
] [
all elements
]
Packages:
HtmlTemplateFramework
Source for file htf_tlb_sample_hp_rightmenu.phl
Documentation is available at
htf_tlb_sample_hp_rightmenu.phl
<?php
/**
* htf_tlb_sample_hp_rightmenuクラス
*
* HP右メニュー生成クラス(サンプル用)
*
*
@package
HtmlTemplateFramework
*
@subpackage
htmltaglib
*
@access
public
*
@author
Yamauchi Shogo <htf@as-prj.com>
*
@version
$Id: htf_tlb_sample_hp_rightmenu.phl ,v 1.0 $
***/
require_once
(
"htf_com_initialize.inc"
)
;
//共通初期処理
require_once
(
"htf_dat_menu.phl"
)
;
//メニュークラス
require_once
(
"htf_tag_table.phl"
)
;
//tableクラス
require_once
(
"htf_tag_tr.phl"
)
;
//trクラス
require_once
(
"htf_tag_td.phl"
)
;
//tdクラス
/**
* HP右メニュー生成クラス(サンプル用)
*
* HPサンプルの右メニュータグ生成用のクラス。
*
*
@access
public
*
@author
Yamauchi Shogo <htf@as-prj.com>
***/
class
htf_tlb_sample_hp_rightmenu
{
/**
* 表示するメニューデータ
*
*
@access
public
*
@var
htf_dat_menu
**
*/
var
$menu
;
/**
* コンストラクタ
*
* 引数の設定値からHP右メニューオブジェクトを生成します。
*
*
@param
menu
$menu
右メニュー用メニューオブジェクト
*
@return
void
***/
function
htf_tlb_sample_hp_rightmenu
(
$menu
=
null
)
{
$this
->
menu
=
$menu
;
if
(
is_null
(
$this
->
menu
))
{
$this
->
menu
=
new
htf_dat_menu
(
)
;
}
return
;
}
/**
*
* HP右メニューHTMLタグを生成します。
*
*
@access
public
*
@return
string
***/
function
get_htmltag
(
)
{
/* 全体・タイトル行設定 */
//テーブルタグ
$tbl
=
new
htf_tag_table
(
HTF_ITEMCASE_ELEMENT
,
HTF_TAG_TABLE_USE_TBODY
)
;
$tbl
->
add_attribute
(
"border"
,
"0"
)
;
$tbl
->
add_attribute
(
"cellpadding"
,
"0"
)
;
$tbl
->
add_attribute
(
"cellspacing"
,
"0"
)
;
$tbl
->
add_attribute
(
"width"
,
"160"
)
;
$tbl
->
add_attribute
(
"bgcolor"
,
"#F0F0F0"
)
;
//先頭にダミー行追加
$tbl
->
add_row_tbody
(
$this
->
make_tr_dummyrow
(
))
;
for
(
$i
=
0
;
$i
<
count
(
$this
->
menu
->
arr_menuitem
)
;
$i
++
)
{
//タグ生成(tr/tdを作成して、$tblに追加する)
$tr
=
$this
->
make_tr_title
(
$this
->
menu
->
arr_menuitem
[
$i
]
->
label
)
;
$tbl
->
add_row_tbody
(
$tr
)
;
for
(
$j
=
0
;
$j
<
count
(
$this
->
menu
->
arr_menuitem
[
$i
]
->
arr_menuitem
)
;
$j
++
)
{
$childtr
=
$this
->
make_tr_link
(
$this
->
menu
->
arr_menuitem
[
$i
]
->
arr_menuitem
[
$j
]
)
;
$tbl
->
add_row_tbody
(
$childtr
)
;
}
$trbefdummy
=
$this
->
make_tr_dummyrow
(
)
;
$trline
=
$this
->
make_tr_line
(
)
;
$traftdummy
=
$this
->
make_tr_dummyrow
(
)
;
$tbl
->
add_row_tbody
(
$trbefdummy
)
;
$tbl
->
add_row_tbody
(
$trline
)
;
$tbl
->
add_row_tbody
(
$traftdummy
)
;
}
return
$tbl
->
get_htmltag
(
)
;
}
/**
*
* タイトル行出力のtrタグを生成します。
*
*
@access
private
*
@return
htf_tag_tr
***/
function
make_tr_title
(
$strtitle
)
{
$tr
=
new
htf_tag_tr
(
HTF_ITEMCASE_ELEMENT
)
;
$td
=
new
htf_tag_td
(
HTF_ITEMCASE_ELEMENT
)
;
$td
->
add_attribute
(
"align"
,
"left"
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$td
->
add_attribute
(
"width"
,
"160"
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$td
->
add_attribute
(
"colspan"
,
"4"
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$td
->
add_content
(
$strtitle
)
;
$tr
->
add_column
(
$td
)
;
return
$tr
;
}
/**
*
* リンク行出力のtrタグを生成します。
*
*
@access
private
*
@return
htf_tag_tr
***/
function
make_tr_link
(
$mi
)
{
$tr
=
new
htf_tag_tr
(
HTF_ITEMCASE_ELEMENT
)
;
//1カラム目(ダミー)
$td1
=
new
htf_tag_td
(
HTF_ITEMCASE_ELEMENT
)
;
$td1
->
add_attribute
(
"width"
,
"10"
,
HTF_ITEMCASE_ATTRIBUTE
)
;
//2カラム目(先頭マーク)
$td2
=
new
htf_tag_td
(
HTF_ITEMCASE_ELEMENT
)
;
$td2
->
add_attribute
(
"width"
,
"10"
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$td2
->
add_attribute
(
"valign"
,
"top"
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$td2
->
add_attribute
(
"align"
,
"left"
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$td2
->
add_content
(
'≫'
)
;
//3カラム目(リンクタグ)
$td3
=
new
htf_tag_td
(
HTF_ITEMCASE_ELEMENT
)
;
$td3
->
add_attribute
(
"align"
,
"left"
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$td3
->
add_attribute
(
"width"
,
"140"
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$td3
->
add_attribute
(
"colspan"
,
"4"
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$td3
->
add_content
(
$mi
->
get_textlinktag
(
))
;
$tr
->
add_column
(
$td1
)
;
$tr
->
add_column
(
$td2
)
;
$tr
->
add_column
(
$td3
)
;
return
$tr
;
}
/**
*
* 空行出力のtrタグを生成します。
*
*
@access
private
*
@return
htf_tag_tr
***/
function
make_tr_dummyrow
(
)
{
$tr
=
new
htf_tag_tr
(
HTF_ITEMCASE_ELEMENT
)
;
$td1
=
new
htf_tag_td
(
HTF_ITEMCASE_ELEMENT
)
;
$td1
->
add_attribute
(
"width"
,
"10"
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$td1
->
add_attribute
(
"height"
,
"10"
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$td2
=
new
htf_tag_td
(
HTF_ITEMCASE_ELEMENT
)
;
$td2
->
add_attribute
(
"width"
,
"10"
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$td2
->
add_attribute
(
"height"
,
"10"
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$td3
=
new
htf_tag_td
(
HTF_ITEMCASE_ELEMENT
)
;
$td3
->
add_attribute
(
"width"
,
"10"
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$td3
->
add_attribute
(
"height"
,
"10"
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$td4
=
new
htf_tag_td
(
HTF_ITEMCASE_ELEMENT
)
;
$td4
->
add_attribute
(
"width"
,
"130"
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$td4
->
add_attribute
(
"height"
,
"10"
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$tr
->
add_column
(
$td1
)
;
$tr
->
add_column
(
$td2
)
;
$tr
->
add_column
(
$td3
)
;
$tr
->
add_column
(
$td4
)
;
return
$tr
;
}
/**
*
* ライン出力のtrタグを生成します。
*
*
@access
private
*
@return
htf_tag_tr
***/
function
make_tr_line
(
)
{
$tr
=
new
htf_tag_tr
(
HTF_ITEMCASE_ELEMENT
)
;
$td1
=
new
htf_tag_td
(
HTF_ITEMCASE_ELEMENT
)
;
$td1
->
add_attribute
(
"width"
,
"10"
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$td1
->
add_attribute
(
"height"
,
"1"
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$td2
=
new
htf_tag_td
(
HTF_ITEMCASE_ELEMENT
)
;
$td2
->
add_attribute
(
"width"
,
"140"
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$td2
->
add_attribute
(
"height"
,
"1"
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$td2
->
add_attribute
(
"bgcolor"
,
"#DCDCDC"
)
;
$td2
->
add_attribute
(
"colspan"
,
"3"
)
;
$tr
->
add_column
(
$td1
)
;
$tr
->
add_column
(
$td2
)
;
return
$tr
;
}
}
?>
Documentation generated on Tue, 19 Sep 2006 06:21:33 +0900 by
phpDocumentor 1.3.0