[2] | 1 | <?php |
---|
| 2 | /**************************************************************************\ |
---|
| 3 | * eGroupWare - html * |
---|
| 4 | * http://www.egroupware.org * |
---|
| 5 | * Written by Jerry Westrick <jerry@westrick.com> * |
---|
| 6 | * -------------------------------------------- * |
---|
| 7 | * This program is free software; you can redistribute it and/or modify it * |
---|
| 8 | * under the terms of the GNU General Public License as published by the * |
---|
| 9 | * Free Software Foundation; either version 2 of the License, or (at your * |
---|
| 10 | * option) any later version. * |
---|
| 11 | \**************************************************************************/ |
---|
| 12 | |
---|
| 13 | |
---|
| 14 | class html_tables |
---|
| 15 | { |
---|
| 16 | function hash_table($rows,$head='',$obj, $frtn) |
---|
| 17 | { |
---|
| 18 | $start = $_POST['start'] ? $_POST['start'] : $_GET['start']; |
---|
| 19 | |
---|
| 20 | $html = ''; |
---|
| 21 | $edittable = $head['_edittable']; |
---|
| 22 | if(isset($edittable)) |
---|
| 23 | { |
---|
| 24 | if($edittable) |
---|
| 25 | { |
---|
| 26 | // Generate the customization table... |
---|
| 27 | return $this->edit_table($rows,$head,$obj,$frtn); |
---|
| 28 | } |
---|
| 29 | else |
---|
| 30 | { |
---|
| 31 | #$html .= '<form method="post" action="' |
---|
| 32 | # . $GLOBALS['phpgw']->link('/index.php') |
---|
| 33 | # . '">' . "\n"; |
---|
| 34 | $bo = CreateObject('admin.bolog',True); |
---|
| 35 | if(!isset($start)) |
---|
| 36 | { |
---|
| 37 | $start = 0; |
---|
| 38 | } |
---|
| 39 | $num_rows = $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']; |
---|
| 40 | $stop = $start + $num_rows; |
---|
| 41 | if($stop > count($rows)) |
---|
| 42 | { |
---|
| 43 | $stop = count($rows); |
---|
| 44 | } |
---|
| 45 | $nextmatchs = CreateObject('phpgwapi.nextmatchs'); |
---|
| 46 | $total_records = $bo->get_no_errors(); |
---|
| 47 | $left = $nextmatchs->left('/index.php',$start,$total_records,'menuaction=admin.uilog.list_log'); |
---|
| 48 | $right = $nextmatchs->right('/index.php',$start,$total_records,'menuaction=admin.uilog.list_log'); |
---|
| 49 | $hits = $nextmatchs->show_hits($total_records,$start); |
---|
| 50 | |
---|
| 51 | $html .= '<table width="98%"><tr>'; |
---|
| 52 | $html .= $left; |
---|
| 53 | $html .= '<td align="right"> ' . $hits . ' </td>'; |
---|
| 54 | $html .= '<td align="left"> <a href=' . $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uilog.list_log&editable=true') .'> ' . lang('Edit Table format') . '</a></td>'; |
---|
| 55 | $html .= $right; |
---|
| 56 | $html .= '</tr></table>'; |
---|
| 57 | } |
---|
| 58 | } |
---|
| 59 | |
---|
| 60 | if($head == '') |
---|
| 61 | { |
---|
| 62 | $frow = $rows[0]; |
---|
| 63 | $cnam = $this->arr_keys($frow); |
---|
| 64 | while(list(,$fn)=each($cnam)) |
---|
| 65 | { |
---|
| 66 | $head[$fn] = array(); |
---|
| 67 | } |
---|
| 68 | } |
---|
| 69 | |
---|
| 70 | if(@is_null($head['_cols'])) |
---|
| 71 | { |
---|
| 72 | $cols = $this->arr_keys($rows[0]); |
---|
| 73 | } |
---|
| 74 | else |
---|
| 75 | { |
---|
| 76 | $cols = $head['_cols']; |
---|
| 77 | } |
---|
| 78 | |
---|
| 79 | // Build Header Row... |
---|
| 80 | |
---|
| 81 | // First Get the layout arrays... |
---|
| 82 | $layout = $head['#layout']; |
---|
| 83 | if(!is_array($layout)) |
---|
| 84 | { |
---|
| 85 | $layout = $this->arr_keys($cols); |
---|
| 86 | } |
---|
| 87 | |
---|
| 88 | // printlist, a list of all columns in a logical row, |
---|
| 89 | // with Row/ColSpawn values, in print order... |
---|
| 90 | |
---|
| 91 | $printlist = $this->make_printlist($layout,$cols); |
---|
| 92 | |
---|
| 93 | // $table contains data for header row.... |
---|
| 94 | $table = $this->make_tblhead($printlist,$head); |
---|
| 95 | |
---|
| 96 | // get GroupBy |
---|
| 97 | $groupby = $head['_groupby']; |
---|
| 98 | $supres = $head['_supres']; |
---|
| 99 | $lastgroup = ''; |
---|
| 100 | |
---|
| 101 | // build actual Rows... |
---|
| 102 | $rparms = array(); |
---|
| 103 | $mrow = $stop; |
---|
| 104 | for($rno=0;$rno<$mrow;$rno++) |
---|
| 105 | { |
---|
| 106 | // Build GroupKey |
---|
| 107 | if(isset($groupby)) |
---|
| 108 | { |
---|
| 109 | $gkey = ''; |
---|
| 110 | reset($groupby); |
---|
| 111 | while(list($gname,)=each($groupby)) |
---|
| 112 | { |
---|
| 113 | $gkey .= $rows[$rno][$gname]['value']; |
---|
| 114 | } |
---|
| 115 | $rows[$rno]['#gkey'] = $gkey; |
---|
| 116 | } |
---|
| 117 | |
---|
| 118 | reset($printlist); |
---|
| 119 | while(list($pc,$pcol)=each($printlist)) |
---|
| 120 | { |
---|
| 121 | $cname = $pcol['#name']; |
---|
| 122 | $cparms = $this->arr_merge($head[$cname],$pcol,array('bgcolor'=>'#FFFFFF'),$rows[$rno][$cname]); |
---|
| 123 | $rows[$rno][$cname] = $cparms; |
---|
| 124 | } |
---|
| 125 | } |
---|
| 126 | |
---|
| 127 | // Grouping Suppression |
---|
| 128 | |
---|
| 129 | if(isset($groupby)) |
---|
| 130 | { |
---|
| 131 | $grno = $start; |
---|
| 132 | $gkey = $rows[$start]['#gkey']; |
---|
| 133 | for($rno=$start+1;$rno<$stop;$rno++) |
---|
| 134 | { |
---|
| 135 | $rowspan = 1; |
---|
| 136 | $rkey = $rows[$rno]['#gkey']; |
---|
| 137 | |
---|
| 138 | while( $gkey == $rkey) |
---|
| 139 | { |
---|
| 140 | //echo "<p>grno:$grno ($gkey) rno:$rno ($rkey) are equal</p>"; |
---|
| 141 | $rowspan = $rowspan + 1; |
---|
| 142 | $row = $rows[$rno]; |
---|
| 143 | |
---|
| 144 | for($pc=0;$pc<count($row);$pc++) |
---|
| 145 | { |
---|
| 146 | $c = $row[$cols[$pc]]; |
---|
| 147 | $cno = $c['#colno']; |
---|
| 148 | $cname = $c['#name']; |
---|
| 149 | |
---|
| 150 | if($supres[$cname]) |
---|
| 151 | { |
---|
| 152 | $rows[$rno][$cname]['#supres']='yes'; |
---|
| 153 | $rows[$rno][$cname]['value']='  '; |
---|
| 154 | $rows[$grno][$cname]['rowspan']=$printlist[$cno]['rowspan']*$rowspan; |
---|
| 155 | } |
---|
| 156 | } |
---|
| 157 | $rno++; |
---|
| 158 | $rkey = $rows[$rno]['#gkey']; |
---|
| 159 | } |
---|
| 160 | //echo "<p>grno:$grno ($gkey) rno:$rno ($rkey) are not equal</p>"; |
---|
| 161 | $grno=$rno; |
---|
| 162 | $gkey=$rkey; |
---|
| 163 | } |
---|
| 164 | } |
---|
| 165 | /* |
---|
| 166 | ** Now Generate the Html For the Table Header |
---|
| 167 | */ |
---|
| 168 | //print_r($table); |
---|
| 169 | |
---|
| 170 | $html .= $this->html_head($head,$table,$printlist); |
---|
| 171 | /* |
---|
| 172 | ** Now (finally) Generate the Html For the Table |
---|
| 173 | */ |
---|
| 174 | //print_r($rows); |
---|
| 175 | for($rno=$start;$rno<$stop;$rno++) |
---|
| 176 | { |
---|
| 177 | // let user have a hack at the row... |
---|
| 178 | $row = $obj->$frtn($rno,$rows[$rno]); |
---|
| 179 | // $row = $rows[$rno]; |
---|
| 180 | |
---|
| 181 | // $rp = $this->makeparms($row[$rno]['#row_parms']); |
---|
| 182 | $rp = ''; |
---|
| 183 | $gkey = $row['#gkey']; |
---|
| 184 | // $html .= "\t<tr $rp> <comment $gkey>\n"; |
---|
| 185 | $html .= "\t<tr $rp> \n"; |
---|
| 186 | reset($printlist); |
---|
| 187 | while(list($pc,$pcol)=each($printlist)) |
---|
| 188 | { |
---|
| 189 | $cname = $pcol['#name']; |
---|
| 190 | |
---|
| 191 | $cp = $this->makeparms($row[$cname]); |
---|
| 192 | if($row[$cname]['#supres'] != 'yes') |
---|
| 193 | { |
---|
| 194 | $html .= "\t\t<td $cp>".$row[$cname]['value']."</td>\n"; |
---|
| 195 | } |
---|
| 196 | if($pcol['#eor']=='1') |
---|
| 197 | { |
---|
| 198 | $html .= "\t</tr>\n"; // \t<tr $rp>\n |
---|
| 199 | } |
---|
| 200 | } |
---|
| 201 | } |
---|
| 202 | $html .= "</table>\n"; |
---|
| 203 | #$html .= "</form>"; |
---|
| 204 | return $html; |
---|
| 205 | } |
---|
| 206 | |
---|
| 207 | function makeparms($parmlist) |
---|
| 208 | { |
---|
| 209 | $html = ''; |
---|
| 210 | $comma = ' '; |
---|
| 211 | if(!is_array($parmlist)) |
---|
| 212 | { |
---|
| 213 | return ''; |
---|
| 214 | } |
---|
| 215 | reset($parmlist); |
---|
| 216 | while(list($pname,$pvalue)=each($parmlist)) |
---|
| 217 | { |
---|
| 218 | switch($pname) |
---|
| 219 | { |
---|
| 220 | case 'value': |
---|
| 221 | break; |
---|
| 222 | case 'colspan': |
---|
| 223 | case 'rowspan': |
---|
| 224 | if($pvalue != 1) |
---|
| 225 | { |
---|
| 226 | $html .= $comma . $pname . '="' . $pvalue . '"'; |
---|
| 227 | #$comma = ', '; |
---|
| 228 | $comma = ' '; |
---|
| 229 | }; |
---|
| 230 | break; |
---|
| 231 | default: |
---|
| 232 | if(substr($pname,0,1) != '#') |
---|
| 233 | { |
---|
| 234 | $html .= $comma . $pname . '="' . $pvalue . '"'; |
---|
| 235 | #$comma = ', '; |
---|
| 236 | $comma = ' '; |
---|
| 237 | } |
---|
| 238 | } |
---|
| 239 | } |
---|
| 240 | return $html; |
---|
| 241 | } |
---|
| 242 | |
---|
| 243 | function edit_table($rows,$head='',$obj, $frtn) |
---|
| 244 | { |
---|
| 245 | $nocols = $_POST['nocols']; |
---|
| 246 | $noflds = $_POST['noflds']; |
---|
| 247 | $norows = $_POST['norows']; |
---|
| 248 | $layout = $_POST['layout']; |
---|
| 249 | $_cols = $_POST['_cols']; |
---|
| 250 | |
---|
| 251 | $html = ''; |
---|
| 252 | $html .= '<form method="post" action="' |
---|
| 253 | . $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uilog.list_log&editable=true') |
---|
| 254 | . '">' . "\n"; |
---|
| 255 | |
---|
| 256 | $params = $head['_table_parms']; |
---|
| 257 | $frow = $rows[0]; |
---|
| 258 | $cnam = $this->arr_keys($frow); |
---|
| 259 | if($head == '') |
---|
| 260 | { |
---|
| 261 | while(list(,$fn)=each($cnam)) |
---|
| 262 | { |
---|
| 263 | $head[$fn] = array(); |
---|
| 264 | } |
---|
| 265 | } |
---|
| 266 | |
---|
| 267 | if(isset($_cols)) |
---|
| 268 | { |
---|
| 269 | $cols = $_cols; |
---|
| 270 | } |
---|
| 271 | else |
---|
| 272 | { |
---|
| 273 | if(@is_null($head['_cols'])) |
---|
| 274 | { |
---|
| 275 | $cols = $this->arr_keys($rows[0]); |
---|
| 276 | } |
---|
| 277 | else |
---|
| 278 | { |
---|
| 279 | $cols = $head['_cols']; |
---|
| 280 | } |
---|
| 281 | } |
---|
| 282 | |
---|
| 283 | if(!isset($noflds)) |
---|
| 284 | { |
---|
| 285 | $noflds = count($cols); |
---|
| 286 | } |
---|
| 287 | if(!isset($layout)) |
---|
| 288 | { |
---|
| 289 | $layout = $head['#layout']; |
---|
| 290 | } |
---|
| 291 | if(!isset($norows)) |
---|
| 292 | { |
---|
| 293 | $norows = count($layout); |
---|
| 294 | } |
---|
| 295 | if(!isset($nocols)) |
---|
| 296 | { |
---|
| 297 | $nocols = count($layout[0]); |
---|
| 298 | } |
---|
| 299 | // Table Excmple |
---|
| 300 | |
---|
| 301 | // Build Header Row... |
---|
| 302 | $html .= "<h2>Table Size</h2>"; |
---|
| 303 | // $html .= "<p>"; |
---|
| 304 | $html .= "Rows: "; |
---|
| 305 | $html .= "<input type=\"input\" name=\"norows\" value=\"$norows\">"; |
---|
| 306 | $html .= "Columns: "; |
---|
| 307 | $html .= "<input type=\"input\" name=\"nocols\" value=\"$nocols\">"; |
---|
| 308 | $html .= "Fields: "; |
---|
| 309 | $html .= "<input type=\"input\" name=\"noflds\" value=\"$noflds\">"; |
---|
| 310 | // $html .= "\t<tr> "; |
---|
| 311 | |
---|
| 312 | // Column Defintions... |
---|
| 313 | $html .= "<h2>Column Definition</h2>"; |
---|
| 314 | $html .= "<table width=\"98%\" bgcolor=\"#000000\">\n"; |
---|
| 315 | $f = array(); |
---|
| 316 | for($fno=0;$fno<$noflds;$fno++) |
---|
| 317 | { |
---|
| 318 | $f[]=$fno; |
---|
| 319 | } |
---|
| 320 | // Column Headings |
---|
| 321 | $html .= "\t<tr bgcolor=\"#D3DCFF\">\n"; |
---|
| 322 | for($cno=0;$cno<$nocols;$cno++) |
---|
| 323 | { |
---|
| 324 | $html .= "\t\t<td align=\"center\">$cno</td>\n"; |
---|
| 325 | } |
---|
| 326 | $html .= "\t</tr >\n"; |
---|
| 327 | for($rno=0;$rno<$norows;$rno++) |
---|
| 328 | { |
---|
| 329 | $html .= "\t<tr bgcolor=\"#D3DCFF\">\n"; |
---|
| 330 | for($cno=0;$cno<$nocols;$cno++) |
---|
| 331 | { |
---|
| 332 | $c = $layout[$rno][$cno]; |
---|
| 333 | $tname = "layout[$rno][]"; |
---|
| 334 | $t = $this->DropDown($f,$tname,$c); |
---|
| 335 | $html .= "\t\t<td align=\"center\">$t</td>\n"; |
---|
| 336 | } |
---|
| 337 | $html .= "\t</tr >\n"; |
---|
| 338 | } |
---|
| 339 | $html .= "</table>\n"; |
---|
| 340 | $html .= "<p>\n"; |
---|
| 341 | |
---|
| 342 | // Header of Table... |
---|
| 343 | $printlist = $this->make_printlist($layout,$cols); |
---|
| 344 | $table = $this->make_tblhead($printlist,$head); |
---|
| 345 | $html .= $this->html_head($head,$table,$printlist); |
---|
| 346 | $html .= "</table>\n"; |
---|
| 347 | |
---|
| 348 | $html .= "<input type=\"submit\" name=\"submit\" value=\"Update\">"; |
---|
| 349 | //Field Definitions |
---|
| 350 | $html .= "<h2>Field Definitions</h2>"; |
---|
| 351 | $html .= "<table width=\"98%\" bgcolor=\"#D3DCFF\">\n"; |
---|
| 352 | $html .= "\t\t<td width=\"2%\" align=\"center\">No</td>\n"; |
---|
| 353 | $html .= "\t\t<td width=\"2%\" align=\"center\">Del</td>\n"; |
---|
| 354 | $html .= "\t\t<td width=\"5%\">Field</td>\n"; |
---|
| 355 | $html .= "\t\t<td>Value</td>\n"; |
---|
| 356 | $html .= "\t</tr>\n"; |
---|
| 357 | |
---|
| 358 | // Add Table Rows... |
---|
| 359 | reset($cols); |
---|
| 360 | // while(list($cno,$name) = each($cols)) |
---|
| 361 | for($fno=0;$fno<$noflds;$fno++) |
---|
| 362 | { |
---|
| 363 | $name = $cols[$fno]; |
---|
| 364 | $values = $head[$name]; |
---|
| 365 | $title = $values['title']; |
---|
| 366 | if($title == '') |
---|
| 367 | { |
---|
| 368 | $title = $name; |
---|
| 369 | } |
---|
| 370 | $html .= "\t</tr>\n"; |
---|
| 371 | $html .= "\t\t<td bgcolor=\"#FFFFFF\">$fno</td>\n"; |
---|
| 372 | $html .= "\t\t<td bgcolor=\"#FFFFFF\"><input type=\"checkbox\" name=\"_delcol[]\" value=\"$fno\"></td>\n"; |
---|
| 373 | $html .= "\t\t<td bgcolor=\"#FFFFFF\">".$this->dropdown($cnam,'_cols[]',$name)."</td>\n"; |
---|
| 374 | $value = $rows[0][$name]['value']; |
---|
| 375 | $html .= "\t\t<td bgcolor=\"#FFFFFF\">$value</td>\n"; |
---|
| 376 | $html .= "\t</tr>\n"; |
---|
| 377 | } |
---|
| 378 | $html .= "</table>\n"; |
---|
| 379 | $html .= "<input type=\"submit\" name=\"modifytable\" value=\"Save Changes\">"; |
---|
| 380 | $html .= "</form>"; |
---|
| 381 | return $html; |
---|
| 382 | } |
---|
| 383 | |
---|
| 384 | function dropdown($opts,$name='',$sel='') |
---|
| 385 | { |
---|
| 386 | $items = $opts; |
---|
| 387 | $html = '<select '; |
---|
| 388 | if($name != '') |
---|
| 389 | { |
---|
| 390 | $html .= 'name="'.$name.'"'; |
---|
| 391 | } |
---|
| 392 | $html .= ">\n"; |
---|
| 393 | |
---|
| 394 | while(list(,$itm)=each($opts)) |
---|
| 395 | { |
---|
| 396 | $html .= '<option value="'.$itm.'" '; |
---|
| 397 | if($itm == $sel) |
---|
| 398 | { |
---|
| 399 | $html .= 'selected '; |
---|
| 400 | } |
---|
| 401 | $html .= '>'.$itm."</option>\n"; |
---|
| 402 | } |
---|
| 403 | $html .= "</select>\n"; |
---|
| 404 | return $html; |
---|
| 405 | } |
---|
| 406 | |
---|
| 407 | function make_printlist($layout,$cols) |
---|
| 408 | { |
---|
| 409 | // Build Printlist... (Col and Row Spans...) |
---|
| 410 | $tlayout = $layout; |
---|
| 411 | $printlist = array(); |
---|
| 412 | $mrows = count($tlayout); |
---|
| 413 | $mcols = count($tlayout[0]); |
---|
| 414 | for($pr=0;$pr<$mrows;$pr++) |
---|
| 415 | { |
---|
| 416 | for($pc=0;$pc<$mcols;$pc++) |
---|
| 417 | { |
---|
| 418 | if(isset($tlayout[$pr][$pc])) |
---|
| 419 | { |
---|
| 420 | $cno = $tlayout[$pr][$pc]; |
---|
| 421 | $cname = $cols[$cno]; |
---|
| 422 | $colspan=1; |
---|
| 423 | $rowspan=1; |
---|
| 424 | while(($pr + $rowspan < $mrows) && ($tlayout[$pr + $rowspan][$pc] == $cno)) |
---|
| 425 | { |
---|
| 426 | unset($tlayout[$pr + $rowspan][$pc]); |
---|
| 427 | $rowspan++; |
---|
| 428 | } |
---|
| 429 | while(($pc + $colspan < $mcols) && ($tlayout[$pr][$pc+$colspan] == $cno)) |
---|
| 430 | { |
---|
| 431 | unset($tlayout[$pr][$pc+$colspan]); |
---|
| 432 | $colspan++; |
---|
| 433 | } |
---|
| 434 | if($colspan > 1 && $rowspan > 1) |
---|
| 435 | { |
---|
| 436 | for($r=$pr+1;$r<$pr+$rowspan;$r++) |
---|
| 437 | { |
---|
| 438 | for($c=$pc+1;$c<$pc+$colspan;$c++) |
---|
| 439 | { |
---|
| 440 | unset($tlayout[$r][$c]); |
---|
| 441 | } |
---|
| 442 | } |
---|
| 443 | } |
---|
| 444 | $printlist[] = array( |
---|
| 445 | '#name' =>$cname, |
---|
| 446 | 'rowspan' =>$rowspan, |
---|
| 447 | 'colspan' =>$colspan, |
---|
| 448 | 'valign' =>'top', |
---|
| 449 | '#colno' =>$cno, |
---|
| 450 | '#eor' =>0 |
---|
| 451 | ); |
---|
| 452 | } |
---|
| 453 | } |
---|
| 454 | $printlist[count($printlist)-1]['#eor'] = '1'; |
---|
| 455 | } |
---|
| 456 | return $printlist; |
---|
| 457 | } |
---|
| 458 | |
---|
| 459 | function make_tblhead($printlist,$head) |
---|
| 460 | { |
---|
| 461 | // Build Title Row |
---|
| 462 | $table = array(); |
---|
| 463 | reset($printlist); |
---|
| 464 | while(list($pc,$pcol)=each($printlist)) |
---|
| 465 | { |
---|
| 466 | $cname = $pcol['#name']; |
---|
| 467 | $values = $head[$cname]; |
---|
| 468 | $title = $values['#title']; |
---|
| 469 | if($title == '') |
---|
| 470 | { |
---|
| 471 | $title = $cname; |
---|
| 472 | } |
---|
| 473 | $cparms = $this->arr_merge($values['#parms_hdr'],$pcol); |
---|
| 474 | $cparms['value']=$title; |
---|
| 475 | $table[0][$pc] = $cparms; |
---|
| 476 | } |
---|
| 477 | return $table; |
---|
| 478 | } |
---|
| 479 | |
---|
| 480 | function html_head($head,$table,$printlist) |
---|
| 481 | { |
---|
| 482 | $html = ''; |
---|
| 483 | $tparams = $this->makeparms($head['#table_parms']); |
---|
| 484 | $html .= "<table $tparams>\n"; |
---|
| 485 | $rp = $this->makeparms($head['#head_parms']); |
---|
| 486 | // $html .= "\t<tr $rp> <comment header>\n"; |
---|
| 487 | $html .= "\t<tr $rp> \n"; |
---|
| 488 | |
---|
| 489 | $row = $table[0]; |
---|
| 490 | reset($row); |
---|
| 491 | $intr = true; |
---|
| 492 | while(list(,$col)=each($row)) |
---|
| 493 | { |
---|
| 494 | if(!$intr) |
---|
| 495 | { |
---|
| 496 | $html .= "\t<tr $rp>\n"; |
---|
| 497 | $intr = true; |
---|
| 498 | } |
---|
| 499 | $cname = $col['#name']; |
---|
| 500 | $cp = $this->makeparms($col); |
---|
| 501 | $html .= "\t\t<td $cp>".$col['value']."</td>\n"; |
---|
| 502 | if($col['#eor']=='1') |
---|
| 503 | { |
---|
| 504 | $html .= "\t</tr>\n"; |
---|
| 505 | $intr = false; |
---|
| 506 | } |
---|
| 507 | } |
---|
| 508 | return $html; |
---|
| 509 | } |
---|
| 510 | |
---|
| 511 | function arr_merge($a1='',$a2='',$a3='',$a4='',$a5='',$a6='',$a7='',$a8='') |
---|
| 512 | { |
---|
| 513 | $out = array(); |
---|
| 514 | $test = array($a1,$a2,$a3,$a4,$a5,$a6,$a7,$a8); |
---|
| 515 | while(list(,$val) = each($test)) |
---|
| 516 | { |
---|
| 517 | if(is_array($val)) |
---|
| 518 | { |
---|
| 519 | $out += $val; |
---|
| 520 | } |
---|
| 521 | } |
---|
| 522 | return $out; |
---|
| 523 | } |
---|
| 524 | |
---|
| 525 | function arr_keys($fields,$array=True) |
---|
| 526 | { |
---|
| 527 | @reset($fields); |
---|
| 528 | while(list($key,$val) = @each($fields)) |
---|
| 529 | { |
---|
| 530 | $fkeys .= $key . ','; |
---|
| 531 | } |
---|
| 532 | $fkeys = substr($fkeys,0,-1); |
---|
| 533 | if($array) |
---|
| 534 | { |
---|
| 535 | $ex = explode(',',$fkeys); |
---|
| 536 | return $ex; |
---|
| 537 | } |
---|
| 538 | else |
---|
| 539 | { |
---|
| 540 | return $fkeys; |
---|
| 541 | } |
---|
| 542 | } |
---|
| 543 | } |
---|