本文整理汇总了PHP中JevDate类的典型用法代码示例。如果您正苦于以下问题:PHP JevDate类的具体用法?PHP JevDate怎么用?PHP JevDate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JevDate类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:madcsaba,项目名称:li-de,代码行数:54,代码来源:defaultgetstartenddates.php
示例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;
}
}
开发者ID:rogatnev-nikita,项目名称:cloudinterpreter,代码行数:26,代码来源:jicaleventrepeat.php
示例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;
}
开发者ID:madcsaba,项目名称:li-de,代码行数:27,代码来源:defaultdateformatteddaterange.php
示例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}");
}
开发者ID:madcsaba,项目名称:li-de,代码行数:27,代码来源:view.html.php
示例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));
}
开发者ID:brojask,项目名称:colegio-abogados-joomla,代码行数:47,代码来源:view.html.php
示例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;
}
开发者ID:madcsaba,项目名称:li-de,代码行数:20,代码来源:iCalEventDetail.php
示例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;
}
开发者ID:madcsaba,项目名称:li-de,代码行数:47,代码来源:Startdate.php
示例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;
}
开发者ID:andreassetiawanhartanto,项目名称:PDKKI,代码行数:42,代码来源:iCalICSFile.php
示例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}");
}
开发者ID:andreassetiawanhartanto,项目名称:PDKKI,代码行数:21,代码来源:view.html.php
示例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;
}
开发者ID:poorgeek,项目名称:JEvents,代码行数:24,代码来源:jevExportHelper.php
示例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;
}
开发者ID:madcsaba,项目名称:li-de,代码行数:45,代码来源:jevdate.php
示例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;
}
开发者ID:madseller,项目名称:coperio,代码行数:72,代码来源:saveIcalEvent.php
示例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);
}
开发者ID:madcsaba,项目名称:li-de,代码行数:30,代码来源:listevents_body.php
示例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;
}
开发者ID:affiliatelk,项目名称:ecc,代码行数:41,代码来源:calendar.php
示例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);
}
}
开发者ID:madseller,项目名称:coperio,代码行数:34,代码来源:commonfunctions.php
示例16: edit
function edit()
{
// get the view
$this->view =& $this->getView("icalevent", "html");
$cid = JRequest::getVar('cid', array(0));
JArrayHelper::toInteger($cid);
if (is_array($cid) && count($cid) > 0) {
$id = $cid[0];
} else {
$id = 0;
}
// front end passes the id as evid
if ($id == 0) {
$id = JRequest::getInt("evid", 0);
}
if (!JEVHelper::isEventCreator()) {
JError::raiseError(403, JText::_('ALERTNOTAUTH'));
}
$repeatId = 0;
$db = JFactory::getDBO();
// iCal agid uses GUID or UUID as identifier
if ($id > 0) {
if ($repeatId == 0) {
// this version gives us a repeat not an event so
//$row = $this->queryModel->getEventById($id, true, "icaldb");
$vevent = $this->dataModel->queryModel->getVEventById($id);
if (!$vevent) {
$Itemid = JRequest::getInt("Itemid");
JFactory::getApplication()->redirect(JRoute::_("index.php?option=" . JEV_COM_COMPONENT . "&Itemid={$Itemid}", false), JText::_("JEV_SORRY_UPDATED"));
}
$row = new jIcalEventDB($vevent);
$row->fixDtstart();
} else {
$row = $this->queryModel->listEventsById($repeatId, true, "icaldb");
}
if (!JEVHelper::canEditEvent($row)) {
JError::raiseError(403, JText::_('ALERTNOTAUTH'));
}
} else {
$vevent = new iCalEvent($db);
$vevent->set("freq", "DAILY");
$vevent->set("description", "");
$vevent->set("summary", "");
list($year, $month, $day) = JEVHelper::getYMD();
$params = JComponentHelper::getParams(JEV_COM_COMPONENT);
$defaultstarttime = $params->get("defaultstarttime", "08:00");
$defaultendtime = $params->get("defaultendtime", "17:00");
list($starthour, $startmin) = explode(":", $defaultstarttime);
list($endhour, $endmin) = explode(":", $defaultendtime);
$vevent->set("dtstart", JevDate::mktime($starthour, $startmin, 0, $month, $day, $year));
$vevent->set("dtend", JevDate::mktime($endhour, $endmin, 0, $month, $day, $year));
$row = new jIcalEventDB($vevent);
// TODO - move this to class!!
// populate with meaningful initial values
$row->starttime($defaultstarttime);
$row->endtime($defaultendtime);
}
/*
$db =& JFactory::getDBO();
// get list of groups
$query = "SELECT id AS value, name AS text"
. "\n FROM #__groups"
. "\n ORDER BY id" ;
$db->setQuery( $query );
$groups = $db->loadObjectList();
// build the html select list
$glist = JHTML::_('select.genericlist', $groups, 'access', 'class="inputbox" size="1"', 'value', 'text', intval( $row->access() ) );
*/
$glist = JEventsHTML::buildAccessSelect(intval($row->access()), 'class="inputbox" size="1"');
// get all the raw native calendars
$nativeCals = $this->dataModel->queryModel->getNativeIcalendars();
// Strip this list down based on user permissions
$jevuser =& JEVHelper::getAuthorisedUser();
if ($jevuser && $jevuser->calendars != "" && $jevuser->calendars != "all") {
$cals = array_keys($nativeCals);
$allowedcals = explode("|", $jevuser->calendars);
foreach ($cals as $calid) {
if (!in_array($calid, $allowedcals)) {
unset($nativeCals[$calid]);
}
}
}
// Are we allowed to edit events within a URL based iCal
$params = JComponentHelper::getParams(JEV_COM_COMPONENT);
if ($params->get("allowedit", 0) && $row->icsid() > 0) {
$calsql = 'SELECT * FROM #__jevents_icsfile WHERE ics_id=' . intval($row->icsid());
$db->setQuery($calsql);
$cal = $db->loadObject();
if ($cal && $cal->icaltype == 0) {
$nativeCals[$cal->ics_id] = $cal;
$this->view->assign("offerlock", 1);
}
}
$excats = "0";
if ($jevuser && $jevuser->categories != "" && $jevuser->categories != "all") {
// Find which categories to exclude
if (JVersion::isCompatible("1.6.0")) {
$catsql = 'SELECT id FROM #__categories WHERE id NOT IN (' . str_replace("|", ",", $jevuser->categories) . ') AND extension="com_jevents"';
} else {
//.........这里部分代码省略.........
开发者ID:andreassetiawanhartanto,项目名称:PDKKI,代码行数:101,代码来源:icalevent.php
示例17: JEventsBuildRouteNew
function JEventsBuildRouteNew(&$query, $task)
{
$transtask = translatetask($task);
$params = JComponentHelper::getParams("com_jevents");
// get a menu item based on Itemid or currently active
$app = JFactory::getApplication();
$menu = $app->getMenu();
// we need a menu item. Either the one specified in the query, or the current active one if none specified
if (empty($query['Itemid'])) {
$menuItem = $menu->getActive();
$menuItemGiven = false;
} else {
$menuItem = $menu->getItem($query['Itemid']);
$menuItemGiven = true;
}
$cfg = JEVConfig::getInstance();
$segments = array();
if (count($query) == 2 && isset($query['Itemid']) && isset($query['option'])) {
// special case where we do not need any information since its a menu item
// as long as the task matches up!
$menu = JFactory::getApplication()->getMenu();
$menuitem = $menu->getItem($query["Itemid"]);
if (!is_null($menuitem) && (isset($menuitem->query["task"]) || isset($menuitem->query["view"]) && isset($menuitem->query["layout"]))) {
if (isset($menuitem->query["task"]) && $task == $menuitem->query["task"]) {
return $segments;
} else {
if (isset($menuitem->query["view"]) && isset($menuitem->query["layout"]) && $task == $menuitem->query["view"] . "." . $menuitem->query["layout"]) {
return $segments;
} else {
$segments[] = $transtask;
}
}
}
}
switch ($task) {
case "year.listevents":
case "month.calendar":
case "week.listevents":
case "day.listevents":
case "cat.listevents":
case "jevent.detail":
case "icalevent.detail":
case "icalrepeat.detail":
case "search.form":
case "search.results":
case "admin.listevents":
if (!in_array($transtask, $segments)) {
$segments[] = $transtask;
}
$config = JFactory::getConfig();
$t_datenow = JEVHelper::getNow();
// if no date in the query then use TODAY not the calendar date
$nowyear = JevDate::strftime('%Y', $t_datenow->toUnix(true));
$nowmonth = JevDate::strftime('%m', $t_datenow->toUnix(true));
$nowday = JevDate::strftime('%d', $t_datenow->toUnix(true));
if (isset($query['year'])) {
$year = $query['year'] == "YYYYyyyy" ? "YYYYyyyy" : intval($query['year']);
unset($query['year']);
} else {
$year = $nowyear;
}
if (isset($query['month'])) {
$month = $query['month'] == "MMMMmmmm" ? "MMMMmmmm" : intval($query['month']);
unset($query['month']);
} else {
$month = $nowmonth;
}
if (isset($query['day'])) {
$day = intval($query['day']);
unset($query['day']);
} else {
// if no date in the query then use TODAY not the calendar date
$day = $nowday;
}
// for week data always go to the start of the week
if ($task == "week.listevents" && is_int($month)) {
$startday = $cfg->get('com_starday');
if (!$startday) {
$startday = 0;
}
$date = mktime(5, 5, 5, $month, $day, $year);
$currentday = strftime("%w", $date);
if ($currentday > $startday) {
$date -= ($currentday - $startday) * 86400;
list($year, $month, $day) = explode("-", strftime("%Y-%m-%d", $date));
} else {
if ($currentday < $startday) {
$date -= (7 + $currentday - $startday) * 86400;
list($year, $month, $day) = explode("-", strftime("%Y-%m-%d", $date));
}
}
}
// only include the year in the date and list views
if (in_array($task, array("year.listevents", "month.calendar", "week.listevents", "day.listevents"))) {
$segments[] = $year;
}
// only include the month in the date and list views (excluding year)
if (in_array($task, array("month.calendar", "week.listevents", "day.listevents"))) {
$segments[] = $month;
}
//.........这里部分代码省略.........
开发者ID:madcsaba,项目名称:li-de,代码行数:101,代码来源:router.php
示例18: JEventsBuildRoute
function JEventsBuildRoute(&$query)
{
$cfg =& JEVConfig::getInstance();
$segments = array();
// sometimes the task is not set but view and layout are so tackle this!
if (!isset($query['task']) && isset($query['view']) && isset($query['layout'])) {
$query['task'] = $query['view'] . "." . $query['layout'];
}
// We don't need the view - its only used to manipulate parameters
if (isset($query['view'])) {
unset($query['view']);
}
if (isset($query['layout'])) {
unset($query['layout']);
}
$task = false;
$task = false;
if (!isset($query['task'])) {
if (isset($query["Itemid"])) {
$menu =& JSite::getMenu();
$menuitem = $menu->getItem($query["Itemid"]);
if (!is_null($menuitem) && isset($menuitem->query["task"])) {
$task = $menuitem->query["task"];
return $segments;
} else {
if (!is_null($menuitem) && isset($menuitem->query["layout"]) && isset($menuitem->query["view"])) {
$task = $menuitem->query["view"] . "." . $menuitem->query["layout"];
}
}
}
if (!$task) {
$task = 'month.calendar';
}
} else {
$task = $query['task'];
unset($query['task']);
}
switch ($task) {
case "year.listevents":
case "month.calendar":
case "week.listevents":
case "day.listeven
|
请发表评论