mirror of
https://github.com/fspc/Yellow-Bike-Database.git
synced 2026-09-03 02:11:38 -04:00
This implements etherpad (#39) for individual_history_log!
This commit is contained in:
@@ -29,6 +29,8 @@ $handler->start();
|
||||
WHERE contact_id=" . $_POST['contact_id'] .";";
|
||||
$sql = mysql_query($query, $YBDB) or die(mysql_error());
|
||||
$result = mysql_fetch_assoc($sql);
|
||||
$etherpad_conf["configurations"] = $etherpad;
|
||||
$result = (object)array_merge((array)$result, (array)$etherpad_conf);
|
||||
echo json_encode($result);
|
||||
}
|
||||
|
||||
@@ -81,5 +83,51 @@ $handler->start();
|
||||
|
||||
} // individual_history
|
||||
|
||||
// Return everyone
|
||||
if (isset($_POST['everyone'])) {
|
||||
|
||||
$interval = 1;
|
||||
|
||||
$query = "SELECT * FROM (SELECT contacts.contact_id, CONCAT(contacts.first_name, ' ', contacts.middle_initial, ' ',contacts.last_name) AS full_name,
|
||||
COUNT(shop_hours.contact_id) as th_visits,
|
||||
ROUND(SUM(HOUR(TIMEDIFF( time_out, time_in)) + MINUTE(TIMEDIFF( time_out, time_in))/60)) AS th_hours
|
||||
FROM shop_hours
|
||||
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id
|
||||
LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_user_role_id
|
||||
GROUP BY contact_id
|
||||
ORDER BY last_name, first_name) AS total_hours
|
||||
LEFT JOIN (SELECT contacts.contact_id AS vh_contact_id,
|
||||
COUNT(shop_hours.contact_id) as vh_visits,
|
||||
ROUND(SUM(HOUR(TIMEDIFF( time_out, time_in)) + MINUTE(TIMEDIFF( time_out, time_in))/60)) AS vh_hours
|
||||
FROM shop_hours
|
||||
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id
|
||||
LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_user_role_id
|
||||
WHERE shop_user_roles.volunteer = 1
|
||||
GROUP BY contacts.contact_id
|
||||
ORDER BY last_name, first_name) AS volunteer_hours ON total_hours.contact_id = volunteer_hours.vh_contact_id
|
||||
LEFT JOIN (SELECT contacts.contact_id AS th3_contact_id,
|
||||
COUNT(shop_hours.contact_id) as th3_visits,
|
||||
ROUND(SUM(HOUR(TIMEDIFF( time_out, time_in)) + MINUTE(TIMEDIFF( time_out, time_in))/60)) AS th3_hours
|
||||
FROM shop_hours
|
||||
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id
|
||||
LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_user_role_id
|
||||
WHERE time_in > DATE_SUB(CURDATE(),INTERVAL $interval MONTH)
|
||||
GROUP BY contacts.contact_id
|
||||
ORDER BY last_name, first_name) AS total_hours3 ON total_hours.contact_id = total_hours3.th3_contact_id
|
||||
LEFT JOIN (SELECT contacts.contact_id AS vh3_contact_id,
|
||||
COUNT(shop_hours.contact_id) as vh3_visits,
|
||||
ROUND(SUM(HOUR(TIMEDIFF( time_out, time_in)) + MINUTE(TIMEDIFF( time_out, time_in))/60)) AS vh3_hours
|
||||
FROM shop_hours
|
||||
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id
|
||||
LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_user_role_id
|
||||
WHERE shop_user_roles.volunteer = 1 AND time_in > DATE_SUB(CURDATE(),INTERVAL $interval MONTH)
|
||||
GROUP BY contacts.contact_id
|
||||
ORDER BY last_name, first_name) AS volunteer_hours3 ON total_hours.contact_id = volunteer_hours3.vh3_contact_id;";
|
||||
|
||||
$sql = mysql_query($query, $YBDB) or die(mysql_error());
|
||||
$result = mysql_fetch_assoc($sql);
|
||||
echo json_encode($result);
|
||||
|
||||
} // return everyone
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user