HtmlTemplateFramework
[
class tree: HtmlTemplateFramework
] [
index: HtmlTemplateFramework
] [
all elements
]
Packages:
HtmlTemplateFramework
Source for file htf_tlb_topicpath.phl
Documentation is available at
htf_tlb_topicpath.phl
<?php
/**
* htf_tlb_topicpathクラス
*
* パンくずリスト生成クラス
*
*
@package
HtmlTemplateFramework
*
@subpackage
htmltaglib
*
@access
public
*
@author
Yamauchi Shogo <htf@as-prj.com>
*
@version
$Id: htf_tlb_topicpath.phl ,v 1.0 $
***/
require_once
(
"htf_com_initialize.inc"
)
;
//共通初期処理
require_once
(
"htf_dat_menu.phl"
)
;
//メニュークラス
require_once
(
"htf_tag_element.phl"
)
;
//エレメントクラス
/**
* パンくずリスト生成クラス
*
* パンくずリスト生成用のクラス。
*
*
@author
Yamauchi Shogo <htf@as-prj.com>
*
@access
public
***/
class
htf_tlb_topicpath
{
/**
* パンくずリスト作成のためのマップデータ
*
*
@access
public
*
@var
htf_dat_menu
**
*/
var
$menu
;
/**
* 表示に使用するルート区切り文字列
*
*
@access
public
*
@var
string
**
*/
var
$splitchar
;
/**
* コンストラクタ
*
* 引数の設定値からパンくずリストオブジェクトを生成します。
*
*
@param
menu
$menu
パンくずリスト生成用マップデータ
*
@param
string
$splitchar
表示に使用するルート区切り文字列
*
@return
void
***/
function
htf_tlb_topicpath
(
$menu
=
null
,
$splitchar
=
">"
)
{
$this
->
menu
=
$menu
;
$this
->
splitchar
=
$splitchar
;
if
(
is_null
(
$this
->
menu
))
{
$this
->
menu
=
new
htf_dat_menu
(
)
;
}
return
;
}
/**
*
* 指定urlからパンくずリストタグを取得します。
*
*
@param
string
$url
パンくずリストを作成するターゲットURL
*
@access
public
*
@return
string
***/
function
get_topicpath_by_url
(
$url
)
{
//該当する子ノードをサーチ
$arrmenuitem
=
$this
->
menu
->
get_route_by_url
(
$url
)
;
if
(
is_null
(
$arrmenuitem
))
return
""
;
//トピックパスのタグを生成
$strret
=
""
;
//print(count($arrmenuitem));
for
(
$i
=
0
;
$i
<
count
(
$arrmenuitem
)
;
$i
++
)
{
$element
=
new
htf_tag_element
(
"a"
,
true
,
HTF_ITEMCASE_ELEMENT
)
;
$element
->
add_attribute
(
"href"
,
$arrmenuitem
[
$i
]
->
url
)
;
$element
->
add_content
(
$arrmenuitem
[
$i
]
->
label
)
;
$strwk
=
$element
->
get_htmltag
(
)
;
if
(
$i
<
count
(
$arrmenuitem
)
-
1
)
{
$strwk
.=
$this
->
splitchar
;
}
$strret
.=
$strwk
;
}
return
$strret
;
}
/**
*
* 指定IDからパンくずリストタグを取得します。
*
*
@param
string
$url
パンくずリストを作成するターゲットmenuitemのID
*
@access
public
*
@return
string
***/
function
get_topicpath_by_id
(
$id
)
{
//該当する子ノードをサーチ
$arrmenuitem
=
$this
->
menu
->
get_route_by_id
(
$id
)
;
if
(
is_null
(
$arrmenuitem
))
return
""
;
//トピックパスのタグを生成
$strret
=
""
;
for
(
$i
=
0
;
$i
<
count
(
$arrmenuitem
)
;
$i
++
)
{
$element
=
new
htf_tag_element
(
"a"
,
true
,
HTF_ITEMCASE_ELEMENT
)
;
$element
->
add_attribute
(
"href"
,
$arrmenuitem
[
$i
]
->
url
)
;
$element
->
add_content
(
$arrmenuitem
[
$i
]
->
label
)
;
$strwk
=
$element
->
get_htmltag
(
)
;
if
(
$i
<
count
(
$arrmenuitem
)
-
1
)
{
$strwk
.=
$this
->
splitchar
;
}
$strret
.=
$strwk
;
}
return
$strret
;
}
}
?>
Documentation generated on Tue, 19 Sep 2006 06:21:36 +0900 by
phpDocumentor 1.3.0