57 lines
2.0 KiB
PHP
57 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace api\classes;
|
|
|
|
use api\classes\API;
|
|
|
|
require_once 'API.php';
|
|
|
|
class API_portalsettings extends API
|
|
{
|
|
public function updatePortalSettings()
|
|
{
|
|
$query = "UPDATE system_settings SET portal_name = ?, portal_provider_name = ?, admin_auth_methods = ? WHERE portal_uuid = ?";
|
|
$stmt = $this->prepareStatement($query);
|
|
$stmt->bind_param("ssss", $this->data['portal_name'], $this->data['portal_provider_name'], $this->data['admin_auth_methods'], $this->data['portal_uuid']);
|
|
|
|
if ($this->executeStatement($stmt)) {
|
|
$this->apiOutput(200, ['success' => 'portal settings updated successfully.']);
|
|
}
|
|
}
|
|
|
|
public function getPortalSettings()
|
|
{
|
|
|
|
list($query, $types, $params) = $this->buildDynamicQuery('system_settings');
|
|
|
|
$items = $this->generalGetFunction($query, $types, $params, false, 'Settings');
|
|
|
|
return ($items);
|
|
}
|
|
|
|
public function updatePortalSettingsOfficeTravelReimburse()
|
|
{
|
|
$setParts = [
|
|
'office_travelreimburse_cents_homework_incl = :homework_incl',
|
|
'office_travelreimburse_cents_homework_excl = :homework_excl',
|
|
'office_travelreimburse_cents_business_incl = :business_incl',
|
|
'office_travelreimburse_cents_business_excl = :business_excl',
|
|
];
|
|
|
|
$params = [
|
|
':homework_incl' => $this->data['office_travelreimburse_cents_homework_incl'],
|
|
':homework_excl' => $this->data['office_travelreimburse_cents_homework_excl'],
|
|
':business_incl' => $this->data['office_travelreimburse_cents_business_incl'],
|
|
':business_excl' => $this->data['office_travelreimburse_cents_business_excl'],
|
|
':portal_uuid' => $this->data['portal_uuid'],
|
|
];
|
|
|
|
$query = "UPDATE system_settings SET " . implode(", ", $setParts) . "
|
|
WHERE portal_uuid = :portal_uuid";
|
|
|
|
$stmt = $this->pdo->prepare($query);
|
|
$stmt->execute($params);
|
|
|
|
$this->apiOutput(200, ['success' => 'portal settings updated successfully.']);
|
|
}
|
|
} |