/[drupal]/contributions/modules/stock/stock.module
ViewVC logotype

Diff of /contributions/modules/stock/stock.module

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

revision 1.21.2.3, Sun Oct 26 02:52:27 2008 UTC revision 1.21.2.4, Sat Jul 25 17:34:51 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: stock.module,v 1.21.2.2 2008/10/25 00:35:16 kbahey Exp $  // $Id: stock.module,v 1.21.2.3 2008/10/26 02:52:27 kbahey Exp $
3  // 6.4 fixes by beyond  // 6.4 fixes by beyond
4    
5  /**  /**
# Line 19  Line 19 
19   * Implementation of hook_help().   * Implementation of hook_help().
20   */   */
21  function stock_help($path, $arg) {  function stock_help($path, $arg) {
   $output = '';  
   
22    switch ($path) {    switch ($path) {
23      case 'admin/settings#stock':      case 'admin/settings#stock':
24        return t('This module provides stock quotes. It either displays a page format or a block format. Users can store their own stock symbols, and have a block that tells them how their portfolio is performing.');        return t('This module provides stock quotes. It either displays a page format or a block format. Users can store their own stock symbols, and have a block that tells them how their portfolio is performing.');
# Line 29  function stock_help($path, $arg) { Line 27  function stock_help($path, $arg) {
27    }    }
28  }  }
29    
30    function stock_menu() {
31      $items['stock'] = array(
32        'title'              => variable_get('stock_overview_title', 'Stocks'),
33        'access arguments'   => array('use stock'),
34        'page callback'      => 'stock_page',
35      );
36    
37      $items['admin/settings/stock'] = array(
38        'title'              => 'Stock settings',
39        'description'        => 'Configure displayed titles and description.',
40        'page callback'      => 'drupal_get_form',
41        'page arguments'     => array('stock_admin_settings'),
42        'access arguments'   => array('administer site configuration'),
43      );
44    
45      return $items;
46    }
47    
48  function stock_admin_settings() {  function stock_admin_settings() {
49      $form['stock_description'] = array(    $form['stock_description'] = array(
50        '#type' => 'textarea',      '#type'          => 'textarea',
51        '#title' => t('Description'),      '#title'         => t('Description'),
52        '#default_value' =>  variable_get('stock_description', t('This is the stock quote page.')),      '#default_value' =>  variable_get('stock_description', t('This is the stock quote page.')),
53        '#cols' => 70,      '#cols'          => 70,
54        '#rows' => 7,      '#rows'          => 7,
55        '#description' => t('This text will be displayed at the top of the stock quote page'),      '#description'   => t('This text will be displayed at the top of the stock quote page'),
56      );    );
57    
58      $form['stock_block_title'] = array(    $form['stock_block_title'] = array(
59        '#type' => 'textfield',      '#type'          => 'textfield',
60        '#title' => t('Stock block title text'),      '#title'         => t('Stock block title text'),
61        '#default_value' => variable_get('stock_block_title', t('Stocks')),      '#default_value' => variable_get('stock_block_title', t('Stocks')),
62        '#size' => 35,      '#size'          => 35,
63        '#maxlength' => 255,      '#maxlength'     => 255,
64        '#description' => t('If configured as a block, this text shows as the block title.'),      '#description'   => t('If configured as a block, this text shows as the block title.'),
65      );    );
66    
67      $form['stock_overview_title'] = array(    $form['stock_overview_title'] = array(
68        '#type' => 'textfield',      '#type'          => 'textfield',
69        '#title' => t('Navigation link text'),      '#title'         => t('Navigation link text'),
70        '#default_value' => variable_get('stock_overview_title', t('Stock quote')),      '#default_value' => variable_get('stock_overview_title', t('Stock quote')),
71        '#size' => 35,      '#size'          => 35,
72        '#maxlength' => 255,      '#maxlength'     => 255,
73        '#description' => t('The text in the navigation link which points to the stock quote page.'),      '#description'   => t('The text in the navigation link which points to the stock quote page.'),
74      );    );
75    
76      $form['stock_block_default_symbols'] = array(    $form['stock_block_default_symbols'] = array(
77        '#type' => 'textfield',      '#type'          => 'textfield',
78        '#title' => t('Block default symbols'),      '#title'         => t('Block default symbols'),
79        '#default_value' => variable_get('stock_block_default_symbols', ''),      '#default_value' => variable_get('stock_block_default_symbols', ''),
80        '#size' => 40,      '#size'          => 40,
81        '#maxlength' => 255,      '#maxlength'     => 255,
82        '#description' => t('Default stock symbols to display in the block when the user has no stocks defined. Separate each stock symbol with a space.'),      '#description'   => t('Default stock symbols to display in the block when the user has no stocks defined. Separate each stock symbol with a space.'),
83      );    );
84    
85    return system_settings_form($form);    return system_settings_form($form);
86  }  }
# Line 81  function stock_link($type, $node = 0, $m Line 97  function stock_link($type, $node = 0, $m
97        'title' => t("Stock"),        'title' => t("Stock"),
98        'href' => "stock");        'href' => "stock");
99    }    }
   
100    return $links;    return $links;
101  }  }
102    
 function stock_menu() {  
   $title = variable_get('stock_overview_title', 'Stocks');  
   
   $items['stock'] = array(  
     'title'              => $title,  
     'access arguments'   => array('use stock'),  
     'page callback'      => 'stock_page',  
   );  
   
   $items['admin/settings/stock'] = array(  
     'title'              => 'Stock settings',  
     'description'        => 'Configure displayed titles and description.',  
     'page callback'      => 'drupal_get_form',  
     'page arguments'     => array('stock_admin_settings'),  
     'access arguments'   => array('administer site configuration'),  
   );  
   
   return $items;  
 }  
   
103  // Display the stock page  // Display the stock page
104  function stock_page() {  function stock_page() {
105    $output = stock_contents('page');    return theme('stock_page', stock_contents('page'));
   return theme('stock_page', $output);  
106  }  }
107    
108  function stock_block($op = 'list', $delta = 0) {  function stock_block($op = 'list', $delta = 0) {

Legend:
Removed from v.1.21.2.3  
changed lines
  Added in v.1.21.2.4

  ViewVC Help
Powered by ViewVC 1.1.2