Clean code
This commit is contained in:
parent
27df3cc02c
commit
b84fd3ec3d
@ -164,6 +164,9 @@ $urlvcal .= $urlwithroot.'/public/agenda/agendaexport.php?format=vcal'.$getentit
|
||||
$message .= img_picto('', 'globe').' '.str_replace('{url}', $urlvcal, '<span class="opacitymedium">'.$langs->trans("WebCalUrlForVCalExport", 'vcal', '').'</span>');
|
||||
$message .= '<div class="urllink">';
|
||||
$message .= '<input type="text" id="onlinepaymenturl1" class="quatrevingtpercent" value="'.$urlwithroot.'/public/agenda/agendaexport.php?format=vcal'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'">';
|
||||
if (!empty($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY)) {
|
||||
$message .= ' <a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=vcal'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'">'.img_picto('', 'download').'</a>';
|
||||
}
|
||||
$message .= '</div>';
|
||||
$message .= ajax_autoselect('onlinepaymenturl1');
|
||||
$message .= '<br>';
|
||||
@ -173,6 +176,9 @@ $urlical .= $urlwithroot.'/public/agenda/agendaexport.php?format=ical&type=event
|
||||
$message .= img_picto('', 'globe').' '.str_replace('{url}', $urlical, '<span class="opacitymedium">'.$langs->trans("WebCalUrlForVCalExport", 'ical/ics', '').'</span>');
|
||||
$message .= '<div class="urllink">';
|
||||
$message .= '<input type="text" id="onlinepaymenturl2" class="quatrevingtpercent" value="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'">';
|
||||
if (!empty($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY)) {
|
||||
$message .= ' <a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'">'.img_picto('', 'download').'</a>';
|
||||
}
|
||||
$message .= '</div>';
|
||||
$message .= ajax_autoselect('onlinepaymenturl2');
|
||||
$message .= '<br>';
|
||||
@ -182,6 +188,9 @@ $urlrss .= $urlwithroot.'/public/agenda/agendaexport.php?format=rss'.$getentity.
|
||||
$message .= img_picto('', 'globe').' '.str_replace('{url}', $urlrss, '<span class="opacitymedium">'.$langs->trans("WebCalUrlForVCalExport", 'rss', '').'</span>');
|
||||
$message .= '<div class="urllink">';
|
||||
$message .= '<input type="text" id="onlinepaymenturl3" class="quatrevingtpercent" value="'.$urlwithroot.'/public/agenda/agendaexport.php?format=rss'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'">';
|
||||
if (!empty($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY)) {
|
||||
$message .= ' <a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=rss'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'">'.img_picto('', 'download').'</a>';
|
||||
}
|
||||
$message .= '</div>';
|
||||
$message .= ajax_autoselect('onlinepaymenturl3');
|
||||
$message .= '<br>';
|
||||
|
||||
@ -1952,14 +1952,14 @@ class ActionComm extends CommonObject
|
||||
$event = array();
|
||||
$event['uid'] = 'dolibarragenda-'.$this->db->database_name.'-'.$obj->id."@".$_SERVER["SERVER_NAME"];
|
||||
$event['type'] = $type;
|
||||
|
||||
$datestart = $this->db->jdate($obj->datep) - (empty($conf->global->AGENDA_EXPORT_FIX_TZ) ? 0 : ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600));
|
||||
|
||||
// fix for -> Warning: A non-numeric value encountered
|
||||
if (is_numeric($this->db->jdate($obj->datep2))) {
|
||||
$dateend = $this->db->jdate($obj->datep2)
|
||||
- (empty($conf->global->AGENDA_EXPORT_FIX_TZ) ? 0 : ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600));
|
||||
$dateend = $this->db->jdate($obj->datep2) - (empty($conf->global->AGENDA_EXPORT_FIX_TZ) ? 0 : ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600));
|
||||
} else {
|
||||
// use start date as fall-back to avoid import erros on empty end date
|
||||
// use start date as fall-back to avoid pb with empty end date on ICS readers
|
||||
$dateend = $datestart;
|
||||
}
|
||||
|
||||
|
||||
@ -100,6 +100,7 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile)
|
||||
$created = $event["created"];
|
||||
$modified = $event["modified"];
|
||||
$assignedUsers = $event["assignedUsers"];
|
||||
//print $fulldayevent.' '.dol_print_date($startdate, 'dayhour', 'gmt');
|
||||
|
||||
// Format
|
||||
$summary = format_cal($format, $summary);
|
||||
@ -191,16 +192,16 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile)
|
||||
|
||||
// Date must be GMT dates
|
||||
// Current date
|
||||
fwrite($calfileh, "DTSTAMP:".dol_print_date($now, "dayhourxcard", true)."\n");
|
||||
fwrite($calfileh, "DTSTAMP:".dol_print_date($now, "dayhourxcard", 'gmt')."\n");
|
||||
|
||||
// Start date
|
||||
$prefix = "";
|
||||
$startdatef = dol_print_date($startdate, "dayhourxcard", true);
|
||||
$startdatef = dol_print_date($startdate, "dayhourxcard", 'gmt');
|
||||
|
||||
if ($fulldayevent) {
|
||||
// Local time
|
||||
$prefix = ";VALUE=DATE";
|
||||
$startdatef = dol_print_date($startdate, "dayxcard", false);
|
||||
$startdatef = dol_print_date($startdate, "dayxcard", 'gmt');
|
||||
}
|
||||
|
||||
fwrite($calfileh, "DTSTART".$prefix.":".$startdatef."\n");
|
||||
@ -208,7 +209,7 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile)
|
||||
// End date
|
||||
if ($fulldayevent) {
|
||||
if (empty($enddate)) {
|
||||
$enddate = dol_time_plus_duree($startdate, 1, "d");
|
||||
$enddate = dol_time_plus_duree($startdate, 1, "d"); // We add 1 day needed for full day event (DTEND must be next day after event)
|
||||
}
|
||||
} else {
|
||||
if (empty($enddate)) {
|
||||
@ -217,14 +218,11 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile)
|
||||
}
|
||||
|
||||
$prefix = "";
|
||||
$enddatef = dol_print_date($enddate, "dayhourxcard", true);
|
||||
$enddatef = dol_print_date($enddate, "dayhourxcard", 'gmt');
|
||||
|
||||
if ($fulldayevent) {
|
||||
$prefix = ";VALUE=DATE";
|
||||
$enddatef = dol_print_date($enddate + 1, "dayxcard", false);
|
||||
|
||||
// Local time
|
||||
//$enddatef .= dol_print_date($enddate+1,"dayhourxcard",false);
|
||||
$enddatef = dol_print_date($enddate + 1, "dayxcard", 'gmt'); // We add 1 second so we reach the +1 day needed for full day event (DTEND must be next day after event)
|
||||
}
|
||||
|
||||
fwrite($calfileh, "DTEND".$prefix.":".$enddatef."\n");
|
||||
@ -256,11 +254,11 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile)
|
||||
}
|
||||
|
||||
if ($created) {
|
||||
fwrite($calfileh, "CREATED:".dol_print_date($created, "dayhourxcard", true)."\n");
|
||||
fwrite($calfileh, "CREATED:".dol_print_date($created, "dayhourxcard", 'gmt')."\n");
|
||||
}
|
||||
|
||||
if ($modified) {
|
||||
fwrite($calfileh, "LAST-MODIFIED:".dol_print_date($modified, "dayhourxcard", true)."\n");
|
||||
fwrite($calfileh, "LAST-MODIFIED:".dol_print_date($modified, "dayhourxcard", 'gmt')."\n");
|
||||
}
|
||||
|
||||
fwrite($calfileh, "SUMMARY:".$encoding.$summary."\n");
|
||||
@ -270,7 +268,7 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile)
|
||||
fwrite($calfileh, "LOCATION:".$location."\n");
|
||||
fwrite($calfileh, "TRANSP:OPAQUE\n");
|
||||
fwrite($calfileh, "CLASS:CONFIDENTIAL\n");
|
||||
fwrite($calfileh, "DTSTAMP:".dol_print_date($startdatef, "dayhourxcard", true)."\n");
|
||||
fwrite($calfileh, "DTSTAMP:".dol_print_date($startdatef, "dayhourxcard", 'gmt')."\n");
|
||||
|
||||
fwrite($calfileh, "END:VJOURNAL\n");
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user