diff options
Diffstat (limited to 'dash')
| -rw-r--r-- | dash/ads.php | 6 | ||||
| -rw-r--r-- | dash/css/dash.css | 36 | ||||
| -rw-r--r-- | dash/css/employer.css | 17 | ||||
| -rw-r--r-- | dash/css/notif.css | 30 | ||||
| -rw-r--r-- | dash/dash_employee.php | 17 | ||||
| -rw-r--r-- | dash/dash_functions.php | 38 | ||||
| -rw-r--r-- | dash/header.php | 4 | ||||
| -rw-r--r-- | dash/headless.php | 6 | ||||
| -rw-r--r-- | dash/img/0.jpg | bin | 208551 -> 1541956 bytes | |||
| -rw-r--r-- | dash/img/trash.png | bin | 0 -> 1011 bytes | |||
| -rw-r--r-- | dash/img/trash_hover.png | bin | 0 -> 1011 bytes | |||
| -rw-r--r-- | dash/js/dash.js | 11 | ||||
| -rw-r--r-- | dash/notif.php | 35 | ||||
| -rw-r--r-- | dash/post.php | 2 | ||||
| -rw-r--r-- | dash/profile.php | 2 | ||||
| -rw-r--r-- | dash/settings.php | 2 |
16 files changed, 168 insertions, 38 deletions
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(); ?> <div id="fulljob"> +<?php +if ($b_user['type'] == 'EMPLOYER' && $b_user['id'] == $row['uid']) echo ' <a href="#" class="adtrash" data-adid="'.$row['id'].'"></a>'.PHP_EOL; +?> <div id="fjheader"> <h3 id="fjhtitle"><a href="ads.php?id=<?=$row['id'];?>"><?=htmlentities($row['title']);?></a></h3> <p id="fjhpay">Pays $<?=number_format($row['pay'], 2);?></p> - <p id="fjhdetails"><?=htmlentities($row['location']);?> at <?=date('g:i a', intval($row['time'])).' on '.date('M j, Y', intval($row['time']));?></p> + <p id="fjhdetails"><?=htmlentities($row['location']);?></p> + <p id="fjhtime"><?=date('g:i a', intval($row['time'])).' on '.date('M j, Y', intval($row['time']));?></p> </div> <div id="fjbody"> <p><?=htmlentities($row['description']);?></p> 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); +?> + <form id="viewform" action="/dash/" method="get"> + <p>Show Me: <select id="catchanger" name="cat" onchange="this.form.submit();"> + <option<?php if (empty($_GET['cat'])) echo ' selected="selected"';?> value="0">All Categories</option> +<?php +while ($row = $result->fetch_assoc()) echo ' <option'.((intval($_GET['cat'])==$row['id'])?' selected="selected"':'').' value="'.$row['id'].'">'.htmlentities($row['cat_name']).'</option>'.PHP_EOL; +$result->free(); +?> + </select></p> + </form> +<?php +$catstr = empty($_GET['cat']) ? '' : ' AND cat = '.intval($_GET['cat']); +$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'.$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) { <span class="navspan"><?=htmlentities($b_user['name']);?> ▾</span> </a> <ul class="subnav"> - <a href="<?=$b_config['base_url'].'dash/profile.php';?>"> - <li><span class="navspan">Profile</span></li> + <a href="<?=$b_config['base_url'].'dash/notif.php';?>"> + <li><span class="navspan">News<?=$b_user['notif']>0?' ('.$b_user['notif'].')':'';?></span></li> </a> <a href="<?=$b_config['base_url'].'dash/settings.php';?>"> <li><span class="navspan">Settings</span></li> diff --git a/dash/headless.php b/dash/headless.php index d85a66a..516cfd5 100644 --- a/dash/headless.php +++ b/dash/headless.php @@ -23,7 +23,11 @@ if (isset($_GET['clicks'])) { $result->free(); $db->query('UPDATE responses, ads SET responses.matched = 1, ads.closed = 1 WHERE ads.id = responses.adid AND responses.id = '.intval($_GET['hire'])) or die('ERR'); if ($db->affected_rows < 1) die('NOK'); - hire_trigger(intval($_GET['hire']); + hire_trigger(intval($_GET['hire'])); + die('OK'); +} else if (isset($_GET['rmad'])) { + $db->query('DELETE FROM ads WHERE ads.id = '.intval($_GET['rmad']).' AND ads.uid = '.$b_user['id']) or die('ERR'); + if ($db->affected_rows < 1) die('NOK'); die('OK'); } $db->close(); diff --git a/dash/img/0.jpg b/dash/img/0.jpg Binary files differindex f7719ff..2d3c917 100644 --- a/dash/img/0.jpg +++ b/dash/img/0.jpg diff --git a/dash/img/trash.png b/dash/img/trash.png Binary files differnew file mode 100644 index 0000000..5014463 --- /dev/null +++ b/dash/img/trash.png diff --git a/dash/img/trash_hover.png b/dash/img/trash_hover.png Binary files differnew file mode 100644 index 0000000..a963356 --- /dev/null +++ b/dash/img/trash_hover.png diff --git a/dash/js/dash.js b/dash/js/dash.js index 7fbceac..9d44802 100644 --- a/dash/js/dash.js +++ b/dash/js/dash.js @@ -25,7 +25,6 @@ function acbtn (e) { $(this).parents().filter('.job').hide(250); $.get('headless.php?hire='+$(this).attr('data-rid'), function (data) { if (data == 'OK') { - window.alert('This application has been approved for hire. You can rate your experience with this candidate under the \'Rate\' tab.'); window.location.href = '/dash/rate.php'; } else { window.alert('We\'ve experienced an error trying to approve this application. Please try again another time.'); @@ -34,6 +33,15 @@ function acbtn (e) { }); } } +function trashbtn (e) { + e.preventDefault(); + if (window.confirm('Permanently delete this ad?')) { + $.get('headless.php?rmad='+$(this).attr('data-adid'), function (data) { + if (data == 'OK') window.location.href = '/dash/'; + else window.alert('An error was encountered while attempting to delete this ad.'); + }); + } +} function serveratings ($spaces) { $.each($spaces, function (idx, me) { var $me = $(me); @@ -55,5 +63,6 @@ $(function() { $('.jobxbtn').click(jxbtn); $('.appxbtn').click(axbtn); $('.appcbtn').click(acbtn); + $('.adtrash').click(trashbtn); serveratings($('.ratingdata')); }); diff --git a/dash/notif.php b/dash/notif.php new file mode 100644 index 0000000..68f0282 --- /dev/null +++ b/dash/notif.php @@ -0,0 +1,35 @@ +<?php +define('HEIRARCHY', 1); +require('dash_common.php'); + +$title = 'News / Bulletin'; +$extra_head = ' <link rel="stylesheet" type="text/css" href="css/notif.css" />'; +require('header.php'); +$result = $db->query('SELECT notif.* FROM notif WHERE notif.uid = '.$b_user['id'].' ORDER BY id DESC') or dash_fatal($db->error); +$db->query('UPDATE notif SET notif.seen = 1 WHERE notif.uid = '.$b_user['id']) or dash_fatal($db->error); +?> + <div class="box cbox"> + <div id="newshead"> + <h3><a href="notif.php">News</a></h3> + <p>Updates for <?=htmlentities($b_user['name']);?></p> + </div> + <div class="hr"></div> + <div id="newsbody"> +<?php +if ($result->num_rows < 1) echo ' <p><em>No updates are available at this time.</em></p>'.PHP_EOL; +else { + while ($row = $result->fetch_assoc()) { + echo ' <p class="'; + if ($row['seen']) echo 'seen'; + else echo 'unseen'; + if (!is_null($row['icon'])) echo ' icon icon'.strtolower($row['icon']); + echo '"><a href="'.$row['link'].'">'.htmlentities($row['text']).'</a></p>'.PHP_EOL; + } +} +$result->free(); +?> + </div> + </div> +<?php +require('footer.php'); +?> diff --git a/dash/post.php b/dash/post.php index 6fdd2fd..ab9a193 100644 --- a/dash/post.php +++ b/dash/post.php @@ -23,7 +23,7 @@ do { } } $stmt = $db->prepare('INSERT INTO ads (uid, title, cat, pay, time, location, description) VALUES (?, ?, ?, ?, ?, ?, ?)') or dash_fatal($db->error); - $stmt->bind_param('isidiss', $b_user['id'], $_POST['title'], $_POST['cat'], $_POST['pay'], strtotime($_POST['time']), $_POST['location'], $_POST['description']); + $stmt->bind_param('isidiss', $b_user['id'], $_POST['title'], $_POST['category'], $_POST['pay'], strtotime($_POST['time']), $_POST['location'], $_POST['description']); $stmt->execute(); if ($stmt->affected_rows < 1) dash_fatal('Your ad was unable to be posted.'); dash_fatal('Your ad has been posted.', $b_config['base_url'].'dash/ads.php?id='.$stmt->insert_id); diff --git a/dash/profile.php b/dash/profile.php index e0db54d..8a448b5 100644 --- a/dash/profile.php +++ b/dash/profile.php @@ -9,7 +9,7 @@ if (!$public) $extra_head .= ' <script type="text/javascript" src="js/profile require('header.php'); $user = $b_user; if ($public) { - $result = $db->query('SELECT users.*, SUM(ratings.stars) / COUNT(ratings.stars) AS rating FROM users LEFT JOIN ratings ON ratings.rated = users.id LEFT JOIN responses ON responses.uid = users.id WHERE users.id = '.intval($_GET['id']).' AND users.active = 1 AND responses.matched = 1 LIMIT 1') or dash_fatal($db->error); + $result = $db->query('SELECT users.*, SUM(ratings.stars) / COUNT(ratings.stars) AS rating FROM users LEFT JOIN ratings ON ratings.rated = users.id WHERE users.id = '.intval($_GET['id']).' AND users.active = 1 GROUP BY users.id LIMIT 1') or dash_fatal($db->error); $user = $result->fetch_assoc(); $result->free(); if ($user['id'] < 1) dash_fatal('A user with that ID does not exist. You must have reached this page in error.'); diff --git a/dash/settings.php b/dash/settings.php index fcd9a0f..6079bed 100644 --- a/dash/settings.php +++ b/dash/settings.php @@ -31,7 +31,7 @@ if (!empty($_POST['change'])) { <div id="fulljob" class="fjsettings"> <div id="fjheader"> <h3 id="fjhtitle"><a href="settings.php">Account Settings</a></h3> - <p id="fjhdesc">Adjusting for <?=htmlentities($b_user['email']);?></p> + <p id="fjhdesc">Adjusting for <?=htmlentities($b_user['name']);?></p> </div> <form action="<?=$_SERVER['REQUEST_URI'];?>" method="post"> <div id="fjbody"> |
