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; }
function __construct($event, $datamodel, $view = false) { $cfg = JEVConfig::getInstance(); $this->event = $event; $this->_datamodel = $datamodel; $this->_view = $view; $this->start_publish = $this->event->getUnixStartDate(); $this->stop_publish = $this->event->getUnixEndDate(); $this->title = $this->event->title(); // On mouse over date formats $this->start_date = JEventsHTML::getDateFormat($this->event->yup(), $this->event->mup(), $this->event->dup(), 0); //$this->start_time = $this->event->startTime() ; $this->start_time = JEVHelper::getTime($this->event->getUnixStartTime(), $this->event->hup(), $this->event->minup()); $this->stop_date = JEventsHTML::getDateFormat($this->event->ydn(), $this->event->mdn(), $this->event->ddn(), 0); //$this->stop_time = $this->event->endTime() ; $this->stop_time = JEVHelper::getTime($this->event->getUnixEndTime(), $this->event->hdn(), $this->event->mindn()); $this->stop_time_midnightFix = $this->stop_time; $this->stop_date_midnightFix = $this->stop_date; if ($this->event->sdn() == 59 && $this->event->mindn() == 59) { $this->stop_time_midnightFix = JEVHelper::getTime($this->event->getUnixEndTime() + 1, 0, 0); $this->stop_date_midnightFix = JEventsHTML::getDateFormat($this->event->ydn(), $this->event->mdn(), $this->event->ddn() + 1, 0); } // we only need the one helper so stick to default layout here! $this->jevlayout = "default"; $this->addHelperPath(JEV_VIEWS . "/default/helpers"); $this->addHelperPath(JPATH_BASE . '/' . 'templates' . '/' . JFactory::getApplication()->getTemplate() . '/' . 'html' . '/' . JEV_COM_COMPONENT . '/' . "helpers"); // attach data model $reg = JevRegistry::getInstance("jevents"); $this->datamodel = $reg->getReference("jevents.datamodel"); }
$hasevents = false; echo '<fieldset><legend class="ev_fieldset">' . JText::_('JEV_EVENTSFOR') . ' ' . JText::_('JEV_WEEK') . ' : </legend><br />' . "\n"; echo '<table align="center" width="90%" cellspacing="0" cellpadding="5" class="ev_table">' . "\n"; ?> <tr valign="top"> <td colspan="2" align="center" class="cal_td_daysnames"> <!-- <div class="cal_daysnames"> --> <?php echo $data['startdate'] . ' - ' . $data['enddate']; ?> <!-- </div> --> </td> </tr> <?php for ($d = 0; $d < 7; $d++) { $day_link = '<a class="ev_link_weekday" href="' . $data['days'][$d]['link'] . '" title="' . JText::_('JEV_CLICK_TOSWITCH_DAY') . '">' . JEV_CommonFunctions::jev_strftime("%A", JevDate::mktime(3, 0, 0, $data['days'][$d]['week_month'], $data['days'][$d]['week_day'], $data['days'][$d]['week_year'])) . "<br/>" . JEventsHTML::getDateFormat($data['days'][$d]['week_year'], $data['days'][$d]['week_month'], $data['days'][$d]['week_day'], 2) . '</a>' . "\n"; if ($data['days'][$d]['today']) { $bg = 'class="ev_td_today"'; } else { $bg = 'class="ev_td_left"'; } echo '<tr><td ' . $bg . '>' . $day_link . '</td>' . "\n"; echo '<td class="ev_td_right">' . "\n"; $num_events = count($data['days'][$d]['rows']); if ($num_events > 0) { $hasevents = true; echo "<ul class='ev_ul'>\n"; for ($r = 0; $r < $num_events; $r++) { $row = $data['days'][$d]['rows'][$r]; $listyle = 'style="border-color:' . $row->bgcolor() . ';"'; echo "<li class='ev_td_li' {$listyle}>\n";
?> <table align="center" width="90%" cellspacing="0" cellpadding="0" class="ev_table"> <tr valign="top"> <td colspan="2" align="center" class="cal_td_daysnames"> <!-- <div class="cal_daysnames"> --> <?php echo $data["year"]; ?> <!-- </div> --> </td> </tr> <?php for ($month = 1; $month <= 12; $month++) { $num_events = count($data["months"][$month]["rows"]); if ($num_events > 0) { echo "<tr><td class='ev_td_left'>" . JEventsHTML::getDateFormat($this->year, $month, '', 3) . "</td>\n"; echo "<td class='ev_td_right'>\n"; echo "<ul class='ev_ul'>\n"; for ($r = 0; $r < $num_events; $r++) { if (!isset($data["months"][$month]["rows"][$r])) { continue; } $row =& $data["months"][$month]["rows"][$r]; $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); } echo "</li>\n";
foreach ($filterHTML as $filter) { echo "<div class='jev_adminfilter'>" . $filter["title"] . "<br/>" . $filter["html"] . "</div>"; } ?> </form> <?php echo '<table align="center" width="90%" cellspacing="0" cellpadding="5" class="ev_table">' . "\n"; if ($num_events > 0) { for ($r = 0; $r < $num_events; $r++) { $row = $data['rows'][$r]; $event_month_year = $row->mup() . $row->yup(); if ($event_month_year != $chdate && $chdate != "") { echo '</ul></td></tr>' . "\n"; } if ($event_month_year != $chdate) { echo '<tr><td class="ev_td_left">' . "\n" . JEventsHTML::getDateFormat($row->yup(), $row->mup(), '', 3) . '</td>' . "\n"; echo '<td class="ev_td_right"><ul class="ev_ul">' . "\n"; } $this->viewEventRowAdmin($row); $chdate = $event_month_year; } echo '</ul></td>' . "\n"; } else { echo '<tr>' . "\n"; echo '<td align="left" valign="top" class="ev_td_right">' . "\n"; echo JText::_('JEV_NO_EVENTS'); } echo '</tr></table><br />' . "\n"; echo '</fieldset><br /><br />' . "\n"; // Create the pagination object if ($data["total"] > $data["limit"]) {
function getEventData($rpid, $jevtype, $year, $month, $day, $uid = "") { $data = array(); $pop = intval(JRequest::getVar('pop', 0)); $Itemid = JEVHelper::getItemid(); $db =& JFactory::getDBO(); $cfg =& JEVConfig::getInstance(); $row = $this->queryModel->listEventsById($rpid, 1, $jevtype); // include unpublished events for publishers and above $num_row = count($row); // No matching rows - use uid as alternative if ($num_row == 0 && strlen($uid) > 0) { $rpid = $this->queryModel->findMatchingRepeat($uid, $year, $month, $day); if (isset($rpid) && $rpid > 0) { $row = $this->queryModel->listEventsById($rpid, 1, $jevtype); // include unpublished events for publishers and above $num_row = count($row); } } if ($num_row) { // process the new plugins $dispatcher =& JDispatcher::getInstance(); $dispatcher->trigger('onGetEventData', array(&$row)); $params = new JParameter(null); $row->contactlink = JEventsHTML::getUserMailtoLink($row->id(), $row->created_by()); $event_up = new JEventDate($row->publish_up()); $row->start_date = JEventsHTML::getDateFormat($event_up->year, $event_up->month, $event_up->day, 0); $row->start_time = JEVHelper::getTime($row->getUnixStartTime()); $event_down = new JEventDate($row->publish_down()); $row->stop_date = JEventsHTML::getDateFormat($event_down->year, $event_down->month, $event_down->day, 0); $row->stop_time = JEVHelper::getTime($row->getUnixEndTime()); $row->stop_time_midnightFix = $row->stop_time; $row->stop_date_midnightFix = $row->stop_date; if ($event_down->second == 59) { $row->stop_time_midnightFix = JEVHelper::getTime($row->getUnixEndTime() + 1); $row->stop_date_midnightFix = JEventsHTML::getDateFormat($event_down->year, $event_down->month, $event_down->day + 1, 0); } // ******************* // ** This cloaking should be done by mambot/Joomla function // ******************* // Parse http and wrap in <a> tag // trigger content plugin $pattern = '[a-zA-Z0-9&?_.,=%\\-\\/]'; // Adresse // don't convert address that already has a link tag if (strpos($row->location(), '<a href=') === false) { $row->location(preg_replace('#(http://)(' . $pattern . '*)#i', '<a href="\\1\\2">\\1\\2</a>', $row->location())); } $tmprow = new stdClass(); $tmprow->text = $row->location(); $dispatcher =& JDispatcher::getInstance(); JPluginHelper::importPlugin('content'); if (JVersion::isCompatible("1.6.0")) { $dispatcher->trigger('onContentPrepare', array('com_jevents', &$tmprow, &$params, 0)); } else { $dispatcher->trigger('onPrepareContent', array(&$tmprow, &$params, 0)); } $row->location($tmprow->text); //Contact if (strpos($row->contact_info(), '<a href=') === false) { $row->contact_info(preg_replace('#(http://)(' . $pattern . '*)#i', '<a href="\\1\\2">\\1\\2</a>', $row->contact_info())); } $tmprow = new stdClass(); $tmprow->text = $row->contact_info(); if (JVersion::isCompatible("1.6.0")) { $dispatcher->trigger('onContentPrepare', array('com_jevents', &$tmprow, &$params, 0)); } else { $dispatcher->trigger('onPrepareContent', array(&$tmprow, &$params, 0)); } $row->contact_info($tmprow->text); //Extra if (strpos($row->extra_info(), '<a href=') === false) { $row->extra_info(preg_replace('#(http://)(' . $pattern . '*)#i', '<a href="\\1\\2">\\1\\2</a>', $row->extra_info())); } //$row->extra_info(eregi_replace('[^(href=|href="|href=\')](((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)','\\1', $row->extra_info())); $tmprow = new stdClass(); $tmprow->text = $row->extra_info(); if (JVersion::isCompatible("1.6.0")) { $dispatcher->trigger('onContentPrepare', array('com_jevents', &$tmprow, &$params, 0)); } else { $dispatcher->trigger('onPrepareContent', array(&$tmprow, &$params, 0)); } $row->extra_info($tmprow->text); $mask = JFactory::getApplication()->getCfg('hideAuthor') ? MASK_HIDEAUTHOR : 0; $mask |= JFactory::getApplication()->getCfg('hideCreateDate') ? MASK_HIDECREATEDATE : 0; $mask |= JFactory::getApplication()->getCfg('hideModifyDate') ? MASK_HIDEMODIFYDATE : 0; $mask |= JFactory::getApplication()->getCfg('hidePdf') ? MASK_HIDEPDF : 0; $mask |= JFactory::getApplication()->getCfg('hidePrint') ? MASK_HIDEPRINT : 0; $mask |= JFactory::getApplication()->getCfg('hideEmail') ? MASK_HIDEEMAIL : 0; //$mask |= JFactory::getApplication()->getCfg( 'vote' ) ? MASK_VOTES : 0; $mask |= JFactory::getApplication()->getCfg('vote') ? MASK_VOTES | MASK_VOTEFORM : 0; $mask |= $pop ? MASK_POPUP | MASK_IMAGES | MASK_BACKTOLIST : 0; // Do main mambot processing here // process bots //$row->text = $row->content; $params->set("image", 1); $row->text = $row->content(); if (JVersion::isCompatible("1.6.0")) { $dispatcher->trigger('onContentPrepare', array('com_jevents', &$row, &$params, 0)); } else { $dispatcher->trigger('onPrepareContent', array(&$row, &$params, 0)); } $row->content($row->text); $data['row'] = $row; $data['mask'] = $mask; $row->updateHits(); return $data; } else { // Do we have to be logged in to see this event? $user =& JFactory::getUser(); if ($user->id == 0) { $db = JFactory::getDBO(); $query = "SELECT ev.*" . "\n FROM #__jevents_vevent as ev " . "\n LEFT JOIN #__jevents_repetition as rpt ON rpt.eventid = ev.ev_id" . "\n WHERE rpt.rp_id = '{$rpid}'"; $db->setQuery($query); $row2 = $db->loadObject(); // need to be logged in to see this event? if ($row2 && (version_compare(JVERSION, '1.6.0', '>=') ? !in_array($row2->access, JEVHelper::getAid($user, 'array')) : JEVHelper::getAid($user) < $row2->access)) { $uri = JURI::getInstance(); $link = $uri->toString(); $comuser = version_compare(JVERSION, '1.6.0', '>=') ? "com_users" : "com_user"; $link = 'index.php?option=' . $comuser . '&view=login&return=' . base64_encode($link); $link = JRoute::_($link); JFactory::getApplication()->redirect($link, JText::_('JEV_LOGIN_TO_VIEWEVENT')); return null; } } // See if a plugin can find our missing event - maybe on another menu item JPluginHelper::importPlugin('jevents'); $dispatcher =& JDispatcher::getInstance(); $dispatcher->trigger('onMissingEvent', array(&$row, $rpid, $jevtype, $year, $month, $day, $uid)); return null; } }
</div> </div> <div class="jev_clear" ></div> <div id='jev_maincal' class='jev_listview'> <?php $hasevents = false; for ($month = 1; $month <= 12; $month++) { $num_events = count($data["months"][$month]["rows"]); if ($num_events > 0) { $hasevents = true; ?> <div class="jev_daysnames"> <?php echo JEventsHTML::getDateFormat($this->year, $month, '', 3); ?> </div> <div class="jev_listrow"> <?php echo "<ul class='ev_ul'>\n"; for ($r = 0; $r < $num_events; $r++) { if (!isset($data["months"][$month]["rows"][$r])) { continue; } $row =& $data["months"][$month]["rows"][$r]; $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 " :: ";
?> </ul> </div> <?php } if ($event_month_year != $chdate) { ?> <div class="jev_daysnames jev_daysnames_<?php echo $this->colourscheme; ?> jev_<?php echo $this->colourscheme; ?> "> <?php echo JEventsHTML::getDateFormat($row->yup(), $row->mup(), $row->dup(), 0); ?> </div> <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); } echo "</li>"; $chdate = $event_month_year;
<?php defined('_JEXEC') or die('Restricted access'); $cfg = JEVConfig::getInstance(); $this->data = $data = $this->datamodel->getDayData($this->year, $this->month, $this->day); $this->Redirectdetail(); $cfg = JEVConfig::getInstance(); $Itemid = JEVHelper::getItemid(); $hasevents = false; echo '<fieldset><legend class="ev_fieldset">' . JText::_('JEV_EVENTSFORTHE') . ': ' . JEventsHTML::getDateFormat($this->year, $this->month, $this->day, 0) . '</legend><br />' . "\n"; echo '<div class="ja-events-list row equal-height equal-height-child">' . "\n"; // Timeless Events First if (count($data['hours']['timeless']['events']) > 0) { $start_time = JText::_('TIMELESS'); $hasevents = true; foreach ($data['hours']['timeless']['events'] as $row) { $class = $datenow->toFormat('%Y-%m-%d') > $row->startDate() ? "pastevent" : ""; $link = $row->viewDetailLink($row->yup(), $row->mup(), $row->dup(), $Itemid); $listyle = 'style="background-color:' . $row->bgcolor() . ';"'; echo "<div class='col-sm-6 col-md-6 col-lg-4 col " . $class . "'><div class='inner'>\n"; if ($row->get('imageimg1')) { ?> <div class="item-image"> <div class="img-intro-left"> <a href="<?php echo $link; ?> " title="<?php echo $row->title(); ?> " class="item-link">
?> <?php echo JText::_("FOLLOWING_Week") . "</a>"; } ?> </td> </tr> <?php $hasevents = false; for ($d = 0; $d < 7; $d++) { $num_events = count($data['days'][$d]['rows']); if ($num_events == 0) { continue; } $hasevents = true; $day_link = '<a class="ev_link_weekday" href="' . $data['days'][$d]['link'] . '" title="' . JText::_('JEV_CLICK_TOSWITCH_DAY') . '">' . JEventsHTML::getDateFormat($data['days'][$d]['week_year'], $data['days'][$d]['week_month'], $data['days'][$d]['week_day'], 2) . '</a>' . "\n"; echo '<tr class="tableh2"><td class="tableh2" colspan="3">' . $day_link . '</td></tr>'; echo "<tr>"; echo '<td class="ev_td_right" colspan="3">'; if ($num_events > 0) { echo "<ul class='ev_ul'>\n"; for ($r = 0; $r < $num_events; $r++) { $row = $data['days'][$d]['rows'][$r]; $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); } echo "</li>\n";
function DefaultLoadedFromTemplate($view, $template_name, $event, $mask, $template_value = false) { $db = JFactory::getDBO(); // find published template static $templates; static $fieldNameArray; if (!isset($templates)) { $templates = array(); $fieldNameArray = array(); $rawtemplates = array(); } $specialmodules = false; if (!$template_value) { if (!array_key_exists($template_name, $templates)) { $db->setQuery("SELECT * FROM #__jev_defaults WHERE state=1 AND name= " . $db->Quote($template_name) . " AND " . 'language in (' . $db->quote(JFactory::getLanguage()->getTag()) . ',' . $db->quote('*') . ')'); $rawtemplates = $db->loadObjectList(); $templates[$template_name] = array(); if ($rawtemplates) { foreach ($rawtemplates as $rt) { if (!isset($templates[$template_name][$rt->language])) { $templates[$template_name][$rt->language] = array(); } $templates[$template_name][$rt->language][$rt->catid] = $rt; } } if (count($templates[$template_name]) == 0) { $templates[$template_name] = null; return false; } if (isset($templates[$template_name][JFactory::getLanguage()->getTag()])) { $templateArray = $templates[$template_name][JFactory::getLanguage()->getTag()]; // We have the most specific by language now fill in the gaps if (isset($templates[$template_name]["*"])) { foreach ($templates[$template_name]["*"] as $cat => $cattemplates) { if (!isset($templateArray[$cat])) { $templateArray[$cat] = $cattemplates; } } } $templates[$template_name] = $templateArray; } else { if (isset($templates[$template_name]["*"])) { $templates[$template_name] = $templates[$template_name]["*"]; } else { if (is_array($templates[$template_name]) && count($templates[$template_name]) == 0) { $templates[$template_name] = null; } else { if (is_array($templates[$template_name]) && count($templates[$template_name]) > 0) { $templates[$template_name] = current($templates[$template_name]); } else { $templates[$template_name] = null; } } } } $matched = false; foreach (array_keys($templates[$template_name]) as $catid) { if ($templates[$template_name][$catid]->value != "") { if (isset($templates[$template_name][$catid]->params)) { $templates[$template_name][$catid]->params = new JRegistry($templates[$template_name][$catid]->params); $specialmodules = $templates[$template_name][$catid]->params; } // Adjust template_value to include dynamic module output then strip it out afterwards if ($specialmodules) { $modids = $specialmodules->get("modid", array()); if (count($modids) > 0) { $modvals = $specialmodules->get("modval", array()); // not sure how this can arise :( if (is_object($modvals)) { $modvals = get_object_vars($modvals); } for ($count = 0; $count < count($modids) && $count < count($modvals) && trim($modids[$count]) != ""; $count++) { $templates[$template_name][$catid]->value .= "{{module start:MODULESTART#" . $modids[$count] . "}}"; // cleaned later! //$templates[$template_name][$catid]->value .= preg_replace_callback('|{{.*?}}|', 'cleanLabels', $modvals[$count]); $templates[$template_name][$catid]->value .= $modvals[$count]; $templates[$template_name][$catid]->value .= "{{module end:MODULEEND}}"; } } } // strip carriage returns other wise the preg replace doesn;y work - needed because wysiwyg editor may add the carriage return in the template field $templates[$template_name][$catid]->value = str_replace("\r", '', $templates[$template_name][$catid]->value); $templates[$template_name][$catid]->value = str_replace("\n", '', $templates[$template_name][$catid]->value); // non greedy replacement - because of the ? $templates[$template_name][$catid]->value = preg_replace_callback('|{{.*?}}|', 'cleanLabels', $templates[$template_name][$catid]->value); $matchesarray = array(); preg_match_all('|{{.*?}}|', $templates[$template_name][$catid]->value, $matchesarray); $templates[$template_name][$catid]->matchesarray = $matchesarray; } } } if (is_null($templates[$template_name])) { return false; } $catids = $event->catids() && count($event->catids()) ? $event->catids() : array($event->catid()); $catids[] = 0; // find the overlap $catids = array_intersect($catids, array_keys($templates[$template_name])); // At present must be an EXACT category match - no inheriting allowed! if (count($catids) == 0) { if (!isset($templates[$template_name][0]) || $templates[$template_name][0]->value == "") { return false; } } $template = false; foreach ($catids as $catid) { // use the first matching non-empty layout if ($templates[$template_name][$catid]->value != "") { $template = $templates[$template_name][$catid]; break; } } if (!$template) { return false; } $template_value = $template->value; $specialmodules = $template->params; $matchesarray = $template->matchesarray; } else { // This is a special scenario where we call this function externally e.g. from RSVP Pro messages // In this scenario we have not gone through the displaycustomfields plugin static $pluginscalled = array(); if (!isset($pluginscalled[$event->rp_id()])) { $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin("jevents"); $customresults = $dispatcher->trigger('onDisplayCustomFields', array(&$event)); $pluginscalled[$event->rp_id()] = $event; } else { $event = $pluginscalled[$event->rp_id()]; } // Adjust template_value to include dynamic module output then strip it out afterwards if ($specialmodules) { $modids = $specialmodules->get("modid", array()); if (count($modids) > 0) { $modvals = $specialmodules->get("modval", array()); // not sure how this can arise :( if (is_object($modvals)) { $modvals = get_object_vars($modvals); } for ($count = 0; $count < count($modids) && $count < count($modvals) && trim($modids[$count]) != ""; $count++) { $template_value .= "{{module start:MODULESTART#" . $modids[$count] . "}}"; // cleaned later! //$template_value .= preg_replace_callback('|{{.*?}}|', 'cleanLabels', $modvals[$count]); $template_value .= $modvals[$count]; $template_value .= "{{module end:MODULEEND}}"; } } } // strip carriage returns other wise the preg replace doesn;y work - needed because wysiwyg editor may add the carriage return in the template field $template_value = str_replace("\r", '', $template_value); $template_value = str_replace("\n", '', $template_value); // non greedy replacement - because of the ? $template_value = preg_replace_callback('|{{.*?}}|', 'cleanLabels', $template_value); $matchesarray = array(); preg_match_all('|{{.*?}}|', $template_value, $matchesarray); } if ($template_value == "") { return; } if (count($matchesarray) == 0) { return; } // now replace the fields $search = array(); $replace = array(); $blank = array(); $rawreplace = array(); $jevparams = JComponentHelper::getParams(JEV_COM_COMPONENT); for ($i = 0; $i < count($matchesarray[0]); $i++) { $strippedmatch = preg_replace('/(#|:|;)+[^}]*/', '', $matchesarray[0][$i]); if (in_array($strippedmatch, $search)) { continue; } // translation string if (strpos($strippedmatch, "{{_") === 0 && strpos($strippedmatch, " ") === false) { $search[] = $strippedmatch; $strippedmatch = substr($strippedmatch, 3, strlen($strippedmatch) - 5); $replace[] = JText::_($strippedmatch); $blank[] = ""; continue; } // Built in fields switch ($strippedmatch) { case "{{TITLE}}": $search[] = "{{TITLE}}"; $replace[] = $event->title(); $blank[] = ""; break; case "{{PRIORITY}}": $search[] = "{{PRIORITY}}"; $replace[] = $event->priority(); $blank[] = ""; break; case "{{LINK}}": case "{{LINKSTART}}": case "{{LINKEND}}": case "{{TITLE_LINK}}": if ($view) { // Title link $rowlink = $event->viewDetailLink($event->yup(), $event->mup(), $event->dup(), false); $rowlink = JRoute::_($rowlink . $view->datamodel->getCatidsOutLink()); ob_start(); ?> <a class="ev_link_row" href="<?php echo $rowlink; ?> " title="<?php echo JEventsHTML::special($event->title()); ?> "> <?php $linkstart = ob_get_clean(); } else { $rowlink = $linkstart = ""; } $search[] = "{{LINK}}"; $replace[] = $rowlink; $blank[] = ""; $search[] = "{{LINKSTART}}"; $replace[] = $linkstart; $blank[] = ""; $search[] = "{{LINKEND}}"; $replace[] = "</a>"; $blank[] = ""; $fulllink = $linkstart . $event->title() . '</a>'; $search[] = "{{TITLE_LINK}}"; $replace[] = $fulllink; $blank[] = ""; break; case "{{TRUNCTITLE}}": // for month calendar cell only if (isset($event->truncatedtitle)) { $search[] = "{{TRUNCTITLE}}"; $replace[] = $event->truncatedtitle; $blank[] = ""; } else { $search[] = "{{TRUNCTITLE}}"; $replace[] = $event->title(); $blank[] = ""; } break; case "{{URL}}": $search[] = "{{URL}}"; $replace[] = $event->url(); $blank[] = ""; break; case "{{TRUNCATED_DESC}}": $search[] = "{{TRUNCATED_DESC:.*?}}"; $replace[] = $event->content(); $blank[] = ""; // $search[]="|{{TRUNCATED_DESC:(.*)}}|";$replace[]=$event->content(); break; case "{{DESCRIPTION}}": $search[] = "{{DESCRIPTION}}"; $replace[] = $event->content(); $blank[] = ""; break; case "{{MANAGEMENT}}": $search[] = "{{MANAGEMENT}}"; if ($view) { ob_start(); $view->_viewNavAdminPanel(); $replace[] = ob_get_clean(); } else { $replace[] = ""; } $blank[] = ""; break; case "{{CATEGORY}}": $search[] = "{{CATEGORY}}"; $replace[] = $event->catname(); $blank[] = ""; break; case "{{ALLCATEGORIES}}": $search[] = "{{ALLCATEGORIES}}"; static $allcat_catids; if (!isset($allcat_catids)) { $db = JFactory::getDBO(); $arr_catids = array(); $catsql = "SELECT cat.id, cat.title as name FROM #__categories as cat WHERE cat.extension='com_jevents' "; $db->setQuery($catsql); $allcat_catids = $db->loadObjectList('id'); } $db = JFactory::getDbo(); $db->setQuery("Select catid from #__jevents_catmap WHERE evid = " . $event->ev_id()); $allcat_eventcats = $db->loadColumn(); $allcats = array(); foreach ($allcat_eventcats as $catid) { if (isset($allcat_catids[$catid])) { $allcats[] = $allcat_catids[$catid]->name; } } $replace[] = implode(", ", $allcats); $blank[] = ""; break; case "{{CALENDAR}}": $search[] = "{{CALENDAR}}"; $replace[] = $event->getCalendarName(); $blank[] = ""; break; case "{{COLOUR}}": case "{{colour}}": $bgcolor = $event->bgcolor(); $search[] = $strippedmatch; $replace[] = $bgcolor == "" ? "#ffffff" : $bgcolor; $blank[] = ""; break; case "{{FGCOLOUR}}": $search[] = "{{FGCOLOUR}}"; $replace[] = $event->fgcolor(); $blank[] = ""; break; case "{{TTTIME}}": $search[] = "{{TTTIME}}"; $replace[] = "[[TTTIME]]"; $blank[] = ""; break; case "{{EVTTIME}}": $search[] = "{{EVTTIME}}"; $replace[] = "[[EVTTIME]]"; $blank[] = ""; break; case "{{TOOLTIP}}": $search[] = "{{TOOLTIP}}"; $replace[] = "[[TOOLTIP]]"; $blank[] = ""; break; case "{{CATEGORYLNK}}": $router = JRouter::getInstance("site"); $catlinks = array(); if ($jevparams->get("multicategory", 0)) { $catids = $event->catids(); $catdata = $event->getCategoryData(); } else { $catids = array($event->catid()); $catdata = array($event->getCategoryData()); } $vars = $router->getVars(); foreach ($catids as $cat) { $vars["catids"] = $cat; $catname = "xxx"; foreach ($catdata as $cg) { if ($cat == $cg->id) { $catname = $cg->name; break; } } $eventlink = "index.php?"; foreach ($vars as $key => $val) { // this is only used in the latest events module so do not perpetuate it here if ($key == "filter_reset") { continue; } if ($key == "task" && ($val == "icalrepeat.detail" || $val == "icalevent.detail")) { $val = "week.listevents"; } $eventlink .= $key . "=" . $val . "&"; } $eventlink = substr($eventlink, 0, strlen($eventlink) - 1); $eventlink = JRoute::_($eventlink); $catlinks[] = '<a class="ev_link_cat" href="' . $eventlink . '" title="' . JEventsHTML::special($catname) . '">' . $catname . '</a>'; } $search[] = "{{CATEGORYLNK}}"; $replace[] = implode(", ", $catlinks); $blank[] = ""; break; case "{{CATEGORYIMG}}": $search[] = "{{CATEGORYIMG}}"; $replace[] = $event->getCategoryImage(); $blank[] = ""; break; case "{{CATEGORYIMGS}}": $search[] = "{{CATEGORYIMGS}}"; $replace[] = $event->getCategoryImage(true); $blank[] = ""; break; case "{{CATDESC}}": $search[] = "{{CATDESC}}"; $replace[] = $event->getCategoryDescription(); $blank[] = ""; break; case "{{CATID}}": $search[] = "{{CATID}}"; $replace[] = $event->catid(); $blank[] = ""; break; case "{{PARENT_CATEGORY}}": $search[] = "{{PARENT_CATEGORY}}"; $replace[] = $event->getParentCategory(); $blank[] = ""; break; case "{{ICALDIALOG}}": case "{{ICALBUTTON}}": case "{{EDITDIALOG}}": case "{{EDITBUTTON}}": static $styledone = false; if (!$styledone) { $document = JFactory::getDocument(); $document->addStyleDeclaration("div.jevdialogs {position:relative;margin-top:35px;text-align:left;}\n div.jevdialogs img{float:none!important;margin:0px}"); $styledone = true; } if ($jevparams->get("showicalicon", 0) && !$jevparams->get("disableicalexport", 0)) { JEVHelper::script('view_detail.js', 'components/' . JEV_COM_COMPONENT . "/assets/js/"); $cssloaded = true; ob_start(); ?> <a href="javascript:void(0)" onclick='clickIcalButton()' title="<?php echo JText::_('JEV_SAVEICAL'); ?> "> <img src="<?php echo JURI::root() . 'components/' . JEV_COM_COMPONENT . '/assets/images/jevents_event_sml.png'; ?> " name="image" alt="<?php echo JText::_('JEV_SAVEICAL'); ?> " class="jev_ev_sml nothumb"/> </a> <div class="jevdialogs"> <?php $search[] = "{{ICALDIALOG}}"; if ($view) { ob_start(); $view->eventIcalDialog($event, $mask); $dialog = ob_get_clean(); $replace[] = $dialog; } else { $replace[] = ""; } $blank[] = ""; echo $dialog; ?> </div> <?php $search[] = "{{ICALBUTTON}}"; $replace[] = ob_get_clean(); $blank[] = ""; } else { $search[] = "{{ICALBUTTON}}"; $replace[] = ""; $blank[] = ""; $search[] = "{{ICALDIALOG}}"; $replace[] = ""; $blank[] = ""; } if (JEVHelper::canEditEvent($event) || JEVHelper::canPublishEvent($event) || JEVHelper::canDeleteEvent($event)) { JEVHelper::script('view_detail.js', 'components/' . JEV_COM_COMPONENT . "/assets/js/"); ob_start(); ?> <a href="javascript:void(0)" onclick='clickEditButton()' title="<?php echo JText::_('JEV_E_EDIT'); ?> "> <?php echo JEVHelper::imagesite('edit.png', JText::_('JEV_E_EDIT')); ?> </a> <div class="jevdialogs"> <?php $search[] = "{{EDITDIALOG}}"; if ($view) { ob_start(); $view->eventManagementDialog($event, $mask); $dialog = ob_get_clean(); $replace[] = $dialog; } else { $replace[] = ""; } $blank[] = ""; echo $dialog; ?> </div> <?php $search[] = "{{EDITBUTTON}}"; $replace[] = ob_get_clean(); $blank[] = ""; } else { $search[] = "{{EDITBUTTON}}"; $replace[] = ""; $blank[] = ""; $search[] = "{{EDITDIALOG}}"; $replace[] = ""; $blank[] = ""; } break; case "{{CREATED}}": $compparams = JComponentHelper::getParams(JEV_COM_COMPONENT); $jtz = $compparams->get("icaltimezonelive", ""); if ($jtz == "") { $jtz = null; } $created = JevDate::getDate($event->created(), $jtz); $search[] = "{{CREATED}}"; $replace[] = $created->toFormat(JText::_("DATE_FORMAT_CREATED")); $blank[] = ""; break; case "{{ACCESS}}": $search[] = "{{ACCESS}}"; $replace[] = $event->getAccessName(); $blank[] = ""; break; case "{{REPEATSUMMARY}}": case "{{STARTDATE}}": case "{{ENDDATE}}": case "{{STARTTIME}}": case "{{ENDTIME}}": case "{{STARTTZ}}": case "{{ENDTZ}}": case "{{ISOSTART}}": case "{{ISOEND}}": case "{{DURATION}}": case "{{MULTIENDDATE}}": if ($template_name == "icalevent.detail_body") { $search[] = "{{REPEATSUMMARY}}"; $repeatsummary = $view->repeatSummary($event); if (!$repeatsummary) { $repeatsummary = $event->repeatSummary(); } $replace[] = $repeatsummary; //$replace[] = $event->repeatSummary(); $blank[] = ""; $row = $event; $start_date = JEventsHTML::getDateFormat($row->yup(), $row->mup(), $row->dup(), 0); $start_time = JEVHelper::getTime($row->getUnixStartTime(), $row->hup(), $row->minup()); $stop_date = JEventsHTML::getDateFormat($row->ydn(), $row->mdn(), $row->ddn(), 0); $stop_time = JEVHelper::getTime($row->getUnixEndTime(), $row->hdn(), $row->mindn()); $stop_time_midnightFix = $stop_time; $stop_date_midnightFix = $stop_date; if ($row->sdn() == 59 && $row->mindn() == 59) { $stop_time_midnightFix = JEVHelper::getTime($row->getUnixEndTime() + 1, 0, 0); $stop_date_midnightFix = JEventsHTML::getDateFormat($row->ydn(), $row->mdn(), $row->ddn() + 1, 0); } $search[] = "{{STARTDATE}}"; $replace[] = $start_date; $blank[] = ""; $search[] = "{{ENDDATE}}"; $replace[] = $stop_date; $blank[] = ""; $search[] = "{{STARTTIME}}"; $replace[] = $row->alldayevent() ? "" : $start_time; $blank[] = ""; $search[] = "{{ENDTIME}}"; $replace[] = $row->noendtime() || $row->alldayevent() ? "" : $stop_time_midnightFix; $blank[] = ""; $search[] = "{{STARTTZ}}"; $replace[] = $row->alldayevent() ? "" : $start_time; $blank[] = ""; $search[] = "{{ENDTZ}}"; $replace[] = $row->noendtime() || $row->alldayevent() ? "" : $stop_time_midnightFix; $blank[] = ""; $rawreplace["{{STARTDATE}}"] = $row->getUnixStartDate(); $rawreplace["{{ENDDATE}}"] = $row->getUnixEndDate(); $rawreplace["{{STARTTIME}}"] = $row->getUnixStartTime(); $rawreplace["{{ENDTIME}}"] = $row->getUnixEndTime(); $rawreplace["{{STARTTZ}}"] = $row->yup() . "-" . $row->mup() . "-" . $row->dup() . " " . $row->hup() . ":" . $row->minup() . ":" . $row->sup(); $rawreplace["{{ENDTZ}}"] = $row->ydn() . "-" . $row->mdn() . "-" . $row->ddn() . " " . $row->hdn() . ":" . $row->mindn() . ":" . $row->sdn(); $rawreplace["{{MULTIENDDATE}}"] = $row->endDate() > $row->startDate() ? $stop_date : ""; $search[] = "{{ISOSTART}}"; $replace[] = JEventsHTML::getDateFormat($row->yup(), $row->mup(), $row->dup(), "%Y-%m-%d") . "T" . sprintf('%02d:%02d:00', $row->hup(), $row->minup()); $blank[] = ""; $search[] = "{{ISOEND}}"; $replace[] = JEventsHTML::getDateFormat($row->ydn(), $row->mdn(), $row->ddn(), "%Y-%m-%d") . "T" . sprintf('%02d:%02d:00', $row->hdn(), $row->mindn()); $blank[] = ""; $search[] = "{{MULTIENDDATE}}"; $replace[] = $row->endDate() > $row->startDate() ? $row->getUnixEndDate() : ""; $blank[] = ""; } else { $row = $event; $start_date = JEventsHTML::getDateFormat($row->yup(), $row->mup(), $row->dup(), 0); $start_time = JEVHelper::getTime($row->getUnixStartTime(), $row->hup(), $row->minup()); $stop_date = JEventsHTML::getDateFormat($row->ydn(), $row->mdn(), $row->ddn(), 0); $stop_time = JEVHelper::getTime($row->getUnixEndTime(), $row->hdn(), $row->mindn()); $stop_time_midnightFix = $stop_time; $stop_date_midnightFix = $stop_date; if ($row->sdn() == 59 && $row->mindn() == 59) { $stop_time_midnightFix = JEVHelper::getTime($row->getUnixEndTime() + 1, 0, 0); $stop_date_midnightFix = JEventsHTML::getDateFormat($row->ydn(), $row->mdn(), $row->ddn() + 1, 0); } $search[] = "{{STARTDATE}}"; $replace[] = $start_date; $blank[] = ""; $search[] = "{{ENDDATE}}"; $replace[] = $stop_date; $blank[] = ""; $search[] = "{{STARTTIME}}"; $replace[] = $row->alldayevent() ? "" : $start_time; $blank[] = ""; $search[] = "{{ENDTIME}}"; $replace[] = $row->noendtime() || $row->alldayevent() ? "" : $stop_time_midnightFix; $blank[] = ""; $search[] = "{{MULTIENDDATE}}"; $replace[] = $row->endDate() > $row->startDate() ? $stop_date : ""; $blank[] = ""; $search[] = "{{STARTTZ}}"; $replace[] = $row->alldayevent() ? "" : $start_time; $blank[] = ""; $search[] = "{{ENDTZ}}"; $replace[] = $row->noendtime() || $row->alldayevent() ? "" : $stop_time_midnightFix; $blank[] = ""; $rawreplace["{{STARTDATE}}"] = $row->getUnixStartDate(); $rawreplace["{{ENDDATE}}"] = $row->getUnixEndDate(); $rawreplace["{{STARTTIME}}"] = $row->getUnixStartTime(); $rawreplace["{{ENDTIME}}"] = $row->getUnixEndTime(); $rawreplace["{{STARTTZ}}"] = $row->yup() . "-" . $row->mup() . "-" . $row->dup() . " " . $row->hup() . ":" . $row->minup() . ":" . $row->sup(); $rawreplace["{{ENDTZ}}"] = $row->ydn() . "-" . $row->mdn() . "-" . $row->ddn() . " " . $row->hdn() . ":" . $row->mindn() . ":" . $row->sdn(); $rawreplace["{{MULTIENDDATE}}"] = $row->endDate() > $row->startDate() ? $row->getUnixEndDate() : ""; if (strpos($template_value, "{{ISOSTART}}") !== false || strpos($template_value, "{{ISOEND}}") !== false) { $search[] = "{{ISOSTART}}"; $replace[] = JEventsHTML::getDateFormat($row->yup(), $row->mup(), $row->dup(), "%Y-%m-%d") . "T" . sprintf('%02d:%02d:00', $row->hup(), $row->minup()); $blank[] = ""; $search[] = "{{ISOEND}}"; $replace[] = JEventsHTML::getDateFormat($row->ydn(), $row->mdn(), $row->ddn(), "%Y-%m-%d") . "T" . sprintf('%02d:%02d:00', $row->hdn(), $row->mindn()); $blank[] = ""; } // these would slow things down if not needed in the list $dorepeatsummary = strpos($template_value, "{{REPEATSUMMARY}}") !== false; if ($dorepeatsummary) { $cfg = JEVConfig::getInstance(); $jevtask = JRequest::getString("jevtask"); $jevtask = str_replace(".listevents", "", $jevtask); $showyeardate = $cfg->get("showyeardate", 0); $row = $event; $times = ""; if ($showyeardate && $jevtask == "year" || $jevtask == "search.results" || $jevtask == "month.calendar" || $jevtask == "cat" || $jevtask == "range") { $start_publish = $row->getUnixStartDate(); $stop_publish = $row->getUnixEndDate(); if ($stop_publish == $start_publish) { if ($row->noendtime()) { $times = $start_time; } else { if ($row->alldayevent()) { $times = ""; } else { if ($start_time != $stop_time) { $times = $start_time . ' - ' . $stop_time_midnightFix; } else { $times = $start_time; } } } $times = $start_date . " " . $times . "<br/>"; } else { if ($row->noendtime()) { $times = $start_time; } else { if ($row->alldayevent()) { $times = ""; } else { if ($start_time != $stop_time && !$row->alldayevent()) { $times = $start_time . ' - ' . $stop_time_midnightFix; } } } $times = $start_date . ' - ' . $stop_date . " " . $times . "<br/>"; } } else { if (($jevtask == "day" || $jevtask == "week") && $row->starttime() != $row->endtime() && !$row->alldayevent()) { if ($row->noendtime()) { if ($showyeardate && $jevtask == "year") { $times = $start_time . ' - ' . $stop_time_midnightFix . ' '; } else { $times = $start_time . ' '; } } else { if ($row->alldayevent()) { $times = ""; } else { $times = $start_time . ' - ' . $stop_time_midnightFix . ' '; } } } } $search[] = "{{REPEATSUMMARY}}"; $replace[] = $times; $blank[] = ""; } } $search[] = "{{DURATION}}"; $timedelta = $row->noendtime() ? "" : $row->getUnixEndTime() - $row->getUnixStartTime(); if ($row->alldayevent()) { $timedelta = $row->getUnixEndDate() - $row->getUnixStartDate() + 60 * 60 * 24; } $fieldval = JText::_("JEV_DURATION_FORMAT"); $shownsign = false; // whole days! if (stripos($fieldval, "%wd") !== false) { $days = intval($timedelta / (60 * 60 * 24)); $timedelta -= $days * 60 * 60 * 24; if ($timedelta > 3610) { //if more than 1 hour and 10 seconds over a day then round up the day output $days += 1; } $fieldval = str_ireplace("%d", $days, $fieldval); $shownsign = true; } if (stripos($fieldval, "%d") !== false) { $days = intval($timedelta / (60 * 60 * 24)); $timedelta -= $days * 60 * 60 * 24; /* if ($timedelta>3610){ //if more than 1 hour and 10 seconds over a day then round up the day output $days +=1; } */ $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); } $replace[] = $fieldval; $blank[] = ""; break; case "{{PREVIOUSNEXT}}": static $doprevnext; if (!isset($doprevnext)) { $doprevnext = strpos($template_value, "{{PREVIOUSNEXT}}") !== false; } if ($doprevnext) { $search[] = "{{PREVIOUSNEXT}}"; $replace[] = $event->previousnextLinks(); $blank[] = ""; } break; case "{{PREVIOUSNEXTEVENT}}": static $doprevnextevent; if (!isset($doprevnextevent)) { $doprevnextevent = strpos($template_value, "{{PREVIOUSNEXTEVENT}}") !== false; } if ($doprevnextevent) { $search[] = "{{PREVIOUSNEXTEVENT}}"; $replace[] = $event->previousnextEventLinks(); $blank[] = ""; } break; case "{{FIRSTREPEAT}}": case "{{FIRSTREPEATSTART}}": static $dofirstrepeat; if (!isset($dofirstrepeat)) { $dofirstrepeat = strpos($template_value, "{{FIRSTREPEAT}}") !== false || strpos($template_value, "{{FIRSTREPEATSTART}}") !== false; } if ($dofirstrepeat) { $search[] = "{{FIRSTREPEAT}}"; $firstrepeat = $event->getFirstRepeat(); if ($firstrepeat->rp_id() == $event->rp_id()) { $replace[] = ""; } else { $replace[] = "<a class='ev_firstrepeat' href='" . $firstrepeat->viewDetailLink($firstrepeat->yup(), $firstrepeat->mup(), $firstrepeat->dup(), true) . "' title='" . JText::_('JEV_FIRSTREPEAT') . "' >" . JText::_('JEV_FIRSTREPEAT') . "</a>"; } $blank[] = ""; $search[] = "{{FIRSTREPEATSTART}}"; if ($firstrepeat->rp_id() == $event->rp_id()) { $replace[] = ""; } else { $replace[] = JEventsHTML::getDateFormat($firstrepeat->yup(), $firstrepeat->mup(), $firstrepeat->dup(), 0); $rawreplace[] = $firstrepeat->yup() . "-" . $firstrepeat->mup() . "-" . $firstrepeat->dup() . " " . $firstrepeat->hup() . ":" . $firstrepeat->minup() . ":" . $firstrepeat->sup(); } $blank[] = ""; } break; case "{{LASTREPEAT}}": case "{{LASTREPEATEND}}": static $dolastrepeat; if (!isset($dolastrepeat)) { $dolastrepeat = strpos($template_value, "{{LASTREPEAT}}") !== false || strpos($template_value, "{{LASTREPEATEND}}") !== false; } if ($dolastrepeat) { $search[] = "{{LASTREPEAT}}"; $lastrepeat = $event->getLastRepeat(); if ($lastrepeat->rp_id() == $event->rp_id()) { $replace[] = ""; } else { $replace[] = "<a class='ev_lastrepeat' href='" . $lastrepeat->viewDetailLink($lastrepeat->yup(), $lastrepeat->mup(), $lastrepeat->dup(), true) . "' title='" . JText::_('JEV_LASTREPEAT') . "' >" . JText::_('JEV_LASTREPEAT') . "</a>"; } $blank[] = ""; $search[] = "{{LASTREPEATEND}}"; if ($lastrepeat->rp_id() != $event->rp_id()) { $replace[] = JEventsHTML::getDateFormat($lastrepeat->ydn(), $lastrepeat->mdn(), $lastrepeat->ddn(), 0); $rawreplace[] = $lastrepeat->ydn() . "-" . $lastrepeat->mdn() . "-" . $lastrepeat->ddn() . " " . $lastrepeat->hdn() . ":" . $lastrepeat->mindn() . ":" . $lastrepeat->sdn(); } else { $replace[] = ""; } $blank[] = ""; } break; case "{{CREATOR_LABEL}}": $search[] = "{{CREATOR_LABEL}}"; $replace[] = JText::_('JEV_BY'); $blank[] = ""; break; case "{{CREATOR}}": $search[] = "{{CREATOR}}"; $replace[] = $event->contactlink(); $blank[] = ""; break; case "{{HITS}}": $search[] = "{{HITS}}"; $replace[] = "<span class='hitslabel'>" . JText::_('JEV_EVENT_HITS') . '</span> : ' . $event->hits(); $blank[] = ""; break; case "{{LOCATION_LABEL}}": case "{{LOCATION}}": if ($event->hasLocation()) { $search[] = "{{LOCATION_LABEL}}"; $replace[] = JText::_('JEV_EVENT_ADRESSE') . " "; $blank[] = ""; $search[] = "{{LOCATION}}"; $replace[] = $event->location(); $blank[] = ""; } else { $search[] = "{{LOCATION_LABEL}}"; $replace[] = ""; $blank[] = ""; $search[] = "{{LOCATION}}"; $replace[] = ""; $blank[] = ""; } break; case "{{CONTACT_LABEL}}": case "{{CONTACT}}": if ($event->hasContactInfo()) { if (strpos($event->contact_info(), '<script') === false) { $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('content'); //Contact $pattern = '[a-zA-Z0-9&?_.,=%\\-\\/]'; if (strpos($event->contact_info(), '<a href=') === false && $event->contact_info() != "") { $event->contact_info(preg_replace('@(https?://)(' . $pattern . '*)@i', '<a href="\\1\\2">\\1\\2</a>', $event->contact_info())); } // NO need to call conContentPrepate since its called on the template value below here } $search[] = "{{CONTACT_LABEL}}"; $replace[] = JText::_('JEV_EVENT_CONTACT') . " "; $blank[] = ""; $search[] = "{{CONTACT}}"; $replace[] = $event->contact_info(); $blank[] = ""; } else { $search[] = "{{CONTACT_LABEL}}"; $replace[] = ""; $blank[] = ""; $search[] = "{{CONTACT}}"; $replace[] = ""; $blank[] = ""; } break; case "{{EXTRAINFO}}": //Extra if (strpos($event->extra_info(), '<script') === false && $event->extra_info() != "") { $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('content'); $pattern = '[a-zA-Z0-9&?_.,=%\\-\\/#]'; if (strpos($event->extra_info(), '<a href=') === false) { $event->extra_info(preg_replace('@(https?://)(' . $pattern . '*)@i', '<a href="\\1\\2">\\1\\2</a>', $event->extra_info())); } //$row->extra_info(eregi_replace('[^(href=|href="|href=\')](((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)','\\1', $row->extra_info())); // NO need to call conContentPrepate since its called on the template value below here } $search[] = "{{EXTRAINFO}}"; $replace[] = $event->extra_info(); $blank[] = ""; break; case "{{RPID}}": $search[] = "{{RPID}}"; $replace[] = $event->rp_id(); $blank[] = ""; break; default: $strippedmatch = str_replace(array("{", "}"), "", $strippedmatch); if (is_callable(array($event, $strippedmatch))) { $search[] = "{{" . $strippedmatch . "}}"; $replace[] = $event->{$strippedmatch}(); $blank[] = ""; } break; } } // Now do the plugins // get list of enabled plugins $layout = $template_name == "icalevent.list_row" || $template_name == "month.calendar_cell" || $template_name == "month.calendar_tip" ? "list" : "detail"; $jevplugins = JPluginHelper::getPlugin("jevents"); foreach ($jevplugins as $jevplugin) { $classname = "plgJevents" . ucfirst($jevplugin->name); if (is_callable(array($classname, "substitutefield"))) { if (!isset($fieldNameArray[$classname])) { $fieldNameArray[$classname] = array(); } if (!isset($fieldNameArray[$classname][$layout])) { //list($usec, $sec) = explode(" ", microtime()); //$starttime = (float) $usec + (float) $sec; $fieldNameArray[$classname][$layout] = call_user_func(array($classname, "fieldNameArray"), $layout); //list ($usec, $sec) = explode(" ", microtime()); //$time_end = (float) $usec + (float) $sec; //echo "$classname::fieldNameArray = ".round($time_end - $starttime, 4)."<br/>"; } if (isset($fieldNameArray[$classname][$layout]["values"])) { foreach ($fieldNameArray[$classname][$layout]["values"] as $fieldname) { if (!strpos($template_value, $fieldname) !== false) { continue; } $search[] = "{{" . $fieldname . "}}"; // is the event detail hidden - if so then hide any custom fields too! if (!isset($event->_privateevent) || $event->_privateevent != 3) { $replace[] = call_user_func(array($classname, "substitutefield"), $event, $fieldname); if (is_callable(array($classname, "blankfield"))) { $blank[] = call_user_func(array($classname, "blankfield"), $event, $fieldname); } else { $blank[] = ""; } } else { $blank[] = ""; $replace[] = ""; } } } } } // word counts etc. for ($s = 0; $s < count($search); $s++) { if (strpos($search[$s], "TRUNCATED_DESC:") > 0) { global $tempreplace, $tempevent, $tempsearch; $tempreplace = $replace[$s]; $tempsearch = $search[$s]; $tempevent = $event; $template_value = preg_replace_callback("|{$tempsearch}|", 'jevSpecialHandling', $template_value); } } // Date/time formats etc. for ($s = 0; $s < count($search); $s++) { if (strpos($search[$s], "STARTDATE") > 0 || strpos($search[$s], "STARTTIME") > 0 || strpos($search[$s], "ENDDATE") > 0 || strpos($search[$s], "ENDTIME") > 0 || strpos($search[$s], "ENDTZ") > 0 || strpos($search[$s], "STARTTZ") > 0 || strpos($search[$s], "MULTIENDDATE") > 0 || strpos($search[$s], "FIRSTREPEATSTART") > 0 || strpos($search[$s], "LASTREPEATEND") > 0) { if (!isset($rawreplace[$search[$s]]) || !$rawreplace[$search[$s]]) { continue; } global $tempreplace, $tempevent, $tempsearch; $tempreplace = $rawreplace[$search[$s]]; $tempsearch = str_replace("}}", ";.*?}}", $search[$s]); $tempevent = $event; $template_value = preg_replace_callback("|{$tempsearch}|", 'jevSpecialDateFormatting', $template_value); } } for ($s = 0; $s < count($search); $s++) { global $tempreplace, $tempevent, $tempsearch, $tempblank; $tempreplace = $replace[$s]; $tempblank = $blank[$s]; $tempsearch = str_replace("}}", "#", $search[$s]); $tempevent = $event; $template_value = preg_replace_callback("|{$tempsearch}(.+?)}}|", 'jevSpecialHandling2', $template_value); } $template_value = str_replace($search, $replace, $template_value); if ($specialmodules) { $reg = JRegistry::getInstance("com_jevents"); $parts = explode("{{MODULESTART#", $template_value); $dynamicmodules = array(); foreach ($parts as $part) { $currentdynamicmodules = $reg->get("dynamicmodules", false); if (strpos($part, "{{MODULEEND}}") === false) { // strip out BAD HTML tags left by WYSIWYG editors if (substr($part, strlen($part) - 3) == "<p>") { $template_value = substr($part, 0, strlen($part) - 3); } else { $template_value = $part; } continue; } // start with module name $modname = substr($part, 0, strpos($part, "}}")); $modulecontent = substr($part, strpos($part, "}}") + 2); $modulecontent = substr($modulecontent, 0, strpos($modulecontent, "{{MODULEEND}}")); // strip out BAD HTML tags left by WYSIWYG editors if (strpos($modulecontent, "</p>") === 0) { $modulecontent = "<p>x@#" . $modulecontent; } if (substr($modulecontent, strlen($modulecontent) - 3) == "<p>") { $modulecontent .= "x@#</p>"; } $modulecontent = str_replace("<p>x@#</p>", "", $modulecontent); if (isset($currentdynamicmodules[$modname])) { if (!is_array($currentdynamicmodules[$modname])) { $currentdynamicmodules[$modname] = array($currentdynamicmodules[$modname]); } $currentdynamicmodules[$modname][] = $modulecontent; $dynamicmodules[$modname] = $currentdynamicmodules[$modname]; } else { $dynamicmodules[$modname] = $modulecontent; } } $reg->set("dynamicmodules", $dynamicmodules); } // non greedy replacement - because of the ? $template_value = preg_replace_callback('|{{.*?}}|', 'cleanUnpublished', $template_value); // replace [[ with { to that other content plugins can work ok - but not for calendar cell or tooltip since we use [[ there already! if ($template_name != "month.calendar_cell" && $template_name != "month.calendar_tip") { $template_value = str_replace(array("[[", "]]"), array("{", "}"), $template_value); } //We add new line characters again to avoid being marked as SPAM when using tempalte in emails // do this before content plugins incase they insert javascript etc. $template_value = preg_replace("@(<\\s*(br)*\\s*\\/\\s*(p|td|tr|table|div|ul|li|ol|dd|dl|dt)*\\s*>)+?@i", "\$1\n", $template_value); // Call content plugins - BUT because emailcloak doesn't identify emails in input fields to a text substitution $template_value = str_replace("@", "@£@", $template_value); $params = new JRegistry(null); $tmprow = new stdClass(); $tmprow->text = $template_value; $tmprow->event = $event; $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('content'); $dispatcher->trigger('onContentPrepare', array('com_jevents', &$tmprow, &$params, 0)); $template_value = $tmprow->text; $template_value = str_replace("@£@", "@", $template_value); echo $template_value; return true; }
function DefaultLoadedFromTemplate($view, $template_name, $event, $mask) { $db = JFactory::getDBO(); // find published template static $templates; if (!isset($templates)) { $templates = array(); } if (!array_key_exists($template_name, $templates)) { $db->setQuery("SELECT * FROM #__jev_defaults WHERE state=1 AND name= " . $db->Quote($template_name)); $templates[$template_name] = $db->loadObject(); } if (is_null($templates[$template_name]) || $templates[$template_name]->value == "") { return false; } $template = $templates[$template_name]; // now replace the fields $search = array(); $replace = array(); $blank = array(); $jevparams = JComponentHelper::getParams(JEV_COM_COMPONENT); // Built in fields $search[] = "{{TITLE}}"; $replace[] = $event->title(); $blank[] = ""; // Title link $rowlink = $event->viewDetailLink($event->yup(), $event->mup(), $event->dup(), false); $rowlink = JRoute::_($rowlink . $view->datamodel->getCatidsOutLink()); ob_start(); ?> <a class="ev_link_row" href="<?php echo $rowlink; ?> " style="font-weight:bold;" title="<?php echo JEventsHTML::special($event->title()); ?> "> <?php $linkstart = ob_get_clean(); $search[] = "{{LINK}}"; $replace[] = $rowlink; $blank[] = ""; $search[] = "{{LINKSTART}}"; $replace[] = $linkstart; $blank[] = ""; $search[] = "{{LINKEND}}"; $replace[] = "</a>"; $blank[] = ""; $fulllink = $linkstart . $event->title() . '</a>'; $search[] = "{{TITLE_LINK}}"; $replace[] = $fulllink; $blank[] = ""; $search[] = "{{URL}}"; $replace[] = $event->url(); $blank[] = ""; $search[] = "{{TRUNCATED_DESC:.*}}"; $replace[] = $event->content(); $blank[] = ""; // $search[]="|{{TRUNCATED_DESC:(.*)}}|";$replace[]=$event->content(); $search[] = "{{DESCRIPTION}}"; $replace[] = $event->content(); $blank[] = ""; $search[] = "{{MANAGEMENT}}"; ob_start(); $view->_viewNavAdminPanel(); $replace[] = ob_get_clean(); $blank[] = ""; $search[] = "{{CATEGORY}}"; $replace[] = $event->catname(); $blank[] = ""; $bgcolor = $event->bgcolor(); $search[] = "{{COLOUR}}"; $replace[] = $bgcolor == "" ? "#ffffff" : $bgcolor; $blank[] = ""; $search[] = "{{FGCOLOUR}}"; $replace[] = $event->fgcolor(); $blank[] = ""; $search[] = "{{TTTIME}}"; $replace[] = "[[TTTIME]]"; $blank[] = ""; $search[] = "{{EVTTIME}}"; $replace[] = "[[EVTTIME]]"; $blank[] = ""; $search[] = "{{TOOLTIP}}"; $replace[] = "[[TOOLTIP]]"; $blank[] = ""; $router = JRouter::getInstance("site"); $vars = $router->getVars(); $vars["catids"] = $event->catid(); $eventlink = "index.php?"; foreach ($vars as $key => $val) { $eventlink .= $key . "=" . $val . "&"; } $eventlink = substr($eventlink, 0, strlen($eventlink) - 1); $eventlink = JRoute::_($eventlink); $catlink = '<a class="ev_link_cat" href="' . $eventlink . '" title="' . JEventsHTML::special($event->catname()) . '">' . $event->catname() . '</a>'; $search[] = "{{CATEGORYLNK}}"; $replace[] = $catlink; $blank[] = ""; $search[] = "{{CATEGORYIMG}}"; $replace[] = $event->getCategoryImage(); $blank[] = ""; static $styledone = false; if (!$styledone) { $document = JFactory::getDocument(); $document->addStyleDeclaration("div.jevdialogs {position:relative;margin-top:35px;text-align:left;}\n div.jevdialogs img{float:none!important;margin:0px}"); $styledone = true; } if ($jevparams->get("showicalicon", 0) && !$jevparams->get("disableicalexport", 0)) { JEVHelper::script('view_detail.js', 'components/' . JEV_COM_COMPONENT . "/assets/js/"); $cssloaded = true; ob_start(); ?> <a href="javascript:void(0)" onclick='clickIcalButton()' title="<?php echo JText::_('JEV_SAVEICAL'); ?> "> <img src="<?php echo JURI::root() . 'administrator/components/' . JEV_COM_COMPONENT . '/assets/images/jevents_event_sml.png'; ?> " align="middle" name="image" alt="<?php echo JText::_('JEV_SAVEICAL'); ?> " style="height:24px;"/> </a> <div class="jevdialogs"> <?php $search[] = "{{ICALDIALOG}}"; ob_start(); $view->eventIcalDialog($event, $mask); $dialog = ob_get_clean(); $replace[] = $dialog; $blank[] = ""; echo $dialog; ?> </div> <?php $search[] = "{{ICALBUTTON}}"; $replace[] = ob_get_clean(); $blank[] = ""; } else { $search[] = "{{ICALBUTTON}}"; $replace[] = ""; $blank[] = ""; $search[] = "{{ICALDIALOG}}"; $replace[] = ""; $blank[] = ""; } if ((JEVHelper::canEditEvent($event) || JEVHelper::canPublishEvent($event) || JEVHelper::canDeleteEvent($event)) && !($mask & MASK_POPUP)) { JEVHelper::script('view_detail.js', 'components/' . JEV_COM_COMPONENT . "/assets/js/"); ob_start(); ?> <a href="javascript:void(0)" onclick='clickEditButton()' title="<?php echo JText::_('JEV_E_EDIT'); ?> "> <?php echo JEVHelper::imagesite('edit.png', JText::_('JEV_E_EDIT')); ?> </a> <div class="jevdialogs"> <?php $search[] = "{{EDITDIALOG}}"; ob_start(); $view->eventManagementDialog($event, $mask); $dialog = ob_get_clean(); $replace[] = $dialog; $blank[] = ""; echo $dialog; ?> </div> <?php $search[] = "{{EDITBUTTON}}"; $replace[] = ob_get_clean(); $blank[] = ""; } else { $search[] = "{{EDITBUTTON}}"; $replace[] = ""; $blank[] = ""; $search[] = "{{EDITDIALOG}}"; $replace[] = ""; $blank[] = ""; } $created = JevDate::getDate($event->created()); $search[] = "{{CREATED}}"; $replace[] = $created->toFormat(JText::_("DATE_FORMAT_CREATED")); $blank[] = ""; if ($template_name == "icalevent.detail_body") { $search[] = "{{REPEATSUMMARY}}"; $replace[] = $event->repeatSummary(); $blank[] = ""; $row = $event; $start_date = JEventsHTML::getDateFormat($row->yup(), $row->mup(), $row->dup(), 0); $start_time = JEVHelper::getTime($row->getUnixStartTime(), $row->hup(), $row->minup()); $stop_date = JEventsHTML::getDateFormat($row->ydn(), $row->mdn(), $row->ddn(), 0); $stop_time = JEVHelper::getTime($row->getUnixEndTime(), $row->hdn(), $row->mindn()); $stop_time_midnightFix = $stop_time; $stop_date_midnightFix = $stop_date; if ($row->sdn() == 59 && $row->mindn() == 59) { $stop_time_midnightFix = JEVHelper::getTime($row->getUnixEndTime() + 1, 0, 0); $stop_date_midnightFix = JEventsHTML::getDateFormat($row->ydn(), $row->mdn(), $row->ddn() + 1, 0); } $search[] = "{{STARTDATE}}"; $replace[] = $start_date; $blank[] = ""; $search[] = "{{ENDDATE}}"; $replace[] = $stop_date; $blank[] = ""; $search[] = "{{STARTTIME}}"; $replace[] = $start_time; $blank[] = ""; $search[] = "{{ENDTIME}}"; $replace[] = $stop_time_midnightFix; $blank[] = ""; } else { $row = $event; $start_date = JEventsHTML::getDateFormat($row->yup(), $row->mup(), $row->dup(), 0); $start_time = JEVHelper::getTime($row->getUnixStartTime(), $row->hup(), $row->minup()); $stop_date = JEventsHTML::getDateFormat($row->ydn(), $row->mdn(), $row->ddn(), 0); $stop_time = JEVHelper::getTime($row->getUnixEndTime(), $row->hdn(), $row->mindn()); $stop_time_midnightFix = $stop_time; $stop_date_midnightFix = $stop_date; if ($row->sdn() == 59 && $row->mindn() == 59) { $stop_time_midnightFix = JEVHelper::getTime($row->getUnixEndTime() + 1, 0, 0); $stop_date_midnightFix = JEventsHTML::getDateFormat($row->ydn(), $row->mdn(), $row->ddn() + 1, 0); } $search[] = "{{STARTDATE}}"; $replace[] = $start_date; $blank[] = ""; $search[] = "{{ENDDATE}}"; $replace[] = $stop_date; $blank[] = ""; $search[] = "{{STARTTIME}}"; $replace[] = $start_time; $blank[] = ""; $search[] = "{{ENDTIME}}"; $replace[] = $stop_time_midnightFix; $blank[] = ""; // these would slow things down if not needed in the list static $dorepeatsummary; if (!isset($dorepeatsummary)) { $dorepeatsummary = strpos($template->value, ":REPEATSUMMARY}}") !== false; } if ($dorepeatsummary) { $cfg =& JEVConfig::getInstance(); $jevtask = JRequest::getString("jevtask"); $jevtask = str_replace(".listevents", "", $jevtask); $showyeardate = $cfg->get("showyeardate", 0); $row = $event; $times = ""; if ($showyeardate && $jevtask == "year" || $jevtask == "search.results" || $jevtask == "cat" || $jevtask == "range") { $start_publish = $row->getUnixStartDate(); $stop_publish = $row->getUnixEndDate(); if ($stop_publish == $start_publish) { if ($row->noendtime()) { $times = $start_time; } else { if ($row->alldayevent()) { $times = ""; } else { if ($start_time != $stop_time) { $times = $start_time . ' - ' . $stop_time_midnightFix; } else { $times = $start_time; } } } $times = $start_date . " " . $times . "<br/>"; } else { if ($row->noendtime()) { $times = $start_time; } else { if ($start_time != $stop_time && !$row->alldayevent()) { $times = $start_time . ' - ' . $stop_time_midnightFix; } } $times = $start_date . ' - ' . $stop_date . " " . $times . "<br/>"; } } else { if (($jevtask == "day" || $jevtask == "week") && $row->starttime() != $row->endtime() && !$row->alldayevent()) { if ($row->noendtime()) { if ($showyeardate && $jevtask == "year") { $times = $start_time . ' - ' . $stop_time_midnightFix . ' '; } else { $times = $start_time . ' '; } } else { $times = $start_time . ' - ' . $stop_time_midnightFix . ' '; } } } $search[] = "{{REPEATSUMMARY}}"; $replace[] = $times; $blank[] = ""; } } static $doprevnext; if (!isset($doprevnext)) { $doprevnext = strpos($template->value, ":PREVIOUSNEXT}}") !== false; } if ($doprevnext) { $search[] = "{{PREVIOUSNEXT}}"; $replace[] = $event->previousnextLinks(); $blank[] = ""; } $search[] = "{{CREATOR_LABEL}}"; $replace[] = JText::_('JEV_BY'); $blank[] = ""; $search[] = "{{CREATOR}}"; $replace[] = $event->contactlink(); $blank[] = ""; $search[] = "{{HITS}}"; $replace[] = "<span class='hitslabel'>" . JText::_('JEV_EVENT_HITS') . '</span> : ' . $event->hits(); $blank[] = ""; if ($event->hasLocation()) { $search[] = "{{LOCATION_LABEL}}"; $replace[] = JText::_('JEV_EVENT_ADRESSE') . " "; $blank[] = ""; $search[] = "{{LOCATION}}"; $replace[] = $event->location(); $blank[] = ""; } else { $search[] = "{{LOCATION_LABEL}}"; $replace[] = ""; $blank[] = ""; $search[] = "{{LOCATION}}"; $replace[] = ""; $blank[] = ""; } if ($event->hasContactInfo()) { $search[] = "{{CONTACT_LABEL}}"; $replace[] = JText::_('JEV_EVENT_CONTACT') . " "; $blank[] = ""; $search[] = "{{CONTACT}}"; $replace[] = $event->contact_info(); $blank[] = ""; } else { $search[] = "{{CONTACT_LABEL}}"; $replace[] = ""; $blank[] = ""; $search[] = "{{CONTACT}}"; $replace[] = ""; $blank[] = ""; } $search[] = "{{EXTRAINFO}}"; $replace[] = $event->extra_info(); $blank[] = ""; // Now do the plugins // get list of enabled plugins $layout = $template_name == "icalevent.list_row" || $template_name == "month.calendar_cell" || $template_name == "month.calendar_tip" ? "list" : "detail"; $jevplugins = JPluginHelper::getPlugin("jevents"); foreach ($jevplugins as $jevplugin) { $classname = "plgJevents" . ucfirst($jevplugin->name); if (is_callable(array($classname, "substitutefield"))) { $fieldNameArray = call_user_func(array($classname, "fieldNameArray"), $layout); if (isset($fieldNameArray["values"])) { foreach ($fieldNameArray["values"] as $fieldname) { $search[] = "{{" . $fieldname . "}}"; // is the event detail hidden - if so then hide any custom fields too! if (!isset($event->_privateevent) || $event->_privateevent != 3) { $replace[] = call_user_func(array($classname, "substitutefield"), $event, $fieldname); if (is_callable(array($classname, "blankfield"))) { $blank[] = call_user_func(array($classname, "blankfield"), $event, $fieldname); } else { $blank[] = ""; } } else { $blank[] = ""; $replace[] = ""; } } } } } $template_value = $template->value; // strip carriage returns other wise the preg replace doesn;y work - needed because wysiwyg editor may add the carriage return in the template field $template_value = str_replace("\r", '', $template_value); $template_value = str_replace("\n", '', $template_value); // non greedy replacement - because of the ? $template_value = preg_replace_callback('|{{.*?}}|', 'cleanLabels', $template_value); // word counts etc. for ($s = 0; $s < count($search); $s++) { if (strpos($search[$s], "TRUNCATED_DESC:") > 0) { global $tempreplace, $tempevent, $tempsearch; $tempreplace = $replace[$s]; $tempsearch = $search[$s]; $tempevent = $event; $template_value = preg_replace_callback("|{$tempsearch}|", 'jevSpecialHandling', $template_value); } } for ($s = 0; $s < count($search); $s++) { global $tempreplace, $tempevent, $tempsearch, $tempblank; $tempreplace = $replace[$s]; $tempblank = $blank[$s]; $tempsearch = str_replace("}}", "#", $search[$s]); $tempevent = $event; $template_value = preg_replace_callback("|{$tempsearch}(.+?)}}|", 'jevSpecialHandling2', $template_value); } $template_value = str_replace($search, $replace, $template_value); // non greedy replacement - because of the ? $template_value = preg_replace_callback('|{{.*?}}|', 'cleanUnpublished', $template_value); echo $template_value; return true; }
function DefaultViewEventRowNew($view, $row, $args = "") { $cfg = JEVConfig::getInstance(); $rowlink = $row->viewDetailLink($row->yup(), $row->mup(), $row->dup(), false); $rowlink = JRoute::_($rowlink . $view->datamodel->getCatidsOutLink()); // I choost not to use $row->fgcolor $fgcolor = "inherit"; $tmpTitle = $row->title(); /* // [mic] if title is too long, cut 'em for display if( JString::strlen( $row->title() ) >= 50 ){ $tmpTitle = JString::substr( $row->title(), 0, 50 ) . ' ...'; } */ $jevtask = JRequest::getString("jevtask"); $jevtask = str_replace(".listevents", "", $jevtask); $showyeardate = $cfg->get("showyeardate", 0); $times = ""; if ($showyeardate && $jevtask == "year" || $jevtask == "search.results" || $jevtask == "cat" || $jevtask == "range") { $start_publish = $row->getUnixStartDate(); $stop_publish = $row->getUnixEndDate(); $start_date = JEventsHTML::getDateFormat($row->yup(), $row->mup(), $row->dup(), 0); $start_time = JEVHelper::getTime($row->getUnixStartTime(), $row->hup(), $row->minup()); $stop_date = JEventsHTML::getDateFormat($row->ydn(), $row->mdn(), $row->ddn(), 0); $stop_time = JEVHelper::getTime($row->getUnixEndTime(), $row->hdn(), $row->mindn()); if ($stop_publish == $start_publish) { if ($row->noendtime()) { $times = $start_time; } else { if ($row->alldayevent()) { $times = ""; } else { if ($start_time != $stop_time) { $times = $start_time . ' - ' . $stop_time; } else { $times = $start_time; } } } $times = $start_date . " " . $times . "<br/>"; } else { if ($row->noendtime()) { $times = $start_time; } else { if ($start_time != $stop_time && !$row->alldayevent()) { $times = $start_time . ' - ' . $stop_time; } } $times = $start_date . ' - ' . $stop_date . " " . $times . "<br/>"; } } else { if (($jevtask == "day" || $jevtask == "week") && $row->starttime() != $row->endtime() && !$row->alldayevent()) { $starttime = JEVHelper::getTime($row->getUnixStartTime(), $row->hup(), $row->minup()); $endtime = JEVHelper::getTime($row->getUnixEndTime(), $row->hdn(), $row->mindn()); if ($row->noendtime()) { if ($showyeardate && $jevtask == "year") { $times = $starttime . ' - ' . $endtime . ' '; } else { $times = $starttime . ' '; } } else { $times = $starttime . ' - ' . $endtime . ' '; } } } echo $times; ?> <a class="ev_link_row" href="<?php echo $rowlink; ?> " <?php echo $args; ?> style="color:<?php echo $fgcolor; ?> ;" title="<?php echo JEventsHTML::special($row->title()); ?> "><?php echo $tmpTitle; ?> </a> <?php if ($cfg->get('com_byview') == '1') { echo JText::_('JEV_BY') . ' <i>' . $row->contactlink() . '</i>'; } ?> <?php }
function DefaultRepeatSummary($view, $event) { $sum = ""; if (!isset($event->start_date)) { $event_up = new JEventDate($event->publish_up()); // NB If you set language file date/time formatting then you can use a specific format string here (using strftime formats) e.g. // $event->start_date = JEventsHTML::getDateFormat($event_up->year, $event_up->month, $event_up->day, "%Y-%m-%d"); $event->start_date = JEventsHTML::getDateFormat($event_up->year, $event_up->month, $event_up->day, 0); $event->start_time = JEVHelper::getTime($event->getUnixStartTime()); $event_down = new JEventDate($event->publish_down()); $event->stop_date = JEventsHTML::getDateFormat($event_down->year, $event_down->month, $event_down->day, 0); $event->stop_time = JEVHelper::getTime($event->getUnixEndTime()); $event->stop_time_midnightFix = $event->stop_time; $event->stop_date_midnightFix = $event->stop_date; if ($event_down->second == 59) { $event->stop_time_midnightFix = JEVHelper::getTime($event->getUnixEndTime() + 1); $event->stop_date_midnightFix = JEventsHTML::getDateFormat($event_down->year, $event_down->month, $event_down->day + 1, 0); } } if ($event->alldayevent()) { if ($event->start_date == $event->stop_date) { $sum .= $event->start_date; } else { $sum .= JText::_('JEV_FROM') . ' ' . $event->start_date . '<br />' . JText::_('JEV_TO') . ' ' . $event->stop_date . '<br/>'; } } else { if ($event->start_date == $event->stop_date) { if ($event->noendtime()) { $sum .= $event->start_date . ', ' . $event->start_time . '<br/>'; } else { if ($event->start_time != $event->stop_time && !$event->alldayevent()) { $sum .= $event->start_date . ', ' . $event->start_time . ' - ' . $event->stop_time_midnightFix . '<br/>'; } else { if ($event->start_time == $event->stop_time && !$event->alldayevent()) { $sum .= $event->start_date . ', ' . $event->start_time . '<br/>'; } else { $sum .= $event->start_date . '<br/>'; } } } } else { // recurring events should have time related to recurrance not range of dates if ($event->noendtime() && !($event->reccurtype() > 0)) { $sum .= $event->start_date . ', ' . $event->start_time . '<br/>' . JText::_('JEV_TO') . ' ' . $event->stop_date . '<br/>'; } else { if ($event->start_time != $event->stop_time && !($event->reccurtype() > 0)) { $sum .= JText::_('JEV_FROM') . ' ' . $event->start_date . ' - ' . $event->start_time . '<br />' . JText::_('JEV_TO') . ' ' . $event->stop_date . ' - ' . $event->stop_time_midnightFix . '<br/>'; } else { $sum .= JText::_('JEV_FROM') . ' ' . $event->start_date . '<br />' . JText::_('JEV_TO') . ' ' . $event->stop_date . '<br/>'; } } } } if ($event->_freq == "none") { return $sum; } if ($event->_eventdetail_id != $event->_detail_id) { $sum .= "<div class='ev_repeatexception'>" . JText::_('JEV_REPEATEXCEPTION') . "</div>"; } return $sum; }
</div> </div> <div id='jev_maincal' class='jev_listview'> <?php $hasevents = false; for ($d = 0; $d < 7; $d++) { $num_events = count($data['days'][$d]['rows']); if ($num_events == 0) { continue; } echo '<a class="ev_link_weekday" href="' . $data['days'][$d]['link'] . '" title="' . JText::_('JEV_CLICK_TOSWITCH_DAY') . '">' . "\n"; ?> <div class="jev_daysnames"> <?php echo JEventsHTML::getDateFormat($data['days'][$d]['week_year'], $data['days'][$d]['week_month'], $data['days'][$d]['week_day'], 2); ?> </div> </a> <div class="jev_listrow"> <?php if ($num_events > 0) { $hasevents = true; echo "<ul class='ev_ul'>\n"; for ($r = 0; $r < $num_events; $r++) { $row = $data['days'][$d]['rows'][$r]; $listyle = 'style="border-color:' . $row->bgcolor() . ';"'; echo "<li class='ev_td_li' {$listyle}>\n"; $this->loadedFromTemplate('icalevent.list_row', $row, 0); echo "</li>\n"; }
<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); } echo "</li>"; ?>
<!-- BEGIN previous_month_link_row --> <?php if ($precedingDay) { echo "<a href='" . $precedingDay . "' title='" . JText::_("PRECEEDING_Day") . "' >"; ?> <?php echo JText::_("PRECEEDING_Day") . "</a>"; } ?> <!-- END previous_month_link_row --> </td> <td class="currentmonth" style="background-color: rgb(208, 230, 246);" align="center" height="22" nowrap="nowrap" valign="middle"> <?php echo JEventsHTML::getDateFormat($this->year, $this->month, $this->day, 0); ?> </td> <td class="nextmonth" align="center" height="22" nowrap="nowrap" valign="middle" width="33%"> <?php if ($followingDay) { echo "<a href='" . $followingDay . "' title='" . JText::_("FOLLOWING_Day") . "' >"; ?> <?php echo JText::_("FOLLOWING_Day") . "</a>"; ?> <?php echo "</a>"; } ?>
function repeatSummary() { $sum = ""; $cfg =& JEVConfig::getInstance(); // i.e. 1 = follow english word order by default $grammar = intval(JText::_('JEV_REPEAT_GRAMMAR')); if (!isset($this->start_date)) { $event_up = new JEventDate($this->publish_up()); $this->start_date = JEventsHTML::getDateFormat($event_up->year, $event_up->month, $event_up->day, 0); $this->start_time = JEVHelper::getTime($this->getUnixStartTime()); $event_down = new JEventDate($this->publish_down()); $this->stop_date = JEventsHTML::getDateFormat($event_down->year, $event_down->month, $event_down->day, 0); $this->stop_time = JEVHelper::getTime($this->getUnixEndTime()); $this->stop_time_midnightFix = $this->stop_time; $this->stop_date_midnightFix = $this->stop_date; if ($event_down->second == 59) { $this->stop_time_midnightFix = JEVHelper::getTime($this->getUnixEndTime() + 1); $this->stop_date_midnightFix = JEventsHTML::getDateFormat($event_down->year, $event_down->month, $event_down->day + 1, 0); } } if ($this->alldayevent()) { if ($this->start_date == $this->stop_date) { $sum .= $this->start_date; } else { $sum .= JText::_('JEV_FROM') . ' ' . $this->start_date . '<br />' . JText::_('JEV_TO') . ' ' . $this->stop_date . '<br/>'; } } else { if ($this->start_date == $this->stop_date) { if ($this->noendtime()) { $sum .= $this->start_date . ', ' . $this->start_time . '<br/>'; } else { if ($this->start_time != $this->stop_time && !$this->alldayevent()) { $sum .= $this->start_date . ', ' . $this->start_time . ' - ' . $this->stop_time_midnightFix . '<br/>'; } else { if ($this->start_time == $this->stop_time && !$this->alldayevent()) { $sum .= $this->start_date . ', ' . $this->start_time . '<br/>'; } else { $sum .= $this->start_date . '<br/>'; } } } } else { // recurring events should have time related to recurrance not range of dates if ($this->noendtime() && !($this->reccurtype() > 0)) { $sum .= $this->start_date . ', ' . $this->start_time . '<br/>' . JText::_('JEV_TO') . ' ' . $this->stop_date . '<br/>'; } else { if ($this->start_time != $this->stop_time && !($this->reccurtype() > 0)) { $sum .= JText::_('JEV_FROM') . ' ' . $this->start_date . ' - ' . $this->start_time . '<br />' . JText::_('JEV_TO') . ' ' . $this->stop_date . ' - ' . $this->stop_time_midnightFix . '<br/>'; } else { $sum .= JText::_('JEV_FROM') . ' ' . $this->start_date . '<br />' . JText::_('JEV_TO') . ' ' . $this->stop_date . '<br/>'; } } } } if ($this->_freq == "none") { return $sum; } return $sum; // TODO consider finishing this later - it is VERY COMPLICATED if ($this->_interval > 0) { if ($this->_interval == 1) { switch ($this->_freq) { case 'DAILY': $reccur = JText::_('JEV_ALLDAYS'); break; case 'WEEKLY': $reccur = JText::_('JEV_EACHWEEK'); break; case 'MONTHLY': $reccur = JText::_('JEV_EACHMONTH'); break; case 'YEARLY': $reccur = JText::_('JEV_EACHYEAR'); break; } } else { switch ($this->_freq) { case 'DAILY': $reccur = JText::_('JEV_EVERY_N_DAYS'); break; case 'WEEKLY': $reccur = JText::_('JEV_EVERY_N_WEEKS'); break; case 'MONTHLY': $reccur = JText::_('JEV_EVERY_N_MONTHS'); break; case 'YEARLY': $reccur = JText::_('JEV_EVERY_N_YEARS'); break; } $reccur = sprintf($reccur, $this->_interval); } if ($this->_count == 99999) { list($y, $m, $d) = explode(":", JevDate::strftime("%Y:%m:%d", $this->until())); $extra = JText::_('JEV_UNTIL') . " " . JEventsHTML::getDateFormat($y, $m, $d, 1); } else { $extra = sprintf(JText::_('JEV_COUNTREPEATS'), $this->_count); } $sum .= $reccur . " " . $extra; } return $sum; }