Esempio n. 1
0
 /**
  * Creates the output for the Venue view
  */
 function display($tpl = null)
 {
     $settings = JemHelper::config();
     $settings2 = JemHelper::globalattribs();
     $app = JFactory::getApplication();
     $jinput = JFactory::getApplication()->input;
     if ($settings2->get('global_show_ical_icon', '0') == 1) {
         // Get data from the model
         $model = $this->getModel();
         $model->setLimit($settings->ical_max_items);
         $model->setLimitstart(0);
         $rows = $model->getItems();
         $venueid = $jinput->getInt('id');
         // initiate new CALENDAR
         $vcal = JemHelper::getCalendarTool();
         // $vcal->setProperty('unique_id', 'category'.$catid.'@'.$mainframe->getCfg('sitename'));
         $vcal->setConfig("filename", "venue" . $venueid . ".ics");
         foreach ($rows as $row) {
             JemHelper::icalAddEvent($vcal, $row, $rows);
         }
         // generate and redirect output to user browser
         $vcal->returnCalendar();
     } else {
         return;
     }
 }
Esempio n. 2
0
	/**
	 * Retrieval of update-data
	 */
	function getUpdatedata()
	{
		$installedversion	= JemHelper::getParam(1,'version',1,'com_jem');
		$updateFile			= "http://www.joomlaeventmanager.net/updatecheck/update.xml";
		$checkFile			= self::CheckFile($updateFile);
		$updatedata 		= new stdClass();

		if ($checkFile) {
			$xml = simplexml_load_file($updateFile);

			//version to check, not visible in table
			$updatedata->version 			= $xml->version;

			//in table
			$updatedata->versiondetail		= $xml->versiondetail;
			$updatedata->date				= JEMOutput::formatdate($xml->date);
			$updatedata->info 				= $xml->info;
			$updatedata->download 			= $xml->download;
			$updatedata->notes				= $xml->notes;
			$updatedata->changes 			= explode(';', $xml->changes);
			$updatedata->failed 			= 0;
			$updatedata->installedversion	= $installedversion;
			$updatedata->current			= version_compare($installedversion, $updatedata->version);
		} else {
			$updatedata->failed 			= 1;
			$updatedata->installedversion	= $installedversion;
		}

		return $updatedata;
	}
Esempio n. 3
0
	/**
	 * Creates the output for the Eventslist view
	 */
	function display($tpl = null)
	{
		$settings 	= JemHelper::config();
		$settings2	= JemHelper::globalattribs();

		if ($settings2->get('global_show_ical_icon','0')==1) {
			// Get data from the model
			$model = $this->getModel();
			$model->setLimit($settings->ical_max_items);
			$model->setLimitstart(0);
			$rows = $model->getItems();

			// initiate new CALENDAR
			$vcal = JemHelper::getCalendarTool();
			$vcal->setConfig("filename", "events.ics");

			if (!empty($rows)) {
				foreach ($rows as $row) {
					JemHelper::icalAddEvent($vcal, $row);
				}
			}

			// generate and redirect output to user browser
			$vcal->returnCalendar();
		} else {
			return;
		}
	}
Esempio n. 4
0
 /**
  * Method to auto-populate the model state.
  *
  * Note. Calling getState in this method will result in recursion.
  */
 protected function populateState($ordering = null, $direction = null)
 {
     $app = JFactory::getApplication();
     $jemsettings = JemHelper::config();
     # it's needed to set the parent option
     parent::populateState('a.dates', 'asc');
 }
Esempio n. 5
0
 public function display($tpl = null)
 {
     $document = JFactory::getDocument();
     $db = JFactory::getDBO();
     $app = JFactory::getApplication();
     $jinput = JFactory::getApplication()->input;
     $itemid = $jinput->getInt('id', 0) . ':' . $jinput->getInt('Itemid', 0);
     $filter_order = $app->getUserStateFromRequest('com_jem.categoryelement.filter_order', 'filter_order', 'c.ordering', 'cmd');
     $filter_order_Dir = $app->getUserStateFromRequest('com_jem.categoryelement.filter_order_Dir', 'filter_order_Dir', '', 'word');
     $filter_state = $app->getUserStateFromRequest('com_jem.categoryelement.' . $itemid . '.filter_state', 'filter_state', '', 'string');
     $search = $app->getUserStateFromRequest('com_jem.categoryelement.' . $itemid . '.filter_search', 'filter_search', '', 'string');
     $search = $db->escape(trim(JString::strtolower($search)));
     // prepare document
     $document->setTitle(JText::_('COM_JEM_SELECT_CATEGORY'));
     // Load css
     JemHelper::loadCss('backend');
     // Get data from the model
     $rows = $this->get('Data');
     $pagination = $this->get('Pagination');
     // publish/unpublished filter
     $lists['state'] = JHtml::_('grid.state', $filter_state);
     // table ordering
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['order'] = $filter_order;
     // search filter
     $lists['search'] = $search;
     // assign data to template
     $this->lists = $lists;
     $this->filter_state = $filter_state;
     $this->rows = $rows;
     $this->pagination = $pagination;
     parent::display($tpl);
 }
Esempio n. 6
0
	/**
	 * Prepares the document.
	 */
	protected function prepareDocument() {
		$app 		= JFactory::getApplication();
		$menus		= $app->getMenu();
		$menu 		= $menus->getActive();
		$print		= $app->input->getBool('print', false);

		if ($print) {
			JemHelper::loadCss('print');
			$this->document->setMetaData('robots', 'noindex, nofollow');
		}

		if ($menu) {
			$this->params->def('page_heading', $this->params->get('page_title', $menu->title));
		} else {
			// TODO
			$this->params->def('page_heading', JText::_('COM_JEM_DEFAULT_PAGE_TITLE_DAY'));
		}

		$title = $this->params->get('page_title', '');

		if (empty($title)) {
			$title = $app->getCfg('sitename');
		} elseif ($app->getCfg('sitename_pagetitles', 0) == 1) {
			$title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title);
		} elseif ($app->getCfg('sitename_pagetitles', 0) == 2) {
			$title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('sitename'));
		}
		$this->document->setTitle($title);

		// TODO: Metadata
		$this->document->setMetadata('keywords', $this->params->get('page_title'));
	}
Esempio n. 7
0
	/**
	 * Creates the output for the event view
	 */
	function display($tpl = null)
	{
		$settings = JemHelper::globalattribs();

		// check iCal global setting
		if ($settings->get('global_show_ical_icon','0')==1) {
			// Get data from the model
			$row = $this->get('Item');
			if (empty($row)) {
				return;
			}

			$row->categories 	= $this->get('Categories');
			$row->id 			= $row->did;
			$row->slug			= $row->alias ? ($row->id.':'.$row->alias) : $row->id;
			$params				= $row->params;

			// check individual iCal Event setting
			if ($params->get('event_show_ical_icon',1)) {
				// initiate new CALENDAR
				$vcal = JemHelper::getCalendarTool();
				$vcal->setConfig( "filename", "event".$row->did.".ics" );
				JemHelper::icalAddEvent($vcal, $row);
				// generate and redirect output to user browser
				$vcal->returnCalendar();
			} else {
				return;
			}
		} else {
			return;
		}
	}
Esempio n. 8
0
 /**
  * Method to get the time zone field option groups.
  *
  * @return  array  The field option objects as a nested array in groups.
  */
 protected function getGroups()
 {
     $settings = JemHelper::globalattribs();
     $globalTz = $settings->get('global_timezone');
     $groups = array();
     $keyField = !empty($this->keyField) ? $this->keyField : 'id';
     $keyValue = $this->form->getValue($keyField);
     $view = $this->element['view'];
     // If the timezone is not set use the server setting.
     if (strlen($this->value) == 0 && empty($keyValue)) {
         # we didn't select A timezone so we'll take a look at the server setting.
         # are we in settings-view?
         if ($view == 'venue') {
             # check if there is a setting filled
             if ($globalTz) {
                 $this->value = $globalTz;
             } else {
                 # there is no global value so check the the server setting
                 $serverTz = JFactory::getConfig()->get('offset');
                 # UTC is seen as Abidjan and that's not something we want
                 if ($serverTz == 'UTC') {
                     $serverTz = 'Europe/Berlin';
                     // for the moment it's been set to this
                 }
                 $this->value = $serverTz;
             }
         }
     }
     // Get the list of time zones from the server.
     $zones = DateTimeZone::listIdentifiers();
     // Build the group lists.
     foreach ($zones as $zone) {
         // Time zones not in a group we will ignore.
         if (strpos($zone, '/') === false) {
             continue;
         }
         // Get the group/locale from the timezone.
         list($group, $locale) = explode('/', $zone, 2);
         // Only use known groups.
         if (in_array($group, self::$zones)) {
             // Initialize the group if necessary.
             if (!isset($groups[$group])) {
                 $groups[$group] = array();
             }
             // Only add options where a locale exists.
             if (!empty($locale)) {
                 $groups[$group][$zone] = JHtml::_('select.option', $zone, str_replace('_', ' ', $locale), 'value', 'text', false);
             }
         }
     }
     // Sort the group lists.
     ksort($groups);
     foreach ($groups as &$location) {
         sort($location);
     }
     // Merge any additional groups in the XML definition.
     $groups = array_merge(parent::getGroups(), $groups);
     return $groups;
 }
Esempio n. 9
0
    /**
     * Creates the Calendar View
     */
    function display($tpl = null)
    {
        $app = JFactory::getApplication();
        //initialize variables
        $menu = $app->getMenu();
        $menuitem = $menu->getActive();
        $jemsettings = JemHelper::config();
        $params = $app->getParams();
        $settings = JemHelper::globalattribs();
        // Load css
        JemHelper::loadCss('calendar');
        JemHelper::loadCss('jem');
        JemHelper::loadCustomCss();
        JemHelper::loadCustomTag();
        $evlinkcolor = $params->get('eventlinkcolor');
        $evbackgroundcolor = $params->get('eventbackgroundcolor');
        $currentdaycolor = $params->get('currentdaycolor');
        $eventandmorecolor = $params->get('eventandmorecolor');
        $style = '
		div[id^=\'catz\'] a {color:' . $evlinkcolor . ';}
		div[id^=\'catz\'] {background-color:' . $evbackgroundcolor . ';}
		.eventcontent {background-color:' . $evbackgroundcolor . ';}
		.eventandmore {background-color:' . $eventandmorecolor . ';}
		.today .daynum {background-color:' . $currentdaycolor . ';}';
        $this->document->addStyleDeclaration($style);
        // add javascript (using full path - see issue #590)
        JHtml::_('script', 'media/com_jem/js/calendar.js');
        $rows = $this->get('Items');
        $currentweek = $this->get('Currentweek');
        $currentyear = Date("Y");
        $showweeknr = $params->get('showweeknr', true);
        //Set Page title
        $pagetitle = $params->def('page_title', $menuitem->title);
        $params->def('page_heading', $pagetitle);
        $pageclass_sfx = $params->get('pageclass_sfx');
        // Add site name to title if param is set
        if ($app->getCfg('sitename_pagetitles', 0) == 1) {
            $pagetitle = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $pagetitle);
        } elseif ($app->getCfg('sitename_pagetitles', 0) == 2) {
            $pagetitle = JText::sprintf('JPAGETITLE', $pagetitle, $app->getCfg('sitename'));
        }
        $this->document->setTitle($pagetitle);
        $this->document->setMetaData('title', $pagetitle);
        $cal = new activeCalendarWeek($currentyear, 1, 1);
        $cal->enableWeekNum(JText::_('COM_JEM_WKCAL_WEEK'), null, '', $showweeknr);
        // enables week number column with linkable week numbers
        $cal->setFirstWeekDay($params->get('firstweekday', 0));
        $this->rows = $rows;
        $this->params = $params;
        $this->jemsettings = $jemsettings;
        $this->settings = $settings;
        $this->currentweek = $currentweek;
        $this->cal = $cal;
        $this->pageclass_sfx = htmlspecialchars($pageclass_sfx);
        parent::display($tpl);
    }
Esempio n. 10
0
	public function display($tpl = null)
	{
		// Initialise variables.
		$this->form	 = $this->get('Form');
		$this->item	 = $this->get('Item');
		$this->state = $this->get('State');

		// Check for errors.
		if (count($errors = $this->get('Errors'))) {
			JError::raiseError(500, implode("\n", $errors));
			return false;
		}
		JHtml::_('behavior.framework');
		JHtml::_('behavior.modal', 'a.modal');
		JHtml::_('behavior.tooltip');
		JHtml::_('behavior.formvalidation');

		//initialise variables
		$jemsettings 	= JemHelper::config();
		$document		= JFactory::getDocument();
		$user 			= JemFactory::getUser();
		$this->settings	= JemAdmin::config();
		$task			= JFactory::getApplication()->input->get('task', '');
		$this->task 	= $task;
		$url 			= JUri::root();

		$categories 	= JemCategories::getCategoriesTree(1);
		$selectedcats 	= $this->get('Catsselected');

		$Lists = array();
		$Lists['category'] = JemCategories::buildcatselect($categories, 'cid[]', $selectedcats, 0, 'multiple="multiple" size="8"');

		// Load css
		JHtml::_('stylesheet', 'com_jem/backend.css', array(), true);

		// Load scripts
		JHtml::_('script', 'com_jem/attachments.js', false, true);
		JHtml::_('script', 'com_jem/recurrence.js', false, true);
		JHtml::_('script', 'com_jem/unlimited.js', false, true);
		JHtml::_('script', 'com_jem/seo.js', false, true);

		// JQuery noConflict
		//$document->addCustomTag('<script type="text/javascript">jQuery.noConflict();</script>');
		//$document->addScript('http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js');
		//$document->addScript('http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js');

		$access2 			= JemHelper::getAccesslevelOptions();
		$this->access		= $access2;
		$this->jemsettings	= $jemsettings;
		$this->Lists 		= $Lists;

		$this->addToolbar();
		parent::display($tpl);
	}
Esempio n. 11
0
	/**
	 * Dissolve recurrence sets where deleted event is referred to as first.
	 *
	 * @param	string	The context for the content passed to the plugin.
	 * @param	object	The data relating to the content that was deleted.
	 * @since	1.9.6
	 */
	public function onContentAfterDelete($context, $data)
	{
		// Skip plugin if we are deleting something other than events
		if (($context != 'com_jem.event') || empty($data->id)) {
			return;
		}

		// event maybe first of recurrence set -> dissolve complete set
		JemHelper::dissolve_recurrence($data->id);

		return;
	}
Esempio n. 12
0
	/**
	 * Method to auto-populate the model state.
	 */
	protected function populateState($ordering = null, $direction = null)
	{
		# parent::populateState($ordering, $direction);
		$app 			= JFactory::getApplication();
		$jemsettings	= JemHelper::config();
		$jinput			= JFactory::getApplication()->input;
		$itemid 		= $jinput->getInt('id', 0) . ':' . $jinput->getInt('Itemid', 0);
		$params 		= $app->getParams();
		$task           = $jinput->get('task','','cmd');
		$top_category 	= $params->get('top_category', 0);
		$startdayonly 	= $params->get('show_only_start', false);

		# params
		$this->setState('params', $params);

		# publish state
		$this->_populatePublishState($task);

		###########
		## DATES ##
		###########

		#only select events within specified dates. (chosen month)
		$monthstart	= mktime(0, 0, 1, strftime('%m', $this->_date), 1, strftime('%Y', $this->_date));
		$monthend	= mktime(0, 0, -1, strftime('%m', $this->_date)+1, 1, strftime('%Y', $this->_date));

		$filter_date_from	= $this->_db->Quote(strftime('%Y-%m-%d', $monthstart));
		$filter_date_to		= $this->_db->Quote(strftime('%Y-%m-%d', $monthend));

		$where = ' DATEDIFF(IF (a.enddates IS NOT NULL, a.enddates, a.dates), '. $filter_date_from .') >= 0';
		$this->setState('filter.calendar_from',$where);

		$where = ' DATEDIFF(a.dates, '. $filter_date_to .') <= 0';
		$this->setState('filter.calendar_to',$where);

		##################
		## TOP-CATEGORY ##
		##################

		if ($top_category) {
			$children = JEMCategories::getChilds($top_category);
			if (count($children)) {
				$where = 'rel.catid IN ('. implode(',', $children) .')';
				$this->setState('filter.category_top', $where);
			}
		}

		# set filter
		$this->setState('filter.calendar_multiday',true);
		$this->setState('filter.calendar_startdayonly',(bool)$startdayonly);
		$this->setState('filter.groupby',array('a.id'));
	}
Esempio n. 13
0
 /**
  * Method to auto-populate the model state.
  */
 protected function populateState($ordering = null, $direction = null)
 {
     # parent::populateState($ordering, $direction);
     $app = JFactory::getApplication();
     $jemsettings = JemHelper::config();
     $jinput = JFactory::getApplication()->input;
     $itemid = $jinput->getInt('id', 0) . ':' . $jinput->getInt('Itemid', 0);
     $params = $app->getParams();
     $task = $jinput->getCmd('task');
     # params
     $this->setState('params', $params);
     # publish state
     $this->setState('filter.published', 1);
     # access
     $this->setState('filter.access', true);
     ###########
     ## DATES ##
     ###########
     #only select events within specified dates. (chosen month)
     $monthstart = mktime(0, 0, 1, strftime('%m', $this->_date), 1, strftime('%Y', $this->_date));
     $monthend = mktime(0, 0, -1, strftime('%m', $this->_date) + 1, 1, strftime('%Y', $this->_date));
     $filter_date_from = $this->_db->Quote(strftime('%Y-%m-%d', $monthstart));
     $filter_date_to = $this->_db->Quote(strftime('%Y-%m-%d', $monthend));
     $where = ' DATEDIFF(IF (a.enddates IS NOT NULL, a.enddates, a.dates), ' . $filter_date_from . ') >= 0';
     $this->setState('filter.calendar_from', $where);
     $where = ' DATEDIFF(a.dates, ' . $filter_date_to . ') <= 0';
     $this->setState('filter.calendar_to', $where);
     #####################
     ## FILTER-CATEGORY ##
     #####################
     $catids = $params->get('catids');
     $venids = $params->get('venueids');
     $eventids = $params->get('eventids');
     $catidsfilter = $params->get('catidsfilter');
     $venidsfilter = $params->get('venueidsfilter');
     $eventidsfilter = $params->get('eventidsfilter');
     if ($catids) {
         $this->setState('filter.category_id', $catids);
         $this->setState('filter.category_id.include', $catidsfilter);
     }
     if ($venids) {
         $this->setState('filter.venue_id', $venids);
         $this->setState('filter.venue_id.include', $venidsfilter);
     }
     if ($eventids) {
         $this->setState('filter.event_id', $eventids);
         $this->setState('filter.event_id.include', $eventidsfilter);
     }
     # set filter
     $this->setState('filter.calendar_multiday', true);
     $this->setState('filter.groupby', array('a.id'));
 }
Esempio n. 14
0
 /**
  * Method to auto-populate the model state.
  */
 protected function populateState($ordering = null, $direction = null)
 {
     // parent::populateState($ordering, $direction);
     $app = JFactory::getApplication();
     $jemsettings = JemHelper::config();
     $jinput = JFactory::getApplication()->input;
     $itemid = $jinput->getInt('id', 0) . ':' . $jinput->getInt('Itemid', 0);
     $params = $app->getParams();
     $task = $jinput->get('task', '', 'cmd');
     // List state information
     /* in J! 3.3.6 limitstart is removed from request - but we need it! */
     if ($app->input->getInt('limitstart', null) === null) {
         $app->setUserState('com_jem.venue.' . $itemid . '.limitstart', 0);
     }
     $limit = $app->getUserStateFromRequest('com_jem.venue.' . $itemid . '.limit', 'limit', $jemsettings->display_num, 'int');
     $this->setState('list.limit', $limit);
     $limitstart = $app->getUserStateFromRequest('com_jem.venue.' . $itemid . '.limitstart', 'limitstart', 0, 'int');
     // correct start value if required
     $limitstart = $limit ? (int) (floor($limitstart / $limit) * $limit) : 0;
     $this->setState('list.start', $limitstart);
     # Search
     $search = $app->getUserStateFromRequest('com_jem.venue.' . $itemid . '.filter_search', 'filter_search', '', 'string');
     $this->setState('filter.filter_search', $search);
     # FilterType
     $filtertype = $app->getUserStateFromRequest('com_jem.venue.' . $itemid . '.filter_type', 'filter_type', '', 'int');
     $this->setState('filter.filter_type', $filtertype);
     # filter_order
     $orderCol = $app->getUserStateFromRequest('com_jem.venue.' . $itemid . '.filter_order', 'filter_order', 'a.dates', 'cmd');
     $this->setState('filter.filter_ordering', $orderCol);
     # filter_direction
     // Changed order from ASC to DESC for showing all events
     $listOrder = $app->getUserStateFromRequest('com_jem.venue.' . $itemid . '.filter_order_Dir', 'filter_order_Dir', 'DESC', 'word');
     $this->setState('filter.filter_direction', $listOrder);
     # show open date events
     # (there is no menu item option yet so show all events)
     $this->setState('filter.opendates', 1);
     if ($orderCol == 'a.dates') {
         $orderby = array('a.dates ' . $listOrder, 'a.times ' . $listOrder);
     } else {
         $orderby = $orderCol . ' ' . $listOrder;
     }
     $this->setState('filter.orderby', $orderby);
     # params
     $this->setState('params', $params);
     // Commented out to show all events
     // if ($task == 'archive') {
     // 	$this->setState('filter.published',2);
     // } else {
     // 	$this->setState('filter.published',1);
     // }
     $this->setState('filter.groupby', array('a.id'));
 }
Esempio n. 15
0
 /**
  * Constructor
  */
 public function __construct()
 {
     parent::__construct();
     $app = JFactory::getApplication();
     $jinput = $app->input;
     $jemsettings = JemHelper::config();
     $itemid = $jinput->getInt('id', 0) . ':' . $jinput->getInt('Itemid', 0);
     $limit = $app->getUserStateFromRequest('com_jem.categoryelement.limit', 'limit', $jemsettings->display_num, 'int');
     $limitstart = $jinput->getInt('limitstart');
     $limitstart = $limit ? (int) (floor($limitstart / $limit) * $limit) : 0;
     $this->setState('limit', $limit);
     $this->setState('limitstart', $limitstart);
 }
Esempio n. 16
0
 /**
  * Constructor
  *
  * @param   object  &$subject  The object to observe
  * @param   array   $config    An array that holds the plugin configuration
  *
  */
 public function __construct(&$subject, $config)
 {
     parent::__construct($subject, $config);
     $this->loadLanguage();
     $app = JFactory::getApplication();
     $jemsettings = JemHelper::globalattribs();
     $this->_SiteName = $app->getCfg('sitename');
     $this->_MailFrom = $app->getCfg('mailfrom');
     $this->_FromName = $app->getCfg('fromname');
     $this->_AdminDBList = self::Adminlist();
     $this->_UseLoginName = !$jemsettings->get('global_regname', 1);
     // regname == 1: name, 0: username (login name)
 }
Esempio n. 17
0
 public function display($tpl = null)
 {
     // Initialise variables.
     $this->form = $this->get('Form');
     $this->item = $this->get('Item');
     $this->state = $this->get('State');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     // initialise variables
     $document = JFactory::getDocument();
     $app = JFactory::getApplication();
     $jinput = $app->input;
     $this->settings = JEMAdmin::config();
     $this->settings2 = JemHelper::globalattribs();
     $task = $jinput->getCmd('task');
     $this->task = $task;
     # load css
     JHtml::_('stylesheet', 'com_jem/backend.css', array(), true);
     # load js
     //JHtml::_('behavior.framework'); //mootools
     JHtml::_('script', 'com_jem/attachments.js', false, true);
     //$document->addScript('http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js');
     $this->access = JEMHelper::getAccesslevelOptions();
     # retrieve mapType setting
     $settings = JemHelper::globalattribs();
     $mapType = $settings->get('mapType', '0');
     switch ($mapType) {
         case '0':
             $type = '"roadmap"';
             break;
         case '1':
             $type = '"satellite"';
             break;
         case '2':
             $type = '"hybrid"';
             break;
         case '3':
             $type = '"terrain"';
             break;
     }
     $this->mapType = $type;
     //JHtml::_('jquery.framework');
     JHtml::_('script', 'com_jem/slider-state.js', false, true);
     $this->addToolbar();
     parent::display($tpl);
 }
Esempio n. 18
0
	/**
	 * Method to auto-populate the model state.
	 */
	protected function populateState($ordering = null, $direction = null)
	{
		$app          = JFactory::getApplication();
		$jemsettings  = JemHelper::config();
		$params       = $app->getParams();
		$jinput       = $app->input;
		$itemid       = $jinput->getInt('Itemid', 0);
		$task         = $jinput->getCmd('task', '');
		$startdayonly = $params->get('show_only_start', false);

		# params
		$this->setState('params', $params);

		# publish state
		//$this->setState('filter.published', 1);
		$this->_populatePublishState($task);


		###########
		## DATES ##
		###########

		#only select events within specified dates. (chosen month)
		$monthstart	= mktime(0, 0,  1, strftime('%m', $this->_date),   1, strftime('%Y', $this->_date));
		$monthend	= mktime(0, 0, -1, strftime('%m', $this->_date)+1, 1, strftime('%Y', $this->_date));

		$filter_date_from = strftime('%Y-%m-%d', $monthstart);
		$filter_date_to   = strftime('%Y-%m-%d', $monthend);

		$where = ' DATEDIFF(IF (a.enddates IS NOT NULL, a.enddates, a.dates), '. $this->_db->Quote($filter_date_from) .') >= 0';
		$this->setState('filter.calendar_from', $where);

		$where = ' DATEDIFF(a.dates, '. $this->_db->Quote($filter_date_to) .') <= 0';
		$this->setState('filter.calendar_to', $where);

		# set filter
		$this->setState('filter.calendar_multiday', true);
		$this->setState('filter.calendar_startdayonly', (bool)$startdayonly);
		$this->setState('filter.filter_catid', $this->_id);

		$app->setUserState('com_jem.categorycal.catid'.$itemid, $this->_id);

		# groupby
		$this->setState('filter.groupby', array('a.id'));
	}
Esempio n. 19
0
 /**
  * Method to get a single record.
  *
  * @param	integer	The id of the primary key.
  *
  * @return	mixed	Object on success, false on failure.
  */
 public function getItem($pk = null)
 {
     $jemsettings = JEMAdmin::config();
     if ($item = parent::getItem($pk)) {
         $files = JEMAttachment::getAttachments('venue' . $item->id);
         $item->attachments = $files;
     }
     $item->author_ip = $jemsettings->storeip ? JemHelper::retrieveIP() : false;
     if (empty($item->id)) {
         $item->country = $jemsettings->defaultCountry;
     }
     if (!empty($item->locimage)) {
         if (strpos($item->locimage, 'images/') !== false) {
             # the image selected contains the images path
         } else {
             # the image selected doesn't have the /images/ path
             # we're looking at the locimage so we'll append the venues folder
             $item->locimage = 'images/jem/venues/' . $item->locimage;
         }
     }
     return $item;
 }
Esempio n. 20
0
 /**
  * Creates the output for the event view
  */
 function display($tpl = null)
 {
     $settings = JemHelper::globalattribs();
     // check iCal global setting
     if ($settings->get('global_show_ical_icon', '0') == 1) {
         // Get data from the model
         $row = $this->get('Item');
         $row->categories = $this->get('Categories');
         $row->id = $row->did;
         $row->slug = $row->alias ? $row->id . ':' . $row->alias : $row->id;
         $params = $row->params;
         // check individual iCal Event setting
         if ($params->get('event_show_ical_icon', 1)) {
             $filename_type = $params->get('event_ical_filename_type', '2');
             switch ($filename_type) {
                 case 1:
                     $filename = JText::_('COM_JEM_EVENT_ICAL_FILENAME');
                     break;
                 case 2:
                     $filename = "event" . $row->did;
                     break;
                 case 3:
                     $filename = $params->get('event_ical_filename', 'event');
                     break;
             }
             // initiate new CALENDAR
             $vcal = JemHelper::getCalendarTool();
             $vcal->setConfig("filename", $filename . '.ics');
             JemHelper::icalAddEvent($vcal, $row, 'event');
             // generate and redirect output to user browser
             $vcal->returnCalendar();
         } else {
             return;
         }
     } else {
         return;
     }
 }
Esempio n. 21
0
 /**
  * Method override to check if you can add a new record.
  *
  * @param	array	An array of input data.
  *
  * @return	boolean
  */
 protected function allowAdd($data = array())
 {
     // Initialise variables.
     $user = JFactory::getUser();
     $jinput = JFactory::getApplication()->input;
     //$categoryId	= JArrayHelper::getValue($data, 'catid', $jinput->getInt('catid'), 'int');
     $allow = null;
     //if ($categoryId) {
     //	// If the category has been passed in the data or URL check it.
     //	$allow	= $user->authorise('core.create', 'com_jem.category.'.$categoryId);
     //}
     $jemsettings = JemHelper::config();
     $maintainer = JEMUser::venuegroups('add');
     $delloclink = JEMUser::validate_user($jemsettings->locdelrec, $jemsettings->deliverlocsyes);
     if ($maintainer || $delloclink) {
         return true;
     }
     if ($allow === null) {
         // In the absense of better information, revert to the component permissions.
         return parent::allowAdd();
     } else {
         return $allow;
     }
 }
Esempio n. 22
0
 protected function populateState($ordering = null, $direction = null)
 {
     $app = JFactory::getApplication();
     $jemsettings = JemHelper::config();
     $jinput = JFactory::getApplication()->input;
     $itemid = $jinput->getInt('id', 0) . ':' . $jinput->getInt('Itemid', 0);
     # limit/start
     $limit = $app->getUserStateFromRequest('com_jem.myattendances.' . $itemid . '.limit', 'limit', $jemsettings->display_num, 'uint');
     $this->setState('list.limit', $limit);
     $limitstart = $app->input->get('limitstart', 0, 'uint');
     $this->setState('list.start', $limitstart);
     # Search
     $search = $app->getUserStateFromRequest('com_jem.myattendances.' . $itemid . '.filter_search', 'filter_search', '', 'string');
     $this->setState('filter.filter_search', $search);
     # FilterType
     $filtertype = $app->getUserStateFromRequest('com_jem.myattendances.' . $itemid . '.filter_type', 'filter_type', '', 'int');
     $this->setState('filter.filter_type', $filtertype);
     ###########
     ## ORDER ##
     ###########
     $filter_order = $app->getUserStateFromRequest('com_jem.myattendances.' . $itemid . '.filter_order', 'filter_order', 'a.dates', 'cmd');
     $filter_order_Dir = $app->getUserStateFromRequest('com_jem.myattendances.' . $itemid . '.filter_order_Dir', 'filter_order_Dir', 'ASC', 'string');
     $filter_order = JFilterInput::getInstance()->clean($filter_order, 'string');
     $filter_order_Dir = JFilterInput::getInstance()->clean($filter_order_Dir, 'string');
     if ($filter_order == 'a.dates') {
         $orderby = array('a.dates ' . $filter_order_Dir, 'a.times ' . $filter_order_Dir);
     } else {
         $orderby = $filter_order . ' ' . $filter_order_Dir;
     }
     $this->setState('filter.orderby', $orderby);
     # params
     $params = $app->getParams();
     $this->setState('params', $params);
     # groupby
     $this->setState('filter.groupby', array('a.id'));
 }
Esempio n. 23
0
 public function display($tpl = null)
 {
     // Initialise variables.
     $this->form = $this->get('Form');
     $this->item = $this->get('Item');
     $this->state = $this->get('State');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     //initialise variables
     $jemsettings = JemHelper::config();
     $document = JFactory::getDocument();
     $user = JFactory::getUser();
     $this->settings = JemAdmin::config();
     $task = JFactory::getApplication()->input->get('task');
     $this->task = $task;
     $url = JUri::root();
     $categories = JemCategories::getCategoriesTree(1);
     $selectedcats = $this->get('Catsselected');
     $Lists = array();
     $Lists['category'] = JemCategories::buildcatselect($categories, 'cid[]', $selectedcats, 0, 'multiple="multiple" size="8"');
     // Load css
     JHtml::_('stylesheet', 'com_jem/backend.css', array(), true);
     // Load scripts
     JHtml::_('script', 'com_jem/attachments.js', false, true);
     JHtml::_('script', 'com_jem/recurrence.js', false, true);
     JHtml::_('script', 'com_jem/seo.js', false, true);
     JHtml::_('script', 'com_jem/slider-state.js', false, true);
     $this->access = JemHelper::getAccesslevelOptions();
     $this->jemsettings = $jemsettings;
     $this->Lists = $Lists;
     $this->addToolbar();
     parent::display($tpl);
 }
Esempio n. 24
0
	/**
	 * Method to get a pagination object
	 *
	 * @access public
	 * @return integer
	 */
	function getPagination()
	{
		$app         = JFactory::getApplication();
		$jemsettings = JemHelper::config();

		$limit       = $app->getUserStateFromRequest('com_jem.userelement.limit', 'limit', $jemsettings->display_num, 'int');
		$limitstart  = $app->input->getInt('limitstart', 0);

		$query = $this->buildQuery();
		$total = $this->_getListCount($query);

		// Create the pagination object
		jimport('joomla.html.pagination');
		$pagination = new JPagination($total, $limitstart, $limit);

		return $pagination;
	}
Esempio n. 25
0
        $multidaydate .= JemOutput::formatSchemaOrgDateTime($row->multistartdate, $row->times, $row->multienddate, $row->endtimes);
    } elseif ($multi->row == 'zlast') {
        $multidaydate .= JemOutput::formatShortDateTime($row->multistartdate, $row->times, $row->multienddate, $row->endtimes);
        $multidaydate .= JemOutput::formatSchemaOrgDateTime($row->multistartdate, $row->times, $row->multienddate, $row->endtimes);
    } else {
        $multidaydate .= JemOutput::formatShortDateTime($row->dates, $row->times, $row->enddates, $row->endtimes);
        $multidaydate .= JemOutput::formatSchemaOrgDateTime($row->dates, $row->times, $row->enddates, $row->endtimes);
    }
    $multidaydate .= '</div>';
    //generate the output
    $content .= JemHelper::caltooltip($catname . $eventname . $timeTip . $venue, $eventdate, $row->title, $detaillink, 'hasTooltip', $timeHtml, $category->color);
    $content .= $colorpic;
    $content .= $contentend;
    $this->cal->setEventContent($year, $month, $day, $content);
}
$catinfo = JemHelper::arrayUnique($catinfo);
// create hidden input fields
foreach ($catinfo as $val) {
    echo "<input name='category" . $val['catid'] . "' type='hidden' value='" . $val['color'] . "'>";
}
echo "<input id='usebgcatcolor' name='usebgcatcolor' type='hidden' value='" . $this->params->get('usebgcatcolor', '0') . "'>";
# output of calendar
$currentWeek = $this->currentweek;
$nrweeks = $this->params->get('nrweeks', 1);
echo $this->cal->showWeeksByID($currentWeek, $nrweeks);
?>

	<div id="jlcalendarlegend">
		<div class="calendarButtons">
			<div class="calendarButtonsToggle">
				<div id="buttonshowall" class="calendarButton">
Esempio n. 26
0
 /**
  * Method to auto-populate the model state.
  */
 protected function populateState($ordering = null, $direction = null)
 {
     // parent::populateState($ordering, $direction);
     $app = JFactory::getApplication();
     $jemsettings = JemHelper::config();
     $settings = JemHelper::globalattribs();
     $jinput = JFactory::getApplication()->input;
     $itemid = $jinput->getInt('id', 0) . ':' . $jinput->getInt('Itemid', 0);
     $params = $app->getParams();
     $task = $jinput->getCmd('task');
     $global = new JRegistry();
     $global->loadString($settings);
     $params = clone $global;
     $params->merge($global);
     if ($menu = $app->getMenu()->getActive()) {
         $params->merge($menu->params);
     }
     $this->setState('params', $params);
     # limit
     $limit = $app->getUserStateFromRequest('com_jem.venue.' . $itemid . '.limit', 'limit', $jemsettings->display_num, 'uint');
     $this->setState('list.limit', $limit);
     $limitstart = $app->input->get('limitstart', 0, 'uint');
     $this->setState('list.start', $limitstart);
     # Search
     $search = $app->getUserStateFromRequest('com_jem.venue.' . $itemid . '.filter_search', 'filter_search', '', 'string');
     $this->setState('filter.filter_search', $search);
     # FilterType
     $filtertype = $app->getUserStateFromRequest('com_jem.venue.' . $itemid . '.filter_type', 'filter_type', '', 'int');
     $this->setState('filter.filter_type', $filtertype);
     # filter_order
     $orderCol = $app->getUserStateFromRequest('com_jem.venue.' . $itemid . '.filter_order', 'filter_order', 'a.dates', 'cmd');
     $this->setState('filter.filter_ordering', $orderCol);
     # filter_direction
     $listOrder = $app->getUserStateFromRequest('com_jem.venue.' . $itemid . '.filter_order_Dir', 'filter_order_Dir', 'ASC', 'word');
     $this->setState('filter.filter_direction', $listOrder);
     if ($orderCol == 'a.dates') {
         $orderby = array('a.dates ' . $listOrder, 'a.times ' . $listOrder);
     } else {
         $orderby = $orderCol . ' ' . $listOrder;
     }
     $this->setState('filter.orderby', $orderby);
     # publish state
     if ($task == 'archive') {
         $this->setState('filter.published', 2);
     } else {
         # we've to check if the setting for the filter has been applied
         if ($params->get('global_show_archive_icon')) {
             $this->setState('filter.published', 1);
         } else {
             # retrieve the status to be displayed
             switch ($params->get('global_show_eventstatus')) {
                 case 0:
                     $status = 1;
                     break;
                 case 1:
                     $status = 2;
                     break;
                 case 2:
                     $status = array(1, 2);
                     break;
                 default:
                     $status = 1;
             }
             $this->setState('filter.published', $status);
         }
     }
     $this->setState('filter.access', true);
     $this->setState('filter.groupby', array('a.id'));
 }
Esempio n. 27
0
	/**
	 * Editvenue-View
	 */
	public function display($tpl = null)
	{
		// Initialise variables.
		$jemsettings = JemHelper::config();
		$settings    = JemHelper::globalattribs();
		$app         = JFactory::getApplication();
		$user        = JemFactory::getUser();
		$document    = JFactory::getDocument();
		$model       = $this->getModel();
		$menu        = $app->getMenu();
		$menuitem    = $menu->getActive();
		$pathway     = $app->getPathway();
		$url         = JUri::root();

		$language    = JFactory::getLanguage();
		$language    = $language->getTag();
		$language    = substr($language, 0,2);

		// Get model data.
		$this->state  = $this->get('State');
		$this->item   = $this->get('Item');
		$this->params = $this->state->get('params');

		// Create a shortcut for $item and params.
		$item = $this->item;
		$params = $this->params;

		$this->form = $this->get('Form');
		$this->return_page = $this->get('ReturnPage');

		// check for data error
		if (empty($item)) {
			$app->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error');
			return false;
		}

		// check for guest
		if (!$user || $user->id == 0) {
			$app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error');
			return false;
		}

		if (empty($item->id)) {
			// Check if the user has access to the form
			$authorised = $user->can('add', 'venue');
		} else {
			// Check if user can edit
			$authorised = $user->can('edit', 'venue', $item->id, $item->created_by);
		}

		if ($authorised !== true) {
			$app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error');
			return false;
		}

		// Decide which parameters should take priority
		$useMenuItemParams = ($menuitem && $menuitem->query['option'] == 'com_jem'
		                                && $menuitem->query['view']   == 'editvenue'
		                                && 0 == $item->id); // menu item is always for new venues

		$title = ($item->id == 0) ? JText::_('COM_JEM_EDITVENUE_VENUE_ADD')
		                          : JText::sprintf('COM_JEM_EDITVENUE_VENUE_EDIT', $item->venue);

		if ($useMenuItemParams) {
			$pagetitle = $menuitem->title ? $menuitem->title : $title;
			$params->def('page_title', $pagetitle);
			$params->def('page_heading', $pagetitle);
			$pathway->setItemName(1, $pagetitle);

			// Load layout from menu item if one is set else from venue if there is one set
			if (isset($menuitem->query['layout'])) {
				$this->setLayout($menuitem->query['layout']);
			} elseif ($layout = $item->params->get('venue_layout')) {
				$this->setLayout($layout);
			}

			$item->params->merge($params);
		} else {
			$pagetitle = $title;
			$params->set('page_title', $pagetitle);
			$params->set('page_heading', $pagetitle);
			$params->set('show_page_heading', 1); // ensure page heading is shown
			$params->set('introtext', ''); // there is no introtext in that case
			$params->set('showintrotext', 0);
			$pathway->addItem($pagetitle, ''); // link not required here so '' is ok

			// Check for alternative layouts (since we are not in an edit-venue menu item)
			// Load layout from venue if one is set
			if ($layout = $item->params->get('venue_layout')) {
				$this->setLayout($layout);
			}

			$temp = clone($params);
			$temp->merge($item->params);
			$item->params = $temp;
		}

		$publisher = $user->can('publish', 'venue', $item->id, $item->created_by);

		if (!empty($this->item) && isset($this->item->id)) {
			// $this->item->images = json_decode($this->item->images);
			// $this->item->urls = json_decode($this->item->urls);

			$tmp = new stdClass();
			// $tmp->images = $this->item->images;
			// $tmp->urls = $this->item->urls;
			$this->form->bind($tmp);
		}

		// Check for errors.
		if (count($errors = $this->get('Errors'))) {
			JError::raiseWarning(500, implode("\n", $errors));
			return false;
		}

		JHtml::_('behavior.framework');
		JHtml::_('behavior.formvalidation');
		JHtml::_('behavior.tooltip');

		$access2 		= JemHelper::getAccesslevelOptions(true);
		$this->access	= $access2;

		// Load css
		JemHelper::loadCss('geostyle');
		JemHelper::loadCss('jem');
		JemHelper::loadCustomCss();
		JemHelper::loadCustomTag();

		// Load script
		JHtml::_('script', 'com_jem/attachments.js', false, true);
		JHtml::_('script', 'com_jem/other.js', false, true);
		$document->addScript('http://maps.googleapis.com/maps/api/js?sensor=false&amp;libraries=places&language='.$language);

		// Noconflict
		$document->addCustomTag( '<script type="text/javascript">jQuery.noConflict();</script>' );

		// JQuery scripts
		$document->addScript('http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js');
		JHtml::_('script', 'com_jem/jquery.geocomplete.js', false, true);

		// No permissions required/useful on this view
		$permissions = new stdClass();

		$this->pageclass_sfx = htmlspecialchars($item->params->get('pageclass_sfx'));
		$this->jemsettings   = $jemsettings;
		$this->settings      = $settings;
		$this->permissions   = $permissions;
		$this->limage        = JemImage::flyercreator($this->item->locimage, 'venue');
		$this->infoimage     = JHtml::_('image', 'com_jem/icon-16-hint.png', JText::_('COM_JEM_NOTES'), NULL, true);
		$this->user          = $user;

		if (!$publisher) {
			$this->form->setFieldAttribute('published', 'default', 0);
			$this->form->setFieldAttribute('published', 'readonly', 'true');
		}

		$this->_prepareDocument();
		parent::display($tpl);
	}
Esempio n. 28
0
	/**
	 * Prepares the print screen
	 *
	 * @param $tpl
	 */
	protected function _displayprint($tpl = null)
	{
		$document	= JFactory::getDocument();
		$app		= JFactory::getApplication();
		$params		= $app->getParams();
		$settings	= JEMHelper::globalattribs();

		// Load css
		JemHelper::loadCss('backend');
		JemHelper::loadCss('jem');
		JemHelper::loadCss('print');
		JemHelper::loadCustomTag();

		$document->setMetaData('robots', 'noindex, nofollow');

		// Emailaddress
		$enableemailaddress = $params->get('enableemailaddress', 0);

		$rows  	= $this->get('Data');
		$event 	= $this->get('Event');

		//assign data to template
		$this->rows 		= $rows;
		$this->event 		= $event;
		$this->enableemailaddress = $enableemailaddress;
		$this->settings		= $settings;

		parent::display($tpl);
	}
Esempio n. 29
0
 /**
  * Remove images
  */
 function rmObsImages()
 {
     $settings = JemHelper::globalattribs();
     $trash_path = $settings->get('trashedimages_path', '/trashedimages');
     $trash_folder = JPATH_SITE . $trash_path;
     $trash_foldersmall = JPATH_SITE . $trash_path . '/small';
     if (JFolder::exists($trash_folder)) {
         $files = JFolder::files($trash_folder, $filter = '.', false, true, array('index.html'));
         if ($files) {
             JFile::delete($files);
         }
     }
     if (JFolder::exists($trash_foldersmall)) {
         $files = JFolder::files($trash_foldersmall, $filter = '.', false, true, array('index.html'));
         if ($files) {
             JFile::delete($files);
         }
     }
     return;
 }
Esempio n. 30
0
		</h1>
	<?php endif; ?>

	<div class="clr"></div>

	<?php foreach ($this->rows as $row) : ?>
		<h2 class="jem cat<?php echo $row->id; ?>">
			<?php echo JHtml::_('link', JRoute::_($row->linktarget), $this->escape($row->catname)); ?>
		</h2>

		<div class="floattext">
			<?php if ($this->jemsettings->discatheader) { ?>
				<div class="catimg">
					<?php // flyer
						if (empty($row->image)) {
							$jemsettings = JemHelper::config();
							$imgattribs['width'] = $jemsettings->imagewidth;
							$imgattribs['height'] = $jemsettings->imagehight;

							echo JHtml::_('image', 'com_jem/noimage.png', $row->catname, $imgattribs, true);
						} else {
							$cimage = JemImage::flyercreator($row->image, 'category');
							echo JemOutput::flyer($row, $cimage, 'category');
						}
					?>
				</div>
			<?php } ?>
			<div class="description cat<?php echo $row->id; ?>">
				<?php echo $row->description; ?>
				<p>
					<?php echo JHtml::_('link', JRoute::_($row->linktarget), $row->linktext); ?>