2001-08-05 08:48:42 +02:00
|
|
|
<?php
|
|
|
|
/**************************************************************************\
|
2004-01-27 00:26:19 +01:00
|
|
|
* eGroupWare - html *
|
|
|
|
* http://www.egroupware.org *
|
2001-08-05 08:48:42 +02:00
|
|
|
* Written by Jerry Westrick <jerry@westrick.com> *
|
|
|
|
* -------------------------------------------- *
|
|
|
|
* This program is free software; you can redistribute it and/or modify it *
|
|
|
|
* under the terms of the GNU General Public License as published by the *
|
|
|
|
* Free Software Foundation; either version 2 of the License, or (at your *
|
|
|
|
* option) any later version. *
|
|
|
|
\**************************************************************************/
|
|
|
|
|
|
|
|
/* $Id$ */
|
|
|
|
|
2004-08-24 21:57:47 +02:00
|
|
|
class html_tables
|
2001-08-05 08:48:42 +02:00
|
|
|
{
|
2001-09-26 03:02:39 +02:00
|
|
|
function hash_table($rows,$head='',$obj, $frtn)
|
2001-08-05 08:48:42 +02:00
|
|
|
{
|
2004-02-20 16:04:26 +01:00
|
|
|
$start = $_POST['start'] ? $_POST['start'] : $_GET['start'];
|
2001-09-26 03:02:39 +02:00
|
|
|
|
|
|
|
$html = '';
|
2004-02-20 16:04:26 +01:00
|
|
|
$edittable = $head['_edittable'];
|
|
|
|
if(isset($edittable))
|
2001-08-05 08:48:42 +02:00
|
|
|
{
|
2004-02-20 16:04:26 +01:00
|
|
|
if($edittable)
|
2001-08-12 03:06:07 +02:00
|
|
|
{
|
2001-09-26 03:02:39 +02:00
|
|
|
// Generate the customization table...
|
|
|
|
return $this->edit_table($rows,$head,$obj,$frtn);
|
2001-08-12 03:06:07 +02:00
|
|
|
}
|
2001-09-26 03:02:39 +02:00
|
|
|
else
|
2001-08-12 03:06:07 +02:00
|
|
|
{
|
2011-04-13 12:07:42 +02:00
|
|
|
//$bo =& CreateObject('admin.bolog',True);
|
2004-02-20 16:04:26 +01:00
|
|
|
if(!isset($start))
|
2001-09-26 03:02:39 +02:00
|
|
|
{
|
|
|
|
$start = 0;
|
|
|
|
}
|
2005-10-14 19:03:16 +02:00
|
|
|
$num_rows = $GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs'];
|
2001-09-26 03:02:39 +02:00
|
|
|
$stop = $start + $num_rows;
|
2004-02-20 16:04:26 +01:00
|
|
|
if($stop > count($rows))
|
2001-09-26 03:02:39 +02:00
|
|
|
{
|
|
|
|
$stop = count($rows);
|
|
|
|
}
|
2005-10-14 19:03:16 +02:00
|
|
|
$nextmatchs =& CreateObject('phpgwapi.nextmatchs');
|
2011-04-13 12:07:42 +02:00
|
|
|
$total_records = count($rows);//$bo->get_no_errors();
|
2001-09-26 03:02:39 +02:00
|
|
|
$left = $nextmatchs->left('/index.php',$start,$total_records,'menuaction=admin.uilog.list_log');
|
|
|
|
$right = $nextmatchs->right('/index.php',$start,$total_records,'menuaction=admin.uilog.list_log');
|
2004-02-20 16:04:26 +01:00
|
|
|
$hits = $nextmatchs->show_hits($total_records,$start);
|
2001-09-26 03:02:39 +02:00
|
|
|
|
|
|
|
$html .= '<table width="98%"><tr>';
|
2003-10-22 07:14:56 +02:00
|
|
|
$html .= $left;
|
2001-09-26 03:02:39 +02:00
|
|
|
$html .= '<td align="right"> ' . $hits . ' </td>';
|
2005-10-14 19:03:16 +02:00
|
|
|
$html .= '<td align="left"> <a href=' . $GLOBALS['egw']->link('/index.php','menuaction=admin.uilog.list_log&editable=true') .'> ' . lang('Edit Table format') . '</a></td>';
|
2003-10-22 07:14:56 +02:00
|
|
|
$html .= $right;
|
2001-09-26 03:02:39 +02:00
|
|
|
$html .= '</tr></table>';
|
2001-08-12 03:06:07 +02:00
|
|
|
}
|
2001-08-05 08:48:42 +02:00
|
|
|
}
|
2001-09-26 03:02:39 +02:00
|
|
|
|
2004-02-20 16:04:26 +01:00
|
|
|
if($head == '')
|
2001-08-05 08:48:42 +02:00
|
|
|
{
|
2001-09-26 03:02:39 +02:00
|
|
|
$frow = $rows[0];
|
|
|
|
$cnam = $this->arr_keys($frow);
|
|
|
|
while(list(,$fn)=each($cnam))
|
|
|
|
{
|
|
|
|
$head[$fn] = array();
|
|
|
|
}
|
2001-08-05 08:48:42 +02:00
|
|
|
}
|
|
|
|
|
2003-12-20 19:51:51 +01:00
|
|
|
if(@is_null($head['_cols']))
|
2001-09-26 03:02:39 +02:00
|
|
|
{
|
|
|
|
$cols = $this->arr_keys($rows[0]);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$cols = $head['_cols'];
|
|
|
|
}
|
2001-08-12 03:06:07 +02:00
|
|
|
|
2001-09-26 03:02:39 +02:00
|
|
|
// Build Header Row...
|
2001-08-12 03:06:07 +02:00
|
|
|
|
2001-09-26 03:02:39 +02:00
|
|
|
// First Get the layout arrays...
|
|
|
|
$layout = $head['#layout'];
|
2004-02-20 16:04:26 +01:00
|
|
|
if(!is_array($layout))
|
2001-09-26 03:02:39 +02:00
|
|
|
{
|
|
|
|
$layout = $this->arr_keys($cols);
|
2004-02-20 16:04:26 +01:00
|
|
|
}
|
2001-08-12 03:06:07 +02:00
|
|
|
|
2004-02-20 16:04:26 +01:00
|
|
|
// printlist, a list of all columns in a logical row,
|
2001-09-26 03:02:39 +02:00
|
|
|
// with Row/ColSpawn values, in print order...
|
2001-08-12 03:06:07 +02:00
|
|
|
|
2001-09-26 03:02:39 +02:00
|
|
|
$printlist = $this->make_printlist($layout,$cols);
|
|
|
|
|
|
|
|
// $table contains data for header row....
|
|
|
|
$table = $this->make_tblhead($printlist,$head);
|
|
|
|
|
2004-02-20 16:04:26 +01:00
|
|
|
// get GroupBy
|
2001-09-26 03:02:39 +02:00
|
|
|
$groupby = $head['_groupby'];
|
|
|
|
$supres = $head['_supres'];
|
|
|
|
$lastgroup = '';
|
|
|
|
|
|
|
|
// build actual Rows...
|
|
|
|
$rparms = array();
|
|
|
|
$mrow = $stop;
|
2004-02-20 16:04:26 +01:00
|
|
|
for($rno=0;$rno<$mrow;$rno++)
|
2001-08-06 18:46:57 +02:00
|
|
|
{
|
2001-09-26 03:02:39 +02:00
|
|
|
// Build GroupKey
|
2004-02-20 16:04:26 +01:00
|
|
|
if(isset($groupby))
|
2001-08-06 18:46:57 +02:00
|
|
|
{
|
2001-09-26 03:02:39 +02:00
|
|
|
$gkey = '';
|
|
|
|
reset($groupby);
|
2004-02-20 16:04:26 +01:00
|
|
|
while(list($gname,)=each($groupby))
|
2001-09-26 03:02:39 +02:00
|
|
|
{
|
|
|
|
$gkey .= $rows[$rno][$gname]['value'];
|
|
|
|
}
|
|
|
|
$rows[$rno]['#gkey'] = $gkey;
|
2001-08-06 18:46:57 +02:00
|
|
|
}
|
2001-08-12 03:06:07 +02:00
|
|
|
|
2001-09-26 03:02:39 +02:00
|
|
|
reset($printlist);
|
|
|
|
while(list($pc,$pcol)=each($printlist))
|
|
|
|
{
|
|
|
|
$cname = $pcol['#name'];
|
2003-10-22 07:14:56 +02:00
|
|
|
$cparms = $this->arr_merge($head[$cname],$pcol,array('bgcolor'=>'#FFFFFF'),$rows[$rno][$cname]);
|
2001-09-26 03:02:39 +02:00
|
|
|
$rows[$rno][$cname] = $cparms;
|
|
|
|
}
|
2001-08-06 18:46:57 +02:00
|
|
|
}
|
|
|
|
|
2001-09-26 03:02:39 +02:00
|
|
|
// Grouping Suppression
|
2001-08-06 18:46:57 +02:00
|
|
|
|
2004-02-20 16:04:26 +01:00
|
|
|
if(isset($groupby))
|
2001-08-06 18:46:57 +02:00
|
|
|
{
|
2001-09-26 03:02:39 +02:00
|
|
|
$grno = $start;
|
|
|
|
$gkey = $rows[$start]['#gkey'];
|
2004-02-20 16:04:26 +01:00
|
|
|
for($rno=$start+1;$rno<$stop;$rno++)
|
2001-08-06 18:46:57 +02:00
|
|
|
{
|
2001-09-26 03:02:39 +02:00
|
|
|
$rowspan = 1;
|
|
|
|
$rkey = $rows[$rno]['#gkey'];
|
2001-08-05 08:48:42 +02:00
|
|
|
|
2004-02-20 16:04:26 +01:00
|
|
|
while( $gkey == $rkey)
|
2001-08-06 18:46:57 +02:00
|
|
|
{
|
2001-09-26 03:02:39 +02:00
|
|
|
//echo "<p>grno:$grno ($gkey) rno:$rno ($rkey) are equal</p>";
|
|
|
|
$rowspan = $rowspan + 1;
|
|
|
|
$row = $rows[$rno];
|
|
|
|
|
2004-02-20 16:04:26 +01:00
|
|
|
for($pc=0;$pc<count($row);$pc++)
|
2001-08-06 18:46:57 +02:00
|
|
|
{
|
2001-09-26 03:02:39 +02:00
|
|
|
$c = $row[$cols[$pc]];
|
|
|
|
$cno = $c['#colno'];
|
|
|
|
$cname = $c['#name'];
|
|
|
|
|
2004-02-20 16:04:26 +01:00
|
|
|
if($supres[$cname])
|
2001-09-26 03:02:39 +02:00
|
|
|
{
|
|
|
|
$rows[$rno][$cname]['#supres']='yes';
|
|
|
|
$rows[$rno][$cname]['value']='  ';
|
|
|
|
$rows[$grno][$cname]['rowspan']=$printlist[$cno]['rowspan']*$rowspan;
|
|
|
|
}
|
2001-08-06 18:46:57 +02:00
|
|
|
}
|
2001-09-26 03:02:39 +02:00
|
|
|
$rno++;
|
|
|
|
$rkey = $rows[$rno]['#gkey'];
|
2001-08-06 18:46:57 +02:00
|
|
|
}
|
2001-09-26 03:02:39 +02:00
|
|
|
//echo "<p>grno:$grno ($gkey) rno:$rno ($rkey) are not equal</p>";
|
|
|
|
$grno=$rno;
|
|
|
|
$gkey=$rkey;
|
|
|
|
}
|
2001-08-06 18:46:57 +02:00
|
|
|
}
|
2001-09-26 03:02:39 +02:00
|
|
|
/*
|
|
|
|
** Now Generate the Html For the Table Header
|
|
|
|
*/
|
|
|
|
//print_r($table);
|
|
|
|
|
|
|
|
$html .= $this->html_head($head,$table,$printlist);
|
|
|
|
/*
|
2004-02-20 16:04:26 +01:00
|
|
|
** Now (finally) Generate the Html For the Table
|
2001-09-26 03:02:39 +02:00
|
|
|
*/
|
|
|
|
//print_r($rows);
|
2004-02-20 16:04:26 +01:00
|
|
|
for($rno=$start;$rno<$stop;$rno++)
|
2001-08-05 08:48:42 +02:00
|
|
|
{
|
2001-09-26 03:02:39 +02:00
|
|
|
// let user have a hack at the row...
|
|
|
|
$row = $obj->$frtn($rno,$rows[$rno]);
|
|
|
|
// $row = $rows[$rno];
|
|
|
|
|
|
|
|
// $rp = $this->makeparms($row[$rno]['#row_parms']);
|
|
|
|
$rp = '';
|
|
|
|
$gkey = $row['#gkey'];
|
|
|
|
// $html .= "\t<tr $rp> <comment $gkey>\n";
|
|
|
|
$html .= "\t<tr $rp> \n";
|
|
|
|
reset($printlist);
|
|
|
|
while(list($pc,$pcol)=each($printlist))
|
2001-08-06 18:46:57 +02:00
|
|
|
{
|
2001-09-26 03:02:39 +02:00
|
|
|
$cname = $pcol['#name'];
|
|
|
|
|
|
|
|
$cp = $this->makeparms($row[$cname]);
|
|
|
|
if($row[$cname]['#supres'] != 'yes')
|
|
|
|
{
|
|
|
|
$html .= "\t\t<td $cp>".$row[$cname]['value']."</td>\n";
|
|
|
|
}
|
|
|
|
if($pcol['#eor']=='1')
|
|
|
|
{
|
|
|
|
$html .= "\t</tr>\n"; // \t<tr $rp>\n
|
|
|
|
}
|
2001-08-12 03:06:07 +02:00
|
|
|
}
|
2001-08-05 08:48:42 +02:00
|
|
|
}
|
2001-09-26 03:02:39 +02:00
|
|
|
$html .= "</table>\n";
|
2003-10-22 07:14:56 +02:00
|
|
|
#$html .= "</form>";
|
2001-09-26 03:02:39 +02:00
|
|
|
return $html;
|
2001-08-05 08:48:42 +02:00
|
|
|
}
|
2001-08-06 18:46:57 +02:00
|
|
|
|
2001-09-26 03:02:39 +02:00
|
|
|
function makeparms($parmlist)
|
2001-08-06 18:46:57 +02:00
|
|
|
{
|
2001-09-26 03:02:39 +02:00
|
|
|
$html = '';
|
|
|
|
$comma = ' ';
|
2004-02-20 16:04:26 +01:00
|
|
|
if(!is_array($parmlist))
|
2001-08-06 18:46:57 +02:00
|
|
|
{
|
2001-09-26 03:02:39 +02:00
|
|
|
return '';
|
|
|
|
}
|
|
|
|
reset($parmlist);
|
|
|
|
while(list($pname,$pvalue)=each($parmlist))
|
|
|
|
{
|
|
|
|
switch($pname)
|
|
|
|
{
|
|
|
|
case 'value':
|
|
|
|
break;
|
|
|
|
case 'colspan':
|
|
|
|
case 'rowspan':
|
2004-02-20 16:04:26 +01:00
|
|
|
if($pvalue != 1)
|
2001-09-26 03:02:39 +02:00
|
|
|
{
|
|
|
|
$html .= $comma . $pname . '="' . $pvalue . '"';
|
2003-10-22 07:14:56 +02:00
|
|
|
#$comma = ', ';
|
|
|
|
$comma = ' ';
|
2001-09-26 03:02:39 +02:00
|
|
|
};
|
|
|
|
break;
|
|
|
|
default:
|
2004-02-20 16:04:26 +01:00
|
|
|
if(substr($pname,0,1) != '#')
|
2001-09-26 03:02:39 +02:00
|
|
|
{
|
|
|
|
$html .= $comma . $pname . '="' . $pvalue . '"';
|
2003-10-22 07:14:56 +02:00
|
|
|
#$comma = ', ';
|
|
|
|
$comma = ' ';
|
2001-09-26 03:02:39 +02:00
|
|
|
}
|
|
|
|
}
|
2001-08-06 18:46:57 +02:00
|
|
|
}
|
2001-09-26 03:02:39 +02:00
|
|
|
return $html;
|
2001-08-06 18:46:57 +02:00
|
|
|
}
|
|
|
|
|
2001-09-26 03:02:39 +02:00
|
|
|
function edit_table($rows,$head='',$obj, $frtn)
|
2001-08-05 08:48:42 +02:00
|
|
|
{
|
2004-02-20 16:04:26 +01:00
|
|
|
$nocols = $_POST['nocols'];
|
|
|
|
$noflds = $_POST['noflds'];
|
|
|
|
$norows = $_POST['norows'];
|
|
|
|
$layout = $_POST['layout'];
|
|
|
|
$_cols = $_POST['_cols'];
|
2001-09-26 03:02:39 +02:00
|
|
|
|
|
|
|
$html = '';
|
|
|
|
$html .= '<form method="post" action="'
|
2005-10-14 19:03:16 +02:00
|
|
|
. $GLOBALS['egw']->link('/index.php','menuaction=admin.uilog.list_log&editable=true')
|
2001-09-26 03:02:39 +02:00
|
|
|
. '">' . "\n";
|
|
|
|
|
|
|
|
$params = $head['_table_parms'];
|
|
|
|
$frow = $rows[0];
|
|
|
|
$cnam = $this->arr_keys($frow);
|
2004-02-20 16:04:26 +01:00
|
|
|
if($head == '')
|
2001-08-05 08:48:42 +02:00
|
|
|
{
|
2001-09-26 03:02:39 +02:00
|
|
|
while(list(,$fn)=each($cnam))
|
|
|
|
{
|
|
|
|
$head[$fn] = array();
|
|
|
|
}
|
2001-08-05 08:48:42 +02:00
|
|
|
}
|
|
|
|
|
2004-02-20 16:04:26 +01:00
|
|
|
if(isset($_cols))
|
2001-08-12 03:06:07 +02:00
|
|
|
{
|
2001-09-26 03:02:39 +02:00
|
|
|
$cols = $_cols;
|
2001-08-12 03:06:07 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-12-20 19:51:51 +01:00
|
|
|
if(@is_null($head['_cols']))
|
2001-09-26 03:02:39 +02:00
|
|
|
{
|
|
|
|
$cols = $this->arr_keys($rows[0]);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$cols = $head['_cols'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-02-20 16:04:26 +01:00
|
|
|
if(!isset($noflds))
|
2001-09-26 03:02:39 +02:00
|
|
|
{
|
|
|
|
$noflds = count($cols);
|
|
|
|
}
|
2004-02-20 16:04:26 +01:00
|
|
|
if(!isset($layout))
|
2001-09-26 03:02:39 +02:00
|
|
|
{
|
|
|
|
$layout = $head['#layout'];
|
|
|
|
}
|
2004-02-20 16:04:26 +01:00
|
|
|
if(!isset($norows))
|
2001-09-26 03:02:39 +02:00
|
|
|
{
|
|
|
|
$norows = count($layout);
|
|
|
|
}
|
2004-02-20 16:04:26 +01:00
|
|
|
if(!isset($nocols))
|
2001-09-26 03:02:39 +02:00
|
|
|
{
|
|
|
|
$nocols = count($layout[0]);
|
|
|
|
}
|
|
|
|
// Table Excmple
|
|
|
|
|
|
|
|
// Build Header Row...
|
|
|
|
$html .= "<h2>Table Size</h2>";
|
|
|
|
// $html .= "<p>";
|
|
|
|
$html .= "Rows: ";
|
|
|
|
$html .= "<input type=\"input\" name=\"norows\" value=\"$norows\">";
|
|
|
|
$html .= "Columns: ";
|
|
|
|
$html .= "<input type=\"input\" name=\"nocols\" value=\"$nocols\">";
|
|
|
|
$html .= "Fields: ";
|
|
|
|
$html .= "<input type=\"input\" name=\"noflds\" value=\"$noflds\">";
|
|
|
|
// $html .= "\t<tr> ";
|
|
|
|
|
|
|
|
// Column Defintions...
|
|
|
|
$html .= "<h2>Column Definition</h2>";
|
2003-10-22 07:14:56 +02:00
|
|
|
$html .= "<table width=\"98%\" bgcolor=\"#000000\">\n";
|
2004-02-20 16:04:26 +01:00
|
|
|
$f = array();
|
|
|
|
for($fno=0;$fno<$noflds;$fno++)
|
2001-09-26 03:02:39 +02:00
|
|
|
{
|
|
|
|
$f[]=$fno;
|
|
|
|
}
|
|
|
|
// Column Headings
|
2003-10-22 07:14:56 +02:00
|
|
|
$html .= "\t<tr bgcolor=\"#D3DCFF\">\n";
|
2004-02-20 16:04:26 +01:00
|
|
|
for($cno=0;$cno<$nocols;$cno++)
|
2001-08-12 03:06:07 +02:00
|
|
|
{
|
2003-10-22 07:14:56 +02:00
|
|
|
$html .= "\t\t<td align=\"center\">$cno</td>\n";
|
2001-08-12 03:06:07 +02:00
|
|
|
}
|
|
|
|
$html .= "\t</tr >\n";
|
2004-02-20 16:04:26 +01:00
|
|
|
for($rno=0;$rno<$norows;$rno++)
|
2001-08-05 08:48:42 +02:00
|
|
|
{
|
2003-10-22 07:14:56 +02:00
|
|
|
$html .= "\t<tr bgcolor=\"#D3DCFF\">\n";
|
2004-02-20 16:04:26 +01:00
|
|
|
for($cno=0;$cno<$nocols;$cno++)
|
2001-09-26 03:02:39 +02:00
|
|
|
{
|
|
|
|
$c = $layout[$rno][$cno];
|
|
|
|
$tname = "layout[$rno][]";
|
|
|
|
$t = $this->DropDown($f,$tname,$c);
|
2003-10-22 07:14:56 +02:00
|
|
|
$html .= "\t\t<td align=\"center\">$t</td>\n";
|
2001-09-26 03:02:39 +02:00
|
|
|
}
|
|
|
|
$html .= "\t</tr >\n";
|
2001-08-05 08:48:42 +02:00
|
|
|
}
|
2001-09-26 03:02:39 +02:00
|
|
|
$html .= "</table>\n";
|
|
|
|
$html .= "<p>\n";
|
|
|
|
|
|
|
|
// Header of Table...
|
|
|
|
$printlist = $this->make_printlist($layout,$cols);
|
|
|
|
$table = $this->make_tblhead($printlist,$head);
|
|
|
|
$html .= $this->html_head($head,$table,$printlist);
|
|
|
|
$html .= "</table>\n";
|
|
|
|
|
|
|
|
$html .= "<input type=\"submit\" name=\"submit\" value=\"Update\">";
|
|
|
|
//Field Definitions
|
|
|
|
$html .= "<h2>Field Definitions</h2>";
|
2003-10-22 07:14:56 +02:00
|
|
|
$html .= "<table width=\"98%\" bgcolor=\"#D3DCFF\">\n";
|
|
|
|
$html .= "\t\t<td width=\"2%\" align=\"center\">No</td>\n";
|
|
|
|
$html .= "\t\t<td width=\"2%\" align=\"center\">Del</td>\n";
|
2001-09-26 03:02:39 +02:00
|
|
|
$html .= "\t\t<td width=\"5%\">Field</td>\n";
|
|
|
|
$html .= "\t\t<td>Value</td>\n";
|
2001-08-05 08:48:42 +02:00
|
|
|
$html .= "\t</tr>\n";
|
|
|
|
|
2001-09-26 03:02:39 +02:00
|
|
|
// Add Table Rows...
|
|
|
|
reset($cols);
|
2004-02-20 16:04:26 +01:00
|
|
|
// while(list($cno,$name) = each($cols))
|
|
|
|
for($fno=0;$fno<$noflds;$fno++)
|
2001-09-26 03:02:39 +02:00
|
|
|
{
|
|
|
|
$name = $cols[$fno];
|
|
|
|
$values = $head[$name];
|
|
|
|
$title = $values['title'];
|
2004-02-20 16:04:26 +01:00
|
|
|
if($title == '')
|
2001-09-26 03:02:39 +02:00
|
|
|
{
|
|
|
|
$title = $name;
|
|
|
|
}
|
|
|
|
$html .= "\t</tr>\n";
|
2003-10-22 07:14:56 +02:00
|
|
|
$html .= "\t\t<td bgcolor=\"#FFFFFF\">$fno</td>\n";
|
|
|
|
$html .= "\t\t<td bgcolor=\"#FFFFFF\"><input type=\"checkbox\" name=\"_delcol[]\" value=\"$fno\"></td>\n";
|
|
|
|
$html .= "\t\t<td bgcolor=\"#FFFFFF\">".$this->dropdown($cnam,'_cols[]',$name)."</td>\n";
|
2001-09-26 03:02:39 +02:00
|
|
|
$value = $rows[0][$name]['value'];
|
2003-10-22 07:14:56 +02:00
|
|
|
$html .= "\t\t<td bgcolor=\"#FFFFFF\">$value</td>\n";
|
2001-09-26 03:02:39 +02:00
|
|
|
$html .= "\t</tr>\n";
|
|
|
|
}
|
|
|
|
$html .= "</table>\n";
|
|
|
|
$html .= "<input type=\"submit\" name=\"modifytable\" value=\"Save Changes\">";
|
|
|
|
$html .= "</form>";
|
|
|
|
return $html;
|
2001-08-05 08:48:42 +02:00
|
|
|
}
|
2001-09-26 03:02:39 +02:00
|
|
|
|
|
|
|
function dropdown($opts,$name='',$sel='')
|
2001-08-05 08:48:42 +02:00
|
|
|
{
|
2001-09-26 03:02:39 +02:00
|
|
|
$items = $opts;
|
|
|
|
$html = '<select ';
|
2004-02-20 16:04:26 +01:00
|
|
|
if($name != '')
|
2001-08-05 08:48:42 +02:00
|
|
|
{
|
2001-09-26 03:02:39 +02:00
|
|
|
$html .= 'name="'.$name.'"';
|
2001-08-05 08:48:42 +02:00
|
|
|
}
|
2001-09-26 03:02:39 +02:00
|
|
|
$html .= ">\n";
|
2001-08-05 08:48:42 +02:00
|
|
|
|
2004-02-20 16:04:26 +01:00
|
|
|
while(list(,$itm)=each($opts))
|
2001-09-26 03:02:39 +02:00
|
|
|
{
|
|
|
|
$html .= '<option value="'.$itm.'" ';
|
2004-02-20 16:04:26 +01:00
|
|
|
if($itm == $sel)
|
2001-09-26 03:02:39 +02:00
|
|
|
{
|
|
|
|
$html .= 'selected ';
|
|
|
|
}
|
|
|
|
$html .= '>'.$itm."</option>\n";
|
|
|
|
}
|
|
|
|
$html .= "</select>\n";
|
|
|
|
return $html;
|
|
|
|
}
|
2001-08-05 08:48:42 +02:00
|
|
|
|
2001-09-26 03:02:39 +02:00
|
|
|
function make_printlist($layout,$cols)
|
2001-08-12 03:06:07 +02:00
|
|
|
{
|
2001-09-26 03:02:39 +02:00
|
|
|
// Build Printlist... (Col and Row Spans...)
|
|
|
|
$tlayout = $layout;
|
|
|
|
$printlist = array();
|
|
|
|
$mrows = count($tlayout);
|
|
|
|
$mcols = count($tlayout[0]);
|
|
|
|
for($pr=0;$pr<$mrows;$pr++)
|
2001-08-12 03:06:07 +02:00
|
|
|
{
|
2001-09-26 03:02:39 +02:00
|
|
|
for($pc=0;$pc<$mcols;$pc++)
|
2001-08-12 03:06:07 +02:00
|
|
|
{
|
2004-02-20 16:04:26 +01:00
|
|
|
if(isset($tlayout[$pr][$pc]))
|
2001-08-12 03:06:07 +02:00
|
|
|
{
|
2001-09-26 03:02:39 +02:00
|
|
|
$cno = $tlayout[$pr][$pc];
|
|
|
|
$cname = $cols[$cno];
|
|
|
|
$colspan=1;
|
|
|
|
$rowspan=1;
|
|
|
|
while(($pr + $rowspan < $mrows) && ($tlayout[$pr + $rowspan][$pc] == $cno))
|
|
|
|
{
|
|
|
|
unset($tlayout[$pr + $rowspan][$pc]);
|
|
|
|
$rowspan++;
|
|
|
|
}
|
|
|
|
while(($pc + $colspan < $mcols) && ($tlayout[$pr][$pc+$colspan] == $cno))
|
2001-08-12 03:06:07 +02:00
|
|
|
{
|
2001-09-26 03:02:39 +02:00
|
|
|
unset($tlayout[$pr][$pc+$colspan]);
|
|
|
|
$colspan++;
|
|
|
|
}
|
2004-02-20 16:04:26 +01:00
|
|
|
if($colspan > 1 && $rowspan > 1)
|
2001-09-26 03:02:39 +02:00
|
|
|
{
|
|
|
|
for($r=$pr+1;$r<$pr+$rowspan;$r++)
|
2001-08-12 03:06:07 +02:00
|
|
|
{
|
2001-09-26 03:02:39 +02:00
|
|
|
for($c=$pc+1;$c<$pc+$colspan;$c++)
|
|
|
|
{
|
|
|
|
unset($tlayout[$r][$c]);
|
|
|
|
}
|
2001-08-12 03:06:07 +02:00
|
|
|
}
|
|
|
|
}
|
2001-09-26 03:02:39 +02:00
|
|
|
$printlist[] = array(
|
|
|
|
'#name' =>$cname,
|
|
|
|
'rowspan' =>$rowspan,
|
|
|
|
'colspan' =>$colspan,
|
|
|
|
'valign' =>'top',
|
|
|
|
'#colno' =>$cno,
|
|
|
|
'#eor' =>0
|
|
|
|
);
|
2001-08-12 03:06:07 +02:00
|
|
|
}
|
|
|
|
}
|
2001-09-26 03:02:39 +02:00
|
|
|
$printlist[count($printlist)-1]['#eor'] = '1';
|
2001-08-12 03:06:07 +02:00
|
|
|
}
|
2001-09-26 03:02:39 +02:00
|
|
|
return $printlist;
|
2001-08-12 03:06:07 +02:00
|
|
|
}
|
2001-08-05 08:48:42 +02:00
|
|
|
|
2001-09-26 03:02:39 +02:00
|
|
|
function make_tblhead($printlist,$head)
|
2001-08-12 03:06:07 +02:00
|
|
|
{
|
2001-09-26 03:02:39 +02:00
|
|
|
// Build Title Row
|
|
|
|
$table = array();
|
|
|
|
reset($printlist);
|
|
|
|
while(list($pc,$pcol)=each($printlist))
|
2001-08-12 03:06:07 +02:00
|
|
|
{
|
2001-09-26 03:02:39 +02:00
|
|
|
$cname = $pcol['#name'];
|
|
|
|
$values = $head[$cname];
|
|
|
|
$title = $values['#title'];
|
2004-02-20 16:04:26 +01:00
|
|
|
if($title == '')
|
2001-09-26 03:02:39 +02:00
|
|
|
{
|
|
|
|
$title = $cname;
|
|
|
|
}
|
|
|
|
$cparms = $this->arr_merge($values['#parms_hdr'],$pcol);
|
|
|
|
$cparms['value']=$title;
|
|
|
|
$table[0][$pc] = $cparms;
|
2001-08-12 03:06:07 +02:00
|
|
|
}
|
2001-09-26 03:02:39 +02:00
|
|
|
return $table;
|
2001-08-12 03:06:07 +02:00
|
|
|
}
|
|
|
|
|
2001-09-26 03:02:39 +02:00
|
|
|
function html_head($head,$table,$printlist)
|
2001-08-12 03:06:07 +02:00
|
|
|
{
|
2001-09-26 03:02:39 +02:00
|
|
|
$html = '';
|
|
|
|
$tparams = $this->makeparms($head['#table_parms']);
|
|
|
|
$html .= "<table $tparams>\n";
|
|
|
|
$rp = $this->makeparms($head['#head_parms']);
|
|
|
|
// $html .= "\t<tr $rp> <comment header>\n";
|
|
|
|
$html .= "\t<tr $rp> \n";
|
|
|
|
|
|
|
|
$row = $table[0];
|
|
|
|
reset($row);
|
|
|
|
$intr = true;
|
|
|
|
while(list(,$col)=each($row))
|
2001-08-12 03:06:07 +02:00
|
|
|
{
|
2004-02-20 16:04:26 +01:00
|
|
|
if(!$intr)
|
2001-09-26 03:02:39 +02:00
|
|
|
{
|
|
|
|
$html .= "\t<tr $rp>\n";
|
|
|
|
$intr = true;
|
|
|
|
}
|
|
|
|
$cname = $col['#name'];
|
|
|
|
$cp = $this->makeparms($col);
|
|
|
|
$html .= "\t\t<td $cp>".$col['value']."</td>\n";
|
|
|
|
if($col['#eor']=='1')
|
|
|
|
{
|
|
|
|
$html .= "\t</tr>\n";
|
|
|
|
$intr = false;
|
|
|
|
}
|
2001-08-12 03:06:07 +02:00
|
|
|
}
|
2001-09-26 03:02:39 +02:00
|
|
|
return $html;
|
|
|
|
}
|
|
|
|
|
|
|
|
function arr_merge($a1='',$a2='',$a3='',$a4='',$a5='',$a6='',$a7='',$a8='')
|
|
|
|
{
|
|
|
|
$out = array();
|
|
|
|
$test = array($a1,$a2,$a3,$a4,$a5,$a6,$a7,$a8);
|
|
|
|
while(list(,$val) = each($test))
|
2001-08-12 03:06:07 +02:00
|
|
|
{
|
2001-09-26 03:02:39 +02:00
|
|
|
if(is_array($val))
|
|
|
|
{
|
|
|
|
$out += $val;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $out;
|
2001-08-12 03:06:07 +02:00
|
|
|
}
|
|
|
|
|
2001-09-26 03:02:39 +02:00
|
|
|
function arr_keys($fields,$array=True)
|
|
|
|
{
|
|
|
|
@reset($fields);
|
|
|
|
while(list($key,$val) = @each($fields))
|
|
|
|
{
|
|
|
|
$fkeys .= $key . ',';
|
|
|
|
}
|
|
|
|
$fkeys = substr($fkeys,0,-1);
|
|
|
|
if($array)
|
|
|
|
{
|
|
|
|
$ex = explode(',',$fkeys);
|
|
|
|
return $ex;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return $fkeys;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|