2021-03-05 03:08:47 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @package Joomla.Component.Builder
|
|
|
|
*
|
|
|
|
* @created 30th April, 2015
|
2024-03-09 19:47:28 +00:00
|
|
|
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
|
|
|
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
2021-03-05 03:08:47 +00:00
|
|
|
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
|
|
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
|
|
|
// No direct access to this file
|
|
|
|
defined('_JEXEC') or die('Restricted access');
|
|
|
|
?>
|
|
|
|
###BOM###
|
|
|
|
|
|
|
|
// No direct access to this file
|
|
|
|
defined('_JEXEC') or die('Restricted access');
|
|
|
|
|
|
|
|
###SITE_VIEW_MODEL_HEADER###
|
|
|
|
|
|
|
|
/**
|
2022-05-25 08:30:55 +00:00
|
|
|
* ###Component### ###SView### Item Model
|
2021-03-05 03:08:47 +00:00
|
|
|
*/
|
2022-05-25 08:30:55 +00:00
|
|
|
class ###Component###Model###SView### extends ItemModel
|
2021-03-05 03:08:47 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Model context string.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $_context = 'com_###component###.###sview###';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Model user data.
|
|
|
|
*
|
|
|
|
* @var strings
|
|
|
|
*/
|
|
|
|
protected $user;
|
|
|
|
protected $userId;
|
|
|
|
protected $guest;
|
|
|
|
protected $groups;
|
|
|
|
protected $levels;
|
|
|
|
protected $app;
|
|
|
|
protected $input;
|
|
|
|
protected $uikitComp;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var object item
|
|
|
|
*/
|
|
|
|
protected $item;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Method to auto-populate the model state.
|
|
|
|
*
|
|
|
|
* Note. Calling getState in this method will result in recursion.
|
|
|
|
*
|
|
|
|
* @since 1.6
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
protected function populateState()
|
|
|
|
{
|
2024-03-09 19:47:28 +00:00
|
|
|
$this->app = Factory::getApplication();
|
2021-03-05 03:08:47 +00:00
|
|
|
$this->input = $this->app->input;
|
|
|
|
// Get the itme main id
|
|
|
|
$id = $this->input->getInt('id', null);
|
|
|
|
$this->setState('###sview###.id', $id);
|
|
|
|
|
|
|
|
// Load the parameters.
|
|
|
|
$params = $this->app->getParams();
|
|
|
|
$this->setState('params', $params);
|
|
|
|
parent::populateState();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Method to get article data.
|
|
|
|
*
|
|
|
|
* @param integer $pk The id of the article.
|
|
|
|
*
|
|
|
|
* @return mixed Menu item data object on success, false on failure.
|
|
|
|
*/
|
|
|
|
public function getItem($pk = null)
|
|
|
|
{
|
2024-03-09 19:47:28 +00:00
|
|
|
$this->user = Factory::getUser();###USER_PERMISSION_CHECK_ACCESS###
|
2021-03-05 03:08:47 +00:00
|
|
|
$this->userId = $this->user->get('id');
|
|
|
|
$this->guest = $this->user->get('guest');
|
|
|
|
$this->groups = $this->user->get('groups');
|
|
|
|
$this->authorisedGroups = $this->user->getAuthorisedGroups();
|
|
|
|
$this->levels = $this->user->getAuthorisedViewLevels();
|
|
|
|
$this->initSet = true;
|
|
|
|
|
|
|
|
$pk = (!empty($pk)) ? $pk : (int) $this->getState('###sview###.id');###SITE_BEFORE_GET_ITEM###
|
2024-03-09 19:47:28 +00:00
|
|
|
|
2021-03-05 03:08:47 +00:00
|
|
|
if ($this->_item === null)
|
|
|
|
{
|
2024-03-09 19:47:28 +00:00
|
|
|
$this->_item = [];
|
2021-03-05 03:08:47 +00:00
|
|
|
}###LICENSE_LOCKED_CHECK###
|
|
|
|
|
|
|
|
if (!isset($this->_item[$pk]))
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{###SITE_GET_ITEM###
|
|
|
|
}
|
|
|
|
catch (Exception $e)
|
|
|
|
{
|
|
|
|
if ($e->getCode() == 404)
|
|
|
|
{
|
|
|
|
// Need to go thru the error handler to allow Redirect to work.
|
2024-03-09 19:47:28 +00:00
|
|
|
JError::raiseError(404, $e->getMessage());
|
2021-03-05 03:08:47 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$this->setError($e);
|
|
|
|
$this->_item[$pk] = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}###SITE_AFTER_GET_ITEM###
|
|
|
|
|
|
|
|
return $this->_item[$pk];
|
|
|
|
}###LICENSE_LOCKED_SET_BOOL######SITE_CUSTOM_METHODS######SITE_CUSTOM_BUTTONS_METHOD###
|
|
|
|
}
|