date_tools.module 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. /**
  3. * @file
  4. * @todo.
  5. */
  6. /**
  7. * Implements hook_help().
  8. */
  9. function date_tools_help($section, $arg) {
  10. switch ($section) {
  11. case 'admin/config/date/tools':
  12. return '<p>' . t('<h2>Tools for Dates and Calendars</h2>') . '</p>';
  13. case 'admin/config/date/tools/change':
  14. return '<p>' . t('Change a date field from one type to another. Very experimental, use at your own risk!') . '</p>';
  15. case 'admin/config/date/tools/date_wizard':
  16. $output = t("Fill out the following form to auto-create a date content type, with a datetime field and matching pre-configured calendar. If the calendar module is enabled and the option to create a calendar is chosen, a calendar and upcoming events block will be created, an ical feed will be added to the calendar. Nodes created from this new content type will include a link to the calendar, and the calendar will have a link to the 'add new date' form. You can also add new date fields to an existing content type by entering the existing content type name instead of creating a new one.") .
  17. '</p><p>' .
  18. t('Only a limited set of options are displayed here to make this easy to set up. Once the date has been created you will be able to make other changes to the date settings and add other fields to your new content type on the Manage fields screen. You can also make changes to the calendar on the Views edit page.') .
  19. '</p>';
  20. return $output;
  21. }
  22. }
  23. /**
  24. * Implements hook_permission().
  25. */
  26. function date_tools_permission() {
  27. return array(
  28. 'administer date tools' => array(
  29. 'title' => t('Administer date tools'),
  30. ),
  31. );
  32. }
  33. /**
  34. * Implements hook_menu().
  35. */
  36. function date_tools_menu() {
  37. $items = array();
  38. $items['admin/config/date/tools'] = array(
  39. 'title' => 'Date Tools',
  40. 'description' => 'Date Wizard and other tools to manage and create dates and calendars. ',
  41. 'access arguments' => array('administer date tools'),
  42. 'page callback' => 'date_tools_page',
  43. );
  44. $items['admin/config/date/tools/about'] = array(
  45. 'title' => 'About',
  46. 'description' => 'Date Wizard and other tools to manage and create dates and calendars. ',
  47. 'type' => MENU_DEFAULT_LOCAL_TASK,
  48. 'weight' => -5,
  49. 'page callback' => 'date_tools_page',
  50. 'access arguments' => array('administer date tools'),
  51. );
  52. $items['admin/config/date/tools/date_wizard'] = array(
  53. 'title' => 'Date wizard',
  54. 'description' => 'Easy creation of date content types and calendars. ',
  55. 'type' => MENU_LOCAL_TASK,
  56. 'weight' => 1,
  57. 'page callback' => 'drupal_get_form',
  58. 'page arguments' => array('date_tools_wizard_form'),
  59. 'access arguments' => array('administer date tools'),
  60. 'file' => 'date_tools.wizard.inc',
  61. );
  62. /**
  63. $items['admin/config/date/tools/change'] = array(
  64. 'title' => 'Change type',
  65. 'access arguments' => array('administer date tools'),
  66. 'page callback' => 'drupal_get_form',
  67. 'page arguments' => array('date_tools_change_type_form'),
  68. 'type' => MENU_LOCAL_TASK,
  69. 'weight' => 3,
  70. 'file' => 'date_tools.change_type.inc',
  71. );
  72. */
  73. return $items;
  74. }
  75. /**
  76. * Main Date Tools page
  77. */
  78. function date_tools_page() {
  79. $content = '';
  80. $content .= t('Dates and calendars can be complicated to set up. The !date_wizard makes it easy to create a simple date content type and related calendar. ', array('!date_wizard' => l(t('Date wizard'), 'admin/config/date/tools/date_wizard')));
  81. return $content;
  82. }