| 1 |
<?php |
<?php |
| 2 |
//$Id$ |
//$Id: job.install,v 1.4 2009/01/02 02:49:21 kbahey Exp $ |
| 3 |
// Copyright Khalid Baheyeldin 2008-2009 http://2bits.com |
// Copyright Khalid Baheyeldin 2008-2009 http://2bits.com |
| 4 |
|
|
| 5 |
|
define('JOB_NODE_TYPE', 'job_node_type_'); |
| 6 |
|
define('RESUME_NODE_TYPE', 'resume_node_type_'); |
| 7 |
|
|
| 8 |
/** |
/** |
| 9 |
* Implementation of hook_install(). |
* Implementation of hook_install(). |
| 10 |
*/ |
*/ |
| 11 |
function job_install() { |
function job_install() { |
| 12 |
drupal_install_schema('job'); |
// Create tables. |
| 13 |
|
drupal_install_schema('job'); |
| 14 |
} |
} |
| 15 |
|
|
| 16 |
/** |
/** |
| 17 |
* Implementation of hook_schema(). |
* Implementation of hook_uninstall(). |
| 18 |
*/ |
*/ |
| 19 |
function job_schema() { |
function job_uninstall() { |
| 20 |
|
// Delete job => nodetype mapping variables. |
| 21 |
|
foreach (node_get_types() as $type => $name) { |
| 22 |
|
variable_del(JOB_NODE_TYPE . $type); |
| 23 |
|
variable_del(RESUME_NODE_TYPE . $type); |
| 24 |
|
} |
| 25 |
|
drupal_uninstall_schema('job'); |
| 26 |
|
} |
| 27 |
|
|
| 28 |
|
/** |
| 29 |
|
* Implementation of hook_schema(). |
| 30 |
|
*/ |
| 31 |
|
function job_schema() { |
| 32 |
$schema['job'] = array( |
$schema['job'] = array( |
| 33 |
'description' => t('The table for jobs'), |
'description' => t('The table for jobs'), |
| 34 |
'fields' => array( |
'fields' => array( |
| 71 |
), |
), |
| 72 |
), |
), |
| 73 |
'primary key' => array('nid', 'uid'), |
'primary key' => array('nid', 'uid'), |
| 74 |
); |
'indexes' => array( |
| 75 |
return $schema; |
'nid' => array('nid', 'uid')), |
| 76 |
} |
); |
| 77 |
|
|
| 78 |
/** |
return $schema; |
| 79 |
* Implentation of hook_uninstall(); |
} |
| 80 |
* |
|
|
*/ |
|
|
function job_uninstall() { |
|
|
drupal_uninstall_schema('job'); |
|
|
} |
|