Stable release of v4.0.0-alpha1
First alpha release of Component Builder towards Joomla 4 (very unstable...).
This commit is contained in:
1
admin/compiler/joomla_4/1.0.0.sql
Normal file
1
admin/compiler/joomla_4/1.0.0.sql
Normal file
@ -0,0 +1 @@
|
||||
###UPDATE_VERSION_MYSQL###
|
102
admin/compiler/joomla_4/ADMIN_AJAX_CONTROLLER.php
Normal file
102
admin/compiler/joomla_4/ADMIN_AJAX_CONTROLLER.php
Normal file
@ -0,0 +1,102 @@
|
||||
<?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###\Administrator\Controller;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Application\CMSApplication;
|
||||
use Joomla\CMS\MVC\Controller\BaseController;
|
||||
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use Joomla\Input\Input;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* ###Component### Ajax Base Controller
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class AjaxController extends BaseController
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param array $config An optional associative array of configuration settings.
|
||||
* Recognized key values include 'name', 'default_task', 'model_path', and
|
||||
* 'view_path' (this list is not meant to be comprehensive).
|
||||
* @param ?MVCFactoryInterface $factory The factory.
|
||||
* @param ?CMSApplication $app The Application for the dispatcher
|
||||
* @param ?Input $input Input
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public function __construct($config = [], ?MVCFactoryInterface $factory = null, ?CMSApplication $app = null, ?Input $input = null)
|
||||
{
|
||||
parent::__construct($config, $factory, $app, $input);
|
||||
|
||||
// make sure all json stuff are set
|
||||
$this->app->getDocument()->setMimeEncoding( 'application/json' );
|
||||
$this->app->setHeader('Content-Disposition','attachment;filename="getajax.json"');
|
||||
$this->app->setHeader('Access-Control-Allow-Origin', '*');
|
||||
// load the tasks###REGISTER_AJAX_TASK###
|
||||
}
|
||||
|
||||
/**
|
||||
* The ajax function
|
||||
*
|
||||
* @since 3.10
|
||||
*/
|
||||
public function ajax()
|
||||
{
|
||||
// get the user for later use
|
||||
$user = $this->app->getIdentity();
|
||||
// get the input values
|
||||
$jinput = $this->input ?? $this->app->input;
|
||||
// check if we should return raw (DEFAULT TRUE SINCE J4)
|
||||
$returnRaw = $jinput->get('raw', true, 'BOOLEAN');
|
||||
// return to a callback function
|
||||
$callback = $jinput->get('callback', null, 'CMD');
|
||||
// Check Token!
|
||||
$token = Session::getFormToken();
|
||||
$call_token = $jinput->get('token', 0, 'ALNUM');
|
||||
if($jinput->get($token, 0, 'ALNUM') || $token === $call_token)
|
||||
{
|
||||
// get the task
|
||||
$task = $this->getTask();
|
||||
switch($task)
|
||||
{###AJAX_INPUT_RETURN###
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// return to a callback function
|
||||
if($callback)
|
||||
{
|
||||
echo $callback."(".json_encode(['error' => 'There was an error! [129]']).");";
|
||||
}
|
||||
elseif($returnRaw)
|
||||
{
|
||||
echo json_encode(['error' => 'There was an error! [129]']);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "(".json_encode(['error' => 'There was an error! [129]']).");";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
62
admin/compiler/joomla_4/ADMIN_AJAX_MODEL.php
Normal file
62
admin/compiler/joomla_4/ADMIN_AJAX_MODEL.php
Normal file
@ -0,0 +1,62 @@
|
||||
<?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###\Administrator\Model;
|
||||
|
||||
###AJAX_ADMIN_MODEL_HEADER###
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* ###Component### Ajax List Model
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class AjaxModel extends ListModel
|
||||
{
|
||||
/**
|
||||
* The component params.
|
||||
*
|
||||
* @var Registry
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Registry $app_params;
|
||||
|
||||
/**
|
||||
* The application object.
|
||||
*
|
||||
* @var CMSApplicationInterface The application instance.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected CMSApplicationInterface $app;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param array $config An array of configuration options (name, state, dbo, table_path, ignore_request).
|
||||
* @param ?MVCFactoryInterface $factory The factory.
|
||||
*
|
||||
* @since 1.6
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function __construct($config = [], MVCFactoryInterface $factory = null)
|
||||
{
|
||||
parent::__construct($config, $factory);
|
||||
|
||||
$this->app_params = ComponentHelper::getParams('com_###component###');
|
||||
$this->app ??= Factory::getApplication();
|
||||
}###AJAX_MODEL_METHODS###
|
||||
}
|
50
admin/compiler/joomla_4/ADMIN_DISPLAY_CONTROLLER.php
Normal file
50
admin/compiler/joomla_4/ADMIN_DISPLAY_CONTROLLER.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?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###\Administrator\Controller;
|
||||
|
||||
use Joomla\CMS\MVC\Controller\BaseController;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Router\Route;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* ###Component### master admin display controller.
|
||||
*
|
||||
* @since 4.0
|
||||
*/
|
||||
class DisplayController extends BaseController
|
||||
{
|
||||
/**
|
||||
* The default view.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $default_view = '###DASHBOARDVIEW###';
|
||||
|
||||
/**
|
||||
* display task
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function display($cachable = false, $urlparams = false)
|
||||
{
|
||||
return parent::display($cachable, $urlparams);
|
||||
}
|
||||
}
|
80
admin/compiler/joomla_4/ADMIN_EXTENSION_COMPONENT.php
Normal file
80
admin/compiler/joomla_4/ADMIN_EXTENSION_COMPONENT.php
Normal file
@ -0,0 +1,80 @@
|
||||
<?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###\Administrator\Extension;
|
||||
|
||||
use Joomla\CMS\Association\AssociationServiceInterface;
|
||||
use Joomla\CMS\Association\AssociationServiceTrait;
|
||||
use Joomla\CMS\Categories\CategoryServiceInterface;
|
||||
use Joomla\CMS\Categories\CategoryServiceTrait;
|
||||
use Joomla\CMS\Component\Router\RouterServiceInterface;
|
||||
use Joomla\CMS\Component\Router\RouterServiceTrait;
|
||||
use Joomla\CMS\Extension\BootableExtensionInterface;
|
||||
use Joomla\CMS\Extension\MVCComponent;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Fields\FieldsServiceInterface;
|
||||
use Joomla\CMS\Form\Form;
|
||||
use Joomla\CMS\HTML\HTMLRegistryAwareTrait;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Tag\TagServiceInterface;
|
||||
use Joomla\CMS\Tag\TagServiceTrait;
|
||||
use Joomla\CMS\User\UserFactoryInterface;
|
||||
// (soon) use ###NAMESPACEPREFIX###\Component\###ComponentNameSpace###\Administrator\Service\HTML\AdministratorService;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Component class for com_###component###
|
||||
*
|
||||
* @since 4.0
|
||||
*/
|
||||
class ###Component###Component extends MVCComponent implements
|
||||
BootableExtensionInterface,
|
||||
CategoryServiceInterface,
|
||||
RouterServiceInterface
|
||||
{
|
||||
use AssociationServiceTrait;
|
||||
use HTMLRegistryAwareTrait;
|
||||
use RouterServiceTrait;
|
||||
use CategoryServiceTrait, TagServiceTrait {
|
||||
CategoryServiceTrait::getTableNameForSection insteadof TagServiceTrait;
|
||||
CategoryServiceTrait::getStateColumnForSection insteadof TagServiceTrait;
|
||||
}
|
||||
|
||||
/**
|
||||
* Booting the extension. This is the function to set up the environment of the extension like
|
||||
* registering new class loaders, etc.
|
||||
*
|
||||
* If required, some initial set up can be done from services of the container, eg.
|
||||
* registering HTML services.
|
||||
*
|
||||
* @param ContainerInterface $container The container
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public function boot(ContainerInterface $container)
|
||||
{
|
||||
// (soon) $this->getRegistry()->register('###component###administrator', new AdministratorService());
|
||||
}
|
||||
|
||||
// will fix these soon
|
||||
protected function getTableNameForSection(string $section = null){}
|
||||
public function countItems(array $items, string $section){}
|
||||
|
||||
}
|
135
admin/compiler/joomla_4/ADMIN_HEADERCHECK.php
Normal file
135
admin/compiler/joomla_4/ADMIN_HEADERCHECK.php
Normal file
@ -0,0 +1,135 @@
|
||||
<?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###\Administrator\Helper;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Document\Document;
|
||||
use Joomla\CMS\Application\CMSApplication;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Helper class for checking loaded scripts and styles in the document header.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class HeaderCheck
|
||||
{
|
||||
/**
|
||||
* @var CMSApplication Application object
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected CMSApplication $app;
|
||||
|
||||
/**
|
||||
* @var Document object
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Document $document;
|
||||
|
||||
/**
|
||||
* Construct the app and document
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
// Initializes the application object.
|
||||
$this->app ??= Factory::getApplication();
|
||||
|
||||
// Initializes the document object.
|
||||
$this->document = $this->app->getDocument();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a JavaScript file is loaded in the document head.
|
||||
*
|
||||
* @param string $scriptName Name of the script to check.
|
||||
*
|
||||
* @return bool True if the script is loaded, false otherwise.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function js_loaded(string $scriptName): bool
|
||||
{
|
||||
return $this->isLoaded($scriptName, 'scripts');
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a CSS file is loaded in the document head.
|
||||
*
|
||||
* @param string $scriptName Name of the stylesheet to check.
|
||||
*
|
||||
* @return bool True if the stylesheet is loaded, false otherwise.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function css_loaded(string $scriptName): bool
|
||||
{
|
||||
return $this->isLoaded($scriptName, 'styleSheets');
|
||||
}
|
||||
|
||||
/**
|
||||
* Abstract method to check if a given script or stylesheet is loaded.
|
||||
*
|
||||
* @param string $scriptName Name of the script or stylesheet.
|
||||
* @param string $type Type of asset to check ('scripts' or 'styleSheets').
|
||||
*
|
||||
* @return bool True if the asset is loaded, false otherwise.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
private function isLoaded(string $scriptName, string $type): bool
|
||||
{
|
||||
// UIkit specific check
|
||||
if ($this->isUIkit($scriptName))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
$head_data = $this->document->getHeadData();
|
||||
foreach (array_keys($head_data[$type]) as $script)
|
||||
{
|
||||
if (stristr($script, $scriptName))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for UIkit framework specific conditions.
|
||||
*
|
||||
* @param string $scriptName Name of the script or stylesheet.
|
||||
*
|
||||
* @return bool True if UIkit specific conditions are met, false otherwise.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
private function isUIkit(string $scriptName): bool
|
||||
{
|
||||
if (strpos($scriptName, 'uikit') !== false)
|
||||
{
|
||||
$get_template_name = $this->app->getTemplate('template')->template;
|
||||
if (strpos($get_template_name, 'yoo') !== false)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
937
admin/compiler/joomla_4/ADMIN_HELPER_CLASS.php
Normal file
937
admin/compiler/joomla_4/ADMIN_HELPER_CLASS.php
Normal file
@ -0,0 +1,937 @@
|
||||
<?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###\Administrator\Helper;
|
||||
|
||||
###ADMIN_POWER_HELPER###
|
||||
|
||||
###ADMIN_HELPER_CLASS_HEADER###
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* ###Component### component helper.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
abstract class ###Component###Helper
|
||||
{
|
||||
/**
|
||||
* Composer Switch
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected static $composer = [];
|
||||
|
||||
/**
|
||||
* The Main Active Language
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public static $langTag;###ADMIN_GLOBAL_EVENT_HELPER######CUSTOM_HELPER_SCRIPT######BOTH_CUSTOM_HELPER_SCRIPT###
|
||||
|
||||
/**
|
||||
* Load the Composer Vendors
|
||||
*/
|
||||
public static function composerAutoload($target)
|
||||
{
|
||||
// insure we load the composer vendor only once
|
||||
if (!isset(self::$composer[$target]))
|
||||
{
|
||||
// get the function name
|
||||
$functionName = Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe('compose' . $target);
|
||||
// check if method exist
|
||||
if (method_exists(__CLASS__, $functionName))
|
||||
{
|
||||
return self::{$functionName}();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return self::$composer[$target];
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the Component xml manifest.
|
||||
*/
|
||||
public static function manifest()
|
||||
{
|
||||
$manifestUrl = JPATH_ADMINISTRATOR."/components/com_###component###/###component###.xml";
|
||||
return simplexml_load_file($manifestUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Joomla version object
|
||||
*/
|
||||
protected static $JVersion;
|
||||
|
||||
/**
|
||||
* set/get Joomla version
|
||||
*/
|
||||
public static function jVersion()
|
||||
{
|
||||
// check if set
|
||||
if (!Super___91004529_94a9_4590_b842_e7c6b624ecf5___Power::check(self::$JVersion))
|
||||
{
|
||||
self::$JVersion = new Version();
|
||||
}
|
||||
return self::$JVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the Contributors details.
|
||||
*/
|
||||
public static function getContributors()
|
||||
{
|
||||
// get params
|
||||
$params = ComponentHelper::getParams('com_###component###');
|
||||
// start contributors array
|
||||
$contributors = [];
|
||||
// get all Contributors (max 20)
|
||||
$searchArray = range('0','20');
|
||||
foreach($searchArray as $nr)
|
||||
{
|
||||
if ((NULL !== $params->get("showContributor".$nr)) && ($params->get("showContributor".$nr) == 1 || $params->get("showContributor".$nr) == 3))
|
||||
{
|
||||
// set link based of selected option
|
||||
if($params->get("useContributor".$nr) == 1)
|
||||
{
|
||||
$link_front = '<a href="mailto:'.$params->get("emailContributor".$nr).'" target="_blank">';
|
||||
$link_back = '</a>';
|
||||
}
|
||||
elseif($params->get("useContributor".$nr) == 2)
|
||||
{
|
||||
$link_front = '<a href="'.$params->get("linkContributor".$nr).'" target="_blank">';
|
||||
$link_back = '</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$link_front = '';
|
||||
$link_back = '';
|
||||
}
|
||||
$contributors[$nr]['title'] = Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($params->get("titleContributor".$nr));
|
||||
$contributors[$nr]['name'] = $link_front.Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($params->get("nameContributor".$nr)).$link_back;
|
||||
}
|
||||
}
|
||||
return $contributors;
|
||||
}###HELP###
|
||||
|
||||
/**
|
||||
* Configure the Linkbar.
|
||||
*/
|
||||
public static function addSubmenu($submenu)
|
||||
{
|
||||
// load user for access menus
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
// load the submenus to sidebar
|
||||
###SUBMENU###
|
||||
}###HELPER_CREATEUSER######HELPER_UIKIT######HELPER_EXEL###
|
||||
|
||||
/**
|
||||
* Get a Variable
|
||||
*
|
||||
* @param string $table The table from which to get the variable
|
||||
* @param string $where The value where
|
||||
* @param string $whereString The target/field string where/name
|
||||
* @param string $what The return field
|
||||
* @param string $operator The operator between $whereString/field and $where/value
|
||||
* @param string $main The component in which the table is found
|
||||
*
|
||||
* @return mix string/int/float
|
||||
* @deprecated 3.3 Use Super___db87c339_5bb6_4291_a7ef_2c48ea1b06bc___Power::var(...);
|
||||
*/
|
||||
public static function getVar($table, $where = null, $whereString = 'user', $what = 'id', $operator = '=', $main = '###component###')
|
||||
{
|
||||
return Super___db87c339_5bb6_4291_a7ef_2c48ea1b06bc___Power::var(
|
||||
$table,
|
||||
$where,
|
||||
$whereString,
|
||||
$what,
|
||||
$operator,
|
||||
$main
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get array of variables
|
||||
*
|
||||
* @param string $table The table from which to get the variables
|
||||
* @param string $where The value where
|
||||
* @param string $whereString The target/field string where/name
|
||||
* @param string $what The return field
|
||||
* @param string $operator The operator between $whereString/field and $where/value
|
||||
* @param string $main The component in which the table is found
|
||||
* @param bool $unique The switch to return a unique array
|
||||
*
|
||||
* @return array
|
||||
* @deprecated 3.3 Use Super___db87c339_5bb6_4291_a7ef_2c48ea1b06bc___Power::vars(...);
|
||||
*/
|
||||
public static function getVars($table, $where = null, $whereString = 'user', $what = 'id', $operator = 'IN', $main = '###component###', $unique = true)
|
||||
{
|
||||
return Super___db87c339_5bb6_4291_a7ef_2c48ea1b06bc___Power::vars(
|
||||
$table,
|
||||
$where,
|
||||
$whereString,
|
||||
$what,
|
||||
$operator,
|
||||
$main,
|
||||
$unique
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a json object to a string
|
||||
*
|
||||
* @input string $value The json string to convert
|
||||
*
|
||||
* @returns a string
|
||||
* @deprecated 3.3 Use Super___4b225c51_d293_48e4_b3f6_5136cf5c3f18___Power::string(...);
|
||||
*/
|
||||
public static function jsonToString($value, $sperator = ", ", $table = null, $id = 'id', $name = 'name')
|
||||
{
|
||||
return Super___4b225c51_d293_48e4_b3f6_5136cf5c3f18___Power::string(
|
||||
$value,
|
||||
$sperator,
|
||||
$table,
|
||||
$id,
|
||||
$name
|
||||
);
|
||||
}
|
||||
|
||||
public static function isPublished($id,$type)
|
||||
{
|
||||
if ($type == 'raw')
|
||||
{
|
||||
$type = 'item';
|
||||
}
|
||||
$db = Factory::getContainer()->get(DatabaseInterface::class);
|
||||
$query = $db->getQuery(true);
|
||||
$query->select(array('a.published'));
|
||||
$query->from('#__###component###_'.$type.' AS a');
|
||||
$query->where('a.id = '. (int) $id);
|
||||
$query->where('a.published = 1');
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
$found = $db->getNumRows();
|
||||
if($found)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function getGroupName($id)
|
||||
{
|
||||
$db = Factory::getContainer()->get(DatabaseInterface::class);
|
||||
$query = $db->getQuery(true);
|
||||
$query->select(array('a.title'));
|
||||
$query->from('#__usergroups AS a');
|
||||
$query->where('a.id = '. (int) $id);
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
$found = $db->getNumRows();
|
||||
if($found)
|
||||
{
|
||||
return $db->loadResult();
|
||||
}
|
||||
return $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the action permissions
|
||||
*
|
||||
* @param string $view The related view name
|
||||
* @param int $record The item to act upon
|
||||
* @param string $views The related list view name
|
||||
* @param mixed $target Only get this permission (like edit, create, delete)
|
||||
* @param string $component The target component
|
||||
* @param object $user The user whose permissions we are loading
|
||||
*
|
||||
* @return object The CMSObject of permission/authorised actions
|
||||
*
|
||||
*/
|
||||
public static function getActions($view, &$record = null, $views = null, $target = null, $component = '###component###', $user = 'null')
|
||||
{
|
||||
// load the user if not given
|
||||
if (!Super___91004529_94a9_4590_b842_e7c6b624ecf5___Power::check($user))
|
||||
{
|
||||
// get the user object
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
}
|
||||
// load the CMSObject
|
||||
$result = new CMSObject;
|
||||
// make view name safe (just incase)
|
||||
$view = Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe($view);
|
||||
if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($views))
|
||||
{
|
||||
$views = Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe($views);
|
||||
}
|
||||
// get all actions from component
|
||||
$actions = Access::getActionsFromFile(
|
||||
JPATH_ADMINISTRATOR . '/components/com_' . $component . '/access.xml',
|
||||
"/access/section[@name='component']/"
|
||||
);
|
||||
// if non found then return empty CMSObject
|
||||
if (empty($actions))
|
||||
{
|
||||
return $result;
|
||||
}
|
||||
// get created by if not found
|
||||
if (Super___91004529_94a9_4590_b842_e7c6b624ecf5___Power::check($record) && !isset($record->created_by) && isset($record->id))
|
||||
{
|
||||
$record->created_by = Super___db87c339_5bb6_4291_a7ef_2c48ea1b06bc___Power::var($view, $record->id, 'id', 'created_by', '=', $component);
|
||||
}
|
||||
// set actions only set in component settings
|
||||
$componentActions = array('core.admin', 'core.manage', 'core.options', 'core.export');
|
||||
// check if we have a target
|
||||
$checkTarget = false;
|
||||
if ($target)
|
||||
{
|
||||
// convert to an array
|
||||
if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($target))
|
||||
{
|
||||
$target = array($target);
|
||||
}
|
||||
// check if we are good to go
|
||||
if (Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($target))
|
||||
{
|
||||
$checkTarget = true;
|
||||
}
|
||||
}
|
||||
// loop the actions and set the permissions
|
||||
foreach ($actions as $action)
|
||||
{
|
||||
// check target action filter
|
||||
if ($checkTarget && self::filterActions($view, $action->name, $target))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// set to use component default
|
||||
$fallback = true;
|
||||
// reset permission per/action
|
||||
$permission = false;
|
||||
$catpermission = false;
|
||||
// set area
|
||||
$area = 'comp';
|
||||
// check if the record has an ID and the action is item related (not a component action)
|
||||
if (Super___91004529_94a9_4590_b842_e7c6b624ecf5___Power::check($record) && isset($record->id) && $record->id > 0 && !in_array($action->name, $componentActions) &&
|
||||
(strpos($action->name, 'core.') !== false || strpos($action->name, $view . '.') !== false))
|
||||
{
|
||||
// we are in item
|
||||
$area = 'item';
|
||||
// The record has been set. Check the record permissions.
|
||||
$permission = $user->authorise($action->name, 'com_' . $component . '.' . $view . '.' . (int) $record->id);
|
||||
// if no permission found, check edit own
|
||||
if (!$permission)
|
||||
{
|
||||
// With edit, if the created_by matches current user then dig deeper.
|
||||
if (($action->name === 'core.edit' || $action->name === $view . '.edit') && $record->created_by > 0 && ($record->created_by == $user->id))
|
||||
{
|
||||
// the correct target
|
||||
$coreCheck = (array) explode('.', $action->name);
|
||||
// check that we have both local and global access
|
||||
if ($user->authorise($coreCheck[0] . '.edit.own', 'com_' . $component . '.' . $view . '.' . (int) $record->id) &&
|
||||
$user->authorise($coreCheck[0] . '.edit.own', 'com_' . $component))
|
||||
{
|
||||
// allow edit
|
||||
$result->set($action->name, true);
|
||||
// set not to use global default
|
||||
// because we already validated it
|
||||
$fallback = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// do not allow edit
|
||||
$result->set($action->name, false);
|
||||
$fallback = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($views) && isset($record->catid) && $record->catid > 0)
|
||||
{
|
||||
// we are in item
|
||||
$area = 'category';
|
||||
// set the core check
|
||||
$coreCheck = explode('.', $action->name);
|
||||
$core = $coreCheck[0];
|
||||
// make sure we use the core. action check for the categories
|
||||
if (strpos($action->name, $view) !== false && strpos($action->name, 'core.') === false )
|
||||
{
|
||||
$coreCheck[0] = 'core';
|
||||
$categoryCheck = implode('.', $coreCheck);
|
||||
}
|
||||
else
|
||||
{
|
||||
$categoryCheck = $action->name;
|
||||
}
|
||||
// The record has a category. Check the category permissions.
|
||||
$catpermission = $user->authorise($categoryCheck, 'com_' . $component . '.' . $views . '.category.' . (int) $record->catid);
|
||||
if (!$catpermission && !is_null($catpermission))
|
||||
{
|
||||
// With edit, if the created_by matches current user then dig deeper.
|
||||
if (($action->name === 'core.edit' || $action->name === $view . '.edit') && $record->created_by > 0 && ($record->created_by == $user->id))
|
||||
{
|
||||
// check that we have both local and global access
|
||||
if ($user->authorise('core.edit.own', 'com_' . $component . '.' . $views . '.category.' . (int) $record->catid) &&
|
||||
$user->authorise($core . '.edit.own', 'com_' . $component))
|
||||
{
|
||||
// allow edit
|
||||
$result->set($action->name, true);
|
||||
// set not to use global default
|
||||
// because we already validated it
|
||||
$fallback = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// do not allow edit
|
||||
$result->set($action->name, false);
|
||||
$fallback = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// if allowed then fallback on component global settings
|
||||
if ($fallback)
|
||||
{
|
||||
// if item/category blocks access then don't fall back on global
|
||||
if ((($area === 'item') && !$permission) || (($area === 'category') && !$catpermission))
|
||||
{
|
||||
// do not allow
|
||||
$result->set($action->name, false);
|
||||
}
|
||||
// Finally remember the global settings have the final say. (even if item allow)
|
||||
// The local item permissions can block, but it can't open and override of global permissions.
|
||||
// Since items are created by users and global permissions is set by system admin.
|
||||
else
|
||||
{
|
||||
$result->set($action->name, $user->authorise($action->name, 'com_' . $component));
|
||||
}
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the action permissions
|
||||
*
|
||||
* @param string $action The action to check
|
||||
* @param array $targets The array of target actions
|
||||
*
|
||||
* @return boolean true if action should be filtered out
|
||||
*
|
||||
*/
|
||||
protected static function filterActions(&$view, &$action, &$targets)
|
||||
{
|
||||
foreach ($targets as $target)
|
||||
{
|
||||
if (strpos($action, $view . '.' . $target) !== false ||
|
||||
strpos($action, 'core.' . $target) !== false)
|
||||
{
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns any Model object.
|
||||
*
|
||||
* @param string $type The model type to instantiate
|
||||
* @param string $prefix Prefix for the model class name. Optional.
|
||||
* @param string $component Component name the model belongs to. Optional.
|
||||
* @param array $config Configuration array for model. Optional.
|
||||
*
|
||||
* @return \Joomla\CMS\MVC\Model\BaseDatabaseModel
|
||||
* @throws \Exception
|
||||
* @since 4.4
|
||||
*/
|
||||
public static function getModel(string $type, string $prefix = 'Administrator',
|
||||
string $component = '###component###', array $config = [])
|
||||
{
|
||||
// make sure the name is correct
|
||||
$type = Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe($type, 'F');
|
||||
$component = strtolower($component);
|
||||
|
||||
if ($prefix !== 'Site' && $prefix !== 'Administrator')
|
||||
{
|
||||
$prefix = self::getPrefixFromModelPath($prefix);
|
||||
}
|
||||
|
||||
// Get the model through the MVCFactory
|
||||
return Factory::getApplication()->bootComponent('com_' . $component)->getMVCFactory()->createModel($type, $prefix, $config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the prefix from the model path
|
||||
*
|
||||
* @param string $path The model path
|
||||
*
|
||||
* @return string The prefix value
|
||||
* @since 4.4
|
||||
*/
|
||||
protected static function getPrefixFromModelPath(string $path): string
|
||||
{
|
||||
// Check if $path starts with JPATH_ADMINISTRATOR path
|
||||
if (str_starts_with($path, JPATH_ADMINISTRATOR . '/components/'))
|
||||
{
|
||||
return 'Administrator';
|
||||
}
|
||||
// Check if $path starts with JPATH_SITE path
|
||||
elseif (str_starts_with($path, JPATH_SITE . '/components/'))
|
||||
{
|
||||
return 'Site';
|
||||
}
|
||||
|
||||
return 'Administrator';
|
||||
}
|
||||
|
||||
/**
|
||||
* Add to asset Table
|
||||
*/
|
||||
public static function setAsset($id, $table, $inherit = true)
|
||||
{
|
||||
$parent = Table::getInstance('Asset');
|
||||
$parent->loadByName('com_###component###');
|
||||
|
||||
$parentId = $parent->id;
|
||||
$name = 'com_###component###.'.$table.'.'.$id;
|
||||
$title = '';
|
||||
|
||||
$asset = Table::getInstance('Asset');
|
||||
$asset->loadByName($name);
|
||||
|
||||
// Check for an error.
|
||||
$error = $asset->getError();
|
||||
|
||||
if ($error)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Specify how a new or moved node asset is inserted into the tree.
|
||||
if ($asset->parent_id != $parentId)
|
||||
{
|
||||
$asset->setLocation($parentId, 'last-child');
|
||||
}
|
||||
|
||||
// Prepare the asset to be stored.
|
||||
$asset->parent_id = $parentId;
|
||||
$asset->name = $name;
|
||||
$asset->title = $title;
|
||||
// get the default asset rules
|
||||
$rules = self::getDefaultAssetRules('com_###component###', $table, $inherit);
|
||||
if ($rules instanceof AccessRules)
|
||||
{
|
||||
$asset->rules = (string) $rules;
|
||||
}
|
||||
|
||||
if (!$asset->check() || !$asset->store())
|
||||
{
|
||||
Factory::getApplication()->enqueueMessage($asset->getError(), 'warning');
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Create an asset_id or heal one that is corrupted.
|
||||
$object = new \StdClass();
|
||||
|
||||
// Must be a valid primary key value.
|
||||
$object->id = $id;
|
||||
$object->asset_id = (int) $asset->id;
|
||||
|
||||
// Update their asset_id to link to the asset table.
|
||||
return Factory::getDbo()->updateObject('#__###component###_'.$table, $object, 'id');
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the default asset Rules for a component/view.
|
||||
*/
|
||||
protected static function getDefaultAssetRules($component, $view, $inherit = true)
|
||||
{
|
||||
// if new or inherited
|
||||
$assetId = 0;
|
||||
// Only get the actual item rules if not inheriting
|
||||
if (!$inherit)
|
||||
{
|
||||
// Need to find the asset id by the name of the component.
|
||||
$db = Factory::getContainer()->get(DatabaseInterface::class);
|
||||
$query = $db->getQuery(true)
|
||||
->select($db->quoteName('id'))
|
||||
->from($db->quoteName('#__assets'))
|
||||
->where($db->quoteName('name') . ' = ' . $db->quote($component));
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
// check that there is a value
|
||||
if ($db->getNumRows())
|
||||
{
|
||||
// asset already set so use saved rules
|
||||
$assetId = (int) $db->loadResult();
|
||||
}
|
||||
}
|
||||
// get asset rules
|
||||
$result = Access::getAssetRules($assetId);
|
||||
if ($result instanceof AccessRules)
|
||||
{
|
||||
$_result = (string) $result;
|
||||
$_result = json_decode($_result);
|
||||
foreach ($_result as $name => &$rule)
|
||||
{
|
||||
$v = explode('.', $name);
|
||||
if ($view !== $v[0])
|
||||
{
|
||||
// remove since it is not part of this view
|
||||
unset($_result->$name);
|
||||
}
|
||||
elseif ($inherit)
|
||||
{
|
||||
// clear the value since we inherit
|
||||
$rule = [];
|
||||
}
|
||||
}
|
||||
// check if there are any view values remaining
|
||||
if (count((array) $_result))
|
||||
{
|
||||
$_result = json_encode($_result);
|
||||
$_result = array($_result);
|
||||
// Instantiate and return the AccessRules object for the asset rules.
|
||||
$rules = new AccessRules($_result);
|
||||
// return filtered rules
|
||||
return $rules;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlAppend
|
||||
*
|
||||
* @param SimpleXMLElement $xml The XML element reference in which to inject a comment
|
||||
* @param mixed $node A SimpleXMLElement node to append to the XML element reference, or a stdClass object containing a comment attribute to be injected before the XML node and a fieldXML attribute containing a SimpleXMLElement
|
||||
*
|
||||
* @return void
|
||||
* @deprecated 3.3 Use Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::append($xml, $node);
|
||||
*/
|
||||
public static function xmlAppend(&$xml, $node)
|
||||
{
|
||||
Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::append($xml, $node);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlComment
|
||||
*
|
||||
* @param SimpleXMLElement $xml The XML element reference in which to inject a comment
|
||||
* @param string $comment The comment to inject
|
||||
*
|
||||
* @return void
|
||||
* @deprecated 3.3 Use Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::comment($xml, $comment);
|
||||
*/
|
||||
public static function xmlComment(&$xml, $comment)
|
||||
{
|
||||
Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::comment($xml, $comment);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlAddAttributes
|
||||
*
|
||||
* @param SimpleXMLElement $xml The XML element reference in which to inject a comment
|
||||
* @param array $attributes The attributes to apply to the XML element
|
||||
*
|
||||
* @return null
|
||||
* @deprecated 3.3 Use Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::attributes($xml, $attributes);
|
||||
*/
|
||||
public static function xmlAddAttributes(&$xml, $attributes = [])
|
||||
{
|
||||
Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::attributes($xml, $attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlAddOptions
|
||||
*
|
||||
* @param SimpleXMLElement $xml The XML element reference in which to inject a comment
|
||||
* @param array $options The options to apply to the XML element
|
||||
*
|
||||
* @return void
|
||||
* @deprecated 3.3 Use Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::options($xml, $options);
|
||||
*/
|
||||
public static function xmlAddOptions(&$xml, $options = [])
|
||||
{
|
||||
Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::options($xml, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* get the field object
|
||||
*
|
||||
* @param array $attributes The array of attributes
|
||||
* @param string $default The default of the field
|
||||
* @param array $options The options to apply to the XML element
|
||||
*
|
||||
* @return object
|
||||
* @deprecated 3.3 Use Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::field($attributes, $default, $options);
|
||||
*/
|
||||
public static function getFieldObject(&$attributes, $default = '', $options = null)
|
||||
{
|
||||
return Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::field($attributes, $default, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* get the field xml
|
||||
*
|
||||
* @param array $attributes The array of attributes
|
||||
* @param array $options The options to apply to the XML element
|
||||
*
|
||||
* @return object
|
||||
* @deprecated 3.3 Use Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::xml($attributes, $options);
|
||||
*/
|
||||
public static function getFieldXML(&$attributes, $options = null)
|
||||
{
|
||||
return Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::xml($attributes, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render Bool Button
|
||||
*
|
||||
* @param array $args All the args for the button
|
||||
* 0) name
|
||||
* 1) additional (options class) // not used at this time
|
||||
* 2) default
|
||||
* 3) yes (name)
|
||||
* 4) no (name)
|
||||
*
|
||||
* @return string The input html of the button
|
||||
*
|
||||
*/
|
||||
public static function renderBoolButton()
|
||||
{
|
||||
$args = func_get_args();
|
||||
// check if there is additional button class
|
||||
$additional = isset($args[1]) ? (string) $args[1] : ''; // not used at this time
|
||||
// button attributes
|
||||
$buttonAttributes = array(
|
||||
'type' => 'radio',
|
||||
'name' => isset($args[0]) ? Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($args[0]) : 'bool_button',
|
||||
'label' => isset($args[0]) ? Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe(Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($args[0]), 'Ww') : 'Bool Button', // not seen anyway
|
||||
'class' => 'btn-group',
|
||||
'filter' => 'INT',
|
||||
'default' => isset($args[2]) ? (int) $args[2] : 0);
|
||||
// set the button options
|
||||
$buttonOptions = array(
|
||||
'1' => isset($args[3]) ? Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($args[3]) : 'JYES',
|
||||
'0' => isset($args[4]) ? Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($args[4]) : 'JNO');
|
||||
// return the input
|
||||
return Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::field($buttonAttributes, $buttonAttributes['default'], $buttonOptions)->input;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if have an json string
|
||||
*
|
||||
* @input string The json string to check
|
||||
*
|
||||
* @returns bool true on success
|
||||
* @deprecated 3.3 Use Super___4b225c51_d293_48e4_b3f6_5136cf5c3f18___Power::check($string);
|
||||
*/
|
||||
public static function checkJson($string)
|
||||
{
|
||||
return Super___4b225c51_d293_48e4_b3f6_5136cf5c3f18___Power::check($string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if have an object with a length
|
||||
*
|
||||
* @input object The object to check
|
||||
*
|
||||
* @returns bool true on success
|
||||
* @deprecated 3.3 Use Super___91004529_94a9_4590_b842_e7c6b624ecf5___Power::check($object);
|
||||
*/
|
||||
public static function checkObject($object)
|
||||
{
|
||||
return Super___91004529_94a9_4590_b842_e7c6b624ecf5___Power::check($object);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if have an array with a length
|
||||
*
|
||||
* @input array The array to check
|
||||
*
|
||||
* @returns bool/int number of items in array on success
|
||||
* @deprecated 3.3 Use Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($array, $removeEmptyString);
|
||||
*/
|
||||
public static function checkArray($array, $removeEmptyString = false)
|
||||
{
|
||||
return Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($array, $removeEmptyString);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if have a string with a length
|
||||
*
|
||||
* @input string The string to check
|
||||
*
|
||||
* @returns bool true on success
|
||||
* @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($string);
|
||||
*/
|
||||
public static function checkString($string)
|
||||
{
|
||||
return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if we are connected
|
||||
* Thanks https://stackoverflow.com/a/4860432/1429677
|
||||
*
|
||||
* @returns bool true on success
|
||||
*/
|
||||
public static function isConnected()
|
||||
{
|
||||
// If example.com is down, then probably the whole internet is down, since IANA maintains the domain. Right?
|
||||
$connected = @fsockopen("www.example.com", 80);
|
||||
// website, port (try 80 or 443)
|
||||
if ($connected)
|
||||
{
|
||||
//action when connected
|
||||
$is_conn = true;
|
||||
fclose($connected);
|
||||
}
|
||||
else
|
||||
{
|
||||
//action in connection failure
|
||||
$is_conn = false;
|
||||
}
|
||||
return $is_conn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge an array of array's
|
||||
*
|
||||
* @input array The arrays you would like to merge
|
||||
*
|
||||
* @returns array on success
|
||||
* @deprecated 3.3 Use Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::merge($arrays);
|
||||
*/
|
||||
public static function mergeArrays($arrays)
|
||||
{
|
||||
return Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::merge($arrays);
|
||||
}
|
||||
|
||||
// typo sorry!
|
||||
public static function sorten($string, $length = 40, $addTip = true)
|
||||
{
|
||||
return self::shorten($string, $length, $addTip);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shorten a string
|
||||
*
|
||||
* @input string The you would like to shorten
|
||||
*
|
||||
* @returns string on success
|
||||
* @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::shorten(...);
|
||||
*/
|
||||
public static function shorten($string, $length = 40, $addTip = true)
|
||||
{
|
||||
return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::shorten($string, $length, $addTip);
|
||||
}
|
||||
|
||||
/**
|
||||
* Making strings safe (various ways)
|
||||
*
|
||||
* @input string The you would like to make safe
|
||||
*
|
||||
* @returns string on success
|
||||
* @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe(...);
|
||||
*/
|
||||
public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true, $keepOnlyCharacters = true)
|
||||
{
|
||||
return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe(
|
||||
$string,
|
||||
$type,
|
||||
$spacer,
|
||||
$replaceNumbers,
|
||||
$keepOnlyCharacters
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert none English strings to code usable string
|
||||
*
|
||||
* @input an string
|
||||
*
|
||||
* @returns a string
|
||||
* @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::transliterate($string);
|
||||
*/
|
||||
public static function transliterate($string)
|
||||
{
|
||||
return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::transliterate($string);
|
||||
}
|
||||
|
||||
/**
|
||||
* make sure a string is HTML save
|
||||
*
|
||||
* @input an html string
|
||||
*
|
||||
* @returns a string
|
||||
* @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html(...);
|
||||
*/
|
||||
public static function htmlEscape($var, $charset = 'UTF-8', $shorten = false, $length = 40)
|
||||
{
|
||||
return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html(
|
||||
$var,
|
||||
$charset,
|
||||
$shorten,
|
||||
$length
|
||||
);
|
||||
}###HELPER_LICENSE_LOCK###
|
||||
|
||||
/**
|
||||
* Convert all int in a string to an English word string
|
||||
*
|
||||
* @input an string with numbers
|
||||
*
|
||||
* @returns a string
|
||||
* @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::numbers($string);
|
||||
*/
|
||||
public static function replaceNumbers($string)
|
||||
{
|
||||
return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::numbers($string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert an integer into an English word string
|
||||
* Thanks to Tom Nicholson <http://php.net/manual/en/function.strval.php#41988>
|
||||
*
|
||||
* @input an int
|
||||
* @returns a string
|
||||
* @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::number($x);
|
||||
*/
|
||||
public static function numberToString($x)
|
||||
{
|
||||
return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::number($x);
|
||||
}
|
||||
|
||||
/**
|
||||
* Random Key
|
||||
*
|
||||
* @returns a string
|
||||
* @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::random($size);
|
||||
*/
|
||||
public static function randomkey($size)
|
||||
{
|
||||
return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::random($size);
|
||||
}###GET_CRYPT_KEY###
|
||||
}
|
128
admin/compiler/joomla_4/ADMIN_HELPER_CONTROLLER.php
Normal file
128
admin/compiler/joomla_4/ADMIN_HELPER_CONTROLLER.php
Normal file
@ -0,0 +1,128 @@
|
||||
<?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###\Administrator\Controller;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\MVC\Controller\BaseController;
|
||||
use Joomla\Database\DatabaseInterface;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* ###Component### Help Base Controller
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class HelpController extends BaseController
|
||||
{
|
||||
public function __construct($config)
|
||||
{
|
||||
parent::__construct($config);
|
||||
// load the tasks
|
||||
$this->registerTask('getText', 'help');
|
||||
}
|
||||
|
||||
public function help()
|
||||
{
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
$jinput = Factory::getApplication()->input;
|
||||
// Check Token!
|
||||
$token = Session::getFormToken();
|
||||
$call_token = $jinput->get('token', 0, 'ALNUM');
|
||||
if($user->id != 0 && ($jinput->get($token, 0, 'ALNUM') || $token === $call_token))
|
||||
{
|
||||
$task = $this->getTask();
|
||||
switch($task){
|
||||
case 'getText':
|
||||
try
|
||||
{
|
||||
$idValue = $jinput->get('id', 0, 'INT');
|
||||
if($idValue)
|
||||
{
|
||||
$result = $this->getHelpDocumentText($idValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = '';
|
||||
}
|
||||
echo $result;
|
||||
// stop execution gracefully
|
||||
jexit();
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
// stop execution gracefully
|
||||
jexit();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// stop execution gracefully
|
||||
jexit();
|
||||
}
|
||||
}
|
||||
|
||||
protected function getHelpDocumentText($id)
|
||||
{
|
||||
$db = Factory::getContainer()->get(DatabaseInterface::class);
|
||||
$query = $db->getQuery(true);
|
||||
$query->select(array('a.title','a.content'));
|
||||
$query->from('#__###component###_help_document AS a');
|
||||
$query->where('a.id = '.(int) $id);
|
||||
$query->where('a.published = 1');
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
if($db->getNumRows())
|
||||
{
|
||||
$text = [];
|
||||
$document = $db->loadObject();
|
||||
// fix image issue
|
||||
$images['src="images'] = 'src="'.Uri::root().'images';
|
||||
$images["src='images"] = "src='".Uri::root()."images";
|
||||
$images['src="/images'] = 'src="'.Uri::root().'images';
|
||||
$images["src='/images"] = "src='".Uri::root()."images";
|
||||
// set document template
|
||||
$text[] = "<!doctype html>";
|
||||
$text[] = '<html>';
|
||||
$text[] = "<head>";
|
||||
$text[] = '<meta charset="utf-8">';
|
||||
$text[] = "<title>".$document->title."</title>";
|
||||
$text[] = '<link type="text/css" href="'.Uri::root().'media/com_###component###/uikit/css/uikit.gradient.min.css" rel="stylesheet"></link>';
|
||||
$text[] = '<script type="text/javascript" src="'.Uri::root().'media/com_###component###/uikit/js/uikit.min.js"></script>';
|
||||
$text[] = "</head>";
|
||||
$text[] = '<body><br />';
|
||||
$text[] = '<div class="uk-container uk-container-center uk-grid-collapse">';
|
||||
$text[] = '<div class="uk-panel uk-width-1-1 uk-panel-box uk-panel-box-primary">';
|
||||
// build the help text
|
||||
$text[] = '<h1 class="uk-panel-title">'.$document->title."</h1>";
|
||||
$text[] = str_replace(array_keys($images),array_values($images),$document->content);
|
||||
// end template
|
||||
$text[] = '</div><br /><br />';
|
||||
$text[] = '</div>';
|
||||
$text[] = "</body>";
|
||||
$text[] = "</html>";
|
||||
|
||||
return implode("\n",$text);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
474
admin/compiler/joomla_4/ADMIN_HELPER_EMAIL.php
Normal file
474
admin/compiler/joomla_4/ADMIN_HELPER_EMAIL.php
Normal file
@ -0,0 +1,474 @@
|
||||
<?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###\Administrator\Helper;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\Mail\Mail;
|
||||
use Joomla\Registry\Registry;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* ###Component### component email helper
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
abstract class ###Component###Email
|
||||
{
|
||||
/**
|
||||
* The active recipient
|
||||
*
|
||||
* @var activeRecipient (array)
|
||||
*/
|
||||
public static $active = [];
|
||||
|
||||
/**
|
||||
* Configuraiton object
|
||||
*
|
||||
* @var Registry
|
||||
*/
|
||||
public static ?Registry $config = null;
|
||||
|
||||
/**
|
||||
* Mailer object
|
||||
*
|
||||
* @var Mail
|
||||
*/
|
||||
public static ?Mail $mailer = null;
|
||||
|
||||
/**
|
||||
* Custom Headers
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected static array $header = [];
|
||||
|
||||
/**
|
||||
* Get a configuration object
|
||||
*
|
||||
*/
|
||||
public static function getConfig()
|
||||
{
|
||||
if (!self::$config)
|
||||
{
|
||||
self::$config = ComponentHelper::getParams('com_###component###');
|
||||
}
|
||||
|
||||
return self::$config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the global mailer object, only creating it if it doesn't already exist.
|
||||
*
|
||||
*/
|
||||
public static function getMailerInstance()
|
||||
{
|
||||
if (!self::$mailer)
|
||||
{
|
||||
self::$mailer = self::createMailer();
|
||||
}
|
||||
|
||||
return self::$mailer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that a string looks like an email address.
|
||||
* @param string $address The email address to check
|
||||
* @param string|callable $patternselect A selector for the validation pattern to use :
|
||||
* * `auto` Pick best pattern automatically;
|
||||
* * `pcre8` Use the squiloople.com pattern, requires PCRE > 8.0, PHP >= 5.3.2, 5.2.14;
|
||||
* * `pcre` Use old PCRE implementation;
|
||||
* * `php` Use PHP built-in FILTER_VALIDATE_EMAIL;
|
||||
* * `html5` Use the pattern given by the HTML5 spec for 'email' type form input elements.
|
||||
* * `noregex` Don't use a regex: super fast, really dumb.
|
||||
* Alternatively you may pass in a callable to inject your own validator, for example:
|
||||
* PHPMailer::validateAddress('user@example.com', function($address) {
|
||||
* return (strpos($address, '@') !== false);
|
||||
* });
|
||||
* You can also set the PHPMailer::$validator static to a callable, allowing built-in methods to use your validator.
|
||||
* @return boolean
|
||||
* @static
|
||||
* @access public
|
||||
*/
|
||||
public static function validateAddress($address, $patternselect = null): bool
|
||||
{
|
||||
return self::getMailerInstance()->validateAddress($address, $patternselect);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a mailer object.
|
||||
*
|
||||
* Returns the global {@link Mail} object, only creating it if it doesn't already exist.
|
||||
*
|
||||
* @return Mail object
|
||||
*
|
||||
* @see Mail
|
||||
*/
|
||||
public static function getMailer(): Mail
|
||||
{
|
||||
if (!self::$mailer)
|
||||
{
|
||||
self::$mailer = self::createMailer();
|
||||
}
|
||||
|
||||
$copy = clone self::$mailer;
|
||||
|
||||
return $copy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a mailer object
|
||||
*
|
||||
* @return Mail object
|
||||
*
|
||||
* @see Mail
|
||||
*/
|
||||
protected static function createMailer(): Mail
|
||||
{
|
||||
// set component params
|
||||
$conf = self::getConfig();
|
||||
|
||||
// now load the mailer
|
||||
$mailer = $conf->get('mailer', 'global');
|
||||
|
||||
// Create a Mail object
|
||||
$mail = Mail::getInstance();
|
||||
|
||||
// check if set to global
|
||||
if ('global' == $mailer)
|
||||
{
|
||||
// get the global details
|
||||
$globalConf = Factory::getConfig();
|
||||
|
||||
$mailer = $globalConf->get('mailer');
|
||||
$smtpauth = ($globalConf->get('smtpauth') == 0) ? null : 1;
|
||||
$smtpuser = $globalConf->get('smtpuser');
|
||||
$smtppass = $globalConf->get('smtppass');
|
||||
$smtphost = $globalConf->get('smtphost');
|
||||
$smtpsecure = $globalConf->get('smtpsecure');
|
||||
$smtpport = $globalConf->get('smtpport');
|
||||
$sendmail = $globalConf->get('sendmail');
|
||||
$mailfrom = $globalConf->get('mailfrom');
|
||||
$fromname = $globalConf->get('fromname');
|
||||
$replyto = $globalConf->get('replyto');
|
||||
$replytoname = $globalConf->get('replytoname');
|
||||
}
|
||||
else
|
||||
{
|
||||
$smtpauth = ($conf->get('smtpauth') == 0) ? null : 1;
|
||||
$smtpuser = $conf->get('smtpuser');
|
||||
$smtppass = $conf->get('smtppass');
|
||||
$smtphost = $conf->get('smtphost');
|
||||
$smtpsecure = $conf->get('smtpsecure');
|
||||
$smtpport = $conf->get('smtpport');
|
||||
$sendmail = $conf->get('sendmail');
|
||||
$mailfrom = $conf->get('emailfrom');
|
||||
$fromname = $conf->get('fromname');
|
||||
$replyto = $conf->get('replyto');
|
||||
$replytoname = $conf->get('replytoname');
|
||||
}
|
||||
|
||||
// Set global sender
|
||||
$mail->setSender(array($mailfrom, $fromname));
|
||||
|
||||
// set the global reply-to if found
|
||||
if ($replyto && $replytoname)
|
||||
{
|
||||
$mail->ClearReplyTos();
|
||||
$mail->addReplyTo($replyto, $replytoname);
|
||||
}
|
||||
|
||||
// Default mailer is to use PHP's mail function
|
||||
switch ($mailer)
|
||||
{
|
||||
case 'smtp':
|
||||
// set the SMTP option
|
||||
$mail->useSMTP($smtpauth, $smtphost, $smtpuser, $smtppass, $smtpsecure, $smtpport);
|
||||
break;
|
||||
|
||||
case 'sendmail':
|
||||
// set the sendmail option
|
||||
$mail->useSendmail($sendmail);
|
||||
$mail->IsSendmail();
|
||||
break;
|
||||
|
||||
default:
|
||||
$mail->IsMail();
|
||||
break;
|
||||
}
|
||||
|
||||
return $mail;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a Mail custom header.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function setHeader($target, $value)
|
||||
{
|
||||
// set the header
|
||||
self::$header[$target] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an email
|
||||
*
|
||||
* @return bool on success
|
||||
*
|
||||
*/
|
||||
public static function send($recipient, $subject, $body, $textonly, $mode = 0, $bounce_email = null, $idsession = null, $mailreply = null, $replyname = null , $mailfrom = null, $fromname = null, $cc = null, $bcc = null, $attachment = null, $embeded = null , $embeds = null)
|
||||
{
|
||||
// Get a Mail instance
|
||||
$mail = self::getMailer();
|
||||
|
||||
// set component params
|
||||
$conf = self::getConfig();
|
||||
|
||||
// set if we have override
|
||||
if ($mailfrom && $fromname)
|
||||
{
|
||||
$mail->setSender(array($mailfrom, $fromname));
|
||||
}
|
||||
|
||||
// load the bounce email as sender if set
|
||||
if (!is_null($bounce_email))
|
||||
{
|
||||
$mail->Sender = $bounce_email;
|
||||
}
|
||||
|
||||
// Add tag to email to identify it
|
||||
if (!is_null($idsession))
|
||||
{
|
||||
$mail->addCustomHeader('X-VDMmethodID:'.$idsession);
|
||||
}
|
||||
|
||||
// set headers if found
|
||||
if (isset(self::$header) && is_array(self::$header) && count((array)self::$header) > 0)
|
||||
{
|
||||
foreach (self::$header as $_target => $_value)
|
||||
{
|
||||
$mail->addCustomHeader($_target.':'.$_value);
|
||||
}
|
||||
}
|
||||
|
||||
// set the subject & Body
|
||||
$mail->setSubject($subject);
|
||||
$mail->setBody($body);
|
||||
|
||||
// Are we sending the email as HTML?
|
||||
if ($mode)
|
||||
{
|
||||
$mail->IsHTML(true);
|
||||
$mail->AltBody = $textonly;
|
||||
}
|
||||
|
||||
//embed images
|
||||
if ($embeded)
|
||||
{
|
||||
if(Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($embeds))
|
||||
{
|
||||
foreach($embeds as $embed)
|
||||
{
|
||||
$mail->AddEmbeddedImage($embed->Path,$embed->FileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$mail->addRecipient($recipient);
|
||||
$mail->addCC($cc);
|
||||
$mail->addBCC($bcc);
|
||||
$mail->addAttachment($attachment);
|
||||
|
||||
// Take care of reply email addresses
|
||||
if (is_array($mailreply))
|
||||
{
|
||||
$mail->ClearReplyTos();
|
||||
$numReplyTo = count((array)$mailreply);
|
||||
for ($i=0; $i < $numReplyTo; $i++)
|
||||
{
|
||||
$mail->addReplyTo($mailreply[$i], $replyname[$i]);
|
||||
}
|
||||
}
|
||||
elseif (!empty($mailreply))
|
||||
{
|
||||
$mail->ClearReplyTos();
|
||||
$mail->addReplyTo($mailreply, $replyname);
|
||||
}
|
||||
|
||||
// check if we can add the DKIM to email
|
||||
if ($conf->get('enable_dkim'))
|
||||
{
|
||||
if (!empty($conf->get('dkim_domain')) && !empty($conf->get('dkim_selector')) && !empty($conf->get('dkim_private')) && !empty($conf->get('dkim_public')))
|
||||
{
|
||||
$mail->DKIM_domain = $conf->get('dkim_domain');
|
||||
$mail->DKIM_selector = $conf->get('dkim_selector');
|
||||
$mail->DKIM_identity = $conf->get('dkim_identity');
|
||||
$mail->DKIM_passphrase = $conf->get('dkim_passphrase');
|
||||
|
||||
$tmp = tempnam(sys_get_temp_dir(), 'VDM');
|
||||
$h = fopen($tmp, 'w');
|
||||
fwrite($h, $conf->get('dkim_private'));
|
||||
fclose($h);
|
||||
$mail->DKIM_private = $tmp;
|
||||
}
|
||||
}
|
||||
|
||||
$sendmail = $mail->Send();
|
||||
|
||||
if ($conf->get('enable_dkim') && !empty($conf->get('dkim_domain')) && !empty($conf->get('dkim_selector')) && !empty($conf->get('dkim_private')) && !empty($conf->get('dkim_public')))
|
||||
{
|
||||
@unlink($tmp);
|
||||
}
|
||||
|
||||
if (method_exists('###Component###Helper','storeMessage'))
|
||||
{
|
||||
// if we have active recipient details
|
||||
if (isset(self::$active[$recipient]))
|
||||
{
|
||||
// store the massage if the method is set
|
||||
###Component###Helper::storeMessage($sendmail, self::$active[$recipient], $subject, $body, $textonly, $mode, 'email');
|
||||
// clear memory
|
||||
unset(self::$active[$recipient]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// store the massage if the method is set
|
||||
###Component###Helper::storeMessage($sendmail, $recipient, $subject, $body, $textonly, $mode, 'email');
|
||||
}
|
||||
}
|
||||
|
||||
return $sendmail;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set html text (in a row) and subject (as title) to a email table.
|
||||
* do not use <p> instead use <br />
|
||||
* in your html that you pass to this method
|
||||
* since it is a table row it does not
|
||||
* work well with paragraphs
|
||||
*
|
||||
* @return string on success
|
||||
*
|
||||
*/
|
||||
public static function setBasicBody($html, $subject)
|
||||
{
|
||||
$body = [];
|
||||
$body[] = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">";
|
||||
$body[] = "<html xmlns=\"http://www.w3.org/1999/xhtml\">";
|
||||
$body[] = "<head>";
|
||||
$body[] = "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />";
|
||||
$body[] = "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"/>";
|
||||
$body[] = "<title>" . $subject . "</title>";
|
||||
$body[] = "<style type=\"text/css\">";
|
||||
$body[] = "#outlook a {padding:0;}";
|
||||
$body[] = ".ExternalClass {width:100%;}";
|
||||
$body[] = ".ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height: 100%;} ";
|
||||
$body[] = "p {margin: 0; padding: 0; font-size: 0px; line-height: 0px;} ";
|
||||
$body[] = "table td {border-collapse: collapse;}";
|
||||
$body[] = "table {border-collapse: collapse; mso-table-lspace:0pt; mso-table-rspace:0pt; }";
|
||||
$body[] = "img {display: block; outline: none; text-decoration: none; -ms-interpolation-mode: bicubic;}";
|
||||
$body[] = "a img {border: none;}";
|
||||
$body[] = "a {text-decoration: none; color: #000001;}";
|
||||
$body[] = "a.phone {text-decoration: none; color: #000001 !important; pointer-events: auto; cursor: default;}";
|
||||
$body[] = "span {font-size: 13px; line-height: 17px; font-family: monospace; color: #000001;}";
|
||||
$body[] = "</style>";
|
||||
$body[] = "<!--[if gte mso 9]>";
|
||||
$body[] = "<style>";
|
||||
$body[] = "/* Target Outlook 2007 and 2010 */";
|
||||
$body[] = "</style>";
|
||||
$body[] = "<![endif]-->";
|
||||
$body[] = "</head>";
|
||||
$body[] = "<body style=\"width:100%; margin:0; padding:0; -webkit-text-size-adjust:100%; -ms-text-size-adjust:100%;\">";
|
||||
$body[] = $html;
|
||||
$body[] = "</body>";
|
||||
$body[] = "</html>";
|
||||
|
||||
return implode("\n", $body);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set html text (in a row) and subject (as title) to a email table.
|
||||
* do not use <p> instead use <br />
|
||||
* in your html that you pass to this method
|
||||
* since it is a table row it does not
|
||||
* work well with paragraphs
|
||||
*
|
||||
* @return string on success
|
||||
*
|
||||
*/
|
||||
public static function setTableBody($html, $subject)
|
||||
{
|
||||
$body = [];
|
||||
$body[] = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">";
|
||||
$body[] = "<html xmlns=\"http://www.w3.org/1999/xhtml\">";
|
||||
$body[] = "<head>";
|
||||
$body[] = "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />";
|
||||
$body[] = "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"/>";
|
||||
$body[] = "<title>" . $subject . "</title>";
|
||||
$body[] = "<style type=\"text/css\">";
|
||||
$body[] = "#outlook a {padding:0;}";
|
||||
$body[] = ".ExternalClass {width:100%;}";
|
||||
$body[] = ".ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height: 100%;} ";
|
||||
$body[] = "p {margin: 0; padding: 0; font-size: 0px; line-height: 0px;} ";
|
||||
$body[] = "table td {border-collapse: collapse;}";
|
||||
$body[] = "table {border-collapse: collapse; mso-table-lspace:0pt; mso-table-rspace:0pt; }";
|
||||
$body[] = "img {display: block; outline: none; text-decoration: none; -ms-interpolation-mode: bicubic;}";
|
||||
$body[] = "a img {border: none;}";
|
||||
$body[] = "a {text-decoration: none; color: #000001;}";
|
||||
$body[] = "a.phone {text-decoration: none; color: #000001 !important; pointer-events: auto; cursor: default;}";
|
||||
$body[] = "span {font-size: 13px; line-height: 17px; font-family: monospace; color: #000001;}";
|
||||
$body[] = "</style>";
|
||||
$body[] = "<!--[if gte mso 9]>";
|
||||
$body[] = "<style>";
|
||||
$body[] = "/* Target Outlook 2007 and 2010 */";
|
||||
$body[] = "</style>";
|
||||
$body[] = "<![endif]-->";
|
||||
$body[] = "</head>";
|
||||
$body[] = "<body style=\"width:100%; margin:0; padding:0; -webkit-text-size-adjust:100%; -ms-text-size-adjust:100%;\">";
|
||||
$body[] = "\n<!-- body wrapper -->";
|
||||
$body[] = "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"margin:0; padding:0; width:100%; line-height: 100% !important;\">";
|
||||
$body[] = "<tr>";
|
||||
$body[] = "<td valign=\"top\">";
|
||||
$body[] = "<!-- edge wrapper -->";
|
||||
$body[] = "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\" width=\"800\" >";
|
||||
$body[] = "<tr>";
|
||||
$body[] = "<td valign=\"top\">";
|
||||
$body[] = "<!-- content wrapper -->";
|
||||
$body[] = "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\" width=\"780\">";
|
||||
$body[] = "<tr>";
|
||||
$body[] = "<td valign=\"top\" style=\"vertical-align: top;\">";
|
||||
$body[] = $html;
|
||||
$body[] = "</td>";
|
||||
$body[] = "</tr>";
|
||||
$body[] = "</table>";
|
||||
$body[] = "<!-- / content wrapper -->";
|
||||
$body[] = "</td>";
|
||||
$body[] = "</tr>";
|
||||
$body[] = "</table>";
|
||||
$body[] = "<!-- / edge wrapper -->";
|
||||
$body[] = "</td>";
|
||||
$body[] = "</tr>";
|
||||
$body[] = "</table>";
|
||||
$body[] = "<!-- / page wrapper -->";
|
||||
$body[] = "</body>";
|
||||
$body[] = "</html>";
|
||||
|
||||
return implode("\n", $body);
|
||||
}
|
||||
}
|
63
admin/compiler/joomla_4/ADMIN_IMPORT_CONTROLLER.php
Normal file
63
admin/compiler/joomla_4/ADMIN_IMPORT_CONTROLLER.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?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###\Administrator\Controller;
|
||||
|
||||
###IMPORT_CONTROLLER_HEADER###
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* ###Component### Import Base Controller
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class ImportController extends BaseController
|
||||
{
|
||||
/**
|
||||
* Import an spreadsheet.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function import()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
$model = $this->getModel('import');
|
||||
if ($model->import())
|
||||
{
|
||||
$cache = Factory::getCache('mod_menu');
|
||||
$cache->clean();
|
||||
// TODO: Reset the users acl here as well to kill off any missing bits
|
||||
}
|
||||
|
||||
$app = Factory::getApplication();
|
||||
$redirect_url = $app->getUserState('com_###component###.redirect_url');
|
||||
if (empty($redirect_url))
|
||||
{
|
||||
$redirect_url = Route::_('index.php?option=com_###component###&view=import', false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// wipe out the user state when we're going to redirect
|
||||
$app->setUserState('com_###component###.redirect_url', '');
|
||||
$app->setUserState('com_###component###.message', '');
|
||||
$app->setUserState('com_###component###.extension_message', '');
|
||||
}
|
||||
$this->setRedirect($redirect_url);
|
||||
}
|
||||
}
|
63
admin/compiler/joomla_4/ADMIN_IMPORT_CONTROLLER_CUSTOM.php
Normal file
63
admin/compiler/joomla_4/ADMIN_IMPORT_CONTROLLER_CUSTOM.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?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###\Administrator\Controller;
|
||||
|
||||
###IMPORT_CUSTOM_CONTROLLER_HEADER###
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* ###Component### ###View### Base Controller
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class ###View###importController extends BaseController
|
||||
{
|
||||
/**
|
||||
* Import an spreadsheet.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function import()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
$model = $this->getModel('###View###');
|
||||
if ($model->import())
|
||||
{
|
||||
$cache = Factory::getCache('mod_menu');
|
||||
$cache->clean();
|
||||
// TODO: Reset the users acl here as well to kill off any missing bits
|
||||
}
|
||||
|
||||
$app = Factory::getApplication();
|
||||
$redirect_url = $app->getUserState('com_###component###.redirect_url');
|
||||
if (empty($redirect_url))
|
||||
{
|
||||
$redirect_url = Route::_('index.php?option=com_###component###&view=###view###', false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// wipe out the user state when we're going to redirect
|
||||
$app->setUserState('com_###component###.redirect_url', '');
|
||||
$app->setUserState('com_###component###.message', '');
|
||||
$app->setUserState('com_###component###.extension_message', '');
|
||||
}
|
||||
$this->setRedirect($redirect_url);
|
||||
}
|
||||
}
|
110
admin/compiler/joomla_4/ADMIN_IMPORT_HTML.php
Normal file
110
admin/compiler/joomla_4/ADMIN_IMPORT_HTML.php
Normal file
@ -0,0 +1,110 @@
|
||||
<?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###\Administrator\View\Import;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
|
||||
use Joomla\CMS\Toolbar\ToolbarHelper;
|
||||
use ###NAMESPACEPREFIX###\Component\###ComponentNameSpace###\Administrator\Helper\###Component###Helper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED###
|
||||
|
||||
/**
|
||||
* ###Component### Import Html View
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class HtmlView extends BaseHtmlView
|
||||
{
|
||||
protected $headerList;
|
||||
protected $hasPackage = false;
|
||||
protected $headers;
|
||||
protected $hasHeader = 0;
|
||||
protected $dataType;
|
||||
|
||||
/**
|
||||
* Display the view
|
||||
*
|
||||
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
public function display($tpl = null)
|
||||
{
|
||||
$paths = new \StdClass;
|
||||
$paths->first = '';
|
||||
$state = $this->get('state');
|
||||
|
||||
$this->paths = &$paths;
|
||||
$this->state = &$state;
|
||||
// get global action permissions
|
||||
$this->canDo = ###Component###Helper::getActions('import');
|
||||
|
||||
// We don't need toolbar in the modal window.
|
||||
if ($this->getLayout() !== 'modal')
|
||||
{
|
||||
$this->addToolbar();
|
||||
}
|
||||
|
||||
// get the session object
|
||||
$session = Factory::getSession();
|
||||
// check if it has package
|
||||
$this->hasPackage = $session->get('hasPackage', false);
|
||||
$this->dataType = $session->get('dataType', false);
|
||||
if($this->hasPackage && $this->dataType)
|
||||
{
|
||||
$this->headerList = json_decode($session->get($this->dataType.'_VDM_IMPORTHEADERS', false),true);
|
||||
$this->headers = ###Component###Helper::getFileHeaders($this->dataType);
|
||||
// clear the data type
|
||||
$session->clear('dataType');
|
||||
}
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
throw new \Exception(implode("\n", $errors), 500);
|
||||
}
|
||||
|
||||
// Display the template
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the page title and toolbar.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function addToolbar(): void
|
||||
{
|
||||
ToolbarHelper::title(Text::_('COM_###COMPONENT###_IMPORT_TITLE'), 'upload');
|
||||
|
||||
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
|
||||
{
|
||||
ToolbarHelper::preferences('com_###component###');
|
||||
}
|
||||
|
||||
// set help url for this view if found
|
||||
$this->help_url = ###Component###Helper::getHelpUrl('import');
|
||||
if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($this->help_url))
|
||||
{
|
||||
ToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url);
|
||||
}
|
||||
}
|
||||
}
|
60
admin/compiler/joomla_4/ADMIN_IMPORT_HTML_CUSTOM.php
Normal file
60
admin/compiler/joomla_4/ADMIN_IMPORT_HTML_CUSTOM.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?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###\Administrator\View\###View###Import;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Form\FormHelper;
|
||||
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
|
||||
use Joomla\CMS\Toolbar\ToolbarHelper;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||
use ###NAMESPACEPREFIX###\Component\###ComponentNameSpace###\Administrator\Helper\###Component###Helper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED###
|
||||
|
||||
/**
|
||||
* ###Component### ###View### Html View
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class HtmlView extends BaseHtmlView
|
||||
{###IMPORT_DISPLAY_METHOD_CUSTOM###
|
||||
|
||||
/**
|
||||
* Add the page title and toolbar.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function addToolbar(): void
|
||||
{
|
||||
ToolbarHelper::title(Text::_('COM_###COMPONENT###_IMPORT_TITLE'), 'upload');
|
||||
|
||||
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
|
||||
{
|
||||
ToolbarHelper::preferences('com_###component###');
|
||||
}
|
||||
|
||||
// set help url for this view if found
|
||||
$this->help_url = ###Component###Helper::getHelpUrl('###view###');
|
||||
if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($this->help_url))
|
||||
{
|
||||
ToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url);
|
||||
}
|
||||
}
|
||||
}
|
460
admin/compiler/joomla_4/ADMIN_IMPORT_MODEL.php
Normal file
460
admin/compiler/joomla_4/ADMIN_IMPORT_MODEL.php
Normal file
@ -0,0 +1,460 @@
|
||||
<?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###\Administrator\Model;
|
||||
|
||||
###IMPORT_MODEL_HEADER###
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/***
|
||||
* ###Component### Import Base Database Model
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class ImportModel extends BaseDatabaseModel
|
||||
{
|
||||
// set uploading values
|
||||
protected $use_streams = false;
|
||||
protected $allow_unsafe = false;
|
||||
protected $safeFileOptions = [];
|
||||
|
||||
/**
|
||||
* @var object JTable object
|
||||
*/
|
||||
protected $_table = null;
|
||||
|
||||
/**
|
||||
* @var object JTable object
|
||||
*/
|
||||
protected $_url = null;
|
||||
|
||||
/**
|
||||
* Model context string.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_context = 'com_###component###.import';
|
||||
|
||||
/**
|
||||
* Import Settings
|
||||
*/
|
||||
protected $getType = NULL;
|
||||
protected $dataType = NULL;
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
protected function populateState()
|
||||
{
|
||||
$app = Factory::getApplication('administrator');
|
||||
|
||||
$this->setState('message', $app->getUserState('com_###component###.message'));
|
||||
$app->setUserState('com_###component###.message', '');
|
||||
|
||||
// Recall the 'Import from Directory' path.
|
||||
$path = $app->getUserStateFromRequest($this->_context . '.import_directory', 'import_directory', $app->get('tmp_path'));
|
||||
$this->setState('import.directory', $path);
|
||||
parent::populateState();
|
||||
}
|
||||
|
||||
/**
|
||||
* Import an spreadsheet from either folder, url or upload.
|
||||
*
|
||||
* @return boolean result of import
|
||||
*
|
||||
*/
|
||||
public function import()
|
||||
{
|
||||
$this->setState('action', 'import');
|
||||
$app = Factory::getApplication();
|
||||
$session = Factory::getSession();
|
||||
$package = null;
|
||||
$continue = false;
|
||||
// get import type
|
||||
$this->getType = $app->input->getString('gettype', NULL);
|
||||
// get import type
|
||||
$this->dataType = $session->get('dataType_VDM_IMPORTINTO', NULL);
|
||||
|
||||
if ($package === null)
|
||||
{
|
||||
switch ($this->getType)
|
||||
{
|
||||
case 'folder':
|
||||
// Remember the 'Import from Directory' path.
|
||||
$app->getUserStateFromRequest($this->_context . '.import_directory', 'import_directory');
|
||||
$package = $this->_getPackageFromFolder();
|
||||
break;
|
||||
|
||||
case 'upload':
|
||||
$package = $this->_getPackageFromUpload();
|
||||
break;
|
||||
|
||||
case 'url':
|
||||
$package = $this->_getPackageFromUrl();
|
||||
break;
|
||||
|
||||
case 'continue':
|
||||
$continue = true;
|
||||
$package = $session->get('package', null);
|
||||
$package = json_decode($package, true);
|
||||
// clear session
|
||||
$session->clear('package');
|
||||
$session->clear('dataType');
|
||||
$session->clear('hasPackage');
|
||||
break;
|
||||
|
||||
default:
|
||||
$app->setUserState('com_###component###.message', Text::_('COM_###COMPONENT###_IMPORT_NO_IMPORT_TYPE_FOUND'));
|
||||
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Was the package valid?
|
||||
if (!$package || !$package['type'])
|
||||
{
|
||||
if (in_array($this->getType, array('upload', 'url')))
|
||||
{
|
||||
$this->remove($package['packagename']);
|
||||
}
|
||||
|
||||
$app->setUserState('com_###component###.message', Text::_('COM_###COMPONENT###_IMPORT_UNABLE_TO_FIND_IMPORT_PACKAGE'));
|
||||
return false;
|
||||
}
|
||||
|
||||
// first link data to table headers
|
||||
if(!$continue){
|
||||
$package = json_encode($package);
|
||||
$session->set('package', $package);
|
||||
$session->set('dataType', $this->dataType);
|
||||
$session->set('hasPackage', true);
|
||||
return true;
|
||||
}
|
||||
|
||||
// set the data
|
||||
$headerList = json_decode($session->get($this->dataType.'_VDM_IMPORTHEADERS', false), true);
|
||||
if (!$this->setData($package,$this->dataType,$headerList))
|
||||
{
|
||||
// There was an error importing the package
|
||||
$msg = Text::_('COM_###COMPONENT###_IMPORT_ERROR');
|
||||
$back = $session->get('backto_VDM_IMPORT', NULL);
|
||||
if ($back)
|
||||
{
|
||||
$app->setUserState('com_###component###.redirect_url', 'index.php?option=com_###component###&view='.$back);
|
||||
$session->clear('backto_VDM_IMPORT');
|
||||
}
|
||||
$result = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Package imported sucessfully
|
||||
$msg = Text::sprintf('COM_###COMPONENT###_IMPORT_SUCCESS', $package['packagename']);
|
||||
$back = $session->get('backto_VDM_IMPORT', NULL);
|
||||
if ($back)
|
||||
{
|
||||
$app->setUserState('com_###component###.redirect_url', 'index.php?option=com_###component###&view='.$back);
|
||||
$session->clear('backto_VDM_IMPORT');
|
||||
}
|
||||
$result = true;
|
||||
}
|
||||
|
||||
// Set some model state values
|
||||
$app->enqueueMessage($msg);
|
||||
|
||||
// remove file after import
|
||||
$this->remove($package['packagename']);
|
||||
$session->clear($this->getType.'_VDM_IMPORTHEADERS');
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Works out an importation spreadsheet from a HTTP upload
|
||||
*
|
||||
* @return spreadsheet definition or false on failure
|
||||
*/
|
||||
protected function _getPackageFromUpload()
|
||||
{
|
||||
// Get the uploaded file information
|
||||
$app = Factory::getApplication();
|
||||
$input = $app->input;
|
||||
|
||||
// Do not change the filter type 'raw'. We need this to let files containing PHP code to upload. See JInputFiles::get.
|
||||
$userfile = $input->files->get('import_package', null, 'raw');
|
||||
|
||||
// Make sure that file uploads are enabled in php
|
||||
if (!(bool) ini_get('file_uploads'))
|
||||
{
|
||||
$app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_WARNIMPORTFILE'), 'warning');
|
||||
return false;
|
||||
}
|
||||
|
||||
// If there is no uploaded file, we have a problem...
|
||||
if (!is_array($userfile))
|
||||
{
|
||||
$app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_NO_FILE_SELECTED'), 'warning');
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if there was a problem uploading the file.
|
||||
if ($userfile['error'] || $userfile['size'] < 1)
|
||||
{
|
||||
$app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_WARNIMPORTUPLOADERROR'), 'warning');
|
||||
return false;
|
||||
}
|
||||
|
||||
// Build the appropriate paths
|
||||
$config = Factory::getConfig();
|
||||
$tmp_dest = $config->get('tmp_path') . '/' . $userfile['name'];
|
||||
$tmp_src = $userfile['tmp_name'];
|
||||
|
||||
// Move uploaded file
|
||||
$p_file = File::upload($tmp_src, $tmp_dest, $this->use_streams, $this->allow_unsafe, $this->safeFileOptions);
|
||||
|
||||
// Was the package downloaded?
|
||||
if (!$p_file)
|
||||
{
|
||||
$session = Factory::getSession();
|
||||
$session->clear('package');
|
||||
$session->clear('dataType');
|
||||
$session->clear('hasPackage');
|
||||
// was not uploaded
|
||||
return false;
|
||||
}
|
||||
|
||||
// check that this is a valid spreadsheet
|
||||
$package = $this->check($userfile['name']);
|
||||
|
||||
return $package;
|
||||
}
|
||||
|
||||
/**
|
||||
* Import an spreadsheet from a directory
|
||||
*
|
||||
* @return array Spreadsheet details or false on failure
|
||||
*
|
||||
*/
|
||||
protected function _getPackageFromFolder()
|
||||
{
|
||||
$app = Factory::getApplication();
|
||||
$input = $app->input;
|
||||
|
||||
// Get the path to the package to import
|
||||
$p_dir = $input->getString('import_directory');
|
||||
$p_dir = Path::clean($p_dir);
|
||||
// Did you give us a valid path?
|
||||
if (!file_exists($p_dir))
|
||||
{
|
||||
$app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_PLEASE_ENTER_A_PACKAGE_DIRECTORY'), 'warning');
|
||||
return false;
|
||||
}
|
||||
|
||||
// Detect the package type
|
||||
$type = $this->getType;
|
||||
|
||||
// Did you give us a valid package?
|
||||
if (!$type)
|
||||
{
|
||||
$app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_PATH_DOES_NOT_HAVE_A_VALID_PACKAGE'), 'warning');
|
||||
}
|
||||
|
||||
// check the extention
|
||||
if(!$this->checkExtension($p_dir))
|
||||
{
|
||||
// set error message
|
||||
$app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning');
|
||||
return false;
|
||||
}
|
||||
|
||||
$package['packagename'] = null;
|
||||
$package['dir'] = $p_dir;
|
||||
$package['type'] = $type;
|
||||
|
||||
return $package;
|
||||
}
|
||||
|
||||
/**
|
||||
* Import an spreadsheet from a URL
|
||||
*
|
||||
* @return Package details or false on failure
|
||||
*
|
||||
*/
|
||||
protected function _getPackageFromUrl()
|
||||
{
|
||||
$app = Factory::getApplication();
|
||||
$input = $app->input;
|
||||
|
||||
// Get the URL of the package to import
|
||||
$url = $input->getString('import_url');
|
||||
|
||||
// Did you give us a URL?
|
||||
if (!$url)
|
||||
{
|
||||
$app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_ENTER_A_URL'), 'warning');
|
||||
return false;
|
||||
}
|
||||
|
||||
// Download the package at the URL given
|
||||
$p_file = InstallerHelper::downloadPackage($url);
|
||||
|
||||
// Was the package downloaded?
|
||||
if (!$p_file)
|
||||
{
|
||||
$app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_INVALID_URL'), 'warning');
|
||||
return false;
|
||||
}
|
||||
|
||||
// check that this is a valid spreadsheet
|
||||
$package = $this->check($p_file);
|
||||
|
||||
return $package;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check a file and verifies it as a spreadsheet file
|
||||
* Supports .csv .xlsx .xls and .ods
|
||||
*
|
||||
* @param string $p_filename The uploaded package filename or import directory
|
||||
*
|
||||
* @return array of elements
|
||||
*
|
||||
*/
|
||||
protected function check($archivename)
|
||||
{
|
||||
$app = Factory::getApplication();
|
||||
// Clean the name
|
||||
$archivename = Path::clean($archivename);
|
||||
|
||||
// check the extention
|
||||
if(!$this->checkExtension($archivename))
|
||||
{
|
||||
// Cleanup the import files
|
||||
$this->remove($archivename);
|
||||
$app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning');
|
||||
return false;
|
||||
}
|
||||
|
||||
$config = Factory::getConfig();
|
||||
// set Package Name
|
||||
$check['packagename'] = $archivename;
|
||||
|
||||
// set directory
|
||||
$check['dir'] = $config->get('tmp_path'). '/' .$archivename;
|
||||
|
||||
// set type
|
||||
$check['type'] = $this->getType;
|
||||
|
||||
return $check;
|
||||
}###IMPORT_EXT_METHOD###
|
||||
|
||||
/**
|
||||
* Clean up temporary uploaded spreadsheet
|
||||
*
|
||||
* @param string $package Name of the uploaded spreadsheet file
|
||||
*
|
||||
* @return boolean True on success
|
||||
*
|
||||
*/
|
||||
protected function remove($package)
|
||||
{
|
||||
jimport('joomla.filesystem.file');
|
||||
|
||||
$config = Factory::getConfig();
|
||||
$package = $config->get('tmp_path'). '/' .$package;
|
||||
|
||||
// Is the package file a valid file?
|
||||
if (is_file($package))
|
||||
{
|
||||
File::delete($package);
|
||||
}
|
||||
elseif (is_file(Path::clean($package)))
|
||||
{
|
||||
// It might also be just a base filename
|
||||
File::delete(Path::clean($package));
|
||||
}
|
||||
}###IMPORT_SETDATA_METHOD######IMPORT_SAVE_METHOD###
|
||||
|
||||
protected function getAlias($name,$type = false)
|
||||
{
|
||||
// sanitize the name to an alias
|
||||
if (Factory::getConfig()->get('unicodeslugs') == 1)
|
||||
{
|
||||
$alias = OutputFilter::stringURLUnicodeSlug($name);
|
||||
}
|
||||
else
|
||||
{
|
||||
$alias = OutputFilter::stringURLSafe($name);
|
||||
}
|
||||
// must be a uniqe alias
|
||||
if ($type)
|
||||
{
|
||||
return $this->getUniqe($alias,'alias',$type);
|
||||
}
|
||||
return $alias;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to generate a uniqe value.
|
||||
*
|
||||
* @param string $field name.
|
||||
* @param string $value data.
|
||||
* @param string $type table.
|
||||
*
|
||||
* @return string New value.
|
||||
*/
|
||||
protected function getUniqe($value,$field,$type)
|
||||
{
|
||||
// insure the filed is always uniqe
|
||||
while (isset($this->uniqeValueArray[$type][$field][$value]))
|
||||
{
|
||||
$value = StringHelper::increment($value, 'dash');
|
||||
}
|
||||
$this->uniqeValueArray[$type][$field][$value] = $value;
|
||||
return $value;
|
||||
}
|
||||
|
||||
protected function getAliasesUsed($table)
|
||||
{
|
||||
// Get a db connection.
|
||||
$db = $this->getDatabase();
|
||||
// first we check if there is a alias column
|
||||
$columns = $db->getTableColumns('#__###component###_'.$table);
|
||||
if(isset($columns['alias'])){
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
$query->select($db->quoteName(array('alias')));
|
||||
$query->from($db->quoteName('#__###component###_'.$table));
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
if ($db->getNumRows())
|
||||
{
|
||||
$aliases = $db->loadColumn();
|
||||
foreach($aliases as $alias)
|
||||
{
|
||||
$this->uniqeValueArray[$table]['alias'][$alias] = $alias;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
351
admin/compiler/joomla_4/ADMIN_IMPORT_MODEL_CUSTOM.php
Normal file
351
admin/compiler/joomla_4/ADMIN_IMPORT_MODEL_CUSTOM.php
Normal file
@ -0,0 +1,351 @@
|
||||
<?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###\Administrator\Model;
|
||||
|
||||
###IMPORT_CUSTOM_MODEL_HEADER###
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* ###Component### ###View### Base Database Model
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class ###View###importModel extends BaseDatabaseModel
|
||||
{
|
||||
// set uploading values
|
||||
protected $use_streams = false;
|
||||
protected $allow_unsafe = false;
|
||||
protected $safeFileOptions = [];
|
||||
|
||||
/**
|
||||
* @var object JTable object
|
||||
*/
|
||||
protected $_table = null;
|
||||
|
||||
/**
|
||||
* @var object JTable object
|
||||
*/
|
||||
protected $_url = null;
|
||||
|
||||
/**
|
||||
* Model context string.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_context = 'com_###component###.###view###';
|
||||
|
||||
/**
|
||||
* Import Settings
|
||||
*/
|
||||
protected $getType = NULL;
|
||||
protected $dataType = NULL;
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
protected function populateState()
|
||||
{
|
||||
$app = Factory::getApplication('administrator');
|
||||
|
||||
$this->setState('message', $app->getUserState('com_###component###.message'));
|
||||
$app->setUserState('com_###component###.message', '');
|
||||
|
||||
// Recall the 'Import from Directory' path.
|
||||
$path = $app->getUserStateFromRequest($this->_context . '.import_directory', 'import_directory', $app->get('tmp_path'));
|
||||
$this->setState('import.directory', $path);
|
||||
parent::populateState();
|
||||
}
|
||||
###IMPORT_METHOD_CUSTOM###
|
||||
|
||||
/**
|
||||
* Works out an importation spreadsheet from a HTTP upload
|
||||
*
|
||||
* @return spreadsheet definition or false on failure
|
||||
*/
|
||||
protected function _getPackageFromUpload()
|
||||
{
|
||||
// Get the uploaded file information
|
||||
$app = Factory::getApplication();
|
||||
$input = $app->input;
|
||||
|
||||
// Do not change the filter type 'raw'. We need this to let files containing PHP code to upload. See JInputFiles::get.
|
||||
$userfile = $input->files->get('import_package', null, 'raw');
|
||||
|
||||
// Make sure that file uploads are enabled in php
|
||||
if (!(bool) ini_get('file_uploads'))
|
||||
{
|
||||
$app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_WARNIMPORTFILE'), 'warning');
|
||||
return false;
|
||||
}
|
||||
|
||||
// If there is no uploaded file, we have a problem...
|
||||
if (!is_array($userfile))
|
||||
{
|
||||
$app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_NO_FILE_SELECTED'), 'warning');
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if there was a problem uploading the file.
|
||||
if ($userfile['error'] || $userfile['size'] < 1)
|
||||
{
|
||||
$app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_WARNIMPORTUPLOADERROR'), 'warning');
|
||||
return false;
|
||||
}
|
||||
|
||||
// Build the appropriate paths
|
||||
$config = Factory::getConfig();
|
||||
$tmp_dest = $config->get('tmp_path') . '/' . $userfile['name'];
|
||||
$tmp_src = $userfile['tmp_name'];
|
||||
|
||||
// Move uploaded file
|
||||
$p_file = File::upload($tmp_src, $tmp_dest, $this->use_streams, $this->allow_unsafe, $this->safeFileOptions);
|
||||
|
||||
// Was the package downloaded?
|
||||
if (!$p_file)
|
||||
{
|
||||
$session = Factory::getSession();
|
||||
$session->clear('package');
|
||||
$session->clear('dataType');
|
||||
$session->clear('hasPackage');
|
||||
// was not uploaded
|
||||
return false;
|
||||
}
|
||||
|
||||
// check that this is a valid spreadsheet
|
||||
$package = $this->check($userfile['name']);
|
||||
|
||||
return $package;
|
||||
}
|
||||
|
||||
/**
|
||||
* Import an spreadsheet from a directory
|
||||
*
|
||||
* @return array Spreadsheet details or false on failure
|
||||
*
|
||||
*/
|
||||
protected function _getPackageFromFolder()
|
||||
{
|
||||
$app = Factory::getApplication();
|
||||
$input = $app->input;
|
||||
|
||||
// Get the path to the package to import
|
||||
$p_dir = $input->getString('import_directory');
|
||||
$p_dir = Path::clean($p_dir);
|
||||
// Did you give us a valid path?
|
||||
if (!file_exists($p_dir))
|
||||
{
|
||||
$app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_PLEASE_ENTER_A_PACKAGE_DIRECTORY'), 'warning');
|
||||
return false;
|
||||
}
|
||||
|
||||
// Detect the package type
|
||||
$type = $this->getType;
|
||||
|
||||
// Did you give us a valid package?
|
||||
if (!$type)
|
||||
{
|
||||
$app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_PATH_DOES_NOT_HAVE_A_VALID_PACKAGE'), 'warning');
|
||||
}
|
||||
|
||||
// check the extention
|
||||
if(!$this->checkExtension($p_dir))
|
||||
{
|
||||
// set error message
|
||||
$app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning');
|
||||
return false;
|
||||
}
|
||||
|
||||
$package['packagename'] = null;
|
||||
$package['dir'] = $p_dir;
|
||||
$package['type'] = $type;
|
||||
|
||||
return $package;
|
||||
}
|
||||
|
||||
/**
|
||||
* Import an spreadsheet from a URL
|
||||
*
|
||||
* @return Package details or false on failure
|
||||
*
|
||||
*/
|
||||
protected function _getPackageFromUrl()
|
||||
{
|
||||
$app = Factory::getApplication();
|
||||
$input = $app->input;
|
||||
|
||||
// Get the URL of the package to import
|
||||
$url = $input->getString('import_url');
|
||||
|
||||
// Did you give us a URL?
|
||||
if (!$url)
|
||||
{
|
||||
$app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_ENTER_A_URL'), 'warning');
|
||||
return false;
|
||||
}
|
||||
|
||||
// Download the package at the URL given
|
||||
$p_file = InstallerHelper::downloadPackage($url);
|
||||
|
||||
// Was the package downloaded?
|
||||
if (!$p_file)
|
||||
{
|
||||
$app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_INVALID_URL'), 'warning');
|
||||
return false;
|
||||
}
|
||||
|
||||
// check that this is a valid spreadsheet
|
||||
$package = $this->check($p_file);
|
||||
|
||||
return $package;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check a file and verifies it as a spreadsheet file
|
||||
* Supports .csv .xlsx .xls and .ods
|
||||
*
|
||||
* @param string $p_filename The uploaded package filename or import directory
|
||||
*
|
||||
* @return array of elements
|
||||
*
|
||||
*/
|
||||
protected function check($archivename)
|
||||
{
|
||||
$app = Factory::getApplication();
|
||||
// Clean the name
|
||||
$archivename = Path::clean($archivename);
|
||||
|
||||
// check the extention
|
||||
if(!$this->checkExtension($archivename))
|
||||
{
|
||||
// Cleanup the import files
|
||||
$this->remove($archivename);
|
||||
$app->enqueueMessage(Text::_('COM_###COMPONENT###_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning');
|
||||
return false;
|
||||
}
|
||||
|
||||
$config = Factory::getConfig();
|
||||
// set Package Name
|
||||
$check['packagename'] = $archivename;
|
||||
|
||||
// set directory
|
||||
$check['dir'] = $config->get('tmp_path'). '/' .$archivename;
|
||||
|
||||
// set type
|
||||
$check['type'] = $this->getType;
|
||||
|
||||
return $check;
|
||||
}
|
||||
###IMPORT_EXT_METHOD###
|
||||
|
||||
/**
|
||||
* Clean up temporary uploaded spreadsheet
|
||||
*
|
||||
* @param string $package Name of the uploaded spreadsheet file
|
||||
*
|
||||
* @return boolean True on success
|
||||
*
|
||||
*/
|
||||
protected function remove($package)
|
||||
{
|
||||
$config = Factory::getConfig();
|
||||
$package = $config->get('tmp_path'). '/' .$package;
|
||||
|
||||
// Is the package file a valid file?
|
||||
if (is_file($package))
|
||||
{
|
||||
File::delete($package);
|
||||
}
|
||||
elseif (is_file(Path::clean($package)))
|
||||
{
|
||||
// It might also be just a base filename
|
||||
File::delete(Path::clean($package));
|
||||
}
|
||||
}
|
||||
###IMPORT_SETDATA_METHOD###
|
||||
###IMPORT_SAVE_METHOD###
|
||||
|
||||
protected function getAlias($name,$type = false)
|
||||
{
|
||||
// sanitize the name to an alias
|
||||
if (Factory::getConfig()->get('unicodeslugs') == 1)
|
||||
{
|
||||
$alias = OutputFilter::stringURLUnicodeSlug($name);
|
||||
}
|
||||
else
|
||||
{
|
||||
$alias = OutputFilter::stringURLSafe($name);
|
||||
}
|
||||
// must be a uniqe alias
|
||||
if ($type)
|
||||
{
|
||||
return $this->getUniqe($alias,'alias',$type);
|
||||
}
|
||||
return $alias;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to generate a uniqe value.
|
||||
*
|
||||
* @param string $field name.
|
||||
* @param string $value data.
|
||||
* @param string $type table.
|
||||
*
|
||||
* @return string New value.
|
||||
*/
|
||||
protected function getUniqe($value,$field,$type)
|
||||
{
|
||||
// insure the filed is always uniqe
|
||||
while (isset($this->uniqeValueArray[$type][$field][$value]))
|
||||
{
|
||||
$value = StringHelper::increment($value, 'dash');
|
||||
}
|
||||
$this->uniqeValueArray[$type][$field][$value] = $value;
|
||||
return $value;
|
||||
}
|
||||
|
||||
protected function getAliasesUsed($table)
|
||||
{
|
||||
// Get a db connection.
|
||||
$db = $this->getDatabase();
|
||||
// first we check if there is a alias column
|
||||
$columns = $db->getTableColumns('#__###component###_'.$table);
|
||||
if(isset($columns['alias'])){
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
$query->select($db->quoteName(array('alias')));
|
||||
$query->from($db->quoteName('#__###component###_'.$table));
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
if ($db->getNumRows())
|
||||
{
|
||||
$aliases = $db->loadColumn();
|
||||
foreach($aliases as $alias)
|
||||
{
|
||||
$this->uniqeValueArray[$table]['alias'][$alias] = $alias;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
22
admin/compiler/joomla_4/ADMIN_LAYOUT.php
Normal file
22
admin/compiler/joomla_4/ADMIN_LAYOUT.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?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###
|
||||
|
||||
###ADMIN_LAYOUT_HEADER###
|
||||
|
||||
// No direct access to this file
|
||||
defined('JPATH_BASE') or die;###ADMIN_LAYOUT_CODE###
|
||||
|
||||
?>###ADMIN_LAYOUT_BODY###
|
78
admin/compiler/joomla_4/ADMIN_PROVIDER.php
Normal file
78
admin/compiler/joomla_4/ADMIN_PROVIDER.php
Normal file
@ -0,0 +1,78 @@
|
||||
<?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###
|
||||
|
||||
###ADMIN_POWER_HELPER###
|
||||
|
||||
// (soon) use Joomla\CMS\Association\AssociationExtensionInterface;
|
||||
use Joomla\CMS\Categories\CategoryFactoryInterface;
|
||||
use Joomla\CMS\Component\Router\RouterFactoryInterface;
|
||||
use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface;
|
||||
use Joomla\CMS\Extension\ComponentInterface;
|
||||
use Joomla\CMS\Extension\Service\Provider\CategoryFactory;
|
||||
use Joomla\CMS\Extension\Service\Provider\ComponentDispatcherFactory;
|
||||
use Joomla\CMS\Extension\Service\Provider\MVCFactory;
|
||||
use Joomla\CMS\Extension\Service\Provider\RouterFactory;
|
||||
use Joomla\CMS\HTML\Registry;
|
||||
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
|
||||
use ###NAMESPACEPREFIX###\Component\###ComponentNameSpace###\Administrator\Extension\###Component###Component;
|
||||
// (soon) use ###NAMESPACEPREFIX###\Component\###ComponentNameSpace###\Administrator\Helper\AssociationsHelper;
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* The ###NAMESPACEPREFIX### ###Component### service provider.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
return new class () implements ServiceProviderInterface
|
||||
{
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
// (soon) $container->set(AssociationExtensionInterface::class, new AssociationsHelper());
|
||||
|
||||
$container->registerServiceProvider(new CategoryFactory('\\###NAMESPACEPREFIX###\\Component\\###Component###'));
|
||||
$container->registerServiceProvider(new MVCFactory('\\###NAMESPACEPREFIX###\\Component\\###Component###'));
|
||||
$container->registerServiceProvider(new ComponentDispatcherFactory('\\###NAMESPACEPREFIX###\\Component\\###Component###'));
|
||||
$container->registerServiceProvider(new RouterFactory('\\###NAMESPACEPREFIX###\\Component\\###Component###'));
|
||||
|
||||
$container->set(
|
||||
ComponentInterface::class,
|
||||
function (Container $container) {
|
||||
$component = new ###Component###Component($container->get(ComponentDispatcherFactoryInterface::class));
|
||||
|
||||
$component->setRegistry($container->get(Registry::class));
|
||||
$component->setMVCFactory($container->get(MVCFactoryInterface::class));
|
||||
$component->setCategoryFactory($container->get(CategoryFactoryInterface::class));
|
||||
// (soon) $component->setAssociationExtension($container->get(AssociationExtensionInterface::class));
|
||||
$component->setRouterFactory($container->get(RouterFactoryInterface::class));
|
||||
|
||||
return $component;
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
27
admin/compiler/joomla_4/ADMIN_VIEW.php
Normal file
27
admin/compiler/joomla_4/ADMIN_VIEW.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?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###
|
||||
|
||||
###ADMIN_VIEW_HEADER###
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
?>
|
||||
###EDITBODYFADEIN###
|
||||
<form action="<?php echo Route::_('index.php?option=com_###component###&layout=edit&id='. (int) $this->item->id . $this->referral); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
|
||||
###EDITBODY###
|
||||
</form>
|
||||
</div>###EDITBODYSCRIPT###
|
28
admin/compiler/joomla_4/ADMIN_VIEWS.php
Normal file
28
admin/compiler/joomla_4/ADMIN_VIEWS.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?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###
|
||||
|
||||
###ADMIN_VIEWS_HEADER###
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED###
|
||||
|
||||
if ($this->saveOrder)
|
||||
{
|
||||
$saveOrderingUrl = 'index.php?option=com_###component###&task=###views###.saveOrderAjax&tmpl=component';
|
||||
Html::_('sortablelist.sortable', '###view###List', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl);
|
||||
}
|
||||
?>
|
||||
###VIEWS_DEFAULT_BODY######VIEWS_FOOTER_SCRIPT###
|
53
admin/compiler/joomla_4/ADMIN_VIEWS_CONTROLLER.php
Normal file
53
admin/compiler/joomla_4/ADMIN_VIEWS_CONTROLLER.php
Normal file
@ -0,0 +1,53 @@
|
||||
<?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###\Administrator\Controller;
|
||||
|
||||
###ADMIN_VIEWS_CONTROLLER_HEADER###
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* ###Views### Admin Controller
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class ###Views###Controller extends AdminController
|
||||
{
|
||||
/**
|
||||
* The prefix to use with controller messages.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $text_prefix = 'COM_###COMPONENT###_###VIEWS###';
|
||||
|
||||
/**
|
||||
* Proxy for getModel.
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getModel($name = '###View###', $prefix = 'Administrator', $config = ['ignore_request' => true])
|
||||
{
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
}###CONTROLLEREXIMPORTMETHOD######CUSTOM_ADMIN_DYNAMIC_BUTTONS_CONTROLLER######ADMIN_CUSTOM_BUTTONS_CONTROLLER_LIST###
|
||||
}
|
33
admin/compiler/joomla_4/ADMIN_VIEWS_EMPTYSTATE.php
Normal file
33
admin/compiler/joomla_4/ADMIN_VIEWS_EMPTYSTATE.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?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###
|
||||
|
||||
use Joomla\CMS\Layout\LayoutHelper;
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED###
|
||||
|
||||
$displayData = [
|
||||
'textPrefix' => 'COM_###COMPONENT###_###VIEWS###',
|
||||
'formURL' => 'index.php?option=com_###component###&view=###views###',
|
||||
'icon' => 'icon-###ICOMOON###',
|
||||
];
|
||||
|
||||
if ($this->user->authorise('###view###.create', 'com_###component###'))
|
||||
{
|
||||
$displayData['createURL'] = 'index.php?option=com_###component###&task=###view###.add';
|
||||
}
|
||||
|
||||
echo LayoutHelper::render('joomla.content.emptystate', $displayData);
|
188
admin/compiler/joomla_4/ADMIN_VIEWS_HTML.php
Normal file
188
admin/compiler/joomla_4/ADMIN_VIEWS_HTML.php
Normal file
@ -0,0 +1,188 @@
|
||||
<?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###\Administrator\View\###Views###;
|
||||
|
||||
###ADMIN_VIEWS_HTML_HEADER###
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED###
|
||||
|
||||
/**
|
||||
* ###Component### Html View class for the ###Views###
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class HtmlView extends BaseHtmlView
|
||||
{
|
||||
/**
|
||||
* ###Views### view display method
|
||||
*
|
||||
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
public function display($tpl = null)
|
||||
{
|
||||
// Assign data to the view
|
||||
$this->items = $this->get('Items');
|
||||
$this->pagination = $this->get('Pagination');
|
||||
$this->state = $this->get('State');
|
||||
$this->styles = $this->get('Styles');
|
||||
$this->scripts = $this->get('Scripts');
|
||||
$this->user ??= Factory::getApplication()->getIdentity();###ADMIN_DIPLAY_METHOD###
|
||||
$this->saveOrder = $this->listOrder == 'a.ordering';
|
||||
// set the return here value
|
||||
$this->return_here = urlencode(base64_encode((string) Uri::getInstance()));
|
||||
// get global action permissions
|
||||
$this->canDo = ###Component###Helper::getActions('###view###');###JVIEWLISTCANDO###
|
||||
|
||||
// If we don't have items we load the empty state
|
||||
if (is_array($this->items) && !count((array) $this->items) && $this->isEmptyState = $this->get('IsEmptyState'))
|
||||
{
|
||||
$this->setLayout('emptystate');
|
||||
}
|
||||
|
||||
// We don't need toolbar in the modal window.
|
||||
if ($this->getLayout() !== 'modal')
|
||||
{
|
||||
$this->addToolbar();
|
||||
}
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
throw new \Exception(implode("\n", $errors), 500);
|
||||
}
|
||||
|
||||
// Set the html view document stuff
|
||||
$this->_prepareDocument();
|
||||
|
||||
// Display the template
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the page title and toolbar.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function addToolbar(): void
|
||||
{
|
||||
ToolbarHelper::title(Text::_('COM_###COMPONENT###_###VIEWS###'), '###ICOMOON###');
|
||||
|
||||
if ($this->canCreate)
|
||||
{
|
||||
ToolbarHelper::addNew('###view###.add');
|
||||
}
|
||||
|
||||
// Only load if there are items
|
||||
if (Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($this->items))
|
||||
{
|
||||
if ($this->canEdit)
|
||||
{
|
||||
ToolbarHelper::editList('###view###.edit');
|
||||
}
|
||||
|
||||
if ($this->canState)
|
||||
{
|
||||
ToolbarHelper::publishList('###views###.publish');
|
||||
ToolbarHelper::unpublishList('###views###.unpublish');
|
||||
ToolbarHelper::archiveList('###views###.archive');
|
||||
|
||||
if ($this->canDo->get('core.admin'))
|
||||
{
|
||||
ToolbarHelper::checkin('###views###.checkin');
|
||||
}
|
||||
}###CUSTOM_ADMIN_DYNAMIC_BUTTONS######ADMIN_CUSTOM_BUTTONS_LIST###
|
||||
|
||||
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
|
||||
{
|
||||
ToolbarHelper::deleteList('', '###views###.delete', 'JTOOLBAR_EMPTY_TRASH');
|
||||
}
|
||||
elseif ($this->canState && $this->canDelete)
|
||||
{
|
||||
ToolbarHelper::trash('###views###.trash');
|
||||
}###EXPORTBUTTON###
|
||||
}###ADMIN_CUSTOM_FUNCTION_ONLY_BUTTONS_LIST######IMPORTBUTTON###
|
||||
|
||||
// set help url for this view if found
|
||||
$this->help_url = ###Component###Helper::getHelpUrl('###views###');
|
||||
if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($this->help_url))
|
||||
{
|
||||
ToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url);
|
||||
}
|
||||
|
||||
// add the options comp button
|
||||
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
|
||||
{
|
||||
ToolbarHelper::preferences('com_###component###');
|
||||
}###FILTERFIELDDISPLAYHELPER######BATCHDISPLAYHELPER###
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare some document related stuff.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function _prepareDocument(): void
|
||||
{###JQUERY###
|
||||
$this->getDocument()->setTitle(Text::_('COM_###COMPONENT###_###VIEWS###'));
|
||||
// add styles
|
||||
foreach ($this->styles as $style)
|
||||
{
|
||||
Html::_('stylesheet', $style, ['version' => 'auto']);
|
||||
}
|
||||
// add scripts
|
||||
foreach ($this->scripts as $script)
|
||||
{
|
||||
Html::_('script', $script, ['version' => 'auto']);
|
||||
}###ADMIN_ADD_JAVASCRIPT_FILE###
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes a value for output in a view script.
|
||||
*
|
||||
* @param mixed $var The output to escape.
|
||||
* @param bool $shorten The switch to shorten.
|
||||
* @param int $length The shorting length.
|
||||
*
|
||||
* @return mixed The escaped value.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function escape($var, bool $shorten = true, int $length = 50)
|
||||
{
|
||||
if (!is_string($var))
|
||||
{
|
||||
return $var;
|
||||
}
|
||||
|
||||
return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of fields the table can be sorted by
|
||||
*
|
||||
* @return array containing the field name to sort by as the key and display text as value
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getSortFields()
|
||||
{
|
||||
###SORTFIELDS###
|
||||
}###FILTERFUNCTIONS###
|
||||
}
|
189
admin/compiler/joomla_4/ADMIN_VIEWS_MODEL.php
Normal file
189
admin/compiler/joomla_4/ADMIN_VIEWS_MODEL.php
Normal file
@ -0,0 +1,189 @@
|
||||
<?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###\Administrator\Model;
|
||||
|
||||
###ADMIN_VIEWS_MODEL_HEADER###
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* ###Views### List Model
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class ###Views###Model extends ListModel
|
||||
{
|
||||
/**
|
||||
* The application object.
|
||||
*
|
||||
* @var CMSApplicationInterface The application instance.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected CMSApplicationInterface $app;
|
||||
|
||||
/**
|
||||
* The styles array.
|
||||
*
|
||||
* @var array
|
||||
* @since 4.3
|
||||
*/
|
||||
protected array $styles = [
|
||||
'administrator/components/com_###component###/assets/css/admin.css',
|
||||
'administrator/components/com_###component###/assets/css/###views###.css'
|
||||
];
|
||||
|
||||
/**
|
||||
* The scripts array.
|
||||
*
|
||||
* @var array
|
||||
* @since 4.3
|
||||
*/
|
||||
protected array $scripts = [
|
||||
'administrator/components/com_###component###/assets/js/admin.js'
|
||||
];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param array $config An array of configuration options (name, state, dbo, table_path, ignore_request).
|
||||
* @param ?MVCFactoryInterface $factory The factory.
|
||||
*
|
||||
* @since 1.6
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function __construct($config = [], MVCFactoryInterface $factory = null)
|
||||
{
|
||||
if (empty($config['filter_fields']))
|
||||
{
|
||||
$config['filter_fields'] = array(
|
||||
###FILTER_FIELDS###
|
||||
);
|
||||
}
|
||||
|
||||
parent::__construct($config, $factory);
|
||||
|
||||
$this->app ??= Factory::getApplication();
|
||||
}###ADMIN_CUSTOM_BUTTONS_METHOD_LIST###
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @param string $ordering An optional ordering field.
|
||||
* @param string $direction An optional direction (asc|desc).
|
||||
*
|
||||
* @return void
|
||||
* @since 1.7.0
|
||||
*/
|
||||
protected function populateState($ordering = null, $direction = null)
|
||||
{
|
||||
$app = $this->app;
|
||||
|
||||
// Adjust the context to support modal layouts.
|
||||
if ($layout = $app->input->get('layout'))
|
||||
{
|
||||
$this->context .= '.' . $layout;
|
||||
}###POPULATESTATE###
|
||||
|
||||
// List state information.
|
||||
parent::populateState($ordering, $direction);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get an array of data items.
|
||||
*
|
||||
* @return mixed An array of data items on success, false on failure.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getItems()
|
||||
{###LICENSE_LOCKED_CHECK######CHECKINCALL###
|
||||
// load parent items
|
||||
$items = parent::getItems();###GET_ITEMS_METHOD_STRING_FIX######SELECTIONTRANSLATIONFIX######GET_ITEMS_METHOD_AFTER_ALL###
|
||||
|
||||
// return items
|
||||
return $items;
|
||||
}###SELECTIONTRANSLATIONFIXFUNC###
|
||||
|
||||
/**
|
||||
* Method to build an SQL query to load the list data.
|
||||
*
|
||||
* @return string An SQL query
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getListQuery()
|
||||
{###LICENSE_LOCKED_CHECK###
|
||||
###LISTQUERY###
|
||||
}###MODELEXPORTMETHOD######LICENSE_LOCKED_SET_BOOL###
|
||||
|
||||
/**
|
||||
* Method to get a store id based on model configuration state.
|
||||
*
|
||||
* @return string A store id.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getStoreId($id = '')
|
||||
{
|
||||
###STOREDID###
|
||||
|
||||
return parent::getStoreId($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the styles that have to be included on the view
|
||||
*
|
||||
* @return array styles files
|
||||
* @since 4.3
|
||||
*/
|
||||
public function getStyles(): array
|
||||
{
|
||||
return $this->styles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to set the styles that have to be included on the view
|
||||
*
|
||||
* @return void
|
||||
* @since 4.3
|
||||
*/
|
||||
public function setStyles(string $path): void
|
||||
{
|
||||
$this->styles[] = $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the script that have to be included on the view
|
||||
*
|
||||
* @return array script files
|
||||
* @since 4.3
|
||||
*/
|
||||
public function getScripts(): array
|
||||
{
|
||||
return $this->scripts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to set the script that have to be included on the view
|
||||
*
|
||||
* @return void
|
||||
* @since 4.3
|
||||
*/
|
||||
public function setScript(string $path): void
|
||||
{
|
||||
$this->scripts[] = $path;
|
||||
}###AUTOCHECKIN###
|
||||
}
|
274
admin/compiler/joomla_4/ADMIN_VIEW_CONTROLLER.php
Normal file
274
admin/compiler/joomla_4/ADMIN_VIEW_CONTROLLER.php
Normal file
@ -0,0 +1,274 @@
|
||||
<?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###\Administrator\Controller;
|
||||
|
||||
###ADMIN_VIEW_CONTROLLER_HEADER###
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* ###View### Form Controller
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class ###View###Controller extends FormController
|
||||
{
|
||||
use VersionableControllerTrait;
|
||||
|
||||
/**
|
||||
* The prefix to use with controller messages.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $text_prefix = 'COM_###COMPONENT###_###VIEW###';
|
||||
|
||||
/**
|
||||
* Current or most recently performed task.
|
||||
*
|
||||
* @var string
|
||||
* @since 12.2
|
||||
* @note Replaces _task.
|
||||
*/
|
||||
protected $task;
|
||||
|
||||
/**
|
||||
* The URL view list variable.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $view_list = '###views###';###ADMIN_CUSTOM_BUTTONS_CONTROLLER###
|
||||
|
||||
/**
|
||||
* Method override to check if you can add a new record.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
*
|
||||
* @return boolean
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function allowAdd($data = [])
|
||||
{###JCONTROLLERFORM_ALLOWADD###
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can edit an existing record.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
* @param string $key The name of the key for the primary key.
|
||||
*
|
||||
* @return boolean
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function allowEdit($data = [], $key = 'id')
|
||||
{###JCONTROLLERFORM_ALLOWEDIT###
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the URL arguments to append to an item redirect.
|
||||
*
|
||||
* @param integer $recordId The primary key id for the item.
|
||||
* @param string $urlVar The name of the URL variable for the id.
|
||||
*
|
||||
* @return string The arguments to append to the redirect URL.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
|
||||
{
|
||||
// get the referral options (old method use return instead see parent)
|
||||
$ref = $this->input->get('ref', 0, 'string');
|
||||
$refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
// get redirect info.
|
||||
$append = parent::getRedirectToItemAppend($recordId, $urlVar);
|
||||
|
||||
// set the referral options
|
||||
if ($refid && $ref)
|
||||
{
|
||||
$append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append;
|
||||
}
|
||||
elseif ($ref)
|
||||
{
|
||||
$append = '&ref='. (string) $ref . $append;
|
||||
}
|
||||
|
||||
return $append;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to run batch operations.
|
||||
*
|
||||
* @param object $model The model.
|
||||
*
|
||||
* @return boolean True if successful, false otherwise and internal error is set.
|
||||
*
|
||||
* @since 2.5
|
||||
*/
|
||||
public function batch($model = null)
|
||||
{
|
||||
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// Set the model
|
||||
$model = $this->getModel('###View###', '', []);
|
||||
|
||||
// Preset the redirect
|
||||
$this->setRedirect(Route::_('index.php?option=com_###component###&view=###views###' . $this->getRedirectToListAppend(), false));
|
||||
|
||||
return parent::batch($model);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to cancel an edit.
|
||||
*
|
||||
* @param string $key The name of the primary key of the URL variable.
|
||||
*
|
||||
* @return boolean True if access level checks pass, false otherwise.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function cancel($key = null)
|
||||
{
|
||||
// get the referral options
|
||||
$this->ref = $this->input->get('ref', 0, 'word');
|
||||
$this->refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
// Check if there is a return value
|
||||
$return = $this->input->get('return', null, 'base64');###JCONTROLLERFORM_BEFORECANCEL###
|
||||
|
||||
$cancel = parent::cancel($key);
|
||||
|
||||
if (!is_null($return) && Uri::isInternal(base64_decode($return)))
|
||||
{
|
||||
$redirect = base64_decode($return);
|
||||
|
||||
// Redirect to the return value.
|
||||
$this->setRedirect(
|
||||
Route::_(
|
||||
$redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->refid && $this->ref)
|
||||
{
|
||||
$redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
|
||||
|
||||
// Redirect to the item screen.
|
||||
$this->setRedirect(
|
||||
Route::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->ref)
|
||||
{
|
||||
$redirect = '&view='.(string)$this->ref;
|
||||
|
||||
// Redirect to the list screen.
|
||||
$this->setRedirect(
|
||||
Route::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}###JCONTROLLERFORM_AFTERCANCEL###
|
||||
return $cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to save a record.
|
||||
*
|
||||
* @param string $key The name of the primary key of the URL variable.
|
||||
* @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions).
|
||||
*
|
||||
* @return boolean True if successful, false otherwise.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function save($key = null, $urlVar = null)
|
||||
{
|
||||
// get the referral options
|
||||
$this->ref = $this->input->get('ref', 0, 'word');
|
||||
$this->refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
// Check if there is a return value
|
||||
$return = $this->input->get('return', null, 'base64');
|
||||
$canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return)));
|
||||
|
||||
if ($this->ref || $this->refid || $canReturn)
|
||||
{
|
||||
// to make sure the item is checkedin on redirect
|
||||
$this->task = 'save';
|
||||
}
|
||||
|
||||
$saved = parent::save($key, $urlVar);
|
||||
|
||||
// This is not needed since parent save already does this
|
||||
// Due to the ref and refid implementation we need to add this
|
||||
if ($canReturn)
|
||||
{
|
||||
$redirect = base64_decode($return);
|
||||
|
||||
// Redirect to the return value.
|
||||
$this->setRedirect(
|
||||
Route::_(
|
||||
$redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->refid && $this->ref)
|
||||
{
|
||||
$redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid;
|
||||
|
||||
// Redirect to the item screen.
|
||||
$this->setRedirect(
|
||||
Route::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->ref)
|
||||
{
|
||||
$redirect = '&view=' . (string) $this->ref;
|
||||
|
||||
// Redirect to the list screen.
|
||||
$this->setRedirect(
|
||||
Route::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
return $saved;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function that allows child controller access to model data
|
||||
* after the data has been saved.
|
||||
*
|
||||
* @param BaseDatabaseModel &$model The data model object.
|
||||
* @param array $validData The validated data.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 11.1
|
||||
*/
|
||||
protected function postSaveHook(BaseDatabaseModel $model, $validData = [])
|
||||
{###POSTSAVEHOOK###
|
||||
}
|
||||
}
|
143
admin/compiler/joomla_4/ADMIN_VIEW_HTML.php
Normal file
143
admin/compiler/joomla_4/ADMIN_VIEW_HTML.php
Normal file
@ -0,0 +1,143 @@
|
||||
<?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###\Administrator\View\###View###;
|
||||
|
||||
###ADMIN_VIEW_HTML_HEADER###
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED###
|
||||
|
||||
/**
|
||||
* ###View### Html View class
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class HtmlView extends BaseHtmlView
|
||||
{
|
||||
/**
|
||||
* ###View### view display method
|
||||
*
|
||||
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
public function display($tpl = null)
|
||||
{
|
||||
// set params
|
||||
$this->params = ComponentHelper::getParams('com_###component###');
|
||||
// Assign the variables
|
||||
$this->form = $this->get('Form');
|
||||
$this->item = $this->get('Item');
|
||||
$this->styles = $this->get('Styles');
|
||||
$this->scripts = $this->get('Scripts');
|
||||
$this->state = $this->get('State');
|
||||
// get action permissions
|
||||
$this->canDo = ###Component###Helper::getActions('###view###', $this->item);
|
||||
// get input
|
||||
$jinput = Factory::getApplication()->input;
|
||||
$this->ref = $jinput->get('ref', 0, 'word');
|
||||
$this->refid = $jinput->get('refid', 0, 'int');
|
||||
$return = $jinput->get('return', null, 'base64');
|
||||
// set the referral string
|
||||
$this->referral = '';
|
||||
if ($this->refid && $this->ref)
|
||||
{
|
||||
// return to the item that referred to this item
|
||||
$this->referral = '&ref=' . (string) $this->ref . '&refid=' . (int) $this->refid;
|
||||
}
|
||||
elseif($this->ref)
|
||||
{
|
||||
// return to the list view that referred to this item
|
||||
$this->referral = '&ref=' . (string) $this->ref;
|
||||
}
|
||||
// check return value
|
||||
if (!is_null($return))
|
||||
{
|
||||
// add the return value
|
||||
$this->referral .= '&return=' . (string) $return;
|
||||
}###LINKEDVIEWITEMS###
|
||||
|
||||
// Set the toolbar
|
||||
$this->addToolBar();
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
throw new \Exception(implode("\n", $errors), 500);
|
||||
}
|
||||
|
||||
// Set the html view document stuff
|
||||
$this->_prepareDocument();
|
||||
|
||||
// Display the template
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add the page title and toolbar.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function addToolbar(): void
|
||||
{
|
||||
###ADDTOOLBAR###
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes a value for output in a view script.
|
||||
*
|
||||
* @param mixed $var The output to escape.
|
||||
* @param bool $shorten The switch to shorten.
|
||||
* @param int $length The shorting length.
|
||||
*
|
||||
* @return mixed The escaped value.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function escape($var, bool $shorten = true, int $length = 30)
|
||||
{
|
||||
if (!is_string($var))
|
||||
{
|
||||
return $var;
|
||||
}
|
||||
|
||||
return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare some document related stuff.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function _prepareDocument(): void
|
||||
{###JQUERY###
|
||||
$isNew = ($this->item->id < 1);
|
||||
$this->getDocument()->setTitle(Text::_($isNew ? 'COM_###COMPONENT###_###VIEW###_NEW' : 'COM_###COMPONENT###_###VIEW###_EDIT'));
|
||||
// add styles
|
||||
foreach ($this->styles as $style)
|
||||
{
|
||||
Html::_('stylesheet', $style, ['version' => 'auto']);
|
||||
}###AJAXTOKE######LINKEDVIEWTABLESCRIPTS###
|
||||
// add scripts
|
||||
foreach ($this->scripts as $script)
|
||||
{
|
||||
Html::_('script', $script, ['version' => 'auto']);
|
||||
}###DOCUMENT_CUSTOM_PHP###
|
||||
}
|
||||
}
|
491
admin/compiler/joomla_4/ADMIN_VIEW_MODEL.php
Normal file
491
admin/compiler/joomla_4/ADMIN_VIEW_MODEL.php
Normal file
@ -0,0 +1,491 @@
|
||||
<?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###\Administrator\Model;
|
||||
|
||||
###ADMIN_VIEW_MODEL_HEADER###
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* ###Component### ###View### Admin Model
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class ###View###Model extends AdminModel
|
||||
{
|
||||
use VersionableModelTrait;
|
||||
|
||||
/**
|
||||
* The tab layout fields array.
|
||||
*
|
||||
* @var array
|
||||
* @since 3.0.0
|
||||
*/
|
||||
protected $tabLayoutFields = ###TABLAYOUTFIELDSARRAY###;
|
||||
|
||||
/**
|
||||
* The styles array.
|
||||
*
|
||||
* @var array
|
||||
* @since 4.3
|
||||
*/
|
||||
protected array $styles = [
|
||||
'administrator/components/com_###component###/assets/css/admin.css',
|
||||
'administrator/components/com_###component###/assets/css/###view###.css'
|
||||
];
|
||||
|
||||
/**
|
||||
* The scripts array.
|
||||
*
|
||||
* @var array
|
||||
* @since 4.3
|
||||
*/
|
||||
protected array $scripts = [
|
||||
'administrator/components/com_###component###/assets/js/admin.js',
|
||||
'media/com_###component###/js/###view###.js'
|
||||
];
|
||||
|
||||
/**
|
||||
* @var string The prefix to use with controller messages.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $text_prefix = 'COM_###COMPONENT###';
|
||||
|
||||
/**
|
||||
* The type alias for this content type.
|
||||
*
|
||||
* @var string
|
||||
* @since 3.2
|
||||
*/
|
||||
public $typeAlias = 'com_###component###.###view###';
|
||||
|
||||
/**
|
||||
* Returns a Table object, always creating it
|
||||
*
|
||||
* @param type $type The table type to instantiate
|
||||
* @param string $prefix A prefix for the table class name. Optional.
|
||||
* @param array $config Configuration array for model. Optional.
|
||||
*
|
||||
* @return Table A database object
|
||||
* @since 3.0
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getTable($type = '###view###', $prefix = 'Administrator', $config = [])
|
||||
{
|
||||
// get instance of the table
|
||||
return parent::getTable($type, $prefix, $config);
|
||||
}###ADMIN_CUSTOM_BUTTONS_METHOD###
|
||||
|
||||
/**
|
||||
* Method to get a single record.
|
||||
*
|
||||
* @param integer $pk The id of the primary key.
|
||||
*
|
||||
* @return mixed Object on success, false on failure.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getItem($pk = null)
|
||||
{###LICENSE_LOCKED_CHECK###
|
||||
if ($item = parent::getItem($pk))
|
||||
{
|
||||
if (!empty($item->params) && !is_array($item->params))
|
||||
{
|
||||
// Convert the params field to an array.
|
||||
$registry = new Registry;
|
||||
$registry->loadString($item->params);
|
||||
$item->params = $registry->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->metadata))
|
||||
{
|
||||
// Convert the metadata field to an array.
|
||||
$registry = new Registry;
|
||||
$registry->loadString($item->metadata);
|
||||
$item->metadata = $registry->toArray();
|
||||
}###METHOD_GET_ITEM###
|
||||
}###LINKEDVIEWGLOBAL###
|
||||
|
||||
return $item;
|
||||
}###LINKEDVIEWMETHODS######LICENSE_LOCKED_SET_BOOL###
|
||||
|
||||
/**
|
||||
* Method to get the record form.
|
||||
*
|
||||
* @param array $data Data for the form.
|
||||
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
|
||||
* @param array $options Optional array of options for the form creation.
|
||||
*
|
||||
* @return Form|boolean A Form object on success, false on failure
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getForm($data = [], $loadData = true, $options = ['control' => 'jform'])
|
||||
{
|
||||
// set load data option
|
||||
$options['load_data'] = $loadData;###JMODELADMIN_GETFORM###
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the styles that have to be included on the view
|
||||
*
|
||||
* @return array styles files
|
||||
* @since 4.3
|
||||
*/
|
||||
public function getStyles(): array
|
||||
{
|
||||
return $this->styles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to set the styles that have to be included on the view
|
||||
*
|
||||
* @return void
|
||||
* @since 4.3
|
||||
*/
|
||||
public function setStyles(string $path): void
|
||||
{
|
||||
$this->styles[] = $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the script that have to be included on the view
|
||||
*
|
||||
* @return array script files
|
||||
* @since 4.3
|
||||
*/
|
||||
public function getScripts(): array
|
||||
{
|
||||
return $this->scripts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to set the script that have to be included on the view
|
||||
*
|
||||
* @return void
|
||||
* @since 4.3
|
||||
*/
|
||||
public function setScript(string $path): void
|
||||
{
|
||||
$this->scripts[] = $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to test whether a record can be deleted.
|
||||
*
|
||||
* @param object $record A record object.
|
||||
*
|
||||
* @return boolean True if allowed to delete the record. Defaults to the permission set in the component.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function canDelete($record)
|
||||
{###JMODELADMIN_CANDELETE###
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to test whether a record can have its state edited.
|
||||
*
|
||||
* @param object $record A record object.
|
||||
*
|
||||
* @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function canEditState($record)
|
||||
{###JMODELADMIN_CANEDITSTATE###
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can edit an existing record.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
* @param string $key The name of the key for the primary key.
|
||||
*
|
||||
* @return boolean
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function allowEdit($data = [], $key = 'id')
|
||||
{###JMODELADMIN_ALLOWEDIT###
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare and sanitise the table data prior to saving.
|
||||
*
|
||||
* @param Table $table A Table object.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function prepareTable($table)
|
||||
{###LICENSE_TABLE_LOCKED_CHECK###
|
||||
$date = Factory::getDate();
|
||||
$user = $this->getCurrentUser();
|
||||
|
||||
if (isset($table->name))
|
||||
{
|
||||
$table->name = \htmlspecialchars_decode($table->name, ENT_QUOTES);
|
||||
}
|
||||
|
||||
if (isset($table->alias) && empty($table->alias))
|
||||
{
|
||||
$table->generateAlias();
|
||||
}
|
||||
|
||||
if (empty($table->id))
|
||||
{
|
||||
$table->created = $date->toSql();
|
||||
// set the user
|
||||
if ($table->created_by == 0 || empty($table->created_by))
|
||||
{
|
||||
$table->created_by = $user->id;
|
||||
}
|
||||
// Set ordering to the last item if not set
|
||||
if (empty($table->ordering))
|
||||
{
|
||||
$db = $this->getDatabase();
|
||||
$query = $db->getQuery(true)
|
||||
->select('MAX(ordering)')
|
||||
->from($db->quoteName('#__###component###_###view###'));
|
||||
$db->setQuery($query);
|
||||
$max = $db->loadResult();
|
||||
|
||||
$table->ordering = $max + 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$table->modified = $date->toSql();
|
||||
$table->modified_by = $user->id;
|
||||
}
|
||||
|
||||
if (!empty($table->id))
|
||||
{
|
||||
// Increment the items version number.
|
||||
$table->version++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the data that should be injected in the form.
|
||||
*
|
||||
* @return mixed The data for the form.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function loadFormData()
|
||||
{
|
||||
// Check the session for previously entered form data.
|
||||
$data = Factory::getApplication()->getUserState('com_###component###.edit.###view###.data', []);
|
||||
|
||||
if (empty($data))
|
||||
{
|
||||
$data = $this->getItem();
|
||||
}
|
||||
|
||||
// run the perprocess of the data
|
||||
$this->preprocessData('com_###component###.###view###', $data);
|
||||
|
||||
return $data;
|
||||
}###VALIDATIONFIX######UNIQUEFIELDS###
|
||||
|
||||
/**
|
||||
* Method to delete one or more records.
|
||||
*
|
||||
* @param array &$pks An array of record primary keys.
|
||||
*
|
||||
* @return boolean True if successful, false if an error occurs
|
||||
* @since 12.2
|
||||
*/
|
||||
public function delete(&$pks)
|
||||
{###JMODELADMIN_BEFORE_DELETE###
|
||||
if (!parent::delete($pks))
|
||||
{
|
||||
return false;
|
||||
}###JMODELADMIN_AFTER_DELETE###
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to change the published state of one or more records.
|
||||
*
|
||||
* @param array &$pks A list of the primary keys to change.
|
||||
* @param integer $value The value of the published state.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
* @since 12.2
|
||||
*/
|
||||
public function publish(&$pks, $value = 1)
|
||||
{###JMODELADMIN_BEFORE_PUBLISH###
|
||||
if (!parent::publish($pks, $value))
|
||||
{
|
||||
return false;
|
||||
}###JMODELADMIN_AFTER_PUBLISH###
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to perform batch operations on an item or a set of items.
|
||||
*
|
||||
* @param array $commands An array of commands to perform.
|
||||
* @param array $pks An array of item ids.
|
||||
* @param array $contexts An array of item contexts.
|
||||
*
|
||||
* @return boolean Returns true on success, false on failure.
|
||||
* @since 12.2
|
||||
*/
|
||||
public function batch($commands, $pks, $contexts)
|
||||
{
|
||||
// Sanitize ids.
|
||||
$pks = array_unique($pks);
|
||||
ArrayHelper::toInteger($pks);
|
||||
|
||||
// Remove any values of zero.
|
||||
if (array_search(0, $pks, true))
|
||||
{
|
||||
unset($pks[array_search(0, $pks, true)]);
|
||||
}
|
||||
|
||||
if (empty($pks))
|
||||
{
|
||||
$this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED'));
|
||||
return false;
|
||||
}
|
||||
|
||||
$done = false;
|
||||
|
||||
// Set some needed variables.
|
||||
$this->user ??= $this->getCurrentUser();
|
||||
$this->table = $this->getTable();
|
||||
$this->tableClassName = get_class($this->table);
|
||||
$this->contentType = new UCMType;
|
||||
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
|
||||
$this->canDo = ###Component###Helper::getActions('###view###');
|
||||
$this->batchSet = true;
|
||||
|
||||
if (!$this->canDo->get('core.batch'))
|
||||
{
|
||||
$this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->type == false)
|
||||
{
|
||||
$type = new UCMType;
|
||||
$this->type = $type->getTypeByAlias($this->typeAlias);
|
||||
}
|
||||
|
||||
$this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags');
|
||||
|
||||
if (!empty($commands['move_copy']))
|
||||
{
|
||||
$cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
|
||||
|
||||
if ($cmd == 'c')
|
||||
{
|
||||
$result = $this->batchCopy($commands, $pks, $contexts);
|
||||
|
||||
if (is_array($result))
|
||||
{
|
||||
foreach ($result as $old => $new)
|
||||
{
|
||||
$contexts[$new] = $contexts[$old];
|
||||
}
|
||||
$pks = array_values($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$done = true;
|
||||
}
|
||||
|
||||
if (!$done)
|
||||
{
|
||||
$this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Clear the cache
|
||||
$this->cleanCache();
|
||||
|
||||
return true;
|
||||
}###MODEL_BATCH_COPY######MODEL_BATCH_MOVE###
|
||||
|
||||
/**
|
||||
* Method to save the form data.
|
||||
*
|
||||
* @param array $data The form data.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function save($data)
|
||||
{
|
||||
$input = Factory::getApplication()->getInput();
|
||||
$filter = InputFilter::getInstance();
|
||||
|
||||
// set the metadata to the Item Data
|
||||
if (isset($data['metadata']) && isset($data['metadata']['author']))
|
||||
{
|
||||
$data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM');
|
||||
|
||||
$metadata = new Registry;
|
||||
$metadata->loadArray($data['metadata']);
|
||||
$data['metadata'] = (string) $metadata;
|
||||
}###CHECKBOX_SAVE######METHOD_ITEM_SAVE###
|
||||
|
||||
// Set the Params Items to data
|
||||
if (isset($data['params']) && is_array($data['params']))
|
||||
{
|
||||
$params = new Registry;
|
||||
$params->loadArray($data['params']);
|
||||
$data['params'] = (string) $params;
|
||||
}###TITLEALIASFIX###
|
||||
|
||||
if (parent::save($data))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to generate a unique value.
|
||||
*
|
||||
* @param string $field name.
|
||||
* @param string $value data.
|
||||
*
|
||||
* @return string New value.
|
||||
* @since 3.0
|
||||
*/
|
||||
protected function generateUnique($field, $value)
|
||||
{
|
||||
// set field value unique
|
||||
$table = $this->getTable();
|
||||
|
||||
while ($table->load([$field => $value]))
|
||||
{
|
||||
$value = StringHelper::increment($value);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}###GENERATENEWTITLE###
|
||||
}
|
372
admin/compiler/joomla_4/ADMIN_VIEW_TABLE.php
Normal file
372
admin/compiler/joomla_4/ADMIN_VIEW_TABLE.php
Normal file
@ -0,0 +1,372 @@
|
||||
<?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###\Administrator\Table;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Table\Table;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\String\PunycodeHelper;
|
||||
use Joomla\CMS\Access\Access as AccessRules;
|
||||
use Joomla\CMS\Access\Rules;
|
||||
use Joomla\CMS\Tag\TaggableTableInterface;
|
||||
use Joomla\CMS\Tag\TaggableTableTrait;
|
||||
use Joomla\CMS\User\CurrentUserInterface;
|
||||
use Joomla\CMS\User\CurrentUserTrait;
|
||||
use Joomla\CMS\Versioning\VersionableTableInterface;
|
||||
use Joomla\CMS\Application\ApplicationHelper;
|
||||
use Joomla\Database\DatabaseInterface;
|
||||
use Joomla\Registry\Registry;
|
||||
use Joomla\Database\DatabaseDriver;
|
||||
use Joomla\Event\DispatcherInterface;
|
||||
use Joomla\String\StringHelper;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
use ###NAMESPACEPREFIX###\Component\###ComponentNameSpace###\Administrator\Helper\###Component###Helper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* ###Views### Table class
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class ###View###Table extends Table implements VersionableTableInterface, TaggableTableInterface, CurrentUserInterface
|
||||
{
|
||||
use TaggableTableTrait;
|
||||
use CurrentUserTrait;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DatabaseDriver $db Database connector object
|
||||
* @param ?DispatcherInterface $dispatcher Event dispatcher for this table
|
||||
*
|
||||
* @param object Database connector object
|
||||
* @since 4.0
|
||||
*/
|
||||
function __construct(DatabaseDriver $db, ?DispatcherInterface $dispatcher = null)
|
||||
{
|
||||
// The type alias generally is the internal component name with the
|
||||
// content type. Ex.: com_content.article
|
||||
$this->typeAlias = 'com_###component###.###view###';
|
||||
|
||||
// Ensure the params and metadata in json encoded in the bind method
|
||||
$this->_jsonEncode = ['params', 'metadata'];
|
||||
|
||||
// Indicates that columns fully support the NULL value in the database
|
||||
// $this->_supportNullValue = true; // hmmm will keep an eye on this ;)
|
||||
|
||||
parent::__construct('#__###component###_###view###', 'id', $db, $dispatcher);###LICENSE_LOCKED_CHECK###
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to bind an associative array or object to the Table instance.This
|
||||
* method only binds properties that are publicly accessible and optionally
|
||||
* takes an array of properties to ignore when binding.
|
||||
*
|
||||
* @param array|object $src An associative array or object to bind to the Table instance.
|
||||
* @param array|string $ignore An optional array or space separated list of properties to ignore while binding.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*
|
||||
* @since 1.7.0
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function bind($array, $ignore = '')
|
||||
{
|
||||
// Bind the rules.
|
||||
if (isset($array['rules']) && is_array($array['rules']))
|
||||
{
|
||||
$rules = new AccessRules($array['rules']);
|
||||
$this->setRules($rules);
|
||||
}
|
||||
|
||||
return parent::bind($array, $ignore);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overload the store method for the ###View### table.
|
||||
*
|
||||
* @param boolean Toggle whether null values should be updated.
|
||||
*
|
||||
* @return boolean True on success, false on failure.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function store($updateNulls = false)
|
||||
{
|
||||
$date = Factory::getDate()->toSql();
|
||||
$userId = $this->getCurrentUser()->id;
|
||||
|
||||
if ($this->id)
|
||||
{
|
||||
// Existing item
|
||||
$this->modified = $date;
|
||||
$this->modified_by = $userId;
|
||||
}
|
||||
else
|
||||
{
|
||||
// New ###view###. A ###view### created and created_by field can be set by the user,
|
||||
// so we don't touch either of these if they are set.
|
||||
if (!(int) $this->created)
|
||||
{
|
||||
$this->created = $date;
|
||||
}
|
||||
if (empty($this->created_by))
|
||||
{
|
||||
$this->created_by = $userId;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->alias))
|
||||
{
|
||||
// Verify that the alias is unique
|
||||
$table = new self($this->getDbo(), $this->getDispatcher());
|
||||
|
||||
if ($table->load(['alias' => $this->alias###JTABLEALIASCATEGORY###]) && ($table->id != $this->id || $this->id == 0))
|
||||
{
|
||||
$this->setError(Text::_('COM_###COMPONENT###_###VIEW###_ERROR_UNIQUE_ALIAS'));
|
||||
|
||||
if ($table->published === -2)
|
||||
{
|
||||
$this->setError(Text::_('COM_###COMPONENT###_###VIEW###_ERROR_UNIQUE_ALIAS_TRASHED'));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->url))
|
||||
{
|
||||
// Convert IDN urls to punycode
|
||||
$this->url = PunycodeHelper::urlToPunycode($this->url);
|
||||
}
|
||||
|
||||
if (isset($this->website))
|
||||
{
|
||||
// Convert IDN urls to punycode
|
||||
$this->website = PunycodeHelper::urlToPunycode($this->website);
|
||||
}
|
||||
|
||||
return parent::store($updateNulls);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overloaded check method to ensure data integrity.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*
|
||||
* @see \Joomla\CMS\Table\Table::check
|
||||
* @since 1.5
|
||||
*/
|
||||
public function check()
|
||||
{
|
||||
try {
|
||||
parent::check();
|
||||
} catch (\Exception $e) {
|
||||
$this->setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isset($this->alias))
|
||||
{
|
||||
// Generate a valid alias
|
||||
$this->generateAlias();
|
||||
|
||||
$table = new self($this->getDbo(), $this->getDispatcher());
|
||||
|
||||
while ($table->load(['alias' => $this->alias]) && ($table->id != $this->id || $this->id == 0))
|
||||
{
|
||||
$this->alias = StringHelper::increment($this->alias, 'dash');
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Clean up keywords -- eliminate extra spaces between phrases
|
||||
* and cr (\r) and lf (\n) characters from string.
|
||||
* Only process if not empty.
|
||||
*/
|
||||
if (!empty($this->metakey))
|
||||
{
|
||||
// Array of characters to remove.
|
||||
$bad_characters = array("\n", "\r", "\"", "<", ">");
|
||||
|
||||
// Remove bad characters.
|
||||
$after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey);
|
||||
|
||||
// Create array using commas as delimiter.
|
||||
$keys = explode(',', $after_clean);
|
||||
$clean_keys = [];
|
||||
|
||||
foreach ($keys as $key)
|
||||
{
|
||||
// Ignore blank keywords.
|
||||
if (trim($key))
|
||||
{
|
||||
$clean_keys[] = trim($key);
|
||||
}
|
||||
}
|
||||
|
||||
// Put array back together delimited by ", "
|
||||
$this->metakey = implode(", ", $clean_keys);
|
||||
}
|
||||
|
||||
// Clean up description -- eliminate quotes and <> brackets
|
||||
if (!empty($this->metadesc))
|
||||
{
|
||||
// Only process if not empty
|
||||
$bad_characters = array("\"", "<", ">");
|
||||
$this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc);
|
||||
}
|
||||
|
||||
// If we don't have any access rules set at this point just use an empty AccessRules class
|
||||
if (!$this->getRules())
|
||||
{
|
||||
$rules = $this->getDefaultAssetValues('com_###component###.###view###.'.$this->id);
|
||||
$this->setRules($rules);
|
||||
}
|
||||
|
||||
// Set ordering
|
||||
if ($this->published < 0)
|
||||
{
|
||||
// Set ordering to 0 if state is archived or trashed
|
||||
$this->ordering = 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
}###LICENSE_LOCKED_SET_BOOL###
|
||||
|
||||
/**
|
||||
* Gets the default asset values for a component.
|
||||
*
|
||||
* @param $string $component The component asset name to search for
|
||||
*
|
||||
* @return AccessRules The AccessRules object for the asset
|
||||
*/
|
||||
protected function getDefaultAssetValues($component, $try = true)
|
||||
{
|
||||
// Need to find the asset id by the name of the component.
|
||||
$db = Factory::getContainer()->get(DatabaseInterface::class);
|
||||
$query = $db->getQuery(true)
|
||||
->select($db->quoteName('id'))
|
||||
->from($db->quoteName('#__assets'))
|
||||
->where($db->quoteName('name') . ' = ' . $db->quote($component));
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
if ($db->loadRowList())
|
||||
{
|
||||
// asset already set so use saved rules
|
||||
$assetId = (int) $db->loadResult();
|
||||
return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
|
||||
}
|
||||
// try again
|
||||
elseif ($try)
|
||||
{
|
||||
$try = explode('.',$component);
|
||||
$result = $this->getDefaultAssetValues($try[0], false);
|
||||
if ($result instanceof AccessRules)
|
||||
{
|
||||
if (isset($try[1]))
|
||||
{
|
||||
$_result = (string) $result;
|
||||
$_result = json_decode($_result);
|
||||
foreach ($_result as $name => &$rule)
|
||||
{
|
||||
$v = explode('.', $name);
|
||||
if ($try[1] !== $v[0])
|
||||
{
|
||||
// remove since it is not part of this view
|
||||
unset($_result->$name);
|
||||
}
|
||||
else
|
||||
{
|
||||
// clear the value since we inherit
|
||||
$rule = [];
|
||||
}
|
||||
}
|
||||
// check if there are any view values remaining
|
||||
if (count( (array) $_result))
|
||||
{
|
||||
$_result = json_encode($_result);
|
||||
$_result = array($_result);
|
||||
// Instantiate and return the AccessRules object for the asset rules.
|
||||
$rules = new AccessRules;
|
||||
$rules->mergeCollection($_result);
|
||||
|
||||
return $rules;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
return AccessRules::getAssetRules(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the type alias for the history table
|
||||
*
|
||||
* The type alias generally is the internal component name with the
|
||||
* content type. Ex.: com_content.article
|
||||
*
|
||||
* @return string The alias as described above
|
||||
*
|
||||
* @since 3.10.0
|
||||
*/
|
||||
public function getTypeAlias()
|
||||
{
|
||||
return $this->typeAlias;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to compute the default name of the asset.
|
||||
* The default name is in the form table_name.id
|
||||
* where id is the value of the primary key of the table.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.7.0
|
||||
*/
|
||||
protected function _getAssetName()
|
||||
{
|
||||
$k = $this->_tbl_key;
|
||||
|
||||
return $this->getTypeAlias() . '.' . (int) $this->$k;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the parent asset under which to register this one.
|
||||
*
|
||||
* By default, all assets are registered to the ROOT node with ID, which will default to 1 if none exists.
|
||||
* An extended class can define a table and ID to lookup. If the asset does not exist it will be created.
|
||||
*
|
||||
* @param Table $table A Table object for the asset parent.
|
||||
* @param integer $id Id to look up
|
||||
*
|
||||
* @return integer
|
||||
*
|
||||
* @since 1.7.0
|
||||
*/
|
||||
protected function _getAssetParentId(Table $table = null, $id = null)
|
||||
{
|
||||
/** @var Asset $assets */
|
||||
$assets = self::getInstance('Asset', 'JTable', ['dbo' => $this->getDbo()]);
|
||||
$rootId = $assets->getRootId();
|
||||
|
||||
// load the ###component### asset
|
||||
$assets->loadByName('com_###component###');
|
||||
|
||||
return $assets->id ?? $rootId ?? 1;
|
||||
}###GENERATENEWALIAS###
|
||||
}
|
1
admin/compiler/joomla_4/CHANGELOG.md
Normal file
1
admin/compiler/joomla_4/CHANGELOG.md
Normal file
@ -0,0 +1 @@
|
||||
###CHANGELOG###
|
22
admin/compiler/joomla_4/CUSTOM_ADMIN_LAYOUT.php
Normal file
22
admin/compiler/joomla_4/CUSTOM_ADMIN_LAYOUT.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?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###
|
||||
|
||||
###CUSTOM_ADMIN_LAYOUT_HEADER###
|
||||
|
||||
// No direct access to this file
|
||||
defined('JPATH_BASE') or die;###CUSTOM_ADMIN_LAYOUT_CODE###
|
||||
|
||||
?>###CUSTOM_ADMIN_LAYOUT_BODY###
|
28
admin/compiler/joomla_4/CUSTOM_ADMIN_VIEW.php
Normal file
28
admin/compiler/joomla_4/CUSTOM_ADMIN_VIEW.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?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###
|
||||
|
||||
###CUSTOM_ADMIN_VIEW_HEADER###
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED######CUSTOM_ADMIN_CODE_BODY###
|
||||
|
||||
?>
|
||||
<?php if ($this->canDo->get('###sview###.access')): ?>###CUSTOM_ADMIN_SUBMITBUTTON_SCRIPT###
|
||||
<?php $urlId = (isset($this->item->id)) ? '&id='. (int) $this->item->id : ''; ?>
|
||||
###CUSTOM_ADMIN_TOP_FORM######CUSTOM_ADMIN_BODY######CUSTOM_ADMIN_BOTTOM_FORM###
|
||||
<?php else: ?>
|
||||
<h1><?php echo Text::_('COM_###COMPONENT###_NO_ACCESS_GRANTED'); ?></h1>
|
||||
<?php endif; ?>
|
27
admin/compiler/joomla_4/CUSTOM_ADMIN_VIEWS.php
Normal file
27
admin/compiler/joomla_4/CUSTOM_ADMIN_VIEWS.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?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###
|
||||
|
||||
###CUSTOM_ADMIN_VIEWS_HEADER###
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED######CUSTOM_ADMIN_CODE_BODY###
|
||||
|
||||
?>
|
||||
<?php if ($this->canDo->get('###sview###.access')): ?>###CUSTOM_ADMIN_SUBMITBUTTON_SCRIPT###
|
||||
###CUSTOM_ADMIN_TOP_FORM######CUSTOM_ADMIN_BODY######CUSTOM_ADMIN_BOTTOM_FORM###
|
||||
<?php else: ?>
|
||||
<h1><?php echo Text::_('COM_###COMPONENT###_NO_ACCESS_GRANTED'); ?></h1>
|
||||
<?php endif; ?>
|
65
admin/compiler/joomla_4/CUSTOM_ADMIN_VIEWS_CONTROLLER.php
Normal file
65
admin/compiler/joomla_4/CUSTOM_ADMIN_VIEWS_CONTROLLER.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?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###\Administrator\Controller;
|
||||
|
||||
###CUSTOM_ADMIN_VIEWS_CONTROLLER_HEADER###
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* ###SViews### Admin Controller
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class ###SViews###Controller extends AdminController
|
||||
{
|
||||
/**
|
||||
* The prefix to use with controller messages.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $text_prefix = 'COM_###COMPONENT###_###SVIEWS###';
|
||||
|
||||
/**
|
||||
* Proxy for getModel.
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getModel($name = '###View###', $prefix = 'Administrator', $config = ['ignore_request' => true])
|
||||
{
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds option to redirect back to the dashboard.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public function dashboard(): void
|
||||
{
|
||||
$this->setRedirect(Route::_('index.php?option=com_###component###', false));
|
||||
}###CUSTOM_ADMIN_CUSTOM_BUTTONS_CONTROLLER###
|
||||
}
|
119
admin/compiler/joomla_4/CUSTOM_ADMIN_VIEWS_HTML.php
Normal file
119
admin/compiler/joomla_4/CUSTOM_ADMIN_VIEWS_HTML.php
Normal file
@ -0,0 +1,119 @@
|
||||
<?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###\Administrator\View\###SViews###;
|
||||
|
||||
###CUSTOM_ADMIN_VIEWS_HTML_HEADER######CUSTOM_ADMIN_GET_MODULE_JIMPORT###
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED###
|
||||
|
||||
/**
|
||||
* ###Component### Html View class for the ###SViews###
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class HtmlView extends BaseHtmlView
|
||||
{
|
||||
/**
|
||||
* Display the view
|
||||
*
|
||||
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
public function display($tpl = null)
|
||||
{
|
||||
// get component params
|
||||
$this->params = ComponentHelper::getParams('com_###component###');
|
||||
// get the application
|
||||
$this->app ??= Factory::getApplication();
|
||||
// get the user object
|
||||
$this->user ??= $this->app->getIdentity();
|
||||
// get global action permissions
|
||||
$this->canDo = ###Component###Helper::getActions('###sview###');
|
||||
$this->styles = $this->get('Styles');
|
||||
$this->scripts = $this->get('Scripts');###CUSTOM_ADMIN_DIPLAY_METHOD###
|
||||
|
||||
// Set the html view document stuff
|
||||
$this->_prepareDocument();
|
||||
}###CUSTOM_ADMIN_EXTRA_DIPLAY_METHODS###
|
||||
|
||||
/**
|
||||
* Prepare some document related stuff.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function _prepareDocument(): void
|
||||
{###CUSTOM_ADMIN_LIBRARIES_LOADER######CUSTOM_ADMIN_UIKIT_LOADER######CUSTOM_ADMIN_GOOGLECHART_LOADER######CUSTOM_ADMIN_FOOTABLE_LOADER######CUSTOM_ADMIN_DOCUMENT_CUSTOM_PHP###
|
||||
// add styles
|
||||
foreach ($this->styles as $style)
|
||||
{
|
||||
Html::_('stylesheet', $style, ['version' => 'auto']);
|
||||
}###CUSTOM_ADMIN_DOCUMENT_CUSTOM_CSS###
|
||||
// add scripts
|
||||
foreach ($this->scripts as $script)
|
||||
{
|
||||
Html::_('script', $script, ['version' => 'auto']);
|
||||
}###CUSTOM_ADMIN_DOCUMENT_CUSTOM_JS###
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the page title and toolbar.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function addToolbar(): void
|
||||
{###HIDEMAINMENU###
|
||||
// add title to the page
|
||||
ToolbarHelper::title(Text::_('COM_###COMPONENT###_###SVIEWS###'),'###ICOMOON###');###CUSTOM_ADMIN_CUSTOM_BUTTONS###
|
||||
|
||||
// set help url for this view if found
|
||||
$this->help_url = ###Component###Helper::getHelpUrl('###sviews###');
|
||||
if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($this->help_url))
|
||||
{
|
||||
ToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url);
|
||||
}
|
||||
|
||||
// add the options comp button
|
||||
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
|
||||
{
|
||||
ToolbarHelper::preferences('com_###component###');
|
||||
}
|
||||
}###CUSTOM_ADMIN_GET_MODULE###
|
||||
|
||||
/**
|
||||
* Escapes a value for output in a view script.
|
||||
*
|
||||
* @param mixed $var The output to escape.
|
||||
* @param bool $shorten The switch to shorten.
|
||||
* @param int $length The shorting length.
|
||||
*
|
||||
* @return mixed The escaped value.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function escape($var, bool $shorten = false, int $length = 40)
|
||||
{
|
||||
if (!is_string($var))
|
||||
{
|
||||
return $var;
|
||||
}
|
||||
|
||||
return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
|
||||
}
|
||||
}
|
220
admin/compiler/joomla_4/CUSTOM_ADMIN_VIEWS_MODEL.php
Normal file
220
admin/compiler/joomla_4/CUSTOM_ADMIN_VIEWS_MODEL.php
Normal file
@ -0,0 +1,220 @@
|
||||
<?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###\Administrator\Model;
|
||||
|
||||
###CUSTOM_ADMIN_VIEWS_MODEL_HEADER###
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* ###Component### List Model for ###SViews###
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class ###SViews###Model extends ListModel
|
||||
{
|
||||
/**
|
||||
* Represents the current user object.
|
||||
*
|
||||
* @var User The user object representing the current user.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected User $user;
|
||||
|
||||
/**
|
||||
* The unique identifier of the current user.
|
||||
*
|
||||
* @var int|null The ID of the current user.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ?int $userId;
|
||||
|
||||
/**
|
||||
* Flag indicating whether the current user is a guest.
|
||||
*
|
||||
* @var int 1 if the user is a guest, 0 otherwise.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected int $guest;
|
||||
|
||||
/**
|
||||
* An array of groups that the current user belongs to.
|
||||
*
|
||||
* @var array|null An array of user group IDs.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ?array $groups;
|
||||
|
||||
/**
|
||||
* An array of view access levels for the current user.
|
||||
*
|
||||
* @var array|null An array of access level IDs.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ?array $levels;
|
||||
|
||||
/**
|
||||
* The application object.
|
||||
*
|
||||
* @var CMSApplicationInterface The application instance.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected CMSApplicationInterface $app;
|
||||
|
||||
/**
|
||||
* The input object, providing access to the request data.
|
||||
*
|
||||
* @var Input The input object.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Input $input;
|
||||
|
||||
/**
|
||||
* The styles array.
|
||||
*
|
||||
* @var array
|
||||
* @since 4.3
|
||||
*/
|
||||
protected array $styles = [
|
||||
'administrator/components/com_###component###/assets/css/admin.css',
|
||||
'administrator/components/com_###component###/assets/css/###sviews###.css'
|
||||
];
|
||||
|
||||
/**
|
||||
* The scripts array.
|
||||
*
|
||||
* @var array
|
||||
* @since 4.3
|
||||
*/
|
||||
protected array $scripts = [
|
||||
'administrator/components/com_###component###/assets/js/admin.js'
|
||||
];
|
||||
|
||||
/**
|
||||
* A custom property for UIKit components. (not used unless you load v2)
|
||||
*/
|
||||
protected $uikitComp;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param array $config An array of configuration options (name, state, dbo, table_path, ignore_request).
|
||||
* @param ?MVCFactoryInterface $factory The factory.
|
||||
*
|
||||
* @since 1.6
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function __construct($config = [], MVCFactoryInterface $factory = null)
|
||||
{
|
||||
parent::__construct($config, $factory);
|
||||
|
||||
$this->app ??= Factory::getApplication();
|
||||
$this->input ??= $this->app->getInput();
|
||||
|
||||
// Set the current user for authorisation checks (for those calling this model directly)
|
||||
$this->user ??= $this->getCurrentUser();
|
||||
$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();
|
||||
|
||||
// will be removed
|
||||
$this->initSet = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to build an SQL query to load the list data.
|
||||
*
|
||||
* @return string An SQL query
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getListQuery()
|
||||
{###CUSTOM_ADMIN_GET_LIST_QUERY###
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get an array of data items.
|
||||
*
|
||||
* @return mixed An array of data items on success, false on failure.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getItems()
|
||||
{
|
||||
$user = $this->user;
|
||||
// check if this user has permission to access items
|
||||
if (!$user->authorise('###sviews###.access', 'com_###component###'))
|
||||
{
|
||||
$this->app->enqueueMessage(Text::_('Not authorised!'), 'error');
|
||||
// redirect away if not a correct to default view
|
||||
$this->app->redirect('index.php?option=com_###component###');
|
||||
return false;
|
||||
}###LICENSE_LOCKED_CHECK######CUSTOM_ADMIN_BEFORE_GET_ITEMS###
|
||||
// load parent items
|
||||
$items = parent::getItems();
|
||||
|
||||
// Get the global params
|
||||
$globalParams = ComponentHelper::getParams('com_###component###', true);###CUSTOM_ADMIN_GET_ITEMS######CUSTOM_ADMIN_AFTER_GET_ITEMS###
|
||||
|
||||
// return items
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the styles that have to be included on the view
|
||||
*
|
||||
* @return array styles files
|
||||
* @since 4.3
|
||||
*/
|
||||
public function getStyles(): array
|
||||
{
|
||||
return $this->styles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to set the styles that have to be included on the view
|
||||
*
|
||||
* @return void
|
||||
* @since 4.3
|
||||
*/
|
||||
public function setStyles(string $path): void
|
||||
{
|
||||
$this->styles[] = $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the script that have to be included on the view
|
||||
*
|
||||
* @return array script files
|
||||
* @since 4.3
|
||||
*/
|
||||
public function getScripts(): array
|
||||
{
|
||||
return $this->scripts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to set the script that have to be included on the view
|
||||
*
|
||||
* @return void
|
||||
* @since 4.3
|
||||
*/
|
||||
public function setScript(string $path): void
|
||||
{
|
||||
$this->scripts[] = $path;
|
||||
}###CUSTOM_ADMIN_CUSTOM_METHODS######LICENSE_LOCKED_SET_BOOL######CUSTOM_ADMIN_CUSTOM_BUTTONS_METHOD###
|
||||
}
|
56
admin/compiler/joomla_4/CUSTOM_ADMIN_VIEW_CONTROLLER.php
Normal file
56
admin/compiler/joomla_4/CUSTOM_ADMIN_VIEW_CONTROLLER.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?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###\Administrator\Controller;
|
||||
|
||||
###CUSTOM_ADMIN_VIEW_CONTROLLER_HEADER###
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* ###Component### ###SView### Base Controller
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class ###SView###Controller extends BaseController
|
||||
{
|
||||
/**
|
||||
* The context for storing internal data, e.g. record.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $context = '###sview###';
|
||||
|
||||
/**
|
||||
* The URL view item variable.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $view_item = '###sview###';
|
||||
|
||||
/**
|
||||
* Adds option to redirect back to the dashboard.
|
||||
*
|
||||
* @return void
|
||||
* @since 3.0
|
||||
*/
|
||||
public function dashboard(): void
|
||||
{
|
||||
$this->setRedirect(Route::_('index.php?option=com_###component###', false));
|
||||
}###CUSTOM_ADMIN_CUSTOM_BUTTONS_CONTROLLER###
|
||||
}
|
129
admin/compiler/joomla_4/CUSTOM_ADMIN_VIEW_HTML.php
Normal file
129
admin/compiler/joomla_4/CUSTOM_ADMIN_VIEW_HTML.php
Normal file
@ -0,0 +1,129 @@
|
||||
<?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###\Administrator\View\###SView###;
|
||||
|
||||
###CUSTOM_ADMIN_VIEW_HTML_HEADER######CUSTOM_ADMIN_GET_MODULE_JIMPORT###
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die; ###LICENSE_LOCKED_DEFINED###
|
||||
|
||||
/**
|
||||
* ###Component### Html View class for the ###SView###
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class HtmlView extends BaseHtmlView
|
||||
{
|
||||
/**
|
||||
* Display the view
|
||||
*
|
||||
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
public function display($tpl = null)
|
||||
{
|
||||
// get component params
|
||||
$this->params = ComponentHelper::getParams('com_###component###');
|
||||
// get the application
|
||||
$this->app ??= Factory::getApplication();
|
||||
// get the user object
|
||||
$this->user ??= Factory::getApplication()->getIdentity();
|
||||
// get global action permissions
|
||||
$this->canDo = ###Component###Helper::getActions('###sview###');
|
||||
$this->styles = $this->get('Styles');
|
||||
$this->scripts = $this->get('Scripts');###CUSTOM_ADMIN_DIPLAY_METHOD###
|
||||
|
||||
// Set the html view document stuff
|
||||
$this->_prepareDocument();
|
||||
}###CUSTOM_ADMIN_EXTRA_DIPLAY_METHODS###
|
||||
|
||||
/**
|
||||
* Prepare some document related stuff.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function _prepareDocument(): void
|
||||
{###CUSTOM_ADMIN_LIBRARIES_LOADER######CUSTOM_ADMIN_DOCUMENT_METADATA######CUSTOM_ADMIN_UIKIT_LOADER######CUSTOM_ADMIN_GOOGLECHART_LOADER######CUSTOM_ADMIN_FOOTABLE_LOADER######CUSTOM_ADMIN_DOCUMENT_CUSTOM_PHP###
|
||||
// add styles
|
||||
foreach ($this->styles as $style)
|
||||
{
|
||||
Html::_('stylesheet', $style, ['version' => 'auto']);
|
||||
}###CUSTOM_ADMIN_DOCUMENT_CUSTOM_CSS###
|
||||
// add scripts
|
||||
foreach ($this->scripts as $script)
|
||||
{
|
||||
Html::_('script', $script, ['version' => 'auto']);
|
||||
}###CUSTOM_ADMIN_DOCUMENT_CUSTOM_JS###
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the page title and toolbar.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function addToolbar(): void
|
||||
{###HIDEMAINMENU###
|
||||
// set the title
|
||||
if (isset($this->item->name) && $this->item->name)
|
||||
{
|
||||
$title = $this->item->name;
|
||||
}
|
||||
// Check for empty title and add view name if param is set
|
||||
if (empty($title))
|
||||
{
|
||||
$title = Text::_('COM_###COMPONENT###_###SVIEW###');
|
||||
}
|
||||
// add title to the page
|
||||
ToolbarHelper::title($title,'###ICOMOON###');###CUSTOM_ADMIN_CUSTOM_BUTTONS###
|
||||
|
||||
// set help url for this view if found
|
||||
$this->help_url = ###Component###Helper::getHelpUrl('###sviews###');
|
||||
if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($this->help_url))
|
||||
{
|
||||
ToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url);
|
||||
}
|
||||
|
||||
// add the options comp button
|
||||
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
|
||||
{
|
||||
ToolbarHelper::preferences('com_###component###');
|
||||
}
|
||||
}###CUSTOM_ADMIN_GET_MODULE###
|
||||
|
||||
/**
|
||||
* Escapes a value for output in a view script.
|
||||
*
|
||||
* @param mixed $var The output to escape.
|
||||
* @param bool $shorten The switch to shorten.
|
||||
* @param int $length The shorting length.
|
||||
*
|
||||
* @return mixed The escaped value.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function escape($var, bool $shorten = false, int $length = 40)
|
||||
{
|
||||
if (!is_string($var))
|
||||
{
|
||||
return $var;
|
||||
}
|
||||
|
||||
return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
|
||||
}
|
||||
}
|
267
admin/compiler/joomla_4/CUSTOM_ADMIN_VIEW_MODEL.php
Normal file
267
admin/compiler/joomla_4/CUSTOM_ADMIN_VIEW_MODEL.php
Normal file
@ -0,0 +1,267 @@
|
||||
<?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###\Administrator\Model;
|
||||
|
||||
###CUSTOM_ADMIN_VIEW_MODEL_HEADER###
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* ###Component### ###SView### Item Model
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class ###SView###Model extends ItemModel
|
||||
{
|
||||
/**
|
||||
* Model context string.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $_context = 'com_###component###.###sview###';
|
||||
|
||||
/**
|
||||
* Represents the current user object.
|
||||
*
|
||||
* @var User The user object representing the current user.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected User $user;
|
||||
|
||||
/**
|
||||
* The unique identifier of the current user.
|
||||
*
|
||||
* @var int|null The ID of the current user.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ?int $userId;
|
||||
|
||||
/**
|
||||
* Flag indicating whether the current user is a guest.
|
||||
*
|
||||
* @var int 1 if the user is a guest, 0 otherwise.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected int $guest;
|
||||
|
||||
/**
|
||||
* An array of groups that the current user belongs to.
|
||||
*
|
||||
* @var array|null An array of user group IDs.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ?array $groups;
|
||||
|
||||
/**
|
||||
* An array of view access levels for the current user.
|
||||
*
|
||||
* @var array|null An array of access level IDs.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ?array $levels;
|
||||
|
||||
/**
|
||||
* The application object.
|
||||
*
|
||||
* @var CMSApplicationInterface The application instance.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected CMSApplicationInterface $app;
|
||||
|
||||
/**
|
||||
* The input object, providing access to the request data.
|
||||
*
|
||||
* @var Input The input object.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Input $input;
|
||||
|
||||
/**
|
||||
* The styles array.
|
||||
*
|
||||
* @var array
|
||||
* @since 4.3
|
||||
*/
|
||||
protected array $styles = [
|
||||
'administrator/components/com_###component###/assets/css/admin.css',
|
||||
'administrator/components/com_###component###/assets/css/###sview###.css'
|
||||
];
|
||||
|
||||
/**
|
||||
* The scripts array.
|
||||
*
|
||||
* @var array
|
||||
* @since 4.3
|
||||
*/
|
||||
protected array $scripts = [
|
||||
'administrator/components/com_###component###/assets/js/admin.js'
|
||||
];
|
||||
|
||||
/**
|
||||
* A custom property for UI Kit components.
|
||||
*
|
||||
* @var array|null Property for storing UI Kit component-related data or objects.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ?array $uikitComp;
|
||||
|
||||
/**
|
||||
* @var object item
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $item;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param array $config An array of configuration options (name, state, dbo, table_path, ignore_request).
|
||||
* @param ?MVCFactoryInterface $factory The factory.
|
||||
*
|
||||
* @since 3.0
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function __construct($config = [], MVCFactoryInterface $factory = null)
|
||||
{
|
||||
parent::__construct($config, $factory);
|
||||
|
||||
$this->app ??= Factory::getApplication();
|
||||
$this->input ??= $this->app->getInput();
|
||||
|
||||
// Set the current user for authorisation checks (for those calling this model directly)
|
||||
$this->user ??= $this->getCurrentUser();
|
||||
$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();
|
||||
|
||||
// will be removed
|
||||
$this->initSet = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function populateState()
|
||||
{
|
||||
// Get the item main id
|
||||
$id = $this->input->getInt('id', null);
|
||||
$this->setState('###sview###.id', $id);
|
||||
|
||||
// Load the parameters.
|
||||
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.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getItem($pk = null)
|
||||
{
|
||||
// check if this user has permission to access item
|
||||
if (!$this->user->authorise('###sview###.access', 'com_###component###'))
|
||||
{
|
||||
$this->app->enqueueMessage(Text::_('Not authorised!'), 'error');
|
||||
// redirect away if not a correct to cPanel/default view
|
||||
$this->app->redirect('index.php?option=com_###component###');
|
||||
return false;
|
||||
}
|
||||
|
||||
$pk = (!empty($pk)) ? $pk : (int) $this->getState('###sview###.id');###CUSTOM_ADMIN_BEFORE_GET_ITEM###
|
||||
|
||||
if ($this->_item === null)
|
||||
{
|
||||
$this->_item = [];
|
||||
}###LICENSE_LOCKED_CHECK###
|
||||
|
||||
if (!isset($this->_item[$pk]))
|
||||
{
|
||||
try
|
||||
{###CUSTOM_ADMIN_GET_ITEM###
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
if ($e->getCode() == 404)
|
||||
{
|
||||
// Need to go thru the error handler to allow Redirect to work.
|
||||
throw $e;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setError($e);
|
||||
$this->_item[$pk] = false;
|
||||
}
|
||||
}
|
||||
}###CUSTOM_ADMIN_AFTER_GET_ITEM###
|
||||
|
||||
return $this->_item[$pk];
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the styles that have to be included on the view
|
||||
*
|
||||
* @return array styles files
|
||||
* @since 4.3
|
||||
*/
|
||||
public function getStyles(): array
|
||||
{
|
||||
return $this->styles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to set the styles that have to be included on the view
|
||||
*
|
||||
* @return void
|
||||
* @since 4.3
|
||||
*/
|
||||
public function setStyles(string $path): void
|
||||
{
|
||||
$this->styles[] = $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the script that have to be included on the view
|
||||
*
|
||||
* @return array script files
|
||||
* @since 4.3
|
||||
*/
|
||||
public function getScripts(): array
|
||||
{
|
||||
return $this->scripts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to set the script that have to be included on the view
|
||||
*
|
||||
* @return void
|
||||
* @since 4.3
|
||||
*/
|
||||
public function setScript(string $path): void
|
||||
{
|
||||
$this->scripts[] = $path;
|
||||
}###CUSTOM_ADMIN_CUSTOM_METHODS######LICENSE_LOCKED_SET_BOOL######CUSTOM_ADMIN_CUSTOM_BUTTONS_METHOD###
|
||||
}
|
31
admin/compiler/joomla_4/DASH_CONTROLLER.php
Normal file
31
admin/compiler/joomla_4/DASH_CONTROLLER.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?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###\Administrator\Controller;
|
||||
|
||||
###DASH_CONTROLLER_HEADER###
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* ###Component### Admin Controller
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class ###Component###Controller extends AdminController
|
||||
{
|
||||
|
||||
}
|
225
admin/compiler/joomla_4/DASH_MODEL.php
Normal file
225
admin/compiler/joomla_4/DASH_MODEL.php
Normal file
@ -0,0 +1,225 @@
|
||||
<?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###\Administrator\Model;
|
||||
|
||||
###DASH_MODEL_HEADER###
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* ###Component### List Model
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class ###Component###Model extends ListModel
|
||||
{
|
||||
public function getIcons()
|
||||
{
|
||||
// load user for access menus
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
// reset icon array
|
||||
$icons = [];
|
||||
// view groups array
|
||||
$viewGroups = array(
|
||||
'main' => array(###DASHBOARDICONS###)
|
||||
);###DASHBOARDICONACCESS###
|
||||
// loop over the $views
|
||||
foreach($viewGroups as $group => $views)
|
||||
{
|
||||
$i = 0;
|
||||
if (Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($views))
|
||||
{
|
||||
foreach($views as $view)
|
||||
{
|
||||
$add = false;
|
||||
// external views (links)
|
||||
if (strpos($view,'||') !== false)
|
||||
{
|
||||
$dwd = explode('||', $view);
|
||||
if (count($dwd) == 3)
|
||||
{
|
||||
list($type, $name, $url) = $dwd;
|
||||
$viewName = $name;
|
||||
$alt = $name;
|
||||
$url = $url;
|
||||
$image = $name . '.' . $type;
|
||||
$name = 'COM_###COMPONENT###_DASHBOARD_' . Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe($name,'U');
|
||||
}
|
||||
}
|
||||
// internal views
|
||||
elseif (strpos($view,'.') !== false)
|
||||
{
|
||||
$dwd = explode('.', $view);
|
||||
if (count($dwd) == 3)
|
||||
{
|
||||
list($type, $name, $action) = $dwd;
|
||||
}
|
||||
elseif (count($dwd) == 2)
|
||||
{
|
||||
list($type, $name) = $dwd;
|
||||
$action = false;
|
||||
}
|
||||
if ($action)
|
||||
{
|
||||
$viewName = $name;
|
||||
switch($action)
|
||||
{
|
||||
case 'add':
|
||||
$url = 'index.php?option=com_###component###&view=' . $name . '&layout=edit';
|
||||
$image = $name . '_' . $action. '.' . $type;
|
||||
$alt = $name . ' ' . $action;
|
||||
$name = 'COM_###COMPONENT###_DASHBOARD_'.Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe($name,'U').'_ADD';
|
||||
$add = true;
|
||||
break;
|
||||
default:
|
||||
// check for new convention (more stable)
|
||||
if (strpos($action, '_qpo0O0oqp_') !== false)
|
||||
{
|
||||
list($action, $extension) = (array) explode('_qpo0O0oqp_', $action);
|
||||
$extension = str_replace('_po0O0oq_', '.', $extension);
|
||||
}
|
||||
else
|
||||
{
|
||||
$extension = 'com_###component###.' . $name;
|
||||
}
|
||||
$url = 'index.php?option=com_categories&view=categories&extension=' . $extension;
|
||||
$image = $name . '_' . $action . '.' . $type;
|
||||
$alt = $viewName . ' ' . $action;
|
||||
$name = 'COM_###COMPONENT###_DASHBOARD_' . Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe($name,'U') . '_' . Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe($action,'U');
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$viewName = $name;
|
||||
$alt = $name;
|
||||
$url = 'index.php?option=com_###component###&view=' . $name;
|
||||
$image = $name . '.' . $type;
|
||||
$name = 'COM_###COMPONENT###_DASHBOARD_' . Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe($name,'U');
|
||||
$hover = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$viewName = $view;
|
||||
$alt = $view;
|
||||
$url = 'index.php?option=com_###component###&view=' . $view;
|
||||
$image = $view . '.png';
|
||||
$name = ucwords($view).'<br /><br />';
|
||||
$hover = false;
|
||||
}
|
||||
// first make sure the view access is set
|
||||
if (Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($viewAccess))
|
||||
{
|
||||
// setup some defaults
|
||||
$dashboard_add = false;
|
||||
$dashboard_list = false;
|
||||
$accessTo = '';
|
||||
$accessAdd = '';
|
||||
// access checking start
|
||||
$accessCreate = (isset($viewAccess[$viewName.'.create'])) ? Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($viewAccess[$viewName.'.create']):false;
|
||||
$accessAccess = (isset($viewAccess[$viewName.'.access'])) ? Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($viewAccess[$viewName.'.access']):false;
|
||||
// set main controllers
|
||||
$accessDashboard_add = (isset($viewAccess[$viewName.'.dashboard_add'])) ? Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($viewAccess[$viewName.'.dashboard_add']):false;
|
||||
$accessDashboard_list = (isset($viewAccess[$viewName.'.dashboard_list'])) ? Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($viewAccess[$viewName.'.dashboard_list']):false;
|
||||
// check for adding access
|
||||
if ($add && $accessCreate)
|
||||
{
|
||||
$accessAdd = $viewAccess[$viewName.'.create'];
|
||||
}
|
||||
elseif ($add)
|
||||
{
|
||||
$accessAdd = 'core.create';
|
||||
}
|
||||
// check if access to view is set
|
||||
if ($accessAccess)
|
||||
{
|
||||
$accessTo = $viewAccess[$viewName.'.access'];
|
||||
}
|
||||
// set main access controllers
|
||||
if ($accessDashboard_add)
|
||||
{
|
||||
$dashboard_add = $user->authorise($viewAccess[$viewName.'.dashboard_add'], 'com_###component###');
|
||||
}
|
||||
if ($accessDashboard_list)
|
||||
{
|
||||
$dashboard_list = $user->authorise($viewAccess[$viewName.'.dashboard_list'], 'com_###component###');
|
||||
}
|
||||
if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($accessAdd) && Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($accessTo))
|
||||
{
|
||||
// check access
|
||||
if($user->authorise($accessAdd, 'com_###component###') && $user->authorise($accessTo, 'com_###component###') && $dashboard_add)
|
||||
{
|
||||
$icons[$group][$i] = new \StdClass;
|
||||
$icons[$group][$i]->url = $url;
|
||||
$icons[$group][$i]->name = $name;
|
||||
$icons[$group][$i]->image = $image;
|
||||
$icons[$group][$i]->alt = $alt;
|
||||
}
|
||||
}
|
||||
elseif (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($accessTo))
|
||||
{
|
||||
// check access
|
||||
if($user->authorise($accessTo, 'com_###component###') && $dashboard_list)
|
||||
{
|
||||
$icons[$group][$i] = new \StdClass;
|
||||
$icons[$group][$i]->url = $url;
|
||||
$icons[$group][$i]->name = $name;
|
||||
$icons[$group][$i]->image = $image;
|
||||
$icons[$group][$i]->alt = $alt;
|
||||
}
|
||||
}
|
||||
elseif (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($accessAdd))
|
||||
{
|
||||
// check access
|
||||
if($user->authorise($accessAdd, 'com_###component###') && $dashboard_add)
|
||||
{
|
||||
$icons[$group][$i] = new \StdClass;
|
||||
$icons[$group][$i]->url = $url;
|
||||
$icons[$group][$i]->name = $name;
|
||||
$icons[$group][$i]->image = $image;
|
||||
$icons[$group][$i]->alt = $alt;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$icons[$group][$i] = new \StdClass;
|
||||
$icons[$group][$i]->url = $url;
|
||||
$icons[$group][$i]->name = $name;
|
||||
$icons[$group][$i]->image = $image;
|
||||
$icons[$group][$i]->alt = $alt;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$icons[$group][$i] = new \StdClass;
|
||||
$icons[$group][$i]->url = $url;
|
||||
$icons[$group][$i]->name = $name;
|
||||
$icons[$group][$i]->image = $image;
|
||||
$icons[$group][$i]->alt = $alt;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$icons[$group][$i] = false;
|
||||
}
|
||||
}
|
||||
return $icons;
|
||||
}###DASH_MODEL_METHODS###
|
||||
}
|
22
admin/compiler/joomla_4/DASH_VIEW.php
Normal file
22
admin/compiler/joomla_4/DASH_VIEW.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?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###
|
||||
|
||||
###DASH_VIEW_HEADER###
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
?>###DASH_DISPLAY_DATA###
|
100
admin/compiler/joomla_4/DASH_VIEW_HTML.php
Normal file
100
admin/compiler/joomla_4/DASH_VIEW_HTML.php
Normal file
@ -0,0 +1,100 @@
|
||||
<?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###\Administrator\View\###Component###;
|
||||
|
||||
###DASH_VIEW_HTML_HEADER###
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* ###Component### View class
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class HtmlView extends BaseHtmlView
|
||||
{
|
||||
/**
|
||||
* View display method
|
||||
* @return void
|
||||
*/
|
||||
function display($tpl = null)
|
||||
{
|
||||
// Assign data to the view
|
||||
$this->icons = $this->get('Icons');
|
||||
$this->contributors = ###Component###Helper::getContributors();
|
||||
|
||||
// get the manifest details of the component
|
||||
$this->manifest = ###Component###Helper::manifest();###DASH_GET_CUSTOM_DATA###
|
||||
|
||||
// Set the toolbar
|
||||
$this->addToolBar();
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
throw new \Exception(implode("\n", $errors), 500);
|
||||
}
|
||||
|
||||
// Set the html view document stuff
|
||||
$this->_prepareDocument();
|
||||
|
||||
// Display the template
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the page title and toolbar.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function addToolbar(): void
|
||||
{
|
||||
$canDo = ###Component###Helper::getActions('###component###');
|
||||
ToolbarHelper::title(Text::_('COM_###COMPONENT###_DASHBOARD'), 'grid-2');
|
||||
|
||||
// set help url for this view if found
|
||||
$this->help_url = ###Component###Helper::getHelpUrl('###component###');
|
||||
if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($this->help_url))
|
||||
{
|
||||
ToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url);
|
||||
}
|
||||
|
||||
if ($canDo->get('core.admin') || $canDo->get('core.options'))
|
||||
{
|
||||
ToolbarHelper::preferences('com_###component###');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare some document related stuff.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function _prepareDocument(): void
|
||||
{
|
||||
// set page title
|
||||
$this->getDocument()->setTitle(Text::_('COM_###COMPONENT###_DASHBOARD'));
|
||||
|
||||
// add manifest to page JavaScript
|
||||
$this->getDocument()->addScriptDeclaration("var manifest = JSON.parse('" . json_encode($this->manifest) . "');", "text/javascript");
|
||||
|
||||
// add dashboard style sheets
|
||||
Html::_('stylesheet', "administrator/components/com_###component###/assets/css/dashboard.css", ['version' => 'auto']);
|
||||
}
|
||||
}
|
51
admin/compiler/joomla_4/FORM_CHECKBOXES_FIELD.php
Normal file
51
admin/compiler/joomla_4/FORM_CHECKBOXES_FIELD.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?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###\Administrator\Field;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Form\Field\CheckboxesField;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use ###NAMESPACEPREFIX###\Component\###ComponentNameSpace###\Administrator\Helper\###Component###Helper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* ###Type### Form Field class for the ###Component### component
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class ###Type###Field extends CheckboxesField
|
||||
{
|
||||
/**
|
||||
* The ###type### field type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = '###Type###';
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
*
|
||||
* @return array An array of Html options.
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
###JFORM_GETOPTIONS_PHP###
|
||||
}
|
||||
}
|
36
admin/compiler/joomla_4/FORM_CUSTOM_FIELD.php
Normal file
36
admin/compiler/joomla_4/FORM_CUSTOM_FIELD.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?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###\Administrator\Field;
|
||||
|
||||
###FORM_CUSTOM_FIELD_HEADER###
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* ###Type### Form Field class for the ###Component### component
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class ###Type###Field extends ###FORM_EXTENDS###
|
||||
{
|
||||
/**
|
||||
* The ###type### field type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = '###Type###';###FORM_CUSTOM_FIELD_PHP###
|
||||
}
|
52
admin/compiler/joomla_4/FORM_LIST_FIELD.php
Normal file
52
admin/compiler/joomla_4/FORM_LIST_FIELD.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?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###\Administrator\Field;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Form\Field\ListField;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use ###NAMESPACEPREFIX###\Component\###ComponentNameSpace###\Administrator\Helper\###Component###Helper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* ###Type### Form Field class for the ###Component### component
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class ###Type###Field extends ListField
|
||||
{
|
||||
/**
|
||||
* The ###type### field type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = '###Type###';###ADD_BUTTON###
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
*
|
||||
* @return array An array of Html options.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
###JFORM_GETOPTIONS_PHP###
|
||||
}
|
||||
}
|
51
admin/compiler/joomla_4/FORM_RADIO_FIELD.php
Normal file
51
admin/compiler/joomla_4/FORM_RADIO_FIELD.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?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###\Administrator\Field;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Form\Field\RadioField;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use ###NAMESPACEPREFIX###\Component\###ComponentNameSpace###\Administrator\Helper\###Component###Helper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* ###Type### Form Field class for the ###Component### component
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class ###Type###Field extends RadioField
|
||||
{
|
||||
/**
|
||||
* The ###type### field type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = '###Type###';
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
*
|
||||
* @return array An array of Html options.
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
###JFORM_GETOPTIONS_PHP###
|
||||
}
|
||||
}
|
37
admin/compiler/joomla_4/FORM_RULE.php
Normal file
37
admin/compiler/joomla_4/FORM_RULE.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?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###\Administrator\Rule;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Form\Form;
|
||||
use Joomla\CMS\Form\FormRule;
|
||||
use Joomla\Registry\Registry;
|
||||
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use ###NAMESPACEPREFIX###\Component\###ComponentNameSpace###\Administrator\Helper\###Component###Helper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('JPATH_PLATFORM') or die;
|
||||
|
||||
/**
|
||||
* Form Rule (###Name###) class for the Joomla Platform.
|
||||
*
|
||||
* @since 3.5
|
||||
*/
|
||||
class ###Name###Rule extends FormRule
|
||||
{###VALIDATION_RULE_METHODS###
|
||||
}
|
65
admin/compiler/joomla_4/FORM_USER_FIELD.php
Normal file
65
admin/compiler/joomla_4/FORM_USER_FIELD.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?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###\Administrator\Field;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Form\Field\UserField;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use ###NAMESPACEPREFIX###\Component\###ComponentNameSpace###\Administrator\Helper\###Component###Helper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* ###Type### Form Field class for the ###Component### component
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class ###Type###Field extends UserField
|
||||
{
|
||||
/**
|
||||
* The ###type### field type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = '###Type###';
|
||||
|
||||
/**
|
||||
* Method to get the filtering groups (null means no filtering)
|
||||
*
|
||||
* @return mixed array of filtering groups or null.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getGroups()
|
||||
{
|
||||
###JFORM_GETGROUPS_PHP###
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the users to exclude from the list of users
|
||||
*
|
||||
* @return mixed Array of users to exclude or null to not exclude them
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getExcluded()
|
||||
{
|
||||
###JFORM_GETEXCLUDED_PHP###
|
||||
}
|
||||
}
|
1099
admin/compiler/joomla_4/INSTALLER_SCRIPT.php
Normal file
1099
admin/compiler/joomla_4/INSTALLER_SCRIPT.php
Normal file
File diff suppressed because it is too large
Load Diff
22
admin/compiler/joomla_4/LAYOUT_OVERRIDE.php
Normal file
22
admin/compiler/joomla_4/LAYOUT_OVERRIDE.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?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###
|
||||
|
||||
###OVERRIDE_LAYOUT_HEADER###
|
||||
|
||||
// No direct access to this file
|
||||
defined('JPATH_BASE') or die;###OVERRIDE_LAYOUT_CODE###
|
||||
|
||||
?>###OVERRIDE_LAYOUT_BODY###
|
340
admin/compiler/joomla_4/LICENSE.txt
Normal file
340
admin/compiler/joomla_4/LICENSE.txt
Normal file
@ -0,0 +1,340 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
1
admin/compiler/joomla_4/README.md
Normal file
1
admin/compiler/joomla_4/README.md
Normal file
@ -0,0 +1 @@
|
||||
###README###
|
1
admin/compiler/joomla_4/README.txt
Normal file
1
admin/compiler/joomla_4/README.txt
Normal file
@ -0,0 +1 @@
|
||||
###README###
|
28
admin/compiler/joomla_4/SITE_ADMIN_VIEW.php
Normal file
28
admin/compiler/joomla_4/SITE_ADMIN_VIEW.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?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###
|
||||
|
||||
###SITE_ADMIN_VIEW_HEADER###
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
?>
|
||||
<div class="###component###-###view###">
|
||||
<?php echo $this->toolbar->render(); ?>
|
||||
<form action="<?php echo Route::_('index.php?option=com_###component###&layout=edit&id='. (int) $this->item->id . $this->referral); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
|
||||
###EDITBODY###
|
||||
</form>
|
||||
</div>###EDITBODYSCRIPT###
|
291
admin/compiler/joomla_4/SITE_ADMIN_VIEW_CONTROLLER.php
Normal file
291
admin/compiler/joomla_4/SITE_ADMIN_VIEW_CONTROLLER.php
Normal file
@ -0,0 +1,291 @@
|
||||
<?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###\Site\Controller;
|
||||
|
||||
###SITE_ADMIN_VIEW_CONTROLLER_HEADER###
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* ###View### Form Controller
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class ###View###Controller extends FormController
|
||||
{
|
||||
use VersionableControllerTrait;
|
||||
|
||||
/**
|
||||
* The prefix to use with controller messages.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $text_prefix = 'COM_###COMPONENT###_###VIEW###';
|
||||
|
||||
/**
|
||||
* Current or most recently performed task.
|
||||
*
|
||||
* @var string
|
||||
* @since 12.2
|
||||
* @note Replaces _task.
|
||||
*/
|
||||
protected $task;
|
||||
|
||||
/**
|
||||
* The context for storing internal data, e.g. record.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $context = '###view###';
|
||||
|
||||
/**
|
||||
* The URL view item variable.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $view_item = '###view###';
|
||||
|
||||
/**
|
||||
* The URL view list variable.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $view_list = '###SITE_DEFAULT_VIEW###';###ADMIN_CUSTOM_BUTTONS_CONTROLLER###
|
||||
|
||||
/**
|
||||
* Method override to check if you can add a new record.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
*
|
||||
* @return boolean
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function allowAdd($data = [])
|
||||
{###JCONTROLLERFORM_ALLOWADD###
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can edit an existing record.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
* @param string $key The name of the key for the primary key.
|
||||
*
|
||||
* @return boolean
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function allowEdit($data = [], $key = 'id')
|
||||
{###JCONTROLLERFORM_ALLOWEDIT###
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the URL arguments to append to an item redirect.
|
||||
*
|
||||
* @param integer $recordId The primary key id for the item.
|
||||
* @param string $urlVar The name of the URL variable for the id.
|
||||
*
|
||||
* @return string The arguments to append to the redirect URL.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
|
||||
{
|
||||
// get the referral options (old method use return instead see parent)
|
||||
$ref = $this->input->get('ref', 0, 'string');
|
||||
$refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
// get redirect info.
|
||||
$append = parent::getRedirectToItemAppend($recordId, $urlVar);
|
||||
|
||||
// set the referral options
|
||||
if ($refid && $ref)
|
||||
{
|
||||
$append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append;
|
||||
}
|
||||
elseif ($ref)
|
||||
{
|
||||
$append = '&ref='. (string) $ref . $append;
|
||||
}
|
||||
|
||||
return $append;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to run batch operations.
|
||||
*
|
||||
* @param object $model The model.
|
||||
*
|
||||
* @return boolean True if successful, false otherwise and internal error is set.
|
||||
*
|
||||
* @since 2.5
|
||||
*/
|
||||
public function batch($model = null)
|
||||
{
|
||||
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// Set the model
|
||||
$model = $this->getModel('###View###', '', []);
|
||||
|
||||
// Preset the redirect
|
||||
$this->setRedirect(Route::_('index.php?option=com_###component###&view=###views###' . $this->getRedirectToListAppend(), false));
|
||||
|
||||
return parent::batch($model);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to cancel an edit.
|
||||
*
|
||||
* @param string $key The name of the primary key of the URL variable.
|
||||
*
|
||||
* @return boolean True if access level checks pass, false otherwise.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function cancel($key = null)
|
||||
{
|
||||
// get the referral options
|
||||
$this->ref = $this->input->get('ref', 0, 'word');
|
||||
$this->refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
// Check if there is a return value
|
||||
$return = $this->input->get('return', null, 'base64');###JCONTROLLERFORM_BEFORECANCEL###
|
||||
|
||||
$cancel = parent::cancel($key);
|
||||
|
||||
if (!is_null($return) && Uri::isInternal(base64_decode($return)))
|
||||
{
|
||||
$redirect = base64_decode($return);
|
||||
|
||||
// Redirect to the return value.
|
||||
$this->setRedirect(
|
||||
Route::_(
|
||||
$redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->refid && $this->ref)
|
||||
{
|
||||
$redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid;
|
||||
|
||||
// Redirect to the item screen.
|
||||
$this->setRedirect(
|
||||
Route::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->ref)
|
||||
{
|
||||
$redirect = '&view=' . (string) $this->ref;
|
||||
|
||||
// Redirect to the list screen.
|
||||
$this->setRedirect(
|
||||
Route::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}###JCONTROLLERFORM_AFTERCANCEL###
|
||||
return $cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to save a record.
|
||||
*
|
||||
* @param string $key The name of the primary key of the URL variable.
|
||||
* @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions).
|
||||
*
|
||||
* @return boolean True if successful, false otherwise.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function save($key = null, $urlVar = null)
|
||||
{
|
||||
// get the referral options
|
||||
$this->ref = $this->input->get('ref', 0, 'word');
|
||||
$this->refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
// Check if there is a return value
|
||||
$return = $this->input->get('return', null, 'base64');
|
||||
$canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return)));
|
||||
|
||||
if ($this->ref || $this->refid || $canReturn)
|
||||
{
|
||||
// to make sure the item is checkedin on redirect
|
||||
$this->task = 'save';
|
||||
}
|
||||
|
||||
$saved = parent::save($key, $urlVar);
|
||||
|
||||
// This is not needed since parent save already does this
|
||||
// Due to the ref and refid implementation we need to add this
|
||||
if ($canReturn)
|
||||
{
|
||||
$redirect = base64_decode($return);
|
||||
|
||||
// Redirect to the return value.
|
||||
$this->setRedirect(
|
||||
Route::_(
|
||||
$redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->refid && $this->ref)
|
||||
{
|
||||
$redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid;
|
||||
|
||||
// Redirect to the item screen.
|
||||
$this->setRedirect(
|
||||
Route::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->ref)
|
||||
{
|
||||
$redirect = '&view=' . (string) $this->ref;
|
||||
|
||||
// Redirect to the list screen.
|
||||
$this->setRedirect(
|
||||
Route::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
return $saved;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function that allows child controller access to model data
|
||||
* after the data has been saved.
|
||||
*
|
||||
* @param BaseDatabaseModel &$model The data model object.
|
||||
* @param array $validData The validated data.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 11.1
|
||||
*/
|
||||
protected function postSaveHook(BaseDatabaseModel $model, $validData = [])
|
||||
{###POSTSAVEHOOK###
|
||||
}
|
||||
|
||||
}
|
142
admin/compiler/joomla_4/SITE_ADMIN_VIEW_HTML.php
Normal file
142
admin/compiler/joomla_4/SITE_ADMIN_VIEW_HTML.php
Normal file
@ -0,0 +1,142 @@
|
||||
<?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###\Site\View\###View###;
|
||||
|
||||
###SITE_ADMIN_VIEW_HTML_HEADER###
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED###
|
||||
|
||||
/**
|
||||
* ###View### Html View class
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class HtmlView extends BaseHtmlView
|
||||
{
|
||||
/**
|
||||
* ###View### view display method
|
||||
*
|
||||
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
public function display($tpl = null)
|
||||
{
|
||||
// set params
|
||||
$this->params = ComponentHelper::getParams('com_###component###');
|
||||
// Assign the variables
|
||||
$this->form = $this->get('Form');
|
||||
$this->item = $this->get('Item');
|
||||
$this->state = $this->get('State');
|
||||
$this->styles = $this->get('Styles');
|
||||
$this->scripts = $this->get('Scripts');
|
||||
// get action permissions
|
||||
$this->canDo = ###Component###Helper::getActions('###view###', $this->item);
|
||||
// get input
|
||||
$jinput = Factory::getApplication()->input;
|
||||
$this->ref = $jinput->get('ref', 0, 'word');
|
||||
$this->refid = $jinput->get('refid', 0, 'int');
|
||||
$return = $jinput->get('return', null, 'base64');
|
||||
// set the referral string
|
||||
$this->referral = '';
|
||||
if ($this->refid && $this->ref)
|
||||
{
|
||||
// return to the item that referred to this item
|
||||
$this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid;
|
||||
}
|
||||
elseif($this->ref)
|
||||
{
|
||||
// return to the list view that referred to this item
|
||||
$this->referral = '&ref=' . (string)$this->ref;
|
||||
}
|
||||
// check return value
|
||||
if (!is_null($return))
|
||||
{
|
||||
// add the return value
|
||||
$this->referral .= '&return=' . (string)$return;
|
||||
}###LINKEDVIEWITEMS###
|
||||
|
||||
// Set the toolbar
|
||||
$this->addToolBar();
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
throw new \Exception(implode("\n", $errors), 500);
|
||||
}
|
||||
|
||||
// Set the html view document stuff
|
||||
$this->_prepareDocument();
|
||||
|
||||
// Display the template
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the page title and toolbar.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function addToolbar(): void
|
||||
{
|
||||
###ADDTOOLBAR###
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes a value for output in a view script.
|
||||
*
|
||||
* @param mixed $var The output to escape.
|
||||
* @param bool $shorten The switch to shorten.
|
||||
* @param int $length The shorting length.
|
||||
*
|
||||
* @return mixed The escaped value.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function escape($var, bool $shorten = true, int $length = 30)
|
||||
{
|
||||
if (!is_string($var))
|
||||
{
|
||||
return $var;
|
||||
}
|
||||
|
||||
return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare some document related stuff.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function _prepareDocument(): void
|
||||
{###JQUERY###
|
||||
$isNew = ($this->item->id < 1);
|
||||
$this->getDocument()->setTitle(Text::_($isNew ? 'COM_###COMPONENT###_###VIEW###_NEW' : 'COM_###COMPONENT###_###VIEW###_EDIT'));
|
||||
// add styles
|
||||
foreach ($this->styles as $style)
|
||||
{
|
||||
Html::_('stylesheet', $style, ['version' => 'auto']);
|
||||
}###AJAXTOKE######LINKEDVIEWTABLESCRIPTS###
|
||||
// add scripts
|
||||
foreach ($this->scripts as $script)
|
||||
{
|
||||
Html::_('script', $script, ['version' => 'auto']);
|
||||
}###DOCUMENT_CUSTOM_PHP###
|
||||
}
|
||||
}
|
446
admin/compiler/joomla_4/SITE_ADMIN_VIEW_MODEL.php
Normal file
446
admin/compiler/joomla_4/SITE_ADMIN_VIEW_MODEL.php
Normal file
@ -0,0 +1,446 @@
|
||||
<?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###\Site\Model;
|
||||
|
||||
###SITE_ADMIN_VIEW_MODEL_HEADER###
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* ###Component### ###View### Admin Model
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class ###View###Model extends AdminModel
|
||||
{
|
||||
use VersionableModelTrait;
|
||||
|
||||
/**
|
||||
* The tab layout fields array.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $tabLayoutFields = ###TABLAYOUTFIELDSARRAY###;
|
||||
|
||||
/**
|
||||
* @var string The prefix to use with controller messages.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $text_prefix = 'COM_###COMPONENT###';
|
||||
|
||||
/**
|
||||
* The type alias for this content type.
|
||||
*
|
||||
* @var string
|
||||
* @since 3.2
|
||||
*/
|
||||
public $typeAlias = 'com_###component###.###view###';
|
||||
|
||||
/**
|
||||
* Returns a Table object, always creating it
|
||||
*
|
||||
* @param type $type The table type to instantiate
|
||||
* @param string $prefix A prefix for the table class name. Optional.
|
||||
* @param array $config Configuration array for model. Optional.
|
||||
*
|
||||
* @return Table A database object
|
||||
*
|
||||
* @since 3.0
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getTable($type = '###view###', $prefix = 'Administrator', $config = [])
|
||||
{
|
||||
// get instance of the table
|
||||
return parent::getTable($type, $prefix, $config);
|
||||
}###ADMIN_CUSTOM_BUTTONS_METHOD###
|
||||
|
||||
/**
|
||||
* Method to get a single record.
|
||||
*
|
||||
* @param integer $pk The id of the primary key.
|
||||
*
|
||||
* @return mixed Object on success, false on failure.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getItem($pk = null)
|
||||
{###LICENSE_LOCKED_CHECK###
|
||||
if ($item = parent::getItem($pk))
|
||||
{
|
||||
if (!empty($item->params) && !is_array($item->params))
|
||||
{
|
||||
// Convert the params field to an array.
|
||||
$registry = new Registry;
|
||||
$registry->loadString($item->params);
|
||||
$item->params = $registry->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->metadata))
|
||||
{
|
||||
// Convert the metadata field to an array.
|
||||
$registry = new Registry;
|
||||
$registry->loadString($item->metadata);
|
||||
$item->metadata = $registry->toArray();
|
||||
}###METHOD_GET_ITEM###
|
||||
}###LINKEDVIEWGLOBAL###
|
||||
|
||||
return $item;
|
||||
}###LINKEDVIEWMETHODS######LICENSE_LOCKED_SET_BOOL###
|
||||
|
||||
/**
|
||||
* Method to get the record form.
|
||||
*
|
||||
* @param array $data Data for the form.
|
||||
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
|
||||
* @param array $options Optional array of options for the form creation.
|
||||
*
|
||||
* @return mixed A JForm object on success, false on failure
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getForm($data = [], $loadData = true, $options = array('control' => 'jform'))
|
||||
{
|
||||
// set load data option
|
||||
$options['load_data'] = $loadData;###JMODELADMIN_GETFORM###
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the script that have to be included on the form
|
||||
*
|
||||
* @return string script files
|
||||
*/
|
||||
public function getScript()
|
||||
{
|
||||
return 'media/com_###component###/js/###view###.js';
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to test whether a record can be deleted.
|
||||
*
|
||||
* @param object $record A record object.
|
||||
*
|
||||
* @return boolean True if allowed to delete the record. Defaults to the permission set in the component.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function canDelete($record)
|
||||
{###JMODELADMIN_CANDELETE###
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to test whether a record can have its state edited.
|
||||
*
|
||||
* @param object $record A record object.
|
||||
*
|
||||
* @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function canEditState($record)
|
||||
{###JMODELADMIN_CANEDITSTATE###
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can edit an existing record.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
* @param string $key The name of the key for the primary key.
|
||||
*
|
||||
* @return boolean
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function allowEdit($data = [], $key = 'id')
|
||||
{###JMODELADMIN_ALLOWEDIT###
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare and sanitise the table data prior to saving.
|
||||
*
|
||||
* @param Table $table A Table object.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function prepareTable($table)
|
||||
{###LICENSE_TABLE_LOCKED_CHECK###
|
||||
$date = $this->getDatabase();
|
||||
$user = $this->getCurrentUser();
|
||||
|
||||
if (isset($table->name))
|
||||
{
|
||||
$table->name = htmlspecialchars_decode($table->name, ENT_QUOTES);
|
||||
}
|
||||
|
||||
if (isset($table->alias) && empty($table->alias))
|
||||
{
|
||||
$table->generateAlias();
|
||||
}
|
||||
|
||||
if (empty($table->id))
|
||||
{
|
||||
$table->created = $date->toSql();
|
||||
// set the user
|
||||
if ($table->created_by == 0 || empty($table->created_by))
|
||||
{
|
||||
$table->created_by = $user->id;
|
||||
}
|
||||
// Set ordering to the last item if not set
|
||||
if (empty($table->ordering))
|
||||
{
|
||||
$db = $this->getDatabase();
|
||||
$query = $db->getQuery(true)
|
||||
->select('MAX(ordering)')
|
||||
->from($db->quoteName('#__###component###_###view###'));
|
||||
$db->setQuery($query);
|
||||
$max = $db->loadResult();
|
||||
|
||||
$table->ordering = $max + 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$table->modified = $date->toSql();
|
||||
$table->modified_by = $user->id;
|
||||
}
|
||||
|
||||
if (!empty($table->id))
|
||||
{
|
||||
// Increment the items version number.
|
||||
$table->version++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the data that should be injected in the form.
|
||||
*
|
||||
* @return mixed The data for the form.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function loadFormData()
|
||||
{
|
||||
// Check the session for previously entered form data.
|
||||
$data = Factory::getApplication()->getUserState('com_###component###.edit.###view###.data', []);
|
||||
|
||||
if (empty($data))
|
||||
{
|
||||
$data = $this->getItem();
|
||||
}
|
||||
|
||||
// run the perprocess of the data
|
||||
$this->preprocessData('com_###component###.###view###', $data);
|
||||
|
||||
return $data;
|
||||
}###VALIDATIONFIX######UNIQUEFIELDS###
|
||||
|
||||
/**
|
||||
* Method to delete one or more records.
|
||||
*
|
||||
* @param array &$pks An array of record primary keys.
|
||||
*
|
||||
* @return boolean True if successful, false if an error occurs.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function delete(&$pks)
|
||||
{###JMODELADMIN_BEFORE_DELETE###
|
||||
if (!parent::delete($pks))
|
||||
{
|
||||
return false;
|
||||
}###JMODELADMIN_AFTER_DELETE###
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to change the published state of one or more records.
|
||||
*
|
||||
* @param array &$pks A list of the primary keys to change.
|
||||
* @param integer $value The value of the published state.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function publish(&$pks, $value = 1)
|
||||
{###JMODELADMIN_BEFORE_PUBLISH###
|
||||
if (!parent::publish($pks, $value))
|
||||
{
|
||||
return false;
|
||||
}###JMODELADMIN_AFTER_PUBLISH###
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to perform batch operations on an item or a set of items.
|
||||
*
|
||||
* @param array $commands An array of commands to perform.
|
||||
* @param array $pks An array of item ids.
|
||||
* @param array $contexts An array of item contexts.
|
||||
*
|
||||
* @return boolean Returns true on success, false on failure.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function batch($commands, $pks, $contexts)
|
||||
{
|
||||
// Sanitize ids.
|
||||
$pks = array_unique($pks);
|
||||
ArrayHelper::toInteger($pks);
|
||||
|
||||
// Remove any values of zero.
|
||||
if (array_search(0, $pks, true))
|
||||
{
|
||||
unset($pks[array_search(0, $pks, true)]);
|
||||
}
|
||||
|
||||
if (empty($pks))
|
||||
{
|
||||
$this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED'));
|
||||
return false;
|
||||
}
|
||||
|
||||
$done = false;
|
||||
|
||||
// Set some needed variables.
|
||||
$this->user ??= $this->getCurrentUser();
|
||||
$this->table = $this->getTable();
|
||||
$this->tableClassName = get_class($this->table);
|
||||
$this->contentType = new UCMType;
|
||||
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
|
||||
$this->canDo = ###Component###Helper::getActions('###view###');
|
||||
$this->batchSet = true;
|
||||
|
||||
if (!$this->canDo->get('core.batch'))
|
||||
{
|
||||
$this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->type == false)
|
||||
{
|
||||
$type = new UCMType;
|
||||
$this->type = $type->getTypeByAlias($this->typeAlias);
|
||||
}
|
||||
|
||||
$this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags');
|
||||
|
||||
if (!empty($commands['move_copy']))
|
||||
{
|
||||
$cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
|
||||
|
||||
if ($cmd == 'c')
|
||||
{
|
||||
$result = $this->batchCopy($commands, $pks, $contexts);
|
||||
|
||||
if (is_array($result))
|
||||
{
|
||||
foreach ($result as $old => $new)
|
||||
{
|
||||
$contexts[$new] = $contexts[$old];
|
||||
}
|
||||
$pks = array_values($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$done = true;
|
||||
}
|
||||
|
||||
if (!$done)
|
||||
{
|
||||
$this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Clear the cache
|
||||
$this->cleanCache();
|
||||
|
||||
return true;
|
||||
}###MODEL_BATCH_COPY######MODEL_BATCH_MOVE###
|
||||
|
||||
/**
|
||||
* Method to save the form data.
|
||||
*
|
||||
* @param array $data The form data.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function save($data)
|
||||
{
|
||||
$input = Factory::getApplication()->input;
|
||||
$filter = InputFilter::getInstance();
|
||||
|
||||
// set the metadata to the Item Data
|
||||
if (isset($data['metadata']) && isset($data['metadata']['author']))
|
||||
{
|
||||
$data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM');
|
||||
|
||||
$metadata = new Registry;
|
||||
$metadata->loadArray($data['metadata']);
|
||||
$data['metadata'] = (string) $metadata;
|
||||
}###CHECKBOX_SAVE######METHOD_ITEM_SAVE###
|
||||
|
||||
// Set the Params Items to data
|
||||
if (isset($data['params']) && is_array($data['params']))
|
||||
{
|
||||
$params = new Registry;
|
||||
$params->loadArray($data['params']);
|
||||
$data['params'] = (string) $params;
|
||||
}###TITLEALIASFIX###
|
||||
|
||||
if (parent::save($data))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to generate a unique value.
|
||||
*
|
||||
* @param string $field name.
|
||||
* @param string $value data.
|
||||
*
|
||||
* @return string New value.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
protected function generateUnique($field, $value)
|
||||
{
|
||||
// set field value unique
|
||||
$table = $this->getTable();
|
||||
|
||||
while ($table->load(array($field => $value)))
|
||||
{
|
||||
$value = StringHelper::increment($value);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}###GENERATENEWTITLE###
|
||||
}
|
97
admin/compiler/joomla_4/SITE_AJAX_CONTROLLER.php
Normal file
97
admin/compiler/joomla_4/SITE_AJAX_CONTROLLER.php
Normal file
@ -0,0 +1,97 @@
|
||||
<?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###\Site\Controller;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Application\CMSApplication;
|
||||
use Joomla\CMS\MVC\Controller\BaseController;
|
||||
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use Joomla\Input\Input;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* ###Component### Ajax Base Controller
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class AjaxController extends BaseController
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param array $config An optional associative array of configuration settings.
|
||||
* Recognized key values include 'name', 'default_task', 'model_path', and
|
||||
* 'view_path' (this list is not meant to be comprehensive).
|
||||
* @param ?MVCFactoryInterface $factory The factory.
|
||||
* @param ?CMSApplication $app The Application for the dispatcher
|
||||
* @param ?Input $input Input
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public function __construct($config = [], ?MVCFactoryInterface $factory = null, ?CMSApplication $app = null, ?Input $input = null)
|
||||
{
|
||||
parent::__construct($config, $factory, $app, $input);
|
||||
|
||||
// make sure all json stuff are set
|
||||
$this->app->getDocument()->setMimeEncoding( 'application/json' );
|
||||
$this->app->setHeader('Content-Disposition','attachment;filename="getajax.json"');
|
||||
$this->app->setHeader('Access-Control-Allow-Origin', '*');
|
||||
// load the tasks ###REGISTER_SITE_AJAX_TASK###
|
||||
}
|
||||
|
||||
public function ajax()
|
||||
{
|
||||
// get the user for later use
|
||||
$user = $this->app->getIdentity();
|
||||
// get the input values
|
||||
$jinput = $this->input ?? $this->app->input;
|
||||
// check if we should return raw (DEFAULT TRUE SINCE J4)
|
||||
$returnRaw = $jinput->get('raw', true, 'BOOLEAN');
|
||||
// return to a callback function
|
||||
$callback = $jinput->get('callback', null, 'CMD');
|
||||
// Check Token!
|
||||
$token = Session::getFormToken();
|
||||
$call_token = $jinput->get('token', 0, 'ALNUM');
|
||||
if($jinput->get($token, 0, 'ALNUM') || $token === $call_token)
|
||||
{
|
||||
// get the task
|
||||
$task = $this->getTask();
|
||||
switch($task)
|
||||
{###AJAX_SITE_INPUT_RETURN###
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// return to a callback function
|
||||
if($callback)
|
||||
{
|
||||
echo $callback."(".json_encode(['error' => 'There was an error! [139]']).");";
|
||||
}
|
||||
elseif($returnRaw)
|
||||
{
|
||||
echo json_encode(['error' => 'There was an error! [139]']);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "(".json_encode(['error' => 'There was an error! [139]']).");";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
62
admin/compiler/joomla_4/SITE_AJAX_MODEL.php
Normal file
62
admin/compiler/joomla_4/SITE_AJAX_MODEL.php
Normal file
@ -0,0 +1,62 @@
|
||||
<?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###\Site\Model;
|
||||
|
||||
###AJAX_SITE_MODEL_HEADER###
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* ###Component### Ajax List Model
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class AjaxModel extends ListModel
|
||||
{
|
||||
/**
|
||||
* The component params.
|
||||
*
|
||||
* @var Registry
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Registry $app_params;
|
||||
|
||||
/**
|
||||
* The application object.
|
||||
*
|
||||
* @var CMSApplicationInterface The application instance.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected CMSApplicationInterface $app;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param array $config An array of configuration options (name, state, dbo, table_path, ignore_request).
|
||||
* @param ?MVCFactoryInterface $factory The factory.
|
||||
*
|
||||
* @since 1.6
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function __construct($config = [], MVCFactoryInterface $factory = null)
|
||||
{
|
||||
parent::__construct($config, $factory);
|
||||
|
||||
$this->app_params = ComponentHelper::getParams('com_###component###');
|
||||
$this->app ??= Factory::getApplication();
|
||||
}###AJAX_SITE_MODEL_METHODS###
|
||||
}
|
41
admin/compiler/joomla_4/SITE_DISPATCHER.php
Normal file
41
admin/compiler/joomla_4/SITE_DISPATCHER.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?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###\Site\Dispatcher;
|
||||
|
||||
use Joomla\CMS\Dispatcher\ComponentDispatcher;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED###
|
||||
|
||||
/**
|
||||
* ComponentDispatcher class for com_###component###
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
class Dispatcher extends ComponentDispatcher
|
||||
{
|
||||
/**
|
||||
* Dispatch a controller task. Redirecting the user if appropriate.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public function dispatch()
|
||||
{
|
||||
parent::dispatch();
|
||||
}
|
||||
}
|
132
admin/compiler/joomla_4/SITE_DISPLAY_CONTROLLER.php
Normal file
132
admin/compiler/joomla_4/SITE_DISPLAY_CONTROLLER.php
Normal file
@ -0,0 +1,132 @@
|
||||
<?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###\Site\Controller;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\MVC\Controller\BaseController;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* ###Component### master site display controller.
|
||||
*
|
||||
* @since 4.0
|
||||
*/
|
||||
class DisplayController extends BaseController
|
||||
{
|
||||
/**
|
||||
* Method to display a view.
|
||||
*
|
||||
* @param boolean $cachable If true, the view output will be cached.
|
||||
* @param boolean $urlparams An array of safe URL parameters and their variable types, for valid values see {@link InputFilter::clean()}.
|
||||
*
|
||||
* @return DisplayController This object to support chaining.
|
||||
* @since 1.5
|
||||
*/
|
||||
function display($cachable = false, $urlparams = false)
|
||||
{
|
||||
// set default view if not set
|
||||
$view = $this->input->getCmd('view', '###SITE_DEFAULT_VIEW###');
|
||||
$this->input->set('view', $view);
|
||||
$isEdit = $this->checkEditView($view);
|
||||
$layout = $this->input->get('layout', null, 'WORD');
|
||||
$id = $this->input->getInt('id');
|
||||
$cachable = true;
|
||||
|
||||
// ensure that the view is not cashable if edit view or if user is logged in
|
||||
$user = $this->app->getIdentity();
|
||||
if ($user->get('id') || $this->input->getMethod() === 'POST' || $isEdit)
|
||||
{
|
||||
$cachable = false;
|
||||
}
|
||||
|
||||
// Check for edit form.
|
||||
if ($isEdit && !$this->checkEditId('com_###component###.edit.'.$view, $id))
|
||||
{
|
||||
// check if item was opened from other than its own list view
|
||||
$ref = $this->input->getCmd('ref', 0);
|
||||
$refid = $this->input->getInt('refid', 0);
|
||||
|
||||
// set redirect
|
||||
if ($refid > 0 && Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($ref))
|
||||
{
|
||||
// redirect to item of ref
|
||||
$this->setRedirect(Route::_('index.php?option=com_###component###&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false));
|
||||
}
|
||||
elseif (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($ref))
|
||||
{
|
||||
// redirect to ref
|
||||
$this->setRedirect(Route::_('index.php?option=com_###component###&view='.(string)$ref, false));
|
||||
}
|
||||
else
|
||||
{
|
||||
// normal redirect back to the list default site view
|
||||
$this->setRedirect(Route::_('index.php?option=com_###component###&view=###SITE_DEFAULT_VIEW###', false));
|
||||
}
|
||||
|
||||
// Somehow the person just went to the form - we don't allow that.
|
||||
throw new \Exception(Text::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id), 403);
|
||||
}
|
||||
|
||||
// we may need to make this more dynamic in the future. (TODO)
|
||||
$safeurlparams = array(
|
||||
'catid' => 'INT',
|
||||
'id' => 'INT',
|
||||
'cid' => 'ARRAY',
|
||||
'year' => 'INT',
|
||||
'month' => 'INT',
|
||||
'limit' => 'UINT',
|
||||
'limitstart' => 'UINT',
|
||||
'showall' => 'INT',
|
||||
'return' => 'BASE64',
|
||||
'filter' => 'STRING',
|
||||
'filter_order' => 'CMD',
|
||||
'filter_order_Dir' => 'CMD',
|
||||
'filter-search' => 'STRING',
|
||||
'print' => 'BOOLEAN',
|
||||
'lang' => 'CMD',
|
||||
'Itemid' => 'INT');
|
||||
|
||||
// should these not merge?
|
||||
if (Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($urlparams))
|
||||
{
|
||||
$safeurlparams = Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::merge(array($urlparams, $safeurlparams));
|
||||
}
|
||||
|
||||
parent::display($cachable, $safeurlparams);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function checkEditView($view)
|
||||
{
|
||||
if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($view))
|
||||
{
|
||||
$views = [###SITE_EDIT_VIEW_ARRAY###
|
||||
];
|
||||
// check if this is a edit view
|
||||
if (in_array($view,$views))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
51
admin/compiler/joomla_4/SITE_FORM_CHECKBOXES_FIELD.php
Normal file
51
admin/compiler/joomla_4/SITE_FORM_CHECKBOXES_FIELD.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?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###\Site\Field;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Form\Field\CheckboxesField;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use ###NAMESPACEPREFIX###\Component\###ComponentNameSpace###\Site\Helper\###Component###Helper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* ###Type### Form Field class for the ###Component### component
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class ###Type###Field extends CheckboxesField
|
||||
{
|
||||
/**
|
||||
* The ###type### field type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = '###Type###';
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
*
|
||||
* @return array An array of Html options.
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
###JFORM_GETOPTIONS_PHP###
|
||||
}
|
||||
}
|
36
admin/compiler/joomla_4/SITE_FORM_CUSTOM_FIELD.php
Normal file
36
admin/compiler/joomla_4/SITE_FORM_CUSTOM_FIELD.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?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###\Site\Field;
|
||||
|
||||
###SITE_FORM_CUSTOM_FIELD_HEADER###
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* ###Type### Form Field class for the ###Component### component
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class ###Type###Field extends ###FORM_EXTENDS###
|
||||
{
|
||||
/**
|
||||
* The ###type### field type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = '###Type###';###FORM_CUSTOM_FIELD_PHP###
|
||||
}
|
52
admin/compiler/joomla_4/SITE_FORM_LIST_FIELD.php
Normal file
52
admin/compiler/joomla_4/SITE_FORM_LIST_FIELD.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?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###\Site\Field;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Form\Field\ListField;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use ###NAMESPACEPREFIX###\Component\###ComponentNameSpace###\Site\Helper\###Component###Helper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* ###Type### Form Field class for the ###Component### component
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class ###Type###Field extends ListField
|
||||
{
|
||||
/**
|
||||
* The ###type### field type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = '###Type###';###ADD_BUTTON###
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
*
|
||||
* @return array An array of Html options.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
###JFORM_GETOPTIONS_PHP###
|
||||
}
|
||||
}
|
51
admin/compiler/joomla_4/SITE_FORM_RADIO_FIELD.php
Normal file
51
admin/compiler/joomla_4/SITE_FORM_RADIO_FIELD.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?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###\Site\Field;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Form\Field\RadioField;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use ###NAMESPACEPREFIX###\Component\###ComponentNameSpace###\Site\Helper\###Component###Helper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* ###Type### Form Field class for the ###Component### component
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class ###Type###Field extends RadioField
|
||||
{
|
||||
/**
|
||||
* The ###type### field type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = '###Type###';
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
*
|
||||
* @return array An array of Html options.
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
###JFORM_GETOPTIONS_PHP###
|
||||
}
|
||||
}
|
37
admin/compiler/joomla_4/SITE_FORM_RULE.php
Normal file
37
admin/compiler/joomla_4/SITE_FORM_RULE.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?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###\Site\Rule;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Form\Form;
|
||||
use Joomla\CMS\Form\FormRule;
|
||||
use Joomla\Registry\Registry;
|
||||
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use ###NAMESPACEPREFIX###\Component\###ComponentNameSpace###\Site\Helper\###Component###Helper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('JPATH_PLATFORM') or die;
|
||||
|
||||
/**
|
||||
* Form Rule (###Name###) class for the Joomla Platform.
|
||||
*
|
||||
* @since 3.5
|
||||
*/
|
||||
class ###Name###Rule extends FormRule
|
||||
{###VALIDATION_RULE_METHODS###
|
||||
}
|
65
admin/compiler/joomla_4/SITE_FORM_USER_FIELD.php
Normal file
65
admin/compiler/joomla_4/SITE_FORM_USER_FIELD.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?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###\Site\Field;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Form\Field\UserField;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use ###NAMESPACEPREFIX###\Component\###ComponentNameSpace###\Site\Helper\###Component###Helper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* ###Type### Form Field class for the ###Component### component
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class ###Type###Field extends UserField
|
||||
{
|
||||
/**
|
||||
* The ###type### field type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = '###Type###';
|
||||
|
||||
/**
|
||||
* Method to get the filtering groups (null means no filtering)
|
||||
*
|
||||
* @return mixed array of filtering groups or null.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getGroups()
|
||||
{
|
||||
###JFORM_GETGROUPS_PHP###
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the users to exclude from the list of users
|
||||
*
|
||||
* @return mixed Array of users to exclude or null to not exclude them
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getExcluded()
|
||||
{
|
||||
###JFORM_GETEXCLUDED_PHP###
|
||||
}
|
||||
}
|
135
admin/compiler/joomla_4/SITE_HEADERCHECK.php
Normal file
135
admin/compiler/joomla_4/SITE_HEADERCHECK.php
Normal file
@ -0,0 +1,135 @@
|
||||
<?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###\Site\Helper;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Document\Document;
|
||||
use Joomla\CMS\Application\CMSApplication;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Helper class for checking loaded scripts and styles in the document header.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class HeaderCheck
|
||||
{
|
||||
/**
|
||||
* @var CMSApplication Application object
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected CMSApplication $app;
|
||||
|
||||
/**
|
||||
* @var Document object
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Document $document;
|
||||
|
||||
/**
|
||||
* Construct the app and document
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
// Initializes the application object.
|
||||
$this->app ??= Factory::getApplication();
|
||||
|
||||
// Initializes the document object.
|
||||
$this->document = $this->app->getDocument();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a JavaScript file is loaded in the document head.
|
||||
*
|
||||
* @param string $scriptName Name of the script to check.
|
||||
*
|
||||
* @return bool True if the script is loaded, false otherwise.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function js_loaded(string $scriptName): bool
|
||||
{
|
||||
return $this->isLoaded($scriptName, 'scripts');
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a CSS file is loaded in the document head.
|
||||
*
|
||||
* @param string $scriptName Name of the stylesheet to check.
|
||||
*
|
||||
* @return bool True if the stylesheet is loaded, false otherwise.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function css_loaded(string $scriptName): bool
|
||||
{
|
||||
return $this->isLoaded($scriptName, 'styleSheets');
|
||||
}
|
||||
|
||||
/**
|
||||
* Abstract method to check if a given script or stylesheet is loaded.
|
||||
*
|
||||
* @param string $scriptName Name of the script or stylesheet.
|
||||
* @param string $type Type of asset to check ('scripts' or 'styleSheets').
|
||||
*
|
||||
* @return bool True if the asset is loaded, false otherwise.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
private function isLoaded(string $scriptName, string $type): bool
|
||||
{
|
||||
// UIkit specific check
|
||||
if ($this->isUIkit($scriptName))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
$head_data = $this->document->getHeadData();
|
||||
foreach (array_keys($head_data[$type]) as $script)
|
||||
{
|
||||
if (stristr($script, $scriptName))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for UIkit framework specific conditions.
|
||||
*
|
||||
* @param string $scriptName Name of the script or stylesheet.
|
||||
*
|
||||
* @return bool True if UIkit specific conditions are met, false otherwise.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
private function isUIkit(string $scriptName): bool
|
||||
{
|
||||
if (strpos($scriptName, 'uikit') !== false)
|
||||
{
|
||||
$get_template_name = $this->app->getTemplate('template')->template;
|
||||
if (strpos($get_template_name, 'yoo') !== false)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
926
admin/compiler/joomla_4/SITE_HELPER_CLASS.php
Normal file
926
admin/compiler/joomla_4/SITE_HELPER_CLASS.php
Normal file
@ -0,0 +1,926 @@
|
||||
<?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###\Site\Helper;
|
||||
|
||||
###SITE_POWER_HELPER###
|
||||
|
||||
###SITE_HELPER_CLASS_HEADER###
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* ###Component### component helper
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
abstract class ###Component###Helper
|
||||
{
|
||||
/**
|
||||
* Composer Switch
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected static $composer = [];
|
||||
|
||||
/**
|
||||
* The Main Active Language
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public static $langTag;###SITE_GLOBAL_EVENT_HELPER######SITE_CUSTOM_HELPER_SCRIPT######BOTH_CUSTOM_HELPER_SCRIPT###
|
||||
|
||||
/**
|
||||
* Load the Composer Vendors
|
||||
*/
|
||||
public static function composerAutoload($target)
|
||||
{
|
||||
// insure we load the composer vendor only once
|
||||
if (!isset(self::$composer[$target]))
|
||||
{
|
||||
// get the function name
|
||||
$functionName = Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe('compose' . $target);
|
||||
// check if method exist
|
||||
if (method_exists(__CLASS__, $functionName))
|
||||
{
|
||||
return self::{$functionName}();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return self::$composer[$target];
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a json object to a string
|
||||
*
|
||||
* @input string $value The json string to convert
|
||||
*
|
||||
* @returns a string
|
||||
* @deprecated 3.3 Use Super___4b225c51_d293_48e4_b3f6_5136cf5c3f18___Power::string(...);
|
||||
*/
|
||||
public static function jsonToString($value, $sperator = ", ", $table = null, $id = 'id', $name = 'name')
|
||||
{
|
||||
return Super___4b225c51_d293_48e4_b3f6_5136cf5c3f18___Power::string(
|
||||
$value,
|
||||
$sperator,
|
||||
$table,
|
||||
$id,
|
||||
$name
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the Component xml manifest.
|
||||
*/
|
||||
public static function manifest()
|
||||
{
|
||||
$manifestUrl = JPATH_ADMINISTRATOR."/components/com_###component###/###component###.xml";
|
||||
return simplexml_load_file($manifestUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Joomla version object
|
||||
*/
|
||||
protected static $JVersion;
|
||||
|
||||
/**
|
||||
* set/get Joomla version
|
||||
*/
|
||||
public static function jVersion()
|
||||
{
|
||||
// check if set
|
||||
if (!Super___91004529_94a9_4590_b842_e7c6b624ecf5___Power::check(self::$JVersion))
|
||||
{
|
||||
self::$JVersion = new Version();
|
||||
}
|
||||
return self::$JVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the Contributors details.
|
||||
*/
|
||||
public static function getContributors()
|
||||
{
|
||||
// get params
|
||||
$params = ComponentHelper::getParams('com_###component###');
|
||||
// start contributors array
|
||||
$contributors = [];
|
||||
// get all Contributors (max 20)
|
||||
$searchArray = range('0','20');
|
||||
foreach($searchArray as $nr)
|
||||
{
|
||||
if ((NULL !== $params->get("showContributor".$nr)) && ($params->get("showContributor".$nr) == 2 || $params->get("showContributor".$nr) == 3))
|
||||
{
|
||||
// set link based of selected option
|
||||
if($params->get("useContributor".$nr) == 1)
|
||||
{
|
||||
$link_front = '<a href="mailto:'.$params->get("emailContributor".$nr).'" target="_blank">';
|
||||
$link_back = '</a>';
|
||||
}
|
||||
elseif($params->get("useContributor".$nr) == 2)
|
||||
{
|
||||
$link_front = '<a href="'.$params->get("linkContributor".$nr).'" target="_blank">';
|
||||
$link_back = '</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$link_front = '';
|
||||
$link_back = '';
|
||||
}
|
||||
$contributors[$nr]['title'] = Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($params->get("titleContributor".$nr));
|
||||
$contributors[$nr]['name'] = $link_front.Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($params->get("nameContributor".$nr)).$link_back;
|
||||
}
|
||||
}
|
||||
return $contributors;
|
||||
}###HELP_SITE###
|
||||
|
||||
/**
|
||||
* Returns any Model object.
|
||||
*
|
||||
* @param string $type The model type to instantiate
|
||||
* @param string $prefix Prefix for the model class name. Optional.
|
||||
* @param string $component Component name the model belongs to. Optional.
|
||||
* @param array $config Configuration array for model. Optional.
|
||||
*
|
||||
* @return \Joomla\CMS\MVC\Model\BaseDatabaseModel
|
||||
* @throws \Exception
|
||||
* @since 4.4
|
||||
*/
|
||||
public static function getModel(string $type, string $prefix = 'Site',
|
||||
string $component = '###component###', array $config = [])
|
||||
{
|
||||
// make sure the name is correct
|
||||
$type = Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe($type, 'F');
|
||||
$component = strtolower($component);
|
||||
|
||||
if ($prefix !== 'Site' && $prefix !== 'Administrator')
|
||||
{
|
||||
$prefix = self::getPrefixFromModelPath($prefix);
|
||||
}
|
||||
|
||||
// Get the model through the MVCFactory
|
||||
return Factory::getApplication()->bootComponent('com_' . $component)->getMVCFactory()->createModel($type, $prefix, $config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the prefix from the model path
|
||||
*
|
||||
* @param string $path The model path
|
||||
*
|
||||
* @return string The prefix value
|
||||
* @since 4.4
|
||||
*/
|
||||
protected static function getPrefixFromModelPath(string $path): string
|
||||
{
|
||||
// Check if $path starts with JPATH_ADMINISTRATOR path
|
||||
if (str_starts_with($path, JPATH_ADMINISTRATOR . '/components/'))
|
||||
{
|
||||
return 'Administrator';
|
||||
}
|
||||
// Check if $path starts with JPATH_SITE path
|
||||
elseif (str_starts_with($path, JPATH_SITE . '/components/'))
|
||||
{
|
||||
return 'Site';
|
||||
}
|
||||
|
||||
return 'Site';
|
||||
}
|
||||
|
||||
/**
|
||||
* Add to asset Table
|
||||
*/
|
||||
public static function setAsset($id, $table, $inherit = true)
|
||||
{
|
||||
$parent = Table::getInstance('Asset');
|
||||
$parent->loadByName('com_###component###');
|
||||
|
||||
$parentId = $parent->id;
|
||||
$name = 'com_###component###.'.$table.'.'.$id;
|
||||
$title = '';
|
||||
|
||||
$asset = Table::getInstance('Asset');
|
||||
$asset->loadByName($name);
|
||||
|
||||
// Check for an error.
|
||||
$error = $asset->getError();
|
||||
|
||||
if ($error)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Specify how a new or moved node asset is inserted into the tree.
|
||||
if ($asset->parent_id != $parentId)
|
||||
{
|
||||
$asset->setLocation($parentId, 'last-child');
|
||||
}
|
||||
|
||||
// Prepare the asset to be stored.
|
||||
$asset->parent_id = $parentId;
|
||||
$asset->name = $name;
|
||||
$asset->title = $title;
|
||||
// get the default asset rules
|
||||
$rules = self::getDefaultAssetRules('com_###component###', $table, $inherit);
|
||||
if ($rules instanceof AccessRules)
|
||||
{
|
||||
$asset->rules = (string) $rules;
|
||||
}
|
||||
|
||||
if (!$asset->check() || !$asset->store())
|
||||
{
|
||||
Factory::getApplication()->enqueueMessage($asset->getError(), 'warning');
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Create an asset_id or heal one that is corrupted.
|
||||
$object = new \StdClass();
|
||||
|
||||
// Must be a valid primary key value.
|
||||
$object->id = $id;
|
||||
$object->asset_id = (int) $asset->id;
|
||||
|
||||
// Update their asset_id to link to the asset table.
|
||||
return Factory::getDbo()->updateObject('#__###component###_'.$table, $object, 'id');
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the default asset Rules for a component/view.
|
||||
*/
|
||||
protected static function getDefaultAssetRules($component, $view, $inherit = true)
|
||||
{
|
||||
// if new or inherited
|
||||
$assetId = 0;
|
||||
// Only get the actual item rules if not inheriting
|
||||
if (!$inherit)
|
||||
{
|
||||
// Need to find the asset id by the name of the component.
|
||||
$db = Factory::getContainer()->get(DatabaseInterface::class);
|
||||
$query = $db->getQuery(true)
|
||||
->select($db->quoteName('id'))
|
||||
->from($db->quoteName('#__assets'))
|
||||
->where($db->quoteName('name') . ' = ' . $db->quote($component));
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
// check that there is a value
|
||||
if ($db->getNumRows())
|
||||
{
|
||||
// asset already set so use saved rules
|
||||
$assetId = (int) $db->loadResult();
|
||||
}
|
||||
}
|
||||
// get asset rules
|
||||
$result = Access::getAssetRules($assetId);
|
||||
if ($result instanceof AccessRules)
|
||||
{
|
||||
$_result = (string) $result;
|
||||
$_result = json_decode($_result);
|
||||
foreach ($_result as $name => &$rule)
|
||||
{
|
||||
$v = explode('.', $name);
|
||||
if ($view !== $v[0])
|
||||
{
|
||||
// remove since it is not part of this view
|
||||
unset($_result->$name);
|
||||
}
|
||||
elseif ($inherit)
|
||||
{
|
||||
// clear the value since we inherit
|
||||
$rule = [];
|
||||
}
|
||||
}
|
||||
// check if there are any view values remaining
|
||||
if (count((array) $_result))
|
||||
{
|
||||
$_result = json_encode($_result);
|
||||
$_result = array($_result);
|
||||
// Instantiate and return the AccessRules object for the asset rules.
|
||||
$rules = new AccessRules($_result);
|
||||
// return filtered rules
|
||||
return $rules;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlAppend
|
||||
*
|
||||
* @param SimpleXMLElement $xml The XML element reference in which to inject a comment
|
||||
* @param mixed $node A SimpleXMLElement node to append to the XML element reference, or a stdClass object containing a comment attribute to be injected before the XML node and a fieldXML attribute containing a SimpleXMLElement
|
||||
*
|
||||
* @return void
|
||||
* @deprecated 3.3 Use Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::append($xml, $node);
|
||||
*/
|
||||
public static function xmlAppend(&$xml, $node)
|
||||
{
|
||||
Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::append($xml, $node);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlComment
|
||||
*
|
||||
* @param SimpleXMLElement $xml The XML element reference in which to inject a comment
|
||||
* @param string $comment The comment to inject
|
||||
*
|
||||
* @return void
|
||||
* @deprecated 3.3 Use Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::comment($xml, $comment);
|
||||
*/
|
||||
public static function xmlComment(&$xml, $comment)
|
||||
{
|
||||
Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::comment($xml, $comment);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlAddAttributes
|
||||
*
|
||||
* @param SimpleXMLElement $xml The XML element reference in which to inject a comment
|
||||
* @param array $attributes The attributes to apply to the XML element
|
||||
*
|
||||
* @return null
|
||||
* @deprecated 3.3 Use Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::attributes($xml, $attributes);
|
||||
*/
|
||||
public static function xmlAddAttributes(&$xml, $attributes = [])
|
||||
{
|
||||
Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::attributes($xml, $attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlAddOptions
|
||||
*
|
||||
* @param SimpleXMLElement $xml The XML element reference in which to inject a comment
|
||||
* @param array $options The options to apply to the XML element
|
||||
*
|
||||
* @return void
|
||||
* @deprecated 3.3 Use Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::options($xml, $options);
|
||||
*/
|
||||
public static function xmlAddOptions(&$xml, $options = [])
|
||||
{
|
||||
Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::options($xml, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* get the field object
|
||||
*
|
||||
* @param array $attributes The array of attributes
|
||||
* @param string $default The default of the field
|
||||
* @param array $options The options to apply to the XML element
|
||||
*
|
||||
* @return object
|
||||
* @deprecated 3.3 Use Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::field($attributes, $default, $options);
|
||||
*/
|
||||
public static function getFieldObject(&$attributes, $default = '', $options = null)
|
||||
{
|
||||
return Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::field($attributes, $default, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* get the field xml
|
||||
*
|
||||
* @param array $attributes The array of attributes
|
||||
* @param array $options The options to apply to the XML element
|
||||
*
|
||||
* @return object
|
||||
* @deprecated 3.3 Use Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::xml($attributes, $options);
|
||||
*/
|
||||
public static function getFieldXML(&$attributes, $options = null)
|
||||
{
|
||||
return Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::xml($attributes, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render Bool Button
|
||||
*
|
||||
* @param array $args All the args for the button
|
||||
* 0) name
|
||||
* 1) additional (options class) // not used at this time
|
||||
* 2) default
|
||||
* 3) yes (name)
|
||||
* 4) no (name)
|
||||
*
|
||||
* @return string The input html of the button
|
||||
*
|
||||
*/
|
||||
public static function renderBoolButton()
|
||||
{
|
||||
$args = func_get_args();
|
||||
// check if there is additional button class
|
||||
$additional = isset($args[1]) ? (string) $args[1] : ''; // not used at this time
|
||||
// button attributes
|
||||
$buttonAttributes = array(
|
||||
'type' => 'radio',
|
||||
'name' => isset($args[0]) ? Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($args[0]) : 'bool_button',
|
||||
'label' => isset($args[0]) ? Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe(Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($args[0]), 'Ww') : 'Bool Button', // not seen anyway
|
||||
'class' => 'btn-group',
|
||||
'filter' => 'INT',
|
||||
'default' => isset($args[2]) ? (int) $args[2] : 0);
|
||||
// set the button options
|
||||
$buttonOptions = array(
|
||||
'1' => isset($args[3]) ? Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($args[3]) : 'JYES',
|
||||
'0' => isset($args[4]) ? Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($args[4]) : 'JNO');
|
||||
// return the input
|
||||
return Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::field($buttonAttributes, $buttonAttributes['default'], $buttonOptions)->input;
|
||||
}###HELPER_UIKIT######HELPER_CREATEUSER###
|
||||
|
||||
/**
|
||||
* Get a variable
|
||||
*
|
||||
* @param string $table The table from which to get the variable
|
||||
* @param string $where The value where
|
||||
* @param string $whereString The target/field string where/name
|
||||
* @param string $what The return field
|
||||
* @param string $operator The operator between $whereString/field and $where/value
|
||||
* @param string $main The component in which the table is found
|
||||
*
|
||||
* @return mix string/int/float
|
||||
* @deprecated 3.3 Use Super___db87c339_5bb6_4291_a7ef_2c48ea1b06bc___Power::var(...);
|
||||
*/
|
||||
public static function getVar($table, $where = null, $whereString = 'user', $what = 'id', $operator = '=', $main = '###component###')
|
||||
{
|
||||
return Super___db87c339_5bb6_4291_a7ef_2c48ea1b06bc___Power::var(
|
||||
$table,
|
||||
$where,
|
||||
$whereString,
|
||||
$what,
|
||||
$operator,
|
||||
$main
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get array of variables
|
||||
*
|
||||
* @param string $table The table from which to get the variables
|
||||
* @param string $where The value where
|
||||
* @param string $whereString The target/field string where/name
|
||||
* @param string $what The return field
|
||||
* @param string $operator The operator between $whereString/field and $where/value
|
||||
* @param string $main The component in which the table is found
|
||||
* @param bool $unique The switch to return a unique array
|
||||
*
|
||||
* @return array
|
||||
* @deprecated 3.3 Use Super___db87c339_5bb6_4291_a7ef_2c48ea1b06bc___Power::vars(...);
|
||||
*/
|
||||
public static function getVars($table, $where = null, $whereString = 'user', $what = 'id', $operator = 'IN', $main = '###component###', $unique = true)
|
||||
{
|
||||
return Super___db87c339_5bb6_4291_a7ef_2c48ea1b06bc___Power::vars(
|
||||
$table,
|
||||
$where,
|
||||
$whereString,
|
||||
$what,
|
||||
$operator,
|
||||
$main,
|
||||
$unique
|
||||
);
|
||||
}
|
||||
|
||||
public static function isPublished($id,$type)
|
||||
{
|
||||
if ($type == 'raw')
|
||||
{
|
||||
$type = 'item';
|
||||
}
|
||||
$db = Factory::getContainer()->get(DatabaseInterface::class);
|
||||
$query = $db->getQuery(true);
|
||||
$query->select(array('a.published'));
|
||||
$query->from('#__###component###_'.$type.' AS a');
|
||||
$query->where('a.id = '. (int) $id);
|
||||
$query->where('a.published = 1');
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
$found = $db->getNumRows();
|
||||
if($found)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function getGroupName($id)
|
||||
{
|
||||
$db = Factory::getContainer()->get(DatabaseInterface::class);
|
||||
$query = $db->getQuery(true);
|
||||
$query->select(array('a.title'));
|
||||
$query->from('#__usergroups AS a');
|
||||
$query->where('a.id = '. (int) $id);
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
$found = $db->getNumRows();
|
||||
if($found)
|
||||
{
|
||||
return $db->loadResult();
|
||||
}
|
||||
return $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the action permissions
|
||||
*
|
||||
* @param string $view The related view name
|
||||
* @param int $record The item to act upon
|
||||
* @param string $views The related list view name
|
||||
* @param mixed $target Only get this permission (like edit, create, delete)
|
||||
* @param string $component The target component
|
||||
* @param object $user The user whose permissions we are loading
|
||||
*
|
||||
* @return object The CMSObject of permission/authorised actions
|
||||
*
|
||||
*/
|
||||
public static function getActions($view, &$record = null, $views = null, $target = null, $component = '###component###', $user = 'null')
|
||||
{
|
||||
// load the user if not given
|
||||
if (!Super___91004529_94a9_4590_b842_e7c6b624ecf5___Power::check($user))
|
||||
{
|
||||
// get the user object
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
}
|
||||
// load the CMSObject
|
||||
$result = new CMSObject;
|
||||
// make view name safe (just incase)
|
||||
$view = Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe($view);
|
||||
if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($views))
|
||||
{
|
||||
$views = Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe($views);
|
||||
}
|
||||
// get all actions from component
|
||||
$actions = Access::getActionsFromFile(
|
||||
JPATH_ADMINISTRATOR . '/components/com_' . $component . '/access.xml',
|
||||
"/access/section[@name='component']/"
|
||||
);
|
||||
// if non found then return empty CMSObject
|
||||
if (empty($actions))
|
||||
{
|
||||
return $result;
|
||||
}
|
||||
// get created by if not found
|
||||
if (Super___91004529_94a9_4590_b842_e7c6b624ecf5___Power::check($record) && !isset($record->created_by) && isset($record->id))
|
||||
{
|
||||
$record->created_by = Super___db87c339_5bb6_4291_a7ef_2c48ea1b06bc___Power::var($view, $record->id, 'id', 'created_by', '=', $component);
|
||||
}
|
||||
// set actions only set in component settings
|
||||
$componentActions = array('core.admin', 'core.manage', 'core.options', 'core.export');
|
||||
// check if we have a target
|
||||
$checkTarget = false;
|
||||
if ($target)
|
||||
{
|
||||
// convert to an array
|
||||
if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($target))
|
||||
{
|
||||
$target = array($target);
|
||||
}
|
||||
// check if we are good to go
|
||||
if (Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($target))
|
||||
{
|
||||
$checkTarget = true;
|
||||
}
|
||||
}
|
||||
// loop the actions and set the permissions
|
||||
foreach ($actions as $action)
|
||||
{
|
||||
// check target action filter
|
||||
if ($checkTarget && self::filterActions($view, $action->name, $target))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// set to use component default
|
||||
$fallback = true;
|
||||
// reset permission per/action
|
||||
$permission = false;
|
||||
$catpermission = false;
|
||||
// set area
|
||||
$area = 'comp';
|
||||
// check if the record has an ID and the action is item related (not a component action)
|
||||
if (Super___91004529_94a9_4590_b842_e7c6b624ecf5___Power::check($record) && isset($record->id) && $record->id > 0 && !in_array($action->name, $componentActions) &&
|
||||
(strpos($action->name, 'core.') !== false || strpos($action->name, $view . '.') !== false))
|
||||
{
|
||||
// we are in item
|
||||
$area = 'item';
|
||||
// The record has been set. Check the record permissions.
|
||||
$permission = $user->authorise($action->name, 'com_' . $component . '.' . $view . '.' . (int) $record->id);
|
||||
// if no permission found, check edit own
|
||||
if (!$permission)
|
||||
{
|
||||
// With edit, if the created_by matches current user then dig deeper.
|
||||
if (($action->name === 'core.edit' || $action->name === $view . '.edit') && $record->created_by > 0 && ($record->created_by == $user->id))
|
||||
{
|
||||
// the correct target
|
||||
$coreCheck = (array) explode('.', $action->name);
|
||||
// check that we have both local and global access
|
||||
if ($user->authorise($coreCheck[0] . '.edit.own', 'com_' . $component . '.' . $view . '.' . (int) $record->id) &&
|
||||
$user->authorise($coreCheck[0] . '.edit.own', 'com_' . $component))
|
||||
{
|
||||
// allow edit
|
||||
$result->set($action->name, true);
|
||||
// set not to use global default
|
||||
// because we already validated it
|
||||
$fallback = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// do not allow edit
|
||||
$result->set($action->name, false);
|
||||
$fallback = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($views) && isset($record->catid) && $record->catid > 0)
|
||||
{
|
||||
// we are in item
|
||||
$area = 'category';
|
||||
// set the core check
|
||||
$coreCheck = explode('.', $action->name);
|
||||
$core = $coreCheck[0];
|
||||
// make sure we use the core. action check for the categories
|
||||
if (strpos($action->name, $view) !== false && strpos($action->name, 'core.') === false )
|
||||
{
|
||||
$coreCheck[0] = 'core';
|
||||
$categoryCheck = implode('.', $coreCheck);
|
||||
}
|
||||
else
|
||||
{
|
||||
$categoryCheck = $action->name;
|
||||
}
|
||||
// The record has a category. Check the category permissions.
|
||||
$catpermission = $user->authorise($categoryCheck, 'com_' . $component . '.' . $views . '.category.' . (int) $record->catid);
|
||||
if (!$catpermission && !is_null($catpermission))
|
||||
{
|
||||
// With edit, if the created_by matches current user then dig deeper.
|
||||
if (($action->name === 'core.edit' || $action->name === $view . '.edit') && $record->created_by > 0 && ($record->created_by == $user->id))
|
||||
{
|
||||
// check that we have both local and global access
|
||||
if ($user->authorise('core.edit.own', 'com_' . $component . '.' . $views . '.category.' . (int) $record->catid) &&
|
||||
$user->authorise($core . '.edit.own', 'com_' . $component))
|
||||
{
|
||||
// allow edit
|
||||
$result->set($action->name, true);
|
||||
// set not to use global default
|
||||
// because we already validated it
|
||||
$fallback = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// do not allow edit
|
||||
$result->set($action->name, false);
|
||||
$fallback = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// if allowed then fallback on component global settings
|
||||
if ($fallback)
|
||||
{
|
||||
// if item/category blocks access then don't fall back on global
|
||||
if ((($area === 'item') && !$permission) || (($area === 'category') && !$catpermission))
|
||||
{
|
||||
// do not allow
|
||||
$result->set($action->name, false);
|
||||
}
|
||||
// Finally remember the global settings have the final say. (even if item allow)
|
||||
// The local item permissions can block, but it can't open and override of global permissions.
|
||||
// Since items are created by users and global permissions is set by system admin.
|
||||
else
|
||||
{
|
||||
$result->set($action->name, $user->authorise($action->name, 'com_' . $component));
|
||||
}
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the action permissions
|
||||
*
|
||||
* @param string $action The action to check
|
||||
* @param array $targets The array of target actions
|
||||
*
|
||||
* @return boolean true if action should be filtered out
|
||||
*
|
||||
*/
|
||||
protected static function filterActions(&$view, &$action, &$targets)
|
||||
{
|
||||
foreach ($targets as $target)
|
||||
{
|
||||
if (strpos($action, $view . '.' . $target) !== false ||
|
||||
strpos($action, 'core.' . $target) !== false)
|
||||
{
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if have an json string
|
||||
*
|
||||
* @input string The json string to check
|
||||
*
|
||||
* @returns bool true on success
|
||||
* @deprecated 3.3 Use Super___4b225c51_d293_48e4_b3f6_5136cf5c3f18___Power::check($string);
|
||||
*/
|
||||
public static function checkJson($string)
|
||||
{
|
||||
return Super___4b225c51_d293_48e4_b3f6_5136cf5c3f18___Power::check($string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if have an object with a length
|
||||
*
|
||||
* @input object The object to check
|
||||
*
|
||||
* @returns bool true on success
|
||||
* @deprecated 3.3 Use Super___91004529_94a9_4590_b842_e7c6b624ecf5___Power::check($object);
|
||||
*/
|
||||
public static function checkObject($object)
|
||||
{
|
||||
return Super___91004529_94a9_4590_b842_e7c6b624ecf5___Power::check($object);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if have an array with a length
|
||||
*
|
||||
* @input array The array to check
|
||||
*
|
||||
* @returns bool/int number of items in array on success
|
||||
* @deprecated 3.3 Use Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($array, $removeEmptyString);
|
||||
*/
|
||||
public static function checkArray($array, $removeEmptyString = false)
|
||||
{
|
||||
return Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($array, $removeEmptyString);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if have a string with a length
|
||||
*
|
||||
* @input string The string to check
|
||||
*
|
||||
* @returns bool true on success
|
||||
* @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($string);
|
||||
*/
|
||||
public static function checkString($string)
|
||||
{
|
||||
return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if we are connected
|
||||
* Thanks https://stackoverflow.com/a/4860432/1429677
|
||||
*
|
||||
* @returns bool true on success
|
||||
*/
|
||||
public static function isConnected()
|
||||
{
|
||||
// If example.com is down, then probably the whole internet is down, since IANA maintains the domain. Right?
|
||||
$connected = @fsockopen("www.example.com", 80);
|
||||
// website, port (try 80 or 443)
|
||||
if ($connected)
|
||||
{
|
||||
//action when connected
|
||||
$is_conn = true;
|
||||
fclose($connected);
|
||||
}
|
||||
else
|
||||
{
|
||||
//action in connection failure
|
||||
$is_conn = false;
|
||||
}
|
||||
return $is_conn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge an array of array's
|
||||
*
|
||||
* @input array The arrays you would like to merge
|
||||
*
|
||||
* @returns array on success
|
||||
* @deprecated 3.3 Use Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::merge($arrays);
|
||||
*/
|
||||
public static function mergeArrays($arrays)
|
||||
{
|
||||
return Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::merge($arrays);
|
||||
}
|
||||
|
||||
// typo sorry!
|
||||
public static function sorten($string, $length = 40, $addTip = true)
|
||||
{
|
||||
return self::shorten($string, $length, $addTip);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shorten a string
|
||||
*
|
||||
* @input string The you would like to shorten
|
||||
*
|
||||
* @returns string on success
|
||||
* @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::shorten(...);
|
||||
*/
|
||||
public static function shorten($string, $length = 40, $addTip = true)
|
||||
{
|
||||
return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::shorten($string, $length, $addTip);
|
||||
}
|
||||
|
||||
/**
|
||||
* Making strings safe (various ways)
|
||||
*
|
||||
* @input string The you would like to make safe
|
||||
*
|
||||
* @returns string on success
|
||||
* @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe(...);
|
||||
*/
|
||||
public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true, $keepOnlyCharacters = true)
|
||||
{
|
||||
return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe(
|
||||
$string,
|
||||
$type,
|
||||
$spacer,
|
||||
$replaceNumbers,
|
||||
$keepOnlyCharacters
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert none English strings to code usable string
|
||||
*
|
||||
* @input an string
|
||||
*
|
||||
* @returns a string
|
||||
* @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::transliterate($string);
|
||||
*/
|
||||
public static function transliterate($string)
|
||||
{
|
||||
return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::transliterate($string);
|
||||
}
|
||||
|
||||
/**
|
||||
* make sure a string is HTML save
|
||||
*
|
||||
* @input an html string
|
||||
*
|
||||
* @returns a string
|
||||
* @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html(...);
|
||||
*/
|
||||
public static function htmlEscape($var, $charset = 'UTF-8', $shorten = false, $length = 40)
|
||||
{
|
||||
return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html(
|
||||
$var,
|
||||
$charset,
|
||||
$shorten,
|
||||
$length
|
||||
);
|
||||
}###HELPER_SITE_LICENSE_LOCK###
|
||||
|
||||
/**
|
||||
* Convert all int in a string to an English word string
|
||||
*
|
||||
* @input an string with numbers
|
||||
*
|
||||
* @returns a string
|
||||
* @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::numbers($string);
|
||||
*/
|
||||
public static function replaceNumbers($string)
|
||||
{
|
||||
return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::numbers($string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert an integer into an English word string
|
||||
* Thanks to Tom Nicholson <http://php.net/manual/en/function.strval.php#41988>
|
||||
*
|
||||
* @input an int
|
||||
* @returns a string
|
||||
* @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::number($x);
|
||||
*/
|
||||
public static function numberToString($x)
|
||||
{
|
||||
return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::number($x);
|
||||
}
|
||||
|
||||
/**
|
||||
* Random Key
|
||||
*
|
||||
* @returns a string
|
||||
* @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::random($size);
|
||||
*/
|
||||
public static function randomkey($size)
|
||||
{
|
||||
return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::random($size);
|
||||
}###GET_CRYPT_KEY###
|
||||
}
|
129
admin/compiler/joomla_4/SITE_HELPER_CONTROLLER.php
Normal file
129
admin/compiler/joomla_4/SITE_HELPER_CONTROLLER.php
Normal file
@ -0,0 +1,129 @@
|
||||
<?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###\Site\Controller;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\MVC\Controller\BaseController;
|
||||
use Joomla\Database\DatabaseInterface;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* ###Component### Help Base Controller
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class HelpController extends BaseController
|
||||
{
|
||||
public function __construct($config)
|
||||
{
|
||||
parent::__construct($config);
|
||||
// load the tasks
|
||||
$this->registerTask('getText', 'help');
|
||||
}
|
||||
|
||||
public function help()
|
||||
{
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
$jinput = Factory::getApplication()->input;
|
||||
// Check Token!
|
||||
$token = Session::getFormToken();
|
||||
$call_token = $jinput->get('token', 0, 'ALNUM');
|
||||
if($user->id != 0 && ($jinput->get($token, 0, 'ALNUM') || $token === $call_token))
|
||||
{
|
||||
$task = $this->getTask();
|
||||
switch($task){
|
||||
case 'getText':
|
||||
try
|
||||
{
|
||||
$idValue = $jinput->get('id', 0, 'INT');
|
||||
if($idValue)
|
||||
{
|
||||
$result = $this->getHelpDocumentText($idValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = '';
|
||||
}
|
||||
echo $result;
|
||||
// stop execution gracefully
|
||||
jexit();
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
// stop execution gracefully
|
||||
jexit();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// stop execution gracefully
|
||||
jexit();
|
||||
}
|
||||
}
|
||||
|
||||
protected function getHelpDocumentText($id)
|
||||
{
|
||||
$db = Factory::getContainer()->get(DatabaseInterface::class);
|
||||
$query = $db->getQuery(true);
|
||||
$query->select(array('a.title','a.content'));
|
||||
$query->from('#__###component###_help_document AS a');
|
||||
$query->where('a.id = '.(int) $id);
|
||||
$query->where('a.published = 1');
|
||||
$query->where('a.location = 2');
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
if($db->getNumRows())
|
||||
{
|
||||
$text = [];
|
||||
$document = $db->loadObject();
|
||||
// fix image issue
|
||||
$images['src="images'] = 'src="'.Uri::root().'images';
|
||||
$images["src='images"] = "src='".Uri::root()."images";
|
||||
$images['src="/images'] = 'src="'.Uri::root().'images';
|
||||
$images["src='/images"] = "src='".Uri::root()."images";
|
||||
// set document template
|
||||
$text[] = "<!doctype html>";
|
||||
$text[] = '<html>';
|
||||
$text[] = "<head>";
|
||||
$text[] = '<meta charset="utf-8">';
|
||||
$text[] = "<title>".$document->title."</title>";
|
||||
$text[] = '<link type="text/css" href="'.Uri::root().'media/com_###component###/uikit/css/uikit.gradient.min.css" rel="stylesheet"></link>';
|
||||
$text[] = '<script type="text/javascript" src="'.Uri::root().'media/com_###component###/uikit/js/uikit.min.js"></script>';
|
||||
$text[] = "</head>";
|
||||
$text[] = '<body><br />';
|
||||
$text[] = '<div class="uk-container uk-container-center uk-grid-collapse">';
|
||||
$text[] = '<div class="uk-panel uk-width-1-1 uk-panel-box uk-panel-box-primary">';
|
||||
// build the help text
|
||||
$text[] = '<h1 class="uk-panel-title">'.$document->title."</h1>";
|
||||
$text[] = str_replace(array_keys($images),array_values($images),$document->content);
|
||||
// end template
|
||||
$text[] = '</div><br /><br />';
|
||||
$text[] = '</div>';
|
||||
$text[] = "</body>";
|
||||
$text[] = "</html>";
|
||||
|
||||
return implode("\n",$text);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
22
admin/compiler/joomla_4/SITE_LAYOUT.php
Normal file
22
admin/compiler/joomla_4/SITE_LAYOUT.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?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###
|
||||
|
||||
###SITE_LAYOUT_HEADER###
|
||||
|
||||
// No direct access to this file
|
||||
defined('JPATH_BASE') or die;###SITE_LAYOUT_CODE###
|
||||
|
||||
?>###SITE_LAYOUT_BODY###
|
97
admin/compiler/joomla_4/SITE_ROUTER.php
Normal file
97
admin/compiler/joomla_4/SITE_ROUTER.php
Normal file
@ -0,0 +1,97 @@
|
||||
<?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###\Site\Service;
|
||||
|
||||
###SITE_ROUTER_HEADER###
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Router class for the ###Component_name### Component
|
||||
*
|
||||
* @since 3.10
|
||||
*/
|
||||
class Router extends RouterView
|
||||
{
|
||||
/**
|
||||
* Flag to remove IDs
|
||||
*
|
||||
* @var boolean
|
||||
* @since 4.0.0
|
||||
*/
|
||||
protected $noIDs = false;
|
||||
|
||||
/**
|
||||
* The category factory
|
||||
*
|
||||
* @var CategoryFactoryInterface
|
||||
* @since 4.0.0
|
||||
*/
|
||||
private $categoryFactory;
|
||||
|
||||
/**
|
||||
* The category cache
|
||||
*
|
||||
* @var array
|
||||
* @since 4.0.0
|
||||
*/
|
||||
private $categoryCache = [];
|
||||
|
||||
/**
|
||||
* The db
|
||||
*
|
||||
* @var DatabaseInterface
|
||||
* @since 4.0.0
|
||||
*/
|
||||
private $db;
|
||||
|
||||
/**
|
||||
* The component params
|
||||
*
|
||||
* @var Registry
|
||||
* @since 4.0.0
|
||||
*/
|
||||
private $params;
|
||||
|
||||
/**
|
||||
* ###Component### Component router constructor
|
||||
*
|
||||
* @param SiteApplication $app The application object
|
||||
* @param AbstractMenu $menu The menu object to work with
|
||||
* @param CategoryFactoryInterface $categoryFactory The category object
|
||||
* @param DatabaseInterface $db The database object
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public function __construct(
|
||||
SiteApplication $app,
|
||||
AbstractMenu $menu,
|
||||
CategoryFactoryInterface $categoryFactory,
|
||||
DatabaseInterface $db)
|
||||
{
|
||||
$this->categoryFactory = $categoryFactory;
|
||||
$this->db = $db;
|
||||
$this->params = ComponentHelper::getParams('com_###component###');
|
||||
$this->noIDs = (bool) $this->params->get('sef_ids', false);###SITE_ROUTER_CONSTRUCTOR_BEFORE_PARENT###
|
||||
|
||||
parent::__construct($app, $menu);###SITE_ROUTER_CONSTRUCTOR_AFTER_PARENT###
|
||||
|
||||
$this->attachRule(new MenuRules($this));
|
||||
$this->attachRule(new StandardRules($this));
|
||||
$this->attachRule(new NomenuRules($this));
|
||||
}###SITE_ROUTER_METHODS###
|
||||
}
|
141
admin/compiler/joomla_4/SITE_ROUTE_HELPER.php
Normal file
141
admin/compiler/joomla_4/SITE_ROUTE_HELPER.php
Normal file
@ -0,0 +1,141 @@
|
||||
<?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###\Site\Helper;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Language\Multilanguage;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\Categories\CategoryNode;
|
||||
use Joomla\CMS\Categories\Categories;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* ###Component### Component Route Helper
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
abstract class RouteHelper
|
||||
{
|
||||
protected static $lookup;###ROUTEHELPER###
|
||||
|
||||
protected static function _findItem($needles = null,$type = null)
|
||||
{
|
||||
$app = Factory::getApplication();
|
||||
$menus = $app->getMenu('site');
|
||||
$language = isset($needles['language']) ? $needles['language'] : '*';
|
||||
|
||||
// Prepare the reverse lookup array.
|
||||
if (!isset(self::$lookup[$language]))
|
||||
{
|
||||
self::$lookup[$language] = [];
|
||||
|
||||
$component = ComponentHelper::getComponent('com_###component###');
|
||||
|
||||
$attributes = array('component_id');
|
||||
$values = array($component->id);
|
||||
|
||||
if ($language != '*')
|
||||
{
|
||||
$attributes[] = 'language';
|
||||
$values[] = array($needles['language'], '*');
|
||||
}
|
||||
|
||||
$items = $menus->getItems($attributes, $values);
|
||||
|
||||
foreach ($items as $item)
|
||||
{
|
||||
if (isset($item->query) && isset($item->query['view']))
|
||||
{
|
||||
$view = $item->query['view'];
|
||||
|
||||
if (!isset(self::$lookup[$language][$view]))
|
||||
{
|
||||
self::$lookup[$language][$view] = [];
|
||||
}
|
||||
|
||||
if (isset($item->query['id']))
|
||||
{
|
||||
/**
|
||||
* Here it will become a bit tricky
|
||||
* language != * can override existing entries
|
||||
* language == * cannot override existing entries
|
||||
*/
|
||||
if (!isset(self::$lookup[$language][$view][$item->query['id']]) || $item->language != '*')
|
||||
{
|
||||
self::$lookup[$language][$view][$item->query['id']] = $item->id;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
self::$lookup[$language][$view][0] = $item->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($needles)
|
||||
{
|
||||
foreach ($needles as $view => $ids)
|
||||
{
|
||||
if (isset(self::$lookup[$language][$view]))
|
||||
{
|
||||
if (Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($ids))
|
||||
{
|
||||
foreach ($ids as $id)
|
||||
{
|
||||
if (isset(self::$lookup[$language][$view][(int) $id]))
|
||||
{
|
||||
return self::$lookup[$language][$view][(int) $id];
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (isset(self::$lookup[$language][$view][0]))
|
||||
{
|
||||
return self::$lookup[$language][$view][0];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($type)
|
||||
{
|
||||
// Check if the global menu item has been set.
|
||||
$params = ComponentHelper::getParams('com_###component###');
|
||||
if ($item = $params->get($type.'_menu', 0))
|
||||
{
|
||||
return $item;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the active menuitem matches the requested language
|
||||
$active = $menus->getActive();
|
||||
|
||||
if ($active
|
||||
&& $active->component == 'com_###component###'
|
||||
&& ($language == '*' || in_array($active->language, array('*', $language)) || !Multilanguage::isEnabled()))
|
||||
{
|
||||
return $active->id;
|
||||
}
|
||||
|
||||
// If not found, return language specific home link
|
||||
$default = $menus->getDefault($language);
|
||||
|
||||
return !empty($default->id) ? $default->id : null;
|
||||
}
|
||||
}
|
23
admin/compiler/joomla_4/SITE_VIEW.php
Normal file
23
admin/compiler/joomla_4/SITE_VIEW.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?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###
|
||||
|
||||
###SITE_VIEW_HEADER###
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED######SITE_CODE_BODY###
|
||||
|
||||
?>
|
||||
###SITE_TOP_FORM######SITE_TOP_BUTTON######SITE_BODY######SITE_BOTTOM_BUTTON######SITE_BOTTOM_FORM###
|
23
admin/compiler/joomla_4/SITE_VIEWS.php
Normal file
23
admin/compiler/joomla_4/SITE_VIEWS.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?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###
|
||||
|
||||
###SITE_VIEWS_HEADER###
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED######SITE_CODE_BODY###
|
||||
|
||||
?>
|
||||
###SITE_TOP_FORM######SITE_TOP_BUTTON######SITE_BODY######SITE_BOTTOM_BUTTON######SITE_BOTTOM_FORM###
|
108
admin/compiler/joomla_4/SITE_VIEWS_HTML.php
Normal file
108
admin/compiler/joomla_4/SITE_VIEWS_HTML.php
Normal file
@ -0,0 +1,108 @@
|
||||
<?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###\Site\View\###SViews###;
|
||||
|
||||
###SITE_VIEWS_HTML_HEADER######SITE_GET_MODULE_JIMPORT###
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED###
|
||||
|
||||
/**
|
||||
* ###Component### Html View class for the ###SViews###
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class HtmlView extends BaseHtmlView
|
||||
{
|
||||
/**
|
||||
* Display the view
|
||||
*
|
||||
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
public function display($tpl = null)
|
||||
{
|
||||
// get combined params of both component and menu
|
||||
$this->app ??= Factory::getApplication();
|
||||
$this->params = $this->app->getParams();
|
||||
$this->menu = $this->app->getMenu()->getActive();
|
||||
$this->styles = $this->get('Styles');
|
||||
$this->scripts = $this->get('Scripts');
|
||||
// get the user object
|
||||
$this->user ??= $this->app->getIdentity();###SITE_DIPLAY_METHOD###
|
||||
}###SITE_EXTRA_DIPLAY_METHODS###
|
||||
|
||||
/**
|
||||
* Prepare some document related stuff.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function _prepareDocument(): void
|
||||
{###SITE_LIBRARIES_LOADER######SITE_UIKIT_LOADER######SITE_GOOGLECHART_LOADER######SITE_FOOTABLE_LOADER######SITE_DOCUMENT_METADATA######SITE_DOCUMENT_CUSTOM_PHP###
|
||||
// add styles
|
||||
foreach ($this->styles as $style)
|
||||
{
|
||||
Html::_('stylesheet', $style, ['version' => 'auto']);
|
||||
}###SITE_DOCUMENT_CUSTOM_CSS###
|
||||
// add scripts
|
||||
foreach ($this->scripts as $script)
|
||||
{
|
||||
Html::_('script', $script, ['version' => 'auto']);
|
||||
}###SITE_DOCUMENT_CUSTOM_JS######SITE_JAVASCRIPT_FOR_BUTTONS###
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the page title and toolbar.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function addToolbar(): void
|
||||
{###SITE_CUSTOM_BUTTONS###
|
||||
|
||||
// set help url for this view if found
|
||||
$this->help_url = ###Component###Helper::getHelpUrl('###sviews###');
|
||||
if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($this->help_url))
|
||||
{
|
||||
ToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url);
|
||||
}
|
||||
// now initiate the toolbar
|
||||
$this->toolbar = Toolbar::getInstance();
|
||||
}###SITE_GET_MODULE###
|
||||
|
||||
/**
|
||||
* Escapes a value for output in a view script.
|
||||
*
|
||||
* @param mixed $var The output to escape.
|
||||
* @param bool $shorten The switch to shorten.
|
||||
* @param int $length The shorting length.
|
||||
*
|
||||
* @return mixed The escaped value.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function escape($var, bool $shorten = false, int $length = 40)
|
||||
{
|
||||
if (!is_string($var))
|
||||
{
|
||||
return $var;
|
||||
}
|
||||
|
||||
return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
|
||||
}
|
||||
}
|
212
admin/compiler/joomla_4/SITE_VIEWS_MODEL.php
Normal file
212
admin/compiler/joomla_4/SITE_VIEWS_MODEL.php
Normal file
@ -0,0 +1,212 @@
|
||||
<?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###\Site\Model;
|
||||
|
||||
###SITE_VIEWS_MODEL_HEADER###
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* ###Component### List Model for ###SViews###
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class ###SViews###Model extends ListModel
|
||||
{
|
||||
/**
|
||||
* Represents the current user object.
|
||||
*
|
||||
* @var User The user object representing the current user.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected User $user;
|
||||
|
||||
/**
|
||||
* The unique identifier of the current user.
|
||||
*
|
||||
* @var int|null The ID of the current user.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ?int $userId;
|
||||
|
||||
/**
|
||||
* Flag indicating whether the current user is a guest.
|
||||
*
|
||||
* @var int 1 if the user is a guest, 0 otherwise.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected int $guest;
|
||||
|
||||
/**
|
||||
* An array of groups that the current user belongs to.
|
||||
*
|
||||
* @var array|null An array of user group IDs.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ?array $groups;
|
||||
|
||||
/**
|
||||
* An array of view access levels for the current user.
|
||||
*
|
||||
* @var array|null An array of access level IDs.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ?array $levels;
|
||||
|
||||
/**
|
||||
* The application object.
|
||||
*
|
||||
* @var CMSApplicationInterface The application instance.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected CMSApplicationInterface $app;
|
||||
|
||||
/**
|
||||
* The input object, providing access to the request data.
|
||||
*
|
||||
* @var Input The input object.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Input $input;
|
||||
|
||||
/**
|
||||
* The styles array.
|
||||
*
|
||||
* @var array
|
||||
* @since 4.3
|
||||
*/
|
||||
protected array $styles = [
|
||||
'components/com_###component###/assets/css/site.css',
|
||||
'components/com_###component###/assets/css/###sview###.css'
|
||||
];
|
||||
|
||||
/**
|
||||
* The scripts array.
|
||||
*
|
||||
* @var array
|
||||
* @since 4.3
|
||||
*/
|
||||
protected array $scripts = [
|
||||
'components/com_###component###/assets/js/site.js'
|
||||
];
|
||||
|
||||
/**
|
||||
* A custom property for UIKit components. (not used unless you load v2)
|
||||
*/
|
||||
protected $uikitComp;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param array $config An array of configuration options (name, state, dbo, table_path, ignore_request).
|
||||
* @param ?MVCFactoryInterface $factory The factory.
|
||||
*
|
||||
* @since 1.6
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function __construct($config = [], MVCFactoryInterface $factory = null)
|
||||
{
|
||||
parent::__construct($config, $factory);
|
||||
|
||||
$this->app ??= Factory::getApplication();
|
||||
$this->input ??= $this->app->getInput();
|
||||
|
||||
// Set the current user for authorisation checks (for those calling this model directly)
|
||||
$this->user ??= $this->getCurrentUser();
|
||||
$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();
|
||||
|
||||
// will be removed
|
||||
$this->initSet = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to build an SQL query to load the list data.
|
||||
*
|
||||
* @return string An SQL query
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getListQuery()
|
||||
{###SITE_GET_LIST_QUERY###
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get an array of data items.
|
||||
*
|
||||
* @return mixed An array of data items on success, false on failure.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getItems()
|
||||
{
|
||||
$user = $this->user;###USER_PERMISSION_CHECK_ACCESS######LICENSE_LOCKED_CHECK######SITE_BEFORE_GET_ITEMS###
|
||||
// load parent items
|
||||
$items = parent::getItems();
|
||||
|
||||
// Get the global params
|
||||
$globalParams = ComponentHelper::getParams('com_###component###', true);###SITE_GET_ITEMS######SITE_AFTER_GET_ITEMS###
|
||||
|
||||
// return items
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the styles that have to be included on the view
|
||||
*
|
||||
* @return array styles files
|
||||
* @since 4.3
|
||||
*/
|
||||
public function getStyles(): array
|
||||
{
|
||||
return $this->styles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to set the styles that have to be included on the view
|
||||
*
|
||||
* @return void
|
||||
* @since 4.3
|
||||
*/
|
||||
public function setStyles(string $path): void
|
||||
{
|
||||
$this->styles[] = $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the script that have to be included on the view
|
||||
*
|
||||
* @return array script files
|
||||
* @since 4.3
|
||||
*/
|
||||
public function getScripts(): array
|
||||
{
|
||||
return $this->scripts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to set the script that have to be included on the view
|
||||
*
|
||||
* @return void
|
||||
* @since 4.3
|
||||
*/
|
||||
public function setScript(string $path): void
|
||||
{
|
||||
$this->scripts[] = $path;
|
||||
}###LICENSE_LOCKED_SET_BOOL######SITE_CUSTOM_METHODS######SITE_CUSTOM_BUTTONS_METHOD###
|
||||
}
|
120
admin/compiler/joomla_4/SITE_VIEW_CONTROLLER.php
Normal file
120
admin/compiler/joomla_4/SITE_VIEW_CONTROLLER.php
Normal file
@ -0,0 +1,120 @@
|
||||
<?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###\Site\Controller;
|
||||
|
||||
###SITE_VIEW_CONTROLLER_HEADER###
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* ###Component### ###SView### Form Controller
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class ###SView###Controller extends FormController
|
||||
{
|
||||
/**
|
||||
* The prefix to use with controller messages.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $text_prefix = 'COM_###COMPONENT###';
|
||||
|
||||
/**
|
||||
* Current or most recently performed task.
|
||||
*
|
||||
* @var string
|
||||
* @since 12.2
|
||||
* @note Replaces _task.
|
||||
*/
|
||||
protected $task;
|
||||
|
||||
/**
|
||||
* The URL view list variable.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $view_list = '###SITE_DEFAULT_VIEW###';###SITE_CUSTOM_BUTTONS_CONTROLLER###
|
||||
|
||||
/**
|
||||
* Method to check if you can edit an existing record.
|
||||
*
|
||||
* Extended classes can override this if necessary.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
* @param string $key The name of the key for the primary key; default is id.
|
||||
*
|
||||
* @return boolean
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
protected function allowEdit($data = [], $key = 'id')
|
||||
{
|
||||
// to insure no other tampering
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can add a new record.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
*
|
||||
* @return boolean
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function allowAdd($data = [])
|
||||
{
|
||||
// to insure no other tampering
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to check if you can save a new or existing record.
|
||||
*
|
||||
* Extended classes can override this if necessary.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
* @param string $key The name of the key for the primary key.
|
||||
*
|
||||
* @return boolean
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
protected function allowSave($data, $key = 'id')
|
||||
{
|
||||
// to insure no other tampering
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function that allows child controller access to model data
|
||||
* after the data has been saved.
|
||||
*
|
||||
* @param JModelLegacy $model The data model object.
|
||||
* @param array $validData The validated data.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
protected function postSaveHook(JModelLegacy $model, $validData = [])
|
||||
{
|
||||
}
|
||||
}
|
108
admin/compiler/joomla_4/SITE_VIEW_HTML.php
Normal file
108
admin/compiler/joomla_4/SITE_VIEW_HTML.php
Normal file
@ -0,0 +1,108 @@
|
||||
<?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###\Site\View\###SView###;
|
||||
|
||||
###SITE_VIEW_HTML_HEADER######SITE_GET_MODULE_JIMPORT###
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED###
|
||||
|
||||
/**
|
||||
* ###Component### Html View class for the ###SView###
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class HtmlView extends BaseHtmlView
|
||||
{
|
||||
/**
|
||||
* Display the view
|
||||
*
|
||||
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
public function display($tpl = null)
|
||||
{
|
||||
// get combined params of both component and menu
|
||||
$this->app ??= Factory::getApplication();
|
||||
$this->params = $this->app->getParams();
|
||||
$this->menu = $this->app->getMenu()->getActive();
|
||||
$this->styles = $this->get('Styles');
|
||||
$this->scripts = $this->get('Scripts');
|
||||
// get the user object
|
||||
$this->user ??= $this->app->getIdentity();###SITE_DIPLAY_METHOD###
|
||||
}###SITE_EXTRA_DIPLAY_METHODS###
|
||||
|
||||
/**
|
||||
* Prepare some document related stuff.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function _prepareDocument(): void
|
||||
{###SITE_LIBRARIES_LOADER######SITE_UIKIT_LOADER######SITE_GOOGLECHART_LOADER######SITE_FOOTABLE_LOADER######SITE_DOCUMENT_METADATA######SITE_DOCUMENT_CUSTOM_PHP###
|
||||
// add styles
|
||||
foreach ($this->styles as $style)
|
||||
{
|
||||
Html::_('stylesheet', $style, ['version' => 'auto']);
|
||||
}###SITE_DOCUMENT_CUSTOM_CSS###
|
||||
// add scripts
|
||||
foreach ($this->scripts as $script)
|
||||
{
|
||||
Html::_('script', $script, ['version' => 'auto']);
|
||||
}###SITE_DOCUMENT_CUSTOM_JS######SITE_JAVASCRIPT_FOR_BUTTONS###
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the page title and toolbar.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function addToolbar(): void
|
||||
{###SITE_CUSTOM_BUTTONS###
|
||||
|
||||
// set help url for this view if found
|
||||
$this->help_url = ###Component###Helper::getHelpUrl('###sview###');
|
||||
if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($this->help_url))
|
||||
{
|
||||
ToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url);
|
||||
}
|
||||
// now initiate the toolbar
|
||||
$this->toolbar = Toolbar::getInstance();
|
||||
}###SITE_GET_MODULE###
|
||||
|
||||
/**
|
||||
* Escapes a value for output in a view script.
|
||||
*
|
||||
* @param mixed $var The output to escape.
|
||||
* @param bool $shorten The switch to shorten.
|
||||
* @param int $length The shorting length.
|
||||
*
|
||||
* @return mixed The escaped value.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function escape($var, bool $shorten = false, int $length = 40)
|
||||
{
|
||||
if (!is_string($var))
|
||||
{
|
||||
return $var;
|
||||
}
|
||||
|
||||
return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
|
||||
}
|
||||
}
|
262
admin/compiler/joomla_4/SITE_VIEW_MODEL.php
Normal file
262
admin/compiler/joomla_4/SITE_VIEW_MODEL.php
Normal file
@ -0,0 +1,262 @@
|
||||
<?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###\Site\Model;
|
||||
|
||||
###SITE_VIEW_MODEL_HEADER###
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* ###Component### ###SView### Item Model
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class ###SView###Model extends ItemModel
|
||||
{
|
||||
/**
|
||||
* Model context string.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $_context = 'com_###component###.###sview###';
|
||||
|
||||
/**
|
||||
* Represents the current user object.
|
||||
*
|
||||
* @var User The user object representing the current user.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected User $user;
|
||||
|
||||
/**
|
||||
* The unique identifier of the current user.
|
||||
*
|
||||
* @var int|null The ID of the current user.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ?int $userId;
|
||||
|
||||
/**
|
||||
* Flag indicating whether the current user is a guest.
|
||||
*
|
||||
* @var int 1 if the user is a guest, 0 otherwise.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected int $guest;
|
||||
|
||||
/**
|
||||
* An array of groups that the current user belongs to.
|
||||
*
|
||||
* @var array|null An array of user group IDs.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ?array $groups;
|
||||
|
||||
/**
|
||||
* An array of view access levels for the current user.
|
||||
*
|
||||
* @var array|null An array of access level IDs.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ?array $levels;
|
||||
|
||||
/**
|
||||
* The application object.
|
||||
*
|
||||
* @var CMSApplicationInterface The application instance.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected CMSApplicationInterface $app;
|
||||
|
||||
/**
|
||||
* The input object, providing access to the request data.
|
||||
*
|
||||
* @var Input The input object.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Input $input;
|
||||
|
||||
/**
|
||||
* The styles array.
|
||||
*
|
||||
* @var array
|
||||
* @since 4.3
|
||||
*/
|
||||
protected array $styles = [
|
||||
'components/com_###component###/assets/css/site.css',
|
||||
'components/com_###component###/assets/css/###sview###.css'
|
||||
];
|
||||
|
||||
/**
|
||||
* The scripts array.
|
||||
*
|
||||
* @var array
|
||||
* @since 4.3
|
||||
*/
|
||||
protected array $scripts = [
|
||||
'components/com_###component###/assets/js/site.js'
|
||||
];
|
||||
|
||||
/**
|
||||
* A custom property for UI Kit components.
|
||||
*
|
||||
* @var array|null Property for storing UI Kit component-related data or objects.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ?array $uikitComp;
|
||||
|
||||
/**
|
||||
* @var object item
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $item;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param array $config An array of configuration options (name, state, dbo, table_path, ignore_request).
|
||||
* @param ?MVCFactoryInterface $factory The factory.
|
||||
*
|
||||
* @since 3.0
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function __construct($config = [], MVCFactoryInterface $factory = null)
|
||||
{
|
||||
parent::__construct($config, $factory);
|
||||
|
||||
$this->app ??= Factory::getApplication();
|
||||
$this->input ??= $this->app->getInput();
|
||||
|
||||
// Set the current user for authorisation checks (for those calling this model directly)
|
||||
$this->user ??= $this->getCurrentUser();
|
||||
$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();
|
||||
|
||||
// will be removed
|
||||
$this->initSet = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function populateState()
|
||||
{
|
||||
// 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.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getItem($pk = null)
|
||||
{###USER_PERMISSION_CHECK_ACCESS###
|
||||
|
||||
$pk = (!empty($pk)) ? $pk : (int) $this->getState('###sview###.id');###SITE_BEFORE_GET_ITEM###
|
||||
|
||||
if ($this->_item === null)
|
||||
{
|
||||
$this->_item = [];
|
||||
}###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.
|
||||
throw $e;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setError($e);
|
||||
$this->_item[$pk] = false;
|
||||
}
|
||||
}
|
||||
}###SITE_AFTER_GET_ITEM###
|
||||
|
||||
return $this->_item[$pk];
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the styles that have to be included on the view
|
||||
*
|
||||
* @return array styles files
|
||||
* @since 4.3
|
||||
*/
|
||||
public function getStyles(): array
|
||||
{
|
||||
return $this->styles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to set the styles that have to be included on the view
|
||||
*
|
||||
* @return void
|
||||
* @since 4.3
|
||||
*/
|
||||
public function setStyles(string $path): void
|
||||
{
|
||||
$this->styles[] = $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the script that have to be included on the view
|
||||
*
|
||||
* @return array script files
|
||||
* @since 4.3
|
||||
*/
|
||||
public function getScripts(): array
|
||||
{
|
||||
return $this->scripts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to set the script that have to be included on the view
|
||||
*
|
||||
* @return void
|
||||
* @since 4.3
|
||||
*/
|
||||
public function setScript(string $path): void
|
||||
{
|
||||
$this->scripts[] = $path;
|
||||
}###LICENSE_LOCKED_SET_BOOL######SITE_CUSTOM_METHODS######SITE_CUSTOM_BUTTONS_METHOD###
|
||||
}
|
4
admin/compiler/joomla_4/access.xml
Normal file
4
admin/compiler/joomla_4/access.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<access component="com_###component###">
|
||||
###ACCESS_SECTIONS###
|
||||
</access>
|
7
admin/compiler/joomla_4/admin.css
Normal file
7
admin/compiler/joomla_4/admin.css
Normal file
@ -0,0 +1,7 @@
|
||||
###BOM###
|
||||
|
||||
/* CSS Document */
|
||||
.no-click {
|
||||
pointer-events: none;
|
||||
}
|
||||
###ADMINCSS###
|
4
admin/compiler/joomla_4/admin.js
Normal file
4
admin/compiler/joomla_4/admin.js
Normal file
@ -0,0 +1,4 @@
|
||||
###BOM###
|
||||
|
||||
/* JS Document */
|
||||
###ADMINJS###
|
87
admin/compiler/joomla_4/component.xml
Normal file
87
admin/compiler/joomla_4/component.xml
Normal file
@ -0,0 +1,87 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="component" version="###XMLVERSION###" method="upgrade">
|
||||
<name>COM_###COMPONENT###</name>
|
||||
<creationDate>###BUILDDATE###</creationDate>
|
||||
<author>###AUTHOR###</author>
|
||||
<authorEmail>###AUTHOREMAIL###</authorEmail>
|
||||
<authorUrl>###AUTHORWEBSITE###</authorUrl>
|
||||
<copyright>###COPYRIGHT###</copyright>
|
||||
<license>###LICENSE###</license>
|
||||
<version>###ACTUALVERSION###</version>
|
||||
<description><![CDATA[
|
||||
<h1>###Component_name### (v.###ACTUALVERSION###)</h1>
|
||||
<div style="clear: both;"></div>
|
||||
<p>###DESCRIPTION###</p>
|
||||
<p>Created by <a href="###AUTHORWEBSITE###" target="_blank">###AUTHOR###</a><br /><small>Development started ###CREATIONDATE###</small></p>
|
||||
]]></description>
|
||||
<namespace path="src">###NAMESPACEPREFIX###\Component\###ComponentNameSpace###</namespace>
|
||||
|
||||
<!-- Runs on install -->
|
||||
<install>
|
||||
<sql>
|
||||
<file driver="mysql" charset="utf8">sql/install.mysql.utf8.sql</file>
|
||||
</sql>
|
||||
</install>
|
||||
|
||||
<!-- Runs on uninstall -->
|
||||
<uninstall>
|
||||
<sql>
|
||||
<file driver="mysql" charset="utf8">sql/uninstall.mysql.utf8.sql</file>
|
||||
</sql>
|
||||
</uninstall>
|
||||
|
||||
<!-- Runs on install/uninstall/update -->
|
||||
<scriptfile>###Component###InstallerScript.php</scriptfile>
|
||||
|
||||
<media destination="com_###component###" folder="media">
|
||||
<filename>index.html</filename>###EXSTRA_MEDIA_FILES###
|
||||
<folder>js</folder>
|
||||
<folder>css</folder>
|
||||
<folder>images</folder>###EXSTRA_MEDIA_FOLDERS###
|
||||
</media>
|
||||
|
||||
<!-- Update Schema -->
|
||||
<update>
|
||||
<schemas>
|
||||
<schemapath type="mysql">sql/updates/mysql/</schemapath>
|
||||
</schemas>
|
||||
</update>
|
||||
|
||||
<files folder="site">
|
||||
<filename>index.html</filename>###EXSTRA_SITE_FILES###
|
||||
<folder>assets</folder>
|
||||
<folder>forms</folder>
|
||||
<folder>layouts</folder>
|
||||
<folder>src</folder>
|
||||
<folder>tmpl</folder>###EXSTRA_SITE_FOLDERS###
|
||||
</files>
|
||||
|
||||
<languages folder="site">
|
||||
###SITE_LANGUAGES###
|
||||
</languages>
|
||||
|
||||
<administration>
|
||||
<menu>COM_###COMPONENT###_MENU</menu>
|
||||
<submenu>
|
||||
<!-- Instead of link you can specify individual link attributes -->###MAINMENUS###
|
||||
</submenu>
|
||||
<files folder="admin">
|
||||
<filename>access.xml</filename>
|
||||
<filename>config.xml</filename>
|
||||
<filename>index.html</filename>###EXSTRA_ADMIN_FILES###
|
||||
<folder>assets</folder>
|
||||
<folder>forms</folder>
|
||||
<folder>layouts</folder>
|
||||
<folder>presets</folder>
|
||||
<folder>services</folder>
|
||||
<folder>sql</folder>
|
||||
<folder>src</folder>
|
||||
<folder>tmpl</folder>###EXSTRA_ADMIN_FOLDERS###
|
||||
</files>
|
||||
|
||||
<languages folder="admin">
|
||||
###ADMIN_LANGUAGES###
|
||||
</languages>
|
||||
|
||||
</administration>###UPDATESERVER###
|
||||
</extension>
|
19
admin/compiler/joomla_4/config.xml
Normal file
19
admin/compiler/joomla_4/config.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<config>
|
||||
###CONFIG_FIELDSETS###
|
||||
<fieldset
|
||||
name="permissions"
|
||||
label="JCONFIG_PERMISSIONS_LABEL"
|
||||
description="JCONFIG_PERMISSIONS_DESC">
|
||||
<field
|
||||
name="rules"
|
||||
type="rules"
|
||||
label="JCONFIG_PERMISSIONS_LABEL"
|
||||
class="inputbox"
|
||||
validate="rules"
|
||||
filter="rules"
|
||||
component="com_###component###"
|
||||
section="component"
|
||||
/>
|
||||
</fieldset>
|
||||
</config>
|
155
admin/compiler/joomla_4/dashboard.css
Normal file
155
admin/compiler/joomla_4/dashboard.css
Normal file
@ -0,0 +1,155 @@
|
||||
###BOM###
|
||||
|
||||
/* CSS Document */
|
||||
|
||||
.dashboard-container {
|
||||
margin-left: 10px;
|
||||
margin-top: 10px;
|
||||
width: 100%;
|
||||
}
|
||||
.dashboard-container [class*="span"] {
|
||||
display: block;
|
||||
float: none;
|
||||
margin-left: 0;
|
||||
width: auto;
|
||||
}
|
||||
.dashboard-container:before, .dashboard-container:after {
|
||||
content: "";
|
||||
display: table;
|
||||
}
|
||||
.dashboard-container:after {
|
||||
clear: both;
|
||||
}
|
||||
.dashboard-container [class*="span"] {
|
||||
box-sizing: border-box;
|
||||
display: block;
|
||||
float: left;
|
||||
min-height: 145px;
|
||||
min-width: 96px;
|
||||
width: 100%;
|
||||
}
|
||||
.dashboard-container [class*="span"]:first-child {
|
||||
margin-left: 0;
|
||||
}
|
||||
.dashboard-wraper {
|
||||
background: none repeat scroll 0 0 hsl(0, 0%, 93%);
|
||||
border-radius: 5px;
|
||||
float: left;
|
||||
margin: 1%;
|
||||
padding: 3px;
|
||||
width: 17%;
|
||||
min-height: 194px;
|
||||
min-width: 96px;
|
||||
}
|
||||
.dashboard-content a {
|
||||
background: linear-gradient(to bottom, hsl(0, 0%, 100%) 0%, hsl(0, 0%, 96%) 47%, hsl(0, 0%, 93%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0);
|
||||
border: 1px solid hsl(0, 0%, 85%);
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 0 3px hsla(0, 0%, 0%, 0.1) inset;
|
||||
color: hsl(0, 0%, 20%);
|
||||
display: block;
|
||||
min-height: 89px;
|
||||
padding: 10px;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
}
|
||||
.dashboard-content a:hover {
|
||||
background: linear-gradient(to bottom, hsl(0, 0%, 90%) 0%, hsl(0, 0%, 100%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0);
|
||||
color: hsl(200, 100%, 30%);
|
||||
text-decoration: none;
|
||||
}
|
||||
.dashboard-title {
|
||||
display: block;
|
||||
padding-top: 5px;
|
||||
}
|
||||
.dashboard-info {
|
||||
background: linear-gradient(to bottom, hsl(0, 0%, 100%) 0%, hsl(0, 0%, 96%) 47%, hsl(0, 0%, 93%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0);
|
||||
border: 1px solid hsl(0, 0%, 85%);
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 0 3px hsla(0, 0%, 0%, 0.1) inset;
|
||||
color: hsl(0, 0%, 20%);
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
padding: 10px;
|
||||
text-align: center;
|
||||
}
|
||||
.dashboard-info span {
|
||||
display: block;
|
||||
text-align: center;
|
||||
}
|
||||
.dashboard-info img {
|
||||
margin: 0 auto;
|
||||
}
|
||||
.dashboard-table {
|
||||
border-top: 1px solid hsl(0, 0%, 87%);
|
||||
margin-top: 5px;
|
||||
width: 100%;
|
||||
}
|
||||
.dashboard-info h5 {
|
||||
font-size: 11px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.dashboard-block {
|
||||
background: linear-gradient(to bottom, hsl(0, 0%, 95%) 0%, hsl(0, 0%, 86%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0);
|
||||
border: 1px solid hsl(0, 0%, 76%);
|
||||
border-radius: 3px;
|
||||
box-shadow: 0 1px 0 hsl(0, 0%, 98%) inset;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.dashboard-block .dashboard-block-head {
|
||||
background: linear-gradient(to bottom, hsl(0, 0%, 95%) 0%, hsl(0, 0%, 86%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0);
|
||||
border-bottom: 1px solid hsl(0, 0%, 76%);
|
||||
border-radius: 3px 3px 0 0;
|
||||
box-shadow: 0 1px 0 hsl(0, 0%, 98%) inset, 0 0 3px hsl(0, 0%, 87%);
|
||||
height: 40px;
|
||||
position: relative;
|
||||
}
|
||||
.dashboard-block .dashboard-block-head h5 {
|
||||
font-size: 12px;
|
||||
margin: 0;
|
||||
padding-left: 10px;
|
||||
padding-top: 11px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
.dashboard-block .dashboard-block-content {
|
||||
background: none repeat scroll 0 0 hsl(0, 0%, 93%);
|
||||
border-radius: 0 0 3px 3px;
|
||||
}
|
||||
.dashboard-block .dashboard-block-box {
|
||||
background: none repeat scroll 0 0 hsl(0, 0%, 100%);
|
||||
border-top: 1px solid hsl(0, 0%, 82%);
|
||||
box-shadow: 0 0 5px hsl(0, 0%, 87%) inset;
|
||||
}
|
||||
.dashboard-block .dashboard-block-content .dashboard-block-box {
|
||||
margin-top: 0 !important;
|
||||
}
|
||||
.dashboard-block .dashboard-block-content .dashboard-block-box .dashboard-block-table {
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
.dashboard-block-table {
|
||||
background-color: hsla(0, 0%, 0%, 0);
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
margin-bottom: 20px;
|
||||
max-width: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
.dashboard-block-table th, .dashboard-block-table td {
|
||||
border-top: 1px solid hsl(0, 0%, 87%);
|
||||
line-height: 20px;
|
||||
padding: 5px;
|
||||
text-align: left;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.dashboard-badge {
|
||||
background-color: hsl(0, 0%, 60%);
|
||||
border-radius: 9px;
|
||||
color: hsl(0, 0%, 100%);
|
||||
font-size: 11.844px;
|
||||
font-weight: bold;
|
||||
line-height: 14px;
|
||||
padding: 1px 9px 2px;
|
||||
text-shadow: 0 -1px 0 hsla(0, 0%, 0%, 0.25);
|
||||
vertical-align: baseline;
|
||||
white-space: nowrap;
|
||||
}
|
1
admin/compiler/joomla_4/default.xml
Normal file
1
admin/compiler/joomla_4/default.xml
Normal file
@ -0,0 +1 @@
|
||||
###SITE_MENU_XML###
|
26
admin/compiler/joomla_4/default_batch_body.php
Normal file
26
admin/compiler/joomla_4/default_batch_body.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?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###
|
||||
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED###
|
||||
|
||||
?>
|
||||
|
||||
<p><?php echo Text::_('COM_###COMPONENT###_###VIEWS###_BATCH_TIP'); ?></p>
|
||||
<?php echo $this->batchDisplay; ?>
|
30
admin/compiler/joomla_4/default_batch_footer.php
Normal file
30
admin/compiler/joomla_4/default_batch_footer.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?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###
|
||||
|
||||
use Joomla\CMS\Language\Text;
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED###
|
||||
|
||||
?>
|
||||
<!-- clear the batch values if cancel -->
|
||||
<button class="btn" type="button" onclick="###BATCH_ONCLICK_CANCEL_SCRIPT###" data-dismiss="modal">
|
||||
<?php echo Text::_('JCANCEL'); ?>
|
||||
</button>
|
||||
<!-- post the batch values if process -->
|
||||
<button class="btn btn-success" type="submit" onclick="Joomla.submitbutton('###view###.batch');">
|
||||
<?php echo Text::_('JGLOBAL_BATCH_PROCESS'); ?>
|
||||
</button>
|
28
admin/compiler/joomla_4/default_body.php
Normal file
28
admin/compiler/joomla_4/default_body.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?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###
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||
use ###NAMESPACEPREFIX###\Component\###ComponentNameSpace###\Administrator\Helper\###Component###Helper;
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED###
|
||||
|
||||
$edit = "index.php?option=com_###component###&view=###views###&task=###view###.edit";
|
||||
|
||||
?>
|
||||
###LISTBODY###
|
24
admin/compiler/joomla_4/default_custom_admin_template.php
Normal file
24
admin/compiler/joomla_4/default_custom_admin_template.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?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###
|
||||
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED######CUSTOM_ADMIN_TEMPLATE_CODE_BODY###
|
||||
|
||||
?>###CUSTOM_ADMIN_TEMPLATE_BODY###
|
23
admin/compiler/joomla_4/default_foot.php
Normal file
23
admin/compiler/joomla_4/default_foot.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?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###
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED###
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="###LISTCOLNR###"><?php echo $this->pagination->getListFooter(); ?></td>
|
||||
</tr>
|
24
admin/compiler/joomla_4/default_head.php
Normal file
24
admin/compiler/joomla_4/default_head.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?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###
|
||||
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED###
|
||||
|
||||
?>
|
||||
###LISTHEAD###
|
199
admin/compiler/joomla_4/default_import.php
Normal file
199
admin/compiler/joomla_4/default_import.php
Normal file
@ -0,0 +1,199 @@
|
||||
<?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###
|
||||
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED###
|
||||
|
||||
Html::_('jquery.framework');
|
||||
Html::_('bootstrap.tooltip');
|
||||
Html::_('script', 'system/core.js', false, true);
|
||||
Html::_('behavior.keepalive');
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
<?php if ($this->hasPackage && Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($this->headerList)) : ?>
|
||||
Joomla.continueImport = function() {
|
||||
var form = document.getElementById('adminForm');
|
||||
var error = false;
|
||||
var therequired = [<?php $i = 0; foreach($this->headerList as $name => $title) { echo ($i != 0)? ', "vdm_'.$name.'"':'"vdm_'.$name.'"'; $i++; } ?>];
|
||||
for(i = 0; i < therequired.length; i++) {
|
||||
if(document.getElementById(therequired[i]).value == "" ) {
|
||||
error = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// do field validation
|
||||
if (error) {
|
||||
alert("<?php echo Text::_('COM_###COMPONENT###_IMPORT_MSG_PLEASE_SELECT_ALL_COLUMNS', true); ?>");
|
||||
} else {
|
||||
document.getElementById('loading').style.display = 'block';
|
||||
form.gettype.value = 'continue';
|
||||
form.submit();
|
||||
}
|
||||
};
|
||||
<?php else: ?>
|
||||
Joomla.submitbutton = function() {
|
||||
var form = document.getElementById('adminForm');
|
||||
// do field validation
|
||||
if (form.import_package.value == "") {
|
||||
alert("<?php echo Text::_('COM_###COMPONENT###_IMPORT_MSG_PLEASE_SELECT_A_FILE', true); ?>");
|
||||
} else {
|
||||
document.getElementById('loading').style.display = 'block';
|
||||
form.gettype.value = 'upload';
|
||||
form.submit();
|
||||
}
|
||||
};
|
||||
|
||||
Joomla.submitbutton3 = function() {
|
||||
var form = document.getElementById('adminForm');
|
||||
// do field validation
|
||||
if (form.import_directory.value == ""){
|
||||
alert("<?php echo Text::_('COM_###COMPONENT###_IMPORT_MSG_PLEASE_SELECT_A_DIRECTORY', true); ?>");
|
||||
} else {
|
||||
document.getElementById('loading').style.display = 'block';
|
||||
form.gettype.value = 'folder';
|
||||
form.submit();
|
||||
}
|
||||
};
|
||||
|
||||
Joomla.submitbutton4 = function() {
|
||||
var form = document.getElementById('adminForm');
|
||||
// do field validation
|
||||
if (form.import_url.value == "" || form.import_url.value == "http://") {
|
||||
alert("<?php echo Text::_('COM_###COMPONENT###_IMPORT_MSG_ENTER_A_URL', true); ?>");
|
||||
} else {
|
||||
document.getElementById('loading').style.display = 'block';
|
||||
form.gettype.value = 'url';
|
||||
form.submit();
|
||||
}
|
||||
};
|
||||
<?php endif; ?>
|
||||
|
||||
// Add spindle-wheel for importations:
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// get page body
|
||||
var outerBodyDiv = document.querySelector('body');
|
||||
// start loading spinner
|
||||
var loadingDiv = document.createElement('div');
|
||||
loadingDiv.id = 'loading';
|
||||
// Set CSS properties individually
|
||||
loadingDiv.style.background = "rgba(255, 255, 255, .8) url('components/com_[[[component]]]/assets/images/import.gif') 50% 15% no-repeat";
|
||||
loadingDiv.style.top = (outerBodyDiv.getBoundingClientRect().top + window.pageYOffset) + "px";
|
||||
loadingDiv.style.left = (outerBodyDiv.getBoundingClientRect().left + window.pageXOffset) + "px";
|
||||
loadingDiv.style.width = outerBodyDiv.offsetWidth + "px";
|
||||
loadingDiv.style.height = outerBodyDiv.offsetHeight + "px";
|
||||
loadingDiv.style.position = 'fixed';
|
||||
loadingDiv.style.opacity = '0.80';
|
||||
loadingDiv.style.msFilter = "progid:DXImageTransform.Microsoft.Alpha(Opacity=80)";
|
||||
loadingDiv.style.filter = "alpha(opacity=80)";
|
||||
loadingDiv.style.display = 'none';
|
||||
// add to page body
|
||||
outerBodyDiv.appendChild(loadingDiv);
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<div id="installer-import" class="clearfix">
|
||||
<form enctype="multipart/form-data" action="<?php echo Route::_('index.php?option=com_###component###&view=import');?>" method="post" name="adminForm" id="adminForm" class="form-horizontal form-validate">
|
||||
<div id="main-card">
|
||||
|
||||
<?php if ($this->hasPackage && Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($this->headerList) && Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($this->headers)) : ?>
|
||||
<fieldset class="uploadform">
|
||||
<legend><?php echo Text::_('COM_###COMPONENT###_IMPORT_LINK_FILE_TO_TABLE_COLUMNS'); ?></legend>
|
||||
<div class="control-group">
|
||||
<label class="control-label" ><h4><?php echo Text::_('COM_###COMPONENT###_IMPORT_TABLE_COLUMNS'); ?></h4></label>
|
||||
<div class="controls">
|
||||
<label class="control-label" ><h4><?php echo Text::_('COM_###COMPONENT###_IMPORT_FILE_COLUMNS'); ?></h4></label>
|
||||
</div>
|
||||
</div>
|
||||
<?php foreach($this->headerList as $name => $title): ?>
|
||||
<div class="control-group">
|
||||
<label for="<?php echo $name; ?>" class="control-label" ><?php echo $title; ?></label>
|
||||
<div class="controls">
|
||||
<select name="<?php echo $name; ?>" id="vdm_<?php echo $name; ?>" required class="required input_box" >
|
||||
<option value=""><?php echo Text::_('COM_###COMPONENT###_IMPORT_PLEASE_SELECT_COLUMN'); ?></option>
|
||||
<option value="IGNORE"><?php echo Text::_('COM_###COMPONENT###_IMPORT_IGNORE_COLUMN'); ?></option>
|
||||
<?php foreach($this->headers as $value => $option): ?>
|
||||
<?php $selected = (strtolower($option) == strtolower ($title) || strtolower($option) == strtolower($name))? 'selected="selected"':''; ?>
|
||||
<option value="<?php echo Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($value); ?>" class="required" <?php echo $selected ?>><?php echo Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($option); ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<div class="form-actions">
|
||||
<input class="btn btn-primary" type="button" value="<?php echo Text::_('COM_###COMPONENT###_IMPORT_CONTINUE'); ?>" onclick="Joomla.continueImport()" />
|
||||
</div>
|
||||
</fieldset>
|
||||
<input type="hidden" name="gettype" value="continue" />
|
||||
<?php else: ?>
|
||||
<?php echo Html::_('uitab.startTabSet', 'myTab', array('active' => 'upload')); ?>
|
||||
|
||||
<?php echo Html::_('uitab.addTab', 'myTab', 'upload', Text::_('COM_###COMPONENT###_IMPORT_FROM_UPLOAD', true)); ?>
|
||||
<fieldset class="uploadform">
|
||||
<legend><?php echo Text::_('COM_###COMPONENT###_IMPORT_UPDATE_DATA'); ?></legend>
|
||||
<div class="control-group">
|
||||
<label for="import_package" class="control-label"><?php echo Text::_('COM_###COMPONENT###_IMPORT_SELECT_FILE'); ?></label>
|
||||
<div class="controls">
|
||||
<input class="input_box" id="import_package" name="import_package" type="file" size="57" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<input class="btn btn-primary" type="button" value="<?php echo Text::_('COM_###COMPONENT###_IMPORT_UPLOAD_BOTTON'); ?>" onclick="Joomla.submitbutton()" /> <small><?php echo Text::_('COM_###COMPONENT###_IMPORT_FORMATS_ACCEPTED'); ?> (.csv .xls .ods)</small>
|
||||
</div>
|
||||
</fieldset>
|
||||
<?php echo Html::_('uitab.endTab'); ?>
|
||||
|
||||
<?php echo Html::_('uitab.addTab', 'myTab', 'directory', Text::_('COM_###COMPONENT###_IMPORT_FROM_DIRECTORY', true)); ?>
|
||||
<fieldset class="uploadform">
|
||||
<legend><?php echo Text::_('COM_###COMPONENT###_IMPORT_UPDATE_DATA'); ?></legend>
|
||||
<div class="control-group">
|
||||
<label for="import_directory" class="control-label"><?php echo Text::_('COM_###COMPONENT###_IMPORT_SELECT_FILE_DIRECTORY'); ?></label>
|
||||
<div class="controls">
|
||||
<input type="text" id="import_directory" name="import_directory" class="span5 input_box" size="70" value="<?php echo $this->state->get('import.directory'); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<input type="button" class="btn btn-primary" value="<?php echo Text::_('COM_###COMPONENT###_IMPORT_GET_BOTTON'); ?>" onclick="Joomla.submitbutton3()" /> <small><?php echo Text::_('COM_###COMPONENT###_IMPORT_FORMATS_ACCEPTED'); ?> (.csv .xls .ods)</small>
|
||||
</div>
|
||||
</fieldset>
|
||||
<?php echo Html::_('uitab.endTab'); ?>
|
||||
|
||||
<?php echo Html::_('uitab.addTab', 'myTab', 'url', Text::_('COM_###COMPONENT###_IMPORT_FROM_URL', true)); ?>
|
||||
<fieldset class="uploadform">
|
||||
<legend><?php echo Text::_('COM_###COMPONENT###_IMPORT_UPDATE_DATA'); ?></legend>
|
||||
<div class="control-group">
|
||||
<label for="import_url" class="control-label"><?php echo Text::_('COM_###COMPONENT###_IMPORT_SELECT_FILE_URL'); ?></label>
|
||||
<div class="controls">
|
||||
<input type="text" id="import_url" name="import_url" class="span5 input_box" size="70" value="http://" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<input type="button" class="btn btn-primary" value="<?php echo Text::_('COM_###COMPONENT###_IMPORT_GET_BOTTON'); ?>" onclick="Joomla.submitbutton4()" /> <small><?php echo Text::_('COM_###COMPONENT###_IMPORT_FORMATS_ACCEPTED'); ?> (.csv .xls .ods)</small>
|
||||
</div>
|
||||
</fieldset>
|
||||
<?php echo Html::_('uitab.endTab'); ?>
|
||||
<?php echo Html::_('uitab.endTabSet'); ?>
|
||||
<input type="hidden" name="gettype" value="upload" />
|
||||
<?php endif; ?>
|
||||
<input type="hidden" name="task" value="import.import" />
|
||||
<?php echo Html::_('form.token'); ?>
|
||||
</form>
|
||||
</div>
|
30
admin/compiler/joomla_4/default_import_custom.php
Normal file
30
admin/compiler/joomla_4/default_import_custom.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?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###
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED###
|
||||
|
||||
Html::_('jquery.framework');
|
||||
Html::_('bootstrap.tooltip');
|
||||
Html::_('script', 'system/core.js', false, true);
|
||||
Html::_('behavior.keepalive');
|
||||
|
||||
?>###IMPORT_DEFAULT_VIEW_CUSTOM###
|
6
admin/compiler/joomla_4/default_list.xml
Normal file
6
admin/compiler/joomla_4/default_list.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<metadata>
|
||||
<layout title="COM_###COMPONENT###_MENU_###VIEWS###_TITLE">
|
||||
<message>COM_###COMPONENT###_MENU_###VIEWS###_DESC</message>
|
||||
</layout>
|
||||
</metadata>
|
37
admin/compiler/joomla_4/default_main.php
Normal file
37
admin/compiler/joomla_4/default_main.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?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###
|
||||
|
||||
use Joomla\CMS\Language\Text;
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
?>
|
||||
<?php if(isset($this->icons['main']) && is_array($this->icons['main'])) :?>
|
||||
<?php foreach($this->icons['main'] as $icon): ?>
|
||||
<div class="dashboard-wraper">
|
||||
<div class="dashboard-content">
|
||||
<a class="icon" href="<?php echo $icon->url; ?>">
|
||||
<img alt="<?php echo $icon->alt; ?>" src="components/com_###component###/assets/images/icons/<?php echo $icon->image; ?>">
|
||||
<span class="dashboard-title"><?php echo Text::_($icon->name); ?></span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<div class="clearfix"></div>
|
||||
<?php else: ?>
|
||||
<div class="alert alert-error"><h4 class="alert-heading"><?php echo Text::_("Permission denied, or not correctly set"); ?></h4><div class="alert-message"><?php echo Text::_("Please notify your System Administrator if result is unexpected."); ?></div></div>
|
||||
<?php endif; ?>
|
24
admin/compiler/joomla_4/default_site_template.php
Normal file
24
admin/compiler/joomla_4/default_site_template.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?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###
|
||||
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||
use Joomla\CMS\Layout\LayoutHelper;
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED######SITE_TEMPLATE_CODE_BODY###
|
||||
|
||||
?>###SITE_TEMPLATE_BODY###
|
53
admin/compiler/joomla_4/default_toolbar.php
Normal file
53
admin/compiler/joomla_4/default_toolbar.php
Normal file
@ -0,0 +1,53 @@
|
||||
<?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###
|
||||
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED###
|
||||
|
||||
?>
|
||||
<div id="filter-bar" class="btn-toolbar">
|
||||
<div class="filter-search btn-group pull-left">
|
||||
<label for="filter_search" class="element-invisible"><?php echo Text::_('Search');?></label>
|
||||
<input type="text" name="filter_search" id="filter_search" placeholder="<?php echo Text::_('JSEARCH_FILTER'); ?>" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" class="hasTooltip" title="<?php echo Html::tooltipText('Search ###Views###'); ?>" />
|
||||
</div>
|
||||
<div class="btn-group pull-left">
|
||||
<button type="submit" class="btn hasTooltip" title="<?php echo Html::tooltipText('JSEARCH_FILTER_SUBMIT'); ?>"><i class="icon-search"></i></button>
|
||||
<button type="button" class="btn hasTooltip" title="<?php echo Html::tooltipText('JSEARCH_FILTER_CLEAR'); ?>" onclick="document.id('filter_search').value='';this.form.submit();"><i class="icon-remove"></i></button>
|
||||
</div>
|
||||
<div class="btn-group pull-right hidden-phone">
|
||||
<label for="limit" class="element-invisible"><?php echo Text::_('JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC');?></label>
|
||||
<?php echo $this->pagination->getLimitBox(); ?>
|
||||
</div>
|
||||
<div class="btn-group pull-right hidden-phone">
|
||||
<label for="directionTable" class="element-invisible"><?php echo Text::_('JFIELD_ORDERING_DESC');?></label>
|
||||
<select name="directionTable" id="directionTable" class="input-medium" onchange="Joomla.orderTable()">
|
||||
<option value=""><?php echo Text::_('JFIELD_ORDERING_DESC');?></option>
|
||||
<option value="asc" <?php if ($this->listDirn == 'asc') echo 'selected="selected"'; ?>><?php echo Text::_('JGLOBAL_ORDER_ASCENDING');?></option>
|
||||
<option value="desc" <?php if ($this->listDirn == 'desc') echo 'selected="selected"'; ?>><?php echo Text::_('JGLOBAL_ORDER_DESCENDING');?></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="btn-group pull-right">
|
||||
<label for="sortTable" class="element-invisible"><?php echo Text::_('JGLOBAL_SORT_BY');?></label>
|
||||
<select name="sortTable" id="sortTable" class="input-medium" onchange="Joomla.orderTable()">
|
||||
<option value=""><?php echo Text::_('JGLOBAL_SORT_BY');?></option>
|
||||
<?php echo Html::_('select.options', $this->getSortFields(), 'value', 'text', $this->listOrder);?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix"> </div>
|
45
admin/compiler/joomla_4/default_vdm.php
Normal file
45
admin/compiler/joomla_4/default_vdm.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?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###
|
||||
|
||||
use Joomla\CMS\Language\Text;
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
?>
|
||||
<img alt="<?php echo Text::_('COM_###COMPONENT###'); ?>" width="100%" src="components/com_###component###/assets/images/vdm-component.###COMP_IMAGE_TYPE###">
|
||||
<ul class="list-striped">
|
||||
<li><b><?php echo Text::_('COM_###COMPONENT###_VERSION'); ?>:</b> <?php echo $this->manifest->version; ?> <span class="update-notice" id="component-update-notice"></span></li>
|
||||
<li><b><?php echo Text::_('COM_###COMPONENT###_DATE'); ?>:</b> <?php echo $this->manifest->creationDate; ?></li>
|
||||
<li><b><?php echo Text::_('COM_###COMPONENT###_AUTHOR'); ?>:</b> <a href="mailto:<?php echo $this->manifest->authorEmail; ?>"><?php echo $this->manifest->author; ?></a></li>
|
||||
<li><b><?php echo Text::_('COM_###COMPONENT###_WEBSITE'); ?>:</b> <a href="<?php echo $this->manifest->authorUrl; ?>" target="_blank"><?php echo $this->manifest->authorUrl; ?></a></li>
|
||||
<li><b><?php echo Text::_('COM_###COMPONENT###_LICENSE'); ?>:</b> <?php echo $this->manifest->license; ?></li>
|
||||
<li><b><?php echo $this->manifest->copyright; ?></b></li>
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
<?php if(Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($this->contributors)): ?>
|
||||
<?php if(count($this->contributors) > 1): ?>
|
||||
<h3><?php echo Text::_('COM_###COMPONENT###_CONTRIBUTORS'); ?></h3>
|
||||
<?php else: ?>
|
||||
<h3><?php echo Text::_('COM_###COMPONENT###_CONTRIBUTOR'); ?></h3>
|
||||
<?php endif; ?>
|
||||
<ul class="list-striped">
|
||||
<?php foreach($this->contributors as $contributor): ?>
|
||||
<li><b><?php echo $contributor['title']; ?>:</b> <?php echo $contributor['name']; ?></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
<?php endif; ?>
|
1
admin/compiler/joomla_4/edit.xml
Normal file
1
admin/compiler/joomla_4/edit.xml
Normal file
@ -0,0 +1 @@
|
||||
###SITE_MENU_XML###
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user