Hi,
I use JobSearch with the new Drupal 6 version (6.x-1.x-dev) It's work fine, but the 3 jobsearch views doesn't appears on my views module.
I have seen this post : http://drupal.org/node/207625#comment-892459 and apply the patch but It doesn't work :(
I have test to apply the patch on Drupal 5 and It's work fine but no on Drupal 6 Version :(
If somebody have an idea ?
Thanks a lot ;)
Bye

Comments

kbahey’s picture

Title: Views with JobSearch » Views 2 integration with JobSearch

The other issue is for Drupal 5.

This still needs work

xamount’s picture

I can probably take a look at this but not at least for the next week...

pydubreucq’s picture

Thanks for All.
I will take a look too, but I'm system Administrator and PHP is a mistery to me ;) lol

pydubreucq’s picture

For Information, the 2 filters doesn't exist :
Job: Application Status
Job: Applicatant User ID
Thanks for all ;)

jchatard’s picture

Hi all,

Just tried to start implementing Views2 to JobSearch.

Be nice with me it's my first Views2 module integration. It's quick and dirty, and has to be tested a lot, and cleaned-up!

I based my work on last 6.x-dev.

So here is a patch for job.module and job.views.inc which has to be placed into an "includes" folder under jobsearch module directory.

Let me know what you think.
Jérémy

jchatard’s picture

Rah, upload doesn't work, here is my code ! Sorry guys.

Since upload doesn't seems to work, I copy/paste my changes.

#1 job.module : remove function jobsearch_views_table()
#2 job.module add the following function :

/**
 * Implementation of hook_views_api():
 * Let knows Views 2 that Job Search handles some views
 */
function job_views_api() {
  return array(
    'api' => 2.0,
    'path' => drupal_get_path('module', 'job') . '/includes',
  );
}

#3 create an includes folder
#4 create a file named "job.views.inc" and insert the following code with PHP tags at start:

/**
 * Implementation of hook_views_tables():
 * Present fields and filters for user data.
 */
function job_views_data() {
  $data = array();
  
  // The 'group' index will be used as a prefix in the UI for any of this
  // table's fields, sort criteria, etc. so it's easy to tell where they came
  // from.
  $data['job']['table']['group'] = t('Jobs');
  
  // This table references the {node} table.
  // This creates an 'implicit' relationship to the node table, so that when 'Node'
  // is the base table, the fields are automatically available.
  $data['job']['table']['join'] = array(
    // Index this array by the table name to which this table refers.
    // 'left_field' is the primary key in the referenced table.
    // 'field' is the foreign key in this table.
    'node' => array(
      'left_field' => 'nid',
      'field' => 'nid',
    ),
    'user' => array(
      'left_field' => 'uid',
      'field' => 'uid',
    ),
  );
  
  // Next, describe each of the individual fields in this table to Views. For
  // each field, you may define what field, sort, argument, and/or filter
  // handlers it supports. This will determine where in the Views interface you
  // may use the field.

  // Node ID field.
  $data['job']['nid'] = array(
    'title' => t('Job nid'),
    'help' => t('Job nid reference.'),
    // Because this is a foreign key to the {node} table. This allows us to
    // have, when the view is configured with this relationship, all the fields
    // for the related node available.
    'relationship' => array(
      'base' => 'node',
      'field' => 'nid',
      'handler' => 'views_handler_relationship',
      'label' => t('Job applied by the user'),
    ),
  );

  // Node ID field.
  $data['job']['uid'] = array(
    'title' => t('User uid'),
    'help' => t('User uid reference.'),
    // Because this is a foreign key to the {user} table. This allows us to
    // have, when the view is configured with this relationship, all the fields
    // for the related user available.
    'relationship' => array(
      'base' => 'users',
      'field' => 'uid',
      'handler' => 'views_handler_relationship',
      'label' => t('User that applied to this job.'),
    ),
  );
  
  // Resume field
  $data['job']['resume_nid'] = array(
    'title' => t('Resume nid'),
    'help' => t('Resume nid reference.'),
    'relationship' => array(
      'base' => 'node',
      'handler' => 'views_handler_relationship',
      'label' => t('Used resume'),
      'click sortable' => FALSE,
    ),
    // Because this is a foreign key to the {node} table. This allows us to
    // have, when the view is configured with this relationship, all the fields
    // for the related node available.
    'relationship' => array(
      'base' => 'node',
      'field' => 'nid',
      'handler' => 'views_handler_relationship',
      'label' => t('Resume used for this appliance.'),
    ),
  );
  
  // $data['job']['resume'] = array(
  //   'title' => t('Used resume'),
  //   'help' => t('The resume node used for this application.'),
  //   'field' => array(
  //     'handler' => 'views_handler_field_numeric',
  //     'click sortable' => TRUE,
  //   ),
  //   'sort' => array(
  //     'handler' => 'views_handler_sort',
  //   ),
  //   'filter' => array(
  //     'handler' => 'views_handler_filter_numeric',
  //   ),
  //   'argument' => array(
  //     'handler' => 'views_handler_argument_numeric',
  //   ),
  // );
  
  
  // Example boolean field.
  $data['job']['status'] = array(
    'title' => t('Applied'),
    'help' => t('Has the user applied for this job (Yes/No).'),
    'field' => array(
      'handler' => 'views_handler_field_boolean',
      'click sortable' => TRUE,
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_boolean_operator',
      'label' => t('Applied'),
      'type' => 'yes-no',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );

  // Example timestamp field.
  $data['job']['timestamp'] = array(
    'title' => t('Appliance date'),
    'help' => t('This is the date when the user applied for a particular job.'),
    'field' => array(
      'handler' => 'views_handler_field_date',
      'click sortable' => TRUE,
    ),
    'sort' => array(
      'handler' => 'views_handler_sort_date',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_date',
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_date',
    ),
  );
  
  
  return $data;
}

Try Views 2 in relationship, fields, etc.

Let me know what you think.
Jérémy

kbahey’s picture

Status: Active » Needs review

Can some people test this and report if it is working?

pydubreucq’s picture

Hi,
Thanks :D
I will test that nearly and I will tell you my opinion ;)
Bye

jrosen’s picture

Status: Needs review » Closed (duplicate)

Issue: Patch for Job Search 6.x-1.x-dev - User profile updates and Views 2 integration includes full Views 2 integration, including:

1. relatationships from Job => Users
2. the 3 default views for Views 2 that were included with the Drupal 5 version

So, I am marking this issue as a duplicate. Please test the patch in the issue above, so we can unify our efforts and get the patch committed into the Drupal 6 version of the Job Search module.

Thanks,
Jason