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

Diff of /contributions/modules/randomizer/randomizer.module

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

revision 1.5, Tue Mar 6 21:20:21 2007 UTC revision 1.6, Fri Jan 4 20:27:39 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: randomizer.module,v 1.4 2006/11/06 22:01:03 deekayen Exp $  // $Id: randomizer.module,v 1.5 2007/03/06 21:20:21 deekayen Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 21  define('RANDOMIZER_MAX_PER_SET', 500); Line 21  define('RANDOMIZER_MAX_PER_SET', 500);
21   * @return string   * @return string
22   */   */
23  function randomizer_help($section = 'admin/help#randomizer') {  function randomizer_help($section = 'admin/help#randomizer') {
   $output = '';  
   
24    switch ($section) {    switch ($section) {
25      case 'admin/help#randomizer':      case 'admin/help#randomizer':
26        return t('<p>This module is designed to assist researchers and students who want an easy way to perform random sampling or assign participants to experimental conditions.</p>');        return t('<p>This module is designed to assist researchers and students who want an easy way to perform random sampling or assign participants to experimental conditions.</p>');
# Line 85  function randomizer_perm() { Line 83  function randomizer_perm() {
83   *   *
84   * @return array   * @return array
85   */   */
86  function randomizer_menu($may_cache) {  function randomizer_menu() {
87    $items = array();    $items = array();
88    if ($may_cache) {    $items['randomizer'] = array(
89      $items[] = array('path' => 'randomizer',      'title' => 'Randomizer',
90        'title' => t('randomizer'),      'page callback' => 'drupal_get_form',
91        'callback' => 'randomizer_page',      'page arguments' => array('randomizer_page'),
92        'callback_arguments' => array($_POST),      'access callback' => 'user_access',
93        'access' => user_access('access randomizer'),      'access arguments' => array('access randomizer'),
94        'type' => MENU_SUGGESTED_ITEM);      'type' => MENU_SUGGESTED_ITEM
95      $items[] = array(    );
96        'path' => 'admin/settings/randomizer',    $items['admin/settings/randomizer'] = array(
97        'title' => t('Randomizer'),      'title' => 'Randomizer',
98        'description' => t('Set bounds for list generation.'),      'description' => 'Set bounds for list generation.',
99        'callback' => 'drupal_get_form',      'page callback' => 'drupal_get_form',
100        'callback arguments' => 'randomizer_admin_settings',      'page arguments' => array('randomizer_admin_settings'),
101        'access' => user_access('administer site configuration'),      'access callback' => 'user_access',
102        'type' => MENU_NORMAL_ITEM      'access arguments' => array('administer site configuration'),
103      );      'type' => MENU_NORMAL_ITEM
104    }    );
105    return $items;    return $items;
106  }  }
107    
# Line 117  function randomizer_menu($may_cache) { Line 115  function randomizer_menu($may_cache) {
115   */   */
116  function randomizer_page() {  function randomizer_page() {
117    $form = array();    $form = array();
118      $error = false;
119    
120    if(isset($_POST['op'])) {    if (isset($_POST['op'])) {
121      if (!is_numeric($_POST['randomizer_sets'])) {      if (!is_numeric($_POST['randomizer_sets'])) {
122        $error = true;        $error = true;
123        form_set_error('randomizer_sets', t('The entered sets of numbers must be numeric.'));        form_set_error('randomizer_sets', t('The entered sets of numbers must be numeric.'));
# Line 167  function randomizer_page() { Line 166  function randomizer_page() {
166          unset($tmp);          unset($tmp);
167        }        }
168    
       $form = array();  
   
169        $_POST['randomizer_range_from'] = (int)$_POST['randomizer_range_from'];        $_POST['randomizer_range_from'] = (int)$_POST['randomizer_range_from'];
170        $_POST['randomizer_range_to']   = (int)$_POST['randomizer_range_to'];        $_POST['randomizer_range_to']   = (int)$_POST['randomizer_range_to'];
171    
# Line 199  function randomizer_page() { Line 196  function randomizer_page() {
196      }      }
197    }    }
198    
199    return drupal_get_form('randomizer_form', $form);    return array_merge($form, randomizer_form());
200  }  }
201    
202  /**  /**

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

  ViewVC Help
Powered by ViewVC 1.1.2