-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathos2web_hearings.module
More file actions
110 lines (93 loc) · 3.47 KB
/
os2web_hearings.module
File metadata and controls
110 lines (93 loc) · 3.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?php
/**
* @file
* Code for the OS2web Planer i Høring feature.
*/
include_once 'os2web_hearings.features.inc';
/**
* Implements hook_init().
*/
function os2web_hearings_init(){
drupal_add_library('system', 'ui.datepicker');
}
/*
* Implements hook_menu()
*/
function os2web_hearings_menu(){
$items = array();
// Admin menu
$items['admin/config/os2web_hearings'] = array(
'title' => 'OS2Web Hearings',
'description' => 'General settings ',
'position' => 'right',
'weight' => -10,
'page callback' => 'system_admin_menu_block_page',
'file' => 'system.admin.inc',
'file path' => drupal_get_path('module', 'system'),
'access arguments' => array('administer site configuration'),
);
$items['admin/config/os2web_hearings/settings'] = array(
'title' => 'OS2web Hearings',
'description' => 'Change settings for OS2web Hearings',
'page callback' => 'drupal_get_form',
'page arguments' => array('os2web_hearings_settings_form'),
'access arguments' => array('administer site configuration'),
);
return $items;
}
/*
* Settings form callback
*/
function os2web_hearings_settings_form(){
$form['os2web_hearings_page_info_nid'] = array(
'#title' => t('Node id for info text on hearings page'),
'#default_value' => variable_get('os2web_hearings_page_info_nid'),
'#type' => 'textfield',
);
return system_settings_form($form);
}
/**
* Implements hook_form_alter()
*/
function os2web_hearings_form_views_exposed_form_alter(&$form, &$form_state){
if($form['#id'] === 'views-exposed-form-os2web-hearings-page'){
$form['from_date']['value']['#date_format'] = 'd-m-Y';
$form['to_date']['value']['#date_format'] = 'd-m-Y';
}
// Add a little js to make the calendar icons clickable.
$cal_icon = url(drupal_get_path('theme', variable_get('theme_default', NULL)) . "/images/cal.png");
$datepicker = '
(function ($) {
Drupal.behaviors.os2web_meetings = {
attach: function(context, settings) {
$("#edit-from-date-value-date").datepicker({
showOn: "both",
buttonImage: "' . $cal_icon . '",
buttonImageOnly: true,
dateFormat: "dd-mm-yy"
});
$("#edit-to-date-value-date").datepicker({
showOn: "both",
buttonImage: "' . $cal_icon . '",
buttonImageOnly: true,
dateFormat: "dd-mm-yy"
});
}
}
}(jQuery));';
drupal_add_js($datepicker, array(
'type' => 'inline',
'scope' => 'footer',
'weight' => 5)
);
}
/**
* Implements hook_os2web_help().
*/
function os2web_hearings_os2web_help($sections) {
// Content types.
$sections['contenttype'] = t('<p><b>Hearings (<i>Høring</i>):</b> Create a <a href="@url" target="_blank">Hearing</a> to show about your hearing times and dates.<br />Hearings are shown from the <a href="@planer-i-h-ring" target="_blank">here</a>.</p>', array('@url' => url('admin/help/os2web_borger_dk'), '@planer-i-h-ring' => '/planer-i-h-ring'));
// Importers.
$sections['import'] = t('<p><b>Hearings:</b> Initialize the importer for hearings at <a href="@url">the import page.</a></p>', array('@url' => 'import/os2web_hearings_feeds_import'));
return $sections;
}