You are here

function course_generate_form in Course 7.2

Same name and namespace in other branches
  1. 8.3 course.devel.inc \course_generate_form()
  2. 8.2 course.devel.inc \course_generate_form()
  3. 7 course.devel.inc \course_generate_form()
  4. 3.x course.devel.inc \course_generate_form()

Form callback for devel_generate support.

1 string reference to 'course_generate_form'
course_menu in ./course.module
Implements hook_menu().

File

./course.devel.inc, line 6

Code

function course_generate_form($form, $form_state) {
  $form['course_types'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Course types'),
    '#options' => drupal_map_assoc(course_get_types()),
    '#required' => TRUE,
  );
  $question_options = array();
  foreach (course_get_handlers('object') as $module => $objects) {
    foreach ($objects as $objname => $object) {
      $course_objects["{$module}-{$objname}"] = $object['name'];
    }
  }
  $form['course_object_types'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Object types'),
    '#options' => $course_objects,
    '#required' => TRUE,
  );
  $form['course_limit'] = array(
    '#type' => 'textfield',
    '#title' => t('Number of courses to generate'),
    '#default_value' => 50,
    '#size' => 10,
    '#required' => TRUE,
    '#description' => t('Course authors will be randomly assigned.'),
  );
  $form['course_object_limit'] = array(
    '#type' => 'textfield',
    '#title' => t('Number of objects per course'),
    '#default_value' => 10,
    '#size' => 10,
    '#required' => TRUE,
    '#description' => t('Course authors will be randomly assigned.'),
  );
  $form['course_enrollments'] = array(
    '#type' => 'textfield',
    '#title' => t('Number of enrollments per course'),
    '#default_value' => 50,
    '#size' => 10,
    '#required' => TRUE,
    '#description' => t('Enrollments will be randomly assigned to users already in the system.'),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Generate'),
  );
  return $form;
}