本文整理汇总了PHP中JevDate类的典型用法代码示例。如果您正苦于以下问题:PHP JevDate类的具体用法?PHP JevDate怎么用?PHP JevDate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JevDate类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Defaultgetstartenddates
function Defaultgetstartenddates($view)
{
$params = JComponentHelper::getParams(JEV_COM_COMPONENT);
$startdate = JRequest::getString("startdate", "");
$enddate = JRequest::getString("enddate", "");
if ($startdate == "") {
if ($params->get("relative", "rel") == "abs") {
$startdate = $params->get("absstart", "");
list($startyear, $startmonth, $startday) = explode("-", $startdate);
} else {
if ($params->get("relative", "rel") == "strtotime") {
$value = $params->get("strstart", "");
$value = new JevDate(JevDate::strtotime($value));
$startdate = $value->toFormat("%Y-%m-%d");
} else {
$value = $params->get("relstart", "");
$value = str_replace(",", " ", $value);
$value = str_replace("y", "year", $value);
$value = str_replace("d", "day", $value);
$value = str_replace("w", "week", $value);
$value = str_replace("m", "month", $value);
$value = new JevDate($value);
$startdate = $value->toFormat("%Y-%m-%d");
}
}
}
if ($enddate == "") {
if ($params->get("relative", "rel") == "abs") {
$enddate = $params->get("absend", "");
} else {
if ($params->get("relative", "rel") == "strtotime") {
$value = $params->get("strend", "");
$value = new JevDate(JevDate::strtotime($value));
$enddate = $value->toFormat("%Y-%m-%d");
} else {
$value = $params->get("relend", "");
$value = str_replace(",", " ", $value);
$value = str_replace("y", "year", $value);
$value = str_replace("d", "day", $value);
$value = str_replace("w", "week", $value);
$value = str_replace("m", "month", $value);
$value = new JevDate($value);
$enddate = $value->toFormat("%Y-%m-%d");
}
}
}
if ($enddate < $startdate) {
// default to 1 year when input dates are not valid!
$value = new JevDate($startdate);
$value->add(new DateInterval('P1Y'));
$enddate = $value->toFormat("%Y-%m-%d");
}
return array($startdate, $enddate);
}
示例2: eventOnDate
function eventOnDate($testDate, $multidayTreatment = 0)
{
if (!isset($this->_startday)) {
$this->_startday = JevDate::mktime(0, 0, 0, $this->mup(), $this->dup(), $this->yup());
$this->_endday = JevDate::mktime(0, 0, 0, $this->mdn(), $this->ddn(), $this->ydn());
// if ends on midnight then testing day should ignore the second day since no one wants this event to show
if ($this->hdn() + $this->mindn() + $this->sdn() == 0 && $this->_startday != $this->_endday) {
$this->_endday -= 86400;
}
}
if ($this->_startday <= $testDate && $this->_endday >= $testDate) {
// if only show on first day
if ($multidayTreatment == 2 && $testDate >= $this->_startday + 86400) {
return false;
}
// don't show multiday suppressed events after the first day if multiday is not true
if ($multidayTreatment == 0) {
if (!$this->_multiday && $testDate >= $this->_startday + 86400) {
return false;
}
}
return true;
} else {
return false;
}
}
示例3: DefaultdateFormattedDateRange
function DefaultdateFormattedDateRange($view)
{
$params = JComponentHelper::getParams(JEV_COM_COMPONENT);
if ($params->get("daterangeformat", "") == "") {
$return = JEventsHTML::getDateFormat($view->startyear, $view->startmonth, $view->startday, 1) . " - " . JEventsHTML::getDateFormat($view->endyear, $view->endmonth, $view->endday, 1);
} else {
$return = $params->get("daterangeformat", "");
$startmatches = array();
preg_match_all('|{START(.*?)}|', $return, $startmatches);
if (count($startmatches) == 2 && count($startmatches[1]) == 1) {
$replace = str_replace(array("(", ")"), "", $startmatches[1][0]);
$datestp = JevDate::mktime(0, 0, 0, $view->startmonth, $view->startday, $view->startyear);
$replace = JEV_CommonFunctions::jev_strftime($replace, $datestp);
$return = str_replace($startmatches[0][0], $replace, $return);
}
$endmatches = array();
preg_match_all('|{END(.*?)}|', $return, $endmatches);
if (count($endmatches) == 2 && count($endmatches[1]) == 1) {
$replace = str_replace(array("(", ")"), "", $endmatches[1][0]);
$datestp = JevDate::mktime(0, 0, 0, $view->endmonth, $view->endday, $view->endyear);
$replace = JEV_CommonFunctions::jev_strftime($replace, $datestp);
$return = str_replace($endmatches[0][0], $replace, $return);
}
//$return = $params->get("daterangeformat", "");
}
return $return;
}
示例4: getAdjacentYear
function getAdjacentYear($year, $month, $day, $direction = 1)
{
$d1 = JevDate::mktime(0, 0, 0, $month, $day, $year + $direction);
$day = JevDate::strftime("%d", $d1);
$year = JevDate::strftime("%Y", $d1);
$params = JComponentHelper::getParams(JEV_COM_COMPONENT);
$cfg = JEVConfig::getInstance();
if (method_exists("JEVHelper", "getMinYear")) {
$earliestyear = JEVHelper::getMinYear();
$latestyear = JEVHelper::getMaxYear();
} else {
$earliestyear = $params->get("com_earliestyear", 1970);
$latestyear = $params->get("com_latestyear", 2150);
}
if ($year > $latestyear || $year < $earliestyear) {
return false;
}
$month = JevDate::strftime("%m", $d1);
$task = JRequest::getString('jevtask');
$Itemid = JEVHelper::getItemid();
if (isset($Itemid)) {
$item = "&Itemid={$Itemid}";
} else {
$item = "";
}
return JRoute::_("index.php?option=" . JEV_COM_COMPONENT . "&task={$task}{$item}&year={$year}&month={$month}&day={$day}");
}
示例5: listevents
function listevents($tpl = null)
{
JEVHelper::componentStylesheet($this);
$params =& JComponentHelper::getParams(JEV_COM_COMPONENT);
$value = trim($params->get("relstart", ""));
if ($value != "") {
$value = str_replace(",", " ", $value);
$value = str_replace("y", "year", $value);
$value = str_replace("d", "day", $value);
$value = str_replace("w", "week", $value);
$value = str_replace("m", "month", $value);
$value = new JevDate($value);
$startdate = $value->toFormat("%Y-%m-%d");
list($startyear, $startmonth, $startday) = explode("-", $startdate);
} else {
$startyear = $params->get("com_earliestyear", 2008);
$startdate = $startyear . "-01-01";
$startmonth = 1;
$startday = 1;
}
if ($value != "") {
$value = trim($params->get("relend", ""));
$value = str_replace(",", " ", $value);
$value = str_replace("y", "year", $value);
$value = str_replace("d", "day", $value);
$value = str_replace("w", "week", $value);
$value = str_replace("m", "month", $value);
$value = new JevDate($value);
$enddate = $value->toFormat("%Y-%m-%d");
list($endyear, $endmonth, $endday) = explode("-", $enddate);
} else {
$endyear = $params->get("com_latestyear", 2020);
$enddate = $endyear . "-12-31";
$endmonth = 12;
$endday = 31;
}
$this->assign("startdate", $startdate);
$this->assign("startyear", $startyear);
$this->assign("startmonth", $startmonth);
$this->assign("startday", $startday);
$this->assign("enddate", $enddate);
$this->assign("endyear", $endyear);
$this->assign("endmonth", $endmonth);
$this->assign("endday", $endday);
// Note that using a $limit value of -1 the limit is ignored in the query
$this->assign("data", $this->datamodel->getRangeData($startdate, $enddate, $this->limit, $this->limitstart));
}
示例6: store
/**
* override store function to force rrule to save too!
*
* @param unknown_type $updateNulls
*/
function store($updateNulls = false)
{
$date = JevDate::getDate();
$this->modified = $date->toMySQL();
if (parent::store($updateNulls)) {
// I also need to store custom data
$dispatcher = JDispatcher::getInstance();
// just incase we don't have jevents plugins registered yet
JPluginHelper::importPlugin("jevents");
$res = $dispatcher->trigger('onStoreCustomDetails', array(&$this));
} else {
JError::raiseError(321, "Problem saving event " . $this->_db->getErrorMsg());
}
return $this->evdet_id;
}
示例7: _createFilter
function _createFilter($prefix = "")
{
if (!$this->filterField) {
return "";
}
// first time visit
if (isset($this->filter_values[2]) && $this->filter_values[2] == 0) {
$this->filter_values = array();
$this->filter_values[0] = 1;
// default scenario is only events starting after 2 weeeks ago
$fulldate = date('Y-m-d H:i:s', JevDate::strtotime("-2 weeks"));
$this->filter_values[1] = substr($fulldate, 0, 10);
$this->filter_values[2] = 1;
return $this->dmap . ".startrepeat>='{$fulldate}'";
} else {
if ($this->filter_values[0] == 0) {
$this->filter_values[1] = "";
$this->_date = $this->filter_values[1];
} else {
if ($this->filter_values[0] == -1 && $this->filter_values[1] == "") {
$fulldate = date('Y-m-d H:i:s', JevDate::strtotime("+2 weeks"));
$this->filter_values[1] = substr($fulldate, 0, 10);
$this->_date = $this->filter_values[1];
} else {
if ($this->filter_values[0] == 1 && $this->filter_values[1] == "") {
$fulldate = date('Y-m-d H:i:s', JevDate::strtotime("-2 weeks"));
$this->filter_values[1] = substr($fulldate, 0, 10);
$this->_date = $this->filter_values[1];
}
}
}
}
$filter = "";
if ($this->_date != "" && $this->_onorbefore != 0) {
$date = JevDate::strtotime($this->_date);
$fulldate = date('Y-m-d H:i:s', $date);
if ($this->_onorbefore > 0) {
$date = $this->dmap . ".startrepeat>='{$fulldate}'";
} else {
$date = $this->dmap . ".startrepeat<'{$fulldate}'";
}
} else {
$date = "";
}
$filter = $date;
return $filter;
}
示例8: editICalendar
function editICalendar($icsid, $catid, $access = 0, $state = 1, $label = "")
{
$db =& JFactory::getDBO();
$temp = new iCalICSFile($db);
$temp->_setup($icsid, $catid, $access, $state);
$temp->filename = "_from_scratch_";
$temp->icaltype = 2;
$temp->label = empty($label) ? 'Scratch-' . md5(JevDate::mktime()) : $label;
$temp->srcURL = "";
$rawText = <<<RAWTEXT
BEGIN:VCALENDAR
PRODID:-//JEvents Project//JEvents Calendar 1.5.0//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:PUBLISH
X-WR-CALNAME:{$label}
X-WR-TIMEZONE:Europe/London
BEGIN:VTIMEZONE
TZID:Europe/London
X-LIC-LOCATION:Europe/London
BEGIN:DAYLIGHT
TZOFFSETFROM:+0000
TZOFFSETTO:+0100
TZNAME:BST
DTSTART:19700329T010000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:+0100
TZOFFSETTO:+0000
TZNAME:GMT
DTSTART:19701025T020000
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
END:STANDARD
END:VTIMEZONE
END:VCALENDAR
\t\t
RAWTEXT;
$temp->_icalInfo =& JEVHelper::iCalInstance("", $rawText);
return $temp;
}
示例9: getAdjacentYear
function getAdjacentYear($year, $month, $day, $direction = 1)
{
$d1 = JevDate::mktime(0, 0, 0, $month, $day, $year + $direction);
$day = JevDate::strftime("%d", $d1);
$year = JevDate::strftime("%Y", $d1);
$cfg =& JEVConfig::getInstance();
$earliestyear = $cfg->get('com_earliestyear');
$latestyear = $cfg->get('com_latestyear');
if ($year > $latestyear || $year < $earliestyear) {
return false;
}
$month = JevDate::strftime("%m", $d1);
$task = JRequest::getString('jevtask');
$Itemid = JEVHelper::getItemid();
if (isset($Itemid)) {
$item = "&Itemid={$Itemid}";
} else {
$item = "";
}
return JRoute::_("index.php?option=" . JEV_COM_COMPONENT . "&task={$task}{$item}&year={$year}&month={$month}&day={$day}");
}
示例10: getEventStringArray
static function getEventStringArray($row)
{
$urlString['title'] = urlencode($row->title());
$params = JComponentHelper::getParams(JEV_COM_COMPONENT);
$tz = $params->get("icaltimezonelive", "");
if ($tz) {
$urlString['dates'] = JevDate::strftime("%Y%m%dT%H%M%S", $row->getUnixStartTime()) . "/" . JevDate::strftime("%Y%m%dT%H%M%S", $row->getUnixEndTime()) . "&ctz=" . $tz;
} else {
$urlString['dates'] = JevDate::strftime("%Y%m%dT%H%M%SZ", $row->getUnixStartTime()) . "/" . JevDate::strftime("%Y%m%dT%H%M%SZ", $row->getUnixEndTime());
}
$urlString['st'] = JevDate::strftime("%Y%m%dT%H%M%SZ", $row->getUnixStartTime());
$urlString['et'] = JevDate::strftime("%Y%m%dT%H%M%SZ", $row->getUnixEndTime());
$urlString['duration'] = (int) $row->getUnixEndTime() - (int) $row->getUnixStartTime();
$urlString['location'] = urlencode(isset($row->_locationaddress) ? $row->_locationaddress : $row->location());
$urlString['sitename'] = urlencode(JFactory::getApplication()->get('sitename'));
$urlString['siteurl'] = urlencode(JUri::root());
$urlString['rawdetails'] = urlencode($row->get('description'));
$urlString['details'] = strip_tags($row->get('description'));
if (JString::strlen($urlString['details']) > 100) {
$urlString['details'] = JString::substr($urlString['details'], 0, 100) . ' ...';
}
$urlString['details'] = urlencode($urlString['details']);
return $urlString;
}
示例11: toFormat
/**
* Gets the date in a specific format
*
* Returns a string formatted according to the given format. Month and weekday names and
* other language dependent strings respect the current locale
*
* @deprecated Deprecated since 1.6, use JDate::format() instead.
*
* @param string The date format specification string (see {@link PHP_MANUAL#JevDate::strftime})
* @param boolean True to return the date string in the local time zone, false to return it in GMT.
* @return string The date as a formatted string.
* @since 1.5
*/
public function toFormat($format = '%Y-%m-%d %H:%M:%S', $local = false)
{
// do not reset the timezone !! - this is needed for the weekdays
// Set time zone to GMT as JevDate::strftime formats according locale setting.
// date_default_timezone_set('GMT');
// Generate the timestamp.
$time = (int) parent::format('U', true);
// this requires php 5.3!
//$time = $this->getTimeStamp();
// If the returned time should be local add the GMT offset.
if ($local) {
$time += $this->getOffsetFromGMT();
}
// Manually modify the month and day strings in the format.
if (strpos($format, '%a') !== false) {
$format = str_replace('%a', $this->dayToString(date('w', $time), true), $format);
}
if (strpos($format, '%A') !== false) {
$format = str_replace('%A', $this->dayToString(date('w', $time)), $format);
}
if (strpos($format, '%b') !== false) {
$format = str_replace('%b', $this->monthToString(date('n', $time), true), $format);
}
if (strpos($format, '%B') !== false) {
$format = str_replace('%B', $this->monthToString(date('n', $time)), $format);
}
// Generate the formatted string.
$date = JevDate::strftime($format, $time);
// reset the timezone !!
date_default_timezone_set(self::$stz->getName());
return $date;
}
示例12: generateRRule
function generateRRule($array)
{
//static $weekdayMap=array("SU"=>0,"MO"=>1,"TU"=>2,"WE"=>3,"TH"=>4,"FR"=>5,"SA"=>6);
static $weekdayReverseMap = array("SU", "MO", "TU", "WE", "TH", "FR", "SA");
$interval = JArrayHelper::getValue($array, "rinterval", 1);
$freq = JArrayHelper::getValue($array, "freq", "NONE");
if ($freq != "NONE") {
$rrule = array();
$rrule["FREQ"] = $freq;
$countuntil = JArrayHelper::getValue($array, "countuntil", "count");
if ($countuntil == "count") {
$count = intval(JArrayHelper::getValue($array, "count", 1));
if ($count <= 0) {
$count = 1;
}
$rrule["COUNT"] = $count;
} else {
$publish_down = JArrayHelper::getValue($array, "publish_down", "2006-12-12");
$until = JArrayHelper::getValue($array, "until", $publish_down);
$rrule["UNTIL"] = JevDate::strtotime($until . " 00:00:00");
}
$rrule["INTERVAL"] = $interval;
}
$whichby = JArrayHelper::getValue($array, "whichby", "bd");
switch ($whichby) {
case "byd":
$byd_direction = JArrayHelper::getValue($array, "byd_direction", "off") == "off" ? "+" : "-";
$byyearday = JArrayHelper::getValue($array, "byyearday", "");
$rrule["BYYEARDAY"] = $byd_direction . $byyearday;
break;
case "bm":
$bm_direction = JArrayHelper::getValue($array, "bm_direction", "off") == "off" ? "+" : "-";
$bymonth = JArrayHelper::getValue($array, "bymonth", "");
$rrule["BYMONTH"] = $bymonth;
break;
case "bwn":
$bwn_direction = JArrayHelper::getValue($array, "bwn_direction", "off") == "off" ? "+" : "-";
$byweekno = JArrayHelper::getValue($array, "byweekno", "");
$rrule["BYWEEKNO"] = $bwn_direction . $byweekno;
break;
case "bmd":
$bmd_direction = JArrayHelper::getValue($array, "bmd_direction", "off") == "off" ? "+" : "-";
$bymonthday = JArrayHelper::getValue($array, "bymonthday", "");
$rrule["BYMONTHDAY"] = $bmd_direction . $bymonthday;
break;
case "bd":
$bd_direction = JArrayHelper::getValue($array, "bd_direction", "off") == "off" ? "+" : "-";
$weekdays = JArrayHelper::getValue($array, "weekdays", array());
$weeknums = JArrayHelper::getValue($array, "weeknums", array());
$byday = "";
if (count($weeknums) == 0) {
// special case for weekly repeats which don't specify eeek of a month
foreach ($weekdays as $wd) {
if (strlen($byday) > 0) {
$byday .= ",";
}
$byday .= $weekdayReverseMap[$wd];
}
}
foreach ($weeknums as $week) {
foreach ($weekdays as $wd) {
if (strlen($byday) > 0) {
$byday .= ",";
}
$byday .= $bd_direction . $week . $weekdayReverseMap[$wd];
}
}
$rrule["BYDAY"] = $byday;
break;
}
return $rrule;
}
示例13: count
</div>
</div>
<div class="jev_clear"></div>
<div id='jev_maincal' class='jev_listview'>
<?php
$num_events = count($data['rows']);
$chdate = "";
if ($num_events > 0) {
$hasevents = true;
for ($r = 0; $r < $num_events; $r++) {
$row = $data['rows'][$r];
$event_day_month_year = $row->dup() . $row->mup() . $row->yup();
// Ensure we reflect multiday setting
if (!$row->eventOnDate(JevDate::mktime(0, 0, 0, $row->mup(), $row->dup(), $row->yup()))) {
continue;
}
$date = JEventsHTML::getDateFormat($row->yup(), $row->mup(), $row->dup(), 1);
?>
<div class="jev_listrow">
<ul class='ev_ul'>
<?php
$listyle = 'style="border-color:' . $row->bgcolor() . ';"';
echo "<li class='ev_td_li' {$listyle}>\n";
if (!$this->loadedFromTemplate('icalevent.list_row', $row, 0)) {
$this->viewEventRowNEW($row);
echo " :: ";
$this->viewEventCatRowNEW($row);
}
示例14: getAjaxCal
function getAjaxCal($modid = 0, $month, $year)
{
// capture module id so that we can use it for ajax type navigation
if ($modid != 0) {
$this->_modid = $modid;
}
$user =& JFactory::getUser();
$db =& JFactory::getDBO();
static $isloaded_css = false;
// this will get the viewname based on which classes have been implemented
$cfg =& JEVConfig::getInstance();
$viewname = ucfirst($cfg->get('com_calViewName', "default"));
$cfg =& JEVConfig::getInstance();
// get array
$day_name = JEVHelper::getWeekdayLetter(null, 1);
$day_name[0] = '<span class="sunday">' . $day_name[0] . '</span>';
$day_name[6] = '<span class="saturday">' . $day_name[6] . '</span>';
$content = "";
$mod = "";
if (isset($this->_modid) && $this->_modid > 0) {
$mod = 'id="modid_' . $this->_modid . '" ';
$content .= "<span id='testspan" . $this->_modid . "' style='display:none'></span>\n";
}
$temptime = JevDate::mktime(12, 0, 0, $month, 15, $year);
//$content .= $this->_displayCalendarMod($temptime,$this->com_starday, JText::_('JEV_THIS_MONTH'),$day_name, false);
$thisDayOfMonth = date("j", $temptime);
$daysLeftInMonth = date("t", $temptime) - date("j", $temptime) + 1;
// calculate month offset from first of month
$first_of_current_month = JevDate::strtotime(date('Y-m-01', $temptime));
$base_year = date("Y", $temptime);
$base_month = date("m", $temptime);
$basefirst_of_month = JevDate::mktime(0, 0, 0, $base_month, 1, $base_year);
if ($this->disp_lastMonth && (!$this->disp_lastMonthDays || $thisDayOfMonth <= $this->disp_lastMonthDays)) {
$content .= $this->_displayCalendarMod(JevDate::strtotime("-1 month", $first_of_current_month), $this->com_starday, JText::_('JEV_LAST_MONTH'), $day_name, $this->disp_lastMonth == 2, $first_of_current_month);
}
$content .= $this->_displayCalendarMod($temptime, $this->com_starday, JText::_('JEV_THIS_MONTH'), $day_name, false, $first_of_current_month);
if ($this->disp_nextMonth && (!$this->disp_nextMonthDays || $daysLeftInMonth <= $this->disp_nextMonthDays)) {
$content .= $this->_displayCalendarMod(JevDate::strtotime("+1 month", $first_of_current_month), $this->com_starday, JText::_('JEV_NEXT_MONTH'), $day_name, $this->disp_nextMonth == 2, $first_of_current_month);
}
return $content;
}
示例15: jev_strftime
/**
* Support all JevDate::strftime() parameter for Window systems
*
* @param string $format
* @param int $timestamp
* @return string formated string
*/
function jev_strftime($format = '', $timestamp = null)
{
if (!$timestamp) {
$timestamp = time();
}
// Replace names by own translation to get rid of improper os system library
if (strpos($format, '%a') !== false) {
$format = str_replace('%a', JEVHelper::getShortDayName(date('w', $timestamp)), $format);
}
if (strpos($format, '%A') !== false) {
$format = str_replace('%A', JEVHelper::getDayName(date('w', $timestamp)), $format);
}
if (strpos($format, '%b') !== false) {
$format = str_replace('%b', JEVHelper::getShortMonthName(date('n', $timestamp)), $format);
}
if (strpos($format, '%B') !== false) {
$format = str_replace('%B', JEVHelper::getMonthName(date('n', $timestamp)), $format);
}
if (JUtility::isWinOS()) {
if (!class_exists('JEV_CompatWin')) {
require_once dirname(__FILE__) . '/compatwin.php';
}
return JEV_CompatWin::win_strftime($format, $timestamp);
} else {
return JevDate::strftime($format, $timestamp);
}
}