2021-03-05 03:08:47 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @package Joomla.Component.Builder
|
|
|
|
*
|
|
|
|
* @created 30th April, 2015
|
2024-03-02 20:10:30 +00:00
|
|
|
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
|
|
|
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
2021-03-05 03:08:47 +00:00
|
|
|
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
|
|
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
|
|
|
// No direct access to this file
|
|
|
|
defined('_JEXEC') or die('Restricted access');
|
|
|
|
?>
|
|
|
|
###BOM###
|
|
|
|
|
|
|
|
// No direct access to this file
|
|
|
|
defined('_JEXEC') or die('Restricted access');
|
|
|
|
|
2021-12-21 14:44:50 +00:00
|
|
|
###DASH_MODEL_HEADER###
|
|
|
|
|
2021-03-05 03:08:47 +00:00
|
|
|
/**
|
2022-05-25 08:30:55 +00:00
|
|
|
* ###Component### List Model
|
2021-03-05 03:08:47 +00:00
|
|
|
*/
|
2022-05-25 08:30:55 +00:00
|
|
|
class ###Component###Model###Component### extends ListModel
|
2021-03-05 03:08:47 +00:00
|
|
|
{
|
|
|
|
public function getIcons()
|
|
|
|
{
|
|
|
|
// load user for access menus
|
2024-03-02 20:10:30 +00:00
|
|
|
$user = Factory::getUser();
|
2021-03-05 03:08:47 +00:00
|
|
|
// reset icon array
|
2024-03-02 20:10:30 +00:00
|
|
|
$icons = [];
|
2021-03-05 03:08:47 +00:00
|
|
|
// view groups array
|
|
|
|
$viewGroups = array(
|
|
|
|
'main' => array(###DASHBOARDICONS###)
|
|
|
|
);###DASHBOARDICONACCESS###
|
|
|
|
// loop over the $views
|
|
|
|
foreach($viewGroups as $group => $views)
|
|
|
|
{
|
|
|
|
$i = 0;
|
2024-03-02 20:10:30 +00:00
|
|
|
if (Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($views))
|
2021-03-05 03:08:47 +00:00
|
|
|
{
|
|
|
|
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;
|
2024-03-02 20:10:30 +00:00
|
|
|
$viewName = $name;
|
|
|
|
$alt = $name;
|
|
|
|
$url = $url;
|
|
|
|
$image = $name . '.' . $type;
|
|
|
|
$name = 'COM_###COMPONENT###_DASHBOARD_' . Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe($name,'U');
|
2021-03-05 03:08:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// 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':
|
2024-03-02 20:10:30 +00:00
|
|
|
$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;
|
2021-03-05 03:08:47 +00:00
|
|
|
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;
|
|
|
|
}
|
2024-03-02 20:10:30 +00:00
|
|
|
$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');
|
2021-03-05 03:08:47 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2024-03-02 20:10:30 +00:00
|
|
|
$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;
|
2021-03-05 03:08:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2024-03-02 20:10:30 +00:00
|
|
|
$viewName = $view;
|
|
|
|
$alt = $view;
|
|
|
|
$url = 'index.php?option=com_###component###&view=' . $view;
|
|
|
|
$image = $view . '.png';
|
|
|
|
$name = ucwords($view).'<br /><br />';
|
|
|
|
$hover = false;
|
2021-03-05 03:08:47 +00:00
|
|
|
}
|
|
|
|
// first make sure the view access is set
|
2024-03-02 20:10:30 +00:00
|
|
|
if (Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($viewAccess))
|
2021-03-05 03:08:47 +00:00
|
|
|
{
|
|
|
|
// setup some defaults
|
|
|
|
$dashboard_add = false;
|
|
|
|
$dashboard_list = false;
|
|
|
|
$accessTo = '';
|
|
|
|
$accessAdd = '';
|
|
|
|
// access checking start
|
2024-03-02 20:10:30 +00:00
|
|
|
$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;
|
2021-03-05 03:08:47 +00:00
|
|
|
// set main controllers
|
2024-03-02 20:10:30 +00:00
|
|
|
$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;
|
2021-03-05 03:08:47 +00:00
|
|
|
// 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)
|
|
|
|
{
|
2024-03-02 20:10:30 +00:00
|
|
|
$dashboard_add = $user->authorise($viewAccess[$viewName.'.dashboard_add'], 'com_###component###');
|
2021-03-05 03:08:47 +00:00
|
|
|
}
|
|
|
|
if ($accessDashboard_list)
|
|
|
|
{
|
|
|
|
$dashboard_list = $user->authorise($viewAccess[$viewName.'.dashboard_list'], 'com_###component###');
|
|
|
|
}
|
2024-03-02 20:10:30 +00:00
|
|
|
if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($accessAdd) && Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($accessTo))
|
2021-03-05 03:08:47 +00:00
|
|
|
{
|
|
|
|
// check access
|
|
|
|
if($user->authorise($accessAdd, 'com_###component###') && $user->authorise($accessTo, 'com_###component###') && $dashboard_add)
|
|
|
|
{
|
2024-03-02 20:10:30 +00:00
|
|
|
$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;
|
2021-03-05 03:08:47 +00:00
|
|
|
}
|
|
|
|
}
|
2024-03-02 20:10:30 +00:00
|
|
|
elseif (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($accessTo))
|
2021-03-05 03:08:47 +00:00
|
|
|
{
|
|
|
|
// check access
|
|
|
|
if($user->authorise($accessTo, 'com_###component###') && $dashboard_list)
|
|
|
|
{
|
2024-03-02 20:10:30 +00:00
|
|
|
$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;
|
2021-03-05 03:08:47 +00:00
|
|
|
}
|
|
|
|
}
|
2024-03-02 20:10:30 +00:00
|
|
|
elseif (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($accessAdd))
|
2021-03-05 03:08:47 +00:00
|
|
|
{
|
|
|
|
// check access
|
|
|
|
if($user->authorise($accessAdd, 'com_###component###') && $dashboard_add)
|
|
|
|
{
|
2024-03-02 20:10:30 +00:00
|
|
|
$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;
|
2021-03-05 03:08:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2024-03-02 20:10:30 +00:00
|
|
|
$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;
|
2021-03-05 03:08:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2024-03-02 20:10:30 +00:00
|
|
|
$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;
|
2021-03-05 03:08:47 +00:00
|
|
|
}
|
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$icons[$group][$i] = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $icons;
|
|
|
|
}###DASH_MODEL_METHODS###
|
|
|
|
}
|