2008-02-19 19:10:24 +00:00
|
|
|
<?php
|
|
|
|
|
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
2020-06-28 20:05:55 +00:00
|
|
|
* Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
|
2024-03-12 23:30:45 +00:00
|
|
|
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
2025-09-29 18:41:32 +00:00
|
|
|
* Copyright (C) 2025 Frédéric France <frederic.france@free.fr>
|
2008-02-19 19:10:24 +00:00
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
2013-01-16 14:36:08 +00:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2008-02-19 19:10:24 +00:00
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program 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
|
2019-09-23 19:55:30 +00:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2008-02-19 19:10:24 +00:00
|
|
|
*/
|
|
|
|
|
|
2023-07-26 00:47:49 +00:00
|
|
|
/**
|
2023-07-25 21:10:06 +00:00
|
|
|
* \defgroup ecm Module ECM
|
|
|
|
|
* \brief Module ECM (Electronic Content Management) to manage Documents
|
|
|
|
|
*
|
|
|
|
|
* \file htdocs/core/modules/modECM.class.php
|
|
|
|
|
* \ingroup ecm
|
|
|
|
|
* \brief Description and activation file for the module ECM
|
2009-03-08 23:57:28 +00:00
|
|
|
*/
|
2008-02-19 19:10:24 +00:00
|
|
|
|
2020-04-10 08:59:32 +00:00
|
|
|
include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
|
2008-02-19 19:10:24 +00:00
|
|
|
|
|
|
|
|
|
2012-10-02 22:30:50 +00:00
|
|
|
/**
|
|
|
|
|
* Description and activation class for module ECM
|
2009-03-08 23:57:28 +00:00
|
|
|
*/
|
2008-02-19 19:10:24 +00:00
|
|
|
class modECM extends DolibarrModules
|
|
|
|
|
{
|
2020-10-31 13:32:18 +00:00
|
|
|
/**
|
|
|
|
|
* Constructor. Define names, constants, directories, boxes, permissions
|
|
|
|
|
*
|
|
|
|
|
* @param DoliDB $db Database handler
|
|
|
|
|
*/
|
|
|
|
|
public function __construct($db)
|
2008-02-19 19:10:24 +00:00
|
|
|
{
|
2012-01-04 20:23:50 +00:00
|
|
|
$this->db = $db;
|
2009-05-04 11:40:00 +00:00
|
|
|
|
2008-02-19 19:10:24 +00:00
|
|
|
// Id for module (must be unique).
|
|
|
|
|
// Use here a free id.
|
|
|
|
|
$this->numero = 2500;
|
2009-05-04 11:40:00 +00:00
|
|
|
|
2008-02-19 19:10:24 +00:00
|
|
|
// Family can be 'crm','financial','hr','projects','product','ecm','technic','other'
|
2009-05-04 11:40:00 +00:00
|
|
|
// It is used to sort modules in module setup page
|
|
|
|
|
$this->family = "ecm";
|
2018-10-06 09:57:53 +00:00
|
|
|
$this->module_position = '10';
|
2008-10-01 19:10:17 +00:00
|
|
|
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
|
2019-01-27 10:55:16 +00:00
|
|
|
$this->name = preg_replace('/^mod/i', '', get_class($this));
|
2008-02-19 19:10:24 +00:00
|
|
|
// Module description used if translation string 'ModuleXXXDesc' not found (XXX is id value)
|
|
|
|
|
$this->description = "Electronic Content Management";
|
|
|
|
|
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
|
2009-05-04 11:40:00 +00:00
|
|
|
$this->version = 'dolibarr';
|
2008-02-19 19:10:24 +00:00
|
|
|
// Key used in llx_const table to save module status enabled/disabled (XXX is id value)
|
2008-10-06 07:39:52 +00:00
|
|
|
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
2008-02-19 19:10:24 +00:00
|
|
|
// Name of png file (without png) used for this module
|
2021-02-15 19:13:38 +00:00
|
|
|
$this->picto = 'folder-open';
|
2009-05-04 11:40:00 +00:00
|
|
|
|
2008-02-19 19:10:24 +00:00
|
|
|
// Data directories to create when module is enabled
|
2017-08-04 11:51:25 +00:00
|
|
|
$this->dirs = array("/ecm/temp");
|
2009-05-04 11:40:00 +00:00
|
|
|
|
2008-02-19 19:10:24 +00:00
|
|
|
// Config pages. Put here list of php page names stored in admmin directory used to setup module
|
2013-03-04 15:59:39 +00:00
|
|
|
$this->config_page_url = array('ecm.php');
|
2009-05-04 11:40:00 +00:00
|
|
|
|
2008-02-19 19:10:24 +00:00
|
|
|
// Dependencies
|
2020-04-10 08:59:32 +00:00
|
|
|
$this->depends = array(); // List of modules id that must be enabled if this module is enabled
|
|
|
|
|
$this->requiredby = array(); // List of modules id to disable if this one is disabled
|
2009-05-04 11:40:00 +00:00
|
|
|
|
2008-02-19 19:10:24 +00:00
|
|
|
// Constants
|
2020-04-10 08:59:32 +00:00
|
|
|
$this->const = array(); // List of parameters
|
|
|
|
|
$r = 0;
|
2014-04-27 23:46:11 +00:00
|
|
|
|
2008-02-19 19:10:24 +00:00
|
|
|
// Boxes
|
2020-04-10 08:59:32 +00:00
|
|
|
$this->boxes = array(); // List of boxes
|
2024-05-30 11:37:17 +00:00
|
|
|
$r = 0;
|
2009-05-04 11:40:00 +00:00
|
|
|
|
2011-10-24 12:11:49 +00:00
|
|
|
// Add here list of php file(s) stored in core/boxes that contains class to show a box.
|
2008-02-19 19:10:24 +00:00
|
|
|
// Example:
|
2020-10-31 13:32:18 +00:00
|
|
|
//$this->boxes[$r][1] = "myboxa.php";
|
|
|
|
|
//$r++;
|
|
|
|
|
//$this->boxes[$r][1] = "myboxb.php";
|
|
|
|
|
//$r++;
|
2008-02-19 19:10:24 +00:00
|
|
|
|
|
|
|
|
// Permissions
|
2020-04-10 08:59:32 +00:00
|
|
|
$this->rights_class = 'ecm'; // Permission key
|
|
|
|
|
$this->rights = array(); // Permission array used by this module
|
2008-02-24 23:29:30 +00:00
|
|
|
|
|
|
|
|
$r++;
|
2010-10-01 17:59:02 +00:00
|
|
|
$this->rights[$r][0] = 2501;
|
2020-06-28 20:05:55 +00:00
|
|
|
$this->rights[$r][1] = 'Read or download documents';
|
2008-02-24 23:29:30 +00:00
|
|
|
$this->rights[$r][2] = 'r';
|
2016-06-04 10:16:30 +00:00
|
|
|
$this->rights[$r][3] = 0;
|
2011-04-05 09:50:10 +00:00
|
|
|
$this->rights[$r][4] = 'read';
|
2008-02-24 23:29:30 +00:00
|
|
|
|
|
|
|
|
$r++;
|
2011-04-05 09:50:10 +00:00
|
|
|
$this->rights[$r][0] = 2503;
|
2020-06-28 20:05:55 +00:00
|
|
|
$this->rights[$r][1] = 'Upload a document';
|
2008-02-24 23:29:30 +00:00
|
|
|
$this->rights[$r][2] = 'w';
|
2016-06-04 10:16:30 +00:00
|
|
|
$this->rights[$r][3] = 0;
|
2008-12-16 19:12:42 +00:00
|
|
|
$this->rights[$r][4] = 'upload';
|
2008-02-24 23:29:30 +00:00
|
|
|
|
|
|
|
|
$r++;
|
|
|
|
|
$this->rights[$r][0] = 2515;
|
2020-06-28 20:05:55 +00:00
|
|
|
$this->rights[$r][1] = 'Administer directories of documents';
|
2008-02-24 23:29:30 +00:00
|
|
|
$this->rights[$r][2] = 'w';
|
2016-06-04 10:16:30 +00:00
|
|
|
$this->rights[$r][3] = 0;
|
2008-02-24 23:29:30 +00:00
|
|
|
$this->rights[$r][4] = 'setup';
|
|
|
|
|
|
2009-05-04 11:40:00 +00:00
|
|
|
|
2020-10-31 13:32:18 +00:00
|
|
|
// Menus
|
2008-02-19 19:10:24 +00:00
|
|
|
//------
|
2023-06-26 13:34:09 +00:00
|
|
|
$this->menu = array(); // List of menus to add
|
2020-04-10 08:59:32 +00:00
|
|
|
$r = 0;
|
2009-05-04 11:40:00 +00:00
|
|
|
|
2008-05-02 14:19:56 +00:00
|
|
|
// Top menu
|
2021-02-07 21:04:46 +00:00
|
|
|
$this->menu[$r] = array(
|
2024-03-12 23:30:45 +00:00
|
|
|
'fk_menu' => 0,
|
|
|
|
|
'type' => 'top',
|
|
|
|
|
'titre' => 'MenuECM',
|
2023-10-13 13:00:51 +00:00
|
|
|
'prefix' => img_picto('', $this->picto, 'class="pictofixedwidth"'),
|
2024-03-12 23:30:45 +00:00
|
|
|
'mainmenu' => 'ecm',
|
|
|
|
|
'url' => '/ecm/index.php',
|
|
|
|
|
'langs' => 'ecm',
|
|
|
|
|
'position' => 82,
|
2025-09-29 18:41:32 +00:00
|
|
|
'perms' => '$user->hasRight("ecm", "read") || $user->hasRight("ecm", "upload") || $user->hasRight("ecm", "setup")',
|
2024-03-12 23:30:45 +00:00
|
|
|
'enabled' => 'isModEnabled("ecm")',
|
|
|
|
|
'target' => '',
|
|
|
|
|
'user' => 2, // 0=Menu for internal users, 1=external users, 2=both
|
2021-02-07 21:04:46 +00:00
|
|
|
);
|
2008-02-19 19:10:24 +00:00
|
|
|
$r++;
|
2008-05-02 03:55:09 +00:00
|
|
|
|
2008-05-02 14:19:56 +00:00
|
|
|
// Left menu linked to top menu
|
2021-02-07 21:04:46 +00:00
|
|
|
$this->menu[$r] = array(
|
2024-03-12 23:30:45 +00:00
|
|
|
'fk_menu' => 'fk_mainmenu=ecm',
|
|
|
|
|
'type' => 'left',
|
|
|
|
|
'titre' => 'ECMArea',
|
2021-02-07 21:04:46 +00:00
|
|
|
'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth"'),
|
2024-03-12 23:30:45 +00:00
|
|
|
'mainmenu' => 'ecm',
|
|
|
|
|
'leftmenu' => 'ecm',
|
|
|
|
|
'url' => '/ecm/index.php?mainmenu=ecm&leftmenu=ecm',
|
|
|
|
|
'langs' => 'ecm',
|
|
|
|
|
'position' => 101,
|
2025-09-29 18:41:32 +00:00
|
|
|
'perms' => '$user->hasRight("ecm", "read") || $user->hasRight("ecm", "upload")',
|
|
|
|
|
'enabled' => '$user->hasRight("ecm", "read") || $user->hasRight("ecm", "upload")',
|
2024-03-12 23:30:45 +00:00
|
|
|
'target' => '',
|
|
|
|
|
'user' => 2, // 0=Menu for internal users, 1=external users, 2=both
|
2021-02-07 21:04:46 +00:00
|
|
|
);
|
2008-05-02 03:55:09 +00:00
|
|
|
$r++;
|
2009-05-04 11:40:00 +00:00
|
|
|
|
2021-02-07 21:04:46 +00:00
|
|
|
$this->menu[$r] = array(
|
2024-03-12 23:30:45 +00:00
|
|
|
'fk_menu' => 'fk_mainmenu=ecm,fk_leftmenu=ecm',
|
|
|
|
|
'type' => 'left',
|
|
|
|
|
'titre' => 'ECMSectionsManual',
|
|
|
|
|
'mainmenu' => 'ecm',
|
|
|
|
|
'leftmenu' => 'ecm_manual',
|
|
|
|
|
'url' => '/ecm/index.php?action=file_manager&mainmenu=ecm&leftmenu=ecm',
|
|
|
|
|
'langs' => 'ecm',
|
|
|
|
|
'position' => 102,
|
2025-09-29 18:41:32 +00:00
|
|
|
'perms' => '$user->hasRight("ecm", "read") || $user->hasRight("ecm", "upload")',
|
|
|
|
|
'enabled' => '$user->hasRight("ecm", "read") || $user->hasRight("ecm", "upload")',
|
2024-03-12 23:30:45 +00:00
|
|
|
'target' => '',
|
|
|
|
|
'user' => 2, // 0=Menu for internal users, 1=external users, 2=both
|
2021-02-07 21:04:46 +00:00
|
|
|
);
|
2008-05-02 03:55:09 +00:00
|
|
|
$r++;
|
2009-05-04 11:40:00 +00:00
|
|
|
|
2021-02-07 21:04:46 +00:00
|
|
|
$this->menu[$r] = array(
|
2024-03-12 23:30:45 +00:00
|
|
|
'fk_menu' => 'fk_mainmenu=ecm,fk_leftmenu=ecm',
|
|
|
|
|
'type' => 'left',
|
|
|
|
|
'titre' => 'ECMSectionsAuto',
|
|
|
|
|
'mainmenu' => 'ecm',
|
|
|
|
|
'url' => '/ecm/index_auto.php?action=file_manager&mainmenu=ecm&leftmenu=ecm',
|
|
|
|
|
'langs' => 'ecm',
|
|
|
|
|
'position' => 103,
|
2025-09-29 18:41:32 +00:00
|
|
|
'perms' => '$user->hasRight("ecm", "read") || $user->hasRight("ecm", "upload")',
|
|
|
|
|
'enabled' => '($user->hasRight("ecm", "read") || $user->hasRight("ecm", "upload")) && !getDolGlobalInt("ECM_AUTO_TREE_HIDEN")',
|
2024-03-12 23:30:45 +00:00
|
|
|
'target' => '',
|
|
|
|
|
'user' => 2, // 0=Menu for internal users, 1=external users, 2=both
|
2022-11-14 01:34:09 +00:00
|
|
|
);
|
|
|
|
|
$r++;
|
|
|
|
|
|
|
|
|
|
$this->menu[$r] = array(
|
2024-03-12 23:30:45 +00:00
|
|
|
'fk_menu' => 'fk_mainmenu=ecm,fk_leftmenu=ecm',
|
|
|
|
|
'type' => 'left',
|
|
|
|
|
'titre' => 'ECMSectionsMedias',
|
|
|
|
|
'mainmenu' => 'ecm',
|
|
|
|
|
'url' => '/ecm/index_medias.php?action=file_manager&mainmenu=ecm&leftmenu=ecm',
|
|
|
|
|
'langs' => 'ecm',
|
|
|
|
|
'position' => 104,
|
2025-09-29 18:41:32 +00:00
|
|
|
'perms' => '$user->hasRight("ecm", "read") || $user->hasRight("ecm", "upload")',
|
|
|
|
|
'enabled' => '($user->hasRight("ecm", "read") || $user->hasRight("ecm", "upload")) && getDolGlobalInt("MAIN_FEATURES_LEVEL") == 2',
|
2024-03-12 23:30:45 +00:00
|
|
|
'target' => '',
|
|
|
|
|
'user' => 2, // 0=Menu for internal users, 1=external users, 2=both
|
2021-02-07 21:04:46 +00:00
|
|
|
);
|
2014-04-27 23:46:11 +00:00
|
|
|
$r++;
|
2008-02-19 19:10:24 +00:00
|
|
|
}
|
|
|
|
|
}
|