145 lines
3.7 KiB
PHP
145 lines
3.7 KiB
PHP
<?php
|
|
|
|
class stBackendActions extends stActions
|
|
{
|
|
public function executePreviewMode()
|
|
{
|
|
$token = stSecureToken::createDBToken();
|
|
|
|
return $this->redirect(stRoutingHelper::generateApplicationUrl('@homepage', 'frontend', null, [
|
|
'preview_mode' => $token,
|
|
]));
|
|
}
|
|
|
|
public function executeAdditionalApplicationsList()
|
|
{
|
|
$applications = array();
|
|
|
|
$routing = sfRouting::getInstance();
|
|
|
|
foreach (stConfiguration::getInstance()->getDesktopModules() as $modules)
|
|
{
|
|
foreach ($modules as $module)
|
|
{
|
|
// if (preg_match('/^app|sm/', $module->getName()))
|
|
{
|
|
$applications[$module->getRoute()] = $module;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
foreach (stApplication::getDefaultDesktopApps() as $app => $name)
|
|
{
|
|
// if (preg_match('/^app|sm/', $app))
|
|
{
|
|
$module = new stBackendDesktopModule($routing, $app);
|
|
|
|
$applications[$module->getRoute()] = $module;
|
|
}
|
|
}
|
|
|
|
// Usuń powtarzajace sie aplikacje, zostaw w pierwszej kolejnosci odwolania do config
|
|
// np. jesli jest odwolania do Zamowień: order/list i order/config - to zostaw order/config
|
|
$app_config = array();
|
|
$applications_config = array();
|
|
foreach ($applications as $app_route => $app_object)
|
|
{
|
|
preg_match("/action=([a-zA-Z0-9]+)/", $app_route, $matches);
|
|
if (isset($matches[1]))
|
|
{
|
|
$app_action = $matches[1];
|
|
}
|
|
else
|
|
{
|
|
$app_action = "index";
|
|
}
|
|
$app_name = $app_object->getName();
|
|
|
|
// dopisz aplikację, jesli nie byla dodana lub jeśli byla dodana ale dodana akcja jst inna niz config
|
|
if ((empty($app_config[$app_name])) || ((!empty($app_config[$app_name])) && ($app_config[$app_name] != "config")))
|
|
{
|
|
if (empty($app_config[$app_name]))
|
|
{
|
|
// pomiń system punktowy (stary modul, ktory nie zostal usuniety i jest w kodzie, jest ukrywany tylko)
|
|
// opcja do poprawienia, wstawiona tymczasowo
|
|
if ($app_name != "stPointsBackend") $applications_config[$app_route] = $app_object;
|
|
}
|
|
$app_config[$app_name] = $app_action;
|
|
}
|
|
}
|
|
|
|
// $this->app_config=$app_config;
|
|
// end
|
|
|
|
$this->applications = $applications_config;;
|
|
|
|
uasort($this->applications, function ($m1, $m2)
|
|
{
|
|
return strnatcmp(strtolower($m1->getLabel()), strtolower($m2->getLabel()));
|
|
});
|
|
}
|
|
|
|
public function executeLicense()
|
|
{
|
|
$block = stCommunication::blockSite(10);
|
|
|
|
if (!$block)
|
|
{
|
|
stCommunication::refreshLicenseInformation();
|
|
|
|
stPartialCache::clear('stBackend', '_updateInfo', array('app' => 'backend'));
|
|
|
|
return $this->redirect($this->getRequest()->getReferer());
|
|
}
|
|
}
|
|
|
|
public function executeCheckService()
|
|
{
|
|
|
|
stCommunication::refreshLicenseInformation();
|
|
|
|
sfLoader::loadHelpers(array('Helper', 'stBackend'));
|
|
|
|
return $this->renderText(get_service_information());
|
|
}
|
|
|
|
public function executeUpdateInfoRefresh()
|
|
{
|
|
stCommunication::refreshLicenseInformation();
|
|
|
|
stPartialCache::clear('stBackend', '_updateInfo', array('app' => 'backend'));
|
|
|
|
return $this->renderText($this->getRenderComponent('stBackend', 'updateInfo'));
|
|
}
|
|
|
|
public function executeLicenseInfoRefresh()
|
|
{
|
|
stCommunication::refreshLicenseInformation();
|
|
|
|
stPartialCache::clear('stBackend', '_licenseInfo', array('app' => 'backend'));
|
|
|
|
return $this->renderText($this->getRenderComponent('stBackend', 'licenseInfo'));
|
|
}
|
|
|
|
public function executeChangeLeftMenuVisibility()
|
|
{
|
|
$config = stAdminGeneratorUserConfiguration::getDefault(sfContext::getInstance());
|
|
|
|
$config->setParameter('left_menu.hidden', $this->getRequestParameter('hidden', false));
|
|
|
|
$config->save();
|
|
}
|
|
|
|
public function executeChangeContentViewport()
|
|
{
|
|
$config = stAdminGeneratorUserConfiguration::getDefault(sfContext::getInstance());
|
|
|
|
$config->setParameter('viewport.expanded', $this->getRequestParameter('expanded', false));
|
|
|
|
$config->save();
|
|
|
|
return sfView::HEADER_ONLY;
|
|
}
|
|
}
|