diff --git a/apps/maarch_entreprise/Controllers/ResController.php b/apps/maarch_entreprise/Controllers/ResController.php new file mode 100644 index 0000000000000000000000000000000000000000..fca943ef4d4d2c4f003921f2ad1c0f80a01492b7 --- /dev/null +++ b/apps/maarch_entreprise/Controllers/ResController.php @@ -0,0 +1,14 @@ +<?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 diff --git a/apps/maarch_entreprise/Models/ResModel.php b/apps/maarch_entreprise/Models/ResModel.php new file mode 100644 index 0000000000000000000000000000000000000000..ba534ee02d1943a8e4dfc4d37e3a7001ea539c75 --- /dev/null +++ b/apps/maarch_entreprise/Models/ResModel.php @@ -0,0 +1,26 @@ +<?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 diff --git a/apps/maarch_entreprise/Models/ResModelAbstract.php b/apps/maarch_entreprise/Models/ResModelAbstract.php new file mode 100644 index 0000000000000000000000000000000000000000..b57c6ad20747dce771f3680b0cba37393048bc81 --- /dev/null +++ b/apps/maarch_entreprise/Models/ResModelAbstract.php @@ -0,0 +1,73 @@ +<?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 diff --git a/rest/index.php b/rest/index.php new file mode 100644 index 0000000000000000000000000000000000000000..ea707c6254fea78f5aebbeb647f6ce37a2ddb571 --- /dev/null +++ b/rest/index.php @@ -0,0 +1,62 @@ +<?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