| 1 |
<?php |
<?php |
| 2 |
|
|
| 3 |
// $Id: job.module,v 1.7.2.6.2.3 2008/05/04 21:16:57 kbahey Exp $ |
// $Id: job.module,v 1.7.2.6.2.4 2008/12/03 18:52:42 xamount Exp $ |
| 4 |
|
|
| 5 |
// Copyright 2006 http://2bits.com |
// Copyright 2006 http://2bits.com |
| 6 |
|
|
| 52 |
'access' => user_access(JOB_PERM_MANAGE), |
'access' => user_access(JOB_PERM_MANAGE), |
| 53 |
); |
); |
| 54 |
|
|
| 55 |
$items[] = array( |
$items[] = array( |
| 56 |
'path' => 'job/applications', |
'path' => 'job/applications', |
| 57 |
'callback' => 'job_view', |
'callback' => 'job_view', |
| 58 |
'title' => t('Job applications'), |
'title' => t('Job applications'), |
| 70 |
'#title' => t('Enable job application for these content types'), |
'#title' => t('Enable job application for these content types'), |
| 71 |
); |
); |
| 72 |
|
|
| 73 |
foreach(node_get_types() as $type => $name) { |
foreach (node_get_types() as $type => $name) { |
| 74 |
$form[$set][JOB_NODE_TYPE . $type] = array( |
$form[$set][JOB_NODE_TYPE . $type] = array( |
| 75 |
'#type' => 'checkbox', |
'#type' => 'checkbox', |
| 76 |
'#title' => $type, |
'#title' => $type, |
| 82 |
return system_settings_form($form); |
return system_settings_form($form); |
| 83 |
} |
} |
| 84 |
|
|
| 85 |
function job_link($type, $node = null, $teaser = FALSE) { |
function job_link($type, $node = NULL, $teaser = FALSE) { |
| 86 |
global $user; |
global $user; |
| 87 |
$links = array(); |
$links = array(); |
| 88 |
if ($type == 'node') { |
if ($type == 'node') { |
| 163 |
|
|
| 164 |
$job = node_load(array('nid' => $job_nid)); |
$job = node_load(array('nid' => $job_nid)); |
| 165 |
|
|
| 166 |
$resume_list = job_resume_list($user->uid); |
$resume_list = job_resume_list($user->uid); |
| 167 |
|
|
| 168 |
if (!$resume_list) { |
if (!$resume_list) { |
| 169 |
$msg = t('Please !create to apply', array('!create' => l(t('create a resume'), 'node/add'))); |
$msg = t('Please !create to apply', array('!create' => l(t('create a resume'), 'node/add'))); |
| 170 |
drupal_set_message($msg); |
drupal_set_message($msg); |
| 171 |
drupal_goto("node/$job_nid"); |
drupal_goto("node/$job_nid"); |
| 172 |
} |
} |
| 173 |
|
|
| 174 |
if(count($resume_list) == 1) { |
if (count($resume_list) == 1) { |
| 175 |
drupal_goto("job/apply/$job_nid/$resume_nid{$resume_list[0]['nid']}"); |
drupal_goto("job/apply/$job_nid/$resume_nid{$resume_list[0]['nid']}"); |
| 176 |
} |
} |
| 177 |
|
|
| 178 |
$output .= '<br/>' . t('Position: ') . $job->title . '<br>'; |
$output .= '<br/>'. t('Position: ') . $job->title .'<br/>'; |
| 179 |
$output .= '<br/>' . t('Select from your resumes below, or !create', |
$output .= '<br/>'. t('Select from your resumes below, or !create', |
| 180 |
array('!create' => l(t('create a new resume'), "node/add"))); |
array('!create' => l(t('create a new resume'), "node/add"))); |
| 181 |
$output .= '<br/>'; |
$output .= '<br/>'; |
| 182 |
|
|
| 183 |
foreach($resume_list as $resume) { |
foreach ($resume_list as $resume) { |
| 184 |
$view = l(t('view'), 'node/' . $resume['nid']); |
$view = l(t('view'), 'node/'. $resume['nid']); |
| 185 |
$apply = l(t('apply'), "job/apply/$job_nid/$resume_nid" . $resume['nid']); |
$apply = l(t('apply'), "job/apply/$job_nid/$resume_nid" . $resume['nid']); |
| 186 |
$edit = l(t('edit'), 'node/' . $resume['nid'] . '/edit'); |
$edit = l(t('edit'), 'node/'. $resume['nid'] .'/edit'); |
| 187 |
|
|
| 188 |
$rows[] = array( |
$rows[] = array( |
| 189 |
$resume['title'], |
$resume['title'], |
| 190 |
format_interval(time() - $resume['changed']), |
format_interval(time() - $resume['changed']), |
| 191 |
$view . ' ' . $apply . ' ' . $edit |
$view .' '. $apply .' '. $edit |
| 192 |
); |
); |
| 193 |
} |
} |
| 194 |
$headers = array(t('Resume Title'), t('Last Changed'), t('Operations')); |
$headers = array(t('Resume Title'), t('Last Changed'), t('Operations')); |
| 195 |
|
|
| 196 |
$output .= theme('table', $headers, $rows); |
$output .= theme('table', $headers, $rows); |
| 197 |
print theme('page', $output); |
print theme('page', $output); |
| 198 |
} |
} |
| 199 |
|
|
| 200 |
function job_resume_list($uid) { |
function job_resume_list($uid) { |
| 201 |
$resume_types = array(); |
$resume_types = array(); |
| 202 |
foreach(node_get_types() as $type => $name) { |
foreach (node_get_types() as $type => $name) { |
| 203 |
if (variable_get(RESUME_NODE_TYPE . $type, 0)) { |
if (variable_get(RESUME_NODE_TYPE . $type, 0)) { |
| 204 |
$resumes_types[] = "'". $type ."'"; |
$resumes_types[] = "'". $type ."'"; |
| 205 |
} |
} |
| 210 |
} |
} |
| 211 |
|
|
| 212 |
$result = db_query("SELECT n.nid, n.title, n.changed FROM {node} n |
$result = db_query("SELECT n.nid, n.title, n.changed FROM {node} n |
| 213 |
WHERE n.type IN (". implode(',', $resumes_types) . ") AND n.uid = %d" , $uid); |
WHERE n.type IN (". implode(',', $resumes_types) .") AND n.uid = %d" , $uid); |
| 214 |
while($row = db_fetch_array($result)) { |
while ($row = db_fetch_array($result)) { |
| 215 |
$data[] = $row; |
$data[] = $row; |
| 216 |
} |
} |
| 217 |
return $data; |
return $data; |
| 285 |
$rows = array(); |
$rows = array(); |
| 286 |
$header = array(t('Job'), t('Applicant'), t('Resume'), t('Date'), t('Operations')); |
$header = array(t('Job'), t('Applicant'), t('Resume'), t('Date'), t('Operations')); |
| 287 |
if (count($list)) { |
if (count($list)) { |
| 288 |
foreach($list as $data) { |
foreach ($list as $data) { |
| 289 |
$applicant = $data['applicant']; |
$applicant = $data['applicant']; |
| 290 |
$resume = $data['resume']; |
$resume = $data['resume']; |
| 291 |
$job = $data['job']; |
$job = $data['job']; |
| 354 |
$body .= t("\nResume URL: @url", array('@url' => url("node/$resume_node->nid", NULL, NULL, TRUE))); |
$body .= t("\nResume URL: @url", array('@url' => url("node/$resume_node->nid", NULL, NULL, TRUE))); |
| 355 |
$body .= t("\n\nManage job applications at @manage", array('@manage' => url("job/applications", NULL, NULL, TRUE))); |
$body .= t("\n\nManage job applications at @manage", array('@manage' => url("job/applications", NULL, NULL, TRUE))); |
| 356 |
|
|
| 357 |
return(array( |
return (array( |
| 358 |
'subject' => $subject, |
'subject' => $subject, |
| 359 |
'body' => $body, |
'body' => $body, |
| 360 |
)); |
)); |
| 366 |
|
|
| 367 |
function theme_job_search_item($item) { |
function theme_job_search_item($item) { |
| 368 |
$output .= '<div id="job_search">'; |
$output .= '<div id="job_search">'; |
| 369 |
$output .= l($item['title'], $item['link']) . '<br />'; |
$output .= l($item['title'], $item['link']) .'<br />'; |
| 370 |
$output .= $item['snippet']. '<br />'; |
$output .= $item['snippet'] .'<br />'; |
| 371 |
$output .= $item['user'] . ' | ' . format_date($item['date'], 'small'). '<br /><br />'; |
$output .= $item['user'] .' | '. format_date($item['date'], 'small') .'<br /><br />'; |
| 372 |
$output .= '</div>'; |
$output .= '</div>'; |
| 373 |
|
|
| 374 |
return $output ; |
return $output ; |
| 451 |
), |
), |
| 452 |
), |
), |
| 453 |
); |
); |
| 454 |
|
|
| 455 |
return $tables; |
return $tables; |
| 456 |
} |
} |
| 457 |
|
|
| 471 |
$table = $query->get_table_name('job', $table_num); |
$table = $query->get_table_name('job', $table_num); |
| 472 |
$query->set_distinct(); |
$query->set_distinct(); |
| 473 |
|
|
| 474 |
switch($filter['value']) { |
switch ($filter['value']) { |
| 475 |
case 'uid_current': |
case 'uid_current': |
| 476 |
if($user->uid) { |
if ($user->uid) { |
| 477 |
$query->add_where("$table.uid = $user->uid"); |
$query->add_where("$table.uid = $user->uid"); |
| 478 |
} |
} |
| 479 |
break; |
break; |