summaryrefslogtreecommitdiff
path: root/dash/rate.php
diff options
context:
space:
mode:
authorCarson Fleming <cflems@cflems.net>2017-03-16 21:28:51 -0700
committerCarson Fleming <cflems@cflems.net>2017-03-16 21:28:51 -0700
commitca71122b9a343bacd6c0b2933ddf295ebcff4f07 (patch)
tree595a998026e0182fc04c4d7ecc7cbc6e14a70455 /dash/rate.php
parent3d0d3a86106ece4ea298ab2f262b3af5ff8a7728 (diff)
downloadbulletin-ca71122b9a343bacd6c0b2933ddf295ebcff4f07.tar.gz
Final candidate for alpha version, moving to beta soon
Diffstat (limited to 'dash/rate.php')
-rw-r--r--dash/rate.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/dash/rate.php b/dash/rate.php
new file mode 100644
index 0000000..767d4ba
--- /dev/null
+++ b/dash/rate.php
@@ -0,0 +1,24 @@
+<?php
+define('HEIRARCHY', 1);
+require('dash_common.php');
+
+$title = 'Rate / Bulletin';
+require('header.php');
+if ($b_user['type'] == 'EMPLOYER') {
+ $result = $db->query('SELECT users.id AS uid, users.name, ads.id AS adid, ads.title, ads.time, SUM(ratings.stars) / COUNT(ratings.stars) AS rating FROM ads INNER JOIN responses ON responses.adid = ads.id AND responses.matched = 1 INNER JOIN users ON users.id = responses.uid LEFT JOIN ratings ON ratings.rated = users.id WHERE ads.uid = '.$b_user['id'].' AND NOT EXISTS (SELECT ratings.id FROM ratings WHERE ratings.rated = responses.uid AND ratings.job = ads.id AND ratings.rater = '.$b_user['id'].') GROUP BY responses.id') or dash_fatal($db->error);
+ if ($result->num_rows < 1) draw_norate_p();
+} else if ($b_user['type'] == 'EMPLOYEE') {
+ $result = $db->query('SELECT users.id AS uid, users.name, ads.id AS adid, ads.title, ads.time, SUM(ratings.stars) / COUNT(ratings.stars) AS rating FROM ads INNER JOIN responses ON responses.adid = ads.id AND responses.matched = 1 INNER JOIN users ON users.id = ads.uid LEFT JOIN ratings ON ratings.rated = users.id WHERE responses.uid = '.$b_user['id'].' AND NOT EXISTS (SELECT ratings.id FROM ratings WHERE ratings.rated = ads.uid AND ratings.job = ads.id AND ratings.rater = '.$b_user['id'].') GROUP BY responses.id') or dash_fatal($db->error);
+ if ($result->num_rows < 1) draw_norate_s();
+}
+else dash_fatal('Only job seekers and job providers can rate one another.');
+
+while ($row = $result->fetch_assoc()) {
+ draw_rate($row);
+}
+$result->free();
+?>
+
+<?php
+require('footer.php');
+?>