159 lines
3.6 KiB
PHP
159 lines
3.6 KiB
PHP
<?php
|
|
/**
|
|
* @package Joomla.Component.Builder
|
|
*
|
|
* @created 4th September 2022
|
|
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
|
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
|
* @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 JCB template file (EVER)
|
|
defined('_JCB_TEMPLATE') or die;
|
|
?>
|
|
###BOM###
|
|
namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Api\Controller;
|
|
|
|
###API_VIEWS_CONTROLLER_HEADER###
|
|
|
|
// No direct access to this file
|
|
\defined('_JEXEC') or die;
|
|
|
|
/**
|
|
* ###Views### Api Controller
|
|
*
|
|
* The read-only list resource of the ###views### view. The item resource
|
|
* of the ###view### view carries the create, update and delete tasks.
|
|
*
|
|
* @since 4.0.0
|
|
*/
|
|
class ###Views###Controller extends ApiController
|
|
{
|
|
/**
|
|
* The content type of the item.
|
|
*
|
|
* @var string
|
|
* @since 4.0.0
|
|
*/
|
|
protected $contentType = '###views###';
|
|
|
|
/**
|
|
* The default view for the display method.
|
|
*
|
|
* @var string
|
|
* @since 3.0
|
|
*/
|
|
protected $default_view = '###views###';
|
|
|
|
/**
|
|
* Method to get a model object, loading it if required.
|
|
*
|
|
* @param string $name The model name. Optional.
|
|
* @param string $prefix The class prefix. Optional.
|
|
* @param array $config Configuration array for model. Optional.
|
|
*
|
|
* @return \Joomla\CMS\MVC\Model\BaseDatabaseModel|boolean Model object on success; otherwise false on failure.
|
|
*
|
|
* @since 4.0.0
|
|
*/
|
|
public function getModel($name = '', $prefix = '', $config = [])
|
|
{###API_VIEWS_CONTROLLER_GETMODEL###
|
|
}
|
|
|
|
/**
|
|
* Basic display of a list view
|
|
*
|
|
* @return static A \JControllerLegacy object to support chaining.
|
|
*
|
|
* @since 4.0.0
|
|
*/
|
|
public function displayList()
|
|
{###API_VIEWS_CONTROLLER_DISPLAYLIST###
|
|
}
|
|
|
|
/**
|
|
* The list resource does not serve one item.
|
|
*
|
|
* @param integer $id The primary key to display.
|
|
*
|
|
* @return static A \JControllerLegacy object to support chaining.
|
|
*
|
|
* @throws \RuntimeException
|
|
* @since 4.0.0
|
|
*/
|
|
public function displayItem($id = null)
|
|
{
|
|
throw new \RuntimeException(Text::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'), 405);
|
|
}
|
|
|
|
/**
|
|
* The list resource is read-only.
|
|
*
|
|
* @return void
|
|
*
|
|
* @throws \RuntimeException
|
|
* @since 4.0.0
|
|
*/
|
|
public function add()
|
|
{
|
|
throw new \RuntimeException(Text::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'), 405);
|
|
}
|
|
|
|
/**
|
|
* The list resource is read-only.
|
|
*
|
|
* @return static A \JControllerLegacy object to support chaining.
|
|
*
|
|
* @throws \RuntimeException
|
|
* @since 4.0.0
|
|
*/
|
|
public function edit()
|
|
{
|
|
throw new \RuntimeException(Text::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'), 405);
|
|
}
|
|
|
|
/**
|
|
* The list resource is read-only.
|
|
*
|
|
* @param integer $id The primary key to delete item.
|
|
*
|
|
* @return void
|
|
*
|
|
* @throws \RuntimeException
|
|
* @since 4.0.0
|
|
*/
|
|
public function delete($id = null)
|
|
{
|
|
throw new \RuntimeException(Text::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'), 405);
|
|
}
|
|
|
|
/**
|
|
* Clean one request filter value, or each value of a multi select filter.
|
|
*
|
|
* @param mixed $value The request value.
|
|
*
|
|
* @return mixed The clean string, or the array of clean strings.
|
|
*
|
|
* @since 4.0.0
|
|
*/
|
|
protected function cleanFilter($value)
|
|
{
|
|
$filter = InputFilter::getInstance();
|
|
|
|
if (is_array($value))
|
|
{
|
|
$clean = [];
|
|
|
|
foreach ($value as $one)
|
|
{
|
|
$clean[] = $filter->clean($one, 'STRING');
|
|
}
|
|
|
|
return $clean;
|
|
}
|
|
|
|
return $filter->clean($value, 'STRING');
|
|
}
|
|
}
|