public function executePreActions()
{
/** @var AttributeBagInterface $objSessionBag */
$objSessionBag = \System::getContainer()->get('session')->getBag('contao_backend');
switch ($this->strAction) {
// Toggle navigation menu
case 'toggleNavigation':
$bemod = $objSessionBag->get('backend_modules');
$bemod[\Input::post('id')] = intval(\Input::post('state'));
$objSessionBag->set('backend_modules', $bemod);
throw new NoContentResponseException();
// Load a navigation menu group
// Load a navigation menu group
case 'loadNavigation':
$bemod = $objSessionBag->get('backend_modules');
$bemod[\Input::post('id')] = intval(\Input::post('state'));
$objSessionBag->set('backend_modules', $bemod);
$this->import('BackendUser', 'User');
/** @var BackendTemplate|object $objTemplate */
$objTemplate = new \BackendTemplate('be_navigation');
$navigation = $this->User->navigation();
$objTemplate->modules = $navigation[\Input::post('id')]['modules'];
throw new ResponseException($objTemplate->getResponse());
// Toggle nodes of the file or page tree
// Toggle nodes of the file or page tree
case 'toggleStructure':
case 'toggleFileManager':
case 'togglePagetree':
case 'toggleFiletree':
$this->strAjaxId = preg_replace('/.*_([0-9a-zA-Z]+)$/', '$1', \Input::post('id'));
$this->strAjaxKey = str_replace('_' . $this->strAjaxId, '', \Input::post('id'));
if (\Input::get('act') == 'editAll') {
$this->strAjaxKey = preg_replace('/(.*)_[0-9a-zA-Z]+$/', '$1', $this->strAjaxKey);
$this->strAjaxName = preg_replace('/.*_([0-9a-zA-Z]+)$/', '$1', \Input::post('name'));
}
$nodes = $objSessionBag->get($this->strAjaxKey);
$nodes[$this->strAjaxId] = intval(\Input::post('state'));
$objSessionBag->set($this->strAjaxKey, $nodes);
throw new NoContentResponseException();
// Load nodes of the file or page tree
// Load nodes of the file or page tree
case 'loadStructure':
case 'loadFileManager':
case 'loadPagetree':
case 'loadFiletree':
$this->strAjaxId = preg_replace('/.*_([0-9a-zA-Z]+)$/', '$1', \Input::post('id'));
$this->strAjaxKey = str_replace('_' . $this->strAjaxId, '', \Input::post('id'));
if (\Input::get('act') == 'editAll') {
$this->strAjaxKey = preg_replace('/(.*)_[0-9a-zA-Z]+$/', '$1', $this->strAjaxKey);
$this->strAjaxName = preg_replace('/.*_([0-9a-zA-Z]+)$/', '$1', \Input::post('name'));
}
$nodes = $objSessionBag->get($this->strAjaxKey);
$nodes[$this->strAjaxId] = intval(\Input::post('state'));
$objSessionBag->set($this->strAjaxKey, $nodes);
break;
// Toggle the visibility of a fieldset
// Toggle the visibility of a fieldset
case 'toggleFieldset':
$fs = $objSessionBag->get('fieldset_states');
$fs[\Input::post('table')][\Input::post('id')] = intval(\Input::post('state'));
$objSessionBag->set('fieldset_states', $fs);
throw new NoContentResponseException();
// Toggle checkbox groups
// Toggle checkbox groups
case 'toggleCheckboxGroup':
$state = $objSessionBag->get('checkbox_groups');
$state[\Input::post('id')] = intval(\Input::post('state'));
$objSessionBag->set('checkbox_groups', $state);
break;
// HOOK: pass unknown actions to callback functions
// HOOK: pass unknown actions to callback functions
default:
if (isset($GLOBALS['TL_HOOKS']['executePreActions']) && is_array($GLOBALS['TL_HOOKS']['executePreActions'])) {
foreach ($GLOBALS['TL_HOOKS']['executePreActions'] as $callback) {
$this->import($callback[0]);
$this->{$callback[0]}->{$callback[1]}($this->strAction);
}
}
break;
}
}