@@ 55-74 (lines=20) @@ | ||
52 | return $nodes; |
|
53 | } |
|
54 | ||
55 | public function head( $list, $attributes = null ) { |
|
56 | if ( is_array($list) ) { |
|
57 | $nodes = $this->getCells( $list, 'th' ); |
|
58 | $head = $this->thead->firstChild; //current( $this->getElementsByTagName('thead') ); |
|
59 | if ( !isset($head) ) { |
|
60 | $head = ar_html::tag( 'thead', $attributes ); |
|
61 | if ( $foot = $this->tfoot->firstChild ) { |
|
62 | $this->insertBefore( $head, $foot ); |
|
63 | } else if ( $body = $this->tbody->firstChild ) { |
|
64 | $this->insertBefore( $head, $body ); |
|
65 | } else { |
|
66 | $this->appendChild( $head ); |
|
67 | } |
|
68 | } else if (isset($attributes)) { |
|
69 | $head->setAttributes( $attributes ); |
|
70 | } |
|
71 | $head->appendChild( ar_html::tag( 'tr', $nodes ) ); |
|
72 | } |
|
73 | return $this; |
|
74 | } |
|
75 | ||
76 | public function foot( $list, $attributes = null ) { |
|
77 | if ( is_array( $list ) ) { |
|
@@ 76-95 (lines=20) @@ | ||
73 | return $this; |
|
74 | } |
|
75 | ||
76 | public function foot( $list, $attributes = null ) { |
|
77 | if ( is_array( $list ) ) { |
|
78 | $nodes = $this->getCells( $list, 'td' ); |
|
79 | $foot = $this->tfoot->lastChild; |
|
80 | if ( !isset($foot) ) { |
|
81 | $foot = ar_html::tag( 'tfoot', $attributes ); |
|
82 | if ( $head = $this->thead->lastChild ) { |
|
83 | $this->insertBefore( $foot, $head->nextSibling ); |
|
84 | } else if ( $body = $this->tbody->firstChild ) { |
|
85 | $this->insertBefore( $foot, $body ); |
|
86 | } else { |
|
87 | $this->appendChild( $foot ); |
|
88 | } |
|
89 | } else if (isset( $attributes ) ) { |
|
90 | $foot->setAttributes( $attributes ); |
|
91 | } |
|
92 | $foot->appendChild( ar_html::tag( 'tr', $nodes ) ); |
|
93 | } |
|
94 | return $this; |
|
95 | } |
|
96 | ||
97 | public function rowHeaders( $list, $attributes = array() ) { |
|
98 | foreach ( $list as $key => $value ) { |