adding zend project folders into old campcaster.
This commit is contained in:
parent
56abfaf28e
commit
7ef0c18b26
4045 changed files with 1054952 additions and 0 deletions
208
library/pear/Calendar/Decorator/Textual.php
Normal file
208
library/pear/Calendar/Decorator/Textual.php
Normal file
|
@ -0,0 +1,208 @@
|
|||
<?php
|
||||
/* vim: set expandtab tabstop=4 shiftwidth=4: */
|
||||
|
||||
/**
|
||||
* Contains the Calendar_Decorator_Wrapper class
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* LICENSE: Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @category Date and Time
|
||||
* @package Calendar
|
||||
* @author Harry Fuecks <hfuecks@phppatterns.com>
|
||||
* @author Lorenzo Alberton <l.alberton@quipo.it>
|
||||
* @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
|
||||
* @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
|
||||
* @version CVS: $Id: Textual.php 246907 2007-11-24 11:04:24Z quipo $
|
||||
* @link http://pear.php.net/package/Calendar
|
||||
*/
|
||||
|
||||
/**
|
||||
* Allows Calendar include path to be redefined
|
||||
* @ignore
|
||||
*/
|
||||
if (!defined('CALENDAR_ROOT')) {
|
||||
define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load Calendar decorator base class
|
||||
*/
|
||||
require_once CALENDAR_ROOT.'Decorator.php';
|
||||
|
||||
/**
|
||||
* Load the Uri utility
|
||||
*/
|
||||
require_once CALENDAR_ROOT.'Util'.DIRECTORY_SEPARATOR.'Textual.php';
|
||||
|
||||
/**
|
||||
* Decorator to help with fetching textual representations of months and
|
||||
* days of the week.
|
||||
* <b>Note:</b> for performance you should prefer Calendar_Util_Textual unless you
|
||||
* have a specific need to use a decorator
|
||||
*
|
||||
* @category Date and Time
|
||||
* @package Calendar
|
||||
* @author Harry Fuecks <hfuecks@phppatterns.com>
|
||||
* @author Lorenzo Alberton <l.alberton@quipo.it>
|
||||
* @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
|
||||
* @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
|
||||
* @link http://pear.php.net/package/Calendar
|
||||
* @access public
|
||||
*/
|
||||
class Calendar_Decorator_Textual extends Calendar_Decorator
|
||||
{
|
||||
/**
|
||||
* Constructs Calendar_Decorator_Textual
|
||||
*
|
||||
* @param object &$Calendar subclass of Calendar
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function Calendar_Decorator_Textual(&$Calendar)
|
||||
{
|
||||
parent::Calendar_Decorator($Calendar);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of 12 month names (first index = 1)
|
||||
*
|
||||
* @param string $format (optional) format of returned months (one|two|short|long)
|
||||
*
|
||||
* @return array
|
||||
* @access public
|
||||
* @static
|
||||
*/
|
||||
function monthNames($format = 'long')
|
||||
{
|
||||
return Calendar_Util_Textual::monthNames($format);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of 7 week day names (first index = 0)
|
||||
*
|
||||
* @param string $format (optional) format of returned days (one|two|short|long)
|
||||
*
|
||||
* @return array
|
||||
* @access public
|
||||
* @static
|
||||
*/
|
||||
function weekdayNames($format = 'long')
|
||||
{
|
||||
return Calendar_Util_Textual::weekdayNames($format);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns textual representation of the previous month of the decorated calendar object
|
||||
*
|
||||
* @param string $format (optional) format of returned months (one|two|short|long)
|
||||
*
|
||||
* @return string
|
||||
* @access public
|
||||
*/
|
||||
function prevMonthName($format = 'long')
|
||||
{
|
||||
return Calendar_Util_Textual::prevMonthName($this->calendar, $format);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns textual representation of the month of the decorated calendar object
|
||||
*
|
||||
* @param string $format (optional) format of returned months (one|two|short|long)
|
||||
*
|
||||
* @return string
|
||||
* @access public
|
||||
*/
|
||||
function thisMonthName($format = 'long')
|
||||
{
|
||||
return Calendar_Util_Textual::thisMonthName($this->calendar, $format);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns textual representation of the next month of the decorated calendar object
|
||||
*
|
||||
* @param string $format (optional) format of returned months (one|two|short|long)
|
||||
*
|
||||
* @return string
|
||||
* @access public
|
||||
*/
|
||||
function nextMonthName($format = 'long')
|
||||
{
|
||||
return Calendar_Util_Textual::nextMonthName($this->calendar, $format);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns textual representation of the previous day of week of the decorated calendar object
|
||||
*
|
||||
* @param string $format (optional) format of returned months (one|two|short|long)
|
||||
*
|
||||
* @return string
|
||||
* @access public
|
||||
*/
|
||||
function prevDayName($format = 'long')
|
||||
{
|
||||
return Calendar_Util_Textual::prevDayName($this->calendar, $format);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns textual representation of the day of week of the decorated calendar object
|
||||
*
|
||||
* @param string $format (optional) format of returned months (one|two|short|long)
|
||||
*
|
||||
* @return string
|
||||
* @access public
|
||||
*/
|
||||
function thisDayName($format = 'long')
|
||||
{
|
||||
return Calendar_Util_Textual::thisDayName($this->calendar, $format);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns textual representation of the next day of week of the decorated calendar object
|
||||
*
|
||||
* @param string $format (optional) format of returned months (one|two|short|long)
|
||||
*
|
||||
* @return string
|
||||
* @access public
|
||||
*/
|
||||
function nextDayName($format = 'long')
|
||||
{
|
||||
return Calendar_Util_Textual::nextDayName($this->calendar, $format);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the days of the week using the order defined in the decorated
|
||||
* calendar object. Only useful for Calendar_Month_Weekdays, Calendar_Month_Weeks
|
||||
* and Calendar_Week. Otherwise the returned array will begin on Sunday
|
||||
*
|
||||
* @param string $format (optional) format of returned months (one|two|short|long)
|
||||
*
|
||||
* @return array ordered array of week day names
|
||||
* @access public
|
||||
*/
|
||||
function orderedWeekdays($format = 'long')
|
||||
{
|
||||
return Calendar_Util_Textual::orderedWeekdays($this->calendar, $format);
|
||||
}
|
||||
}
|
||||
?>
|
183
library/pear/Calendar/Decorator/Uri.php
Normal file
183
library/pear/Calendar/Decorator/Uri.php
Normal file
|
@ -0,0 +1,183 @@
|
|||
<?php
|
||||
/* vim: set expandtab tabstop=4 shiftwidth=4: */
|
||||
|
||||
/**
|
||||
* Contains the Calendar_Decorator_Uri class
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* LICENSE: Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @category Date and Time
|
||||
* @package Calendar
|
||||
* @author Harry Fuecks <hfuecks@phppatterns.com>
|
||||
* @author Lorenzo Alberton <l.alberton@quipo.it>
|
||||
* @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
|
||||
* @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
|
||||
* @version CVS: $Id: Uri.php 300729 2010-06-24 12:05:53Z quipo $
|
||||
* @link http://pear.php.net/package/Calendar
|
||||
*/
|
||||
|
||||
/**
|
||||
* Allows Calendar include path to be redefined
|
||||
* @ignore
|
||||
*/
|
||||
if (!defined('CALENDAR_ROOT')) {
|
||||
define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load Calendar decorator base class
|
||||
*/
|
||||
require_once CALENDAR_ROOT.'Decorator.php';
|
||||
|
||||
/**
|
||||
* Load the Uri utility
|
||||
*/
|
||||
require_once CALENDAR_ROOT.'Util'.DIRECTORY_SEPARATOR.'Uri.php';
|
||||
|
||||
/**
|
||||
* Decorator to help with building HTML links for navigating the calendar<br />
|
||||
* <b>Note:</b> for performance you should prefer Calendar_Util_Uri unless you
|
||||
* have a specific need to use a decorator
|
||||
* <code>
|
||||
* $Day = new Calendar_Day(2003, 10, 23);
|
||||
* $Uri = new Calendar_Decorator_Uri($Day);
|
||||
* $Uri->setFragments('year', 'month', 'day');
|
||||
* echo $Uri->getPrev(); // Displays year=2003&month=10&day=22
|
||||
* </code>
|
||||
*
|
||||
* @category Date and Time
|
||||
* @package Calendar
|
||||
* @author Harry Fuecks <hfuecks@phppatterns.com>
|
||||
* @author Lorenzo Alberton <l.alberton@quipo.it>
|
||||
* @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
|
||||
* @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
|
||||
* @link http://pear.php.net/package/Calendar
|
||||
* @see Calendar_Util_Uri
|
||||
* @access public
|
||||
*/
|
||||
class Calendar_Decorator_Uri extends Calendar_Decorator
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Calendar_Util_Uri
|
||||
* @access private
|
||||
*/
|
||||
var $Uri;
|
||||
|
||||
/**
|
||||
* Constructs Calendar_Decorator_Uri
|
||||
*
|
||||
* @param object &$Calendar subclass of Calendar
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function Calendar_Decorator_Uri(&$Calendar)
|
||||
{
|
||||
parent::Calendar_Decorator($Calendar);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the URI fragment names
|
||||
*
|
||||
* @param string $y URI fragment for year
|
||||
* @param string $m (optional) URI fragment for month
|
||||
* @param string $d (optional) URI fragment for day
|
||||
* @param string $h (optional) URI fragment for hour
|
||||
* @param string $i (optional) URI fragment for minute
|
||||
* @param string $s (optional) URI fragment for second
|
||||
*
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function setFragments($y, $m = null, $d = null, $h = null, $i = null, $s = null)
|
||||
{
|
||||
$this->Uri = new Calendar_Util_Uri($y, $m, $d, $h, $i, $s);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the separator string between fragments
|
||||
*
|
||||
* @param string $separator url fragment separator e.g. /
|
||||
*
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function setSeparator($separator)
|
||||
{
|
||||
$this->Uri->separator = $separator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts Uri decorator into "scalar mode" - URI variable names are not returned
|
||||
*
|
||||
* @param boolean $state (optional)
|
||||
*
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function setScalar($state = true)
|
||||
{
|
||||
$this->Uri->scalar = $state;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the URI string for the previous calendar unit
|
||||
*
|
||||
* @param string $method calendar unit to fetch uri for (year, month, week or day etc)
|
||||
*
|
||||
* @return string
|
||||
* @access public
|
||||
*/
|
||||
function prev($method)
|
||||
{
|
||||
return $this->Uri->prev($this, $method);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the URI string for the current calendar unit
|
||||
*
|
||||
* @param string $method calendar unit to fetch uri for (year,month,week or day etc)
|
||||
*
|
||||
* @return string
|
||||
* @access public
|
||||
*/
|
||||
function this($method)
|
||||
{
|
||||
return $this->Uri->this($this, $method);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the URI string for the next calendar unit
|
||||
*
|
||||
* @param string $method calendar unit to fetch uri for (year,month,week or day etc)
|
||||
*
|
||||
* @return string
|
||||
* @access public
|
||||
*/
|
||||
function next($method)
|
||||
{
|
||||
return $this->Uri->next($this, $method);
|
||||
}
|
||||
}
|
||||
?>
|
195
library/pear/Calendar/Decorator/Weekday.php
Normal file
195
library/pear/Calendar/Decorator/Weekday.php
Normal file
|
@ -0,0 +1,195 @@
|
|||
<?php
|
||||
/* vim: set expandtab tabstop=4 shiftwidth=4: */
|
||||
|
||||
/**
|
||||
* Contains the Calendar_Decorator_Weekday class
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* LICENSE: Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @category Date and Time
|
||||
* @package Calendar
|
||||
* @author Harry Fuecks <hfuecks@phppatterns.com>
|
||||
* @author Lorenzo Alberton <l.alberton@quipo.it>
|
||||
* @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
|
||||
* @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
|
||||
* @version CVS: $Id: Weekday.php 300729 2010-06-24 12:05:53Z quipo $
|
||||
* @link http://pear.php.net/package/Calendar
|
||||
*/
|
||||
|
||||
/**
|
||||
* Allows Calendar include path to be redefined
|
||||
* @ignore
|
||||
*/
|
||||
if (!defined('CALENDAR_ROOT')) {
|
||||
define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load Calendar decorator base class
|
||||
*/
|
||||
require_once CALENDAR_ROOT.'Decorator.php';
|
||||
|
||||
/**
|
||||
* Load a Calendar_Day
|
||||
*/
|
||||
require_once CALENDAR_ROOT.'Day.php';
|
||||
/**
|
||||
* Decorator for fetching the day of the week
|
||||
* <code>
|
||||
* $Day = new Calendar_Day(2003, 10, 23);
|
||||
* $Weekday = new Calendar_Decorator_Weekday($Day);
|
||||
* $Weekday->setFirstDay(0); // Set first day of week to Sunday (default Mon)
|
||||
* echo $Weekday->thisWeekDay(); // Displays 5 - fifth day of week relative to Sun
|
||||
* </code>
|
||||
*
|
||||
* @category Date and Time
|
||||
* @package Calendar
|
||||
* @author Harry Fuecks <hfuecks@phppatterns.com>
|
||||
* @author Lorenzo Alberton <l.alberton@quipo.it>
|
||||
* @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
|
||||
* @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
|
||||
* @link http://pear.php.net/package/Calendar
|
||||
* @access public
|
||||
*/
|
||||
class Calendar_Decorator_Weekday extends Calendar_Decorator
|
||||
{
|
||||
/**
|
||||
* First day of week
|
||||
* @var int (default = 1 for Monday)
|
||||
* @access private
|
||||
*/
|
||||
var $firstDay = 1;
|
||||
|
||||
/**
|
||||
* Constructs Calendar_Decorator_Weekday
|
||||
*
|
||||
* @param object &$Calendar subclass of Calendar
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function Calendar_Decorator_Weekday(&$Calendar)
|
||||
{
|
||||
parent::Calendar_Decorator($Calendar);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the first day of the week (0 = Sunday, 1 = Monday (default) etc)
|
||||
*
|
||||
* @param int $firstDay first day of week
|
||||
*
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function setFirstDay($firstDay)
|
||||
{
|
||||
$this->firstDay = (int)$firstDay;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the previous weekday
|
||||
*
|
||||
* @param string $format (default = 'int') return value format
|
||||
*
|
||||
* @return int $format numeric day of week or timestamp
|
||||
* @access public
|
||||
*/
|
||||
function prevWeekDay($format = 'int')
|
||||
{
|
||||
$ts = $this->calendar->prevDay('timestamp');
|
||||
$Day = new Calendar_Day(2000, 1, 1);
|
||||
$Day->setTimeStamp($ts);
|
||||
$day = $this->calendar->cE->getDayOfWeek(
|
||||
$Day->thisYear(),
|
||||
$Day->thisMonth(),
|
||||
$Day->thisDay()
|
||||
);
|
||||
$day = $this->adjustWeekScale($day);
|
||||
return $this->returnValue('Day', $format, $ts, $day);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current weekday
|
||||
*
|
||||
* @param string $format (default = 'int') return value format
|
||||
*
|
||||
* @return int numeric day of week or timestamp
|
||||
* @access public
|
||||
*/
|
||||
function thisWeekDay($format = 'int')
|
||||
{
|
||||
$ts = $this->calendar->thisDay('timestamp');
|
||||
$day = $this->calendar->cE->getDayOfWeek(
|
||||
$this->calendar->year,
|
||||
$this->calendar->month,
|
||||
$this->calendar->day
|
||||
);
|
||||
$day = $this->adjustWeekScale($day);
|
||||
return $this->returnValue('Day', $format, $ts, $day);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the next weekday
|
||||
*
|
||||
* @param string $format (default = 'int') return value format
|
||||
*
|
||||
* @return int numeric day of week or timestamp
|
||||
* @access public
|
||||
*/
|
||||
function nextWeekDay($format = 'int')
|
||||
{
|
||||
$ts = $this->calendar->nextDay('timestamp');
|
||||
$Day = new Calendar_Day(2000, 1, 1);
|
||||
$Day->setTimeStamp($ts);
|
||||
$day = $this->calendar->cE->getDayOfWeek(
|
||||
$Day->thisYear(),
|
||||
$Day->thisMonth(),
|
||||
$Day->thisDay()
|
||||
);
|
||||
$day = $this->adjustWeekScale($day);
|
||||
return $this->returnValue('Day', $format, $ts, $day);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjusts the day of the week relative to the first day of the week
|
||||
*
|
||||
* @param int $dayOfWeek day of week calendar from Calendar_Engine
|
||||
*
|
||||
* @return int day of week adjusted to first day
|
||||
* @access private
|
||||
*/
|
||||
function adjustWeekScale($dayOfWeek)
|
||||
{
|
||||
$dayOfWeek = $dayOfWeek - $this->firstDay;
|
||||
if ($dayOfWeek >= 0) {
|
||||
return $dayOfWeek;
|
||||
} else {
|
||||
return $this->calendar->cE->getDaysInWeek(
|
||||
$this->calendar->year,
|
||||
$this->calendar->month,
|
||||
$this->calendar->day
|
||||
) + $dayOfWeek;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
115
library/pear/Calendar/Decorator/Wrapper.php
Normal file
115
library/pear/Calendar/Decorator/Wrapper.php
Normal file
|
@ -0,0 +1,115 @@
|
|||
<?php
|
||||
/* vim: set expandtab tabstop=4 shiftwidth=4: */
|
||||
|
||||
/**
|
||||
* Contains the Calendar_Decorator_Wrapper class
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* LICENSE: Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @category Date and Time
|
||||
* @package Calendar
|
||||
* @author Harry Fuecks <hfuecks@phppatterns.com>
|
||||
* @author Lorenzo Alberton <l.alberton@quipo.it>
|
||||
* @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
|
||||
* @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
|
||||
* @version CVS: $Id: Wrapper.php 300729 2010-06-24 12:05:53Z quipo $
|
||||
* @link http://pear.php.net/package/Calendar
|
||||
*/
|
||||
|
||||
/**
|
||||
* Allows Calendar include path to be redefined
|
||||
* @ignore
|
||||
*/
|
||||
if (!defined('CALENDAR_ROOT')) {
|
||||
define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load Calendar decorator base class
|
||||
*/
|
||||
require_once CALENDAR_ROOT.'Decorator.php';
|
||||
|
||||
/**
|
||||
* Decorator to help with wrapping built children in another decorator
|
||||
*
|
||||
* @category Date and Time
|
||||
* @package Calendar
|
||||
* @author Harry Fuecks <hfuecks@phppatterns.com>
|
||||
* @author Lorenzo Alberton <l.alberton@quipo.it>
|
||||
* @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
|
||||
* @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
|
||||
* @link http://pear.php.net/package/Calendar
|
||||
* @access public
|
||||
*/
|
||||
class Calendar_Decorator_Wrapper extends Calendar_Decorator
|
||||
{
|
||||
/**
|
||||
* Constructs Calendar_Decorator_Wrapper
|
||||
*
|
||||
* @param object &$Calendar subclass of Calendar
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function Calendar_Decorator_Wrapper(&$Calendar)
|
||||
{
|
||||
parent::Calendar_Decorator($Calendar);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps objects returned from fetch in the named Decorator class
|
||||
*
|
||||
* @param string $decorator name of Decorator class to wrap with
|
||||
*
|
||||
* @return object instance of named decorator
|
||||
* @access public
|
||||
*/
|
||||
function & fetch($decorator)
|
||||
{
|
||||
$Calendar = parent::fetch();
|
||||
if ($Calendar) {
|
||||
$ret = new $decorator($Calendar);
|
||||
} else {
|
||||
$ret = false;
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps the returned calendar objects from fetchAll in the named decorator
|
||||
*
|
||||
* @param string $decorator name of Decorator class to wrap with
|
||||
*
|
||||
* @return array
|
||||
* @access public
|
||||
*/
|
||||
function fetchAll($decorator)
|
||||
{
|
||||
$children = parent::fetchAll();
|
||||
foreach ($children as $key => $Calendar) {
|
||||
$children[$key] = new $decorator($Calendar);
|
||||
}
|
||||
return $children;
|
||||
}
|
||||
}
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue