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

Diff of /contributions/modules/ticketyboo/ticketyboo.module

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

revision 1.3, Thu Sep 11 15:49:07 2008 UTC revision 1.4, Sat Jan 10 12:48:22 2009 UTC
# Line 54  function _ticketyboo_config($delta) { Line 54  function _ticketyboo_config($delta) {
54        '#type' => 'textarea',        '#type' => 'textarea',
55        '#default_value' => variable_get('ticketyboo_text_'.$delta, ''),        '#default_value' => variable_get('ticketyboo_text_'.$delta, ''),
56     );     );
57       $form['selection'] = array(
58          '#title' => t('Selection'),
59          '#description' => t('Method of selecting nodes to be displayed in the ticker:<br />- Node: a list of node numbers separated by commas<br />- Type: a single node type (eg page, story)<br />- Taxonomy: a list of taxonomy categories separarted by commas'),
60          '#type' => 'select',
61          '#default_value' => variable_get('ticketyboo_selection_'.$delta, 'node'),
62          '#options' => array('node'=>'Node', 'type'=>'Type', 'taxonomy'=>'Taxonomy'),
63       );
64     $form['nodes'] = array(     $form['nodes'] = array(
65        '#title' => t('Nodes'),        '#title' => t('Nodes, Type or Taxonomy'),
66        '#description' => t('A list of node numbers which will be used for Ticker ').$delta.'. '.t('Separate node numbers with commas.'),        '#description' => t('A list of node numbers, types or taxonomy categories which will be used for Ticker ').$delta.'. '.t('Separate each entry with commas.'),
67        '#type' => 'textarea',        '#type' => 'textarea',
68        '#default_value' => variable_get('ticketyboo_nodes_'.$delta, ''),        '#default_value' => variable_get('ticketyboo_nodes_'.$delta, ''),
69     );     );
# Line 123  function _ticketyboo_config($delta) { Line 130  function _ticketyboo_config($delta) {
130  */  */
131  function _ticketyboo_config_save($delta, $edit) {  function _ticketyboo_config_save($delta, $edit) {
132     variable_set('ticketyboo_nodes_'.$delta, $edit['nodes']);     variable_set('ticketyboo_nodes_'.$delta, $edit['nodes']);
133       variable_set('ticketyboo_selection_'.$delta, $edit['selection']);
134     variable_set('ticketyboo_text_'.$delta, $edit['text']);     variable_set('ticketyboo_text_'.$delta, $edit['text']);
135     variable_set('ticketyboo_transition_'.$delta, $edit['transition']);     variable_set('ticketyboo_transition_'.$delta, $edit['transition']);
136     variable_set('ticketyboo_pause_'.$delta, $edit['pause']);     variable_set('ticketyboo_pause_'.$delta, $edit['pause']);
# Line 144  $eps = 50; // events per second, control Line 152  $eps = 50; // events per second, control
152    
153     // get the parameters     // get the parameters
154     $nodes = variable_get('ticketyboo_nodes_'.$delta, '');     $nodes = variable_get('ticketyboo_nodes_'.$delta, '');
155       $selection = variable_get('ticketyboo_selection_'.$delta, '');
156     $text = variable_get('ticketyboo_text_'.$delta, '');     $text = variable_get('ticketyboo_text_'.$delta, '');
157     $transition = variable_get('ticketyboo_transition_'.$delta, 3);     $transition = variable_get('ticketyboo_transition_'.$delta, 3);
158     $pause = variable_get('ticketyboo_pause_'.$delta, 1);     $pause = variable_get('ticketyboo_pause_'.$delta, 1);
# Line 183  $eps = 50; // events per second, control Line 192  $eps = 50; // events per second, control
192     $item_style = "overflow-x: hidden; overflow-y: hidden; {$float} width: {$item_width}px; height: {$item_height}px; {$item_style}";     $item_style = "overflow-x: hidden; overflow-y: hidden; {$float} width: {$item_width}px; height: {$item_height}px; {$item_style}";
193    
194     // build the ticker contents     // build the ticker contents
195     $nodes = explode(',', $nodes);     switch ($selection) {
196          case 'node':
197             $nodes = explode(',', $nodes);
198             break;
199          case 'type':
200             $r = db_query("SELECT DISTINCT nid FROM {node} WHERE type ='%s'", trim($nodes));
201             $nodes = array();
202             while ($n = db_fetch_array($r)) {$nodes[] = $n['nid'];}
203             break;
204          case 'taxonomy':
205             $r = db_query("SELECT DISTINCT nid FROM {term_node} WHERE tid in (%s)", $nodes);
206             $nodes = array();
207             while ($n = db_fetch_array($r)) {$nodes[] = $n['nid'];}
208             break;
209       }
210     $ret = '';     $ret = '';
211     $i=0;     $i=0;
212     foreach ($nodes as $nid) {     foreach ($nodes as $nid) {

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

  ViewVC Help
Powered by ViewVC 1.1.2