/[drupal]/contributions/modules/openresort/generic/genericbusiness.module
ViewVC logotype

Contents of /contributions/modules/openresort/generic/genericbusiness.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.5 - (show annotations) (download) (as text)
Wed Jan 2 22:14:26 2008 UTC (22 months, 3 weeks ago) by marcingy
Branch: MAIN
CVS Tags: DRUPAL-5--1-15-1, DRUPAL-5--1-15-2, DRUPAL-5--1-16-6, DRUPAL-5--1-16-4, DRUPAL-5--1-16-5, DRUPAL-5--1-16-2, DRUPAL-5--1-16-3, DRUPAL-5--1-16-1, DRUPAL-5--1-15, DRUPAL-5--1-16, HEAD
Changes since 1.4: +2 -2 lines
File MIME type: text/x-php
*** empty log message ***
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 ?>

  ViewVC Help
Powered by ViewVC 1.1.2