function calendar_confirm_cancel_appointment_form
Search API
7.x calendar.module | calendar_confirm_cancel_appointment_form($cid) |
6.x calendar.module | calendar_confirm_cancel_appointment_form($cid) |
Confirm we actually want to cancel this appointment
1 string reference to 'calendar_confirm_cancel_appointment_form'
- calendar_menu in modules/
calendar/ calendar.module - implements hook_menu
File
- modules/
calendar/ calendar.module, line 432
Code
function calendar_confirm_cancel_appointment_form($cid) {
$form = array();
$content = content_load($cid);
fp_add_css(fp_get_module_path("content") . "/css/content.css");
$types = content_get_types();
$type = $content->type;
// Go back to the original content (our default option)
$form ['#redirect'] = array('path' => "content/$cid");
// We want to redirect correctly based on this type's options....
// Are there any special settings for the title?
if (isset($types [$type]['settings'])) {
if (is_array($types [$type]['settings']['#redirect'])) {
$form ['#redirect'] = $types [$type]['settings']['#redirect'];
}
}
$student_name = @fp_get_student_name($content->field__student_id ['value'], TRUE);
$faculty_name = @fp_get_faculty_name($content->field__faculty_id ['value']);
// Make a nice title for this appointment.
$apt_title = t("Meeting between @ft and @st on @dt", array("@ft" => $faculty_name, "@st" => $student_name, "@dt" => $content->field__appointment_datetime ['display_value']));
$form ['cid'] = array(
'type' => 'hidden',
'value' => $cid,
);
$form ['mark_top'] = array(
'type' => 'markup',
'value' => "<h2>" . t("Are you sure you wish to cancel %ap?", array("%ap" => $apt_title)) . "</h2>
<p>" . t("This action will send a notification to both parties that the appointment has been canceled.") . "</p>
<hr>",
);
//If this appointment had meeting data (zoom) then we should include some text here that explains it will be cancelled as well.
if (isset($content->field__video_data) && isset($content->field__video_data ['value']) && $content->field__video_data ['value'] != "") {
$data = json_decode($content->field__video_data ['value']);
$video_provider = $data->video_provider;
if ($video_provider == "zoom" && module_enabled('zoomapi')) {
$id = $data->id;
$form ['video_msg_markup'] = array(
'type' => 'markup',
'value' => t("<strong>Zoom Meeting:</strong> By cancelling this appointment, the scheduled Zoom meeting (ID: $id) will also be cancelled."),
);
}
}
$form ['msg'] = array(
'type' => 'textarea',
'label' => t("Reason"),
'description' => t("Please enter a brief reason for canceling this appointment."),
);
$form ['submit_confirm'] = array(
'type' => 'submit',
'spinner' => TRUE,
'value' => t('Confirm & Cancel Appointment'),
'attributes' => array('class' => 'content-submit-btn'),
'suffix' => " <a href='javascript:history.go(-1);'>" . t("Cancel") . "</a>",
);
return $form;
}