Changeset 102


Ignore:
Timestamp:
19/04/07 04:58:10 (5 years ago)
Author:
nigel
Message:

Fixed view and graph

File:
1 edited

Legend:

Unmodified
Added
Removed
  • openweather/openweather.module

    r101 r102  
    9696      $node = node_load(arg(1)); 
    9797      if ($node->type == 'openweather'){ 
    98       $items[] = array('path' => 'node/'. arg(1), 
    99           'title' => t('view openweather'), 
    100           'access' => user_access('access content'), 
    101           'weight' => 6, 
    102           'type' => MENU_LOCAL_TASK); 
    103  
    104       $items[] = array('path' => 'node/'. arg(1) .'/csv_readings', 
     98        $items[] = array('path' => 'node/'. arg(1) .'/csv_readings', 
    10599          'title' => t('readings'), 
    106100          'callback' => 'openweather_csv_readings', 
     
    109103          'type' => MENU_LOCAL_TASK); 
    110104 
    111       $items[] = array('path' => 'node/'. arg(1) .'/graph', 
     105        $items[] = array('path' => 'node/'. arg(1) .'/graph', 
    112106          'title' => t('graph'), 
    113107          'callback' => 'openweather_graph', 
     
    260254 * 
    261255 * @param $block 
    262  *   An extra paraopenweather that adapts the hook to display a block-ready 
    263  *   rendering of the poll. 
    264256 */ 
    265257function openweather_view($node, $teaser = FALSE, $page = FALSE, $block = FALSE) { 
    266258  global $user; 
    267  
    268   $output = ''; 
    269  
    270   $links = array(); 
    271   $links[] = l(t('export readings'), 'node/'.$node->nid.'/csv_readings',array('title'=>'Export the openweather readings as CSV')); 
    272  
    273   $output .= openweather_summary($node->nid); 
    274  
    275   $output .= "<img src='?q=node/".$node->nid."/graph/temp_out' />"; 
    276   $output .= "<img src='?q=node/".$node->nid."/graph/rel_hum_out' />"; 
    277   $output .= "<img src='?q=node/".$node->nid."/graph/rel_pressure' />"; 
    278   $output .= "<img src='?q=node/".$node->nid."/graph/windspeed' />"; 
    279  
    280   // Only show the add readings form when in full view 
    281 //  $node->teaser = $output; 
    282 //  $node->body = $output; //$output.drupal_get_form('openweather_add_reading', $form); 
    283   $node = node_prepare($node, $teaser); 
    284   $node->links = $links; 
    285   $node->content['graphs'] = array( 
    286     '#value' => theme('openweather_graphs', $output), 
    287     '#weight' => 1, 
    288   ); 
     259  $node->content['summary'] = array('#weight'=>0, 
     260    '#value'=>openweather_summary($node->nid)); 
     261 
     262  $node->content['graphs'] =  array('#weight'=>1, 
     263    '#value'=>"<img src='?q=node/".$node->nid."/graph/temp_out' />". 
     264        "<img src='?q=node/".$node->nid."/graph/rel_hum_out' />". 
     265        "<img src='?q=node/".$node->nid."/graph/rel_pressure' />". 
     266        "<img src='?q=node/".$node->nid."/graph/windspeed' />"); 
     267 
    289268  return $node; 
    290269} 
Note: See TracChangeset for help on using the changeset viewer.