function availability_calendars_page in Availability Calendars 5
Same name and namespace in other branches
- 6 availability_calendars.module \availability_calendars_page()
Availability calendars page
1 string reference to 'availability_calendars_page'
- availability_calendars_menu in ./
availability_calendars.module - Implementation of hook_menu()
File
- ./
availability_calendars.module, line 91 - Availability Calendars Module
Code
function availability_calendars_page($nid = NULL, $year = NULL, $month = NULL, $edit = FALSE) {
if (is_numeric($nid)) {
$node = node_load($nid);
drupal_set_title(t('Availability for %name', array(
'%name' => $node->title,
)));
if (is_numeric($year) && is_numeric($month)) {
drupal_set_title(t('Availability for %name in %date', array(
'%name' => $node->title,
'%date' => format_date(strtotime("{$year}-{$month}-01 12:00"), 'custom', 'M Y'),
)));
if ($edit == 'edit') {
// Display the edit form for the availability calendar on the node
return availability_calendars_node_edit($node, $year, $month);
}
else {
// Display availability calendar for single month
$monthstodisplay = 1;
return theme('availability_calendars_node', $node, $year, $month, $monthstodisplay);
}
}
elseif (is_numeric($year)) {
// Display availability calendar for a whole year
$month = 1;
$monthstodisplay = 12;
return theme('availability_calendars_node', $node, $year, $month, $monthstodisplay);
}
else {
// Display rolling availability calendar from this point onwards
$year = date('Y');
$month = date('m');
$monthstodisplay = variable_get('availability_display_monthcount', 12);
return theme('availability_calendars_node', $node, $year, $month, $monthstodisplay);
}
}
else {
print drupal_not_found();
}
}