function _adminStart() { $dispatcher = JEventDispatcher::getInstance(); list($this->year, $this->month, $this->day) = JEVHelper::getYMD(); $this->Itemid = JEVHelper::getItemid(); $this->datamodel = new JEventsDataModel(); $dispatcher->trigger('onJEventsHeader', array($this)); ?> <div style="clear:both" <?php $mainframe = JFactory::getApplication(); $params = JComponentHelper::getParams(JEV_COM_COMPONENT); echo !JFactory::getApplication()->isAdmin() && $params->get("darktemplate", 0) ? "class='jeventsdark'" : "class='jeventslight'"; ?> > <div id="toolbar-box" > <?php $bar = JToolBar::getInstance('toolbar'); $barhtml = $bar->render(); //$barhtml = str_replace('href="#"','href="javascript void();"',$barhtml); //$barhtml = str_replace('submitbutton','return submitbutton',$barhtml); echo $barhtml; if (JevJoomlaVersion::isCompatible("3.0")) { // JFactory::getApplication()->JComponentTitle; $title = ""; } else { $title = JFactory::getApplication()->get('JComponentTitle'); } echo $title; ?> </div> <?php $dispatcher = JEventDispatcher::getInstance(); $dispatcher->trigger('onJEventsFooter', array($this)); }
function listevents() { list($year, $month, $day) = JEVHelper::getYMD(); $Itemid = JEVHelper::getItemid(); // get the view $document =& JFactory::getDocument(); $viewType = $document->getType(); $cfg =& JEVConfig::getInstance(); $theme = JEV_CommonFunctions::getJEventsViewName(); $view = "day"; $this->addViewPath($this->_basePath . DS . "views" . DS . $theme); $this->view =& $this->getView($view, $viewType, $theme, array('base_path' => $this->_basePath, "template_path" => $this->_basePath . DS . "views" . DS . $theme . DS . $view . DS . 'tmpl', "name" => $theme . DS . $view)); // Set the layout $this->view->setLayout('listevents'); $this->view->assign("Itemid", $Itemid); $this->view->assign("month", $month); $this->view->assign("day", $day); $this->view->assign("year", $year); $this->view->assign("task", $this->_task); // View caching logic -- simple... are we logged in? $cfg =& JEVConfig::getInstance(); $useCache = intval($cfg->get('com_cache', 0)); $user =& JFactory::getUser(); if ($user->get('id') || !$useCache) { $this->view->display(); } else { $cache =& JFactory::getCache(JEV_COM_COMPONENT, 'view'); $cache->get($this->view, 'display'); } }
function ajax() { $modid = intval(JRequest::getVar('modid', 0)); if ($modid <= 0) { echo "<script>alert('bad mod id');</script>"; return; } // load language constants JEVHelper::loadLanguage('modcal'); list($year, $month, $day) = JEVHelper::getYMD(); $user = JFactory::getUser(); $query = "SELECT id, params" . "\n FROM #__modules AS m" . "\n WHERE m.published = 1" . "\n AND m.id = " . $modid . "\n AND m.access " . (version_compare(JVERSION, '1.6.0', '>=') ? ' IN (' . JEVHelper::getAid($user, 'string') . ')' : ' <= ' . JEVHelper::getAid($user)) . "\n AND m.client_id != 1"; $db =& JFactory::getDBO(); $db->setQuery($query); $modules = $db->loadObjectList(); if (count($modules) <= 0) { if (!$modid <= 0) { echo "<script>alert('bad mod id');</script>"; return; } } $params = new JParameter($modules[0]->params); $cfg =& JEVConfig::getInstance(); $theme = JEV_CommonFunctions::getJEventsViewName(); $theme = $params->get("com_calViewName", $theme); $modtheme = $params->get("com_calViewName", $theme); if ($modtheme == "") { $modtheme = $theme; } $theme = $modtheme; //require(JModuleHelper::getLayoutPath('mod_jevents_cal',$theme.DS."calendar")); require_once JPATH_SITE . '/modules/mod_jevents_cal/helper.php'; $jevhelper = new modJeventsCalHelper(); $viewclass = $jevhelper->getViewClass($theme, 'mod_jevents_cal', $theme . DS . "calendar", $params); $modview = new $viewclass($params, $modid); ?> <script type="text/javascript"> var doitdone = false; function doit(){ if (doitdone) return; doitdone = true; var sillydiv=document.getElementById('silly'); parent.navLoaded(sillydiv,<?php echo $modid; ?> ); } window.onload=doit; </script> <?php echo "<div id='silly'>"; echo $modview->getAjaxCal($modid, $month, $year); echo "</div>"; ?> <script type="text/javascript"> doit(); </script> <?php }
function detail() { // Do we have to be logged in to see this event $user = JFactory::getUser(); if (JRequest::getInt("login", 0) && $user->id == 0) { $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); $this->setRedirect($link, JText::_('JEV_LOGIN_TO_VIEW_EVENT')); return; } $evid = JRequest::getInt("rp_id", 0); if ($evid == 0) { $evid = JRequest::getInt("evid", 0); // In this case I do not have a repeat id so I } // if cancelling from save of copy and edit use the old event id if ($evid == 0) { $evid = JRequest::getInt("old_evid", 0); } $pop = intval(JRequest::getVar('pop', 0)); list($year, $month, $day) = JEVHelper::getYMD(); $Itemid = JEVHelper::getItemid(); $uid = urldecode(JRequest::getVar('uid', "")); $document =& JFactory::getDocument(); $viewType = $document->getType(); $cfg =& JEVConfig::getInstance(); $theme = JEV_CommonFunctions::getJEventsViewName(); $view = "icalevent"; $this->addViewPath($this->_basePath . DS . "views" . DS . $theme); $this->view =& $this->getView($view, $viewType, $theme . "View", array('base_path' => $this->_basePath, "template_path" => $this->_basePath . DS . "views" . DS . $theme . DS . $view . DS . 'tmpl', "name" => $theme . DS . $view)); // Set the layout $this->view->setLayout("detail"); $this->view->assign("Itemid", $Itemid); $this->view->assign("month", $month); $this->view->assign("day", $day); $this->view->assign("year", $year); $this->view->assign("task", $this->_task); $this->view->assign("pop", $pop); $this->view->assign("evid", $evid); $this->view->assign("jevtype", "icaldb"); $this->view->assign("uid", $uid); // View caching logic -- simple... are we logged in? $cfg =& JEVConfig::getInstance(); $useCache = intval($cfg->get('com_cache', 0)); if ($user->get('id') || !$useCache) { $this->view->display(); } else { $cache =& JFactory::getCache(JEV_COM_COMPONENT, 'view'); $cache->get($this->view, 'display'); } }
function results() { list($year, $month, $day) = JEVHelper::getYMD(); $Itemid = JEVHelper::getItemid(); $db = JFactory::getDBO(); $keyword = JRequest::getString('keyword', ''); // limit searchword to a maximum of characters $upper_limit = 20; if (strlen($keyword) > $upper_limit) { $keyword = substr($keyword, 0, $upper_limit - 1); } // Joomla unhelpfully switched limitstart to start when sef is enabled! includes/router.php line 390 $limitstart = intval(JRequest::getVar('start', JRequest::getVar('limitstart', 0))); $params = JComponentHelper::getParams(JEV_COM_COMPONENT); $limit = intval(JFactory::getApplication()->getUserStateFromRequest('jevlistlimit', 'limit', $params->get("com_calEventListRowsPpg", 15))); $document = JFactory::getDocument(); $viewType = $document->getType(); $cfg = JEVConfig::getInstance(); $theme = JEV_CommonFunctions::getJEventsViewName(); $view = "search"; $this->addViewPath($this->_basePath . '/' . "views" . '/' . $theme); $this->view = $this->getView($view, $viewType, $theme . "View", array('base_path' => $this->_basePath, "template_path" => $this->_basePath . '/' . "views" . '/' . $theme . '/' . $view . '/' . 'tmpl', "name" => $theme . '/' . $view)); // Set the layout $this->view->setLayout('results'); $this->view->assign("Itemid", $Itemid); $this->view->assign("month", $month); $this->view->assign("day", $day); $this->view->assign("year", $year); $this->view->assign("task", $this->_task); $this->view->assign("keyword", $keyword); $this->view->assign("limit", $limit); $this->view->assign("limitstart", $limitstart); // View caching logic -- simple... are we logged in? $cfg = JEVConfig::getInstance(); $joomlaconf = JFactory::getConfig(); $useCache = intval($cfg->get('com_cache', 0)) && $joomlaconf->get('caching', 1); $user = JFactory::getUser(); if ($user->get('id') || !$useCache) { $this->view->display(); } else { $cache = JFactory::getCache(JEV_COM_COMPONENT, 'view'); $uri = JURI::getInstance(); $url = $uri->toString(); $cache->get($this->view, 'display', base64_encode($keyword . $Itemid . $limit . $limitstart . $month . $day . $year . $url)); } }
function listevents() { $is_event_editor = JEVHelper::isEventCreator(); $Itemid = JEVHelper::getItemid(); $user = JFactory::getUser(); if (!$is_event_editor) { $returnlink = JRoute::_('index.php?option=' . JEV_COM_COMPONENT . '&task=month.calendar&Itemid=' . $Itemid, false); $this->setRedirect($returnlink, html_entity_decode(JText::_('JEV_NOPERMISSION'))); $this->redirect(); return; } list($year, $month, $day) = JEVHelper::getYMD(); // Joomla unhelpfully switched limitstart to start when sef is enabled! includes/router.php line 390 $limitstart = intval(JRequest::getVar('start', JRequest::getVar('limitstart', 0))); $params = JComponentHelper::getParams(JEV_COM_COMPONENT); $limit = intval(JFactory::getApplication()->getUserStateFromRequest('jevlistlimit', 'limit', $params->get("com_calEventListRowsPpg", 15))); $Itemid = JEVHelper::getItemid(); $task = $this->_task; $params = JComponentHelper::getParams(JEV_COM_COMPONENT); $adminuser = $params->get("jevadmin", -1); if (JEVHelper::isAdminUser($user) || $user->id == $adminuser) { $creator_id = 'ADMIN'; } else { $creator_id = $user->id; } // get the view $document = JFactory::getDocument(); $viewType = $document->getType(); $cfg = JEVConfig::getInstance(); $theme = JEV_CommonFunctions::getJEventsViewName(); $view = "admin"; $this->addViewPath($this->_basePath . '/' . "views" . '/' . $theme); $this->view = $this->getView($view, $viewType, $theme . "View", array('base_path' => $this->_basePath, "template_path" => $this->_basePath . '/' . "views" . '/' . $theme . '/' . $view . '/' . 'tmpl', "name" => $theme . '/' . $view)); // Set the layout $this->view->setLayout('listevents'); $this->view->assign("Itemid", $Itemid); $this->view->assign("limitstart", $limitstart); $this->view->assign("limit", $limit); $this->view->assign("month", $month); $this->view->assign("day", $day); $this->view->assign("year", $year); $this->view->assign("task", $task); $this->view->assign("creator_id", $creator_id); $this->view->display(); }
function _createfilterHTML() { // setup for all required function and classes $file = JPATH_SITE . '/components/com_jevents/mod.defines.php'; if (file_exists($file)) { include_once $file; } $reg = JevRegistry::getInstance("jevents"); $this->datamodel = $reg->getReference("jevents.datamodel", false); if (!$this->datamodel) { $this->datamodel = new JEventsDataModel(); $this->datamodel->setupComponentCatids(); } $filterList = array(); $filterList["title"] = JText::_("JEV_SELECT_MATCHING_EVENT"); $options = array(); // only if other filters are active to we offer a choice if (JRequest::getInt("eventlist") == 1) { $options[] = JHTML::_('select.option', "0", JText::_("JEV_SELECT_MATCHING_EVENT"), "value", "text"); list($year, $month, $day) = JEVHelper::getYMD(); $tenyear = $year + 10; // next 100 matching events $events = $this->datamodel->queryModel->listIcalEventsByRange("{$year}-{$month}-{$day}", "{$tenyear}-{$month}-{$day}", 0, 100, false, "rpt.startrepeat asc, rpt.endrepeat ASC, det.summary ASC"); if ($events && count($events) > 0) { $Itemid = $this->datamodel->myItemid; foreach ($events as $event) { $link = $event->viewDetailLink($event->yup(), $event->mup(), $event->dup(), true, $Itemid); $options[] = JHTML::_('select.option', $link, $event->title(), "value", "text"); } } } else { $options[] = JHTML::_('select.option', "0", JText::_("JEV_NO_MATCHING_EVENTS"), "value", "text"); } $filterList["html"] = JHTML::_('select.genericlist', $options, 'eventlist_fv', 'class="inputbox" size="1" onchange="document.location.replace(this.value);"', 'value', 'text', 0); $filterList["html"] .= "<input type='hidden' name='eventlist' id='eventlistid' value='1' />"; $script = "function resetEventlist(){document.getElementById('eventlistid').value=0;}\n"; $script .= "try {JeventsFilters.filters.push({action:'resetEventlist()',id:'eventlist_fv',value:0});} catch (e) {}\n"; $document = JFactory::getDocument(); $document->addScriptDeclaration($script); return $filterList; }
function listevents() { list($year, $month, $day) = JEVHelper::getYMD(); // Joomla unhelpfully switched limitstart to start when sef is enabled! includes/router.php line 390 $limitstart = intval(JRequest::getVar('start', JRequest::getVar('limitstart', 0))); $params = JComponentHelper::getParams(JEV_COM_COMPONENT); $limit = intval(JFactory::getApplication()->getUserStateFromRequest('jevlistlimit', 'limit', $params->get("com_calEventListRowsPpg", 15))); // $catid = intval( JRequest::getVar( 'catid', 0 ) ); $catids = JRequest::getVar('catids', ""); $catids = explode("|", $catids); $Itemid = JEVHelper::getItemid(); // get the view $document = JFactory::getDocument(); $viewType = $document->getType(); $cfg = JEVConfig::getInstance(); $theme = JEV_CommonFunctions::getJEventsViewName(); $view = "cat"; $this->addViewPath($this->_basePath . '/' . "views" . '/' . $theme); $this->view = $this->getView($view, $viewType, $theme . "View", array('base_path' => $this->_basePath, "template_path" => $this->_basePath . '/' . "views" . '/' . $theme . '/' . $view . '/' . 'tmpl', "name" => $theme . '/' . $view)); // Set the layout $this->view->setLayout('listevents'); $this->view->assign("Itemid", $Itemid); $this->view->assign("limitstart", $limitstart); $this->view->assign("limit", $limit); $this->view->assign("catids", $catids); $this->view->assign("month", $month); $this->view->assign("day", $day); $this->view->assign("year", $year); $this->view->assign("task", $this->_task); // View caching logic -- simple... are we logged in? $cfg = JEVConfig::getInstance(); $joomlaconf = JFactory::getConfig(); $useCache = intval($cfg->get('com_cache', 0)) && $joomlaconf->get('caching', 1); $user = JFactory::getUser(); if ($user->get('id') || !$useCache) { $this->view->display(); } else { $cache = JFactory::getCache(JEV_COM_COMPONENT, 'view'); $cache->get($this->view, 'display'); } }
function eventdata() { $this->datamodel = new JEventsDataModel(); list($year, $month, $day) = JEVHelper::getYMD(); $start = JRequest::getVar('start', "{$year}-{$month}-{$day}"); $end = JRequest::getVar('end', "{$year}-{$month}-{$day}"); $limitstart = 0; $limit = 0; $myItemid = JEVHelper::getItemid(); // Force repeats to show $cfg = JEVConfig::getInstance(); $cfg->set("com_showrepeats", true); // TODO Check for sanity of $start and $end $this->datamodel = new JEventsDataModel(); $data = $this->datamodel->getRangeData($start, $end, $limitstart, $limit); $events = array(); foreach ($data['rows'] as $event) { $eventArray = array(); $eventArray['title'] = $event->title(); $eventArray['start'] = $event->yup() . "-" . $event->mup() . "-" . $event->dup() . " " . date("H:i", $event->getUnixStartTime()); $eventArray['end'] = $event->yup() . "-" . $event->mup() . "-" . $event->dup() . " " . date("H:i", $event->getUnixStartTime()); $eventArray['textcolor'] = $event->fgcolor(); $eventArray['backgroundColor'] = $event->bgcolor(); $link = $event->viewDetailLink($event->yup(), $event->mup(), $event->dup(), false, $myItemid); $eventArray['url'] = JRoute::_($link . $this->datamodel->getCatidsOutLink()); if ($event->hasrepetition()) { $eventArray['id'] = $event->ev_id(); } $events[] = $eventArray; } // Get the document object. $document =& JFactory::getDocument(); // Set the MIME type for JSON output. $document->setMimeEncoding('application/json'); // Change the suggested filename. JResponse::setHeader('Content-Disposition', 'attachment;filename="eventdata.json"'); // Output the JSON data. echo json_encode($events); exit; }
function listevents() { JRequest::setVar("tmpl", "component"); list($year, $month, $day) = JEVHelper::getYMD(); // Joomla unhelpfully switched limitstart to start when sef is enabled! includes/router.php line 390 $limitstart = intval(JRequest::getVar('start', JRequest::getVar('limitstart', 0))); $params = JComponentHelper::getParams(JEV_COM_COMPONENT); $limit = $params->get("com_calEventListRowsPpg", 15); // Crawler should list at least 100 events for efficiency $limit = intval($limit) < 100 ? 100 : $limit; $Itemid = JEVHelper::getItemid(); // get the view $document = JFactory::getDocument(); $viewType = $document->getType(); $cfg = JEVConfig::getInstance(); $theme = "default"; $view = "crawler"; $this->addViewPath($this->_basePath . '/' . "views" . '/' . $theme); $this->view = $this->getView($view, $viewType, $theme . "View", array('base_path' => $this->_basePath, "template_path" => $this->_basePath . '/' . "views" . '/' . $theme . '/' . $view . '/' . 'tmpl', "name" => $theme . '/' . $view)); // Set the layout $this->view->setLayout('listevents'); $this->view->assign("Itemid", $Itemid); $this->view->assign("limitstart", $limitstart); $this->view->assign("limit", $limit); $this->view->assign("month", $month); $this->view->assign("day", $day); $this->view->assign("year", $year); $this->view->assign("task", $this->_task); // View caching logic -- simple... are we logged in? $cfg = JEVConfig::getInstance(); $joomlaconf = JFactory::getConfig(); $useCache = intval($cfg->get('com_cache', 0)) && $joomlaconf->get('caching', 1); $user = JFactory::getUser(); if ($user->get('id') || !$useCache) { $this->view->display(); } else { $cache = JFactory::getCache(JEV_COM_COMPONENT, 'view'); $cache->get($this->view, 'display'); } }
function listevents() { $params = JComponentHelper::getParams(JEV_COM_COMPONENT); $fixedDay = $params->get('fixedday', ''); if ($fixedDay) { $year = date('Y', strtotime($fixedDay)); $month = date('m', strtotime($fixedDay)); $day = date('d', strtotime($fixedDay)); } else { list($year, $month, $day) = JEVHelper::getYMD(); } $Itemid = JEVHelper::getItemid(); // get the view $document = JFactory::getDocument(); $viewType = $document->getType(); $cfg = JEVConfig::getInstance(); $theme = JEV_CommonFunctions::getJEventsViewName(); $view = "day"; $this->addViewPath($this->_basePath . '/' . "views" . '/' . $theme); $this->view = $this->getView($view, $viewType, $theme . "View", array('base_path' => $this->_basePath, "template_path" => $this->_basePath . '/' . "views" . '/' . $theme . '/' . $view . '/' . 'tmpl', "name" => $theme . '/' . $view)); // Set the layout $this->view->setLayout('listevents'); $this->view->assign("Itemid", $Itemid); $this->view->assign("month", $month); $this->view->assign("day", $day); $this->view->assign("year", $year); $this->view->assign("task", $this->_task); // View caching logic -- simple... are we logged in? $cfg = JEVConfig::getInstance(); $joomlaconf = JFactory::getConfig(); $useCache = intval($cfg->get('com_cache', 0)) && $joomlaconf->get('caching', 1); $user = JFactory::getUser(); if ($user->get('id') || !$useCache) { $this->view->display(); } else { $cache = JFactory::getCache(JEV_COM_COMPONENT, 'view'); $cache->get($this->view, 'display'); } }
function detail() { $evid = JRequest::getInt("evid", 0); $pop = intval(JRequest::getVar('pop', 0)); list($year, $month, $day) = JEVHelper::getYMD(); $Itemid = JEVHelper::getItemid(); // get the view $document = JFactory::getDocument(); $viewType = $document->getType(); $cfg = JEVConfig::getInstance(); $theme = JEV_CommonFunctions::getJEventsViewName(); $view = "jevent"; $this->addViewPath($this->_basePath . '/' . "views" . '/' . $theme); $this->view = $this->getView($view, $viewType, $theme . "View", array('base_path' => $this->_basePath, "template_path" => $this->_basePath . '/' . "views" . '/' . $theme . '/' . $view . '/' . 'tmpl', "name" => $theme . '/' . $view)); // Set the layout $this->view->setLayout("detail"); $this->view->assign("Itemid", $Itemid); $this->view->assign("month", $month); $this->view->assign("day", $day); $this->view->assign("year", $year); $this->view->assign("task", $this->_task); $this->view->assign("pop", $pop); $this->view->assign("evid", $evid); $this->view->assign("jevtype", "jevent"); // View caching logic -- simple... are we logged in? $cfg = JEVConfig::getInstance(); $joomlaconf = JFactory::getConfig(); $useCache = intval($cfg->get('com_cache', 0)) && $joomlaconf->get('caching', 1); $user = JFactory::getUser(); if ($user->get('id') || !$useCache) { $this->view->display(); } else { $cache = JFactory::getCache(JEV_COM_COMPONENT, 'view'); $cache->get($this->view, 'display'); } }
function _adminStart() { $dispatcher =& JDispatcher::getInstance(); list($this->year, $this->month, $this->day) = JEVHelper::getYMD(); $this->Itemid = JEVHelper::getItemid(); $this->datamodel = new JEventsDataModel(); $dispatcher->trigger('onJEventsHeader', array($this)); ?> <div style="clear:both"> <div id="toolbar-box" > <?php $bar =& JToolBar::getInstance('toolbar'); $barhtml = $bar->render(); //$barhtml = str_replace('href="#"','href="javascript void();"',$barhtml); //$barhtml = str_replace('submitbutton','return submitbutton',$barhtml); echo $barhtml; $title = JFactory::getApplication()->get('JComponentTitle'); echo $title; ?> </div> <?php $dispatcher =& JDispatcher::getInstance(); $dispatcher->trigger('onJEventsFooter', array($this)); }
function notifyAuthorPublished($event) { JLoader::register('JEventsCategory', JEV_ADMINPATH . "/libraries/categoryClass.php"); $db = JFactory::getDBO(); $cat = new JEventsCategory($db); $cat->load($event->catid()); $adminuser = $cat->getAdminUser(); $adminEmail = $adminuser->email; $adminName = $adminuser->name; $config = new JConfig(); $sitename = $config->sitename; $subject = JText::sprintf('JEV_NOTIFY_AUTHOR_SUBJECT', $sitename); $Itemid = JEVHelper::getItemid(); // reload the event to get the reptition ids $evid = intval($event->ev_id()); $dataModel = new JEventsDataModel("JEventsAdminDBModel"); $queryModel = new JEventsDBModel($dataModel); $testevent = $queryModel->getEventById($evid, 1, "icaldb"); // attach anonymous creator etc. JPluginHelper::importPlugin('jevents'); $dispatcher =& JDispatcher::getInstance(); $dispatcher->trigger('onDisplayCustomFields', array(&$event)); $rp_id = $testevent->rp_id(); list($year, $month, $day) = JEVHelper::getYMD(); $uri =& JURI::getInstance(JURI::base()); if (JFactory::getApplication()->isAdmin()) { $root = $uri->toString(array('scheme', 'host', 'port', 'path')); $root = str_replace("/administrator", "", $root); $detaillink = '<a href="' . $root . 'index.php?option=' . JEV_COM_COMPONENT . '&task=icalrepeat.detail&rp_id=' . $evid . '&rp_id=' . $rp_id . '&Itemid=' . $Itemid . "&year={$year}&month={$month}&day={$day}" . '">' . $event->title() . '</a>' . "\n"; } else { $root = $uri->toString(array('scheme', 'host', 'port')); $detaillink = '<a href="' . $root . JRoute::_('index.php?option=' . JEV_COM_COMPONENT . '&task=icalrepeat.detail&rp_id=' . $evid . '&rp_id=' . $rp_id . '&Itemid=' . $Itemid . "&year={$year}&month={$month}&day={$day}") . '">' . $event->title() . '</a>' . "\n"; } $content = sprintf(JText::_('JEV_NOTIFY_AUTHOR_Message'), $detaillink, $sitename); $authorname = ""; $authoremail = ""; if ($event->created_by() > 0) { $author = JFactory::getUser($event->created_by()); if (!$author) { return; } $authorname = $author->name; $authoremail = $author->email; } else { if (isset($event->authoremail) && $event->authoremail != "") { $authorname = $event->authorname; $authoremail = $event->authoremail; } } if ($authoremail == "") { return; } // mail function $mail =& JFactory::getMailer(); $mail->setSender(array(0 => $adminEmail, 1 => $adminName)); $mail->addRecipient($authoremail); $mail->setSubject($subject); $mail->setBody($content); $mail->IsHTML(true); $mail->send(); }
function delete() { // clean out the cache $cache =& JFactory::getCache('com_jevents'); $cache->clean(JEV_COM_COMPONENT); /* // This is covered by canDeleteEvent below if (!JEVHelper::isEventDeletor()){ JError::raiseError( 403, JText::_( 'ALERTNOTAUTH' ) ); } */ $cid = JRequest::getVar('cid', array(0)); JArrayHelper::toInteger($cid); // front end passes the id as evid if (count($cid) == 1 && $cid[0] == 0) { $cid = array(JRequest::getInt("evid", 0)); } $db =& JFactory::getDBO(); foreach ($cid as $key => $id) { // I should be able to do this in one operation but that can come later $event = $this->queryModel->getEventById(intval($id), 1, "icaldb"); if (is_null($event) || !JEVHelper::canDeleteEvent($event)) { JError::raiseWarning(534, JText::_("JEV_NO_DELETE_ROW")); unset($cid[$key]); } } if (count($cid) > 0) { $veventidstring = implode(",", $cid); // TODO the ruccurences should take care of all of these?? // This would fail if all recurrances have been 'adjusted' $query = "SELECT DISTINCT (eventdetail_id) FROM #__jevents_repetition WHERE eventid IN ({$veventidstring})"; $db->setQuery($query); $detailids = $db->loadResultArray(); $detailidstring = implode(",", $detailids); $query = "DELETE FROM #__jevents_rrule WHERE eventid IN ({$veventidstring})"; $db->setQuery($query); $db->query(); $query = "DELETE FROM #__jevents_repetition WHERE eventid IN ({$veventidstring})"; $db->setQuery($query); $db->query(); $query = "DELETE FROM #__jevents_exception WHERE eventid IN ({$veventidstring})"; $db->setQuery($query); $db->query(); if (strlen($detailidstring) > 0) { $query = "DELETE FROM #__jevents_vevdetail WHERE evdet_id IN ({$detailidstring})"; $db->setQuery($query); $db->query(); // I also need to clean out associated custom data $dispatcher =& JDispatcher::getInstance(); // just incase we don't have jevents plugins registered yet JPluginHelper::importPlugin("jevents"); $res = $dispatcher->trigger('onDeleteEventDetails', array($detailidstring)); } $query = "DELETE FROM #__jevents_vevent WHERE ev_id IN ({$veventidstring})"; $db->setQuery($query); $db->query(); // I also need to delete custom data $dispatcher =& JDispatcher::getInstance(); // just incase we don't have jevents plugins registered yet JPluginHelper::importPlugin("jevents"); $res = $dispatcher->trigger('onDeleteCustomEvent', array(&$veventidstring)); } if (JFactory::getApplication()->isAdmin()) { $this->setRedirect("index.php?option=" . JEV_COM_COMPONENT . "&task=icalevent.list", "ICal Event(s) deleted"); } else { $Itemid = JRequest::getInt("Itemid"); list($year, $month, $day) = JEVHelper::getYMD(); $rettask = JRequest::getString("rettask", "day.listevents"); $this->setRedirect(JRoute::_('index.php?option=' . JEV_COM_COMPONENT . "&task={$rettask}&year={$year}&month={$month}&day={$day}&Itemid={$Itemid}", false), "IcalEvent Deleted"); } }
function __construct($view, $today_date, $view_date, $dates, $alts, $option, $task, $Itemid) { global $catidsOut; if (JRequest::getInt('pop', 0)) { return; } $cfg =& JEVConfig::getInstance(); $compname = JEV_COM_COMPONENT; $viewimages = JURI::root() . "components/" . JEV_COM_COMPONENT . "/views/" . $view->getViewName() . "/assets/images"; $cat = ""; $hiddencat = ""; if ($catidsOut != 0) { $cat = '&catids=' . $catidsOut; $hiddencat = '<input type="hidden" name="catids" value="' . $catidsOut . '"/>'; } $link = 'index.php?option=' . $option . '&task=' . $task . $cat . '&Itemid=' . $Itemid . '&'; ?> <table class="ev_navigation" bgcolor="#ffffff" border="0" cellpadding="10" cellspacing="0" width="100%" > <tr> <td class="tableh1" align="center"> <table border="0" cellpadding="0" cellspacing="0"> <tr> <!-- BEGIN add_event --> <!--// <?php if (JEVHelper::isEventCreator()) { list($year, $month, $day) = JEVHelper::getYMD(); $editLink = JRoute::_('index.php?option=' . JEV_COM_COMPONENT . '&task=icalevent.edit' . '&year=' . $year . '&month=' . $month . '&day=' . $day . '&Itemid=' . $view->Itemid, true); $eventlinkadd = $view->popup ? "javascript:jevEditPopup('" . $editLink . "',{$view->popupw}, {$view->popuph});" : $editLink; ?> <td><img name="spacer" src="<?php echo $viewimages; ?> /spacer.gif" alt="" border="0" height="25" width="10"/></td> <td class="buttontext" align="center" nowrap="nowrap" valign="middle"> <a href="<?php echo $eventlinkadd; ?> " title="Add Event" class="buttontext"> <img src="<?php echo $viewimages; ?> /icon-addevent.gif" alt="Add Event" border="0"/><br/> <?php echo JText::_('JEV_ADD_EVENT'); ?> </a> </td> <?php } ?> //--> <!-- END add_event --> <!-- BEGIN flyer_view --> <td><img name="spacer" src="<?php echo $viewimages; ?> /spacer.gif" alt="" border="0" height="25" width="10"/></td> <td class="buttontext" align="center" nowrap="nowrap" valign="middle"> <a href="<?php echo JRoute::_('index.php?option=' . $option . $cat . '&task=year.listevents&' . $view_date->toDateURL() . '&Itemid=' . $Itemid); ?> " title="<?php echo JText::_('JEV_VIEWBYYEAR'); ?> " class="buttontext"> <img src="<?php echo $viewimages; ?> /icon-flyer.gif" alt="Flat View" border="0"/><br/> <?php echo JText::_('JEV_VIEWBYYEAR'); ?> </a> </td> <!-- END flyer_view --> <!-- BEGIN monthly_view --> <td><img name="spacer" src="<?php echo $viewimages; ?> /spacer.gif" alt="" border="0" height="25" width="10"/></td> <td class="buttontext" align="center" nowrap="nowrap" valign="middle"> <a href="<?php echo JRoute::_('index.php?option=' . $option . $cat . '&task=month.calendar&' . $view_date->toDateURL() . '&Itemid=' . $Itemid); ?> " title="<?php echo JText::_('JEV_VIEWBYMONTH'); ?> " class="buttontext"> <img src="<?php echo $viewimages; ?> /icon-calendarview.gif" alt="<?php echo JText::_('MONTHLY_VIEW'); ?> " border="0"/><br/> <?php echo JText::_('JEV_VIEWBYMONTH'); ?> </a> </td> <!-- END monthly_view --> <!-- BEGIN weekly_view --> <td><img name="spacer" src="<?php echo $viewimages; ?> /spacer.gif" alt="" border="0" height="25" width="10"/></td> <td class="buttontext" align="center" nowrap="nowrap" valign="middle"> <a href="<?php echo JRoute::_('index.php?option=' . $option . $cat . '&task=week.listevents&' . $view_date->toDateURL() . '&Itemid=' . $Itemid); ?> " title="<?php echo JText::_('JEV_VIEWBYWEEK'); ?> " class="buttontext"> <img src="<?php echo $viewimages; ?> /icon-weekly.gif" alt="Weekly View" border="0"/><br/> <?php echo JText::_('JEV_VIEWBYWEEK'); ?> </a> </td> <!-- END weekly_view --> <!-- BEGIN daily_view --> <td><img name="spacer" src="<?php echo $viewimages; ?> /spacer.gif" alt="" border="0" height="25" width="10"/></td> <td class="buttontext" align="center" nowrap="nowrap" valign="middle"> <a href="<?php echo JRoute::_('index.php?option=' . $option . $cat . '&task=day.listevents&' . $today_date->toDateURL() . '&Itemid=' . $Itemid); ?> " title="<?php echo JText::_('JEV_VIEWTODAY'); ?> " class="buttontext"> <img src="<?php echo $viewimages; ?> /icon-daily.gif" alt="Daily View" border="0"/><br/> <?php echo JText::_('JEV_VIEWTODAY'); ?> </a> </td> <!-- END daily_view --> <?php if ($cfg->get('com_hideshowbycats', 0) == '0') { ?> <!-- BEGIN cat_view --> <td><img name="spacer" src="<?php echo $viewimages; ?> /spacer.gif" alt="" border="0" height="25" width="10"/></td> <td class="buttontext" align="center" nowrap="nowrap" valign="middle"> <a href="<?php echo JRoute::_('index.php?option=' . $option . $cat . '&task=cat.listevents&' . $view_date->toDateURL() . '&Itemid=' . $Itemid); ?> " title="<?php echo JText::_('JEV_VIEWBYCAT'); ?> " class="buttontext"> <img src="<?php echo $viewimages; ?> /icon-cats.gif" alt="Categories" border="0"/><br/> <?php echo JText::_('JEV_VIEWBYCAT'); ?> </a> </td> <!-- END cat_view --> <?php } ?> <!-- BEGIN search_view --> <td><img name="spacer" src="<?php echo $viewimages; ?> /spacer.gif" alt="" border="0" height="25" width="10"/></td> <td class="buttontext" align="center" nowrap="nowrap" valign="middle"> <a href="<?php echo JRoute::_('index.php?option=' . $option . $cat . '&task=search.form&' . $view_date->toDateURL() . '&Itemid=' . $Itemid); ?> " title="<?php echo JText::_('JEV_SEARCH_TITLE'); ?> " class="buttontext"> <img src="<?php echo $viewimages; ?> /icon-search.gif" alt="Search" border="0"/><br/> <?php echo JText::_('JEV_SEARCH_TITLE'); ?> </a> </td> <!-- END search_view --> </tr> </table> </td> </tr></table> <?php }
function displayCalendarLegend($style = "list") { // do not display normal legend if dynamic legend is visible on this page $registry = JRegistry::getInstance("jevents"); if ($registry->get("jevents.dynamiclegend", 0)) { return; } // since this is meant to be a comprehensive legend look for catids from menu first: $cfg = JEVConfig::getInstance(); $Itemid = $this->myItemid; $user = JFactory::getUser(); $db = JFactory::getDBO(); // Parameters - This module should only be displayed alongside a com_jevents calendar component!!! $cfg = JEVConfig::getInstance(); $option = JRequest::getCmd('option'); if ($this->disable && $option != JEV_COM_COMPONENT) { return; } $catidList = ""; include_once JPATH_ADMINISTRATOR . "/components/" . JEV_COM_COMPONENT . "/libraries/colorMap.php"; $menu = JFactory::getApplication()->getMenu(); $active = $menu->getActive(); if (!is_null($active) && $active->component == JEV_COM_COMPONENT || !isset($Itemid)) { $params = JComponentHelper::getParams(JEV_COM_COMPONENT); } else { // If accessing this function from outside the component then I must load suitable parameters $params = $menu->getParams($Itemid); } $params = JComponentHelper::getParams(JEV_COM_COMPONENT); $c = 0; $catids = array(); // New system $newcats = $params->get("catidnew", false); if ($newcats && is_array($newcats)) { foreach ($newcats as $newcat) { if (!in_array($newcat, $catids)) { $catids[] = $newcat; $catidList .= (JString::strlen($catidList) > 0 ? "," : "") . $newcat; } } } else { while ($nextCatId = $params->get("catid{$c}", null)) { if (!in_array($nextCatId, $catids)) { $catids[] = $nextCatId; $catidList .= (JString::strlen($catidList) > 0 ? "," : "") . $nextCatId; } $c++; } } $jevleghelper = new modJeventsLegendHelper(); if ($catidList == "" && $params->get("catid0", "xxx") == "xxx") { modJeventsLegendHelper::getAllCats($this->_params, $catids, $catidList); } $separator = $params->get("catseparator", "|"); $catidsOut = str_replace(",", $separator, $catidList); // I should only show legend for items that **can** be shown in calendar so must filter based on GET/POST $catidsIn = JRequest::getVar('catids', "NONE"); if ($catidsIn != "NONE" && $catidsIn != "0") { $catidsGP = explode($separator, $catidsIn); } else { $catidsGP = array(); } $catidsGPList = implode(",", $catidsGP); // This produces a full tree of categories $allrows = $this->getCategoryHierarchy($catidList, $catidsGPList); // This is the full set of top level catids $availableCatsIds = ""; foreach ($allrows as $row) { $availableCatsIds .= (JString::strlen($availableCatsIds) > 0 ? $separator : "") . $row->id; } $allcats = new catLegend("0", JText::_('JEV_LEGEND_ALL_CATEGORIES'), "#d3d3d3", JText::_('JEV_LEGEND_ALL_CATEGORIES_DESC')); $allcats->activeBranch = true; array_push($allrows, $allcats); if (count($allrows) == 0) { return ""; } else { if ($Itemid < 999999) { $itm = "&Itemid={$Itemid}"; } $task = JRequest::getVar('jevcmd', $cfg->get('com_startview')); list($year, $month, $day) = JEVHelper::getYMD(); $tsk = ""; if ($task == "month.calendar" || $task == "year.listeventsevents" || $task == "week.listevents" || $task == "year.listevents" || $task == "day.listevents" || $task == "cat.listevents") { $tsk = "&task={$task}&year={$year}&month={$month}&day={$day}"; } else { $tsk = "&task={$this->myTask}&year={$year}&month={$month}&day={$day}"; } switch ($style) { case 'list': $content = '<div class="event_legend_container">'; $content .= '<table border="0" cellpadding="0" cellspacing="5" width="100%">'; foreach ($allrows as $row) { if (isset($row->activeBranch)) { $content .= $this->listKids($row, $itm, $tsk, $availableCatsIds); } } $content .= "</table>\n"; $content .= "</div>"; break; case 'block': default: $content = '<div class="event_legend_container">'; foreach ($allrows as $row) { if (isset($row->activeBranch)) { $content .= $this->blockKids($row, $itm, $tsk, $availableCatsIds); } } // stop floating legend items $content .= '<br style="clear:both" />' . "</div>\n"; } // only if called from module if (isset($this->_params)) { if ($this->_params->get('show_admin', 0) && isset($year) && isset($month) && isset($day) && isset($Itemid)) { // This is only displayed when JEvents is the component so I can get the component view $component = JComponentHelper::getComponent(JEV_COM_COMPONENT); $registry = JRegistry::getInstance("jevents"); $controller =& $registry->get("jevents.controller", null); if (!$controller) { return $content; } $view = $controller->view; //include_once(JPATH_SITE."/components/$option/events.html.php"); ob_start(); if (method_exists($view, "_viewNavAdminPanel")) { echo $view->_viewNavAdminPanel(); } $content .= ob_get_contents(); ob_end_clean(); } } return $content; } }
private function getAdjacentEvents() { $Itemid = JEVHelper::getItemid(); list($year, $month, $day) = JEVHelper::getYMD(); $this->datamodel = new JEventsDataModel(); JLoader::register('JEVHelper', JPATH_SITE . "/components/com_jevents/libraries/helper.php"); if (method_exists("JEVHelper", "getMinYear")) { $minyear = JEVHelper::getMinYear(); $maxyear = JEVHelper::getMaxYear(); } else { $params = JComponentHelper::getParams(JEV_COM_COMPONENT); $minyear = $params->get("com_earliestyear", 1970); $maxyear = $params->get("com_latestyear", 2150); } $pastev = 0; $limit = 10; while ($pastev == 0) { $prev = $this->datamodel->queryModel->listIcalEvents($minyear . '-01-01 00:00:00', $this->_startrepeat, "rpt.startrepeat DESC, rpt.rp_id DESC", false, "", "", $limit); for ($i = 0; $i < count($prev); $i++) { if ($this->_startrepeat > $prev[$i]->_startrepeat) { $prior = $prev[$i]; $pastev = 1; break; } else { if ($prev[$i]->_rp_id < $this->_rp_id && $this->_startrepeat == $prev[$i]->_startrepeat) { $prior = $prev[$i]; $pastev = 1; break; } } } if (count($prev) < $limit) { $pastev = 1; } $limit = $limit * 2; } if (!is_null($prior)) { $link = "index.php?option=" . JEV_COM_COMPONENT . "&task=" . $this->detailTask() . "&evid=" . $prior->_rp_id . '&Itemid=' . $Itemid . "&year=" . $prior->_yup . "&month=" . $prior->_mup . "&day=" . $prior->_dup . "&uid=" . urlencode($prior->_uid) . "&title=" . JApplication::stringURLSafe($prior->_title); $link = JRoute::_($link); $this->_prevEvent = $link; } else { $this->_prevEvent = false; } $pastevpost = 0; $limit = 10; while ($pastevpost == 0) { $next = $this->datamodel->queryModel->listIcalEvents($this->_startrepeat, $maxyear . '-01-01 00:00:00', "rpt.startrepeat ASC, rpt.rp_id ASC", false, "", "", $limit); for ($i = 0; $i < count($next); $i++) { if ($this->_startrepeat < $next[$i]->_startrepeat) { $post = $next[$i]; $pastevpost = 1; break; } else { if ($next[$i]->_rp_id > $this->_rp_id && $this->_startrepeat == $next[$i]->_startrepeat) { $post = $next[$i]; $pastevpost = 1; break; } } } if (count($next) < $limit) { $pastevpost = 1; } $limit = $limit * 2; } if (!is_null($post)) { $link = "index.php?option=" . JEV_COM_COMPONENT . "&task=" . $this->detailTask() . "&evid=" . $post->rp_id . '&Itemid=' . $Itemid . "&year={$post->yup}&month={$post->mup}&day={$post->dup}&uid=" . urlencode($this->uid()) . "&title=" . JApplication::stringURLSafe($post->title); $link = JRoute::_($link); $this->_nextEvent = $link; } else { $this->_nextEvent = false; } }
private function exportEvent($withrepeats = true) { $rpid = JRequest::getInt("evid", 0); if (!$rpid) { return; } list($year, $month, $day) = JEVHelper::getYMD(); $repeat = $this->dataModel->getEventData($rpid, "icaldb", $year, $month, $day); if ($repeat && is_array($repeat) && isset($repeat["row"]) && $repeat["row"]->rp_id() == $rpid) { $a = $repeat["row"]; $this->dataModel->setupComponentCatids(); if ($withrepeats && $a->hasrepetition()) { $a = $a->getOriginalFirstRepeat(); } if (!$a) { return; } JRequest::setVar("tmpl", "component"); //$dispatcher = JDispatcher::getInstance(); // just incase we don't have jevents plugins registered yet //JPluginHelper::importPlugin("jevents"); //$dispatcher->trigger('onExportRow', array(&$row)); $icalEvents = array(); $icalEvents[$a->ev_id()] = $a; // get the view $this->view = $this->getView("icals", "html"); $this->view->setLayout("export"); $this->view->assign("dataModel", $this->dataModel); $this->view->assign("outlook2003icalexport", false); $this->view->assign("icalEvents", $icalEvents); $this->view->assign("withrepeats", $withrepeats); $this->view->export(); return; } }
function ajax() { $modid = intval(JRequest::getVar('modid', 0)); if ($modid <= 0) { echo "<script>alert('bad mod id');</script>"; return; } // load language constants JEVHelper::loadLanguage('modcal'); list($year, $month, $day) = JEVHelper::getYMD(); $user = JFactory::getUser(); $query = "SELECT id, params" . "\n FROM #__modules AS m" . "\n WHERE m.published = 1" . "\n AND m.id = " . $modid . "\n AND m.access IN (" . JEVHelper::getAid($user, 'string') . ")" . "\n AND m.client_id != 1"; $db = JFactory::getDBO(); $db->setQuery($query); $modules = $db->loadObjectList(); if (count($modules) <= 0) { if (!$modid <= 0) { echo "<script>alert('bad mod id');</script>"; return; } } $params = new JRegistry($modules[0]->params); $cfg = JEVConfig::getInstance(); $theme = JEV_CommonFunctions::getJEventsViewName(); $comptheme = $params->get("com_calViewName", "global"); $theme = $comptheme == "global" ? $theme : $comptheme; $modtheme = $params->get("com_calViewName", $theme); if ($modtheme == "" || $modtheme == "global") { $modtheme = $theme; } $theme = $modtheme; //require(JModuleHelper::getLayoutPath('mod_jevents_cal',$theme.'/'."calendar")); require_once JPATH_SITE . '/modules/mod_jevents_cal/helper.php'; $jevhelper = new modJeventsCalHelper(); $viewclass = $jevhelper->getViewClass($theme, 'mod_jevents_cal', $theme . '/' . "calendar", $params); $modview = new $viewclass($params, $modid); $modview->jevlayout = $theme; $content = $modview->getAjaxCal($modid, $month, $year); $content = str_replace("<script style='text/javascript'>xyz=1;", "XYZ", $content); $content = str_replace("zyx=1;</script>", "ZYX", $content); preg_match("/XYZ(.*)ZYX/s", $content, $match); $script = ""; if (isset($match[1])) { $script = $match[1]; $content = str_replace($match[0], "", $content); } $json = array("data" => $content, "modid" => $modid, "script" => $script); ob_end_clean(); ob_end_flush(); if (JRequest::getCmd("callback", 0)) { echo JRequest::getCmd("callback", 0) . "(" . json_encode($json), ");"; exit; } else { if (JRequest::getInt("json") == 1) { echo json_encode($json); exit; } else { ?> <script type="text/javascript"> var doitdone = false; function doit(){ if (doitdone) return; doitdone = true; var sillydiv=document.getElementById('silly'); parent.navLoaded(sillydiv,<?php echo $modid; ?> ); } window.onload=doit; </script> <?php echo "<div id='silly'>"; echo $modview->getAjaxCal($modid, $month, $year); echo "</div>"; ?> <script type="text/javascript"> doit(); </script> <?php } } }
/** * Function that overwrites meta-tags in mainframe!! * * @static * @param string $name - metatag name * @param string $content - metatag value */ public static function checkRobotsMetaTag($name = "robots", $content = "index,follow") { // force robots metatag $cfg = JEVConfig::getInstance(); $document = JFactory::getDocument(); // constrained in some way if ($cfg->get('com_blockRobots', 0) >= 1) { // Allow on detail pages - block otherwise unless crawler! if ($cfg->get('com_blockRobots', 0) == 3) { if (strpos(JRequest::getString("jevtask", ""), ".detail") > 0) { $document->setMetaData($name, "index,nofollow"); return; } if (strpos(JRequest::getString("jevtask", ""), "crawler") !== false || $content != "index,follow") { $document->setMetaData($name, $content); } else { $document->setMetaData($name, "noindex,nofollow"); } return; } // Always block Robots if ($cfg->get('com_blockRobots', 0) == 1) { $document->setMetaData($name, "noindex,nofollow"); return; } // conditional on date list($cyear, $cmonth, $cday) = JEVHelper::getYMD(); $cdate = JevDate::mktime(0, 0, 0, $cmonth, $cday, $cyear); $prior = JevDate::strtotime($cfg->get('robotprior', "-1 day")); if ($cdate < $prior && $cfg->get('com_blockRobots', 0)) { $document->setMetaData($name, "noindex,nofollow"); return; } $post = JevDate::strtotime($cfg->get('robotpost', "-1 day")); if ($cdate > $post && $cfg->get('com_blockRobots', 0)) { $document->setMetaData($name, "noindex,nofollow"); return; } //If JEvents is not blocking robots we use menu item configuration $document->setMetaData($name, $cfg->get('robots', $content)); } else { $document->setMetaData($name, $cfg->get('robots', $content)); } }
function DefaultViewNavTableBar($view, $today_date, $view_date, $dates, $alts, $option, $task, $Itemid) { $cfg =& JEVConfig::getInstance(); $this->view = $view; $this->transparentGif = JURI::root() . "components/" . JEV_COM_COMPONENT . "/views/" . $this->view->getViewName() . "/assets/images/transp.gif"; $this->Itemid = JEVHelper::getItemid(); $this->cat = $this->view->datamodel->getCatidsOutLink(); $this->task = $task; if (JRequest::getInt('pop', 0)) { return; } list($year, $month, $day) = JEVHelper::getYMD(); $iconstoshow = $cfg->get('iconstoshow', array('byyear', 'bymonth', 'byweek', 'byday', 'search')); ?> <div class="ev_navigation" style="width:100%"> <table width="300" border="0" align="center" > <tr align="center" valign="top"> <td height="1" width="100" align="right" valign="top"> <a href="<?php echo JRoute::_('index.php?option=' . JEV_COM_COMPONENT . $this->cat . '&task=day.listevents&' . $today_date->toDateURL() . '&Itemid=' . $this->Itemid); ?> " title="<?php echo JText::_('JEV_VIEWTODAY'); ?> "><?php echo JText::_('JEV_VIEWTODAY'); ?> </a> </td> <td height="1" align="center" valign="bottom"> <form name="ViewSelect" action="<?php echo JURI::root() . "index.php"; ?> " method="get"> <input type="hidden" name="Itemid" value="<?php echo $Itemid; ?> " /> <input type="hidden" name="option" value="<?php echo JEV_COM_COMPONENT; ?> " /> <input type="hidden" name="year" value="<?php echo $year; ?> " /> <input type="hidden" name="month" value="<?php echo $month; ?> " /> <input type="hidden" name="day" value="<?php echo $day; ?> " /> <select name="task" id="task" onchange="submit(this.form);"> <?php if (in_array("byday", $iconstoshow)) { ?> <option value="day.listevents"><?php echo JText::_('JEV_VIEWBYDAY'); ?> </option> <?php } if (in_array("byweek", $iconstoshow)) { ?> <option value="week.listevents"><?php echo JText::_('JEV_VIEWBYWEEK'); ?> </option> <?php } if (in_array("bymonth", $iconstoshow)) { ?> <option value="month.calendar"><?php echo JText::_('JEV_VIEWBYMONTH'); ?> </option> <?php } if (in_array("byyear", $iconstoshow)) { ?> <option value="year.listevents"><?php echo JText::_('JEV_VIEWBYYEAR'); ?> </option> <?php } if (in_array("search", $iconstoshow)) { ?> <option value="search.form"><?php echo JText::_('JEV_SEARCH_TITLE'); ?> </option> <?php } if (in_array("bycat", $iconstoshow)) { ?> <option value="cat.listevents"><?php echo JText::_('JEV_VIEWBYCAT'); ?> </option> <?php } ?> </select> </form> </td> <td height="1" width="100" align="left" valign="top"> <a href="<?php echo JRoute::_('index.php?option=' . JEV_COM_COMPONENT . $this->cat . '&task=month.calendar&' . $today_date->toDateURL() . '&Itemid=' . $this->Itemid); ?> " title="<?php echo JText::_('JEV_VIEWTOCOME'); ?> "> <?php echo JText::_('JEV_VIEWTOCOME'); ?> </a> </td> </tr> </table> <table width="300" border="0" align="center"> <tr valign="top"> <?php if (in_array("byyear", $iconstoshow)) { echo $this->_lastYearIcon($dates, $alts); } if (in_array("bymonth", $iconstoshow)) { echo $this->_lastMonthIcon($dates, $alts); } ?> <td align="center" valign="top"> <form name="BarNav" action="index.php" method="get"> <input type="hidden" name="option" value="<?php echo JEV_COM_COMPONENT; ?> " /> <input type="hidden" name="task" value="<?php echo $this->task; ?> " /> <?php /* Day Select */ JEventsHTML::buildDaySelect($year, $month, $day, ' style="font-size:10px;" onchange="submit(this.form)"'); /* Month Select */ JEventsHTML::buildMonthSelect($month, 'style="font-size:10px;" onchange="submit(this.form)"'); /* Year Select */ JEventsHTML::buildYearSelect($year, 'style="font-size:10px;" onchange="submit(this.form)"'); ?> <input type="hidden" name="Itemid" value="<?php echo $this->Itemid; ?> " /> </form> </td> <?php if (in_array("bymonth", $iconstoshow)) { echo $this->_nextMonthIcon($dates, $alts); } if (in_array("byyear", $iconstoshow)) { echo $this->_nextYearIcon($dates, $alts); } ?> </tr> </table> </div> <?php }
function __construct($view, $today_date, $view_date, $dates, $alts, $option, $task, $Itemid) { global $catidsOut; if (JRequest::getInt('pop', 0)) { return; } $cfg = JEVConfig::getInstance(); $compname = JEV_COM_COMPONENT; //Lets check if we should show the nav on event details if ($task == "icalrepeat.detail" && $cfg->get('shownavbar_detail', 1) == 0) { return; } $this->iconstoshow = $cfg->get('iconstoshow', array('byyear', 'bymonth', 'byweek', 'byday', 'search')); $viewimages = JURI::root() . "components/" . JEV_COM_COMPONENT . "/views/" . $view->getViewName() . "/assets/images"; $cat = ""; $hiddencat = ""; if ($catidsOut != 0) { $cat = '&catids=' . $catidsOut; $hiddencat = '<input type="hidden" name="catids" value="' . $catidsOut . '"/>'; } // for popup editing $view->popup = false; $params = JComponentHelper::getParams(JEV_COM_COMPONENT); if ($params->get("editpopup", 0) && JEVHelper::isEventCreator()) { JevHtmlBootstrap::modal(); JEVHelper::script('editpopup.js', 'components/' . JEV_COM_COMPONENT . '/assets/js/'); $view->popup = true; $view->popupw = $params->get("popupw", 800); $view->popuph = $params->get("popuph", 600); } $link = 'index.php?option=' . $option . '&task=' . $task . $cat . '&Itemid=' . $Itemid . '&'; ?> <table class="ev_navigation" bgcolor="#ffffff" border="0" cellpadding="10" cellspacing="0" width="100%" > <tr> <td class="tableh1" align="center"> <table border="0" cellpadding="0" cellspacing="0"> <tr> <!-- BEGIN add_event --> <!--// <?php if (JEVHelper::isEventCreator()) { list($year, $month, $day) = JEVHelper::getYMD(); $editLink = JRoute::_('index.php?option=' . JEV_COM_COMPONENT . '&task=icalevent.edit' . '&year=' . $year . '&month=' . $month . '&day=' . $day . '&Itemid=' . $view->Itemid, true); $eventlinkadd = $view->popup ? "javascript:jevEditPopup('" . $editLink . "');" : $editLink; ?> <td><img name="spacer" src="<?php echo $viewimages; ?> /spacer.gif" alt="" border="0" height="25" width="10"/></td> <td class="buttontext" align="center" nowrap="nowrap" valign="middle"> <a href="<?php echo $eventlinkadd; ?> " title="Add Event" class="buttontext"> <img src="<?php echo $viewimages; ?> /icon-addevent.gif" alt="Add Event" border="0"/><br/> <?php echo JText::_('JEV_ADD_EVENT'); ?> </a> </td> <?php } ?> //--> <!-- END add_event --> <?php if (in_array("byyear", $this->iconstoshow)) { ?> <td><img name="spacer" src="<?php echo $viewimages; ?> /spacer.gif" alt="" border="0" height="25" width="10"/></td> <td class="buttontext" align="center" nowrap="nowrap" valign="middle"> <a href="<?php echo JRoute::_('index.php?option=' . $option . $cat . '&task=year.listevents&' . $view_date->toDateURL() . '&Itemid=' . $Itemid); ?> " title="<?php echo JText::_('JEV_VIEWBYYEAR'); ?> " class="buttontext"> <img src="<?php echo $viewimages; ?> /icon-flyer.gif" alt="Flat View" border="0"/><br/> <?php echo JText::_('JEV_VIEWBYYEAR'); ?> </a> </td> <?php } ?> <?php if (in_array("bymonth", $this->iconstoshow)) { ?> <td><img name="spacer" src="<?php echo $viewimages; ?> /spacer.gif" alt="" border="0" height="25" width="10"/></td> <td class="buttontext" align="center" nowrap="nowrap" valign="middle"> <a href="<?php echo JRoute::_('index.php?option=' . $option . $cat . '&task=month.calendar&' . $view_date->toDateURL() . '&Itemid=' . $Itemid); ?> " title="<?php echo JText::_('JEV_VIEWBYMONTH'); ?> " class="buttontext"> <img src="<?php echo $viewimages; ?> /icon-calendarview.gif" alt="<?php echo JText::_('MONTHLY_VIEW'); ?> " border="0"/><br/> <?php echo JText::_('JEV_VIEWBYMONTH'); ?> </a> </td> <?php } ?> <?php if (in_array("byweek", $this->iconstoshow)) { ?> <td><img name="spacer" src="<?php echo $viewimages; ?> /spacer.gif" alt="" border="0" height="25" width="10"/></td> <td class="buttontext" align="center" nowrap="nowrap" valign="middle"> <a href="<?php echo JRoute::_('index.php?option=' . $option . $cat . '&task=week.listevents&' . $view_date->toDateURL() . '&Itemid=' . $Itemid); ?> " title="<?php echo JText::_('JEV_VIEWBYWEEK'); ?> " class="buttontext"> <img src="<?php echo $viewimages; ?> /icon-weekly.gif" alt="Weekly View" border="0"/><br/> <?php echo JText::_('JEV_VIEWBYWEEK'); ?> </a> </td> <?php } ?> <?php if (in_array("byday", $this->iconstoshow)) { ?> <td><img name="spacer" src="<?php echo $viewimages; ?> /spacer.gif" alt="" border="0" height="25" width="10"/></td> <td class="buttontext" align="center" nowrap="nowrap" valign="middle"> <a href="<?php echo JRoute::_('index.php?option=' . $option . $cat . '&task=day.listevents&' . $today_date->toDateURL() . '&Itemid=' . $Itemid); ?> " title="<?php echo JText::_('JEV_VIEWTODAY'); ?> " class="buttontext"> <img src="<?php echo $viewimages; ?> /icon-daily.gif" alt="Daily View" border="0"/><br/> <?php echo JText::_('JEV_VIEWTODAY'); ?> </a> </td> <?php } ?> <?php if ($cfg->get('com_hideshowbycats', 0) == '0') { ?> <?php if (in_array("bycat", $this->iconstoshow)) { ?> <td><img name="spacer" src="<?php echo $viewimages; ?> /spacer.gif" alt="" border="0" height="25" width="10"/></td> <td class="buttontext" align="center" nowrap="nowrap" valign="middle"> <a href="<?php echo JRoute::_('index.php?option=' . $option . $cat . '&task=cat.listevents&' . $view_date->toDateURL() . '&Itemid=' . $Itemid); ?> " title="<?php echo JText::_('JEV_VIEWBYCAT'); ?> " class="buttontext"> <img src="<?php echo $viewimages; ?> /icon-cats.gif" alt="Categories" border="0"/><br/> <?php echo JText::_('JEV_VIEWBYCAT'); ?> </a> </td> <?php } ?> <?php } ?> <?php if (in_array("search", $this->iconstoshow)) { ?> <td><img name="spacer" src="<?php echo $viewimages; ?> /spacer.gif" alt="" border="0" height="25" width="10"/></td> <td class="buttontext" align="center" nowrap="nowrap" valign="middle"> <a href="<?php echo JRoute::_('index.php?option=' . $option . $cat . '&task=search.form&' . $view_date->toDateURL() . '&Itemid=' . $Itemid); ?> " title="<?php echo JText::_('JEV_SEARCH_TITLE'); ?> " class="buttontext"> <img src="<?php echo $viewimages; ?> /icon-search.gif" alt="Search" border="0"/><br/> <?php echo JText::_('JEV_SEARCH_TITLE'); ?> </a> </td> <?php } ?> </tr> </table> </td> </tr></table> <?php }
$this->searchtags[] = "{{MESSAGE}}"; $output = ob_get_clean(); $this->replacetags[] = $output; echo $output; $this->blanktags[] = ""; ob_start(); if (isset($this->row->_uid)) { ?> <input type="hidden" name="uid" value="<?php echo $this->row->_uid; ?> " /> <?php } // I need $year,$month,$day So that I can return to an appropriate date after saving an event (the repetition ids have all changed so I can't go back there!!) list($year, $month, $day) = JEVHelper::getYMD(); // need rp_id for front end editing cancel to work note that evid is the repeat id for viewing detail ?> <input type="hidden" name="jevtype" value="icaldb" /> <input type="hidden" name="boxchecked" value="0" /> <input type="hidden" name="updaterepeats" value="0"/> <input type="hidden" name="task" value="<?php echo JRequest::getCmd("task", "icalevent.edit"); ?> " /> <input type="hidden" name="option" value="<?php echo JEV_COM_COMPONENT; ?> " /> <input type="hidden" name="rp_id" value="<?php echo isset($this->rp_id) ? $this->rp_id : -1;
function detail() { // Do we have to be logged in to see this event $user = JFactory::getUser(); if (JRequest::getInt("login", 0) && $user->id == 0) { $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, false); $this->setRedirect($link, JText::_('JEV_LOGIN_TO_VIEW_EVENT')); return; } $evid = JRequest::getInt("rp_id", 0); if ($evid == 0) { $evid = JRequest::getInt("evid", 0); // In this case I do not have a repeat id so I } // special case where loading a direct menu item to an event with nextrepeat specified /* * This is problematic since it will affect direct links to a specific repeat e.g. from latest events module on this menu item $params = JComponentHelper::getParams(JEV_COM_COMPONENT); $Itemid = JRequest::getInt("Itemid"); if ($params->get("nextrepeat", 0) && $Itemid>0 ) { $menu = JFactory::getApplication()->getMenu(); $menuitem = $menu->getItem($Itemid); if (!is_null($menuitem) && isset($menuitem->query["layout"]) && isset($menuitem->query["view"]) && isset($menuitem->query["rp_id"])) { // we put the xml file in the wrong folder - stupid. Hard to move now! if ($menuitem->query["view"] == "icalrepeat" || $menuitem->query["view"] == "icalevent") { if (intval($menuitem->query["rp_id"]) == $evid ){ $this->datamodel = new JEventsDataModel(); $this->datamodel->setupComponentCatids(); list($year,$month,$day) = JEVHelper::getYMD(); $uid = urldecode((JRequest::getVar( 'uid', "" ))); $eventdata = $this->datamodel->getEventData( $evid, "icaldb", $year, $month, $day, $uid ); if ($eventdata && isset($eventdata["row"])){ $nextrepeat = $eventdata["row"]->getNextRepeat(); if ($nextrepeat){ //$evid = $nextrepeat->rp_id(); } } } } } } * */ // if cancelling from save of copy and edit use the old event id if ($evid == 0) { $evid = JRequest::getInt("old_evid", 0); } $pop = intval(JRequest::getVar('pop', 0)); list($year, $month, $day) = JEVHelper::getYMD(); $Itemid = JEVHelper::getItemid(); $uid = urldecode(JRequest::getVar('uid', "")); $document = JFactory::getDocument(); $viewType = $document->getType(); $cfg = JEVConfig::getInstance(); $theme = JEV_CommonFunctions::getJEventsViewName(); $view = "icalevent"; $this->addViewPath($this->_basePath . '/' . "views" . '/' . $theme); $this->view = $this->getView($view, $viewType, $theme . "View", array('base_path' => $this->_basePath, "template_path" => $this->_basePath . '/' . "views" . '/' . $theme . '/' . $view . '/' . 'tmpl', "name" => $theme . '/' . $view)); // Set the layout $this->view->setLayout("detail"); $this->view->assign("Itemid", $Itemid); $this->view->assign("month", $month); $this->view->assign("day", $day); $this->view->assign("year", $year); $this->view->assign("task", $this->_task); $this->view->assign("pop", $pop); $this->view->assign("evid", $evid); $this->view->assign("jevtype", "icaldb"); $this->view->assign("uid", $uid); // View caching logic -- simple... are we logged in? $cfg = JEVConfig::getInstance(); $joomlaconf = JFactory::getConfig(); $useCache = intval($cfg->get('com_cache', 0)) && $joomlaconf->get('caching', 1); if ($user->get('id') || !$useCache) { $this->view->display(); } else { $cache = JFactory::getCache(JEV_COM_COMPONENT, 'view'); $cache->get($this->view, 'display'); } }
function unpublishLink($sef = false) { $Itemid = JEVHelper::getItemid(); // I need $year,$month,$day So that I can return to an appropriate date after deleting a repetition!!! list($year, $month, $day) = JEVHelper::getYMD(); $link = "index.php?option=" . JEV_COM_COMPONENT . "&task=" . $this->unpublishTask() . '&cid[]=' . $this->ev_id() . '&Itemid=' . $Itemid . "&year={$year}&month={$month}&day={$day}"; $link = $sef ? JRoute::_($link) : $link; return $link; }
function save($array, &$queryModel, $rrule, $dryrun = false) { $cfg =& JEVConfig::getInstance(); $db =& JFactory::getDBO(); $user = JFactory::getUser(); // Allow plugins to check data validity $dispatcher =& JDispatcher::getInstance(); JPluginHelper::importPlugin("jevents"); $res = $dispatcher->trigger('onBeforeSaveEvent', array(&$array, &$rrule, $dryrun)); // TODO do error and hack checks here $ev_id = intval(JArrayHelper::getValue($array, "evid", 0)); $newevent = $ev_id == 0; $data = array(); // TODO add UID to edit form $data["UID"] = JArrayHelper::getValue($array, "uid", md5(uniqid(rand(), true))); $data["X-EXTRAINFO"] = JArrayHelper::getValue($array, "extra_info", ""); $data["LOCATION"] = JArrayHelper::getValue($array, "location", ""); $data["allDayEvent"] = JArrayHelper::getValue($array, "allDayEvent", "off"); $data["CONTACT"] = JArrayHelper::getValue($array, "contact_info", ""); $data["DESCRIPTION"] = JArrayHelper::getValue($array, "jevcontent", ""); $data["publish_down"] = JArrayHelper::getValue($array, "publish_down", "2006-12-12"); $data["publish_up"] = JArrayHelper::getValue($array, "publish_up", "2006-12-12"); $data["SUMMARY"] = JArrayHelper::getValue($array, "title", ""); $data["URL"] = JArrayHelper::getValue($array, "url", ""); // If user is jevents can deleteall or has backend access then allow them to specify the creator $jevuser = JEVHelper::getAuthorisedUser(); $creatorid = JRequest::getInt("jev_creatorid", 0); if ($creatorid > 0) { if (JVersion::isCompatible("1.6.0")) { //$access = JAccess::check($user->id, "core.deleteall","com_jevents"); $access = $user->authorise('core.admin', 'com_jevents'); } else { // Get an ACL object $acl =& JFactory::getACL(); $grp = $acl->getAroGroup($user->get('id')); $access = $acl->is_group_child_of($grp->name, 'Public Backend'); } if ($jevuser && $jevuser->candeleteall || $access) { $data["X-CREATEDBY"] = $creatorid; } } $ics_id = JArrayHelper::getValue($array, "ics_id", 0); if ($data["allDayEvent"] == "on") { $start_time = "00:00"; } else { $start_time = JArrayHelper::getValue($array, "start_time", "08:00"); } $publishstart = $data["publish_up"] . ' ' . $start_time . ':00'; $data["DTSTART"] = JevDate::strtotime($publishstart); if ($data["allDayEvent"] == "on") { $end_time = "00:00"; } else { $end_time = JArrayHelper::getValue($array, "end_time", "15:00"); } $publishend = $data["publish_down"] . ' ' . $end_time . ':00'; if (isset($array["noendtime"]) && $array["noendtime"]) { $publishend = $data["publish_down"] . ' 23:59:59'; } $data["DTEND"] = JevDate::strtotime($publishend); // iCal for whole day uses 00:00:00 on the next day JEvents uses 23:59:59 on the same day list($h, $m, $s) = explode(":", $end_time . ':00'); if ($h + $m + $s == 0 && $data["allDayEvent"] == "on" && $data["DTEND"] > $data["DTSTART"]) { //if (($h+$m+$s)==0 && $data["allDayEvent"]=="on" && $data["DTEND"]>=$data["DTSTART"]) { //$publishend = JevDate::strftime('%Y-%m-%d 23:59:59',($data["DTEND"]-86400)); $publishend = JevDate::strftime('%Y-%m-%d 23:59:59', $data["DTEND"]); $data["DTEND"] = JevDate::strtotime($publishend); } $data["RRULE"] = $rrule; $data["MULTIDAY"] = JArrayHelper::getValue($array, "multiday", "1"); $data["NOENDTIME"] = JArrayHelper::getValue($array, "noendtime", "0"); $data["X-COLOR"] = JArrayHelper::getValue($array, "color", ""); $data["LOCKEVENT"] = JArrayHelper::getValue($array, "lockevent", "0"); // Add any custom fields into $data array foreach ($array as $key => $value) { if (strpos($key, "custom_") === 0) { $data[$key] = $value; } } $vevent = iCalEvent::iCalEventFromData($data); $vevent->catid = JArrayHelper::getValue($array, "catid", 0); if (is_array($vevent->catid)) { JArrayHelper::toInteger($vevent->catid); } // if catid is empty then use the catid of the ical calendar if (is_string($vevent->catid) && $vevent->catid <= 0 || is_array($vevent->catid) && count($vevent->catid) == 0) { $query = "SELECT catid FROM #__jevents_icsfile WHERE ics_id={$ics_id}"; $db->setQuery($query); $vevent->catid = $db->loadResult(); } $vevent->access = intval(JArrayHelper::getValue($array, "access", 0)); if (!JVersion::isCompatible("1.6.0")) { $vevent->access = $vevent->access > $user->aid ? $user->aid : $vevent->access; } $vevent->state = intval(JArrayHelper::getValue($array, "state", 0)); // Shouldn't really do this like this $vevent->_detail->priority = intval(JArrayHelper::getValue($array, "priority", 0)); // FRONT END AUTO PUBLISHING CODE $frontendPublish = JEVHelper::isEventPublisher(); if (!$frontendPublish) { $frontendPublish = JEVHelper::canPublishOwnEvents($ev_id); } // Always unpublish if no Publisher otherwise publish automatically (for new events) // Should we always notify of new events $notifyAdmin = $cfg->get("com_notifyallevents", 0); if (!JFactory::getApplication()->isAdmin()) { if ($frontendPublish && $ev_id == 0) { $vevent->state = 1; } else { if (!$frontendPublish) { $vevent->state = 0; // In this case we send a notification email to admin $notifyAdmin = true; } } } $vevent->icsid = $ics_id; if ($ev_id > 0) { $vevent->ev_id = $ev_id; } $rp_id = intval(JArrayHelper::getValue($array, "rp_id", 0)); if ($rp_id > 0) { // I should be able to do this in one operation but that can come later $testevent = $queryModel->listEventsById(intval($rp_id), 1, "icaldb"); if (!JEVHelper::canEditEvent($testevent)) { JError::raiseError(403, JText::_('ALERTNOTAUTH')); } } $db =& JFactory::getDBO(); $success = true; //echo "class = ".get_class($vevent); if (!$dryrun) { if (!$vevent->store()) { echo $db->getErrorMsg() . "<br/>"; $success = false; JError::raiseWarning(101, JText::_('COULD_NOT_SAVE_EVENT_')); } } else { // need a value for eventid to pretend we have saved the event so we can get the repetitions if (!isset($vevent->ev_id)) { $vevent->ev_id = 0; } $vevent->rrule->eventid = $vevent->ev_id; } // Only update the repetitions if the event edit says the reptitions will have changed or a new event if ($newevent || JRequest::getInt("updaterepeats", 1)) { $repetitions = $vevent->getRepetitions(true); if (!$dryrun) { if (!$vevent->storeRepetitions()) { echo $db->getErrorMsg() . "<br/>"; $success = false; JError::raiseWarning(101, JText::_('COULD_NOT_SAVE_REPETITIONS')); } } } $res = $dispatcher->trigger('onAfterSaveEvent', array(&$vevent, $dryrun)); if ($dryrun) { return $vevent; } // If not authorised to publish in the frontend then notify the administrator if (!$dryrun && $success && $notifyAdmin && !JFactory::getApplication()->isAdmin()) { JLoader::register('JEventsCategory', JEV_ADMINPATH . "/libraries/categoryClass.php"); $cat = new JEventsCategory($db); $cat->load($vevent->catid); $adminuser = $cat->getAdminUser(); $adminEmail = $adminuser->email; $config = new JConfig(); $sitename = $config->sitename; $subject = JText::_('JEV_MAIL_ADDED') . ' ' . $sitename; $subject = $vevent->state == '1' ? '[Info] ' . $subject : '[Approval] ' . $subject; $Itemid = JEVHelper::getItemid(); // reload the event to get the reptition ids $evid = intval($vevent->ev_id); $testevent = $queryModel->getEventById($evid, 1, "icaldb"); $rp_id = $testevent->rp_id(); list($year, $month, $day) = JEVHelper::getYMD(); //http://joomlacode1.5svn/index.php?option=com_jevents&task=icalevent.edit&evid=1&Itemid=68&rp_id=72&year=2008&month=09&day=10&lang=cy $uri =& JURI::getInstance(JURI::base()); $root = $uri->toString(array('scheme', 'host', 'port')); $modifylink = '<a href="' . $root . JRoute::_('index.php?option=' . JEV_COM_COMPONENT . '&task=icalevent.edit&evid=' . $evid . '&rp_id=' . $rp_id . '&Itemid=' . $Itemid . "&year={$year}&month={$month}&day={$day}") . '"><b>' . JText::_('JEV_MODIFY') . '</b></a>' . "\n"; $viewlink = '<a href="' . $root . JRoute::_('index.php?option=' . JEV_COM_COMPONENT . '&task=icalrepeat.detail&evid=' . $rp_id . '&Itemid=' . $Itemid . "&year={$year}&month={$month}&day={$day}&login=1") . '"><b>' . JText::_('JEV_VIEW') . '</b></a>' . "\n"; $created_by = $user->name; if ($created_by == null) { $created_by = "Anonymous"; if (JRequest::getString("custom_anonusername", "") != "") { $created_by = JRequest::getString("custom_anonusername", "") . " (" . JRequest::getString("custom_anonemail", "") . ")"; } } JEV_CommonFunctions::sendAdminMail($sitename, $adminEmail, $subject, $testevent->title(), $testevent->content(), $created_by, JURI::root(), $modifylink, $viewlink); } if ($success) { return $vevent; } return $success; }
function countIcalEventsByCat($catids, $showrepeats = false) { $db =& JFactory::getDBO(); $user = JFactory::getUser(); // Use catid in accessibleCategoryList to pick up offsping too! $aid = null; $catidlist = implode(",", $catids); // process the new plugins // get extra data and conditionality from plugins $extrafields = ""; // must have comma prefix $extratables = ""; // must have comma prefix $extrawhere = array(); $extrajoin = array(); $needsgroup = false; if (!$this->cfg->getValue("showyearpast", 1)) { list($year, $month, $day) = JEVHelper::getYMD(); $startdate = JevDate::mktime(0, 0, 0, $month, $day, $year); $startdate = JevDate::strftime('%Y-%m-%d 00:00:00', $startdate); $extrawhere[] = "rpt.endrepeat >= '{$startdate}'"; } $filters = jevFilterProcessing::getInstance(array("published", "justmine", "category", "search")); $filters->setWhereJoin($extrawhere, $extrajoin); $needsgroup = $filters->needsGroupBy(); $extrafields = ""; // must have comma prefix $extratables = ""; // must have comma prefix $dispatcher =& JDispatcher::getInstance(); $dispatcher->trigger('onListIcalEvents', array(&$extrafields, &$extratables, &$extrawhere, &$extrajoin, &$needsgroup)); $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 count if ($showrepeats) { $query = "SELECT count(DISTINCT rpt.rp_id) as cnt" . "\n FROM #__jevents_vevent as ev " . "\n LEFT JOIN #__jevents_icsfile as icsf ON icsf.ics_id=ev.icsid" . "\n LEFT JOIN #__jevents_repetition as rpt ON rpt.eventid = ev.ev_id" . "\n LEFT JOIN #__jevents_rrule as rr ON rr.eventid = ev.ev_id" . "\n LEFT JOIN #__jevents_vevdetail as det ON det.evdet_id = rpt.eventdetail_id" . $extrajoin . $catwhere . "\n AND icsf.state=1" . $extrawhere; } else { // TODO fine a single query way of doing this !!! $query = "SELECT MIN(rpt.rp_id) as rp_id FROM #__jevents_repetition as rpt " . "\n LEFT JOIN #__jevents_vevent as ev ON rpt.eventid = ev.ev_id" . "\n LEFT JOIN #__jevents_rrule as rr ON rr.eventid = ev.ev_id" . "\n LEFT JOIN #__jevents_vevdetail as det ON det.evdet_id = rpt.eventdetail_id" . "\n LEFT JOIN #__jevents_icsfile as icsf ON icsf.ics_id=ev.icsid " . $extrajoin . $catwhere . $extrawhere . "\n AND icsf.state=1" . "\n GROUP BY ev.ev_id"; $db->setQuery($query); $rplist = $db->loadResultArray(); $rplist = implode(',', array_merge(array(-1), $rplist)); $query = "SELECT count(DISTINCT det.evdet_id) as cnt" . "\n FROM #__jevents_vevent as ev " . "\n LEFT JOIN #__jevents_icsfile as icsf ON icsf.ics_id=ev.icsid" . "\n LEFT JOIN #__jevents_repetition as rpt ON rpt.eventid = ev.ev_id" . "\n AND rpt.rp_id IN({$rplist})" . "\n LEFT JOIN #__jevents_rrule as rr ON rr.eventid = ev.ev_id" . "\n LEFT JOIN #__jevents_vevdetail as det ON det.evdet_id = rpt.eventdetail_id" . $extrajoin . $catwhere . "\n AND icsf.state=1" . $extrawhere; } $db->setQuery($query); //echo $db->_sql; //echo $db->explain(); $total = intval($db->loadResult()); return $total; }
function deletefuture() { // clean out the cache $cache = JFactory::getCache('com_jevents'); $cache->clean(JEV_COM_COMPONENT); if (!JEVHelper::isEventCreator()) { throw new Exception(JText::_('ALERTNOTAUTH'), 403); return false; } $this->_deleteFuture(); if (JFactory::getApplication()->isAdmin()) { $this->setRedirect("index.php?option=" . JEV_COM_COMPONENT . "&task=icalrepeat.list&cid[]=" . $repeatdata->eventid, "ICal Repeats deleted"); } else { $Itemid = JRequest::getInt("Itemid"); list($year, $month, $day) = JEVHelper::getYMD(); $this->setRedirect(JRoute::_('index.php?option=' . JEV_COM_COMPONENT . "&task=day.listevents&year={$year}&month={$month}&day={$day}&Itemid={$Itemid}"), "Ical Repeats Deleted"); } }
function DefaultViewHelperViewNavAdminPanel($view) { $cfg = JEVConfig::getInstance(); if ($cfg->get('show_adminpanel', 1) == 1) { $is_event_editor = JEVHelper::isEventCreator(); $user = JFactory::getUser(); JEVHelper::script('view_detailJQ.js', 'components/' . JEV_COM_COMPONENT . "/assets/js/"); JLoader::register('jevFilterProcessing', JEV_PATH . "/libraries/filters.php"); $pluginsDir = JPATH_ROOT . '/' . 'plugins' . '/' . 'jevents'; $filters = jevFilterProcessing::getInstance(array("published", "justmine", "category", "reset")); $cfg = JEVConfig::getInstance(); if (JRequest::getInt('pop', 0)) { return; } if ($is_event_editor) { if ($cfg->get("bootstrapchosen", 1)) { // Load Bootstrap JevHtmlBootstrap::framework(); JHtml::_('formbehavior.chosen', '#jevents select:not(.notchosen)'); } if ($cfg->get("bootstrapcss", 1) == 1) { // This version of bootstrap has maximum compatability with JEvents due to enhanced namespacing JHTML::stylesheet("com_jevents/bootstrap.css", array(), true); } else { if ($cfg->get("bootstrapcss", 1) == 2) { JHtmlBootstrap::loadCss(); } } // Load event adding language string JText::script('JEV_ADD_EVENT'); JText::script('JEV_IMPORT_ICALEVENT'); ?> <div class="ev_adminpanel"> <div align="left" class="nav_bar_cell"> <?php $editLink = JRoute::_('index.php?option=' . JEV_COM_COMPONENT . '&task=icalevent.edit' . '&year=' . $view->year . '&month=' . $view->month . '&day=' . $view->day . '&Itemid=' . $view->Itemid, true); $popup = false; $params = JComponentHelper::getParams(JEV_COM_COMPONENT); if ($params->get("editpopup", 0) && JEVHelper::isEventCreator()) { //JevHtmlBootstrap::modal(); JEVHelper::script('editpopupJQ.js', 'components/' . JEV_COM_COMPONENT . '/assets/js/'); $popup = true; } $eventlinkadd = $popup ? "javascript:jevEditPopup('" . $editLink . "');" : $editLink; ?> <a href="<?php echo $eventlinkadd; ?> " title="<?php echo JText::_('JEV_ADDEVENT'); ?> "> <b><?php echo JText::_('JEV_ADDEVENT'); ?> </b> </a> <?php // offer frontend import ? if ($params->get("feimport", 0)) { $importLink = JRoute::_('index.php?option=' . JEV_COM_COMPONENT . '&task=icals.importform&tmpl=component&Itemid=' . $view->Itemid, true); //JevHtmlBootstrap::modal(); JEVHelper::script('editpopupJQ.js', 'components/' . JEV_COM_COMPONENT . '/assets/js/'); $eventimport = "javascript:jevImportPopup('" . $importLink . "');"; ?> <br/><a href="<?php echo $eventimport; ?> " title="<?php echo JText::_('JEV_IMPORT_ICALEVENT', true); ?> "> <b><?php echo JText::_('JEV_IMPORT_ICALEVENT'); ?> </b> </a> <?php } if ($user->id > 0) { $datamodel = new JEventsDataModel(); // find appropriate Itemid and setup catids for datamodel $myItemid = JEVHelper::getItemid(); $datamodel->setupComponentCatids(); list($year, $month, $day) = JEVHelper::getYMD(); $evid = JRequest::getVar("evid", false); $jevtype = JRequest::getVar("jevtype", false); // FORM for filter submission $form_link = JRoute::_('index.php?option=' . JEV_COM_COMPONENT . '&task=' . JRequest::getVar("jevtask", "month.calendar") . ($evid ? '&evid=' . $evid : '') . ($jevtype ? '&jevtype=' . $jevtype : '') . ($year ? '&year=' . $year : '') . ($month ? '&month=' . $month : '') . ($day ? '&day=' . $day : '') . "&Itemid=" . $myItemid, false); ?> <form action="<?php echo $form_link; ?> " method="post"> <?php $filterHTML = $filters->getFilterHTML(); $Itemid = JEVHelper::getItemid(); foreach ($filterHTML as $filter) { echo "<div>" . $filter["title"] . " " . $filter["html"] . "</div>"; } /* $eventmylinks = JRoute::_( 'index.php?option=' . JEV_COM_COMPONENT . '&task=admin.listevents' . '&year=' . $view->year . '&month=' . $view->month . '&day=' . $view->day . '&Itemid=' . $view->Itemid ); ?> <a href="<?php echo $eventmylinks; ?>" title="<?php echo JText::_('JEV_MYEVENTS'); ?>"> <b><?php echo JText::_('JEV_MYEVENTS'); ?></b> </a> <?php */ ?> </form> <?php } ?> </div> </div> <?php } } }