Fixing agenda calendar view.

1.9.x
Julio Montoya 12 years ago
parent e65b539aeb
commit 7f18bf57ad
  1. 15
      main/calendar/agenda.lib.php
  2. 10
      main/calendar/agenda_js.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)
);
}
}

@ -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', '<div id="visible_to_input">');
$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', '</div>');
$form->addElement('html', '<div id="visible_to_read_only" style="display: none">');

Loading…
Cancel
Save