-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
41 changed files
with
4,219 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<IfModule mod_rewrite.c> | ||
RewriteEngine On | ||
|
||
# Some hosts may require you to use the `RewriteBase` directive. | ||
# Determine the RewriteBase automatically and set it as environment variable. | ||
# If you are using Apache aliases to do mass virtual hosting or installed the | ||
# project in a subdirectory, the base path will be prepended to allow proper | ||
# resolution of the index.php file and to redirect to the correct URI. It will | ||
# work in environments without path prefix as well, providing a safe, one-size | ||
# fits all solution. But as you do not need it in this case, you can comment | ||
# the following 2 lines to eliminate the overhead. | ||
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$ | ||
RewriteRule ^(.*) - [E=BASE:%1] | ||
|
||
# If the above doesn't work you might need to set the `RewriteBase` directive manually, it should be the | ||
# absolute physical path to the directory that contains this htaccess file. | ||
# RewriteBase / | ||
|
||
RewriteCond %{REQUEST_FILENAME} !-f | ||
RewriteRule ^ index.php [QSA,L] | ||
</IfModule> |
132 changes: 132 additions & 0 deletions
132
appexemplo_v2.5/api/api_controllers/Acesso_menuAPI.class.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
<?php | ||
/** | ||
* System generated by SysGen (System Generator with Formdin Framework) | ||
* Download SysGen: https://github.com/bjverde/sysgen | ||
* Download Formdin Framework: https://github.com/bjverde/formDin | ||
* | ||
* SysGen Version: 1.12.0 | ||
* FormDin Version: 4.19.0 | ||
* | ||
* System appev2 created in: 2022-09-28 00:42:11 | ||
*/ | ||
|
||
namespace api_controllers; | ||
|
||
use Psr\Http\Message\ServerRequestInterface as Request; | ||
use Psr\Http\Message\ResponseInterface as Response; | ||
|
||
class Acesso_menuAPI | ||
{ | ||
|
||
public function __construct() | ||
{ | ||
} | ||
|
||
//-------------------------------------------------------------------------------- | ||
public static function selectAll(Request $request, Response $response, array $args) | ||
{ | ||
try{ | ||
$param = $request->getQueryParams(); | ||
$page = TGenericAPI::getSelectNumPage($param); | ||
$rowsPerPage = TGenericAPI::getSelectNumRowsPerPage($param); | ||
$orderBy = null; | ||
$where = array(); | ||
$controller = new \Acesso_menu(); | ||
//$result = $controller->selectAll(); | ||
$qtd_total = $controller->selectCount( $where ); | ||
$result = $controller->selectAllPagination( $orderBy, $where, $page, $rowsPerPage); | ||
$result = \ArrayHelper::convertArrayFormDin2Pdo($result); | ||
$msg = array( 'qtd_total'=> $qtd_total | ||
, 'qtd_result'=> \CountHelper::count($result) | ||
, 'page'=>$page | ||
, 'pages'=>$page | ||
, 'result'=>round($qtd_total/$rowsPerPage) | ||
); | ||
$response = TGenericAPI::getBodyJson($msg,$response,200); | ||
return $response; | ||
} catch ( \Exception $e) { | ||
$msg = $e->getMessage(); | ||
$response = TGenericAPI::getBodyJson($msg,$response,500); | ||
return $response; | ||
} | ||
} | ||
|
||
//-------------------------------------------------------------------------------- | ||
private static function selectByIdInside(array $args) | ||
{ | ||
$id = $args['id']; | ||
$controller = new \Acesso_menu(); | ||
$result = $controller->selectById($id); | ||
$result = \ArrayHelper::convertArrayFormDin2Pdo($result); | ||
return $result; | ||
} | ||
|
||
//-------------------------------------------------------------------------------- | ||
public static function selectById(Request $request, Response $response, array $args) | ||
{ | ||
try{ | ||
$result = self::selectByIdInside($args); | ||
$msg = array( 'qtd'=> \CountHelper::count($result) | ||
, 'result'=>$result | ||
); | ||
$response = TGenericAPI::getBodyJson($msg,$response,200); | ||
return $response; | ||
} catch ( \Exception $e) { | ||
$msg = $e->getMessage(); | ||
$response = TGenericAPI::getBodyJson($msg,$response,500); | ||
return $response; | ||
} | ||
} | ||
|
||
//-------------------------------------------------------------------------------- | ||
public static function save(Request $request, Response $response, array $args) | ||
{ | ||
try{ | ||
$vo = new \Acesso_menuVO; | ||
$msg = \Message::GENERIC_INSERT; | ||
if($request->getMethod() == 'PUT'){ | ||
$msg = \Message::GENERIC_UPDATE; | ||
$result = self::selectByIdInside($args); | ||
$bodyRequest = \ArrayHelper::get($result,0); | ||
if( empty($bodyRequest) ){ | ||
throw new \DomainException(\Message::GENERIC_ID_NOT_EXIST); | ||
} | ||
$vo = \FormDinHelper::setPropertyVo($bodyRequest,$vo); | ||
} | ||
$bodyRequest = json_decode($request->getBody(),true); | ||
if( empty($bodyRequest) ){ | ||
$bodyRequest = $request->getParsedBody(); | ||
} | ||
$vo = \FormDinHelper::setPropertyVo($bodyRequest,$vo); | ||
$controller = new \Acesso_menu; | ||
$controller->save($vo); | ||
|
||
$response = TGenericAPI::getBodyJson($msg,$response,200); | ||
return $response; | ||
} catch ( \Exception $e) { | ||
$msg = $e->getMessage(); | ||
$response = TGenericAPI::getBodyJson($msg,$response,500); | ||
return $response; | ||
} | ||
} | ||
|
||
//-------------------------------------------------------------------------------- | ||
public static function delete(Request $request, Response $response, array $args) | ||
{ | ||
try{ | ||
$id = $args['id']; | ||
$controller = new \Acesso_menu; | ||
$msg = $controller->delete($id); | ||
if($msg==true){ | ||
$msg = \Message::GENERIC_DELETE; | ||
$msg = $msg.' id='.$id; | ||
} | ||
$response = TGenericAPI::getBodyJson($msg,$response,200); | ||
return $response; | ||
} catch ( \Exception $e) { | ||
$msg = $e->getMessage(); | ||
$response = TGenericAPI::getBodyJson($msg,$response,500); | ||
return $response; | ||
} | ||
} | ||
} |
132 changes: 132 additions & 0 deletions
132
appexemplo_v2.5/api/api_controllers/Acesso_perfilAPI.class.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
<?php | ||
/** | ||
* System generated by SysGen (System Generator with Formdin Framework) | ||
* Download SysGen: https://github.com/bjverde/sysgen | ||
* Download Formdin Framework: https://github.com/bjverde/formDin | ||
* | ||
* SysGen Version: 1.12.0 | ||
* FormDin Version: 4.19.0 | ||
* | ||
* System appev2 created in: 2022-09-28 00:42:11 | ||
*/ | ||
|
||
namespace api_controllers; | ||
|
||
use Psr\Http\Message\ServerRequestInterface as Request; | ||
use Psr\Http\Message\ResponseInterface as Response; | ||
|
||
class Acesso_perfilAPI | ||
{ | ||
|
||
public function __construct() | ||
{ | ||
} | ||
|
||
//-------------------------------------------------------------------------------- | ||
public static function selectAll(Request $request, Response $response, array $args) | ||
{ | ||
try{ | ||
$param = $request->getQueryParams(); | ||
$page = TGenericAPI::getSelectNumPage($param); | ||
$rowsPerPage = TGenericAPI::getSelectNumRowsPerPage($param); | ||
$orderBy = null; | ||
$where = array(); | ||
$controller = new \Acesso_perfil(); | ||
//$result = $controller->selectAll(); | ||
$qtd_total = $controller->selectCount( $where ); | ||
$result = $controller->selectAllPagination( $orderBy, $where, $page, $rowsPerPage); | ||
$result = \ArrayHelper::convertArrayFormDin2Pdo($result); | ||
$msg = array( 'qtd_total'=> $qtd_total | ||
, 'qtd_result'=> \CountHelper::count($result) | ||
, 'page'=>$page | ||
, 'pages'=>$page | ||
, 'result'=>round($qtd_total/$rowsPerPage) | ||
); | ||
$response = TGenericAPI::getBodyJson($msg,$response,200); | ||
return $response; | ||
} catch ( \Exception $e) { | ||
$msg = $e->getMessage(); | ||
$response = TGenericAPI::getBodyJson($msg,$response,500); | ||
return $response; | ||
} | ||
} | ||
|
||
//-------------------------------------------------------------------------------- | ||
private static function selectByIdInside(array $args) | ||
{ | ||
$id = $args['id']; | ||
$controller = new \Acesso_perfil(); | ||
$result = $controller->selectById($id); | ||
$result = \ArrayHelper::convertArrayFormDin2Pdo($result); | ||
return $result; | ||
} | ||
|
||
//-------------------------------------------------------------------------------- | ||
public static function selectById(Request $request, Response $response, array $args) | ||
{ | ||
try{ | ||
$result = self::selectByIdInside($args); | ||
$msg = array( 'qtd'=> \CountHelper::count($result) | ||
, 'result'=>$result | ||
); | ||
$response = TGenericAPI::getBodyJson($msg,$response,200); | ||
return $response; | ||
} catch ( \Exception $e) { | ||
$msg = $e->getMessage(); | ||
$response = TGenericAPI::getBodyJson($msg,$response,500); | ||
return $response; | ||
} | ||
} | ||
|
||
//-------------------------------------------------------------------------------- | ||
public static function save(Request $request, Response $response, array $args) | ||
{ | ||
try{ | ||
$vo = new \Acesso_perfilVO; | ||
$msg = \Message::GENERIC_INSERT; | ||
if($request->getMethod() == 'PUT'){ | ||
$msg = \Message::GENERIC_UPDATE; | ||
$result = self::selectByIdInside($args); | ||
$bodyRequest = \ArrayHelper::get($result,0); | ||
if( empty($bodyRequest) ){ | ||
throw new \DomainException(\Message::GENERIC_ID_NOT_EXIST); | ||
} | ||
$vo = \FormDinHelper::setPropertyVo($bodyRequest,$vo); | ||
} | ||
$bodyRequest = json_decode($request->getBody(),true); | ||
if( empty($bodyRequest) ){ | ||
$bodyRequest = $request->getParsedBody(); | ||
} | ||
$vo = \FormDinHelper::setPropertyVo($bodyRequest,$vo); | ||
$controller = new \Acesso_perfil; | ||
$controller->save($vo); | ||
|
||
$response = TGenericAPI::getBodyJson($msg,$response,200); | ||
return $response; | ||
} catch ( \Exception $e) { | ||
$msg = $e->getMessage(); | ||
$response = TGenericAPI::getBodyJson($msg,$response,500); | ||
return $response; | ||
} | ||
} | ||
|
||
//-------------------------------------------------------------------------------- | ||
public static function delete(Request $request, Response $response, array $args) | ||
{ | ||
try{ | ||
$id = $args['id']; | ||
$controller = new \Acesso_perfil; | ||
$msg = $controller->delete($id); | ||
if($msg==true){ | ||
$msg = \Message::GENERIC_DELETE; | ||
$msg = $msg.' id='.$id; | ||
} | ||
$response = TGenericAPI::getBodyJson($msg,$response,200); | ||
return $response; | ||
} catch ( \Exception $e) { | ||
$msg = $e->getMessage(); | ||
$response = TGenericAPI::getBodyJson($msg,$response,500); | ||
return $response; | ||
} | ||
} | ||
} |
Oops, something went wrong.