From 3d0d3a86106ece4ea298ab2f262b3af5ff8a7728 Mon Sep 17 00:00:00 2001 From: Carson Fleming Date: Sat, 11 Mar 2017 01:29:13 -0800 Subject: Almost there... --- dash/ads.php | 6 +++++- dash/css/dash.css | 36 ++++++++++++++++++++++++++++++++---- dash/css/employer.css | 17 ----------------- dash/css/notif.css | 30 ++++++++++++++++++++++++++++++ dash/dash_employee.php | 17 ++++++++++++++--- dash/dash_functions.php | 38 ++++++++++++++++++++++++++++++++------ dash/header.php | 4 ++-- dash/headless.php | 6 +++++- dash/img/0.jpg | Bin 208551 -> 1541956 bytes dash/img/trash.png | Bin 0 -> 1011 bytes dash/img/trash_hover.png | Bin 0 -> 1011 bytes dash/js/dash.js | 11 ++++++++++- dash/notif.php | 35 +++++++++++++++++++++++++++++++++++ dash/post.php | 2 +- dash/profile.php | 2 +- dash/settings.php | 2 +- inc/app_eml.tpl | 4 ++-- inc/functions.php | 18 +++++++++++------- inc/hire_eml.tpl | 23 +++++++++++++++++++++++ inc/user.php | 2 +- index.php | 5 ++--- 21 files changed, 207 insertions(+), 51 deletions(-) create mode 100644 dash/css/notif.css create mode 100644 dash/img/trash.png create mode 100644 dash/img/trash_hover.png create mode 100644 dash/notif.php create mode 100644 inc/hire_eml.tpl diff --git a/dash/ads.php b/dash/ads.php index 46ebe25..6878456 100644 --- a/dash/ads.php +++ b/dash/ads.php @@ -12,10 +12,14 @@ $row = $result->fetch_assoc(); $result->free(); ?>
+'.PHP_EOL; +?>

Pays $

-

at

+

+

diff --git a/dash/css/dash.css b/dash/css/dash.css index 29fb29f..b2dbbef 100644 --- a/dash/css/dash.css +++ b/dash/css/dash.css @@ -166,12 +166,10 @@ body { margin: 2em auto 1em auto; position: absolute; top: 0; - bottom: 0; left: 0; right: 0; width: 50%; - height: calc(100% - 5em); - padding: 1em; + padding: 1em 1em 2em 1em; box-shadow: 0px 0px 5px rgba(0,0,0,0.75); border-radius: 3px; background-color: #ffffff; @@ -344,10 +342,40 @@ h3 a:hover, h4 a:hover { height: 16px; } .norating { - height: 16px; + width: 86px !important; + height: 16px !important; } .star { width: 16px !important; height: 16px !important; margin: 0px 2px !important; } +#viewform { + width: 548px; + margin: 2em auto -1.25em; + font-size: 14pt; +} +#viewform select { + font-family: 'Myriad Pro'; + font-size: 12pt; + padding: 5px; + background-color: #ffffff; + border-style: solid; + border-width: 1px; + border-color: #dddddd; + border-radius: 5px; + color: #000000; + margin-left: 10px; +} +.adtrash { + display: block; + width: 32px; + height: 32px; + float: right; + background-image: url('../img/trash.png'); + background-size: contain; + background-repeat: no-repeat; +} +.adtrash:hover { + background-image: url('../img/trash_hover.png'); +} diff --git a/dash/css/employer.css b/dash/css/employer.css index f2a1c37..8737802 100644 --- a/dash/css/employer.css +++ b/dash/css/employer.css @@ -1,20 +1,3 @@ -#viewform { - width: 548px; - margin: 2em auto -1.25em; - font-size: 14pt; -} -#viewform select { - font-family: 'Myriad Pro'; - font-size: 12pt; - padding: 5px; - background-color: #ffffff; - border-style: solid; - border-width: 1px; - border-color: #dddddd; - border-radius: 5px; - color: #000000; - margin-left: 10px; -} .appcbtn { display: block; width: 16px; diff --git a/dash/css/notif.css b/dash/css/notif.css new file mode 100644 index 0000000..1e71824 --- /dev/null +++ b/dash/css/notif.css @@ -0,0 +1,30 @@ +#newsbody a { + text-decoration: none; + color: #000000; +} +#newsbody p { + display: block; + height: 16px; + font-size: 12pt; + padding: 16px 0; + margin: 0; +} +#newsbody p.unseen { + background-color: #ffffff; + font-weight: bold; +} +#newsbody p.seen { + background-color: #eeeeee; + box-shadow: 0px 0px 1px rgba(0,0,0,0.75); +} +#newsbody p.icon { + background-repeat: no-repeat; + background-size: 32px 32px; + background-position: 8px 8px; +} +#newsbody p.iconhired { + background-image: url('../img/check_blank.png'); +} +#newsbody p.iconapplied { + background-image: url('../img/star_empty.png'); +} diff --git a/dash/dash_employee.php b/dash/dash_employee.php index 795d400..df7112d 100644 --- a/dash/dash_employee.php +++ b/dash/dash_employee.php @@ -2,9 +2,20 @@ if (!defined('HEIRARCHY')) die; $title = 'Dashboard / Bulletin'; require('header.php'); -$page = 1; -// if (!empty($_GET['p'])) $page = max(1, intval($_GET['p'])); -$result = $db->query('SELECT ads.*, categories.cat_name, SUM(ratings.stars) / COUNT(ratings.stars) AS rating FROM ads LEFT JOIN categories ON ads.cat = categories.id LEFT JOIN ratings ON ads.uid = ratings.rated WHERE ads.closed = 0 GROUP BY ads.id LIMIT ' . $b_config['ads_per_page']*($page-1) . ', '.$b_config['ads_per_page']) or fatal($db->error); +$result = $db->query('SELECT id, cat_name FROM categories') or dash_fatal($db->error); +?> +
+

Show Me:

+
+query('SELECT ads.*, categories.cat_name, SUM(ratings.stars) / COUNT(ratings.stars) AS rating FROM ads LEFT JOIN categories ON ads.cat = categories.id LEFT JOIN ratings ON ads.uid = ratings.rated WHERE ads.closed = 0'.$catstr.' GROUP BY ads.id LIMIT 0, '.$b_config['ads_per_page']) or fatal($db->error); while ($row = $result->fetch_assoc()) draw_ad($row); $result->free(); require('footer.php'); diff --git a/dash/dash_functions.php b/dash/dash_functions.php index b12fdcd..933a72d 100644 --- a/dash/dash_functions.php +++ b/dash/dash_functions.php @@ -73,19 +73,23 @@ function draw_app ($row) { // triggers function app_trigger ($responseid) { - global $db; + global $db, $b_config; - $result = $db->query('SELECT responses.id, responses.uid AS seeker, responses.adid, responses.comment, ads.title, users.name, users.email, users.notify FROM responses INNER JOIN ads ON responses.adid = ads.id INNER JOIN users ON ads.uid = users.id WHERE responses.id = '.$responseid.' LIMIT 1') or dash_fatal($db->error); + $result = $db->query('SELECT responses.id, responses.uid AS seeker, responses.adid, responses.comment, ads.title, users.id AS provider, users.name, users.email, users.notify FROM responses INNER JOIN ads ON responses.adid = ads.id INNER JOIN users ON ads.uid = users.id WHERE responses.id = '.intval($responseid).' LIMIT 1') or dash_fatal($db->error); if ($result->num_rows < 1) dash_fatal('The ad you\'ve tried to apply to no longer exists.'); $appinfo = $result->fetch_assoc(); $result->free(); - if (!$appinfo['notify']) return; $result = $db->query('SELECT users.name, users.email, SUM(ratings.stars) / COUNT(ratings.stars) AS rating FROM users LEFT JOIN ratings ON ratings.rated = users.id WHERE users.id = '.$appinfo['seeker'].' LIMIT 1') or dash_fatal($db->error); $uinfo = $result->fetch_assoc(); $result->free(); + + $db->query('INSERT INTO notif (uid, icon, text, link) VALUES ('.$appinfo['provider'].', \'APPLIED\', \'"'.$db->escape_string($appinfo['title']).'" Has Received a Response\', \''.$db->escape_string($b_config['base_url'].'dash/?view='.$appinfo['adid']).'\')') or dash_fatal($db->error); + + if (!$appinfo['notify']) return; + $options = array( - 'rid' => $appinfo['id'], + 'adid' => $appinfo['adid'], 'adname' => $appinfo['title'], 'seekername' => $uinfo['name'], 'seekerrating' => is_null($uinfo['rating']) ? 'has yet to be rated' : 'is rated '.number_format($uinfo['rating'], 1).' stars', @@ -95,7 +99,29 @@ function app_trigger ($responseid) { bulletin_mail($appinfo['email'], '"'.$appinfo['title'].'" Has Received a Response', tpl($options, 'app_eml.tpl')); } function hire_trigger ($rid) { - global $db; - // TODO: this busywork + global $db, $b_config; + + $result = $db->query('SELECT responses.adid, responses.uid AS seeker, ads.title, ads.uid, users.name, users.email, users.notify FROM responses INNER JOIN ads ON ads.id = responses.adid INNER JOIN users ON users.id = responses.uid WHERE responses.id = '.intval($rid).' LIMIT 1') or dash_fatal($db->error); + if ($result->num_rows < 1) dash_fatal('Oops! Something went wrong.'); + $rinfo = $result->fetch_assoc(); + $result->free(); + + $result = $db->query('SELECT users.name, users.email FROM users WHERE users.id = '.$rinfo['uid'].' LIMIT 1') or dash_fatal($db->error); + if ($result->num_rows < 1) dash_fatal('The employer you\'ve applied to no longer has an account with us.'); + $pinfo = $result->fetch_assoc(); + $result->free(); + + $db->query('INSERT INTO notif (uid, icon, text, link) VALUES ('.$rinfo['seeker'].', \'HIRED\', \'You\\\'ve been hired for "'.$db->escape_string($rinfo['title']).'"\', \''.$db->escape_string($b_config['base_url'].'dash/ads.php?id='.$rinfo['adid']).'\')') or dash_fatal($db->error); + + if (!$rinfo['notify']) return; + + $options = array( + 'providername' => $pinfo['name'], + 'adid' => $rinfo['adid'], + 'adtitle' => $rinfo['title'], + 'provideremail' => $pinfo['email'], + 'providerid' => $rinfo['uid'], + ); + bulletin_mail($rinfo['email'], 'You\'ve Been Hired for "'.$rinfo['title'].'"', tpl($options, 'hire_eml.tpl')); } ?> diff --git a/dash/header.php b/dash/header.php index 65de171..ea0bad8 100644 --- a/dash/header.php +++ b/dash/header.php @@ -43,8 +43,8 @@ foreach ($navtitles as $k => $title) {  ▾