| 1 |
<?php
|
| 2 |
// $Id: $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* Implementation of hook_businessapi() from business_module.
|
| 6 |
*/
|
| 7 |
function genericbusiness_businessapi(&$node, $op, $a3 = null, $a4 = null) {
|
| 8 |
if (user_access('access content')) {
|
| 9 |
switch ($op) {
|
| 10 |
case 'type':
|
| 11 |
return array('ptype' => 'generic');
|
| 12 |
case 'wizard_select':
|
| 13 |
return array('generic' => t('Generic'));
|
| 14 |
case 'ammenities':
|
| 15 |
return array('generic' => t('Generic'));
|
| 16 |
case 'form':
|
| 17 |
$form['ammenities'] = array(
|
| 18 |
'#type' => 'fieldset',
|
| 19 |
'#title' => t('Business amenitites'),
|
| 20 |
'#tree' => true,
|
| 21 |
);
|
| 22 |
//generate
|
| 23 |
$result = db_query("SELECT a.description,a.aid,a.helptext FROM {business_ammenities} a JOIN {business_ammenities_ptype} p ON p.aid = a.aid WHERE p.ptype = '%s'",$node->ptype);
|
| 24 |
while($ammenity = db_fetch_object($result)){
|
| 25 |
$form['ammenities']['ammenity-'.$ammenity->aid] = array(
|
| 26 |
'#type' => 'checkbox',
|
| 27 |
'#title' => $ammenity->description,
|
| 28 |
'#return_value' => true,
|
| 29 |
'#default_value' => $node->ammenties[$ammenity->aid],
|
| 30 |
'#description' => $ammenity->helptext,
|
| 31 |
'#attributes' => NULL,
|
| 32 |
'#required' => FALSE,
|
| 33 |
);
|
| 34 |
}
|
| 35 |
return $form;
|
| 36 |
}
|
| 37 |
}
|
| 38 |
}
|
| 39 |
|
| 40 |
function theme_generic_view($node, $teaser = 0, $page = 0) {
|
| 41 |
$output .= '<div class="details">';
|
| 42 |
if($node->ammenties){
|
| 43 |
foreach($node->ammenties as $ammenity){
|
| 44 |
$facilities .= '<li>'.$ammenity.'</li>';
|
| 45 |
}
|
| 46 |
$output .= '<div class="special"><h4>'.t('Special features').'</h4><ul class="hotel">'.$facilities.'</ul></div>';
|
| 47 |
}
|
| 48 |
return $output. '</div>';
|
| 49 |
}
|
| 50 |
?>
|