Projet

Général

Profil

Paste
Télécharger (3,43 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / date / date_tools / date_tools.module @ 599a39cd

1
<?php
2

    
3
/**
4
 * @file
5
 * Primary hook implementations for the Date Tools module
6
 */
7

    
8
/**
9
 * Implements hook_help().
10
 */
11
function date_tools_help($section, $arg) {
12
  switch ($section) {
13
    case 'admin/config/date/tools':
14
      return '<p>' . t('<h2>Tools for Dates and Calendars</h2>') . '</p>';
15

    
16
    case 'admin/config/date/tools/change':
17
      return '<p>' . t('Change a date field from one type to another. Very experimental, use at your own risk!') . '</p>';
18

    
19
    case 'admin/config/date/tools/date_wizard':
20
      $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.");
21
      $output .= '</p><p>';
22
      $output .= 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.');
23
      $output .= '</p>';
24
      return $output;
25
  }
26
}
27

    
28
/**
29
 * Implements hook_permission().
30
 */
31
function date_tools_permission() {
32
  return array(
33
    'administer date tools' => array(
34
      'title' => t('Administer date tools'),
35
    ),
36
  );
37
}
38

    
39
/**
40
 * Implements hook_menu().
41
 */
42
function date_tools_menu() {
43
  $items = array();
44
  $items['admin/config/date/tools'] = array(
45
    'title' => 'Date Tools',
46
    'description' => 'Date Wizard and other tools to manage and create dates and calendars. ',
47
    'access arguments' => array('administer date tools'),
48
    'page callback' => 'date_tools_page',
49
  );
50
  $items['admin/config/date/tools/about'] = array(
51
    'title' => 'About',
52
    'description' => 'Date Wizard and other tools to manage and create dates and calendars. ',
53
    'type' => MENU_DEFAULT_LOCAL_TASK,
54
    'weight' => -5,
55
    'page callback' => 'date_tools_page',
56
    'access arguments' => array('administer date tools'),
57
  );
58
  $items['admin/config/date/tools/date_wizard'] = array(
59
    'title' => 'Date wizard',
60
    'description' => 'Easy creation of date content types and calendars. ',
61
    'type' => MENU_LOCAL_TASK,
62
    'weight' => 1,
63
    'page callback' => 'drupal_get_form',
64
    'page arguments' => array('date_tools_wizard_form'),
65
    'access arguments' => array('administer date tools'),
66
    'file' => 'date_tools.wizard.inc',
67
  );
68

    
69
  // $items['admin/config/date/tools/change'] = array(
70
  //   'title' => 'Change type',
71
  //   'access arguments' => array('administer date tools'),
72
  //   'page callback' => 'drupal_get_form',
73
  //   'page arguments' => array('date_tools_change_type_form'),
74
  //   'type' => MENU_LOCAL_TASK,
75
  //   'weight' => 3,
76
  //   'file' => 'date_tools.change_type.inc',
77
  // );
78

    
79
  return $items;
80
}
81

    
82
/**
83
 * Main Date Tools page.
84
 */
85
function date_tools_page() {
86
  return 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')));
87
}