| 1 |
<?php |
<?php |
| 2 |
|
|
| 3 |
// $Id: job.module,v 1.19.2.1 2009/01/02 15:30:59 kbahey Exp $ |
// $Id: job.module,v 1.19.2.2 2009/01/17 01:25:08 kbahey Exp $ |
| 4 |
|
|
| 5 |
// Copyright Khalid Baheyeldin 2006-2009 http://2bits.com |
// Copyright Khalid Baheyeldin 2006-2009 http://2bits.com |
| 6 |
|
|
| 7 |
|
|
| 8 |
define('JOB_NODE_TYPE', 'job_node_type_'); |
define('JOB_NODE_TYPE', 'job_node_type_'); |
| 9 |
define('RESUME_NODE_TYPE', 'resume_node_type_'); |
define('RESUME_NODE_TYPE', 'resume_node_type_'); |
| 10 |
|
|
| 16 |
/** |
/** |
| 17 |
* Implementation of hook_help(). |
* Implementation of hook_help(). |
| 18 |
*/ |
*/ |
|
|
|
| 19 |
function job_help($path, $arg) { |
function job_help($path, $arg) { |
| 20 |
switch ($path) { |
switch ($path) { |
| 21 |
case 'admin/help#job': |
case 'admin/help#job': |
| 26 |
/** |
/** |
| 27 |
* Implementation of hook_perm(). |
* Implementation of hook_perm(). |
| 28 |
*/ |
*/ |
|
|
|
| 29 |
function job_perm() { |
function job_perm() { |
| 30 |
return array( |
return array( |
| 31 |
JOB_PERM_APPLY, |
JOB_PERM_APPLY, |
| 38 |
*/ |
*/ |
| 39 |
function job_menu() { |
function job_menu() { |
| 40 |
$items = array(); |
$items = array(); |
|
|
|
| 41 |
$items['admin/settings/job'] = array( |
$items['admin/settings/job'] = array( |
| 42 |
'title' => t('Job'), |
'title' => t('Job'), |
| 43 |
'description' => t('Job settings'), |
'description' => t('Job settings'), |
| 44 |
'page callback' => 'drupal_get_form', |
'page callback' => 'drupal_get_form', |
| 45 |
'page arguments' => array('job_admin_settings'), |
'page arguments' => array('job_admin_settings'), |
| 46 |
'access arguments' => array('administer site configuration'), |
'access arguments' => array('administer site configuration'), |
| 47 |
); |
); |
| 48 |
|
|
| 49 |
$items['job/apply'] = array( |
$items['job/apply'] = array( |
| 60 |
|
|
| 61 |
$items['job/applications'] = array( |
$items['job/applications'] = array( |
| 62 |
'page callback' => 'job_view', |
'page callback' => 'job_view', |
| 63 |
'title' => t('Job applications'), |
'title' => t('Job Applications Received'), |
| 64 |
'type' => MENU_SUGGESTED_ITEM, |
'type' => MENU_SUGGESTED_ITEM, |
| 65 |
'access arguments' => array(JOB_PERM_MANAGE), |
'access arguments' => array(JOB_PERM_MANAGE), |
| 66 |
); |
); |
| 67 |
|
|
| 68 |
|
$items['job/appliedfor'] = array( |
| 69 |
|
'page callback' => 'job_post_view', |
| 70 |
|
'title' => t('Jobs Applied For'), |
| 71 |
|
'type' => MENU_SUGGESTED_ITEM, |
| 72 |
|
'access arguments' => array(JOB_PERM_APPLY), |
| 73 |
|
); |
| 74 |
|
|
| 75 |
return $items; |
return $items; |
| 76 |
} |
} |
| 82 |
'#title' => t('Enable job application for these content types'), |
'#title' => t('Enable job application for these content types'), |
| 83 |
); |
); |
| 84 |
|
|
| 85 |
foreach(node_get_types() as $type => $name) { |
foreach (node_get_types() as $type => $name) { |
| 86 |
$form[$set][JOB_NODE_TYPE . $type] = array( |
$form[$set][JOB_NODE_TYPE . $type] = array( |
| 87 |
'#type' => 'checkbox', |
'#type' => 'checkbox', |
| 88 |
'#title' => $type, |
'#title' => $type, |
| 97 |
/** |
/** |
| 98 |
* Implementation of hook_link(). |
* Implementation of hook_link(). |
| 99 |
*/ |
*/ |
| 100 |
|
function job_link($type, $node = NULL, $teaser = FALSE) { |
|
function job_link($type, $node = null, $teaser = FALSE) { |
|
| 101 |
global $user; |
global $user; |
| 102 |
$links = array(); |
$links = array(); |
| 103 |
if ($type == 'node') { |
if ($type == 'node') { |
| 136 |
/** |
/** |
| 137 |
* Implementation of hook_user(). |
* Implementation of hook_user(). |
| 138 |
*/ |
*/ |
|
|
|
| 139 |
function job_user($op, &$edit, &$account, $category = NULL) { |
function job_user($op, &$edit, &$account, $category = NULL) { |
| 140 |
global $user; |
global $user; |
| 141 |
switch ($op) { |
switch ($op) { |
| 143 |
if ($user->uid == $account->uid) { |
if ($user->uid == $account->uid) { |
| 144 |
// User is viewing own account |
// User is viewing own account |
| 145 |
if (user_access(JOB_PERM_MANAGE)) { |
if (user_access(JOB_PERM_MANAGE)) { |
| 146 |
return array(t('Job applications') => array(array('value' => l(t('View job applications'), 'job/applications')))); |
|
| 147 |
|
// Create Job Applications Received Header |
| 148 |
|
$account->content['job_applications'] = |
| 149 |
|
array( |
| 150 |
|
'#type' => 'user_profile_category', |
| 151 |
|
'#attributes' => array( |
| 152 |
|
'class' => 'user-member' |
| 153 |
|
), |
| 154 |
|
'#title' => 'Job Applications Received', |
| 155 |
|
'#weight' => 0 |
| 156 |
|
); |
| 157 |
|
|
| 158 |
|
// Create Job Applications Content |
| 159 |
|
$account->content['job_applications']['view_job_applications'] = |
| 160 |
|
array( |
| 161 |
|
'#type' => 'user_profile_item', |
| 162 |
|
'#value' => l(t('View job applications'), 'job/applications'), |
| 163 |
|
'#weight' => 0 |
| 164 |
|
); |
| 165 |
} |
} |
| 166 |
|
|
| 167 |
|
if (user_access(JOB_PERM_APPLY)) { |
| 168 |
|
|
| 169 |
|
// Create Jobs Applied For Header |
| 170 |
|
$account->content['job_applied_for'] = |
| 171 |
|
array( |
| 172 |
|
'#type' => 'user_profile_category', |
| 173 |
|
'#attributes' => array( |
| 174 |
|
'class' => 'user-member' |
| 175 |
|
), |
| 176 |
|
'#title' => 'Jobs Applied For', |
| 177 |
|
'#weight' => 0 |
| 178 |
|
); |
| 179 |
|
|
| 180 |
|
// Create Job Applied For Content |
| 181 |
|
$account->content['job_applied_for']['view_job_applied_for'] = |
| 182 |
|
array( |
| 183 |
|
'#type' => 'user_profile_item', |
| 184 |
|
'#value' => l(t('View job postings'), 'job/appliedfor'), |
| 185 |
|
'#weight' => 0 |
| 186 |
|
); |
| 187 |
|
} |
| 188 |
} |
} |
| 189 |
break; |
break; |
| 190 |
} |
} |
| 224 |
$resume_list = job_resume_list($user->uid); |
$resume_list = job_resume_list($user->uid); |
| 225 |
|
|
| 226 |
if (!$resume_list) { |
if (!$resume_list) { |
| 227 |
$msg = t('Please !create to apply', array('!create' => l(t('create a resume'), 'node/add'))); |
foreach (node_get_types() as $type => $name) { |
| 228 |
|
$resume_node = variable_get(RESUME_NODE_TYPE . $type, 0); |
| 229 |
|
if ($resume_node == 1) { |
| 230 |
|
$resume_node = $type; |
| 231 |
|
break; |
| 232 |
|
} |
| 233 |
|
} |
| 234 |
|
|
| 235 |
|
$msg = t('Please !create to apply', array('!create' => l(t('create a resume'), 'node/add/' . $resume_node))); |
| 236 |
drupal_set_message($msg); |
drupal_set_message($msg); |
| 237 |
drupal_goto("node/$job_nid"); |
drupal_goto("node/$job_nid"); |
| 238 |
} |
} |
| 347 |
return $rows; |
return $rows; |
| 348 |
} |
} |
| 349 |
|
|
| 350 |
|
function job_post_view() { |
| 351 |
|
global $user; |
| 352 |
|
print theme('page', theme('job_post_view', job_get_post_list($user->uid))); |
| 353 |
|
} |
| 354 |
|
|
| 355 |
|
function job_get_post_list($uid = NULL) { |
| 356 |
|
$rows = array(); |
| 357 |
|
$sql = "SELECT n.nid, n.uid, j.resume_nid, j.timestamp, j.uid AS juid |
| 358 |
|
FROM {node} n INNER JOIN {job} j USING(nid) |
| 359 |
|
WHERE j.uid = %d |
| 360 |
|
AND j.status = 1 |
| 361 |
|
ORDER by j.timestamp ASC"; |
| 362 |
|
$result = db_query($sql, $uid); |
| 363 |
|
while ($data = db_fetch_object($result)) { |
| 364 |
|
$resume = node_load(array('nid' => $data->resume_nid)); |
| 365 |
|
$job = node_load(array('nid' => $data->nid)); |
| 366 |
|
$rows[] = array( |
| 367 |
|
'poster' => user_load(array('uid' => $data->uid)), |
| 368 |
|
'resume' => $resume, |
| 369 |
|
'job' => $job, |
| 370 |
|
'timestamp' => $data->timestamp, |
| 371 |
|
'applicant' => user_load(array('uid' => $data->juid)), |
| 372 |
|
); |
| 373 |
|
} |
| 374 |
|
return $rows; |
| 375 |
|
} |
| 376 |
|
|
| 377 |
|
|
| 378 |
function theme_job_view($list = array()) { |
function theme_job_view($list = array()) { |
| 379 |
$rows = array(); |
$rows = array(); |
| 380 |
$header = array(t('Job'), t('Applicant'), t('Resume'), t('Date'), t('Operations')); |
$header = array(t('Job'), t('Applicant'), t('Resume'), t('Date'), t('Operations')); |
| 407 |
return theme('table', $header, $rows); |
return theme('table', $header, $rows); |
| 408 |
} |
} |
| 409 |
|
|
| 410 |
|
|
| 411 |
/** |
/** |
| 412 |
* Implemetation of hook_theme(). |
* Implemetation of hook_theme(). |
| 413 |
* |
* |
| 415 |
function job_theme() { |
function job_theme() { |
| 416 |
return array( |
return array( |
| 417 |
'job_view' => array( |
'job_view' => array( |
| 418 |
'arguments' => array('list' => NULL), |
'file' => 'job.module', |
| 419 |
|
'arguments' => array( |
| 420 |
|
'list' => array(), |
| 421 |
|
), |
| 422 |
), |
), |
| 423 |
|
'job_post_view' => array( |
| 424 |
'job_mail' => array( |
'file' => 'job.module', |
| 425 |
'arguments' => array( |
'arguments' => array( |
| 426 |
'job_node' => NULL, |
'list' => array(), |
| 427 |
'job_user' => NULL, |
), |
| 428 |
'resume_node' => NULL, |
), |
| 429 |
'resume_user' => NULL, |
'job_mail' => array( |
| 430 |
), |
'file' => 'job.module', |
| 431 |
|
'arguments' => array( |
| 432 |
|
'job_node' => NULL, |
| 433 |
|
'job_user' => NULL, |
| 434 |
|
'resume_node' => NULL, |
| 435 |
|
'resume_user' => NULL, |
| 436 |
|
), |
| 437 |
), |
), |
|
|
|
| 438 |
'job_search_item' => array( |
'job_search_item' => array( |
| 439 |
|
'file' => 'job.module', |
| 440 |
'arguments' => array( |
'arguments' => array( |
| 441 |
'item' => NULL, |
'item' => NULL, |
| 442 |
), |
), |
| 443 |
), |
), |
| 444 |
); |
); |
| 445 |
|
} |
| 446 |
|
|
| 447 |
|
|
| 448 |
|
function theme_job_post_view($list = array()) { |
| 449 |
|
$rows = array(); |
| 450 |
|
$header = array(t('Poster'), t('Job'), t('Resume'), t('Date'), t('Operations')); |
| 451 |
|
if (count($list)) { |
| 452 |
|
foreach($list as $data) { |
| 453 |
|
$poster = $data['poster']; |
| 454 |
|
$applicant = $data['applicant']; |
| 455 |
|
$resume = $data['resume']; |
| 456 |
|
$job = $data['job']; |
| 457 |
|
|
| 458 |
|
$title = l($job->title, "node/$job->nid"); |
| 459 |
|
$resume = l($resume->title, "node/" . $resume->nid); |
| 460 |
|
$user = l($poster->name, "user/$poster->uid"); |
| 461 |
|
$ops = l(t('Clear'), "job/clear/$job->nid/" . $applicant->uid); |
| 462 |
|
$timestamp = format_date($data['timestamp'], 'custom', 'Y-m-d H:i'); |
| 463 |
|
|
| 464 |
|
$rows[] = array( |
| 465 |
|
'data' => array_merge( |
| 466 |
|
array($user), |
| 467 |
|
array($title), |
| 468 |
|
array($resume), |
| 469 |
|
array($timestamp), |
| 470 |
|
array($ops) |
| 471 |
|
) |
| 472 |
|
); |
| 473 |
|
} |
| 474 |
|
} |
| 475 |
|
else { |
| 476 |
|
$rows[] = array('data' => array(t('No jobs applied for.'))); |
| 477 |
|
} |
| 478 |
|
return theme('table', $header, $rows); |
| 479 |
} |
} |
| 480 |
|
|
| 481 |
|
|
| 482 |
/** |
/** |
| 483 |
* Implementation of hook_nodeapi(). |
* Implementation of hook_nodeapi(). |
| 484 |
*/ |
*/ |
|
|
|
| 485 |
function job_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) { |
function job_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) { |
| 486 |
switch ($op) { |
switch ($op) { |
| 487 |
case 'delete': |
case 'delete': |
| 540 |
)); |
)); |
| 541 |
} |
} |
| 542 |
|
|
| 543 |
|
|
| 544 |
|
/* |
| 545 |
|
function job_send_email($job_nid, $resume_nid) { |
| 546 |
|
$job_node = node_load(array('nid' => $job_nid)); |
| 547 |
|
$job_user = user_load(array('uid' => $job_node->uid)); |
| 548 |
|
$resume_node = node_load(array('nid' => $resume_nid)); |
| 549 |
|
$resume_user = user_load(array('uid' => $resume_node->uid)); |
| 550 |
|
|
| 551 |
|
$from = $resume_user->mail; |
| 552 |
|
//$result = theme('job_mail', $job_node, $job_user, $resume_node, $resume_user); |
| 553 |
|
$account = array(); // Set this as needed |
| 554 |
|
$language = user_preferred_language($account); |
| 555 |
|
$object = array(); // Replace this as needed |
| 556 |
|
$context['subject'] = $subject; |
| 557 |
|
$context['body'] = $body; |
| 558 |
|
$params = array( |
| 559 |
|
'account' => $account, |
| 560 |
|
'object' => $object, |
| 561 |
|
'context' => $context, |
| 562 |
|
'job_node' => $job_node, |
| 563 |
|
'job_user' => $job_user, |
| 564 |
|
'resume_node' => $resume_node, |
| 565 |
|
'resume_user' => $resume_user); |
| 566 |
|
drupal_mail('job', 'job_apply', $job_user->mail, $language, $params, $from); |
| 567 |
|
|
| 568 |
|
watchdog('job', t("%name applied for job $job_node->nid.", |
| 569 |
|
array('%name' => theme('placeholder', $resume_user->name . " <$from>")))); |
| 570 |
|
} |
| 571 |
|
|
| 572 |
|
function job_mail($key, &$message, $params) { |
| 573 |
|
if ($key == 'job_apply') { |
| 574 |
|
global $base_url; |
| 575 |
|
$job_node = $params['job_node']; |
| 576 |
|
$job_user = $params['job_user']; |
| 577 |
|
$resume_node = $params['resume_node']; |
| 578 |
|
$resume_user = $params['resume_user']; |
| 579 |
|
|
| 580 |
|
$site = variable_get('site_name', 'drupal site'); |
| 581 |
|
$subject = t("[$site] [Job application] for [$job_node->title] by [$resume_user->name]"); |
| 582 |
|
$body = t("The following user has applied for the above job.\n"); |
| 583 |
|
$body .= t("\n\nJob: @title", array('@title' => $job_node->title)); |
| 584 |
|
$body .= t("\n\nJob URL: @url", array('@url' => url($base_url . "/node/$job_node->nid"))); |
| 585 |
|
$body .= t("\n\nApplicant name: @name", array('@name' => $resume_user->name)); |
| 586 |
|
$body .= t("\n\nApplicant email: @email", array('@email' => $resume_user->mail)); |
| 587 |
|
$body .= t("\n\nApplicant URL: @url", array('@url' => url($base_url . "/user/$resume_user->uid"))); |
| 588 |
|
$body .= t("\n\nResume: @title", array('@title' => $resume_node->title)); |
| 589 |
|
$body .= t("\n\nResume URL: @url", array('@url' => url($base_url . "/node/$resume_node->nid"))); |
| 590 |
|
$body .= t("\n\nManage job applications at @manage", array('@manage' => url($base_url . "/job/applications"))); |
| 591 |
|
|
| 592 |
|
$message ['subject'] = $subject; |
| 593 |
|
$message ['body'] = $body; |
| 594 |
|
} |
| 595 |
|
} |
| 596 |
|
*/ |
| 597 |
|
|
| 598 |
function job_search_item($item) { |
function job_search_item($item) { |
| 599 |
return theme('job_search_item', $item); |
return theme('job_search_item', $item); |
| 600 |
} |
} |
| 609 |
return $output ; |
return $output ; |
| 610 |
} |
} |
| 611 |
|
|
|
|
|
| 612 |
/** |
/** |
| 613 |
* Implementation of hook_views_tables(): |
* Implementation of hook_views_api(). |
|
* Present fields and filters for user data. |
|
| 614 |
*/ |
*/ |
| 615 |
function job_views_tables() { |
function job_views_api() { |
| 616 |
$tables['job'] = array( |
return array( |
| 617 |
'name' => 'job', |
'api' => 2, |
| 618 |
|
'path' => drupal_get_path('module', 'job') .'/views', |
|
'provider' => 'internal', // won't show up in external list. |
|
|
|
|
|
'join' => array( |
|
|
'left' => array( |
|
|
'table' => 'node', |
|
|
'field' => 'nid', |
|
|
), |
|
|
'right' => array( |
|
|
'field' => 'nid', |
|
|
), |
|
|
), |
|
|
|
|
|
'fields' => array( |
|
|
'timestamp' => array( |
|
|
'name' => t('Job: Date/Time applied for'), |
|
|
'sortable' => TRUE, |
|
|
'option' => 'integer', |
|
|
'handler' => 'views_handler_field_date_small', |
|
|
'help' => t('Displays the date/time applied for this Job.'), |
|
|
), |
|
|
'uid' => array( |
|
|
'name' => t('Resume: Applicant Name'), |
|
|
'handler' => 'job_views_handler_field_applicant', |
|
|
'sortable' => TRUE, |
|
|
'help' => t('Displays the name of the applicant.'), |
|
|
), |
|
|
'resume_nid' => array( |
|
|
'name' => t('Resume: Node ID'), |
|
|
'sortable' => TRUE, |
|
|
'option' => 'integer', |
|
|
'handler' => 'views_handler_field_int', |
|
|
'help' => t('Displays the Node ID of the resume node.'), |
|
|
), |
|
|
), |
|
|
|
|
|
'sorts' => array( |
|
|
'timestamp' => array( |
|
|
'name' => t('Job: Date/time applied for'), |
|
|
'help' => t("Sort by the date/time applied for this job"), |
|
|
), |
|
|
), |
|
|
|
|
|
'filters' => array( |
|
|
'status' => array( |
|
|
'name' => t('Job: Application status'), |
|
|
'value-type' => 'integer', |
|
|
'operator' => 'views_handler_operator_eqneq', |
|
|
'list-type' => 'select', |
|
|
'list' => array( |
|
|
0 => t('Job has no applications'), |
|
|
1 => t('Job has one or more applications'), |
|
|
), |
|
|
'help' => t('Filter by whether a job has applications or not.'), |
|
|
), |
|
|
'uid' => array( |
|
|
'field' => 'uid', |
|
|
'name' => t('Job: Applicant User ID'), |
|
|
'operator' => 'views_handler_operator_eqneq', |
|
|
'handler' => 'job_views_handler_filter_applicant', |
|
|
'list-type' => 'select', |
|
|
'list' => array( |
|
|
'uid_current' => t('Currently Logged In User'), |
|
|
'uid_all' => t('All Users'), |
|
|
), |
|
|
'help' => t('This allows you to filter based on favorites nodes.'), |
|
|
), |
|
|
), |
|
| 619 |
); |
); |
|
|
|
|
return $tables; |
|
| 620 |
} |
} |
| 621 |
|
|
|
function job_views_handler_field_applicant($fieldinfo, $fielddata, $value, $data) { |
|
|
$obj = new stdClass(); |
|
|
$obj = user_load(array('uid' => $value)); |
|
|
return theme('username', $obj); |
|
|
} |
|
| 622 |
|
|
|
function job_views_handler_filter_applicant($op, $filter, $filterinfo, &$query) { |
|
|
global $user; |
|
|
|
|
|
$table_data = _views_get_tables(); |
|
|
$joininfo = $table_data['job']['join']; |
|
|
$joininfo['type'] = 'inner'; |
|
|
$table_num = $query->add_table('job', FALSE, 1, $joininfo); |
|
|
$table = $query->get_table_name('job', $table_num); |
|
|
$query->set_distinct(); |
|
|
|
|
|
switch($filter['value']) { |
|
|
case 'uid_current': |
|
|
if($user->uid) { |
|
|
$query->add_where("$table.uid = $user->uid"); |
|
|
} |
|
|
break; |
|
| 623 |
|
|
|
case 'uid_all': |
|
|
// No special processing needed, since we do an inner join anyways |
|
|
break; |
|
|
} |
|
|
} |
|
|
|
|
|
function job_views_arguments() { |
|
|
$args = array(); |
|
|
|
|
|
$args[] = array( |
|
|
'name' => t('Job: Applied for by User ID'), |
|
|
'handler' => 'job_views_handler_argument_applicant', |
|
|
); |
|
|
return $args; |
|
|
} |
|
|
|
|
|
function job_views_handler_argument_applicant($op, &$query, $argtype, $arg = '') { |
|
|
if ($op == 'filter' && $arg) { |
|
|
$table_data = _views_get_tables(); |
|
|
$joininfo = $table_data['job']['join']; |
|
|
$joininfo['type'] = 'inner'; |
|
|
$table_num = $query->add_table('job', FALSE, 1, $joininfo); |
|
|
$table = $query->get_table_name('job', $table_num); |
|
|
$query->set_distinct(); |
|
|
|
|
|
$query->add_where("$table.uid = $arg"); |
|
|
} |
|
|
} |
|
|
|
|
|
function job_views_default_views() { |
|
|
|
|
|
$view = new stdClass(); |
|
|
$view->name = 'my_applications'; |
|
|
$view->description = 'My applications: shows job applications by the currently logged in user.'; |
|
|
$view->access = array(); |
|
|
$view->view_args_php = ''; |
|
|
$view->page = TRUE; |
|
|
$view->page_title = 'My applications'; |
|
|
$view->page_header = ''; |
|
|
$view->page_header_format = '1'; |
|
|
$view->page_footer = ''; |
|
|
$view->page_footer_format = '1'; |
|
|
$view->page_empty = 'You have not applied for any jobs.'; |
|
|
$view->page_empty_format = '1'; |
|
|
$view->page_type = 'table'; |
|
|
$view->url = 'my_applications'; |
|
|
$view->use_pager = TRUE; |
|
|
$view->nodes_per_page = '10'; |
|
|
$view->sort = array(); |
|
|
$view->argument = array(); |
|
|
$view->field = array( |
|
|
array( |
|
|
'tablename' => 'node', |
|
|
'field' => 'title', |
|
|
'label' => '', |
|
|
'handler' => 'views_handler_field_nodelink', |
|
|
'options' => 'link', |
|
|
), |
|
|
array( |
|
|
'tablename' => 'node', |
|
|
'field' => 'created', |
|
|
'label' => '', |
|
|
'handler' => 'views_handler_field_date_small', |
|
|
), |
|
|
); |
|
|
$view->filter = array( |
|
|
array( |
|
|
'tablename' => 'job', |
|
|
'field' => 'uid', |
|
|
'operator' => '=', |
|
|
'options' => '', |
|
|
'value' => 'uid_current', |
|
|
), |
|
|
); |
|
|
$view->exposed_filter = array(); |
|
|
$view->requires = array(node, job); |
|
|
$views[$view->name] = $view; |
|
|
|
|
|
|
|
|
$view = new stdClass(); |
|
|
$view->name = 'job_applications'; |
|
|
$view->description = 'Job applications: Recruiter/employer view of all jobs applied for.'; |
|
|
$view->access = array(); |
|
|
$view->view_args_php = ''; |
|
|
$view->page = TRUE; |
|
|
$view->page_title = 'Job applications'; |
|
|
$view->page_header = ''; |
|
|
$view->page_header_format = '1'; |
|
|
$view->page_footer = ''; |
|
|
$view->page_footer_format = '1'; |
|
|
$view->page_empty = 'There are no job applications.'; |
|
|
$view->page_empty_format = '1'; |
|
|
$view->page_type = 'table'; |
|
|
$view->url = 'job_applications'; |
|
|
$view->use_pager = TRUE; |
|
|
$view->nodes_per_page = '10'; |
|
|
$view->sort = array(); |
|
|
$view->argument = array(); |
|
|
$view->field = array( |
|
|
array( |
|
|
'tablename' => 'node', |
|
|
'field' => 'title', |
|
|
'label' => 'Job', |
|
|
'handler' => 'views_handler_field_nodelink', |
|
|
'sortable' => '1', |
|
|
'options' => 'link', |
|
|
), |
|
|
array( |
|
|
'tablename' => 'users', |
|
|
'field' => 'name', |
|
|
'label' => 'Recruiter', |
|
|
'sortable' => '1', |
|
|
), |
|
|
array( |
|
|
'tablename' => 'job', |
|
|
'field' => 'uid', |
|
|
'label' => 'Applicant', |
|
|
'sortable' => '1', |
|
|
), |
|
|
array( |
|
|
'tablename' => 'job', |
|
|
'field' => 'timestamp', |
|
|
'label' => 'Date/Time', |
|
|
), |
|
|
); |
|
|
$view->filter = array( |
|
|
array( |
|
|
'tablename' => 'node', |
|
|
'field' => 'type', |
|
|
'operator' => 'OR', |
|
|
'options' => '', |
|
|
'value' => array( |
|
|
0 => 'job', |
|
|
), |
|
|
), |
|
|
array( |
|
|
'tablename' => 'job', |
|
|
'field' => 'status', |
|
|
'operator' => '=', |
|
|
'options' => '', |
|
|
'value' => '1', |
|
|
), |
|
|
); |
|
|
$view->exposed_filter = array(); |
|
|
$view->requires = array(node, users, job); |
|
|
$views[$view->name] = $view; |
|
|
|
|
|
$view = new stdClass(); |
|
|
$view->name = 'seeker_applications'; |
|
|
$view->description = 'Seeker applications: a view that accepts an optional UID argument to list all applications, or a specific user\'s applications'; |
|
|
$view->access = array(); |
|
|
$view->view_args_php = ''; |
|
|
$view->page = TRUE; |
|
|
$view->page_title = 'Seeker applications'; |
|
|
$view->page_header = ''; |
|
|
$view->page_header_format = '1'; |
|
|
$view->page_footer = ''; |
|
|
$view->page_footer_format = '1'; |
|
|
$view->page_empty = 'There are no job applications.'; |
|
|
$view->page_empty_format = '1'; |
|
|
$view->page_type = 'table'; |
|
|
$view->url = 'seeker_applications'; |
|
|
$view->use_pager = TRUE; |
|
|
$view->nodes_per_page = '10'; |
|
|
$view->sort = array(); |
|
|
$view->argument = array( |
|
|
array( |
|
|
'type' => '0', |
|
|
'argdefault' => '2', |
|
|
'title' => '', |
|
|
'options' => '', |
|
|
'wildcard' => '', |
|
|
'wildcard_substitution' => '', |
|
|
), |
|
|
); |
|
|
$view->field = array( |
|
|
array( |
|
|
'tablename' => 'node', |
|
|
'field' => 'title', |
|
|
'label' => 'Job', |
|
|
'handler' => 'views_handler_field_nodelink', |
|
|
'sortable' => '1', |
|
|
'options' => 'link', |
|
|
), |
|
|
array( |
|
|
'tablename' => 'users', |
|
|
'field' => 'name', |
|
|
'label' => 'Recruiter', |
|
|
'sortable' => '1', |
|
|
), |
|
|
array( |
|
|
'tablename' => 'job', |
|
|
'field' => 'timestamp', |
|
|
'label' => 'Date/Time', |
|
|
), |
|
|
); |
|
|
$view->filter = array( |
|
|
array( |
|
|
'tablename' => 'node', |
|
|
'field' => 'type', |
|
|
'operator' => 'OR', |
|
|
'options' => '', |
|
|
'value' => array( |
|
|
0 => 'job', |
|
|
), |
|
|
), |
|
|
); |
|
|
$view->exposed_filter = array(); |
|
|
$view->requires = array(node, users, job); |
|
|
$views[$view->name] = $view; |
|
|
} |
|