Adding Send announcement feature in calendar/agenda.php -refs #6926

1.9.x
unknown 11 years ago
parent 27ef038ee7
commit e911a158fb
  1. 8
      main/calendar/agenda.inc.php
  2. 5
      main/calendar/agenda.php

@ -2738,6 +2738,12 @@ function show_add_form($id = '', $type = null)
echo $return;
//echo '<textarea class="span5" rows="4" name="content">'.$content.'</textarea>';
echo '</div>
<label class="control-label">
'.get_lang('AddAnnouncement').'&nbsp('.get_lang('SendMail').')
</label>
<div class = "controls">
<input id="add_announcement" type="checkbox" name="add_announcement" checked="checked"/>
</div>
</div>';
if ($agendaObj->type == 'course') {
@ -4093,7 +4099,7 @@ function show_add_form($id = '', $type = null)
$result = Database::query($sql);
$last_id = Database::insert_id();
// add a attachment file in agenda
add_agenda_attachment_file($file_comment, $last_id);

@ -61,6 +61,7 @@ if (!empty($addresources)) {
'content' => Security::remove_XSS(stripslashes($_POST['content'])),
'id' => Security::remove_XSS($_POST['id']),
'action' => Security::remove_XSS($_POST['action']),
'add_announcement' => Security::remove_XSS($_POST['add_announcement']),
'to' => Security::remove_XSS($_POST['selectedform'])
);
$_SESSION['formelements'] = $form_elements;
@ -243,6 +244,10 @@ if (api_is_allowed_to_edit(false, true) OR
$end = mktime(23, 59, 59, $end_m, $end_d, $end_y);
$res = agenda_add_repeat_item($course_info, $id, $_POST['repeat_type'], $end, $_POST['selected_form'], $safe_file_comment);
}
if (isset($_POST['add_announcement'])) {
$ann_id = store_agenda_item_as_announcement($id);
AnnouncementManager::send_email($ann_id);
}
Display::display_confirmation_message(get_lang('AddSuccess'));
} else {
show_add_form();

Loading…
Cancel
Save