|
|
|
|
@ -3144,7 +3144,7 @@ class Agenda |
|
|
|
|
$allowCollectiveInvitations = $agendaCollectiveInvitations && 'personal' === $this->type; |
|
|
|
|
$allowEventSubscriptions = 'personal' === $this->type && $agendaEventSubscriptions; |
|
|
|
|
|
|
|
|
|
if ($allowCollectiveInvitations && $allowEventSubscriptions && !$personalEvent->hasInvitation()) { |
|
|
|
|
if ($allowCollectiveInvitations && $allowEventSubscriptions && !$personalEvent) { |
|
|
|
|
$form->addRadio( |
|
|
|
|
'invitation_type', |
|
|
|
|
get_lang('Allow'), |
|
|
|
|
@ -3159,6 +3159,49 @@ class Agenda |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($allowCollectiveInvitations) { |
|
|
|
|
$this->addCollectiveInvitationsFields($form, $personalEvent); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($agendaEventSubscriptions) { |
|
|
|
|
$this->addSubscriptionFields($form, $personalEvent); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (api_get_configuration_value('agenda_reminders')) { |
|
|
|
|
$form->addHtml('<div id="notification_list">'); |
|
|
|
|
|
|
|
|
|
if ($id) { |
|
|
|
|
$this->addFieldsForRemindersToForm($id, $form); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$form->addHtml('</div>'); |
|
|
|
|
$form->addButton('add_notification', get_lang('AddNotification'), 'bell-o')->setType('button'); |
|
|
|
|
$form->addHtml('<hr>'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (api_get_configuration_value('allow_careers_in_global_agenda') && 'admin' === $this->type) { |
|
|
|
|
Career::addCareerFieldsToForm($form); |
|
|
|
|
$form->addHtml('<hr>'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($id) { |
|
|
|
|
$form->addButtonUpdate(get_lang('ModifyEvent')); |
|
|
|
|
} else { |
|
|
|
|
$form->addButtonSave(get_lang('AgendaAdd')); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$form->setDefaults($params); |
|
|
|
|
$form->addRule( |
|
|
|
|
'date_range', |
|
|
|
|
get_lang('ThisFieldIsRequired'), |
|
|
|
|
'required' |
|
|
|
|
); |
|
|
|
|
$form->addRule('title', get_lang('ThisFieldIsRequired'), 'required'); |
|
|
|
|
|
|
|
|
|
return $form; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private function addCollectiveInvitationsFields(FormValidator $form, ?PersonalAgenda $personalEvent) |
|
|
|
|
{ |
|
|
|
|
$invitees = []; |
|
|
|
|
$isCollective = false; |
|
|
|
|
$allowInvitees = true; |
|
|
|
|
@ -3180,7 +3223,7 @@ class Agenda |
|
|
|
|
|
|
|
|
|
if ($allowInvitees) { |
|
|
|
|
$form->addHtml( |
|
|
|
|
'<div id="invitations-block" style="display:'.($allowEventSubscriptions && !$allowInvitees ? 'none;' : 'block;').'">' |
|
|
|
|
'<div id="invitations-block">' |
|
|
|
|
); |
|
|
|
|
$form->addHeader(get_lang('Invitations')); |
|
|
|
|
$form->addSelectAjax( |
|
|
|
|
@ -3196,12 +3239,15 @@ class Agenda |
|
|
|
|
$form->addHtml('<hr>'); |
|
|
|
|
$form->addHtml('</div>'); |
|
|
|
|
|
|
|
|
|
$params['invitees'] = array_keys($invitees); |
|
|
|
|
$params['collective'] = $isCollective; |
|
|
|
|
$form->setDefaults([ |
|
|
|
|
'invitees' => array_keys($invitees), |
|
|
|
|
'collective' => $isCollective |
|
|
|
|
]); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($agendaEventSubscriptions) { |
|
|
|
|
private function addSubscriptionFields(FormValidator $form, ?PersonalAgenda $personalEvent) |
|
|
|
|
{ |
|
|
|
|
$subscribers = []; |
|
|
|
|
$allowSubscribers = true; |
|
|
|
|
|
|
|
|
|
@ -3215,12 +3261,14 @@ class Agenda |
|
|
|
|
array_column($subscribers, 'name') |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$params['subscribers'] = array_keys($subscribers); |
|
|
|
|
$form->setDefaults([ |
|
|
|
|
'subscribers' => array_keys($subscribers), |
|
|
|
|
]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($allowSubscribers) { |
|
|
|
|
$form->addHtml( |
|
|
|
|
'<div id="subscriptions-block" style="display:'.($allowCollectiveInvitations ? 'none;' : 'block;').'">' |
|
|
|
|
'<div id="subscriptions-block">' |
|
|
|
|
); |
|
|
|
|
$form->addHeader(get_lang('Subscriptions')); |
|
|
|
|
$form->addSelect( |
|
|
|
|
@ -3273,7 +3321,9 @@ class Agenda |
|
|
|
|
|
|
|
|
|
/** @var AgendaEventSubscription $subscription */ |
|
|
|
|
$subscription = $personalEvent->getInvitation(); |
|
|
|
|
$params['max_subscriptions'] = $subscription->getMaxAttendees(); |
|
|
|
|
$form->setDefaults([ |
|
|
|
|
'max_subscriptions' => $subscription->getMaxAttendees(), |
|
|
|
|
]); |
|
|
|
|
|
|
|
|
|
$groupId = $personalEvent->getSubscriptionItemId(); |
|
|
|
|
|
|
|
|
|
@ -3289,40 +3339,6 @@ class Agenda |
|
|
|
|
$form->addHtml('</div>'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (api_get_configuration_value('agenda_reminders')) { |
|
|
|
|
$form->addHtml('<div id="notification_list">'); |
|
|
|
|
|
|
|
|
|
if ($id) { |
|
|
|
|
$this->addFieldsForRemindersToForm($id, $form); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$form->addHtml('</div>'); |
|
|
|
|
$form->addButton('add_notification', get_lang('AddNotification'), 'bell-o')->setType('button'); |
|
|
|
|
$form->addHtml('<hr>'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (api_get_configuration_value('allow_careers_in_global_agenda') && 'admin' === $this->type) { |
|
|
|
|
Career::addCareerFieldsToForm($form); |
|
|
|
|
$form->addHtml('<hr>'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($id) { |
|
|
|
|
$form->addButtonUpdate(get_lang('ModifyEvent')); |
|
|
|
|
} else { |
|
|
|
|
$form->addButtonSave(get_lang('AgendaAdd')); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$form->setDefaults($params); |
|
|
|
|
$form->addRule( |
|
|
|
|
'date_range', |
|
|
|
|
get_lang('ThisFieldIsRequired'), |
|
|
|
|
'required' |
|
|
|
|
); |
|
|
|
|
$form->addRule('title', get_lang('ThisFieldIsRequired'), 'required'); |
|
|
|
|
|
|
|
|
|
return $form; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function addFieldsForRemindersToForm(int $eventId, FormValidator $form) |
|
|
|
|
{ |
|
|
|
|
$remindersList = $this->parseEventReminders( |
|
|
|
|
|