0)) { $sql .= ' and j_upper >= '.$salary[0].' and j_lower <= '.$salary[1].''; } else { $salary[0] = $lower; $salary[1] = $upper; } $href = str_replace(' ','_',implode('-',$keys).'.'.implode('-',$regions)); $cache = 'cache/'.$href.'.'.$salary[0].'-'.$salary[1].'.htm'; $_SESSION['sess_keys'] = $href; $pagetitle = ucwords(implode(' ',$keys)).' Jobs'; $regions_ = $regions; if ($r = ucwords(array_pop($regions_))) { $pagetitle .= ' in '; if (count($regions_)) { $pagetitle .= ucwords(implode(', ',$regions_)).' and '.$r; } else { $pagetitle .= $r; } } $pagetitle .= ' from £'.$salary[0].' to £'.$salary[1]; include('carl-includes/head.php'); $i = mysql_fetch_row(mysql_query("select count(*) from job_jobs where w_id=".$WID.($AD?'':' and j_active=1').$sql,$db)); $max = intval($i[0]); if (@filemtime($cache) < time() || !$CACHE) { $i = mysql_query("select j_title, j_id, j_keys, j_region, j_upper, j_lower from job_jobs where ".($AD?'1':'j_active=1').$sql.' order by j_title asc',$db); echo mysql_error(); $show = array(); $thekeys = array(); while ($r = mysql_fetch_assoc($i)) { $show[] = $r; foreach (explode("\t",strtolower($r['j_keys'])) as $k) { if (!in_array($k,$keys) && $k) { $thekeys[$k] ++; } } } arsort($thekeys); $out = '

Regions Click to select or deselect

'; $i = mysql_query('select j_region, count(*) as cnt from job_jobs where w_id='.$WID.' and j_active=1 group by j_region order by cnt desc',$db); echo mysql_error(); $allregions = array(); while ($r = mysql_fetch_assoc($i)) { $t = explode(' ',$r['j_region']); $k = array_shift($t); $r['j_region2'] = implode(' ',$t); $allregions[$k][] = $r; } function drawreg($reg,$disp) { global $regions; global $salary; global $keys; $out = ''; if (in_array(strtolower($reg),$regions)) { $out .= ''; } else { $regions_ = $regions; $regions_[] = str_replace(" ",'_',strtolower($reg)); $out .= ''; } $out .= $disp.''; return $out; } foreach ($allregions as $k => $arr) { if (count($arr) > 1) { $out .= drawreg($k,$k); if (!in_array(strtolower($k),$regions)) { $out .= ''; } } else { $out .= '
'.drawreg($arr[0]['j_region'],$arr[0]['j_region']); } } $out .= '

'; $k = array_keys($thekeys); $per = 10; $limit_ = $thekeys[$k[(count($k)>$per?$per:count($k)-1)]]; $limit = $thekeys[$k[0]]; $interval = 20/($limit-$limit_); $out .= '

Skills'.(count($keys)?' (list applies only to these jobs)':'').'

'; if (count($keys)) { foreach ($keys as $k) { $out .= ''.$k.'
'; } } $c = 0; foreach ($thekeys as $k => $v) { if (($v < $limit_ ) || ( $c > 10)) { break; } if ($v != $max) { // if it won't restrict results any more it's not interesting $c ++; $out .= ''.$k.'('.$v.')
'; } } $out .= '




Salary Drag markers to set range

'; $out .= '
 
'; $out .= '
Showing jobs from £ '.$salary[0].' to £ '.$salary[1].'
'; $out .= '
'; $out .= '

Matched '.$max.' job'.($max==1?'':'s').'

'; foreach ($show as $j) { $out .= '

'.$j['j_title'].''; // $out .= ' ('.$j['j_region']; // if ($j['j_lower'] == $j['j_upper']) { // $out .= ', £'.$j['j_upper']; // } else if ($j['j_upper'] && !$j['j_lower']) { // $out .= ', to £'.$j['j_upper']; // } else if ($j['j_upper'] && $j['j_lower']) { // $out .= ', £'.$j['j_lower'].' to £'.$j['j_upper']; // } // $out .= ')'; $out .= '

'; } $out .= '
'; if ($CACHE) { $fp = fopen($cache,'w'); fwrite($fp,$out); fclose($fp); } } if ($CACHE) { include($cache); } else { echo $out; } ?>