From 2ae21b34ab27a06955e5f9901cec6e5a368c34ad Mon Sep 17 00:00:00 2001 From: "florian.azizian" <florian.azizian@maarch.org> Date: Wed, 4 Nov 2020 18:02:24 +0100 Subject: [PATCH] FEAT #15350 TIME 0:15 clean useless code (entities) --- modules/entities/admin_difflist_type.php | 154 -- .../entities/admin_difflist_type_validate.php | 68 - modules/entities/admin_difflist_types.php | 141 -- modules/entities/class/Entity.php | 42 - modules/entities/class/EntityControler.php | 47 - .../class/EntityControler_Abstract.php | 619 ------- modules/entities/class/Entity_Abstract.php | 55 - modules/entities/class/class_get_barcode.php | 39 - .../class/class_get_barcode_Abstract.php | 59 - .../entities/class/class_manage_entities.php | 28 - .../class/class_manage_entities_Abstract.php | 1489 ----------------- .../entities/class/class_manage_listdiff.php | 48 - .../class/class_manage_listdiff_Abstract.php | 770 --------- .../entities/class/class_modules_tools.php | 40 - .../class/class_modules_tools_Abstract.php | 1002 ----------- .../entities/class/class_users_entities.php | 39 - .../class/class_users_entities_Abstract.php | 318 ---- modules/entities/css/module.css | 47 - modules/entities/difflist_display.php | 114 -- modules/entities/difflist_history_display.php | 209 --- .../difflist_visa_history_display.php | 208 --- modules/entities/entities_list_by_label.php | 63 - modules/entities/entities_tables.php | 46 - modules/entities/entity_add.php | 57 - modules/entities/entity_add_db.php | 24 - modules/entities/entity_allow.php | 37 - modules/entities/entity_ban.php | 38 - modules/entities/entity_up.php | 68 - modules/entities/entity_up_db.php | 24 - .../entities/html/admin_difflist_type.html | 47 - modules/entities/js/functions.js | 217 --- modules/entities/lang/en.php | 571 ------- modules/entities/lang/fr.php | 572 ------- modules/entities/lang/nl.php | 554 ------ modules/entities/loadDiffList.php | 72 - modules/entities/loadDiffListHistory.php | 173 -- modules/entities/load_listinstance.php | 161 -- modules/entities/load_toolbarEntities.php | 37 - modules/entities/manage_entities.php | 173 -- modules/entities/manage_listinstance.php | 1222 -------------- modules/entities/reloadListDiff.php | 22 - modules/entities/save_list_diff.php | 41 - modules/entities/show_diffListHistory_tab.php | 31 - modules/entities/users_list.php | 151 -- modules/entities/xml/IVS/data_types.xml | 15 - .../entities/xml/IVS/requests_definitions.xml | 130 -- modules/entities/xml/IVS/validation_rules.xml | 136 -- modules/entities/xml/config.xml | 22 - modules/entities/xml/menu.xml | 10 - modules/entities/xml/redirect_keywords.xml | 35 - 50 files changed, 10285 deletions(-) delete mode 100755 modules/entities/admin_difflist_type.php delete mode 100755 modules/entities/admin_difflist_type_validate.php delete mode 100755 modules/entities/admin_difflist_types.php delete mode 100755 modules/entities/class/Entity.php delete mode 100755 modules/entities/class/EntityControler.php delete mode 100755 modules/entities/class/EntityControler_Abstract.php delete mode 100755 modules/entities/class/Entity_Abstract.php delete mode 100755 modules/entities/class/class_get_barcode.php delete mode 100755 modules/entities/class/class_get_barcode_Abstract.php delete mode 100755 modules/entities/class/class_manage_entities.php delete mode 100755 modules/entities/class/class_manage_entities_Abstract.php delete mode 100755 modules/entities/class/class_manage_listdiff.php delete mode 100755 modules/entities/class/class_manage_listdiff_Abstract.php delete mode 100755 modules/entities/class/class_modules_tools.php delete mode 100755 modules/entities/class/class_modules_tools_Abstract.php delete mode 100755 modules/entities/class/class_users_entities.php delete mode 100755 modules/entities/class/class_users_entities_Abstract.php delete mode 100755 modules/entities/css/module.css delete mode 100755 modules/entities/difflist_display.php delete mode 100755 modules/entities/difflist_history_display.php delete mode 100755 modules/entities/difflist_visa_history_display.php delete mode 100755 modules/entities/entities_list_by_label.php delete mode 100755 modules/entities/entities_tables.php delete mode 100755 modules/entities/entity_add.php delete mode 100755 modules/entities/entity_add_db.php delete mode 100755 modules/entities/entity_allow.php delete mode 100755 modules/entities/entity_ban.php delete mode 100755 modules/entities/entity_up.php delete mode 100755 modules/entities/entity_up_db.php delete mode 100755 modules/entities/html/admin_difflist_type.html delete mode 100755 modules/entities/js/functions.js delete mode 100755 modules/entities/lang/en.php delete mode 100755 modules/entities/lang/fr.php delete mode 100755 modules/entities/lang/nl.php delete mode 100755 modules/entities/loadDiffList.php delete mode 100755 modules/entities/loadDiffListHistory.php delete mode 100755 modules/entities/load_listinstance.php delete mode 100755 modules/entities/load_toolbarEntities.php delete mode 100755 modules/entities/manage_entities.php delete mode 100755 modules/entities/manage_listinstance.php delete mode 100755 modules/entities/reloadListDiff.php delete mode 100755 modules/entities/save_list_diff.php delete mode 100755 modules/entities/show_diffListHistory_tab.php delete mode 100755 modules/entities/users_list.php delete mode 100755 modules/entities/xml/IVS/data_types.xml delete mode 100755 modules/entities/xml/IVS/requests_definitions.xml delete mode 100755 modules/entities/xml/IVS/validation_rules.xml delete mode 100755 modules/entities/xml/config.xml delete mode 100755 modules/entities/xml/menu.xml delete mode 100755 modules/entities/xml/redirect_keywords.xml diff --git a/modules/entities/admin_difflist_type.php b/modules/entities/admin_difflist_type.php deleted file mode 100755 index 5712abf03d9..00000000000 --- a/modules/entities/admin_difflist_type.php +++ /dev/null @@ -1,154 +0,0 @@ -<?php -/* -* -* Copyright 2008,2012 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/>. -* -* @author Cyril Vazquez <dev@maarch.org> -*/ - -$admin = new core_tools(); -$admin->test_admin('admin_difflist_types', 'entities'); -$_SESSION['m_admin']= array(); -/****************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_difflist_type&module=entities'; -$page_label = _DIFFLIST_TYPE; -$page_id = "admin_difflist_type"; -$admin->manage_location_bar($page_path, $page_label, $page_id, $init, $level); -#****************************************************************************** -require_once("core/class/usergroups_controler.php"); -$ugc = new usergroups_controler(); - -require_once("modules/entities/class/class_manage_listdiff.php"); -$difflist = new diffusion_list(); - -# Prepare view for UP/ADD -#****************************************************************************** -$view = new DOMDocument(); -$view->loadHTMLFile( - __DIR__ . '/html/admin_difflist_type.html' -); -$xview = new DOMXPath($view); -# Set id attributes in view -$ids = $xview->query('//*[@id]'); -for($i=0, $l=$ids->length; $i<$l; $i++) { - $id = $ids->item($i); - $id->setIdAttribute('id', false); - $id->setIdAttribute('id', true); -} - -# Set action mode -$mode = $view->getElementById("mode"); -$mode->setAttribute('value', $_REQUEST['mode']); - -# Translate -$labels = $view->getElementsByTagName('label'); -for($i=0, $l=$labels->length; $i<$l; $i++) { - $label = $labels->item($i); - $const = $label->nodeValue; - if($text = @constant($const)) - $label->nodeValue = $text; -} -$buttons = $xview->query('//input[@type="button"]'); -for($i=0, $l=$buttons->length; $i<$l; $i++) { - $button = $buttons->item($i); - $value = $button->getAttribute('value'); - if($text = @constant($value)) - $button->setAttribute('value', $text); -} - -# Manage local path -$cancel_btn = $view->getElementById("cancel"); -$cancel_btn->setAttribute( - 'onclick', - "goTo('index.php?module=entities&page=admin_difflist_types');" -); - -# Get data for UP/DEL -#****************************************************************************** -if($_REQUEST['mode'] == 'up' || $_REQUEST['mode'] == 'del') { - $difflist_type = $difflist->get_difflist_type($_REQUEST['id']); - $difflist_type_roles = $difflist->get_difflist_type_roles($difflist_type); -} -$difflist_roles = $difflist->list_difflist_roles(); - -# Switch on mode/action -#****************************************************************************** -switch($_REQUEST['mode']) { -case 'add': - # difflist_type_roles - echo '<h1><i class="fa fa-share-alt fa-2x"></i> '._ADD.' '._DIFFLIST_TYPE.'</h1>'; - $all_roles = $view->getElementById("all_roles"); - foreach($difflist_roles as $role_id => $role_label) { - $option = $view->createElement('option', $role_label); - $option->setAttribute('value', $role_id); - $all_roles->appendChild($option); - } - echo $view->saveXML(); - break; - -case 'up': - # difflist_type id - echo '<h1><i class="fa fa-share-alt fa-2x"></i> '._MODIFY.' '._DIFFLIST_TYPE.' ('.$difflist_type->difflist_type_id.')</h1>'; - $difflist_type_id = $view->getElementById("difflist_type_id"); - $difflist_type_id->setAttribute('value', $difflist_type->difflist_type_id); - $difflist_type_id->setAttribute('readonly', 'true'); - $difflist_type_id->setAttribute('disabled', 'true'); - - # difflist_type Label - $difflist_type_label = $view->getElementById("difflist_type_label"); - $difflist_type_label->setAttribute('value', $difflist_type->difflist_type_label); - - # difflist_type_roles - $all_roles = $view->getElementById("all_roles"); - $selected_roles = $view->getElementById("selected_roles"); - foreach($difflist_roles as $role_id => $role_label) { - $option = $view->createElement('option', $role_label); - $option->setAttribute('value', $role_id); - if(!isset($difflist_type_roles[$role_id])) { - $all_roles->appendChild($option); - } else { - $selected_roles->appendChild($option); - } - } - - # Allow entities - $allow_entities = $view->getElementById("allow_entities"); - if($difflist_type->allow_entities == 'Y') - $allow_entities->setAttribute('checked', 'true'); - - # Display - echo $view->saveXML(); - break; - -case "del": - if($difflist_type->is_system != 'Y') { - $difflist->delete_difflist_type($_REQUEST['id']); - } - echo "<script type='text/javascript'> goTo('".$_SESSION['config']['businessappurl']."index.php?page=admin_difflist_types&module=entities');</script>"; - break; -} diff --git a/modules/entities/admin_difflist_type_validate.php b/modules/entities/admin_difflist_type_validate.php deleted file mode 100755 index ac0a2ad67fe..00000000000 --- a/modules/entities/admin_difflist_type_validate.php +++ /dev/null @@ -1,68 +0,0 @@ -<?php -/* -difflist_type_id : $('difflist_type_id').value, -difflist_type_label : $('difflist_type_label').value, -*/ - -require_once("modules/entities/class/class_manage_listdiff.php"); -$difflist = new diffusion_list(); - - -require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_request.php"); -require_once("modules/entities/entities_tables.php"); - -$db = new Database(); - -$difflist_type_id = functions::protect_string_db($_REQUEST['difflist_type_id']); -$difflist_type_label = functions::protect_string_db($_REQUEST['difflist_type_label']); -$difflist_type_roles = functions::protect_string_db($_REQUEST['difflist_type_roles']); -$allow_entities = functions::protect_string_db($_REQUEST['allow_entities']); - -# Controls -$errors = false; -if(!empty($difflist_type_id)) { - $stmt = $db->query( - "select count(1) as nb from " . ENT_DIFFLIST_TYPES - . " where difflist_type_id = ?",array($difflist_type_id)); - $res = $stmt->fetchObject(); - $nb = $res->nb; - if($_REQUEST['mode'] == 'add' && $nb == 1) - $errors .= "<br/>" . _DIFFLIST_TYPE_ID_ALREADY_USED; - if($_REQUEST['mode'] == 'up' && $nb == 0) - $errors .= "<br/>" . _DIFFLIST_TYPE_ID_IS_UNKNOWN; -} else { - $errors .= "<br/>" . _DIFFLIST_TYPE_ID_IS_MANDATORY; -} - - -if(empty($difflist_type_label)) - $errors .= "<br/>" . _DIFFLIST_TYPE_LABEL_IS_MANDATORY; - - -# If errors detected, return html -if($errors) { - echo $errors; - return; -} - -# If no error, proceed -switch($_REQUEST['mode']) { -case 'add': - $difflist->insert_difflist_type( - $difflist_type_id, - $difflist_type_label, - $difflist_type_roles, - $allow_entities - ); - - break; -case 'up': - $difflist->update_difflist_type( - $difflist_type_id, - $difflist_type_label, - $difflist_type_roles, - $allow_entities - ); - break; - -} \ No newline at end of file diff --git a/modules/entities/admin_difflist_types.php b/modules/entities/admin_difflist_types.php deleted file mode 100755 index 127c094e234..00000000000 --- a/modules/entities/admin_difflist_types.php +++ /dev/null @@ -1,141 +0,0 @@ -<?php -/* -* -* Copyright 2008,2012 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/>. -* -* @author Cyril Vazquez <dev@maarch.org> -*/ - -$admin = new core_tools(); -$admin->test_admin('admin_difflist_types', 'entities'); -$_SESSION['m_admin']= array(); -/****************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_difflist_types&module=entities'; -$page_label = _DIFFLIST_TYPES; -$page_id = "admin_difflist_types"; -$admin->manage_location_bar($page_path, $page_label, $page_id, $init, $level); -/***********************************************************/ - -require_once("apps/".$_SESSION['config']['app_id']."/class/class_list_show.php"); -require_once("core/class/class_request.php"); -require_once("modules/entities/entities_tables.php"); - -$func = new functions(); -$request = new request; - -$what = ''; -$where = ''; - -$list = new list_show(); -$arrayPDO = array(); - -if(isset($_REQUEST['what']) && !empty($_REQUEST['what'])) -{ - $what = $func->protect_string_db($_REQUEST['what']); - $where = " lower(difflist_type_label) like lower(?)"; - $arrayPDO = array_merge($arrayPDO, array($what."%")); -} - -$order = 'asc'; -if(isset($_REQUEST['order']) && !empty($_REQUEST['order'])) -{ - $order = trim($_REQUEST['order']); -} -$field = 'difflist_type_id'; -if(isset($_REQUEST['order_field']) && !empty($_REQUEST['order_field'])) -{ - $field = trim($_REQUEST['order_field']); -} - -$orderstr = $list->define_order($order, $field); - -$select[ENT_DIFFLIST_TYPES] = array(); -array_push($select[ENT_DIFFLIST_TYPES], "difflist_type_id", "difflist_type_label", 'is_system'); - -$tab = $request->PDOselect($select, $where, $arrayPDO, $orderstr, $_SESSION['config']['databasetype']); - -for ($i=0;$i<count($tab);$i++) -{ - for ($j=0;$j<count($tab[$i]);$j++) - { - foreach(array_keys($tab[$i][$j]) as $value) - { - if($tab[$i][$j][$value]=="difflist_type_id") - { - $tab[$i][$j]["difflist_type_id"]=$tab[$i][$j]['value']; - $tab[$i][$j]["label"]= _ID; - $tab[$i][$j]["size"]="18"; - $tab[$i][$j]["label_align"]="left"; - $tab[$i][$j]["align"]="left"; - $tab[$i][$j]["order"]=$tab[$i][$j][$value]; - $tab[$i][$j]["valign"]="bottom"; - $tab[$i][$j]["show"]=true; - } - - if($tab[$i][$j][$value]=="difflist_type_label") - { - $tab[$i][$j]['value']=$request->show_string($tab[$i][$j]['value']); - $tab[$i][$j]["difflist_type_label"]=$tab[$i][$j]['value']; - $tab[$i][$j]["label"]=_DIFFLIST_TYPE_LABEL; - $tab[$i][$j]["size"]="25"; - $tab[$i][$j]["label_align"]="left"; - $tab[$i][$j]["align"]="left"; - $tab[$i][$j]["order"]=$tab[$i][$j][$value]; - $tab[$i][$j]["valign"]="bottom"; - $tab[$i][$j]["show"]=true; - } - - if($tab[$i][$j][$value]=="is_system") - { - $tab[$i][$j]['value']=$request->show_string($tab[$i][$j]['value']); - if($tab[$i][$j]['value'] == 'Y') - $tab[$i][$j]["can_delete"] = 'false'; - $tab[$i][$j]["label"]= _IS_SYSTEM; - $tab[$i][$j]["size"]="10"; - $tab[$i][$j]["label_align"]="left"; - $tab[$i][$j]["align"]="left"; - $tab[$i][$j]["order"]=$tab[$i][$j][$value]; - $tab[$i][$j]["valign"]="bottom"; - $tab[$i][$j]["show"]=false; - } - } - } -} - -$page_name = "admin_difflist_types"; -$page_name_up = "admin_difflist_type&mode=up"; -$page_name_add = "admin_difflist_type&mode=add"; -$page_name_del = "admin_difflist_type&mode=del"; -$label_add = _ADD_DIFFLIST_TYPE; -$_SESSION['m_admin']['init'] = true; - -$title = _DIFFLIST_TYPES." : ".$i." "._DIFFLIST_TYPE; -$autoCompletionArray = false;//array(); - -$list->admin_list($tab, $i, $title, 'difflist_type_id','admin_difflist_types','entities', 'difflist_type_id', true, $page_name_up, $page_name_val, $page_name_ban, $page_name_del, $page_name_add, $label_add, false, false, _ALL_DIFFLIST_TYPES, _DIFFLIST_TYPE, "share-alt", true, true, false, true, "", true, $autoCompletionArray, false, true); -?> diff --git a/modules/entities/class/Entity.php b/modules/entities/class/Entity.php deleted file mode 100755 index 4e1fa68c8d8..00000000000 --- a/modules/entities/class/Entity.php +++ /dev/null @@ -1,42 +0,0 @@ -<?php -/* -* Copyright 2008-2016 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 Entity Object (herits of the BaseObject class) -* -* -* @file -* @author Claire Figueras <dev@maarch.org> -* @date $date$ -* @version $Revision$ -* @ingroup basket -*/ - -require_once 'modules/entities/class/Entity_Abstract.php'; - -/** -* @brief Entity Object, herits of the BaseObject class -* -* @ingroup basket -*/ -class EntityObj extends EntityObj_Abstract - { - // custom -} diff --git a/modules/entities/class/EntityControler.php b/modules/entities/class/EntityControler.php deleted file mode 100755 index 425a70c7d9c..00000000000 --- a/modules/entities/class/EntityControler.php +++ /dev/null @@ -1,47 +0,0 @@ -<?php -/* -* Copyright 2008-2016 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 controler of the Basket Object (create, save, modify, etc...) -* -* -* @file -* @date $date$ -* @version $Revision$ -* @ingroup core -*/ - -require_once 'modules/entities/class/EntityControler_Abstract.php'; - -/** -* @brief Controler of the Entity Object -* -*<ul> -* <li>Get an entity object from an id</li> -* <li>Save in the database an entity</li> -* <li>Manage the operation on the entities related tables in the database (insert, select, update, delete)</li> -*</ul> -* @ingroup core -*/ -class EntityControler extends EntityControler_Abstract -{ - // custom -} - diff --git a/modules/entities/class/EntityControler_Abstract.php b/modules/entities/class/EntityControler_Abstract.php deleted file mode 100755 index 78c6cbf58b8..00000000000 --- a/modules/entities/class/EntityControler_Abstract.php +++ /dev/null @@ -1,619 +0,0 @@ -<?php -/* -* Copyright 2008-2016 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 controler of the Basket Object (create, save, modify, etc...) -* -* -* @file -* @author Claire Figueras <dev@maarch.org> -* @date $date$ -* @version $Revision$ -* @ingroup core -*/ - -// To activate de debug mode of the class -$_ENV['DEBUG'] = false; -/* -define("_CODE_SEPARATOR","/"); -define("_CODE_INCREMENT",1); -*/ - -// Loads the required class -try { - require_once("core/class/class_db.php"); - require_once("modules/entities/class/Entity.php"); - require_once("modules/entities/entities_tables.php"); -} catch (Exception $e){ - functions::xecho($e->getMessage()).' // '; -} - -/** -* @brief Controler of the Entity Object -* -*<ul> -* <li>Get an entity object from an id</li> -* <li>Save in the database an entity</li> -* <li>Manage the operation on the entities related tables in the database (insert, select, update, delete)</li> -*</ul> -* @ingroup core -*/ -abstract class EntityControler_Abstract -{ - /** - * Db query object used to connnect to the database - */ - private static $db; - - /** - * Entities table - */ - public static $entities_table ; - - /** - * Users_entities table - */ - public static $users_entities_table ; - - /** - * Groupbasket_redirect table - */ - public static $groupbasket_redirect_table ; - - /** - * Opens a database connexion and values the tables variables - */ - - - /** - * Close the database connexion - */ - - - /** - * Returns an Entity Object based on a entity identifier - * - * @param $entity_id string Entity identifier - * @param $can_be_disabled bool if true gets the basket even if it is disabled in the database (false by default) - * @return User object with properties from the database or null - */ - public function get($entity_id, $can_be_disabled = false) - { - if(empty($entity_id)) - return null; - - $db = new database(); - - $query = "select * from ".ENT_ENTITIES." where entity_id = ?"; - if(!$can_be_disabled) - $query .= " and enabled = 'Y'"; - - try{ - $stmt = $db->query($query,array($entity_id)); - } catch (Exception $e){ - echo _NO_ENTITY_WITH_ID.' '.$entity_id.' // '; - } - if($stmt->rowCount() > 0) - { - $entity = new EntityObj(); - $queryResult=$stmt->fetchObject(); - foreach($queryResult as $key => $value){ - $entity->{$key}=$value; - } - - return $entity; - } - else - { - - return null; - } - } - - /** - * Returns all entities (enabled by default) from the database in an array of Entity Objects (ordered by group_desc by default) - * - * @param $order_str string Order string passed to the query ("order by short_label asc" by default) - * @param $enabled_only bool if true returns only the enabled entities, otherwise returns even the disabled (true by default) - * @return Array of Entity objects with properties from the database - */ - public function getAllEntities($order_str = "order by short_label asc", $enabled_only = true) - { - $db = new database(); - $query = "select * from ".ENT_ENTITIES." "; - if($enabled_only) - $query .= "where enabled = 'Y'"; - - $query.= $order_str; - - try{ - $stmt = $db->query($query); - } catch (Exception $e){} - - $entities = array(); - while($res = $stmt->fetchObject()) - { - $ent=new EntityObj(); - foreach($res as $key => $value) - $tmp_array[$key] = $value; - - $ent->setArray($tmp_array); - array_push($entities, $ent); - } - - return $entities; - } - - /** - * Returns entities of current user from the database in an array of Entity Objects (ordered by group_desc by default) - * - * @param $order_str string Order string passed to the query ("order by short_label asc" by default) - * @param $enabled_only bool if true returns only the enabled entities, otherwise returns even the disabled (true by default) - * @return Array of Entity objects with properties from the database - */ - public function getEntitiesUser($entity_id) - { - $db = new database(); - - $entities=self::getEntityArbo($entity_id); - - - return $entities; - } - - public function getEntityArbo($parent) - { - $db = new Database(); - $entities=array(); - - $stmt = $db->query("SELECT * from entities WHERE parent_entity_id = ? and enabled = 'Y'",array($parent)); - while($res = $stmt->fetchObject()) - { - $ent=new EntityObj(); - foreach($res as $key => $value) - $tmp_array[$key] = $value; - - $ent->setArray($tmp_array); - array_push($entities, $ent); - $entities=array_merge(self::getEntityArbo($res->entity_id),$entities); - } - return $entities; - } - - public function getEntityParentTreeOf($entityId) - { - $entities = array(); - if ($entityId <> '') { - $db = new Database(); - - - $stmt = $db->query("SELECT parent_entity_id from entities WHERE entity_id = ? and enabled = 'Y'",array($entityId)); - while ($res = $stmt->fetchObject()) { - $ent=new EntityObj(); - foreach($res as $key => $value) - $tmp_array[$key] = $value; - - $ent->setArray($tmp_array); - array_push($entities, $ent); - $entities=array_merge(self::getEntityParentTreeOf($res->parent_entity_id),$entities); - } - } else { - - } - return $entities; - } - - /** - * Returns entities of current user from the database in an array of Entity Objects (ordered by group_desc by default) - * - * @param $entities Array of Entities Objects entities will be sort - * @return Array of Entity objects sorted - */ - public function sortEntities($entities) - { - $arr=array(); - foreach($entities as $key => $value){ - array_push($arr, "'".$value->entity_id."'"); - } - $tmp_entities=join(',',$arr); - - $db = new Database(); - $arr=array(); - $query="Select * from ".ENT_ENTITIES." WHERE entity_id IN (?) order by short_label asc"; - $stmt = $db->query($query,array($tmp_entities)); - while($res = $stmt->fetchObject()) - { - $ent=new EntityObj(); - foreach($res as $key => $value) - $tmp_array[$key] = $value; - - $ent->setArray($tmp_array); - array_push($arr, $ent); - } - return $arr; - } - - /** - * Returns in an array all the members of an entity (user_id only) - * - * @param $user_id string User identifier - * @return Array (user_id, user_role, primary_entity) or null - */ - public function getUsersEntities($user_id) - { - if(empty($user_id)) - return null; - - $db = new Database(); - $func = new functions(); - $query = "SELECT ue.entity_id, ue.user_role, ue.primary_entity from ". ENT_USERS_ENTITIES." ue, ".ENT_ENTITIES." u where ue.user_id = ? and ue.entity_id = u.entity_id and u.enabled = 'Y'"; - - try{ - $stmt = $db->query($query,array($user_id)); - } catch (Exception $e){ - echo _NO_USER_WITH_ID.' '.$user_id.' // '; - } - $entities = array(); - while($res= $stmt->fetchObject()) - { - array_push($entities, array('USER_ID' => $user_id, 'ENTITY_ID' => $res->entity_id, 'PRIMARY' => $res->primary_entity, 'ROLE' => $res->user_role)); - } - - return $entities; - } - - /** - * Saves in the database an entity object - * - * @param $entity Entity object to be saved - * @param $mode string Saving mode : add or up - * @return bool true if the save is complete, false otherwise - */ - public function save($entity, $mode) - { - if(!isset($entity) ) - return false; - - if($mode == "up") - return self::update($entity); - elseif($mode =="add") - return self::insert($entity); - - return false; - } - - /** - * Inserts in the database (entities table) an Entity object - * - * @param $entity Entity object - * @return bool true if the insertion is complete, false otherwise - */ - protected function insert($entity) - { - if(!isset($entity) ) - return false; - - $db = new Database(); - $prep_query = self::insert_prepare($entity); - - $query="insert into ".ENT_ENTITIES." (?) values(?)"; - try{ - $stmt = $db->query($query,array($prep_query['COLUMNS'],$prep_query['VALUES'])); - $ok = true; - } catch (Exception $e){ - echo _CANNOT_INSERT_ENTITY." ".$entity->toString().' // '; - $ok = false; - } - - return $ok; - } - - /** - * Updates an entity in the database (entities table) with an Entity object - * - * @param $entity Entity object - * @return bool true if the update is complete, false otherwise - */ - protected function update($entity) - { - if(!isset($entity) ) - return false; - - $query="update ".ENT_ENTITIES." set " - .self::update_prepare($entity) - ." where entity_id= ?"; - - try{ - $stmt = $db->query(array($entity->entity_id)); - $ok = true; - } catch (Exception $e){ - echo _CANNOT_UPDATE_ENTITY." ".$entity->toString().' // '; - $ok = false; - } - return $ok; - } - - /** - * Deletes in the database (entities related tables) a given entity (entity_id) - * - * @param $entity_id string Entity identifier - * @return bool true if the deletion is complete, false otherwise - */ - public function delete($entity_id) - { - if(!isset($entity_id)|| empty($entity_id) ) - return false; - if(! self::userExists($entity_id)) - return false; - - self::connect(); - $query="delete from ".ENT_ENTITIES." where entity_id= ?"; - - try{ - $stmt = $db->query($query,array($entity_id)); - $ok = true; - } catch (Exception $e){ - echo _CANNOT_DELETE_ENTITY_ID." ".$entity_id.' // '; - $ok = false; - } - - if($ok) - $ok = cleanGroupbasketRedirect($entity_id); - - if($ok) - $ok = cleanUsersentities($entity_id); - - return $ok; - } - - /** - * Cleans the users_entities table in the database from a given field (entity_id by default) - * - * @param $id string object identifier - * @param $field string Field name (entity_id by default) - * @return bool true if the cleaning is complete, false otherwise - */ - public function cleanUsersentities($id, $field = 'entity_id') - { - if(!isset($id)|| empty($id) ) - return false; - - $db = new Database(); - $query="delete from ".ENT_USERS_ENTITIES." where ".$field."= ?"; - - try{ - $stmt = $db->query($query,array($id)); - $ok = true; - } catch (Exception $e){ - echo _CANNOT_DELETE.' '.$field." ".$id.' // '; - $ok = false; - } - - return $ok; - } - - /** - * Cleans the groupbasket_redirect table in the database from a given field (entity_id by default) - * - * @param $id string object identifier - * @param $field string Field name (entity_id by default) - * @return bool true if the cleaning is complete, false otherwise - */ - public function cleanGroupbasketRedirect($id, $field = 'entity_id') - { - if(!isset($id)|| empty($id) ) - return false; - - $db = new Database(); - $query="delete from ".$_SESSION['tablename']['ent_groupbasket_redirect']." where ".$field."= ?"; - - try{ - $stmt = $db->query($query,array($id)); - $ok = true; - } catch (Exception $e){ - echo _CANNOT_DELETE.' '.$field." ".$id.' // '; - $ok = false; - } - - return $ok; - } - - /** - * Asserts if a given entity (entity_id) exists in the database - * - * @param $entity_id String Entity identifier - * @return bool true if the basket exists, false otherwise - */ - public function entityExists($entity_id) - { - if(!isset($entity_id) || empty($entity_id)) - return false; - - $query = "select entity_id from ".ENT_ENTITIES." where entity_id = ?"; - - try{ - $stmt = $db->query($query,array($entity_id)); - } catch (Exception $e){ - echo _UNKNOWN.' '._ENTITY." ".$entity_id.' // '; - } - - if($stmt->rowCount() > 0) - { - - return true; - } - - return false; - } - - /** - * Prepares the update query for a given Entity object - * - * @param $entity Entity object - * @return String containing the fields and the values - */ - protected function update_prepare($entity) - { - $result=array(); - foreach($entity->getArray() as $key => $value) - { - // For now all fields in the users table are strings or dates - if(!empty($value)) - { - $result[]=$key."='".$value."'"; - } - } - // Return created string minus last ", " - return implode(",",$result); - } - - /** - * Prepares the insert query for a given Entity object - * - * @param $entity Entity object - * @return Array containing the fields and the values - */ - protected function insert_prepare($entity) - { - $columns=array(); - $values=array(); - foreach($entity->getArray() as $key => $value) - { - //For now all fields in the users table are strings or dates - if(!empty($value)) - { - $columns[]=$key; - $values[]="'".$value."'"; - } - } - return array('COLUMNS' => implode(",",$columns), 'VALUES' => implode(",",$values)); - } - - /** - * Disables a given entity - * - * @param $entity_id String Entity identifier - * @return bool true if the disabling is complete, false otherwise - */ - public function disable($entity_id) - { - if(!isset($entity_id)|| empty($entity_id) ) - return false; - if(! self::entityExists($entity_id)) - return false; - - $db = new Database(); - $query="update ".ENT_ENTITIES." set enabled = 'N' where entity_id= ?"; - - try{ - $stmt = $db->query($query,$entity_id); - $ok = true; - } catch (Exception $e){ - echo _CANNOT_DISABLE_ENTITY." ".$entity_id.' // '; - $ok = false; - } - return $ok; - } - - /** - * Enables a given entity - * - * @param $entity_id String Entity identifier - * @return bool true if the enabling is complete, false otherwise - */ - public function enable($entity_id) - { - if(!isset($entity_id)|| empty($entity_id) ) - return false; - if(! self::entityExists($entity_id)) - return false; - - self::connect(); - $query="update ".ENT_ENTITIES." set enabled = 'Y' where entity_id='".$entity_id."'"; - - try{ - $stmt = $db->query($query,array($entity_id)); - $ok = true; - } catch (Exception $e){ - echo _CANNOT_ENABLE_ENTITY." ".$entity_id.' // '; - $ok = false; - } - return $ok; - } - - /** - * Returns the number of entities of the entities table (only the enabled by default) - * - * @param $enabled_only Bool if true counts only the enabled ones, otherwise counts all entities even the disabled ones (true by default) - * @return Integer the number of entities in the entities table - */ - public function getEntitiesCount($enabled_only = true) - { - $nb = 0; - $db = new Database(); - - $query = "select entity_id from ".ENT_ENTITIES." " ; - if($enabled_only) - $query .= "where enabled ='Y'"; - - try{ - $stmt = $db->query($query); - } catch (Exception $e){} - - $nb = $stmt->rowCount(); - return $nb; - } - - /** - * Loads into the users_entities table the given data for a given user - * - * @param $user_id String User identifier - * @param $array Array - * @return bool true if the loadng is complete, false otherwise - */ - public function loadDbUsersentities($user_id, $array) - { - if(!isset($user_id)|| empty($user_id) ) - return false; - if(!isset($array) || count($array) == 0) - return false; - - $ok = true; - $func = new functions(); - for($i=0; $i < count($array ); $i++) - { - if($ok) - { - $query = "INSERT INTO ".ENT_USERS_ENTITIES." (user_id, entity_id, primary_entity, user_role) VALUES (?, ?, ?, ?)"; - try{ - $db = new database(); - $stmt = $db->query($query,array($user_id,$array[$i]['ENTITY_ID'],$array[$i]['PRIMARY'],$array[$i]['ROLE'])); - $ok = true; - } catch (Exception $e){ - $ok = false; - } - } - else - break; - } - return $ok; - } -} -?> diff --git a/modules/entities/class/Entity_Abstract.php b/modules/entities/class/Entity_Abstract.php deleted file mode 100755 index bfc0146aaf6..00000000000 --- a/modules/entities/class/Entity_Abstract.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php -/* -* Copyright 2008-2016 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 Entity Object (herits of the BaseObject class) -* -* -* @file -* @author Claire Figueras <dev@maarch.org> -* @date $date$ -* @version $Revision$ -* @ingroup basket -*/ - -// Loads the required class -try { - require_once("core/class/BaseObject.php"); -} catch (Exception $e){ - functions::xecho($e->getMessage()).' // '; -} - -/** -* @brief Entity Object, herits of the BaseObject class -* -* @ingroup basket -*/ -abstract class EntityObj_Abstract extends BaseObject - { - /** - * Returns the string representing the Entity object - * - * @return string The entity label (entity_label) - */ - function __toString(){ - return $this->entity_label ; - } -} -?> diff --git a/modules/entities/class/class_get_barcode.php b/modules/entities/class/class_get_barcode.php deleted file mode 100755 index fe29fab79b3..00000000000 --- a/modules/entities/class/class_get_barcode.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php - -/* -* Copyright 2008-2016 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/>. -*/ - -/** -* File : class_get_barcode.php -* -* Frame able to list boxes in physical archives modules -* -* @package Maarch 3.0 -* @version 2.1 -* @since 10/2005 -* @license GPL -* @author Loic Vinet <dev@maarch.org> - -*/ - -require_once 'modules/entities/class/class_get_barcode_Abstract.php'; - -class barcocdeFPDF extends barcocdeFPDF_Abstract { - // custom -} diff --git a/modules/entities/class/class_get_barcode_Abstract.php b/modules/entities/class/class_get_barcode_Abstract.php deleted file mode 100755 index cd4b76a6fed..00000000000 --- a/modules/entities/class/class_get_barcode_Abstract.php +++ /dev/null @@ -1,59 +0,0 @@ -<?php - -/* -* Copyright 2008-2016 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/>. -*/ - -/** -* File : class_get_barcode.php -* -* Frame able to list boxes in physical archives modules -* -* @package Maarch 3.0 -* @version 2.1 -* @since 10/2005 -* @license GPL -* @author Loic Vinet <dev@maarch.org> - -*/ - -abstract class barcocdeFPDF_Abstract extends FPDI { - - function generateBarCode($type, $code, $hh=60, $hr, $hw, $showtype) - { - $img_file_name = $_SESSION['user']['UserId'] . time() . rand() . ".png"; - - $objCode = new pi_barcode(); - - $objCode->setCode($code); - - $objCode->setType($type); - - $objCode->setSize($hh, $hw); - - $objCode->setText($code); - - $objCode->hideCodeType(); - - $objCode->setFiletype('PNG'); - - $objCode->writeBarcodeFile($_SESSION['config']['tmppath'] . $img_file_name); - - return $img_file_name; - } -} diff --git a/modules/entities/class/class_manage_entities.php b/modules/entities/class/class_manage_entities.php deleted file mode 100755 index 34a2f5d8717..00000000000 --- a/modules/entities/class/class_manage_entities.php +++ /dev/null @@ -1,28 +0,0 @@ -<?php - -/* -* Copyright 2008-2016 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 'modules/entities/class/class_manage_entities_Abstract.php'; - -class entity extends entity_Abstract -{ - // custom -} - diff --git a/modules/entities/class/class_manage_entities_Abstract.php b/modules/entities/class/class_manage_entities_Abstract.php deleted file mode 100755 index ebde6cbfcb9..00000000000 --- a/modules/entities/class/class_manage_entities_Abstract.php +++ /dev/null @@ -1,1489 +0,0 @@ -<?php - -/* -* Copyright 2008-2016 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("modules/entities/entities_tables.php"); - -abstract class entity_Abstract extends functions -{ - /** - * Form for the management of the entities. - * - * @param string $mode administrator mode (modification, suspension, authorization, delete) - * @param string $id entity identifier (empty by default) - */ - public function formentity($mode, $id = '') - { - $core_tools = new core_tools(); - $state = true; - if($mode == "up") - { - $_SESSION['service_tag'] = 'entity_up'; - echo '<h1><i class="fa fa-sitemap fa-2x"></i> '._ENTITY_MODIFICATION.'</h1>'; - if(empty($_SESSION['error'])) - { - $db = new Database(); - $stmt = $db->query('select * from '.ENT_ENTITIES." where entity_id = ?",array(trim($id))); - if($stmt->rowCount() == 0) - { - $_SESSION['error'] = _ENTITY_MISSING; - $state = false; - } - else - { - $_SESSION['m_admin']['entity']['entityId'] = functions::show_string($id); - $line = $stmt->fetchObject(); - $_SESSION['m_admin']['entity']['label'] = functions::show_string($line->entity_label); - $_SESSION['m_admin']['entity']['short_label'] = functions::show_string($line->short_label); - $_SESSION['m_admin']['entity']['entity_full_name'] = functions::show_string($line->entity_full_name); - $_SESSION['m_admin']['entity']['enabled'] = functions::show_string($line->enabled); - $_SESSION['m_admin']['entity']['adrs1'] = functions::show_string($line->adrs_1); - $_SESSION['m_admin']['entity']['adrs2'] = functions::show_string($line->adrs_2); - $_SESSION['m_admin']['entity']['adrs3'] = functions::show_string($line->adrs_3); - $_SESSION['m_admin']['entity']['zcode'] = functions::show_string($line->zipcode); - $_SESSION['m_admin']['entity']['city'] = functions::show_string($line->city); - $_SESSION['m_admin']['entity']['country'] = functions::show_string($line->country); - $_SESSION['m_admin']['entity']['email'] = functions::show_string($line->email); - $_SESSION['m_admin']['entity']['business'] = functions::show_string($line->business_id); - $_SESSION['m_admin']['entity']['parent'] = functions::show_string($line->parent_entity_id); - $_SESSION['m_admin']['entity']['type'] = functions::show_string($line->entity_type); - $_SESSION['m_admin']['entity']['archival_agreement'] = functions::show_string($line->archival_agreement); - $_SESSION['m_admin']['entity']['archival_agency'] = functions::show_string($line->archival_agency); - } - } - //$core_tools->execute_modules_services($_SESSION['modules_services'], 'entity_up', "include"); - //$core_tools->execute_app_services($_SESSION['app_services'], 'entity_up', 'include'); - } - elseif($mode == 'add') - { - $_SESSION['service_tag'] = 'entity_add'; - echo '<h1><i class="fa fa-sitemap fa-2x"></i> '._ENTITY_ADDITION.'</h1>'; - if($_SESSION['m_admin']['init']== true || !isset($_SESSION['m_admin']['init'] )) - { - //$this->init_session(); - } - //$core_tools->execute_modules_services($_SESSION['modules_services'], 'entity_add', "include"); - //$core_tools->execute_app_services($_SESSION['app_services'], 'entity_add', 'include'); - } - $_SESSION['service_tag_form'] = 'formentity'; - $except = array(); - if(isset($_SESSION['m_admin']['entity']['entityId'])) - { - $except[] = $_SESSION['m_admin']['entity']['entityId']; - } - $entities = array(); - if($_SESSION['user']['UserId'] == 'superadmin') - { - $entities = $this->getShortEntityTree($entities, 'all', '', $except ); - } - else - { - $entities = $this->getShortEntityTree($entities, $_SESSION['user']['entities'], '' , $except); - } - ?> - <div id="inner_content" class="clearfix"> - <?php - $core_tools->execute_modules_services($_SESSION['modules_services'], 'formentity', "include"); - $core_tools->execute_app_services($_SESSION['app_services'], 'formentity', 'include'); - if($state == false) - { - $_SESSION['error'] = _ENTITY_UNKNOWN; - echo '<div class="error">'.$_SESSION['error'].'</div>'; - } - else - { - ?> - <div class="block" style="float:left;width:65%;"> - <form name="formentity" id="formentity" method="post" style="width:500px;margin:auto;" action="<?php if($mode == 'up') { echo $_SESSION['config']['businessappurl'].'index.php?display=true&module=entities&page=entity_up_db'; } elseif($mode == 'add') { echo $_SESSION['config']['businessappurl'].'index.php?display=true&module=entities&page=entity_add_db'; } ?>" class="forms"> - <input type="hidden" name="display" value="true" /> - <input type="hidden" name="module" value="entities" /> - <?php if($mode == 'up') - {?> - <input type="hidden" name="page" value="entity_up_db" /> - <?php } - elseif($mode == 'add') - {?> - <input type="hidden" name="page" value="entity_add_db" /> - <?php } ?> - <input type="hidden" name="order" id="order" value="<?php if(isset($_REQUEST['order'])){ functions::xecho($_REQUEST['order']);}?>" /> - <input type="hidden" name="order_field" id="order_field" value="<?php if(isset($_REQUEST['order_field'])){ functions::xecho($_REQUEST['order_field']);}?>" /> - <input type="hidden" name="what" id="what" value="<?php if(isset($_REQUEST['what'])){functions::xecho($_REQUEST['what']);}?>" /> - <input type="hidden" name="start" id="start" value="<?php if(isset($_REQUEST['start'])){ functions::xecho($_REQUEST['start']);}?>" /> - <?php - if($mode == 'up') - { - ?> - <p style="text-align:right;"> - <label><?php echo _ID;?> : </label> - <input name="entityId" id="entityId" type="text" value="<?php functions::xecho($_SESSION['m_admin']['entity']['entityId']);?>" readonly="readonly" class="readonly" /><span class="red_asterisk"><i class="fa fa-star"></i></span> - <input type="hidden" name="id" value="<?php functions::xecho($id);?>" /> - <input type="hidden" name="mode" value="<?php functions::xecho($mode);?>" /> - </p> - <?php - } - else - { - ?> - <p style="text-align:right;"> - <label><?php echo _ID;?> : </label> - <input name="entityId" id="entityId" type="text" value="<?php if(isset($_SESSION['m_admin']['entity']['entityId'])){ functions::xecho($_SESSION['m_admin']['entity']['entityId']);} ?>" /><span class="red_asterisk"><i class="fa fa-star"></i></span> - </p> - <?php - } - ?> - <p style="text-align:right;"> - <label><?php echo _ENTITY_LABEL;?> : </label> - <input name="label" type="text" id="label" value="<?php if(isset($_SESSION['m_admin']['entity']['label'])){ echo $_SESSION['m_admin']['entity']['label'];} ?>" /><span class="red_asterisk"><i class="fa fa-star"></i></span> - </p> - <p style="text-align:right;"> - <label><?php echo _SHORT_LABEL;?> : </label> - <input name="short_label" type="text" id="short_label" value="<?php if(isset($_SESSION['m_admin']['entity']['short_label'])){ functions::xecho($_SESSION['m_admin']['entity']['short_label']);} ?>" /><span class="red_asterisk"><i class="fa fa-star"></i></span> - </p> - <p style="text-align:right;"> - <label><?php echo _ENTITY_FULL_NAME;?> : </label> - <textarea name="entity_full_name" style="margin-right: 7px" type="text" id="entity_full_name"><?php if(isset($_SESSION['m_admin']['entity']['entity_full_name'])){ functions::xecho($_SESSION['m_admin']['entity']['entity_full_name']);}?></textarea> - </p> - <p style="text-align:right;"> - <label><?php echo _ENTITY_ADR_1;?> : </label> - <input name="adrs1" style="margin-right: 7px" type="text" id="adrs1" value="<?php if(isset( $_SESSION['m_admin']['entity']['adrs1'])){functions::xecho($_SESSION['m_admin']['entity']['adrs1']); }?>" /> - </p> - <p style="text-align:right;"> - <label><?php echo _ENTITY_ADR_2;?> : </label> - <input name="adrs2" style="margin-right: 7px" type="text" id="adrs2" value="<?php if(isset($_SESSION['m_admin']['entity']['adrs2'])){ functions::xecho($_SESSION['m_admin']['entity']['adrs2']);} ?>" /> - </p> - <p style="text-align:right;"> - <label><?php echo _ENTITY_ADR_3;?> : </label> - <input name="adrs3" style="margin-right: 7px" type="text" id="adrs3" value="<?php if(isset($_SESSION['m_admin']['entity']['adrs3'])){ functions::xecho($_SESSION['m_admin']['entity']['adrs3']);} ?>" /> - </p> - <p style="text-align:right;"> - <label><?php echo _ENTITY_ZIPCODE;?> : </label> - <input name="zcode" style="margin-right: 7px" type="text" id="zcode" value="<?php if(isset($_SESSION['m_admin']['entity']['zcode'])){ functions::xecho($_SESSION['m_admin']['entity']['zcode']);} ?>" /> - </p> - <p style="text-align:right;"> - <label><?php echo _ENTITY_CITY;?> : </label> - <input name="city" style="margin-right: 7px" type="text" id="city" value="<?php if(isset($_SESSION['m_admin']['entity']['city'])){ functions::xecho($_SESSION['m_admin']['entity']['city']); }?>" /> - </p> - <p style="text-align:right;"> - <label><?php echo _ENTITY_COUNTRY;?> : </label> - <input name="country" style="margin-right: 7px" type="text" id="country" value="<?php if(isset($_SESSION['m_admin']['entity']['country'])){ functions::xecho($_SESSION['m_admin']['entity']['country']);} ?>" /> - </p> - <p style="text-align:right;"> - <label><?php echo _ENTITY_EMAIL;?> : </label> - <input name="email" style="margin-right: 7px" type="text" id="email" value="<?php if(isset($_SESSION['m_admin']['entity']['email'])){ functions::xecho($_SESSION['m_admin']['entity']['email']);} ?>" /> - </p> - <p style="text-align:right;"> - <label><?php echo _ENTITY_BUSINESS;?> : </label> - <input name="business" style="margin-right: 7px" type="text" id="business" value="<?php if(isset($_SESSION['m_admin']['entity']['business'])){ functions::xecho($_SESSION['m_admin']['entity']['business']); }?>" /> - </p> - <p style="text-align:right;"> - <label><?php echo _ENTITY_TYPE; - require_once('modules'.DIRECTORY_SEPARATOR.'entities'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_modules_tools.php'); - - $ent = new entities; - - if($_SESSION['user']['UserId'] =="superadmin") - { - $entity_type = "all"; - } - else - { - $entity_type = $this->get_entity_type_level($_SESSION['user']['primaryentity']['id']); - } - - $typelist = $this->load_entities_types_for_user($entity_type); - ?> : </label> - <select name="type" id="type"> - <option value="" ><?php echo _CHOOSE_ENTITY_TYPE;?></option> - <?php - for ($i = 0; $i < count($typelist); $i++) - { - ?> - <option value="<?php functions::xecho($typelist[$i]['id']);?>" <?php if (isset($_SESSION['m_admin']['entity']['type']) &&$_SESSION['m_admin']['entity']['type'] == $typelist[$i]['id']){ echo 'selected="selected"'; } ?> ><?php functions::xecho($typelist[$i]['label']);?></option> - <?php - } - ?> - </select><span class="red_asterisk"><i class="fa fa-star"></i></span> - </p> - <p style="text-align:right;"> - <label><?php echo _ARCHIVAL_AGREEMENT ?> : </label> - <input name="archival_agreement" style="margin-right: 7px" type="text" id="archival_agreement" value="<?php if(isset($_SESSION['m_admin']['entity']['archival_agreement'])){ functions::xecho($_SESSION['m_admin']['entity']['archival_agreement']); }?>"> - </p> - <p style="text-align:right;"> - <label><?php echo _ARCHIVAL_AGENCY ?> : </label> - <input name="archival_agency" style="margin-right: 7px" type="text" id="archival_agency" value="<?php if(isset($_SESSION['m_admin']['entity']['archival_agency'])){ functions::xecho($_SESSION['m_admin']['entity']['archival_agency']); }?>"> - </p> - <?php - $foundParent = false; - for ($cptEnt=0; $cptEnt<count($entities);$cptEnt++) { - if ($entities[$cptEnt]['ID'] == $_SESSION['m_admin']['entity']['parent']) { - $foundParent = true; - } - } - ?> - <p> - <label for="parent_id"><?php echo _ENTITY_PARENT;?> : </label><br /><br /> - <select name="parententity" size="10" style="width:98%;"> - <option value=""><?php echo _CHOOSE_ENTITY_PARENT;?></option> - <?php - if (!$foundParent && $_SESSION['m_admin']['entity']['parent'] <> '') { - $stmt = $db->query("select entity_label from entities where entity_id = ?",array(trim($_SESSION['m_admin']['entity']['parent']))); - $resParent = $stmt->fetchObject(); - if ($resParent->entity_label <> '') { - $theLabelParent = $resParent->entity_label; - } else { - $theLabelParent = $_SESSION['m_admin']['entity']['parent']; - } - echo '<option style="font-size:14px;font-weight:bold;" '; - echo 'value="' . $_SESSION['m_admin']['entity']['parent'] . '" '; - echo 'selected="selected" >'; - echo $theLabelParent . '</option>'; - } - for ($i=0; $i<count($entities);$i++) { - ?> - <option <?php - if ($entities[$i]['ID'] <> $_SESSION['m_admin']['entity']['entityId']) { - if (isset($_SESSION['m_admin']['entity']['parent']) && $entities[$i]['ID'] == $_SESSION['m_admin']['entity']['parent']) { - echo 'style="font-size:14px;font-weight:bold;"'; - } ?> value="<?php functions::xecho($entities[$i]['ID']);?>" <?php - if (isset($_SESSION['m_admin']['entity']['parent']) && $entities[$i]['ID'] == $_SESSION['m_admin']['entity']['parent']) { - echo 'selected="selected"'; - } ?> ><?php echo $entities[$i]['LABEL'];?></option><?php - } - } - ?> - </select> - </p> - - <p class="buttons" style="text-align:center;"> - <input type="submit" name="Submit" value="<?php echo _VALIDATE;?>" class="button" /> - <input type="button" name="cancel" value="<?php echo _CANCEL;?>" class="button" onclick="javascript:window.top.location.href='<?php echo $_SESSION['config']['businessappurl'];?>index.php?page=manage_entities&module=entities';"/> - </p> - </form> - </div> - <?php - } - ?> - </div> - <?php - } - - /** - * Checks if an entity has children - * - * @param string $id entity identifier - */ - public function havechild($id) - { - $db = new Database(); - $stmt = $db->query('select entity_id from '.ENT_ENTITIES." where parent_entity_id = ?",array(trim($id))); - if($stmt->rowCount() == 0){ return false; } - else{ return true; } - } - - /** - * Checks if an entity is related with a user - * - * @param string $id entity identifier - */ - public function isRelated($id) - { - $db = new Database(); - $stmt = $db->query('select ue.entity_id from '.ENT_USERS_ENTITIES." ue, ".$_SESSION['tablename']['users']." u where ue.user_id = u.user_id and ue.entity_id = ?",array(trim($id))); - if($stmt->rowCount() == 0){ return false; } - else{ return true; } - } - - - /** - * Inits the session variables related to the entities administration. - */ - public function init_session() - { - unset($_SESSION['m_admin']); - } - - /** - * Returns entity label - * - * @param string $entity_id entity selected - */ - public function getentitylabel($entity_id) - { - $labelreturn = false; - - $db = new Database(); - $stmt = $db->query("select entity_label from ".ENT_ENTITIES." where entity_id = ?",array(trim($entity_id))); - - if($stmt->rowCount() > 0) - { - $line = $stmt->fetchObject(); - return $line->entity_label; - } - else - { - return $labelreturn; - } - } - /** - * Returns entity label - * - * @param string $entity_id entity selected - */ - public function getentityshortlabel($entity_id) - { - $labelreturn = false; - - $db = new Database(); - $stmt = $db->query("select short_label from ".ENT_ENTITIES." where entity_id = ?",array(trim($entity_id))); - - if($stmt->rowCount() > 0) - { - $line = $stmt->fetchObject(); - return $line->short_label; - } - else - { - return $labelreturn; - } - } - - - /** - * check whether an entity exists and is enabled - * - * @param string $entity_id identifier of the entity - */ - public function isEnabledEntity($entity_id) - { - $db = new Database(); - $stmt = $db->query('select entity_id, entity_label, short_label from '.ENT_ENTITIES." where enabled = 'Y' and entity_id = ?",array(trim($entity_id))); - if($stmt->rowCount() > 0) - { - $line = $stmt->fetchObject(); - return $line; - } - else - { - return false; - } - } - - /** - * Gets all children of an entity in an array - * - * @param string $parent the root of the tree - * @param string $selected identifier of the selected entity - * @param string $tabspace margin of separation of tree's branches - * @param array $except array of entity_id ( elements of the tree that should not appear ) - */ - - public function getEntityChildrenTree($entities, $parent = '', $tabspace = '', $except = array(), $where = '') - { - $db = new Database(); - if(trim($parent) == "") - { - $stmt = $db->query('select entity_id, entity_label, short_label from '.ENT_ENTITIES." where enabled = 'Y' and (parent_entity_id ='' or parent_entity_id is null) ".$where . " order by short_label, entity_id"); - } - else - { - $stmt = $db->query('select entity_id, entity_label, short_label from '.ENT_ENTITIES." where enabled = 'Y' and parent_entity_id = '".trim($parent)."' ".$where . " order by short_label, entity_id"); - } - - if($stmt->rowCount() > 0) - { - $espace = $tabspace.' '; - - while($line = $stmt->fetchObject()) - { - if (!in_array($line->entity_id, $except)) - { - array_push($entities, array('ID' =>$line->entity_id, 'LABEL' => $espace.functions::xssafe($line->entity_label), 'SHORT_LABEL' =>$espace.functions::show_string($line->short_label), 'KEYWORD' => false)); - - $db2 = new entity(); - $db= new Database(); - $stmt2 = $db->query('select entity_id from '.ENT_ENTITIES." where enabled = 'Y' and parent_entity_id = ?".$where,array(trim($line->entity_id))); - $tmp = array(); - if($stmt2->rowCount() > 0) - { - $tmp = $db2->getEntityChildrenTree($tmp,$line->entity_id, $espace, $except); - $entities = array_merge($entities, $tmp); - } - } - } - } - return $entities; - } - - /** - * Gets all children of an entity in an array - * - * @param string $parent the root of the tree - * @param string $selected identifier of the selected entity - * @param string $tabspace margin of separation of tree's branches - * @param array $except array of entity_id ( elements of the tree that should not appear ) - */ - - public function getEntityChildrenTreeAdvanced($entities, $parent = '', $tabspace = '', $except = array(), $where = '') - { //var_dump($parent); - //var_dump($where); - /** - lorsqu'on passe la variable trim($parent) dans array, la liste déroulante des entités lors d'un enregistrement d'un courrier n'affiche pas tout - */ - - $db = new Database(); - if (trim($parent) == "") { - $stmt = $db->query('select entity_id, entity_label, short_label from ' - . ENT_ENTITIES - . " where enabled = 'Y' and (parent_entity_id ='' or parent_entity_id is null) " . $where . " order by short_label"); - } else { - $stmt = $db->query('select entity_id, entity_label, short_label from ' - . ENT_ENTITIES . " where enabled = 'Y' and parent_entity_id = '" - . trim($parent) . "' " . $where . " order by short_label"); - } - - //var_dump($stmt->rowCount()); - if ($stmt->rowCount() > 0) { - $espace = $tabspace.' '; - while ($line = $stmt->fetchObject()) { - if (!in_array($line->entity_id, $except)) { - array_push( - $entities, - array( - 'ID' =>$line->entity_id, - 'LABEL' => $espace . functions::xssafe($line->entity_label), - 'SHORT_LABEL' =>$espace . functions::xssafe($line->short_label), - 'KEYWORD' => false, - 'DISABLED' => false, - ) - ); - } else { - array_push( - $entities, - array( - 'ID' =>$line->entity_id, - 'LABEL' => $espace . functions::xssafe($line->entity_label), - 'SHORT_LABEL' =>$espace . functions::xssafe($line->short_label), - 'KEYWORD' => false, - 'DISABLED' => true, - ) - ); - } - $db2 = new entity(); - $db = new Database(); - //var_dump(trim($line->entity_id)); - $stmt2 = $db->query('select entity_id from ' . ENT_ENTITIES - . " where enabled = 'Y' and parent_entity_id = ? " . $where,array(trim($line->entity_id))); - $tmp = array(); - //var_dump($stmt2->rowCount()); - if ($stmt2->rowCount() > 0) { - //var_dump(trim($line->entity_id)); - $tmp = $db2->getEntityChildrenTreeAdvanced($tmp,$line->entity_id, $espace, $except); - $entities = array_merge($entities, $tmp); - } - } - } - return $entities; - } - - - /** - * Gets all entities in an array - * - * @param string $parent the root of the tree - * @param string $selected identifier of the selected entity - * @param string $tabspace margin of separation of tree's branches - * @param array $except array of entity_id ( elements of the tree that should not appear ) - */ - public function getShortEntityTree($entities, $parent = 'all', $tabspace = '', $except = array(), $entity_type = '', $root=true) - { - $tab_entity_type = array(); - $my_tab_entity_type = array(); - $where = ''; - if($entity_type == '') - { - if($_SESSION['user']['UserId'] == 'superadmin') - { - $entity_type = "all"; - } - else - { - $entity_type = $this->get_entity_type_level($_SESSION['user']['primaryentity']['id']); - } - } - $tab_entity_type = $this->load_entities_types_for_user($entity_type); - - foreach($tab_entity_type as $theType) - { - $my_tab_entity_type[] = "'".$theType['id']."'"; - } - - if (count($my_tab_entity_type)>0) - { - $where = " and entity_type in(".join(",", $my_tab_entity_type).")"; - } - - if(is_array($parent)) - { - //print_r($parent); - for ($i=0; $i < count($parent); $i++) - { - $tmp = array(); - if($entity = $this->isEnabledEntity($parent[$i]['ENTITY_ID'])) - { - if ($root) - { - array_push($entities, array('ID' =>$parent[$i]['ENTITY_ID'], 'LABEL' => functions::show_string($parent[$i]['ENTITY_LABEL']),'SHORT_LABEL' => functions::show_string($parent[$i]['SHORT_LABEL']), 'KEYWORD' => false)); - } - - $tmp = $this->getEntityChildrenTree($tmp, $parent[$i]['ENTITY_ID'], $tabspace, $except, $where); - $entities = array_merge($entities, $tmp); - } - } - } - elseif($parent == 'all') - { - $entities = $this->getEntityChildrenTree($entities,'', $tabspace, $except, $where); - } - return $entities; - } - - /** - * Gets all entities in an array - * - * @param string $parent the root of the tree - * @param string $selected identifier of the selected entity - * @param string $tabspace margin of separation of tree's branches - * @param array $except array of entity_id ( elements of the tree that should not appear ) - */ - public function getShortEntityTreeAdvanced($entities, $parent = 'all', $tabspace = '', $except = array(), $entity_type = '', $root=true) - { - $tab_entity_type = array(); - $my_tab_entity_type = array(); - $where = ''; - if ($entity_type == '') { - if ($_SESSION['user']['UserId'] == 'superadmin') { - $entity_type = "all"; - } else { - $entity_type = $this->get_entity_type_level($_SESSION['user']['primaryentity']['id']); - } - } - $tab_entity_type = $this->load_entities_types_for_user($entity_type); - - foreach ($tab_entity_type as $theType) { - $my_tab_entity_type[] = "'".$theType['id']."'"; - } - - if (count($my_tab_entity_type)>0) { - $where = " and entity_type in(" . join(",", $my_tab_entity_type).")"; - } - - if (is_array($parent)) { - //print_r($parent); - for ($i=0;$i<count($parent);$i++) { - $tmp = array(); - if ($entity = $this->isEnabledEntity($parent[$i]['ENTITY_ID'])) { - if ($root) { - array_push( - $entities, - array( - 'ID' =>$parent[$i]['ENTITY_ID'], - 'LABEL' => functions::xssafe($parent[$i]['ENTITY_LABEL']), - 'SHORT_LABEL' => functions::xssafe($parent[$i]['SHORT_LABEL']), - 'KEYWORD' => false, - 'DISABLED' => false, - ) - ); - } - $tmp = $this->getEntityChildrenTreeAdvanced( - $tmp, - $parent[$i]['ENTITY_ID'], - $tabspace, - $except, - $where - ); - $entities = array_merge($entities, $tmp); - } - } - } elseif ($parent == 'all') { - $entities = $this->getEntityChildrenTreeAdvanced( - $entities, - '', - $tabspace, - $except, - $where - ); - } - return $entities; - } - - - /** - * Get array of identifiers of all entity's children of an entity (that are related to a user) - * - * @param string $parent the root of the tree - */ - public function getTabChildrenId($tab_children_id, $parent = '', $where = '', $immediate_children_only = false) - { - //echo "<br>call getTabChildrenId parent : ".$parent."<br>"; - if($immediate_children_only) { - //echo "immediate_children_only<br>"; - } - //static $tab_children_id = array(); - - $db = new Database(); - - $stmt = $db->query('SELECT entity_id FROM '.ENT_ENTITIES." WHERE parent_entity_id = '".trim($parent)."'".$where); - //$this->show(); - if($stmt->rowCount() > 0) - { - while($line = $stmt->fetchObject()) - { - $tab_children_id[] = "'".trim($line->entity_id)."'"; - - if($immediate_children_only == false) - { - $db2 = new entity(); - $db = new Database(); - $stmt2 = $db->query('SELECT entity_id FROM '.ENT_ENTITIES." WHERE parent_entity_id = '".trim($line->entity_id)."'".$where); - /*echo "<br>"; - $db2->show(); - echo "<br>";*/ - if($stmt2->rowCount() > 0) - { - $tab_children_id = $db2->getTabChildrenId($tab_children_id, $line->entity_id, $where); - } - } - } - } - /*echo "<pre>"; - print_r($tab_children_id); - echo "</pre>";*/ - return $tab_children_id; - } - - /** - * Get array of identifiers of all entities that are related to a user - * - * @param string $parent the root of the tree - */ - public function get_all_entities_id_user($parent = 'all') - { - $tab_entity_type = array(); - $my_tab_entity_type = array(); - $tab_all_id = array(); - $where = ''; - - if($_SESSION['user']['UserId'] == 'superadmin') - { - $entity_type = "all"; - } - else - { - $entity_type = $this->get_entity_type_level($_SESSION['user']['primaryentity']['id']); - } - - $tab_entity_type = $this->load_entities_types_for_user($entity_type); - - foreach($tab_entity_type as $theType) - { - $my_tab_entity_type[] = "'".$theType['id']."'"; - } - - if (count($my_tab_entity_type)>0) - { - $where = " and entity_type in(".join(",", $my_tab_entity_type).")"; - } - - if(is_array($parent)) - { - for ($i=0; $i < count($parent); $i++) - { - if($entity = $this->isEnabledEntity($parent[$i]['ENTITY_ID'])) - { - $tab_all_id[] = "'".$entity->entity_id."'"; - $tabChildren = array(); - $tab_all_id = array_merge($tab_all_id, $this->getTabChildrenId($tabChildren, $parent[$i]['ENTITY_ID'], $where)); - } - } - } - elseif($parent == 'all') - { - $tabChildren = array(); - $tab_all_id = $this->getTabChildrenId($tabChildren, '', $where); - } - - return $tab_all_id; - } - - /** - * Get array of identifiers of all entities that are related to a user - * - * @param string $parent the root of the tree - */ - public function get_entities_of_user($user_id,$parent = 'all') - { - $entities = array(); - $db = new Database(); - $stmt = $db->query("select e.entity_id,e.entity_label,e.short_label,e.entity_full_name, ue.primary_entity, ue.user_role from ".ENT_ENTITIES." e, ".ENT_USERS_ENTITIES." ue where ue.entity_id = e.entity_id and ue.user_id = ? order by e.entity_label",array(trim($user_id))); - while($res = $stmt->fetchObject()) - { - array_push($entities, array('ID' => $res->entity_id, 'LABEL' => $res->entity_label, 'SHORT_LABEL' => $res->short_label,'ENTITY_FULL_NAME' => $res->entity_full_name, 'PRIMARY' => $res->entity_label, 'ROLE' => $res->user_role )); - } - return $entities; - } - - /** - * Allows or denies an entity and its children - * - * @param string $id entity identifier - * @param string $mode ban or allow - */ - public function allowbanentity($id, $mode) - { - static $count = 1; - - if($mode == 'ban'){ - $action = 'N'; - $histKey = 'BAN'; - $histLabel = _ENTITY_SUSPENSION; - $hist = 'entityban'; - $msgError = _ENTITY_SUSPENDED; - } - else{ - $action = 'Y'; - $histKey = 'VAL'; - $histLabel = _ENTITY_AUTORIZATION; - $histKeyDetails = 'entityval'; - $msgError = _ENTITY_AUTORIZED; - } - $order = $_REQUEST['order']; - $order_field = $_REQUEST['order_field']; - $start = $_REQUEST['start']; - $what = $_REQUEST['what']; - - $db = new Database(); - $stmt = $db->query('Update '.ENT_ENTITIES." set enabled = ? where entity_id = ?",array(trim($action),trim($id))); - - if($_SESSION['history'][$histKeyDetails] == "true") - { - require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_history.php"); - $hist = new history(); - $hist->add(ENT_ENTITIES, $id, $histKey, 'entityup', $histLabel." : ".$id, $_SESSION['config']['databasetype']); - } - $db = new Database(); - $stmt = $db->query('select entity_id from '.ENT_ENTITIES." where parent_entity_id = ?",array(trim($id))); - - if($stmt->rowCount() > 0) - { - while($line = $stmt->fetchObject()) - { - $db2 = new entity(); - $db = new Database(); - - $stmt2 = $db->query('Update '.ENT_ENTITIES." set enabled = ? where entity_id = ?",array(trim($action),trim($line->entity_id))); - - if($_SESSION['history'][$histKeyDetails] == "true") - { - require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_history.php"); - $hist = new history(); - $hist->add(ENT_ENTITIES, $line->entity_id, $histKey, 'entityup', $histLabel." : ".$line->entity_id, $_SESSION['config']['databasetype']); - } - - $count++; - $db = new Database(); - $stmt2 = $db->query('select entity_id from '.ENT_ENTITIES." where parent_entity_id = ?",array(trim($line->entity_id))); - if($stmt2->rowCount() > 0) - { - $db2->allowbanentity($line->entity_id, $mode); - } - } - } - $_SESSION['error'] = $count.' '.$msgError; - } - - - /** - * Allow, Denied or Delete an entity in the database - * - * @param string $id entity identifier - * @param string $mode allow, ban or del - */ - public function adminentity($id, $mode) - { - $order = $_REQUEST['order']; - $order_field = $_REQUEST['order_field']; - $start = $_REQUEST['start']; - $what = $_REQUEST['what']; - if(!empty($_SESSION['error'])) - { - ?> - <script type="text/javascript">window.top.location.href='<?php echo $_SESSION['config']['businessappurl'].'index.php?page=manage_entities&module=entities&order='.$order."&order_field=".$order_field."&start=".$start."&what=".$what;?>';</script> - <?php - //header('location: '.$_SESSION['config']['businessappurl'].'index.php?page=manage_entities&module=entities&order='.$order."&order_field=".$order_field."&start=".$start."&what=".$what); - exit(); - } - else - { - $db = new Database(); - $stmt = $db->query('select entity_id from '.ENT_ENTITIES." where entity_id = ?",array(trim($id))); - if($stmt->rowCount() == 0) - { - $_SESSION['error'] = _ENTITY.' '._UNKNWON; - //header('location: '.$_SESSION['config']['businessappurl'].'index.php?page=manage_entities&module=entities&order='.$order."&order_field=".$order_field."&start=".$start."&what=".$what); - ?> - <script type="text/javascript">window.top.location.href='<?php echo $_SESSION['config']['businessappurl'].'index.php?page=manage_entities&module=entities&order='.$order."&order_field=".$order_field."&start=".$start."&what=".$what;?>';</script> - <?php - exit; - } - else - { - if($mode == 'allow') - { - $this->allowbanentity($id, $mode); - } - elseif($mode == 'ban') - { - $this->allowbanentity($id, $mode); - } - elseif($mode == 'del' ) - { - if($this->havechild($id)) - { - $_SESSION['error'] = _ENTITY_HAVE_CHILD; - } - elseif($this->isRelated($id)) - { - $_SESSION['error'] = _ENTITY_IS_RELATED; - } - else - { - $stmt = $db->query("delete from ".ENT_ENTITIES." where entity_id = ?",array(trim($id))); - if($_SESSION['history']['entitydel'] == "true") - { - require_once('core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_history.php'); - $hist = new history(); - $hist->add(ENT_ENTITIES, $id,'DEL','entitydel', _ENTITY_DELETION." : ".$this->protect_string_db(trim($id)), $_SESSION['config']['databasetype']); - } - $_SESSION['info'] = $id." "._ENTITY_DELETED; - } - } - //header('location: '.$_SESSION['config']['businessappurl'].'index.php?page=manage_entities&module=entities&order='.$order."&order_field=".$order_field."&start=".$start."&what=".$what); - - ?> - <script type="text/javascript"> - window.top.location.href='<?php echo $_SESSION['config']['businessappurl'].'index.php?page=manage_entities&module=entities&order='.$order."&order_field=".$order_field."&start=".$start."&what=".$what;?>'; - </script> - <?php - exit(); - } - } - } - - /** - * Treats the information returned by the form of formentity() - * - * @param string $mode administrator mode (modification, suspension, authorization, delete) - */ - public function entityinfo($mode) - { - //require_once('core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR..'class_core_tools.php'); - $core = new core_tools(); - if($mode == 'up') - { - if(empty($_REQUEST['id']) || !isset($_REQUEST['id'])) - { - $_SESSION['error'].= _ID_MISSING."<br/>"; - } - else - { - $_SESSION['m_admin']['entity']['entityId'] = functions::wash($_REQUEST['id'], "alphanum", _THE_ID, 'yes', 0, 32); - } - } - - if($mode == 'add') - { - if(empty($_REQUEST['entityId']) || !isset($_REQUEST['entityId'])) - { - $_SESSION['error'].= _ID_MISSING."<br/>"; - } - else - { - $_SESSION['m_admin']['entity']['entityId'] = functions::wash($_REQUEST['entityId'], "alphanum", _THE_ID, 'yes', 0, 32); - } - } - $_SESSION['m_admin']['entity']['mode'] = $mode; - if(isset($_REQUEST['label']) && !empty($_REQUEST['label'])) - { - $_SESSION['m_admin']['entity']['label'] = functions::wash($_REQUEST['label'], "no", _ENTITY_LABEL, 'yes', 0, 255); - } - else - { - $_SESSION['error'].= _LABEL_MISSING."<br/>"; - } - if(isset($_REQUEST['short_label']) && !empty($_REQUEST['short_label'])) - { - $_SESSION['m_admin']['entity']['short_label'] = functions::wash(utf8_decode($_REQUEST['short_label']), "no", _SHORT_LABEL, 'yes', 0, 50); - $_SESSION['m_admin']['entity']['short_label'] = utf8_encode($_SESSION['m_admin']['entity']['short_label']); - } - else - { - $_SESSION['error'].= _SHORT_LABEL_MISSING."<br/>"; - } - $_SESSION['m_admin']['entity']['entity_full_name'] = ''; - if(isset($_REQUEST['entity_full_name']) && !empty($_REQUEST['entity_full_name'])){ - $_SESSION['m_admin']['entity']['entity_full_name'] = functions::wash(utf8_decode($_REQUEST['entity_full_name']), "no", _FULL_NAME, 'yes', 0); - $_SESSION['m_admin']['entity']['entity_full_name'] = utf8_encode($_SESSION['m_admin']['entity']['entity_full_name']); - } - $_SESSION['m_admin']['entity']['adrs1'] = ''; - if(isset($_REQUEST['adrs1']) && !empty($_REQUEST['adrs1'])) - { - $_SESSION['m_admin']['entity']['adrs1'] = functions::wash($_REQUEST['adrs1'], "no", _ENTITY_ADR_1, 'yes', 0, 255); - } - $_SESSION['m_admin']['entity']['adrs2'] = ''; - if(isset($_REQUEST['adrs2']) && !empty($_REQUEST['adrs2'])) - { - $_SESSION['m_admin']['entity']['adrs2'] = functions::wash($_REQUEST['adrs2'], "no", _ENTITY_ADR_2, 'yes', 0, 255); - } - $_SESSION['m_admin']['entity']['adrs3'] = ''; - if(isset($_REQUEST['adrs3']) && !empty($_REQUEST['adrs3'])) - { - $_SESSION['m_admin']['entity']['adrs3'] = functions::wash($_REQUEST['adrs3'], "no", _ENTITY_ADR_3, 'yes', 0, 255); - } - $_SESSION['m_admin']['entity']['zcode'] = ''; - if(isset($_REQUEST['zcode']) && !empty($_REQUEST['zcode'])) - { - $_SESSION['m_admin']['entity']['zcode'] = functions::wash($_REQUEST['zcode'], "no", _ENTITY_ZIPCODE, 'yes', 0, 32); - } - $_SESSION['m_admin']['entity']['city'] = ''; - if(isset($_REQUEST['city']) && !empty($_REQUEST['city'])) - { - $_SESSION['m_admin']['entity']['city'] = functions::wash($_REQUEST['city'], "no", _ENTITY_CITY, 'yes', 0, 255); - } - $_SESSION['m_admin']['entity']['country'] = ''; - if(isset($_REQUEST['country']) && !empty($_REQUEST['country'])) - { - $_SESSION['m_admin']['entity']['country'] = functions::wash($_REQUEST['country'], "no", _ENTITY_COUNTRY, 'yes', 0, 255); - } - $_SESSION['m_admin']['entity']['email'] = ''; - if(isset($_REQUEST['email']) && !empty($_REQUEST['email'])) - { - $_SESSION['m_admin']['entity']['email'] = functions::wash($_REQUEST['email'], "mail", _ENTITY_EMAIL, 'yes', 0, 255); - } - $_SESSION['m_admin']['entity']['archival_agreement'] = ''; - if(isset($_REQUEST['archival_agreement']) && !empty($_REQUEST['archival_agreement'])) - { - $_SESSION['m_admin']['entity']['archival_agreement'] = functions::wash($_REQUEST['archival_agreement'], "no", _ARCHIVAL_AGREEMENT, 'yes', 0, 255); - } - $_SESSION['m_admin']['entity']['archival_agency'] = ''; - if(isset($_REQUEST['archival_agency']) && !empty($_REQUEST['archival_agency'])) - { - $_SESSION['m_admin']['entity']['archival_agency'] = functions::wash($_REQUEST['archival_agency'], "no", _ARCHIVAL_AGENCY, 'yes', 0, 255); - } - $_SESSION['m_admin']['entity']['business'] = ''; - if(isset($_REQUEST['business']) && !empty($_REQUEST['business'])) - { - $_SESSION['m_admin']['entity']['business'] = functions::wash($_REQUEST['business'], "no", _ENTITY_BUSINESS, 'yes', 0, 32); - } - - if(isset($_REQUEST['type']) && !empty($_REQUEST['type'])) - { - $_SESSION['m_admin']['entity']['type'] = functions::wash($_REQUEST['type'], "no", _ENTITY_TYPE, 'yes', 0, 64); - } - else - { - $_SESSION['error'].= _TYPE_MISSING; - } - $_SESSION['service_tag'] = 'entity_check'; - $core->execute_modules_services($_SESSION['modules_services'], 'entity_check', "include"); - $core->execute_app_services($_SESSION['app_services'], 'entity_check', 'include'); - $_SESSION['service_tag'] = ''; - $_SESSION['m_admin']['entity']['parent'] = ''; - if(isset($_REQUEST['parententity']) && !empty($_REQUEST['parententity'])) - { - $_SESSION['m_admin']['entity']['parent'] = $_REQUEST['parententity']; - } - $_SESSION['m_admin']['init'] = false; - - $_SESSION['m_admin']['entity']['order'] = $_REQUEST['order']; - $_SESSION['m_admin']['entity']['order_field'] = $_REQUEST['order_field']; - $_SESSION['m_admin']['entity']['what'] = $_REQUEST['what']; - $_SESSION['m_admin']['entity']['start'] = $_REQUEST['start']; - } - - - /** - * Add ou modify entity in the database - * - * @param string $mode up or add - */ - public function addupentity($mode) - { - //require_once('core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_core_tools.php'); - $core = new core_tools(); - // add ou modify entity in the database - $this->entityinfo($mode); - $order = $_SESSION['m_admin']['entity']['order']; - $order_field = $_SESSION['m_admin']['entity']['order_field']; - $what = $_SESSION['m_admin']['entity']['what']; - $start = $_SESSION['m_admin']['entity']['start']; - if(!empty($_SESSION['error'])) - { - if($mode == 'up') - { - if(!empty($_SESSION['m_admin']['entity']['entityId'] )) - { - header('location: '.$_SESSION['config']['businessappurl'].'index.php?page=entity_up&id='.$_SESSION['m_admin']['entity']['entityId'] .'&module=entities'); - exit(); - } - else - { - header('location: '.$_SESSION['config']['businessappurl'].'index.php?page=manage_entities&module=entities&order='.$order.'&order_field='.$order_field.'&start='.$start.'&what='.$what); - exit(); - } - } - elseif($mode == 'add') - { - header('location: '.$_SESSION['config']['businessappurl'].'index.php?page=entity_add&module=entities'); - exit(); - } - } - else - { - $db = new Database(); - if($mode == 'add') - { - $stmt= $db->query('select entity_id from '.ENT_ENTITIES.' where entity_id = ?',array(trim($_SESSION['m_admin']['entity']['entityId']))); - if($stmt->rowCount() > 0) - { - $_SESSION['error'] = $_SESSION['m_admin']['entity']['entityId'] .' '._ALREADY_EXISTS; - header('location: '.$_SESSION['config']['businessappurl'].'index.php?page=entity_add&module=entities'); - exit(); - } - else - { - $stmt = $db->query('INSERT INTO '.ENT_ENTITIES." (entity_id, entity_label, short_label, adrs_1, adrs_2, adrs_3, zipcode, city, country, email, business_id, parent_entity_id, entity_type, archival_agency, archival_agreement, entity_full_name) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",array($_SESSION['m_admin']['entity']['entityId'],$_SESSION['m_admin']['entity']['label'],$_SESSION['m_admin']['entity']['short_label'],$_SESSION['m_admin']['entity']['adrs1'],$_SESSION['m_admin']['entity']['adrs2'],$_SESSION['m_admin']['entity']['adrs3'],$_SESSION['m_admin']['entity']['zcode'],$_SESSION['m_admin']['entity']['city'],$_SESSION['m_admin']['entity']['country'],$_SESSION['m_admin']['entity']['email'],$_SESSION['m_admin']['entity']['business'],$_SESSION['m_admin']['entity']['parent'],$_SESSION['m_admin']['entity']['type'],$_SESSION['m_admin']['entity']['archival_agency'],$_SESSION['m_admin']['entity']['archival_agreement'],$_SESSION['m_admin']['entity']['entity_full_name'])); - $_SESSION['service_tag'] = 'entity_add_db'; - $core->execute_modules_services($_SESSION['modules_services'], 'entity_add_db', "include"); - $core->execute_app_services($_SESSION['app_services'], 'entity_add_db', 'include'); - $_SESSION['service_tag'] = ''; - - if($_SESSION['history']['entityadd'] == "true") - { - require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_history.php"); - $hist = new history(); - $hist->add(ENT_ENTITIES, $_SESSION['m_admin']['entity']['entityId'] ,"ADD",'entityadd',_ADD_ENTITY." : ".$_SESSION['m_admin']['entity']['entityId'] , $_SESSION['config']['databasetype'], 'entities'); - } - $this->clearentityinfos(); - $_SESSION['info'] = _ENTITY_ADDITION; - unset($_SESSION['m_admin']); - header("location: ".$_SESSION['config']['businessappurl']."index.php?page=manage_entities&module=entities&order=".$order."&order_field=".$order_field."&start=".$start."&what=".$what); - exit(); - } - } - elseif($mode == 'up') - { - $stmt = $db->query('UPDATE '.ENT_ENTITIES." set entity_label = ? , short_label = ? , adrs_1 = ?, adrs_2 = ?, adrs_3 = ?, zipcode = ?, city = ?, country = ?, email = ?, business_id = ?, parent_entity_id = ?, entity_type = ?, archival_agency = ?, archival_agreement = ?, entity_full_name = ? where entity_id = ?",array($_SESSION['m_admin']['entity']['label'], $_SESSION['m_admin']['entity']['short_label'], $_SESSION['m_admin']['entity']['adrs1'], $_SESSION['m_admin']['entity']['adrs2'],$_SESSION['m_admin']['entity']['adrs3'], $_SESSION['m_admin']['entity']['zcode'], $_SESSION['m_admin']['entity']['city'], $_SESSION['m_admin']['entity']['country'], $_SESSION['m_admin']['entity']['email'], $_SESSION['m_admin']['entity']['business'], $_SESSION['m_admin']['entity']['parent'], $_SESSION['m_admin']['entity']['type'], $_SESSION['m_admin']['entity']['archival_agency'], $_SESSION['m_admin']['entity']['archival_agreement'], $_SESSION['m_admin']['entity']['entity_full_name'], $_SESSION['m_admin']['entity']['entityId'])); - $_SESSION['service_tag'] = 'entity_up_db'; - $core->execute_modules_services($_SESSION['modules_services'], 'entity_up_db', "include"); - $core->execute_app_services($_SESSION['app_services'], 'entity_up_db', 'include'); - $_SESSION['service_tag'] = ''; - if($_SESSION['history']['entityup'] == "true") - { - require_once('core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_history.php'); - $hist = new history(); - $hist->add(ENT_ENTITIES, $_SESSION['m_admin']['entity']['entityId'] ,'UP','entityup',_ENTITY_UPDATED.' : '.$_SESSION['m_admin']['entity']['entityId'] , $_SESSION['config']['databasetype'], 'folder'); - } - $this->clearentityinfos(); - $_SESSION['info'] = _ENTITY_MODIFICATION; - unset($_SESSION['m_admin']); - header('location: '.$_SESSION['config']['businessappurl'].'index.php?page=manage_entities&module=entities&order='.$order."&order_field=".$order_field."&start=".$start."&what=".$what); - exit(); - } - } - } - - - /** - * Clean the $_SESSION['m_admin']['entity'] array - */ - protected function clearentityinfos() - { - // clear the users add or modification vars - unset($_SESSION['m_admin']); - } - - /** - * Get array of all entity_type that a user has acces - * - * @param string $level the entity_type's level of the primary entity of a user - */ - public function load_entities_types_for_user($level="all") - { - $entypes = array(); - $type = array(); - foreach($_SESSION['entities_types'] as $type) - { - if ($level == 'root') - { - if($type['level'] == 'node') - { - $entypes[] = $type; - } - } - elseif($level =="node") - { - if($type['level'] == 'none') - { - $entypes[] = $type; - } - } - elseif($level =="all") - { - $entypes[] = $type; - } - } - return $entypes; - } - - /** - * Get the entity_type_level of an entity - * - * @param string $entity_id identifier of the entity - */ - public function get_entity_type_level($entity_id) - { - $type_level = ""; - $found_type_level = false; - - $db = new Database(); - $stmt = $db->query('select entity_id, entity_label, short_label, entity_type from '.ENT_ENTITIES." where entity_id = ?",array(trim($entity_id))); - //$this->show(); - $line = $stmt->fetchObject(); - $entity_type = $line->entity_type; - if(file_exists($_SESSION['config']['corepath'].'custom'.DIRECTORY_SEPARATOR.$_SESSION['custom_override_id'].DIRECTORY_SEPARATOR."modules".DIRECTORY_SEPARATOR."entities".DIRECTORY_SEPARATOR."xml".DIRECTORY_SEPARATOR."typentity.xml")) - { - $path = $_SESSION['config']['corepath'].'custom'.DIRECTORY_SEPARATOR.$_SESSION['custom_override_id'].DIRECTORY_SEPARATOR."modules".DIRECTORY_SEPARATOR."entities".DIRECTORY_SEPARATOR."xml".DIRECTORY_SEPARATOR."typentity.xml"; - } - else - { - $path = "modules".DIRECTORY_SEPARATOR."entities".DIRECTORY_SEPARATOR."xml".DIRECTORY_SEPARATOR."typentity.xml"; - } - - $xmltypeentity = simplexml_load_file($path); - //echo "<br>"; - foreach($xmltypeentity->TYPE as $ENTITYTYPE) - { - if($ENTITYTYPE->id == $entity_type) - { - $type_level = (string) $ENTITYTYPE->typelevel; - $found_type_level = true; - break; - } - } - if ($found_type_level) - { - return $type_level; - } - else - { - return $found_type_level; - } - } - - /** - * Return the parent of an entity - * - * @param string $entity_id identifier of the entity - */ - public function getParentEntityId($entity_id) - { - if(!empty($entity_id)) - { - $db = new Database(); - $stmt = $db->query("select parent_entity_id from ".ENT_ENTITIES." where entity_id = ?",array(trim($entity_id))); - $res = $stmt->fetchObject(); - return $res->parent_entity_id; - } - else - { - return ''; - } - } - - public function getTabSisterEntityId($entity_id) - { - $sisters = array(); - if(!empty($entity_id)) - { - $parent = $this->getParentEntityId($entity_id); - $db = new Database(); - if(!empty($parent)) - { - $stmt = $db->query('select entity_id from '.ENT_ENTITIES." where parent_entity_id = ? and entity_id <> ?",array(trim($parent),trim($entity_id))); - while($res = $stmt->fetchObject()) - { - array_push($sisters, "'".$res->entity_id."'"); - } - } - } - return $sisters; - } - - public function is_user_in_entity($user_id, $entity_id) - { - if($_SESSION['user']['UserId'] == $user_id) - { - for($i=0; $i<count($_SESSION['user']['entities']);$i++) - { - if($_SESSION['user']['entities'][$i]['ENTITY_ID'] == $entity_id) - { - return true; - } - } - return false; - } - else - { - $db = new Database(); - $stmt = $db->query("select entity_id from ".ENT_USERS_ENTITIES." where user_id = ? and entity_id = ?",array(trim($user_id),trim($entity_id))); - if($stmt->rowCount() == 1) - { - return true ; - } - else - { - return false; - } - } - } - - public function get_primary_entity($user_id) - { - if(empty($user_id)) - { - return false; - } - $db = new Database(); - $stmt = $db->query("select ue.entity_id, ue.user_role, e.entity_label, e.short_label from ".ENT_ENTITIES." e, ".ENT_USERS_ENTITIES." ue where ue.user_id = ? and ue.entity_id = e.entity_id and ue.primary_entity = 'Y'",array(trim($user_id))); - $res = $stmt->fetchObject(); - return array( - 'ID' => $res->entity_id, - 'LABEL' => $res->entity_label, - 'SHORT_LABEL' => $res->short_label, - 'ROLE' => $res->user_role - ); - } - - public function increaseListinstanceViewed($docId) { - if(isset($_SESSION['collection_id_choice']) && !empty($_SESSION['collection_id_choice'])) { - $collId = $_SESSION['collection_id_choice']; - } else { - $collId = $_SESSION['collections'][0]['id']; - } - if($docId <> "" && $collId <> "") { - $entities = ''; - for($cptEnt=0;$cptEnt<count($_SESSION['user']['entities']);$cptEnt++) { - $entities .= "'" . $_SESSION['user']['entities'][$cptEnt]['ENTITY_ID'] . "', "; - } - $entities = preg_replace('/, $/', '', $entities); - if($entities == '' && $_SESSION['user']['UserId']== 'superadmin') { - $entities = $this->empty_list(); - } - $db = new Database(); - $stmt = $db->query("select res_id, viewed from ".$_SESSION['tablename']['ent_listinstance']." where coll_id = ? and res_id = ? and item_type = 'user_id' and item_id = ?",array($collId,$docId,$_SESSION['user']['UserId'])); - //$this->show(); - $res = $stmt->fetchObject(); - $cptViewed = 0; - if(isset($res->res_id) && $res->res_id <> "") { - if($res->viewed <> "" && $res->viewed <> 0) { - $cptViewed = $res->viewed + 1; - } else { - $cptViewed = 1; - } - $stmt = $db->query("update ".$_SESSION['tablename']['ent_listinstance']." set viewed = ".$cptViewed." where coll_id = ? and res_id = ? and item_type = 'user_id' and item_id = ?",array($collId,$docId,$_SESSION['user']['UserId'])); - //$this->show(); - } - $db = new Database(); - if(isset($entities) && $entities <> "") { - $stmt = $db->query("select res_id, viewed, item_id from ".$_SESSION['tablename']['ent_listinstance']." where coll_id = ? and res_id = ? and item_type = 'entity_id' and ".$_SESSION['tablename']['ent_listinstance'].".item_id in (?)",array($collId,$docId,$entities)); - //$this->show(); - while($res = $stmt->fetchObject()) { - $cptViewed = 0; - if($res->res_id <> "") { - if($res->viewed <> "" && $res->viewed <> 0) { - $cptViewed = $res->viewed + 1; - } else { - $cptViewed = 1; - } - $stmt = $db->query("update ".$_SESSION['tablename']['ent_listinstance']." set viewed = ? where coll_id = ? and res_id = ? and item_type = 'entity_id' and ".$_SESSION['tablename']['ent_listinstance'].".item_id = ?",array($cptViewed,$collId,$docId,$res->item_id)); - //$db->show(); - } - } - } - } - } - - public function formDeleteEntity($s_id, $label, $entities, $admin) - { - echo '<h1><i class="fa fa-sitemap fa-2x"></i> '._ENTITY_DELETION.'</h1>'; - - $element_found = false; - $haveChild = false; - $tables = array(); - $nb_docs = 0; - $nb_users = 0; - - if($admin->is_module_loaded('templates')) - { - $nb_templates = 0; - } - if($admin->is_module_loaded('basket')) - { - $nb_listmodels = 0; - $nb_listinstances = 0; - $nb_redirect_baskets = 0; - } - if(!empty($s_id)) - { - if($this->havechild($s_id)) - { - $element_found = true; - $haveChild = true; - } - - for($i=0; $i<count($_SESSION['collections']); $i++) - { - // Skip this test if view doesn't have a column named res_id or destination - //if(!$this->test_column($_SESSION['collections'][$i]['view'], 'res_id')) continue; - //if(!$this->test_column($_SESSION['collections'][$i]['view'], 'destination')) continue; - - $db = new Database(); - - $stmt = $db->query("select res_id from ".$_SESSION['collections'][$i]['view']." where destination = ?",array($s_id)); - - //$this->show(); - if($stmt->rowCount() > 0) - { - $element_found = true; - $nb_docs = $nb_docs + $stmt->rowCount(); - array_push($tables, $_SESSION['collections'][$i]['table']); - } - } - $stmt = $db->query("select user_id from ".ENT_USERS_ENTITIES." where entity_id = ?",array($s_id)); - if($stmt->rowCount() > 0) - { - $element_found = true; - $nb_users = $stmt->rowCount(); - } - - if($admin->is_module_loaded('templates')) - { - $stmt = $db->query("select template_id from ".$_SESSION['tablename']['temp_templates_association']." where value_field = ? and what = 'destination'",array($s_id)); - if($stmt->rowCount() > 0) - { - $element_found = true; - $nb_templates = $stmt->rowCount(); - } - } - if($admin->is_module_loaded('basket')) - { - $stmt = $db->query("select system_id from ".$_SESSION['tablename']['ent_groupbasket_redirect']." where entity_id = ?",array($s_id)); - if($stmt->rowCount() > 0) - { - $element_found = true; - $nb_redirect_baskets = $stmt->rowCount(); - } - $stmt = $db->query("select res_id from ".$_SESSION['tablename']['ent_listinstance']." where item_id = ? and item_type = 'entity_id'",array($s_id)); - if($stmt->rowCount() > 0) - { - $element_found = true; - $nb_listinstances = $stmt->rowCount(); - } - } - } - if($element_found) - { - echo "<div class='error' id='main_error'>".$_SESSION['error']."</div>"; - $_SESSION['error'] = ""; - ?> - <br> - <div id="main_error"> - <b><?php - echo _WARNING_MESSAGE_DEL_ENTITY; - ?></b> - </div> - <br> - <form name="entity_del" id="entity_del" method="post" class="forms"> - <input type="hidden" value="<?php functions::xecho($s_id);?>" name="id"> - <h2 class="tit"><?php echo _ENTITY_DELETION." : <i>".$label."</i>";?></h2> - <?php - if($element_found) - { - if($this->havechild($s_id)) - { - echo "<br> - "._ENTITY_HAVE_CHILD; - } - echo "<br> - ".$nb_docs." "._DOC_IN_THE_DEPARTMENT; - echo "<br> - ".$nb_users." "._USERS_LINKED_TO; - - if($admin->is_module_loaded('basket')) - { - echo "<br> - ".$nb_redirect_baskets." "._BASKET_REDIRECTIONS_OCCURS_LINKED_TO; - echo "<br> - ".$nb_listinstances." "._LISTISTANCES_OCCURS_LINKED_TO; - } - if($admin->is_module_loaded('templates')) - { - echo "<br> - ".$nb_templates." "._TEMPLATES_LINKED_TO; - - } - ?> - <br> - <br> - <input type="hidden" value="documents" name="documents"> - <select name="doc_entity_id" id="doc_entity_id"> - <option value=""><?php echo _CHOOSE_REPLACEMENT_DEPARTMENT;?></option> - <?php - for($i=0; $i < count($entities); $i++) - { - ?> - <option value="<?php functions::xecho($entities[$i]['ID']);?>"><?php echo $entities[$i]['LABEL'];?></option> - <?php - } - ?> - </select> - <br/> - <?php - } - ?> - <br/> - <p class="buttons"> - <input type="submit" value="<?php echo _DEL_AND_REAFFECT;?>" name="valid" class="button" onclick="return(confirm('<?php echo _REALLY_DELETE; if(isset($page_name) && $page_name == "users"){ functions::xecho($complete_name);} elseif(isset($admin_id)){ echo " ".$admin_id; }?> ?\n\r\n\r<?php echo _DEFINITIVE_ACTION;?>'));"/> - <input type="button" value="<?php echo _CANCEL;?>" onclick="window.location.href='<?php echo $_SESSION['config']['businessappurl'].'index.php?page=manage_entities&module=entities&order='.$_REQUEST['order']."&order_field=".$_REQUEST['order_field']."&start=".$_REQUEST['start']."&what=".$_REQUEST['what'];?>';"" class="button" /> - </p> - </form> - <?php - } - else - { - $this->adminentity($s_id, 'del'); - } - } -} -?> diff --git a/modules/entities/class/class_manage_listdiff.php b/modules/entities/class/class_manage_listdiff.php deleted file mode 100755 index b1eb4e11c93..00000000000 --- a/modules/entities/class/class_manage_listdiff.php +++ /dev/null @@ -1,48 +0,0 @@ -<?php -/* -* Copyright 2008-2016 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 all the functions to manage diffusion list -* -* @file -* @author Claire Figueras <dev@maarch.org> -* @date $date$ -* @version $Revision$ -* @ingroup entities -*/ - -require_once 'modules/entities/class/class_manage_listdiff_Abstract.php'; - -/** -* @brief Contains all the functions to manage diffusion list -* -* <ul> -* <li>Loads diffusion list from an model linked to an entity</li> -* <li>Updates the listinstance or listmodel table in the database</li> -* <li>Gets a diffusion list for a given resource identifier</li> -*</ul> -* -* @ingroup entities -*/ -class diffusion_list extends diffusion_list_Abstract -{ - // custom -} diff --git a/modules/entities/class/class_manage_listdiff_Abstract.php b/modules/entities/class/class_manage_listdiff_Abstract.php deleted file mode 100755 index 09534cad6bc..00000000000 --- a/modules/entities/class/class_manage_listdiff_Abstract.php +++ /dev/null @@ -1,770 +0,0 @@ -<?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 class_manage_listdiff_Abstract : Contains all the functions to manage diffusion list -* -* @author dev <dev@maarch.org> -* @ingroup entities -*/ -require_once 'modules/entities/entities_tables.php'; -require_once 'core/core_tables.php'; - -abstract class diffusion_list_Abstract extends functions -{ - //************************************************************************** - // LISTINSTANCE - // Management of diffusion lists for documents and folders - //************************************************************************** - // Legacy load_list_db (for custom calls) - public function load_list_db( - $diffList, - $params, - $listType = 'DOC', - $objectType = 'entity_id' - ) { - $collId = trim($params['coll_id']); - $resId = $params['res_id']; - - if (isset($params['user_id']) && !empty($params['user_id'])) { - require_once 'modules/entities/class/class_manage_entities.php'; - $ent = new entity(); - $creatorUser = trim($params['user_id']); - $primary = $ent->get_primary_entity($creatorUser); - $creatorEntity = trim($primary['ID']); - } else { - $creatorUser = ''; - $creatorEntity = ''; - } - - $objectType = trim($objectType); - - if (isset($params['fromQualif']) && $params['fromQualif'] == true) { - $fromQualif = true; - } else { - $fromQualif = false; - } - - $this->save_listinstance( - $diffList, - $objectType, - $collId, - $resId, - $creatorUser, - $creatorEntity, - $fromQualif - ); - } - - public function save_listinstance( - $diffList, - $difflistType = 'entity_id', - $collId, - $resId, - $creatorUser = '', - $creatorEntity = '', - $fromQualif = false - ) { - // Fix : superadmin can edit visa workflow in detail - if ($creatorUser == 'superadmin') { - $creatorEntity = ''; - } - - $oldListInst = $this->get_listinstance($resId, false, $difflistType); - /*echo 'old<br/>'; - var_dump($oldListInst); - echo 'new<br/>'; - var_dump($diffList);*/ - - require_once 'core/class/class_history.php'; - $hist = new history(); - - $roles = $this->list_difflist_roles(); - $db = new Database(); - $stmt = $db->query('SELECT listinstance_id FROM listinstance WHERE res_id = ? and difflist_type = ?', array($resId, $difflistType)); - - $diffUser = false; - $diffCopyUsers = false; - $diffCopyEntities = false; - - foreach ($roles as $role_id => $role_label) { - if ($stmt->rowCount() > 0 && (isset($oldListInst[$role_id]) || isset($diffList[$role_id]))) { - //compare old and new difflist - if (!empty($oldListInst[$role_id]['users'])) { - for ($iOld = 0; $iOld < count($oldListInst[$role_id]['users']); ++$iOld) { - if ($oldListInst[$role_id]['users'][$iOld]['user_id'] != $diffList[$role_id]['users'][$iOld]['user_id']) { - $diffUser = true; - break; - } - } - } - - //USELESS ? - if (!$diffUser && isset($oldListInst[$role_id]['users']) && !empty($oldListInst[$role_id]['users'])) { - if (count($oldListInst[$role_id]['users']) != count($diffList[$role_id]['users'])) { - $diffCopyUsers = true; - } - } - - if (!$diffUser && !$diffCopyEntities && isset($oldListInst[$role_id]['entities']) && !empty($oldListInst[$role_id]['entities'])) { - if (count($oldListInst[$role_id]['entities']) != count($diffList[$role_id]['entities'])) { - $diffCopyEntities = true; - } - for ($iOld = 0; $iOld < count($oldListInst[$role_id]['entities']); ++$iOld) { - foreach ($oldListInst[$role_id]['entities'][$iOld] as $key => $value) { - if ($value != $diffList[$role_id]['entities'][$iOld][$key]) { - $diffCopyEntities = true; - break; - } - } - } - } - - // check add/remove all copy entities - if ((isset($diffList[$role_id]['entities']) && !isset($oldListInst[$role_id]['entities'])) || (!isset($diffList[$role_id]['entities']) && isset($oldListInst[$role_id]['entities']))) { - $diffCopyUsers = true; - } - } - } - - if ($diffUser || $diffCopyUsers || $diffCopyEntities) { - $this->save_listinstance_history($collId, $resId, $difflistType); - } - - //Delete previous listinstance - $stmt = $db->query( - 'DELETE FROM '.ENT_LISTINSTANCE - .' WHERE res_id = ? AND difflist_type = ?', - array($resId, $difflistType) - ); - - $roles = $this->list_difflist_roles(); - foreach ($roles as $role_id => $role_label) { - // Special value 'copy', item_mode = cc - if ($role_id == 'copy') { - $item_mode = 'cc'; - } else { - $item_mode = $role_id; - } - - $cptUsers = 0; - if (!empty($diffList[$role_id]['users']) && is_array($diffList[$role_id]['users'])) { - $cptUsers = count($diffList[$role_id]['users']); - } - for ($i = 0; $i < $cptUsers; ++$i) { - $userFound = false; - $userId = trim($diffList[$role_id]['users'][$i]['user_id']); - $processComment = trim($diffList[$role_id]['users'][$i]['process_comment']); - $processDate = trim($diffList[$role_id]['users'][$i]['process_date']); - $viewed = (int) $diffList[$role_id]['users'][$i]['viewed']; - - $signatory = ($diffList[$role_id]['users'][$i]['signatory'] ? 'true' : 'false'); - $requested_signature = ($diffList[$role_id]['users'][$i]['requested_signature'] ? 'true' : 'false'); - - $cptOldUsers = 0; - if (!empty($oldListInst[$role_id]['users']) && is_array($oldListInst[$role_id]['users'])) { - $cptOldUsers = count($oldListInst[$role_id]['users']); - } - for ($h = 0; $h < $cptOldUsers; ++$h) { - if ($userId == $oldListInst[$role_id]['users'][$h]['user_id']) { - $userFound = true; - break; - } else { - //else - } - } - //Modification du dest_user dans la table res_letterbox - if ($role_id == 'dest') { - $resEntities = \User\models\UserEntityModel::get(['select' => ['entity_id', 'primary_entity'], 'where' => ['user_id = ?'], 'data' => [$userId]]); - $mailDestination = \Resource\models\ResModel::getById(['select' => ['destination'], 'resId' => $resId]); - - $entityFound = false; - $primaryEntity = ''; - foreach ($resEntities as $key => $value) { - if ($mailDestination['destination'] == $value['entity_id']) { - $entityFound = true; - } - if ($value['primary_entity'] == 'Y') { - $primaryEntity = $value['entity_id']; - } - } - if ($entityFound) { - $stmt = $db->query('update res_letterbox set dest_user = ? where res_id = ?', array($userId, $resId)); - } else { - $stmt = $db->query('update res_letterbox set dest_user = ?, destination = ? where res_id = ?', array($userId, $primaryEntity, $resId)); - } - } - - if ($processDate != '') { - $stmt = $db->query( - 'insert into '.ENT_LISTINSTANCE - .' (res_id, sequence, item_id, item_type, item_mode, added_by_user, viewed, difflist_type, process_comment, process_date, signatory, requested_signature) ' - .'values (' - .'?, ?, ' - ."?, " - .'?, ' - ."'user_id' , " - .'?, ' - .'?, ' - .'?, ?, ' - .'?, ' - .'?, ' - .'?, ' - .'?, ' - .'?' - .' )', - array($resId, $i, $userId, $item_mode, $creatorUser, $viewed, $difflistType, $processComment, $processDate, $signatory, $requested_signature) - ); - } else { - $stmt = $db->query( - 'insert into '.ENT_LISTINSTANCE - .' (res_id, sequence, item_id, item_type, item_mode, added_by_user, viewed, difflist_type, process_comment, signatory, requested_signature) ' - .'values (' - .'?, ?, ' - .'?, ' - ."'user_id' , " - .'?, ' - .'?, ' - .'?, ?, ' - .'?, ' - .'?, ' - .'?' - .' )', - array($resId, $i, $userId, $item_mode, $creatorUser, $viewed, $difflistType, $processComment, $signatory, $requested_signature) - ); - } - - if (!$userFound || $fromQualif) { - //History - $listinstance_id = $db->lastInsertId('listinstance_id_seq'); - $hist->add( - ENT_LISTINSTANCE, - $listinstance_id, - 'ADD', - 'diff'.$role_id.'user', - 'Diffusion du document '.$resId.' à '.$userId.' en tant que "'.$role_id.'"', - $_SESSION['config']['databasetype'], - 'entities' - ); - } - } - - //CUSTOM ENTITY ROLES - $cptEntities = 0; - if (!empty($diffList[$role_id]['entities']) && is_array($diffList[$role_id]['entities'])) { - $cptEntities = count($diffList[$role_id]['entities']); - } - for ($j = 0; $j < $cptEntities; ++$j) { - $entityFound = false; - $entityId = trim($diffList[$role_id]['entities'][$j]['entity_id']); - $viewed = (int) $diffList[$role_id]['entities'][$j]['viewed']; - $cptOldEntities = 0; - if (is_array($oldListInst[$role_id]['entities'])) { - $cptOldEntities = count($oldListInst[$role_id]['entities']); - } - for ($g = 0; $g < $cptOldEntities; ++$g) { - if ($entityId == $oldListInst[$role_id]['entities'][$g]['entity_id']) { - $entityFound = true; - break; - } else { - //else - } - } - - $stmt = $db->query( - 'INSERT INTO '.ENT_LISTINSTANCE - .' (res_id, sequence, item_id, item_type, item_mode, added_by_user, viewed, difflist_type) ' - .'VALUES (' - .'?, ?, ' - .'?, ' - ."'entity_id' , " - .'?, ' - .'?, ' - .'?, ?' - .' )', - array($resId, $j, $entityId, $item_mode, $creatorUser, $viewed, $difflistType) - ); - - if (!$entityFound || $fromQualif) { - //History - $listinstance_id = $db->lastInsertId('listinstance_id_seq'); - $hist->add( - ENT_LISTINSTANCE, - $listinstance_id, - 'ADD', - 'diff'.$role_id.'user', - 'Diffusion of document '.$resId.' to '.$entityId.' as '.$role_id, - $_SESSION['config']['databasetype'], - 'entities' - ); - } - } - } - } - - public function save_listinstance_history($coll_id, $res_id, $difflistType) - { - $user = \User\models\UserModel::getByLogin(['select' => ['id'], 'login' => $_SESSION['user']['UserId']]); - - $db = new Database(); - $db->query('INSERT INTO listinstance_history (coll_id, res_id, user_id, updated_date) VALUES (?, ?, ?, current_timestamp)', array('letterbox_coll', $res_id, $user['id'])); - $listinstance_history_id = $db->lastInsertId('listinstance_history_id_seq'); - - $stmt = $db->query('SELECT * FROM listinstance WHERE res_id = ? and difflist_type = ?', array($res_id, $difflistType)); - - while ($resListinstance = $stmt->fetchObject()) { - $stmt2 = $db->query( - 'INSERT INTO listinstance_history_details - (listinstance_history_id, coll_id, res_id, listinstance_type, sequence, item_id, item_type, item_mode, added_by_user, viewed, difflist_type, process_comment) ' - .'VALUES (?,?, ?, ' - ."'DOC', ?, " - .'?, ' - .'? , ' - .'?, ' - .'?, ' - .'?,?, ' - .'?, ' - .'?' - .' )', - array($listinstance_history_id, 'letterbox_coll', $res_id, $resListinstance->sequence, $resListinstance->item_id, $resListinstance->item_type, $resListinstance->item_mode, $resListinstance->added_by_user, $resListinstance->viewed, $resListinstance->difflist_type, $resListinstance->process_comment) - ); - } - } - - /** - * Gets a diffusion list for a given resource identifier. - * - * @param string $resId Resource identifier - * @param string $collId Collection identifier, 'letterbox_coll' by default - * - * @return array $listinstance['dest] : Data of the dest_user - * ['user_id'] : identifier of the dest_user - * ['lastname'] : Lastname of the dest_user - * ['firstname'] : firstname of the dest_user - * ['entity_id'] : entity identifier of the dest_user - * ['entity_label'] : entity label of the dest_user - * ['copy'] : Data of the copies - * ['users'][$i] : Users in copy data - * ['user_id'] : identifier of the user in copy - * ['lastname'] : Lastname of the user in copy - * ['firstname'] : firstname of the user in copy - * ['entity_id'] : entity identifier of the user in copy - * ['entity_label'] : entity label of the user in copy - * ['entities'][$i] : Entities in copy data - * ['entity_id'] : entity identifier of the entity in copy - * ['entity_label'] : entity label of the entity in copy - **/ - public function get_listinstance( - $resId, - $modeCc = false, - $typeList = 'entity_id' - ) { - $db = new Database(); - $roles = $this->list_difflist_roles(); - - $listinstance = array(); - - if (empty($resId)) { - return $listinstance; - } - - // Load header - $query = - 'SELECT distinct res_id, difflist_type' - .' FROM '.ENT_LISTINSTANCE - .' WHERE res_id = ? GROUP BY res_id, difflist_type'; - $stmt = $db->query($query, array($resId)); - - $listinstance = $stmt->fetch(PDO::FETCH_ASSOC); - if ($listinstance['difflist_type'] == '') { - $listinstance['difflist_type'] = 'entity_id'; - } - - // DEST USER - /*if (! $modeCc) { - $stmt = $db->query( - "select l.item_id, u.firstname, u.lastname, e.entity_id, " - . "e.entity_label, l.viewed from " . ENT_LISTINSTANCE . " l, " - . USERS_TABLE . " u, " . ENT_ENTITIES . " e, " - . ENT_USERS_ENTITIES . " ue " - . " where l.item_mode = 'dest' " - . "and l.item_type = 'user_id' and l.sequence = 0 " - . "and l.item_id = u.user_id and u.user_id = ue.user_id " - . "and e.entity_id = ue.entity_id and ue.primary_entity = 'Y' " - . "and l.res_id = " . $resId - ); - - $res = $stmt->fetchObject(); - - $listinstance['dest'] = array( - 'user_id' => $this->show_string($res->item_id), - 'lastname' => $this->show_string($res->lastname), - 'firstname' => $this->show_string($res->firstname), - 'entity_id' => $this->show_string($res->entity_id), - 'entity_label' => $this->show_string($res->entity_label), - 'viewed' => $this->show_string($res->viewed) - ); - }*/ - - // OTHER ROLES USERS - //********************************************************************** - $stmt = $db->query( - 'select l.listinstance_id ,l.item_id, u.firstname, u.lastname, e.entity_id, e.entity_label,' - .' l.viewed, l.item_mode, l.difflist_type, l.process_date, l.process_comment, l.signatory, l.requested_signature from ' - .ENT_LISTINSTANCE.' l, '.USERS_TABLE - .' u, '.ENT_ENTITIES.' e, '.ENT_USERS_ENTITIES - ." ue where l.item_type = 'user_id' and l.item_id = u.user_id " - .' and l.item_id = ue.user_id and ue.user_id=u.user_id ' - ." and e.entity_id = ue.entity_id and l.difflist_type = ? and l.res_id = ? and ue.primary_entity = 'Y' order by l.sequence ", - array($typeList, $resId) - ); - //$this->show(); - while ($res = $stmt->fetchObject()) { - if ($res->item_mode == 'cc') { - $role_id = 'copy'; - } else { - $role_id = $res->item_mode; - } - - if (!isset($listinstance[$role_id]['users'])) { - $listinstance[$role_id]['users'] = []; - } - $listinstance[$role_id]['users'][] = [ - 'listinstance_id' => $res->listinstance_id, - 'user_id' => functions::show_string($res->item_id), - 'lastname' => functions::show_string($res->lastname), - 'firstname' => functions::show_string($res->firstname), - 'entity_id' => functions::show_string($res->entity_id), - 'entity_label' => functions::show_string($res->entity_label), - 'viewed' => functions::show_string($res->viewed), - 'difflist_type' => functions::show_string($res->difflist_type), - 'process_date' => functions::show_string($res->process_date), - 'process_comment' => functions::show_string($res->process_comment), - 'signatory' => (empty($res->signatory) ? false : true), - 'requested_signature' => (empty($res->requested_signature) ? false : true), - ]; - } - - // OTHER ROLES ENTITIES - //********************************************************************** - $stmt = $db->query( - 'select l.item_id, e.entity_label, l.viewed, l.item_mode, l.difflist_type, l.process_date, l.process_comment from '.ENT_LISTINSTANCE - .' l, '.ENT_ENTITIES.' e where l.difflist_type = ? ' - ."and l.item_type = 'entity_id' and l.item_id = e.entity_id " - .'and l.res_id = ? order by l.sequence ', - array($typeList, $resId) - ); - - while ($res = $stmt->fetchObject()) { - if ($res->item_mode == 'cc') { - $role_id = 'copy'; - } else { - $role_id = $res->item_mode; - } - - if (!isset($listinstance[$role_id]['entities'])) { - $listinstance[$role_id]['entities'] = array(); - } - array_push( - $listinstance[$role_id]['entities'], - array( - 'entity_id' => functions::show_string($res->item_id), - 'entity_label' => functions::show_string($res->entity_label), - 'viewed' => functions::show_string($res->viewed), - 'difflist_type' => functions::show_string($res->difflist_type), - 'process_date' => functions::show_string($res->process_date), - 'process_comment' => functions::show_string($res->process_comment), - ) - ); - } - - return $listinstance; - } - - public function set_main_dest( - $dest, - $collId, - $resId, - $listinstanceType = 'DOC', - $itemType = 'user_id', - $viewed - ) { - $db = new Database(); - $stmt = $db->query( - 'select item_id from '.ENT_LISTINSTANCE." where res_id = ? and sequence = 0 and item_type = ? and item_mode = 'dest'", - array($resId, $itemType) - ); - if ($stmt->rowCount() == 1) { - $stmt = $db->query( - 'update '.ENT_LISTINSTANCE." set item_id = ?, viewed = ? where res_id = ? and sequence = 0 and item_type = ? and item_mode = 'dest'", - array($dest, $viewed, $resId, $itemType) - ); - } else { - $stmt = $db->query( - 'insert into '.ENT_LISTINSTANCE.' (res_id, ' - .'item_id, item_type, item_mode, sequence, ' - ."added_by_user, viewed) values (?, ?, ?, ?, 'dest', 0, ?, ?)", - array($resId, $dest, $itemType, $_SESSION['user']['UserId'], $viewed) - ); - } - } - - //************************************************************************** - // DIFFLIST_ROLES - // Administration and management of roles - //************************************************************************** - // Get list of available roles for list models and diffusion lists definition - public function list_difflist_roles() - { - $roles = array(); - - //load roles difflist - if (file_exists( - $_SESSION['config']['corepath'].'custom'.DIRECTORY_SEPARATOR - .$_SESSION['custom_override_id'].DIRECTORY_SEPARATOR.'modules' - .DIRECTORY_SEPARATOR.'entities'.DIRECTORY_SEPARATOR.'xml'.DIRECTORY_SEPARATOR - .'roles.xml' - ) - ) { - $path = $_SESSION['config']['corepath'].'custom'.DIRECTORY_SEPARATOR - .$_SESSION['custom_override_id'].DIRECTORY_SEPARATOR.'modules' - .DIRECTORY_SEPARATOR.'entities'.DIRECTORY_SEPARATOR.'xml'.DIRECTORY_SEPARATOR - .'roles.xml'; - } else { - $path = 'modules'.DIRECTORY_SEPARATOR.'entities' - .DIRECTORY_SEPARATOR.'xml' - .DIRECTORY_SEPARATOR.'roles.xml'; - } - - $xmlroles = simplexml_load_file($path); - - foreach ($xmlroles->ROLES as $value) { - foreach ($value as $role) { - $id = (string) $role->id; - $label = (string) $role->label; - if (!empty($label) && defined($label) && constant($label) != null) { - $label = constant($label); - } - $roles[$id] = $label; - } - } - - return $roles; - } - - public function list_difflist_roles_to_keep($resId, $collId, $objectType, $newDiffList) - { - $roles = array(); - - //load roles difflist - if (file_exists( - $_SESSION['config']['corepath'].'custom'.DIRECTORY_SEPARATOR - .$_SESSION['custom_override_id'].DIRECTORY_SEPARATOR.'modules' - .DIRECTORY_SEPARATOR.'entities'.DIRECTORY_SEPARATOR.'xml'.DIRECTORY_SEPARATOR - .'roles.xml' - ) - ) { - $path = $_SESSION['config']['corepath'].'custom'.DIRECTORY_SEPARATOR - .$_SESSION['custom_override_id'].DIRECTORY_SEPARATOR.'modules' - .DIRECTORY_SEPARATOR.'entities'.DIRECTORY_SEPARATOR.'xml'.DIRECTORY_SEPARATOR - .'roles.xml'; - } else { - $path = 'modules'.DIRECTORY_SEPARATOR.'entities' - .DIRECTORY_SEPARATOR.'xml' - .DIRECTORY_SEPARATOR.'roles.xml'; - } - - $xmlroles = simplexml_load_file($path); - - foreach ($xmlroles->ROLES as $value) { - foreach ($value as $role) { - $id = (string) $role->id; - $keep_string = (string) $role->keep_in_diffusion_list; - $keep = $keep_string === 'true' ? true : false; - $roles[$id] = $keep; - } - } - - $aCurrentDiffList = diffusion_list::get_listinstance($resId, false, $objectType); - if (!empty($aCurrentDiffList)) { - // On regarde les roles a conserver - foreach ($aCurrentDiffList as $roleId => $listDiffItemId) { - if ($roles[$roleId]) { - $aRolesToKeep[$roleId] = $listDiffItemId; - } - } - - if (!empty($aRolesToKeep['dest']['users'][0]['user_id']) && !empty($newDiffList['dest']['users'][0]['user_id'])) { - if ($newDiffList['dest']['users'][0]['user_id'] != $aRolesToKeep['dest']['users'][0]['user_id']) { - // On passe le dest en copie car il ne peut y avoir qu'un dest. - $aRolesToKeep['copy']['users'][] = $aRolesToKeep['dest']['users'][0]; - } - unset($aRolesToKeep['dest']); - } - - // Si c'est parametre, on reinjecte les anciens roles dans la nouvelle liste de diffusion - if (!empty($aRolesToKeep)) { - foreach ($aRolesToKeep as $roleId => $listDiffItemId) { - // On injecte le user s il n'existe pas encore - if (isset($listDiffItemId['users'])) { - if (!isset($newDiffList[$roleId]['users']) && isset($listDiffItemId['users'])) { - $newDiffList[$roleId]['users'] = []; - } - foreach ($listDiffItemId['users'] as $value) { - if (!diffusion_list::in_array_r($value['user_id'], $newDiffList[$roleId]['users'], true)) { - $newDiffList[$roleId]['users'][] = $value; - } - } - } - - // On injecte l entite si elle n'existe pas encore - if (isset($listDiffItemId['entities'])) { - if (!isset($newDiffList[$roleId]['entities']) && isset($listDiffItemId['entities'])) { - $newDiffList[$roleId]['entities'] = []; - } - foreach ($listDiffItemId['entities'] as $value) { - if (!diffusion_list::in_array_r($value['entity_id'], $newDiffList[$roleId]['entities'], true)) { - $newDiffList[$roleId]['entities'][] = $value; - } - } - } - } - } - } - - return $newDiffList; - } - - public function in_array_r($needle, $haystack, $strict = false) - { - foreach ($haystack as $item) { - if (($strict ? $item === $needle : $item == $needle) || (is_array($item) && diffusion_list::in_array_r($needle, $item, $strict))) { - return true; - } - } - - return false; - } - - //************************************************************************** - // DIFFLIST_TYPES - // Administration and management of types of list - //************************************************************************** - // Get list of available list types / labels - public function list_difflist_types() - { - $db = new Database(); - $stmt = $db->query('select * from '.ENT_DIFFLIST_TYPES); - - $types = array(); - - while ($type = $stmt->fetchObject()) { - $types[(string) $type->difflist_type_id] = $type->difflist_type_label; - } - - return $types; - } - - // Get given listmodel type object - public function get_difflist_type( - $difflist_type_id - ) { - $db = new Database(); - $stmt = $db->query( - 'SELECT * FROM '.ENT_DIFFLIST_TYPES - .' WHERE difflist_type_id = ?', - array($difflist_type_id) - ); - - $difflist_type = $stmt->fetchObject(); - - return $difflist_type; - } - - public function get_difflist_type_roles( - $difflist_type - ) { - $roles = array(); - - $db = new Database(); - - $role_ids = explode(' ', $difflist_type->difflist_type_roles); - - for ($i = 0, $l = count($role_ids); - $i < $l; - ++$i - ) { - $role_id = $role_ids[$i]; - $role_label = diffusion_list::get_difflist_type_roles_label($role_id); - $roles[$role_id] = $role_label; - } - - return $roles; - } - - public function get_difflist_type_roles_label( - $role_id - ) { - $roles = diffusion_list::list_difflist_roles(); - - foreach ($roles as $id => $label) { - if ($role_id == $id) { - $role_label = $label; - } - } - - return $role_label; - } - - public function insert_difflist_type( - $difflist_type_id, - $difflist_type_label, - $difflist_type_roles, - $allow_entities - ) { - $db = new Database(); - $stmt = $db->query( - 'insert into '.ENT_DIFFLIST_TYPES - .' (difflist_type_id, difflist_type_label, difflist_type_roles, allow_entities)' - .' values (' - .'?,' - .'?,' - .'?,' - .'?' - .')', - array($difflist_type_id, $difflist_type_label, $difflist_type_roles, $allow_entities) - ); - } - - public function update_difflist_type( - $difflist_type_id, - $difflist_type_label, - $difflist_type_roles, - $allow_entities - ) { - $db = new Database(); - $stmt = $db->query( - 'update '.ENT_DIFFLIST_TYPES - .' set ' - .' difflist_type_label = ?,' - .' difflist_type_roles = ?,' - .' allow_entities = ?' - .' where difflist_type_id = ?', - array($difflist_type_label, $difflist_type_roles, $allow_entities, $difflist_type_id) - ); - } - - public function delete_difflist_type( - $difflist_type_id - ) { - $db = new Database(); - $stmt = $db->query( - 'DELETE FROM '.ENT_DIFFLIST_TYPES - .' WHERE difflist_type_id = ?', - array($difflist_type_id) - ); - } -} diff --git a/modules/entities/class/class_modules_tools.php b/modules/entities/class/class_modules_tools.php deleted file mode 100755 index 5e43b20d6ca..00000000000 --- a/modules/entities/class/class_modules_tools.php +++ /dev/null @@ -1,40 +0,0 @@ -<?php - -/* -* Copyright 2008-2016 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/>. -*/ - -/** -* modules tools Class for entities -* -* Contains all the functions to load modules tables for entities -* -* @package maarch -* @version 1 -* @since 03/2009 -* @license GPL -* @author Cédric Ndoumba <dev@maarch.org> -* @author Claire Figueras <dev@maarch.org> -*/ - -require_once 'modules/entities/class/class_modules_tools_Abstract.php'; - -class entities extends entities_Abstract -{ - // custom -} diff --git a/modules/entities/class/class_modules_tools_Abstract.php b/modules/entities/class/class_modules_tools_Abstract.php deleted file mode 100755 index 1be03dd65de..00000000000 --- a/modules/entities/class/class_modules_tools_Abstract.php +++ /dev/null @@ -1,1002 +0,0 @@ -<?php - -/* -* Copyright 2008-2016 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/>. -*/ - -/** -* modules tools Class for entities -* -* Contains all the functions to load modules tables for entities -* -* @package maarch -* @version 1 -* @since 03/2009 -* @license GPL -* @author Cédric Ndoumba <dev@maarch.org> -* @author Claire Figueras <dev@maarch.org> -*/ -require_once 'modules/entities/entities_tables.php'; -require_once 'core/core_tables.php'; - -abstract class entities_Abstract extends functions -{ - /** - * Build Maarch module tables into sessions vars with a xml configuration - * file - */ - public function build_modules_tables() - { - if (file_exists( - $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR - . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR . 'modules' - . DIRECTORY_SEPARATOR . 'entities'. DIRECTORY_SEPARATOR . 'xml' - . DIRECTORY_SEPARATOR . 'config.xml' - ) - ) { - $path = $_SESSION['config']['corepath'] . 'custom' - . DIRECTORY_SEPARATOR . $_SESSION['custom_override_id'] - . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR - . 'entities' . DIRECTORY_SEPARATOR . 'xml' - . DIRECTORY_SEPARATOR . 'config.xml'; - } else { - $path = 'modules' . DIRECTORY_SEPARATOR . 'entities' - . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR - . 'config.xml'; - } - $xmlconfig = simplexml_load_file($path); - foreach ($xmlconfig->TABLENAME as $tablename) { - $_SESSION['tablename']['ent_entities'] = - (string) $tablename->ent_entities; - $_SESSION['tablename']['ent_users_entities'] = - (string) $tablename->ent_users_entities; - $_SESSION['tablename']['ent_listinstance'] = - (string) $tablename->ent_listinstance; - $_SESSION['tablename']['ent_groupbasket_redirect'] = - (string) $tablename->ent_groupbasket_redirect; - } - - $history = $xmlconfig->HISTORY; - $_SESSION['history']['entityadd'] = (string) $history->entityadd; - $_SESSION['history']['entityup'] = (string) $history->entityup; - $_SESSION['history']['entitydel'] = (string) $history->entitydel; - $_SESSION['history']['entityval'] = (string) $history->entityval; - $_SESSION['history']['entityban'] = (string) $history->entityban; - } - - public function load_module_var_session($userData) - { - $_SESSION['user']['entities'] = array(); - $_SESSION['entities_types'] = array(); - $_SESSION['user']['primaryentity'] = array(); - if (isset($userData['UserId'])) { - $type = 'root'; - $db = new Database(); -// $stmt = $db->query( -// 'SELECT ue.entity_id, ue.user_role, ue.primary_entity, ' -// . 'e.entity_label, e.short_label, e.entity_type FROM ' -// . ENT_USERS_ENTITIES . ' ue, ' . $_SESSION['tablename']['users'] -// . ' u,'. ENT_ENTITIES ." e WHERE ue.user_id = u.user_id and " -// . " ue.entity_id = e.entity_id and e.enabled = 'Y' " -// . " and ue.user_id = ? ", -// array(trim($userData['UserId'])) -// ); - } -// while ($line = $stmt->fetchObject()) { -// array_push( -// $_SESSION['user']['entities'], -// array( -// 'ENTITY_ID' => $line -> entity_id, -// 'ENTITY_LABEL' => $line -> entity_label, -// 'SHORT_LABEL' => $line -> short_label, -// 'ROLE' => $line -> user_role, -// 'ENTITY_TYPE' => $line -> entity_type -// ) -// ); -// -// if ($line->primary_entity == 'Y') { -// $_SESSION['user']['primaryentity']['id'] = $line->entity_id; -// } -// } - if (file_exists( - $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR - . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR . 'modules' - . DIRECTORY_SEPARATOR . 'entities' . DIRECTORY_SEPARATOR . 'xml' - . DIRECTORY_SEPARATOR . 'typentity.xml' - ) - ) { - $path = $_SESSION['config']['corepath'] . 'custom' - . DIRECTORY_SEPARATOR . $_SESSION['custom_override_id'] - . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR - . 'entities' . DIRECTORY_SEPARATOR . 'xml' - . DIRECTORY_SEPARATOR . 'typentity.xml'; - } else { - $path = 'modules' . DIRECTORY_SEPARATOR . 'entities' - . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR - . 'typentity.xml'; - } - - $xmltype = simplexml_load_file($path); - $entypes = array(); - - foreach ($xmltype->TYPE as $type) { - $_SESSION['entities_types'][] = array( - 'id' => (string) $type -> id, - 'label' => (string) $type -> label, - 'level' => (string) $type -> typelevel, - ); - } - // TODO: keep only by_group session array - $core = new core_tools; - if ($core->is_module_loaded('basket')) { - $_SESSION['user']['redirect_groupbasket'] = array(); - $_SESSION['user']['redirect_groupbasket_by_group'] = array(); - if (isset($userData) - && isset($userData['primarygroup']) - && isset($userData['UserId']) - ) { - $arr1 = $this->load_redirect_groupbasket_session( - $userData['primarygroup'], - $userData['UserId'] - ); - $arr1ByGroup = $this->load_redirect_groupbasket_session_by_group( - $userData['primarygroup'], - $userData['UserId'] - ); - $arr2 = $this->load_redirect_groupbasket_session_for_abs( - $userData['UserId'] - ); - $arr2ByGroup = $this->load_redirect_groupbasket_session_for_abs_by_group( - $userData['UserId'] - ); - - $arrSecondary = array(); - $arrSecondaryByGroup = array(); - for ($cptB=0;$cptB<count($_SESSION['user']['baskets']);$cptB++) { - $arrTmp = array(); - $arrTmpByGroup = array(); - if ($_SESSION['user']['baskets'][$cptB]['is_secondary']) { - $arrTmp = $this->load_redirect_groupbasket_secondary_session( - $_SESSION['user']['baskets'][$cptB]['id'], - $_SESSION['user']['baskets'][$cptB]['group_id'], - $userData['UserId'] - ); - } - //echo $_SESSION['user']['baskets'][$cptB]['id'] - // . ' ' . $_SESSION['user']['baskets'][$cptB]['group_id'] . '<br/>'; - $arrTmpByGroup = $this->load_redirect_groupbasket_secondary_session_by_group( - $_SESSION['user']['baskets'][$cptB]['id'], - $_SESSION['user']['baskets'][$cptB]['group_id'], - $userData['UserId'] - ); - if (!empty($arrTmp[$_SESSION['user']['baskets'][$cptB]['id']])) { - $arrSecondary = array_merge($arrSecondary, $arrTmp); - } - if (!empty($arrTmpByGroup[$_SESSION['user']['baskets'][$cptB]['id']])) { - $arrSecondaryByGroup = array_merge_recursive($arrSecondaryByGroup, $arrTmpByGroup); - } - } - if (!empty($arrSecondary)) { - $_SESSION['user']['redirect_groupbasket'] = array_merge( - $arr1, - $arr2, - $arrSecondary - ); - $_SESSION['user']['redirect_groupbasket_by_group'] = array_merge_recursive( - $arr1ByGroup, - $arr2ByGroup, - $arrSecondaryByGroup - ); - } else { - $_SESSION['user']['redirect_groupbasket'] = array_merge( - $arr1, - $arr2 - ); - $_SESSION['user']['redirect_groupbasket_by_group'] = array_merge_recursive( - $arr1ByGroup, - $arr2ByGroup - ); - } - } - //to delete duplicates entries due to array_merge_recursive fonction when digital key in an array - // foreach ($_SESSION['user']['redirect_groupbasket_by_group'] as $aBasketKey => $aBasketContent) { - // foreach ($aBasketContent as $aGroupKey => $aGroupContent) { - // $cptCtrl = 1; - // foreach ($aGroupContent as $aActionKey => $aActionContent) { - // if ($cptCtrl % 2 == 0) { - // unset($_SESSION['user']['redirect_groupbasket_by_group'][$aBasketKey][$aGroupKey][$aActionKey]); - // } - // $cptCtrl++; - // } - // } - // } - } - } - - public function process_where_clause($whereClause, $userId) - { - if (! preg_match('/@/', $whereClause)) { - return $whereClause; - } - $where = $whereClause; - $tmpArr = array(); - // We must create a new object because the object connexion can already - // be used - $db = new Database(); - require_once 'modules' . DIRECTORY_SEPARATOR . 'entities' - . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR - . 'class_manage_entities.php'; - $obj = new entity(); - if (preg_match('/@my_entities/', $where)) { - $entities = ''; - $user = \User\models\UserModel::getByLogin(['login' => $userId, 'select' => ['id']]); - $stmt = $db->query( - "select entity_id from " . ENT_USERS_ENTITIES - . " where user_id = ? ", - array(trim($user['id'])) - ); - while ($res = $stmt->fetchObject()) { - $entities .= "'" . $res->entity_id . "', "; - } - - $entities = preg_replace('/, $/', '', $entities); - - if ($entities == '') { - $entities = $this->empty_list(); - } - $where = str_replace("@my_entities", $entities, $where); - } - if (preg_match('/@all_entities/', $where)) { - $entities = ''; - $stmt = $db->query( - "select entity_id from " . ENT_ENTITIES . " where enabled ='Y'" - ); - while ($res = $stmt->fetchObject()) { - $entities .= "'" . $res->entity_id . "', "; - } - $entities = preg_replace("|, $|", '', $entities); - $where = str_replace("@all_entities", $entities, $where); - } - if (preg_match('/@my_primary_entity/', $where)) { - $primEntity = ''; - if (isset($_SESSION['user']['UserId']) - && $userId == $_SESSION['user']['UserId'] - && isset($_SESSION['user']['primary_entity']['id']) - ) { - $primEntity = "'" . $_SESSION['user']['primary_entity']['id'] - . "'"; - } else { - $user = \User\models\UserModel::getByLogin(['login' => $userId, 'select' => ['id']]); - $stmt = $db->query( - "select entity_id from " . ENT_USERS_ENTITIES - . " where user_id = ? and primary_entity = 'Y'", - array(trim($user['id'])) - ); - //$db->show();$userId - $res = $stmt->fetchObject(); - if (isset($res->entity_id)) { - $primEntity = "'" . $res->entity_id . "'"; - } - } - if ($primEntity == '') { - $primEntity = $this->empty_list(); - } - $where = str_replace("@my_primary_entity", $primEntity, $where); - //echo "<br>".$where."<br>"; - } - - $total = preg_match_all( - "|@entity_type\[('[^\]]*')\]|", - $where, - $tmpArr, - PREG_PATTERN_ORDER - ); - if ($total > 0) { - for ($i = 0; $i < $total; $i ++) { - $tmp = str_replace("'", '', $tmpArr[1][$i]); - $tmp = trim($tmp); - $tmpEntities = array(); - - $db = new Database(); - if (!empty($tmp)) { - $stmt = $db->query('select entity_id from '.ENT_ENTITIES." where entity_type = ?", array(trim($tmp))); - while ($res = $stmt->fetchObject()) { - array_push($tmpEntities, "'".$res->entity_id."'"); - } - } - $entities = ""; - for ($j = 0; $j < count($tmpEntities); $j++) { - $entities .= $tmpEntities[$j].", "; - } - $entities = preg_replace("|, $|", '', $entities); - - if ($entities == '') { - $entities = $this->empty_list(); - } - $where = preg_replace( - "|@entity_type\['[^\]]*'\]|", - $entities, - $where, - 1 - ); - } - } - - $total = preg_match_all( - "|@subentities\[('[^\]]*')\]|", - $where, - $tmpArr, - PREG_PATTERN_ORDER - ); - if ($total > 0) { - //$this->show_array( $tmpArr); - for ($i = 0; $i < $total; $i ++) { - $entitiesArr = array(); - $tmp = str_replace("'", '', $tmpArr[1][$i]); - if (preg_match('/,/', $tmp)) { - $entitiesArr = preg_split('/,/', $tmp); - } else { - array_push($entitiesArr, $tmp); - } - - $children = array(); - for ($j = 0; $j < count($entitiesArr); $j ++) { - $tabChildren = array(); - $arr = $obj->getTabChildrenId( - $tabChildren, - $entitiesArr[$j] - ); - $children = array_merge($children, $arr); - } - $entities = ''; - for ($j = 0; $j < count($children); $j ++) { - //$entities .= "'".$children[$j]."', "; - $entities .= $children[$j] . ", "; - } - $entities = preg_replace("|, $|", '', $entities); - if ($entities == '') { - $entities = $this->empty_list(); - } - $where = preg_replace( - "|@subentities\['[^\]]*'\]|", - $entities, - $where, - 1 - ); - } - } - $total = preg_match_all( - "|@immediate_children\[('[^\]]*')\]|", - $where, - $tmpArr, - PREG_PATTERN_ORDER - ); - if ($total > 0) { - //$this->show_array($tmpArr); - for ($i = 0; $i < $total; $i ++) { - $entitiesArr = array(); - $tmp = str_replace("'", '', $tmpArr[1][$i]); - if (preg_match('/,/', $tmp)) { - $entitiesArr = preg_split('/,/', $tmp); - } else { - array_push($entitiesArr, $tmp); - } - - $children = array(); - for ($j = 0; $j < count($entitiesArr); $j ++) { - $tabChildren = array(); - $arr = $obj->getTabChildrenId( - $tabChildren, - $entitiesArr[$j], - '', - true - ); - $children = array_merge($children, $arr); - } - //print_r($children); - $entities = ''; - for ($j = 0; $j < count($children); $j ++) { - //$entities .= "'".$children[$j]."', "; - $entities .= $children[$j] . ", "; - } - $entities = preg_replace("|, $|", '', $entities); - if ($entities == '') { - $entities = $this->empty_list(); - } - - $where = preg_replace( - "|@immediate_children\['[^\]]*'\]|", - $entities, - $where, - 1 - ); - } - } - - $total = preg_match_all( - "|@sisters_entities\[('[^\]]*')\]|", - $where, - $tmpArr, - PREG_PATTERN_ORDER - ); - if ($total > 0) { - //$this->show_array( $tmpArr); - for ($i = 0; $i < $total; $i ++) { - $tmp = str_replace("'", '', $tmpArr[1][$i]); - $tmp = trim($tmp); - $entities = $obj->getTabSisterEntityId($tmp); - $sisters = ''; - for ($j = 0; $j < count($entities); $j ++) { - $sisters .= $entities[$j].", "; - } - $sisters = preg_replace("|, $|", '', $sisters); - if ($sisters == '') { - $sisters = $this->empty_list(); - } - $where = preg_replace( - "|@sisters_entities\['[^\]]*'\]|", - $sisters, - $where, - 1 - ); - } - } - $total = preg_match_all( - "|@parent_entity\[('[^\]]*')\]|", - $where, - $tmpArr, - PREG_PATTERN_ORDER - ); - if ($total > 0) { - //$this->show_array( $tmpArr); - for ($i = 0; $i < $total; $i ++) { - $tmp = str_replace("'", '', $tmpArr[1][$i]); - $tmp = trim($tmp); - $entity = $obj->getParentEntityId($tmp); - $entity = "'" . $entity . "'"; - if ($entity == '') { - $entity = $this->empty_list(); - } - $where = preg_replace( - "|@parent_entity\['[^\]]*'\]|", - $entity, - $where, - 1 - ); - } - } - - /* CV 1.5 : ancestors up to depth n*/ - $total = preg_match_all( - "|@ancestor_entities\[('[^\]]*')\](?:\[(\d)\])?|", - $where, - $tmpArr, - PREG_PATTERN_ORDER - ); - if ($total > 0) { - //$this->show_array( $tmpArr); - for ($i = 0; $i < $total; $i ++) { - $entity = trim(str_replace("'", '', $tmpArr[1][$i])); - $max_depth = false; - if (isset($tmpArr[2][$i]) && $tmpArr[2][$i] > 0) { - $max_depth = $tmpArr[2][$i]; - } - $ancestors = array(); - while (($entity = $obj->getParentEntityId($entity)) && (!$max_depth || $depth < $max_depth)) { - $ancestors[] = $entity; - $depth++; - } - if (count($ancestors)) { - $entity = "'" . implode("', '", $ancestors) . "'"; - } else { - $entity = $this->empty_list(); - } - if ($userId == 'superadmin') { - $entity = $this->empty_list(); - } - $where = preg_replace( - "|@ancestor_entities\[('[^\]]*')\](?:\[(\d)\])?|", - $entity, - $where, - 1 - ); - } - } - - $where = str_ireplace("DESTINATION in ()", "1=2", $where); - $where = str_ireplace("initiator in ()", "1=2", $where); - return $where; - } - - public function update_redirect_groupbasket_db( - $groupId, - $basketId, - $actionId, - $entities = array(), - $usersEntities = array() - ) { - //$this->show_array($usersEntities); - $db = new Database(); - $stmt = $db->query( - "DELETE FROM " . ENT_GROUPBASKET_REDIRECT - . " where basket_id= ? and group_id = ? and action_id = ?", - array(trim($basketId), trim($groupId), $actionId) - ); - $redirectMode = 'ENTITY'; - for ($i = 0; $i < count($entities); $i ++) { - if ($entities[$i]['KEYWORD'] == true) { - $keyword = $entities[$i]['ID']; - $entityId = ''; - } else { - $keyword = ''; - $entityId = $entities[$i]['ID']; - } - $stmt = $db->query( - "INSERT INTO " . ENT_GROUPBASKET_REDIRECT - . " (group_id, basket_id, action_id, entity_id, keyword," - . " redirect_mode ) values ( ?, ?, ?, ?, ?, ?)", - array(trim($groupId), trim($basketId), $actionId, trim($entityId), trim($keyword), $redirectMode) - ); - } - - $redirectMode = 'USERS'; - for ($i = 0; $i < count($usersEntities); $i ++) { - if ($usersEntities[$i]['KEYWORD'] == true) { - $keyword = $usersEntities[$i]['ID']; - $entityId = ''; - } else { - $keyword = ''; - $entityId = $usersEntities[$i]['ID']; - } - $stmt = $db->query( - "INSERT INTO " . ENT_GROUPBASKET_REDIRECT . " (group_id, " - . "basket_id, action_id, entity_id, keyword, redirect_mode ) " - . "values ( ?, ?, ?, ?, ?, ?)", - array(trim($groupId), trim($basketId), $actionId, trim($entityId), trim($keyword), $redirectMode) - ); - } - } - - public function get_values_redirect_groupbasket_db( - $groupId, - $basketId, - $actionId - ) { - $db = new Database(); - - - - $arr['ENTITY'] = array(); - $stmt = $db->query( - "select entity_id, keyword from " . ENT_GROUPBASKET_REDIRECT - . " where group_id = ? and basket_id = ? and redirect_mode " - . "= 'ENTITY' and action_id = ?", - array($groupId,trim($basketId),$actionId) - ); - - while ($res = $stmt->fetchObject()) { - if ($res->entity_id <> '') { - $stmt2 = $db->query( - "select entity_label from " . ENT_ENTITIES - . " where entity_id = ? ", - array(trim($res->entity_id)) - ); - $line = $stmt2->fetchObject(); - $label = functions::show_string($line->entity_label); - $tab = array( - 'ID' => $res->entity_id, - 'LABEL' => $label, - 'KEYWORD' => false, - ); - array_push($arr['ENTITY'], $tab); - } elseif ($res->keyword <> '') { - for ($i = 0; $i < count( - $_SESSION['m_admin']['redirect_keywords'] - ); $i ++ - ) { - if ($_SESSION['m_admin']['redirect_keywords'][$i]['ID'] == - $res->keyword - ) { - $label = - $_SESSION['m_admin']['redirect_keywords'][$i] - ['LABEL']; - break; - } - } - $tab = array( - 'ID' => $res->keyword, - 'LABEL' => $label, - 'KEYWORD' => true, - ); - array_push($arr['ENTITY'], $tab); - } - } - - $arr['USERS'] = array(); - $stmt = $db->query( - "select entity_id, keyword from " . ENT_GROUPBASKET_REDIRECT - . " where group_id = ? and basket_id = ? and redirect_mode = 'USERS' and action_id = ?", - array(trim($groupId),trim($basketId),$actionId) - ); - - - while ($res = $stmt->fetchObject()) { - if ($res->entity_id <> '') { - $stmt2 = $db->query( - "select entity_label from " . ENT_ENTITIES - . " where entity_id = ?", - array(trim($res->entity_id)) - ); - $line = $stmt2->fetchObject(); - $label = functions::show_string($line->entity_label); - $tab = array( - 'ID' => $res->entity_id, - 'LABEL' => $label, - 'KEYWORD' => false, - ); - array_push($arr['USERS'], $tab); - array_push($arr['USERS'], $tab); - } elseif ($res->keyword <> '') { - for ($i = 0; $i < count( - $_SESSION['m_admin']['redirect_keywords'] - ); $i ++ - ) { - if ($_SESSION['m_admin']['redirect_keywords'][$i]['ID'] == - $res->keyword - ) { - $label = - $_SESSION['m_admin']['redirect_keywords'][$i] - ['LABEL']; - break; - } - } - $tab = array( - 'ID' => $res->keyword, - 'LABEL' => $label, - 'KEYWORD' => true, - ); - array_push($arr['USERS'], $tab); - } - } - return $arr; - } - - public function get_info_entity($entityId) - { - $arr = array(); - $arr['label'] = ''; - $arr['keyword'] = false; - if (empty($entityId)) { - return $arr; - } - for ($i = 0; $i < count($_SESSION['m_admin']['entities']); $i ++) { - if ($_SESSION['m_admin']['entities'][$i]['ID'] == $entityId) { - $arr['label'] = $_SESSION['m_admin']['entities'][$i]['LABEL']; - $arr['keyword'] = - $_SESSION['m_admin']['entities'][$i]['KEYWORD']; - return $arr; - } - } - return $arr; - } - - public function load_redirect_groupbasket_session($primaryGroup, $userId) - { - $arr = array(); - $db = new Database(); - $stmt = $db->query( - 'select distinct basket_id from ' . ENT_GROUPBASKET_REDIRECT - . " where group_id = ?", - array(trim($primaryGroup)) - ); - - - while ($res = $stmt->fetchObject()) { - $basketId = $res->basket_id; - $arr[$basketId] = array(); - - $stmt2 = $db->query( - "select distinct action_id from " . ENT_GROUPBASKET_REDIRECT - . " where group_id = ? and basket_id = ?", - array(trim($primaryGroup),trim($basketId)) - ); - while ($line = $stmt2->fetchObject()) { - $actionId = $line->action_id; - $arr[$basketId][$actionId]['entities'] = ''; - $arr[$basketId][$actionId]['users_entities'] = ''; - $tmpArr = $this->get_redirect_groupbasket( - $primaryGroup, - $basketId, - $userId, - $actionId - ); - $arr[$basketId][$actionId]['entities'] = $tmpArr['entities']; - $arr[$basketId][$actionId]['users_entities'] = $tmpArr['users']; - } - } - return $arr; - } - - public function load_redirect_groupbasket_session_by_group($primaryGroup, $userId) - { - $arr = array(); - $db = new Database(); - $stmt = $db->query( - 'select distinct basket_id from ' . ENT_GROUPBASKET_REDIRECT - . " where group_id = ?", - array(trim($primaryGroup)) - ); - - - while ($res = $stmt->fetchObject()) { - $basketId = $res->basket_id; - $arr[$basketId] = array(); - - $stmt2 = $db->query( - "select distinct action_id from " . ENT_GROUPBASKET_REDIRECT - . " where group_id = ? and basket_id = ?", - array(trim($primaryGroup),trim($basketId)) - ); - while ($line = $stmt2->fetchObject()) { - $actionId = $line->action_id; - $arr[$basketId][$primaryGroup][$actionId]['entities'] = ''; - $arr[$basketId][$primaryGroup][$actionId]['users_entities'] = ''; - $tmpArr = $this->get_redirect_groupbasket( - $primaryGroup, - $basketId, - $userId, - $actionId - ); - $arr[$basketId][$primaryGroup][$actionId]['entities'] = $tmpArr['entities']; - $arr[$basketId][$primaryGroup][$actionId]['users_entities'] = $tmpArr['users']; - } - } - return $arr; - } - - public function load_redirect_groupbasket_secondary_session($basketId, $groupId, $userId) - { - $arr = array(); - $db = new Database(); - - $arr[$basketId] = array(); - - $stmt = $db->query( - "select distinct action_id from " . ENT_GROUPBASKET_REDIRECT - . " where group_id = ? and basket_id = ?", - array(trim($groupId),trim($basketId)) - ); - while ($line = $stmt->fetchObject()) { - $actionId = $line->action_id; - $arr[$basketId][$actionId]['entities'] = ''; - $arr[$basketId][$actionId]['users_entities'] = ''; - $tmpArr = $this->get_redirect_groupbasket( - $groupId, - $basketId, - $userId, - $actionId - ); - $arr[$basketId][$actionId]['entities'] = $tmpArr['entities']; - $arr[$basketId][$actionId]['users_entities'] = $tmpArr['users']; - } - - return $arr; - } - - public function load_redirect_groupbasket_secondary_session_by_group($basketId, $groupId, $userId) - { - $arr = array(); - $db = new Database(); - - $arr[$basketId] = array(); - - $stmt = $db->query( - "select distinct action_id from " . ENT_GROUPBASKET_REDIRECT - . " where group_id = ? and basket_id = ?", - array(trim($groupId),trim($basketId)) - ); - while ($line = $stmt->fetchObject()) { - $actionId = $line->action_id; - $arr[$basketId][$groupId][$actionId]['entities'] = ''; - $arr[$basketId][$groupId][$actionId]['users_entities'] = ''; - $tmpArr = $this->get_redirect_groupbasket( - $groupId, - $basketId, - $userId, - $actionId - ); - $arr[$basketId][$groupId][$actionId]['entities'] = $tmpArr['entities']; - $arr[$basketId][$groupId][$actionId]['users_entities'] = $tmpArr['users']; - } - - return $arr; - } - - public function load_redirect_groupbasket_session_for_abs($userId) - { - $arr = array(); - $db = new Database(); - - if (! isset($_SESSION['user']['baskets'])) { - require_once('modules/basket/class/class_modules_tools.php'); - $bask = new basket(); - $baskAbs = $bask->load_basket_abs($userId); - } else { - $baskAbs = $_SESSION['user']['baskets']; - } - for ($i = 0; $i < count($baskAbs); $i ++) { - if ($baskAbs[$i]['abs_basket']) { - $primaryGroup = $baskAbs[$i]['group_id']; - $tmpBasketId = preg_replace( - '/_' . $baskAbs[$i]['basket_owner'] . '$/', - '', - $baskAbs[$i]['id'] - ); - $stmt = $db->query( - "select distinct action_id from " . ENT_GROUPBASKET_REDIRECT - . " where group_id = ? and basket_id = ?", - array(trim($primaryGroup),trim($tmpBasketId)) - ); - //$db->show(); - while ($line = $stmt->fetchObject()) { - $actionId = $line->action_id; - $arr[$baskAbs[$i]['id']][$actionId]['entities'] = ''; - $arr[$baskAbs[$i]['id']][$actionId]['users_entities'] = ''; - - $tmpArr = $this->get_redirect_groupbasket( - $primaryGroup, - $tmpBasketId, - $baskAbs[$i]['basket_owner'], - $actionId - ); - $arr[$baskAbs[$i]['id']][$actionId]['entities'] = - $tmpArr['entities']; - $arr[$baskAbs[$i]['id']][$actionId]['users_entities'] = - $tmpArr['users']; - } - } - } - return $arr; - } - - public function load_redirect_groupbasket_session_for_abs_by_group($userId) - { - $arr = array(); - $db = new Database(); - - if (! isset($_SESSION['user']['baskets'])) { - require_once('modules/basket/class/class_modules_tools.php'); - $bask = new basket(); - $baskAbs = $bask->load_basket_abs($userId); - } else { - $baskAbs = $_SESSION['user']['baskets']; - } - for ($i = 0; $i < count($baskAbs); $i ++) { - if ($baskAbs[$i]['abs_basket']) { - $primaryGroup = $baskAbs[$i]['group_id']; - $tmpBasketId = preg_replace( - '/_' . $baskAbs[$i]['basket_owner'] . '$/', - '', - $baskAbs[$i]['id'] - ); - $stmt = $db->query( - "select distinct action_id from " . ENT_GROUPBASKET_REDIRECT - . " where group_id = ? and basket_id = ?", - array(trim($primaryGroup),trim($tmpBasketId)) - ); - //$db->show(); - while ($line = $stmt->fetchObject()) { - $actionId = $line->action_id; - $arr[$baskAbs[$i]['id']][$primaryGroup][$actionId]['entities'] = ''; - $arr[$baskAbs[$i]['id']][$primaryGroup][$actionId]['users_entities'] = ''; - - $tmpArr = $this->get_redirect_groupbasket( - $primaryGroup, - $tmpBasketId, - $baskAbs[$i]['basket_owner'], - $actionId - ); - $arr[$baskAbs[$i]['id']][$primaryGroup][$actionId]['entities'] = - $tmpArr['entities']; - $arr[$baskAbs[$i]['id']][$primaryGroup][$actionId]['users_entities'] = - $tmpArr['users']; - } - } - } - return $arr; - } - - - public function get_redirect_groupbasket($groupId, $basketId, $userId, $actionId) - { - $arr = array(); - $db = new Database(); - $stmt = $db->query( - "select entity_id, keyword from " . ENT_GROUPBASKET_REDIRECT - . " where basket_id = ? and group_id = ? and redirect_mode = 'ENTITY' and action_id = ?", - array(trim($basketId),trim($groupId),$actionId) - ); - - $entities = ''; - while ($line = $stmt->fetchObject()) { - if (empty($line->keyword)) { - $entities .= "'" . $line->entity_id . "', "; - } else { - $entities .= $this->translate_entity_keyword($line->keyword) - . ", "; - } - } - - $entities = preg_replace("/, $/", '', $entities); - $entities = $this->process_where_clause($entities, $userId); - $entities = preg_replace("/^,/", '', $entities); - $entities = preg_replace("/^ ,/", '', $entities); - $entities = preg_replace("/, ,/", ',', $entities); - $entities = preg_replace("/, $/", '', $entities); - - $stmt = $db->query( - "select entity_id, keyword from " . ENT_GROUPBASKET_REDIRECT - . " where basket_id = ? and group_id = ? and redirect_mode = 'USERS' and action_id = ?", - array(trim($basketId),trim($groupId),$actionId) - ); - //$db->show(); - $users = ''; - while ($line = $stmt->fetchObject()) { - if (empty($line->keyword)) { - $users .= "'" . $line->entity_id . "', "; - } else { - $users .= $this->translate_entity_keyword($line->keyword) - . ", "; - } - } - - $users = preg_replace("/, $/", '', $users); - $users = $this->process_where_clause($users, $userId); - $users = preg_replace("/^,/", '', $users); - $users = preg_replace("/, ,/", ',', $users); - $users = preg_replace("/, $/", '', $users); - - $arr['entities'] = $entities; - $arr['users'] = $users; - //print_r($arr); - return $arr; - } - - public function translate_entity_keyword($keyword) - { - if ($keyword == 'ALL_ENTITIES') { - return '@all_entities'; - } elseif ($keyword == 'ENTITIES_JUST_BELOW') { - return '@immediate_children[@my_primary_entity]'; - } elseif ($keyword == 'ENTITIES_BELOW') { - return '@subentities[@my_entities]'; - } elseif ($keyword == 'ALL_ENTITIES_BELOW') { - return '@subentities[@my_primary_entity]'; - } elseif ($keyword == 'ENTITIES_JUST_UP') { - return '@parent_entity[@my_primary_entity]'; - } elseif ($keyword == 'MY_ENTITIES') { - return '@my_entities'; - } elseif ($keyword == 'MY_PRIMARY_ENTITY') { - return '@my_primary_entity'; - } elseif ($keyword == 'SAME_LEVEL_ENTITIES') { - return '@sisters_entities[@my_primary_entity]'; - } else { - return ''; - } - } -} diff --git a/modules/entities/class/class_users_entities.php b/modules/entities/class/class_users_entities.php deleted file mode 100755 index 5e3d99c9354..00000000000 --- a/modules/entities/class/class_users_entities.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php - -/* -* Copyright 2008-2016 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/>. -*/ - -/** -* Users_entities class -* -* Contains all the functions to manage entities and users through session variables -* -* @package Maarch Framework 3.0 -* @version 1 -* @since 03/2009 -* @license GPL -* @author C�dric Ndoumba <dev@maarch.org> -*/ - -require_once 'modules/entities/class/class_users_entities_Abstract.php'; - -class users_entities extends users_entities_Abstract -{ - // custom -} diff --git a/modules/entities/class/class_users_entities_Abstract.php b/modules/entities/class/class_users_entities_Abstract.php deleted file mode 100755 index 4193f8658f3..00000000000 --- a/modules/entities/class/class_users_entities_Abstract.php +++ /dev/null @@ -1,318 +0,0 @@ -<?php - -/* -* Copyright 2008-2016 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/>. -*/ - -/** -* Users_entities class -* -* Contains all the functions to manage entities and users through session variables -* -* @package Maarch Framework 3.0 -* @version 1 -* @since 03/2009 -* @license GPL -* @author <dev@maarch.org> -*/ -require("modules/entities/entities_tables.php"); - -abstract class users_entities_Abstract extends functions -{ - - /** - * Loads in the session variables the entities of the user passed in parameter - * - * @param string $user_id user identifier - */ - public function load_entities_session($user_id) - { - $db = new Database(); - $stmt = $db->query("select ue.entity_id, ue.primary_entity, ue.user_role, e.entity_label, e.short_label from ".ENT_USERS_ENTITIES." ue, ".ENT_ENTITIES." e where ue.user_id = ? and ue.entity_id = e.entity_id",array(trim($user_id))); - if($stmt->rowCount() == 0) - { - $_SESSION['m_admin']['entity']['entities'] = array(); - } - else - { - $entitytab = array(); - while($res = $stmt->fetchObject()) - { - array_push($entitytab, array("USER_ID" => $user_id,"ENTITY_ID" => $res->entity_id, "LABEL" => functions::show_string($res->entity_label),"SHORT_LABEL" => functions::show_string($res->short_label), "PRIMARY" => $res->primary_entity, "ROLE" => functions::show_string($res->user_role) )); - } - $_SESSION['m_admin']['entity']['entities'] = $entitytab; - - } - $_SESSION['m_admin']['load_entities'] = false; - } - - - /** - * Put in an array ($tmparray) the identifiers of all children of an entity - * - * @param string $entity_id entity identifier - * @param array $tmparray the array who receive the children - */ - public function getEntityChildren($parent_id) - { - $entities = array(); - $db = new Database(); - $stmt = $db->query('SELECT entity_id, parent_entity_id FROM entities WHERE parent_entity_id = \''.$parent_id.'\' order by entity_id asc', array()); - while($row=$stmt->fetch(PDO::FETCH_ASSOC)){ - $stmt3 = $db->query( - "SELECT count(entity_id) as total FROM entities WHERE parent_entity_id IN ('".$row['entity_id']."')" - ); - $row3 = $stmt3->fetch(PDO::FETCH_ASSOC); - - $entities[] = $row['entity_id']; - - $entities = array_merge($entities,self::getEntityChildren($row['entity_id'])); - } - return $entities ; - } - - - /** - * Form to add or modify users - entities relations - * - * @param string $mode up or add - * @param integer $id user identifier, empty by default - */ - public function formuserentities($mode, $id = "") - { - // the form to add or modify users - $func = new functions(); - - $state = true; - if(empty($_SESSION['error'])) - { - $db = new Database(); - $stmt = $db->query("select count(*) as total from ".ENT_ENTITIES." where enabled ='Y'"); - $nb_total_1 = $stmt->fetchObject(); - $_SESSION['m_admin']['nbentities'] = $nb_total_1->total; - } - if($mode == "up") - { - $_SESSION['m_admin']['mode'] = "up"; - if(empty($_SESSION['error'])) - { - $db = new Database(); - $stmt = $db->query("select * from ".$_SESSION['tablename']['users']." where user_id = ?",array(trim($id))); - - if($stmt->rowCount() == 0) - { - $_SESSION['error'] = _USER.' '._UNKNOWN; - $state = false; - } - else - { - $line = $stmt->fetchObject(); - - $_SESSION['m_admin']['entity']['user_UserId'] = $line->user_id; - $_SESSION['m_admin']['entity']['user_FirstName'] = $this->show_string($line->firstname); - $_SESSION['m_admin']['entity']['user_LastName'] = $this->show_string($line->lastname); - $_SESSION['m_admin']['entity']['user_Phone'] = $line->phone; - $_SESSION['m_admin']['entity']['user_Mail'] = $line->mail; - $_SESSION['m_admin']['entity']['user_Department'] = $this->show_string($line->department); - $_SESSION['m_admin']['entity']['user_Status'] = $line->enabled; - - } - - if (($_SESSION['m_admin']['load_entities'] == true || ! isset($_SESSION['m_admin']['load_entities'] )) && $_SESSION['m_admin']['entity']['user_UserId'] <> "superadmin") - { - $this->load_entities_session($_SESSION['m_admin']['entity']['user_UserId']); - } - } - } - - if($mode == "up") - { - echo '<h1><i class="fa fa-sitemap fa-2x"></i> '._USER_ENTITIES_ADDITION.'</h1>'; - } - - ?> - <div id="inner_content" class="clearfix"> - <div id="add_box" class="block"> - <p> - <?php - if($_SESSION['m_admin']['entity']['user_UserId'] <> "superadmin") - { - ?> - <iframe name="usersEnt" id="usersEnt" class="frameform2" src="<?php echo $_SESSION['config']['businessappurl'].'index.php?display=true&module=entities&page=users_entities_form';?>" frameborder="0"></iframe> - <?php - } - ?> - </p> - </div> - <?php - if($state == false) - { - $_SESSION['error'] = _USER.' '._UNKNOWN; - echo '<div class="error">'.$_SESSION['error'].'</div>'; - } - else - { - ?> - <form name="frmuserent" method="post" action="<?php if($mode == "up") { echo $_SESSION['config']['businessappurl'].'index.php?display=true&module=entities&page=users_entities_up_db'; } ?>" class="forms addforms" > - <p> - <label for="UserId"><?php echo _ID;?> :</label> - <?php if($mode == "up") { functions::xecho($_SESSION['m_admin']['entity']['user_UserId']); } ?> - <input type="hidden" name="id" id="id" value="<?php functions::xecho($id);?>" /> - </p> - - <p> - <label for="LastName"><?php echo _LASTNAME;?> :</label> - <?php functions::xecho($func->show_str($_SESSION['m_admin']['entity']['user_LastName']));?> - </p> - <p> - <label for="FirstName"><?php echo _FIRSTNAME;?> :</label> - <?php functions::xecho($func->show_str($_SESSION['m_admin']['entity']['user_FirstName']));?> - </p> - <p> - <label for="Phone"><?php echo _PHONE_NUMBER;?> :</label> - <?php functions::xecho($_SESSION['m_admin']['entity']['user_Phone']);?> - </p> - <p> - <label for="Mail"><?php echo _MAIL;?> :</label> - <?php functions::xecho($_SESSION['m_admin']['entity']['user_Mail']);?> - </p> - <p class="buttons"> - <input type="submit" name="Submit" value="<?php echo _VALIDATE;?>" class="button"/> - <input type="button" class="button" name="cancel" value="<?php echo _CANCEL;?>" onclick="javascript:window.location.href='<?php echo $_SESSION['config']['businessappurl'];?>index.php?page=users_list&module=entities';"/> - </p> - </form> - </div> - - <?php - } - - } - - - /** - * Updates the database (users_entities table) with the session variables. - * - */ - public function load_db($from_module_entities_page = true) - { - $db = new Database(); - - if(!$from_module_entities_page) - { - $stmt = $db->query("DELETE FROM ".ENT_USERS_ENTITIES ." where user_id = ?",array(trim($_SESSION['m_admin']['users']['user_id']))); - } - else - { - $stmt = $db->query("DELETE FROM ".ENT_USERS_ENTITIES ." where user_id = ?",array(trim($_SESSION['m_admin']['entity']['user_UserId']))); - } - for($i=0; $i < count($_SESSION['m_admin']['entity']['entities'] ); $i++) - { - $tmp_r = $_SESSION['m_admin']['entity']['entities'][$i]['ROLE']; - if(!$from_module_entities_page) - { - $stmt = $db->query("INSERT INTO ".ENT_USERS_ENTITIES." VALUES (?, ?, ?, ?)",array($_SESSION['m_admin']['users']['user_id'],$_SESSION['m_admin']['entity']['entities'][$i]['ENTITY_ID'],$tmp_r,$_SESSION['m_admin']['entity']['entities'][$i]['PRIMARY'])); - } - else - { - $this->query("INSERT INTO ".ENT_USERS_ENTITIES." VALUES (?, ?, ?, ?)",array($_SESSION['m_admin']['entity']['user_UserId'],$_SESSION['m_admin']['entity']['entities'][$i]['ENTITY_ID'],$tmp_r,$_SESSION['m_admin']['entity']['entities'][$i]['PRIMARY'])); - } - } - - } - - - /** - * Add ou modify users_entities in the database - * - * @param string $mode up or add - */ - public function addupusersentities($mode) - { - $primary_set = false; - if(!empty($_SESSION['m_admin']['entity']['entities']) ) - { - for($i=0; $i < count($_SESSION['m_admin']['entity']['entities']); $i++) - { - if($_SESSION['m_admin']['entity']['entities'][$i]['PRIMARY'] == 'Y') - { - $primary_set = true; - break; - } - } - - if ($primary_set == false) - { - $_SESSION['error'] = _NO_PRIMARY_ENTITY; - } - } - - - if(!empty($_SESSION['error'])) - { - if($mode == "up") - { - if(!empty($_SESSION['m_admin']['entity']['user_UserId'])) - { - header("location: ".$_SESSION['config']['businessappurl']."index.php?page=users_entities_up&id=".$_SESSION['m_admin']['entity']['user_UserId']."&module=entities"); - exit(); - } - else - { - header("location: ".$_SESSION['config']['businessappurl']."index.php?page=users_list&module=entities"); - exit(); - } - } - - } - else - { - - if($mode == "up") - { - if($_SESSION['m_admin']['entity']['user_UserId'] <> "superadmin") - { - $this->load_db(); - } - if($_SESSION['history']['usersup'] == "true") - { - $tmp_h = $this->protect_string_db(_USER_UPDATE." : ".$_SESSION['m_admin']['entity']['user_LastName']." ".$_SESSION['m_admin']['entity']['user_FirstName']." (".$_SESSION['m_admin']['entity']['user_UserId'].")"); - require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_history.php"); - $hist = new history(); - $hist->add($_SESSION['tablename']['users'], $_SESSION['m_admin']['entity']['user_UserId'],"UP",'usersup',$tmp_h, $_SESSION['config']['databasetype']); - } - - $this->clearuserinfos(); - - $_SESSION['info'] = _USER_UPDATED; - header("location: ".$_SESSION['config']['businessappurl'].'index.php?page=users_list&module=entities'); - exit(); - } - - } - } - - /** - * Clear the users add or modification vars - */ - protected function clearuserinfos() - { - unset($_SESSION['m_admin']); - } - -} -?> diff --git a/modules/entities/css/module.css b/modules/entities/css/module.css deleted file mode 100755 index 31a01f7e937..00000000000 --- a/modules/entities/css/module.css +++ /dev/null @@ -1,47 +0,0 @@ -#admin_difflist_types{ - background: url(static.php?filename=manage_groupe.gif) no-repeat 2px top; -} - -.entities_list -{ - width: 310px; -} - -#diff_list .listing -{ - width: 800px; -} - -#chooseEntity select, #chooseEntity #role -{ - width: 280px; -} - -#user_entities .tit { - /*color: #F99830;*/ - color: #135F7F; -} -#user_entities{ - border: 0px; - float: right; - margin: 0 10px 0 13px; - height: 350px; - width: 18%; -} - -span.change { - padding-left: 20px; - background: transparent url(static.php?filename=puce_prev.gif) 10px center no-repeat; - color: #135F7F; - padding: 5px 0 5px 20px; - background-position: center left; - background-image: url(static.php?filename=picto_change.gif); - cursor: pointer; -} - -.visaWorkFlowBasket { - width:50%; - text-align:center !important; - background-color:transparent !important; - font-size: 14px; -} diff --git a/modules/entities/difflist_display.php b/modules/entities/difflist_display.php deleted file mode 100755 index 6ad9d52596b..00000000000 --- a/modules/entities/difflist_display.php +++ /dev/null @@ -1,114 +0,0 @@ -<?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 difflist_display -* -* @author dev <dev@maarch.org> -* @ingroup entities -*/ -$contentDiffList = ''; - -$contentDiffList .= '<div id="diff_list_div" style="max-height:490px;overflow:auto;">'; - -$empty = 0; -$nb_roles = 0; -foreach ($roles as $role_id => $role_label) { - ++$nb_role; - if ($category == 'outgoing' && $role_id == 'dest') { - $role_label = _REDACTOR; - } elseif ($category != 'outgoing' && $role_id == 'dest') { - $role_label = _ASSIGNEE; - } - if (($specific_role != $role_id && $specific_role.'_copy' != $role_id && $specific_role.'_info' != $role_id) && isset($specific_role) && $specific_role != '') { - continue; - } - if ((!empty($difflist[$role_id]['users']) && is_array($difflist[$role_id]['users']) && count($difflist[$role_id]['users']) > 0) - || (!empty($difflist[$role_id]['entities']) && is_array($difflist[$role_id]['entities']) && count($difflist[$role_id]['entities']) > 0) - ) { - ++$empty; - $contentDiffList .= '<h3 class="sstit" style="font-size: 1.2em;">'.$role_label.'</h3>'; - - if (!empty($difflist[$role_id]['users']) && count($difflist[$role_id]['users']) > 0) { - $contentDiffList .= '<table id="diffListUser_'.$role_id.'" cellpadding="0" cellspacing="0" border="0" class="listingsmall liste_diff spec" style="width:100%;margin:0;">'; - - $color = ' class="col"'; - - for ($i = 0, $l = count($difflist[$role_id]['users']); $i < $l; ++$i) { - $user = $difflist[$role_id]['users'][$i]; - - if ($color == ' class="col"') { - $color = ' '; - } else { - $color = ' class="col"'; - } - - if (preg_match("/\[DEL\]/", $difflist[$role_id]['users'][$i]['process_comment'])) { - $styleMoved = " style='text-decoration: line-through;opacity:0.5;' "; - $descMoved = $difflist[$role_id]['users'][$i]['process_comment']; - } else { - $styleMoved = ''; - $descMoved = ''; - } - - $contentDiffList .= '<tr id="'.str_replace('.', '_', $user['user_id']).'_'.$role_id.'" '.$color.$styleMoved.' title="'.$descMoved.'">'; - $contentDiffList .= '<td style="width:15%;text-align:center;">'; - $contentDiffList .= '<i class="fa fa-user fa-2x" title="'._USER.'"></i>'; - $contentDiffList .= '</td>'; - $contentDiffList .= '<td style="width:37%;">'.$user['lastname'].' '.$user['firstname'].'</td>'; - $contentDiffList .= '<td style="width:43%;">'.$user['entity_label'].'</td>'; - $contentDiffList .= '<td class="movedest" style="width:5%;">'; - - if (empty($specific_role) && !empty($difflist['dest']['users'][0]) && $role_id != 'dest' && $origin != null && $core->test_service('edit_recipient_outside_process', 'entities', false)) { - $contentDiffList .= '<i class="fa fa-arrow-up" style="cursor:pointer;" title="'._TO_DEST.'" onclick="moveToDest(\''.str_replace('.', '_', $user['user_id']).'\',\''.$role_id.'\',\''.$origin.'\');"></i>'; - } - $contentDiffList .= '</td>'; - - if ($showStatus == true) { - if (!empty($difflist[$role_id]['users'][$i]['process_date'])) { - $contentDiffList .= '<td style="width:5%;"><i class="fa fa-check" aria-hidden="true" style="color:green;"></i></td>'; - } else { - $contentDiffList .= '<td style="width:5%;"><i class="fa fa-hourglass-half" aria-hidden="true"></i></td>'; - } - } - $contentDiffList .= '</tr>'; - } - $contentDiffList .= '</table>'; - } - if (!empty($difflist[$role_id]['entities']) && is_array($difflist[$role_id]['entities']) && count($difflist[$role_id]['entities']) > 0) { - $contentDiffList .= '<table cellpadding="0" cellspacing="0" border="0" class="listingsmall liste_diff spec" style="width:100%;margin:0;">'; - $color = ' class="col"'; - - for ($i = 0, $l = count($difflist[$role_id]['entities']); $i < $l; ++$i) { - $entity = $difflist[$role_id]['entities'][$i]; - if ($color == ' class="col"') { - $color = ''; - } else { - $color = ' class="col"'; - } - - $contentDiffList .= '<tr '.$color.'>'; - $contentDiffList .= '<td style="width:15%;text-align:center;">'; - $contentDiffList .= '<i class="fa fa-sitemap fa-2x" title="'._ENTITY.' '.$role_label.'"></i>'; - $contentDiffList .= '</td>'; - $contentDiffList .= '<td style="width:37%;">'.$entity['entity_id'].'</td>'; - $contentDiffList .= '<td style="width:38%;">'.$entity['entity_label'].'</td>'; - $contentDiffList .= '<td style="width:10%;">'; - $contentDiffList .= '</td>'; - $contentDiffList .= '</tr>'; - } - $contentDiffList .= '</table>'; - } - $contentDiffList .= '<br/>'; - } -} - -if ($empty == $nb_roles) { - $contentDiffList .= '<div style="font-style:italic;text-align:center;color:#ea0000;margin:10px;">'._DIFF_LIST.' '._IS_EMPTY.'</div>'; -} -$contentDiffList .= '</div>'; - -echo $contentDiffList; diff --git a/modules/entities/difflist_history_display.php b/modules/entities/difflist_history_display.php deleted file mode 100755 index 0e2d0782356..00000000000 --- a/modules/entities/difflist_history_display.php +++ /dev/null @@ -1,209 +0,0 @@ -<?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/>. -*/ - -/** -* @brief Displays diffusion list history -* -* @file -* @author <dev@maarch.org> -* @date $date$ -* @version $Revision$ -* @ingroup apps -*/ - -require_once "core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_request.php"; -require_once "core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_security.php"; -require_once "core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_manage_status.php"; -require_once "apps".DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR - ."class".DIRECTORY_SEPARATOR."class_lists.php"; - -$sec = new security(); -$core_tools = new core_tools(); -$request = new request(); -$db = new Database(); -$list = new lists(); - -//Include definition fields -// include_once('apps'.DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR.'definition_mail_categories.php'); - -//Parameters -$urlParameters = ''; - -//Start - - //Templates - $defaultTemplate = 'history_list_diff'; - $selectedTemplate = $list->getTemplate(); - if (empty($selectedTemplate)) { - if (!empty($defaultTemplate)) { - $list->setTemplate($defaultTemplate); - $selectedTemplate = $list->getTemplate(); - } - } - $template_list = array(); - array_push($template_list, 'history_list_diff'); - - //For status icon - $extension_icon = ''; - if ($selectedTemplate <> 'none') { - $extension_icon = "_big"; - } - -/************Construction de la requete*******************/ -//Table or view - $view = "listinstance_history"; - $select = array(); - $select[$view]= array(); - -//Fields - //Documents - array_push($select[$view], "listinstance_history_id", "res_id", "updated_date", 'user_id'); - -//Where clause - $where_tab = array(); - $where_tab[] = "res_id = ?"; - $where_tab[] = "coll_id = ?"; - $arrayPDO = array(); - - if (isset($diffListType)) { - $where_tab[] = "listinstance_history_id IN (SELECT DISTINCT listinstance_history_id from listinstance_history_details where difflist_type = '$diffListType')"; - } - -//From searching comp query - $where_request = implode(' and ', $where_tab); - $arrayPDO = array($s_id,$coll_id); -//Order - $order = $order_field = ''; - $order = $list->getOrder(); - $order_field = $list->getOrderField(); - - if (!empty($order_field) && !empty($order)) { - $orderstr = "order by ".$order_field." ".$order; - } else { - $list->setOrder(); - $list->setOrderField('updated_date'); - $orderstr = "order by updated_date desc"; - } - -//URL extra Parameters - $parameters = ''; - $start = $list->getStart(); - if (!empty($selectedTemplate)) { - $parameters .= '&template='.$selectedTemplate; - } - $parameters .= '&start='.$start; - - -//Query - $tab=$request->PDOselect($select, $where_request, $arrayPDO, $orderstr, $_SESSION['config']['databasetype'], "default", false, "", "", "", $add_security, false, false, $start); - // $request->show(); - -//Result array - for ($i=0;$i<count($tab);$i++) { - for ($j=0;$j<count($tab[$i]);$j++) { - foreach (array_keys($tab[$i][$j]) as $value) { - if ($tab[$i][$j][$value]=="listinstance_history_id") { - $tab[$i][$j]["label"]=_TYPE_ID_HISTORY; - $tab[$i][$j]['value'] = functions::show_string($tab[$i][$j]['value']); - $tab[$i][$j]["size"]="15"; - $tab[$i][$j]["label_align"]="left"; - $tab[$i][$j]["align"]="left"; - $tab[$i][$j]["valign"]="bottom"; - $tab[$i][$j]["show"]=true; - $tab[$i][$j]["value_export"] = $tab[$i][$j]['value']; - $tab[$i][$j]["order"]="listinstance_history_id"; - } - - if ($tab[$i][$j][$value]=="res_id") { - $tab[$i][$j]["label"]=_RES_ID; - $tab[$i][$j]['value'] = functions::show_string($tab[$i][$j]['value']); - $tab[$i][$j]["size"]="15"; - $tab[$i][$j]["label_align"]="left"; - $tab[$i][$j]["align"]="left"; - $tab[$i][$j]["valign"]="bottom"; - $tab[$i][$j]["show"]=true; - $tab[$i][$j]["value_export"] = $tab[$i][$j]['value']; - $tab[$i][$j]["order"]="res_id"; - } - if ($tab[$i][$j][$value]=="user_id") { - $tab[$i][$j]["label"] = _UPDATED_BY_USER; - $tab[$i][$j]['value'] = \User\models\UserModel::getLabelledUserById(['id' => $tab[$i][$j]['value']]); - $tab[$i][$j]["size"]="15"; - $tab[$i][$j]["label_align"]="left"; - $tab[$i][$j]["align"]="left"; - $tab[$i][$j]["valign"]="bottom"; - $tab[$i][$j]["show"]=true; - $tab[$i][$j]["value_export"] = $tab[$i][$j]['value']; - $tab[$i][$j]["order"]="user_id"; - } - - if ($tab[$i][$j][$value]=="updated_date") { - $tab[$i][$j]["label"]=_UPDATED_DATE; - $tab[$i][$j]['value'] = $core_tools->format_date_db($tab[$i][$j]['value']); - $tab[$i][$j]["size"]="15"; - $tab[$i][$j]["label_align"]="left"; - $tab[$i][$j]["align"]="left"; - $tab[$i][$j]["valign"]="bottom"; - $tab[$i][$j]["show"]=true; - $tab[$i][$j]["value_export"] = $tab[$i][$j]['value']; - $tab[$i][$j]["order"]="updated_date"; - } - } - } - } - -if (count($tab) > 0) { - /************Construction de la liste*******************/ - //Clé de la liste - $listKey = 'listinstance_history_id'; - - //Initialiser le tableau de paramètres - $paramsTab = array(); - if (isset($return_mode) && $return_mode) { - $paramsTab['bool_modeReturn'] = true; //Desactivation du mode return (vs echo) - } else { - $paramsTab['bool_modeReturn'] = false; //Desactivation du mode return (vs echo) - } - - $paramsTab['listCss'] = 'listing largerList spec'; //css - $paramsTab['start'] = $start; - $paramsTab['bool_showTemplateDefaultList'] = false; //Default list (no template) - - //Form attributs - //Standalone form - $paramsTab['bool_standaloneForm'] = true; - - //Afficher la liste dans process - if (isset($return_mode) && $return_mode) { - $frm_str .= $list->showList($tab, $paramsTab, $listKey); - } else { - $list->showList($tab, $paramsTab, $listKey); - } -} else { - if (isset($return_mode) && $return_mode) { - $frm_str .= '<br/>'; - $frm_str .= _DIFFLIST_NEVER_MODIFIED; - } else { - echo '<br/>' . _DIFFLIST_NEVER_MODIFIED; - } -} - - // $list->debug(); diff --git a/modules/entities/difflist_visa_history_display.php b/modules/entities/difflist_visa_history_display.php deleted file mode 100755 index 177486cb519..00000000000 --- a/modules/entities/difflist_visa_history_display.php +++ /dev/null @@ -1,208 +0,0 @@ -<?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/>. -*/ - -/** -* @brief Displays diffusion list history -* -* @file -* @author <dev@maarch.org> -* @date $date$ -* @version $Revision$ -* @ingroup apps -*/ - -require_once "core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_request.php"; -require_once "core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_security.php"; -require_once "core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_manage_status.php"; -require_once "apps".DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR - ."class".DIRECTORY_SEPARATOR."class_lists.php"; - -$sec = new security(); -$core_tools = new core_tools(); -$request = new request(); -$list = new lists(); - -//Include definition fields -// include_once('apps'.DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR.'definition_mail_categories.php'); - -//Parameters -$urlParameters = ''; - -//Start - - //Templates - $defaultTemplate = 'history_list_diff'; - $selectedTemplate = $list->getTemplate(); - if (empty($selectedTemplate)) { - if (!empty($defaultTemplate)) { - $list->setTemplate($defaultTemplate); - $selectedTemplate = $list->getTemplate(); - } - } - $template_list = array(); - array_push($template_list, 'history_list_diff'); - - //For status icon - $extension_icon = ''; - if ($selectedTemplate <> 'none') { - $extension_icon = "_big"; - } - -/************Construction de la requete*******************/ -//Table or view - $view = "listinstance_history"; - $select = array(); - $select[$view]= array(); - -//Fields - //Documents - array_push($select[$view], "listinstance_history_id", "res_id", 'user_id', "updated_date"); - -//Where clause - $where_tab = array(); - $where_tab[] = "res_id = ?"; - $where_tab[] = "coll_id = ?"; - $arrayPDO = array(); - - if (isset($diffListType)) { - $where_tab[] = "listinstance_history_id IN (SELECT DISTINCT listinstance_history_id from listinstance_history_details where difflist_type = '$diffListType')"; - } - -//From searching comp query - $where_request = implode(' and ', $where_tab); - $arrayPDO = array($s_id,$coll_id); -//Order - $order = $order_field = ''; - $order = $list->getOrder(); - $order_field = $list->getOrderField(); - - if (!empty($order_field) && !empty($order)) { - $orderstr = "order by ".$order_field." ".$order; - } else { - $list->setOrder(); - $list->setOrderField('updated_date'); - $orderstr = "order by updated_date desc"; - } - -//URL extra Parameters - $parameters = ''; - $start = $list->getStart(); - if (!empty($selectedTemplate)) { - $parameters .= '&template='.$selectedTemplate; - } - - $parameters .= '&start='.$start; - -//Query - $tab=$request->PDOselect($select, $where_request, $arrayPDO, $orderstr, $_SESSION['config']['databasetype'], "default", false, "", "", "", $add_security, false, false, $start); - // $request->show(); - -//Result array - for ($i=0;$i<count($tab);$i++) { - for ($j=0;$j<count($tab[$i]);$j++) { - foreach (array_keys($tab[$i][$j]) as $value) { - if ($tab[$i][$j][$value]=="listinstance_history_id") { - $tab[$i][$j]["label"]=_TYPE_ID_HISTORY; - $tab[$i][$j]['value'] = functions::show_string($tab[$i][$j]['value']); - $tab[$i][$j]["size"]="15"; - $tab[$i][$j]["label_align"]="left"; - $tab[$i][$j]["align"]="left"; - $tab[$i][$j]["valign"]="bottom"; - $tab[$i][$j]["show"]=true; - $tab[$i][$j]["value_export"] = $tab[$i][$j]['value']; - $tab[$i][$j]["order"]="listinstance_history_id"; - } - - if ($tab[$i][$j][$value]=="res_id") { - $tab[$i][$j]["label"]=_RES_ID; - $tab[$i][$j]['value'] = functions::show_string($tab[$i][$j]['value']); - $tab[$i][$j]["size"]="15"; - $tab[$i][$j]["label_align"]="left"; - $tab[$i][$j]["align"]="left"; - $tab[$i][$j]["valign"]="bottom"; - $tab[$i][$j]["show"]=true; - $tab[$i][$j]["value_export"] = $tab[$i][$j]['value']; - $tab[$i][$j]["order"]="res_id"; - } - if ($tab[$i][$j][$value]=="user_id") { - $tab[$i][$j]["label"] = _UPDATED_BY_USER; - $tab[$i][$j]['value'] = \User\models\UserModel::getLabelledUserById(['id' => $tab[$i][$j]['value']]); - $tab[$i][$j]["size"]="15"; - $tab[$i][$j]["label_align"]="left"; - $tab[$i][$j]["align"]="left"; - $tab[$i][$j]["valign"]="bottom"; - $tab[$i][$j]["show"]=true; - $tab[$i][$j]["value_export"] = $tab[$i][$j]['value']; - $tab[$i][$j]["order"]="user_id"; - } - - if ($tab[$i][$j][$value]=="updated_date") { - $tab[$i][$j]["label"]=_UPDATED_DATE; - $tab[$i][$j]['value'] = $core_tools->format_date_db($tab[$i][$j]['value']); - $tab[$i][$j]["size"]="15"; - $tab[$i][$j]["label_align"]="left"; - $tab[$i][$j]["align"]="left"; - $tab[$i][$j]["valign"]="bottom"; - $tab[$i][$j]["show"]=true; - $tab[$i][$j]["value_export"] = $tab[$i][$j]['value']; - $tab[$i][$j]["order"]="updated_date"; - } - } - } - } - -if (count($tab) > 0) { - /************Construction de la liste*******************/ - //Clé de la liste - $listKey = 'listinstance_history_id'; - - //Initialiser le tableau de paramètres - $paramsTab = array(); - if (isset($return_mode) && $return_mode) { - $paramsTab['bool_modeReturn'] = true; //Desactivation du mode return (vs echo) - } else { - $paramsTab['bool_modeReturn'] = false; //Desactivation du mode return (vs echo) - } - - $paramsTab['listCss'] = 'listing largerList spec'; //css - $paramsTab['start'] = $start; - $paramsTab['bool_showTemplateDefaultList'] = false; //Default list (no template) - - //Form attributs - //Standalone form - $paramsTab['bool_standaloneForm'] = true; - - //Afficher la liste dans process - if (isset($return_mode) && $return_mode) { - $frm_str .= $list->showList($tab, $paramsTab, $listKey); - } else { - $list->showList($tab, $paramsTab, $listKey); - } -} else { - if (isset($return_mode) && $return_mode) { - $frm_str .= '<br/>'; - $frm_str .= _DIFFLIST_NEVER_MODIFIED; - } else { - echo '<br/>' . _DIFFLIST_NEVER_MODIFIED; - } -} - - // $list->debug(); diff --git a/modules/entities/entities_list_by_label.php b/modules/entities/entities_list_by_label.php deleted file mode 100755 index e254db48a7c..00000000000 --- a/modules/entities/entities_list_by_label.php +++ /dev/null @@ -1,63 +0,0 @@ -<?php -/** -* File : entities_list_by_label.php -* -* List of entities for autocompletion -* -* @package Maarch Framework 3.0 -* @version 3 -* @since 10/2005 -* @license GPL -* @author Cédric Ndoumba <dev@maarch.org> -*/ - -require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_request.php"); -require_once('modules'.DIRECTORY_SEPARATOR.'entities'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_manage_entities.php'); -require_once("modules/entities/entities_tables.php"); -$ent = new entity(); -$db = new Database(); - -$select = "select entity_label from ".ENT_ENTITIES; -$where = " where (lower(entity_label) like lower(?) "; -$where .= " or lower(short_label) like lower(?) "; -$where .= " or lower(entity_id) like lower(?)) "; - -if($_SESSION['user']['UserId'] != 'superadmin') -{ - $my_tab_entities_id = $ent->get_all_entities_id_user($_SESSION['user']['entities']); - if (count($my_tab_entities_id)>0) - { - $where.= ' and entity_id in ('.join(',', $my_tab_entities_id).')'; - } -} - -$sql = $select.$where." order by entity_id"; - -$stmt = $db->query($sql,array("%".$_REQUEST['what']."%","%".$_REQUEST['what']."%","%".$_REQUEST['what']."%")); - -$entities = array(); -while($line = $stmt->fetchObject()) -{ - array_push($entities, $line->entity_label); -} - -echo "<ul>\n"; -$authViewList = 0; -foreach($entities as $entity) -{ - if($authViewList >= 10) - { - $flagAuthView = true; - } - // if(stripos($entity, $_REQUEST['what']) === 0) - // { - echo "<li>".$entity."</li>\n"; - if(isset($flagAuthView) && $flagAuthView) - { - echo "<li>...</li>\n"; - break; - } - $authViewList++; - // } -} -echo "</ul>"; diff --git a/modules/entities/entities_tables.php b/modules/entities/entities_tables.php deleted file mode 100755 index e0bb50e95dd..00000000000 --- a/modules/entities/entities_tables.php +++ /dev/null @@ -1,46 +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 Entities tables declarations -* -* -* @file -* @author Claire Figueras <dev@maarch.org> -* @date $date$ -* @version $Revision$ -* @ingroup entities -*/ - -if (! defined('ENT_ENTITIES')) { - define('ENT_ENTITIES', 'entities'); -} -if (! defined('ENT_USERS_ENTITIES')) { - define('ENT_USERS_ENTITIES', 'users_entities'); -} -if (! defined('ENT_LISTINSTANCE')) { - define('ENT_LISTINSTANCE', 'listinstance'); -} -if (! defined('ENT_GROUPBASKET_REDIRECT')) { - define('ENT_GROUPBASKET_REDIRECT', 'groupbasket_redirect'); -} -if (! defined('ENT_DIFFLIST_TYPES')) { - define('ENT_DIFFLIST_TYPES', 'difflist_types'); -} diff --git a/modules/entities/entity_add.php b/modules/entities/entity_add.php deleted file mode 100755 index 68e716e2ebb..00000000000 --- a/modules/entities/entity_add.php +++ /dev/null @@ -1,57 +0,0 @@ -<?php - -/* -* Copyright 2008,20015 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/>. -*/ - -/** -* File : entity_add.php -* -* To add an entity -* -* @package Maarch Framework 3.0 -* @version 1 -* @since 03/2009 -* @license GPL -* @author Cédric Ndoumba <dev@maarch.org> -*/ - -$admin = new core_tools(); -$admin->test_admin('manage_entities', 'entities'); - /****************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=entity_add&module=entities'; -$page_label = _ADDITION; -$page_id = "entity_add"; -$admin->manage_location_bar($page_path, $page_label, $page_id, $init, $level); -/***********************************************************/ -require_once('modules'.DIRECTORY_SEPARATOR.'entities'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_manage_entities.php'); - -$ent = new entity(); - -$ent->formentity("add"); -?> diff --git a/modules/entities/entity_add_db.php b/modules/entities/entity_add_db.php deleted file mode 100755 index f65a79e2a7c..00000000000 --- a/modules/entities/entity_add_db.php +++ /dev/null @@ -1,24 +0,0 @@ -<?php -/** -* File : entity_add_db.php -* -* Add entity in database after form -* -* @package Maarch Framework 3.0 -* @version 1 -* @since 03/2009 -* @license GPL -* @author Cédric Ndoumba <dev@maarch.org> -*/ - - -require_once('modules'.DIRECTORY_SEPARATOR.'entities'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_manage_entities.php'); - -$admin = new core_tools(); - -$admin->load_lang(); -$admin->test_admin('manage_entities', 'entities'); -$ent = new entity(); - -$ent->addupentity("add"); -?> diff --git a/modules/entities/entity_allow.php b/modules/entities/entity_allow.php deleted file mode 100755 index d579d795fd9..00000000000 --- a/modules/entities/entity_allow.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php -/** -* File : entity_ban.php -* -* To suspend an entity -* -* @package Maarch Framework 3.0 -* @version 1 -* @since 03/2009 -* @license GPL -* @author Cédric Ndoumba <dev@maarch.org> -*/ - -$core_tools = new core_tools(); -$core_tools->load_lang(); -$admin = new core_tools(); -$admin->test_admin('manage_entities', 'entities'); - -$path = 'modules'.DIRECTORY_SEPARATOR.'entities'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_manage_entities.php'; - -require($path); - -//$func = new functions(); -$db = new Database(); - -if(isset($_GET['id'])) -{ - $s_id = addslashes(functions::wash($_GET['id'], "alphanum", _ENTITY)); -} -else -{ - $s_id = ""; -} - -$ent = new entity(); -$ent->adminentity($s_id,'allow'); -?> diff --git a/modules/entities/entity_ban.php b/modules/entities/entity_ban.php deleted file mode 100755 index ee8c088b459..00000000000 --- a/modules/entities/entity_ban.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php -/** -* File : entity_ban.php -* -* To suspend an entity -* -* @package Maarch Framework 3.0 -* @version 1 -* @since 03/2009 -* @license GPL -* @author Cédric Ndoumba <dev@maarch.org> -*/ - -$core_tools = new core_tools(); - -$core_tools->load_lang(); -$admin = new core_tools(); -$admin->test_admin('manage_entities', 'entities'); - -$path = 'modules'.DIRECTORY_SEPARATOR.'entities'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_manage_entities.php'; - -require($path); - -//$func = new functions(); -$db = new Database(); - -if(isset($_GET['id'])) -{ - $s_id = addslashes(functions::wash($_GET['id'], "alphanum", _ENTITY)); -} -else -{ - $s_id = ""; -} - -$ent = new entity(); -$ent->adminentity($s_id,'ban'); -?> diff --git a/modules/entities/entity_up.php b/modules/entities/entity_up.php deleted file mode 100755 index 644a6f65923..00000000000 --- a/modules/entities/entity_up.php +++ /dev/null @@ -1,68 +0,0 @@ -<?php - -/* -* Copyright 2008,20015 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/>. -*/ - -/** -* File : entity_up.php -* -* To update an entity -* -* @package Maarch Framework 3.0 -* @version 1 -* @since 03/2009 -* @license GPL -* @author Cédric Ndoumba <dev@maarch.org> -*/ - -$admin = new core_tools(); -$admin->test_admin('manage_entities', 'entities'); - /****************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=entity_add&module=entities'; -$page_label = _MODIFICATION; -$page_id = "entity_up"; -$admin->manage_location_bar($page_path, $page_label, $page_id, $init, $level); -/***********************************************************/ - -require_once('modules'.DIRECTORY_SEPARATOR.'entities'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_manage_entities.php'); - -$func = new functions(); -$ent = new entity(); - -if(isset($_GET['id'])) -{ - $id = addslashes($func->wash($_GET['id'], "alphanum", _THE_ID)); -} -else -{ - $id = ""; -} - -$ent->formentity("up",$id); -?> diff --git a/modules/entities/entity_up_db.php b/modules/entities/entity_up_db.php deleted file mode 100755 index 5b6a2e4abd8..00000000000 --- a/modules/entities/entity_up_db.php +++ /dev/null @@ -1,24 +0,0 @@ -<?php - -/** -* File : entity_up_db.php -* -* Modify entity in database after form -* -* @package Maarch Framework 3.0 -* @version 1 -* @since 03/2009 -* @license GPL -* @author Cédric Ndoumba <dev@maarch.org> -*/ - -require_once('modules'.DIRECTORY_SEPARATOR.'entities'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_manage_entities.php'); - -$admin = new core_tools(); - -$admin->load_lang(); -$admin->test_admin('manage_entities', 'entities'); -$ent = new entity(); - -$ent->addupentity("up"); -?> diff --git a/modules/entities/html/admin_difflist_type.html b/modules/entities/html/admin_difflist_type.html deleted file mode 100755 index b1c447b1343..00000000000 --- a/modules/entities/html/admin_difflist_type.html +++ /dev/null @@ -1,47 +0,0 @@ -<br/> -<div class="block"> -<div id="difflist_type" style="width: 460px;margin:auto;"> - <div id="difflist_type_messages" style="color:red;"> - </div> - <form id="difflist_type_form" method="POST" class="forms"> - <input name="mode" id="mode" type="hidden" /> - <p></p> - <p> - <label for="difflist_type_id">_DIFFLIST_TYPE_ID</label> - <input name="difflist_type_id" id="difflist_type_id" type="text" /><span class="red_asterisk"><i class="fa fa-star"> </i></span> - </p> - <p> - <label for="difflist_type_label">_DIFFLIST_TYPE_LABEL</label> - <input name="difflist_type_label" id="difflist_type_label" type="text" /><span class="red_asterisk"><i class="fa fa-star"> </i></span> - </p> - <span> - <label for="difflist_type_roles">_DIFFLIST_TYPE_ROLES</label> - <table> - <tr> - <td> - <select name="all_roles" id="all_roles" size="7" ondblclick='moveclick(document.forms["difflist_type_form"].elements["all_roles"], document.forms["difflist_type_form"].elements["selected_roles"]);' multiple="multiple" > - </select> - </td> - <td> - <input type="button" class="button" value=">>" onclick='Move(document.forms["difflist_type_form"].elements["all_roles"], document.forms["difflist_type_form"].elements["selected_roles"]);' /> - <br/> - <input type="button" class="button" value="<<" onclick='Move(document.forms["difflist_type_form"].elements["selected_roles"], document.forms["difflist_type_form"].elements["all_roles"]);' /> - </td> - <td> - <select name="selected_roles" id="selected_roles" size="7" ondblclick='moveclick(document.forms["difflist_type_form"].elements["selected_roles"], document.forms["difflist_type_form"].elements["all_roles"]);' multiple="multiple" > - </select> - </td> - </tr> - </table> - </span> - <p> - <label for="allow_entities">_ALLOW_ENTITIES</label> - <input name="allow_entities" id="allow_entities" type="checkbox" value="Y" /> - </p> - <p class="buttons" style="text-align:center;"> - <input type="button" value="_SUBMIT" class="button" onclick="validate_difflist_type()" /> - <input type="button" value="_CANCEL" id="cancel" class="button" /> - </p> - </form> -</div> -</div> \ No newline at end of file diff --git a/modules/entities/js/functions.js b/modules/entities/js/functions.js deleted file mode 100755 index 22bed68c3a4..00000000000 --- a/modules/entities/js/functions.js +++ /dev/null @@ -1,217 +0,0 @@ -function change_diff_list( - origin, - display_value_tr, - difflist_div, - difflist_tr, - category, - specific_role, - entity_id_dest -) { - if(category === undefined){ - category = ''; - } - if(specific_role === undefined){ - specific_role = ''; - } - var list_div = difflist_div || 'diff_list_div'; - var list_tr = difflist_tr || 'diff_list_tr'; - var tr_display_val = display_value_tr || 'table-row'; - - new Ajax.Request( - 'index.php?display=true&module=entities&page=load_listinstance', - { - method:'post', - parameters: { - origin : origin, - category : category, - specific_role : specific_role - }, - onSuccess: function(answer){ - eval("response = "+answer.responseText); - if(response.status == 0 ) - { - var diff_list_tr = window.opener.$(list_tr); - var diff_list_div = window.opener.$(list_div); - - if(diff_list_tr != null) - { - diff_list_tr.style.display = tr_display_val; - } - - window.opener.$j('#destination').val(entity_id_dest); - window.opener.$j('#destination').trigger("chosen:updated"); - - if(window.opener.parent.document.getElementById('iframe_tab')){ - diff_list_div.innerHTML = response.div_content_action; - } else if(window.opener.parent.document.getElementById('uniqueDetailsIframe')){ - diff_list_div.innerHTML = response.div_content; - window.opener.$j('#save_list_diff').click(); - } else { - diff_list_div.innerHTML = response.div_content; - } - window.close(); - } - else - { - try{ - $('frm_error').innerHTML = response.error_txt; - } - catch(e){} - } - } - } - ); -} - -function isIdToken(value) -{ - var token = value.match(/[\w_]+/g); - if(!token) - return false; - if(token[0] != value) - return false; - else - return true; - -} - -function validate_difflist_type() { - var main_error = $('main_error'); - main_error.innerHTML = ''; - - var difflist_type_id = $('difflist_type_id').value; - var difflist_type_label = $('difflist_type_label').value; - - var allow_entities = 'N'; - - if($('allow_entities').checked) - allow_entities = 'Y'; - - var difflist_type_roles = ""; - - var selected_roles = $('selected_roles'); - for (var i=0;i<selected_roles.length;i++) { - difflist_type_roles = difflist_type_roles + selected_roles[i].value + " "; - } - - var idValid = isIdToken(difflist_type_id); - if(idValid == false) { - main_error.innerHTML = 'Identifiant invalide (A-Z, a-z, 0-9 et _)'; - return; - } - main_error.innerHTML = ''; - - new Ajax.Request( - 'index.php?module=entities&page=admin_difflist_type_validate&display=true', - { - method: 'post', - parameters: - { - mode : $('mode').value, - difflist_type_id : difflist_type_id, - difflist_type_label : difflist_type_label, - difflist_type_roles : difflist_type_roles, - allow_entities : allow_entities - }, - onSuccess: function(transport) { - var responseText = transport.responseText.replace(new RegExp("(\r|\n)", "g"), ""); - if(responseText) - $('difflist_type_messages').innerHTML += responseText; - else - goTo('index.php?module=entities&page=admin_difflist_types'); - } - } - ); - -} - -function loadToolbarEntities(where) -{ - var path_manage_script = 'index.php?display=true&module=entities&page=load_toolbarEntities'; - $j.ajax({ - url : path_manage_script, - //dataType: "json", - type : 'POST', - data: { - where : where, - }, - beforeSend: function() { - //alert('beforesend'); - $j("#entity_id").html('<option value="">chargement en cours ...</option>'); - $j("#entity_id").trigger("chosen:updated"); - //show loading image in toolbar - }, - success: function(answer){ - eval("response = " + answer); - if(response.status == 0 ) { - $j("#entity_id").html(response.resultContent); - $j("#entity_id").trigger("chosen:updated"); - } - }, - error: function(){ - //alert('erreur'); - } - }); -} - -function moveToDest(user_id,role_id,origin) { - var pos = $j('#'+user_id+'_'+role_id)[0].rowIndex; - - $j('tr[id$=_dest]').after($j('#'+user_id+'_'+role_id)[0]); - - console.log($j('#diffListUser_'+role_id+' tr:eq('+pos+')')); - if ($j('#diffListUser_'+role_id+' tr:eq('+pos+')').length) { - $j('#diffListUser_'+role_id+' tr:eq('+pos+')')[0].before($j('tr[id$=_dest]')[0]); - }else{ - $j('#diffListUser_'+role_id)[0].append($j('tr[id$=_dest]')[0]); - } - - var destUserId = $j('tr[id$=_dest]')[0].id.replace("_dest",""); - - $j('#'+destUserId+'_dest .movedest').append('<i class="fa fa-arrow-up" style="cursor:pointer;" title="" onclick="moveToDest(\''+destUserId+'\',\''+role_id+'\');"></i>'); - - $j('tr[id$=_dest]')[0].id = destUserId+'_'+role_id; - - - $j('#'+user_id+'_'+role_id).removeClass('col'); - $j('#'+user_id+'_'+role_id+' .movedest i').remove(); - - $j('#'+user_id+'_'+role_id).prop('onclick',null).off('click'); - - $j('#'+user_id+'_'+role_id)[0].id = user_id+'_dest'; - - i=0; - $j("#diffListUser_"+role_id+' tr').each(function() { - $j('#'+this.id).removeClass('col'); - - if (i%2) { - $j('#'+this.id).addClass('col'); - } - i++ - }); - - $j.ajax({ - url : 'index.php?display=true&module=entities&page=reloadListDiff', - type : 'POST', - dataType : 'JSON', - data: { - rank: pos, - origin: origin, - role_id: role_id - - }, - success : function(response){ - if (response.status == 0) { - - var userList = response.result; - - } else { - alert('ERROR!'); - } - }, - error : function(error){ - console.log('ERROR!'); - } - - }); -} diff --git a/modules/entities/lang/en.php b/modules/entities/lang/en.php deleted file mode 100755 index 17d2736a1d9..00000000000 --- a/modules/entities/lang/en.php +++ /dev/null @@ -1,571 +0,0 @@ -<?php -/* - * - * Copyright 2008,2009 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/>. - */ - -/*************************** Entites management *****************/ -if (!defined('_ADD_ENTITY')) { - define('_ADD_ENTITY', 'Added department'); -} -if (!defined('_ENTITY_ADDITION')) { - define('_ENTITY_ADDITION', 'Department addition'); -} -if (!defined('_ENTITY_MODIFICATION')) { - define('_ENTITY_MODIFICATION', 'Department modification'); -} -if (!defined('_ENTITY_AUTORIZATION')) { - define('_ENTITY_AUTORIZATION', 'Department authorization'); -} -if (!defined('_ENTITY_SUSPENSION')) { - define('_ENTITY_SUSPENSION', 'Department suspension'); -} -if (!defined('_ENTITY_DELETION')) { - define('_ENTITY_DELETION', 'Department deletion'); -} -if (!defined('_ENTITY_DELETED')) { - define('_ENTITY_DELETED', 'Deleted department'); -} -if (!defined('_ENTITY_UPDATED')) { - define('_ENTITY_UPDATED', ' Modified department'); -} -if (!defined('_ENTITY_AUTORIZED')) { - define('_ENTITY_AUTORIZED', 'Authorized department'); -} -if (!defined('_ENTITY_SUSPENDED')) { - define('_ENTITY_SUSPENDED', 'Suspended department'); -} -if (!defined('_ENTITY')) { - define('_ENTITY', 'Department'); -} -if (!defined('_ENTITIES')) { - define('_ENTITIES', 'Departments'); -} -if (!defined('_ENTITIES_COMMENT')) { - define('_ENTITIES_COMMENT', 'Departments'); -} -if (!defined('_ALL_ENTITIES')) { - define('_ALL_ENTITIES', 'All the departments'); -} -if (!defined('_ENTITIES_LIST')) { - define('_ENTITIES_LIST', 'Departments list'); -} -if (!defined('_MANAGE_ENTITIES')) { - define('_MANAGE_ENTITIES', 'Manage the departments'); -} -if (!defined('_ENTITY_MISSING')) { - define('_ENTITY_MISSING', "This department doesn't exist"); -} -if (!defined('_ENTITY_TREE')) { - define('_ENTITY_TREE', 'Departments tree view'); -} -if (!defined('_ENTITY_TREE_DESC')) { - define('_ENTITY_TREE_DESC', 'See departments tree view'); -} -if (!defined('_ENTITY_HAVE_CHILD')) { - define('_ENTITY_HAVE_CHILD', 'This department owns sub-departments'); -} -if (!defined('_ENTITY_IS_RELATED')) { - define('_ENTITY_IS_RELATED', 'This department is linked to users'); -} -if (!defined('_TYPE')) { - define('_TYPE', 'Type'); -} - -/*************************** Users - Entites management *****************/ -if (!defined('_ENTITY_USER_DESC')) { - define('_ENTITY_USER_DESC', 'Connect departments and users'); -} -if (!defined('_ENTITIES_USERS')) { - define('_ENTITIES_USERS', 'Departments - users relationship'); -} -if (!defined('_ENTITIES_USERS_LIST')) { - define('_ENTITIES_USERS_LIST', 'Users list'); -} -if (!defined('_USER_ENTITIES_TITLE')) { - define('_USER_ENTITIES_TITLE', 'The user belongs to the following departments'); -} -if (!defined('_USER_ENTITIES_ADDITION')) { - define('_USER_ENTITIES_ADDITION', 'User- Departments connections'); -} -if (!defined('_USER_BELONGS_NO_ENTITY')) { - define('_USER_BELONGS_NO_ENTITY', "The user doesn't belong to any department"); -} -if (!defined('_CHOOSE_ONE_ENTITY')) { - define('_CHOOSE_ONE_ENTITY', 'Choose a department at least'); -} -if (!defined('_CHOOSE_ENTITY')) { - define('_CHOOSE_ENTITY', 'Choose a department'); -} -if (!defined('_CHOOSE_PRIMARY_ENTITY')) { - define('_CHOOSE_PRIMARY_ENTITY', 'Choose as primary department'); -} -if (!defined('_PRIMARY_ENTITY')) { - define('_PRIMARY_ENTITY', 'Primary department'); -} -if (!defined('_DELETE_ENTITY')) { - define('_DELETE_ENTITY', 'Delete department(s)'); -} -if (!defined('USER_ADD_ENTITY')) { - define('USER_ADD_ENTITY', 'Add a department'); -} -if (!defined('_ADD_TO_ENTITY')) { - define('_ADD_TO_ENTITY', 'Add to a department'); -} -if (!defined('_NO_ENTITY_SELECTED')) { - define('_NO_ENTITY_SELECTED', 'No selected entity'); -} -if (!defined('_NO_PRIMARY_ENTITY')) { - define('_NO_PRIMARY_ENTITY', 'The primary department is mandatory'); -} -if (!defined('_NO_ENTITIES_DEFINED_FOR_YOU')) { - define('_NO_ENTITIES_DEFINED_FOR_YOU', ' No defined entity for this user'); -} -if (!defined('_LABEL_MISSING')) { - define('_LABEL_MISSING', 'The department name is missing'); -} -if (!defined('_SHORT_LABEL_MISSING')) { - define('_SHORT_LABEL_MISSING', 'The department short name is missing'); -} -if (!defined('_ID_MISSING')) { - define('_ID_MISSING', 'The department ID is missing'); -} -if (!defined('_TYPE_MISSING')) { - define('_TYPE_MISSING', 'The department type is mandatory'); -} -if (!defined('_PARENT_MISSING')) { - define('_PARENT_MISSING', 'The relative department is mandatory'); -} -if (!defined('_ENTITY_UNKNOWN')) { - define('_ENTITY_UNKNOWN', 'Unknown department'); -} - -/*************************** Entites form *****************/ -if (!defined('_ENTITY_LABEL')) { - define('_ENTITY_LABEL', 'Name'); -} -if (!defined('_SHORT_LABEL')) { - define('_SHORT_LABEL', 'Short name'); -} -if (!defined('_ENTITY_FULL_NAME')) { - define('_ENTITY_FULL_NAME', 'Full name'); -} -if (!defined('_ENTITY_ADR_1')) { - define('_ENTITY_ADR_1', 'Address 1'); -} -if (!defined('_ENTITY_ADR_2')) { - define('_ENTITY_ADR_2', 'Address 2'); -} -if (!defined('_ENTITY_ADR_3')) { - define('_ENTITY_ADR_3', 'Address 3'); -} -if (!defined('_ENTITY_ZIPCODE')) { - define('_ENTITY_ZIPCODE', 'Postal code'); -} -if (!defined('_ENTITY_CITY')) { - define('_ENTITY_CITY', 'City'); -} -if (!defined('_ENTITY_COUNTRY')) { - define('_ENTITY_COUNTRY', ' Country'); -} -if (!defined('_ENTITY_EMAIL')) { - define('_ENTITY_EMAIL', 'E-mail'); -} -if (!defined('_ENTITY_BUSINESS')) { - define('_ENTITY_BUSINESS', 'SIRET Number'); -} -if (!defined('_ENTITY_PARENT')) { - define('_ENTITY_PARENT', 'Relative department'); -} -if (!defined('_CHOOSE_ENTITY_PARENT')) { - define('_CHOOSE_ENTITY_PARENT', 'Choose the relative department'); -} -if (!defined('_CHOOSE_FILTER_ENTITY')) { - define('_CHOOSE_FILTER_ENTITY', 'Filter by department'); -} -if (!defined('_CHOOSE_ENTITY_TYPE')) { - define('_CHOOSE_ENTITY_TYPE', 'Choose the department type'); -} -if (!defined('_ENTITY_TYPE')) { - define('_ENTITY_TYPE', 'Department type'); -} -if (!defined('_TO_USERS_OF_ENTITIES')) { - define('_TO_USERS_OF_ENTITIES', 'To departments users'); -} -if (!defined('_ALL_ENTITIES')) { - define('_ALL_ENTITIES', 'All the departments'); -} -if (!defined('_ENTITIES_JUST_BELOW')) { - define('_ENTITIES_JUST_BELOW', 'Immediatly lower than the primary department'); -} -if (!defined('_ALL_ENTITIES_BELOW')) { - define('_ALL_ENTITIES_BELOW', 'Lower than the primary department'); -} -if (!defined('_ENTITIES_JUST_UP')) { - define('_ENTITIES_JUST_UP', 'Immediatly higher than the primary department'); -} -if (!defined('_ENTITIES_BELOW')) { - define('_ENTITIES_BELOW', 'Lower than all my departments'); -} -if (!defined('_MY_ENTITIES')) { - define('_MY_ENTITIES', "All user's departments"); -} -if (!defined('_MY_PRIMARY_ENTITY')) { - define('_MY_PRIMARY_ENTITY', 'Primary department'); -} -if (!defined('_SAME_LEVEL_ENTITIES')) { - define('_SAME_LEVEL_ENTITIES', "Same level than the primary department // Même niveau de l'entité primaire"); -} -if (!defined('_INDEXING_ENTITIES')) { - define('_INDEXING_ENTITIES', 'Index for departments'); -} -if (!defined('_SEARCH_DIFF_LIST')) { - define('_SEARCH_DIFF_LIST', 'Search a department or an user'); -} -if (!defined('_ADD_CC')) { - define('_ADD_CC', 'Add on copy'); -} -if (!defined('_TO_DEST')) { - define('_TO_DEST', 'Recipient'); -} -if (!defined('_NO_DIFF_LIST_ASSOCIATED')) { - define('_NO_DIFF_LIST_ASSOCIATED', 'No diffusion list'); -} -if (!defined('_PRINCIPAL_RECIPIENT')) { - define('_PRINCIPAL_RECIPIENT', 'Main recipient'); -} -if (!defined('_UPDATE_LIST_DIFF_IN_DETAILS')) { - define('_UPDATE_LIST_DIFF_IN_DETAILS', 'Update diffusion list from the detailed page'); -} -if (!defined('_UPDATE_LIST_DIFF')) { - define('_UPDATE_LIST_DIFF', 'Modify diffusion list'); -} -if (!defined('_DIFF_LIST_COPY')) { - define('_DIFF_LIST_COPY', 'Diffusion list'); -} -if (!defined('_DIFF_LIST')) { - define('_DIFF_LIST', 'Diffusion list'); -} -if (!defined('_NO_USER')) { - define('_NO_USER', 'No user'); -} -if (!defined('_MUST_CHOOSE_DEST')) { - define('_MUST_CHOOSE_DEST', 'You have to select one recipient at least'); -} -if (!defined('_ENTITIES__DEL')) { - define('_ENTITIES__DEL', 'Deletion'); -} -if (!defined('_ENTITY_DELETION')) { - define('_ENTITY_DELETION', 'Department deletion'); -} -if (!defined('_THERE_ARE_NOW')) { - define('_THERE_ARE_NOW', 'Now, there are ...'); -} -if (!defined('_DOC_IN_THE_DEPARTMENT')) { - define('_DOC_IN_THE_DEPARTMENT', 'Associated mail(s) to the department'); -} -if (!defined('_DEL_AND_REAFFECT')) { - define('_DEL_AND_REAFFECT', 'Delete and reassign'); -} -if (!defined('_THE_ENTITY')) { - define('_THE_ENTITY', 'The department'); -} -if (!defined('_USERS_LINKED_TO')) { - define('_USERS_LINKED_TO', 'user(s) associated to the department'); -} -if (!defined('_ENTITY_MANDATORY_FOR_REDIRECTION')) { - define('_ENTITY_MANDATORY_FOR_REDIRECTION', 'Mandatory department for the reassigment'); -} -if (!defined('_WARNING_MESSAGE_DEL_ENTITY')) { - define('_WARNING_MESSAGE_DEL_ENTITY', 'Warning :<br> The department deletion leads to mails and users reassigment to a new department. It also reassigns mails on pending handling, the diffusion list templates and response templates toward a replacement department.'); -} - -/******************** Keywords Helper ************/ -if (!defined('_HELP_KEYWORD1')) { - define('_HELP_KEYWORD1', "All the departments attached to a connected user. Doesn't include subtitles"); -} -if (!defined('_HELP_KEYWORD2')) { - define('_HELP_KEYWORD2', "Connected user's primary department"); -} -if (!defined('_HELP_KEYWORD3')) { - define('_HELP_KEYWORD3', 'Sub-department from the arguments list, which might be @my_entities or @my_primary_entity'); -} -if (!defined('_HELP_KEYWORD4')) { - define('_HELP_KEYWORD4', 'Relative department to the department on argument'); -} -if (!defined('_HELP_KEYWORD5')) { - define('_HELP_KEYWORD5', 'All departments on the same level as the department on arguments'); -} -if (!defined('_HELP_KEYWORD6')) { - define('_HELP_KEYWORD6', 'All the departments (actives)'); -} -if (!defined('_HELP_KEYWORD7')) { - define('_HELP_KEYWORD7', 'Immediate sub-departments (n-1) from the departments given on argument'); -} -if (!defined('_HELP_KEYWORD8')) { - define('_HELP_KEYWORD8', 'Forefather department to the one that is given to the level asked on second argument (or the first one - root- if there is no argument 2'); -} -if (!defined('_HELP_KEYWORD9')) { - define('_HELP_KEYWORD9', 'All departments of the type put on argument'); -} -if (!defined('_HELP_KEYWORDS')) { - define('_HELP_KEYWORDS', 'Help on the keywords'); -} -if (!defined('_HELP_KEYWORD_EXEMPLE_TITLE')) { - define('_HELP_KEYWORD_EXEMPLE_TITLE', "Example in the goup security definition (where clause) : access on the resources about the connected user's main belongings department, or the subdepartments of this department."); -} -if (!defined('_HELP_KEYWORD_EXEMPLE')) { - define('_HELP_KEYWORD_EXEMPLE', 'where_clause : (DESTINATION = @my_primary_entity or DESTINATION in (@subentities[@my_primary_entity]))'); -} -if (!defined('_HELP_BY_ENTITY')) { - define('_HELP_BY_ENTITY', 'Keywords of the department module'); -} -if (!defined('_BASKET_REDIRECTIONS_OCCURS_LINKED_TO')) { - define('_BASKET_REDIRECTIONS_OCCURS_LINKED_TO', 'Number of basket redirection associated to the department'); -} -if (!defined('_TEMPLATES_LINKED_TO')) { - define('_TEMPLATES_LINKED_TO', 'Response template(s) associated to a department'); -} -if (!defined('_LISTISTANCES_OCCURS_LINKED_TO')) { - define('_LISTISTANCES_OCCURS_LINKED_TO', 'Number of mails to handle or on copy associated to a department'); -} -if (!defined('_LISTMODELS_OCCURS_LINKED_TO')) { - define('_LISTMODELS_OCCURS_LINKED_TO', 'Diffusion template associated to the department'); -} -if (!defined('_CHOOSE_REPLACEMENT_DEPARTMENT')) { - define('_CHOOSE_REPLACEMENT_DEPARTMENT', 'Choose a replacing department'); -} -if (!defined('_WRONG_DATE_FORMAT')) { - define('_WRONG_DATE_FORMAT', 'Wrong date format'); -} -/******************** Action put in copy ************/ -if (!defined('_ALL_LIST')) { - define('_ALL_LIST', 'Display all the list'); -} - - /******************** Listinstance roles ***********/ -if (!defined('_DEST_OR_COPY')) { - define('_DEST_OR_COPY', 'Recipient'); -} -if (!defined('_SUBMIT')) { - define('_SUBMIT', 'Validate'); -} -if (!defined('_CANCEL')) { - define('_CANCEL', 'Cancel'); -} -if (!defined('_DIFFLIST_TYPE_ROLES')) { - define('_DIFFLIST_TYPE_ROLES', 'Available roles'); -} -if (!defined('_NO_AVAILABLE_ROLE')) { - define('_NO_AVAILABLE_ROLE', 'No available role'); -} - - /******************** Difflist types ***********/ -if (!defined('_ALL_DIFFLIST_TYPES')) { - define('_ALL_DIFFLIST_TYPES', 'All the types'); -} -if (!defined('_DIFFLIST_TYPES_DESC')) { - define('_DIFFLIST_TYPES_DESC', 'Types of diffusion lists'); -} -if (!defined('_DIFFLIST_TYPES')) { - define('_DIFFLIST_TYPES', 'Types of diffusion lists'); -} -if (!defined('_DIFFLIST_TYPE')) { - define('_DIFFLIST_TYPE', 'Type(s) of list'); -} -if (!defined('_ADD_DIFFLIST_TYPE')) { - define('_ADD_DIFFLIST_TYPE', 'Add a type'); -} -if (!defined('_DIFFLIST_TYPE_ID')) { - define('_DIFFLIST_TYPE_ID', 'ID'); -} -if (!defined('_DIFFLIST_TYPE_LABEL')) { - define('_DIFFLIST_TYPE_LABEL', 'Description'); -} -if (!defined('_ALLOW_ENTITIES')) { - define('_ALLOW_ENTITIES', 'Authorize the departments'); -} - - /******************** Listmodels ***********/ -if (!defined('_ALL_LISTMODELS')) { - define('_ALL_LISTMODELS', 'All the lists'); -} -if (!defined('_LISTMODELS_DESC')) { - define('_LISTMODELS_DESC', 'Diffusion list templates of mails and folders'); -} -if (!defined('_LISTMODELS')) { - define('_LISTMODELS', 'Diffusion list templates'); -} -if (!defined('_MANAGE_LISTMODELS_DESC')) { - define('_MANAGE_LISTMODELS_DESC', 'Manage avis and visa circuit models, which can be used in mail.'); -} -if (!defined('_LISTMODEL')) { - define('_LISTMODEL', 'List template(s)'); -} -if (!defined('_ADD_LISTMODEL')) { - define('_ADD_LISTMODEL', 'New template'); -} -if (!defined('_ADMIN_LISTMODEL')) { - define('_ADMIN_LISTMODEL', 'Diffusion list template'); -} -if (!defined('_ADMIN_LISTMODEL_TITLE')) { - define('_ADMIN_LISTMODEL_TITLE', ' List template identification:'); -} -if (!defined('_OBJECT_TYPE')) { - define('_OBJECT_TYPE', 'List template type'); -} -if (!defined('_SELECT_OBJECT_TYPE')) { - define('_SELECT_OBJECT_TYPE', 'Select a type...'); -} -if (!defined('_SELECT_OBJECT_ID')) { - define('_SELECT_OBJECT_ID', 'Select a link...'); -} -if (!defined('_USER_DEFINED_ID')) { - define('_USER_DEFINED_ID', 'Free'); -} -if (!defined('_ALL_OBJECTS_ARE_LINKED')) { - define('_ALL_OBJECTS_ARE_LINKED', 'All the lists are already definied'); -} -if (!defined('_SELECT_OBJECT_TYPE_AND_ID')) { - define('_SELECT_OBJECT_TYPE_AND_ID', 'You have to specify a list type and an ID!'); -} -if (!defined('_SAVE_LISTMODEL')) { - define('_SAVE_LISTMODEL', 'Validate'); -} -if (!defined('_CONFIRM_LISTMODEL_SAVE')) { - define('_CONFIRM_LISTMODEL_SAVE', 'Save the liste ?'); -} - -if (!defined('_ENTER_DESCRIPTION')) { - define('_ENTER_DESCRIPTION', 'Mandatory description'); -} -if (!defined('_ENTER_TITLE')) { - define('_ENTER_TITLE', 'Mandatory title'); -} -if (!defined('_ADMIN_DIFFLIST_TYPES')) { - define('_ADMIN_DIFFLIST_TYPES', 'Diffusion list types (Administration)'); -} -if (!defined('_ADMIN_DIFFLIST_TYPES_DESC')) { - define('_ADMIN_DIFFLIST_TYPES_DESC', 'Administer the different types of diffusion list'); -} -if (!defined('_ADMIN_LISTMODELS')) { - define('_ADMIN_LISTMODELS', 'Diffusion templates (Administration)'); -} -if (!defined('_ADMIN_LISTMODELS_DESC')) { - define('_ADMIN_LISTMODELS_DESC', 'Administer the different diffusion templates'); -} - -/******************** RM ENTITIES ************/ -if (!defined('_STANDARD')) { - define('_STANDARD', 'Standard'); -} - -if (!defined('_VISIBLE')) { - define('_VISIBLE', 'Active'); -} -if (!defined('_NOT_VISIBLE')) { - define('_NOT_VISIBLE', 'Not active'); -} - -/******** NEW WF ************/ -if (!defined('_TARGET_STATUS')) { - define('_TARGET_STATUS', 'Final status on the step validation'); -} -if (!defined('_TARGET_ROLE')) { - define('_TARGET_ROLE', 'Rôle à faire avancer dans le workflow'); -} -if (!defined('_NO_FILTER')) { - define('_NO_FILTER', 'Remove filters'); -} - -if (!defined('_AUTO_FILTER')) { - define('_AUTO_FILTER', 'Suggested list'); -} - -if (!defined('_REDIRECT_NOTE')) { - define('_REDIRECT_NOTE', 'Redirection reason (optional)'); -} - -if (!defined('_STORE_DIFF_LIST')) { - define('_STORE_DIFF_LIST', 'Record the diffusion list'); -} - -if (!defined('_DIFF_LIST_STORED')) { - define('_DIFF_LIST_STORED', 'Recorded diffusion list'); -} - -/////////////print_sep -if (!defined('_PRINT_SEPS')) { - define('_PRINT_SEPS', 'Printing separators'); -} - -if (!defined('_CHOOSE_ENTITIES')) { - define('_CHOOSE_ENTITIES', 'Choose the departments'); -} -if (!defined('_DEL_USER_LISTDIFF')) { - define('_DEL_USER_LISTDIFF', 'Remove the user from the diffusion list'); -} - -if (!defined('_DEL_ENTITY_LISTDIFF')) { - define('_DEL_ENTITY_LISTDIFF', 'Remove the department from the diffusion list'); -} - -if (!defined('_ADD_USER_LISTDIFF')) { - define('_ADD_USER_LISTDIFF', 'Add the user to the diffusion list'); -} - -if (!defined('_ADD_ENTITY_LISTDIFF')) { - define('_ADD_ENTITY_LISTDIFF', 'Add the department to the diffusion list'); -} - -// SEDA -if (!defined('_ARCHIVAL_AGREEMENT')) { - define('_ARCHIVAL_AGREEMENT', 'Archival agreement'); -} -if (!defined('_ARCHIVAL_AGENCY')) { - define('_ARCHIVAL_AGENCY', 'Archival agency'); -} - -if (!defined('_GO_TO_CC')) { - define('_GO_TO_CC', 'Put the user in copy'); -} -if (!defined('_GO_TO_DEST')) { - define('_GO_TO_DEST', 'Put the user in recipient'); -} -if (!defined('_UP_USER_ONE_ROW')) { - define('_UP_USER_ONE_ROW', 'Move up the user for a row'); -} -if (!defined('_DOWN_USER_ONE_ROW')) { - define('_DOWN_USER_ONE_ROW', 'Move down the user for a row'); -} -if (!defined('_UP_ENTITY_ONE_ROW')) { - define('_UP_ENTITY_ONE_ROW', 'Move up the entity for a row'); -} -if (!defined('_DOWN_ENTITY_ONE_ROW')) { - define('_DOWN_ENTITY_ONE_ROW', 'Move down the entity for a row'); -} - -if (!defined('_TYPE_ID_HISTORY')) { - define('_TYPE_ID_HISTORY', "Historic identifier"); -} -if (!defined('_RES_ID')) { - define('_RES_ID', "RES ID"); -} -if (!defined('_UPDATED_BY_USER')) { - define('_UPDATED_BY_USER', "Updated by"); -} diff --git a/modules/entities/lang/fr.php b/modules/entities/lang/fr.php deleted file mode 100755 index 8a730e26e76..00000000000 --- a/modules/entities/lang/fr.php +++ /dev/null @@ -1,572 +0,0 @@ -<?php -/* - * - * Copyright 2008,2009 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/>. - */ - -/*************************** Entites management *****************/ -if (!defined('_ADD_ENTITY')) { - define('_ADD_ENTITY', 'Entité ajoutée'); -} -if (!defined('_ENTITY_ADDITION')) { - define('_ENTITY_ADDITION', "Ajout d'une entité"); -} -if (!defined('_ENTITY_MODIFICATION')) { - define('_ENTITY_MODIFICATION', "Modification d'une entité"); -} -if (!defined('_ENTITY_AUTORIZATION')) { - define('_ENTITY_AUTORIZATION', "Autorisation d'une entité"); -} -if (!defined('_ENTITY_SUSPENSION')) { - define('_ENTITY_SUSPENSION', "Suspension d'une entité"); -} -if (!defined('_ENTITY_DELETION')) { - define('_ENTITY_DELETION', "Suppression d'une entité"); -} -if (!defined('_ENTITY_DELETED')) { - define('_ENTITY_DELETED', 'Entité supprimée'); -} -if (!defined('_ENTITY_UPDATED')) { - define('_ENTITY_UPDATED', 'Entité modifiée'); -} -if (!defined('_ENTITY_AUTORIZED')) { - define('_ENTITY_AUTORIZED', 'Entité autorisé'); -} -if (!defined('_ENTITY_SUSPENDED')) { - define('_ENTITY_SUSPENDED', 'Entité suspendue'); -} -if (!defined('_ENTITY')) { - define('_ENTITY', 'Entité'); -} -if (!defined('_ENTITIES')) { - define('_ENTITIES', 'Entités'); -} -if (!defined('_ENTITIES_COMMENT')) { - define('_ENTITIES_COMMENT', 'Entités'); -} -if (!defined('_ALL_ENTITIES')) { - define('_ALL_ENTITIES', 'Toutes les entités'); -} -if (!defined('_ENTITIES_LIST')) { - define('_ENTITIES_LIST', 'Liste des entités'); -} -if (!defined('_MANAGE_ENTITIES')) { - define('_MANAGE_ENTITIES', 'Gérer les Entités'); -} -if (!defined('_ENTITY_MISSING')) { - define('_ENTITY_MISSING', "Cette entité n'existe pas"); -} -if (!defined('_ENTITY_TREE')) { - define('_ENTITY_TREE', 'Arborescence des entités'); -} -if (!defined('_ENTITY_TREE_DESC')) { - define('_ENTITY_TREE_DESC', "Voir l'arborescence des entités"); -} -if (!defined('_ENTITY_HAVE_CHILD')) { - define('_ENTITY_HAVE_CHILD', 'cette entité possède des sous entités'); -} -if (!defined('_ENTITY_IS_RELATED')) { - define('_ENTITY_IS_RELATED', 'cette entité est reliée à des utilisateurs'); -} -if (!defined('_TYPE')) { - define('_TYPE', 'Type'); -} - -/*************************** Users - Entites management *****************/ -if (!defined('_ENTITY_USER_DESC')) { - define('_ENTITY_USER_DESC', 'Mettre en relation des entités et des utilisateurs'); -} -if (!defined('_ENTITIES_USERS')) { - define('_ENTITIES_USERS', 'Relation entités - utilisateurs'); -} -if (!defined('_ENTITIES_USERS_LIST')) { - define('_ENTITIES_USERS_LIST', 'Liste des utilisateurs'); -} -if (!defined('_USER_ENTITIES_TITLE')) { - define('_USER_ENTITIES_TITLE', "L'utilisateur appartient aux entités suivantes"); -} -if (!defined('_USER_ENTITIES_ADDITION')) { - define('_USER_ENTITIES_ADDITION', 'Relation Utilisateur - Entités'); -} -if (!defined('_USER_BELONGS_NO_ENTITY')) { - define('_USER_BELONGS_NO_ENTITY', "L'utilisateur n'appartient à aucune entité"); -} -if (!defined('_CHOOSE_ONE_ENTITY')) { - define('_CHOOSE_ONE_ENTITY', 'Choisissez au moins une entité'); -} -if (!defined('_CHOOSE_ENTITY')) { - define('_CHOOSE_ENTITY', 'Choisissez une entité'); -} -if (!defined('_CHOOSE_PRIMARY_ENTITY')) { - define('_CHOOSE_PRIMARY_ENTITY', 'Choisir comme entité primaire'); -} -if (!defined('_PRIMARY_ENTITY')) { - define('_PRIMARY_ENTITY', 'Entité primaire'); -} -if (!defined('_DELETE_ENTITY')) { - define('_DELETE_ENTITY', 'Supprimer le(s) entité(s)'); -} -if (!defined('USER_ADD_ENTITY')) { - define('USER_ADD_ENTITY', 'Ajouter une entité'); -} -if (!defined('_ADD_TO_ENTITY')) { - define('_ADD_TO_ENTITY', 'Ajouter à une entité'); -} -if (!defined('_NO_ENTITY_SELECTED')) { - define('_NO_ENTITY_SELECTED', 'Aucune entité sélectionnée'); -} -if (!defined('_NO_PRIMARY_ENTITY')) { - define('_NO_PRIMARY_ENTITY', "L'entité primaire est obligatoire"); -} -if (!defined('_NO_ENTITIES_DEFINED_FOR_YOU')) { - define('_NO_ENTITIES_DEFINED_FOR_YOU', 'Aucune entité définie pour cet utilisateur'); -} -if (!defined('_LABEL_MISSING')) { - define('_LABEL_MISSING', "Il manque le nom de l'entité"); -} -if (!defined('_SHORT_LABEL_MISSING')) { - define('_SHORT_LABEL_MISSING', "Il manque le nom court de l'entité"); -} -if (!defined('_ID_MISSING')) { - define('_ID_MISSING', "Il manque l'indentifiant de l'entité"); -} -if (!defined('_TYPE_MISSING')) { - define('_TYPE_MISSING', "Le type de l'entité est obligatoire"); -} -if (!defined('_PARENT_MISSING')) { - define('_PARENT_MISSING', "L'entité parente est obligatoire"); -} -if (!defined('_ENTITY_UNKNOWN')) { - define('_ENTITY_UNKNOWN', 'Entité Inconnue'); -} - -/*************************** Entites form *****************/ -if (!defined('_ENTITY_LABEL')) { - define('_ENTITY_LABEL', 'Nom'); -} -if (!defined('_SHORT_LABEL')) { - define('_SHORT_LABEL', 'Nom court'); -} -if (!defined('_ENTITY_FULL_NAME')) { - define('_ENTITY_FULL_NAME', 'Bloc arborescence'); -} -if (!defined('_ENTITY_ADR_1')) { - define('_ENTITY_ADR_1', 'Adresse 1'); -} -if (!defined('_ENTITY_ADR_2')) { - define('_ENTITY_ADR_2', 'Adresse 2'); -} -if (!defined('_ENTITY_ADR_3')) { - define('_ENTITY_ADR_3', 'Adresse 3'); -} -if (!defined('_ENTITY_ZIPCODE')) { - define('_ENTITY_ZIPCODE', 'Code Postal'); -} -if (!defined('_ENTITY_CITY')) { - define('_ENTITY_CITY', 'Ville'); -} -if (!defined('_ENTITY_COUNTRY')) { - define('_ENTITY_COUNTRY', 'Pays'); -} -if (!defined('_ENTITY_EMAIL')) { - define('_ENTITY_EMAIL', 'Email'); -} -if (!defined('_ENTITY_BUSINESS')) { - define('_ENTITY_BUSINESS', 'N° SIRET'); -} -if (!defined('_ENTITY_PARENT')) { - define('_ENTITY_PARENT', 'Entité parente'); -} -if (!defined('_CHOOSE_ENTITY_PARENT')) { - define('_CHOOSE_ENTITY_PARENT', "Choisissez l'entité parente"); -} -if (!defined('_CHOOSE_FILTER_ENTITY')) { - define('_CHOOSE_FILTER_ENTITY', 'Filtrer par entité'); -} -if (!defined('_CHOOSE_ENTITY_TYPE')) { - define('_CHOOSE_ENTITY_TYPE', "Choisissez le type de l'entité"); -} -if (!defined('_ENTITY_TYPE')) { - define('_ENTITY_TYPE', "Type de l'entité"); -} -if (!defined('_TO_USERS_OF_ENTITIES')) { - define('_TO_USERS_OF_ENTITIES', 'Vers des utilisateurs des entités'); -} -if (!defined('_ALL_ENTITIES')) { - define('_ALL_ENTITIES', 'Toutes les entités'); -} -if (!defined('_ENTITIES_JUST_BELOW')) { - define('_ENTITIES_JUST_BELOW', "Immédiatement inférieures à l'entité primaire"); -} -if (!defined('_ALL_ENTITIES_BELOW')) { - define('_ALL_ENTITIES_BELOW', "Inférieures à l'entité primaire"); -} -if (!defined('_ENTITIES_JUST_UP')) { - define('_ENTITIES_JUST_UP', "Immédiatement supérieures à l'entité primaire"); -} -if (!defined('_ENTITIES_BELOW')) { - define('_ENTITIES_BELOW', 'Inférieures à toutes mes entités'); -} -if (!defined('_MY_ENTITIES')) { - define('_MY_ENTITIES', "Toutes les entités de l'utilisateur"); -} -if (!defined('_MY_PRIMARY_ENTITY')) { - define('_MY_PRIMARY_ENTITY', 'Entité primaire'); -} -if (!defined('_SAME_LEVEL_ENTITIES')) { - define('_SAME_LEVEL_ENTITIES', "Même niveau de l'entité primaire"); -} -if (!defined('_INDEXING_ENTITIES')) { - define('_INDEXING_ENTITIES', 'Indexer pour les entités'); -} -if (!defined('_SEARCH_DIFF_LIST')) { - define('_SEARCH_DIFF_LIST', 'Rechercher une entité ou un utilisateur'); -} -if (!defined('_ADD_CC')) { - define('_ADD_CC', 'Ajouter en copie'); -} -if (!defined('_TO_DEST')) { - define('_TO_DEST', 'Attributaire'); -} -if (!defined('_NO_DIFF_LIST_ASSOCIATED')) { - define('_NO_DIFF_LIST_ASSOCIATED', 'Aucune liste de diffusion'); -} -if (!defined('_PRINCIPAL_RECIPIENT')) { - define('_PRINCIPAL_RECIPIENT', 'Destinataire principal'); -} -if (!defined('_UPDATE_LIST_DIFF')) { - define('_UPDATE_LIST_DIFF', 'Modifier la liste de diffusion'); -} -if (!defined('_DIFF_LIST_COPY')) { - define('_DIFF_LIST_COPY', 'Liste de diffusion'); -} -if (!defined('_DIFF_LIST')) { - define('_DIFF_LIST', 'Liste de diffusion'); -} -if (!defined('_NO_USER')) { - define('_NO_USER', "Pas d'utilisateur"); -} -if (!defined('_MUST_CHOOSE_DEST')) { - define('_MUST_CHOOSE_DEST', 'Vous devez sélectionner au moins un destinataire'); -} -if (!defined('_ENTITIES__DEL')) { - define('_ENTITIES__DEL', 'Suppression'); -} -if (!defined('_ENTITY_DELETION')) { - define('_ENTITY_DELETION', "Suppression d'entité"); -} -if (!defined('_THERE_ARE_NOW')) { - define('_THERE_ARE_NOW', 'Il y a actuellement'); -} -if (!defined('_DOC_IN_THE_DEPARTMENT')) { - define('_DOC_IN_THE_DEPARTMENT', "courrier(s) associé(s) à l'entité"); -} -if (!defined('_DEL_AND_REAFFECT')) { - define('_DEL_AND_REAFFECT', 'Supprimer ET réaffecter'); -} -if (!defined('_NO_REAFFECT')) { - define('_NO_REAFFECT', 'Ne pas réaffecter'); -} -if (!defined('_THE_ENTITY')) { - define('_THE_ENTITY', "L'entité"); -} -if (!defined('_USERS_LINKED_TO')) { - define('_USERS_LINKED_TO', "utilisateur(s) associé(s) à l'entité"); -} -if (!defined('_ENTITY_MANDATORY_FOR_REDIRECTION')) { - define('_ENTITY_MANDATORY_FOR_REDIRECTION', 'Entité obligatoire pour la réaffectation'); -} -if (!defined('_WARNING_MESSAGE_DEL_ENTITY')) { - define('_WARNING_MESSAGE_DEL_ENTITY', "Avertissement :<br> La suppression d'une entité entraine la réaffectation des courriers et utilisateurs à une nouvelle entité mais réaffecte également les courriers en attente de traitement, les modèles de liste de diffusion et les modèles de réponses vers l'entité de remplacement."); -} - -/******************** Keywords Helper ************/ -if (!defined('_HELP_KEYWORD1')) { - define('_HELP_KEYWORD1', "toutes les entités rattachées à l'utilisateur connecté. N'inclut pas les sous-entités"); -} -if (!defined('_HELP_KEYWORD2')) { - define('_HELP_KEYWORD2', "entité primaire de l'utilisateur connecté"); -} -if (!defined('_HELP_KEYWORD3')) { - define('_HELP_KEYWORD3', "sous-entités de la liste d'argument, qui peut aussi être @my_entities ou @my_primary_entity"); -} -if (!defined('_HELP_KEYWORD4')) { - define('_HELP_KEYWORD4', "entité parente de l'entité en argument"); -} -if (!defined('_HELP_KEYWORD5')) { - define('_HELP_KEYWORD5', "toutes les entités du même niveau que l'entité en argument"); -} -if (!defined('_HELP_KEYWORD6')) { - define('_HELP_KEYWORD6', 'toutes les entités (actives)'); -} -if (!defined('_HELP_KEYWORD7')) { - define('_HELP_KEYWORD7', 'sous-entités immédiates (n-1) des entités données en argument'); -} -if (!defined('_HELP_KEYWORD8')) { - define('_HELP_KEYWORD8', "entités ancètres de l'entité donnée en argument jusqu'à la profondeur demandée en second argument (ou la racine si aucun argument 2 fourni)"); -} -if (!defined('_HELP_KEYWORD9')) { - define('_HELP_KEYWORD9', 'toutes les entités du type mis en argument'); -} -if (!defined('_HELP_KEYWORDS')) { - define('_HELP_KEYWORDS', 'Aide sur les mots clés'); -} -if (!defined('_HELP_KEYWORD_EXEMPLE_TITLE')) { - define('_HELP_KEYWORD_EXEMPLE_TITLE', "Exemple dans la définition de la sécurité d'un groupe (where clause) : accès sur les ressources concernant l'entité d'appartenance principal de l'utilisateur connecté, ou les sous-entités de cette entité."); -} -if (!defined('_HELP_KEYWORD_EXEMPLE')) { - define('_HELP_KEYWORD_EXEMPLE', 'where_clause : (DESTINATION = @my_primary_entity or DESTINATION in (@subentities[@my_primary_entity]))'); -} -if (!defined('_HELP_BY_ENTITY')) { - define('_HELP_BY_ENTITY', 'Mots clés du module Entités'); -} -if (!defined('_BASKET_REDIRECTIONS_OCCURS_LINKED_TO')) { - define('_BASKET_REDIRECTIONS_OCCURS_LINKED_TO', "occurence(s) de redirection(s) de bannette(s) associé(s) à l'entité"); -} -if (!defined('_TEMPLATES_LINKED_TO')) { - define('_TEMPLATES_LINKED_TO', "modèle(s) de réponse(s) associé(s) à l'entité"); -} -if (!defined('_LISTISTANCES_OCCURS_LINKED_TO')) { - define('_LISTISTANCES_OCCURS_LINKED_TO', "occurence(s) de courrier(s) à traiter ou en copie(s) associé(s) à l'entité"); -} -if (!defined('_LISTMODELS_OCCURS_LINKED_TO')) { - define('_LISTMODELS_OCCURS_LINKED_TO', "modèle de diffusion associé à l'entité"); -} -if (!defined('_CHOOSE_REPLACEMENT_DEPARTMENT')) { - define('_CHOOSE_REPLACEMENT_DEPARTMENT', 'Choisissez une entité remplaçante'); -} -if (!defined('_WRONG_DATE_FORMAT')) { - define('_WRONG_DATE_FORMAT', 'Format de date incorrect'); -} -/******************** Action put in copy ************/ -if (!defined('_ALL_LIST')) { - define('_ALL_LIST', 'Afficher toute la liste'); -} - - /******************** Listinstance roles ***********/ -if (!defined('_DEST_OR_COPY')) { - define('_DEST_OR_COPY', 'Destinataire'); -} -if (!defined('_SUBMIT')) { - define('_SUBMIT', 'Valider'); -} -if (!defined('_CANCEL')) { - define('_CANCEL', 'Annuler'); -} -if (!defined('_DIFFLIST_TYPE_ROLES')) { - define('_DIFFLIST_TYPE_ROLES', 'Rôles disponibles'); -} -if (!defined('_NO_AVAILABLE_ROLE')) { - define('_NO_AVAILABLE_ROLE', 'Aucun rôle disponible'); -} - - /******************** Difflist types ***********/ -if (!defined('_ALL_DIFFLIST_TYPES')) { - define('_ALL_DIFFLIST_TYPES', 'Tous les types'); -} - -if (!defined('_DIFFLIST_TYPES_DESC')) { - define('_DIFFLIST_TYPES_DESC', 'Types listes de diffusion'); -} -if (!defined('_DIFFLIST_TYPES')) { - define('_DIFFLIST_TYPES', 'Types de listes de diffusion'); -} -if (!defined('_DIFFLIST_TYPE')) { - define('_DIFFLIST_TYPE', 'Type(s) de liste'); -} -if (!defined('_ADD_DIFFLIST_TYPE')) { - define('_ADD_DIFFLIST_TYPE', 'Ajouter un type'); -} -if (!defined('_DIFFLIST_TYPE_ID')) { - define('_DIFFLIST_TYPE_ID', 'Identifiant'); -} -if (!defined('_DIFFLIST_TYPE_LABEL')) { - define('_DIFFLIST_TYPE_LABEL', 'Description'); -} -if (!defined('_ALLOW_ENTITIES')) { - define('_ALLOW_ENTITIES', 'Autoriser les entités'); -} - - /******************** Listmodels ***********/ -if (!defined('_ALL_LISTMODELS')) { - define('_ALL_LISTMODELS', 'Toutes les listes'); -} -if (!defined('_LISTMODELS_DESC')) { - define('_LISTMODELS_DESC', 'Modèles de listes de diffusion des courriers et dossiers'); -} -if (!defined('_LISTMODELS')) { - define('_LISTMODELS', 'Modèles de listes de diffusion'); -} -if (!defined('_MANAGE_LISTMODELS_DESC')) { - define('_MANAGE_LISTMODELS_DESC', "Gérer les modèles de circuits d'avis et de visa pouvant être utilisés dans un courrier."); -} -if (!defined('_LISTMODEL')) { - define('_LISTMODEL', 'Modèle(s) de liste'); -} -if (!defined('_ADD_LISTMODEL')) { - define('_ADD_LISTMODEL', 'Nouveau modèle'); -} -if (!defined('_ADMIN_LISTMODEL')) { - define('_ADMIN_LISTMODEL', 'Modèle de liste de diffusion'); -} -if (!defined('_ADMIN_LISTMODEL_TITLE')) { - define('_ADMIN_LISTMODEL_TITLE', 'Identification du modèle de liste:'); -} -if (!defined('_OBJECT_TYPE')) { - define('_OBJECT_TYPE', 'Type de modèle de liste'); -} -if (!defined('_SELECT_OBJECT_TYPE')) { - define('_SELECT_OBJECT_TYPE', 'Sélectionnez un type...'); -} -if (!defined('_SELECT_OBJECT_ID')) { - define('_SELECT_OBJECT_ID', 'Sélectionnez un lien...'); -} -if (!defined('_USER_DEFINED_ID')) { - define('_USER_DEFINED_ID', 'Libre'); -} -if (!defined('_ALL_OBJECTS_ARE_LINKED')) { - define('_ALL_OBJECTS_ARE_LINKED', 'Toutes les listes sont déjà définies'); -} -if (!defined('_SELECT_OBJECT_TYPE_AND_ID')) { - define('_SELECT_OBJECT_TYPE_AND_ID', 'Vous devez spécifier un type de liste et un identifiant!'); -} -if (!defined('_SAVE_LISTMODEL')) { - define('_SAVE_LISTMODEL', 'Valider'); -} -if (!defined('_CONFIRM_LISTMODEL_SAVE')) { - define('_CONFIRM_LISTMODEL_SAVE', 'Sauvegarder la liste ?'); -} -if (!defined('_ENTER_DESCRIPTION')) { - define('_ENTER_DESCRIPTION', 'Description obligatoire'); -} -if (!defined('_ENTER_TITLE')) { - define('_ENTER_TITLE', 'Titre obligatoire'); -} -if (!defined('_ADMIN_DIFFLIST_TYPES')) { - define('_ADMIN_DIFFLIST_TYPES', 'Types de liste de diffusion (Administration)'); -} -if (!defined('_ADMIN_DIFFLIST_TYPES_DESC')) { - define('_ADMIN_DIFFLIST_TYPES_DESC', 'Administrer les différents types de liste de diffusion'); -} -if (!defined('_ADMIN_LISTMODELS')) { - define('_ADMIN_LISTMODELS', 'Modèle de diffusion (Administration)'); -} -if (!defined('_ADMIN_LISTMODELS_DESC')) { - define('_ADMIN_LISTMODELS_DESC', 'Administrer les différents modèles de diffusion'); -} - -/******************** RM ENTITIES ************/ -if (!defined('_STANDARD')) { - define('_STANDARD', 'Standard'); -} - -if (!defined('_VISIBLE')) { - define('_VISIBLE', 'Actif'); -} -if (!defined('_NOT_VISIBLE')) { - define('_NOT_VISIBLE', 'Inactif'); -} - -/******** NEW WF ************/ -if (!defined('_TARGET_STATUS')) { - define('_TARGET_STATUS', "Statut final à la validation de l'étape"); -} -if (!defined('_TARGET_ROLE')) { - define('_TARGET_ROLE', 'Rôle à faire avancer dans le workflow'); -} - -if (!defined('_NO_FILTER')) { - define('_NO_FILTER', 'Effacer les filtres'); -} - -if (!defined('_AUTO_FILTER')) { - define('_AUTO_FILTER', 'Liste suggérée'); -} - -if (!defined('_REDIRECT_NOTE')) { - define('_REDIRECT_NOTE', 'Motif de redirection (optionnel)'); -} - -if (!defined('_STORE_DIFF_LIST')) { - define('_STORE_DIFF_LIST', 'Enregistrer la liste de diffusion'); -} - -if (!defined('_DIFF_LIST_STORED')) { - define('_DIFF_LIST_STORED', 'Liste de diffusion enregistrée'); -} - -/////////////print_sep -if (!defined('_PRINT_SEPS')) { - define('_PRINT_SEPS', 'Impression des séparateurs'); -} - -if (!defined('_CHOOSE_ENTITIES')) { - define('_CHOOSE_ENTITIES', 'Choisissez les entités'); -} -if (!defined('_DEL_USER_LISTDIFF')) { - define('_DEL_USER_LISTDIFF', "Retirer l'utilisateur de la liste de diffusion"); -} - -if (!defined('_DEL_ENTITY_LISTDIFF')) { - define('_DEL_ENTITY_LISTDIFF', "Retirer l'entité de la liste de diffusion"); -} - -if (!defined('_ADD_USER_LISTDIFF')) { - define('_ADD_USER_LISTDIFF', "Ajouter l'utilisateur à la liste de diffusion"); -} - -if (!defined('_ADD_ENTITY_LISTDIFF')) { - define('_ADD_ENTITY_LISTDIFF', "Ajouter l'entité à la liste de diffusion"); -} - -// SEDA -if (!defined('_ARCHIVAL_AGREEMENT')) { - define('_ARCHIVAL_AGREEMENT', "Convention d'archivage"); -} -if (!defined('_ARCHIVAL_AGENCY')) { - define('_ARCHIVAL_AGENCY', "Entité d'archive"); -} - -if (!defined('_GO_TO_CC')) { - define('_GO_TO_CC', "Passer l'utilisateur en copie"); -} -if (!defined('_GO_TO_DEST')) { - define('_GO_TO_DEST', "Passer l'utilisateur en attributaire"); -} -if (!defined('_UP_USER_ONE_ROW')) { - define('_UP_USER_ONE_ROW', "Monter l'utilisateur d'un rang"); -} -if (!defined('_DOWN_USER_ONE_ROW')) { - define('_DOWN_USER_ONE_ROW', "Descendre l'utilisateur d'un rang"); -} -if (!defined('_UP_ENTITY_ONE_ROW')) { - define('_UP_ENTITY_ONE_ROW', "Monter l'entité d'un rang"); -} -if (!defined('_DOWN_ENTITY_ONE_ROW')) { - define('_DOWN_ENTITY_ONE_ROW', "Descendre l'entité d'un rang"); -} - -if (!defined('_TYPE_ID_HISTORY')) { - define('_TYPE_ID_HISTORY', "Identifiant de l'historique"); -} -if (!defined('_RES_ID')) { - define('_RES_ID', "RES ID"); -} -if (!defined('_UPDATED_BY_USER')) { - define('_UPDATED_BY_USER', "Mis à jour par"); -} diff --git a/modules/entities/lang/nl.php b/modules/entities/lang/nl.php deleted file mode 100755 index 2ad5f07a1f4..00000000000 --- a/modules/entities/lang/nl.php +++ /dev/null @@ -1,554 +0,0 @@ -<?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. - */ - -/*************************** Entites management *****************/ -if (!defined('_ADD_ENTITY')) { - define('_ADD_ENTITY', 'Toegevoegde eenheid'); -} -if (!defined('_ENTITY_ADDITION')) { - define('_ENTITY_ADDITION', 'Toevoeging van een eenheid'); -} -if (!defined('_ENTITY_MODIFICATION')) { - define('_ENTITY_MODIFICATION', 'Wijziging van een eenheid'); -} -if (!defined('_ENTITY_AUTORIZATION')) { - define('_ENTITY_AUTORIZATION', 'Toelating van een eenheid'); -} -if (!defined('_ENTITY_SUSPENSION')) { - define('_ENTITY_SUSPENSION', 'Opschorting van een eenheid'); -} -if (!defined('_ENTITY_DELETION')) { - define('_ENTITY_DELETION', 'Verwijdering van een eenheid'); -} -if (!defined('_ENTITY_DELETED')) { - define('_ENTITY_DELETED', 'Verwijderde eenheid'); -} -if (!defined('_ENTITY_UPDATED')) { - define('_ENTITY_UPDATED', 'Gewijzigde eenheid'); -} -if (!defined('_ENTITY_AUTORIZED')) { - define('_ENTITY_AUTORIZED', 'Toegelaten eenheid'); -} -if (!defined('_ENTITY_SUSPENDED')) { - define('_ENTITY_SUSPENDED', 'Opgeschorste eenheid'); -} -if (!defined('_ENTITY')) { - define('_ENTITY', 'Eenheid'); -} -if (!defined('_ENTITIES')) { - define('_ENTITIES', 'Eenheden'); -} -if (!defined('_ENTITIES_COMMENT')) { - define('_ENTITIES_COMMENT', 'Eenheden'); -} -if (!defined('_ALL_ENTITIES')) { - define('_ALL_ENTITIES', 'Alle eenheden'); -} -if (!defined('_ENTITIES_LIST')) { - define('_ENTITIES_LIST', 'Lijst van de eenheden'); -} -if (!defined('_MANAGE_ENTITIES')) { - define('_MANAGE_ENTITIES', 'De Eenheden beheren'); -} -if (!defined('_ENTITY_MISSING')) { - define('_ENTITY_MISSING', 'Deze eenheid bestaat niet'); -} -if (!defined('_ENTITY_TREE')) { - define('_ENTITY_TREE', 'Boomstructuur van de eenheden'); -} -if (!defined('_ENTITY_TREE_DESC')) { - define('_ENTITY_TREE_DESC', 'De boomstructuur van de eenheden bekijken'); -} -if (!defined('_ENTITY_HAVE_CHILD')) { - define('_ENTITY_HAVE_CHILD', 'deze eenheid heeft subeenheden'); -} -if (!defined('_ENTITY_IS_RELATED')) { - define('_ENTITY_IS_RELATED', 'Deze eenheid is aan gebruikers gekoppeld'); -} -if (!defined('_TYPE')) { - define('_TYPE', 'Type'); -} -if (!defined('_ENTITY_USER_DESC')) { - define('_ENTITY_USER_DESC', 'Eenheden en gebruikers met elkaar in relatie brengen'); -} -if (!defined('_ENTITIES_USERS')) { - define('_ENTITIES_USERS', 'Relatie eenheden - gebruikers'); -} -if (!defined('_ENTITIES_USERS_LIST')) { - define('_ENTITIES_USERS_LIST', 'Gebruikerslijst'); -} -if (!defined('_USER_ENTITIES_TITLE')) { - define('_USER_ENTITIES_TITLE', 'De gebruiker behoort tot de volgende eenheden'); -} -if (!defined('_USER_ENTITIES_ADDITION')) { - define('_USER_ENTITIES_ADDITION', 'Relatie Gebruiker - Eenheden'); -} -if (!defined('_USER_BELONGS_NO_ENTITY')) { - define('_USER_BELONGS_NO_ENTITY', 'De gebruiker behoort tot geen enkele eenheid'); -} -if (!defined('_CHOOSE_ONE_ENTITY')) { - define('_CHOOSE_ONE_ENTITY', 'Kies minstens een eenheid'); -} -if (!defined('_CHOOSE_ENTITY')) { - define('_CHOOSE_ENTITY', 'Kies een eenheid'); -} -if (!defined('_CHOOSE_PRIMARY_ENTITY')) { - define('_CHOOSE_PRIMARY_ENTITY', 'Als primaire eenheid kiezen'); -} -if (!defined('_PRIMARY_ENTITY')) { - define('_PRIMARY_ENTITY', 'Primaire eenheid'); -} -if (!defined('_DELETE_ENTITY')) { - define('_DELETE_ENTITY', 'Eenhe(i)d(en) verwijderen'); -} -if (!defined('USER_ADD_ENTITY')) { - define('USER_ADD_ENTITY', 'Aan een eenheid toevoegen'); -} -if (!defined('_ADD_TO_ENTITY')) { - define('_ADD_TO_ENTITY', 'Aan een eenheid toevoegen'); -} -if (!defined('_NO_ENTITY_SELECTED')) { - define('_NO_ENTITY_SELECTED', 'Geen eenheid geselecteerd'); -} -if (!defined('_NO_PRIMARY_ENTITY')) { - define('_NO_PRIMARY_ENTITY', 'De primaire eenheid is verplicht'); -} -if (!defined('_NO_ENTITIES_DEFINED_FOR_YOU')) { - define('_NO_ENTITIES_DEFINED_FOR_YOU', 'Geen eenheid bepaald voor deze gebruiker'); -} -if (!defined('_LABEL_MISSING')) { - define('_LABEL_MISSING', 'Naam van de eenheid ontbreekt'); -} -if (!defined('_SHORT_LABEL_MISSING')) { - define('_SHORT_LABEL_MISSING', 'Korte naam van de eenheid ontbreekt'); -} -if (!defined('_ID_MISSING')) { - define('_ID_MISSING', 'De gebruikersnaam van de eenheid ontbreekt'); -} -if (!defined('_TYPE_MISSING')) { - define('_TYPE_MISSING', 'Het type eenheid is verplicht'); -} -if (!defined('_PARENT_MISSING')) { - define('_PARENT_MISSING', 'De bovenliggende eenheid is verplicht'); -} -if (!defined('_ENTITY_UNKNOWN')) { - define('_ENTITY_UNKNOWN', 'Onbekende eenheid'); -} -if (!defined('_ENTITY_LABEL')) { - define('_ENTITY_LABEL', 'Naam'); -} -if (!defined('_SHORT_LABEL')) { - define('_SHORT_LABEL', 'Korte naam'); -} -if (!defined('_ENTITY_FULL_NAME')) { - define('_ENTITY_FULL_NAME', 'Blok boomstructuur'); -} -if (!defined('_ENTITY_ADR_1')) { - define('_ENTITY_ADR_1', 'Adres 1'); -} -if (!defined('_ENTITY_ADR_2')) { - define('_ENTITY_ADR_2', 'Adres 2'); -} -if (!defined('_ENTITY_ADR_3')) { - define('_ENTITY_ADR_3', 'Adres 3'); -} -if (!defined('_ENTITY_ZIPCODE')) { - define('_ENTITY_ZIPCODE', 'Postcode'); -} -if (!defined('_ENTITY_CITY')) { - define('_ENTITY_CITY', 'Gemeente'); -} -if (!defined('_ENTITY_COUNTRY')) { - define('_ENTITY_COUNTRY', 'Land'); -} -if (!defined('_ENTITY_EMAIL')) { - define('_ENTITY_EMAIL', 'E-mail'); -} -if (!defined('_ENTITY_BUSINESS')) { - define('_ENTITY_BUSINESS', 'SIRET NR.'); -} -if (!defined('_ENTITY_PARENT')) { - define('_ENTITY_PARENT', 'Bovenliggende eenheid '); -} -if (!defined('_CHOOSE_ENTITY_PARENT')) { - define('_CHOOSE_ENTITY_PARENT', 'Kies de bovenliggende eenheid'); -} -if (!defined('_CHOOSE_FILTER_ENTITY')) { - define('_CHOOSE_FILTER_ENTITY', 'Filteren op eenheid'); -} -if (!defined('_CHOOSE_ENTITY_TYPE')) { - define('_CHOOSE_ENTITY_TYPE', 'Kies het type eenheid'); -} -if (!defined('_ENTITY_TYPE')) { - define('_ENTITY_TYPE', 'Type eenheid'); -} -if (!defined('_TO_USERS_OF_ENTITIES')) { - define('_TO_USERS_OF_ENTITIES', 'Naar gebruikers van de diensten'); -} -if (!defined('_ALL_ENTITIES')) { - define('_ALL_ENTITIES', 'Alle eenheden'); -} -if (!defined('_ENTITIES_JUST_BELOW')) { - define('_ENTITIES_JUST_BELOW', 'Onmiddellijk onder de primaire eenheid'); -} -if (!defined('_ALL_ENTITIES_BELOW')) { - define('_ALL_ENTITIES_BELOW', 'Onder de primaire eenheid'); -} -if (!defined('_ENTITIES_JUST_UP')) { - define('_ENTITIES_JUST_UP', 'Onmiddellijk boven de primaire eenheid'); -} -if (!defined('_ENTITIES_BELOW')) { - define('_ENTITIES_BELOW', 'Onder al mijn eenheden'); -} -if (!defined('_MY_ENTITIES')) { - define('_MY_ENTITIES', 'Alle eenheden van de gebruiker'); -} -if (!defined('_MY_PRIMARY_ENTITY')) { - define('_MY_PRIMARY_ENTITY', 'Primaire eenheid'); -} -if (!defined('_SAME_LEVEL_ENTITIES')) { - define('_SAME_LEVEL_ENTITIES', 'Zelfde niveau van de primaire eenheid'); -} -if (!defined('_INDEXING_ENTITIES')) { - define('_INDEXING_ENTITIES', 'Indexeren voor de diensten'); -} -if (!defined('_SEARCH_DIFF_LIST')) { - define('_SEARCH_DIFF_LIST', 'Een dienst of een gebruiker zoeken'); -} -if (!defined('_ADD_CC')) { - define('_ADD_CC', 'In kopie toevoegen'); -} -if (!defined('_TO_DEST')) { - define('_TO_DEST', 'Ontvanger'); -} -if (!defined('_NO_DIFF_LIST_ASSOCIATED')) { - define('_NO_DIFF_LIST_ASSOCIATED', 'Geen verdelingslijst'); -} -if (!defined('_PRINCIPAL_RECIPIENT')) { - define('_PRINCIPAL_RECIPIENT', 'Hoofdbestemmeling'); -} -if (!defined('_UPDATE_LIST_DIFF_IN_DETAILS')) { - define('_UPDATE_LIST_DIFF_IN_DETAILS', 'De verdelingslijst vanuit de detailpagina’s updaten'); -} -if (!defined('_UPDATE_LIST_DIFF')) { - define('_UPDATE_LIST_DIFF', 'De verdelingslijst wijzigen'); -} -if (!defined('_DIFF_LIST_COPY')) { - define('_DIFF_LIST_COPY', 'Verdelingslijst'); -} -if (!defined('_DIFF_LIST')) { - define('_DIFF_LIST', 'Verdelingslijst'); -} -if (!defined('_NO_USER')) { - define('_NO_USER', 'Geen gebruiker'); -} -if (!defined('_MUST_CHOOSE_DEST')) { - define('_MUST_CHOOSE_DEST', 'U moet minstens één ontvanger selecteren'); -} -if (!defined('_ENTITIES__DEL')) { - define('_ENTITIES__DEL', 'Verwijderen'); -} -if (!defined('_ENTITY_DELETION')) { - define('_ENTITY_DELETION', 'Verwijdering van de eenheid'); -} -if (!defined('_THERE_ARE_NOW')) { - define('_THERE_ARE_NOW', 'Er zijn momenteel'); -} -if (!defined('_DOC_IN_THE_DEPARTMENT')) { - define('_DOC_IN_THE_DEPARTMENT', 'Brieven aan de eenheid gekoppeld'); -} -if (!defined('_DEL_AND_REAFFECT')) { - define('_DEL_AND_REAFFECT', 'Verwijderen EN opnieuw toewijzen'); -} -if (!defined('_NO_REAFFECT')) { - define('_NO_REAFFECT', 'Niet opnieuw toewijzen'); -} -if (!defined('_THE_ENTITY')) { - define('_THE_ENTITY', 'De eenheid'); -} -if (!defined('_USERS_LINKED_TO')) { - define('_USERS_LINKED_TO', 'gebruiker(s) aan de eenheid gekoppeld'); -} -if (!defined('_ENTITY_MANDATORY_FOR_REDIRECTION')) { - define('_ENTITY_MANDATORY_FOR_REDIRECTION', 'Eenheid verplicht om opnieuw toe te wijzen'); -} -if (!defined('_WARNING_MESSAGE_DEL_ENTITY')) { - define('_WARNING_MESSAGE_DEL_ENTITY', 'Waarschuwing :<br> De verwijdering van een eenheid leidt ertoe dat de brieven en de gebruikers aan een nieuwe eenheid worden toegewezen maar wijst eveneens de brieven in afwachting van verwerking, de modellen van de verdelingslijst en de antwoordmodellen toe aan de vervangingseenheid.'); -} -if (!defined('_HELP_KEYWORD1')) { - define('_HELP_KEYWORD1', 'Alle eenheden die aan de verbonden gebruiker gekoppeld zijn Bevat geen subeenheden'); -} -if (!defined('_HELP_KEYWORD2')) { - define('_HELP_KEYWORD2', 'primaire eenheid van de verbonden gebruiker'); -} -if (!defined('_HELP_KEYWORD3')) { - define('_HELP_KEYWORD3', 'Subeenheden van de argumentenlijst die ook @my_entities of @my_primary_entity kan zijn'); -} -if (!defined('_HELP_KEYWORD4')) { - define('_HELP_KEYWORD4', 'bovenliggende eenheid van de eenheid in het argument'); -} -if (!defined('_HELP_KEYWORD5')) { - define('_HELP_KEYWORD5', 'alle eenheden van hetzelfde niveau van de eenheid in het argument'); -} -if (!defined('_HELP_KEYWORD6')) { - define('_HELP_KEYWORD6', 'alle (actieve) eenheden'); -} -if (!defined('_HELP_KEYWORD7')) { - define('_HELP_KEYWORD7', 'subeenheden die direct onder (n-1) de in het argument gegeven eenheden liggen'); -} -if (!defined('_HELP_KEYWORD8')) { - define('_HELP_KEYWORD8', 'onderliggende eenheden van de in het argument gegeven eenheid tot op de diepte die in het tweede argument gevraagd wordt (of de vierkantswortel indien er geen enkel argument 2 geleverd werd)'); -} -if (!defined('_HELP_KEYWORD9')) { - define('_HELP_KEYWORD9', 'alle eenheden van het type dat in het argument voorkomt'); -} -if (!defined('_HELP_KEYWORDS')) { - define('_HELP_KEYWORDS', 'Hulp voor sleutelwoorden'); -} -if (!defined('_HELP_KEYWORD_EXEMPLE_TITLE')) { - define('_HELP_KEYWORD_EXEMPLE_TITLE', 'Voorbeeld in de bepaling van de veiligheid van een groep (where clause): toegangen op de assets met betrekking tot de belangrijkste dienst waartoe de verbonden gebruiker of de subdiensten van deze dienst behoren.'); -} -if (!defined('_HELP_KEYWORD_EXEMPLE')) { - define('_HELP_KEYWORD_EXEMPLE', 'where_clause : (DESTINATION = @my_primary_entity or DESTINATION in (@subentities[@my_primary_entity]))'); -} -if (!defined('_HELP_BY_ENTITY')) { - define('_HELP_BY_ENTITY', 'Sleutelwoorden van de Eenhedenmodule'); -} -if (!defined('_BASKET_REDIRECTIONS_OCCURS_LINKED_TO')) { - define('_BASKET_REDIRECTIONS_OCCURS_LINKED_TO', 'geval(len) van omleiding(en) van aan de eenheid gekoppeld(e) bakje(s)'); -} -if (!defined('_TEMPLATES_LINKED_TO')) { - define('_TEMPLATES_LINKED_TO', 'aan de eenheid gekoppeld(e) antwoordmodel(len)'); -} -if (!defined('_LISTISTANCES_OCCURS_LINKED_TO')) { - define('_LISTISTANCES_OCCURS_LINKED_TO', 'geval(len) van te verwerken brief(ven) of in kopie aan de eenheid gekoppeld'); -} -if (!defined('_LISTMODELS_OCCURS_LINKED_TO')) { - define('_LISTMODELS_OCCURS_LINKED_TO', 'verdelingsmodel gekoppeld aan de eenheid'); -} -if (!defined('_CHOOSE_REPLACEMENT_DEPARTMENT')) { - define('_CHOOSE_REPLACEMENT_DEPARTMENT', 'Kies een vervangende dienst'); -} -if (!defined('_NO_DATA_MESSAGE')) { - define('_NO_DATA_MESSAGE', 'Onvoldoende gegevens'); -} -if (!defined('_WRONG_DATE_FORMAT')) { - define('_WRONG_DATE_FORMAT', 'Fout datumformaat'); -} -if (!defined('_ALL_LIST')) { - define('_ALL_LIST', 'De volledige lijst weergeven'); -} -if (!defined('_DEST_OR_COPY')) { - define('_DEST_OR_COPY', 'Ontvanger'); -} -if (!defined('_SUBMIT')) { - define('_SUBMIT', 'Valideren'); -} -if (!defined('_CANCEL')) { - define('_CANCEL', 'Annuleren'); -} -if (!defined('_DIFFLIST_TYPE_ROLES')) { - define('_DIFFLIST_TYPE_ROLES', 'Beschikbare rollen'); -} -if (!defined('_NO_AVAILABLE_ROLE')) { - define('_NO_AVAILABLE_ROLE', 'Geen rol beschikbaar'); -} -if (!defined('_ALL_DIFFLIST_TYPES')) { - define('_ALL_DIFFLIST_TYPES', 'Alle types'); -} -if (!defined('_DIFFLIST_TYPES_DESC')) { - define('_DIFFLIST_TYPES_DESC', 'Types verdelingslijsten'); -} -if (!defined('_DIFFLIST_TYPES')) { - define('_DIFFLIST_TYPES', 'Types verdelingslijsten'); -} -if (!defined('_DIFFLIST_TYPE')) { - define('_DIFFLIST_TYPE', 'Lijsttype(s)'); -} -if (!defined('_ADD_DIFFLIST_TYPE')) { - define('_ADD_DIFFLIST_TYPE', 'Een type toevoegen'); -} -if (!defined('_DIFFLIST_TYPE_ID')) { - define('_DIFFLIST_TYPE_ID', 'Gebruikersnaam'); -} -if (!defined('_DIFFLIST_TYPE_LABEL')) { - define('_DIFFLIST_TYPE_LABEL', 'Beschrijving'); -} -if (!defined('_ALLOW_ENTITIES')) { - define('_ALLOW_ENTITIES', 'Diensten toestaan'); -} -if (!defined('_ALL_LISTMODELS')) { - define('_ALL_LISTMODELS', 'Alle lijsten'); -} -if (!defined('_LISTMODELS_DESC')) { - define('_LISTMODELS_DESC', 'Modellen van verdelingslijsten van brieven en mappen'); -} -if (!defined('_LISTMODELS')) { - define('_LISTMODELS', 'Modellen verdelingslijsten'); -} -if (!defined('_MANAGE_LISTMODELS_DESC')) { - define('_MANAGE_LISTMODELS_DESC', 'De modellen van de berichten- en goedkeuringscircuits beheren die in een brief gebruikt kunnen worden.'); -} -if (!defined('_LISTMODEL')) { - define('_LISTMODEL', 'Lijstmodel(len)'); -} -if (!defined('_ADD_LISTMODEL')) { - define('_ADD_LISTMODEL', 'Nieuw model'); -} -if (!defined('_ADMIN_LISTMODEL')) { - define('_ADMIN_LISTMODEL', 'Model van verdelingslijst'); -} -if (!defined('_ADMIN_LISTMODEL_TITLE')) { - define('_ADMIN_LISTMODEL_TITLE', 'Identificatie van het lijstmodel:'); -} -if (!defined('_OBJECT_TYPE')) { - define('_OBJECT_TYPE', 'Type van het lijstmodel'); -} -if (!defined('_SELECT_OBJECT_TYPE')) { - define('_SELECT_OBJECT_TYPE', 'Selecteer een type...'); -} -if (!defined('_SELECT_OBJECT_ID')) { - define('_SELECT_OBJECT_ID', 'Selecteer een link...'); -} -if (!defined('_USER_DEFINED_ID')) { - define('_USER_DEFINED_ID', 'Vrij'); -} -if (!defined('_ALL_OBJECTS_ARE_LINKED')) { - define('_ALL_OBJECTS_ARE_LINKED', 'Alle lijsten zijn reeds bepaald'); -} -if (!defined('_SELECT_OBJECT_TYPE_AND_ID')) { - define('_SELECT_OBJECT_TYPE_AND_ID', 'U moet een lijsttype en een gebruikersnaam specificeren!'); -} -if (!defined('_SAVE_LISTMODEL')) { - define('_SAVE_LISTMODEL', 'Valideren'); -} -if (!defined('_CONFIRM_LISTMODEL_SAVE')) { - define('_CONFIRM_LISTMODEL_SAVE', 'De lijst opslaan?'); -} -if (!defined('_ENTER_DESCRIPTION')) { - define('_ENTER_DESCRIPTION', 'Verplichte beschrijving'); -} -if (!defined('_ENTER_TITLE')) { - define('_ENTER_TITLE', 'Verplichte titel'); -} -if (!defined('_ADMIN_DIFFLIST_TYPES')) { - define('_ADMIN_DIFFLIST_TYPES', 'Types verdelingslijst (Administratie)'); -} -if (!defined('_ADMIN_DIFFLIST_TYPES_DESC')) { - define('_ADMIN_DIFFLIST_TYPES_DESC', 'De verschillende types verdelingslijst beheren'); -} -if (!defined('_ADMIN_LISTMODELS')) { - define('_ADMIN_LISTMODELS', 'Verdelingsmodel (Administratie)'); -} -if (!defined('_ADMIN_LISTMODELS_DESC')) { - define('_ADMIN_LISTMODELS_DESC', 'De verschillende verdelingsmodellen beheren'); -} -if (!defined('_STANDARD')) { - define('_STANDARD', 'Standaard'); -} -if (!defined('_VISIBLE')) { - define('_VISIBLE', 'Actief'); -} -if (!defined('_NOT_VISIBLE')) { - define('_NOT_VISIBLE', 'Niet actief'); -} -if (!defined('_TARGET_STATUS')) { - define('_TARGET_STATUS', 'Eindstatus bij de bevestiging van de fase'); -} -if (!defined('_TARGET_ROLE')) { - define('_TARGET_ROLE', 'Rol die vooruit moet gaan in de workflow'); -} -if (!defined('_NO_FILTER')) { - define('_NO_FILTER', 'De filters wissen'); -} -if (!defined('_AUTO_FILTER')) { - define('_AUTO_FILTER', 'Voorgestelde lijst'); -} -if (!defined('_REDIRECT_NOTE')) { - define('_REDIRECT_NOTE', 'Woord'); -} -if (!defined('_STORE_DIFF_LIST')) { - define('_STORE_DIFF_LIST', 'De verdelingslijst bewaren'); -} -if (!defined('_DIFF_LIST_STORED')) { - define('_DIFF_LIST_STORED', 'Bewaarde verdelingslijst'); -} -if (!defined('_PRINT_SEPS')) { - define('_PRINT_SEPS', 'Afdrukken van de separatoren'); -} -if (!defined('_CHOOSE_ENTITIES')) { - define('_CHOOSE_ENTITIES', 'Kies de diensten'); -} -if (!defined('_DEL_USER_LISTDIFF')) { - define('_DEL_USER_LISTDIFF', 'De gebruiker van de verdelingslijst halen'); -} -if (!defined('_DEL_ENTITY_LISTDIFF')) { - define('_DEL_ENTITY_LISTDIFF', 'De eenheid van de verdelingslijst halen'); -} -if (!defined('_ADD_USER_LISTDIFF')) { - define('_ADD_USER_LISTDIFF', 'De gebruiker aan de verdelingslijst toevoegen'); -} -if (!defined('_ADD_ENTITY_LISTDIFF')) { - define('_ADD_ENTITY_LISTDIFF', 'De eenheid aan de verdelingslijst toevoegen'); -} -if (!defined('_ARCHIVAL_AGREEMENT')) { - define('_ARCHIVAL_AGREEMENT', 'Archiveringsconventie'); -} -if (!defined('_ARCHIVAL_AGENCY')) { - define('_ARCHIVAL_AGENCY', 'Archiveringsdienst'); -} -if (!defined('_GO_TO_CC')) { - define('_GO_TO_CC', 'De gebruiker in kopie zetten'); -} -if (!defined('_GO_TO_DEST')) { - define('_GO_TO_DEST', 'De gebruiker als ontvanger zetten'); -} -if (!defined('_UP_USER_ONE_ROW')) { - define('_UP_USER_ONE_ROW', 'De gebruiker een rang verhogen'); -} -if (!defined('_DOWN_USER_ONE_ROW')) { - define('_DOWN_USER_ONE_ROW', 'De gebruiker een rang verlagen'); -} -if (!defined('_UP_ENTITY_ONE_ROW')) { - define('_UP_ENTITY_ONE_ROW', 'De eenheid een rang verhogen'); -} -if (!defined('_DOWN_ENTITY_ONE_ROW')) { - define('_DOWN_ENTITY_ONE_ROW', 'De eenheid een rang verlagen'); -} -if (!defined('_TO_USERS_OF_ENTITIES')) { - define('_TO_USERS_OF_ENTITIES', 'Naar gebruikers van de eenheden'); -} -if (!defined('_INDEXING_ENTITIES')) { - define('_INDEXING_ENTITIES', 'Indexeren voor de eenheden'); -} -if (!defined('_SEARCH_DIFF_LIST')) { - define('_SEARCH_DIFF_LIST', 'Een eenheid of een gebruiker zoeken'); -} -if (!defined('_HELP_KEYWORD_EXEMPLE_TITLE')) { - define('_HELP_KEYWORD_EXEMPLE_TITLE', 'Voorbeeld in de bepaling van de veiligheid van een groep (where clause): toegangen op de assets met betrekking tot de belangrijkste dienst waartoe de verbonden gebruiker of de subeenheden van deze dienst behoren.'); -} -if (!defined('_CHOOSE_REPLACEMENT_DEPARTMENT')) { - define('_CHOOSE_REPLACEMENT_DEPARTMENT', 'Kies een vervangende eenheid'); -} -if (!defined('_ALLOW_ENTITIES')) { - define('_ALLOW_ENTITIES', 'De eenheden toelaten'); -} -if (!defined('_CHOOSE_ENTITIES')) { - define('_CHOOSE_ENTITIES', 'Kies de eenheden'); -} -if (!defined('_ARCHIVAL_AGENCY')) { - define('_ARCHIVAL_AGENCY', 'Archiefeenheid'); -} -if (!defined('_TYPE_ID_HISTORY')) { - define('_TYPE_ID_HISTORY', 'Gebruikersnaam van de geschiedenis'); -} -if (!defined('_RES_ID')) { - define('_RES_ID', 'RES ID'); -} -if (!defined('_UPDATED_BY_USER')) { - define('_UPDATED_BY_USER', 'Bijgewerkt door'); -} diff --git a/modules/entities/loadDiffList.php b/modules/entities/loadDiffList.php deleted file mode 100755 index 04ddc1846fb..00000000000 --- a/modules/entities/loadDiffList.php +++ /dev/null @@ -1,72 +0,0 @@ -<?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. -* -*/ - -require_once('core/class/class_core_tools.php'); -$Core_Tools = new core_tools; -$Core_Tools->load_lang(); - -$status = 0; - -if (isset($_REQUEST['typeList'])) { - $typeList = $_REQUEST['typeList']; -} else { - $typeList = 'entity_id'; -} - -if (isset($_REQUEST['showStatus'])) { - $showStatus = true; -} else { - $showStatus = false; -} - -//VISA WORKFLOW -if ($typeList=='VISA_CIRCUIT') { - $visaWorkflow = \SrcCore\models\DatabaseModel::select([ - 'select' => ['u.firstname', 'u.lastname', 'l.process_date', 'l.process_comment', 'l.signatory', 'l.requested_signature'], - 'table' => ['listinstance l, users u'], - 'where' => ['l.res_id = ?', 'l.difflist_type = ?', 'u.user_id = l.item_id'], - 'data' => [$_REQUEST['res_id'], 'VISA_CIRCUIT'], - 'order_by' => ['l.listinstance_id asc'] - ]); - - if (!empty($visaWorkflow)) { - $return = '<table style="width:100%;margin-top: 5px;">'; - $return .= '<tr><td class="sstit visaWorkFlowBasket">'._ADMIN_USERS.'</td>'; - $return .= '<td class="sstit visaWorkFlowBasket">'._PROCESS_DATE.'</td></tr>'; - foreach ($visaWorkflow as $key => $value) { - $signatory = ''; - if ($value['signatory'] || ($value['requested_signature'] && empty($value['process_date']))) { - $signatory = ' ('._SIGNATORY.')'; - } else { - $signatory = ' ('._VISA_USER_SEARCH_MIN.')'; - } - $nb = $key+1; - $return .= '<tr><td style="width:50%;padding: 8px 0px 7px 10px;">'. $nb . '. ' .$value['firstname']. ' ' . $value['lastname'] . $signatory.'</td>'; - $return .= '<td style="width:50%; text-align:center;">'.functions::format_date_db($value['process_date'], true, '', true) . '</td></tr>'; - } - $return .= '</table>'; - } else { - $return .= '<div style="font-style:italic;text-align:center;color:#ea0000;margin:10px;">'._DIFF_LIST.' '._IS_EMPTY.'</div>'; - } -} else { - require_once('modules/entities/class/class_manage_listdiff.php'); - $diffListObj = new diffusion_list(); - $difflist = $diffListObj->get_listinstance($_REQUEST['res_id'], false, $typeList); - - # Include display of list - $roles = $diffListObj->list_difflist_roles(); - - ob_start(); - require_once 'modules/entities/difflist_display.php'; - $return .= str_replace(array("\r", "\n", "\t"), array("", "", ""), ob_get_contents()); - ob_end_clean(); -} - -echo "{status : " . $status . ", toShow : '" . addslashes($return) . "'}"; -exit(); diff --git a/modules/entities/loadDiffListHistory.php b/modules/entities/loadDiffListHistory.php deleted file mode 100755 index 2f0bf373479..00000000000 --- a/modules/entities/loadDiffListHistory.php +++ /dev/null @@ -1,173 +0,0 @@ -<?php - -$core = new core_tools(); -$core->test_user(); -$core->load_lang(); - -require_once('modules/entities/class/class_manage_listdiff.php'); -$diff_list = new diffusion_list(); -$db = new Database(); - -$roles = $diff_list->list_difflist_roles(); - -$listinstance = array(); - -# Load header -$query = - "SELECT distinct coll_id, res_id, difflist_type" - . " FROM listinstance_history_details WHERE listinstance_history_id = ? GROUP BY coll_id, res_id, difflist_type"; - -$stmt = $db->query($query, array($_REQUEST['listinstance_history_id'])); - -$listinstance = $stmt->fetch(); -if ($listinstance['difflist_type'] == "") { - $listinstance['difflist_type'] = 'entity_id'; -} - -# OTHER ROLES USERS -#********************************************************************** -$stmt = $db->query( - "select l.item_id, u.firstname, u.lastname, e.entity_id, " - . "e.entity_label, l.visible, l.viewed, l.item_mode, l.difflist_type from listinstance_history_details l, " . USERS_TABLE - . " u, " . ENT_ENTITIES . " e, " . ENT_USERS_ENTITIES - . " ue where l.listinstance_history_id = ?" - . " and l.item_type = 'user_id' and l.item_id = u.user_id " - . " and l.item_id = ue.user_id and ue.user_id=u.user_id " - . " and e.entity_id = ue.entity_id" - . " and ue.primary_entity = 'Y' order by l.sequence ", - array($_REQUEST['listinstance_history_id']) -); -//$diff_list->show(); -while ($res = $stmt->fetchObject()) { - if ($res->item_mode == 'cc') { - $role_id = 'copy'; - } else { - $role_id = $res->item_mode; - } - - if (!isset($listinstance[$role_id]['users'])) { - $listinstance[$role_id]['users'] = array(); - } - array_push( - $listinstance[$role_id]['users'], - array( - 'user_id' => functions::show_string($res->item_id), - 'lastname' => functions::show_string($res->lastname), - 'firstname' => functions::show_string($res->firstname), - 'entity_id' => functions::show_string($res->entity_id), - 'entity_label' => functions::show_string($res->entity_label), - 'visible' => functions::show_string($res->visible), - 'viewed' => functions::show_string($res->viewed), - 'difflist_type' => functions::show_string($res->difflist_type) - ) - ); -} - -# OTHER ROLES ENTITIES -#********************************************************************** -$stmt = $db->query( - "select l.item_id, e.entity_label, l.visible, l.viewed, l.item_mode, l.difflist_type from listinstance_history_details l, " - . ENT_ENTITIES . " e where l.listinstance_history_id = ?" - . " and l.item_type = 'entity_id' and l.item_id = e.entity_id " - . "order by l.sequence ", - array($_REQUEST['listinstance_history_id']) -); - -while ($res = $stmt->fetchObject()) { - if ($res->item_mode == 'cc') { - $role_id = 'copy'; - } else { - $role_id = $res->item_mode; - } - - if (!isset($listinstance[$role_id]['entities'])) { - $listinstance[$role_id]['entities'] = array(); - } - array_push( - $listinstance[$role_id]['entities'], - array( - 'entity_id' => functions::show_string($res->item_id), - 'entity_label' => functions::show_string($res->entity_label), - 'visible' => functions::show_string($res->visible), - 'viewed' => functions::show_string($res->viewed), - 'difflist_type' => functions::show_string($res->difflist_type) - ) - ); -} - -$difflist = $listinstance; - -// $diff_list->get_difflist_type($listinstance['difflist_type']); - -$return = ''; - -foreach ($roles as $role_id => $role_label) { - if ($role_id == 'dest' && $onlyCC) { - continue; - } - if ((!empty($difflist[$role_id]['users']) && count($difflist[$role_id]['users']) > 0) || (!empty($difflist[$role_id]['entities']) && count($difflist[$role_id]['entities']) > 0)) { - $return .= '<h3 class="sstit">'.$role_label.'</h3>'; - if (count($difflist[$role_id]['users']) > 0) { - $return .= '<table cellpadding="0" cellspacing="0" border="0" class="listingsmall liste_diff spec" style="width:100%;margin:0;">'; - $color = ' class="col"'; - for ($i=0, $l=count($difflist[$role_id]['users']); - $i<$l; - $i++ - ) { - $user = $difflist[$role_id]['users'][$i]; - - if ($color == ' class="col"') { - $color = ' '; - } else { - $color = ' class="col"'; - } - $return .= '<tr '. $color.' >'; - $return .= '<td style="width:15%;text-align:center;">'; - $return .= '<i class="fa fa-user fa-2x" title="'._USER.' '.$role_label.'"></i>'; - $return .= '</td>'; - $return .= '<td style="width:10%;">'; - if ($user['visible'] == 'Y') { - $return .= '<i class="fa fa-check fa-2x" title="'._VISIBLE.'"></i>'; - } else { - $return .= '<i class="fa fa-times fa-2x" title="'._NOT_VISIBLE.'"></i>'; - } - $return .= '</td>'; - $return .= '<td style="width:37%;">'. $user['lastname'] . ' ' . $user['firstname'].'</td>'; - $return .= '<td style="width:38%;">'. $user['entity_label'].'</td>'; - $return .= '</tr>'; - } - $return .= '</table>'; - } - if (!empty($difflist[$role_id]['entities']) && count($difflist[$role_id]['entities']) > 0) { - $return .= '<table cellpadding="0" cellspacing="0" border="0" class="listingsmall liste_diff spec" style="width:100%;margin:0;">'; - $color = ' class="col"'; - for ($i=0, $l=count($difflist[$role_id]['entities']); $i<$l; $i++) { - $entity = $difflist[$role_id]['entities'][$i]; - if ($color == ' class="col"') { - $color = ''; - } else { - $color = ' class="col"'; - } - $return .= '<tr'. $color.'>'; - $return .= '<td style="width:15%;text-align:center;">'; - $return .= '<i class="fa fa-sitemap fa-2x" title="'._ENTITY . ' ' . $role_label.'" ></i>'; - $return .= '</td>'; - $return .= '<td style="width:10%;">'; - if ($entity['visible'] == 'Y') { - $return .= '<i class="fa fa-check fa-2x" title="'._VISIBLE.'"></i>'; - } else { - $return .= '<i class="fa fa-times fa-2x" title="'._NOT_VISIBLE.'"></i>'; - } - $return .= '</td>'; - $return .= '<td style="width:37%;">'. $entity['entity_id'].'</td>'; - $return .= '<td style="width:38%;">'. $entity['entity_label'].'</td>'; - $return .= '</tr>'; - } - $return .= '</table>'; - } - $return .= '<br/>'; - } -} - -echo "{status : 0, toShow : '" . addslashes($return) . "'}"; -exit(); diff --git a/modules/entities/load_listinstance.php b/modules/entities/load_listinstance.php deleted file mode 100755 index 1d675de9a87..00000000000 --- a/modules/entities/load_listinstance.php +++ /dev/null @@ -1,161 +0,0 @@ -<?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. -* -*/ - -/** -* File : load_listinstance.php -* -* @license GPL v3 -* @author dev <dev@maarch.org> -*/ - -require_once 'modules/entities/class/class_manage_listdiff.php'; - -$db = new Database(); -$core = new core_tools(); -$core->load_lang(); -$diffList = new diffusion_list(); -$origin = $_REQUEST['origin']; -$category = $_REQUEST['category']; - -if (empty($_REQUEST['origin'])) { - $_SESSION['error'] = _ORIGIN . ' ' . _UNKNOWN; - echo "{status : 2, error_txt : '" . addslashes($_SESSION['error']) . "'}"; - exit(); -} - -if ((! isset($_REQUEST['objectType']) || empty($_REQUEST['objectType'])) && $_REQUEST['load_from_model'] == 'true') { - if ($_REQUEST['mandatory'] <> 'none') { - $_SESSION['error'] = _OBJECT_TYPE . ' ' . _IS_EMPTY; - } - $_SESSION[$origin]['diff_list'] = array(); - echo "{status : 1, error_txt : '" . addslashes($_SESSION['error']) . "'}"; - exit(); -} - -if ((! isset($_REQUEST['objectId']) || empty($_REQUEST['objectId'])) - && $_REQUEST['load_from_model'] == 'true' -) { - // if ($_REQUEST['mandatory'] <> 'none') { - // $_SESSION['error'] = _ENTITY_ID . ' ' . _IS_EMPTY; - // } - $_SESSION[$origin]['diff_list'] = array(); - echo "{status : 1, error_txt : '" . addslashes($_SESSION['error']) . "'}"; - exit(); -} - -if (empty($_REQUEST['collId']) && $_REQUEST['load_from_model'] == 'true') { - $_SESSION['error'] = _COLL_ID . ' ' . _IS_EMPTY; - echo "{status : 2, error_txt : '" . addslashes($_SESSION['error']) . "'}"; - exit(); -} - -$specific_role = $_REQUEST['specific_role']; - -$onlyCC = false; - -if ((!$core->test_service('edit_recipient_in_process', 'entities', false) && $_REQUEST['origin'] == 'process') - || (!$core->test_service('edit_recipient_outside_process', 'entities', false) && ($_REQUEST['origin'] == 'indexing' || $_REQUEST['origin'] == 'redirect'))) { - $onlyCC = true; -} - -// if($_REQUEST['origin'] == 'indexing'){ -// $onlyCC = false; -// } - -$objectType = $_REQUEST['objectType']; -$objectId = $_REQUEST['objectId']; - -// Get listmodel_parameters -$_SESSION[$origin]['difflist_type'] = $diffList->get_difflist_type($objectType); - -if ($objectId <> '') { - $_SESSION[$origin]['difflist_object']['object_id'] = $objectId; - if ($objectType == 'entity_id') { - $query = "SELECT entity_label FROM entities WHERE entity_id = ?"; - $stmt = $db->query($query, array($objectId)); - $res = $stmt->fetchObject(); - if ($res->entity_label <> '') { - $_SESSION[$origin]['difflist_object']['object_label'] = $res->entity_label; - } - } -} - -if (($specific_role <> null || $specific_role <> '') && empty($_SESSION[$origin]['diff_list'])) { - $diff_list = new diffusion_list(); - $res_id = $_SESSION['doc_id']; - $_SESSION[$origin]['diff_list'] = $diff_list->get_listinstance($res_id); -} - -$content = ''; - -if (!empty($_SESSION[$origin]['diff_list'])) { - // Si on redirige en masse plusieurs courriers, on ne récupère pas les roles persistent - if (empty($_SESSION['stockCheckbox']) || count($_SESSION['stockCheckbox']) == 1) { - if (!empty($_SESSION['stockCheckbox']) && count($_SESSION['stockCheckbox']) == 1) { - // Cas où on redirige en masse un courrier - $res_id = $_SESSION['stockCheckbox'][0]; - } else { - $res_id = $_SESSION['doc_id']; - } - $_SESSION[$origin]['diff_list'] = $diffList->list_difflist_roles_to_keep($res_id, $_REQUEST['collId'], $objectType, $_SESSION[$origin]['diff_list']); - } - - $roles = $diffList->list_difflist_roles(); - $difflist = $_SESSION[$origin]['diff_list']; - - // Get content from buffer of difflist_display - ob_start(); - require_once 'modules/entities/difflist_display.php'; - $content .= str_replace(array("\r", "\n", "\t"), array("", "", ""), ob_get_contents()); - ob_end_clean(); - - $labelButton = _UPDATE_LIST_DIFF; - $arg = '&mode=up'; -} else { - $content .= '<p>' . _NO_DIFF_LIST_ASSOCIATED . '</p>'; - $labelButton = _CREATE_LIST; - $arg = '&mode=add'; -} -if ($onlyCC) { - $arg .= '&only_cc'; -} - -if ($origin != 'process' && $origin != 'details') { - $content_standard = '<center><b>' . _DIFF_LIST . '</b> | '; - $content_standard .= '<span class="button" >'; - $content_standard .= '<small><input type="button" style="margin-top:0px;" class="button" title="'.$labelButton.'" value="'.$labelButton.'" ' - . 'onclick="window.open(\''; - $content_standard .= $_SESSION['config']['businessappurl'] . 'index.php?display=true'; - if ($specific_role <> null) { - $content_standard .= '&specific_role='.$specific_role; - } - $content_standard .= '&module=entities&page=manage_listinstance&cat='.$category.'&origin=' . $origin . $arg - . '\', \'\', \'scrollbars=yes,menubar=no,toolbar=no,status=no,' - . 'resizable=yes,width=1280,height=800,location=no\');" /></small>'; - $content_standard .= '</span></center>'; - $full_content = $content_standard . $content; -} else if ($origin == 'details') { - $full_content =$content; -} else { - $content_standard .= '<div class="block" style="margin-top:-2px;">'; - $content_standard .= '<h2 style="text-align:center;">' . _DIFF_LIST . '</h2>'; - $content_standard .= '<div style="text-align:center;">'; - $content_standard .= '<input type="button" class="button" title="'.$labelButton.'" value="'.$labelButton.'" ' - . 'onclick="window.open(\'' - . $_SESSION['config']['businessappurl'] . 'index.php?display=true' - . '&module=entities&page=manage_listinstance&cat='.$category.'&origin=' . $origin . $arg - . '\', \'\', \'scrollbars=yes,menubar=no,toolbar=no,status=no,' - . 'resizable=yes,width=1280,height=800,location=no\');" />'; - $content_standard .= '</div>'; - - $full_content = $content_standard . $content. '</div>'; -} - -echo "{status : 0, div_content : '" . addslashes($full_content . '<br>') . "', div_content_action : '" . addslashes($content) . "'}"; -exit(); diff --git a/modules/entities/load_toolbarEntities.php b/modules/entities/load_toolbarEntities.php deleted file mode 100755 index 52404a90c3f..00000000000 --- a/modules/entities/load_toolbarEntities.php +++ /dev/null @@ -1,37 +0,0 @@ -<?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 load_toolbarEntities -* @author dev <dev@maarch.org> -* @ingroup entities -*/ -require_once "modules" . DIRECTORY_SEPARATOR . "entities" . DIRECTORY_SEPARATOR - . "class" . DIRECTORY_SEPARATOR . "class_manage_entities.php"; -$db = new Database(); -$ent = new entity(); - -$stmt = $db->query( - "SELECT distinct(r.destination) as entity_id, count(distinct r.res_id)" - . " as total, e.short_label FROM " - . " res_view_letterbox r left join entities" - . " e on e.entity_id = r.destination " .$_POST['where'] . " and entity_id <> ''" - . " group by e.short_label, r.destination order by e.short_label" -); -$options ='<option value="none" style="text-align:center;"></option>'; - -while ($res = $stmt->fetchObject()) { - - if ((isset($_SESSION['filters']['entity']['VALUE']) || isset($_SESSION['filters']['entity_subentities'])) - && $_SESSION['filters']['entity']['VALUE'] == $res->entity_id - ) $selected = 'selected="selected"'; else $selected = ''; - - if ($ent->is_user_in_entity($_SESSION['user']['UserId'], $res->entity_id)) $style = 'style="font-weight:bold;"'; else $style = ''; - - $options .='<option value="'.$res->entity_id.'" '.$selected.' '.$style.'>'.$res->short_label.' ('.$res->total.')</option>'; -} - -echo "{status : 0, resultContent : '" . addslashes($options) . "'}"; -exit(); diff --git a/modules/entities/manage_entities.php b/modules/entities/manage_entities.php deleted file mode 100755 index 06caed85c90..00000000000 --- a/modules/entities/manage_entities.php +++ /dev/null @@ -1,173 +0,0 @@ -<?php -/* -* -* Copyright 2008,2009 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/>. -* -* @author Cedric Ndoumba <dev@maarch.org> -* @author Claire Figueras <dev@maarch.org> -* @author Laurent Giovannoni <dev@maarch.org> -*/ - -$admin = new core_tools(); -$admin->test_admin('manage_entities', 'entities'); -$_SESSION['m_admin']= array(); -/****************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=manage_entities&module=entities'; -$page_label = _ENTITIES_LIST; -$page_id = "manage_entities"; -$admin->manage_location_bar($page_path, $page_label, $page_id, $init, $level); -/***********************************************************/ - -require_once("apps".DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_list_show.php"); -require_once('modules'.DIRECTORY_SEPARATOR.'entities'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_manage_entities.php'); -require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_request.php"); -require_once("modules/entities/entities_tables.php"); -$ent = new entity(); -$func = new functions(); -$request = new request; - -$what = ''; -$where = ''; -$arrayPDO = array(); - -if(isset($_REQUEST['what']) && !empty($_REQUEST['what'])) -{ - $what = $_REQUEST['what']; - $where = " lower(entity_label) like lower(?) "; - $arrayPDO = array_merge($arrayPDO, array($what."%")); -} - -if($_SESSION['user']['UserId'] != 'superadmin') -{ - $my_tab_entities_id = $ent->get_all_entities_id_user($_SESSION['user']['entities']); - if (count($my_tab_entities_id)>0) - { - if(isset($_REQUEST['what']) && !empty($_REQUEST['what'])) - { - $where.= ' and '; - } - - //we need all entities that are managed by connected user - $where.= '('.ENT_ENTITIES.'.entity_id in ('.join(',', $my_tab_entities_id).'))'; - } -} - -$list = new list_show(); -$order = 'asc'; -if(isset($_REQUEST['order']) && !empty($_REQUEST['order'])) -{ - $order = trim($_REQUEST['order']); -} -$field = 'entity_label'; -if(isset($_REQUEST['order_field']) && !empty($_REQUEST['order_field'])) -{ - $field = trim($_REQUEST['order_field']); -} - -$orderstr = $list->define_order($order, $field); - -$select[ENT_ENTITIES] = array(); -array_push($select[ENT_ENTITIES], "entity_id", "entity_label", "entity_type", "enabled"); - -$tab = $request->PDOselect($select, $where, $arrayPDO, $orderstr, $_SESSION['config']['databasetype']); -//$request->show(); - -for ($i=0;$i<count($tab);$i++) -{ - for ($j=0;$j<count($tab[$i]);$j++) - { - foreach(array_keys($tab[$i][$j]) as $value) - { - if($tab[$i][$j][$value]=="entity_id") - { - $tab[$i][$j]["entity_id"]=$tab[$i][$j]['value']; - $tab[$i][$j]["label"]= _ID; - $tab[$i][$j]["size"]="18"; - $tab[$i][$j]["label_align"]="left"; - $tab[$i][$j]["align"]="left"; - $tab[$i][$j]["order"]=$tab[$i][$j][$value]; - $tab[$i][$j]["valign"]="bottom"; - $tab[$i][$j]["show"]=true; - } - - if($tab[$i][$j][$value]=="entity_label") - { - $tab[$i][$j]['value']=$request->show_string($tab[$i][$j]['value']); - $tab[$i][$j]["entity_label"]=$tab[$i][$j]['value']; - $tab[$i][$j]["label"]=_DESC; - $tab[$i][$j]["size"]="25"; - $tab[$i][$j]["label_align"]="left"; - $tab[$i][$j]["align"]="left"; - $tab[$i][$j]["order"]=$tab[$i][$j][$value]; - $tab[$i][$j]["valign"]="bottom"; - $tab[$i][$j]["show"]=true; - } - - if($tab[$i][$j][$value]=="entity_type") - { - $tab[$i][$j]['value']=$request->show_string($tab[$i][$j]['value']); - $tab[$i][$j]["entity_type"]=$tab[$i][$j]['value']; - $tab[$i][$j]["label"]=_TYPE; - $tab[$i][$j]["size"]="15"; - $tab[$i][$j]["label_align"]="left"; - $tab[$i][$j]["align"]="left"; - $tab[$i][$j]["order"]=$tab[$i][$j][$value]; - $tab[$i][$j]["valign"]="bottom"; - $tab[$i][$j]["show"]=true; - } - - if($tab[$i][$j][$value]=="enabled") - { - $tab[$i][$j]["enabled"]=$tab[$i][$j]['value']; - $tab[$i][$j]["label"]=_STATUS; - $tab[$i][$j]["size"]="10"; - $tab[$i][$j]["label_align"]="center"; - $tab[$i][$j]["align"]="center"; - $tab[$i][$j]["valign"]="bottom"; - $tab[$i][$j]["show"]=true; - } - } - } -} - -$page_name = "manage_entities"; -$page_name_up = "entity_up"; -$page_name_del = "entity_del"; -$page_name_val = "entity_allow"; -$page_name_ban = "entity_ban"; -$page_name_add = "entity_add"; -$label_add = _ENTITY_ADDITION; -$_SESSION['m_admin']['init'] = true; - -$title = _ENTITIES_LIST." : ".$i." "._ENTITIES; -$autoCompletionArray = array(); -$autoCompletionArray["list_script_url"] = $_SESSION['config']['businessappurl'].'index.php?display=true&module=entities&page=entities_list_by_label'; -$autoCompletionArray["number_to_begin"] = 1; - -$list->admin_list($tab, $i, $title, 'entity_id','manage_entities','entities', 'entity_id', true, $page_name_up, $page_name_val, $page_name_ban, $page_name_del, $page_name_add, $label_add, false, false, _ALL_ENTITIES, _ENTITY, 'sitemap', true, true, false, true, "", true, $autoCompletionArray, false, true); -?> diff --git a/modules/entities/manage_listinstance.php b/modules/entities/manage_listinstance.php deleted file mode 100755 index 169506ce38f..00000000000 --- a/modules/entities/manage_listinstance.php +++ /dev/null @@ -1,1222 +0,0 @@ -<?php -/** -* File : manage_listinstance.php. -* -* Pop up used to create and modify diffusion lists instances -* -* @version 1.0 -* -* @since 06/2006 -* -* @license GPL -* @author Claire Figueras <dev@maarch.org> -* @author Cyril Vazquez <dev@maarch.org> -*/ -require_once 'core/class/usergroups_controler.php'; -require_once 'modules/entities/class/class_manage_listdiff.php'; -require_once 'modules/entities/entities_tables.php'; -require_once 'core/core_tables.php'; - -$core_tools = new core_tools(); -$core_tools->load_lang(); -$func = new functions(); - -$db = new Database(); - -$difflist = new diffusion_list(); -$usergroups_controler = new usergroups_controler(); - -// ***************************************************************************** -// Manage request paramaters -// ***************************************************************************** -// Origin -$origin = $_REQUEST['origin']; - -// Action ? -if (isset($_GET['action'])) { - $action = $_GET['action']; -} else { - $action = false; -} - -// Id ? -if (isset($_GET['id'])) { - $id = $_GET['id']; -} else { - $id = false; -} - -// Category ? -if (isset($_GET['cat'])) { - $cat = $_GET['cat']; -} else { - $cat = false; -} - -// Rank for remove/move ? -if (isset($_GET['rank'])) { - $rank = $_GET['rank']; -} else { - $rank = false; -} - -// Mode (dest/copy or custom copy mode) -if (isset($_GET['role']) && !empty($_GET['role'])) { - $role_id = $_GET['role']; -} else { - $role_id = false; -} - -// Id ? -if (isset($_GET['specific_role'])) { - $specific_role = $_GET['specific_role']; -} else { - $specific_role = false; -} - -// ***************************************************************************** -// Manage SESSION paramaters -// ***************************************************************************** -/// Object/list type -//$objectType = $_SESSION[$origin]['diff_list']['difflist_type']; - -// Load roles -$difflistType = $difflist->get_difflist_type($objectType); -$roles = $difflist->get_difflist_type_roles($difflistType); - -$available_roles = $difflist->list_difflist_roles(); - -if ($difflistType->allow_entities == 'Y') { - $allow_entities = true; -} else { - $allow_entities = false; -} - -// Entity_id by default -if ($difflistType == '') { - $roles = array(); - $difflistType = $difflist->get_difflist_type('entity_id'); - $roles = $difflist->get_difflist_type_roles($difflistType); - $allow_entities = true; -} -// Dest user -if (isset($_SESSION[$origin]['diff_list']['dest']['users'][0]) - && !empty($_SESSION[$origin]['diff_list']['dest']['users'][0])) { - $dest_is_set = true; -} else { - $dest_is_set = false; -} - -// 1.4 create indexed array of existing diffusion to search for users/entities easily -$user_roles = array(); -$entity_roles = array(); -foreach ($roles as $role_id_local => $role_label) { - if (!empty($_SESSION[$origin]['diff_list'][$role_id_local]['users'])) { - for ($i = 0, $l = count($_SESSION[$origin]['diff_list'][$role_id_local]['users']); $i < $l; ++$i) { - $user_id = $_SESSION[$origin]['diff_list'][$role_id_local]['users'][$i]['user_id']; - $user_roles[$user_id][] = $role_id_local; - } - } - if (!empty($_SESSION[$origin]['diff_list'][$role_id_local]['entities'])) { - for ($i = 0, $l = count($_SESSION[$origin]['diff_list'][$role_id_local]['entities']); $i < $l; ++$i) { - $entity_id = $_SESSION[$origin]['diff_list'][$role_id_local]['entities'][$i]['entity_id']; - $entity_roles[$entity_id][] = $role_id_local; - } - } -} -// ***************************************************************************** -// Search functions / filter users and entities avilable for list composition -// ***************************************************************************** -if (isset($_POST['what_users']) && !empty($_POST['what_users'])) { - $_GET['what_users'] = $_POST['what_users']; -} -if (isset($_POST['what_services']) && !empty($_POST['what_services'])) { - $_GET['what_services'] = $_POST['what_services']; -} - -// by default, if difflist for entities, load users and entity of the selectionned entity -$primaryEntityLabel = ''; -if ($_GET['what_services'] == '' && $_GET['what_users'] == '') { - if ($_SESSION[$origin]['difflist_object']['object_label'] != null) { - $_GET['what_services'] = $_SESSION[$origin]['difflist_object']['object_label']; - } else { - $_SESSION['user']['primaryentity']['id']; - $_GET['what_services'] = $_SESSION['user']['primaryentity']['id']; - foreach ($_SESSION['user']['entities'] as $key => $value) { - if ($_SESSION['user']['entities'][$key]['ENTITY_ID'] == $_SESSION['user']['primaryentity']['id']) { - $primaryEntityLabel = $_SESSION['user']['entities'][$key]['ENTITY_LABEL']; - $_GET['what_services'] = $primaryEntityLabel; - } - } - } -} - -if (isset($_REQUEST['no_filter'])) { - $_GET['what_users'] = '%'; - $_GET['what_services'] = '%'; -} - -$users = array(); -$entities = array(); -$whereUsers = ''; -$whereEntities = ''; -$orderByUsers = ''; -$orderByEntities = ''; -$whereEntitiesUsers = ''; -$what = ''; -$whatUsers = ''; -$whatServices = ''; -$onlyCc = false; -$noDelete = false; -$redirect_groupbasket = false; - -if (isset($_SESSION['current_basket']) && count($_SESSION['current_basket']) > 0) { - if (is_array($_SESSION['user']['redirect_groupbasket_by_group'][$_SESSION['current_basket']['id']][$_SESSION['current_basket']['group_id']])) { - $redirect_groupbasket = current($_SESSION['user']['redirect_groupbasket_by_group'][$_SESSION['current_basket']['id']][$_SESSION['current_basket']['group_id']]); - - if (empty($redirect_groupbasket['entities'])) { - $redirect_groupbasket['entities'] = ''; - //$redirect_groupbasket['entities'] = $db->empty_list(); - } - if (empty($redirect_groupbasket['users_entities'])) { - $redirect_groupbasket['users_entities'] = ''; - //$redirect_groupbasket['users_entities'] = $db->empty_list(); - } - } -} - -if (isset($_REQUEST['only_cc'])) { - $onlyCc = true; -} - -if (isset($_REQUEST['no_delete'])) { - $noDelete = true; -} - -$PDOarray = array(); -if (isset($_GET['what_users']) - && !empty($_GET['what_users']) -) { - $what_users = $func->wash($_GET['what_users'], 'no', '', 'no'); - $user_expr = - ' and ( ' - .'lower(u.lastname) like lower(:whatUser) ' - .' or lower(u.firstname) like lower(:whatUser) ' - .' or lower(u.user_id) like lower(:whatUser)' - .')'; - $PDOarray = array_merge($PDOarray, array(':whatUser' => '%'.$what_users.'%')); -} - -if (isset($_GET['what_services']) - && !empty($_GET['what_services']) -) { - $what_services = addslashes( - functions::wash($_GET['what_services'], 'no', '', 'no') - ); - //$what_services = $what_services; - $entity_expr = - ' and (' - .' lower(e.entity_label) like lower(:whatEntity) ' - .' or lower(e.entity_id) like lower(:whatEntity)' - .')'; - $PDOarray = array_merge($PDOarray, array(':whatEntity' => '%'.$what_services.'%')); -} -/*$users_query = - "select u.user_id, u.firstname, u.lastname, e.entity_id, e.entity_label " - . "FROM " . $_SESSION['tablename']['users'] . " u, " . ENT_ENTITIES . " e, " - . ENT_USERS_ENTITIES . " ue WHERE u.status <> 'DEL' and u.enabled = 'Y' and" - . " e.entity_id = ue.entity_id and u.user_id = ue.user_id and" - . " e.enabled = 'Y' and ue.primary_entity='Y' " . $user_expr . $entity_expr - . " order by u.lastname asc, u.firstname asc, u.user_id asc, e.entity_label asc limit 50";*/ - -$where = "u.status <> 'DEL' and u.status != 'SPD' and" - .' e.entity_id = ue.entity_id and u.user_id = ue.user_id and' - ." e.enabled = 'Y' and ue.primary_entity='Y' ".$user_expr.$entity_expr; -$order = 'order by u.lastname asc, u.firstname asc, u.user_id asc, e.entity_label asc'; - -$users_query = $db->limit_select( - 0, - 50, - 'u.user_id, u.firstname, u.lastname, e.entity_id, e.entity_label', - $_SESSION['tablename']['users'].' u, '.ENT_ENTITIES.' e, '.ENT_USERS_ENTITIES.' ue', - $where, - '', - '', - $order -); -//echo $users_query;exit; - -if ($user_expr == '' && $entity_expr == '') { - //no query -} else { - $stmt = $db->query($users_query, $PDOarray); - while ($line = $stmt->fetchObject()) { - array_push( - $users, - array( - 'ID' => functions::show_string($line->user_id), - 'PRENOM' => functions::show_string($line->firstname), - 'NOM' => functions::show_string($line->lastname), - 'DEP_ID' => functions::show_string($line->entity_id), - 'DEP' => functions::show_string($line->entity_label), - ) - ); - } -} - -$entity_query = - 'select e.entity_id, e.entity_label FROM ' - .$_SESSION['tablename']['users'].' u, '.ENT_ENTITIES.' e, ' - .ENT_USERS_ENTITIES." ue WHERE u.status <> 'DEL' and u.enabled = 'Y'" - .'and e.entity_id = ue.entity_id and u.user_id = ue.user_id and ' - ."e.enabled = 'Y' ".$user_expr.$entity_expr - .' group by e.entity_id, e.entity_label order by e.entity_label asc limit 50'; - -$where = "u.status <> 'DEL' and u.status != 'SPD'".'and e.entity_id = ue.entity_id and u.user_id = ue.user_id and ' - ."e.enabled = 'Y' ".$user_expr.$entity_expr; -$order = 'ORDER by entity_label ASC'; -$entity_query = $db->limit_select( - 0, - 50, - 'e.entity_id, e.entity_label', - $_SESSION['tablename']['users'].' u, '.ENT_ENTITIES.' e, '.ENT_USERS_ENTITIES.' ue', - $where, - 'group by e.entity_id, e.entity_label', - '', - $order -); -//echo $entity_query;exit; - -if ($user_expr == '' && $entity_expr == '') { - //no query -} else { - $stmt = $db->query($entity_query, $PDOarray); - while ($line = $stmt->fetchObject()) { - array_push( - $entities, - array( - 'ID' => functions::show_string($line->entity_id), - 'DEP' => functions::show_string($line->entity_label), - ) - ); - } -} - -$_REQUEST['dest_is_set'] = $dest_is_set; - -//**************************************************************************************** -// RELOAD PARENT ID VALIDATION OF LIST -//**************************************************************************************** -//**************************************************************************************** -// SWITCH ON ACTION REQUEST -//**************************************************************************************** -switch ($action) { -// ADDS -//*************************************************************************************** -// Add USER AS dest/copy/custom mode -case 'add_user': - $stmt = $db->query( - 'SELECT u.firstname, u.lastname, e.entity_id, e.entity_label ' - .' FROM '.USERS_TABLE.' u ' - .' LEFT JOIN '.ENT_USERS_ENTITIES.' ue ON u.user_id = ue.user_id ' - .' LEFT JOIN '.ENT_ENTITIES.' e ON ue.entity_id = e.entity_id' - ." WHERE u.user_id= ? and ue.primary_entity = 'Y'", - array($id) - ); - $line = $stmt->fetchObject(); - - $visible = 'Y'; - if (!isset($_SESSION[$origin]['diff_list'][$role_id]['users'])) { - $_SESSION[$origin]['diff_list'][$role_id]['users'] = array(); - } else { - if ($lastUser = end($_SESSION[$origin]['diff_list'][$role_id]['users'])) { - $visible = $lastUser['visible']; - } - } - - // If dest is set && role is dest, move current dest to copy (legacy) - if ($role_id == 'dest' && $dest_is_set) { - if (!isset($_SESSION[$origin]['diff_list']['copy']['users'])) { - $_SESSION[$origin]['diff_list']['copy']['users'] = array(); - } - - $old_dest = $_SESSION[$origin]['diff_list']['dest']['users'][0]['user_id']; - if (!in_array('copy', $user_roles[$old_dest])) { - array_push( - $_SESSION[$origin]['diff_list']['copy']['users'], - array( - 'user_id' => $_SESSION[$origin]['diff_list']['dest']['users'][0]['user_id'], - 'firstname' => $_SESSION[$origin]['diff_list']['dest']['users'][0]['firstname'], - 'lastname' => $_SESSION[$origin]['diff_list']['dest']['users'][0]['lastname'], - 'entity_id' => $_SESSION[$origin]['diff_list']['dest']['users'][0]['entity_id'], - 'entity_label' => $_SESSION[$origin]['diff_list']['dest']['users'][0]['entity_label'], - 'visible' => 'Y', - ) - ); - } - unset($_SESSION[$origin]['diff_list']['dest']['users'][0]); - $_SESSION[$origin]['diff_list']['dest']['users'] = array_values( - $_SESSION[$origin]['diff_list']['dest']['users'] - ); - } - - array_push( - $_SESSION[$origin]['diff_list'][$role_id]['users'], - array( - 'user_id' => functions::show_string($id), - 'firstname' => functions::show_string($line->firstname), - 'lastname' => functions::show_string($line->lastname), - 'entity_id' => functions::show_string($line->entity_id), - 'entity_label' => functions::show_string($line->entity_label), - 'visible' => $visible, - ) - ); - $_SESSION[$origin]['diff_list'][$role_id]['users'] = array_values( - $_SESSION[$origin]['diff_list'][$role_id]['users'] - ); - break; - -// ADD ENTITY AS copy/custom mode -case 'add_entity': - $stmt = $db->query( - 'SELECT entity_id, entity_label FROM '.ENT_ENTITIES - .' WHERE entity_id = ?', - array($id) - ); - $line = $stmt->fetchObject(); - $visible = 'Y'; - if (!isset($_SESSION[$origin]['diff_list'][$role_id]['entities'])) { - $_SESSION[$origin]['diff_list'][$role_id]['entities'] = array(); - } else { - if ($lastEntity = end($_SESSION[$origin]['diff_list'][$role_id]['entities'])) { - $visible = $lastEntity['visible']; - } - } - array_push( - $_SESSION[$origin]['diff_list'][$role_id]['entities'], - array( - 'entity_id' => functions::show_string($id), - 'entity_label' => functions::show_string($line->entity_label), - 'visible' => $visible, - ) - ); - break; - -// REMOVE -//*************************************************************************************** -// Remove USER -case 'remove_user': - if ($rank !== false && $id && $role_id - && $_SESSION[$origin]['diff_list'][$role_id]['users'][$rank]['user_id'] == $id - ) { - $visible = $_SESSION[$origin]['diff_list'][$role_id]['users'][$rank]['visible']; - unset($_SESSION[$origin]['diff_list'][$role_id]['users'][$rank]); - $_SESSION[$origin]['diff_list'][$role_id]['users'] = array_values( - $_SESSION[$origin]['diff_list'][$role_id]['users'] - ); - // Set next user (replacing removed one) visible - if (isset($_SESSION[$origin]['diff_list'][$role_id]['users'][$rank])) { - $_SESSION[$origin]['diff_list'][$role_id]['users'][$rank]['visible'] = $visible; - } - if ($role_id == 'dest') { - $dest_is_set = false; - } - } - break; - -// Remove ENTITY -case 'remove_entity': - if ($rank !== false && $id && $role_id - && $_SESSION[$origin]['diff_list'][$role_id]['entities'][$rank]['entity_id'] == $id - ) { - $visible = $_SESSION[$origin]['diff_list'][$role_id]['entities'][$rank]['visible']; - unset($_SESSION[$origin]['diff_list'][$role_id]['entities'][$rank]); - $_SESSION[$origin]['diff_list'][$role_id]['entities'] = array_values( - $_SESSION[$origin]['diff_list'][$role_id]['entities'] - ); - if (isset($_SESSION[$origin]['diff_list'][$role_id]['entities'][$rank])) { - $_SESSION[$origin]['diff_list'][$role_id]['entities'][$rank]['visible'] = $visible; - } - } - break; - -// MOVE -//*************************************************************************************** -case 'dest_to_copy': - if ($dest_is_set) { - if (!isset($_SESSION[$origin]['diff_list']['copy']['users'])) { - $_SESSION[$origin]['diff_list']['copy']['users'] = array(); - } - - $old_dest = $_SESSION[$origin]['diff_list']['dest']['users'][0]['user_id']; - - if ($_SESSION['collection_id_choice'] != 'letterbox_coll') { - if (!in_array('copy', $user_roles[$old_dest])) { - array_push( - $_SESSION[$origin]['diff_list']['copy']['users'], - array( - 'user_id' => $_SESSION[$origin]['diff_list']['dest']['users'][0]['user_id'], - 'firstname' => $_SESSION[$origin]['diff_list']['dest']['users'][0]['firstname'], - 'lastname' => $_SESSION[$origin]['diff_list']['dest']['users'][0]['lastname'], - 'entity_id' => $_SESSION[$origin]['diff_list']['dest']['users'][0]['entity_id'], - 'entity_label' => $_SESSION[$origin]['diff_list']['dest']['users'][0]['entity_label'], - 'visible' => 'Y', - ) - ); - } - unset($_SESSION[$origin]['diff_list']['dest']['users'][0]); - $_SESSION[$origin]['diff_list']['dest']['users'] = array_values( - $_SESSION[$origin]['diff_list']['dest']['users'] - ); - } else { - $old_dest_array = $_SESSION[$origin]['diff_list']['dest']['users'][0]; - $old_copy_array = $_SESSION[$origin]['diff_list']['copy']['users'][0]; - - if (!in_array('copy', $user_roles[$old_dest])) { - $_SESSION[$origin]['diff_list']['copy']['users'][0]['user_id'] = $_SESSION[$origin]['diff_list']['dest']['users'][0]['user_id']; - $_SESSION[$origin]['diff_list']['copy']['users'][0]['firstname'] = $_SESSION[$origin]['diff_list']['dest']['users'][0]['firstname']; - $_SESSION[$origin]['diff_list']['copy']['users'][0]['lastname'] = $_SESSION[$origin]['diff_list']['dest']['users'][0]['lastname']; - $_SESSION[$origin]['diff_list']['copy']['users'][0]['entity_id'] = $_SESSION[$origin]['diff_list']['dest']['users'][0]['entity_id']; - $_SESSION[$origin]['diff_list']['copy']['users'][0]['entity_label'] = $_SESSION[$origin]['diff_list']['dest']['users'][0]['entity_label']; - $_SESSION[$origin]['diff_list']['copy']['users'][0]['visible'] = 'Y'; - } - - $_SESSION[$origin]['diff_list']['dest']['users'][0]['user_id'] = $old_copy_array['user_id']; - $_SESSION[$origin]['diff_list']['dest']['users'][0]['firstname'] = $old_copy_array['firstname']; - $_SESSION[$origin]['diff_list']['dest']['users'][0]['lastname'] = $old_copy_array['lastname']; - $_SESSION[$origin]['diff_list']['dest']['users'][0]['entity_id'] = $old_copy_array['entity_id']; - $_SESSION[$origin]['diff_list']['dest']['users'][0]['entity_label'] = $old_copy_array['entity_label']; - $_SESSION[$origin]['diff_list']['dest']['users'][0]['visible'] = 'Y'; - } - $dest_is_set = false; - } - break; - -case 'copy_to_dest': - if ($dest_is_set) { - if (!isset($_SESSION[$origin]['diff_list'][$role_id]['users'])) { - $_SESSION[$origin]['diff_list'][$role_id]['users'] = array(); - } - $old_dest = $_SESSION[$origin]['diff_list']['dest']['users'][0]['user_id']; - if (!in_array('copy', $user_roles[$old_dest])) { - array_push( - $_SESSION[$origin]['diff_list']['copy']['users'], - array( - 'user_id' => $_SESSION[$origin]['diff_list']['dest']['users'][0]['user_id'], - 'firstname' => $_SESSION[$origin]['diff_list']['dest']['users'][0]['firstname'], - 'lastname' => $_SESSION[$origin]['diff_list']['dest']['users'][0]['lastname'], - 'entity_id' => $_SESSION[$origin]['diff_list']['dest']['users'][0]['entity_id'], - 'entity_label' => $_SESSION[$origin]['diff_list']['dest']['users'][0]['entity_label'], - 'visible' => 'Y', - ) - ); - } - unset($_SESSION[$origin]['diff_list']['dest']['users'][0]); - $_SESSION[$origin]['diff_list']['dest']['users'] = array_values( - $_SESSION[$origin]['diff_list']['dest']['users'] - ); - } - if (isset($_SESSION[$origin]['diff_list']['copy']['users'][$rank]['user_id']) - && !empty($_SESSION[$origin]['diff_list']['copy']['users'][$rank]['user_id']) - ) { - $_SESSION[$origin]['diff_list']['dest']['users'][0]['user_id'] = $_SESSION[$origin]['diff_list']['copy']['users'][$rank]['user_id']; - $_SESSION[$origin]['diff_list']['dest']['users'][0]['firstname'] = $_SESSION[$origin]['diff_list']['copy']['users'][$rank]['firstname']; - $_SESSION[$origin]['diff_list']['dest']['users'][0]['lastname'] = $_SESSION[$origin]['diff_list']['copy']['users'][$rank]['lastname']; - $_SESSION[$origin]['diff_list']['dest']['users'][0]['entity_id'] = $_SESSION[$origin]['diff_list']['copy']['users'][$rank]['entity_id']; - $_SESSION[$origin]['diff_list']['dest']['users'][0]['entity_label'] = $_SESSION[$origin]['diff_list']['copy']['users'][$rank]['entity_label']; - $_SESSION[$origin]['diff_list']['dest']['users'][0]['visible'] = 'Y'; - unset($_SESSION[$origin]['diff_list']['copy']['users'][$rank]); - $_SESSION[$origin]['diff_list']['copy']['users'] = array_values( - $_SESSION[$origin]['diff_list']['copy']['users'] - ); - $dest_is_set = false; - } - break; - -case 'move_user_down': - $downUser = - array_splice( - $_SESSION[$origin]['diff_list'][$role_id]['users'], - $rank, - 1, - $preserve_keys = true - ); - $newRank = $rank + 1; - $upUser = - array_splice( - $_SESSION[$origin]['diff_list'][$role_id]['users'], - $newRank, - 1, - $preserve_keys = true - ); - if ($upUser[0] && $downUser[0]) { - // Switch visible values - $downUserVisible = $downUser[0]['visible']; - $upUserVisible = $upUser[0]['visible']; - $upUser[0]['visible'] = $downUserVisible; - $downUser[0]['visible'] = $upUserVisible; - // Switch positions - $_SESSION[$origin]['diff_list'][$role_id]['users'][$rank] = $upUser[0]; - $_SESSION[$origin]['diff_list'][$role_id]['users'][$newRank] = $downUser[0]; - } - break; - -case 'move_entity_down': - $downEntity = - array_splice( - $_SESSION[$origin]['diff_list'][$role_id]['entities'], - $rank, - 1, - $preserve_keys = true - ); - $newRank = $rank + 1; - $upEntity = - array_splice( - $_SESSION[$origin]['diff_list'][$role_id]['entities'], - $newRank, - 1, - $preserve_keys = true - ); - if ($upEntity[0] && $downEntity[0]) { - // Switch visible values - $downEntityVisible = $downEntity[0]['visible']; - $upEntityVisible = $upEntity[0]['visible']; - $upEntity[0]['visible'] = $downEntityVisible; - $downEntity[0]['visible'] = $upEntityVisible; - // Switch positions - $_SESSION[$origin]['diff_list'][$role_id]['entities'][$rank] = $upEntity[0]; - $_SESSION[$origin]['diff_list'][$role_id]['entities'][$newRank] = $downEntity[0]; - } - break; - -case 'move_user_up': - $upUser = - array_splice( - $_SESSION[$origin]['diff_list'][$role_id]['users'], - $rank, - 1, - $preserve_keys = true - ); - $newRank = $rank - 1; - $downUser = - array_splice( - $_SESSION[$origin]['diff_list'][$role_id]['users'], - $newRank, - 1, - $preserve_keys = true - ); - if ($upUser[0] && $downUser[0]) { - // Switch visible values - $downUserVisible = $downUser[0]['visible']; - $upUserVisible = $upUser[0]['visible']; - $upUser[0]['visible'] = $downUserVisible; - $downUser[0]['visible'] = $upUserVisible; - // Switch positions - $_SESSION[$origin]['diff_list'][$role_id]['users'][$rank] = $downUser[0]; - $_SESSION[$origin]['diff_list'][$role_id]['users'][$newRank] = $upUser[0]; - } - break; - -case 'move_entity_up': - $upEntity = - array_splice( - $_SESSION[$origin]['diff_list'][$role_id]['entities'], - $rank, - 1, - $preserve_keys = true - ); - $newRank = $rank - 1; - $downEntity = - array_splice( - $_SESSION[$origin]['diff_list'][$role_id]['entities'], - $newRank, - 1, - $preserve_keys = true - ); - - if ($upEntity[0] && $downEntity[0]) { - // Switch visible values - $downEntityVisible = $downEntity[0]['visible']; - $upEntityVisible = $upEntity[0]['visible']; - $upEntity[0]['visible'] = $downEntityVisible; - $downEntity[0]['visible'] = $upEntityVisible; - // Switch positions - $_SESSION[$origin]['diff_list'][$role_id]['entities'][$rank] = $downEntity[0]; - $_SESSION[$origin]['diff_list'][$role_id]['entities'][$newRank] = $upEntity[0]; - } - break; - -// VISIBLE -//*************************************************************************************** -case 'make_user_visible': - $_SESSION[$origin]['diff_list'][$role_id]['users'][$rank]['visible'] = 'Y'; - break; - -case 'make_user_unvisible': - $_SESSION[$origin]['diff_list'][$role_id]['users'][$rank]['visible'] = 'N'; - break; - -case 'make_entity_visible': - $_SESSION[$origin]['diff_list'][$role_id]['entities'][$rank]['visible'] = 'Y'; - break; - -case 'make_entity_unvisible': - $_SESSION[$origin]['diff_list'][$role_id]['entities'][$rank]['visible'] = 'N'; - break; -// END SWITCH ACTION -} - -// 1.4 create indexed array of existing diffusion to search for users/entities easily -$user_roles = array(); -$entity_roles = array(); - -foreach ($roles as $role_id => $role_label) { - if (!empty($_SESSION[$origin]['diff_list'][$role_id]['users'])) { - for ($i = 0, $l = count($_SESSION[$origin]['diff_list'][$role_id]['users']); $i < $l; ++$i) { - $user_id = $_SESSION[$origin]['diff_list'][$role_id]['users'][$i]['user_id']; - $user_roles[$user_id][] = $role_id; - } - } - if (!empty($_SESSION[$origin]['diff_list'][$role_id]['entities'])) { - for ($i = 0, $l = count($_SESSION[$origin]['diff_list'][$role_id]['entities']); $i < $l; ++$i) { - $entity_id = $_SESSION[$origin]['diff_list'][$role_id]['entities'][$i]['entity_id']; - $entity_roles[$entity_id][] = $role_id; - } - } -} - -$core_tools->load_html(); -$core_tools->load_header(_USER_ENTITIES_TITLE); -$time = $core_tools->get_session_time_expire(); -$displayValue = ''; -$displayValue = ''.$displayValue.''; - -$link = $_SESSION['config']['businessappurl'].'index.php?display=true&module=entities&page=manage_listinstance&origin='.$origin; -if ($onlyCc) { - $link .= '&only_cc'; -} -if ($noDelete) { - $link .= '&no_delete'; -} -if ($cat) { - $link .= '&cat='.$cat; -} -if ($specific_role) { - $link .= '&specific_role='.$specific_role; -} - -$linkwithwhat = - $link - .'&what_users='.$whatUsers - .'&what_services='.$whatServices; -//****************************************************************************** -// DISPLAY EXISTING LIST -//****************************************************************************** -?> - -<body onload="setTimeout(window.close, <?php echo $time; ?>*60*1000);"> - <script type="text/javascript"> - function add_user(id) { - var user_id = $('user_id_' + id).value; - var role_select = $('user_role_' + id); - var role = role_select.options[role_select.selectedIndex].value; - goTo('<?php echo $linkwithwhat; ?>&action=add_user&id=' + user_id + '&role=' + role); - } - - function add_entity(id) { - var entity_id = $('entity_id_' + id).value; - var role_select = $('entity_role_' + id); - var role = role_select.options[role_select.selectedIndex].value; - goTo('<?php echo $linkwithwhat; ?>&action=add_entity&id=' + entity_id + '&role=' + role); - } - </script> - <br /> - <?php - /*if ((isset($_GET['what_users']) && ! empty($_GET['what_users'])) - || (isset($_GET['what_services']) && !empty($_GET['what_services'])) - || ( !empty($user_roles) || !empty($entity_roles)) - ) {*/ ?> - <div id="diff_list" class="block" align="center"> - <h2> - <?php - echo _DIFFUSION_LIST.' '; - if ($_SESSION[$origin]['difflist_object']['object_label'] != '') { - functions::xecho($_SESSION[$origin]['difflist_object']['object_label']); - } - /*if ($difflistType->difflist_type_label != '') { - echo "<br /><small><small><small> (" . $difflistType->difflist_type_label . ")</small></small></small>"; - }*/ - ?> - </h2> - <?php - //************************************************************************** - // DEST USER - //************************************************************************** - if (1 == 2 && isset($_SESSION[$origin]['diff_list']['dest']['user_id']) - && !empty($_SESSION[$origin]['diff_list']['dest']['user_id']) - && !$onlyCc - ) { - ?> - <h3 class="sstit"> - <?php echo _PRINCIPAL_RECIPIENT; ?> - </h3> - <table cellpadding="0" cellspacing="0" border="0" class="listing spec"> - <tr> - <td style="width:5%;"> - <i class="fa fa-user fa-2x" title="<?php echo _USER; ?>"></i> - </td> - <td style="width:5%;"> - <?php - if ($_SESSION[$origin]['diff_list']['dest']['visible'] == 'Y') { - ?> - <i class="fa fa-check fa-2x" title="<?php echo _VISIBLE; ?>"></i> - <?php - } ?> - </td> - <td> - <?php functions::xecho($_SESSION[$origin]['diff_list']['dest']['lastname']).' '.$_SESSION[$origin]['diff_list']['dest']['firstname']; ?> - </td> - <td> - <?php functions::xecho($_SESSION[$origin]['diff_list']['dest']['entity_label']); ?> - </td> - <td class="action_entities" style="width:5%;"> - <!-- Remove dest --> - <a href="<?php echo $linkwithwhat; ?>&action=remove_dest"><i - class="fa fa-times fa-2x"></i></a> - </td> - <td class="action_entities" style="width:15%;"> - <!-- Move dest to copy --> - <a href="<?php echo $linkwithwhat; ?>&action=dest_to_copy&role=copy"><i - class="fa fa-arrow-down fa-2x"></i> - <?php echo _TO_CC; ?></a> - </td> - </tr> - </table> - <?php - } ?> - <br /> - <?php - //************************************************************************** - // OTHER ROLES - //************************************************************************** - foreach ($roles as $role_id => $role_label) { - if ($cat == 'outgoing' && $role_id == 'dest') { - $role_label = _REDACTOR; - } elseif ($cat != 'outgoing' && $role_id == 'dest') { - $role_label = _ASSIGNEE; - } - if (!empty($_SESSION[$origin]['diff_list']['dest']['users'][0]['entity_id'])) { - $entity_id_dest = $_SESSION[$origin]['diff_list']['dest']['users'][0]['entity_id']; - } - if ((!empty($_SESSION[$origin]['diff_list'][$role_id]['users']) && count($_SESSION[$origin]['diff_list'][$role_id]['users']) > 0) || (!empty($_SESSION[$origin]['diff_list'][$role_id]['entities']) && count($_SESSION[$origin]['diff_list'][$role_id]['entities']) > 0)) { - if (($specific_role == $role_id || $specific_role.'_copy' == $role_id || $specific_role.'_info' == $role_id) || !isset($_REQUEST['specific_role'])) { - ?> - <h3 class="sstit" style="font-size:1.5em; text-align:left; margin-left:230px; margin-bottom: -10px"> - <?php functions::xecho($role_label); ?> - </h3> - <table cellpadding="0" cellspacing="0" border="0" class="listing liste_diff spec"> - <?php - //************************************************************************** - // OTHER ROLE USERS - //************************************************************************** - $color = ' class="col"'; - if (!empty($_SESSION[$origin]['diff_list'][$role_id]['users'])) { - $nbDiffListUser = count($_SESSION[$origin]['diff_list'][$role_id]['users']); - } else { - $nbDiffListUser = 0; - } - for ($i = 0, $l = $nbDiffListUser; $i < $l; ++$i) { - $user = $_SESSION[$origin]['diff_list'][$role_id]['users'][$i]; - - if ($color == ' class="col"') { - $color = ''; - } else { - $color = ' class="col"'; - } ?> - <tr <?php echo $color; ?> > - <td style="width:5%;"> - <i class="fa fa-user fa-2x" title="<?php echo _USER.' '.$role_label; ?>"></i> - </td> - <td style="width:5%;"> - <?php - if ($user['visible'] == 'Y') { - ?> - <a href="<?php echo $linkwithwhat; ?>&action=make_user_unvisible&role=<?php functions::xecho($role_id); ?>&rank=<?php functions::xecho($i); ?>"> - <i class="fa fa-check fa-2x" title="<?php echo _VISIBLE; ?>"></i> - </a> - <?php - } else { - ?> - <a href="<?php echo $linkwithwhat; ?>&action=make_user_visible&role=<?php functions::xecho($role_id); ?>&rank=<?php functions::xecho($i); ?>"> - <i class="fa fa-times fa-2x" title="<?php echo _NOT_VISIBLE; ?>"></i> - </a> - <?php - } ?> - </td> - <td> - <?php functions::xecho($user['lastname'].' '.$user['firstname']); ?> - </td> - <td> - <?php functions::xecho($user['entity_label']); ?> - </td> - <td class="action_entities" style="width:5%;"> - <?php - /*if (!$noDelete && ($role_id != 'dest' && !$onlyCc)) { */ - if (!$noDelete && (!$onlyCc || ($onlyCc && $role_id != 'dest'))) { - ?> - <a href="<?php echo $linkwithwhat; ?>&action=remove_user&role=<?php functions::xecho($role_id); ?>&rank=<?php functions::xecho($i); ?>&id=<?php functions::xecho($user['user_id']); ?>"><i - class="fa fa-times fa-lg" title="<?php echo _DEL_USER_LISTDIFF; ?>"></i></a> - <?php - } ?> - </td> - <td class="action_entities" style="width:15%;"> - <!-- Switch copy to dest --> - <?php - //if($role_id == 'dest' && isset($roles['copy']) && ($role_id != 'dest' && $onlyCc)) { - if ($role_id == 'dest' && isset($roles['copy']) && !$onlyCc && $_SESSION[$origin]['diff_list']['copy']['users'][0] != '') { - ?> - <a href="<?php functions::xecho($linkwithwhat); ?>&action=dest_to_copy&role=copy" - title="<?php echo _GO_TO_CC; ?>"><i class="fa fa-arrow-down"></i> - <?php echo _TO_CC; ?></a> - <?php - } elseif ($role_id == 'copy' && !$onlyCc && isset($roles['dest'])) { - ?> - <a href="<?php echo $linkwithwhat; ?>&action=copy_to_dest&role=copy&rank=<?php functions::xecho($i); ?>" - title="<?php echo _GO_TO_DEST; ?>"><i class="fa fa-arrow-up"></i> - <?php echo _TO_DEST; ?></a> - <?php - } else { - echo ' '; - } ?> - </td> - <td class="action_entities" style="width:5%;"> - <!-- Move up in list --> - <?php - if ($i > 0) { - ?> - <a href="<?php echo $linkwithwhat; ?>&action=move_user_up&role=<?php functions::xecho($role_id); ?>&rank=<?php functions::xecho($i); ?>"><i - class="fa fa-arrow-up" title="<?php echo _UP_USER_ONE_ROW; ?>"></i></a> - <?php - } ?> - </td> - <td class="action_entities" style="width:5%;"> - <!-- Move down in list --> - <?php - if ($i < $l - 1) { - ?> - <a href="<?php echo $linkwithwhat; ?>&action=move_user_down&role=<?php functions::xecho($role_id); ?>&rank=<?php functions::xecho($i); ?>"><i - class="fa fa-arrow-down" title="<?php echo _DOWN_USER_ONE_ROW; ?>"></i></a> - <?php - } ?> - </td> - </tr> - <?php - } - - //************************************************************************** - // OTHER ROLE ENTITIES - //************************************************************************** - $nbEntitiesDiffList = 0; - if ($_SESSION[$origin]['diff_list'][$role_id]['entities']) { - $nbEntitiesDiffList = count($_SESSION[$origin]['diff_list'][$role_id]['entities']); - } - for ($i = 0, $l = $nbEntitiesDiffList; $i < $l; ++$i) { - $entity = $_SESSION[$origin]['diff_list'][$role_id]['entities'][$i]; - if ($color == ' class="col"') { - $color = ''; - } else { - $color = ' class="col"'; - } ?> - <tr <?php echo $color; ?> > - <td style="width:5%;"> - <i class="fa fa-sitemap fa-2x" title="<?php echo _ENTITY.' '.$role_label; ?>"></i> - </td> - <td style="width:5%;"> - <?php - if ($entity['visible'] == 'Y') { - ?> - <a href="<?php echo $linkwithwhat; ?>&action=make_entity_unvisible&role=<?php functions::xecho($role_id); ?>&rank=<?php functions::xecho($i); ?>"> - <i class="fa fa-check fa-2x" title="<?php echo _VISIBLE; ?>"></i> - </a> - <?php - } else { - ?> - <a href="<?php echo $linkwithwhat; ?>&action=make_entity_visible&role=<?php functions::xecho($role_id); ?>&rank=<?php functions::xecho($i); ?>"> - <i class="fa fa-times fa-2x" title="<?php echo _NOT_VISIBLE; ?>"></i> - </a> - <?php - } ?> - </td> - <td> - <?php functions::xecho($entity['entity_id']); ?> - </td> - <td> - <?php functions::xecho($entity['entity_label']); ?> - </td> - <td class="action_entities" style="width:5%;"> - <?php - if (!$noDelete) { - ?> - <a href="<?php echo $linkwithwhat; ?>&action=remove_entity&role=<?php functions::xecho($role_id); ?>&rank=<?php functions::xecho($i); ?>&id=<?php functions::xecho($entity['entity_id']); ?>"> - <i class="fa fa-times fa-lg" title="<?php echo _DEL_ENTITY_LISTDIFF; ?>"></i> - </a> - <?php - } ?> - </td> - <td class="action_entities" style="width:15%;"> </td> - <td class="action_entities" style="width:5%;"> - <!-- Move up in list --> - <?php - if ($i > 0) { - ?> - <a href="<?php echo $linkwithwhat; ?>&action=move_entity_up&role=<?php functions::xecho($role_id); ?>&rank=<?php functions::xecho($i); ?>"><i - class="fa fa-arrow-up" title="<?php echo _UP_ENTITY_ONE_ROW; ?>"></i></a> - <?php - } ?> - </td> - <td class="action_entities" style="width:5%;"> - <!-- Move down in list --> - <?php - if ($i < $l - 1) { - ?> - <a href="<?php echo $linkwithwhat; ?>&action=move_entity_down&role=<?php functions::xecho($role_id); ?>&rank=<?php functions::xecho($i); ?>"><i - class="fa fa-arrow-down" title="<?php echo _DOWN_ENTITY_ONE_ROW; ?>"></i></a> - <?php - } ?> - </td> - </tr> - <?php - } - } ?> - </table> - <br /> - <?php - } - } - //****************************************************************************** - // ACTIONS BUTTONS - //******************************************************************************?> - <form name="pop_diff" method="post" > - <div align="center"> - <input align="middle" type="button" value="<?php echo _VALIDATE; ?>" class="button" name="valid" onclick="change_diff_list('<?php functions::xecho($origin); ?>', <?php echo "'".$displayValue."'"; - if ($_REQUEST['origin'] == 'redirect') { - echo ",'diff_list_div_redirect','','','".$specific_role."'"; - } else { - echo ",'','','".$cat."',''"; - } - echo ",'".$entity_id_dest."'"; - ?>);" /> - <input align="middle" type="button" value="<?php echo _CANCEL; ?>" onclick="self.close();" class="button"/> - </div> - </form> - <br/> - <br/><?php - //****************************************************************************** - // LIST OF AVAILABLE ENTITIES / USERS - //******************************************************************************?> - <hr align="center" color="#6633CC" size="5" width="60%"> - <div align="center"> - <form action="#" name="search_diff_list" method="" id="search_diff_list" > - <input type="hidden" name="display" value="true" /> - <input type="hidden" name="module" value="entities" /> - <input type="hidden" name="page" value="manage_listinstance" /> - <input type="hidden" name="origin" id="origin" value="<?php functions::xecho($origin); ?>" /> - <table cellpadding="2" cellspacing="2" border="0" style="width:35%"> - <tr> - <th> - <label for="what_users" class="bold"><?php echo _USER; ?></label> - </th> - <th> - <input name="what_users" id="what_users" type="text" <?php if (isset($_GET['what_users'])) { - echo "value ='".functions::xssafe($_GET['what_users'])."'"; - } ?> style="width:100%"/> - </th> - </tr> - <tr> - <th> - <label for="what_services" class="bold"><?php echo _DEPARTMENT; ?></label> - </th> - <th> - <input name="what_services" id="what_services" type="text" <?php if (isset($_GET['what_services'])) { - echo "value ='".functions::xssafe($_GET['what_services'])."'"; - } ?> style="width:100%"/> - </th> - </tr> - <tr> - <th> - <label for="auto_filters" class="bold"> </label> - </th> - <th> - <?php - if ($_SESSION[$origin]['difflist_object']['object_label'] != '') { - ?> - <input class="button" name="auto_filter" id="auto_filter" type="button" onclick="$('what_services').value='<?php - functions::xecho($_SESSION[$origin]['difflist_object']['object_label']); ?>';$('what_users').value='';" value="<?php echo _AUTO_FILTER; ?>"/> - <?php - } elseif ($primaryEntityLabel != '') { - ?> - <input class="button" name="auto_filter" id="auto_filter" type="button" onclick="$('what_services').value='<?php - functions::xecho($primaryEntityLabel); ?>';$('what_users').value='';" value="<?php echo _AUTO_FILTER; ?>"/> - <?php - } - ?> - <input class="button" name="no_filter" id="no_filter" type="button" onclick="$('what_services').value='';$('what_users').value='';" value="<?php echo _NO_FILTER; ?>"/> - </th> - </tr> - </table> - </form> - </div> - <script type="text/javascript"> - repost('<?php echo $link; ?>',new Array('diff_list_items'),new Array('what_users','what_services'),'keyup',250); - repost('<?php echo $link; ?>',new Array('diff_list_items'),new Array('no_filter'), 'click',250); - repost('<?php echo $link; ?>',new Array('diff_list_items'),new Array('auto_filter'), 'click',250); - </script> - <br/> - <div id="diff_list_items"> <?php - //****************************************************************************** - // LIST OF AVAILABLE USERS - //****************************************************************************** - if (count($users) > 0) { ?> - <div align="center"> - <h3 class="tit"><?php echo _USERS_LIST; ?></h3> - <table cellpadding="0" cellspacing="0" border="0" class="listing spec"> - <thead> - <tr> - <th ><?php echo _LASTNAME.' '._FIRSTNAME; ?></th> - <th><?php echo _DEPARTMENT; ?></th> - <th> </th> - </tr> - </thead><?php - $color = ' class="col"'; - - foreach ($available_roles as $id => $label) { - $available_roles_ids[] = $id; - } - - - for ($j = 0, $m = count($users); $j < $m; ++$j) { - $user_id = $users[$j]['ID']; - $possible_roles = array(); - - foreach ($roles as $role_id => $role_label) { - if (in_array($role_id, $available_roles_ids) || $usergroups_controler->inGroup($users[$j]['ID'], $role_id)) { - if ($user_roles[$user_id] == null || !in_array($role_id, $user_roles[$user_id])) { - $possible_roles[$role_id] = $role_label; - } - } - } - - if ($color == ' class="col"') { - $color = ''; - } else { - $color = ' class="col"'; - } ?> - <tr <?php echo $color; ?> id="user_<?php functions::xecho($j); ?>"> - <td style="width:30%;"><?php functions::xecho($users[$j]['NOM'].' '.$users[$j]['PRENOM']); ?></td> - <td style="width:50%;"><?php functions::xecho($users[$j]['DEP']); ?></td> - <td class="action_entities" style="width:20%;text-align:center;"><?php - if (count($possible_roles) > 0) { - ?> - <input type="hidden" id="user_id_<?php functions::xecho($j); ?>" value="<?php functions::xecho($users[$j]['ID']); ?>" /> - <select name="role" id="user_role_<?php functions::xecho($j); ?>" style="width:60%;"><?php - foreach ($possible_roles as $role_id => $role_label) { - if ($cat == 'outgoing' && $role_id == 'dest') { - $role_label = _REDACTOR; - } elseif ($cat != 'outgoing' && $role_id == 'dest') { - $role_label = _ASSIGNEE; - } - - if ((($role_id != 'dest' || ($role_id == 'dest' && !$onlyCc)) && (!isset($_REQUEST['specific_role']))) || ($role_id == $specific_role || $role_id == $specific_role.'_copy' || $role_id == $specific_role.'_info')) { - ?> - <option value="<?php functions::xecho($role_id); ?>"><?php functions::xecho($role_label); ?></option><?php - } - } ?> - </select> - <span onclick="add_user(<?php functions::xecho($j); ?>);" style="cursor: pointer"/> - <i class="fa fa-user-plus fa-lg" title="<?php echo _ADD_USER_LISTDIFF; ?>"></i> - </span> <?php - } else { - echo _NO_AVAILABLE_ROLE; - } ?> - </td> - </tr> <?php - } ?> - </table> - <br/> - </div> - <?php - } - //****************************************************************************** - // LIST OF AVAILABLE ENTITIES - //****************************************************************************** - if (count($entities) > 0 && !isset($_REQUEST['specific_role'])) { - if ($allow_entities) { - $entityListDiff = array(); ?> - <div align="center"> - <h3 class="tit"><?php echo _ENTITIES_LIST; ?></h3> - <table cellpadding="0" cellspacing="0" border="0" class="listing spec"> - <thead> - <tr> - <th><?php echo _ID; ?></th> - <th><?php echo _DEPARTMENT; ?></th> - <th> </th> - </tr> - </thead><?php - $color = ' class="col"'; - - foreach ($entity_roles as $key => $value) { - $entityListDiff[] = $key; - } - for ($j = 0, $m = count($entities); $j < $m; ++$j) { - $entity_id = $entities[$j]['ID']; - // Check if at least one role can be added - $possible_roles = array(); - if (!in_array($entity_id, $entityListDiff)) { - foreach ($roles as $role_id => $role_label) { - if ($role_id == 'copy') { - $possible_roles[$role_id] = $role_label; - } - } - } - - if ($color == ' class="col"') { - $color = ''; - } else { - $color = ' class="col"'; - } ?> - <tr <?php echo $color; ?>> - <td style="width:30%;"><?php functions::xecho($entities[$j]['ID']); ?></td> - <td style="width:50%;"><?php functions::xecho($entities[$j]['DEP']); ?></td> - <td class="action_entities" style="width:20%;text-align:center;"><?php - if (count($possible_roles) > 0) { - ?> - <input type="hidden" id="entity_id_<?php functions::xecho($j); ?>" value="<?php functions::xecho($entities[$j]['ID']); ?>" /> - <select name="role" id="entity_role_<?php functions::xecho($j); ?>" style="width:60%;"><?php - foreach ($possible_roles as $role_id => $role_label) { - ?> - <option value="<?php functions::xecho($role_id); ?>"><?php functions::xecho($role_label); ?></option><?php - } ?> - </select> - <span onclick="add_entity(<?php functions::xecho($j); ?>);" style="cursor: pointer"/> - <i class="fa fa-plus fa-lg" title="<?php echo _ADD_ENTITY_LISTDIFF; ?>"></i> - </span> <?php - } else { - echo _NO_AVAILABLE_ROLE; - } ?> - </td> - </tr> <?php - } ?> - </table> - </div><?php - } - } - ?> - </div> <?php - /*} else { ?> - <div id="diff_list" align="center"> - <input align="middle" type="button" value="<?php echo _CANCEL;?>" class="button" onclick="self.close();"/> - </div> <?php - } */?> - <script type="text/javascript">$('no_filter').click();</script> -</body> -</html> diff --git a/modules/entities/reloadListDiff.php b/modules/entities/reloadListDiff.php deleted file mode 100755 index e8bd5d11ba6..00000000000 --- a/modules/entities/reloadListDiff.php +++ /dev/null @@ -1,22 +0,0 @@ -<?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 reloadListDiff -* @author dev <dev@maarch.org> -* @ingroup entities -*/ - -$origin = $_REQUEST['origin']; -$role_id = $_REQUEST['role_id']; -$rank = $_REQUEST['rank']; - -$oldDest = $_SESSION[$origin]['diff_list']['dest']['users'][0]; - -$_SESSION[$origin]['diff_list']['dest']['users'][0] = $_SESSION[$origin]['diff_list'][$role_id]['users'][$rank]; - -$_SESSION[$origin]['diff_list'][$role_id]['users'][$rank] = $oldDest; - -echo "{\"status\" : 0}"; \ No newline at end of file diff --git a/modules/entities/save_list_diff.php b/modules/entities/save_list_diff.php deleted file mode 100755 index 8c1ca828e4b..00000000000 --- a/modules/entities/save_list_diff.php +++ /dev/null @@ -1,41 +0,0 @@ -<?php -/** -* File : save_list_diff.php -* -* Script called by an ajax object to store the list diff -* -* @package maarch -* @version 1.5 -* @since 10/2005 -* @license GPL v3 -* @author Laurent Giovannoni <dev@maarch.org> -*/ - -//var_dump($_REQUEST);exit; -require_once('core/class/class_core_tools.php'); -require_once('modules/entities/class/class_manage_listdiff.php'); -$core = new core_tools(); -$core->load_lang(); -$diff_list = new diffusion_list(); -$list = new diffusion_list(); -$params = array( - 'mode'=> $_REQUEST['mode'], - 'table' => $_REQUEST['table'], - 'coll_id' => $_REQUEST['collId'], - 'res_id' => $_REQUEST['resId'], - 'user_id' => $_REQUEST['userId'], - 'concat_list' => $_REQUEST['concatList'], - 'only_cc' => $_REQUEST['onlyCC'] -); -$list->load_list_db( - $_SESSION['details']['diff_list'], - $params -); - -//pb enchainement avec action redirect -$_SESSION['details']['diff_list']['key_value'] = md5($res_id); -$return = '<b>'. _DIFF_LIST_STORED . '</b>'; - -echo "{status : 0, div_content : '" . addslashes($return) - . "'}"; -exit(); diff --git a/modules/entities/show_diffListHistory_tab.php b/modules/entities/show_diffListHistory_tab.php deleted file mode 100755 index 7d0ed665ead..00000000000 --- a/modules/entities/show_diffListHistory_tab.php +++ /dev/null @@ -1,31 +0,0 @@ -<?php -$s_id = $_REQUEST["resId"]; -$coll_id = $_REQUEST["collId"]; - - -require_once 'core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_request.php'; -require_once 'core' . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . 'class_security.php'; - -$security = new security(); -$right = $security->test_right_doc($coll_id, $s_id); - -if(!$right){ - exit(_NO_RIGHT_TXT); -} - -$core_tools = new core_tools(); -$core_tools->load_lang(); -$core_tools->load_html(); -$core_tools->load_header('', true, false); -$core_tools->load_js(); - -$difflist = $_SESSION['process']['diff_list']; - -$frm_str .= '<div id="diff_list_history_div">'; - -$return_mode = true; -$diffListType = 'entity_id'; -require_once('modules/entities/difflist_history_display.php'); - - -echo $frm_str; \ No newline at end of file diff --git a/modules/entities/users_list.php b/modules/entities/users_list.php deleted file mode 100755 index 63c7c97c7f9..00000000000 --- a/modules/entities/users_list.php +++ /dev/null @@ -1,151 +0,0 @@ -<?php -/** -* File : users_list.php -* -* Users list -* -* @package Maarch Framework 3.0 -* @version 1 -* @since 03/2009 -* @license GPL -* @author Cédric Ndoumba <dev@maarch.org> -*/ -$admin = new core_tools(); -$admin->test_admin('manage_entities', 'entities'); - /****************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=users_list&module=entities'; -$page_label = _ENTITIES_USERS_LIST; -$page_id = "users_list"; -$admin->manage_location_bar($page_path, $page_label, $page_id, $init, $level); -/***********************************************************/ -require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_request.php"); -require_once('modules'.DIRECTORY_SEPARATOR.'entities'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_manage_entities.php'); -require_once("apps".DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR.'class_list_show.php'); -require("modules/entities/entities_tables.php"); -$func = new functions(); -$ent = new entity(); - -$what = ''; -$where = ''; -$my_tab_entities_id = array(); -if(isset($_REQUEST['what']) && !empty($_REQUEST['what'])) -{ - $what = $func->protect_string_db($_REQUEST['what']); - $arrayPDO = array(); - $where = " lower(lastname) like lower('".$what."%') "; -} - -if($_SESSION['user']['UserId'] != 'superadmin') -{ - $my_tab_entities_id = $ent->get_all_entities_id_user($_SESSION['user']['entities']); - if (count($my_tab_entities_id)>0) - { - if(isset($_REQUEST['what']) && !empty($_REQUEST['what'])) - { - $where.= ' and '; - } - - //we need all users who aren't releated with an entity - // and all users who are releated with all entities that are managed by connected user - $where.= '('.$_SESSION['tablename']['users'].'.user_id not in (select distinct user_id from '.ENT_USERS_ENTITIES.') or ?.entity_id in (?))'; - $arrayPDO = array($_SESSION['tablename']['ent_users_entities'],join(',', $my_tab_entities_id)); - } -} - -$first_join_table = $_SESSION['tablename']['users']; -$second_join_table = ENT_USERS_ENTITIES; -$join_key = "user_id"; -$limit = 10; - -$select[$_SESSION['tablename']['users']] = array(); -array_push($select[$_SESSION['tablename']['users']],"user_id","lastname","firstname","enabled","mail"); -$request= new request; -$tab = $request->PDOselect($select, $where, $arrayPDO, "order by lastname asc",$_SESSION['config']['databasetype'], $limit, true, $first_join_table, $second_join_table, $join_key); -//$request->show(); - -for ($i=0;$i<count($tab);$i++) -{ - for ($j=0;$j<count($tab[$i]);$j++) - { - foreach(array_keys($tab[$i][$j]) as $value) - { - if($tab[$i][$j][$value]=="user_id") - { - $tab[$i][$j]["user_id"]=$tab[$i][$j]['value']; - $tab[$i][$j]["label"]= _ID; - $tab[$i][$j]["size"]="15"; - $tab[$i][$j]["label_align"]="left"; - $tab[$i][$j]["align"]="left"; - $tab[$i][$j]["valign"]="bottom"; - $tab[$i][$j]["show"]=true; - } - if($tab[$i][$j][$value]=="lastname") - { - $tab[$i][$j]['value']= functions::show_string($tab[$i][$j]['value']); - $tab[$i][$j]["lastname"]=$tab[$i][$j]['value']; - $tab[$i][$j]["label"]=_LASTNAME; - $tab[$i][$j]["size"]="15"; - $tab[$i][$j]["label_align"]="left"; - $tab[$i][$j]["align"]="left"; - $tab[$i][$j]["valign"]="bottom"; - $tab[$i][$j]["show"]=true; - } - if($tab[$i][$j][$value]=="firstname") - { - $tab[$i][$j]['value']= functions::show_string($tab[$i][$j]['value']); - $tab[$i][$j]["firstname"]= $tab[$i][$j]['value']; - $tab[$i][$j]["label"]=_FIRSTNAME; - $tab[$i][$j]["size"]="15"; - $tab[$i][$j]["label_align"]="left"; - $tab[$i][$j]["align"]="left"; - $tab[$i][$j]["valign"]="bottom"; - $tab[$i][$j]["show"]=true; - } - if($tab[$i][$j][$value]=="enabled") - { - $tab[$i][$j]["enabled"]= $tab[$i][$j]['value']; - $tab[$i][$j]["label"]=_STATUS; - $tab[$i][$j]["size"]="3"; - $tab[$i][$j]["label_align"]="left"; - $tab[$i][$j]["align"]="center"; - $tab[$i][$j]["valign"]="bottom"; - $tab[$i][$j]["show"]=true; - } - if($tab[$i][$j][$value]=="mail") - { - $tab[$i][$j]["mail"] = $tab[$i][$j]['value']; - $tab[$i][$j]["label"]=_MAIL; - $tab[$i][$j]["size"]="10"; - $tab[$i][$j]["label_align"]="left"; - $tab[$i][$j]["align"]="left"; - $tab[$i][$j]["valign"]="bottom"; - $tab[$i][$j]["show"]=true; - } - } - } -} -$_SESSION['m_admin']['load_entities'] = true; - -$page_name = 'users_list'; -$page_name_up = "users_entities_up"; -$page_name_ban = ""; -$page_name_del = ""; -$page_name_val = ""; -$page_name_add = ""; -$label_add = ""; -$title = _ENTITIES_USERS_LIST." : ".$i." "._USERS; -$list = new list_show(); -$autoCompletionArray = array(); -$list->admin_list($tab, $i, $title,'user_id','users_list', 'entities','user_id', false, $page_name_up, $page_name_val, $page_name_ban, false, $page_name_add, $label_add, false, false, _ALL_USERS, _USER, 'user', true, true, false, true, "", false, $autoCompletionArray); - -?> diff --git a/modules/entities/xml/IVS/data_types.xml b/modules/entities/xml/IVS/data_types.xml deleted file mode 100755 index 8777f95f23e..00000000000 --- a/modules/entities/xml/IVS/data_types.xml +++ /dev/null @@ -1,15 +0,0 @@ -<dataTypes> - <dataType name="entities_table_list" base="string"> - <enumeration value="listinstance" /> - </dataType> - <dataType name="annee" base="graph"> - <pattern value="/^[0-9]{4}+$/" /> - </dataType> - - <dataType name="mois" base="graph"> - <pattern value="/^[0-9]{2}+$/" /> - </dataType> - <dataType name="ajax_ids_2" base="graph"> - <pattern value="/^[\w#\$]+$/" /> - </dataType> -</dataTypes> \ No newline at end of file diff --git a/modules/entities/xml/IVS/requests_definitions.xml b/modules/entities/xml/IVS/requests_definitions.xml deleted file mode 100755 index b2fdbf09d32..00000000000 --- a/modules/entities/xml/IVS/requests_definitions.xml +++ /dev/null @@ -1,130 +0,0 @@ -<requestDefinitions> - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="users_list" > - <parameter name="page" value="users_list"/> - <parameter name="display" value="true"/> - <parameter name="module" value="entities"/> - </requestDefinition> - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="users_entities_up" > - <parameter name="page" value="users_entities_up"/> - <parameter name="display" value="true"/> - <parameter name="module" value="entities"/> - </requestDefinition> - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="save_list_diff" > - <parameter name="page" value="save_list_diff"/> - <parameter name="display" value="true"/> - <parameter name="module" value="entities"/> - </requestDefinition> - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="remove_user_entities" > - <parameter name="page" value="remove_user_entities"/> - <parameter name="display" value="true"/> - <parameter name="module" value="entities"/> - </requestDefinition> - <requestDefinition method="GET" path="/apps/maarch_entreprise/index.php" validationRule="entity_form" > - <parameter name="page" value="entity_up"/> - <parameter name="module" value="entities"/> - </requestDefinition> - <requestDefinition method="GET" path="/apps/maarch_entreprise/index.php" validationRule="entity_ban" > - <parameter name="page" value="entity_ban"/> - <parameter name="module" value="entities"/> - </requestDefinition> - <requestDefinition method="GET" path="/apps/maarch_entreprise/index.php" validationRule="manage_entities" > - <parameter name="page" value="manage_entities"/> - <parameter name="module" value="entities"/> - </requestDefinition> - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="manage_entities" > - <parameter name="page" value="manage_entities"/> - <parameter name="module" value="entities"/> - </requestDefinition> - <requestDefinition method="GET" path="/apps/maarch_entreprise/index.php" validationRule="entity_allow" > - <parameter name="page" value="entity_allow"/> - <parameter name="module" value="entities"/> - </requestDefinition> - <requestDefinition method="GET" path="/apps/maarch_entreprise/index.php" validationRule="entity_add" > - <parameter name="page" value="entity_add"/> - <parameter name="module" value="entities"/> - </requestDefinition> - - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="entity_form" > - <parameter name="page" value="entity_add_db"/> - <parameter name="display" value="true"/> - <parameter name="module" value="entities"/> - </requestDefinition> - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="entity_form" > - <parameter name="page" value="entity_up_db"/> - <parameter name="display" value="true"/> - <parameter name="module" value="entities"/> - </requestDefinition> - - <requestDefinition method="GET" path="/apps/maarch_entreprise/index.php" validationRule="admin_difflist_types" > - <parameter name="page" value="admin_difflist_types"/> - <parameter name="module" value="entities"/> - </requestDefinition> - <requestDefinition method="GET" path="/apps/maarch_entreprise/index.php" validationRule="admin_difflist_types" > - <parameter name="page" value="admin_difflist_type"/> - <parameter name="module" value="entities"/> - </requestDefinition> - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="admin_difflist_type_validate" > - <parameter name="page" value="admin_difflist_type_validate"/> - <parameter name="module" value="entities"/> - </requestDefinition> - <requestDefinition method="GET" path="/apps/maarch_entreprise/index.php" validationRule="admin_difflist_type_validate" > - <parameter name="page" value="admin_difflist_type_validate"/> - <parameter name="module" value="entities"/> - </requestDefinition> - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="manage_listinstance"> - <parameter name="page" value="manage_listinstance"/> - <parameter name="display" value="true"/> - <parameter name="module" value="entities"/> - </requestDefinition> - <requestDefinition method="GET" path="/apps/maarch_entreprise/index.php" validationRule="manage_listinstance"> - <parameter name="page" value="manage_listinstance"/> - <parameter name="display" value="true"/> - <parameter name="module" value="entities"/> - </requestDefinition> - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="loadDiffList"> - <parameter name="page" value="loadDiffList"/> - <parameter name="display" value="true"/> - <parameter name="module" value="entities"/> - </requestDefinition> - <requestDefinition method="GET" path="/apps/maarch_entreprise/index.php" validationRule="loadDiffList"> - <parameter name="page" value="loadDiffList"/> - <parameter name="module" value="entities"/> - </requestDefinition> - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="loadDiffListHistory"> - <parameter name="page" value="loadDiffListHistory"/> - <parameter name="display" value="true"/> - <parameter name="module" value="entities"/> - </requestDefinition> - <requestDefinition method="GET" path="/apps/maarch_entreprise/index.php" validationRule="loadDiffListHistory"> - <parameter name="page" value="loadDiffListHistory"/> - <parameter name="module" value="entities"/> - </requestDefinition> - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="load_listinstance"> - <parameter name="page" value="load_listinstance"/> - <parameter name="display" value="true"/> - <parameter name="module" value="entities"/> - </requestDefinition> - <requestDefinition method="GET" path="/apps/maarch_entreprise/index.php" validationRule="load_listinstance"> - <parameter name="page" value="load_listinstance"/> - <parameter name="module" value="entities"/> - </requestDefinition> - - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="manage_listmodel"> - <parameter name="page" value="manage_listmodel"/> - <parameter name="display" value="true"/> - <parameter name="module" value="entities"/> - </requestDefinition> - <requestDefinition method="GET" path="/apps/maarch_entreprise/index.php" validationRule="manage_listmodel"> - <parameter name="page" value="manage_listmodel"/> - <parameter name="display" value="true"/> - <parameter name="module" value="entities"/> - </requestDefinition> - - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="entities_list_by_label"> - <parameter name="page" value="entities_list_by_label"/> - <parameter name="display" value="true"/> - <parameter name="module" value="entities"/> - </requestDefinition> - - -</requestDefinitions> diff --git a/modules/entities/xml/IVS/validation_rules.xml b/modules/entities/xml/IVS/validation_rules.xml deleted file mode 100755 index 808bf610739..00000000000 --- a/modules/entities/xml/IVS/validation_rules.xml +++ /dev/null @@ -1,136 +0,0 @@ -<validationRules> - <validationRule name="users_list" extends="standardForm" mode="error"> - <parameter name="module" type="identifier" /> - <parameter name="what" type="string" /> - </validationRule> - <validationRule name="users_entities_up" extends="standardForm" mode="error"> - <parameter name="module" type="identifier" /> - <parameter name="id" type="identifier" /> - </validationRule> - <validationRule name="save_list_diff" extends="standardForm" mode="error"> - <parameter name="module" type="identifier" /> - <parameter name="mode" type="entities_table_list" /> - <parameter name="table" type="entities_table_list" /> - <parameter name="collId" type="collection_list" /> - <parameter name="resId" type="integer" /> - <parameter name="concatList" type="integer" /> - <parameter name="onlyCC" type="boolean" /> - <parameter name="userId" type="login" /> - <parameter name="opt" type="identifier" /> - </validationRule> - <validationRule name="remove_user_entities" extends="standardForm" mode="error"> - <parameter name="module" type="identifier" /> - <parameter name="entities" type="ajax_ids" /> - </validationRule> - <validationRule name="entity_ban" extends="standardForm" mode="error"> - <parameter name="module" type="identifier" /> - <parameter name="id" type="identifier" /> - </validationRule> - <validationRule name="manage_entities" extends="standardForm" mode="error"> - <parameter name="module" type="identifier" /> - <parameter name="Submit" type="string" /> - <parameter name="selectedObject" type="identifier" /> - </validationRule> - <validationRule name="entity_allow" extends="standardForm" mode="error"> - <parameter name="module" type="identifier" /> - <parameter name="id" type="identifier" /> - </validationRule> - <validationRule name="entity_form" extends="standardForm" mode="error"> - <parameter name="module" type="identifier" /> - <parameter name="id" type="identifier" /> - <parameter name="Submit" type="identifier" /> - <parameter name="adrs1" type="string" /> - <parameter name="adrs2" type="string" /> - <parameter name="adrs3" type="string" /> - <parameter name="zcode" type="identifier" /> - <parameter name="business" type="string" /> - <parameter name="city" type="string" /> - <parameter name="country" type="string" /> - <parameter name="email" type="email" /> - <parameter name="entityId" type="identifier" /> - <parameter name="id" type="string" /> - <parameter name="label" type="string" /> - <parameter name="mode" type="mode" /> - <parameter name="parententity" type="identifier" /> - <parameter name="short_label" type="string" /> - <parameter name="entity_full_name" type="string" /> - <parameter name="type" type="string" /> - <parameter name="archival_agreement" type="string" /> - <parameter name="archival_agency" type="string" /> - </validationRule> - <validationRule name="admin_difflist_types" extends="standardForm" mode="error"> - <parameter name="module" type="identifier" /> - <parameter name="id" type="identifier" /> - <parameter name="mode" type="mode" /> - </validationRule> - <validationRule name="admin_difflist_type_validate" extends="standardForm" mode="error"> - <parameter name="module" type="identifier" /> - <parameter name="difflist_type_id" type="identifier" /> - <parameter name="difflist_type_label" type="string" /> - <parameter name="difflist_type_roles" type="string" /> - <parameter name="allow_entities" type="string" /> - <parameter name="mode" type="mode" /> - </validationRule> - <validationRule name="entity_up" extends="standardForm" mode="error"> - <parameter name="module" type="identifier" /> - <parameter name="id" type="identifier" /> - </validationRule> - - <validationRule name="manage_listinstance" extends="standardForm" mode="error"> - <parameter name="module" type="identifier" /> - <parameter name="origin" type="identifier" /> - <parameter name="what_services" type="string" /> - <parameter name="what_users" type="string" /> - <parameter name="action" type="string" /> - <parameter name="id" type="login" /> - <parameter name="role" type="identifier" /> - <parameter name="no_filter" type="string" /> - <parameter name="rank" type="integer" /> - <parameter name="auto_filter" type="string" /> - <parameter name="specific_role" type="string" /> - <parameter name="cat" type="string" /> - </validationRule> - - <validationRule name="loadDiffList" extends="standardForm" mode="error"> - <parameter name="module" type="identifier" /> - <parameter name="res_id" type="integer" /> - <parameter name="typeList" type="string" /> - <parameter name="showStatus" type="boolean" /> - </validationRule> - - <validationRule name="loadDiffListHistory" extends="standardForm" mode="error"> - <parameter name="module" type="identifier" /> - <parameter name="listinstance_history_id" type="integer" /> - </validationRule> - <validationRule name="load_listinstance" extends="standardForm" mode="error"> - <parameter name="module" type="identifier" /> - <parameter name="origin" type="string" /> - <parameter name="objectType" type="string" /> - <parameter name="load_from_model" type="string" /> - <parameter name="mandatory" type="string" /> - <parameter name="objectId" type="identifier" /> - <parameter name="collId" type="collection_list" /> - <parameter name="category" type="string" /> - <parameter name="specific_role" type="string" /> - </validationRule> - - <validationRule name="manage_listmodel" extends="standardForm" mode="error"> - <parameter name="module" type="identifier" /> - <parameter name="origin" type="integer" /> - <parameter name="action" type="identifier" /> - <parameter name="rank" type="integer" /> - <parameter name="role" type="identifier" /> - <parameter name="what_services" type="identifier" /> - <parameter name="what_users" type="identifier" /> - <parameter name="id" type="login" /> - <parameter name="valid" type="identifier" /> - <parameter name="no_filter" type="string" /> - <parameter name="objectType" type="identifier" /> - <parameter name="objectId" type="identifier" /> - </validationRule> - - <validationRule name="entities_list_by_label" extends="standardForm" mode="error"/> - - <validationRule name="entity_add" extends="standardForm" mode="error" /> - -</validationRules> diff --git a/modules/entities/xml/config.xml b/modules/entities/xml/config.xml deleted file mode 100755 index e766dfeeb9a..00000000000 --- a/modules/entities/xml/config.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<root> - <CONFIG> - <name>entities</name> - <comment>_ENTITIES_COMMENT</comment> - <file_prefix>not</file_prefix> - <loaded>true</loaded> - </CONFIG> - <TABLENAME> - <ent_entities>entities</ent_entities> - <ent_users_entities>users_entities</ent_users_entities> - <ent_listinstance>listinstance</ent_listinstance> - <ent_groupbasket_redirect>groupbasket_redirect</ent_groupbasket_redirect> - </TABLENAME> - <HISTORY> - <entityadd>true</entityadd> - <entityup>true</entityup> - <entitydel>true</entitydel> - <entityval>true</entityval> - <entityban>true</entityban> - </HISTORY> -</root> diff --git a/modules/entities/xml/menu.xml b/modules/entities/xml/menu.xml deleted file mode 100755 index 0a7561b783f..00000000000 --- a/modules/entities/xml/menu.xml +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<root> - <MENU> - <id>entities_print_sep_mlb</id> - <libconst>_PRINT_SEPS</libconst> - <url>/separators/print</url> - <style>fa fa-print</style> - <angular>true</angular> - </MENU> -</root> \ No newline at end of file diff --git a/modules/entities/xml/redirect_keywords.xml b/modules/entities/xml/redirect_keywords.xml deleted file mode 100755 index 5e88a003d6d..00000000000 --- a/modules/entities/xml/redirect_keywords.xml +++ /dev/null @@ -1,35 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<root> - <keyword> - <id>ALL_ENTITIES</id> - <label>_ALL_ENTITIES</label> - </keyword> - <keyword> - <id>ENTITIES_JUST_BELOW</id> - <label>_ENTITIES_JUST_BELOW</label> - </keyword> - <keyword> - <id>ENTITIES_BELOW</id> - <label>_ENTITIES_BELOW</label> - </keyword> - <keyword> - <id>ENTITIES_JUST_UP</id> - <label>_ENTITIES_JUST_UP</label> - </keyword> - <keyword> - <id>ALL_ENTITIES_BELOW</id> - <label>_ALL_ENTITIES_BELOW</label> - </keyword> - <keyword> - <id>MY_ENTITIES</id> - <label>_MY_ENTITIES</label> - </keyword> - <keyword> - <id>MY_PRIMARY_ENTITY</id> - <label>_MY_PRIMARY_ENTITY</label> - </keyword> - <keyword> - <id>SAME_LEVEL_ENTITIES</id> - <label>_SAME_LEVEL_ENTITIES</label> - </keyword> -</root> \ No newline at end of file -- GitLab