function makemeeting_calendarselector_process in Make Meeting Scheduler 6
makemeeting_calendarselector_process()
1 string reference to 'makemeeting_calendarselector_process'
- makemeeting_elements in ./
makemeeting.module - Implements hook_elements().
File
- ./
makemeeting.module, line 154 - Make Meeting module
Code
function makemeeting_calendarselector_process($element, $form_state) {
// collecting the selected date and options from the posted form
// and put it into the calendar element's 'value' field
$day_options = array();
$days = array();
// using preg_match to indentifing and collecting dynamicly created input fields
foreach ($element['#post'] as $k => $v) {
preg_match("/(day_)(\\d+)/i", $k, $matches_day);
if (!empty($matches_day)) {
$days[] = $v;
$day_options[$v] = array();
}
}
foreach ($element['#post'] as $k => $v) {
preg_match("/(day_option_)(\\d+)(_)(\\d+)/i", $k, $matches_options);
if (!empty($matches_options)) {
$field_name = $element['#post']['day_' . $matches_options[2]];
$day_options[$field_name][] = $v;
}
}
$element['#value'] = $day_options;
// Adding javascript locales and settings
$days = array(
t('Su'),
t('Mon'),
t('Tue'),
t('Wed'),
t('Th'),
t('Fr'),
t('Sat'),
);
$months = array(
t('January'),
t('Febuary'),
t('March'),
t('April'),
t('May'),
t('June'),
t('July'),
t('August'),
t('September'),
t('October'),
t('November'),
t('December'),
);
$element['#attributes']['months'] = $months;
$nav_links = array(
'p' => '«',
'n' => '»',
't' => t('Today'),
'b' => t('Add date to list'),
);
drupal_add_js(array(
'makemeeting' => array(
'days' => $days,
'months' => $months,
'navLinks' => $nav_links,
),
), 'setting');
// adding custon javascript and css
drupal_add_js(drupal_get_path('module', 'makemeeting') . '/jcalendar-source.js');
drupal_add_css(drupal_get_path('module', 'makemeeting') . '/jcalendar.css');
return $element;
}