You are not logged in.
You can post links like google.com which will be rendered as text but you will not be able to post messages that contain complete URLs like www.google.com
Thank you for your understanding!Pages: 1
Currently there is get jobs by category, and jobs by company function in the jobberbase api.
To get jobs by city, this code works fine.
Useful additions would be:
Filtering jobs by category and city (at the same time). So that the string such as this would work:
example.com/api/api.php?action=getJobsSpecific&category=butcher&city=toronto&count=10&response=js
Slightly less useful, would be the api function to get the job counts using the api.
example.com/api/api.php?action=getJobsCountLocation&city=toronto&response=js
example.com/api/api.php?action=getJobsCountCategory&category=butcher&response=js
example.com/api/api.php?action=getJobsCountCompany&company=NoNameCompany&response=js
Last edited by hobo (2009-09-18 21:26:18)
100% Free Job Listings Canada
Get it now! Free Job Listings Template for jobberBase
Check it out: Job Listings Template demo
Offline
Thanks for Hobo for funding these series of API enhancements! (this is for v1.7, v1.8 to follow)
First off, Get Jobs By Category and City (you can filter by Category or City or Category and City)
In /_includes/class.Job.php, add this function
// API to get Jobs by Category and City
public function ApiGetJobsCategoryCity($category = false, $city = false, $limit = false)
{
global $db;
$jobs = array();
$conditions = '';
if ($limit > 0)
{
$sql_limit = 'LIMIT ' . $limit;
}
else
{
$sql_limit = '';
}
if ($category AND !isset($city))
{
$sql = 'SELECT a.id
FROM jobs a
WHERE (
SELECT b.id
FROM categories b
WHERE a.category_id = b.id
AND b.var_name LIKE "' . $category . '"
) ORDER BY a.created_on DESC ' . $sql_limit;
}
if ($city AND !isset($category))
{
$sql = 'SELECT a.id
FROM jobs a
WHERE (
SELECT b.id
FROM cities b
WHERE a.city_id = b.id
AND b.ascii_name LIKE "' . $city . '"
) ORDER BY a.created_on DESC ' . $sql_limit;
}
if ($city AND $category)
{
$sql = 'SELECT a.id
FROM jobs a
WHERE (
SELECT b.id
FROM categories b
WHERE a.category_id = b.id
AND b.var_name LIKE "' . $category . '"
)
AND (
SELECT c.id
FROM cities c
WHERE a.city_id = c.id
AND c.ascii_name LIKE "' . $city . '"
)
ORDER BY a.created_on DESC ' . $sql_limit;
}
$result = $db->query($sql);
while ($row = $result->fetch_assoc())
{
$current_job = new Job($row['id']);
$jobs[] = $current_job->GetInfo();
}
return $jobs;
}In /_includes/class.Api.php, add this in the series of else ifs
// API to get Jobs by Category and City
else if ($action == 'ApiGetJobsCategoryCity')
{
$this->mJobs = $job->ApiGetJobsCategoryCity($params['category'], $params['city'], $params['count']);
}In /api/api.php, add this in the series of Cases
// API to get Jobs by Category and City
case 'ApiGetJobsCategoryCity':
$params = array('category' => $category, 'city' => $city, 'count' => $count, 'response' => $response);
$api = new Api('ApiGetJobsCategoryCity', $params, $response);
$api->Display();
exit;
break;Usage:
http://yoursite/api/api.php?action=ApiGetJobsCategoryCity&category=administrators&city=Adjud&count=10&response=jsNext update will be to grab Job Counts By Category, Location and Company
www.redjumpsuit.net | jobberBase custom development and support
Offline
Hi there - can someone please follow this up with the API modification to count (and display) the total number of jobs in each category and in all categories.
ie - I will be able to use this function elsewhere on my web site to say: "Total live jobs: xxxx" or in certain areas of the site, include other content that dynamically updates with the number of jobs in specific categories.
I'm looking at integrating Jobberbase with a CMS system and this would be very handy!
I can see that this has been achieved using the Smarty template - but I can't understand how to use that unfortunately, so I'm looking for a php-only implementation or API modification, if possible?!
Thanks in advance for any help.
Last edited by mattcody (2010-02-12 16:30:53)
Offline
Thanks for the great work done on the api so far.
I wonder if it could be possible to add "Jobs by Keyword" to the api. My understanding of tha API is not well enough to tell ... any ideas? Or totally not possible?
New jobboard for germany: www.jobboard-deutschland.de it's getting better every day!
Thanks to everyone -specially within this forum- for supporting!
Offline
Pages: 1