' . $person_id . '';
}
}
function plc_node_link ($node_id) {
if ( empty ($node_id)) {
return "";
} else {
return '' . $node_id . '';
}
}
// pagination function
function paginate( $fn_array, $table_id, $caption, $limit, $main_field, $other_func= NULL, $fid= NULL ) {
// get vars from call adjust them
$dir= strtolower( $caption );
$echo= "";
$link_page= 'index.php';
// check for page number
if( empty( $_GET['page'] ) )
$page= 1;
else
$page= $_GET['page'];
// reorder array_chunk
foreach( $fn_array as $arr1 ) {
unset( $arr2 );
foreach( $arr1 as $key => $val ) {
// if( substr( $key, -3 ) == "_id" )
if ( $key == $table_id ) {
$id[$key]= $val;
} else {
$data[$key]= $val;
}
}
foreach( $id as $key => $val )
$arr2[$key]= $val;
foreach( $data as $key => $val )
$arr2[$key]= $val;
$as_array[]= $arr2;
}
$totalrows= count( $as_array );
// if array has no rows display msg
if( $totalrows == 0 )
return "Nothing to display";
// set key and break up data struct
$newkey= $page - 1;
$newarray= array_chunk( $as_array, $limit );
// start table output
$echo.= "
\n";
// if there is a caption add it to table
if( $caption )
$echo.= "
$caption
\n";
$echo.= "
";
// go through keys of one array row for table headers
foreach( $newarray[$newkey][0] as $key => $val ) {
// if( substr( $key, -3 ) != "_id" )
if ( $key != $table_id && $key != 'peer_id' )
$echo.= "
". ucfirst( $key ) ."
";
}
if( $other_func == 'slivers' )
$echo.= "
Slivers
";
$echo.= "
\n";
// go through array row by row to output table rows
foreach( $newarray[$newkey] as $assoc ) {
$extraclass="";
if ($assoc['peer_id']) {
$extraclass="plc-foreign";
}
$echo.= "
";
foreach( $assoc as $key => $val ) {
// do not rely on keys order
$id = $assoc[$table_id];
// if( substr( $key, -3 ) == "_id" )
if ($key == $table_id) {
// $id= $val;
continue;
} elseif( $key == $main_field ) {
$echo.= "