diff --git a/apps/maarch_entreprise/Views/action-administration.component.html b/apps/maarch_entreprise/Views/action-administration.component.html index c032d98b407d8320e4ac79611b02dff1c523dc91..ce0c72ca7139a3fe1de6e7bf678b3dae23fb8606 100755 --- a/apps/maarch_entreprise/Views/action-administration.component.html +++ b/apps/maarch_entreprise/Views/action-administration.component.html @@ -43,8 +43,7 @@ </div> <div class="form-group"> <mat-form-field> - <mat-select id="keyword" name="keyword" title="{{lang.keyword}}" placeholder="{{lang.keyword}}" [(ngModel)]="action.keyword" - required> + <mat-select id="keyword" name="keyword" title="{{lang.keyword}}" placeholder="{{lang.keyword}}" [(ngModel)]="action.keyword"> <mat-option *ngFor="let keyword of keywordsList" [value]="keyword.value"> {{keyword.label}} </mat-option> diff --git a/apps/maarch_entreprise/Views/actions-administration.component.html b/apps/maarch_entreprise/Views/actions-administration.component.html index 617953c156451aee0ea61c77e2a5fadf1d353e72..814154ec09fc73074df352cec7720918cf5f9091 100755 --- a/apps/maarch_entreprise/Views/actions-administration.component.html +++ b/apps/maarch_entreprise/Views/actions-administration.component.html @@ -1,6 +1,6 @@ <div class="page-header"> <h1>{{lang.administration}} {{lang.actions}} - <small>{{data.length}} {{lang.actions}}</small> + <small>{{actions.length}} {{lang.actions}}</small> </h1> </div> <div *ngIf="loading"> diff --git a/apps/maarch_entreprise/Views/status-administration.component.html b/apps/maarch_entreprise/Views/status-administration.component.html index 9f1c997c573ae104e9c2f24cd43ad47627b83916..60172bb914437e35dbb3fccee0f92c7b283697c9 100755 --- a/apps/maarch_entreprise/Views/status-administration.component.html +++ b/apps/maarch_entreprise/Views/status-administration.component.html @@ -30,7 +30,7 @@ {{lang.canBeSearched}} </mat-slide-toggle> <sup> - <i class="fa fa-question-circle" matTooltip="{{lang.matTooltipSearchStatus}}"></i> + <i class="fa fa-question-circle" matTooltip="{{lang.tooltipSearchStatus}}"></i> </sup> </div> <div class="col-sm-4" style="white-space:nowrap;"> @@ -38,7 +38,7 @@ {{lang.canBeModified}} </mat-slide-toggle> <sup> - <i class="fa fa-question-circle" matTooltip="{{lang.matTooltipIndexStatus}}"></i> + <i class="fa fa-question-circle" matTooltip="{{lang.tooltipIndexStatus}}"></i> </sup> </div> <div class="col-sm-4" style="white-space:nowrap;"> @@ -46,7 +46,7 @@ {{lang.isFolderStatus}} </mat-slide-toggle> <sup> - <i class="fa fa-question-circle" matTooltip="{{lang.matTooltipFolderStatus}}"></i> + <i class="fa fa-question-circle" matTooltip="{{lang.tooltipFolderStatus}}"></i> </sup> </div> </div> diff --git a/apps/maarch_entreprise/admin.php b/apps/maarch_entreprise/admin.php deleted file mode 100755 index a727971a89e1e408882629072f733fa13fcf37c1..0000000000000000000000000000000000000000 --- a/apps/maarch_entreprise/admin.php +++ /dev/null @@ -1,63 +0,0 @@ -<?php -/* -* Copyright 2008-2011 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/>. -*/ - -/** -* @brief Administration summary Page -* -* @file {@internal this page calls an admin object (class admin)}} -* @author Claire Figueras <dev@maarch.org> -* @date $date$ -* @version $Revision$ -* @ingroup apps -*/ - -require("apps".DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_admin.php"); -$admin = new admin(); - -$core_tools2 = new core_tools(); -$core_tools2->test_admin('admin', 'apps'); - /****************Management of the location bar ************/ -$init = false; -if(isset($_REQUEST['reinit']) && $_REQUEST['reinit'] == "true") -{ - $init = true; -} -$level = ""; -if(isset($_REQUEST['level']) && ($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1)) -{ - $level = $_REQUEST['level']; -} -$page_path = $_SESSION['config']['businessappurl'].'index.php?page=admin'; -$page_label = _ADMIN; -$page_id = "admin"; -$core_tools2->manage_location_bar($page_path, $page_label, $page_id, $init, $level); -/***********************************************************/ -unset($_SESSION['m_admin']); -?> -<h1 id='pageTitle'><i class="fa fa-cogs fa-2x"></i> <?php echo _ADMIN;?></h1> -<div id="inner_content" class="clearfix"> -<?php -$admin->display_app_admin_services($_SESSION['app_services']); -?> - -<?php -$admin->display_modules_admin_services($_SESSION['modules_services']); -?> -</div> diff --git a/apps/maarch_entreprise/class/class_admin.php b/apps/maarch_entreprise/class/class_admin.php deleted file mode 100755 index eb2406607d2a37c3656211615d6e64d2dfa2b244..0000000000000000000000000000000000000000 --- a/apps/maarch_entreprise/class/class_admin.php +++ /dev/null @@ -1,35 +0,0 @@ -<?php -/* -* Copyright 2008-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/>. -*/ - -/** -* @brief Contains the functions to load administration services -* -* @file -* @date $date$ -* @version $Revision$ -* @ingroup apps -*/ - -require_once 'apps/'. $_SESSION['config']['app_id'] .'/class/class_admin_Abstract.php'; - -class admin extends admin_Abstract -{ - // custom -} diff --git a/apps/maarch_entreprise/class/class_admin_Abstract.php b/apps/maarch_entreprise/class/class_admin_Abstract.php deleted file mode 100755 index ddf6e2c140b504c0ad347a960303c104c5f1ebf0..0000000000000000000000000000000000000000 --- a/apps/maarch_entreprise/class/class_admin_Abstract.php +++ /dev/null @@ -1,159 +0,0 @@ -<?php -/* -* Copyright 2008-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/>. -*/ - -/** -* @brief Contains the functions to load administration services -* -* @file -* @author Claire Figueras <dev@maarch.org> -* @date $date$ -* @version $Revision$ -* @ingroup apps -*/ - -abstract class admin_Abstract extends functions -{ - /** - * Displays the administration services for the application - * - * @param $app_services Array Application services - */ - public function display_app_admin_services($app_services) - { - $debug_style = ''; - if (preg_match("/MSIE 6.0/", $_SERVER['HTTP_USER_AGENT'])) - $debug_style = 'style="height:100px;"'; - - $display_app_services = false; - for($i=0;$i<count($app_services);$i++) - { - if ($app_services[$i]['servicetype'] == "admin" - && isset($_SESSION['user']['services'][$app_services[$i]['id']]) - && $_SESSION['user']['services'][$app_services[$i]['id']] - ) { - $display_app_services = true; - break; - } - } - - if ($display_app_services) { - echo '<div class="block">'; - echo '<h2 style="text-align:center;">Application</h2>'; - echo '<div class="content" id="admin_apps">'; - for($i=0;$i<count($app_services);$i++) - { - if ($app_services[$i]['servicetype'] == "admin" - && isset($_SESSION['user']['services'][$app_services[$i]['id']]) - && $_SESSION['user']['services'][$app_services[$i]['id']] - ) { - if($app_services[$i]['name']=='Actions'){ - ?> - <div class="admin_item" title="<?php functions::xecho($app_services[$i]['comment']);?>" onclick="triggerAngular(false, '#/administration/actions')"> - <?php - } - else { - ?> - <div class="admin_item" title="<?php functions::xecho($app_services[$i]['comment']);?>" onclick="window.top.location='<?php echo($app_services[$i]['servicepage']);?>';"> - <?php - } - - - ?> - <div><i class="<?php functions::xecho($app_services[$i]['style']);?> fa-4x"></i></div> - <div <?php functions::xecho($debug_style);?>> - - <strong><?php functions::xecho($app_services[$i]['name']);?></strong> - - </div> - </div> - <?php - } - } - echo '<div class="clearfix"></div>'; - echo '</div>'; - echo '</div>'; - } - } - - /** - * Displays the administration services for each module - * - * @param $modules_services Array Modules services - */ - public function display_modules_admin_services($modules_services) - { - $debug_style = ''; - if (preg_match("/MSIE 6.0/", $_SERVER['HTTP_USER_AGENT'])) { - $debug_style = 'style="height:100px;"'; - } - $nb = 0; - foreach (array_keys($modules_services) as $value) { - for ($i = 0; $i < count($modules_services[$value]); $i ++) { - if (isset($_SESSION['user']['services'][$modules_services[$value][$i]['id']]) - && $modules_services[$value][$i]['servicetype'] == "admin" - && $_SESSION['user']['services'][$modules_services[$value][$i]['id']] - ) { - if ($nb == 0) { - echo '<div class="block" style="margin-top:10px;">'; - echo '<h2 style="text-align:center;">Modules</h2>'; - echo '<div class="content" id="admin_modules">'; - } - - if($modules_services[$value][$i]['name'] == "Etats et éditions"){ - ?> - <div class="admin_item" title="<?php echo 'Module ' - . functions::xssafe($value) .' : ' - . functions::xssafe($modules_services[$value][$i]['comment']);?>" onclick="triggerAngular(false,'#/reports');"> - <i class="<?php functions::xecho($modules_services[$value][$i]['style']);?> fa-4x"></i> - <div <?php functions::xecho($debug_style);?> > - - <strong><?php functions::xecho($modules_services[$value][$i]['name']);?></strong> - </div> - </div> - <?php - } - else { - ?> - <div class="admin_item" title="<?php echo 'Module ' - . functions::xssafe($value) .' : ' - . functions::xssafe($modules_services[$value][$i]['comment']);?>" onclick="window.top.location='<?php echo($modules_services[$value][$i]['servicepage']);?>';"> - <i class="<?php functions::xecho($modules_services[$value][$i]['style']);?> fa-4x"></i> - <div <?php functions::xecho($debug_style);?> > - - <strong><?php functions::xecho($modules_services[$value][$i]['name']);?></strong> - </div> - </div> - <?php - } - - $nb ++; - - - } - } - } - if ($nb > 0) { - echo '</div>'; - echo '<div class="clearfix"></div>'; - echo '</div>'; - } - - } -} diff --git a/apps/maarch_entreprise/js/angular/app/administration/action-administration.component.js b/apps/maarch_entreprise/js/angular/app/administration/action-administration.component.js index e1eab789179a4a3c6ec95e3c26125b1b70b9c9d9..0f734998b34a19a0862694892bd5d96958dbf877 100755 --- a/apps/maarch_entreprise/js/angular/app/administration/action-administration.component.js +++ b/apps/maarch_entreprise/js/angular/app/administration/action-administration.component.js @@ -84,7 +84,7 @@ var ActionAdministrationComponent = /** @class */ (function () { this.http.post(this.coreUrl + 'rest/actions', this.action) .subscribe(function (data) { _this.router.navigate(['/administration/actions']); - _this.notify.success(_this.lang.actionAdded + ' « ' + _this.action.label_action + ' »'); + _this.notify.success(_this.lang.actionAdded); }, function (err) { _this.notify.error(JSON.parse(err._body).errors); }); @@ -93,7 +93,7 @@ var ActionAdministrationComponent = /** @class */ (function () { this.http.put(this.coreUrl + 'rest/actions/' + this.action.id, this.action) .subscribe(function (data) { _this.router.navigate(['/administration/actions']); - _this.notify.success(_this.lang.actionUpdated + ' « ' + _this.action.label_action + ' »'); + _this.notify.success(_this.lang.actionUpdated); }, function (err) { _this.notify.error(JSON.parse(err._body).errors); }); diff --git a/apps/maarch_entreprise/js/angular/app/administration/action-administration.component.ts b/apps/maarch_entreprise/js/angular/app/administration/action-administration.component.ts index 55acc072f909fc8b3dbcb745e1510915000042b4..8ac02c22dbcb4c003aab5b4ff4378992aa077c4e 100755 --- a/apps/maarch_entreprise/js/angular/app/administration/action-administration.component.ts +++ b/apps/maarch_entreprise/js/angular/app/administration/action-administration.component.ts @@ -94,7 +94,7 @@ export class ActionAdministrationComponent implements OnInit { this.http.post(this.coreUrl + 'rest/actions', this.action) .subscribe((data : any) => { this.router.navigate(['/administration/actions']); - this.notify.success(this.lang.actionAdded+' « '+this.action.label_action+' »'); + this.notify.success(this.lang.actionAdded); },(err) => { this.notify.error(JSON.parse(err._body).errors); @@ -103,7 +103,7 @@ export class ActionAdministrationComponent implements OnInit { this.http.put(this.coreUrl + 'rest/actions/' + this.action.id, this.action) .subscribe((data : any) => { this.router.navigate(['/administration/actions']); - this.notify.success(this.lang.actionUpdated+' « '+this.action.label_action+' »'); + this.notify.success(this.lang.actionUpdated); },(err) => { this.notify.error(JSON.parse(err._body).errors); diff --git a/apps/maarch_entreprise/js/angular/app/administration/actions-administration.component.js b/apps/maarch_entreprise/js/angular/app/administration/actions-administration.component.js index 0bfb7eea4c354df310eecbecfd453245d9895cca..ba6a8c5cd8d64aaebf0382db87c440e4b28095ba 100755 --- a/apps/maarch_entreprise/js/angular/app/administration/actions-administration.component.js +++ b/apps/maarch_entreprise/js/angular/app/administration/actions-administration.component.js @@ -23,9 +23,8 @@ var ActionsAdministrationComponent = /** @class */ (function () { this.actions = []; this.titles = []; this.loading = false; - this.data = []; this.displayedColumns = ['id', 'label_action', 'history', 'is_folder_action', 'actions']; - this.dataSource = new material_1.MatTableDataSource(this.data); + this.dataSource = new material_1.MatTableDataSource(this.actions); } ActionsAdministrationComponent.prototype.applyFilter = function (filterValue) { filterValue = filterValue.trim(); // Remove whitespace @@ -43,13 +42,12 @@ var ActionsAdministrationComponent = /** @class */ (function () { this.loading = true; this.updateBreadcrumb(angularGlobals.applicationName); $j('#inner_content').remove(); - this.http.get(this.coreUrl + 'rest/administration/actions') + this.http.get(this.coreUrl + 'rest/actions') .subscribe(function (data) { _this.actions = data['actions']; - _this.data = _this.actions; _this.loading = false; setTimeout(function () { - _this.dataSource = new material_1.MatTableDataSource(_this.data); + _this.dataSource = new material_1.MatTableDataSource(_this.actions); _this.dataSource.paginator = _this.paginator; _this.dataSource.sort = _this.sort; }, 0); @@ -64,11 +62,11 @@ var ActionsAdministrationComponent = /** @class */ (function () { if (r) { this.http.delete(this.coreUrl + 'rest/actions/' + action.id) .subscribe(function (data) { - _this.data = data.action; - _this.dataSource = new material_1.MatTableDataSource(_this.data); + _this.actions = data.action; + _this.dataSource = new material_1.MatTableDataSource(_this.actions); _this.dataSource.paginator = _this.paginator; _this.dataSource.sort = _this.sort; - _this.notify.success(_this.lang.actionDeleted + ' « ' + action.label_action + ' »'); + _this.notify.success(_this.lang.actionDeleted); }, function (err) { _this.notify.error(JSON.parse(err._body).errors); }); diff --git a/apps/maarch_entreprise/js/angular/app/administration/actions-administration.component.ts b/apps/maarch_entreprise/js/angular/app/administration/actions-administration.component.ts index 14d422025328c1013c500ebb7a8f5b31a0bcbf10..ee92cc5a6494ef362ec7a175500aca58563c3098 100755 --- a/apps/maarch_entreprise/js/angular/app/administration/actions-administration.component.ts +++ b/apps/maarch_entreprise/js/angular/app/administration/actions-administration.component.ts @@ -25,10 +25,9 @@ export class ActionsAdministrationComponent implements OnInit { titles : any[] = []; loading : boolean = false; - data: Action[] = []; displayedColumns = ['id', 'label_action', 'history', 'is_folder_action', 'actions']; - dataSource = new MatTableDataSource(this.data); + dataSource = new MatTableDataSource(this.actions); @ViewChild(MatPaginator) paginator: MatPaginator; @ViewChild(MatSort) sort: MatSort; applyFilter(filterValue: string) { @@ -54,15 +53,14 @@ export class ActionsAdministrationComponent implements OnInit { this.updateBreadcrumb(angularGlobals.applicationName); $j('#inner_content').remove(); - this.http.get(this.coreUrl + 'rest/administration/actions') + this.http.get(this.coreUrl + 'rest/actions') .subscribe((data) => { this.actions = data['actions']; - this.data = this.actions; this.loading = false; setTimeout(() => { - this.dataSource = new MatTableDataSource(this.data); + this.dataSource = new MatTableDataSource(this.actions); this.dataSource.paginator = this.paginator; - this.dataSource.sort = this.sort; + this.dataSource.sort = this.sort; }, 0); }, (err) => { console.log(err); @@ -76,11 +74,11 @@ export class ActionsAdministrationComponent implements OnInit { if (r) { this.http.delete(this.coreUrl + 'rest/actions/' + action.id) .subscribe((data : any) => { - this.data = data.action; - this.dataSource = new MatTableDataSource(this.data); + this.actions = data.action; + this.dataSource = new MatTableDataSource(this.actions); this.dataSource.paginator = this.paginator; - this.dataSource.sort = this.sort; - this.notify.success(this.lang.actionDeleted+' « '+action.label_action+' »'); + this.dataSource.sort = this.sort; + this.notify.success(this.lang.actionDeleted); }, (err) => { this.notify.error(JSON.parse(err._body).errors); diff --git a/core/Models/LangModelAbstract.php b/core/Models/LangModelAbstract.php index 4a616b90ae7a641a33d51cfb77fe2b6e8e551d2e..6b7ae12bca4d3c6f773d36d5986bca1f8f0ad9d9 100755 --- a/core/Models/LangModelAbstract.php +++ b/core/Models/LangModelAbstract.php @@ -107,65 +107,6 @@ class LangModelAbstract return $aLang; } - - public static function getActionsForAdministrationLang() - { - $aLang = [ - 'id' => _ID, - 'desc' => _DESC, - 'is_folder_action' => _IS_FOLDER_ACTION, - 'is_folder_action_desc' => _IS_FOLDER_ACTION_DESC, - 'is_system' => _IS_SYSTEM, - 'new_action' => _NEW_ACTION, - 'recordsPerPage' => _RECORDS_PER_PAGE, - 'display' => _DISPLAY, - 'noRecords' => _NO_RECORDS, - 'page' => _PAGE, - 'outOf' => _OUT_OF, - 'available' => _AVAILABLE, - 'filteredFrom' => _FILTERED_FROM, - 'records' => _RECORDS, - 'last' => _LAST, - 'modify' => _MODIFY, - 'delete' => _DELETE, - 'do_not_modify_unless_expert' => _DO_NOT_MODIFY_UNLESS_EXPERT, - 'associated_status' => _ASSOCIATED_STATUS, - 'yes' => _YES, - 'no' => _NO, - 'action_page' => _ACTION_PAGE, - 'action_history' => _ACTION_HISTORY, - 'action_history_desc' => _ACTION_HISTORY_DESC, - 'choose_category_association' => _CHOOSE_CATEGORY_ASSOCIATION, - 'choose_category_association_help' => _CHOOSE_CATEGORY_ASSOCIATION_HELP, - 'add' => _ADD, - 'remove' => _REMOVE, - 'infos_actions' => _INFOS_ACTIONS, - 'keyword' => _KEYWORD, - 'system_parameters' => _SYSTEM_PARAMETERS, - 'delete_action' => _DEL_ACTION, - 'action_modified' => _ACTION_MODIFIED, - 'action_added' => _ACTION_ADDED, - 'validate' => _VALIDATE, - 'cancel' => _CANCEL, - 'noResult' => _NO_RESULTS, - 'noRecord' => _NO_RECORD, - 'previous' => _PREVIOUS_PAGE, - 'next' => _NEXT_PAGE, - 'record' => _RECORD, - 'search' => _SEARCH, - 'actions' => _ACTIONS, - 'action' => _ACTION, - 'admin' => _ADMIN, - 'deleteMsg' => _REALLY_DELETE, - 'modify_action' => _MODIFY_ACTION, - 'selectAll' => _SELECT_ALL, - 'unselectAll' => _UNSELECT_ALL, - - - ]; - return $aLang; - } - public static function getUsersAdministrationLang() { $aLang = [ diff --git a/rest/index.php b/rest/index.php index 8edb6674718ae69ae6d73bab9382a9b73196f91d..d849286c732797d2b688280aa471ffbcf63ad1e9 100755 --- a/rest/index.php +++ b/rest/index.php @@ -227,9 +227,9 @@ $app->get('/histories/users/{userSerialId}', \History\controllers\HistoryControl $app->get('/administration/historyBatch/eventDate/{date}', \History\controllers\HistoryController::class . ':getBatchForAdministration'); //actions -$app->get('/administration/actions', \Action\controllers\ActionController::class . ':getForAdministration'); +$app->get('/actions', \Action\controllers\ActionController::class . ':get'); $app->get('/initAction', \Action\controllers\ActionController::class . ':initAction'); -$app->get('/actions/{id}', \Action\controllers\ActionController::class . ':getByIdForAdministration'); +$app->get('/actions/{id}', \Action\controllers\ActionController::class . ':getById'); $app->post('/actions', \Action\controllers\ActionController::class . ':create'); $app->put('/actions/{id}', \Action\controllers\ActionController::class . ':update'); $app->delete('/actions/{id}', \Action\controllers\ActionController::class . ':delete'); diff --git a/src/app/action/controllers/ActionController.php b/src/app/action/controllers/ActionController.php index f778b09a73667388534d87e8e01fc557c07c7537..1568caa954a3acfb6a0d3a910c7c0eb5c1c30909 100644 --- a/src/app/action/controllers/ActionController.php +++ b/src/app/action/controllers/ActionController.php @@ -20,15 +20,14 @@ use Slim\Http\Response; class ActionController { - public function getForAdministration(Request $request, Response $response) + public function get(Request $request, Response $response) { - $obj ['actions']= ActionModel::get(); return $response->withJson($obj); } - public function getByIdForAdministration(Request $request, Response $response, $aArgs) + public function getById(Request $request, Response $response, $aArgs) { if (isset($aArgs['id'])) { $id = $aArgs['id']; @@ -83,9 +82,9 @@ class ActionController $obj['statuses'] = StatusModel::get(); array_unshift($obj['statuses'], ['id'=>'_NOSTATUS_','label_status'=> _UNCHANGED]); - $obj['action_pagesList']=ActionModel::getAction_pages(); + $obj['action_pagesList'] = ActionModel::getAction_pages(); array_unshift($obj['action_pagesList']['actionsPageList'], ['id'=>'','label'=> _NO_PAGE, 'name'=>'', 'origin'=>'']); - $obj['keywordsList']=ActionModel::getKeywords(); + $obj['keywordsList'] = ActionModel::getKeywords(); return $response->withJson($obj); } @@ -93,13 +92,10 @@ class ActionController public function create(Request $request, Response $response, $aArgs) { $errors = []; - - $aArgs = $request->getParams(); - - $aArgs = $this->manageValue($aArgs); + $aArgs = $request->getParams(); + $aArgs = $this->manageValue($aArgs); $errors = $this->control($aArgs, 'create'); - if (!empty($errors)) { return $response @@ -131,11 +127,10 @@ class ActionController { $errors = []; - $obj = $request->getParams(); - $obj['id']=$aArgs['id']; - - $obj = $this->manageValue($obj); + $obj = $request->getParams(); + $obj['id'] = $aArgs['id']; + $obj = $this->manageValue($obj); $errors = $this->control($obj, 'update'); if (!empty($errors)) { @@ -163,7 +158,6 @@ class ActionController ); } - public function delete(Request $request, Response $response, $aArgs) { if (isset($aArgs['id'])) { @@ -202,12 +196,9 @@ class ActionController $obj = ActionModel::getById(['id' => $aArgs['id']]); if (empty($obj)) { - $errors[]=_ID . ' ' .$aArgs['id']. ' ' . _NOT_EXISTS; - } } - if (!Validator::notEmpty()->validate($aArgs['label_action'])) { $errors[]=_NO_RIGHT.' '._DESC; @@ -217,16 +208,16 @@ class ActionController $errors[]=CHOOSE_STATUS; } - if (!Validator::notEmpty()->validate($aArgs['create_id']) || ($aArgs['create_id']!='Y' && $aArgs['create_id']!='N') ) { + if (!Validator::notEmpty()->validate($aArgs['create_id']) || ($aArgs['create_id']!='Y' && $aArgs['create_id']!='N')) { $errors[]= _CREATE_ID . ' ' . _NOT_VALID; } - if (!Validator::notEmpty()->validate($aArgs['history']) || ($aArgs['history']!='Y' && $aArgs['history']!='N') ) { + if (!Validator::notEmpty()->validate($aArgs['history']) || ($aArgs['history']!='Y' && $aArgs['history']!='N')) { $errors[]= _ACTION_HISTORY . ' ' . _NOT_VALID; } - if (!Validator::notEmpty()->validate($aArgs['is_system']) || ($aArgs['is_system']!='Y' && $aArgs['is_system']!='N') ) { + if (!Validator::notEmpty()->validate($aArgs['is_system']) || ($aArgs['is_system']!='Y' && $aArgs['is_system']!='N')) { $errors[]= _IS_SYSTEM . ' ' . _NOT_VALID; } @@ -237,14 +228,15 @@ class ActionController public function initAction(Request $request, Response $response) { //default data - $obj['action']['history'] = true; - $obj['action']['keyword'] = ''; + $obj['action']['history'] = true; + $obj['action']['keyword'] = ''; $obj['action']['is_folder_action'] = false; - $obj['action']['is_system'] = false; - $obj['action']['action_page'] = ''; - $obj['action']['id_status'] = '_NOSTATUS_'; - $obj['action']['create_id'] = false; - $obj['categoriesList'] = ActionModel::getLettersBoxCategories(); + $obj['action']['is_system'] = false; + $obj['action']['action_page'] = ''; + $obj['action']['id_status'] = '_NOSTATUS_'; + $obj['action']['create_id'] = false; + $obj['categoriesList'] = ActionModel::getLettersBoxCategories(); + foreach ($obj['categoriesList'] as $key => $value) { $obj['categoriesList'][$key]['selected'] = true; } @@ -254,10 +246,8 @@ class ActionController $obj['action_pagesList'] = ActionModel::getAction_pages(); array_unshift($obj['action_pagesList']['actionsPageList'], ['id'=>'','label'=> _NO_PAGE, 'name'=>'', 'origin'=>'']); $obj['keywordsList'] = ActionModel::getKeywords(); - $obj['lang'] = LangModel::getActionsForAdministrationLang(); return $response->withJson($obj); - } protected function manageValue($request) diff --git a/src/app/action/models/ActionModelAbstract.php b/src/app/action/models/ActionModelAbstract.php index 67af996fa0ab4cb2fd8f1f57972f0a4927ecb895..8323e138a29bf8043aa8df7d9ee783870b28e6aa 100644 --- a/src/app/action/models/ActionModelAbstract.php +++ b/src/app/action/models/ActionModelAbstract.php @@ -11,6 +11,10 @@ namespace Action\models; +use Core\Models\CoreConfigModel; +use Core\Models\DatabaseModel; +use Core\Models\ValidatorModel; + class ActionModelAbstract { public static function get(array $aArgs = []) @@ -70,14 +74,13 @@ class ActionModelAbstract $tab['action_id'] = max(ActionModel::get())['id']; for ($i=0;$i<count($actioncategories);$i++) { - $tab['category_id'] = $actioncategories[$i]; $aInsert = DatabaseModel::insert( [ 'table' => 'actions_categories', 'columnsValues' => $tab ] - ); + ); } return $aReturn; } @@ -90,7 +93,7 @@ class ActionModelAbstract $aReturn = DatabaseModel::update( ['table' => 'actions', 'set' => [ - 'keyword' => $aArgs['keyword'], + 'keyword' => $aArgs['keyword'], 'label_action' => $aArgs['label_action'], 'id_status' => $aArgs['id_status'], 'action_page' => $aArgs['action_page'], @@ -111,14 +114,13 @@ class ActionModelAbstract $tab['action_id']=$aArgs['id']; for ($i=0;$i<count($aArgs['actionCategories']);$i++) { - $tab['category_id']=$aArgs['actionCategories'][$i]; $aInsert = DatabaseModel::insert( [ 'table' => 'actions_categories', 'columnsValues' => $tab ] - ); + ); } return $aReturn; @@ -165,7 +167,6 @@ class ActionModelAbstract if ($category->id == (string)$categories->default_category) { $categoriesTmp['default_category']=true; - } else { $categoriesTmp['default_category']=false; } @@ -173,7 +174,6 @@ class ActionModelAbstract } } return $categoriesTypes; - } public static function getAction_pages() @@ -265,7 +265,7 @@ class ActionModelAbstract function ($element) { return $element['label']; }, $tabActions_pages['actionsPageList'] - ), + ), SORT_ASC, $tabActions_pages['actionsPageList'] ); @@ -324,4 +324,3 @@ class ActionModelAbstract return $action[0]['id_action']; } } -