/** * @see parent::getPerm() */ function getPerm($permType) { $this->loadRefAuthor(); $this->loadRefCategory(); // Permission de base $perm = parent::getPerm($permType); // Il faut au moins avoir le droit de lecture sur la catégories if ($this->file_category_id) { $perm &= $this->_ref_category->getPerm(PERM_READ); } // Gestion d'un document confidentiel if ($this->private) { $sameFunction = $this->_ref_author->function_id == CMediusers::get()->function_id; $isAdmin = CMediusers::get()->isAdmin(); $perm &= $sameFunction || $isAdmin; } return $perm; }
// 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$ * * @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(); $do = CValue::get("do", "0"); // Auto send categories $category = new CFilesCategory(); $category->send_auto = "1"; foreach ($categories = $category->loadMatchingList() as $_category) { $_category->countDocItems(); $_category->countUnsentDocItems(); } // Unsent docItems $max_load = CAppUI::conf("dPfiles CDocumentSender auto_max_load"); $where["file_category_id"] = CSQLDataSource::prepareIn(array_keys($categories)); $where["etat_envoi"] = "!= 'oui'"; $where["object_id"] = "IS NOT NULL"; $file = new CFile(); $items["CFile"] = $file->loadList($where, "file_id DESC", $max_load); $count["CFile"] = $file->countList($where); $document = new CCompteRendu(); $items["CCompteRendu"] = $document->loadList($where, "compte_rendu_id DESC", $max_load);
<?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");
<?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 */ $object_class = CValue::get("object_class"); $keywords = CValue::post("keywords_category"); $order = "nom"; $categories = array(); $instance = new CFilesCategory(); $where = array($instance->_spec->ds->prepare("`class` IS NULL OR `class` = %", $object_class)); $categories = array_merge($categories, $instance->seek($keywords, $where, null, null, null, $order)); $smarty = new CSmartyDP(); $smarty->assign("categories", $categories); $smarty->assign("nodebug", true); $smarty->assign("keywords", $keywords); $smarty->display("inc_category_autocomplete.tpl");
$page = intval(CValue::get('page', 0)); $filter = CValue::getOrSession("filter", ""); $eligible_file_view = CValue::getOrSession("eligible_file_view"); $class = CValue::getOrSession("class"); $step = 25; $order = "class, nom"; $where = array(); if ($eligible_file_view == "1") { $where["eligible_file_view"] = "= '1'"; } if ($eligible_file_view == "0") { $where["eligible_file_view"] = "= '0'"; } if ($class) { $where["class"] = "= '{$class}'"; } $category = new CFilesCategory(); if ($filter) { $categories = $category->seek($filter, $where, "{$page}, {$step}", true, null, $order); $total_categories = $category->_totalSeek; } else { $categories = $category->loadList($where, $order, "{$page}, {$step}"); $total_categories = $category->countList($where); } // Création du template $smarty = new CSmartyDP(); $smarty->assign("categories", $categories); $smarty->assign("total_categories", $total_categories); $smarty->assign("page", $page); $smarty->assign("step", $step); $smarty->display("inc_list_categories.tpl");
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) {
if ($listFile[$elementId]->_canRead) { $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)) {
/** * 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; }
<?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");
} $operations = $_sejour->loadRefsOperations(); CMbObject::filterByPerm($operations); foreach ($operations as $_op) { $_op->loadRefsFiles(); foreach ($_op->_ref_files as $_key => $_file) { $right = $_file->canDo(); if (!$_file->isImage() || !$_file->_can->read || $_file->annule) { unset($_op->_ref_files[$_key]); continue; } } } } // file categories $category = new CFilesCategory(); $categories = $category->loadListWithPerms(PERM_EDIT); $matrices = array(); $matrices["1x2"] = array("line" => 2, "col" => 1); $matrices["2x1"] = array("line" => 1, "col" => 2); $matrices["2x2"] = array("line" => 2, "col" => 2); $matrices["2x3"] = array("line" => 3, "col" => 2); $matrices["3x2"] = array("line" => 2, "col" => 3); $matrices["3x3"] = array("line" => 3, "col" => 3); $smarty = new CSmartyDP(); $smarty->assign("patient", $patient); $smarty->assign("context", $context); $smarty->assign("matrices", $matrices); $smarty->assign("categories", $categories); $smarty->assign("default_disposition", $default_disposition); $smarty->display("inc_img_to_document.tpl");
* @version $Revision$ * @link http://www.mediboard.org */ CCanDo::checkEdit(); //get $document_guid = CValue::get("document_guid"); $patient_id = CValue::get("patient_id"); /** @var CDocumentExterne $document */ $document = CMbObject::loadFromGuid($document_guid); if (!$document->_id) { CAppUI::stepAjax("PB"); } $account = $document->loadRefAccount(); //$praticien = $account->loadRefMediuser(); $file = $document->loadRefFile(true); $cat = new CFilesCategory(); $cats = $cat->loadListWithPerms(); if (!$file->_id) { CAppUI::stepAjax("CBioServeurAccount-msg-no_file_id_spectified_for_moving", UI_MSG_ERROR); } $file->loadTargetObject(); //finding patient $patient = $document->findPatient(); //smarty $smarty = new CSmartyDP("modules/messagerie"); $smarty->assign("file", $file); $smarty->assign("file_categories", $cats); //$smarty->assign("praticien", $praticien); $smarty->assign("document", $document); $smarty->assign("guessing_date", $document->document_date); $smarty->assign("patient", $patient);
/** * $Id$ * * @category dPfiles * @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::checkRead(); $user = CUser::get(); $object_guid = CValue::get("object_guid"); $object = CMbObject::loadFromGuid($object_guid); $category = new CFilesCategory(); $category->eligible_file_view = 1; $categories = $category->loadMatchingList(); $nb_unread = 0; foreach ($categories as $_cat) { $file = new CFile(); $file->file_category_id = $_cat->_id; $file->setObject($object); /** @var CFile[] $files */ $_cat->_ref_files = $file->loadMatchingList(); foreach ($_cat->_ref_files as $file_id => $_file) { $_file->loadRefReadStatus($user->_id); if (!$_file->_ref_read_status->_id) { $nb_unread++; } else { unset($_cat->_ref_files[$file_id]);
/** * Charge les modèles par catégorie * * @param string $catName nom de la catégorie * @param array $where1 [optional] * @param string $order [optional] * @param boolean $horsCat [optional] * * @return array */ static function loadModeleByCat($catName, $where1 = null, $order = "nom", $horsCat = null) { $ds = CSQLDataSource::get("std"); $where = array(); if (is_array($catName)) { $where = array_merge($where, $catName); } elseif (is_string($catName)) { $where["nom"] = $ds->prepare("= %", $catName); } $category = new CFilesCategory(); $resultCategory = $category->loadList($where); $documents = array(); if (count($resultCategory) || $horsCat) { $where = array(); if ($horsCat) { $resultCategory[0] = ""; $where[] = "file_category_id IS NULL OR file_category_id " . CSQLDataSource::prepareIn(array_keys($resultCategory)); } else { $where["file_category_id"] = CSQLDataSource::prepareIn(array_keys($resultCategory)); } $where["object_id"] = " IS NULL"; if ($where1) { if (is_array($where1)) { $where = array_merge($where, $where1); } elseif (is_string($where1)) { $where[] = $where1; } } $resultDoc = new CCompteRendu(); $documents = $resultDoc->loadList($where, $order); } return $documents; }
foreach ($_modele->childNodes as $_node) { if (in_array($_node->nodeName, CCompteRendu::$fields_import_export)) { $modele->{$_node->nodeName} = $_node->nodeValue; } } $modele->nom = utf8_decode($modele->nom); // Mapping de l'entête, pieds de page, introduction, conclusion foreach ($components as $_component) { if ($modele->{$_component}) { $modele->{$_component} = $modeles_ids[$modele->{$_component}]; } } // Recherche de la catégorie $cat = utf8_decode($_modele->getAttribute("cat")); if ($cat) { $categorie = new CFilesCategory(); $categorie->nom = $cat; if (!$categorie->loadMatchingObject()) { $categorie->store(); } $modele->file_category_id = $categorie->_id; } if ($msg = $modele->store()) { CAppUI::stepAjax($modele->nom . " - " . $msg, UI_MSG_ERROR); continue; } CAppUI::stepAjax($modele->nom . " - " . CAppUI::tr("CCompteRendu-msg-create"), UI_MSG_OK); // On garde la référence entre l'id provenant du xml et l'id en base $modeles_ids[$_modele->getAttribute("modele_id")] = $modele->_id; } CAppUI::js("window.opener.getForm('filterModeles').onsubmit()");
$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 {
$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();
/** * Get the list of categories for a specific class * * @param string $class Class name * * @return self[] */ static function listCatClass($class = null) { $instance = new CFilesCategory(); $where = array($instance->_spec->ds->prepare("`class` IS NULL OR `class` = %", $class)); return $instance->loadListWithPerms(PERM_READ, $where, "nom"); }