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

Diff of /contributions/modules/sna/sna.module

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

revision 1.5, Mon Sep 4 10:13:07 2006 UTC revision 1.5.4.1, Mon Jul 30 11:48:18 2007 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id$  // $Id: sna.module,v 1.5 2006/09/04 10:13:07 aronnovak Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 154  function sna_block($op = 'list', $delta Line 154  function sna_block($op = 'list', $delta
154   */   */
155  function sna_routes() {  function sna_routes() {
156    // Generate form for searching route    // Generate form for searching route
   $form['sna_a_to_b'] = array(  
     '#type' => 'fieldset',  
     '#title' => t('Searching best route between users'),  
     '#tree' => TRUE);  
   $form['sna_a_to_b']['from'] = array(  
     '#type' => 'select',  
     '#title' => t('From'),  
     '#options' => get_all_vertices_for_forms());  
   $form['sna_a_to_b']['to'] = array(  
     '#type' => 'select',  
     '#title' => t('To'),  
     '#options' => get_all_vertices_for_forms());  
   $form['sna_a_to_b']['min_or_step'] = array(  
     '#type' => 'radios',  
     '#title' => t('Type of route searching'),  
     '#options' => array(ROUTE_SHORTEST => t('Shortest route'),  
                         ROUTE_MIN_STEP => t('Minimal step route')));  
   $form['sna_a_to_b']['submit'] = array('#type' => 'submit', '#value' => t('Search'));  
157    return drupal_get_form('sna_a_to_b', $form);    return drupal_get_form('sna_a_to_b', $form);
158  }  }
159    
# Line 240  function sna_groups() { Line 222  function sna_groups() {
222    return $output;    return $output;
223  }  }
224    
225    function sna_a_to_b() {
226      $form['sna_a_to_b'] = array(
227        '#type' => 'fieldset',
228        '#title' => t('Searching best route between users'),
229        '#tree' => TRUE);
230      $form['sna_a_to_b']['from'] = array(
231        '#type' => 'select',
232        '#title' => t('From'),
233        '#options' => get_all_vertices_for_forms());
234      $form['sna_a_to_b']['to'] = array(
235        '#type' => 'select',
236        '#title' => t('To'),
237        '#options' => get_all_vertices_for_forms());
238      $form['sna_a_to_b']['min_or_step'] = array(
239        '#type' => 'radios',
240        '#title' => t('Type of route searching'),
241        '#options' => array(ROUTE_SHORTEST => t('Shortest route'),
242                            ROUTE_MIN_STEP => t('Minimal step route')));
243      $form['sna_a_to_b']['submit'] = array('#type' => 'submit', '#value' => t('Search'));
244      return $form;
245    }
246    
247  /**  /**
248   * Handle the form of the sna_operations page   * Handle the form of the sna_operations page
249   *   *
# Line 384  function sna_menu($may_cache) { Line 388  function sna_menu($may_cache) {
388                       'callback' => 'sna_svg_distribution',                       'callback' => 'sna_svg_distribution',
389                       'access' => TRUE,                       'access' => TRUE,
390                       'type' => MENU_CALLBACK);                       'type' => MENU_CALLBACK);
391      $items[] =   array('path' => 'admin/settings/sna',
392                         'title' => t('SNA'),
393                         'description' => t('Adjust the network details'),
394                         'callback' => 'drupal_get_form',
395                         'callback arguments' => array('sna_admin_settings'),
396                         'type' => MENU_NORMAL_ITEM);
397    return $items;    return $items;
398  }  }
399    
400  /**  /**
401   * Implementation of hook_settings()   * System-wide settings of sna module
402   *   *
403   * @return array The form of settings   * @return array The form of settings
404   */   */
405  function sna_settings() {  function sna_admin_settings() {
406    /*if (!user_access("access administration pages")) {    /*if (!user_access("access administration pages")) {
407      return message_access();      return message_access();
408    }*/    }*/
# Line 402  function sna_settings() { Line 412  function sna_settings() {
412        drupal_set_message(t('You have to choose a valid dba_handler in common.php'), 'status');        drupal_set_message(t('You have to choose a valid dba_handler in common.php'), 'status');
413      }      }
414    }    }
415    drupal_set_message(t('The network database is updated: ') . date('F d Y H:i:s', filemtime(DATA_PATH)), 'status');    if (file_exists(DATA_PATH)) {
416        drupal_set_message(t('The network database is updated: ') . date('F d Y H:i:s', filemtime(DATA_PATH)), 'status');
417      }
418    $form['sna_data_source'] = array('#title' => t('Data source of the network'),    $form['sna_data_source'] = array('#title' => t('Data source of the network'),
419                                     '#type' => 'select',                                     '#type' => 'select',
420                                     '#options' => array('nodes' => 'Comments and replies', 'buddy' => 'Buddymodule', 'stats' => 'Viewing other\'s user page'),                                     '#options' => array('nodes' => 'Comments and replies', 'buddy' => 'Buddymodule', 'stats' => 'Viewing other\'s user page'),
# Line 440  function sna_settings() { Line 451  function sna_settings() {
451                                          '#description' => t('Turning on realtime network generation. It means that the                                          '#description' => t('Turning on realtime network generation. It means that the
452                                                              social network is rebuilt at every page request.                                                              social network is rebuilt at every page request.
453                                                              At large sites it can be extremly slow!.'));                                                              At large sites it can be extremly slow!.'));
454    return $form;    return system_settings_form($form);
455  }  }
456    
457  function sna_cron() {  function sna_cron() {

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.5.4.1

  ViewVC Help
Powered by ViewVC 1.1.2