コード例 #1
0
ファイル: ViewBase.php プロジェクト: sasumi/SvnPQA
 /**
  * add element class
  * @param $tag
  * @param array $attributes
  * @param array $define
  * @return string
  */
 public static function buildElement($tag, $attributes = array(), $define = array())
 {
     if ($define['rel'] == 'keywords' || $define['rel'] == 'tags') {
         return self::buildTagsInput($tag, $attributes, $define);
     }
     $tag = strtolower($tag);
     $class = $attributes['class'];
     switch ($tag) {
         case 'input':
             if ($attributes['type'] == 'text' || $attributes['type'] == 'password' || $attributes['type'] == 'number') {
                 $class .= ' txt';
             }
             if ($define['type'] == 'date') {
                 $class .= ' date-txt';
             }
             if ($define['type'] == 'datetime' || $define['type'] == 'timestamp') {
                 $class .= ' datetime-txt';
             }
             if ($define['type'] == 'time') {
                 $class .= ' time-txt';
             }
             break;
         case 'textarea':
             $class = ' txt';
             if ($define['type'] == 'simple_rich_text') {
                 $attributes['rel'] = 'simple-rich';
                 $class .= ' medium-txt';
             } else {
                 if ($define['type'] == 'rich_text') {
                     $attributes['rel'] = 'rich';
                     $class .= ' large-txt';
                 } else {
                     $class .= ' small-txt';
                 }
             }
             break;
     }
     if ($class) {
         $attributes['class'] = $class;
     }
     return parent::buildElement($tag, $attributes, $define);
 }
コード例 #2
0
ファイル: ViewBase.php プロジェクト: sasumi/SvnPQA
 /**
  * add element class
  * @param $tag
  * @param array $attributes
  * @param array $define
  * @return string
  */
 public static function buildElement($tag, $attributes = array(), $define = array())
 {
     $tag = strtolower($tag);
     //绑定 class
     $class = '';
     switch ($tag) {
         case 'input':
             if ($attributes['type'] == 'text' || $attributes['type'] == 'password' || $attributes['type'] == 'number') {
                 $class = 'txt';
             }
             if ($define['type'] == 'date') {
                 $class .= ' date-txt';
             }
             if ($define['type'] == 'datetime') {
                 $class .= ' datetime-txt';
             }
             if ($define['type'] == 'time') {
                 $class .= ' time-txt';
             }
             break;
         case 'textarea':
             $class = 'txt small-txt';
             break;
     }
     $attributes['class'] = $class;
     return parent::buildElement($tag, $attributes, $define);
 }