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');
|
|
|
|
|
2023-02-27 12:27:41 +00:00
|
|
|
###IMPORT_CONTROLLER_HEADER###
|
2021-03-05 03:08:47 +00:00
|
|
|
|
|
|
|
/**
|
2022-05-25 08:30:55 +00:00
|
|
|
* ###Component### Import Base Controller
|
2021-03-05 03:08:47 +00:00
|
|
|
*/
|
2022-05-25 08:30:55 +00:00
|
|
|
class ###Component###ControllerImport extends BaseController
|
2021-03-05 03:08:47 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Import an spreadsheet.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function import()
|
|
|
|
{
|
|
|
|
// Check for request forgeries
|
2024-03-02 20:10:30 +00:00
|
|
|
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
|
2021-03-05 03:08:47 +00:00
|
|
|
|
|
|
|
$model = $this->getModel('import');
|
|
|
|
if ($model->import())
|
|
|
|
{
|
2024-03-02 20:10:30 +00:00
|
|
|
$cache = Factory::getCache('mod_menu');
|
2021-03-05 03:08:47 +00:00
|
|
|
$cache->clean();
|
|
|
|
// TODO: Reset the users acl here as well to kill off any missing bits
|
|
|
|
}
|
|
|
|
|
2024-03-02 20:10:30 +00:00
|
|
|
$app = Factory::getApplication();
|
2021-03-05 03:08:47 +00:00
|
|
|
$redirect_url = $app->getUserState('com_###component###.redirect_url');
|
|
|
|
if (empty($redirect_url))
|
|
|
|
{
|
2024-03-02 20:10:30 +00:00
|
|
|
$redirect_url = Route::_('index.php?option=com_###component###&view=import', false);
|
2021-03-05 03:08:47 +00:00
|
|
|
}
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|