project_issue_generate.module

Tracking 5.x-2.x branch
  1. drupal
    1. 5 contributions/project_issue/generate/project_issue_generate.module

Functions & methods

NameDescription
project_issue_generate_issues_form
project_issue_generate_issues_form_submit
project_issue_generate_menuImplementation of hook_menu().

File

View source
  1. <?php
  2. /**
  3. * Implementation of hook_menu().
  4. */
  5. function project_issue_generate_menu($may_cache) {
  6. $items = array();
  7. if ($may_cache) {
  8. $items[] = array(
  9. 'path' => 'admin/project/generate_issue',
  10. 'title' => t('Generate issues'),
  11. 'description' => t('Generate random issues and issue comments.'),
  12. 'callback' => 'drupal_get_form',
  13. 'callback arguments' => array('project_issue_generate_issues_form'),
  14. 'access' => user_access('administer nodes'),
  15. );
  16. }
  17. return $items;
  18. }
  19. function project_issue_generate_issues_form() {
  20. $form['issues'] = array(
  21. '#type' => 'textfield',
  22. '#title' => t('How many issues would you like to generate?'),
  23. '#default_value' => 100,
  24. '#size' => 4,
  25. );
  26. $form['comments'] = array(
  27. '#type' => 'textfield',
  28. '#title' => t('How many issue comments would you like to generate?'),
  29. '#default_value' => 200,
  30. '#size' => 4,
  31. );
  32. $form['submit'] = array(
  33. '#type' => 'submit',
  34. '#value' => t('Do it!'),
  35. );
  36. return $form;
  37. }
  38. function project_issue_generate_issues_form_submit($form_id, $form_values) {
  39. $path = drupal_get_path('module', 'project_issue_generate');
  40. require_once($path .'/project_issue_generate.inc');
  41. project_issue_generate_issues($form_values['issues']);
  42. project_issue_generate_issue_comments($form_values['comments']);
  43. }