I have a drupal 6 installation with a bunch of webforms i need my users to complete.
My aim to to show a list of webforms in a table with submission dates and a col stating Complete or Not Complete.
This is where im at... I thought it was working until i submitted the forms as a test user and the table changed for everyone as NULL is no longer found once the form has been submitted by anyone.
I pretty much want to search and list all forms with SSOW in the title that exist and show if the current logged in user has completed them or not. I tried to achive this with views before i went down this route, but no luck there either
thanks in advance for anyone who might take a look
$sql = "SELECT node.nid AS 'page', node.title AS 'webform',
IFNULL(FROM_UNIXTIME(webform_submissions.submitted), '') AS 'subdate',
IF(webform_submissions.submitted IS NULL, 'NOT COMPLETED', 'COMPLETED')
AS 'status'
FROM node
LEFT OUTER JOIN webform_submissions ON node.nid = webform_submissions.nid
LEFT OUTER JOIN users ON webform_submissions.uid = users.uid
WHERE node.title LIKE '%SIGNOFF%' AND node.type LIKE 'webform' AND
(webform_submissions.uid IS NULL OR webform_submissions.uid LIKE
'$user->uid')";
$res = db_query($sql);
$table_rows = array();
while ($row = db_fetch_object($res)) {
$table_rows[] = array(
'data' => array(
// Column 1
'Webform' => array('data' => l($row->webform, 'node/' . $row->page), 'class' => 'col-title', ),
// Column 2
'Date Submitted' => array('data' => $row->subdate, 'class' => 'col-submitted',),
// Column 3
'STATUS' => array('data' => $row->status, 'class' => 'col-status',),
// Row attributes
'id' => 'articles-row-' . $row->nid, 'class' => 'articles-row');
}
// Format and print out the table.
return theme('table', $table_header, $table_rows, array('id' =>
'table-articles', 'class' => 'articles' ));