예제 #1
0
	public function display($tpl = null)
	{
		$app = JFactory::getApplication();

		//initialise variables
		$user        = JemFactory::getUser();
		$db          = JFactory::getDBO();
		$jemsettings = JEMAdmin::config();
		$document    = JFactory::getDocument();
		$itemid      = $app->input->getInt('id', 0) . ':' . $app->input->getInt('Itemid', 0);

		JHtml::_('behavior.tooltip');
		JHtml::_('behavior.modal');

		//get var
		$filter_order     = $app->getUserStateFromRequest('com_jem.eventelement.filter_order',     'filter_order', 'a.dates', 'cmd');
		$filter_order_Dir = $app->getUserStateFromRequest('com_jem.eventelement.filter_order_Dir', 'filter_order_Dir', '', 'word');
		$filter_type      = $app->getUserStateFromRequest('com_jem.eventelement.'.$itemid.'.filter_type',   'filter_type', '', 'int');
		$filter_state     = $app->getUserStateFromRequest('com_jem.eventelement.'.$itemid.'.filter_state',  'filter_state', '', 'string');
		$filter_search    = $app->getUserStateFromRequest('com_jem.eventelement.'.$itemid.'.filter_search', 'filter_search', '', 'string');
		$filter_search    = $db->escape(trim(JString::strtolower($filter_search)));

		//prepare the document
		$document->setTitle(JText::_('COM_JEM_SELECTEVENT'));

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

		//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;

		//Create the filter selectlist
		$filters = array();
		$filters[] = JHtml::_('select.option', '1', JText::_('COM_JEM_EVENT_TITLE'));
		$filters[] = JHtml::_('select.option', '2', JText::_('COM_JEM_VENUE'));
		$filters[] = JHtml::_('select.option', '3', JText::_('COM_JEM_CITY'));
		//$filters[] = JHtml::_('select.option', '4', JText::_('COM_JEM_CATEGORY'));
		$lists['filter'] = JHtml::_('select.genericlist', $filters, 'filter_type', array('size'=>'1','class'=>'inputbox'), 'value', 'text', $filter_type);

		// search filter
		$lists['search']= $filter_search;

		//assign data to template
		$this->lists 		= $lists;
		$this->filter_state = $filter_state;
		$this->rows 		= $rows;
		$this->pagination 	= $pagination;
		$this->jemsettings 	= $jemsettings;
		$this->user 		= $user;

		parent::display($tpl);
	}
예제 #2
0
 public function display($tpl = null)
 {
     $user = JFactory::getUser();
     $document = JFactory::getDocument();
     $settings = JEMHelper::globalattribs();
     $jemsettings = JEMAdmin::config();
     $url = JUri::root();
     // Initialise variables.
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     $this->state = $this->get('State');
     // Retrieving params
     $params = $this->state->get('params');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     // loading Mootools
     JHtml::_('behavior.framework');
     // Load css
     JHtml::_('stylesheet', 'com_jem/backend.css', array(), true);
     // Load Scripts
     $document->addScript('http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js');
     $document->addCustomTag('<script type="text/javascript">jQuery.noConflict();</script>');
     // assign data to template
     $this->user = $user;
     $this->jemsettings = $jemsettings;
     $this->settings = $settings;
     // add toolbar
     $this->addToolbar();
     parent::display($tpl);
 }
예제 #3
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');
     // initialise variables
     $jemsettings = JEMHelper::config();
     $document = JFactory::getDocument();
     $this->settings = JEMAdmin::config();
     $task = JFactory::getApplication()->input->get('task');
     $this->task = $task;
     $url = JUri::root();
     // Load css
     JHtml::_('stylesheet', 'com_jem/backend.css', array(), 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');
     $this->jemsettings = $jemsettings;
     $this->addToolbar();
     parent::display($tpl);
 }
예제 #4
0
 public function display($tpl = null)
 {
     $user = JFactory::getUser();
     $document = JFactory::getDocument();
     $settings = JEMHelper::globalattribs();
     $jemsettings = JEMAdmin::config();
     $url = JUri::root();
     // Initialise variables.
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     $this->state = $this->get('State');
     $this->filterForm = $this->get('FilterForm');
     $this->activeFilters = $this->get('ActiveFilters');
     // Retrieving params
     $params = $this->state->get('params');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     // Load css
     JHtml::_('stylesheet', 'com_jem/backend.css', array(), true);
     // assign data to template
     $this->user = $user;
     $this->jemsettings = $jemsettings;
     $this->settings = $settings;
     // add toolbar
     $this->addToolbar();
     parent::display($tpl);
 }
예제 #5
0
	public function display($tpl = null)
	{
		$user        = JemFactory::getUser();
		$jemsettings = JEMAdmin::config();

		// Initialise variables.
		$this->items      = $this->get('Items');
		$this->pagination = $this->get('Pagination');
		$this->state      = $this->get('State');

		// loading Mootools
		JHtml::_('behavior.framework');

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

		// add style to description of the tooltip (hastip)
		JHtml::_('behavior.tooltip');

		// assign data to template
		$this->user			= $user;
		$this->jemsettings  = $jemsettings;

		// add toolbar
		$this->addToolbar();

		parent::display($tpl);
		}
예제 #6
0
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     // initialise variables
     $document = JFactory::getDocument();
     $jemsettings = JEMAdmin::config();
     $db = JFactory::getDBO();
     // get var
     $filter_order = $app->getUserStateFromRequest('com_jem.userelement.filter_order', 'filter_order', 'u.name', 'cmd');
     $filter_order_Dir = $app->getUserStateFromRequest('com_jem.userelement.filter_order_Dir', 'filter_order_Dir', '', 'word');
     $search = $app->getUserStateFromRequest('com_jem.userelement.filter_search', 'filter_search', '', 'string');
     $search = $db->escape(trim(JString::strtolower($search)));
     // prepare the document
     $document->setTitle(JText::_('COM_JEM_SELECTATTENDEE'));
     // Load css
     JHtml::_('stylesheet', 'com_jem/backend.css', array(), true);
     // Get data from the model
     $users = $this->get('Data');
     $pagination = $this->get('Pagination');
     // build selectlists
     $lists = array();
     // 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->rows = $users;
     $this->jemsettings = $jemsettings;
     $this->pagination = $pagination;
     parent::display($tpl);
 }
예제 #7
0
 public function display($tpl = null)
 {
     $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;
     }
     $jemsettings = JEMHelper::config();
     $document = JFactory::getDocument();
     $this->settings = JEMAdmin::config();
     $task = JFactory::getApplication()->input->get('task');
     $this->task = $task;
     $url = JUri::root();
     // Load css
     JHtml::_('stylesheet', 'com_jem/backend.css', array(), true);
     $maintainers = $this->get('Members');
     $available_users = $this->get('Available');
     //make data safe
     JFilterOutput::objectHTMLSafe($this->item);
     //create selectlists
     $lists = array();
     $lists['maintainers'] = JHtml::_('select.genericlist', $maintainers, 'maintainers[]', array('class' => 'inputbox', 'size' => '20', 'onDblClick' => 'moveOptions(document.adminForm[\'maintainers[]\'], document.adminForm[\'available_users\'])', 'multiple' => 'multiple', 'style' => 'padding: 6px; width: 250px;'), 'value', 'text');
     $lists['available_users'] = JHtml::_('select.genericlist', $available_users, 'available_users', array('class' => 'inputbox', 'size' => '20', 'onDblClick' => 'moveOptions(document.adminForm[\'available_users\'], document.adminForm[\'maintainers[]\'])', 'multiple' => 'multiple', 'style' => 'padding: 6px; width: 250px;'), 'value', 'text');
     $this->jemsettings = $jemsettings;
     $this->lists = $lists;
     $this->addToolbar();
     parent::display($tpl);
 }
예제 #8
0
	public function getInput()
	{

	
		$startminutes = JEMAdmin::buildtimeselect(59, 'startminutes', substr( $this->name, 3, 2 ));
	
		return $startminutes;
		
	}
예제 #9
0
	public function getInput()
	{
	
		$starthours = JEMAdmin::buildtimeselect(23, 'starthours', substr( $this->name, 0, 2 ));
		$startminutes = JEMAdmin::buildtimeselect(59, 'startminutes', substr( $this->name, 3, 2 ));
		
		$var2 = $starthours.$startminutes;
	
		return $var2;
		
	}
예제 #10
0
	/**
	 * logic for uploading an image
	 *
	 * @access public
	 * @return void
	 *
	 */
	function uploadimage()
	{
		$app = JFactory::getApplication();

		// Check for request forgeries
		JSession::checkToken() or jexit('Invalid token');

		$jemsettings = JEMAdmin::config();

		$file 		= JFactory::getApplication()->input->files->get('userfile', array(), 'array');
		$task 		= JFactory::getApplication()->input->get('task', '');

		// Set FTP credentials, if given
		jimport('joomla.client.helper');
		JClientHelper::setCredentialsFromRequest('ftp');
		//$ftp = JClientHelper::getCredentials('ftp');

		//set the target directory
		if ($task == 'venueimgup') {
			$base_Dir = JPATH_SITE.'/images/jem/venues/';
		} else if ($task == 'eventimgup') {
			$base_Dir = JPATH_SITE.'/images/jem/events/';
		} else if ($task == 'categoriesimgup') {
			$base_Dir = JPATH_SITE.'/images/jem/categories/';
		}

		//do we have an upload?
		if (empty($file['name'])) {
			echo "<script> alert('".JText::_('COM_JEM_IMAGE_EMPTY')."'); window.history.go(-1); </script>\n";
			$app->close();
		}

		//check the image
		$check = JEMImage::check($file, $jemsettings);

		if ($check === false) {
			$app->redirect($_SERVER['HTTP_REFERER']);
		}

		//sanitize the image filename
		$filename = JEMImage::sanitize($base_Dir, $file['name']);
		$filepath = $base_Dir . $filename;

		//upload the image
		if (!JFile::upload($file['tmp_name'], $filepath)) {
			echo "<script> alert('".JText::_('COM_JEM_UPLOAD_FAILED')."'); window.history.go(-1); </script>\n";
			$app->close();
		} else {
			echo "<script> alert('".JText::_('COM_JEM_UPLOAD_COMPLETE')."'); window.history.go(-1); window.parent.SelectImage('$filename', '$filename'); </script>\n";
			$app->close();
		}

	}
예제 #11
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
		$document       = JFactory::getDocument();
		$this->settings = JEMAdmin::config();
		$task           = JFactory::getApplication()->input->get('task', '');
		$this->task     = $task;

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

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

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

		$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);

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

		$this->addToolbar();
		parent::display($tpl);
	}
예제 #12
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);
 }
예제 #13
0
파일: attendee.php 프로젝트: JKoelman/JEM-3
 /**
  * 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)
 {
     $id = $this->getState('attendee.id');
     $jemsettings = JEMAdmin::config();
     $db = JFactory::getDbo();
     if ($item = parent::getItem($pk)) {
         if (!is_null($item->id)) {
             $query = $db->getQuery(true);
             $query->select(array('name'));
             $query->from('#__users');
             $query->where('id = ' . $item->uid);
             $username = $db->setQuery($query);
             $item->username = $db->loadResult();
         }
     }
     return $item;
 }
예제 #14
0
파일: venue.php 프로젝트: JKoelman/JEM-3
 /**
  * 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;
 }
예제 #15
0
파일: event.php 프로젝트: JKoelman/JEM-3
 /**
  * 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)) {
         // Convert the params field to an array.
         $registry = new JRegistry();
         $registry->loadString($item->attribs);
         $item->attribs = $registry->toArray();
         // Convert the metadata field to an array.
         $registry = new JRegistry();
         $registry->loadString($item->metadata);
         $item->metadata = $registry->toArray();
         $item->articletext = trim($item->fulltext) != '' ? $item->introtext . "<hr id=\"system-readmore\" />" . $item->fulltext : $item->introtext;
         $db = JFactory::getDbo();
         $query = $db->getQuery(true);
         $query->select(array('count(id)'));
         $query->from('#__jem_register');
         $query->where(array('event= ' . $db->quote($item->id), 'waiting= 0'));
         $db->setQuery($query);
         $res = $db->loadResult();
         $item->booked = $res;
         $files = JEMAttachment::getAttachments('event' . $item->id);
         $item->attachments = $files;
         ################
         ## RECURRENCE ##
         ################
         # check recurrence
         if ($item->recurrence_group) {
             # this event is part of a recurrence-group
             #
             # check for groupid & groupid_ref (recurrence_table)
             # - groupid		= $item->recurrence_group
             # - groupid_ref	= $item->recurrence_group
             # - Itemid		= $item->id
             $db = JFactory::getDbo();
             $query = $db->getQuery(true);
             $query->select(array('count(id)'));
             $query->from('#__jem_recurrence');
             $query->where(array('groupid= ' . $item->recurrence_group, 'itemid= ' . $item->id, 'groupid = groupid_ref'));
             $db->setQuery($query);
             $rec_groupset_check = $db->loadResult();
             if ($rec_groupset_check == '1') {
                 $item->recurrence_groupcheck = true;
             } else {
                 $item->recurrence_groupcheck = false;
             }
         } else {
             $item->recurrence_groupcheck = false;
         }
         ##############
         ## HOLIDAYS ##
         ##############
         # Retrieve dates that are holidays and enabled.
         $db = JFactory::getDbo();
         $query = $db->getQuery(true);
         $query->select('holiday');
         $query->from('#__jem_dates');
         $query->where(array('enabled = 1', 'holiday = 1'));
         $db->setQuery($query);
         $holidays = $db->loadColumn();
         if ($holidays) {
             $item->recurrence_country_holidays = true;
         } else {
             $item->recurrence_country_holidays = false;
         }
         $item->author_ip = $jemsettings->storeip ? JemHelper::retrieveIP() : false;
         if (empty($item->id)) {
             $item->country = $jemsettings->defaultCountry;
         }
         if (!empty($item->datimage)) {
             if (strpos($item->datimage, '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->datimage = 'images/jem/events/' . $item->datimage;
             }
         }
         $admin = JFactory::getUser()->authorise('core.manage', 'com_jem');
         if ($admin) {
             $item->admin = true;
         } else {
             $item->admin = false;
         }
     }
     return $item;
 }
예제 #16
0
파일: date.php 프로젝트: JKoelman/JEM-3
 /**
  * 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)) {
     }
     return $item;
 }
예제 #17
0
			</td>
		</tr>
	</tfoot>

	<tbody>
		<?php foreach ($this->rows as $i => $row) : ?>
		 <tr class="row<?php echo $i % 2; ?>">
			<td class="center"><?php echo $this->pagination->getRowOffset($i); ?></td>
			<td align="left">
				 <a class="pointer" onclick="if (window.parent) window.parent.<?php echo $this->escape($function);?>('<?php echo $row->id; ?>', '<?php echo $this->escape(addslashes($row->venue)); ?>');"><?php echo $this->escape($row->venue); ?></a>
			</td>
			<td align="left"><?php echo $this->escape($row->city); ?></td>
			<td align="left"><?php echo $this->escape($row->state); ?></td>
			<td class="center"><?php echo $this->escape($row->country); ?></td>
		</tr>

		<?php endforeach; ?>

	</tbody>

</table>

<p class="copyright">
	<?php echo JEMAdmin::footer( ); ?>
</p>

<input type="hidden" name="task" value="" />
<input type="hidden" name="function" value="<?php echo $this->escape($function); ?>" />
<input type="hidden" name="filter_order" value="<?php echo $this->lists['order']; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $this->lists['order_Dir']; ?>" />
</form>
예제 #18
0
	/**
	 * Prepares the upload image screen
	 *
	 * @param $tpl
	 *
	 */
	protected function _displayuploadimage($tpl = null) {
		//initialise variables
		$uri 			= JFactory::getURI()->toString();
		$jemsettings	= JEMAdmin::config();

		//get vars
		$task 			= JFactory::getApplication()->input->get('task', '');

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

		jimport('joomla.client.helper');
		$ftp = JClientHelper::setCredentialsFromRequest('ftp');

		//assign data to template
		$this->task 		= $task;
		$this->jemsettings 	= $jemsettings;
		$this->request_url 	= $uri;
		$this->ftp 			= $ftp;

		parent::display($tpl);
	}
예제 #19
0
파일: default.php 프로젝트: JKoelman/JEM-3
    ?>
</td>
			<td class="center"><?php 
    echo $this->escape($row->country);
    ?>
</td>
		</tr>
		<?php 
}
?>
		</tbody>
	</table>

	<div class="poweredby">
		<?php 
echo JEMAdmin::footer();
?>
	</div>

	<input type="hidden" name="task" value="" />
	<input type="hidden" name="function" value="<?php 
echo $this->escape($function);
?>
" />
	<input type="hidden" name="filter_order" value="<?php 
echo $this->lists['order'];
?>
" />
	<input type="hidden" name="filter_order_Dir" value="<?php 
echo $this->lists['order_Dir'];
?>
예제 #20
0
파일: venue.php 프로젝트: BillVGN/PortalPRP
	/**
	 * 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;
		}

		return $item;
	}
예제 #21
0
파일: event.php 프로젝트: BillVGN/PortalPRP
	/**
	 * 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)){
			// Convert the params field to an array.
			$registry = new JRegistry;
			$registry->loadString($item->attribs);
			$item->attribs = $registry->toArray();

			// Convert the metadata field to an array.
			$registry = new JRegistry;
			$registry->loadString($item->metadata);
			$item->metadata = $registry->toArray();

			$item->articletext = trim($item->fulltext) != '' ? $item->introtext . "<hr id=\"system-readmore\" />" . $item->fulltext : $item->introtext;

			$db = JFactory::getDbo();

			$query = $db->getQuery(true);
			$query->select(array('count(id)'));
			$query->from('#__jem_register');
			$query->where(array('event= '.$db->quote($item->id), 'waiting= 0'));

			$db->setQuery($query);
			$res = $db->loadResult();
			$item->booked = $res;

			$files = JEMAttachment::getAttachments('event'.$item->id);
			$item->attachments = $files;

			if ($item->id){
				// Store current recurrence values
				$item->recurr_bak = new stdClass;
				foreach (get_object_vars($item) as $k => $v) {
					if (strncmp('recurrence_', $k, 11) === 0) {
						$item->recurr_bak->$k = $v;
					}
				}

				$item->recurrence_type 			= '';
				$item->recurrence_number 		= '';
				$item->recurrence_byday 		= '';
				$item->recurrence_counter 		= '';
				$item->recurrence_first_id 		= '';
				$item->recurrence_limit 		= '';
				$item->recurrence_limit_date	= '';
			}

			$item->author_ip = $jemsettings->storeip ? JemHelper::retrieveIP() : false;

			if (empty($item->id)){
				$item->country = $jemsettings->defaultCountry;
			}
		}

		return $item;
	}
예제 #22
0
	public function display($tpl = null)
	{
		$user 		= JemFactory::getUser();
		$document	= JFactory::getDocument();
		$settings 	= JEMHelper::globalattribs();

		$jemsettings = JEMAdmin::config();
		$url 		= JUri::root();

		// Initialise variables.
		$this->items		= $this->get('Items');
		$this->pagination	= $this->get('Pagination');
		$this->state		= $this->get('State');

		// Retrieving params
		$params = $this->state->get('params');

		// highlighter
		$highlighter = $settings->get('highlight','0');

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

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

		// Load Scripts
		$document->addScript('http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js');

		if ($highlighter) {
			$document->addScript($url.'media/com_jem/js/highlighter.js');
			$style = '
			    .red, .red a {
			    color:red;}
			    ';
			$document->addStyleDeclaration($style);
		}

		//add style to description of the tooltip (hastip)
		JHtml::_('behavior.tooltip');

		// add filter selection for the search
		$filters = array();
		$filters[] = JHtml::_('select.option', '1', JText::_('COM_JEM_EVENT_TITLE'));
		$filters[] = JHtml::_('select.option', '2', JText::_('COM_JEM_VENUE'));
		$filters[] = JHtml::_('select.option', '3', JText::_('COM_JEM_CITY'));
		$filters[] = JHtml::_('select.option', '4', JText::_('COM_JEM_CATEGORY'));
		$filters[] = JHtml::_('select.option', '5', JText::_('COM_JEM_STATE'));
		$filters[] = JHtml::_('select.option', '6', JText::_('COM_JEM_COUNTRY'));
		$filters[] = JHtml::_('select.option', '7', JText::_('JALL'));
		$lists['filter'] = JHtml::_('select.genericlist', $filters, 'filter_type', array('size'=>'1','class'=>'inputbox'), 'value', 'text', $this->state->get('filter_type'));

		//assign data to template
		$this->lists		= $lists;
		$this->user			= $user;
		$this->jemsettings  = $jemsettings;
		$this->settings		= $settings;

		// add toolbar
		$this->addToolbar();

		parent::display($tpl);
		}