124 lines
2.6 KiB
PHP
124 lines
2.6 KiB
PHP
<?php
|
|
|
|
class cvIngBackendActions extends stActions
|
|
{
|
|
|
|
public function executeConfig()
|
|
{
|
|
if($this->cfg->save()) {
|
|
$this->setFlash('notice', 'Dane zostały zapisane.', 0);
|
|
}
|
|
}
|
|
|
|
public function validateConfig()
|
|
{
|
|
$this->cfg = new cvIngCfg('cvIngBackend', $this->getConfigFields());
|
|
|
|
return $this->cfg->validate();
|
|
}
|
|
|
|
protected function getConfigFields()
|
|
{
|
|
sfLoader::loadHelpers(array(
|
|
'Helper',
|
|
'stUrl',
|
|
));
|
|
$i18n = $this->getContext()->getI18n();
|
|
$params = array(
|
|
'size' => 50,
|
|
'required' => true,
|
|
);
|
|
$validate = array(
|
|
'method' => 'isEmpty',
|
|
'message' => $i18n->__('To pole nie może być puste'),
|
|
);
|
|
$configFields['Identyfikatory sklepu'] = array(
|
|
'config' => array(
|
|
'client_id' => array(
|
|
'name' => $i18n->__('Identyfikator klienta'),
|
|
'type' => 'input_tag',
|
|
'params' => $params,
|
|
'validate' => $validate,
|
|
),
|
|
'shop_id' => array(
|
|
'name' => $i18n->__('Identyfikator sklepu'),
|
|
'type' => 'input_tag',
|
|
'params' => $params,
|
|
'validate' => $validate,
|
|
),
|
|
'shop_key' => array(
|
|
'name' => $i18n->__('Klucz sklepu'),
|
|
'type' => 'input_tag',
|
|
'params' => $params,
|
|
'validate' => $validate,
|
|
),
|
|
),
|
|
);
|
|
$configFields['Tryb testowy'] = array(
|
|
'config' => array(
|
|
'test_mode_enabled' => array(
|
|
'name' => $i18n->__('Używaj URL aplikacji sandbox'),
|
|
'type' => 'checkbox_tag',
|
|
'params' => array(),
|
|
),
|
|
'log_enabled' => array(
|
|
'name' => $i18n->__('Loguj dane do pliku'),
|
|
'type' => 'checkbox_tag',
|
|
'params' => array(),
|
|
),
|
|
),
|
|
);
|
|
$configFields['Adres notyfikacji'] = array(
|
|
'config' => array(
|
|
'report_success' => array(
|
|
'name' => $i18n->__('URL'),
|
|
'type' => 'plain',
|
|
'params' => array('value' => st_url_for('cv_ing_imoje/statusReport', true, 'frontend')),
|
|
),
|
|
),
|
|
);
|
|
|
|
return $configFields;
|
|
}
|
|
|
|
public function handleErrorConfig()
|
|
{
|
|
$this->cfg = new cvIngCfg('cvIngBackend', $this->getConfigFields());
|
|
|
|
return sfView::SUCCESS;
|
|
}
|
|
|
|
#TRANSLATIONS
|
|
|
|
public function executeTranslations()
|
|
{
|
|
if($this->cfg->save()) {
|
|
$this->setFlash('notice', 'Dane zostały zapisane.', 0);
|
|
}
|
|
}
|
|
|
|
public function validateTranslations()
|
|
{
|
|
$tl = new cvIngTranslationCfg();
|
|
$this->cfg = $tl->cfg;
|
|
|
|
return $this->cfg->validate();
|
|
}
|
|
|
|
public function handleErrorTranslations()
|
|
{
|
|
$tl = new cvIngTranslationCfg();
|
|
$this->cfg = $tl->cfg;
|
|
|
|
return sfView::SUCCESS;
|
|
}
|
|
|
|
public function executeTlRestoreDefaults()
|
|
{
|
|
$tl = new cvIngTranslationCfg();
|
|
$tl->cfg->createConfig();
|
|
|
|
return $this->renderText('Domyślne translacje przywrócone');
|
|
}
|
|
}
|