* * 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 * the Free Software Foundation; either version 3 of the License, or * (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 * along with this program. If not, see . */ /** * \file htdocs/ecm/class/htmlecm.form.class.php * \brief File of class to manage HTML component for ECM and generic filemanager */ require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php'; /** * Class to manage HTML component for ECM and generic filemanager */ class FormEcm { /** * @var DoliDB Database handler. */ public $db; /** * @var string Error code (or message) */ public $error = ''; /** * Constructor * * @param DoliDB $db Database handler */ public function __construct($db) { $this->db = $db; } /** * Return list of sections * * @param int $selected Id of preselected section * @param string $select_name Name of HTML select component * @param string $module Module ('ecm', 'medias', ...) * @param array $ids_to_ignore Array of id to ignore * @return string String with HTML select */ public function selectAllSections($selected = 0, $select_name = '', $module = 'ecm', $ids_to_ignore = array()) { global $conf, $langs; $langs->load("ecm"); if ($select_name == '') { $select_name = "catParent"; } if (!is_array($ids_to_ignore)) { $ids_to_ignore = array($ids_to_ignore); } $cate_arbo = null; if ($module == 'ecm') { $cat = new EcmDirectory($this->db); $cate_arbo = $cat->get_full_arbo(); } elseif ($module == 'medias') { include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $path = $conf->medias->multidir_output[$conf->entity]; $cate_arbo = dol_dir_list($path, 'directories', 1, '', array('(\.meta|_preview.*\.png)$', '^\.'), 'relativename', SORT_ASC); } $output = ''; $output .= ajax_combobox($select_name); $output .= "\n"; return $output; } }