I need some advice on
I created a web app where a user can assign a form to multiple recipients simultaneously so that one assignment inserts multiple rows (one row per recipient) into the form_assignments
table like so:
foreach ($recipients as $row) {
$query = "INSERT INTO form_assignments
(sender_id, recipient_id, form_id, due_date, priority_id, comment, completed)
VALUES
('{$sender_id}', " . $row['id'] . ", '{$assigned_form_id}', '2014-04-30 00:00:00', '{$priority_id}', '{$comment}', '{$completed}')";
In the example above, $recipients
is an array with user ids referenced by $row['id']
.
So, one assignment can generate 100 of these rows (for 100 recipients), for example, and each recipient can edit his individual row as "completed". This is good so far.
The problem is, if I want to generate a list of assignments for the user that assigned them I want him to see only one row for a multiple-user assignment (not one row for each recipient he sent the assignment to).
I'd love to be able to show the user a table like:
You assigned: form 1 To: 50 users Due on: April 25, 2014 Users Completed: 10 View List of Users
And each assignee would see a table like:
User 1 assigned you the following form: form 1 Due on: April 25, 2014, Click to Mark as Completed
I'm not sure how to go about this. If anyone could point me in the right direction I would greatly appreciate it.