You are here

function course_generate_form_submit in Course 7.2

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

Submit callback for devel_generate support.

File

./course.devel.inc, line 67

Code

function course_generate_form_submit($form, &$form_state) {
  module_load_include('inc', 'devel_generate', 'devel_generate.fields');
  module_load_include('inc', 'devel_generate', 'devel_generate');
  $course_types = array_filter($form_state['values']['course_types']);
  $course_limit = $form_state['values']['course_limit'];
  $course_objects = array_filter($form_state['values']['course_object_types']);
  $course_object_limit = $form_state['values']['course_object_limit'];
  $course_enrollments = $form_state['values']['course_enrollments'];
  for ($i = 1; $i <= $course_limit; $i++) {
    course_generate(array_rand($course_types), $course_objects, $course_object_limit, $course_enrollments);
  }
}