$fileSel = $listFile[$elementId]; $file_id = $fileSel->_id; if ($pdf_active && $type == "_ref_documents") { $compte_rendu = new CCompteRendu(); $compte_rendu->load($elementId); $compte_rendu->loadFile(); $fileSel = $compte_rendu->_ref_file; $file_id = $fileSel->_id; } $keyTable = $listFile[$elementId]->_spec->key; $keyFileSel = $listFile[$elementId]->{$nameFile}; $keyFileSel .= "-" . $elementClass . "-"; $keyFileSel .= $listFile[$elementId]->{$keyTable}; // Récupération de la catégorie $catFileSel = new CFilesCategory(); $catFileSel->load($fileSel->file_category_id); } } else { CAppUI::stepAjax(CAppUI::tr("CDocumentItem-_not_available"), UI_MSG_WARNING); CApp::rip(); } } else { // Objet Inexistant $object = null; } } $show_editor = true; // Gestion des pages pour les Fichiers PDF et fichiers TXT if ($fileSel && $elementClass == "CFile" && !$acces_denied) { if (file_exists($fileSel->_file_path)) { $raw_content = file_get_contents($fileSel->_file_path);
$destination_guid = CValue::get("destination_guid"); $name = CValue::get("file_name"); $category_id = CValue::get("category_id"); $allowed = array("CFile", "CCompteRendu"); if (!in_array($file_class, $allowed)) { CAppUI::stepAjax("CFile-msg-not_allowed_object_to_move", UI_MSG_ERROR); } /** @var CFile|CCompteRendu $file */ $file = new $file_class(); $file->load($file_id); $file->file_category_id = $category_id && $category_id != $file->file_category_id ? $category_id : $file->file_category_id; if ($file instanceof CFile) { $file->file_name = $name ? $name : $file->file_name; } $destination = CStoredObject::loadFromGuid($destination_guid); if ($file->object_id == $destination->_id && $file->object_class == $destination->_class) { CAppUI::stepAjax("CFile-msg-from_equal_to", UI_MSG_ERROR); } $file->setObject($destination); // check category $cat = new CFilesCategory(); $cat->load($file->file_category_id); if ($cat->class && $cat->class != $destination->_class) { $file->file_category_id = ""; } if ($msg = $file->store()) { CAppUI::setMsg($msg, UI_MSG_ERROR); } else { CAppUI::setMsg("CFile-msg-moved"); } echo CAppUI::getMsg();
<?php /** * $Id$ * * @category Files * @package Mediboard * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ * @link http://www.mediboard.org */ CCanDo::checkEdit(); $category_id = CValue::getOrSession("category_id"); $category = new CFilesCategory(); $category->load($category_id); $category->countDocItems(); $category->loadRefsNotes(); $listClass = CApp::getChildClasses(); $classes = array(); foreach ($listClass as $key => $_class) { $classes[$_class] = CAppUI::tr($_class); } asort($classes); $smarty = new CSmartyDP(); $smarty->assign("category", $category); $smarty->assign("listClass", $classes); $smarty->display("inc_form_category.tpl");