Your IP : 216.73.216.224


Current Path : /var/www/html/administrator/components/com_community/views/eventcategories/
Upload File :
Current File : /var/www/html/administrator/components/com_community/views/eventcategories/view.html.php

<?php
/**
* @copyright (C) 2013 iJoomla, Inc. - All rights reserved.
* @license GNU General Public License, version 2 (http://www.gnu.org/licenses/gpl-2.0.html)
* @author iJoomla.com <webmaster@ijoomla.com>
* @url https://www.jomsocial.com/license-agreement
* The PHP code portions are distributed under the GPL license. If not otherwise stated, all images, manuals, cascading style sheets, and included JavaScript *are NOT GPL, and are released under the IJOOMLA Proprietary Use License v1.0
* More info at https://www.jomsocial.com/license-agreement
*/

use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Table\Table;
use Joomla\CMS\Toolbar\ToolbarHelper;

// Disallow direct access to this file
defined('_JEXEC') or die('Restricted access');

jimport( 'joomla.application.component.view' );

/**
 * Configuration view for JomSocial
 */
class CommunityViewEventCategories extends HtmlView
{
	/**
	 * The default method that will display the output of this view which is called by
	 * Joomla
	 *
	 * @param	string template	Template file name
	 **/
	public function display( $tpl = null )
	{
		$mainframe	= Factory::getApplication();

		$filter_order		= $mainframe->getUserStateFromRequest( "com_community.eventcategories.filter_order",		'filter_order',		'name',	'cmd' );
		$filter_order_Dir	= $mainframe->getUserStateFromRequest( "com_community.eventcategories.filter_order_Dir",	'filter_order_Dir',	'',			'word' );

		// table ordering
		$lists['order_Dir']	= $filter_order_Dir;
		$lists['order']		= $filter_order;

		$categories	= $this->get( 'Categories' );
		$pagination	= $this->get( 'Pagination' );
		$catCount	= $this->get( 'CategoriesCount' );

		// Escape the output
		//CFactory::load( 'helpers' , 'string' );
		foreach ($categories as $row)
		{
			$row->name	    = CStringHelper::escape($row->name);
			$row->description   = CStringHelper::escape($row->description);

			if( $row->parent == 0 )
			{
				$row->pname	=   Text::_("COM_COMMUNITY_NO_PARENT");
			}
			else
			{
				$parent   = Table::getInstance( 'eventcategories', 'CommunityTable' );
				$parent->load( $row->parent );

				$row->pname	=   CStringHelper::escape( $parent->name );
			}
		}

		$this->set( 'lists' 	, $lists );
		$this->set( 'categories'	, $categories );
		$this->set( 'catCount'	, $catCount );
		$this->set( 'pagination'	, $pagination );
		parent::display( $tpl );
	}

	public function setToolBar()
	{
		// Set the titlebar text
		ToolbarHelper::title( Text::_('COM_COMMUNITY_EVENT_CATEGORIES'), 'eventcategories');

		// Add the necessary buttons

		ToolBarHelper::trash( 'removecategory', Text::_('COM_COMMUNITY_DELETE'));
		ToolBarHelper::addNew( 'newcategory' , Text::_('COM_COMMUNITY_NEW') );
	}
}