2008-02-19 20:10:24 +01:00
|
|
|
<?php
|
|
|
|
|
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
2020-06-28 22:05:55 +02:00
|
|
|
* Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
|
2008-02-19 20:10:24 +01: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 15:36:08 +01:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2008-02-19 20:10:24 +01: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 21:55:30 +02:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2008-02-19 20:10:24 +01:00
|
|
|
*/
|
|
|
|
|
|
2009-07-30 00:52:08 +02:00
|
|
|
/** \defgroup ecm Module ecm
|
2009-03-09 00:57:28 +01:00
|
|
|
* \brief Module for ECM (Electronic Content Management)
|
2011-10-24 14:11:49 +02:00
|
|
|
* \file htdocs/core/modules/modECM.class.php
|
2011-08-31 12:27:17 +02:00
|
|
|
* \ingroup ecm
|
2021-03-20 13:55:43 +01:00
|
|
|
* \brief Description and activation file for the module ECM
|
2009-03-09 00:57:28 +01:00
|
|
|
*/
|
2008-02-19 20:10:24 +01:00
|
|
|
|
2020-04-10 10:59:32 +02:00
|
|
|
include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
|
2008-02-19 20:10:24 +01:00
|
|
|
|
|
|
|
|
|
2012-10-03 00:30:50 +02:00
|
|
|
/**
|
|
|
|
|
* Description and activation class for module ECM
|
2009-03-09 00:57:28 +01:00
|
|
|
*/
|
2008-02-19 20:10:24 +01:00
|
|
|
class modECM extends DolibarrModules
|
|
|
|
|
{
|
|
|
|
|
|
2020-10-31 14:32:18 +01:00
|
|
|
/**
|
|
|
|
|
* Constructor. Define names, constants, directories, boxes, permissions
|
|
|
|
|
*
|
|
|
|
|
* @param DoliDB $db Database handler
|
|
|
|
|
*/
|
|
|
|
|
public function __construct($db)
|
2008-02-19 20:10:24 +01:00
|
|
|
{
|
2012-01-04 21:23:50 +01:00
|
|
|
$this->db = $db;
|
2009-05-04 13:40:00 +02:00
|
|
|
|
2008-02-19 20:10:24 +01:00
|
|
|
// Id for module (must be unique).
|
|
|
|
|
// Use here a free id.
|
|
|
|
|
$this->numero = 2500;
|
2009-05-04 13:40:00 +02:00
|
|
|
|
2008-02-19 20:10:24 +01:00
|
|
|
// Family can be 'crm','financial','hr','projects','product','ecm','technic','other'
|
2009-05-04 13:40:00 +02:00
|
|
|
// It is used to sort modules in module setup page
|
|
|
|
|
$this->family = "ecm";
|
2018-10-06 11:57:53 +02:00
|
|
|
$this->module_position = '10';
|
2008-10-01 21:10:17 +02: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 11:55:16 +01:00
|
|
|
$this->name = preg_replace('/^mod/i', '', get_class($this));
|
2008-02-19 20:10:24 +01: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 13:40:00 +02:00
|
|
|
$this->version = 'dolibarr';
|
2008-02-19 20:10:24 +01:00
|
|
|
// Key used in llx_const table to save module status enabled/disabled (XXX is id value)
|
2008-10-06 09:39:52 +02:00
|
|
|
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
2008-02-19 20:10:24 +01:00
|
|
|
// Name of png file (without png) used for this module
|
2021-02-15 20:13:38 +01:00
|
|
|
$this->picto = 'folder-open';
|
2009-05-04 13:40:00 +02:00
|
|
|
|
2008-02-19 20:10:24 +01:00
|
|
|
// Data directories to create when module is enabled
|
2017-08-04 13:51:25 +02:00
|
|
|
$this->dirs = array("/ecm/temp");
|
2009-05-04 13:40:00 +02:00
|
|
|
|
2008-02-19 20:10:24 +01:00
|
|
|
// Config pages. Put here list of php page names stored in admmin directory used to setup module
|
2013-03-04 16:59:39 +01:00
|
|
|
$this->config_page_url = array('ecm.php');
|
2009-05-04 13:40:00 +02:00
|
|
|
|
2008-02-19 20:10:24 +01:00
|
|
|
// Dependencies
|
2020-04-10 10:59:32 +02: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 13:40:00 +02:00
|
|
|
|
2008-02-19 20:10:24 +01:00
|
|
|
// Constants
|
2020-04-10 10:59:32 +02:00
|
|
|
$this->const = array(); // List of parameters
|
|
|
|
|
$r = 0;
|
2014-04-28 01:46:11 +02:00
|
|
|
|
2008-02-19 20:10:24 +01:00
|
|
|
// Boxes
|
2020-04-10 10:59:32 +02:00
|
|
|
$this->boxes = array(); // List of boxes
|
|
|
|
|
$r = 0;
|
2009-05-04 13:40:00 +02:00
|
|
|
|
2011-10-24 14:11:49 +02:00
|
|
|
// Add here list of php file(s) stored in core/boxes that contains class to show a box.
|
2008-02-19 20:10:24 +01:00
|
|
|
// Example:
|
2020-10-31 14:32:18 +01:00
|
|
|
//$this->boxes[$r][1] = "myboxa.php";
|
|
|
|
|
//$r++;
|
|
|
|
|
//$this->boxes[$r][1] = "myboxb.php";
|
|
|
|
|
//$r++;
|
2008-02-19 20:10:24 +01:00
|
|
|
|
|
|
|
|
// Permissions
|
2020-04-10 10:59:32 +02:00
|
|
|
$this->rights_class = 'ecm'; // Permission key
|
|
|
|
|
$this->rights = array(); // Permission array used by this module
|
2008-02-25 00:29:30 +01:00
|
|
|
|
|
|
|
|
$r++;
|
2010-10-01 19:59:02 +02:00
|
|
|
$this->rights[$r][0] = 2501;
|
2020-06-28 22:05:55 +02:00
|
|
|
$this->rights[$r][1] = 'Read or download documents';
|
2008-02-25 00:29:30 +01:00
|
|
|
$this->rights[$r][2] = 'r';
|
2016-06-04 12:16:30 +02:00
|
|
|
$this->rights[$r][3] = 0;
|
2011-04-05 11:50:10 +02:00
|
|
|
$this->rights[$r][4] = 'read';
|
2008-02-25 00:29:30 +01:00
|
|
|
|
|
|
|
|
$r++;
|
2011-04-05 11:50:10 +02:00
|
|
|
$this->rights[$r][0] = 2503;
|
2020-06-28 22:05:55 +02:00
|
|
|
$this->rights[$r][1] = 'Upload a document';
|
2008-02-25 00:29:30 +01:00
|
|
|
$this->rights[$r][2] = 'w';
|
2016-06-04 12:16:30 +02:00
|
|
|
$this->rights[$r][3] = 0;
|
2008-12-16 20:12:42 +01:00
|
|
|
$this->rights[$r][4] = 'upload';
|
2008-02-25 00:29:30 +01:00
|
|
|
|
|
|
|
|
$r++;
|
|
|
|
|
$this->rights[$r][0] = 2515;
|
2020-06-28 22:05:55 +02:00
|
|
|
$this->rights[$r][1] = 'Administer directories of documents';
|
2008-02-25 00:29:30 +01:00
|
|
|
$this->rights[$r][2] = 'w';
|
2016-06-04 12:16:30 +02:00
|
|
|
$this->rights[$r][3] = 0;
|
2008-02-25 00:29:30 +01:00
|
|
|
$this->rights[$r][4] = 'setup';
|
|
|
|
|
|
2009-05-04 13:40:00 +02:00
|
|
|
|
2020-10-31 14:32:18 +01:00
|
|
|
// Menus
|
2008-02-19 20:10:24 +01:00
|
|
|
//------
|
2020-04-10 10:59:32 +02:00
|
|
|
$this->menus = array(); // List of menus to add
|
|
|
|
|
$r = 0;
|
2009-05-04 13:40:00 +02:00
|
|
|
|
2008-05-02 16:19:56 +02:00
|
|
|
// Top menu
|
2021-02-07 22:04:46 +01:00
|
|
|
$this->menu[$r] = array(
|
|
|
|
|
'fk_menu'=>0,
|
|
|
|
|
'type'=>'top',
|
|
|
|
|
'titre'=>'MenuECM',
|
2021-03-13 18:56:02 +01:00
|
|
|
'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth"'),
|
2021-02-07 22:04:46 +01:00
|
|
|
'mainmenu'=>'ecm',
|
|
|
|
|
'url'=>'/ecm/index.php',
|
|
|
|
|
'langs'=>'ecm',
|
|
|
|
|
'position'=>82,
|
|
|
|
|
'perms'=>'$user->rights->ecm->read || $user->rights->ecm->upload || $user->rights->ecm->setup',
|
|
|
|
|
'enabled'=>'$conf->ecm->enabled',
|
|
|
|
|
'target'=>'',
|
|
|
|
|
'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
|
|
|
|
|
);
|
2008-02-19 20:10:24 +01:00
|
|
|
$r++;
|
2008-05-02 05:55:09 +02:00
|
|
|
|
2008-05-02 16:19:56 +02:00
|
|
|
// Left menu linked to top menu
|
2021-02-07 22:04:46 +01:00
|
|
|
$this->menu[$r] = array(
|
|
|
|
|
'fk_menu'=>'fk_mainmenu=ecm',
|
|
|
|
|
'type'=>'left',
|
|
|
|
|
'titre'=>'ECMArea',
|
|
|
|
|
'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth"'),
|
|
|
|
|
'mainmenu'=>'ecm',
|
|
|
|
|
'leftmenu'=>'ecm',
|
|
|
|
|
'url'=>'/ecm/index.php?mainmenu=ecm&leftmenu=ecm',
|
|
|
|
|
'langs'=>'ecm',
|
|
|
|
|
'position'=>101,
|
|
|
|
|
'perms'=>'$user->rights->ecm->read || $user->rights->ecm->upload',
|
|
|
|
|
'enabled'=>'$user->rights->ecm->read || $user->rights->ecm->upload',
|
|
|
|
|
'target'=>'',
|
|
|
|
|
'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
|
|
|
|
|
);
|
2008-05-02 05:55:09 +02:00
|
|
|
$r++;
|
2009-05-04 13:40:00 +02:00
|
|
|
|
2021-02-07 22:04:46 +01:00
|
|
|
$this->menu[$r] = array(
|
|
|
|
|
'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,
|
|
|
|
|
'perms'=>'$user->rights->ecm->read || $user->rights->ecm->upload',
|
|
|
|
|
'enabled'=>'$user->rights->ecm->read || $user->rights->ecm->upload',
|
|
|
|
|
'target'=>'',
|
|
|
|
|
'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
|
|
|
|
|
);
|
2008-05-02 05:55:09 +02:00
|
|
|
$r++;
|
2009-05-04 13:40:00 +02:00
|
|
|
|
2021-02-07 22:04:46 +01:00
|
|
|
$this->menu[$r] = array(
|
|
|
|
|
'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,
|
|
|
|
|
'perms'=>'$user->rights->ecm->read || $user->rights->ecm->upload',
|
2023-01-02 02:23:28 +01:00
|
|
|
'enabled'=>'($user->rights->ecm->read || $user->rights->ecm->upload) && !getDolGlobalInt("ECM_AUTO_TREE_HIDEN")',
|
2022-11-14 02:34:09 +01:00
|
|
|
'target'=>'',
|
|
|
|
|
'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
|
|
|
|
|
);
|
|
|
|
|
$r++;
|
|
|
|
|
|
|
|
|
|
$this->menu[$r] = array(
|
|
|
|
|
'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,
|
|
|
|
|
'perms'=>'$user->rights->ecm->read || $user->rights->ecm->upload',
|
|
|
|
|
'enabled'=>'($user->rights->ecm->read || $user->rights->ecm->upload) && getDolGlobalInt("MAIN_FEATURES_LEVEL") == 2',
|
2021-02-07 22:04:46 +01:00
|
|
|
'target'=>'',
|
|
|
|
|
'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
|
|
|
|
|
);
|
2014-04-28 01:46:11 +02:00
|
|
|
$r++;
|
2008-02-19 20:10:24 +01:00
|
|
|
}
|
|
|
|
|
}
|