21 public $_template_path;
22 public $_base_template_name;
25 public function setTemplatePath( $name ) {
26 $this->_template_path = $name;
29 public function setBaseTemplate( $name ) {
30 $this->_base_template_name = $name;
33 public function assign( $name, $value ) {
34 $this->_v[ $name ] = $value;
37 public function setContent( $value ) {
38 $this->_content = $value;
41 public function setOp( $value ) {
45 public function setTitle( $value ) {
46 $this->_title = $value;
49 public function setNext( $value ) {
50 $this->_next = $value;
51 $this->_custom_seq =
true;
54 public function setBack( $value ) {
55 $this->_back = $value;
56 $this->_custom_seq =
true;
59 public function setReload( $value ) {
60 $this->_reload = $value;
61 $this->_custom_seq =
true;
64 public function addArray( $name, $value ) {
65 if ( ! isset( $this->_v[ $name ] ) || ! is_array( $this->_v[ $name ] ) ) {
66 $this->_v[ $name ] = [];
68 $this->_v[ $name ][] = $value;
71 public function v( $name ) {
72 return ! empty( $this->_v[ $name ] ) ? $this->_v[ $name ] :
false;
76 $args = func_get_args();
77 if ( func_num_args() > 0 ) {
78 if ( ! empty( $this->_v[ $args[0] ] ) ) {
79 $value = $this->_v[ $args[0] ];
80 if ( 2 === func_num_args() && is_array( $value ) ) {
81 $value = $value[ $args[1] ];
90 public function render( $fname =
'' ) {
91 if ( $fname && file_exists( $this->_template_path .
'/' . $fname ) ) {
93 include $this->_template_path .
'/' . $fname;
94 $this->setContent( ob_get_clean() );
96 $content = $this->_content;
97 if ( ! empty( $this->_title ) ) {
98 $title = $this->_title;
100 $title = $GLOBALS[
'wizardSeq']->getTitle( $this->_op );
102 if ( ! empty( $this->_next ) ) {
103 $b_next = $this->_next;
104 } elseif ( ! $this->_custom_seq ) {
105 $b_next = $GLOBALS[
'wizardSeq']->getNext( $this->_op );
109 if ( ! empty( $this->_back ) ) {
110 $b_back = $this->_back;
111 } elseif ( ! $this->_custom_seq ) {
112 $b_back = $GLOBALS[
'wizardSeq']->getBack( $this->_op );
116 if ( ! empty( $this->_reload ) ) {
117 $b_reload = $this->_reload;
118 } elseif ( ! $this->_custom_seq ) {
119 $b_reload = $GLOBALS[
'wizardSeq']->getReload( $this->_op );
123 include $this->_base_template_name;
126 public function error() {
127 $content = $this->_content;
128 if ( ! empty( $this->_title ) ) {
129 $title = $this->_title;
131 $title = $GLOBALS[
'wizardSeq']->getTitle( $this->_op );
133 if ( ! empty( $this->_next ) ) {
134 $b_next = $this->_next;
138 if ( ! empty( $this->_back ) ) {
139 $b_back = $this->_back;
143 if ( ! empty( $this->_reload ) ) {
144 $b_reload = $this->_reload;
148 include $this->_base_template_name;
155 public function add( $name, $title =
'', $next =
'', $next_btn =
'', $back =
'', $back_btn =
'', $reload =
'' ) {
156 $this->_list[ $name ][
'title'] = $title;
157 $this->_list[ $name ][
'next'] = $next;
158 $this->_list[ $name ][
'next_btn'] = $next_btn;
159 $this->_list[ $name ][
'back'] = $back;
160 $this->_list[ $name ][
'back_btn'] = $back_btn;
161 $this->_list[ $name ][
'reload'] = $reload;
164 public function insertAfter( $after, $name, $title =
'', $back =
'', $back_btn =
'', $reload =
'' ) {
165 if ( ! empty( $this->_list[ $after ] ) ) {
166 $this->_list[ $name ][
'title'] = $title;
167 $this->_list[ $name ][
'next'] = $this->_list[ $after ][
'next'];
168 $this->_list[ $name ][
'next_btn'] = $this->_list[ $after ][
'next_btn'];
169 $this->_list[ $after ][
'next'] = $name;
170 $this->_list[ $after ][
'next_btn'] = $title;
171 $this->_list[ $name ][
'back'] = $back;
172 $this->_list[ $name ][
'back_btn'] = $back_btn;
173 $this->_list[ $name ][
'reload'] = $reload;
178 public function replaceAfter( $after, $name, $title =
'', $next =
'', $next_btn =
'', $back =
'', $back_btn =
'', $reload =
'' ) {
179 if ( ! empty( $this->_list[ $after ] ) ) {
180 $this->_list[ $name ][
'title'] = $title;
181 $this->_list[ $name ][
'next'] = $next;
182 $this->_list[ $name ][
'next_btn'] = $next_btn;
183 $this->_list[ $after ][
'next'] = $name;
184 $this->_list[ $after ][
'next_btn'] = $title;
185 $this->_list[ $name ][
'back'] = $back;
186 $this->_list[ $name ][
'back_btn'] = $back_btn;
187 $this->_list[ $name ][
'reload'] = $reload;
191 public function getTitle( $name ) {
192 return ! empty( $this->_list[ $name ][
'title'] ) ? ( $this->_list[ $name ][
'title'] ) :
'';
195 public function getNext( $name ) {
196 return ! empty( $this->_list[ $name ][
'next'] ) || ! empty( $this->_list[ $name ][
'next_btn'] ) ? ( [
197 $this->_list[ $name ][
'next'],
198 $this->_list[ $name ][
'next_btn']
202 public function getBack( $name ) {
203 return ! empty( $this->_list[ $name ][
'back'] ) || ! empty( $this->_list[ $name ][
'back_btn'] ) ? ( [
204 $this->_list[ $name ][
'back'],
205 $this->_list[ $name ][
'back_btn']
209 public function getReload( $name ) {
210 return ! empty( $this->_list[ $name ][
'reload'] ) ? ( $this->_list[ $name ][
'reload'] ) :
'';