Exemplo n.º 1
0
 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');
     }
 }
Exemplo n.º 2
0
    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));
    }
Exemplo n.º 3
0
 function getAdjacentYear($year, $month, $day, $direction = 1)
 {
     $d1 = JevDate::mktime(0, 0, 0, $month, $day, $year + $direction);
     $day = JevDate::strftime("%d", $d1);
     $year = JevDate::strftime("%Y", $d1);
     $params = JComponentHelper::getParams(JEV_COM_COMPONENT);
     $cfg = JEVConfig::getInstance();
     if (method_exists("JEVHelper", "getMinYear")) {
         $earliestyear = JEVHelper::getMinYear();
         $latestyear = JEVHelper::getMaxYear();
     } else {
         $earliestyear = $params->get("com_earliestyear", 1970);
         $latestyear = $params->get("com_latestyear", 2150);
     }
     if ($year > $latestyear || $year < $earliestyear) {
         return false;
     }
     $month = JevDate::strftime("%m", $d1);
     $task = JRequest::getString('jevtask');
     $Itemid = JEVHelper::getItemid();
     if (isset($Itemid)) {
         $item = "&Itemid={$Itemid}";
     } else {
         $item = "";
     }
     return JRoute::_("index.php?option=" . JEV_COM_COMPONENT . "&task={$task}{$item}&year={$year}&month={$month}&day={$day}");
 }
Exemplo n.º 4
0
 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');
     }
 }
Exemplo n.º 5
0
 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));
     }
 }
Exemplo n.º 6
0
 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();
 }
Exemplo n.º 7
0
 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');
     }
 }
Exemplo n.º 8
0
 function getAdjacentYear($year, $month, $day, $direction = 1)
 {
     $d1 = JevDate::mktime(0, 0, 0, $month, $day, $year + $direction);
     $day = JevDate::strftime("%d", $d1);
     $year = JevDate::strftime("%Y", $d1);
     $cfg =& JEVConfig::getInstance();
     $earliestyear = $cfg->get('com_earliestyear');
     $latestyear = $cfg->get('com_latestyear');
     if ($year > $latestyear || $year < $earliestyear) {
         return false;
     }
     $month = JevDate::strftime("%m", $d1);
     $task = JRequest::getString('jevtask');
     $Itemid = JEVHelper::getItemid();
     if (isset($Itemid)) {
         $item = "&Itemid={$Itemid}";
     } else {
         $item = "";
     }
     return JRoute::_("index.php?option=" . JEV_COM_COMPONENT . "&task={$task}{$item}&year={$year}&month={$month}&day={$day}");
 }
Exemplo n.º 9
0
 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;
 }
Exemplo n.º 10
0
 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');
     }
 }
Exemplo n.º 11
0
 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');
     }
 }
Exemplo n.º 12
0
 function ical()
 {
     // Ensure authorised to do this
     $cfg = JEVConfig::getInstance();
     if ($cfg->get("disableicalexport", 0)) {
         JError::raiseError(403, JText::_('ALERTNOTAUTH'));
     }
     // Include mootools framework
     JHtml::_('behavior.framework', true);
     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 = "icals";
     $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('ical');
     $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');
     }
 }
Exemplo n.º 13
0
 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');
     }
 }
Exemplo n.º 14
0
    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));
    }
Exemplo n.º 15
0
<?php

defined('_JEXEC') or die('Restricted access');
$cfg =& JEVConfig::getInstance();
$this->data = $data = $this->datamodel->getDayData($this->year, $this->month, $this->day);
$cfg =& JEVConfig::getInstance();
$Itemid = JEVHelper::getItemid();
$cfg =& JEVConfig::getInstance();
$hasevents = false;
// previous and following month names and links
$followingDay = $this->datamodel->getFollowingDay($this->year, $this->month, $this->day);
$precedingDay = $this->datamodel->getPrecedingDay($this->year, $this->month, $this->day);
?>
<table class="maintable" align="center" cellpadding="0" cellspacing="0" width="100%">
	<tr>
		<td class="tableh1" colspan="3">
			<table border="0" cellpadding="0" cellspacing="0" width="100%">
				<tr> 
					<td><h2><?php 
echo JText::_('DAILY_VIEW');
?>
</h2></td>
					<td class="today" align="right"><?php 
echo JEventsHTML::getDateFormat($this->year, $this->month, $this->day, 0);
?>
</td>
				</tr>
			</table>
	  </td>
	</tr>
		<tr>
Exemplo n.º 16
0
 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;
 }
Exemplo n.º 17
0
 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();
 }
Exemplo n.º 18
0
 function calendarCell(&$currentDay, $year, $month, $i, $slot = "")
 {
     // pass $data by reference in order to update countdisplay
     $cfg = JEVConfig::getInstance();
     $Itemid = JEVHelper::getItemid();
     $event_day = $this->event->dup();
     $event_month = $this->event->mup();
     $id = $this->event->id();
     // this file controls the events component month calendar display cell output.  It is separated from the
     // showCalendar function in the events.php file to allow users to customize this portion of the code easier.
     // The event information to be displayed within a month day on the calendar can be modified, as well as any
     // overlay window information printed with a javascript mouseover event.  Each event prints as a separate table
     // row with a single column, within the month table's cell.
     // define start and end
     $cellStart = '<div';
     $cellStyle = 'padding:0;';
     $cellEnd = '</div>' . "\n";
     $linkStyle = "";
     // The title is printed as a link to the event's detail page
     $link = $this->event->viewDetailLink($year, $month, $currentDay['d0'], false);
     $link = JRoute::_($link . $this->_datamodel->getCatidsOutLink());
     $title = $this->event->title();
     // [mic] if title is too long, cut 'em for display
     $tmpTitle = $title;
     // set truncated title
     if (!isset($this->event->truncatedtitle)) {
         if (JString::strlen($title) >= $cfg->get('com_calCutTitle', 50)) {
             $tmpTitle = JString::substr($title, 0, $cfg->get('com_calCutTitle', 50)) . ' ...';
         }
         $tmpTitle = JEventsHTML::special($tmpTitle);
         $this->event->truncatedtitle = $tmpTitle;
     } else {
         $tmpTitle = $this->event->truncatedtitle;
     }
     // [new mic] if amount of displaing events greater than defined, show only a scmall coloured icon
     // instead of full text - the image could also be "recurring dependig", which means
     // for each kind of event (one day, multi day, last day) another icon
     // in this case the dfinition must moved down to be more flexible!
     // [tstahl] add a graphic symbol for all day events?
     $tmp_start_time = $this->start_time == $this->stop_time && !$this->event->noendtime() || $this->event->alldayevent() ? '' : $this->start_time;
     $templatedcell = false;
     // set truncated title
     if (!isset($this->event->truncatedtitle)) {
         $this->event->_title = $tmpTitle;
         $this->event->truncatedtitle = true;
     }
     if ($currentDay['countDisplay'] < $cfg->get('com_calMaxDisplay', 5)) {
         ob_start();
         $templatedcell = $this->loadedFromTemplate('month.calendar_cell', $this->event, 0);
         $res = ob_get_clean();
         if ($templatedcell) {
             $templatedcell = $res;
         } else {
             if ($this->_view) {
                 $this->_view->assignRef("link", $link);
                 $this->_view->assignRef("linkStyle", $linkStyle);
                 $this->_view->assignRef("tmp_start_time", $tmp_start_time);
                 $this->_view->assignRef("tmpTitle", $tmpTitle);
             }
             $title_event_link = $this->loadOverride("cellcontent");
             // allow fallback to old method
             if ($title_event_link == "") {
                 $title_event_link = "\n" . '<a class="cal_titlelink" href="' . $link . '" ' . $linkStyle . '>' . ($cfg->get('com_calDisplayStarttime') ? $tmp_start_time : '') . ' ' . $tmpTitle . '</a>' . "\n";
             }
             $cellStyle .= "border-left:8px solid " . $this->event->bgcolor() . ";padding-left:2px;";
         }
     } else {
         $eventIMG = '<img align="left" src="' . JURI::root() . 'components/' . JEV_COM_COMPONENT . '/images/event.png" alt="" style="height:12px;width:8px;border:1px solid white;background-color:' . $this->event->bgcolor() . '" />';
         $title_event_link = "\n" . '<a class="cal_titlelink" href="' . $link . '">' . $eventIMG . '</a>' . "\n";
         $cellStyle .= ' float:left;width:10px;';
     }
     $cellString = '';
     // allow template overrides for cell popups
     // only try override if we have a view reference
     if ($this->_view) {
         $this->_view->assignRef("ecc", $this);
         $this->_view->assignRef("cellDate", $currentDay["cellDate"]);
     }
     if ($cfg->get("com_enableToolTip", 1)) {
         if ($cfg->get("tooltiptype", 'overlib') == 'overlib') {
             $tooltip = $this->loadOverride("overlib");
             // allow fallback to old method
             if ($tooltip == "") {
                 $tooltip = $this->calendarCell_popup($currentDay["cellDate"]);
             }
             $cellString .= $tooltip;
         } else {
             // TT background
             if ($cfg->get('com_calTTBackground', 1) == '1') {
                 $bground = $this->event->bgcolor();
                 $fground = $this->event->fgcolor();
             } else {
                 $bground = "#000000";
                 $fground = "#ffffff";
             }
             JevHtmlBootstrap::popover('.hasjevtip', array("trigger" => "hover focus", "placement" => "top", "container" => "#jevents_body", "delay" => array("hide" => 150)));
             //$toolTipArray = array('className' => 'jevtip');
             //JHTML::_('behavior.tooltip', '.hasjevtip', $toolTipArray);
             $tooltip = $this->loadOverride("tooltip");
             // allow fallback to old method
             if ($tooltip == "") {
                 $tooltip = $this->calendarCell_tooltip($currentDay["cellDate"]);
             }
             if (strpos($tooltip, "templated") === 0) {
                 $title = JString::substr($tooltip, 9);
                 $cellString = "";
             } else {
                 $cellString .= '<div class="jevtt_text" >' . $tooltip . '</div>';
                 $title = '<div class="jevtt_title" style = "color:' . $fground . ';background-color:' . $bground . '">' . $this->title . '</div>';
             }
             if ($templatedcell) {
                 $templatedcell = str_replace("[[TOOLTIP]]", htmlspecialchars($title . $cellString, ENT_QUOTES), $templatedcell);
                 $templatedcell = str_replace("[[TOOLTIPTITLE]]", htmlspecialchars($title, ENT_QUOTES), $templatedcell);
                 $templatedcell = str_replace("[[TOOLTIPCONTENT]]", htmlspecialchars($cellString, ENT_QUOTES), $templatedcell);
                 $time = $cfg->get('com_calDisplayStarttime') ? $tmp_start_time : "";
                 $templatedcell = str_replace("[[EVTTIME]]", $time, $templatedcell);
                 return $templatedcell;
             }
             $html = $cellStart . ' style="' . $cellStyle . '">' . $this->tooltip($title, $cellString, $title_event_link) . $cellEnd;
             return $html;
         }
     }
     if ($templatedcell) {
         $templatedcell = str_replace("[[TOOLTIP]]", htmlspecialchars($title . $cellString, ENT_QUOTES), $templatedcell);
         $templatedcell = str_replace("[[TOOLTIPTITLE]]", htmlspecialchars($title, ENT_QUOTES), $templatedcell);
         $templatedcell = str_replace("[[TOOLTIPCONTENT]]", htmlspecialchars($cellString, ENT_QUOTES), $templatedcell);
         $time = $cfg->get('com_calDisplayStarttime') ? $tmp_start_time : "";
         $templatedcell = str_replace("[[EVTTIME]]", $time, $templatedcell);
         return $templatedcell;
     }
     // return the whole thing
     return $cellStart . ' style="' . $cellStyle . '" ' . $cellString . ">\n" . $title_event_link . $cellEnd;
 }
    function DefaultViewNavTableBarIconic($view, $today_date, $view_date, $dates, $alts, $option, $task, $Itemid)
    {
        $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;
        $cfg =& JEVConfig::getInstance();
        if (JRequest::getInt('pop', 0)) {
            return;
        }
        ?>
    	<div class="ev_navigation" style="width:100%">
    		<table  border="0" align="center" >
    			<tr align="center" valign="top">
    	    		<?php 
        if ($cfg->get('com_calUseIconic', 1) != 2 && $task != "range.listevents") {
            echo $this->_lastYearIcon($dates, $alts);
            echo $this->_lastMonthIcon($dates, $alts);
        }
        echo $this->_viewYearIcon($view_date);
        echo $this->_viewMonthIcon($view_date);
        echo $this->_viewWeekIcon($view_date);
        echo $this->_viewDayIcon($today_date);
        echo $this->_viewSearchIcon($view_date);
        echo $this->_viewJumptoIcon($view_date);
        if ($cfg->get('com_calUseIconic', 1) != 2 && $task != "range.listevents") {
            echo $this->_nextMonthIcon($dates, $alts);
            echo $this->_nextYearIcon($dates, $alts);
        }
        ?>
                </tr>
    			<tr class="icon_labels" align="center" valign="top">
    				<?php 
        if ($cfg->get('com_calUseIconic', 1) != 2 && $task != "range.listevents") {
            ?>
	        		<td colspan="2"></td>
	        		<?php 
        }
        ?>
    				<td><?php 
        echo JText::_('JEV_VIEWBYYEAR');
        ?>
</td>
    				<td><?php 
        echo JText::_('JEV_VIEWBYMONTH');
        ?>
</td>
    				<td><?php 
        echo JText::_('JEV_VIEWBYWEEK');
        ?>
</td>
    				<td><?php 
        echo JText::_('JEV_VIEWTODAY');
        ?>
</td>
    				<td><?php 
        echo JText::_('JEV_SEARCH_TITLE');
        ?>
</td>
    				<td><?php 
        echo JText::_('JEV_JUMPTO');
        ?>
</td>
    				<?php 
        if ($cfg->get('com_calUseIconic', 1) != 2 && $task != "range.listevents") {
            ?>
	        		<td colspan="2"></td>
	        		<?php 
        }
        ?>
                </tr>
                <?php 
        echo $this->_viewHiddenJumpto($view_date);
        ?>
            </table>
        </div>
		<?php 
    }
Exemplo n.º 20
0
 public static function getAdminItemid()
 {
     static $jevitemid;
     if (!isset($jevitemid)) {
         $jevitemid = 0;
         $menu = JFactory::getApplication()->getMenu();
         $active = $menu->getActive();
         if (!is_null($active) && $active->component == JEV_COM_COMPONENT && strpos($active->link, "admin.listevents") > 0) {
             $jevitemid = $active->id;
             return $jevitemid;
         } else {
             $jevitems = $menu->getItems("component", JEV_COM_COMPONENT);
             // TODO Check enclosing categories
             if (count($jevitems) > 0) {
                 $user = JFactory::getUser();
                 foreach ($jevitems as $jevitem) {
                     if (in_array($jevitem->access, JEVHelper::getAid($user, 'array'))) {
                         if (strpos($jevitem->link, "admin.listevents") > 0) {
                             $jevitemid = $jevitem->id;
                             return $jevitemid;
                         }
                     }
                 }
             }
         }
         $jevitemid = JEVHelper::getItemid();
     }
     return $jevitemid;
 }
Exemplo n.º 21
0
 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 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 
        }
    }
}
Exemplo n.º 23
0
 * JEvents Component for Joomla 1.5.x
 *
 * @version     $Id: edit.php 3229 2012-01-30 12:06:34Z geraintedwards $
 * @package     JEvents
 * @copyright   Copyright (C)  2008-2015 GWE Systems Ltd
 * @license     GNU/GPLv2, see http://www.gnu.org/licenses/gpl-2.0.html
 * @link        http://www.jevents.net
 */
defined('_JEXEC') or die('Restricted access');
global $task, $catid;
$db = JFactory::getDBO();
$editor = JFactory::getEditor();
// clean any existing cache files
$cache = JFactory::getCache(JEV_COM_COMPONENT);
$cache->clean(JEV_COM_COMPONENT);
$action = JFactory::getApplication()->isAdmin() ? "index.php" : "index.php?option=" . JEV_COM_COMPONENT . "&Itemid=" . JEVHelper::getItemid();
?>
<div id="jevents">
<form action="<?php 
echo $action;
?>
" method="post" name="adminForm"  accept-charset="UTF-8" enctype="multipart/form-data"  id="adminForm">
<table width="90%" border="0" cellpadding="2" cellspacing="2" class="adminform">
<tr><td>
<?php 
global $task;
if (isset($this->editItem->ics_id)) {
    $id = $this->editItem->ics_id;
    $catid = $this->editItem->catid;
    $access = $this->editItem->access;
    $srcURL = $this->editItem->srcURL;
Exemplo n.º 24
0
    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 
    }
Exemplo n.º 25
0
		else if (form.valid_dates.value =="0"){
			alert( "<?php 
echo JText::_("JEV_INVALID_DATES", true);
?>
");
		}
		else {
<?php 
// in case editor is toggled off - needed for TinyMCE
echo $this->editor->save('jevcontent');
// Do we have to check for conflicting events i.e. overlapping times etc. BUT ONLY FOR EVENTS INITIALLY
$params = JComponentHelper::getParams(JEV_COM_COMPONENT);
if ($params->get("checkclashes", 0) || $params->get("noclashes", 0)) {
    $checkURL = JURI::root() . "components/com_jevents/libraries/checkconflict.php";
    if (JEVHelper::getItemid() > 0) {
        $checkURL .= "?Itemid=" . JEVHelper::getItemid();
    }
    ?>
					// reformat start and end dates  to Y-m-d format
					reformatStartEndDates();
					checkConflict('<?php 
    echo $checkURL;
    ?>
',pressbutton, '<?php 
    echo JSession::getFormToken();
    ?>
', '<?php 
    echo JFactory::getApplication()->isAdmin() ? 'administrator' : 'site';
    ?>
', <?php 
    echo $this->repeatId;
 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;
     }
 }
Exemplo n.º 27
0
 function savefuture()
 {
     // experimentaal code disabled for count (startthe time being
     throw new Exception(JText::_('ALERTNOTAUTH'), 403);
     return false;
     if (!JEVHelper::isEventCreator()) {
         throw new Exception(JText::_('ALERTNOTAUTH'), 403);
         return false;
     }
     // clean out the cache
     $cache = JFactory::getCache('com_jevents');
     $cache->clean(JEV_COM_COMPONENT);
     echo "<pre>";
     $rpid = JRequest::getInt("rp_id", 0);
     $event = $this->queryModel->listEventsById($rpid, 1, "icaldb");
     $data = array();
     foreach (get_object_vars($event) as $key => $val) {
         if (strpos($key, "_") == 0) {
             $data[substr($key, 1)] = $val;
         }
     }
     echo var_export($data, true);
     echo "\n\n";
     // Change the underlying event repeat rule details  !!
     $query = "SELECT * FROM #__jevents_rrule WHERE rr_id=" . $event->_rr_id;
     $db = JFactory::getDBO();
     $db->setQuery($query);
     $this->rrule = null;
     $this->rrule = $db->loadObject();
     $this->rrule = iCalRRule::iCalRRuleFromDB(get_object_vars($this->rrule));
     echo var_export($this->rrule, true);
     // TODO *** I must save the modified repeat rule
     // Create the copy of the event and reset the repeat rule to the new values
     foreach ($this->rrule->data as $key => $val) {
         $key = "_" . $key;
         $event->{$key} = $val;
     }
     $event->eventid = 0;
     $event->ev_id = 0;
     // create copy of rrule by resetting id and saving
     $this->rrule->rr_id = 0;
     $this->rrule->eventid = 0;
     if (intval($this->rrule->until) > 0) {
         // The until date is in the future so no need to do anything here
     } else {
         // count prior matching repetition
         $query = "SELECT count(startrepeat) FROM #__jevents_repetition WHERE eventid=" . $repeatdata->eventid . " AND startrepeat<'" . $repeatdata->startrepeat;
         $db->setQuery($query);
         $countrepeat = $db->loadResult();
         $this->rrule->count -= $countrepeat;
     }
     //$this->rrule->store();
     $event->_rr_id = $this->rrule->rr_id;
     //I must copy the event detail and its id too
     $eventDetail = new iCalEventDetail($db);
     $eventDetail->load($event->_eventdetail_id);
     $eventDetail->evdet_id = 0;
     $eventDetail->store();
     $event->_detail_id = $eventDetail->evdet_id;
     $event->_eventdetail_id = $eventDetail->evdet_id;
     // TODO I must now regenerate the repetitions
     $event->_rp_id = 0;
     $event->store();
     echo "</pre>";
     // TODO I must store a copy of the event id in the rrule table
     exit;
     // now delete exising current and future repeats - this resets the rrule for the truncated event
     $this->_deleteFuture();
     if (JFactory::getApplication()->isAdmin()) {
         $this->setRedirect('index.php?option=' . JEV_COM_COMPONENT . '&task=icalrepeat.list&cid[]=' . $rpt->eventid, "" . JText::_("JEV_ICAL_RPT_UPDATED") . "");
     } else {
         list($year, $month, $day) = JEVHelper::getYMD();
         $rettask = JRequest::getString("rettask", "day.listevents");
         $this->setRedirect('index.php?option=' . JEV_COM_COMPONENT . "&task={$rettask}&evid=" . $rpt->rp_id . "&Itemid=" . JEVHelper::getItemid() . "&year={$year}&month={$month}&day={$day}", "" . JText::_("JEV_ICAL_RPT_UPDATED") . "");
     }
 }
Exemplo n.º 28
0
 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');
     }
 }
Exemplo n.º 29
0
 function viewDetailLink($year, $month, $day, $sef = true, $Itemid = 0)
 {
     $Itemid = $Itemid > 0 ? $Itemid : JEVHelper::getItemid($this);
     $title = JApplication::stringURLSafe($this->title());
     $link = "index.php?option=" . JEV_COM_COMPONENT . "&task=" . $this->detailTask() . "&evid=" . $this->id() . '&Itemid=' . $Itemid . "&year={$year}&month={$month}&day={$day}";
     if (JRequest::getCmd("tmpl", "") == "component" && JRequest::getCmd('task', 'selectfunction') != 'icalevent.select' && JRequest::getCmd("option", "") != "com_acymailing" && JRequest::getCmd("option", "") != "com_jnews" && JRequest::getCmd("jevtask", "") != "crawler.listevents") {
         $link .= "&tmpl=component";
     }
     $link = $sef ? JRoute::_($link) : $link;
     return $link;
 }
Exemplo n.º 30
0
 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 = isset($this->myItemid) ? $this->myItemid : JEVHelper::getItemid();
     $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 = "";
     $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++;
         }
     }
     // special case where params are not yet saved
     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}";
         }
         include_once JPATH_ADMINISTRATOR . "/components/" . JEV_COM_COMPONENT . "/libraries/colorMap.php";
         switch ($style) {
             case 'list':
                 $content = "<div class=\"event_legend_container\"><ul class=\"event_legend_list\">";
                 foreach ($allrows as $row) {
                     if (isset($row->activeBranch)) {
                         $content .= $this->listKids($row, $itm, $tsk, $availableCatsIds);
                     }
                 }
                 $content .= "</ul></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;
     }
 }