From 7f18bf57ad12dbf5391d8a8407e18786ad981ea0 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Mon, 14 Apr 2014 16:21:04 +0200 Subject: [PATCH] Fixing agenda calendar view. --- main/calendar/agenda.lib.php | 15 +++++++++++---- main/calendar/agenda_js.php | 10 ++++++---- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/main/calendar/agenda.lib.php b/main/calendar/agenda.lib.php index e0a40750ca..9683ac6ea7 100644 --- a/main/calendar/agenda.lib.php +++ b/main/calendar/agenda.lib.php @@ -1539,6 +1539,7 @@ class Agenda $select->addOptGroup($options, get_lang('Groups')); } + // adding the individual users to the select form if (is_array($userList)) { $options = array(); @@ -1549,9 +1550,11 @@ class Agenda ); $selected = in_array($user['user_id'], $sendToUsers) ? true : false; + if ($selected) { $option['selected'] = 'selected'; } + if ($addOnlyItemsInSendTo) { if ($selected) { $options[] = $option; @@ -1560,6 +1563,7 @@ class Agenda $options[] = $option; } } + $select->addOptGroup($options, get_lang('Users')); } } @@ -1774,11 +1778,16 @@ class Agenda * @param bool $addOnlyItemsInSendTo * @return bool */ - public function showToForm($form, $sendTo = array(), $attributes = array(), $addOnlyItemsInSendTo = false) - { + public function showToForm( + $form, + $sendTo = array(), + $attributes = array(), + $addOnlyItemsInSendTo = false + ) { if ($this->type != 'course') { return false; } + $order = 'lastname'; if (api_is_western_name_order()) { $order = 'firstname'; @@ -2276,6 +2285,4 @@ class Agenda 'groups' => array($groupId) ); } - - } diff --git a/main/calendar/agenda_js.php b/main/calendar/agenda_js.php index fe442e5b82..8a7dbd8824 100644 --- a/main/calendar/agenda_js.php +++ b/main/calendar/agenda_js.php @@ -193,13 +193,15 @@ $course_code = api_get_course_id(); $form = new FormValidator('form', 'get', null, null, array('id' => 'add_event_form')); $form->addElement('html', '
'); + $sendTo = $agenda->parseAgendaFilter($userId); - $showAll = false; - if ($sendTo == 'everyone') { - $showAll = true; + $addOnlyItemsInSendTo = true; + + if ($sendTo['everyone']) { + $addOnlyItemsInSendTo = false; } - $agenda->showToForm($form, $sendTo, array(), $showAll); + $agenda->showToForm($form, $sendTo, array(), $addOnlyItemsInSendTo); $form->addElement('html', '
'); $form->addElement('html', '