// creation if (!$draw->_id) { // author = self $draw->author_id = $user->_id; $draw->_ref_author = $user; $draw->file_type = "image/svg+xml"; $draw->file_name = "Sans titre"; // context if ($object && $object->_id) { $draw->setObject($object); } else { $draw->setObject($user); } $draw->loadTargetObject(); } $file_categories = CFilesCategory::listCatClass($draw->_class); $category = new CDrawingCategory(); $where = array("user_id" => " = '{$user->_id}'"); $categories_user = $category->loadList($where); $where = array("function_id" => " = '{$user->function_id}'"); $categories_function = $category->loadList($where); $where = array("group_id" => " = '{$user->_ref_function}->group_id'"); $categories_group = $category->loadList($where); /** @var CDrawingCategory[] $categories */ $categories = $categories_user + $categories_function + $categories_group; foreach ($functions as $_function) { $where = array("function_id" => " = '{$_function->_id}'"); $categories_function = $category->loadList($where); $categories = array_merge($categories, $categories_function); } foreach ($categories as $_category) {
<?php /** * $Id: upload_file.php 20498 2013-09-29 19:08:17Z phenxdesign $ * * @category Files * @package Mediboard * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision: 20498 $ * @link http://www.mediboard.org */ $object = mbGetObjectFromGetOrSession("object_class", "object_id", "object_guid"); $file_category_id = CValue::getOrSession("file_category_id"); $_rename = CValue::getOrSession("_rename"); $uploadok = CValue::get("uploadok"); $private = CValue::get("private"); $named = CValue::get("named"); $listCategory = CFilesCategory::listCatClass($object->_class); $file = new CFile(); $file->private = $private; // Création du template $smarty = new CSmartyDP(); $smarty->assign("object", $object); $smarty->assign("file_category_id", $file_category_id); $smarty->assign("uploadok", $uploadok); $smarty->assign("listCategory", $listCategory); $smarty->assign("_rename", $_rename); $smarty->assign("named", $named); $smarty->assign("file", $file); $smarty->display("upload_file.tpl");
$prat_id = $compte_rendu->user_id; $templateManager->valueMode = false; $templateManager->loadLists($compte_rendu->user_id, $compte_rendu->_id); $templateManager->applyTemplate($compte_rendu); } $templateManager->initHTMLArea(); } // Class and fields $listObjectClass = array(); $listObjectAffichage = array(); foreach (CCompteRendu::getTemplatedClasses() as $valueClass => $localizedClassName) { $listObjectClass[$valueClass] = array(); $listObjectAffichage[$valueClass] = utf8_encode($localizedClassName); } foreach ($listObjectClass as $keyClass => $value) { $listCategory = CFilesCategory::listCatClass($keyClass); foreach ($listCategory as $keyCat => $valueCat) { $listObjectClass[$keyClass][$keyCat] = utf8_encode($listCategory[$keyCat]->nom); } } // Headers and footers $headers = array(); $prefaces = array(); $endings = array(); $footers = array(); if ($compte_rendu->_id) { // Si modèle de fonction, on charge en fonction d'un des praticiens de la fonction if ($compte_rendu->user_id) { $owner = 'prat'; $id = $compte_rendu->user_id; } else {
case "CSejour": /** @var $object CSejour */ $user_id = $object->praticien_id; break; case "COperation": /** @var $object COperation */ $user_id = $object->chir_id; break; default: $user_id = $curr_user->_id; } $user->load($user_id); } $function = $user->loadRefFunction(); // Chargement des catégories $listCategory = CFilesCategory::listCatClass($compte_rendu->object_class); // Décompte des imprimantes disponibles pour l'impression serveur $nb_printers = $curr_user->loadRefFunction()->countBackRefs("printers"); // Gestion du template $templateManager = new CTemplateManager($_GET); $templateManager->isModele = false; $templateManager->document = $compte_rendu->_source; $object->fillTemplate($templateManager); $templateManager->loadHelpers($user->_id, $compte_rendu->object_class, $curr_user->function_id); $templateManager->loadLists($user->_id, $modele_id ? $modele_id : $compte_rendu->modele_id); $templateManager->applyTemplate($compte_rendu); $lists = $templateManager->getUsedLists($templateManager->allLists); // Afficher le bouton correpondant si on détecte un élément de publipostage $isCourrier = $templateManager->isCourrier(); $destinataires = array(); if ($isCourrier) {
/** * Load files for on object * * @param CMbObject $object object to load the files * * @return array[][] */ static function loadDocItemsByObject(CMbObject $object) { if (!$object->_ref_files) { $object->loadRefsFiles(); } if (!$object->_ref_documents) { $object->loadRefsDocs(); } //Création du tableau des catégorie pour l'affichage $affichageFile = array(array("name" => CAppUI::tr("CFilesCategory.none"), "items" => array())); foreach (CFilesCategory::listCatClass($object->_class) as $_cat) { $affichageFile[$_cat->_id] = array("name" => $_cat->nom, "items" => array()); } //Ajout des fichiers dans le tableau foreach ($object->_ref_files as &$_file) { $cat_id = $_file->file_category_id ? $_file->file_category_id : 0; $affichageFile[$cat_id]["items"]["{$_file->file_name}-{$_file->_guid}"] =& $_file; if (!isset($affichageFile[$cat_id]["name"])) { $affichageFile[$cat_id]["name"] = ''; } } //Ajout des document dans le tableau foreach ($object->_ref_documents as &$_doc) { $_doc->isLocked(); $cat_id = $_doc->file_category_id ? $_doc->file_category_id : 0; $affichageFile[$cat_id]["items"]["{$_doc->nom}-{$_doc->_guid}"] =& $_doc; if (!isset($affichageFile[$cat_id]["name"])) { $affichageFile[$cat_id]["name"] = ''; } } // Classement des Fichiers et des document par Ordre alphabétique foreach ($affichageFile as $keyFile => $currFile) { ksort($affichageFile[$keyFile]["items"]); } return $affichageFile; }