本文整理汇总了PHP中JEVHelper::getNow方法的典型用法代码示例。如果您正苦于以下问题:PHP JEVHelper::getNow方法的具体用法?PHP JEVHelper::getNow怎么用?PHP JEVHelper::getNow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JEVHelper
的用法示例。
在下文中一共展示了JEVHelper::getNow方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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.listevents":
case "cat.listevents":
case "jevent.detail":
case "icalevent.detail":
case "icalrepeat.detail":
case "search.form":
case "search.results":
case "admin.listevents":
$segments[] = $task;
$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));
/*
$year = intval( JRequest::getVar( 'year', $nowyear ));
$month = intval( JRequest::getVar( 'month', $nowmonth ));
$day = intval( JRequest::getVar( 'day', $nowday ));
*/
if (isset($query['year'])) {
$segments[] = $query['year'];
unset($query['year']);
} else {
// if no date in the query then use TODAY not the calendar date
$segments[] = $nowyear;
}
if (isset($query['month'])) {
$segments[] = $query['month'];
unset($query['month']);
} else {
// if no date in the query then use TODAY not the calendar date
$segments[] = $nowmonth;
}
if (isset($query['day'])) {
$segments[] = $query['day'];
unset($query['day']);
} else {
// if no date in the query then use TODAY not the calendar date
$segments[] = $nowday;
}
switch ($task) {
case "jevent.detail":
case "icalevent.detail":
case "icalrepeat.detail":
if (isset($query['jevtype'])) {
unset($query['jevtype']);
}
if (isset($query['evid'])) {
$segments[] = $query['evid'];
unset($query['evid']);
} else {
$segments[] = "0";
}
/*
// Can we drop the use of uid?
if(isset($query['title'])) {
$segments[] = JFilterOutput::stringURLSafe($query['title']);
unset($query['title']);
//.........这里部分代码省略.........
示例2: DefaultModCalView
function DefaultModCalView($params, $modid)
{
$this->_modid = $modid;
$user =& JFactory::getUser();
$cfg =& JEVConfig::getInstance();
$jev_component_name = JEV_COM_COMPONENT;
$db =& JFactory::getDBO();
$this->datamodel = new JEventsDataModel();
// component config object
$jevents_config =& JEVConfig::getInstance();
$this->modparams =& $params;
$this->aid = $user->aid;
$tmplang =& JFactory::getLanguage();
// get params exclusive to module
$this->inc_ec_css = $this->modparams->get('inc_ec_css', 1);
$this->minical_showlink = $this->modparams->get('minical_showlink', 1);
$this->minical_prevyear = $this->modparams->get('minical_prevyear', 1);
$this->minical_prevmonth = $this->modparams->get('minical_prevmonth', 1);
$this->minical_actmonth = $this->modparams->get('minical_actmonth', 1);
$this->minical_actmonth = $this->modparams->get('minical_actmonth', 1);
$this->minical_actyear = $this->modparams->get('minical_actyear', 1);
$this->minical_nextmonth = $this->modparams->get('minical_nextmonth', 1);
$this->minical_nextyear = $this->modparams->get('minical_nextyear', 1);
// get params exclusive to component
$this->com_starday = intval($jevents_config->get('com_starday', 0));
// make config object (module or component) current
if (intval($this->modparams->get('modcal_useLocalParam', 0)) == 1) {
$myparam =& $this->modparams;
} else {
$myparam =& $jevents_config;
}
// get com_event config parameters for this module
$this->displayLastMonth = $myparam->get('modcal_DispLastMonth', 'NO');
$this->disp_lastMonthDays = $myparam->get('modcal_DispLastMonthDays', 0);
$this->linkCloaking = $myparam->get('modcal_LinkCloaking', 0);
$t_datenow = JEVHelper::getNow();
$this->timeWithOffset = $t_datenow->toUnix(true);
switch ($this->displayLastMonth) {
case 'YES_stop':
$this->disp_lastMonth = 1;
break;
case 'YES_stop_events':
$this->disp_lastMonth = 2;
break;
case 'ALWAYS':
$this->disp_lastMonthDays = 0;
$this->disp_lastMonth = 1;
break;
case 'ALWAYS_events':
$this->disp_lastMonthDays = 0;
$this->disp_lastMonth = 2;
break;
case 'NO':
default:
$this->disp_lastMonthDays = 0;
$this->disp_lastMonth = 0;
break;
}
$this->displayNextMonth = $myparam->get('modcal_DispNextMonth', 'NO');
$this->disp_nextMonthDays = $myparam->get('modcal_DispNextMonthDays', 0);
switch ($this->displayNextMonth) {
case 'YES_stop':
$this->disp_nextMonth = 1;
break;
case 'YES_stop_events':
$this->disp_nextMonth = 2;
break;
case 'ALWAYS':
$this->disp_nextMonthDays = 0;
$this->disp_nextMonth = 1;
break;
case 'ALWAYS_events':
$this->disp_nextMonthDays = 0;
$this->disp_nextMonth = 2;
break;
case 'NO':
default:
$this->disp_nextMonthDays = 0;
$this->disp_nextMonth = 0;
break;
}
// find appropriate Itemid and setup catids for datamodel
$this->myItemid = $this->datamodel->setupModuleCatids($this->modparams);
$this->cat = $this->datamodel->getCatidsOutLink(true);
$this->linkpref = 'index.php?option=' . $jev_component_name . '&Itemid=' . $this->myItemid . $this->cat . '&task=';
}
示例3: 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;
}
//.........这里部分代码省略.........
示例4: processMatch
protected function processMatch(&$content, $match, $dayEvent, $dateParm, $relDay)
{
$datenow = JEVHelper::getNow();
$dispatcher = JDispatcher::getInstance();
// get the title and start time
$startDate = JevDate::strtotime($dayEvent->publish_up());
if ($relDay > 0) {
$eventDate = JevDate::strtotime($datenow->toFormat('%Y-%m-%d ') . JevDate::strftime('%H:%M', $startDate) . " +{$relDay} days");
} else {
$eventDate = JevDate::strtotime($datenow->toFormat('%Y-%m-%d ') . JevDate::strftime('%H:%M', $startDate) . " {$relDay} days");
}
$endDate = JevDate::strtotime($dayEvent->publish_down());
list($st_year, $st_month, $st_day) = explode('-', JevDate::strftime('%Y-%m-%d', $startDate));
list($ev_year, $ev_month, $ev_day) = explode('-', JevDate::strftime('%Y-%m-%d', $startDate));
$task_events = 'icalrepeat.detail';
switch ($match) {
case 'endDate':
case 'startDate':
case 'eventDate':
// Note we need to examine the date specifiers used to determine if language translation will be
// necessary. Do this later when script is debugged.
if (!$this->disableDateStyle) {
$content .= '<span class="mod_events_latest_date">';
}
if (!$dayEvent->alldayevent() && $match == "endDate" && ($dayEvent->noendtime() && $dayEvent->getUnixStartDate() == $dayEvent->getUnixEndDate() || $dayEvent->getUnixStartTime() == $dayEvent->getUnixEndTime())) {
$time_fmt = "";
} else {
if (!isset($dateParm) || $dateParm == '') {
if ($this->com_calUseStdTime) {
$time_fmt = $dayEvent->alldayevent() ? '' : IS_WIN ? ' @%I:%M%p' : ' @%l:%M%p';
} else {
$time_fmt = $dayEvent->alldayevent() ? '' : ' @%H:%M';
}
$dateFormat = $this->displayYear ? '%a %b %d, %Y' . $time_fmt : '%a %b %d' . $time_fmt;
$jmatch = new JevDate(${$match});
$content .= $jmatch->toFormat($dateFormat);
//$content .= JEV_CommonFunctions::jev_strftime($dateFormat, $$match);
} else {
// format endDate when midnight to show midnight!
if ($match == "endDate" && $dayEvent->sdn() == 59) {
$tempEndDate = $endDate + 1;
if ($dayEvent->alldayevent()) {
// if an all day event then we don't want to roll to the next day
$tempEndDate -= 86400;
}
$match = "tempEndDate";
}
// if a '%' sign detected in date format string, we assume JevDate::strftime() is to be used,
if (preg_match("/\\%/", $dateParm)) {
$jmatch = new JevDate(${$match});
$content .= $jmatch->toFormat($dateParm);
} else {
$content .= date($dateParm, ${$match});
}
if ($match == "tempDndDate") {
$match = "endDate";
}
}
}
if (!$this->disableDateStyle) {
$content .= "</span>";
}
break;
case 'title':
$title = $dayEvent->title();
if (!empty($dateParm)) {
$parts = explode("|", $dateParm);
if (count($parts) > 0 && strlen($title) > intval($parts[0])) {
$title = substr($title, 0, intval($parts[0]));
if (count($parts) > 1) {
$title .= $parts[1];
}
}
}
if (!$this->disableTitleStyle) {
$content .= '<span class="mod_events_latest_content">';
}
if ($this->displayLinks) {
$link = $dayEvent->viewDetailLink($ev_year, $ev_month, $ev_day, false, $this->myItemid);
if ($this->modparams->get("ignorefiltermodule", 0)) {
$link = JRoute::_($link . $this->datamodel->getCatidsOutLink() . "&filter_reset=1");
} else {
$link = JRoute::_($link . $this->datamodel->getCatidsOutLink());
}
$content .= $this->_htmlLinkCloaking($link, JEventsHTML::special($title));
} else {
$content .= JEventsHTML::special($title);
}
if (!$this->disableTitleStyle) {
$content .= '</span>';
}
break;
case 'category':
$catobj = $dayEvent->getCategoryName();
$content .= JEventsHTML::special($catobj);
break;
case 'categoryimage':
$catobj = $dayEvent->getCategoryImage();
$content .= $catobj;
break;
//.........这里部分代码省略.........
示例5: getYMD
/**
* Get array Year, Month, Day from current Request, fallback to current date
*
* @return array
*/
public static function getYMD()
{
static $data;
if (!isset($data)) {
$datenow = JEVHelper::getNow();
list($yearnow, $monthnow, $daynow) = explode('-', $datenow->toFormat('%Y-%m-%d'));
$year = min(2100, abs(intval(JRequest::getVar('year', $yearnow))));
$month = min(99, abs(intval(JRequest::getVar('month', $monthnow))));
$day = min(3650, abs(intval(JRequest::getVar('day', $daynow))));
if ($day <= 0) {
$day = $daynow;
}
if ($month <= 0) {
$month = $monthnow;
}
if ($year <= 0) {
$year = $yearnow;
}
if ($day <= '9') {
$day = '0' . $day;
}
if ($month <= '9') {
$month = '0' . $month;
}
// Make sure $day is not outside the month
$lastDayOfMonth = intval(strftime("%d", mktime(6, 0, 0, $month + 1, 1, $year) - 86400));
$day = $lastDayOfMonth < $day ? $lastDayOfMonth : $day;
$data = array();
$data[] = $year;
$data[] = $month;
$data[] = $day;
}
return $data;
}
示例6: displayLatestEvents
function displayLatestEvents()
{
// this will get the viewname based on which classes have been implemented
$viewname = $this->getTheme();
$cfg =& JEVConfig::getInstance();
$compname = JEV_COM_COMPONENT;
$viewpath = "components/" . JEV_COM_COMPONENT . "/views/" . $viewname . "/assets/css/";
$dispatcher =& JDispatcher::getInstance();
$datenow = JEVHelper::getNow();
$this->getLatestEventsData();
$content = "";
$content .= '<table class="mod_events_latest_table" width="100%" border="0" cellspacing="0" cellpadding="0" align="center">';
if (isset($this->eventsByRelDay) && count($this->eventsByRelDay)) {
// Now to display these events, we just start at the smallest index of the $this->eventsByRelDay array
// and work our way up.
$firstTime = true;
// initialize name of com_jevents module and task defined to view
// event detail. Note that these could change in future com_event
// component revisions!! Note that the '$this->itemId' can be left out in
// the link parameters for event details below since the event.php
// component handler will fetch its own id from the db menu table
// anyways as far as I understand it.
$this->processFormatString();
foreach ($this->eventsByRelDay as $relDay => $daysEvents) {
reset($daysEvents);
// get all of the events for this day
foreach ($daysEvents as $dayEvent) {
if ($firstTime) {
$content .= '<tr><td class="mod_events_latest_first">';
} else {
$content .= '<tr><td class="mod_events_latest">';
}
// generate output according custom string
foreach ($this->splitCustomFormat as $condtoken) {
if (isset($condtoken['cond'])) {
if ($condtoken['cond'] == 'a' && !$dayEvent->alldayevent()) {
continue;
} else {
if ($condtoken['cond'] == '!a' && $dayEvent->alldayevent()) {
continue;
} else {
if ($condtoken['cond'] == 'e' && !($dayEvent->noendtime() || $dayEvent->alldayevent())) {
continue;
} else {
if ($condtoken['cond'] == '!e' && ($dayEvent->noendtime() || $dayEvent->alldayevent())) {
continue;
} else {
if ($condtoken['cond'] == '!m' && $dayEvent->getUnixStartDate() != $dayEvent->getUnixEndDate()) {
continue;
} else {
if ($condtoken['cond'] == 'm' && $dayEvent->getUnixStartDate() == $dayEvent->getUnixEndDate()) {
continue;
}
}
}
}
}
}
}
foreach ($condtoken['data'] as $token) {
unset($match);
unset($dateParm);
$dateParm = "";
$match = '';
if (is_array($token)) {
$match = $token['keyword'];
$dateParm = isset($token['dateParm']) ? trim($token['dateParm']) : "";
} else {
if (strpos($token, '${') !== false) {
$match = $token;
} else {
$content .= $token;
continue;
}
}
$this->processMatch($content, $match, $dayEvent, $dateParm, $relDay);
}
// end of foreach
}
// end of foreach
$content .= "</td></tr>\n";
$firstTime = false;
}
// end of foreach
}
// end of foreach
} else {
$content .= '<tr><td class="mod_events_latest_noevents">' . JText::_('JEV_NO_EVENTS') . '</td></tr>' . "\n";
}
$content .= "</table>\n";
$callink_HTML = '<div class="mod_events_latest_callink">' . $this->getCalendarLink() . '</div>';
if ($this->linkToCal == 1) {
$content = $callink_HTML . $content;
}
if ($this->linkToCal == 2) {
$content .= $callink_HTML;
}
if ($this->displayRSS) {
if (JVersion::isCompatible("1.6.0")) {
$rssimg = JURI::root() . "media/system/images/livemarks.png";
//.........这里部分代码省略.........
示例7: displayLatestEvents
function displayLatestEvents()
{
$cfg = JEVConfig::getInstance();
$compname = JEV_COM_COMPONENT;
$dispatcher = JDispatcher::getInstance();
$datenow = JEVHelper::getNow();
$this->getLatestEventsData();
$content = "";
if (isset($this->eventsByRelDay) && count($this->eventsByRelDay)) {
$content .= $this->modparams->get("modlatest_templatetop") ? $this->modparams->get("modlatest_templatetop") : '<table class="mod_events_latest_table jevbootstrap" width="100%" border="0" cellspacing="0" cellpadding="0" align="center">';
// Now to display these events, we just start at the smallest index of the $this->eventsByRelDay array
// and work our way up.
$firstTime = true;
// initialize name of com_jevents module and task defined to view
// event detail. Note that these could change in future com_event
// component revisions!! Note that the '$this->itemId' can be left out in
// the link parameters for event details below since the event.php
// component handler will fetch its own id from the db menu table
// anyways as far as I understand it.
$task_events = 'icalrepeat.detail';
$this->processFormatString();
foreach ($this->eventsByRelDay as $relDay => $daysEvents) {
reset($daysEvents);
// get all of the events for this day
foreach ($daysEvents as $dayEvent) {
$eventcontent = "";
// generate output according custom string
foreach ($this->splitCustomFormat as $condtoken) {
if (isset($condtoken['cond'])) {
if ($condtoken['cond'] == 'a' && !$dayEvent->alldayevent()) {
continue;
} else {
if ($condtoken['cond'] == '!a' && $dayEvent->alldayevent()) {
continue;
} else {
if ($condtoken['cond'] == 'e' && !($dayEvent->noendtime() || $dayEvent->alldayevent())) {
continue;
} else {
if ($condtoken['cond'] == '!e' && ($dayEvent->noendtime() || $dayEvent->alldayevent())) {
continue;
} else {
if ($condtoken['cond'] == '!m' && $dayEvent->getUnixStartDate() != $dayEvent->getUnixEndDate()) {
continue;
} else {
if ($condtoken['cond'] == 'm' && $dayEvent->getUnixStartDate() == $dayEvent->getUnixEndDate()) {
continue;
}
}
}
}
}
}
}
foreach ($condtoken['data'] as $token) {
unset($match);
unset($dateParm);
$dateParm = "";
$match = '';
if (is_array($token)) {
$match = $token['keyword'];
$dateParm = isset($token['dateParm']) ? trim($token['dateParm']) : "";
} else {
if (strpos($token, '${') !== false) {
$match = $token;
} else {
$eventcontent .= $token;
continue;
}
}
$this->processMatch($eventcontent, $match, $dayEvent, $dateParm, $relDay);
}
// end of foreach
}
// end of foreach
$dst = "border-color:" . $dayEvent->bgcolor();
if ($firstTime) {
$eventrow = '<tr><td class="mod_events_latest_first" style="' . $dst . '">%s' . "</td></tr>\n";
} else {
$eventrow = '<tr><td class="mod_events_latest" style="' . $dst . '">%s' . "</td></tr>\n";
}
$templaterow = $this->modparams->get("modlatest_templaterow") ? $this->modparams->get("modlatest_templaterow") : $eventrow;
$content .= str_replace("%s", $eventcontent, $templaterow);
$firstTime = false;
}
// end of foreach
}
// end of foreach
$content .= $this->modparams->get("modlatest_templatebottom") ? $this->modparams->get("modlatest_templatebottom") : "</table>\n";
} else {
if ($this->modparams->get("modlatest_NoEvents", 1)) {
$content .= $this->modparams->get("modlatest_templatetop") ? $this->modparams->get("modlatest_templatetop") : '<table class="mod_events_latest_table jevbootstrap" width="100%" border="0" cellspacing="0" cellpadding="0" align="center">';
$templaterow = $this->modparams->get("modlatest_templaterow") ? $this->modparams->get("modlatest_templaterow") : '<tr><td class="mod_events_latest_noevents">%s</td></tr>' . "\n";
$content .= str_replace("%s", JText::_('JEV_NO_EVENTS'), $templaterow);
$content .= $this->modparams->get("modlatest_templatebottom") ? $this->modparams->get("modlatest_templatebottom") : "</table>\n";
}
}
$callink_HTML = '<div class="mod_events_latest_callink">' . $this->getCalendarLink() . '</div>';
if ($this->linkToCal == 1) {
$content = $callink_HTML . $content;
}
//.........这里部分代码省略.........
示例8: getKeywordData
function getKeywordData($keyword, $limit, $limitstart, $useRegX = true)
{
$data = array();
$user =& JFactory::getUser();
$Itemid = JEVHelper::getItemid();
$db =& JFactory::getDBO();
$cfg =& JEVConfig::getInstance();
include_once JPATH_ADMINISTRATOR . "/components/" . JEV_COM_COMPONENT . "/libraries/colorMap.php";
$keyword = preg_replace("/[[:space:]]+/", ' +', $keyword);
$keyword = trim($keyword);
$keyword = preg_replace("/\\++/", '+', $keyword);
$keywordcheck = preg_replace("/ |\\+/", '', $keyword);
$searchisValid = false;
$total = 0;
if (empty($keyword) || JString::strlen($keywordcheck) < 3 || $keyword == '%%' || $keywordcheck == '') {
$keyword = JText::_('JEV_KEYWORD_NOT_VALID');
$num_events = 0;
$rows = array();
$data['total'] = 0;
$data['limit'] = 0;
$data['limitstart'] = 0;
$data['num_events'] = 0;
} else {
$searchisValid = true;
$rows = $this->queryModel->listEventsByKeyword($keyword, 'publish_up,catid', $limit, $limitstart, $total, $useRegX);
$data['total'] = $total;
$data['limit'] = $limit;
$data['limitstart'] = $limitstart;
$num_events = count($rows);
$data['num_events'] = $num_events;
}
$chdate = '';
$chcat = '';
if ($num_events > 0) {
for ($r = 0; $r < $num_events; $r++) {
$row =& $rows[$r];
$row->catname = $row->getCategoryName();
$row->contactlink = JEventsHTML::getUserMailtoLink($row->id(), $row->created_by());
$row->bgcolor = JEV_CommonFunctions::setColor($row);
$row->fgcolor = JevMapColor($row->bgcolor);
$t_datenow = JEVHelper::getNow();
$now_adjusted = $t_datenow->toUnix(true);
if ($row->mup() == JevDate::strftime('%m', $now_adjusted) && $row->yup() == JevDate::strftime('%Y', $now_adjusted) && $row->dup() == JevDate::strftime('%d', $now_adjusted)) {
$row->today = true;
} else {
$row->today = false;
}
}
}
$data['rows'] = $rows;
return $data;
}
示例9: getNextRepeat
function getNextRepeat($allowexceptions = true)
{
$t_datenow = JEVHelper::getNow();
$now = $t_datenow->toMysql();
$db =& JFactory::getDBO();
$query = "SELECT ev.*, rpt.*, rr.*, det.* " . "\n , YEAR(rpt.startrepeat) as yup, MONTH(rpt.startrepeat ) as mup, DAYOFMONTH(rpt.startrepeat ) as dup" . "\n , YEAR(rpt.endrepeat ) as ydn, MONTH(rpt.endrepeat ) as mdn, DAYOFMONTH(rpt.endrepeat ) as ddn" . "\n , HOUR(rpt.startrepeat) as hup, MINUTE(rpt.startrepeat ) as minup, SECOND(rpt.startrepeat ) as sup" . "\n , HOUR(rpt.endrepeat ) as hdn, MINUTE(rpt.endrepeat ) as mindn, SECOND(rpt.endrepeat ) as sdn" . "\n FROM #__jevents_vevent as ev " . "\n LEFT JOIN #__jevents_repetition as rpt ON rpt.eventid = ev.ev_id" . "\n LEFT JOIN #__jevents_vevdetail as det ON det.evdet_id = rpt.eventdetail_id" . "\n LEFT JOIN #__jevents_rrule as rr ON rr.eventid = ev.ev_id" . (!$allowexceptions ? "\n LEFT JOIN #__jevents_exception as exc ON exc.rp_id=rpt.rp_id" : "") . "\n WHERE ev.ev_id = '" . $this->ev_id() . "' " . (!$allowexceptions ? "\n AND exc.rp_id IS NULL" : "") . "\n AND rpt.startrepeat >= '" . $now . "' " . "\n ORDER BY rpt.startrepeat asc LIMIT 1";
$db->setQuery($query);
$rows = $db->loadObjectList();
if (!$rows || count($rows) == 0) {
// Look backwards as fallback
$query = "SELECT ev.*, rpt.*, rr.*, det.* " . "\n , YEAR(rpt.startrepeat) as yup, MONTH(rpt.startrepeat ) as mup, DAYOFMONTH(rpt.startrepeat ) as dup" . "\n , YEAR(rpt.endrepeat ) as ydn, MONTH(rpt.endrepeat ) as mdn, DAYOFMONTH(rpt.endrepeat ) as ddn" . "\n , HOUR(rpt.startrepeat) as hup, MINUTE(rpt.startrepeat ) as minup, SECOND(rpt.startrepeat ) as sup" . "\n , HOUR(rpt.endrepeat ) as hdn, MINUTE(rpt.endrepeat ) as mindn, SECOND(rpt.endrepeat ) as sdn" . "\n FROM #__jevents_vevent as ev " . "\n LEFT JOIN #__jevents_repetition as rpt ON rpt.eventid = ev.ev_id" . "\n LEFT JOIN #__jevents_vevdetail as det ON det.evdet_id = rpt.eventdetail_id" . "\n LEFT JOIN #__jevents_rrule as rr ON rr.eventid = ev.ev_id" . (!$allowexceptions ? "\n LEFT JOIN #__jevents_exception as exc ON exc.rp_id=rpt.rp_id" : "") . "\n WHERE ev.ev_id = '" . $this->ev_id() . "' " . (!$allowexceptions ? "\n AND exc.rp_id IS NULL" : "") . "\n AND rpt.startrepeat <= '" . $now . "' " . "\n ORDER BY rpt.startrepeat desc LIMIT 1";
$db->setQuery($query);
$rows = $db->loadObjectList();
}
$row = null;
// iCal agid uses GUID or UUID as identifier
if ($rows) {
$row = new jIcalEventRepeat($rows[0]);
}
return $row;
}
示例10: DefaultViewHelperShowNavTableBar
function DefaultViewHelperShowNavTableBar($view)
{
// this, previous and next date handling
$cfg =& JEVConfig::getInstance();
// Optionally display no nav bar
if ($cfg->get('com_calUseIconic', 1) == -1) {
return "";
}
$t_datenow = JEVHelper::getNow();
$datetime = JevDate::strftime('%Y-%m-%d %H:%M:%S', $t_datenow->toUnix(true));
preg_match("#([0-9]{4})-([0-9]{2})-([0-9]{2})[ ]([0-9]{2}):([0-9]{2}):([0-9]{2})#", $datetime, $regs);
$this_date = new JEventDate();
$this_date->setDate($view->year, $view->month, $view->day);
$today_date = clone $this_date;
$today_date->setDate($regs[1], $regs[2], $regs[3]);
$task = JRequest::getString("jevtask");
$view->loadModules("jevpretoolbar");
$view->loadModules("jevpretoolbar_" . $task);
$prev_year = clone $this_date;
$prev_year->addMonths(-12);
$next_year = clone $this_date;
$next_year->addMonths(+12);
$prev_month = clone $this_date;
$prev_month->addMonths(-1);
$next_month = clone $this_date;
$next_month->addMonths(+1);
$prev_week = clone $this_date;
$prev_week->addDays(-7);
$next_week = clone $this_date;
$next_week->addDays(+7);
$prev_day = clone $this_date;
$prev_day->addDays(-1);
$next_day = clone $this_date;
$next_day->addDays(+1);
switch ($task) {
case 'year.listevents':
$dates['prev2'] = $prev_year;
$dates['prev1'] = $prev_year;
$dates['next1'] = $next_year;
$dates['next2'] = $next_year;
$alts['prev2'] = JText::_('JEV_PREVIOUSYEAR');
$alts['prev1'] = JText::_('JEV_PREVIOUSYEAR');
$alts['next1'] = JText::_('JEV_NEXTYEAR');
$alts['next2'] = JText::_('JEV_NEXTYEAR');
// Show
if ($cfg->get('com_calUseIconic', 1) == 1 || $cfg->get('com_calUseIconic', 1) == 2) {
$view->viewNavTableBarIconic($today_date, $this_date, $dates, $alts, JEV_COM_COMPONENT, $task, $view->Itemid);
} else {
$view->viewNavTableBar($today_date, $this_date, $dates, $alts, JEV_COM_COMPONENT, $task, $view->Itemid);
}
break;
case 'month.calendar':
$dates['prev2'] = $prev_year;
$dates['prev1'] = $prev_month;
$dates['next1'] = $next_month;
$dates['next2'] = $next_year;
$alts['prev2'] = JText::_('JEV_PREVIOUSYEAR');
$alts['prev1'] = JText::_('JEV_PREVIOUSMONTH');
$alts['next1'] = JText::_('JEV_NEXTMONTH');
$alts['next2'] = JText::_('JEV_NEXTYEAR');
// Show
if ($cfg->get('com_calUseIconic', 1) == 1 || $cfg->get('com_calUseIconic', 1) == 2) {
$view->viewNavTableBarIconic($today_date, $this_date, $dates, $alts, JEV_COM_COMPONENT, $task, $view->Itemid);
} else {
$view->viewNavTableBar($today_date, $this_date, $dates, $alts, JEV_COM_COMPONENT, $task, $view->Itemid);
}
break;
case 'week.listevents':
$dates['prev2'] = $prev_month;
$dates['prev1'] = $prev_week;
$dates['next1'] = $next_week;
$dates['next2'] = $next_month;
$alts['prev2'] = JText::_('JEV_PREVIOUSMONTH');
$alts['prev1'] = JText::_('JEV_PREVIOUSWEEK');
$alts['next1'] = JText::_('JEV_NEXTWEEK');
$alts['next2'] = JText::_('JEV_NEXTMONTH');
// Show
if ($cfg->get('com_calUseIconic', 1) == 1 || $cfg->get('com_calUseIconic', 1) == 2) {
$view->viewNavTableBarIconic($today_date, $this_date, $dates, $alts, JEV_COM_COMPONENT, $task, $view->Itemid);
} else {
$view->viewNavTableBar($today_date, $this_date, $dates, $alts, JEV_COM_COMPONENT, $task, $view->Itemid);
}
break;
case 'day.listevents':
default:
$dates['prev2'] = $prev_month;
$dates['prev1'] = $prev_day;
$dates['next1'] = $next_day;
$dates['next2'] = $next_month;
$alts['prev2'] = JText::_('JEV_PREVIOUSMONTH');
$alts['prev1'] = JText::_('JEV_PREVIOUSDAY');
$alts['next1'] = JText::_('JEV_NEXTDAY');
$alts['next2'] = JText::_('JEV_NEXTMONTH');
// Show
if ($cfg->get('com_calUseIconic', 1) == 1 || $cfg->get('com_calUseIconic', 1) == 2) {
$view->viewNavTableBarIconic($today_date, $this_date, $dates, $alts, JEV_COM_COMPONENT, $task, $view->Itemid);
} else {
$view->viewNavTableBar($today_date, $this_date, $dates, $alts, JEV_COM_COMPONENT, "day.listevents", $view->Itemid);
}
break;
//.........这里部分代码省略.........
示例11: JFeedImage
$docimage = new JFeedImage();
$docimage->description = $this->info['description'];
$docimage->title = $this->info['title'];
$docimage->url = $this->info['image_url'];
$docimage->link = $this->info['imagelink'];
$doc->image = $docimage;
foreach ($this->eventsByRelDay as $relDay => $ebrd) {
foreach ($ebrd as $row) {
// title for particular item
$item_title = htmlspecialchars($row->title());
$item_title = html_entity_decode($item_title);
// url link to article
$startDate = $row->publish_up();
//$eventDate = JevDate::mktime(JString::substr($startDate,11,2),JString::substr($startDate,14,2), JString::substr($startDate,17,2),$this->jeventCalObject->now_m,$this->jeventCalObject->now_d + $relDay,$this->jeventCalObject->now_Y);
$eventDate = JevDate::strtotime($startDate);
$datenow = JEVHelper::getNow();
if ($relDay > 0) {
$eventDate = JevDate::strtotime($datenow->toFormat('%Y-%m-%d ') . JevDate::strftime('%H:%M', $eventDate) . " +{$relDay} days");
} else {
$eventDate = JevDate::strtotime($datenow->toFormat('%Y-%m-%d ') . JevDate::strftime('%H:%M', $eventDate) . " {$relDay} days");
}
$targetid = $this->modparams->get("target_itemid", 0);
$link = $row->viewDetailLink(date("Y", $eventDate), date("m", $eventDate), date("d", $eventDate), false, $targetid);
$link = str_replace("&tmpl=component", "", $link);
$item_link = JRoute::_($link . $this->jeventCalObject->datamodel->getCatidsOutLink());
// removes all formating from the intro text for the description text
$item_description = $row->content();
// remove dodgy border e.g. "diamond/question mark"
$item_description = preg_replace('#border=[\\"\'][^0-9]*[\\"\']#i', '', $item_description);
if ($this->info['limit_text']) {
if ($this->info['text_length']) {
示例12: listLatestIcalEvents
function listLatestIcalEvents($startdate, $enddate, $limit = 10, $noRepeats = 0, $multidayTreatment = 0)
{
$user = JFactory::getUser();
$lang =& JFactory::getLanguage();
$langtag = $lang->getTag();
if (strpos($startdate, "-") === false) {
$startdate = JevDate::strftime('%Y-%m-%d 00:00:00', $startdate);
$enddate = JevDate::strftime('%Y-%m-%d 23:59:59', $enddate);
}
// process the new plugins
// get extra data and conditionality from plugins
$extrawhere = array();
$extrajoin = array();
$rptwhere = array();
$extrafields = "";
// must have comma prefix
$extratables = "";
// must have comma prefix
$needsgroup = false;
$filterarray = array("published", "justmine", "category", "search");
// If there are extra filters from the module then apply them now
$reg =& JFactory::getConfig();
$modparams = $reg->getValue("jev.modparams", false);
if ($modparams && $modparams->getValue("extrafilters", false)) {
$filterarray = array_merge($filterarray, explode(",", $modparams->getValue("extrafilters", false)));
}
$filters = jevFilterProcessing::getInstance($filterarray);
$filters->setWhereJoin($extrawhere, $extrajoin);
$needsgroup = $filters->needsGroupBy();
$dispatcher =& JDispatcher::getInstance();
$dispatcher->trigger('onListIcalEvents', array(&$extrafields, &$extratables, &$extrawhere, &$extrajoin, &$needsgroup, &$rptwhere));
// What if join multiplies the rows?
// Useful MySQL link http://forums.mysql.com/read.php?10,228378,228492#msg-228492
// concat with group
// http://www.mysqlperformanceblog.com/2006/09/04/group_concat-useful-group-by-extension/
// did any of the plugins adjust the range of dateds allowed eg. timelimit plugin - is so then we need to use this information otherwise we get problems
$regex = "#(rpt.endrepeat>='[0-9:\\- ]*' AND rpt.startrepeat<='[0-9:\\- ]*')#";
foreach ($extrawhere as $exwhere) {
if (preg_match($regex, $exwhere)) {
$rptwhere[] = str_replace("rpt.", "rpt2.", $exwhere);
}
}
$rptwhere = count($rptwhere) ? ' AND ' . implode(' AND ', $rptwhere) : '';
$catwhere = "\n WHERE ev.catid IN(" . $this->accessibleCategoryList() . ")";
$params = JComponentHelper::getParams("com_jevents");
if ($params->get("multicategory", 0)) {
$extrajoin[] = "\n #__jevents_catmap as catmap ON catmap.evid = rpt.eventid";
$extrajoin[] = "\n #__categories AS catmapcat ON catmap.catid = catmapcat.id";
$extrafields .= ", GROUP_CONCAT(DISTINCT catmap.catid SEPARATOR ',') as catids";
$extrawhere[] = " catmapcat.access " . (version_compare(JVERSION, '1.6.0', '>=') ? ' IN (' . JEVHelper::getAid($user) . ')' : ' <= ' . JEVHelper::getAid($user));
$extrawhere[] = " catmap.catid IN(" . $this->accessibleCategoryList() . ")";
$needsgroup = true;
$catwhere = "\n WHERE 1 ";
}
$extrajoin = count($extrajoin) ? " \n LEFT JOIN " . implode(" \n LEFT JOIN ", $extrajoin) : '';
$extrawhere = count($extrawhere) ? ' AND ' . implode(' AND ', $extrawhere) : '';
// get the event ids first - split into 2 queries to pick up the ones after now and the ones before
$t_datenow = JEVHelper::getNow();
$t_datenowSQL = $t_datenow->toMysql();
// multiday condition
if ($multidayTreatment == 3) {
// We only show events once regardless of multiday setting of event so we allow them all through here!
$multiday = "";
$multiday2 = "";
} else {
if ($multidayTreatment == 2) {
// We only show events on their first day only regardless of multiday setting of event so we allow them all through here!
$multiday = "";
$multiday2 = "";
} else {
if ($multidayTreatment == 1) {
// We only show events on all days regardless of multiday setting of event so we allow them all through here!
$multiday = "";
$multiday2 = "";
} else {
// We only show events on their first day if they are not to be shown on multiple days so also add this condition
// i.e. the event settings are used
// This is the true version of these conditions
//$multiday = "\n AND ((rpt.startrepeat >= '$startdate' AND det.multiday=0) OR det.multiday=1)";
//$multiday2 = "\n AND ((rpt.startrepeat <= '$startdate' AND det.multiday=0) OR det.multiday=1)";
// BUT this is logically equivalent and appears much faster on some databases
$multiday = "\n AND (rpt.startrepeat >= '{$startdate}' OR det.multiday=1)";
$multiday2 = "\n AND (rpt.startrepeat <= '{$startdate}'OR det.multiday=1)";
}
}
}
if ($noRepeats) {
// Display a repeating event ONCE we group by event id selecting the most appropriate repeat for each one
// Find the ones after now (only if not past only)
$rows1 = array();
if ($enddate >= $t_datenowSQL && $modparams->get("pastonly", 0) != 1) {
$query = "SELECT rpt.*, ev.*, rr.*, det.*, ev.state as published, ev.created as created {$extrafields}" . "\n , YEAR(rpt.startrepeat) as yup, MONTH(rpt.startrepeat ) as mup, DAYOFMONTH(rpt.startrepeat ) as dup" . "\n , YEAR(rpt.endrepeat ) as ydn, MONTH(rpt.endrepeat ) as mdn, DAYOFMONTH(rpt.endrepeat ) as ddn" . "\n , HOUR(rpt.startrepeat) as hup, MINUTE(rpt.startrepeat ) as minup, SECOND(rpt.startrepeat ) as sup" . "\n , HOUR(rpt.endrepeat ) as hdn, MINUTE(rpt.endrepeat ) as mindn, SECOND(rpt.endrepeat ) as sdn" . "\n FROM #__jevents_repetition as rpt" . "\n LEFT JOIN #__jevents_vevent as ev ON rpt.eventid = ev.ev_id" . "\n LEFT JOIN #__jevents_icsfile as icsf ON icsf.ics_id=ev.icsid " . "\n LEFT JOIN #__jevents_vevdetail as det ON det.evdet_id = rpt.eventdetail_id" . "\n LEFT JOIN #__jevents_rrule as rr ON rr.eventid = rpt.eventid" . $extrajoin . $catwhere . "\n AND rpt.endrepeat >= '{$t_datenowSQL}' AND rpt.startrepeat <= '{$enddate}'" . $multiday . $extrawhere . "\n AND ev.access " . (version_compare(JVERSION, '1.6.0', '>=') ? ' IN (' . JEVHelper::getAid($user) . ')' : ' <= ' . JEVHelper::getAid($user)) . " AND icsf.state=1 " . "\n AND icsf.access " . (version_compare(JVERSION, '1.6.0', '>=') ? ' IN (' . JEVHelper::getAid($user) . ')' : ' <= ' . JEVHelper::getAid($user)) . "\n AND rpt.startrepeat=(\n\t\t\t\tSELECT MIN(startrepeat) FROM #__jevents_repetition as rpt2\n\t\t\t\tWHERE rpt2.eventid=rpt.eventid\n\t\t\t\tAND (\n\t\t\t\t\t(rpt2.startrepeat >= '{$t_datenowSQL}' AND rpt2.startrepeat <= '{$enddate}')\n\t\t\t\t\tOR (rpt2.startrepeat <= '{$t_datenowSQL}' AND rpt2.endrepeat > '{$t_datenowSQL}' AND det.multiday=1)\n\t\t\t\t\t)\n\t\t\t\t{$rptwhere}\n\t\t\t) \n\t\t\tGROUP BY ev.ev_id\n\t\t\tORDER BY rpt.startrepeat";
// This limit will always be enough
$query .= " LIMIT " . $limit;
$cache =& JFactory::getCache(JEV_COM_COMPONENT);
list($usec, $sec) = explode(" ", microtime());
$dbstart = (double) $usec + (double) $sec;
$rows1 = $cache->call('JEventsDBModel::_cachedlistIcalEvents', $query, $langtag);
list($usec, $sec) = explode(" ", microtime());
$dbend = (double) $usec + (double) $sec;
//.........这里部分代码省略.........
示例13: getYMD
/**
* Get array Year, Month, Day from current Request, fallback to current date
*
* @return array
*/
function getYMD()
{
static $data;
if (!isset($data)) {
$datenow = JEVHelper::getNow();
list($yearnow, $monthnow, $daynow) = explode('-', $datenow->toFormat('%Y-%m-%d'));
$year = min(2100, abs(intval(JRequest::getVar('year', $yearnow))));
$month = min(99, abs(intval(JRequest::getVar('month', $monthnow))));
$day = min(3650, abs(intval(JRequest::getVar('day', $daynow))));
if ($day <= 0) {
$day = $daynow;
}
if ($month <= 0) {
$month = $monthnow;
}
if ($year <= 0) {
$year = $yearnow;
}
if ($day <= '9') {
$day = '0' . $day;
}
if ($month <= '9') {
$month = '0' . $month;
}
$data = array();
$data[] = $year;
$data[] = $month;
$data[] = $day;
}
return $data;
}
示例14: listLatestIcalEvents
function listLatestIcalEvents($startdate, $enddate, $limit = 10, $noRepeats = 0, $multidayTreatment = 0)
{
$user =& JFactory::getUser();
$db =& JFactory::getDBO();
$lang =& JFactory::getLanguage();
$langtag = $lang->getTag();
if (strpos($startdate, "-") === false) {
$startdate = JevDate::strftime('%Y-%m-%d 00:00:00', $startdate);
$enddate = JevDate::strftime('%Y-%m-%d 23:59:59', $enddate);
}
// process the new plugins
// get extra data and conditionality from plugins
$extrawhere = array();
$extrajoin = array();
$extrafields = "";
// must have comma prefix
$extratables = "";
// must have comma prefix
$needsgroup = false;
$filterarray = array("published", "justmine", "category", "search");
// If there are extra filters from the module then apply them now
$reg =& JFactory::getConfig();
$modparams = $reg->getValue("jev.modparams", false);
if ($modparams && $modparams->getValue("extrafilters", false)) {
$filterarray = array_merge($filterarray, explode(",", $modparams->getValue("extrafilters", false)));
}
$filters = jevFilterProcessing::getInstance($filterarray);
$filters->setWhereJoin($extrawhere, $extrajoin);
$needsgroup = $filters->needsGroupBy();
$dispatcher =& JDispatcher::getInstance();
$dispatcher->trigger('onListIcalEvents', array(&$extrafields, &$extratables, &$extrawhere, &$extrajoin, &$needsgroup));
// What if join multiplies the rows?
// Useful MySQL link http://forums.mysql.com/read.php?10,228378,228492#msg-228492
// concat with group
// http://www.mysqlperformanceblog.com/2006/09/04/group_concat-useful-group-by-extension/
// did any of the plugins adjust the range of dateds allowed eg. timelimit plugin - is so then we need to use this information otherwise we get problems
$regex = "#(rpt.endrepeat>='[0-9:\\- ]*' AND rpt.startrepeat<='[0-9:\\- ]*')#";
$rptwhere = array();
foreach ($extrawhere as $exwhere) {
if (preg_match($regex, $exwhere)) {
$rptwhere[] = str_replace("rpt.", "rpt2.", $exwhere);
}
}
$rptwhere = count($rptwhere) ? ' AND ' . implode(' AND ', $rptwhere) : '';
$extrajoin = count($extrajoin) ? " \n LEFT JOIN " . implode(" \n LEFT JOIN ", $extrajoin) : '';
$extrawhere = count($extrawhere) ? ' AND ' . implode(' AND ', $extrawhere) : '';
// get the event ids first - split into 2 queries to pick up the ones after now and the ones before
$t_datenow = JEVHelper::getNow();
$t_datenowSQL = $t_datenow->toMysql();
// multiday condition
if ($multidayTreatment == 3) {
// We only show events once regardless of multiday setting of event so we allow them all through here!
$multiday = "";
$multiday2 = "";
} else {
if ($multidayTreatment == 2) {
// We only show events on their first day only regardless of multiday setting of event so we allow them all through here!
$multiday = "";
$multiday2 = "";
} else {
if ($multidayTreatment == 1) {
// We only show events on all days regardless of multiday setting of event so we allow them all through here!
$multiday = "";
$multiday2 = "";
} else {
// We only show events on their first day if they are not to be shown on multiple days so also add this condition
// i.e. the event settings are used
$multiday = "\n AND ((rpt.startrepeat >= '{$startdate}' AND det.multiday=0) OR det.multiday=1)";
$multiday2 = "\n AND ((rpt.startrepeat <= '{$startdate}' AND det.multiday=0) OR det.multiday=1)";
}
}
}
// Find the ones after now (only if not past only)
if ($modparams->get("pastonly", 0) != 1) {
$query = "SELECT DISTINCT rpt.eventid FROM #__jevents_repetition as rpt" . "\n LEFT JOIN #__jevents_vevent as ev ON rpt.eventid = ev.ev_id" . "\n LEFT JOIN #__jevents_icsfile as icsf ON icsf.ics_id=ev.icsid " . "\n LEFT JOIN #__jevents_vevdetail as det ON det.evdet_id = rpt.eventdetail_id" . "\n LEFT JOIN #__jevents_rrule as rr ON rr.eventid = rpt.eventid" . $extrajoin . "\n WHERE ev.catid IN(" . $this->accessibleCategoryList() . ")" . "\n AND rpt.endrepeat >= '{$t_datenowSQL}' AND rpt.startrepeat <= '{$enddate}'" . $multiday . $extrawhere . "\n AND ev.access " . (version_compare(JVERSION, '1.6.0', '>=') ? ' IN (' . JEVHelper::getAid($user) . ')' : ' <= ' . JEVHelper::getAid($user)) . " AND icsf.state=1 " . "\n AND icsf.access " . (version_compare(JVERSION, '1.6.0', '>=') ? ' IN (' . JEVHelper::getAid($user) . ')' : ' <= ' . JEVHelper::getAid($user)) . "\n AND rpt.startrepeat=(\n\t\t\t\tSELECT MIN(startrepeat) FROM #__jevents_repetition as rpt2\n\t\t\t\tWHERE rpt2.eventid=rpt.eventid\n\t\t\t\tAND rpt2.startrepeat >= '{$t_datenowSQL}' AND rpt2.endrepeat <= '{$enddate}'\n\t\t\t\t{$rptwhere}\n\t\t\t)" . "\n ORDER BY rpt.startrepeat ASC";
// This limit will always be enough
$query .= " LIMIT " . $limit;
$db = JFactory::getDBO();
$db->setQuery($query);
//$query = $db->replacePrefix($db->getQuery());
//echo $db->replacePrefix($db->getQuery())."<br/>";
$ids1 = $db->loadResultArray();
} else {
$ids1 = array();
}
// Before now (only if not past only == future events)
if ($startdate < $t_datenowSQL && $modparams->get("pastonly", 0) < 2) {
$query = "SELECT rpt.eventid FROM #__jevents_repetition as rpt" . "\n LEFT JOIN #__jevents_vevent as ev ON rpt.eventid = ev.ev_id" . "\n LEFT JOIN #__jevents_icsfile as icsf ON icsf.ics_id=ev.icsid " . "\n LEFT JOIN #__jevents_vevdetail as det ON det.evdet_id = rpt.eventdetail_id" . "\n LEFT JOIN #__jevents_rrule as rr ON rr.eventid = rpt.eventid" . $extrajoin . "\n WHERE ev.catid IN(" . $this->accessibleCategoryList() . ")" . "\n AND rpt.endrepeat >= '{$startdate}' AND rpt.startrepeat <= '{$t_datenowSQL}'" . $multiday . $extrawhere . "\n AND ev.access " . (version_compare(JVERSION, '1.6.0', '>=') ? ' IN (' . JEVHelper::getAid($user) . ')' : ' <= ' . JEVHelper::getAid($user)) . " AND icsf.state=1 " . "\n AND icsf.access " . (version_compare(JVERSION, '1.6.0', '>=') ? ' IN (' . JEVHelper::getAid($user) . ')' : ' <= ' . JEVHelper::getAid($user)) . "\n AND rpt.startrepeat=(\n\t\t\t\t\tSELECT MAX(startrepeat) FROM #__jevents_repetition as rpt2\n\t\t\t\t\t WHERE rpt2.eventid=rpt.eventid\n\t\t\t\t\tAND rpt2.startrepeat <= '{$t_datenowSQL}' AND rpt2.startrepeat >= '{$startdate}'\n\t\t\t\t\t{$rptwhere}\n\t\t\t\t)" . "\n GROUP BY rpt.eventid " . "\n ORDER BY rpt.startrepeat DESC";
// This limit will always be enough
$query .= " LIMIT " . $limit;
$db = JFactory::getDBO();
$db->setQuery($query);
//$query = $db->replacePrefix($db->getQuery());
//echo $db->explain();die();
//echo $db->replacePrefix($db->getQuery())."<br/>";
$ids2 = $db->loadResultArray();
} else {
$ids2 = array();
}
$ids3 = array();
//.........这里部分代码省略.........
示例15: processMatch
protected function processMatch(&$content, $match, $dayEvent, $dateParm, $relDay)
{
$datenow = JEVHelper::getNow();
$dispatcher =& JDispatcher::getInstance();
// get the title and start time
$startDate = JevDate::strtotime($dayEvent->publish_up());
if ($relDay > 0) {
$eventDate = JevDate::strtotime($datenow->toFormat('%Y-%m-%d ') . JevDate::strftime('%H:%M', $startDate) . " +{$relDay} days");
} else {
$eventDate = JevDate::strtotime($datenow->toFormat('%Y-%m-%d ') . JevDate::strftime('%H:%M', $startDate) . " {$relDay} days");
}
$endDate = JevDate::strtotime($dayEvent->publish_down());
list($st_year, $st_month, $st_day) = explode('-', JevDate::strftime('%Y-%m-%d', $startDate));
list($ev_year, $ev_month, $ev_day) = explode('-', JevDate::strftime('%Y-%m-%d', $startDate));
$task_events = 'icalrepeat.detail';
switch ($match) {
case 'endDate':
case 'startDate':
case 'eventDate':
// Note we need to examine the date specifiers used to determine if language translation will be
// necessary. Do this later when script is debugged.
if (!$this->disableDateStyle) {
$content .= '<span class="mod_events_latest_date">';
}
if (!$dayEvent->alldayevent() && $match == "endDate" && ($dayEvent->noendtime() || $dayEvent->getUnixStartTime() == $dayEvent->getUnixEndTime())) {
$time_fmt = "";
} else {
if (!isset($dateParm) || $dateParm == '') {
if ($this->com_calUseStdTime) {
$time_fmt = $dayEvent->alldayevent() ? '' : ' @%l:%M%p';
} else {
$time_fmt = $dayEvent->alldayevent() ? '' : ' @%H:%M';
}
$dateFormat = $this->displayYear ? '%a %b %d, %Y' . $time_fmt : '<span class="eventDay">%a</span> <span class="eventDate">%d<span class="eventMonth">%b</span></span>';
$jmatch = new JevDate(${$match});
$content .= $jmatch->toFormat($dateFormat);
//$content .= JEV_CommonFunctions::jev_strftime($dateFormat, $$match);
} else {
// format endDate when midnight to show midnight!
if ($match == "endDate" && $dayEvent->sdn() == 59) {
$tempEndDate = $endDate + 1;
if ($dayEvent->alldayevent()) {
// if an all day event then we don't want to roll to the next day
$tempEndDate -= 86400;
}
$match = "tempEndDate";
}
// if a '%' sign detected in date format string, we assume JevDate::strftime() is to be used,
if (preg_match("/\\%/", $dateParm)) {
$jmatch = new JevDate(${$match});
$content .= $jmatch->toFormat($dateParm);
} else {
$content .= date($dateParm, ${$match});
}
if ($match == "tempDndDate") {
$match = "endDate";
}
}
}
if (!$this->disableDateStyle) {
$content .= "</span>";
}
break;
case 'title':
$title = $dayEvent->title();
if (!empty($dateParm)) {
$parts = explode("|", $dateParm);
if (count($parts) > 0 && strlen($title) > intval($parts[0])) {
$title = substr($title, 0, intval($parts[0]));
if (count($parts) > 1) {
$title .= $parts[1];
}
}
}
if (!$this->disableTitleStyle) {
$content .= '<span class="mod_events_latest_content">';
}
if ($this->displayLinks) {
$link = $dayEvent->viewDetailLink($ev_year, $ev_month, $ev_day, false, $this->myItemid);
$link = JRoute::_($link . $this->datamodel->getCatidsOutLink());
$content .= $this->_htmlLinkCloaking($link, JEventsHTML::special($title));
} else {
$content .= JEventsHTML::special($title);
}
if (!$this->disableTitleStyle) {
$content .= '</span>';
}
break;
case 'category':
$catobj = $dayEvent->getCategoryName();
$content .= JEventsHTML::special($catobj);
break;
case 'calendar':
$catobj = $dayEvent->getCalendarName();
$content .= JEventsHTML::special($catobj);
break;
case 'contact':
// Also want to cloak contact details so
$this->modparams->set("image", 1);
$dayEvent->text = $dayEvent->contact_info();
//.........这里部分代码省略.........