forked from extern/egroupware
* Calendar: automatic load new holidays, if there are no irregular ones for a given year, plus new Germany holidays for 2016
This commit is contained in:
parent
32732c00b2
commit
7742f9316b
@ -256,3 +256,26 @@ DE 1. Advent 29 11 2015 0 0
|
||||
DE 2. Advent 6 12 2015 0 0
|
||||
DE 3. Advent 13 12 2015 0 0
|
||||
DE 4. Advent 20 12 2015 0 0
|
||||
|
||||
Quellen:
|
||||
http://de.wikipedia.org/wiki/Feiertage_in_Deutschland#Bewegliche_Feiertage
|
||||
http://de.wikipedia.org/wiki/Karneval,_Fastnacht_und_Fasching#Termin.C3.BCbersicht
|
||||
http://de.wikipedia.org/wiki/Advent#Datum_des_ersten_Adventssonntags_in_der_Lateinischen_Kirche
|
||||
|
||||
2016:
|
||||
DE Rosenmontag 8 2 2016 0 0
|
||||
DE Fastnacht 9 2 2016 0 0
|
||||
DE Aschermittwoch 10 2 2016 0 0
|
||||
DE Gründonnerstag 24 3 2016 0 0
|
||||
DE Karfreitag 25 3 2016 0 0
|
||||
DE Ostersonntag 27 3 2016 0 0
|
||||
DE Ostermontag 28 3 2016 0 0
|
||||
DE Christi Himmelfahrt 5 5 2016 0 0
|
||||
DE Pfingstsonntag 15 5 2016 0 0
|
||||
DE Pfingstmontag 16 5 2016 0 0
|
||||
DE Fronleichnam 26 6 2016 0 0
|
||||
DE Buß- und Bettag 16 11 2016 0 0
|
||||
DE 1. Advent 27 11 2016 0 0
|
||||
DE 2. Advent 4 12 2016 0 0
|
||||
DE 3. Advent 11 12 2016 0 0
|
||||
DE 4. Advent 18 12 2016 0 0
|
||||
|
|
@ -245,15 +245,21 @@
|
||||
{
|
||||
foreach($this->locales as $local)
|
||||
{
|
||||
$this->auto_load_holidays($local);
|
||||
$this->auto_load_holidays($local, $year);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function auto_load_holidays($locale)
|
||||
function auto_load_holidays($locale, $year=0)
|
||||
{
|
||||
if($this->so->holiday_total($locale) == 0)
|
||||
//error_log(__METHOD__."('$locale', $year)");
|
||||
if (!egw_cache::getInstance(__CLASS__, $locale.'-'.$year) && // check if autoload has been tried for this locale and year
|
||||
(!($total_year = $this->so->holiday_total($locale, '', $year)) ||
|
||||
// automatic try load new holidays, if there are no irregular ones for queried year
|
||||
$total_year == $this->so->holiday_total($locale, '', 1901)))
|
||||
{
|
||||
//error_log(__METHOD__."('$locale', $year) attemption autoload ...");
|
||||
egw_cache::setInstance(__CLASS__, $locale.'-'.$year, true, 86400); // do NOT try again for 1 day
|
||||
@set_time_limit(0);
|
||||
|
||||
/* get the file that contains the calendar events for your locale */
|
||||
@ -265,19 +271,9 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
$pos = strpos(' '.$GLOBALS['egw_info']['server']['webserver_url'],$_SERVER['HTTP_HOST']);
|
||||
if($pos == 0)
|
||||
if ($GLOBALS['egw_info']['server']['webserver_url'][0] == '/')
|
||||
{
|
||||
switch($_SERVER['SERVER_PORT'])
|
||||
{
|
||||
case 80:
|
||||
$http_protocol = 'http://';
|
||||
break;
|
||||
case 443:
|
||||
$http_protocol = 'https://';
|
||||
break;
|
||||
}
|
||||
$server_host = $http_protocol.$_SERVER['HTTP_HOST'].$GLOBALS['egw_info']['server']['webserver_url'];
|
||||
$server_host = ($_SERVER['HTTPS']?'https://':'http://').$_SERVER['HTTP_HOST'].$GLOBALS['egw_info']['server']['webserver_url'];
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -299,18 +295,17 @@
|
||||
return false;
|
||||
}
|
||||
// reading the holidayfile from egroupware.org via network::gethttpsocketfile contains all the headers!
|
||||
foreach($lines as $n => $line)
|
||||
foreach($lines as $line)
|
||||
{
|
||||
$fields = preg_split("/[\t\n ]+/",$line);
|
||||
|
||||
if ($fields[0] == 'charset' && $fields[1])
|
||||
{
|
||||
$lines = $GLOBALS['egw']->translation->convert($lines,$fields[1]);
|
||||
$lines = translation::convert($lines,$fields[1]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
$c_lines = count($lines);
|
||||
foreach ($lines as $i => $line)
|
||||
foreach ($lines as $line)
|
||||
{
|
||||
// echo 'Line #'.$i.' : '.$lines[$i]."<br>\n";
|
||||
$holiday = explode("\t",$line);
|
||||
|
@ -42,6 +42,7 @@
|
||||
|
||||
function uiholiday()
|
||||
{
|
||||
egw_framework::csp_script_src_attrs('unsafe-inline');
|
||||
$this->bo =& CreateObject('calendar.boholiday');
|
||||
$this->bo->check_admin();
|
||||
$this->base_url = $this->bo->base_url;
|
||||
|
Loading…
Reference in New Issue
Block a user