%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/lightco1/upgrade.lightco.com.au/administrator/components/com_csvi/
Upload File :
Create Path :
Current File : /home/lightco1/upgrade.lightco.com.au/administrator/components/com_csvi/toolbar.php

<?php
/**
 * @package     CSVI
 * @subpackage  Toolbar
 *
 * @author      Roland Dalmulder <contact@csvimproved.com>
 * @copyright   Copyright (C) 2006 - 2016 RolandD Cyber Produksi. All rights reserved.
 * @license     GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 * @link        http://www.csvimproved.com
 */

defined('_JEXEC') or die;

/**
 * Creates the CSVI toolbars.
 *
 * @package     CSVI
 * @subpackage  Toolbar
 * @since       6.0
 */
class CsviToolbar extends FOFToolbar
{
	/**
	 * Renders the submenu (toolbar links) for all detected views of this component
	 *
	 * @return  void
	 *
	 * @since   6.0
	 */
	public function renderSubmenu()
	{
		$activeView = $this->input->getCmd('view', 'cpanel');

		if ($activeView !== 'imports' && $activeView !== 'exports'&& $activeView !== 'maintenance')
		{
			$views = array(
				'cpanel',
				'imports',
				'exports',
				'COM_CSVI_TITLE_TEMPLATES'   => array(
					'templates',
					'templatefields',
					'rules',
					'maps'
				),
				'COM_CSVI_TITLE_MAINTENANCE' => array(
					'maintenance',
					'availablefields',
					'analyzer',
					'tasks',
					'processes'
				),
				'logs',
				'about'
			);

			foreach ($views as $label => $view)
			{
				if (!is_array($view))
				{
					$this->addSubmenuLink($view);
				}
				else
				{
					$label = JText::_($label);
					$this->appendLink($label, '', false);

					foreach ($view as $v)
					{
						$this->addSubmenuLink($v, $label);
					}
				}
			}
		}
	}

	/**
	 * Creates the submenu links.
	 *
	 * @param   string       $view    The name of the view.
	 * @param   string|null  $parent  The parent element (referenced by name)) This will create a dropdown list
	 *
	 * @return  void.
	 *
	 * @since   6.0
	 */
	private function addSubmenuLink($view, $parent = null)
	{
		static $activeView = null;

		if (empty($activeView))
		{
			$activeView = $this->input->getCmd('view', 'csvi');
		}

		if ($activeView == 'cpanels')
		{
			$activeView = 'csvi';
		}

		$key = strtoupper($this->component) . '_TITLE_' . strtoupper($view);

		if (strtoupper(JText::_($key)) == $key)
		{
			$altview = FOFInflector::isPlural($view) ? FOFInflector::singularize($view) : FOFInflector::pluralize($view);
			$key2 = strtoupper($this->component) . '_TITLE_' . strtoupper($altview);

			if (strtoupper(JText::_($key2)) == $key2)
			{
				$name = ucfirst($view);
			}
			else
			{
				$name = JText::_($key2);
			}
		}
		else
		{
			$name = JText::_($key);
		}

		$link = 'index.php?option=' . $this->component . '&view=' . $view;

		$active = $view == $activeView;

		$this->appendLink($name, $link, $active, null, $parent);
	}

	/**
	 * Creates the Export toolbar.
	 *
	 * @return  void.
	 *
	 * @since   6.0
	 */
	protected function onExportsExport()
	{
		$this->onExportsRead('download');
	}

	/**
	 * Creates the Export toolbar.
	 *
	 * @return  void.
	 *
	 * @since   6.0
	 */
	protected function onExportsDetail()
	{
		$this->renderSubmenu();
		$this->toolbarTitle('download');
		JToolBarHelper::custom('start', 'download', 'download', JText::_('COM_CSVI_EXPORT'), false);
	}

	/**
	 * Creates the Export start toolbar.
	 *
	 * @return  void.
	 *
	 * @since   6.0
	 */
	protected function onExportsStart()
	{
		$this->toolbarTitle('download');
		JToolBarHelper::cancel();
	}

	/**
	 * Creates the Import toolbar.
	 *
	 * @return  void.
	 *
	 * @since   6.0
	 */
	protected function onImportsDetail()
	{
		$this->renderSubmenu();
		$this->toolbarTitle('upload');
		JToolBarHelper::custom('selectsource', 'upload', 'upload', JText::_('COM_CSVI_SELECT_IMPORTFILE'), false);
	}

	/**
	 * Creates the Import start toolbar.
	 *
	 * @return  void.
	 *
	 * @since   6.0
	 */
	protected function onImportsStart()
	{
		$this->toolbarTitle('upload');
		JToolBarHelper::cancel();
	}

	/**
	 * Creates the Import sources toolbar.
	 *
	 * @return  void.
	 *
	 * @since   6.0
	 */
	protected function onImportsourcesDetail()
	{
		$this->toolbarTitle('upload');
		JToolBarHelper::cancel();
		JToolBarHelper::divider();
		JToolBarHelper::custom('preview', 'eye-open', 'eye-open', JText::_('COM_CSVI_PREVIEW'), false);
	}

	/**
	 * Creates the Import preview toolbar.
	 *
	 * @return  void.
	 *
	 * @since   6.0
	 */
	protected function onImportpreviewsDetail()
	{
		$this->toolbarTitle('upload');
		JToolBarHelper::cancel();
		JToolBarHelper::divider();
		JToolBarHelper::custom('start', 'play', 'play', JText::_('COM_CSVI_START_IMPORT'), false);
	}

	/**
	 * Creates the Maintenance list toolbar.
	 *
	 * @return  void.
	 *
	 * @since   6.0
	 */
	protected function onMaintenancesDetail()
	{
		$this->renderSubmenu();
		$this->toolbarTitle('tools');

		// Show the toolbar
		JToolBarHelper::custom('read', 'arrow-right', 'arrow-right', JText::_('COM_CSVI_CONTINUE'), false);
		JToolBarHelper::divider();
		JToolBarHelper::custom('hidetips', 'help', 'help', JText::_('COM_CSVI_HELP'), false);
	}

	/**
	 * Creates the Maintenance operation toolbar.
	 *
	 * @return  void.
	 *
	 * @since   6.0
	 */
	protected function onMaintenancesRead()
	{
		$this->toolbarTitle('tools');
		JToolBarHelper::custom('canceloperation', 'cancel', 'cancel', JText::_('COM_CSVI_CANCEL'), false);
	}

	/**
	 * Creates the toolbar title.
	 *
	 * @param   string  $icon  The icon to use for the title
	 * @param   string  $task  The task of the page
	 *
	 * @return  void.
	 *
	 * @since   6.0
	 */
	private function toolbarTitle($icon = '', $task= '')
	{
		// Set toolbar title
		$option = $this->input->getCmd('option', 'com_csvi');

		if (empty($icon))
		{
			$view = $this->input->getCmd('view', '');
			$icon = str_replace('com_', '', $option) . '-' . $view . '-48';
		}

		if ($task)
		{
			$task = '_' . $task;
		}

		$subtitle_key = strtoupper($option . '_TITLE_' . $this->input->getCmd('view', 'cpanel') . $task);
		JToolBarHelper::title(JText::_(strtoupper($option)) . ' - ' . JText::_($subtitle_key), $icon);
	}
}

Zerion Mini Shell 1.0