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

Source for file htf_tag_attribute.phl

Documentation is available at htf_tag_attribute.phl

  1. <?php
  2. /**
  3.  * htf_tag_attributeクラス
  4.  *
  5.  * htmlタグ属性を保有するクラス
  6.  *
  7.  * @package   HtmlTemplateFramework
  8.  * @subpackage htmltagbase
  9.  * @access     public
  10.  * @author    Yamauchi Shogo <htf@as-prj.com>
  11.  * @version   $Id: htf_tag_attribute.phl ,v 1.0 $
  12.  ***/
  13. require_once("htf_com_define.inc");    //共通定数
  14. require_once("htf_com_func.inc");        //共通関数
  15.  
  16. /**
  17.  * htmlタグ属性を保有するクラス
  18.  *
  19.  * htmlタグの属性情報を保有し、保有している内容でhtmlの属性記述を出力します。
  20.  *
  21.  * @access     public
  22.  * @author    Yamauchi Shogo <htf@as-prj.com>
  23.  ***/
  24.  
  25.    /**
  26.     * 属性名(デフォルトは空文字)
  27.     * 
  28.     * @access public
  29.     * @var string 
  30.     */
  31.     var $name;
  32.    /**
  33.     * 属性値(デフォルトは空文字)
  34.     * 
  35.     * @access public
  36.     * @var string 
  37.     */
  38.     var $value;
  39.    /**
  40.     * 属性名出力設定値。
  41.     * 空文字(デフォルト・そのまま出力)'lower'(小文字)もしくは'upper'(大文字)を設定します。
  42.     * 
  43.     * @access public
  44.     * @var string 
  45.     */    var $case;
  46.  
  47.     /**
  48.      * コンストラクタ
  49.      *
  50.      * 引数の属性名・属性値からhtf_tag_attributeオブジェクトを生成します。
  51.      *
  52.      * @access public
  53.      * @param     string    $strname     htmlタグの属性名(デフォルトは空文字)
  54.      * @param     string    $strvalue    htmlタグの属性値(デフォルトは空文字)
  55.      * @param     string    $strcase     大文字・小文字出力(デフォルトはそのまま出力)
  56.      * @return    void 
  57.      ***/
  58.     function htf_tag_attribute($strname="",
  59.                                $strvalue="",
  60.                                $strcase=""{
  61.         //各プロパティ初期化
  62.         $this->name = $strname;
  63.         $this->value = $strvalue;
  64.         $this->case = $strcase;
  65.         return;
  66.     }
  67.     
  68.     /**
  69.      * htmlタグの属性記述を取得します。
  70.      *
  71.      * @access     public
  72.      * @return    string  htmlタグ属性記述
  73.      ***/
  74.     function get_description({
  75.  
  76.         if (!htf_is_existsval($this->get_attribute_name())) {
  77.             return "";
  78.         }
  79.         
  80.         $strret $this->get_attribute_name().'='.'"'.$this->value.'"';
  81.         return $strret;
  82.     }
  83.  
  84.     /**
  85.      * 大文字・小文字を判別し、属性名を取得します。
  86.      *
  87.      * @access     private
  88.      * @return    string  属性名
  89.      ***/
  90.     function get_attribute_name({
  91.         $retstr="";
  92.         if ($this->case == HTF_CASE_LOWER{
  93.             //小文字に変換して出力
  94.             $retstr=strtolower($this->name);
  95.         else if($this->case == HTF_CASE_UPPER{
  96.             //大文字に変換して出力
  97.             $retstr=strtoupper($this->name);
  98.         else {
  99.             //そのまま出力
  100.             $retstr=$this->name;
  101.         }
  102.         return $retstr;
  103.     }
  104. }
  105. ?>

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