Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
/**
* Copyright Maarch since 2008 under licence GPLv3.
* See LICENCE.txt file at the root folder for more details.
* This file is part of Maarch software.
*
*/
/**
* @brief External Signature Book Controller
* @author dev@maarch.org
*/
namespace ExternalSignatoryBook\controllers;
use Slim\Http\Request;
use Slim\Http\Response;
use SrcCore\models\CoreConfigModel;
class ExternalSignatureBookController
{
public function getEnabledSignatureBook(Request $request, Response $response)
{
$enabledSignatureBook = null;
$loadedXml = CoreConfigModel::getXmlLoaded(['path' => 'modules/visa/xml/remoteSignatoryBooks.xml']);
if (!empty($loadedXml)) {
$enabledOne = (string)$loadedXml->signatoryBookEnabled;
foreach ($loadedXml->signatoryBook as $value) {
if ((string)$value->id == $enabledOne) {
if (!empty($value->url) && !empty($value->userId) && !empty($value->password)) {
$enabledSignatureBook = $enabledOne;
}
break;
}
}
}
return $response->withJson(['enabledSignatureBook' => $enabledSignatureBook]);
}
}