Your IP : 216.73.216.224


Current Path : /var/www/html/administrator/components/com_community/views/userpoints/
Upload File :
Current File : /var/www/html/administrator/components/com_community/views/userpoints/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\Language\Text;
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Version;

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

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

/**
 * Configuration view for JomSocial
 */
class CommunityViewUserPoints 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 )
	{
		$userpoints	= $this->get( 'UserPoints' );
		$pagination	= $this->get( 'Pagination' );
		$ordering	= $this->get( 'Ordering' );

 		$this->set( 'userpoints'	, $userpoints );
 		$this->set( 'pagination'	, $pagination );
 		$this->set( 'lists'	, $ordering );

		parent::display( $tpl );
	}

	/**
	 * Method to get the publish status HTML
	 *
	 * @param	object	Field object
	 * @param	string	Type of the field
	 * @param	string	The ajax task that it should call
	 * @return	string	HTML source
	 **/
	public function getPublish( &$row , $type , $ajaxTask )
	{
		$version = new Version();
		$currentV = $version->getHelpVersion();

		$class = 'jgrid';

		$alt	= $row->$type ? Text::_('COM_COMMUNITY_PUBLISHED') : Text::_('COM_COMMUNITY_UNPUBLISH');
		$state = $row->$type == 1 ? 'publish' : 'unpublish';
		$span = '<span class="state '.$state.'"><span class="text">'.$alt.'</span></span></a>';

		if($currentV >= '0.30')
		{
			$class = $row->$type == 1 ? 'disabled jgrid': '';

			$span = '<i class="icon-'.$state.'""></i>';
		}

		$href = '<a class="'.$class.'" href="javascript:void(0);" onclick="azcommunity.togglePublish(\'' . $ajaxTask . '\',\'' . $row->id . '\',\'' . $type . '\');">';

		$href .= $span;

		return $href;
	}

	/**
	 * Private method to set the toolbar for this view
	 *
	 * @access private
	 *
	 * @return null
	 **/
	public function setToolBar()
	{
		// Set the titlebar text
		ToolbarHelper::title( Text::_('Points and Activities'), 'userpoints' );

		// Add the necessary buttons
		ToolBarHelper::addNew('ruleScan', Text::_('COM_COMMUNITY_USERPOINTS_RULE_SCAN'));
		ToolBarHelper::publishList('publish', Text::_('COM_COMMUNITY_PUBLISH'));
		ToolBarHelper::unpublishList('unpublish', Text::_('COM_COMMUNITY_UNPUBLISH'));
		ToolBarHelper::trash('removeRules', Text::_('COM_COMMUNITY_DELETE'));
		ToolBarHelper::custom('documentation', 'help', 'help', Text::_('Help'), false);
	}
}