Release of v4.0.0-rc1
Improved the Schema Table update engine (more). Fix autoloader timing, and loading. Implement the Joomla Powers in JCB code, to move away from JClasses.
This commit is contained in:
@@ -17,9 +17,8 @@ use Joomla\Utilities\ArrayHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
@@ -55,69 +54,6 @@ class Admin_viewsController extends AdminController
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
}
|
||||
|
||||
public function exportData()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// check if export is allowed for this user.
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
if ($user->authorise('admin_view.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the input
|
||||
$input = Factory::getApplication()->input;
|
||||
$pks = $input->post->get('cid', array(), 'array');
|
||||
// Sanitize the input
|
||||
$pks = ArrayHelper::toInteger($pks);
|
||||
// Get the model
|
||||
$model = $this->getModel('Admin_views');
|
||||
// get the data to export
|
||||
$data = $model->getExportData($pks);
|
||||
if (UtilitiesArrayHelper::check($data))
|
||||
{
|
||||
// now set the data to the spreadsheet
|
||||
$date = Factory::getDate();
|
||||
ComponentbuilderHelper::xls($data,'Admin_views_'.$date->format('jS_F_Y'),'Admin views exported ('.$date->format('jS F, Y').')','admin views');
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_EXPORT_FAILED');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=admin_views', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
public function importData()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// check if import is allowed for this user.
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
if ($user->authorise('admin_view.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the import model
|
||||
$model = $this->getModel('Admin_views');
|
||||
// get the headers to import
|
||||
$headers = $model->getExImPortHeaders();
|
||||
if (ObjectHelper::check($headers))
|
||||
{
|
||||
// Load headers to session.
|
||||
$session = Factory::getSession();
|
||||
$headers = json_encode($headers);
|
||||
$session->set('admin_view_VDM_IMPORTHEADERS', $headers);
|
||||
$session->set('backto_VDM_IMPORT', 'admin_views');
|
||||
$session->set('dataType_VDM_IMPORTINTO', 'admin_view');
|
||||
// Redirect to import view.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_ADMIN_VIEWS');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=import', false), $message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_IMPORT_FAILED');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=admin_views', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Run the Expansion
|
||||
@@ -131,7 +67,7 @@ class Admin_viewsController extends AdminController
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
// set page redirect
|
||||
$redirect_url = \JRoute::_('index.php?option=com_componentbuilder&view=admin_views', false);
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=admin_views', false);
|
||||
// set massage
|
||||
$message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE');
|
||||
// check if this user has the right to run expansion
|
||||
@@ -140,7 +76,7 @@ class Admin_viewsController extends AdminController
|
||||
// set massage
|
||||
$message = Text::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB');
|
||||
// run expansion via API
|
||||
$result = ComponentbuilderHelper::getFileContents(\JUri::root() . 'index.php?option=com_componentbuilder&task=api.expand');
|
||||
$result = ComponentbuilderHelper::getFileContents(Uri::root() . 'index.php?option=com_componentbuilder&task=api.expand');
|
||||
// is there a message returned
|
||||
if (!is_numeric($result) && StringHelper::check($result))
|
||||
{
|
||||
|
@@ -17,8 +17,6 @@ use Joomla\Utilities\ArrayHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
@@ -53,67 +51,4 @@ class Class_methodsController extends AdminController
|
||||
{
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
}
|
||||
|
||||
public function exportData()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// check if export is allowed for this user.
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
if ($user->authorise('class_method.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the input
|
||||
$input = Factory::getApplication()->input;
|
||||
$pks = $input->post->get('cid', array(), 'array');
|
||||
// Sanitize the input
|
||||
$pks = ArrayHelper::toInteger($pks);
|
||||
// Get the model
|
||||
$model = $this->getModel('Class_methods');
|
||||
// get the data to export
|
||||
$data = $model->getExportData($pks);
|
||||
if (UtilitiesArrayHelper::check($data))
|
||||
{
|
||||
// now set the data to the spreadsheet
|
||||
$date = Factory::getDate();
|
||||
ComponentbuilderHelper::xls($data,'Class_methods_'.$date->format('jS_F_Y'),'Class methods exported ('.$date->format('jS F, Y').')','class methods');
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_EXPORT_FAILED');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=class_methods', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
public function importData()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// check if import is allowed for this user.
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
if ($user->authorise('class_method.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the import model
|
||||
$model = $this->getModel('Class_methods');
|
||||
// get the headers to import
|
||||
$headers = $model->getExImPortHeaders();
|
||||
if (ObjectHelper::check($headers))
|
||||
{
|
||||
// Load headers to session.
|
||||
$session = Factory::getSession();
|
||||
$headers = json_encode($headers);
|
||||
$session->set('class_method_VDM_IMPORTHEADERS', $headers);
|
||||
$session->set('backto_VDM_IMPORT', 'class_methods');
|
||||
$session->set('dataType_VDM_IMPORTINTO', 'class_method');
|
||||
// Redirect to import view.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_CLASS_METHODS');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=import', false), $message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_IMPORT_FAILED');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=class_methods', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
}
|
@@ -17,8 +17,6 @@ use Joomla\Utilities\ArrayHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
@@ -53,67 +51,4 @@ class Class_propertiesController extends AdminController
|
||||
{
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
}
|
||||
|
||||
public function exportData()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// check if export is allowed for this user.
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
if ($user->authorise('class_property.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the input
|
||||
$input = Factory::getApplication()->input;
|
||||
$pks = $input->post->get('cid', array(), 'array');
|
||||
// Sanitize the input
|
||||
$pks = ArrayHelper::toInteger($pks);
|
||||
// Get the model
|
||||
$model = $this->getModel('Class_properties');
|
||||
// get the data to export
|
||||
$data = $model->getExportData($pks);
|
||||
if (UtilitiesArrayHelper::check($data))
|
||||
{
|
||||
// now set the data to the spreadsheet
|
||||
$date = Factory::getDate();
|
||||
ComponentbuilderHelper::xls($data,'Class_properties_'.$date->format('jS_F_Y'),'Class properties exported ('.$date->format('jS F, Y').')','class properties');
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_EXPORT_FAILED');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=class_properties', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
public function importData()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// check if import is allowed for this user.
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
if ($user->authorise('class_property.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the import model
|
||||
$model = $this->getModel('Class_properties');
|
||||
// get the headers to import
|
||||
$headers = $model->getExImPortHeaders();
|
||||
if (ObjectHelper::check($headers))
|
||||
{
|
||||
// Load headers to session.
|
||||
$session = Factory::getSession();
|
||||
$headers = json_encode($headers);
|
||||
$session->set('class_property_VDM_IMPORTHEADERS', $headers);
|
||||
$session->set('backto_VDM_IMPORT', 'class_properties');
|
||||
$session->set('dataType_VDM_IMPORTINTO', 'class_property');
|
||||
// Redirect to import view.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_CLASS_PROPERTIES');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=import', false), $message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_IMPORT_FAILED');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=class_properties', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
}
|
@@ -21,6 +21,7 @@ use VDM\Joomla\Componentbuilder\Compiler\Factory as CFactory;
|
||||
use Joomla\CMS\Version;
|
||||
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
@@ -142,7 +143,7 @@ class CompilerController extends AdminController
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=compiler', false);
|
||||
if (($pos = strpos($model->compiler->filepath['component'], "/tmp/")) !== FALSE)
|
||||
{
|
||||
$url = \JUri::root() . substr($model->compiler->filepath['component'], $pos + 1);
|
||||
$url = Uri::root() . substr($model->compiler->filepath['component'], $pos + 1);
|
||||
}
|
||||
// check if we have plugins
|
||||
$add_plugin_install = UtilitiesArrayHelper::check($model->compiler->filepath['plugins'], true);
|
||||
@@ -225,7 +226,7 @@ class CompilerController extends AdminController
|
||||
$message[] = '<b>Module Path:</b> <code>' . $module_path . '</code><br />';
|
||||
if (($pos = strpos($module_path, "/tmp/")) !== FALSE)
|
||||
{
|
||||
$module_urls[$module_id] = \JUri::root() . substr($module_path, $pos + 1);
|
||||
$module_urls[$module_id] = Uri::root() . substr($module_path, $pos + 1);
|
||||
$message[] = '<b>Module URL:</b> <code>' . $module_urls[$module_id] . '</code><br />';
|
||||
}
|
||||
}
|
||||
@@ -241,7 +242,7 @@ class CompilerController extends AdminController
|
||||
$message[] = '<b>Plugin Path:</b> <code>' . $plugin_path . '</code><br />';
|
||||
if (($pos = strpos($plugin_path, "/tmp/")) !== FALSE)
|
||||
{
|
||||
$plugin_urls[$plugin_id] = \JUri::root() . substr($plugin_path, $pos + 1);
|
||||
$plugin_urls[$plugin_id] = Uri::root() . substr($plugin_path, $pos + 1);
|
||||
$message[] = '<b>Plugin URL:</b> <code>' . $plugin_urls[$plugin_id] . '</code><br />';
|
||||
}
|
||||
}
|
||||
@@ -547,7 +548,7 @@ class CompilerController extends AdminController
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
// set page redirect
|
||||
$redirect_url = \JRoute::_('index.php?option=com_componentbuilder&view=compiler', false);
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=compiler', false);
|
||||
// set massage
|
||||
$message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE');
|
||||
// check if this user has the right to run expansion
|
||||
@@ -556,7 +557,7 @@ class CompilerController extends AdminController
|
||||
// set massage
|
||||
$message = Text::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB');
|
||||
// run expansion via API
|
||||
$result = ComponentbuilderHelper::getFileContents(\JUri::root() . 'index.php?option=com_componentbuilder&task=api.expand');
|
||||
$result = ComponentbuilderHelper::getFileContents(Uri::root() . 'index.php?option=com_componentbuilder&task=api.expand');
|
||||
// is there a message returned
|
||||
if (!is_numeric($result) && StringHelper::check($result))
|
||||
{
|
||||
|
@@ -17,8 +17,6 @@ use Joomla\Utilities\ArrayHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
@@ -54,69 +52,6 @@ class Custom_admin_viewsController extends AdminController
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
}
|
||||
|
||||
public function exportData()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// check if export is allowed for this user.
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
if ($user->authorise('custom_admin_view.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the input
|
||||
$input = Factory::getApplication()->input;
|
||||
$pks = $input->post->get('cid', array(), 'array');
|
||||
// Sanitize the input
|
||||
$pks = ArrayHelper::toInteger($pks);
|
||||
// Get the model
|
||||
$model = $this->getModel('Custom_admin_views');
|
||||
// get the data to export
|
||||
$data = $model->getExportData($pks);
|
||||
if (UtilitiesArrayHelper::check($data))
|
||||
{
|
||||
// now set the data to the spreadsheet
|
||||
$date = Factory::getDate();
|
||||
ComponentbuilderHelper::xls($data,'Custom_admin_views_'.$date->format('jS_F_Y'),'Custom admin views exported ('.$date->format('jS F, Y').')','custom admin views');
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_EXPORT_FAILED');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=custom_admin_views', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
public function importData()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// check if import is allowed for this user.
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
if ($user->authorise('custom_admin_view.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the import model
|
||||
$model = $this->getModel('Custom_admin_views');
|
||||
// get the headers to import
|
||||
$headers = $model->getExImPortHeaders();
|
||||
if (ObjectHelper::check($headers))
|
||||
{
|
||||
// Load headers to session.
|
||||
$session = Factory::getSession();
|
||||
$headers = json_encode($headers);
|
||||
$session->set('custom_admin_view_VDM_IMPORTHEADERS', $headers);
|
||||
$session->set('backto_VDM_IMPORT', 'custom_admin_views');
|
||||
$session->set('dataType_VDM_IMPORTINTO', 'custom_admin_view');
|
||||
// Redirect to import view.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_CUSTOM_ADMIN_VIEWS');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=import', false), $message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_IMPORT_FAILED');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=custom_admin_views', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
public function getSnippets()
|
||||
{
|
||||
// Check for request forgeries
|
||||
|
@@ -17,9 +17,8 @@ use Joomla\Utilities\ArrayHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
@@ -55,69 +54,6 @@ class Custom_codesController extends AdminController
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
}
|
||||
|
||||
public function exportData()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// check if export is allowed for this user.
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
if ($user->authorise('custom_code.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the input
|
||||
$input = Factory::getApplication()->input;
|
||||
$pks = $input->post->get('cid', array(), 'array');
|
||||
// Sanitize the input
|
||||
$pks = ArrayHelper::toInteger($pks);
|
||||
// Get the model
|
||||
$model = $this->getModel('Custom_codes');
|
||||
// get the data to export
|
||||
$data = $model->getExportData($pks);
|
||||
if (UtilitiesArrayHelper::check($data))
|
||||
{
|
||||
// now set the data to the spreadsheet
|
||||
$date = Factory::getDate();
|
||||
ComponentbuilderHelper::xls($data,'Custom_codes_'.$date->format('jS_F_Y'),'Custom codes exported ('.$date->format('jS F, Y').')','custom codes');
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_EXPORT_FAILED');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=custom_codes', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
public function importData()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// check if import is allowed for this user.
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
if ($user->authorise('custom_code.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the import model
|
||||
$model = $this->getModel('Custom_codes');
|
||||
// get the headers to import
|
||||
$headers = $model->getExImPortHeaders();
|
||||
if (ObjectHelper::check($headers))
|
||||
{
|
||||
// Load headers to session.
|
||||
$session = Factory::getSession();
|
||||
$headers = json_encode($headers);
|
||||
$session->set('custom_code_VDM_IMPORTHEADERS', $headers);
|
||||
$session->set('backto_VDM_IMPORT', 'custom_codes');
|
||||
$session->set('dataType_VDM_IMPORTINTO', 'custom_code');
|
||||
// Redirect to import view.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_CUSTOM_CODES');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=import', false), $message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_IMPORT_FAILED');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=custom_codes', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Run the Expansion
|
||||
@@ -131,7 +67,7 @@ class Custom_codesController extends AdminController
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
// set page redirect
|
||||
$redirect_url = \JRoute::_('index.php?option=com_componentbuilder&view=custom_codes', false);
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=custom_codes', false);
|
||||
// set massage
|
||||
$message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE');
|
||||
// check if this user has the right to run expansion
|
||||
@@ -140,7 +76,7 @@ class Custom_codesController extends AdminController
|
||||
// set massage
|
||||
$message = Text::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB');
|
||||
// run expansion via API
|
||||
$result = ComponentbuilderHelper::getFileContents(\JUri::root() . 'index.php?option=com_componentbuilder&task=api.expand');
|
||||
$result = ComponentbuilderHelper::getFileContents(Uri::root() . 'index.php?option=com_componentbuilder&task=api.expand');
|
||||
// is there a message returned
|
||||
if (!is_numeric($result) && StringHelper::check($result))
|
||||
{
|
||||
|
@@ -17,9 +17,8 @@ use Joomla\Utilities\ArrayHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
@@ -55,69 +54,6 @@ class Dynamic_getsController extends AdminController
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
}
|
||||
|
||||
public function exportData()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// check if export is allowed for this user.
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
if ($user->authorise('dynamic_get.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the input
|
||||
$input = Factory::getApplication()->input;
|
||||
$pks = $input->post->get('cid', array(), 'array');
|
||||
// Sanitize the input
|
||||
$pks = ArrayHelper::toInteger($pks);
|
||||
// Get the model
|
||||
$model = $this->getModel('Dynamic_gets');
|
||||
// get the data to export
|
||||
$data = $model->getExportData($pks);
|
||||
if (UtilitiesArrayHelper::check($data))
|
||||
{
|
||||
// now set the data to the spreadsheet
|
||||
$date = Factory::getDate();
|
||||
ComponentbuilderHelper::xls($data,'Dynamic_gets_'.$date->format('jS_F_Y'),'Dynamic gets exported ('.$date->format('jS F, Y').')','dynamic gets');
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_EXPORT_FAILED');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=dynamic_gets', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
public function importData()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// check if import is allowed for this user.
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
if ($user->authorise('dynamic_get.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the import model
|
||||
$model = $this->getModel('Dynamic_gets');
|
||||
// get the headers to import
|
||||
$headers = $model->getExImPortHeaders();
|
||||
if (ObjectHelper::check($headers))
|
||||
{
|
||||
// Load headers to session.
|
||||
$session = Factory::getSession();
|
||||
$headers = json_encode($headers);
|
||||
$session->set('dynamic_get_VDM_IMPORTHEADERS', $headers);
|
||||
$session->set('backto_VDM_IMPORT', 'dynamic_gets');
|
||||
$session->set('dataType_VDM_IMPORTINTO', 'dynamic_get');
|
||||
// Redirect to import view.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_DYNAMIC_GETS');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=import', false), $message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_IMPORT_FAILED');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=dynamic_gets', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Run the Expansion
|
||||
@@ -131,7 +67,7 @@ class Dynamic_getsController extends AdminController
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
// set page redirect
|
||||
$redirect_url = \JRoute::_('index.php?option=com_componentbuilder&view=dynamic_gets', false);
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=dynamic_gets', false);
|
||||
// set massage
|
||||
$message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE');
|
||||
// check if this user has the right to run expansion
|
||||
@@ -140,7 +76,7 @@ class Dynamic_getsController extends AdminController
|
||||
// set massage
|
||||
$message = Text::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB');
|
||||
// run expansion via API
|
||||
$result = ComponentbuilderHelper::getFileContents(\JUri::root() . 'index.php?option=com_componentbuilder&task=api.expand');
|
||||
$result = ComponentbuilderHelper::getFileContents(Uri::root() . 'index.php?option=com_componentbuilder&task=api.expand');
|
||||
// is there a message returned
|
||||
if (!is_numeric($result) && StringHelper::check($result))
|
||||
{
|
||||
|
@@ -17,9 +17,8 @@ use Joomla\Utilities\ArrayHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
@@ -55,69 +54,6 @@ class FieldsController extends AdminController
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
}
|
||||
|
||||
public function exportData()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// check if export is allowed for this user.
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
if ($user->authorise('field.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the input
|
||||
$input = Factory::getApplication()->input;
|
||||
$pks = $input->post->get('cid', array(), 'array');
|
||||
// Sanitize the input
|
||||
$pks = ArrayHelper::toInteger($pks);
|
||||
// Get the model
|
||||
$model = $this->getModel('Fields');
|
||||
// get the data to export
|
||||
$data = $model->getExportData($pks);
|
||||
if (UtilitiesArrayHelper::check($data))
|
||||
{
|
||||
// now set the data to the spreadsheet
|
||||
$date = Factory::getDate();
|
||||
ComponentbuilderHelper::xls($data,'Fields_'.$date->format('jS_F_Y'),'Fields exported ('.$date->format('jS F, Y').')','fields');
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_EXPORT_FAILED');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=fields', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
public function importData()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// check if import is allowed for this user.
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
if ($user->authorise('field.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the import model
|
||||
$model = $this->getModel('Fields');
|
||||
// get the headers to import
|
||||
$headers = $model->getExImPortHeaders();
|
||||
if (ObjectHelper::check($headers))
|
||||
{
|
||||
// Load headers to session.
|
||||
$session = Factory::getSession();
|
||||
$headers = json_encode($headers);
|
||||
$session->set('field_VDM_IMPORTHEADERS', $headers);
|
||||
$session->set('backto_VDM_IMPORT', 'fields');
|
||||
$session->set('dataType_VDM_IMPORTINTO', 'field');
|
||||
// Redirect to import view.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_FIELDS');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=import', false), $message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_IMPORT_FAILED');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=fields', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Run the Expansion
|
||||
@@ -131,7 +67,7 @@ class FieldsController extends AdminController
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
// set page redirect
|
||||
$redirect_url = \JRoute::_('index.php?option=com_componentbuilder&view=fields', false);
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=fields', false);
|
||||
// set massage
|
||||
$message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE');
|
||||
// check if this user has the right to run expansion
|
||||
@@ -140,7 +76,7 @@ class FieldsController extends AdminController
|
||||
// set massage
|
||||
$message = Text::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB');
|
||||
// run expansion via API
|
||||
$result = ComponentbuilderHelper::getFileContents(\JUri::root() . 'index.php?option=com_componentbuilder&task=api.expand');
|
||||
$result = ComponentbuilderHelper::getFileContents(Uri::root() . 'index.php?option=com_componentbuilder&task=api.expand');
|
||||
// is there a message returned
|
||||
if (!is_numeric($result) && StringHelper::check($result))
|
||||
{
|
||||
|
@@ -17,8 +17,6 @@ use Joomla\Utilities\ArrayHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
@@ -53,67 +51,4 @@ class FieldtypesController extends AdminController
|
||||
{
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
}
|
||||
|
||||
public function exportData()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// check if export is allowed for this user.
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
if ($user->authorise('fieldtype.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the input
|
||||
$input = Factory::getApplication()->input;
|
||||
$pks = $input->post->get('cid', array(), 'array');
|
||||
// Sanitize the input
|
||||
$pks = ArrayHelper::toInteger($pks);
|
||||
// Get the model
|
||||
$model = $this->getModel('Fieldtypes');
|
||||
// get the data to export
|
||||
$data = $model->getExportData($pks);
|
||||
if (UtilitiesArrayHelper::check($data))
|
||||
{
|
||||
// now set the data to the spreadsheet
|
||||
$date = Factory::getDate();
|
||||
ComponentbuilderHelper::xls($data,'Fieldtypes_'.$date->format('jS_F_Y'),'Fieldtypes exported ('.$date->format('jS F, Y').')','fieldtypes');
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_EXPORT_FAILED');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=fieldtypes', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
public function importData()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// check if import is allowed for this user.
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
if ($user->authorise('fieldtype.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the import model
|
||||
$model = $this->getModel('Fieldtypes');
|
||||
// get the headers to import
|
||||
$headers = $model->getExImPortHeaders();
|
||||
if (ObjectHelper::check($headers))
|
||||
{
|
||||
// Load headers to session.
|
||||
$session = Factory::getSession();
|
||||
$headers = json_encode($headers);
|
||||
$session->set('fieldtype_VDM_IMPORTHEADERS', $headers);
|
||||
$session->set('backto_VDM_IMPORT', 'fieldtypes');
|
||||
$session->set('dataType_VDM_IMPORTINTO', 'fieldtype');
|
||||
// Redirect to import view.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_FIELDTYPES');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=import', false), $message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_IMPORT_FAILED');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=fieldtypes', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
}
|
@@ -17,8 +17,6 @@ use Joomla\Utilities\ArrayHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
@@ -53,67 +51,4 @@ class Help_documentsController extends AdminController
|
||||
{
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
}
|
||||
|
||||
public function exportData()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// check if export is allowed for this user.
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
if ($user->authorise('help_document.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the input
|
||||
$input = Factory::getApplication()->input;
|
||||
$pks = $input->post->get('cid', array(), 'array');
|
||||
// Sanitize the input
|
||||
$pks = ArrayHelper::toInteger($pks);
|
||||
// Get the model
|
||||
$model = $this->getModel('Help_documents');
|
||||
// get the data to export
|
||||
$data = $model->getExportData($pks);
|
||||
if (UtilitiesArrayHelper::check($data))
|
||||
{
|
||||
// now set the data to the spreadsheet
|
||||
$date = Factory::getDate();
|
||||
ComponentbuilderHelper::xls($data,'Help_documents_'.$date->format('jS_F_Y'),'Help documents exported ('.$date->format('jS F, Y').')','help documents');
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_EXPORT_FAILED');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=help_documents', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
public function importData()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// check if import is allowed for this user.
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
if ($user->authorise('help_document.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the import model
|
||||
$model = $this->getModel('Help_documents');
|
||||
// get the headers to import
|
||||
$headers = $model->getExImPortHeaders();
|
||||
if (ObjectHelper::check($headers))
|
||||
{
|
||||
// Load headers to session.
|
||||
$session = Factory::getSession();
|
||||
$headers = json_encode($headers);
|
||||
$session->set('help_document_VDM_IMPORTHEADERS', $headers);
|
||||
$session->set('backto_VDM_IMPORT', 'help_documents');
|
||||
$session->set('dataType_VDM_IMPORTINTO', 'help_document');
|
||||
// Redirect to import view.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_HELP_DOCUMENTS');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=import', false), $message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_IMPORT_FAILED');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=help_documents', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
}
|
@@ -1,64 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @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
|
||||
*/
|
||||
namespace VDM\Component\Componentbuilder\Administrator\Controller;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\MVC\Controller\BaseController;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Componentbuilder 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_componentbuilder.redirect_url');
|
||||
if (empty($redirect_url))
|
||||
{
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=import', false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// wipe out the user state when we're going to redirect
|
||||
$app->setUserState('com_componentbuilder.redirect_url', '');
|
||||
$app->setUserState('com_componentbuilder.message', '');
|
||||
$app->setUserState('com_componentbuilder.extension_message', '');
|
||||
}
|
||||
$this->setRedirect($redirect_url);
|
||||
}
|
||||
}
|
@@ -21,6 +21,7 @@ use VDM\Joomla\Componentbuilder\Package\Factory as PackageFactory;
|
||||
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
@@ -132,7 +133,7 @@ class Joomla_componentsController extends AdminController
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
// set page redirect
|
||||
$redirect_url = \JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false);
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=joomla_components', false);
|
||||
// set massage
|
||||
$message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE');
|
||||
// check if this user has the right to run expansion
|
||||
@@ -141,7 +142,7 @@ class Joomla_componentsController extends AdminController
|
||||
// set massage
|
||||
$message = Text::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB');
|
||||
// run expansion via API
|
||||
$result = ComponentbuilderHelper::getFileContents(\JUri::root() . 'index.php?option=com_componentbuilder&task=api.expand');
|
||||
$result = ComponentbuilderHelper::getFileContents(Uri::root() . 'index.php?option=com_componentbuilder&task=api.expand');
|
||||
// is there a message returned
|
||||
if (!is_numeric($result) && StringHelper::check($result))
|
||||
{
|
||||
|
@@ -17,8 +17,6 @@ use Joomla\Utilities\ArrayHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
@@ -54,69 +52,6 @@ class Joomla_modulesController extends AdminController
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
}
|
||||
|
||||
public function exportData()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// check if export is allowed for this user.
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
if ($user->authorise('joomla_module.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the input
|
||||
$input = Factory::getApplication()->input;
|
||||
$pks = $input->post->get('cid', array(), 'array');
|
||||
// Sanitize the input
|
||||
$pks = ArrayHelper::toInteger($pks);
|
||||
// Get the model
|
||||
$model = $this->getModel('Joomla_modules');
|
||||
// get the data to export
|
||||
$data = $model->getExportData($pks);
|
||||
if (UtilitiesArrayHelper::check($data))
|
||||
{
|
||||
// now set the data to the spreadsheet
|
||||
$date = Factory::getDate();
|
||||
ComponentbuilderHelper::xls($data,'Joomla_modules_'.$date->format('jS_F_Y'),'Joomla modules exported ('.$date->format('jS F, Y').')','joomla modules');
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_EXPORT_FAILED');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=joomla_modules', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
public function importData()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// check if import is allowed for this user.
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
if ($user->authorise('joomla_module.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the import model
|
||||
$model = $this->getModel('Joomla_modules');
|
||||
// get the headers to import
|
||||
$headers = $model->getExImPortHeaders();
|
||||
if (ObjectHelper::check($headers))
|
||||
{
|
||||
// Load headers to session.
|
||||
$session = Factory::getSession();
|
||||
$headers = json_encode($headers);
|
||||
$session->set('joomla_module_VDM_IMPORTHEADERS', $headers);
|
||||
$session->set('backto_VDM_IMPORT', 'joomla_modules');
|
||||
$session->set('dataType_VDM_IMPORTINTO', 'joomla_module');
|
||||
// Redirect to import view.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_JOOMLA_MODULES');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=import', false), $message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_IMPORT_FAILED');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=joomla_modules', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
public function getSnippets()
|
||||
{
|
||||
// Check for request forgeries
|
||||
|
@@ -18,6 +18,7 @@ use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
@@ -66,7 +67,7 @@ class Joomla_pluginsController extends AdminController
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
// set page redirect
|
||||
$redirect_url = \JRoute::_('index.php?option=com_componentbuilder&view=joomla_plugins', false);
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=joomla_plugins', false);
|
||||
// set massage
|
||||
$message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE');
|
||||
// check if this user has the right to run expansion
|
||||
@@ -75,7 +76,7 @@ class Joomla_pluginsController extends AdminController
|
||||
// set massage
|
||||
$message = Text::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB');
|
||||
// run expansion via API
|
||||
$result = ComponentbuilderHelper::getFileContents(\JUri::root() . 'index.php?option=com_componentbuilder&task=api.expand');
|
||||
$result = ComponentbuilderHelper::getFileContents(Uri::root() . 'index.php?option=com_componentbuilder&task=api.expand');
|
||||
// is there a message returned
|
||||
if (!is_numeric($result) && StringHelper::check($result))
|
||||
{
|
||||
@@ -106,7 +107,7 @@ class Joomla_pluginsController extends AdminController
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
// set page redirect
|
||||
$redirect_url = \JRoute::_('index.php?option=com_componentbuilder&view=joomla_plugins', false);
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=joomla_plugins', false);
|
||||
// set massage
|
||||
$message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_GET_BOILERPLATE_MODULE');
|
||||
// check if this user has the right to run expansion
|
||||
|
@@ -17,8 +17,6 @@ use Joomla\Utilities\ArrayHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
@@ -54,69 +52,6 @@ class LanguagesController extends AdminController
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
}
|
||||
|
||||
public function exportData()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// check if export is allowed for this user.
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
if ($user->authorise('language.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the input
|
||||
$input = Factory::getApplication()->input;
|
||||
$pks = $input->post->get('cid', array(), 'array');
|
||||
// Sanitize the input
|
||||
$pks = ArrayHelper::toInteger($pks);
|
||||
// Get the model
|
||||
$model = $this->getModel('Languages');
|
||||
// get the data to export
|
||||
$data = $model->getExportData($pks);
|
||||
if (UtilitiesArrayHelper::check($data))
|
||||
{
|
||||
// now set the data to the spreadsheet
|
||||
$date = Factory::getDate();
|
||||
ComponentbuilderHelper::xls($data,'Languages_'.$date->format('jS_F_Y'),'Languages exported ('.$date->format('jS F, Y').')','languages');
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_EXPORT_FAILED');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=languages', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
public function importData()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// check if import is allowed for this user.
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
if ($user->authorise('language.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the import model
|
||||
$model = $this->getModel('Languages');
|
||||
// get the headers to import
|
||||
$headers = $model->getExImPortHeaders();
|
||||
if (ObjectHelper::check($headers))
|
||||
{
|
||||
// Load headers to session.
|
||||
$session = Factory::getSession();
|
||||
$headers = json_encode($headers);
|
||||
$session->set('language_VDM_IMPORTHEADERS', $headers);
|
||||
$session->set('backto_VDM_IMPORT', 'languages');
|
||||
$session->set('dataType_VDM_IMPORTINTO', 'language');
|
||||
// Redirect to import view.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_LANGUAGES');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=import', false), $message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_IMPORT_FAILED');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=languages', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
public function buildLanguages()
|
||||
{
|
||||
// Check for request forgeries
|
||||
|
@@ -17,8 +17,6 @@ use Joomla\Utilities\ArrayHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
@@ -54,69 +52,6 @@ class LayoutsController extends AdminController
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
}
|
||||
|
||||
public function exportData()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// check if export is allowed for this user.
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
if ($user->authorise('layout.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the input
|
||||
$input = Factory::getApplication()->input;
|
||||
$pks = $input->post->get('cid', array(), 'array');
|
||||
// Sanitize the input
|
||||
$pks = ArrayHelper::toInteger($pks);
|
||||
// Get the model
|
||||
$model = $this->getModel('Layouts');
|
||||
// get the data to export
|
||||
$data = $model->getExportData($pks);
|
||||
if (UtilitiesArrayHelper::check($data))
|
||||
{
|
||||
// now set the data to the spreadsheet
|
||||
$date = Factory::getDate();
|
||||
ComponentbuilderHelper::xls($data,'Layouts_'.$date->format('jS_F_Y'),'Layouts exported ('.$date->format('jS F, Y').')','layouts');
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_EXPORT_FAILED');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=layouts', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
public function importData()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// check if import is allowed for this user.
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
if ($user->authorise('layout.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the import model
|
||||
$model = $this->getModel('Layouts');
|
||||
// get the headers to import
|
||||
$headers = $model->getExImPortHeaders();
|
||||
if (ObjectHelper::check($headers))
|
||||
{
|
||||
// Load headers to session.
|
||||
$session = Factory::getSession();
|
||||
$headers = json_encode($headers);
|
||||
$session->set('layout_VDM_IMPORTHEADERS', $headers);
|
||||
$session->set('backto_VDM_IMPORT', 'layouts');
|
||||
$session->set('dataType_VDM_IMPORTINTO', 'layout');
|
||||
// Redirect to import view.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_LAYOUTS');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=import', false), $message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_IMPORT_FAILED');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=layouts', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
public function getSnippets()
|
||||
{
|
||||
// Check for request forgeries
|
||||
|
@@ -17,8 +17,6 @@ use Joomla\Utilities\ArrayHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
@@ -53,67 +51,4 @@ class PlaceholdersController extends AdminController
|
||||
{
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
}
|
||||
|
||||
public function exportData()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// check if export is allowed for this user.
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
if ($user->authorise('placeholder.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the input
|
||||
$input = Factory::getApplication()->input;
|
||||
$pks = $input->post->get('cid', array(), 'array');
|
||||
// Sanitize the input
|
||||
$pks = ArrayHelper::toInteger($pks);
|
||||
// Get the model
|
||||
$model = $this->getModel('Placeholders');
|
||||
// get the data to export
|
||||
$data = $model->getExportData($pks);
|
||||
if (UtilitiesArrayHelper::check($data))
|
||||
{
|
||||
// now set the data to the spreadsheet
|
||||
$date = Factory::getDate();
|
||||
ComponentbuilderHelper::xls($data,'Placeholders_'.$date->format('jS_F_Y'),'Placeholders exported ('.$date->format('jS F, Y').')','placeholders');
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_EXPORT_FAILED');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=placeholders', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
public function importData()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// check if import is allowed for this user.
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
if ($user->authorise('placeholder.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the import model
|
||||
$model = $this->getModel('Placeholders');
|
||||
// get the headers to import
|
||||
$headers = $model->getExImPortHeaders();
|
||||
if (ObjectHelper::check($headers))
|
||||
{
|
||||
// Load headers to session.
|
||||
$session = Factory::getSession();
|
||||
$headers = json_encode($headers);
|
||||
$session->set('placeholder_VDM_IMPORTHEADERS', $headers);
|
||||
$session->set('backto_VDM_IMPORT', 'placeholders');
|
||||
$session->set('dataType_VDM_IMPORTINTO', 'placeholder');
|
||||
// Redirect to import view.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_PLACEHOLDERS');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=import', false), $message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_IMPORT_FAILED');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=placeholders', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
}
|
@@ -20,6 +20,7 @@ use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use VDM\Joomla\Componentbuilder\Power\Factory as PowerFactory;
|
||||
use VDM\Joomla\Utilities\GetHelper;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
@@ -68,7 +69,7 @@ class PowersController extends AdminController
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
// set page redirect
|
||||
$redirect_url = \JRoute::_('index.php?option=com_componentbuilder&view=powers', false);
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=powers', false);
|
||||
// set massage
|
||||
$message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE');
|
||||
// check if this user has the right to run expansion
|
||||
@@ -77,7 +78,7 @@ class PowersController extends AdminController
|
||||
// set massage
|
||||
$message = Text::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB');
|
||||
// run expansion via API
|
||||
$result = ComponentbuilderHelper::getFileContents(\JUri::root() . 'index.php?option=com_componentbuilder&task=api.expand');
|
||||
$result = ComponentbuilderHelper::getFileContents(Uri::root() . 'index.php?option=com_componentbuilder&task=api.expand');
|
||||
// is there a message returned
|
||||
if (!is_numeric($result) && StringHelper::check($result))
|
||||
{
|
||||
|
@@ -17,8 +17,6 @@ use Joomla\Utilities\ArrayHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
@@ -53,67 +51,4 @@ class ServersController extends AdminController
|
||||
{
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
}
|
||||
|
||||
public function exportData()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// check if export is allowed for this user.
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
if ($user->authorise('server.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the input
|
||||
$input = Factory::getApplication()->input;
|
||||
$pks = $input->post->get('cid', array(), 'array');
|
||||
// Sanitize the input
|
||||
$pks = ArrayHelper::toInteger($pks);
|
||||
// Get the model
|
||||
$model = $this->getModel('Servers');
|
||||
// get the data to export
|
||||
$data = $model->getExportData($pks);
|
||||
if (UtilitiesArrayHelper::check($data))
|
||||
{
|
||||
// now set the data to the spreadsheet
|
||||
$date = Factory::getDate();
|
||||
ComponentbuilderHelper::xls($data,'Servers_'.$date->format('jS_F_Y'),'Servers exported ('.$date->format('jS F, Y').')','servers');
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_EXPORT_FAILED');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=servers', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
public function importData()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// check if import is allowed for this user.
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
if ($user->authorise('server.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the import model
|
||||
$model = $this->getModel('Servers');
|
||||
// get the headers to import
|
||||
$headers = $model->getExImPortHeaders();
|
||||
if (ObjectHelper::check($headers))
|
||||
{
|
||||
// Load headers to session.
|
||||
$session = Factory::getSession();
|
||||
$headers = json_encode($headers);
|
||||
$session->set('server_VDM_IMPORTHEADERS', $headers);
|
||||
$session->set('backto_VDM_IMPORT', 'servers');
|
||||
$session->set('dataType_VDM_IMPORTINTO', 'server');
|
||||
// Redirect to import view.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_SERVERS');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=import', false), $message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_IMPORT_FAILED');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=servers', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
}
|
@@ -17,8 +17,6 @@ use Joomla\Utilities\ArrayHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
@@ -54,69 +52,6 @@ class Site_viewsController extends AdminController
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
}
|
||||
|
||||
public function exportData()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// check if export is allowed for this user.
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
if ($user->authorise('site_view.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the input
|
||||
$input = Factory::getApplication()->input;
|
||||
$pks = $input->post->get('cid', array(), 'array');
|
||||
// Sanitize the input
|
||||
$pks = ArrayHelper::toInteger($pks);
|
||||
// Get the model
|
||||
$model = $this->getModel('Site_views');
|
||||
// get the data to export
|
||||
$data = $model->getExportData($pks);
|
||||
if (UtilitiesArrayHelper::check($data))
|
||||
{
|
||||
// now set the data to the spreadsheet
|
||||
$date = Factory::getDate();
|
||||
ComponentbuilderHelper::xls($data,'Site_views_'.$date->format('jS_F_Y'),'Site views exported ('.$date->format('jS F, Y').')','site views');
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_EXPORT_FAILED');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=site_views', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
public function importData()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// check if import is allowed for this user.
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
if ($user->authorise('site_view.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the import model
|
||||
$model = $this->getModel('Site_views');
|
||||
// get the headers to import
|
||||
$headers = $model->getExImPortHeaders();
|
||||
if (ObjectHelper::check($headers))
|
||||
{
|
||||
// Load headers to session.
|
||||
$session = Factory::getSession();
|
||||
$headers = json_encode($headers);
|
||||
$session->set('site_view_VDM_IMPORTHEADERS', $headers);
|
||||
$session->set('backto_VDM_IMPORT', 'site_views');
|
||||
$session->set('dataType_VDM_IMPORTINTO', 'site_view');
|
||||
// Redirect to import view.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_SITE_VIEWS');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=import', false), $message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_IMPORT_FAILED');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=site_views', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
public function getSnippets()
|
||||
{
|
||||
// Check for request forgeries
|
||||
|
@@ -18,7 +18,6 @@ use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
@@ -54,69 +53,6 @@ class SnippetsController extends AdminController
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
}
|
||||
|
||||
public function exportData()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// check if export is allowed for this user.
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
if ($user->authorise('snippet.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the input
|
||||
$input = Factory::getApplication()->input;
|
||||
$pks = $input->post->get('cid', array(), 'array');
|
||||
// Sanitize the input
|
||||
$pks = ArrayHelper::toInteger($pks);
|
||||
// Get the model
|
||||
$model = $this->getModel('Snippets');
|
||||
// get the data to export
|
||||
$data = $model->getExportData($pks);
|
||||
if (UtilitiesArrayHelper::check($data))
|
||||
{
|
||||
// now set the data to the spreadsheet
|
||||
$date = Factory::getDate();
|
||||
ComponentbuilderHelper::xls($data,'Snippets_'.$date->format('jS_F_Y'),'Snippets exported ('.$date->format('jS F, Y').')','snippets');
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_EXPORT_FAILED');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=snippets', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
public function importData()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// check if import is allowed for this user.
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
if ($user->authorise('snippet.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the import model
|
||||
$model = $this->getModel('Snippets');
|
||||
// get the headers to import
|
||||
$headers = $model->getExImPortHeaders();
|
||||
if (ObjectHelper::check($headers))
|
||||
{
|
||||
// Load headers to session.
|
||||
$session = Factory::getSession();
|
||||
$headers = json_encode($headers);
|
||||
$session->set('snippet_VDM_IMPORTHEADERS', $headers);
|
||||
$session->set('backto_VDM_IMPORT', 'snippets');
|
||||
$session->set('dataType_VDM_IMPORTINTO', 'snippet');
|
||||
// Redirect to import view.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_SNIPPETS');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=import', false), $message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_IMPORT_FAILED');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=snippets', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
public function getSnippets()
|
||||
{
|
||||
// Check for request forgeries
|
||||
|
@@ -17,8 +17,6 @@ use Joomla\Utilities\ArrayHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
@@ -54,69 +52,6 @@ class TemplatesController extends AdminController
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
}
|
||||
|
||||
public function exportData()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// check if export is allowed for this user.
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
if ($user->authorise('template.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the input
|
||||
$input = Factory::getApplication()->input;
|
||||
$pks = $input->post->get('cid', array(), 'array');
|
||||
// Sanitize the input
|
||||
$pks = ArrayHelper::toInteger($pks);
|
||||
// Get the model
|
||||
$model = $this->getModel('Templates');
|
||||
// get the data to export
|
||||
$data = $model->getExportData($pks);
|
||||
if (UtilitiesArrayHelper::check($data))
|
||||
{
|
||||
// now set the data to the spreadsheet
|
||||
$date = Factory::getDate();
|
||||
ComponentbuilderHelper::xls($data,'Templates_'.$date->format('jS_F_Y'),'Templates exported ('.$date->format('jS F, Y').')','templates');
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_EXPORT_FAILED');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=templates', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
public function importData()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// check if import is allowed for this user.
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
if ($user->authorise('template.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the import model
|
||||
$model = $this->getModel('Templates');
|
||||
// get the headers to import
|
||||
$headers = $model->getExImPortHeaders();
|
||||
if (ObjectHelper::check($headers))
|
||||
{
|
||||
// Load headers to session.
|
||||
$session = Factory::getSession();
|
||||
$headers = json_encode($headers);
|
||||
$session->set('template_VDM_IMPORTHEADERS', $headers);
|
||||
$session->set('backto_VDM_IMPORT', 'templates');
|
||||
$session->set('dataType_VDM_IMPORTINTO', 'template');
|
||||
// Redirect to import view.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_TEMPLATES');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=import', false), $message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_IMPORT_FAILED');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=templates', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
public function getSnippets()
|
||||
{
|
||||
// Check for request forgeries
|
||||
|
@@ -17,9 +17,8 @@ use Joomla\Utilities\ArrayHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
@@ -55,69 +54,6 @@ class Validation_rulesController extends AdminController
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
}
|
||||
|
||||
public function exportData()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// check if export is allowed for this user.
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
if ($user->authorise('validation_rule.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the input
|
||||
$input = Factory::getApplication()->input;
|
||||
$pks = $input->post->get('cid', array(), 'array');
|
||||
// Sanitize the input
|
||||
$pks = ArrayHelper::toInteger($pks);
|
||||
// Get the model
|
||||
$model = $this->getModel('Validation_rules');
|
||||
// get the data to export
|
||||
$data = $model->getExportData($pks);
|
||||
if (UtilitiesArrayHelper::check($data))
|
||||
{
|
||||
// now set the data to the spreadsheet
|
||||
$date = Factory::getDate();
|
||||
ComponentbuilderHelper::xls($data,'Validation_rules_'.$date->format('jS_F_Y'),'Validation rules exported ('.$date->format('jS F, Y').')','validation rules');
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_EXPORT_FAILED');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=validation_rules', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
public function importData()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
// check if import is allowed for this user.
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
if ($user->authorise('validation_rule.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the import model
|
||||
$model = $this->getModel('Validation_rules');
|
||||
// get the headers to import
|
||||
$headers = $model->getExImPortHeaders();
|
||||
if (ObjectHelper::check($headers))
|
||||
{
|
||||
// Load headers to session.
|
||||
$session = Factory::getSession();
|
||||
$headers = json_encode($headers);
|
||||
$session->set('validation_rule_VDM_IMPORTHEADERS', $headers);
|
||||
$session->set('backto_VDM_IMPORT', 'validation_rules');
|
||||
$session->set('dataType_VDM_IMPORTINTO', 'validation_rule');
|
||||
// Redirect to import view.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_VALIDATION_RULES');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=import', false), $message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = Text::_('COM_COMPONENTBUILDER_IMPORT_FAILED');
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=validation_rules', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Run the Expansion
|
||||
@@ -131,7 +67,7 @@ class Validation_rulesController extends AdminController
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
// set page redirect
|
||||
$redirect_url = \JRoute::_('index.php?option=com_componentbuilder&view=validation_rules', false);
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=validation_rules', false);
|
||||
// set massage
|
||||
$message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE');
|
||||
// check if this user has the right to run expansion
|
||||
@@ -140,7 +76,7 @@ class Validation_rulesController extends AdminController
|
||||
// set massage
|
||||
$message = Text::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB');
|
||||
// run expansion via API
|
||||
$result = ComponentbuilderHelper::getFileContents(\JUri::root() . 'index.php?option=com_componentbuilder&task=api.expand');
|
||||
$result = ComponentbuilderHelper::getFileContents(Uri::root() . 'index.php?option=com_componentbuilder&task=api.expand');
|
||||
// is there a message returned
|
||||
if (!is_numeric($result) && StringHelper::check($result))
|
||||
{
|
||||
|
Reference in New Issue
Block a user