本文整理汇总了PHP中JevDate::mktime方法的典型用法代码示例。如果您正苦于以下问题:PHP JevDate::mktime方法的具体用法?PHP JevDate::mktime怎么用?PHP JevDate::mktime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JevDate
的用法示例。
在下文中一共展示了JevDate::mktime方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
}
示例2: 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;
}
示例3: 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}");
}
示例4: 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;
}
示例5: 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}");
}
示例6: checkRobotsMetaTag
/**
* Function that overwrites meta-tags in mainframe!!
*
* @static
* @param string $name - metatag name
* @param string $content - metatag value
*/
public static function checkRobotsMetaTag($name = "robots", $content = "index,follow")
{
// force robots metatag
$cfg = JEVConfig::getInstance();
$document = JFactory::getDocument();
// constrained in some way
if ($cfg->get('com_blockRobots', 0) >= 1) {
// Allow on detail pages - block otherwise unless crawler!
if ($cfg->get('com_blockRobots', 0) == 3) {
if (strpos(JRequest::getString("jevtask", ""), ".detail") > 0) {
$document->setMetaData($name, "index,nofollow");
return;
}
if (strpos(JRequest::getString("jevtask", ""), "crawler") !== false || $content != "index,follow") {
$document->setMetaData($name, $content);
} else {
$document->setMetaData($name, "noindex,nofollow");
}
return;
}
// Always block Robots
if ($cfg->get('com_blockRobots', 0) == 1) {
$document->setMetaData($name, "noindex,nofollow");
return;
}
// conditional on date
list($cyear, $cmonth, $cday) = JEVHelper::getYMD();
$cdate = JevDate::mktime(0, 0, 0, $cmonth, $cday, $cyear);
$prior = JevDate::strtotime($cfg->get('robotprior', "-1 day"));
if ($cdate < $prior && $cfg->get('com_blockRobots', 0)) {
$document->setMetaData($name, "noindex,nofollow");
return;
}
$post = JevDate::strtotime($cfg->get('robotpost', "-1 day"));
if ($cdate > $post && $cfg->get('com_blockRobots', 0)) {
$document->setMetaData($name, "noindex,nofollow");
return;
}
//If JEvents is not blocking robots we use menu item configuration
$document->setMetaData($name, $cfg->get('robots', $content));
} else {
$document->setMetaData($name, $cfg->get('robots', $content));
}
}
示例7: calendarCell
function calendarCell(&$currentDay, $year, $month, $i, $slot = "")
{
$cfg = JEVConfig::getInstance();
$event = $currentDay["events"][$i];
// Event publication infomation
$event_up = new JEventDate($event->startDate());
$event_down = new JEventDate($event->endDate());
// BAR COLOR GENERATION
$bgeventcolor = JEV_CommonFunctions::setColor($event);
$start_publish = JevDate::mktime(0, 0, 0, $event->mup(), $event->dup(), $event->yup());
$stop_publish = JevDate::mktime(0, 0, 0, $event->mdn(), $event->ddn(), $event->ydn());
// this file controls the events component month calendar display cell output. It is separated from the
// showCalendar function in the events.php file to allow users to customize this portion of the code easier.
// The event information to be displayed within a month day on the calendar can be modified, as well as any
// overlay window information printed with a javascript mouseover event. Each event prints as a separate table
// row with a single column, within the month table's cell.
// On mouse over date formats
// Note that the date formats for the events can be easily changed by modifying the sprintf formatting
// string below. These are used for the default overlay window. As well, the JevDate::strftime() function could
// also be used instead to provide more powerful date formatting which supports locales if php function
// set_locale() is being used.
// define start and end
$cellStart = '<div class="eventfull"><div class="eventstyle" ';
$cellStyle = '';
$cellEnd = '</div></div>' . "\n";
// add the event color as the column background color
include_once JPATH_ADMINISTRATOR . "/components/" . JEV_COM_COMPONENT . "/libraries/colorMap.php";
//$colStyle .= $bgeventcolor ? ' background-color:' . $bgeventcolor . ';' : '';
//$colStyle .= $bgeventcolor ? 'color:'.JevMapColor($bgeventcolor) . ';' : '';
// MSIE ignores "inherit" color for links - stupid Microsoft!!!
//$linkStyle = $bgeventcolor ? 'style="color:'.JevMapColor($bgeventcolor) . ';"' : '';
$linkStyle = "";
// The title is printed as a link to the event's detail page
$link = $this->event->viewDetailLink($year, $month, $currentDay['d0'], false);
$link = JRoute::_($link . $this->_datamodel->getCatidsOutLink());
$title = $event->title();
// [mic] if title is too long, cut 'em for display
$tmpTitle = $title;
// set truncated title
if (!isset($this->event->truncatedtitle)) {
if (JString::strlen($title) >= $cfg->get('com_calCutTitle', 50)) {
$tmpTitle = JString::substr($title, 0, $cfg->get('com_calCutTitle', 50)) . ' ...';
}
$tmpTitle = JEventsHTML::special($tmpTitle);
$this->event->truncatedtitle = $tmpTitle;
} else {
$tmpTitle = $this->event->truncatedtitle;
}
// [new mic] if amount of displaing events greater than defined, show only a scmall coloured icon
// instead of full text - the image could also be "recurring dependig", which means
// for each kind of event (one day, multi day, last day) another icon
// in this case the dfinition must moved down to be more flexible!
// [tstahl] add a graphic symbol for all day events?
$tmp_start_time = $this->start_time == $this->stop_time && !$this->event->noendtime() || $this->event->alldayevent() ? '' : $this->start_time;
$templatedcell = false;
if ($currentDay['countDisplay'] < $cfg->get('com_calMaxDisplay', 5)) {
ob_start();
$templatedcell = $this->loadedFromTemplate('month.calendar_cell', $this->event, 0);
$res = ob_get_clean();
if ($templatedcell) {
$templatedcell = $res;
} else {
if ($this->_view) {
$this->_view->assignRef("link", $link);
$this->_view->assignRef("linkStyle", $linkStyle);
$this->_view->assignRef("tmp_start_time", $tmp_start_time);
$this->_view->assignRef("tmpTitle", $tmpTitle);
}
$title_event_link = $this->loadOverride("cellcontent");
// allow fallback to old method
if ($title_event_link == "") {
$title_event_link = "\n" . '<a class="cal_titlelink" href="' . $link . '" ' . $linkStyle . '>' . ($cfg->get('com_calDisplayStarttime') ? $tmp_start_time : '') . ' ' . $tmpTitle . '</a>' . "\n";
}
$cellStyle .= "border-width:0px 0px 1px 8px;border-color:{$bgeventcolor};padding:0px 0px 1px 2px;";
}
} else {
$eventIMG = '<img align="left" src="' . JURI::root() . 'components/' . JEV_COM_COMPONENT . '/images/event.png" alt="" style="height:12px;width:8px;border:1px solid white;background-color:' . $bgeventcolor . '" />';
$title_event_link = "\n" . '<a class="cal_titlelink" href="' . $link . '">' . $eventIMG . '</a>' . "\n";
$cellStyle .= ' float:left;width:10px;';
}
$cellString = '';
// allow template overrides for cell popups
// only try override if we have a view reference
if ($this->_view) {
$this->_view->assignRef("ecc", $this);
$this->_view->assignRef("cellDate", $currentDay["cellDate"]);
}
if ($cfg->get("com_enableToolTip", 1)) {
if ($cfg->get("tooltiptype", 'joomla') == 'overlib') {
$tooltip = $this->loadOverride("overlib");
// allow fallback to old method
if ($tooltip == "") {
$tooltip = $this->calendarCell_popup($currentDay["cellDate"]);
}
$cellString .= $tooltip;
} else {
// TT background
if ($cfg->get('com_calTTBackground', 1) == '1') {
$bground = $this->event->bgcolor();
$fground = $this->event->fgcolor();
//.........这里部分代码省略.........
示例8: __construct
function __construct($view, $today_date, $view_date, $dates, $alts, $option, $task, $Itemid)
{
global $catidsOut;
if (JRequest::getInt('pop', 0)) {
return;
}
$cfg = JEVConfig::getInstance();
$compname = JEV_COM_COMPONENT;
//Lets check if we should show the nav on event details
if ($task == "icalrepeat.detail" && $cfg->get('shownavbar_detail', 1) == 0) {
return;
}
$this->iconstoshow = $cfg->get('iconstoshow', array('byyear', 'bymonth', 'byweek', 'byday', 'search'));
$viewimages = JURI::root() . "components/" . JEV_COM_COMPONENT . "/views/" . $view->getViewName() . "/assets/images";
$cat = "";
$hiddencat = "";
if ($catidsOut != 0) {
$cat = '&catids=' . $catidsOut;
$hiddencat = '<input type="hidden" name="catids" value="' . $catidsOut . '"/>';
}
$link = 'index.php?option=' . $option . '&task=' . $task . $cat . '&Itemid=' . $Itemid . '&';
$month_date = JevDate::mktime(0, 0, 0, $view_date->month, $view_date->day, $view_date->year);
?>
<?php
if ($task == "month.calendar") {
echo "<div class='month_date'><div class='month_title'>" . JEV_CommonFunctions::jev_strftime("%B", $month_date) . ", </div><div class='month_title_year'> " . JEV_CommonFunctions::jev_strftime("%Y", $month_date) . "</div></div>";
}
?>
<div class="new-navigation">
<div class="nav-items">
<?php
if (in_array("byyear", $this->iconstoshow)) {
?>
<div id="nav-year"<?php
if ($task == "year.listevents") {
echo ' class="active"';
}
?>
>
<a href="<?php
echo JRoute::_('index.php?option=' . $option . $cat . '&task=year.listevents&' . $view_date->toDateURL() . '&Itemid=' . $Itemid);
?>
" title="<?php
echo JText::_('JEV_VIEWBYYEAR');
?>
" >
<?php
echo JText::_('JEV_VIEWBYYEAR');
?>
</a>
</div>
<?php
}
?>
<?php
if (in_array("bymonth", $this->iconstoshow)) {
?>
<div id="nav-month"<?php
if ($task == "month.calendar") {
echo ' class="active"';
}
?>
>
<a href="<?php
echo JRoute::_('index.php?option=' . $option . $cat . '&task=month.calendar&' . $view_date->toDateURL() . '&Itemid=' . $Itemid);
?>
" title="<?php
echo JText::_('JEV_VIEWBYMONTH');
?>
" > <?php
echo JText::_('JEV_VIEWBYMONTH');
?>
</a>
</div>
<?php
}
?>
<?php
if (in_array("byweek", $this->iconstoshow)) {
?>
<div id="nav-week"<?php
if ($task == "week.listevents") {
echo ' class="active"';
}
?>
>
<a href="<?php
echo JRoute::_('index.php?option=' . $option . $cat . '&task=week.listevents&' . $view_date->toDateURL() . '&Itemid=' . $Itemid);
?>
" title="<?php
echo JText::_('JEV_VIEWBYWEEK');
?>
" >
<?php
echo JText::_('JEV_VIEWBYWEEK');
?>
</a>
</div>
<?php
}
//.........这里部分代码省略.........
示例9:
<div class="jev_toprow">
<div class="jev_header2">
<div class="previousmonth">
<?php
if ($precedingWeek) {
echo "<a href='" . $precedingWeek . "' title='" . JText::_("PRECEEDING_Week") . "' >" . JText::_("PRECEEDING_Week") . "</a>";
}
?>
</div>
<div class="currentmonth">
<?php
$week_start = $data['days']['0'];
$week_end = $data['days']['6'];
$starttime = JevDate::mktime(0, 0, 0, $week_start['week_month'], $week_start['week_day'], $week_start['week_year']);
$endtime = JevDate::mktime(0, 0, 0, $week_end['week_month'], $week_end['week_day'], $week_end['week_year']);
if ($week_start['week_month'] == $week_end['week_month']) {
$startformat = "%d";
$endformat = "%d %B, %Y";
} else {
if ($week_start['week_year'] == $week_end['week_year']) {
$startformat = "%d %B";
$endformat = "%d %B, %Y";
} else {
$startformat = "%d. %B %Y";
$endformat = "%d. %B %Y";
}
}
echo JEV_CommonFunctions::jev_strftime($startformat, $starttime) . ' - ' . JEV_CommonFunctions::jev_strftime($endformat, $endtime);
?>
</div>
示例10: unixTime
/**
* iCal spec represents date in ISO 8601 format followed by "T" then the time
* a "Z at the end means the time is UTC and not local time zone
*
* TODO make sure if time is UTC we take account of system time offset properly
*
*/
function unixTime($ical_date, $tz = false)
{
jimport("joomla.utilities.date");
static $offset = null;
if (is_null($offset)) {
$config =& JFactory::getConfig();
$offset = $config->getValue('config.offset', 0);
}
if (!is_numeric($ical_date)) {
$t = JevDate::strtotime($ical_date);
if (JString::strpos($ical_date, "Z") > 0) {
if (is_callable("date_default_timezone_set")) {
$timezone = date_default_timezone_get();
// See http://www.php.net/manual/en/timezones.php
$params = JComponentHelper::getParams(JEV_COM_COMPONENT);
// server offset tiemzone
if ($params->get("icaltimezone", "") != "") {
date_default_timezone_set($params->get("icaltimezone", ""));
}
// server offset PARAMS
$serveroffset1 = (JevDate::strtotime(JevDate::strftime('%Y%m%dT%H%M%S', $t)) - JevDate::strtotime(JevDate::strftime('%Y%m%dT%H%M%SZ', $t))) / 3600;
// server offset SERVER
date_default_timezone_set($timezone);
$serveroffset2 = (JevDate::strtotime(JevDate::strftime('%Y%m%dT%H%M%S', $t)) - JevDate::strtotime(JevDate::strftime('%Y%m%dT%H%M%SZ', $t))) / 3600;
$t = new JevDate($ical_date, $serveroffset1 - $serveroffset2);
//$t = new JevDate($ical_date );
date_default_timezone_set($timezone);
echo "icaldate = " . $ical_date . " imported date=" . $t->toMySQL() . "<br/>";
} else {
// Summer Time adjustment
list($y, $m, $d, $h, $min, $s) = explode(":", JevDate::strftime('%Y:%m:%d:%H:%M:%S', $t));
$dst = (JevDate::mktime($h, $min, $s, $m, $d, $y, 0) - JevDate::mktime($h, $min, $s, $m, $d, $y, -1)) / 3600;
// server offset including DST
$serveroffset = (JevDate::strtotime(JevDate::strftime('%Y%m%dT%H%M%S', $t)) - JevDate::strtotime(JevDate::strftime('%Y%m%dT%H%M%SZ', $t))) / 3600;
$serveroffset += $dst;
$t = new JevDate($ical_date, -($serveroffset + $offset));
}
/*
echo "<h3>SET TIMEZONE</h3>";
$timezone= date_default_timezone_get();
date_default_timezone_set('America/New_York');
$tempIcal = "20091020T163000Z";
echo $tempIcal."<br/>";
$temp = JevDate::strtotime($tempIcal);
list($y,$m,$d,$h,$min,$s) = explode(":", JevDate::strftime('%Y:%m:%d:%H:%M:%S',$temp));
echo "$y,$m,$d,$h,$min,$s<br/>";
$dst = (JevDate::mktime($h,$min,$s,$m,$d,$y,0)-JevDate::mktime($h,$min,$s,$m,$d,$y,-1))/3600;
$so = (JevDate::strtotime(JevDate::strftime('%Y%m%dT%H%M%S',$temp))-JevDate::strtotime(JevDate::strftime('%Y%m%dT%H%M%SZ',$temp)))/3600;
echo " dst=".$dst." serverforoffset=".$so."<br/>";
$so += $dst;
$t = new JevDate($tempIcal);
echo $t->toMySQL()."<br><br/>";
$tempIcal = "20091029T163000Z";
echo $tempIcal."<br/>";
$temp = JevDate::strtotime($tempIcal);
list($y,$m,$d,$h,$min,$s) = explode(":", JevDate::strftime('%Y:%m:%d:%H:%M:%S',$temp));
echo "$y,$m,$d,$h,$min,$s<br/>";
$dst = (JevDate::mktime($h,$min,$s,$m,$d,$y,0)-JevDate::mktime($h,$min,$s,$m,$d,$y,-1))/3600;
$so = (JevDate::strtotime(JevDate::strftime('%Y%m%dT%H%M%S',$temp))-JevDate::strtotime(JevDate::strftime('%Y%m%dT%H%M%SZ',$temp)))/3600;
echo " dst=".$dst." serverforoffset=".$so."<br/>";
$so += $dst;
$t = new JevDate($tempIcal );
echo $t->toMySQL()."<br><br/>";
$tempIcal = "20091103T163000Z";
echo $tempIcal."<br/>";
$temp = JevDate::strtotime($tempIcal);
list($y,$m,$d,$h,$min,$s) = explode(":", JevDate::strftime('%Y:%m:%d:%H:%M:%S',$temp));
echo "$y,$m,$d,$h,$min,$s<br/>";
$dst = (JevDate::mktime($h,$min,$s,$m,$d,$y,0)-JevDate::mktime($h,$min,$s,$m,$d,$y,-1))/3600;
$so = (JevDate::strtotime(JevDate::strftime('%Y%m%dT%H%M%S',$temp))-JevDate::strtotime(JevDate::strftime('%Y%m%dT%H%M%SZ',$temp)))/3600;
echo " dst=".$dst." serverforoffset=".$so."<br/>";
$so += $dst;
$t = new JevDate($tempIcal);
echo $t->toMySQL()."<br>";
*/
} else {
if ($tz != false && $tz != "") {
// really should use the timezone of the inputted date
$tz = new DateTimeZone($tz);
$t = new JevDate($ical_date, $tz);
echo "icaldate = " . $ical_date . " imported date=" . $t->toMySQL() . "<br/>";
} else {
$compparams = JComponentHelper::getParams(JEV_COM_COMPONENT);
$jtz = $compparams->get("icaltimezonelive", "");
if ($jtz) {
$t = new JevDate($ical_date, $jtz);
} else {
$t = new JevDate($ical_date);
}
//.........这里部分代码省略.........
示例11: 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;
}
示例12: 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 {
//.........这里部分代码省略.........
示例13: processMatch
//.........这里部分代码省略.........
*/
$fieldval = str_ireplace("%d", $days, $fieldval);
$shownsign = true;
}
if (stripos($fieldval, "%h") !== false) {
$hours = intval($timedelta / (60 * 60));
$timedelta -= $hours * 60 * 60;
if ($shownsign) {
$hours = abs($hours);
}
$hours = sprintf("%02d", $hours);
$fieldval = str_ireplace("%h", $hours, $fieldval);
$shownsign = true;
}
if (stripos($fieldval, "%m") !== false) {
$mins = intval($timedelta / 60);
$timedelta -= $hours * 60;
if ($mins) {
$mins = abs($mins);
}
$mins = sprintf("%02d", $mins);
$fieldval = str_ireplace("%m", $mins, $fieldval);
}
$content .= $fieldval;
break;
case 'extraInfo':
$this->modparams->set("image", 0);
$dayEvent->data->text = $dayEvent->extra_info();
$dispatcher->trigger('onContentPrepare', array('com_jevents', &$dayEvent->data, &$this->modparams, 0));
$dayEvent->extra_info($dayEvent->data->text);
$content .= $dayEvent->extra_info();
break;
case 'countdown':
$timedelta = $dayEvent->getUnixStartTime() - JevDate::mktime();
$eventPassed = !($timedelta >= 0);
$fieldval = $dateParm;
$shownsign = false;
if (stripos($fieldval, "%nopast") !== false) {
if (!$eventPassed) {
$fieldval = str_ireplace("%nopast", "", $fieldval);
} else {
$fieldval = JText::_('JEV_EVENT_FINISHED');
}
}
if (stripos($fieldval, "%d") !== false) {
$days = intval($timedelta / (60 * 60 * 24));
$timedelta -= $days * 60 * 60 * 24;
$fieldval = str_ireplace("%d", $days, $fieldval);
$shownsign = true;
}
if (stripos($fieldval, "%h") !== false) {
$hours = intval($timedelta / (60 * 60));
$timedelta -= $hours * 60 * 60;
if ($shownsign) {
$hours = abs($hours);
}
$hours = sprintf("%02d", $hours);
$fieldval = str_ireplace("%h", $hours, $fieldval);
$shownsign = true;
}
if (stripos($fieldval, "%m") !== false) {
$mins = intval($timedelta / 60);
$timedelta -= $hours * 60;
if ($mins) {
$mins = abs($mins);
}
示例14: _displayCalendarMod
function _displayCalendarMod($time, $startday, $linkString, &$day_name, $monthMustHaveEvent = false, $basedate = false)
{
$db = JFactory::getDBO();
$cfg = JEVConfig::getInstance();
$compname = JEV_COM_COMPONENT;
$cal_day = date("d", $time);
//$cal_year=date("Y",$time);
//$cal_month=date("m",$time);
//list($cal_year,$cal_month,$cal_day) = JEVHelper::getYMD();
if (!$basedate) {
$basedate = $time;
}
$base_year = date("Y", $basedate);
$base_month = date("m", $basedate);
$basefirst_of_month = JevDate::mktime(0, 0, 0, $base_month, 1, $base_year);
$requestYear = JRequest::getInt("year", 0);
$requestMonth = JRequest::getInt("month", 0);
// special case when site link set the dates for the mini-calendar in the URL but not in the ajax request
if ($requestMonth && $requestYear && JRequest::getString("task", "") != "modcal.ajax" && $this->modparams->get("minical_usedate", 0)) {
$requestDay = JRequest::getInt("day", 1);
$requestTime = JevDate::mktime(0, 0, 0, $requestMonth, $requestDay, $requestYear);
if ($time - $basedate > 100000) {
$requestTime = JevDate::strtotime("+1 month", $requestTime);
} else {
if ($time - $basedate < -100000) {
$requestTime = JevDate::strtotime("-1 month", $requestTime);
}
}
$cal_year = date("Y", $requestTime);
$cal_month = date("m", $requestTime);
$base_year = $requestYear;
$base_month = $requestMonth;
$basefirst_of_month = JevDate::mktime(0, 0, 0, $requestMonth, $requestDay, $requestYear);
} else {
$cal_year = date("Y", $time);
$cal_month = date("m", $time);
}
$base_prev_month = $base_month - 1;
$base_next_month = $base_month + 1;
$base_next_month_year = $base_year;
$base_prev_month_year = $base_year;
if ($base_prev_month == 0) {
$base_prev_month = 12;
$base_prev_month_year -= 1;
}
if ($base_next_month == 13) {
$base_next_month = 1;
$base_next_month_year += 1;
}
$reg = JFactory::getConfig();
$reg->set("jev.modparams", $this->modparams);
if ($this->modparams->get("showtooltips", 0)) {
$data = $this->datamodel->getCalendarData($cal_year, $cal_month, 1, false, false);
$this->hasTooltips = true;
} else {
$data = $this->datamodel->getCalendarData($cal_year, $cal_month, 1, true, $this->modparams->get("noeventcheck", 0));
}
$reg->set("jev.modparams", false);
$width = $this->modparams->get("mod_cal_width", "135px");
$height = $this->modparams->get("mod_cal_height", "auto");
$rowheight = $this->modparams->get("mod_cal_rowheight", "auto");
$month_name = JEVHelper::getMonthName($cal_month);
$to_day = date("Y-m-d", $this->timeWithOffset);
$today = JevDate::mktime(0, 0, 0, $cal_month, $cal_day, $cal_year);
$cal_prev_month = $cal_month - 1;
$cal_next_month = $cal_month + 1;
$cal_next_month_year = $cal_year;
$cal_prev_month_year = $cal_year;
// additional EBS
if ($cal_prev_month == 0) {
$cal_prev_month = 12;
$cal_prev_month_year -= 1;
}
if ($cal_next_month == 13) {
$cal_next_month = 1;
$cal_next_month_year += 1;
}
$viewname = $this->getTheme();
$viewpath = JURI::root(true) . "/components/{$compname}/views/" . $viewname . "/assets";
$viewimages = $viewpath . "/images";
$linkpref = "index.php?option={$compname}&Itemid=" . $this->myItemid . $this->cat . "&task=";
/*
$linkprevious = $linkpref."month.calendar&day=$cal_day&month=$cal_prev_month&year=$cal_prev_month_year";
$linkprevious = JRoute::_($linkprevious);
$linkprevious = $this->htmlLinkCloaking($linkprevious, '<img border="0" title="' . JText::_("JEV_PREVIOUSMONTH") . '" alt="' . JText::_("JEV_PREVIOUSMONTH") . '" src="'.$viewimages.'/mini_arrowleft.gif"/>' );
*/
$jev_component_name = JEV_COM_COMPONENT;
$this->_navigationJS($this->_modid);
$scriptlinks = "";
if ($this->minical_prevmonth) {
$linkprevious = htmlentities(JURI::base() . "index.php?option={$jev_component_name}&task=modcal.ajax&day=1&month={$base_prev_month}&year={$base_prev_month_year}&modid={$this->_modid}&tmpl=component" . $this->cat);
$scriptlinks .= "linkprevious = '" . $linkprevious . "';\n";
$linkprevious = '<img border="0" title="' . JText::_("JEV_PREVIOUSMONTH") . '" alt="' . JText::_("JEV_LAST_MONTH") . '" class="mod_events_link" src="' . $viewimages . '/mini_arrowleft.gif" onmousedown="callNavigation(\'' . $linkprevious . '\');" />';
} else {
$linkprevious = "";
}
if ($this->minical_actmonth == 1) {
$linkcurrent = $linkpref . "month.calendar&day={$cal_day}&month={$cal_month}&year={$cal_year}";
$linkcurrent = JRoute::_($linkcurrent);
$linkcurrent = $this->htmlLinkCloaking($linkcurrent, $month_name . " " . $cal_year, array("style" => "text-decoration:none;color:inherit;"));
//.........这里部分代码省略.........
示例15: getAdjacentDay
function getAdjacentDay($year, $month, $day, $direction = 1)
{
$d1 = JevDate::mktime(0, 0, 0, $month, $day + $direction, $year);
$day = JevDate::strftime("%d", $d1);
$year = JevDate::strftime("%Y", $d1);
$cfg = JEVConfig::getInstance();
$earliestyear = JEVHelper::getMinYear();
$latestyear = JEVHelper::getMaxYear();
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 = "";
}
// URL suffix to preserver catids!
$cat = $this->getCatidsOutLink();
return JRoute::_("index.php?option=" . JEV_COM_COMPONENT . "&task={$task}{$item}&year={$year}&month={$month}&day={$day}" . $cat);
}