Skip to content
Snippets Groups Projects
Commit 7cc5f438 authored by Damien's avatar Damien
Browse files

FEAT #5232 Ajout de la base Rest pour slim framework

parent b369b084
No related branches found
No related tags found
No related merge requests found
<?php
namespace Apps\Controllers;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
class ResController {
public function get(RequestInterface $request, ResponseInterface $response, $args) {
}
}
\ No newline at end of file
<?php
/*
* Copyright 2015 Maarch
*
* This file is part of Maarch Framework.
*
* Maarch Framework is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Maarch Framework is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>.
*/
require_once 'apps/maarch_entreprise/Models/ResModelAbstract.php';
class ResModel extends ResModelAbstract {
// Do your stuff in this class
}
\ No newline at end of file
<?php
/*
* Copyright 2015 Maarch
*
* This file is part of Maarch Framework.
*
* Maarch Framework is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Maarch Framework is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>.
*/
require_once 'apps/maarch_entreprise/services/Table.php';
class ResModelAbstract extends Apps_Table_Service {
public static function get(array $aArgs = []) {
static::checkRequired($aArgs, ['resId']);
static::checkNumeric($aArgs, ['resId']);
$aReturn = static::select([
'select' => empty($aArgs['select']) ? ['*'] : $aArgs['select'],
'table' => ['res_letterbox'],
'where' => ['res_id = ?'],
'data' => [$aArgs['resId']]
]);
return $aReturn;
}
public static function getAvailableLinkedAttachmentsIn(array $aArgs = []) {
static::checkRequired($aArgs, ['resIdMaster', 'in']);
static::checkNumeric($aArgs, ['resIdMaster']);
static::checkArray($aArgs, ['in']);
$aReturn = static::select([
'select' => empty($aArgs['select']) ? ['*'] : $aArgs['select'],
'table' => ['res_view_attachments'],
'where' => ['res_id_master = ?', 'attachment_type in (?)', 'status not in (?)'],
'data' => [$aArgs['resIdMaster'], $aArgs['in'], ['DEL', 'TMP', 'OBS']]
]);
return $aReturn;
}
public static function getAvailableLinkedAttachmentsNotIn(array $aArgs = []) {
static::checkRequired($aArgs, ['resIdMaster', 'notIn']);
static::checkNumeric($aArgs, ['resIdMaster']);
static::checkArray($aArgs, ['notIn']);
$aReturn = static::select([
'select' => empty($aArgs['select']) ? ['*'] : $aArgs['select'],
'table' => ['res_view_attachments'],
'where' => ['res_id_master = ?', 'attachment_type not in (?)', 'status not in (?)'],
'data' => [$aArgs['resIdMaster'], $aArgs['notIn'], ['DEL', 'TMP', 'OBS']]
]);
return $aReturn;
}
}
\ No newline at end of file
<?php
require '../vendor/autoload.php';
header('Content-Type: text/html; charset=utf-8');
//create session if NO SESSION
if (empty($_SESSION['user'])) {
require_once('../core/class/class_functions.php');
include_once('../core/init.php');
require_once('core/class/class_portal.php');
require_once('core/class/class_db.php');
require_once('core/class/class_request.php');
require_once('core/class/class_core_tools.php');
require_once('core/class/web_service/class_web_service.php');
require_once('core/services/CoreConfig.php');
//load Maarch session vars
$portal = new portal();
$portal->unset_session();
$portal->build_config();
$coreTools = new core_tools();
$_SESSION['custom_override_id'] = $coreTools->get_custom_id();
if (isset($_SESSION['custom_override_id'])
&& ! empty($_SESSION['custom_override_id'])
&& isset($_SESSION['config']['corepath'])
&& ! empty($_SESSION['config']['corepath'])
) {
$path = $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR
. $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR;
set_include_path(
$path . PATH_SEPARATOR . $_SESSION['config']['corepath']
. PATH_SEPARATOR . get_include_path()
);
} else if (isset($_SESSION['config']['corepath'])
&& ! empty($_SESSION['config']['corepath'])
) {
set_include_path(
$_SESSION['config']['corepath'] . PATH_SEPARATOR . get_include_path()
);
}
// Load configuration from xml into session
Core_CoreConfig_Service::buildCoreConfig('core' . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'config.xml');
$_SESSION['config']['app_id'] = $_SESSION['businessapps'][0]['appid'];
require_once 'apps/' .$_SESSION['businessapps'][0]['appid']. '/class/class_business_app_tools.php';
Core_CoreConfig_Service::buildBusinessAppConfig();
// Load Modules configuration from xml into session
Core_CoreConfig_Service::loadModulesConfig($_SESSION['modules']);
Core_CoreConfig_Service::loadAppServices();
Core_CoreConfig_Service::loadModulesServices($_SESSION['modules']);
}
$app = new \Slim\App([
'settings' => [
'displayErrorDetails' => true
]
]);
$app->get('/signatureBook/{resId}', \Visa\Controllers\VisaController::class . ':getSignatureBook');
$app->run();
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment