first commit
This commit is contained in:
144
apps/backend/modules/stBackend/actions/actions.class.php
Normal file
144
apps/backend/modules/stBackend/actions/actions.class.php
Normal file
@@ -0,0 +1,144 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
78
apps/backend/modules/stBackend/actions/components.class.php
Normal file
78
apps/backend/modules/stBackend/actions/components.class.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
class stBackendComponents extends sfComponents {
|
||||
|
||||
public function executeMenu()
|
||||
{
|
||||
$this->inverted = false;
|
||||
|
||||
$navigationBarItems = sfConfig::get('app_navigation_bar_items');
|
||||
|
||||
$menu = new stNavigationMenu();
|
||||
|
||||
foreach (sfConfig::get('app_navigation_bar_display') as $id => $items)
|
||||
{
|
||||
if (!isset($navigationBarItems[$id]))
|
||||
{
|
||||
throw new Exception(sprintf('Item "%s" does not exist in navigation_bar.items', $id));
|
||||
}
|
||||
|
||||
$navigationBarItem = $navigationBarItems[$id];
|
||||
|
||||
$item = $menu->addItem($id, $navigationBarItem['label'], isset($navigationBarItem['route']) ? $navigationBarItem['route'] : null, $navigationBarItem);
|
||||
|
||||
if ($items)
|
||||
{
|
||||
foreach (array_keys($items) as $childId)
|
||||
{
|
||||
if (!isset($navigationBarItems[$childId]))
|
||||
{
|
||||
throw new Exception(sprintf('Item "%s" does not exist in navigation_bar.items', $id));
|
||||
}
|
||||
|
||||
$navigationBarItem = $navigationBarItems[$childId];
|
||||
|
||||
$item->addItem($childId, $navigationBarItem['label'], isset($navigationBarItem['route']) ? $navigationBarItem['route'] : null, $navigationBarItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$configItem = $menu->getItem('configuration');
|
||||
|
||||
foreach (stConfiguration::getGroups() as $name => $title)
|
||||
{
|
||||
if (stConfiguration::getInstance()->hasDesktopModules($name))
|
||||
{
|
||||
$configItem->addItem($name, $title, '@stConfigurationPlugin?group='.$name.'#'.$name, array(
|
||||
'i18n' => 'stConfigurationBackend',
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
$this->items = $menu->getItems();
|
||||
}
|
||||
|
||||
public function executeAbuseInformation() {
|
||||
|
||||
}
|
||||
|
||||
public function executeUpdateInfo()
|
||||
{
|
||||
$version = stCommunication::getCurrentVersion();
|
||||
|
||||
stLicenseAbuse::checkLicenseAbuseStatus();
|
||||
|
||||
$this->has_valid_license = stCommunication::hasValidLicense();
|
||||
|
||||
$this->update = version_compare(stRegisterSync::getPackageVersion('soteshop'), $version, '<');
|
||||
}
|
||||
|
||||
public function executeLicenseInfo()
|
||||
{
|
||||
$info = stCommunication::getLicenseInfo();
|
||||
$config = stConfig::getInstance('stRegister');
|
||||
$this->change_subscription_url = stSoteHelper::getChangeSubscriptionUrl($this->getUser()->getCulture());
|
||||
$this->config = $config;
|
||||
$this->license_valid_until = $info['guarantee'];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user