25 include_once (
'Class.Log.php');
87 $this->log =
new Log(
"",
"TableLayout",
"");
99 if (!is_array($this->array)) {
114 if (!isset($this->headcontent))
return;
115 reset($this->headcontent);
116 foreach ($this->headcontent as $k => $v) {
118 if (isset($this->headsortfields[$k])) {
119 $value[0] = $this->headsortfields[$k];
122 if ($this->
order_by == $this->headsortfields[$k]) {
124 if ($this->desc ==
"down") {
130 $this->lay->set(
"$k", $v);
139 foreach ($this->array as $key => $val) {
140 if ($ind > $this->
slice)
break;
143 if ((!is_array($val)) && (!is_object($val)))
continue;
145 reset($this->fields);
146 foreach ($this->fields as $k => $v) {
147 if (is_object($val)) {
150 if (isset($val[$v])) {
156 if (!isset($this->links[$v])) {
157 $tmparray[$ind][$v] = $curval;
159 reset($this->links[$v][1]);
160 foreach ($this->links[$v][1] as $kk => $var) {
161 if (is_object($val)) {
164 if (isset($val[$var])) {
172 $tmparray[$ind][$v] = $link;
177 reset($this->fields);
178 foreach ($this->fields as $k => $v) {
179 $this->lay->SetBlockCorresp($this->table_name .
"BODY", $v, $v);
182 $this->lay->SetBlockData($this->table_name .
"BODY", $tmparray);
187 reset($this->fields);
188 foreach ($this->fields as $k => $v) {
189 if (isset($this->footcontent)) {
190 if (isset($this->footcontent[$v])) {
191 $val = $this->footcontent[$v];
199 $this->lay->set($v, $val);
214 if ($this->
slice && ($this->slice < $this->nb_tot) && isset($this->page_link)) {
216 $page_tot = (ceil(($this->nb_tot / $this->
slice) * $this->
slice) ==
$this->nb_tot) ? ceil($this->nb_tot / $this->slice) : ceil($this->nb_tot / $this->slice + 1);
217 $page_num = (int)($this->
start / $this->slice) + 1;
219 $values_first[0] = 0;
221 $values_last[0] = $this->nb_tot - ($this->nb_tot - (($page_tot - 1) * ($this->slice)));
223 if ($this->
start - $this->slice >= 0) {
226 $link_first = $this->
create_link($this->page_link, $values_first, $this->
first);
229 if ($this->
start + $this->slice < $this->nb_tot) {
233 $link_last = $this->
create_link($this->page_link, $values_last, $this->last);
236 $this->lay->set($this->table_name .
"_PREV", $link_prev);
237 $this->lay->set($this->table_name .
"_NEXT", $link_next);
238 $this->lay->set($this->table_name .
"_FIRST", $link_first);
239 $this->lay->set($this->table_name .
"_LAST", $link_last);
240 $this->lay->set($this->table_name .
"_NUM", $page_num);
241 $this->lay->set($this->table_name .
"_NB", $page_tot);
247 if (isset($this->fields))
return;
249 list($key, $val) = each($this->array);
250 if (is_object($val)) $val = get_object_vars($val);
252 foreach ($val as $k => $v) {
253 $this->fields[] = $k;
263 $link =
"<a href=\"" . $template .
"\">";
264 for ($i = 0; $i < 9; $i++) {
265 if (!isset($values[$i])) $values[$i] =
"";
267 $link = sprintf($link, $values[0], $values[1], $values[2], $values[3], $values[4], $values[5], $values[6], $values[7], $values[8]);
268 $link = $link . $text .
"</a>";
__construct(&$lay, $table_name= 'TABLE')
create_link($template, $values, $text)