diff options
Diffstat (limited to 'dash')
| -rw-r--r-- | dash/ads.php | 6 | ||||
| -rw-r--r-- | dash/css/dash.css | 4 | ||||
| -rw-r--r-- | dash/css/employer.css | 17 | ||||
| -rw-r--r-- | dash/dash_employer.php | 34 | ||||
| -rw-r--r-- | dash/dash_functions.php | 31 | ||||
| -rw-r--r-- | dash/js/dash.js | 11 |
6 files changed, 85 insertions, 18 deletions
diff --git a/dash/ads.php b/dash/ads.php index 96f05cb..7187f86 100644 --- a/dash/ads.php +++ b/dash/ads.php @@ -33,8 +33,14 @@ else </div> <div id="fjfright"> <p id="ebio"><?=(is_null($row['bio']) ? '<em>No bio included in profile.</em>' : htmlentities($row['bio']));?></p> +<?php +if ($b_user['type'] == 'EMPLOYEE') { +?> <h4>Respond to this Ad</h4> <p id="eapply"><a href="apply.php?id=<?=intval($row['id']);?>">Apply Now</a></p> +<?php +} +?> <h4>Contact the Employer</h4> <p id="eemail"><a href="mailto:<?=htmlentities($row['email']);?>"><?=htmlentities($row['email']);?></a></p> <?php diff --git a/dash/css/dash.css b/dash/css/dash.css index 3e79901..b814fb0 100644 --- a/dash/css/dash.css +++ b/dash/css/dash.css @@ -145,7 +145,7 @@ body { background-repeat: no-repeat; margin-right: 3px; } -.jobxbtn { +.jobxbtn, .appxbtn { display: block; width: 16px; height: 16px; @@ -154,7 +154,7 @@ body { background-size: contain; background-repeat: no-repeat; } -.jobxbtn:hover { +.jobxbtn:hover, .appxbtn:hover { background-image: url('../img/x_hover.png'); cursor: pointer; } diff --git a/dash/css/employer.css b/dash/css/employer.css new file mode 100644 index 0000000..95d6049 --- /dev/null +++ b/dash/css/employer.css @@ -0,0 +1,17 @@ +#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; +} diff --git a/dash/dash_employer.php b/dash/dash_employer.php index 3c08ffd..1dbdd16 100644 --- a/dash/dash_employer.php +++ b/dash/dash_employer.php @@ -1,12 +1,36 @@ <?php if (!defined('HEIRARCHY')) die; $title = 'Dashboard / Bulletin'; +$extra_head = ' <link rel="stylesheet" type="text/css" href="css/employer.css" />'; 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.uid = '.$b_user['id'].' GROUP BY ads.id LIMIT ' . $b_config['ads_per_page']*($page-1) . ', '.$b_config['ads_per_page']) or fatal($db->error); -if ($result->num_rows < 1) draw_noads(); -while ($row = $result->fetch_assoc()) draw_ad($row); +$result = $db->query('SELECT ads.id, ads.title FROM ads WHERE ads.uid = '.$b_user['id'].' AND ads.closed = 0') or dash_fatal('A problem was encountered loading your posted ads.'); +$view = intval(@$_GET['view']); +?> + <form id="viewform" action="/dash/" method="get"> + <p>Show Me: <select id="viewchanger" name="view" onchange="this.form.submit();"> + <option<?php if ($view == 0) echo ' selected="selected"';?> value="0">Jobs Posted</option> + <optgroup label="Applications For"> +<?php +if ($result->num_rows < 1) echo ' <option value="0">No Ads Posted</option>'.PHP_EOL; +else { + while ($row = $result->fetch_assoc()) echo ' <option'.(($view==$row['id'])?' selected="selected"':'').' value="'.$row['id'].'">'.htmlentities($row['title']).'</option>'.PHP_EOL; +} $result->free(); +?> + </optgroup> + </select></p> + </form> +<?php +if ($view == 0) { + $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.uid = '.$b_user['id'].' AND ads.closed = 0 GROUP BY ads.id LIMIT 0, '.$b_config['ads_per_page']) or fatal($db->error); + if ($result->num_rows < 1) draw_noads(); + while ($row = $result->fetch_assoc()) draw_ad($row); + $result->free(); +} else { + $result = $db->query('SELECT responses.id, responses.comment, users.name, users.address, SUM(ratings.stars) / COUNT(ratings.stars) AS rating FROM responses INNER JOIN users ON responses.uid = users.id LEFT JOIN ratings ON ratings.rated = responses.uid WHERE responses.adid = '.$view) or dash_fatal($db->error); + if ($result->num_rows < 1) draw_noapps(); + while ($row = $result->fetch_assoc()) draw_app($row); + $result->free(); +} require('footer.php'); ?> diff --git a/dash/dash_functions.php b/dash/dash_functions.php index 9160426..cb22cd5 100644 --- a/dash/dash_functions.php +++ b/dash/dash_functions.php @@ -23,13 +23,21 @@ function rating_format ($rating = null, $typestr = 'Employer') { function draw_noads () { ?> <div class="job"> - <a href="#" class="jobxbtn"></a> <p class="jobtitle"><a href="post.php">Post an Ad!</a></p> - <p class="jobpay">Costs $5.00</p> + <p class="jobpay">It's FREE!</p> <p class="jobblurb">You haven't posted any ads yet! It's a quick and easy way to get connected to the workers you need.<br /><a href="post.php">Post an ad!</a></p> </div> <?php } +function draw_noapps () { +?> + <div class="job"> + <p class="jobtitle"><a href="post.php">No Applications Yet!</a></p> + <p class="jobpay">Post another ad. It's FREE!</p> + <p class="jobblurb">This ad hasn't received any responses yet. In the meantime, be sure to post more to maximize your exposure.<br /><a href="post.php">Post an ad!</a></p> + </div> +<?php +} function draw_ad ($row) { ?> <div class="job"> @@ -42,18 +50,25 @@ function draw_ad ($row) { echo ' <p class="jobcat">'.htmlentities($row['cat_name']).'</p>'.PHP_EOL; ?> <p class="joblocation"><?=htmlentities($row['location']);?></p> -<?php - if (is_null($row['rating'])) - echo ' <p class="jobstars">Employer Not Rated</p>'.PHP_EOL; - else - echo ' <p class="jobstars">'.$row['rating'].' Star Employer</p>'.PHP_EOL; -?> + <p class="jobstars"><?=rating_format($row['rating']);?></p> <p class="jobpay">Pays $<?=number_format($row['pay'], 2);?></p> <p class="jobblurb"><?=htmlentities(substr($row['description'], 0, min(strlen($row['description']), 160)));?> <a href="ads.php?id=<?=$row['id'];?>">[...]</a></p> </p> </div> <?php } +function draw_app ($row) { +?> + <div class="job"> + <a href="#" class="appxbtn"></a> + <p class="jobtitle"><a href="review.php?id=<?=$row['id'];?>"><?=htmlentities($row['name']);?></a></p> + <p class="jobstars"><?=rating_format($row['rating'], 'Employee');?></p> + <p class="joblocation"><?=htmlentities($row['address']);?></p> + <p class="jobblurb"><?=htmlentities(substr($row['comment'], 0, min(strlen($row['comment']), 160)));?> <a href="review.php?id=<?=$row['id'];?>">[...]</a></p> + </p> + </div> +<?php +} // triggers function app_trigger ($responseid) { diff --git a/dash/js/dash.js b/dash/js/dash.js index 39e9882..d3c1a1a 100644 --- a/dash/js/dash.js +++ b/dash/js/dash.js @@ -1,16 +1,21 @@ var xclicks = 0, a; -function xbtn (e) { +function jxbtn (e) { e.preventDefault(); $(this).parents().filter('.job').hide(250); $.get('headless.php?clicks='+xclicks, function (data) { var $newjob = $($.parseHTML(data)); window.a = $newjob; - $newjob.find('.jobxbtn').click(xbtn); + $newjob.find('.jobxbtn').click(jxbtn); $newjob.appendTo($('#content')); }); xclicks++; } +function axbtn (e) { + e.preventDefault(); + $(this).parents().filter('.job').hide(250); +} $(function() { - $('.jobxbtn').click(xbtn); + $('.jobxbtn').click(jxbtn); + $('.appxbtn').click(axbtn); }); |
