function amr_get_csv_lines($ulist)
{
    /* get the whole cached file - write to file? but security / privacy ? */
    /* how big */
    $c = new adb_cache();
    $rptid = $c->reportid($ulist);
    //$total = $c->get_cache_totallines ($rptid );  // nlr should rather pass 0 to get all
    $lines = $c->get_cache_report_lines($rptid, 0, 0);
    if (empty($lines)) {
        return false;
    }
    // 20140722 no headings lines at moment either
    $headinglines = $c->get_column_headings($rptid);
    array_unshift($lines, $headinglines[1]);
    //$lines = $c->get_cache_report_lines($rptid,0,$total);
    /* we want the heading line (line1), but not the internal nameslines (line 0) , 
    	plus all the data lines, so neeed total + 1 */
    return $lines;
}
function alist_one_widget($type = 'user', $i = 1, $do_headings = false, $do_csv = false, $max = 10)
{
    /* a widget version of alist one*/
    /* Get the fields to use for the chosen list type */
    global $aopt;
    global $amain;
    $c = new adb_cache();
    $rptid = $c->reportid($i, $type);
    $lines = $c->get_column_headings($rptid);
    /* get the internal heading names  for internal plugin use only */
    /* get the user defined heading names */
    $line = $lines['0'];
    if (!defined('str_getcsv')) {
        $icols = amr_str_getcsv($line[0]['csvcontent'], ',', '"', '\\');
    } else {
        $icols = str_getcsv($line[0]['csvcontent'], ',', '"', '\\');
    }
    //		if (!defined('str_getcsv')) $cols = amr_str_getcsv( $line[1]['csvcontent'], '","','"','\\');
    //		else $cols = str_getcsv( $line[1]['csvcontent'], ',','"','\\');
    foreach ($icols as $ic => $cv) {
        /* use the icols as our controlling array, so that we have the internal field names */
        $v = $cols[$ic];
        $html .= '<th>' . $v . '</th>';
    }
    $hhtml = '<thead><tr>' . $html . '</tr></thead>';
    /* setup the html for the table headings */
    $fhtml = '<tfoot><tr>' . $html . '</tr>' . '</tfoot>';
    /* setup the html for the table headings */
    $html = '';
    $totalitems = $c->get_cache_totallines($rptid);
    $lines = $c->get_cache_report_lines($rptid, $start + 1, $max);
    if (!($lines > 0)) {
        amr_flag_error($c->get_error('numoflists'));
        return false;
    }
    foreach ($lines as $il => $lineitems) {
        //if (WP_DEBUG) var_dump($lineitems);
        $id = $lineitems[0];
        /*  *** pop the first one - this should always be the id */
        $user = amr_get_userdata($id);
        unset($linehtml);
        foreach ($icols as $ic => $c) {
            /* use the icols as our controlling array, so that we have the internal field names */
            $v = $lineitems[$ic];
            $linehtml .= '<td>' . amr_format_user_cell($c, $v, $user, $l) . '</td>';
        }
        $html .= PHP_EOL . '<tr>' . $linehtml . '</tr>';
    }
    $html = '<table>' . $hhtml . $fhtml . '<tbody>' . $html . '</tbody></table>';
    return $html;
}