NEW Add link to export ICS file of an event.
This commit is contained in:
parent
de210ce277
commit
e846721dc9
4 changed files with 41 additions and 6 deletions
|
|
@ -2051,6 +2051,7 @@ class ActionComm extends CommonObject
|
|||
}
|
||||
$sql .= " WHERE a.fk_action=c.id";
|
||||
$sql .= " AND a.entity IN (".getEntity('agenda').")";
|
||||
|
||||
foreach ($filters as $key => $value) {
|
||||
if ($key == 'notolderthan' && $value != '') {
|
||||
$sql .= " AND a.datep >= '".$this->db->idate($now - ($value * 24 * 60 * 60))."'";
|
||||
|
|
@ -2111,6 +2112,9 @@ class ActionComm extends CommonObject
|
|||
}
|
||||
}
|
||||
if ($key == 'module') {
|
||||
if ($value == 'conforbooth@eventorganization') {
|
||||
$value = '@eventorganization';
|
||||
}
|
||||
$sql .= " AND c.module LIKE '%".$this->db->escape($value)."'";
|
||||
}
|
||||
if ($key == 'status') {
|
||||
|
|
|
|||
|
|
@ -483,7 +483,7 @@ if ($projectid > 0) {
|
|||
print $form->editfieldval($form->textwithpicto($langs->trans('MaxNbOfAttendees'), ''), 'max_attendees', $project->max_attendees, $project, $permissiontoadd, 'integer:3', '', 0, 0, '', 0, '', 'projectid');
|
||||
print "</td></tr>";
|
||||
|
||||
print '<tr><td class="titlefield valignmiddle">'.$langs->trans("EventOrganizationICSLink").'</td><td class="valuefield">';
|
||||
print '<tr><td class="titlefield valignmiddle">'.$langs->trans("EventOrganizationICSLinkProject").'</td><td class="valuefield">';
|
||||
// Define $urlwithroot
|
||||
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
|
||||
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
|
||||
|
|
@ -491,7 +491,26 @@ if ($projectid > 0) {
|
|||
// Show message
|
||||
$message = '<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical'.($conf->entity > 1 ? "&entity=".$conf->entity : "");
|
||||
$message .= '&exportkey='.urlencode(getDolGlobalString('MAIN_AGENDA_XCAL_EXPORTKEY', '...'));
|
||||
$message .= "&project=".$projectid.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').img_picto('', 'download', 'class="paddingleft"').'</a>';
|
||||
$message .= "&project=".$projectid.'&module='.urlencode('project@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').img_picto('', 'download', 'class="paddingleft"').'</a>';
|
||||
print $message;
|
||||
print "</td></tr>";
|
||||
|
||||
|
||||
print '<tr><td class="titlefield valignmiddle">'.$langs->trans("EventOrganizationICSLink");
|
||||
// TODO Add nb of events
|
||||
$nbofconfbooth = 0;
|
||||
if ($nbofconfbooth > 0) {
|
||||
print '<span class="opacitymedium">('.$nbofconfbooth.')</span>';
|
||||
}
|
||||
print '</td><td class="valuefield">';
|
||||
// Define $urlwithroot
|
||||
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
|
||||
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
|
||||
|
||||
// Show message
|
||||
$message = '<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical'.($conf->entity > 1 ? "&entity=".$conf->entity : "");
|
||||
$message .= '&exportkey='.urlencode(getDolGlobalString('MAIN_AGENDA_XCAL_EXPORTKEY', '...'));
|
||||
$message .= "&project=".$projectid.'&module='.urlencode('conforbooth@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').img_picto('', 'download', 'class="paddingleft"').'</a>';
|
||||
print $message;
|
||||
print "</td></tr>";
|
||||
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ PriceOfRegistration=Price of registration
|
|||
PriceOfRegistrationHelp=Price to pay to register or participate in the event
|
||||
PriceOfBooth=Subscription price to stand a booth
|
||||
PriceOfBoothHelp=Subscription price to stand a booth
|
||||
EventOrganizationICSLinkProject=Link ICS for the event
|
||||
EventOrganizationICSLink=Link ICS for conferences
|
||||
ConferenceOrBoothInformation=Conference Or Booth information
|
||||
Attendees=Attendees
|
||||
|
|
|
|||
|
|
@ -211,6 +211,7 @@ foreach ($filters as $key => $value) {
|
|||
}
|
||||
if ($key == 'project') {
|
||||
$filename .= '-project'.$value;
|
||||
$shortfilename .= '-project'.$value;
|
||||
}
|
||||
if ($key == 'logina') {
|
||||
$filename .= '-logina'.$value; // Author
|
||||
|
|
@ -226,6 +227,11 @@ foreach ($filters as $key => $value) {
|
|||
}
|
||||
if ($key == 'module') {
|
||||
$filename .= '-module'.$value;
|
||||
if ($value == 'project@eventorganization') {
|
||||
$shortfilename .= '-project';
|
||||
} elseif ($value == 'conforbooth@eventorganization') {
|
||||
$shortfilename .= '-conforbooth';
|
||||
}
|
||||
}
|
||||
if ($key == 'status') {
|
||||
$filename .= '-status'.$value;
|
||||
|
|
@ -266,16 +272,21 @@ $exportholidays = GETPOST('includeholidays', 'int');
|
|||
|
||||
// Build file
|
||||
if ($format == 'ical' || $format == 'vcal') {
|
||||
// For export of conforbooth, we disable the filter 'notolderthan'
|
||||
if (!empty($filters['project']) && !empty($filters['module']) && ($filters['module'] == 'project@eventorganization' || $filters['module'] == 'conforbooth@eventorganization')) {
|
||||
$filters['notolderthan'] = null;
|
||||
}
|
||||
|
||||
$result = $agenda->build_exportfile($format, $type, $cachedelay, $filename, $filters, $exportholidays);
|
||||
if ($result >= 0) {
|
||||
$attachment = true;
|
||||
if (isset($_GET["attachment"])) {
|
||||
$attachment = $_GET["attachment"];
|
||||
if (GETPOSTISSET("attachment")) {
|
||||
$attachment = GETPOST("attachment");
|
||||
}
|
||||
//$attachment = false;
|
||||
$contenttype = 'text/calendar';
|
||||
if (isset($_GET["contenttype"])) {
|
||||
$contenttype = $_GET["contenttype"];
|
||||
if (GETPOSTISSET("contenttype")) {
|
||||
$contenttype = GETPOST("contenttype");
|
||||
}
|
||||
//$contenttype='text/plain';
|
||||
$outputencoding = 'UTF-8';
|
||||
|
|
|
|||
Loading…
Reference in a new issue