HtmlTemplateFramework
[ class tree: HtmlTemplateFramework ] [ index: HtmlTemplateFramework ] [ all elements ]

Source for file htf_tlb_topicpath.phl

Documentation is available at htf_tlb_topicpath.phl

  1. <?php
  2. /**
  3.  * htf_tlb_topicpathクラス
  4.  *
  5.  * パンくずリスト生成クラス
  6.  *
  7.  * @package HtmlTemplateFramework
  8.  * @subpackage htmltaglib
  9.  * @access  public
  10.  * @author    Yamauchi Shogo <htf@as-prj.com>
  11.  * @version $Id: htf_tlb_topicpath.phl ,v 1.0 $
  12.  ***/
  13. require_once("htf_com_initialize.inc");    //共通初期処理
  14. require_once("htf_dat_menu.phl");            //メニュークラス
  15. require_once("htf_tag_element.phl");        //エレメントクラス
  16.  
  17. /**
  18.  * パンくずリスト生成クラス
  19.  * 
  20.  * パンくずリスト生成用のクラス。
  21.  *
  22.  * @author    Yamauchi Shogo <htf@as-prj.com>
  23.  * @access  public
  24.  ***/
  25.     /**
  26.      * パンくずリスト作成のためのマップデータ
  27.      * 
  28.      * @access public
  29.      * @var    htf_dat_menu 
  30.      ***/
  31.     var $menu;
  32.     /**
  33.      * 表示に使用するルート区切り文字列
  34.      * 
  35.      * @access public
  36.      * @var    string 
  37.      ***/
  38.     var $splitchar;
  39.     
  40.     /**
  41.      * コンストラクタ
  42.      *
  43.      * 引数の設定値からパンくずリストオブジェクトを生成します。
  44.      *
  45.      * @param     menu    $menu          パンくずリスト生成用マップデータ
  46.      * @param     string  $splitchar     表示に使用するルート区切り文字列
  47.      * @return    void 
  48.      ***/
  49.     function htf_tlb_topicpath($menu=null$splitchar=">"{
  50.  
  51.         $this->menu = $menu;
  52.         $this->splitchar = $splitchar;
  53.         
  54.         if (is_null($this->menu)) {
  55.             $this->menu = new htf_dat_menu();
  56.         }
  57.         return;
  58.     }
  59.     
  60.     /**
  61.      *
  62.      * 指定urlからパンくずリストタグを取得します。
  63.      *
  64.      * @param  string  $url     パンくずリストを作成するターゲットURL
  65.      * @access  public
  66.      * @return string 
  67.      ***/
  68.     function get_topicpath_by_url($url{
  69.             
  70.         //該当する子ノードをサーチ
  71.         $arrmenuitem $this->menu->get_route_by_url($url);
  72.         if (is_null($arrmenuitem)) return "";
  73.         
  74.         //トピックパスのタグを生成
  75.         $strret "";
  76.         //print(count($arrmenuitem));
  77.         for ($i=0$i<count($arrmenuitem)$i++{
  78.             $element new htf_tag_element("a"trueHTF_ITEMCASE_ELEMENT);
  79.             $element->add_attribute("href"$arrmenuitem[$i]->url);
  80.             $element->add_content($arrmenuitem[$i]->label);
  81.             $strwk $element->get_htmltag();
  82.             if ($i count($arrmenuitem)-1{
  83.                 $strwk.= $this->splitchar;
  84.             }
  85.             $strret.=$strwk;
  86.         }
  87.         
  88.         return $strret;
  89.     }
  90.  
  91.     /**
  92.      *
  93.      * 指定IDからパンくずリストタグを取得します。
  94.      *
  95.      * @param  string  $url     パンくずリストを作成するターゲットmenuitemのID
  96.      * @access  public
  97.      * @return    string 
  98.      ***/
  99.     function get_topicpath_by_id($id{
  100.             
  101.         //該当する子ノードをサーチ
  102.         $arrmenuitem $this->menu->get_route_by_id($id);
  103.         if (is_null($arrmenuitem)) return "";
  104.         
  105.         //トピックパスのタグを生成
  106.         $strret "";
  107.         for ($i=0$i<count($arrmenuitem)$i++{
  108.             $element new htf_tag_element("a"trueHTF_ITEMCASE_ELEMENT);
  109.             $element->add_attribute("href"$arrmenuitem[$i]->url);
  110.             $element->add_content($arrmenuitem[$i]->label);
  111.             $strwk $element->get_htmltag();
  112.             if ($i count($arrmenuitem)-1{
  113.                 $strwk.= $this->splitchar;
  114.             }
  115.             $strret.=$strwk;
  116.         }
  117.         
  118.         return $strret;
  119.     }
  120. }
  121.  
  122. ?>

Documentation generated on Tue, 19 Sep 2006 06:21:36 +0900 by phpDocumentor 1.3.0