mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-13 01:18:42 +01:00
reading holidays now from Mozilla holiday calendars, or a custom iCal URL
This commit is contained in:
parent
647dae4167
commit
8c7c0c1eb2
@ -104,8 +104,9 @@ class IcalIterator extends Horde_Icalendar implements \Iterator
|
||||
* @param string $charset =null
|
||||
* @param callback $callback =null callback to call with component in current() method, if returning false, item get's ignored
|
||||
* @param array $callback_params =array() further parameters for the callback, 1. parameter is component
|
||||
* @param boolean $add_container =false true, add container / $this as last parameter to callback
|
||||
*/
|
||||
public function __construct($ical_file,$base='VCALENDAR',$charset=null,$callback=null,array $callback_params=array())
|
||||
public function __construct($ical_file,$base='VCALENDAR',$charset=null,$callback=null,array $callback_params=array(), $add_container=false)
|
||||
{
|
||||
// call parent constructor
|
||||
parent::__construct();
|
||||
@ -115,6 +116,7 @@ class IcalIterator extends Horde_Icalendar implements \Iterator
|
||||
if (is_callable($callback))
|
||||
{
|
||||
$this->callback = $callback;
|
||||
if ($add_container) $callback_params[] = $this;
|
||||
$this->callback_params = $callback_params;
|
||||
}
|
||||
if (is_string($ical_file))
|
||||
@ -274,7 +276,7 @@ class IcalIterator extends Horde_Icalendar implements \Iterator
|
||||
*/
|
||||
public function rewind()
|
||||
{
|
||||
fseek($this->ical_file,0,SEEK_SET);
|
||||
@fseek($this->ical_file,0,SEEK_SET);
|
||||
|
||||
// advance to begin of container
|
||||
while(($line = $this->read_line()) && substr($line,0,6+strlen($this->base)) !== 'BEGIN:'.$this->base)
|
||||
|
@ -184,10 +184,6 @@ class calendar_bo
|
||||
* @var array $cached_holidays holidays plus birthdays (gets cached in the session for performance reasons)
|
||||
*/
|
||||
var $cached_holidays;
|
||||
/**
|
||||
* @var boholiday
|
||||
*/
|
||||
var $holidays;
|
||||
/**
|
||||
* Instance of the socal class
|
||||
*
|
||||
@ -1744,14 +1740,11 @@ class calendar_bo
|
||||
*
|
||||
* @param int $year =0 year, defaults to 0 = current year
|
||||
* @return array indexed with Ymd of array of holidays. A holiday is an array with the following fields:
|
||||
* index: numerical unique id
|
||||
* locale: string, 2-char short for the nation
|
||||
* name: string
|
||||
* title: optional string with description
|
||||
* day: numerical day in month
|
||||
* month: numerical month
|
||||
* occurence: numerical year or 0 for every year
|
||||
* dow: day of week, 0=sunday, .., 6= saturday
|
||||
* observande_rule: boolean
|
||||
*/
|
||||
function read_holidays($year=0)
|
||||
{
|
||||
@ -1763,12 +1756,10 @@ class calendar_bo
|
||||
}
|
||||
if (!isset($this->cached_holidays[$year]))
|
||||
{
|
||||
if (!is_object($this->holidays))
|
||||
{
|
||||
$this->holidays = CreateObject('calendar.boholiday');
|
||||
}
|
||||
$this->holidays->prepare_read_holidays($year);
|
||||
$this->cached_holidays[$year] = $this->holidays->read_holiday();
|
||||
$this->cached_holidays[$year] = calendar_holidays::read(
|
||||
!empty($GLOBALS['egw_info']['server']['ical_holiday_url']) ?
|
||||
$GLOBALS['egw_info']['server']['ical_holiday_url'] :
|
||||
$GLOBALS['egw_info']['user']['preferences']['common']['country'], $year);
|
||||
|
||||
// search for birthdays
|
||||
if ($GLOBALS['egw_info']['server']['hide_birthdays'] != 'yes')
|
||||
@ -1813,7 +1804,7 @@ class calendar_bo
|
||||
}
|
||||
}
|
||||
// store holidays and birthdays in the session
|
||||
$this->cached_holidays = Api\Cache::setSession('calendar', 'holidays', $this->cached_holidays);
|
||||
Api\Cache::setSession('calendar', 'holidays', $this->cached_holidays);
|
||||
}
|
||||
if ((int) $this->debug >= 2 || $this->debug == 'read_holidays')
|
||||
{
|
||||
|
220
calendar/inc/class.calendar_holidays.inc.php
Normal file
220
calendar/inc/class.calendar_holidays.inc.php
Normal file
@ -0,0 +1,220 @@
|
||||
<?php
|
||||
/**
|
||||
* EGroupware - Calendar holidays
|
||||
*
|
||||
* @link http://www.egroupware.org
|
||||
* @package calendar
|
||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @copyright (c) 2016 by RalfBecker-At-outdoor-training.de
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
use EGroupware\Api;
|
||||
|
||||
/**
|
||||
* Calendar holidays
|
||||
*
|
||||
* Holidays are read from:
|
||||
* - a given iCal URL or
|
||||
* - json file with 2-digit iso country-code: URL pairs is read from https://community.egroupware.org or
|
||||
* - json file is read from /calendar/setup/ical_holiday_urls.json
|
||||
*
|
||||
* Holidays are cached on tree or instance level, later for custom urls.
|
||||
* As fetching and parsing iCal files is expensive, we always render them
|
||||
* from previous (requested) year until next 5 years.
|
||||
*/
|
||||
class calendar_holidays
|
||||
{
|
||||
const URL_CACHE_TIME = 864000;
|
||||
const URL_FAIL_CACHE_TIME = 300;
|
||||
const EGW_HOLIDAY_URL = 'https://community.egroupware.org/egw';
|
||||
const HOLIDAY_PATH = '/calendar/setup/ical_holiday_urls.json';
|
||||
const HOLIDAY_CACHE_TIME = 864000;
|
||||
|
||||
/**
|
||||
* Read holidays for given country/url and year
|
||||
*
|
||||
* @param string $country 2-digit iso country code or URL
|
||||
* @param int $year =null default current year
|
||||
* @return array of Ymd => array of array with values for keys 'occurence','month','day','name', (commented out) 'title'
|
||||
*/
|
||||
public static function read($country, $year=null)
|
||||
{
|
||||
if (!$year) $year = (int)Api\DateTime::to('now', 'Y');
|
||||
$level = self::is_url($country) ? Api\Cache::INSTANCE : Api\Cache::TREE;
|
||||
|
||||
$holidays = Api\Cache::getCache($level, __CLASS__, $country.':'.$year);
|
||||
|
||||
// if we dont find holidays in cache, we render from previous year until next 5 years
|
||||
if (!isset($holidays) && ($years = self::render($country, $year-1, $year+5)))
|
||||
{
|
||||
foreach($years as $y => $data)
|
||||
{
|
||||
Api\Cache::setCache($level, __CLASS__, $country.':'.$y, $data, self::HOLIDAY_CACHE_TIME);
|
||||
}
|
||||
$holidays = $years[$year];
|
||||
}
|
||||
return (array)$holidays;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch holiday iCal and convert it to usual holiday format
|
||||
*
|
||||
* @param string $country 2-digit iso country code or URL
|
||||
* @param int $year =null default current year
|
||||
* @param int $until_year =null default, fetch only one year, if given result is indexed additional by year
|
||||
* @return array of Ymd => array of array with values for keys 'occurence','month','day','name', (commented out) 'title'
|
||||
*/
|
||||
public static function render($country, $year=null, $until_year=null)
|
||||
{
|
||||
if (!$year) $year = (int)Api\DateTime::to('now', 'Y');
|
||||
$end_year = $until_year && $year < $until_year ? $until_year : $year;
|
||||
|
||||
$starttime = microtime(true);
|
||||
if (!($holidays = self::fetch($country)))
|
||||
{
|
||||
return array();
|
||||
}
|
||||
$years = array();
|
||||
foreach($holidays as $event)
|
||||
{
|
||||
$start = new Api\DateTime($event['start']);
|
||||
$end = new Api\DateTime($event['end']);
|
||||
if ($start->format('Y') > $end_year) continue;
|
||||
if ($end->format('Y') < $year && !$event['recur_type']) continue;
|
||||
|
||||
// recuring events
|
||||
if ($event['recur_type'])
|
||||
{
|
||||
// calendar_rrule limits no enddate, to 5 years
|
||||
if (!$event['recur_enddate']) $event['recur_enddate'] = (1+$end_year).'0101';
|
||||
|
||||
$rrule = calendar_rrule::event2rrule($event);
|
||||
if ($rrule->enddate && $rrule->enddate->format('Y') < $year) continue;
|
||||
|
||||
foreach($rrule as $rtime)
|
||||
{
|
||||
if (($y = (int)$rtime->format('Y')) < $year) continue;
|
||||
if ($y > $end_year) break;
|
||||
|
||||
$ymd = (int)$rtime->format('Ymd');
|
||||
$years[$y][(string)$ymd][] = array(
|
||||
'day' => $ymd % 100,
|
||||
'month' => ($ymd / 100) % 100,
|
||||
'occurence' => $y,
|
||||
'name' => $event['title'],
|
||||
//'title' => $event['description'],
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$end_ymd = (int)$end->format('Ymd');
|
||||
while(($ymd = (int)$start->format('Ymd')) <= $end_ymd)
|
||||
{
|
||||
$y = (int)$start->format('Y');
|
||||
$years[$y][(string)$ymd][] = array(
|
||||
'day' => $ymd % 100,
|
||||
'month' => ($ymd / 100) % 100,
|
||||
'occurence' => $y,
|
||||
'name' => $event['title'],
|
||||
//'title' => $event['description'],
|
||||
);
|
||||
$start->add('1day');
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach($years as $y => &$data)
|
||||
{
|
||||
ksort($data);
|
||||
}
|
||||
error_log(__METHOD__."('$country', $year, $end_year) took ". number_format(microtime(true)-$starttime, 3).'s to fetch '.count(call_user_func_array('array_merge', $years)).' events');
|
||||
unset($starttime);
|
||||
|
||||
return $until_year ? $years : $years[$year];
|
||||
}
|
||||
|
||||
protected static function is_url($url)
|
||||
{
|
||||
return $url[0] == '/' || strpos($url, '://') !== false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch iCal for given country
|
||||
*
|
||||
* @param string $country 2-digit iso country code or URL
|
||||
* @return array|Iterator parsed events
|
||||
*/
|
||||
protected static function fetch($country)
|
||||
{
|
||||
if (!($url = self::is_url($country) ? $country : self::ical_url($country)))
|
||||
{
|
||||
error_log("No holiday iCal for '$country'!");
|
||||
return array();
|
||||
}
|
||||
if (!($f = fopen($url, 'r')))
|
||||
{
|
||||
error_log("Can NOT open holiday iCal '$url' for country '$country'!");
|
||||
return array();
|
||||
}
|
||||
$parser = new calendar_ical();
|
||||
if (!($icals = $parser->icaltoegw($f)))
|
||||
{
|
||||
error_log("Error parsing holiday iCal '$url' for country '$country'!");
|
||||
return array();
|
||||
}
|
||||
return $icals;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get iCal url for holidays of given country
|
||||
*
|
||||
* We first try to fetch urls from https://community.egroupware.org and if that fails we use the local one.
|
||||
*
|
||||
* @param string $country
|
||||
* @return string|boolean|null string with url, false if we cant load urls, NULL if $country is not included
|
||||
*/
|
||||
protected static function ical_url($country)
|
||||
{
|
||||
$urls = Api\Cache::getTree(__CLASS__, 'ical_holiday_urls');
|
||||
|
||||
if (!isset($urls))
|
||||
{
|
||||
$ctx = stream_context_create(array(
|
||||
'http'=> array(
|
||||
'timeout' => 1,
|
||||
)
|
||||
));
|
||||
if (!($json = file_get_contents(self::EGW_HOLIDAY_URL.self::HOLIDAY_PATH, false, $ctx)))
|
||||
{
|
||||
$json = file_get_contents(EGW_SERVER_ROOT.self::HOLIDAY_PATH);
|
||||
}
|
||||
if (!$json || !($urls = json_decode($json, true)))
|
||||
{
|
||||
error_log(__METHOD__."() cant read ical_holiday_urls.json!");
|
||||
$urls = false;
|
||||
}
|
||||
Api\Cache::setTree(__CLASS__, 'ical_holiday_urls', $urls, $urls ? self::URL_CACHE_TIME : self::URL_FAIL_CACHE_TIME);
|
||||
}
|
||||
return $urls[$country];
|
||||
}
|
||||
}
|
||||
|
||||
// some tests when url is called direct
|
||||
if (isset($_SERVER['SCRIPT_FILENAME']) && $_SERVER['SCRIPT_FILENAME'] == __FILE__)
|
||||
{
|
||||
$GLOBALS['egw_info'] = array(
|
||||
'flags' => array(
|
||||
'currentapp' => 'login',
|
||||
)
|
||||
);
|
||||
include('../../header.inc.php');
|
||||
|
||||
$country = !empty($_GET['country']) && preg_match('/^[A-Z]{2}$/i', $_GET['country']) ? strtoupper($_GET['country']) : 'DE';
|
||||
$year = !empty($_GET['year']) && (int)$_GET['year'] > 2000 ? (int)$_GET['year'] : (int)date('Y');
|
||||
$year_until = !empty($_GET['year_until']) && (int)$_GET['year_until'] >= $year ? (int)$_GET['year_until'] : $year;
|
||||
|
||||
Api\Header\Content::type('holidays-'.$country.'.txt', 'text/plain', 0, true, false);
|
||||
print_r(calendar_holidays::render($country, $year, $year_until));
|
||||
}
|
@ -86,7 +86,6 @@ class calendar_hooks
|
||||
$file = Array(
|
||||
'Site Configuration' => Egw::link('/index.php','menuaction=admin.admin_config.index&appname=calendar&ajax=true'),
|
||||
'Custom fields' => Egw::link('/index.php','menuaction=admin.customfields.index&appname=calendar'),
|
||||
'Calendar Holiday Management' => Egw::link('/index.php','menuaction=calendar.uiholiday.admin'),
|
||||
'Global Categories' => Egw::link('/index.php','menuaction=admin.admin_categories.index&appname=calendar'),
|
||||
'Category ACL' => Egw::link('/index.php','menuaction=calendar.calendar_uiforms.cat_acl'),
|
||||
'Update timezones' => Egw::link('/index.php','menuaction=calendar.calendar_timezones.update'),
|
||||
|
@ -2249,7 +2249,9 @@ class calendar_ical extends calendar_boupdate
|
||||
// we use Api\CalDAV\IcalIterator only on resources, as calling importVCal() accesses single events like an array (eg. $events[0])
|
||||
if (is_resource($_vcalData))
|
||||
{
|
||||
return new Api\CalDAV\IcalIterator($_vcalData,'VCALENDAR',$charset,array($this,'_ical2egw_callback'),array($this->tzid,$principalURL));
|
||||
return new Api\CalDAV\IcalIterator($_vcalData, 'VCALENDAR', $charset,
|
||||
// true = add container as last parameter to callback parameters
|
||||
array($this, '_ical2egw_callback'), array($this->tzid, $principalURL), true);
|
||||
}
|
||||
|
||||
if ($this->tzid)
|
||||
@ -2335,6 +2337,12 @@ class calendar_ical extends calendar_boupdate
|
||||
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__.'() '.get_class($component)." found\n",3,$this->logfile);
|
||||
}
|
||||
|
||||
// eg. Mozilla holiday calendars contain only a X-WR-TIMEZONE on vCalendar component
|
||||
if (!$tzid && $container && ($tz = $container->getAttributeDefault('X-WR-TIMEZONE')))
|
||||
{
|
||||
$tzid = $tz;
|
||||
}
|
||||
|
||||
if (!is_a($component, 'Horde_Icalendar_Vevent') ||
|
||||
!($event = $this->vevent2egw($component, $container ? $container->getAttributeDefault('VERSION', '2.0') : '2.0',
|
||||
$this->supportedFields, $principalURL, null, $container)))
|
||||
|
@ -520,7 +520,6 @@ class calendar_ui
|
||||
$file = Array(
|
||||
'Configuration'=>Egw::link('/index.php','menuaction=admin.admin_config.index&appname=calendar&ajax=true'),
|
||||
'Custom Fields'=>Egw::link('/index.php','menuaction=admin.customfields.index&appname=calendar'),
|
||||
'Holiday Management'=>Egw::link('/index.php','menuaction=calendar.uiholiday.admin'),
|
||||
'Global Categories' =>Egw::link('/index.php','menuaction=admin.admin_categories.index&appname=calendar'),
|
||||
);
|
||||
$GLOBALS['egw']->framework->sidebox($appname,lang('Admin'),$file,'admin');
|
||||
|
@ -158,7 +158,7 @@ class calendar_uiviews extends calendar_ui
|
||||
'daywise' => True,
|
||||
'use_so_events' => $this->test === 'true',
|
||||
);
|
||||
$this->holidays = $this->bo->read_holidays($this->year);
|
||||
// $this->holidays = $this->bo->read_holidays($this->year);
|
||||
|
||||
$this->check_owners_access();
|
||||
|
||||
|
@ -1,34 +0,0 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* eGroupWare - holidaycalc *
|
||||
* http://www.egroupware.org *
|
||||
* Based on Yoshihiro Kamimura <your@itheart.com> *
|
||||
* http://www.itheart.com *
|
||||
* -------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
if (empty($GLOBALS['egw_info']['user']['preferences']['common']['country']) ||
|
||||
strlen($GLOBALS['egw_info']['user']['preferences']['common']['country']) > 2)
|
||||
{
|
||||
$rule = 'US';
|
||||
}
|
||||
else
|
||||
{
|
||||
$rule = $GLOBALS['egw_info']['user']['preferences']['common']['country'];
|
||||
}
|
||||
|
||||
$calc_include = EGW_INCLUDE_ROOT.'/calendar/inc/class.holidaycalc_'.$rule.'.inc.php';
|
||||
if(@file_exists($calc_include))
|
||||
{
|
||||
include($calc_include);
|
||||
}
|
||||
else
|
||||
{
|
||||
include(EGW_INCLUDE_ROOT.'/calendar/inc/class.holidaycalc_US.inc.php');
|
||||
}
|
@ -1,159 +0,0 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* eGroupWare - holidaycalc_JP *
|
||||
* http://www.egroupware.org *
|
||||
* Based on Yoshihiro Kamimura <your@itheart.com> *
|
||||
* http://www.itheart.com *
|
||||
* -------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/**
|
||||
* Calculations for calendar JP holidays
|
||||
*
|
||||
* @package calendar
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
*/
|
||||
class holidaycalc
|
||||
{
|
||||
function calculate_date($holiday, &$holidays, $year)
|
||||
{
|
||||
static $cached_month;
|
||||
static $cached_day;
|
||||
static $cached_observance_rule;
|
||||
|
||||
if ($holiday['day'] == 0 && $holiday['dow'] != 0 && $holiday['occurence'] != 0)
|
||||
{
|
||||
$dow = $GLOBALS['egw']->datetime->day_of_week($year, $holiday['month'], 1);
|
||||
$dayshift = (($holiday['dow'] + 7) - $dow) % 7;
|
||||
$day = ($holiday['occurence'] - 1) * 7 + $dayshift + 1;
|
||||
|
||||
// Happy monday law.
|
||||
if ($holiday['month'] == 1)
|
||||
{
|
||||
if ($year < 2000)
|
||||
{
|
||||
$day = 15;
|
||||
}
|
||||
}
|
||||
elseif ($holiday['month'] == 7)
|
||||
{
|
||||
if ($year < 2003)
|
||||
{
|
||||
$day = 20;
|
||||
}
|
||||
}
|
||||
elseif ($holiday['month'] == 9)
|
||||
{
|
||||
if ($year < 2003)
|
||||
{
|
||||
$day = 15;
|
||||
}
|
||||
}
|
||||
elseif ($holiday['month'] == 10)
|
||||
{
|
||||
if ($year < 2000)
|
||||
{
|
||||
$day = 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ($holiday['day'] == 0 && $holiday['dow'] == 0 && $holiday['occurence'] == 0)
|
||||
{
|
||||
// For the next generation.
|
||||
// over 2151, please set $factor...
|
||||
if ($holiday['month'] == 3)
|
||||
{
|
||||
// for Vernal Equinox
|
||||
if ($year >= 1980 && $year <= 2099)
|
||||
{
|
||||
$factor = 20.8431;
|
||||
}
|
||||
elseif ($year >= 2100 && $year <= 2150)
|
||||
{
|
||||
$factor = 21.851;
|
||||
}
|
||||
}
|
||||
elseif ($holiday['month'] == 9)
|
||||
{
|
||||
// for Autumnal Equinox
|
||||
if ($year >= 1980 && $year <= 2099)
|
||||
{
|
||||
$factor = 23.2488;
|
||||
}
|
||||
elseif ($year >= 2100 && $year <= 2150)
|
||||
{
|
||||
$factor = 24.2488;
|
||||
}
|
||||
}
|
||||
|
||||
$day = (int)($factor + 0.242194 * ($year - 1980)
|
||||
- (int)(($year - 1980) / 4));
|
||||
}
|
||||
else
|
||||
{
|
||||
// normal holiday
|
||||
$day = $holiday['day'];
|
||||
}
|
||||
|
||||
if ($year >= 1985 && $holiday['month'] == $cached_month && $day == $cached_day + 2 && $cached_observance_rule == True && $holiday['observance_rule'] == True)
|
||||
{
|
||||
$pdow = $GLOBALS['egw']->datetime->day_of_week($year,$holiday['month'],$day-1);
|
||||
if ($pdow != 0)
|
||||
{
|
||||
$addcnt = count($holidays) + 1;
|
||||
$holidays[$addcnt]['locale'] = $holiday['locale'];
|
||||
if ($pdow == 1)
|
||||
{
|
||||
$holidays[$addcnt]['name'] = lang('overlap holiday');
|
||||
}
|
||||
else
|
||||
{
|
||||
$holidays[$addcnt]['name'] = lang('people holiday');
|
||||
}
|
||||
$holidays[$addcnt]['day'] = $day - 1;
|
||||
$holidays[$addcnt]['month'] = $holiday['month'];
|
||||
$holidays[$addcnt]['occurence'] = 0;
|
||||
$holidays[$addcnt]['dow'] = 0;
|
||||
$holidays[$addcnt]['date'] = mktime(0,0,0,$holiday['month'],$day-1,$year);
|
||||
$holidays[$addcnt]['observance_rule'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$cached_month = $holiday['month'];
|
||||
$cached_day = $day;
|
||||
$cached_observance_rule = $holiday['observance_rule'];
|
||||
|
||||
if ($year >= 1985 && $holiday['month'] == 5 && $day == 3)
|
||||
{
|
||||
;
|
||||
}
|
||||
elseif ($holiday['observance_rule'] == True)
|
||||
{
|
||||
$dow = $GLOBALS['egw']->datetime->day_of_week($year,$holiday['month'],$day);
|
||||
// This now calulates Observed holidays and creates a new entry for them.
|
||||
if($dow == 0)
|
||||
{
|
||||
$addcnt = count($holidays) + 1;
|
||||
$holidays[$addcnt]['locale'] = $holiday['locale'];
|
||||
$holidays[$addcnt]['name'] = lang('overlap holiday');
|
||||
$holidays[$addcnt]['day'] = $day + 1;
|
||||
$holidays[$addcnt]['month'] = $holiday['month'];
|
||||
$holidays[$addcnt]['occurence'] = $holiday['occurence'];
|
||||
$holidays[$addcnt]['dow'] = $holiday['dow'];
|
||||
$holidays[$addcnt]['date'] = mktime(0,0,0,$holiday['month'],$day+1,$year);
|
||||
$holidays[$addcnt]['observance_rule'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$date = mktime(0,0,0,$holiday['month'],$day,$year);
|
||||
|
||||
return $date;
|
||||
}
|
||||
}
|
||||
?>
|
@ -1,111 +0,0 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* eGroupWare - holidaycalc_US *
|
||||
* http://www.egroupware.org *
|
||||
* Based on Yoshihiro Kamimura <your@itheart.com> *
|
||||
* http://www.itheart.com *
|
||||
* -------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/**
|
||||
* Calculations for calendar US and other holidays
|
||||
*
|
||||
* @package calendar
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
*/
|
||||
class holidaycalc
|
||||
{
|
||||
function add($holiday,&$holidays,$year,$day_offset=0)
|
||||
{
|
||||
if ($day_offset)
|
||||
{
|
||||
$holiday['name'] .= ' (Observed)';
|
||||
}
|
||||
$holiday['date'] = mktime(0,0,0,$holiday['month'],$holiday['day']+$day_offset,$year);
|
||||
foreach(array('day'=>'d','month'=>'m','occurence'=>'Y') as $key => $frmt)
|
||||
{
|
||||
$holiday[$key] = date($frmt,$holiday['date']);
|
||||
}
|
||||
$holiday['obervance_rule'] = 0;
|
||||
|
||||
$holidays[]= $holiday;
|
||||
|
||||
//echo "<p>holidaycalc::add(,,$year,,$day_offset)=".print_r($holiday,True)."</p>";
|
||||
}
|
||||
|
||||
function calculate_date($holiday, &$holidays, $year)
|
||||
{
|
||||
//echo "<p>holidaycalc::calculate_date(".print_r($holiday,True).",,$year,)</p>";
|
||||
|
||||
if($holiday['day'] == 0 && $holiday['occurence'] != 0)
|
||||
{
|
||||
if($holiday['occurence'] != 99)
|
||||
{
|
||||
$dow = $GLOBALS['egw']->datetime->day_of_week($year,$holiday['month'],1);
|
||||
$day = (((7 * $holiday['occurence']) - 6) + ((($holiday['dow'] + 7) - $dow) % 7));
|
||||
$day += ($day < 1 ? 7 : 0);
|
||||
|
||||
// Sometimes the 5th occurance of a weekday (ie the 5th monday)
|
||||
// can spill over to the next month. This prevents that.
|
||||
$ld = $GLOBALS['egw']->datetime->days_in_month($holiday['month'],$year);
|
||||
if ($day > $ld)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$ld = $GLOBALS['egw']->datetime->days_in_month($holiday['month'],$year);
|
||||
$dow = $GLOBALS['egw']->datetime->day_of_week($year,$holiday['month'],$ld);
|
||||
$day = $ld - (($dow + 7) - $holiday['dow']) % 7 ;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$day = $holiday['day'];
|
||||
if($holiday['observance_rule'] == True)
|
||||
{
|
||||
$dow = $GLOBALS['egw']->datetime->day_of_week($year,$holiday['month'],$day);
|
||||
// This now calulates Observed holidays and creates a new entry for them.
|
||||
|
||||
// 0 = sundays are observed on monday (+1), 6 = saturdays are observed on fridays (-1)
|
||||
if($dow == 0 || $dow == 6)
|
||||
{
|
||||
$this->add($holiday,$holidays,$year,$dow == 0 ? 1 : -1);
|
||||
}
|
||||
if ($holiday['month'] == 1 && $day == 1)
|
||||
{
|
||||
$dow = $GLOBALS['egw']->datetime->day_of_week($year+1,$holiday['month'],$day);
|
||||
// checking if next year's newyear might be observed in this year
|
||||
if ($dow == 6)
|
||||
{
|
||||
$this->add($holiday,$holidays,$year+1,-1);
|
||||
}
|
||||
// add the next years newyear, to show it in a week- or month-view
|
||||
$this->add($holiday,$holidays,$year+1);
|
||||
}
|
||||
// checking if last year's new year's eve might be observed in this year
|
||||
if ($holiday['month'] == 12 && $day == 31)
|
||||
{
|
||||
$dow = $GLOBALS['egw']->datetime->day_of_week($year-1,$holiday['month'],$day);
|
||||
if ($dow == 0)
|
||||
{
|
||||
$this->add($holiday,$holidays,$year-1,1);
|
||||
}
|
||||
// add the last years new year's eve, to show it in a week- or month-view
|
||||
$this->add($holiday,$holidays,$year-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
$date = mktime(0,0,0,$holiday['month'],$day,$year);
|
||||
|
||||
return $date;
|
||||
}
|
||||
}
|
||||
?>
|
@ -1,395 +0,0 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* eGroupWare API - Select Box *
|
||||
* This file written by Marc Logemann <loge@phpgroupware.org> *
|
||||
* Class for creating predefines select boxes *
|
||||
* Copyright (C) 2000, 2001 Dan Kuykendall *
|
||||
* -------------------------------------------------------------------------*
|
||||
* This library is part of the eGroupWare API *
|
||||
* ------------------------------------------------------------------------ *
|
||||
* This library is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Lesser General Public License as published by *
|
||||
* the Free Software Foundation; either version 2.1 of the License, *
|
||||
* or any later version. *
|
||||
* This library is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU Lesser General Public License for more details. *
|
||||
* You should have received a copy of the GNU Lesser General Public License *
|
||||
* along with this library; if not, write to the Free Software Foundation, *
|
||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
|
||||
\**************************************************************************/
|
||||
/* $Id: class.sbox.inc.php 15449 2004-06-15 08:16:07Z ralfbecker $ */
|
||||
|
||||
class sbox
|
||||
{
|
||||
var $monthnames = array(
|
||||
'',
|
||||
'January',
|
||||
'February',
|
||||
'March',
|
||||
'April',
|
||||
'May',
|
||||
'June',
|
||||
'July',
|
||||
'August',
|
||||
'September',
|
||||
'October',
|
||||
'November',
|
||||
'December'
|
||||
);
|
||||
|
||||
var $weekdays = array(
|
||||
'',
|
||||
'Monday',
|
||||
'Tuesday',
|
||||
'Wednesday',
|
||||
'Thursday',
|
||||
'Friday',
|
||||
'Saturday',
|
||||
'Sunday'
|
||||
);
|
||||
|
||||
function sbox()
|
||||
{
|
||||
if (!$this->country_array)
|
||||
{
|
||||
$this->country_array = EGroupware\Api\Country::countries(true);
|
||||
}
|
||||
}
|
||||
|
||||
function hour_formated_text($name, $selected = 0)
|
||||
{
|
||||
$s = '<select name="' . $name . '">';
|
||||
$t_s[$selected] = ' selected';
|
||||
|
||||
for ($i=0; $i<24; $i++)
|
||||
{
|
||||
$s .= '<option value="' . $i . '"' . $t_s[$i] . '>'
|
||||
. $GLOBALS['phpgw']->common->formattime($i+1,"00") . '</option>' . "\n";
|
||||
}
|
||||
$s .= "</select>";
|
||||
|
||||
return $s;
|
||||
}
|
||||
|
||||
function hour_text($name, $selected = 0)
|
||||
{
|
||||
$s = '<select name="' . $name . '">';
|
||||
$t_s[$selected] = " selected";
|
||||
for ($i=1; $i<13; $i++)
|
||||
{
|
||||
$s .= '<option value="' . $i . '"' . $t_s[$i] . '>'
|
||||
. $i . '</option>';
|
||||
$s .= "\n";
|
||||
}
|
||||
$s .= "</select>";
|
||||
|
||||
return $s;
|
||||
}
|
||||
|
||||
// I would like to add a increment feature
|
||||
function sec_minute_text($name, $selected = 0)
|
||||
{
|
||||
$s = '<select name="' . $name . '">';
|
||||
$t_s[$selected] = " selected";
|
||||
|
||||
for ($i=0; $i<60; $i++)
|
||||
{
|
||||
$s .= '<option value="' . $i . '"' . $t_s[sprintf("%02d",$i)] . '>' . sprintf("%02d",$i) . '</option>';
|
||||
$s .= "\n";
|
||||
}
|
||||
$s .= "</select>";
|
||||
return $s;
|
||||
}
|
||||
|
||||
function ap_text($name,$selected)
|
||||
{
|
||||
$selected = strtolower($selected);
|
||||
$t[$selected] = " selected";
|
||||
$s = '<select name="' . $name . '">'
|
||||
. ' <option value="am"' . $t['am'] . '>am</option>'
|
||||
. ' <option value="pm"' . $t['pm'] . '>pm</option>';
|
||||
$s .= '</select>';
|
||||
return $s;
|
||||
}
|
||||
|
||||
function full_time($hour_name,$hour_selected,$min_name,$min_selected,$sec_name,$sec_selected,$ap_name,$ap_selected)
|
||||
{
|
||||
// This needs to be changed to support there time format preferences
|
||||
$s = $this->hour_text($hour_name,$hour_selected)
|
||||
. $this->sec_minute_text($min_name,$min_selected)
|
||||
. $this->sec_minute_text($sec_name,$sec_selected)
|
||||
. $this->ap_text($ap_name,$ap_selected);
|
||||
return $s;
|
||||
}
|
||||
|
||||
function getWeekdays($name, $selected=0)
|
||||
{
|
||||
$out = '';
|
||||
for($i=0;$i<count($this->weekdays);$i++)
|
||||
{
|
||||
$out .= '<option value="'.$i.'"'.($selected!=$i?'':' selected').'>'.($this->weekdays[$i]!=''?lang($this->weekdays[$i]):'').'</option>'."\n";
|
||||
}
|
||||
return '<select name="'.$name.'">'."\n".$out.'</select>'."\n";
|
||||
}
|
||||
|
||||
function nr2weekday($selected = 0)
|
||||
{
|
||||
for($i=0;$i<count($this->weekdays);$i++)
|
||||
{
|
||||
if ($selected > 0 && $selected == $i)
|
||||
{
|
||||
return lang($this->weekdays[$i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getMonthText($name, $selected=0)
|
||||
{
|
||||
$out = '';
|
||||
$c_monthnames = count($this->monthnames);
|
||||
for($i=0;$i<$c_monthnames;$i++)
|
||||
{
|
||||
$out .= '<option value="'.$i.'"'.($selected!=$i?'':' selected').'>'.($this->monthnames[$i]!=''?lang($this->monthnames[$i]):'').'</option>'."\n";
|
||||
}
|
||||
return '<select name="'.$name.'">'."\n".$out.'</select>'."\n";
|
||||
}
|
||||
|
||||
function getDays($name, $selected=0)
|
||||
{
|
||||
$out = '';
|
||||
|
||||
for($i=0;$i<32;$i++)
|
||||
{
|
||||
$out .= '<option value="'.($i?$i:'').'"'.($selected!=$i?'':' selected').'>'.($i?$i:'').'</option>'."\n";
|
||||
}
|
||||
return '<select name="'.$name.'">'."\n".$out.'</select>'."\n";
|
||||
}
|
||||
|
||||
function getYears($name, $selected = 0, $startYear = 0, $endyear = 0)
|
||||
{
|
||||
if (!$startYear)
|
||||
{
|
||||
$startYear = date('Y') - 5;
|
||||
}
|
||||
if ($selected && $startYear > $selected) $startYear = $selected;
|
||||
|
||||
if (!$endyear)
|
||||
{
|
||||
$endyear = date('Y') + 6;
|
||||
}
|
||||
if ($selected && $endYear < $selected) $endYear = $selected;
|
||||
|
||||
$out = '<select name="'.$name.'">'."\n";
|
||||
|
||||
$out .= '<option value=""';
|
||||
if ($selected == 0 OR $selected == '')
|
||||
{
|
||||
$out .= ' SELECTED';
|
||||
}
|
||||
$out .= '></option>'."\n";
|
||||
|
||||
// We need to add some good error checking here.
|
||||
for ($i=$startYear;$i<$endyear; $i++)
|
||||
{
|
||||
$out .= '<option value="'.$i.'"';
|
||||
if ($selected==$i)
|
||||
{
|
||||
$out .= ' SELECTED';
|
||||
}
|
||||
$out .= '>'.$i.'</option>'."\n";
|
||||
}
|
||||
$out .= '</select>'."\n";
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
function getPercentage($name, $selected=0)
|
||||
{
|
||||
$out = "<select name=\"$name\">\n";
|
||||
|
||||
for($i=0;$i<101;$i=$i+10)
|
||||
{
|
||||
$out .= "<option value=\"$i\"";
|
||||
if($selected==$i)
|
||||
{
|
||||
$out .= " SELECTED";
|
||||
}
|
||||
$out .= ">$i%</option>\n";
|
||||
}
|
||||
$out .= "</select>\n";
|
||||
// echo $out;
|
||||
return $out;
|
||||
}
|
||||
|
||||
function getPriority($name, $selected=2)
|
||||
{
|
||||
$arr = array('','low','normal','high');
|
||||
$out = '<select name="' . $name . '">';
|
||||
|
||||
for($i=1;$i<count($arr);$i++)
|
||||
{
|
||||
$out .= "<option value=\"";
|
||||
$out .= $i;
|
||||
$out .= "\"";
|
||||
if ($selected==$i)
|
||||
{
|
||||
$out .= ' SELECTED';
|
||||
}
|
||||
$out .= ">";
|
||||
$out .= lang($arr[$i]);
|
||||
$out .= "</option>\n";
|
||||
}
|
||||
$out .= "</select>\n";
|
||||
return $out;
|
||||
}
|
||||
|
||||
function getAccessList($name, $selected="private")
|
||||
{
|
||||
$arr = array(
|
||||
"private" => "Private",
|
||||
"public" => "Global public",
|
||||
"group" => "Group public"
|
||||
);
|
||||
|
||||
if (strpos($selected,",") !== false)
|
||||
{
|
||||
$selected = "group";
|
||||
}
|
||||
|
||||
$out = "<select name=\"$name\">\n";
|
||||
|
||||
for(reset($arr);current($arr);next($arr))
|
||||
{
|
||||
$out .= '<option value="' . key($arr) . '"';
|
||||
if($selected==key($arr))
|
||||
{
|
||||
$out .= " SELECTED";
|
||||
}
|
||||
$out .= ">" . pos($arr) . "</option>\n";
|
||||
}
|
||||
$out .= "</select>\n";
|
||||
return $out;
|
||||
}
|
||||
|
||||
function getGroups($groups, $selected="", $name="n_groups[]")
|
||||
{
|
||||
$out = '<select name="' . $name . '" multiple>';
|
||||
while (list($null,$group) = each($groups))
|
||||
{
|
||||
$out .= '<option value="' . $group['account_id'] . '"';
|
||||
if(@is_array($selected))
|
||||
{
|
||||
for($i=0;$i<count($selected);$i++)
|
||||
{
|
||||
if ($group['account_id'] == $selected[$i])
|
||||
{
|
||||
$out .= " SELECTED";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (ereg("," . $group['account_id'] . ",", $selected))
|
||||
{
|
||||
$out .= " SELECTED";
|
||||
}
|
||||
$out .= ">" . $group['account_name'] . "</option>\n";
|
||||
}
|
||||
$out .= "</select>\n";
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
function list_states($name, $selected = '')
|
||||
{
|
||||
$states = array(
|
||||
'' => lang('Select one'),
|
||||
'--' => 'non US',
|
||||
'AL' => 'Alabama',
|
||||
'AK' => 'Alaska',
|
||||
'AZ' => 'Arizona',
|
||||
'AR' => 'Arkansas',
|
||||
'CA' => 'California',
|
||||
'CO' => 'Colorado',
|
||||
'CT' => 'Connecticut',
|
||||
'DE' => 'Delaware',
|
||||
'DC' => 'District of Columbia',
|
||||
'FL' => 'Florida',
|
||||
'GA' => 'Georgia',
|
||||
'HI' => 'Hawaii',
|
||||
'ID' => 'Idaho',
|
||||
'IL' => 'Illinois',
|
||||
'IN' => 'Indiana',
|
||||
'IA' => 'Iowa',
|
||||
'KS' => 'Kansas',
|
||||
'KY' => 'Kentucky',
|
||||
'LA' => 'Louisiana',
|
||||
'ME' => 'Maine',
|
||||
'MD' => 'Maryland',
|
||||
'MA' => 'Massachusetts',
|
||||
'MI' => 'Michigan',
|
||||
'MN' => 'Minnesota',
|
||||
'MO' => 'Missouri',
|
||||
'MS' => 'Mississippi',
|
||||
'MT' => 'Montana',
|
||||
'NC' => 'North Carolina',
|
||||
'ND' => 'Noth Dakota',
|
||||
'NE' => 'Nebraska',
|
||||
'NH' => 'New Hampshire',
|
||||
'NJ' => 'New Jersey',
|
||||
'NM' => 'New Mexico',
|
||||
'NV' => 'Nevada',
|
||||
'NY' => 'New York',
|
||||
'OH' => 'Ohio',
|
||||
'OK' => 'Oklahoma',
|
||||
'OR' => 'Oregon',
|
||||
'PA' => 'Pennsylvania',
|
||||
'RI' => 'Rhode Island',
|
||||
'SC' => 'South Carolina',
|
||||
'SD' => 'South Dakota',
|
||||
'TN' => 'Tennessee',
|
||||
'TX' => 'Texas',
|
||||
'UT' => 'Utah',
|
||||
'VA' => 'Virginia',
|
||||
'VT' => 'Vermont',
|
||||
'WA' => 'Washington',
|
||||
'WI' => 'Wisconsin',
|
||||
'WV' => 'West Virginia',
|
||||
'WY' => 'Wyoming'
|
||||
);
|
||||
|
||||
while (list($sn,$ln) = each($states))
|
||||
{
|
||||
$s .= '<option value="' . $sn . '"';
|
||||
if ($selected == $sn)
|
||||
{
|
||||
$s .= ' selected';
|
||||
}
|
||||
$s .= '>' . $ln . '</option>';
|
||||
}
|
||||
return '<select name="' . $name . '">' . $s . '</select>';
|
||||
}
|
||||
|
||||
function form_select($selected,$name='')
|
||||
{
|
||||
if($name=='')
|
||||
{
|
||||
$name = 'country';
|
||||
}
|
||||
$str = '<select name="'.$name.'">'."\n"
|
||||
. ' <option value=" "'.($selected == ' '?' selected':'').'>'.lang('Select One').'</option>'."\n";
|
||||
foreach($this->country_array as $key => $value)
|
||||
{
|
||||
$str .= ' <option value="'.$key.'"'.($selected == $key?' selected':'') . '>'.$value.'</option>'."\n";
|
||||
}
|
||||
$str .= '</select>'."\n";
|
||||
return $str;
|
||||
}
|
||||
|
||||
function get_full_name($selected)
|
||||
{
|
||||
return($this->country_array[$selected]);
|
||||
}
|
||||
}
|
||||
?>
|
@ -1,213 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* EGroupware - Calendar Holidays
|
||||
*
|
||||
* @link http://www.egroupware.org
|
||||
* @package calendar
|
||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @author Mark Peters <skeeter@phpgroupware.org>
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
use EGroupware\Api;
|
||||
|
||||
/**
|
||||
* Storage layer for calendar holidays
|
||||
*
|
||||
* Maintained and further developed by RalfBecker@outdoor-training.de
|
||||
* Originaly written by Mark Peters <skeeter@phpgroupware.org>
|
||||
*/
|
||||
class soholiday
|
||||
{
|
||||
var $debug = False;
|
||||
/**
|
||||
* Reference to the global db-object
|
||||
*
|
||||
* @var Api\Db
|
||||
*/
|
||||
var $db;
|
||||
var $table = 'egw_cal_holidays';
|
||||
|
||||
function soholiday()
|
||||
{
|
||||
$this->db = $GLOBALS['egw']->db;
|
||||
}
|
||||
|
||||
/* Begin Holiday functions */
|
||||
function save_holiday($holiday)
|
||||
{
|
||||
// observance_rule is either "True" or unset !
|
||||
$holiday['observance_rule'] = @$holiday['observance_rule'] ? 1 : 0;
|
||||
$holiday['locale'] = strtoupper($holiday['locale']);
|
||||
|
||||
foreach($holiday as $name => $val)
|
||||
{
|
||||
if (substr($name,0,4) != 'hol_')
|
||||
{
|
||||
if (!is_numeric($name))
|
||||
{
|
||||
$holiday['hol_'.$name] = $val;
|
||||
}
|
||||
unset($holiday[$name]);
|
||||
}
|
||||
}
|
||||
$hol_id = $holiday['hol_id'];
|
||||
unset($holiday['hol_id']);
|
||||
unset($holiday['hol_locales']);
|
||||
|
||||
if ($hol_id)
|
||||
{
|
||||
if($this->debug)
|
||||
{
|
||||
echo "Updating LOCALE='".$holiday['locale']."' NAME='".$holiday['name']."' extra=(".$holiday['mday'].'/'.$holiday['month_num'].'/'.$holiday['occurence'].'/'.$holiday['dow'].'/'.$holiday['observance_rule'].")<br>\n";
|
||||
}
|
||||
$this->db->update($this->table,$holiday,array('hol_id' => $hol_id),__LINE__,__FILE__,'calendar');
|
||||
}
|
||||
else
|
||||
{
|
||||
if($this->debug)
|
||||
{
|
||||
echo "Inserting LOCALE='".$holiday['locale']."' NAME='".$holiday['name']."' extra=(".$holiday['mday'].'/'.$holiday['month_num'].'/'.$holiday['occurence'].'/'.$holiday['dow'].'/'.$holiday['observance_rule'].")<br>\n";
|
||||
}
|
||||
// delete evtl. existing rules with same name, year (occurence) and local
|
||||
$this->db->delete($this->table, array(
|
||||
'hol_name' => $holiday['hol_name'],
|
||||
'hol_occurence' => $holiday['hol_occurence'],
|
||||
'hol_locale' => $holiday['hol_locale'],
|
||||
), __LINE__, __FILES__, 'calendar');
|
||||
$this->db->insert($this->table,$holiday,False,__LINE__,__FILE__,'calendar');
|
||||
}
|
||||
}
|
||||
|
||||
function store_to_array(&$holidays,$rs)
|
||||
{
|
||||
foreach($rs as $row)
|
||||
{
|
||||
$holidays[] = Array(
|
||||
'index' => $row['hol_id'],
|
||||
'locale' => $row['hol_locale'],
|
||||
'name' => $GLOBALS['egw']->strip_html($row['hol_name']),
|
||||
'day' => (int)$row['hol_mday'],
|
||||
'month' => (int)$row['hol_month_num'],
|
||||
'occurence' => (int)$row['hol_occurence'],
|
||||
'dow' => (int)$row['hol_dow'],
|
||||
'observance_rule' => $row['hol_observance_rule']
|
||||
);
|
||||
if($this->debug)
|
||||
{
|
||||
echo 'Holiday ID: '.$row['hol_id'].'<br>'."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function read_holidays($locales='',$query='',$order='',$year=0)
|
||||
{
|
||||
$holidays = Array();
|
||||
|
||||
if($locales == '')
|
||||
{
|
||||
return $holidays;
|
||||
}
|
||||
|
||||
$where = $this->_build_where($locales,$query,$order,$year);
|
||||
|
||||
if($this->debug)
|
||||
{
|
||||
echo 'Read Holidays : '.$where.'<br>'."\n";
|
||||
}
|
||||
|
||||
$rs = $this->db->select($this->table,'*',$where,__LINE__,__FILE__,false,'','calendar');
|
||||
$this->store_to_array($holidays,$rs);
|
||||
|
||||
return $holidays;
|
||||
}
|
||||
|
||||
function read_holiday($id)
|
||||
{
|
||||
$holidays = Array();
|
||||
if($this->debug)
|
||||
{
|
||||
echo 'Reading Holiday ID : '.$id.'<br>'."\n";
|
||||
}
|
||||
$rs = $this->db->select($this->table,'*',array('hol_id'=>$id),__LINE__,__FILE__,false,'','calendar');
|
||||
$this->store_to_array($holidays,$rs);
|
||||
return $holidays[0];
|
||||
}
|
||||
|
||||
function delete_holiday($id)
|
||||
{
|
||||
$this->db->delete($this->table,array('hol_id' => $id),__LINE__,__FILE__,'calendar');
|
||||
}
|
||||
|
||||
function delete_locale($locale)
|
||||
{
|
||||
$this->db->delete($this->table,array('hol_locale' => $locale),__LINE__,__FILE__,'calendar');
|
||||
}
|
||||
|
||||
/* Private functions */
|
||||
function _build_where($locales,$query='',$order='',$year=0,$add_order_by=True)
|
||||
{
|
||||
$querymethod = 'hol_locale';
|
||||
if (is_array($locales))
|
||||
{
|
||||
$querymethod .= ' IN ('.$this->db->column_data_implode(',',$locales,False).')';
|
||||
}
|
||||
else
|
||||
{
|
||||
$querymethod .= '='.$this->db->quote($locales);
|
||||
}
|
||||
if($query)
|
||||
{
|
||||
$querymethod .= " AND hol_name LIKE ".$this->db->quote('%'.$query.'%');
|
||||
}
|
||||
if ($year > 1900)
|
||||
{
|
||||
$querymethod .= " AND (hol_occurence < 1900 OR hol_occurence = ".(int)$year.")";
|
||||
}
|
||||
if ($add_order_by)
|
||||
{
|
||||
$querymethod .= ' ORDER BY '.(preg_match('/^[a-zA-Z0-9_,]+$/',$order) ? $order : 'hol_month_num,hol_mday');
|
||||
}
|
||||
return $querymethod;
|
||||
}
|
||||
|
||||
function get_locale_list($sort='', $order='', $query='')
|
||||
{
|
||||
$querymethod = '';
|
||||
if($query)
|
||||
{
|
||||
$querymethod = 'hol_locale LIKE '.$this->db->quote('%'.$query.'%');
|
||||
}
|
||||
|
||||
if(!preg_match('/^[a-zA-Z0-9_,]+$/',$order))
|
||||
{
|
||||
$order = 'hol_locale';
|
||||
}
|
||||
if (strtoupper($sort) != 'DESC') $sort = 'ASC';
|
||||
if (strpos($order, ',') === false) $order .= ' '.$sort;
|
||||
foreach($this->db->select($this->table,'DISTINCT hol_locale',$querymethod,__LINE__,__FILE__,false,'ORDER BY '.$order,'calendar') as $row)
|
||||
{
|
||||
$locale[] = $row['hol_locale'];
|
||||
}
|
||||
return $locale;
|
||||
}
|
||||
|
||||
function holiday_total($locale,$query='',$year=0)
|
||||
{
|
||||
$where = $this->_build_where($locale,$query,'',$year,False);
|
||||
|
||||
if($this->debug)
|
||||
{
|
||||
echo 'HOLIDAY_TOTAL : '.$where.'<br>'."\n";
|
||||
}
|
||||
|
||||
$retval = $this->db->select($this->table,'count(*)',$where,__LINE__,__FILE__,false,'','calendar')->fetchColumn();
|
||||
|
||||
if($this->debug)
|
||||
{
|
||||
echo 'Total Holidays for : '.$locale.' : '.$retval."<br>\n";
|
||||
}
|
||||
return $retval;
|
||||
}
|
||||
}
|
@ -1,530 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* EGroupware - Calendar Holidays
|
||||
*
|
||||
* Based on Webcalendar by Craig Knudsen <cknudsen@radix.net> http://www.radix.net/~cknudsen
|
||||
*
|
||||
* @link http://www.egroupware.org
|
||||
* @package calendar
|
||||
* @author Mark Peters <skeeter@phpgroupware.org>
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
use EGroupware\Api;
|
||||
use EGroupware\Api\Framework;
|
||||
|
||||
/**
|
||||
* User interface for calendar holidays
|
||||
*
|
||||
* @package calendar
|
||||
* @author Mark Peters <skeeter@phpgroupware.org>
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
*/
|
||||
class uiholiday
|
||||
{
|
||||
var $debug = False;
|
||||
var $base_url;
|
||||
var $bo;
|
||||
var $template_dir;
|
||||
var $holidays;
|
||||
var $cat_id;
|
||||
|
||||
var $public_functions = array(
|
||||
'admin' => True,
|
||||
'edit_locale' => True,
|
||||
'edit_holiday' => True,
|
||||
'copy_holiday' => True,
|
||||
'delete_holiday' => True,
|
||||
'delete_locale' => True,
|
||||
'submit' => True
|
||||
);
|
||||
|
||||
function uiholiday()
|
||||
{
|
||||
Api\Header\ContentSecurityPolicy::add('script-src', 'unsafe-inline');
|
||||
$this->bo = CreateObject('calendar.boholiday');
|
||||
$this->bo->check_admin();
|
||||
$this->base_url = $this->bo->base_url;
|
||||
$this->template_dir = Framework\Template::get_dir('calendar');
|
||||
$this->sb = CreateObject('calendar.sbox');
|
||||
|
||||
// calendar does not work with hidden sidebox atm.
|
||||
unset($GLOBALS['egw_info']['user']['preferences']['common']['auto_hide_sidebox']);
|
||||
|
||||
$GLOBALS['egw_info']['flags']['app_header'] = $GLOBALS['egw_info']['apps']['calendar']['title'].' - '.lang('Holiday Management');
|
||||
|
||||
$GLOBALS['egw']->template->set_var('help_msg',lang('<b>Please note</b>: The calendar use the holidays of your country, which is set to %1. You can change it in your %2.<br />Holidays are %3 automatic installed from %4. You can changed it in %5.',
|
||||
'<b>'.$GLOBALS['egw_info']['user']['preferences']['common']['country'].'</b>',lang('common preferences'),
|
||||
$GLOBALS['egw_info']['server']['auto_load_holidays'] ? '' : '<b>'.lang('not').'</b>',
|
||||
'<b>'.$GLOBALS['egw_info']['server']['holidays_url_path'].'</b>',
|
||||
'<a href="'.$GLOBALS['egw']->link('/index.php',array(
|
||||
'menuaction' => 'admin.uiconfig.index',
|
||||
'appname' => 'calendar',
|
||||
)).'">'.lang('admin').' >> '.lang('calendar').' >> '.lang('site configuration').'</a>'));
|
||||
$GLOBALS['egw']->template->set_var('total','');
|
||||
}
|
||||
|
||||
function admin()
|
||||
{
|
||||
unset($GLOBALS['egw_info']['flags']['noheader']);
|
||||
unset($GLOBALS['egw_info']['flags']['nonavbar']);
|
||||
$GLOBALS['egw_info']['flags']['noappfooter'] = True;
|
||||
|
||||
$p = &$GLOBALS['egw']->template;
|
||||
$p->set_file(Array('locales'=>'locales.tpl'));
|
||||
$p->set_block('locales','list','list');
|
||||
$p->set_block('locales','row','row');
|
||||
$p->set_block('locales','row_empty','row_empty');
|
||||
|
||||
$var = Array(
|
||||
'th_bg' => $GLOBALS['egw_info']['theme']['th_bg'],
|
||||
'left_next_matchs' => $GLOBALS['egw']->nextmatchs->left('/index.php?menuaction=calendar.uiholiday.admin',$this->bo->start,$this->bo->total),
|
||||
'right_next_matchs' => $GLOBALS['egw']->nextmatchs->right('/index.php?menuaction=calendar.uiholiday.admin',$this->bo->start,$this->bo->total),
|
||||
'center' => '<td align="center">'.lang('Countries').'</td>',
|
||||
'sort_name' => $GLOBALS['egw']->nextmatchs->show_sort_order($this->bo->sort,'hol_locale',$this->bo->order,'/calendar/'.basename($SCRIPT_FILENAME),lang('Country')),
|
||||
'header_edit' => lang('Edit'),
|
||||
'header_delete' => lang('Delete'),
|
||||
'header_extra' => lang('Submit to Repository'),
|
||||
'extra_width' => 'width="45%"',
|
||||
'rule' => '',
|
||||
'header_rule' => '',
|
||||
'back_button' => ''
|
||||
);
|
||||
|
||||
$p->set_var($var);
|
||||
|
||||
$locales = $this->bo->get_locale_list($this->bo->sort, $this->bo->order, $this->bo->query, $this->bo->total);
|
||||
@reset($locales);
|
||||
if (!$locales)
|
||||
{
|
||||
$p->set_var('message',lang('no matches found'));
|
||||
$p->parse('rows','row_empty',True);
|
||||
}
|
||||
else
|
||||
{
|
||||
$p->set_var('submit_extra',' width="5%"');
|
||||
while (list(,$value) = each($locales))
|
||||
{
|
||||
$tr_color = $GLOBALS['egw']->nextmatchs->alternate_row_color($tr_color);
|
||||
if (! $value) $value = ' ';
|
||||
|
||||
$var = Array(
|
||||
'tr_color' => $tr_color,
|
||||
'group_name' => $value,
|
||||
'edit_link' => '<a href="'.$GLOBALS['egw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.edit_locale','locale'=>$value)) . '"> '.lang('Edit').' </a>',
|
||||
'delete_link' => '<a href="'.$GLOBALS['egw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.delete_locale','locale'=>$value)).'"> '.lang('Delete').' </a>',
|
||||
'extra_link' => '<a href="'.$GLOBALS['egw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.submit','locale'=>$value)).'"> '.lang('Submit').' </a>'.
|
||||
' <a href="'.$GLOBALS['egw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.submit','locale'=>$value,'download'=>1)).'"> '.lang('Download').' </a>'
|
||||
);
|
||||
$p->set_var($var);
|
||||
$p->parse('rows','row',True);
|
||||
}
|
||||
}
|
||||
|
||||
$var = Array(
|
||||
'new_action' => $GLOBALS['egw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.edit_holiday','id'=>0)),
|
||||
'lang_add' => lang('add'),
|
||||
'search_action' => $GLOBALS['egw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.admin')),
|
||||
'lang_search' => lang('search')
|
||||
);
|
||||
|
||||
$p->set_var($var);
|
||||
$p->pparse('out','list');
|
||||
}
|
||||
|
||||
function edit_locale($locale='')
|
||||
{
|
||||
if ($locale === '')
|
||||
{
|
||||
$locale = $this->bo->locale;
|
||||
}
|
||||
if ($locale)
|
||||
{
|
||||
$this->bo->locales = array($locale);
|
||||
$this->bo->total = $this->bo->so->holiday_total($locale,$this->bo->query);
|
||||
}
|
||||
if(!$this->bo->total && !isset($this->bo->query))
|
||||
{
|
||||
$link_params = Array(
|
||||
'menuaction' => 'calendar.uiholiday.admin'
|
||||
);
|
||||
$GLOBALS['egw']->redirect_link($this->base_url,$link_params);
|
||||
}
|
||||
unset($GLOBALS['egw_info']['flags']['noheader']);
|
||||
unset($GLOBALS['egw_info']['flags']['nonavbar']);
|
||||
$GLOBALS['egw_info']['flags']['noappfooter'] = True;
|
||||
$GLOBALS['egw']->framework->header();
|
||||
$p =& $GLOBALS['egw']->template;
|
||||
$p->set_file(Array('locale'=>'locales.tpl'));
|
||||
$p->set_block('locale','list','list');
|
||||
$p->set_block('locale','row','row');
|
||||
$p->set_block('locale','row_empty','row_empty');
|
||||
$p->set_block('locale','back_button_form','back_button_form');
|
||||
|
||||
$year_form = str_replace('<option value=""></option>','',Api\Html::form(Api\Html::sbox_submit($this->sb->getYears('year',$this->bo->year),true),array(),
|
||||
$this->base_url,Array('menuaction'=>'calendar.uiholiday.edit_locale','locale'=>$this->bo->locales[0])));
|
||||
|
||||
$holidays = $this->bo->get_holiday_list();
|
||||
$total = count($holidays);
|
||||
|
||||
$var = Array(
|
||||
'th_bg' => $GLOBALS['egw_info']['theme']['th_bg'],
|
||||
'left_next_matchs' => $GLOBALS['egw']->nextmatchs->left('/index.php',$this->bo->start,$total,'&menuaction=calendar.uiholiday.edit_locale&locale='.$this->bo->locales[0].'&year='.$this->bo->year),
|
||||
'right_next_matchs' => $GLOBALS['egw']->nextmatchs->right('/index.php',$this->bo->start,$total,'&menuaction=calendar.uiholiday.edit_locale&locale='.$this->bo->locales[0].'&year='.$this->bo->year),
|
||||
'center' => '<td align="right">'.lang('Holidays').' ('.$this->bo->locales[0].')</td><td align="left">'.$year_form.'</td>',
|
||||
'sort_name' => $GLOBALS['egw']->nextmatchs->show_sort_order($this->bo->sort,'hol_name',$this->bo->order,'/index.php',lang('Holiday'),'&menuaction=calendar.uiholiday.edit_locale&locale='.$this->bo->locales[0].'&year='.$this->bo->year),
|
||||
'header_edit' => lang('Edit'),
|
||||
'header_delete' => lang('Delete'),
|
||||
'header_rule' => '<td>'.$GLOBALS['egw']->nextmatchs->show_sort_order($this->bo->sort,'hol_month_num,hol_mday',$this->bo->order,'/index.php',lang('Rule'),'&menuaction=calendar.uiholiday.edit_locale&locale='.$this->bo->locales[0].'&year='.$this->bo->year).'</td>',
|
||||
'header_extra' => lang('Copy'),
|
||||
'extra_width' => 'width="5%"'
|
||||
);
|
||||
|
||||
$p->set_var($var);
|
||||
|
||||
if (!count($holidays))
|
||||
{
|
||||
$p->set_var('total',lang('no matches found'));
|
||||
//$p->parse('rows','row_empty',True);
|
||||
}
|
||||
else
|
||||
{
|
||||
$maxmatchs = $GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs'];
|
||||
$end = min($total,$this->bo->start+$maxmatchs);
|
||||
$p->set_var('total',lang('showing %1 - %2 of %3',1+$this->bo->start,$end,$total));
|
||||
//$p->parse('rows','row_empty',True);
|
||||
for($i=$this->bo->start; $i < $end; $i++)
|
||||
{
|
||||
$tr_color = $GLOBALS['egw']->nextmatchs->alternate_row_color($tr_color);
|
||||
if (!$holidays[$i]['name'])
|
||||
{
|
||||
$holidays[$i]['name'] = ' ';
|
||||
}
|
||||
|
||||
$var = Array(
|
||||
'tr_color' => $tr_color,
|
||||
'header_delete'=> lang('Delete'),
|
||||
'group_name' => $holidays[$i]['name'],
|
||||
'rule' => '<td>'.$this->bo->rule_string($holidays[$i]).'</td>',
|
||||
'edit_link' => '<a href="'.$GLOBALS['egw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.edit_holiday','locale'=>$this->bo->locales[0],'id'=>$holidays[$i]['index'],'year'=>$this->bo->year)).'"> '.lang('Edit').' </a>',
|
||||
'extra_link' => '<a href="'.$GLOBALS['egw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.copy_holiday','locale'=>$this->bo->locales[0],'id'=>$holidays[$i]['index'],'year'=>$this->bo->year)).'"> '.lang('Copy').' </a>',
|
||||
'delete_link' => '<a href="'.$GLOBALS['egw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.delete_holiday','locale'=>$this->bo->locales[0],'id'=>$holidays[$i]['index'],'year'=>$this->bo->year)).'"> '.lang('Delete').' </a>'
|
||||
);
|
||||
|
||||
$p->set_var($var);
|
||||
$p->parse('rows','row',True);
|
||||
}
|
||||
}
|
||||
|
||||
$var = Array(
|
||||
'new_action' => $GLOBALS['egw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.edit_holiday','locale'=>$this->bo->locales[0],'id'=>0,'year'=>$this->bo->year)),
|
||||
'lang_add' => lang('add'),
|
||||
'back_action' => $GLOBALS['egw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.admin')),
|
||||
'lang_back' => lang('Back'),
|
||||
'search_action'=> $GLOBALS['egw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.edit_locale','locale'=>$this->bo->locales[0],'year'=>$this->bo->year)),
|
||||
'lang_search' => lang('search')
|
||||
);
|
||||
$p->set_var($var);
|
||||
$p->parse('back_button','back_button_form',False);
|
||||
$p->pparse('out','list');
|
||||
}
|
||||
|
||||
function copy_holiday()
|
||||
{
|
||||
if(@$this->bo->id)
|
||||
{
|
||||
$holiday = $this->bo->read_entry($this->bo->id);
|
||||
}
|
||||
$this->bo->id = 0;
|
||||
|
||||
if (!$holiday['occurence'] || $holiday['occurence'] >= 1900)
|
||||
{
|
||||
$holiday['occurence'] = date('Y');
|
||||
}
|
||||
$this->edit_holiday('',$holiday);
|
||||
}
|
||||
|
||||
function edit_holiday($error='',$holiday='')
|
||||
{
|
||||
if(@$this->bo->id && !$holiday)
|
||||
{
|
||||
$holiday = $this->bo->read_entry($this->bo->id);
|
||||
}
|
||||
if ($this->bo->locale)
|
||||
{
|
||||
$holiday['locale'] = $this->bo->locale;
|
||||
}
|
||||
unset($GLOBALS['egw_info']['flags']['noheader']);
|
||||
unset($GLOBALS['egw_info']['flags']['nonavbar']);
|
||||
$GLOBALS['egw_info']['flags']['noappfooter'] = True;
|
||||
$GLOBALS['egw_info']['flags']['app_header'] = $GLOBALS['egw_info']['apps']['calendar']['title'].' - '.($this->bo->id ? lang('Edit') : lang('Add')).' '.lang('Holiday');
|
||||
$GLOBALS['egw']->framework->header();
|
||||
|
||||
$t = &$GLOBALS['egw']->template;
|
||||
$t->set_file(Array('holiday'=>'holiday.tpl','form_button'=>'form_button_script.tpl'));
|
||||
$t->set_block('holiday','form','form');
|
||||
$t->set_block('holiday','list','list');
|
||||
|
||||
if (@count($error))
|
||||
{
|
||||
$message = common::error_list($error);
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = '';
|
||||
}
|
||||
|
||||
$var = Array(
|
||||
'title_holiday' => ($this->bo->id ? lang('Edit') : lang('Add')).' '.lang('Holiday'),
|
||||
'message' => $message,
|
||||
'actionurl' => $GLOBALS['egw']->link($this->base_url,'menuaction=calendar.boholiday.add&year='.$this->bo->year),
|
||||
'hidden_vars' => '<input type="hidden" name="holiday[hol_id]" value="'.$this->bo->id.'">'."\n"
|
||||
. '<input type="hidden" name="holiday[locales]" value="'.$this->bo->locales[0].'">'."\n"
|
||||
);
|
||||
$t->set_var($var);
|
||||
|
||||
// Locale
|
||||
$this->display_item($t,lang('Country'),$this->sb->form_select($holiday['locale'],'holiday[locale]'));
|
||||
|
||||
// Title/Name
|
||||
$this->display_item($t,lang('title'),'<input name="holiday[name]" size="60" maxlength="50" value="'.$holiday['name'].'">');
|
||||
|
||||
// Date
|
||||
$this->display_item($t,lang('Date'),common::dateformatorder($this->sb->getYears('holiday[year]',$holiday['occurence']>1900?$holiday['occurence']:0),$this->sb->getMonthText('holiday[month_num]',$holiday['month']),$this->sb->getDays('holiday[mday]',$holiday['day'])).
|
||||
' '.lang('Set a Year only for one-time / non-regular holidays.'));
|
||||
|
||||
// Occurence
|
||||
$occur = Array(
|
||||
0 => '',
|
||||
1 => '1.',
|
||||
2 => '2.',
|
||||
3 => '3.',
|
||||
4 => '4.',
|
||||
5 => '5.',
|
||||
99 => lang('Last')
|
||||
);
|
||||
$out = '';
|
||||
while(list($key,$value) = each($occur))
|
||||
{
|
||||
$out .= '<option value="'.$key.'"'.($holiday['occurence']==$key?' selected':'').'>'.$value.'</option>'."\n";
|
||||
}
|
||||
$occurence_html = '<select name="holiday[occurence]">'."\n".$out.'</select>'."\n";
|
||||
|
||||
$dow = Array(
|
||||
0 => lang('Sun'),
|
||||
1 => lang('Mon'),
|
||||
2 => lang('Tue'),
|
||||
3 => lang('Wed'),
|
||||
4 => lang('Thu'),
|
||||
5 => lang('Fri'),
|
||||
6 => lang('Sat')
|
||||
);
|
||||
$out = '';
|
||||
for($i=0;$i<7;$i++)
|
||||
{
|
||||
$out .= '<option value="'.$i.'"'.($holiday['dow']==$i?' selected':'').'>'.$dow[$i].'</option>'."\n";
|
||||
}
|
||||
$dow_html = '<select name="holiday[dow]">'."\n".$out.'</select>'."\n";
|
||||
$this->display_item($t,lang('Occurence'),$occurence_html.' '.$dow_html.
|
||||
' '.lang('You can either set a Year or a Occurence, not both !!!'));
|
||||
$this->display_item($t,lang('Observance Rule'),'<input type="checkbox" name="holiday[observance_rule]" value="True"'.($holiday['observance_rule']?' checked':'').'>'.
|
||||
' '.lang('If checked holidays falling on a weekend, are taken on the monday after.'));
|
||||
|
||||
$t->set_var('lang_add',lang('Save'));
|
||||
$t->set_var('lang_reset',lang('Reset'));
|
||||
|
||||
if(@$this->bo->locales[0])
|
||||
{
|
||||
$link_params = Array(
|
||||
'menuaction' => 'calendar.uiholiday.edit_locale',
|
||||
'year' => $this->bo->year,
|
||||
'locale' => $this->bo->locales[0]
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$link_params = Array(
|
||||
'menuaction' => 'calendar.uiholiday.admin'
|
||||
);
|
||||
}
|
||||
|
||||
$t->set_var(Array(
|
||||
'action_url_button' => $GLOBALS['egw']->link($this->base_url,$link_params),
|
||||
'action_text_button' => lang('Cancel'),
|
||||
'action_confirm_button' => '',
|
||||
'action_extra_field' => ''
|
||||
));
|
||||
$t->parse('cancel_button','form_button');
|
||||
|
||||
if ($this->bo->id)
|
||||
{
|
||||
$link_params = Array(
|
||||
'menuaction' => 'calendar.uiholiday.delete_holiday',
|
||||
'year' => $this->bo->year,
|
||||
'locale' => $this->bo->locales[0],
|
||||
'id' => $this->bo->id
|
||||
);
|
||||
$t->set_var(Array(
|
||||
'action_url_button' => $GLOBALS['egw']->link($this->base_url,$link_params),
|
||||
'action_text_button' => lang('Delete'),
|
||||
'action_confirm_button' => '',
|
||||
'action_extra_field' => ''
|
||||
));
|
||||
$t->parse('delete_button','form_button');
|
||||
}
|
||||
else
|
||||
{
|
||||
$t->set_var('delete_button',' ');
|
||||
}
|
||||
$t->pparse('out','form');
|
||||
}
|
||||
|
||||
|
||||
function delete_locale()
|
||||
{
|
||||
$this->admin();
|
||||
|
||||
$p =& CreateObject('phpgwapi.Template',$this->template_dir);
|
||||
$p->set_file(Array('form'=>'delete_common.tpl','form_button'=>'form_button_script.tpl'));
|
||||
|
||||
$p->set_var('messages',lang('Are you sure you want to delete this Country ?')."<br>".$this->bo->locales[0]);
|
||||
|
||||
$var = Array(
|
||||
'action_url_button' => $GLOBALS['egw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.admin')),
|
||||
'action_text_button' => lang('No'),
|
||||
'action_confirm_button' => '',
|
||||
'action_extra_field' => ''
|
||||
);
|
||||
$p->set_var($var);
|
||||
$p->parse('no','form_button');
|
||||
|
||||
$var = Array(
|
||||
'action_url_button' => $GLOBALS['egw']->link($this->base_url,Array('menuaction'=>'calendar.boholiday.delete_locale','locale'=>$this->bo->locales[0])),
|
||||
'action_text_button' => lang('Yes'),
|
||||
'action_confirm_button' => '',
|
||||
'action_extra_field' => ''
|
||||
);
|
||||
$p->set_var($var);
|
||||
$p->parse('yes','form_button');
|
||||
|
||||
$p->pparse('out','form');
|
||||
}
|
||||
|
||||
function delete_holiday()
|
||||
{
|
||||
$holiday = $this->bo->read_entry($this->bo->id);
|
||||
|
||||
if(!$holiday)
|
||||
{
|
||||
return $this->edit_locale();
|
||||
}
|
||||
|
||||
unset($GLOBALS['egw_info']['flags']['noheader']);
|
||||
unset($GLOBALS['egw_info']['flags']['nonavbar']);
|
||||
$GLOBALS['egw_info']['flags']['noappfooter'] = True;
|
||||
$GLOBALS['egw']->framework->header();
|
||||
|
||||
$p =& CreateObject('phpgwapi.Template',$this->template_dir);
|
||||
$p->set_file(Array('form'=>'delete_common.tpl','form_button'=>'form_button_script.tpl'));
|
||||
|
||||
$p->set_var('messages',lang('Are you sure you want to delete this holiday ?')."<br>".$holiday['name'].' ('.$this->bo->locales[0].') '.$this->bo->rule_string($holiday));
|
||||
|
||||
$var = Array(
|
||||
'action_url_button' => $GLOBALS['egw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.edit_locale','locale'=>$this->bo->locales[0],'year'=>$this->bo->year)),
|
||||
'action_text_button' => lang('No'),
|
||||
'action_confirm_button' => '',
|
||||
'action_extra_field' => ''
|
||||
);
|
||||
$p->set_var($var);
|
||||
$p->parse('no','form_button');
|
||||
|
||||
$var = Array(
|
||||
'action_url_button' => $GLOBALS['egw']->link($this->base_url,Array('menuaction'=>'calendar.boholiday.delete_holiday','locale'=>$this->bo->locales[0],'id'=>$this->bo->id,'year'=>$this->bo->year)),
|
||||
'action_text_button' => lang('Yes'),
|
||||
'action_confirm_button' => '',
|
||||
'action_extra_field' => ''
|
||||
);
|
||||
$p->set_var($var);
|
||||
$p->parse('yes','form_button');
|
||||
|
||||
$p->pparse('out','form');
|
||||
}
|
||||
|
||||
function submit()
|
||||
{
|
||||
if(!@$this->bo->locales[0])
|
||||
{
|
||||
return $this->admin();
|
||||
}
|
||||
$this->bo->year = 0; // for a complete list with all years
|
||||
$holidays = $this->bo->get_holiday_list();
|
||||
|
||||
if (!is_array($holidays) || !count($holidays))
|
||||
{
|
||||
$this->admin();
|
||||
}
|
||||
// sort holidays by year / occurence:
|
||||
usort($holidays,'_holiday_cmp');
|
||||
|
||||
if (isset($_GET['download']))
|
||||
{
|
||||
$locale = $this->bo->locales[0];
|
||||
Api\Header\Content::type("holidays.$locale.csv",'text/text');
|
||||
|
||||
echo "charset\t".Api\Translation::charset()."\n";
|
||||
$last_year = -1;
|
||||
foreach($holidays as $holiday)
|
||||
{
|
||||
$year = $holiday['occurence'] <= 0 ? 0 : $holiday['occurence'];
|
||||
if ($year != $last_year)
|
||||
{
|
||||
echo "\n".($year ? $year : 'regular (year=0)').":\n";
|
||||
$last_year = $year;
|
||||
}
|
||||
echo "$locale\t$holiday[name]\t$holiday[day]\t$holiday[month]\t$holiday[occurence]\t$holiday[dow]\t$holiday[observance_rule]\n";
|
||||
}
|
||||
exit();
|
||||
}
|
||||
if($this->debug)
|
||||
{
|
||||
$action = $GLOBALS['egw']->link('/calendar/egroupware.org/accept_holiday.php');
|
||||
}
|
||||
else
|
||||
{
|
||||
$action = 'http://www.egroupware.org/cal/accept_holiday.php';
|
||||
}
|
||||
$GLOBALS['egw_info']['flags']['noappheader'] = True;
|
||||
$GLOBALS['egw_info']['flags']['noappfooter'] = True;
|
||||
$GLOBALS['egw_info']['flags']['nofooter'] = True;
|
||||
$GLOBALS['egw']->framework->header();
|
||||
|
||||
echo '<body onLoad="document.submitform.submit()">'."\n";
|
||||
echo '<form action="'.$action.'" method="post" name="submitform">'."\n";
|
||||
|
||||
echo '<input type="hidden" name="locale" value="'.$this->bo->locales[0].'">'."\n";
|
||||
echo '<input type="hidden" name="charset" value="'.Api\Translation::charset().'">'."\n";
|
||||
foreach($holidays as $holiday)
|
||||
{
|
||||
echo '<input type="hidden" name="name[]" value="'.htmlspecialchars($holiday['name']).'">'."\n"
|
||||
. '<input type="hidden" name="day[]" value="'.$holiday['day'].'">'."\n"
|
||||
. '<input type="hidden" name="month[]" value="'.$holiday['month'].'">'."\n"
|
||||
. '<input type="hidden" name="occurence[]" value="'.$holiday['occurence'].'">'."\n"
|
||||
. '<input type="hidden" name="dow[]" value="'.$holiday['dow'].'">'."\n"
|
||||
. '<input type="hidden" name="observance[]" value="'.$holiday['observance_rule'].'">'."\n\n";
|
||||
}
|
||||
echo "</form>\n</body>\n</head>";
|
||||
}
|
||||
|
||||
/* private functions */
|
||||
function display_item(&$p,$field,$data)
|
||||
{
|
||||
$var = Array(
|
||||
'tr_color' => $GLOBALS['egw']->nextmatchs->alternate_row_color(),
|
||||
'field' => $field,
|
||||
'data' => $data
|
||||
);
|
||||
$p->set_var($var);
|
||||
$p->parse('rows','list',True);
|
||||
}
|
||||
}
|
@ -12,9 +12,9 @@
|
||||
%s the event calendar de %s dem Termin
|
||||
(%1 events in %2 seconds) calendar de (%1 Termine in %2 Sekunden
|
||||
(empty = use global limit, no = no export at all) admin de (leer = globale Begrenzung verwenden, nein = gar kein Export)
|
||||
(without a custom url we use nation of user preference to load holidays from %s) calendar de (Ohne eine eigene URL laden wir die Feiertage entsprechen des Landes in den Benutzereinstellung aus den %s)
|
||||
, exceptions preserved calendar de und Ausnahmen erhalten
|
||||
, stati of participants reset calendar de , Status der Teilnehmer zurückgesetzt
|
||||
<b>please note</b>: the calendar use the holidays of your country, which is set to %1. you can change it in your %2.<br />holidays are %3 automatic installed from %4. you can changed it in %5. calendar de <b>Bitte beachten</b>: Der Kalender verwendet die Feiertages des Landes, welches auf %1 eingestellt ist. Das können Sie in Ihren %2 ändern.<br />Feiertage werden %3 automatisch von %4 installiert, was in %5 änderbar ist.
|
||||
a non blocking event will not conflict with other events calendar de Ein nicht blockierender Termin ergibt keine Konflikt mit anderen Terminen
|
||||
accept calendar de Zusagen
|
||||
accept or reject an invitation calendar de Einladung zu- oder absagen
|
||||
@ -55,8 +55,6 @@ always calendar de Immer
|
||||
apply the action on the whole query, not only the shown events calendar de Befehl auf die gesamte Abfrage anwenden, NICHT nur auf die angezeigten Termine
|
||||
apply the changes calendar de Übernimmt die Änderungen
|
||||
appointment settings calendar de Einstellungen der Terminverwaltung
|
||||
are you sure you want to delete this country ? calendar de Sind Sie sicher, dass Sie dieses Land löschen möchten?
|
||||
are you sure you want to delete this holiday ? calendar de Sind Sie sicher, dass Sie diesen Feiertag löschen möchten?
|
||||
as an alternative you can %1download a mysql dump%2 and import it manually into egw_cal_timezones table. calendar de Als Alternative können Sie auch einen %1MySQL Dump herunterladen%2 und diesen von Hand in die Datenbank Tabelle egw_cal_timezones importieren.
|
||||
automatically purge old events after admin de Bereinigt bzw. löscht alte Termine automatisch nach
|
||||
back half a month calendar de einen halben Monat zurück
|
||||
@ -79,7 +77,6 @@ calendar csv export calendar de Kalender CSV Export
|
||||
calendar csv import calendar de Kalender CSV Import
|
||||
calendar event calendar de Kalender Aktualisierung
|
||||
calendar fields: calendar de Kalender Felder:
|
||||
calendar holiday management admin de Feiertage verwalten
|
||||
calendar ical export calendar de Kalender iCal Export
|
||||
calendar ical import calendar de Kalender iCal Import
|
||||
calendar id calendar de Kalender ID
|
||||
@ -120,6 +117,7 @@ csv-fieldname calendar de CSV-Feldname
|
||||
csv-filename calendar de CSV-Dateiname
|
||||
custom calendar de Benutzerdefiniert
|
||||
custom fields common de Benutzerdefinierte Felder
|
||||
custom url for ical with holidays for all users calendar de Eigene URL für iCal-Datei mit Feiertagen für alle Benutzer
|
||||
custom_2 common de frei / besetzt
|
||||
daily calendar de Täglich
|
||||
daily tables calendar de Tabellen für tägliche Einträge
|
||||
@ -169,7 +167,6 @@ do you want to be notified about new or changed appointments? you be notified ab
|
||||
do you want to edit this event as an exception or the whole series? calendar de Wollen Sie diesen Termin als Ausnahme bearbeiten oder die ganze Serie?
|
||||
do you want to keep the series exceptions in your calendar? calendar de Wollen Sie die Ausnahmen dieses Serientermins in Ihrem Kalender behalten?
|
||||
do you want to receive a regulary summary of your appointsments via email?<br>the summary is sent to your standard email-address on the morning of that day or on monday for weekly summarys.<br>it is only sent when you have any appointments on that day or week. calendar de Möchten Sie eine regelmäßige Zusammenfassung Ihrer Termine via E-Mail erhalten?<br>Die Zusammenfassung wird täglich (jeden Morgen), oder für eine wöchentliche Zusammenfassung Montags an Ihre Standard E-Mail Adresse gesendet.<br> Die Benachrichtigung wird nur versendet, wenn Sie am nächsten Tag oder in der nächsten Woche auch einen Termin haben.
|
||||
do you wish to autoload calendar holidays files dynamically? admin de Sollen die Feiertage automatisch geladen werden?
|
||||
download calendar de Herunterladen
|
||||
download this event as ical calendar de Termin als iCal herunterladen
|
||||
duration calendar de Dauer
|
||||
@ -264,7 +261,6 @@ high priority calendar de Hohe Priorität
|
||||
history calendar de Historie
|
||||
history logging admin de Protokollierung der Historie
|
||||
holiday calendar de Feiertag
|
||||
holiday management calendar de Feiertagsverwaltung
|
||||
holidays calendar de Feiertage
|
||||
holidays only calendar de Nur Feiertage
|
||||
hours calendar de Stunden
|
||||
@ -281,7 +277,6 @@ ical export calendar de iCal Export
|
||||
ical file calendar de iCal Datei
|
||||
ical import calendar de iCal Import
|
||||
ical successful imported calendar de iCal erfolgreich importiert
|
||||
if checked holidays falling on a weekend, are taken on the monday after. calendar de Wenn ausgewählt werden Feiertage die auf ein Wochenende fallen, am drauf folgenden Montag nachgeholt.
|
||||
if start day differs calendar de Wenn die Starttage abweichen
|
||||
if you dont set a password here, the information is available to everyone, who knows the url!!! calendar de Wenn Sie hier kein Passwort angeben, ist die Information für jeden verfügbar, der die Adresse (URL) kennt!!!
|
||||
if you select a range (month, week, etc) instead of a list of entries, these extra fields are available calendar de Falls Sie einen Bereich (Monat, Woche, Tag) anstatt einer Liste von Einträge ausgewählt haben, können Sie folgende Platzhalter für Ihre Felder definieren.
|
||||
@ -318,7 +313,6 @@ links, attachments calendar de Verknüpfungen, Datei-Anhänge
|
||||
list of files linked to the current record calendar de Liste der Dokumente, die zum aktuellen Datensatz gehören.
|
||||
listview calendar de Listenansicht
|
||||
location calendar de Ort
|
||||
location to autoload from admin de Von wo sollen sie geladen werden
|
||||
location, start- and endtimes, ... calendar de Ort, Start- und Endzeiten
|
||||
mail all participants calendar de Mail an alle Teilnehmer
|
||||
make freebusy information available to not loged in persons? calendar de Die freien/nicht verfügbaren Zeiten für nicht angemeldete Personen sichtbar machen?
|
||||
@ -459,7 +453,6 @@ select who should get the alarm calendar de Auswählen wer den Alarm erhalten so
|
||||
selected range calendar de Ausgewählter Zeitraum
|
||||
send meetingrequest to all participants after the event is saved calendar de Terminanforderung an alle Teilnehmer senden nachdem der Termin gespeichert wurde
|
||||
series deleted calendar de Serientermin wurde gelöscht
|
||||
set a year only for one-time / non-regular holidays. calendar de Nur für einmalige bzw. unregelmäßige Feiertage das Jahr angeben.
|
||||
set new events to private calendar de Neue Termine als private Termine eintragen
|
||||
setting lock time calender admin de Zeitintervall für Datensatzlock (Voreinstellung beträgt eine Sekunde)
|
||||
shall the date parameter be accepted (e.g. from calendar module)? calendar de Soll der Parameter Datum akzeptiert werden (z.B. vom Kalender Modul)?
|
||||
|
@ -12,9 +12,9 @@
|
||||
%s the event calendar en %s the event
|
||||
(%1 events in %2 seconds) calendar en (%1 events in %2 seconds)
|
||||
(empty = use global limit, no = no export at all) admin en (empty = use global limit, no = no export at all)
|
||||
(without a custom url we use nation of user preference to load holidays from %s) calendar en (Without a custom URL we use nation of user preference to load holidays from %s)
|
||||
, exceptions preserved calendar en , exceptions preserved
|
||||
, stati of participants reset calendar en , status of participants reset
|
||||
<b>please note</b>: the calendar use the holidays of your country, which is set to %1. you can change it in your %2.<br />holidays are %3 automatic installed from %4. you can changed it in %5. calendar en <b>Please note</b>: The calendar use the holidays of your country, which is set to %1. You can change it in your %2.<br />Holidays are %3 automatic installed from %4. You can change it in %5.
|
||||
a non blocking event will not conflict with other events calendar en A non blocking event will not conflict with other events
|
||||
accept calendar en Accept
|
||||
accept or reject an invitation calendar en Accept or reject an invitation
|
||||
@ -55,8 +55,6 @@ always calendar en Always
|
||||
apply the action on the whole query, not only the shown events calendar en Apply the action on the whole query, NOT only the shown events.
|
||||
apply the changes calendar en Apply the changes
|
||||
appointment settings calendar en Appointment settings
|
||||
are you sure you want to delete this country ? calendar en Are you sure you want to delete this country?
|
||||
are you sure you want to delete this holiday ? calendar en Are you sure you want to delete this holiday?
|
||||
as an alternative you can %1download a mysql dump%2 and import it manually into egw_cal_timezones table. calendar en As an alternative you can %1download a MySQL dump%2 and import it manually into egw_cal_timezones table.
|
||||
automatically purge old events after admin en Automatically purge old events after
|
||||
back half a month calendar en Back half a month
|
||||
@ -79,7 +77,6 @@ calendar csv export calendar en Calendar CSV export
|
||||
calendar csv import calendar en Calendar CSV import
|
||||
calendar event calendar en Calendar event
|
||||
calendar fields: calendar en Calendar fields:
|
||||
calendar holiday management admin en Calendar holiday management
|
||||
calendar ical export calendar en Calendar iCal export
|
||||
calendar ical import calendar en Calendar iCal import
|
||||
calendar id calendar en Calendar ID
|
||||
@ -120,6 +117,7 @@ csv-fieldname calendar en CSV field name
|
||||
csv-filename calendar en CSV file name
|
||||
custom calendar en Custom
|
||||
custom fields common en Custom fields
|
||||
custom url for ical with holidays for all users calendar en Custom URL for iCal with holidays for all users
|
||||
custom_2 common en Free/Busy
|
||||
daily calendar en Daily
|
||||
daily tables calendar en Daily tables
|
||||
@ -169,7 +167,6 @@ do you want to be notified about new or changed appointments? you be notified ab
|
||||
do you want to edit this event as an exception or the whole series? calendar en Do you want to edit this event as an exception or the whole series?
|
||||
do you want to keep the series exceptions in your calendar? calendar en Do you want to keep the series exceptions in your calendar?
|
||||
do you want to receive a regulary summary of your appointsments via email?<br>the summary is sent to your standard email-address on the morning of that day or on monday for weekly summarys.<br>it is only sent when you have any appointments on that day or week. calendar en Do you want to receive regularly a summary of your appointments via email?<br>The summary is sent to your standard email-address on the morning of that day or on Monday for weekly summaries.<br>It is only sent when you have any appointments on that day or week.
|
||||
do you wish to autoload calendar holidays files dynamically? admin en Do you wish to auto-load calendar holidays files dynamically?
|
||||
download calendar en Download
|
||||
download this event as ical calendar en Download this event as iCal
|
||||
duration calendar en Duration
|
||||
@ -264,7 +261,6 @@ high priority calendar en High priority
|
||||
history calendar en History
|
||||
history logging admin en History logging
|
||||
holiday calendar en Holiday
|
||||
holiday management calendar en Holiday management
|
||||
holidays calendar en Holidays
|
||||
holidays only calendar en Holidays only
|
||||
hours calendar en hours
|
||||
@ -281,7 +277,6 @@ ical export calendar en iCal export
|
||||
ical file calendar en iCal file
|
||||
ical import calendar en iCal import
|
||||
ical successful imported calendar en iCal successful imported.
|
||||
if checked holidays falling on a weekend, are taken on the monday after. calendar en If checked holidays are falling on a weekend, they are taken on the Monday after.
|
||||
if start day differs calendar en If start day differs
|
||||
if you dont set a password here, the information is available to everyone, who knows the url!!! calendar en If you don't set a password here, the information is available to everyone, who knows the URL!
|
||||
if you select a range (month, week, etc) instead of a list of entries, these extra fields are available calendar en If you select a range (month, week, etc) instead of a list of entries, these extra fields are available.
|
||||
@ -318,7 +313,6 @@ links, attachments calendar en Links, Attachments
|
||||
list of files linked to the current record calendar en List of files linked to the current record
|
||||
listview calendar en List view
|
||||
location calendar en Location
|
||||
location to autoload from admin en Location to autoload from
|
||||
location, start- and endtimes, ... calendar en Location, start and end times, ...
|
||||
mail all participants calendar en Mail all participants
|
||||
make freebusy information available to not loged in persons? calendar en Make Free/Busy information available to not logged in persons
|
||||
@ -460,7 +454,6 @@ select who should get the alarm calendar en Select who should get the alarm
|
||||
selected range calendar en Selected range
|
||||
send meetingrequest to all participants after the event is saved calendar en Send meetingrequest to all participants after the event is saved
|
||||
series deleted calendar en Series deleted
|
||||
set a year only for one-time / non-regular holidays. calendar en Set a year only for one time / non regular holidays.
|
||||
set new events to private calendar en Set new events to private
|
||||
setting lock time calender admin en Setting data lock time for Calendar (default 1 sec.)
|
||||
shall the date parameter be accepted (e.g. from calendar module)? calendar en Shall the date parameter be accepted, e.g. from calendar module?
|
||||
|
72
calendar/setup/ical_holiday_urls.json
Normal file
72
calendar/setup/ical_holiday_urls.json
Normal file
@ -0,0 +1,72 @@
|
||||
{
|
||||
"_origin": "https://www.mozilla.org/en-US/projects/calendar/holidays/",
|
||||
"DZ": "https://www.mozilla.org/media/caldata/AlgeriaHolidays.ics",
|
||||
"AR": "https://www.mozilla.org/media/caldata/ArgentinaHolidays.ics",
|
||||
"AU": "https://www.mozilla.org/media/caldata/AustraliaHolidays.ics",
|
||||
"AT": "https://www.mozilla.org/media/caldata/AustrianHolidays.ics",
|
||||
"BE": "https://www.mozilla.org/media/caldata/BelgianHolidays.ics",
|
||||
"BO": "https://www.mozilla.org/media/caldata/BoliviaHolidays.ics",
|
||||
"BR": "https://www.mozilla.org/media/caldata/BrazilHolidays.ics",
|
||||
"BG": "https://www.mozilla.org/media/caldata/BulgarianHolidays.ics",
|
||||
"CA": "https://www.mozilla.org/media/caldata/CanadaHolidays.ics",
|
||||
"CL": "https://www.mozilla.org/media/caldata/ChileHolidays.ics",
|
||||
"CN": "https://www.mozilla.org/media/caldata/ChinaHolidays.ics",
|
||||
"CO": "https://www.mozilla.org/media/caldata/ColombianHolidays.ics",
|
||||
"CR": "https://www.mozilla.org/media/caldata/CostaRicaHolidays.ics",
|
||||
"HR": "https://www.mozilla.org/media/caldata/CroatiaHolidays.ics",
|
||||
"CZ": "https://www.mozilla.org/media/caldata/CzechHolidays.ics",
|
||||
"DK": "https://www.mozilla.org/media/caldata/DanishHolidays.ics",
|
||||
"DO": "https://www.mozilla.org/media/caldata/DominicanRepublicSpanish.ics",
|
||||
"EE": "https://www.mozilla.org/media/caldata/EstoniaHolidays.ics",
|
||||
"FI": "https://www.mozilla.org/media/caldata/FinlandHolidays.ics",
|
||||
"FR": "https://www.mozilla.org/media/caldata/FrenchHolidays.ics",
|
||||
"DE": "https://www.mozilla.org/media/caldata/GermanHolidays.ics",
|
||||
"GR": "https://www.mozilla.org/media/caldata/GreeceHolidays.ics",
|
||||
"GY": "https://www.mozilla.org/media/caldata/GuyanaHolidays.ics",
|
||||
"HT": "https://www.mozilla.org/media/caldata/HaitiHolidays.ics",
|
||||
"HK": "https://www.mozilla.org/media/caldata/HongKongHolidays.ics",
|
||||
"HU": "https://www.mozilla.org/media/caldata/HungarianHolidays.ics",
|
||||
"IS": "https://www.mozilla.org/media/caldata/IcelandHolidays.ics",
|
||||
"IN": "https://www.mozilla.org/media/caldata/IndiaHolidays.ics",
|
||||
"ID": "https://www.mozilla.org/media/caldata/IndonesianHolidays.ics",
|
||||
"IR": "https://www.mozilla.org/media/caldata/IranHolidays_Persian.ics",
|
||||
"IE": "https://www.mozilla.org/media/caldata/IrelandHolidays2014-2021.ics",
|
||||
"IT": "https://www.mozilla.org/media/caldata/ItalianHolidays.ics",
|
||||
"JP": "https://www.mozilla.org/media/caldata/JapanHolidays.ics",
|
||||
"KZ": "https://www.mozilla.org/media/caldata/KazakhstanHolidaysRussian.ics",
|
||||
"KE": "https://www.mozilla.org/media/caldata/KenyaHolidays.ics",
|
||||
"KR": "https://www.mozilla.org/media/caldata/SouthKoreaHolidays.ics",
|
||||
"LV": "https://www.mozilla.org/media/caldata/LatviaHolidays.ics",
|
||||
"LI": "https://www.mozilla.org/media/caldata/LiechtensteinHolidays.ics",
|
||||
"LT": "https://www.mozilla.org/media/caldata/LithuanianHolidays.ics",
|
||||
"LU": "https://www.mozilla.org/media/caldata/LuxembourgHolidays.ics",
|
||||
"MA": "https://www.mozilla.org/media/caldata/MoroccoHolidays.ics",
|
||||
"NL": "https://www.mozilla.org/media/caldata/DutchHolidays.ics",
|
||||
"NZ": "https://www.mozilla.org/media/caldata/NewZealandHolidays.ics",
|
||||
"NI": "https://www.mozilla.org/media/caldata/NicaraguaHolidays.ics",
|
||||
"NO": "https://www.mozilla.org/media/caldata/NorwegianHolidays.ics",
|
||||
"PK": "https://www.mozilla.org/media/caldata/PakistanHolidays.ics",
|
||||
"PE": "https://www.mozilla.org/media/caldata/PeruHolidays.ics",
|
||||
"PH": "https://www.mozilla.org/media/caldata/PhilippinesHolidays.ics",
|
||||
"PL": "https://www.mozilla.org/media/caldata/PolishHolidays.ics",
|
||||
"PT": "https://www.mozilla.org/media/caldata/PortugalHolidays.ics",
|
||||
"RO": "https://www.mozilla.org/media/caldata/RomaniaHolidays.ics",
|
||||
"RU": "https://www.mozilla.org/media/caldata/RussiaHolidays.ics",
|
||||
"SG": "https://www.mozilla.org/media/caldata/SingaporeHolidays.ics",
|
||||
"SK": "https://www.mozilla.org/media/caldata/SlovakHolidays.ics",
|
||||
"SI": "https://www.mozilla.org/media/caldata/SlovenianHolidays.ics",
|
||||
"ZA": "https://www.mozilla.org/media/caldata/SouthAfricaHolidays.ics",
|
||||
"ES": "https://www.mozilla.org/media/caldata/SpanishHolidays.ics",
|
||||
"LK": "https://www.mozilla.org/media/caldata/SriLankaHolidays.ics",
|
||||
"SE": "https://www.mozilla.org/media/caldata/SwedishHolidays.ics",
|
||||
"CH": "https://www.mozilla.org/media/caldata/SwissHolidays.ics",
|
||||
"TW": "https://www.mozilla.org/media/caldata/TaiwanHolidays.ics",
|
||||
"TH": "https://www.mozilla.org/media/caldata/ThaiHolidays.ics",
|
||||
"TT": "https://www.mozilla.org/media/caldata/TrinidadTobagoHolidays.ics.ics",
|
||||
"TR": "https://www.mozilla.org/media/caldata/TurkeyHolidays.ics",
|
||||
"UA": "https://www.mozilla.org/media/caldata/UkraineHolidays.ics",
|
||||
"GB": "https://www.mozilla.org/media/caldata/UKHolidays.ics",
|
||||
"US": "https://www.mozilla.org/media/caldata/USHolidays.ics",
|
||||
"UY": "https://www.mozilla.org/media/caldata/UruguayHolidays.ics",
|
||||
"VN": "https://www.mozilla.org/media/caldata/VietnamHolidays.ics"
|
||||
}
|
@ -10,7 +10,7 @@
|
||||
*/
|
||||
|
||||
$setup_info['calendar']['name'] = 'calendar';
|
||||
$setup_info['calendar']['version'] = '16.1';
|
||||
$setup_info['calendar']['version'] = '16.1.001';
|
||||
$setup_info['calendar']['app_order'] = 3;
|
||||
$setup_info['calendar']['enable'] = 1;
|
||||
$setup_info['calendar']['index'] = 'calendar.calendar_uiviews.index&ajax=true';
|
||||
@ -26,7 +26,6 @@ $setup_info['calendar']['author'] = $setup_info['calendar']['maintainer'] = arra
|
||||
);
|
||||
|
||||
$setup_info['calendar']['tables'][] = 'egw_cal';
|
||||
$setup_info['calendar']['tables'][] = 'egw_cal_holidays';
|
||||
$setup_info['calendar']['tables'][] = 'egw_cal_repeats';
|
||||
$setup_info['calendar']['tables'][] = 'egw_cal_user';
|
||||
$setup_info['calendar']['tables'][] = 'egw_cal_extra';
|
||||
|
@ -41,22 +41,6 @@ $phpgw_baseline = array(
|
||||
'ix' => array('cal_uid','cal_owner','cal_modified','cal_reference','cal_deleted','caldav_name'),
|
||||
'uc' => array()
|
||||
),
|
||||
'egw_cal_holidays' => array(
|
||||
'fd' => array(
|
||||
'hol_id' => array('type' => 'auto','nullable' => False),
|
||||
'hol_locale' => array('type' => 'char','precision' => '2','nullable' => False),
|
||||
'hol_name' => array('type' => 'varchar','precision' => '50','nullable' => False),
|
||||
'hol_mday' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'),
|
||||
'hol_month_num' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'),
|
||||
'hol_occurence' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'),
|
||||
'hol_dow' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'),
|
||||
'hol_observance_rule' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0')
|
||||
),
|
||||
'pk' => array('hol_id'),
|
||||
'fk' => array(),
|
||||
'ix' => array('hol_locale'),
|
||||
'uc' => array()
|
||||
),
|
||||
'egw_cal_repeats' => array(
|
||||
'fd' => array(
|
||||
'cal_id' => array('type' => 'int','precision' => '4','nullable' => False),
|
||||
|
@ -2715,3 +2715,11 @@ function calendar_upgrade14_3_903()
|
||||
{
|
||||
return $GLOBALS['setup_info']['calendar']['currentver'] = '16.1';
|
||||
}
|
||||
|
||||
|
||||
function calendar_upgrade16_1()
|
||||
{
|
||||
$GLOBALS['egw_setup']->oProc->DropTable('egw_cal_holidays');
|
||||
|
||||
return $GLOBALS['setup_info']['calendar']['currentver'] = '16.1.001';
|
||||
}
|
||||
|
@ -10,18 +10,11 @@
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<description value="Do you wish to autoload calendar holidays files dynamically?"/>
|
||||
<select id="newsettings[auto_load_holidays]">
|
||||
<option value="">No</option>
|
||||
<option value="True">Yes</option>
|
||||
</select>
|
||||
</row>
|
||||
<row>
|
||||
<description value="Location to autoload from" label="%s:"/>
|
||||
<select id="newsettings[holidays_url_path]">
|
||||
<option value="localhost">localhost</option>
|
||||
<option value="http://www.egroupware.org/cal">www.egroupware.org</option>
|
||||
</select>
|
||||
<vbox>
|
||||
<description value="Custom URL for iCal with holidays for all users" label="%s:"/>
|
||||
<description label="(Without a custom URL we use nation of user preference to load holidays from %s)" href="https://www.mozilla.org/en-US/projects/calendar/holidays/" value="Mozilla Holiday Calendars" extra_link_target="_blank"/>
|
||||
</vbox>
|
||||
<url id="newsettings[ical_holiday_url]" size="64"/>
|
||||
</row>
|
||||
<row>
|
||||
<description value="setting lock time calender" label="%s:"/>
|
||||
|
@ -1,72 +0,0 @@
|
||||
<!-- BEGIN filename -->
|
||||
<tr>
|
||||
<td>{lang_csvfile}</td>
|
||||
<td><input name="csvfile" SIZE=30 type="file" value="{csvfile}"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{lang_fieldsep}</td>
|
||||
<td><input name="fieldsep" size=1 value="{fieldsep}"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{lang_charset}</td>
|
||||
<td>
|
||||
{select_charset}
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td> </td>
|
||||
<td><input name="convert" type="submit" value="{submit}"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">{lang_help}</td>
|
||||
</tr>
|
||||
<!-- END filename -->
|
||||
|
||||
<!-- BEGIN fheader -->
|
||||
<tr>
|
||||
<td><b>{lang_csv_fieldname}</b></td>
|
||||
<td><b>{lang_info_fieldname}</b></td>
|
||||
<td><b>{lang_translation}</b></td>
|
||||
</tr>
|
||||
<!-- END fheader -->
|
||||
|
||||
<!-- BEGIN fields -->
|
||||
<tr>
|
||||
<td>{csv_field}</td>
|
||||
<td><select name="cal_fields[{csv_idx}]">{cal_fields}</select></td>
|
||||
<td><input name="trans[{csv_idx}]" size=60 value="{trans}"></td>
|
||||
</tr>
|
||||
<!-- END fields -->
|
||||
|
||||
<!-- BEGIN ffooter -->
|
||||
<tr>
|
||||
<td rowspan="2" valign="middle" nowrap><br>{submit}</td>
|
||||
<td colspan="2"><br>
|
||||
{lang_start} <input name="start" type="text" size="5" value="{start}">
|
||||
{lang_max} <input name="max" type="text" size="3" value="{max}"><td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><input name="debug" type="checkbox" value="1"{debug}> {lang_debug}</td>
|
||||
</tr>
|
||||
<tr><td colspan="3"> <p>
|
||||
{help_on_trans}
|
||||
</td></tr>
|
||||
<!-- END ffooter -->
|
||||
|
||||
<!-- BEGIN imported -->
|
||||
<tr>
|
||||
<td colspan=2 align=center>
|
||||
{log}<p>
|
||||
{anz_imported}
|
||||
</td>
|
||||
</tr>
|
||||
<!-- END imported -->
|
||||
|
||||
<!-- BEGIN import -->
|
||||
<br />
|
||||
<form {enctype} action="{action_url}" method="post">
|
||||
{hiddenvars}
|
||||
<table align="center">
|
||||
{rows}
|
||||
</table>
|
||||
</form>
|
||||
<!-- END import -->
|
@ -1,16 +0,0 @@
|
||||
<!-- BEGIN form -->
|
||||
<center>
|
||||
<table border="0" with="65%">
|
||||
<tr>
|
||||
<td colspan="2" align="center">
|
||||
{messages}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">{no}</td>
|
||||
<td align="center">{yes}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
<!-- END form -->
|
||||
|
@ -1,40 +0,0 @@
|
||||
<!-- BEGIN event_widget -->
|
||||
{indent}<div class="calendar_calEventHeader{Small}" style="background-color: {bordercolor}; color: {headercolor};">
|
||||
{indent} {header}
|
||||
{indent} <div class="calendar_calEventIcons">{icons}</div>
|
||||
{indent}</div>
|
||||
{indent}<div class="calendar_calEventBody{Small}">
|
||||
{indent} <p style="margin: 0px;">
|
||||
{indent} <span class="calendar_calEventTitle">{title}</span>
|
||||
{indent} <br>{bodydescription}
|
||||
{indent} </p>
|
||||
{indent}</div>
|
||||
<!-- END event_widget -->
|
||||
|
||||
<!-- BEGIN event_widget_wholeday_on_top -->
|
||||
{indent}<div class="calendar_calEventBody{Small}">
|
||||
{indent} {title}
|
||||
{indent}</div>
|
||||
<!-- END event_widget_wholeday_on_top -->
|
||||
|
||||
<!-- BEGIN event_tooltip -->
|
||||
<div class="calendar_calEventTooltip {status_class}" style="border-color: {bordercolor}; background: {bodybackground};">
|
||||
<div class="calendar_calEventHeaderSmall" style="background-color: {bordercolor};">
|
||||
<font color="{headercolor}">{timespan}</font>
|
||||
<div class="calendar_calEventIcons">{icons}</div>
|
||||
</div>
|
||||
<div class="calendar_calEventBodySmall">
|
||||
<p style="margin: 0px;">
|
||||
<span class="calendar_calEventTitle">{title}</span><br>
|
||||
{description}</p>
|
||||
<p style="margin: 2px 0px;">{times}
|
||||
{location}
|
||||
{category}
|
||||
{participants}</p>
|
||||
</div>
|
||||
</div>
|
||||
<!-- END event_tooltip -->
|
||||
|
||||
<!-- BEGIN planner_event -->
|
||||
{icons} {title}
|
||||
<!-- END planner_event -->
|
@ -1,12 +0,0 @@
|
||||
<!-- $Id$ -->
|
||||
|
||||
<!-- BEGIN form_button -->
|
||||
|
||||
<form action="{action_url_button}" method="post" name="{action_text_button}form">
|
||||
<div style="padding-right: 2px">
|
||||
{action_extra_field}
|
||||
<input style="font-size:10px" type="submit" value="{action_text_button}" {action_confirm_button}>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<!-- END form_button -->
|
@ -1,34 +0,0 @@
|
||||
<!-- $Id$ -->
|
||||
<!-- BEGIN form -->
|
||||
<center>
|
||||
{message}<br>
|
||||
<table border="0" width="80%" cellspacing="2" cellpadding="2">
|
||||
<form name="form" action="{actionurl}" method="POST">
|
||||
{hidden_vars}
|
||||
{rows}
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table width="100%" border="0" cellspacing="5">
|
||||
<tr>
|
||||
<td>
|
||||
<input type="submit" name="submit" value="{lang_add}"></form>
|
||||
</td>
|
||||
<td>
|
||||
{cancel_button}
|
||||
</td>
|
||||
<td align="right" width="80%">
|
||||
{delete_button}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
<!-- END form -->
|
||||
<!-- BEGIN list -->
|
||||
<tr bgcolor="{tr_color}">
|
||||
<td valign="top" width="35%"><b>{field}:</b></td>
|
||||
<td valign="top" width="65%">{data}</td>
|
||||
</tr>
|
||||
<!-- END list -->
|
@ -1,62 +0,0 @@
|
||||
<!-- BEGIN list -->
|
||||
<p class="row_on" style="text-align: center; border: 1px dotted black; padding: 10px;">{help_msg}</p>
|
||||
|
||||
<table border="0" width="45%" align="center">
|
||||
<tr>
|
||||
<td align="left">{left_next_matchs}</td>
|
||||
{center}
|
||||
<td align="right">{right_next_matchs}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p align="center">{total}</p>
|
||||
|
||||
<table border="0" width="70%" align="center">
|
||||
<tr bgcolor="{th_bg}">
|
||||
<td> {sort_name}</td>
|
||||
{header_rule}
|
||||
<td>{header_edit}</td>
|
||||
<td>{header_delete}</td>
|
||||
<td>{header_extra}</td>
|
||||
</tr>
|
||||
|
||||
{rows}
|
||||
|
||||
</table>
|
||||
|
||||
<table border="0" width="70%" cellspacing="5" align="center">
|
||||
<tr>
|
||||
<td align="left">
|
||||
<form method="POST" action="{new_action}">
|
||||
<input type="submit" value="{lang_add}">
|
||||
</form>
|
||||
</td>
|
||||
{back_button}
|
||||
<td width="80%" align="right">
|
||||
<form method="POST" action="{search_action}">
|
||||
{lang_search} <input name="query">
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- END list -->
|
||||
<!-- BEGIN row -->
|
||||
<tr bgcolor="{tr_color}">
|
||||
<td> {group_name}</td>
|
||||
{rule}
|
||||
<td width="5%">{edit_link}</td>
|
||||
<td width="5%">{delete_link}</td>
|
||||
<td align="center" {extra_width}>{extra_link}</td>
|
||||
</tr>
|
||||
<!-- END row -->
|
||||
<!-- BEGIN row_empty -->
|
||||
<tr>
|
||||
<td colspan="5" align="center">{message}</td>
|
||||
</tr>
|
||||
<!-- END row_empty -->
|
||||
<!-- BEGIN back_button_form -->
|
||||
<td align="center">
|
||||
<form method="POST" action="{back_action}">
|
||||
<input type="submit" value="{lang_back}">
|
||||
</form>
|
||||
</td>
|
||||
<!-- END back_button_form -->
|
@ -1,11 +0,0 @@
|
||||
<!-- $Id$ -->
|
||||
<tr class="{row_class}">
|
||||
<td>{user}</td>
|
||||
<td align="center"><input type="checkbox" name="{custom_2}" value="Y"{custom_2_selected}></td>
|
||||
<td class="aclInviteColumn" align="center"><input type="checkbox" name="{custom_3}" value="Y"{custom_3_selected}></td>
|
||||
<td align="center"><input type="checkbox" name="{read}" value="Y"{read_selected}></td>
|
||||
<td align="center"><input type="checkbox" name="{add}" value="Y"{add_selected}></td>
|
||||
<td align="center"><input type="checkbox" name="{edit}" value="Y"{edit_selected}></td>
|
||||
<td align="center"><input type="checkbox" name="{delete}" value="Y"{delete_selected}></td>
|
||||
<td align="center"><input type="checkbox" name="{private}" value="Y"{private_selected}></td>
|
||||
</tr>
|
@ -1,10 +0,0 @@
|
||||
<tr class="th">
|
||||
<td>{string}</td>
|
||||
<td align="center">{lang_freebusy}</td>
|
||||
<td class="aclInviteColumn" align="center">{lang_invite}</td>
|
||||
<td align="center">{lang_read}</td>
|
||||
<td align="center">{lang_add}</td>
|
||||
<td align="center">{lang_edit}</td>
|
||||
<td align="center">{lang_delete}</td>
|
||||
<td align="center">{lang_private}</td>
|
||||
</tr>
|
Loading…
Reference in New Issue
Block a user