add some settings to core and delete from static pages

This commit is contained in:
Hesabix 2024-01-05 21:20:16 +00:00
parent 3ce75f730b
commit 7b132cdc17
3 changed files with 30 additions and 23 deletions

View file

@ -186,9 +186,13 @@ class AdminController extends AbstractController
$resp['description'] = $item->getDiscription(); $resp['description'] = $item->getDiscription();
$resp['scripts'] = $item->getScripts(); $resp['scripts'] = $item->getScripts();
$resp['zarinpal'] = $item->getZarinpalMerchant(); $resp['zarinpal'] = $item->getZarinpalMerchant();
$resp['footerScripts'] = $item->getFooterScripts();
$resp['appSite'] = $item->getAppSite();
$resp['footer'] = $item->getFooter();
return $this->json($resp); return $this->json($resp);
} }
#[Route('/api/admin/settings/system/info/save', name: 'admin_settings_system_info_save')] #[Route('/api/admin/settings/system/info/save', name: 'admin_settings_system_info_save')]
public function admin_settings_system_info_save(EntityManagerInterface $entityManager,Request $request): Response public function admin_settings_system_info_save(EntityManagerInterface $entityManager,Request $request): Response
{ {
@ -202,6 +206,9 @@ class AdminController extends AbstractController
$item->setDiscription($params['description']); $item->setDiscription($params['description']);
$item->setScripts($params['scripts']); $item->setScripts($params['scripts']);
$item->setZarinpalMerchant($params['zarinpal']); $item->setZarinpalMerchant($params['zarinpal']);
$item->setFooterScripts($params['footerScripts']);
$item->setAppSite($params['appSite']);
$item->setFooter($params['footer']);
$entityManager->persist($item); $entityManager->persist($item);
$entityManager->flush(); $entityManager->flush();
return $this->json(['result' => 1]); return $this->json(['result' => 1]);
@ -364,7 +371,7 @@ class AdminController extends AbstractController
/** /**
* @throws Exception * @throws Exception
*/ */
#[Route('/test', name: 'app_admin_database_backup_create')] #[Route('/api/admin/database/backup/create', name: 'app_admin_database_backup_create')]
public function app_admin_database_backup_create(KernelInterface $kernel):JsonResponse public function app_admin_database_backup_create(KernelInterface $kernel):JsonResponse
{ {
$application = new Application($kernel); $application = new Application($kernel);
@ -374,8 +381,6 @@ class AdminController extends AbstractController
'command' => 'doctrine:schema:create', 'command' => 'doctrine:schema:create',
// (optional) define the value of command arguments // (optional) define the value of command arguments
'--dump-sql' => true, '--dump-sql' => true,
'../../hesabixBackup/databaseFiles/file.sql'=>true,
]); ]);
// You can use NullOutput() if you don't need the output // You can use NullOutput() if you don't need the output
@ -383,8 +388,13 @@ class AdminController extends AbstractController
$application->run($input, $output); $application->run($input, $output);
// return the output, don't use if you used NullOutput() // return the output, don't use if you used NullOutput()
$content = $output->fetch(); $content = $output->fetch();
$time = time();
$file = fopen(dirname(__DIR__, 3) . '/hesabixBackup/versions/Hesabix-'. $time . '.sql' ,'w');
fwrite($file,$content);
fclose($file);
return $this->json([ return $this->json([
'message' => $content, 'result' => 0,
'filename'=>'Hesabix-' . $time . '.sql',
]); ]);
} }
} }

View file

@ -47,6 +47,9 @@ class Settings
#[ORM\Column(type: Types::TEXT, nullable: true)] #[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $footerScripts = null; private ?string $footerScripts = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $footer = null;
public function getId(): ?int public function getId(): ?int
{ {
return $this->id; return $this->id;
@ -183,4 +186,16 @@ class Settings
return $this; return $this;
} }
public function getFooter(): ?string
{
return $this->footer;
}
public function setFooter(?string $footer): static
{
$this->footer = $footer;
return $this;
}
} }

View file

@ -244,25 +244,7 @@
</div> </div>
</div> </div>
</div> </div>
<footer class="bg-body-light" id="page-footer"> {{settings.footer | raw}}
<div class="content py-0">
<div class="row fs-sm align-items-center">
<div class="col-sm-6 order-sm-2 mb-1 mb-sm-0 text-center text-sm-end">
<a class="fw-semibold" href="https://github.com/morrning/hesabixUI" target="_blank">حسابیکس</a>
با <i class="fa fa-heart text-danger"></i>
متن باز است.
</div>
<div class="col-sm-6 order-sm-1 text-center text-sm-start">
<a class="'btn btn-link" href="https://parspack.com" target="_blank">
<img style="max-width: 7rem" src="{{ asset('/img/parspack-logo.svg') }}" class="img-fluid" alt="parspack">
<span class="text-danger ms-2">
با خاطری آسوده، استوار بر روی راهکارهای ابری پارس‌پک
</span>
</a>
</div>
</div>
</div>
</footer>
<!-- END Footer --> <!-- END Footer -->
<!-- END Page Content --> <!-- END Page Content -->
</main> </main>