function S3QLoutput($D) { extract($D); $data = listS3DB($D); if (is_array($data)) { $data = array_map('ValuesToFileLinks', $data); } #echo '<pre>';print_r($data); #After the query, resume the cols that are supposed to be displayed if ($D['out'] != '' && $D['out'] != '*') { if ($SQLfun == 'distinct') { $D['out'] = str_replace(array($SQLfun, "(", ")"), "", $D['out']); } $cols = array_map('trimmit', explode(',', $D['out'])); } for ($c = 0; $c < count($cols); $c++) { $pCol = $cols[$c]; if ($c == count($cols) - 1) { $header .= trim($pCol); } else { $header .= trim($pCol) . $format['middle']; } } $x = array('data' => $data, 'format' => $format, 'header' => $header, 'columns' => $cols); if ($data != '') { echo display($x); } else { echo "<report>Your query returned no results</report>"; } }
function resourceClassID4Instance($x) { extract($x); $table = 'class'; $permission = "~ '(^|_)" . $project_id . "_'"; $project_id = "~ '^" . $project_id . "\$'"; $cols = array('entity', 'resource_id', 'iid'); $iid = '0'; $class_entry = listS3DB(compact('db', 'table', 'cols', 'project_id', 'permission', 'iid', 'entity')); $class_id = $class_entry[0]['resource_id']; if ($class_id != '') { return $class_id; } else { return False; } }