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 DefaultdateFormattedDateRange($view) { $params = JComponentHelper::getParams(JEV_COM_COMPONENT); if ($params->get("daterangeformat", "") == "") { $return = JEventsHTML::getDateFormat($view->startyear, $view->startmonth, $view->startday, 1) . " - " . JEventsHTML::getDateFormat($view->endyear, $view->endmonth, $view->endday, 1); } else { $return = $params->get("daterangeformat", ""); $startmatches = array(); preg_match_all('|{START(.*?)}|', $return, $startmatches); if (count($startmatches) == 2 && count($startmatches[1]) == 1) { $replace = str_replace(array("(", ")"), "", $startmatches[1][0]); $datestp = JevDate::mktime(0, 0, 0, $view->startmonth, $view->startday, $view->startyear); $replace = JEV_CommonFunctions::jev_strftime($replace, $datestp); $return = str_replace($startmatches[0][0], $replace, $return); } $endmatches = array(); preg_match_all('|{END(.*?)}|', $return, $endmatches); if (count($endmatches) == 2 && count($endmatches[1]) == 1) { $replace = str_replace(array("(", ")"), "", $endmatches[1][0]); $datestp = JevDate::mktime(0, 0, 0, $view->endmonth, $view->endday, $view->endyear); $replace = JEV_CommonFunctions::jev_strftime($replace, $datestp); $return = str_replace($endmatches[0][0], $replace, $return); } //$return = $params->get("daterangeformat", ""); } return $return; }
function __construct($config = null) { parent::__construct($config); jimport('joomla.filesystem.file'); if (JevJoomlaVersion::isCompatible("3.0")) { JEVHelper::stylesheet('eventsadmin.css', 'components/' . JEV_COM_COMPONENT . '/assets/css/'); } else { JEVHelper::stylesheet('eventsadminjq.css', 'components/' . JEV_COM_COMPONENT . '/assets/css/'); } $this->_addPath('template', $this->_basePath . '/' . 'views' . '/' . 'abstract' . '/' . 'tmpl'); // note that the name config variable is ignored in the parent construct! if (JevJoomlaVersion::isCompatible("2.5")) { // Ok getTemplate doesn't seem to get the active menu item's template, so lets do it ourselves if it exists $app = JFactory::getApplication(); // Get current template style ID $page_template_id = $app->isAdmin() ? "0" : @$app->getMenu()->getActive()->template_style_id; // Check it's a valid style with simple check if (!($page_template_id == "" || $page_template_id == "0")) { // Load the valid style: $db = JFactory::getDbo(); $query = $db->getQuery(true)->select('template')->from('#__template_styles')->where('id =' . $db->quote($page_template_id) . ''); $db->setQuery($query); $template = $db->loadResult(); } else { $template = JFactory::getApplication()->getTemplate(); } $theme = JEV_CommonFunctions::getJEventsViewName(); $name = $this->getName(); $name = str_replace($theme . "/", "", $name); $this->addTemplatePath(JPATH_BASE . '/' . 'templates' . '/' . $template . '/' . 'html' . '/' . JEV_COM_COMPONENT . '/' . $theme . '/' . $name); // or could have used //$this->addTemplatePath( JPATH_BASE.'/'.'templates'.'/'.JFactory::getApplication()->getTemplate().'/'.'html'.'/'.JEV_COM_COMPONENT.'/'.$config['name'] ); } }
public function getOptions() { // Must load admin language files $lang = JFactory::getLanguage(); $lang->load("com_jevents", JPATH_ADMINISTRATOR); $views = array(); include_once JPATH_ADMINISTRATOR . "/components/com_jevents/jevents.defines.php"; $exceptions_values = (string) $this->element['except'] ? (string) $this->element['except'] : ""; $exceptions = array(); $exceptions = explode(',', $exceptions_values); foreach (JEV_CommonFunctions::getJEventsViewList((string) $this->element["viewtype"]) as $viewfile) { if (in_array($viewfile, $exceptions)) { continue; } $views[] = JHTML::_('select.option', $viewfile, $viewfile); } sort($views); if ($this->menu != 'hide') { $task = JRequest::getVar('task'); if ($task == "params.edit") { unset($views['global']); } else { array_unshift($views, JHTML::_('select.option', 'global', JText::_('USE_GLOBAL'))); } } return $views; }
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 __construct($config = null) { parent::__construct($config); $this->_addPath('template', $this->_basePath . DS . 'views' . DS . 'abstract' . DS . 'tmpl'); // note that the name config variable is ignored in the parent construct! if (JVersion::isCompatible("2.5")) { $theme = JEV_CommonFunctions::getJEventsViewName(); $this->addTemplatePath(JPATH_BASE . DS . 'templates' . DS . JFactory::getApplication()->getTemplate() . DS . 'html' . DS . JEV_COM_COMPONENT . DS . $theme . DS . $this->getName()); // or could have used //$this->addTemplatePath( JPATH_BASE.DS.'templates'.DS.JFactory::getApplication()->getTemplate().DS.'html'.DS.JEV_COM_COMPONENT.DS.$config['name'] ); } }
function getViewClass($theme, $module, $layout, $params = false) { // If we have a specified over ride then use it here if ($params && strlen($params->get("layout", "")) > 0) { $speciallayout = strtolower($params->get("layout", "")); // Build the template and base path for the layout $tPath = JPATH_SITE . '/' . 'templates' . '/' . JFactory::getApplication()->getTemplate() . '/' . 'html' . '/' . $module . '/' . $theme . '/' . $speciallayout . '.php'; // If the template has a layout override use it if (file_exists($tPath)) { $viewclass = "Override" . ucfirst($theme) . "ModCalView" . ucfirst($speciallayout); require_once $tPath; if (class_exists($viewclass)) { return $viewclass; } } } if ($layout == "" || $layout == "global") { $layout = JEV_CommonFunctions::getJEventsViewName(); } // Build the template and base path for the layout $tPath = JPATH_SITE . '/' . 'templates' . '/' . JFactory::getApplication()->getTemplate() . '/' . 'html' . '/' . $module . '/' . $layout . '.php'; $bPath = JPATH_SITE . '/' . 'modules' . '/' . $module . '/' . 'tmpl' . '/' . $layout . '.php'; jimport('joomla.filesystem.file'); // If the template has a layout override use it if (JFile::exists($tPath)) { require_once $tPath; $viewclass = "Override" . ucfirst($theme) . "ModCalView"; if (class_exists($viewclass)) { return $viewclass; } else { // fall back to badly declared template override! $viewclass = ucfirst($theme) . "ModCalView"; if (class_exists($viewclass)) { return $viewclass; } } } if (JFile::exists($bPath)) { require_once $bPath; $viewclass = ucfirst($theme) . "ModCalView"; return $viewclass; } else { echo "<strong>" . JText::sprintf("JEV_PLEASE_REINSTALL_LAYOUT", $theme) . "</strong>"; $bPath = JPATH_SITE . '/' . 'modules' . '/' . $module . '/' . 'tmpl' . '/' . 'default' . '/' . 'calendar.php'; require_once $bPath; $viewclass = "DefaultModCalView"; return $viewclass; } }
public function getOptions() { // Must load admin language files $lang =& JFactory::getLanguage(); $lang->load("com_jevents", JPATH_ADMINISTRATOR); $views = array(); include_once JPATH_ADMINISTRATOR . "/components/com_jevents/jevents.defines.php"; foreach (JEV_CommonFunctions::getJEventsViewList() as $viewfile) { $views[] = JHTML::_('select.option', $viewfile, $viewfile); } sort($views); if ($this->menu != 'hide') { array_unshift($views, JHTML::_('select.option', '', JText::_('USE_GLOBAL'))); } return $views; }
function __construct($config = array()) { if (!isset($config['base_path'])) { $config['base_path'] = JEV_PATH; } parent::__construct($config); // TODO get this from config $this->registerDefaultTask('calendar'); $cfg =& JEVConfig::getInstance(); $theme = ucfirst(JEV_CommonFunctions::getJEventsViewName()); JLoader::register('JEvents' . ucfirst($theme) . 'View', JEV_VIEWS . "/" . $theme . "/abstract/abstract.php"); include_once JEV_LIBS . "/modfunctions.php"; if (!isset($this->_basePath) && JVersion::isCompatible("1.6.0")) { $this->_basePath = $this->basePath; $this->_task = $this->task; } }
function fetchElement($name, $value, &$node, $control_name) { // Must load admin language files $lang = JFactory::getLanguage(); $lang->load("com_jevents", JPATH_ADMINISTRATOR); $views = array(); include_once JPATH_ADMINISTRATOR . "/components/com_jevents/jevents.defines.php"; foreach (JEV_CommonFunctions::getJEventsViewList() as $viewfile) { $views[] = JHTML::_('select.option', $viewfile, $viewfile); $load = $lang->load("com_jevents", JPATH_SITE . "/components/com_jevents/views/" . $viewfile . "/assets"); } sort($views); if ($node->attributes('menu') != 'hide') { array_unshift($views, JHTML::_('select.option', '', JText::_('USE_GLOBAL'))); } return JHTML::_('select.genericlist', $views, '' . $control_name . '[' . $name . ']', '', 'value', 'text', $value, $control_name . $name); }
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 DefaultEventsLegend($view) { $cfg =& JEVConfig::getInstance(); $theme = JEV_CommonFunctions::getJEventsViewName(); $modpath = JModuleHelper::getLayoutPath('mod_jevents_legend', $theme . DS . "legend"); if (!file_exists($modpath)) { return; } // load the helper class require_once JPATH_SITE . '/modules/mod_jevents_legend/helper.php'; require_once $modpath; $viewclass = ucfirst($theme) . "ModLegendView"; $module = JModuleHelper::getModule("mod_jevents_legend", false); $params = new JParameter($module->params); $modview = new $viewclass($params, $module->id); echo $modview->displayCalendarLegend("block"); echo "<br style='clear:both'/>"; }
function __construct($config = null) { parent::__construct($config); jimport('joomla.filesystem.file'); if (JevJoomlaVersion::isCompatible("3.0")) { JEVHelper::stylesheet('eventsadmin.css', 'components/' . JEV_COM_COMPONENT . '/assets/css/'); } else { JEVHelper::stylesheet('eventsadmin16.css', 'components/' . JEV_COM_COMPONENT . '/assets/css/'); } $this->_addPath('template', $this->_basePath . '/' . 'views' . '/' . 'abstract' . '/' . 'tmpl'); // note that the name config variable is ignored in the parent construct! if (JevJoomlaVersion::isCompatible("2.5")) { $theme = JEV_CommonFunctions::getJEventsViewName(); $this->addTemplatePath(JPATH_BASE . '/' . 'templates' . '/' . JFactory::getApplication()->getTemplate() . '/' . 'html' . '/' . JEV_COM_COMPONENT . '/' . $theme . '/' . $this->getName()); // or could have used //$this->addTemplatePath( JPATH_BASE.'/'.'templates'.'/'.JFactory::getApplication()->getTemplate().'/'.'html'.'/'.JEV_COM_COMPONENT.'/'.$config['name'] ); } }
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 results() { list($year, $month, $day) = JEVHelper::getYMD(); $Itemid = JEVHelper::getItemid(); $db =& JFactory::getDBO(); $keyword = $db->getEscaped(JRequest::getVar('keyword', '')); // 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->getValue("com_calEventListRowsPpg", 15))); $document =& JFactory::getDocument(); $viewType = $document->getType(); $cfg =& JEVConfig::getInstance(); $theme = JEV_CommonFunctions::getJEventsViewName(); $view = "search"; $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('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(); $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'); $uri = JURI::getInstance(); $url = $uri->toString(); $cache->get($this->view, 'display', base64_encode($keyword . $Itemid . $limit . $limitstart . $month . $day . $year . $url)); } }
function DefaultEventsLegend($view) { $cfg = JEVConfig::getInstance(); if ($cfg->get('com_calShowLegend', 1) == 1) { $theme = JEV_CommonFunctions::getJEventsViewName(); $modpath = JModuleHelper::getLayoutPath('mod_jevents_legend', $theme . '/' . "legend"); if (!file_exists($modpath) || !file_exists(JPATH_SITE . '/modules/mod_jevents_legend/helper.php')) { return; } // load the helper class require_once JPATH_SITE . '/modules/mod_jevents_legend/helper.php'; require_once $modpath; $viewclass = ucfirst($theme) . "ModLegendView"; $module = JModuleHelper::getModule("mod_jevents_legend", false); $params = new JRegistry($module->params); $modview = new $viewclass($params, $module->id); echo $modview->displayCalendarLegend("block"); echo "<br style='clear:both;height:0px;line-height:0px;'/>"; } else { //Do nothing } }
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 bgcolor($val = "") { if (JString::strlen($val) == 0) { if (!isset($this->_bgcolor)) { $this->_bgcolor = JEV_CommonFunctions::setColor($this); } return $this->_bgcolor; } else { $this->_bgcolor = $val; } }
function ProcessRequest(&$requestObject, $returnData) { define("REQUESTOBJECT", serialize($requestObject)); define("RETURNDATA", serialize($returnData)); require_once JPATH_BASE . DS . 'includes' . DS . 'defines.php'; require_once JPATH_BASE . DS . 'includes' . DS . 'framework.php'; $requestObject = unserialize(REQUESTOBJECT); $returnData = unserialize(RETURNDATA); $returnData->allclear = 1; ini_set("display_errors", 0); global $option; $client = "site"; if (isset($requestObject->client) && in_array($requestObject->client, array("site", "administrator"))) { $client = $requestObject->client; } $mainframe = JFactory::getApplication($client); JFactory::getApplication()->initialise(); $option = "com_jevents"; // Not sure why this is needed but it is if (use use $mainframe =& JFactory::getApplication($client); )!!! // needed for Joomla 1.5 plugins $GLOBALS['mainframe'] = $mainframe; $lang =& JFactory::getLanguage(); $lang->load("com_jevents", JPATH_SITE); $lang->load("com_jevents", JPATH_ADMINISTRATOR); include_once JPATH_SITE . "/components/com_jevents/jevents.defines.php"; $params =& JComponentHelper::getParams("com_jevents"); if (!$params->get("checkclashes", 0) && !$params->get("noclashes", 0)) { return $returnData; } // Enforce referrer if (!$params->get("skipreferrer", 0)) { if (!array_key_exists("HTTP_REFERER", $_SERVER)) { throwerror("There was an error"); } $live_site = $_SERVER['HTTP_HOST']; $ref_parts = parse_url($_SERVER["HTTP_REFERER"]); if (!isset($ref_parts["host"]) || $ref_parts["host"] . (isset($ref_parts["port"]) ? ':' . $ref_parts["port"] : '') != $live_site) { throwerror("There was an error - missing host in referrer"); } } if ($params->get("icaltimezonelive", "") != "" && is_callable("date_default_timezone_set") && $params->get("icaltimezonelive", "") != "") { $timezone = date_default_timezone_get(); $tz = $params->get("icaltimezonelive", ""); date_default_timezone_set($tz); $registry =& JRegistry::getInstance("jevents"); $registry->setValue("jevents.timezone", $timezone); } $token = JUtility::getToken(); if (!isset($requestObject->token) || $requestObject->token != $token) { throwerror("There was an error - bad token. Please refresh the page and try again."); } $user = JFactory::getUser(); if (!JEVHelper::isEventCreator()) { throwerror("There was an error"); } if (intval($requestObject->formdata->evid) > 0) { $db = JFactory::getDBO(); $dataModel = new JEventsDataModel("JEventsAdminDBModel"); $queryModel = new JEventsDBModel($dataModel); $event = $queryModel->getEventById(intval($requestObject->formdata->evid), 1, "icaldb"); //$db->setQuery("SELECT * FROM #__jevents_vevent where ev_id=".intval($requestObject->formdata->evid)); // $event = $db->loadObject(); if (!$event || !JEVHelper::canEditEvent($event)) { throwerror("There was an error"); } } $returnData->overlaps = array(); if ($requestObject->pressbutton == "icalrepeat.apply" || $requestObject->pressbutton == "icalrepeat.save") { $testrepeat = simulateSaveRepeat($requestObject); // now we have out event and its repetitions we now check to see for overlapping events $overlaps = checkRepeatOverlaps($testrepeat, $returnData, intval($requestObject->formdata->evid), $requestObject); } else { $testevent = simulateSaveEvent($requestObject); // now we have out event and its repetitions we now check to see for overlapping events $overlaps = checkEventOverlaps($testevent, $returnData, intval($requestObject->formdata->evid), $requestObject); } if (count($overlaps) > 0) { $returnData->allclear = 0; foreach ($overlaps as $olp) { $overlap = new stdClass(); $overlap->event_id = $olp->eventid; $overlap->eventdetail_id = $olp->eventdetail_id; $overlap->summary = $olp->summary; $overlap->rp_id = $olp->rp_id; $overlap->startrepeat = $olp->startrepeat; $overlap->endrepeat = $olp->endrepeat; list($y, $m, $d, $h, $m, $d) = sscanf($olp->startrepeat, "%d-%d-%d %d:%d:%d"); $tstring = JText::_("JEV_OVERLAP_MESSAGE"); $overlap->conflictMessage = sprintf($tstring, $olp->summary, JEV_CommonFunctions::jev_strftime(JText::_("DATE_FORMAT_4"), JevDate::strtotime($olp->startrepeat)), JEV_CommonFunctions::jev_strftime(JText::_("DATE_FORMAT_4"), JevDate::strtotime($olp->endrepeat)), $olp->conflictCause); $overlap->conflictMessage = addslashes($overlap->conflictMessage); $overlap->url = JURI::root() . "index.php?option=com_jevents&task=icalrepeat.detail&evid=" . $olp->rp_id . "&year={$y}&month={$m}&day={$d}"; $overlap->url = str_replace("components/com_jevents/libraries/", "", $overlap->url); $returnData->overlaps[] = $overlap; } } if ($requestObject->error) { $returnData->allclear = 0; return "Error"; } return $returnData; }
if ($cfg->get("show_webcal_google", 0) == 1) { echo $this->ExportGoogle($publiclink, $privatelink); } } if ($cfg->get("outlook2003icalexport", 0) == 0 && $cfg->get("show_ical_download", 1) == 0 && $cfg->get("show_webcal_url", 0) == 0 && $cfg->get("show_webcal_google", 0) && $cfg->get("outlook2003icalexport", 0)) { //If non are enabled we don't want to have user thinking the script is buggy as nothing is produced. echo "<div style='margin:15px;font-weight:bold;'>" . JText::_("JEV_ICAL_ALL_DISABLED") . "</div>"; } else { ?> <div class="export_form"> <form id="ical" name="ical" method="post" class="<?php isset($_POST['submit']) ? 'icalexportresults' : ''; ?> "> <?php $categories = JEV_CommonFunctions::getCategoryData(); ?> <div class='choosecat' style='float:left;width:300px;'> <?php echo "<h3>" . JText::_('JEV_EVENT_CHOOSE_CATEG') . "</h3>\n"; // All categories $cb = "<input name=\"categories[]\" value=\"0\" type=\"checkbox\" onclick='clearIcalCategories(this);' "; $checked = false; if (!JRequest::getVar('categories', 0, 'POST')) { $cb = $cb . " CHECKED"; $checked = true; } else { if (JRequest::getVar('categories', 0, 'POST') && in_array(0, JRequest::getVar('categories', '', 'POST'))) { $cb = $cb . " CHECKED"; $checked = true; }
?> </th> </tr> <?php $k = 0; $nullDate = $db->getNullDate(); for ($i = 0, $n = count($this->rows); $i < $n; $i++) { $row =& $this->rows[$i]; ?> <tr class="row<?php echo $k; ?> "> <td width="20" style="background-color:<?php echo JEV_CommonFunctions::setColor($row); ?> "> <?php echo JHtml::_('grid.id', $i, $row->id()); ?> </td> <td > <a href="#edit" onclick="return listItemTask('cb<?php echo $i; ?> ','icalevent.edit')" title="<?php echo JText::_('JEV_CLICK_TO_EDIT'); ?> "><?php echo $row->title();
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 getTheme() { $theme = JEV_CommonFunctions::getJEventsViewName(); return $theme; }
/** * Cloaks html link whith javascript * * @param string $url The cloaking URL * @param string $text The link text * @param array $attribs additional attributes * @return string HTML */ function jEventsLinkCloaking($url = '', $text = '', $attribs = array()) { static $linkCloaking; if (!isset($linkCloaking)) { $cfg =& JEVConfig::getInstance(); $linkCloaking = $cfg->get('com_linkcloaking', 0); } if (!is_array($attribs)) { $attribs = array(); } if ($linkCloaking) { $cloakattribs = array('onclick' => '"window.location.href=\'' . JRoute::_($url) . '\';return false;"'); return JEV_CommonFunctions::jEventsDoLink("", $text, array_merge($cloakattribs, $attribs)); } else { return JEV_CommonFunctions::jEventsDoLink(JRoute::_($url), "{$text}", $attribs); } }
echo $tabs->endPanel(); } } $haslayouts = false; foreach (JEV_CommonFunctions::getJEventsViewList() as $viewfile) { $config = JPATH_SITE . "/components/" . JEV_COM_COMPONENT . "/views/" . $viewfile . "/config.xml"; if (file_exists($config)) { $haslayouts = true; } } if ($haslayouts) { echo $tabs->startPanel(JText::_("CLUB_LAYOUTS"), "CLUB_LAYOUTS"); echo $tabs->startPane('layouts'); } // Now get layout specific parameters foreach (JEV_CommonFunctions::getJEventsViewList() as $viewfile) { $config = JPATH_SITE . "/components/" . JEV_COM_COMPONENT . "/views/" . $viewfile . "/config.xml"; if (file_exists($config)) { $viewparams = new JevParameter($this->params->toString(), $config); echo $tabs->startPanel(JText::_(ucfirst($viewfile)), 'config_' . str_replace(" ", "_", $viewfile)); echo $viewparams->render(); echo $tabs->endPanel(); } } if ($haslayouts) { echo $tabs->endPanel(); echo $tabs->endPane(); } echo $tabs->endPane(); } else { echo $this->params->render();
protected function toggleICalEventPublish($cid, $newstate) { // clean out the cache $cache =& JFactory::getCache('com_jevents'); $cache->clean(JEV_COM_COMPONENT); // Must be at least an event creator to publish events $is_event_editor = JEVHelper::isEventPublisher(); if (!$is_event_editor) { if (is_array($cid)) { foreach ($cid as $id) { if (!JEVHelper::canPublishOwnEvents($id)) { JError::raiseError(403, JText::_('ALERTNOTAUTH')); } } } $is_event_editor = true; } if (!$is_event_editor) { JError::raiseError(403, JText::_('ALERTNOTAUTH')); } $db =& JFactory::getDBO(); foreach ($cid as $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::canPublishEvent($event)) { JError::raiseError(403, JText::_('ALERTNOTAUTH')); } $sql = "UPDATE #__jevents_vevent SET state={$newstate} where ev_id='" . $id . "'"; $db->setQuery($sql); $db->query(); $params = JComponentHelper::getParams(JEV_COM_COMPONENT); if ($newstate == 1 && $params->get("com_notifyauthor", 0) && !$event->_author_notified) { $sql = "UPDATE #__jevents_vevent SET author_notified=1 where ev_id='" . $id . "'"; $db->setQuery($sql); $db->query(); JEV_CommonFunctions::notifyAuthorPublished($event); } } // I also need to trigger any onpublish event triggers $dispatcher =& JDispatcher::getInstance(); // just incase we don't have jevents plugins registered yet JPluginHelper::importPlugin("jevents"); $res = $dispatcher->trigger('onPublishEvent', array($cid, $newstate)); if (JFactory::getApplication()->isAdmin()) { $this->setRedirect('index.php?option=' . JEV_COM_COMPONENT . '&task=icalevent.list', "IcalEvent : New published state Saved"); } else { $Itemid = JRequest::getInt("Itemid"); list($year, $month, $day) = JEVHelper::getYMD(); $rettask = JRequest::getString("rettask", "day.listevents"); // Don't return to the event detail since we may be filtering on published state! //$this->setRedirect( JRoute::_('index.php?option=' . JEV_COM_COMPONENT. "&task=icalrepeat.detail&evid=$id&year=$year&month=$month&day=$day&Itemid=$Itemid",false),"IcalEvent : New published state Saved"); $this->setRedirect(JRoute::_('index.php?option=' . JEV_COM_COMPONENT . "&task={$rettask}&year={$year}&month={$month}&day={$day}&Itemid={$Itemid}", false), "IcalEvent : New published state Saved"); } }
require_once dirname(__FILE__) . '/' . 'helper.php'; $jevhelper = new modJeventsCalHelper(); JPluginHelper::importPlugin("jevents"); // record what is running - used by the filters $registry = JRegistry::getInstance("jevents"); $registry->set("jevents.activeprocess", "mod_jevents_cal"); $registry->set("jevents.moduleid", $module->id); $registry->set("jevents.moduleparams", $params); // See http://www.php.net/manual/en/timezones.php $compparams = JComponentHelper::getParams(JEV_COM_COMPONENT); $tz = $compparams->get("icaltimezonelive", ""); if ($tz != "" && is_callable("date_default_timezone_set")) { $timezone = date_default_timezone_get(); // echo "timezone is ".$timezone."<br/>"; date_default_timezone_set($tz); $registry->set("jevents.timezone", $timezone); } $theme = JEV_CommonFunctions::getJEventsViewName(); $modtheme = $params->get("com_calViewName", $theme); if ($modtheme == "global" || $modtheme == "") { $modtheme = $theme; } $theme = $modtheme; $viewclass = $jevhelper->getViewClass($theme, 'mod_jevents_cal', $theme . '/' . "calendar", $params); $modview = new $viewclass($params, $module->id); $modview->jevlayout = $theme; echo $modview->getCal(); // Must reset the timezone back!! if ($tz && is_callable("date_default_timezone_set")) { date_default_timezone_set($timezone); }
// redirect to crawler menu item $Itemid = $params->get("robotmenuitem", 0); JFactory::getApplication()->redirect(JRoute::_("index.php?option=com_jevents&task=crawler.listevents&Itemid={$Itemid}")); } } //list($usec, $sec) = explode(" ", microtime()); //$starttime = (float) $usec + (float) $sec; //list ($usec, $sec) = explode(" ", microtime()); //$time_end = (float) $usec + (float) $sec; //echo "JEvents before importPlugin = ".round($time_end - $starttime, 4)."<br/>"; JPluginHelper::importPlugin("jevents"); //list ($usec, $sec) = explode(" ", microtime()); //$time_end = (float) $usec + (float) $sec; //echo "JEvents after importPlugin = ".round($time_end - $starttime, 4)."<br/>"; // Make sure the view specific language file is loaded JEV_CommonFunctions::loadJEventsViewLang(); // Set the name for the controller and instantiate it $controllerClass = ucfirst($controllerName) . 'Controller'; if (class_exists($controllerClass)) { $controller = new $controllerClass(); } else { JFactory::getApplication()->enqueueMessage('Invalid Controller Class - ' . $controllerClass); $cmd = "month.calendar"; list($controllerName, $task) = explode('.', $cmd); JRequest::setVar("jevtask", $cmd); JRequest::setVar("jevcmd", $cmd); $controllerClass = ucfirst($controllerName) . 'Controller'; $controllerPath = JPATH_COMPONENT . '/' . 'controllers' . '/' . $controllerName . '.php'; require_once $controllerPath; $controller = new $controllerClass(); }
/** * List Icals * */ function overview() { // get the view $this->view =& $this->getView("icals", "html"); $this->_checkValidCategories(); $option = JEV_COM_COMPONENT; $db =& JFactory::getDBO(); $catid = intval(JFactory::getApplication()->getUserStateFromRequest("catid{$option}", 'catid', 0)); $limit = intval(JFactory::getApplication()->getUserStateFromRequest("viewlistlimit", 'limit', 10)); $limitstart = intval(JFactory::getApplication()->getUserStateFromRequest("view{$option}limitstart", 'limitstart', 0)); $search = JFactory::getApplication()->getUserStateFromRequest("search{$option}", 'search', ''); $search = $db->getEscaped(trim(strtolower($search))); $where = array(); if ($search) { $where[] = "LOWER(icsf.label) LIKE '%{$search}%'"; } if ($catid > 0) { $where[] = "catid = {$catid}"; } // get the total number of records $query = "SELECT count(*)" . "\n FROM #__jevents_icsfile AS icsf" . (count($where) ? "\n WHERE " . implode(' AND ', $where) : ''); $db->setQuery($query); $total = $db->loadResult(); echo $db->getErrorMsg(); if ($limitstart > $total) { $limitstart = 0; } if (JVersion::isCompatible("1.6.0")) { $query = "SELECT icsf.*, a.title as _groupname" . "\n FROM #__jevents_icsfile as icsf " . "\n LEFT JOIN #__viewlevels AS a ON a.id = icsf.access" . (count($where) ? "\n WHERE " . implode(' AND ', $where) : ''); } else { $query = "SELECT icsf.*, g.name AS _groupname" . "\n FROM #__jevents_icsfile as icsf " . "\n LEFT JOIN #__groups AS g ON g.id = icsf.access" . (count($where) ? "\n WHERE " . implode(' AND ', $where) : ''); } $query .= "\n ORDER BY icsf.isdefault DESC, icsf.label ASC"; if ($limit > 0) { $query .= "\n LIMIT {$limitstart}, {$limit}"; } $db->setQuery($query); $rows = $db->loadObjectList(); $catData = JEV_CommonFunctions::getCategoryData(); for ($s = 0; $s < count($rows); $s++) { $row =& $rows[$s]; if (array_key_exists($row->catid, $catData)) { $row->category = $catData[$row->catid]->name; } else { $row->category = "?"; } } if ($this->_debug) { echo '[DEBUG]<br />'; echo 'query:'; echo '<pre>'; echo $query; echo '-----------<br />'; echo 'option "' . $option . '"<br />'; echo '</pre>'; //die( 'userbreak - mic ' ); } if ($db->getErrorNum()) { echo $db->stderr(); return false; } // get list of categories $attribs = 'class="inputbox" size="1" onchange="document.adminForm.submit();"'; $clist = JEventsHTML::buildCategorySelect($catid, $attribs, null, true, false, 0, 'catid'); jimport('joomla.html.pagination'); $pageNav = new JPagination($total, $limitstart, $limit); // Set the layout $this->view->setLayout('overview'); $this->view->assign('option', JEV_COM_COMPONENT); $this->view->assign('rows', $rows); $this->view->assign('clist', $clist); $this->view->assign('search', $search); $this->view->assign('pageNav', $pageNav); $this->view->display(); }