Spade

Mini Shell

Directory:~$ /home/lmsyaran/public_html/joomla4/
Upload File

[Home] [System Details] [Kill Me]
Current File:~$ /home/lmsyaran/public_html/joomla4/ItemView.php.tar

home/lmsyaran/public_html/j3/htaccess.back/osl/View/ItemView.php000064400000006576151157165600020632
0ustar00<?php
/**
 * @package     OSL
 * @subpackage  View
 *
 * @copyright   Copyright (C) 2016 Ossolution Team, Inc. All rights
reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

namespace OSL\View;

use OSL\Utils\Html as HtmlUtils;
use JHtml, JLanguageHelper, JToolbarHelper, JText;

/**
 * Class ItemView
 *
 * Joomla CMS Item View Class. This class is used to display details
information of an item
 * or display form allow add/editing items
 *
 * @property \OSL\Model\AdminModel $model
 *
 */
class ItemView extends HtmlView
{

	/**
	 * The model state.
	 *
	 * @var \OSL\Model\State
	 */
	protected $state;

	/**
	 * The record which is being added/edited
	 *
	 * @var Object
	 */
	protected $item;

	/**
	 * The array which keeps list of "list" options which will be
displayed on the form
	 *
	 * @var array $lists
	 */
	protected $lists = array();

	/**
	 * Active languages use on the site
	 *
	 * @var array
	 */
	protected $languages = array();

	/**
	 * Method to prepare all the data for the view before it is displayed
	 */
	protected function beforeRender()
	{
		$this->state = $this->model->getState();
		$this->item  = $this->model->getData();

		if (property_exists($this->item, 'published'))
		{
			$this->lists['published'] =
HtmlUtils::getBooleanInput('published',
$this->item->published);
		}

		if (property_exists($this->item, 'access'))
		{
			$this->lists['access'] = JHtml::_('access.level',
'access', $this->item->access,
'class="form-select"', false);
		}

		if (property_exists($this->item, 'language'))
		{
			$this->lists['language'] =
JHtml::_('select.genericlist',
JHtml::_('contentlanguage.existing', true, true),
'language', 'class="form-select"',
'value', 'text', $this->item->language);
		}

		$this->languages = JLanguageHelper::getLanguages();

		if ($this->isAdminView)
		{
			$this->addToolbar();
		}
	}

	/**
	 * Add toolbar buttons for add/edit item form
	 */
	protected function addToolbar()
	{
		$helperClass = $this->container->componentNamespace .
'\\Site\\Helper\\Helper';

		if (is_callable($helperClass . '::getActions'))
		{
			$canDo = call_user_func(array($helperClass, 'getActions'),
$this->name, $this->state);
		}
		else
		{
			$canDo = call_user_func(array('\\OSL\Utils\\Helper',
'getActions'), $this->container->option);
		}

		if ($this->item->id)
		{
			$toolbarTitle = $this->container->languagePrefix . '_' .
$this->name . '_EDIT';
		}
		else
		{
			$toolbarTitle = $this->container->languagePrefix . '_' .
$this->name . '_NEW';
		}

		JToolbarHelper::title(JText::_(strtoupper($toolbarTitle)));

		if (($canDo->get('core.edit') ||
($canDo->get('core.create'))) &&
!in_array('save', $this->hideButtons))
		{
			JToolbarHelper::apply('apply', 'JTOOLBAR_APPLY');
			JToolbarHelper::save('save', 'JTOOLBAR_SAVE');
		}

		if ($canDo->get('core.create') &&
!in_array('save2new', $this->hideButtons))
		{
			JToolbarHelper::custom('save2new', 'save-new.png',
'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
		}

		if ($this->item->id &&
$canDo->get('core.create') &&
!in_array('save2copy', $this->hideButtons))
		{
			JToolbarHelper::save2copy('save2copy');
		}

		if ($this->item->id)
		{
			JToolbarHelper::cancel('cancel', 'JTOOLBAR_CLOSE');
		}
		else
		{
			JToolbarHelper::cancel('cancel',
'JTOOLBAR_CANCEL');
		}
	}
}home/lmsyaran/public_html/libraries/osl/View/ItemView.php000064400000006576151157546370017605
0ustar00<?php
/**
 * @package     OSL
 * @subpackage  View
 *
 * @copyright   Copyright (C) 2016 Ossolution Team, Inc. All rights
reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

namespace OSL\View;

use OSL\Utils\Html as HtmlUtils;
use JHtml, JLanguageHelper, JToolbarHelper, JText;

/**
 * Class ItemView
 *
 * Joomla CMS Item View Class. This class is used to display details
information of an item
 * or display form allow add/editing items
 *
 * @property \OSL\Model\AdminModel $model
 *
 */
class ItemView extends HtmlView
{

	/**
	 * The model state.
	 *
	 * @var \OSL\Model\State
	 */
	protected $state;

	/**
	 * The record which is being added/edited
	 *
	 * @var Object
	 */
	protected $item;

	/**
	 * The array which keeps list of "list" options which will be
displayed on the form
	 *
	 * @var array $lists
	 */
	protected $lists = array();

	/**
	 * Active languages use on the site
	 *
	 * @var array
	 */
	protected $languages = array();

	/**
	 * Method to prepare all the data for the view before it is displayed
	 */
	protected function beforeRender()
	{
		$this->state = $this->model->getState();
		$this->item  = $this->model->getData();

		if (property_exists($this->item, 'published'))
		{
			$this->lists['published'] =
HtmlUtils::getBooleanInput('published',
$this->item->published);
		}

		if (property_exists($this->item, 'access'))
		{
			$this->lists['access'] = JHtml::_('access.level',
'access', $this->item->access,
'class="form-select"', false);
		}

		if (property_exists($this->item, 'language'))
		{
			$this->lists['language'] =
JHtml::_('select.genericlist',
JHtml::_('contentlanguage.existing', true, true),
'language', 'class="form-select"',
'value', 'text', $this->item->language);
		}

		$this->languages = JLanguageHelper::getLanguages();

		if ($this->isAdminView)
		{
			$this->addToolbar();
		}
	}

	/**
	 * Add toolbar buttons for add/edit item form
	 */
	protected function addToolbar()
	{
		$helperClass = $this->container->componentNamespace .
'\\Site\\Helper\\Helper';

		if (is_callable($helperClass . '::getActions'))
		{
			$canDo = call_user_func(array($helperClass, 'getActions'),
$this->name, $this->state);
		}
		else
		{
			$canDo = call_user_func(array('\\OSL\Utils\\Helper',
'getActions'), $this->container->option);
		}

		if ($this->item->id)
		{
			$toolbarTitle = $this->container->languagePrefix . '_' .
$this->name . '_EDIT';
		}
		else
		{
			$toolbarTitle = $this->container->languagePrefix . '_' .
$this->name . '_NEW';
		}

		JToolbarHelper::title(JText::_(strtoupper($toolbarTitle)));

		if (($canDo->get('core.edit') ||
($canDo->get('core.create'))) &&
!in_array('save', $this->hideButtons))
		{
			JToolbarHelper::apply('apply', 'JTOOLBAR_APPLY');
			JToolbarHelper::save('save', 'JTOOLBAR_SAVE');
		}

		if ($canDo->get('core.create') &&
!in_array('save2new', $this->hideButtons))
		{
			JToolbarHelper::custom('save2new', 'save-new.png',
'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
		}

		if ($this->item->id &&
$canDo->get('core.create') &&
!in_array('save2copy', $this->hideButtons))
		{
			JToolbarHelper::save2copy('save2copy');
		}

		if ($this->item->id)
		{
			JToolbarHelper::cancel('cancel', 'JTOOLBAR_CLOSE');
		}
		else
		{
			JToolbarHelper::cancel('cancel',
'JTOOLBAR_CANCEL');
		}
	}
}