示例#1
0
 /**
  * Insertion des modèles par référence pour les packs
  *
  * @return boolean
  */
 protected function setupAddmodeles()
 {
     $ds = $this->ds;
     $query = "SELECT * from pack;";
     $packs = $ds->loadList($query);
     foreach ($packs as $_pack) {
         if ($_pack['modeles'] == '') {
             continue;
         }
         $modeles = explode("|", $_pack['modeles']);
         if (count($modeles) == 0) {
             continue;
         }
         $compterendu = new CCompteRendu();
         foreach ($modeles as $_modele) {
             if (!$compterendu->load($_modele)) {
                 continue;
             }
             $query = "INSERT INTO modele_to_pack (modele_id, pack_id)\r\n                  VALUES ({$_modele}, {$_pack['pack_id']})";
             $ds->exec($query);
         }
     }
     return true;
 }
 /**
  * Charge les listes de choix pour un utilisateur, ou la fonction et l'établissement de l'utilisateur connecté
  *
  * @param int $user_id         identifiant de l'utilisateur
  * @param int $compte_rendu_id identifiant du compte-rendu
  *
  * @return void
  */
 function loadLists($user_id, $compte_rendu_id = 0)
 {
     $where = array();
     $user = CMediusers::get($user_id);
     $user->loadRefFunction();
     if ($user_id) {
         $where[] = "(\n        user_id = '{$user->user_id}' OR\n        function_id = '{$user->function_id}' OR\n        group_id = '{$user->_ref_function->group_id}'\n      )";
     } else {
         $compte_rendu = new CCompteRendu();
         $compte_rendu->load($compte_rendu_id);
         $where[] = "(\n        function_id IN('{$user->function_id}', '{$compte_rendu->function_id}') OR\n        group_id IN('{$user->_ref_function->group_id}', '{$compte_rendu->group_id}')\n      )";
     }
     $where[] = $user->getDS()->prepare("`compte_rendu_id` IS NULL OR compte_rendu_id = %", $compte_rendu_id);
     $order = "user_id, function_id, group_id, nom ASC";
     $lists = new CListeChoix();
     $this->allLists = $lists->loadList($where, $order);
     foreach ($this->allLists as $list) {
         /** @var CListeChoix $list */
         $this->addList($list->nom);
     }
 }
示例#3
0
 // Application des destinataires
 foreach ($_POST as $key => $value) {
     // Remplacement des destinataires
     if (preg_match("/_dest_([\\w]+)_([0-9]+)/", $key, $dest)) {
         $destinataires[] = $dest;
     }
 }
 if (count($destinataires) && $do_merge) {
     $object = new $_POST["object_class"]();
     /** @var $object CMbObject */
     $object->load($_POST["object_id"]);
     CDestinataire::makeAllFor($object);
     $allDest = CDestinataire::$destByClass;
     // Récupération des correspondants ajoutés par l'autocomplete
     $cr_dest = new CCompteRendu();
     $cr_dest->load($_POST["compte_rendu_id"]);
     $cr_dest->mergeCorrespondantsCourrier($allDest);
     $bodyTag = '<div id="body">';
     // On sort l'en-tête et le pied de page
     $posBody = strpos($_POST["_source"], $bodyTag);
     if ($posBody) {
         $headerfooter = substr($_POST["_source"], 0, $posBody);
         $index_div = strrpos($_POST["_source"], "</div>") - ($posBody + strlen($bodyTag));
         $body = substr($_POST["_source"], $posBody + strlen($bodyTag), $index_div);
     } else {
         $headerfooter = "";
         $body = $_POST["_source"];
     }
     // On fait le doBind avant le foreach si la config est à 1.
     if (CAppUI::conf("dPcompteRendu CCompteRendu multiple_doc_correspondants")) {
         $do->doBind();
示例#4
0
 */
$compte_rendu_id = CValue::get("compte_rendu_id", 0);
$modele_id = CValue::get("modele_id", null);
$praticien_id = CValue::get("praticien_id", 0);
$type = CValue::get("type", 0);
$pack_id = CValue::get("pack_id", 0);
$object_id = CValue::get("object_id", 0);
$switch_mode = CValue::get("switch_mode", 0);
$target_id = CValue::get("target_id");
$target_class = CValue::get("target_class");
$force_fast_edit = CValue::get("force_fast_edit", 0);
// Faire ici le test des différentes variables dont on a besoin
$compte_rendu = new CCompteRendu();
// Modification d'un document
if ($compte_rendu_id) {
    $compte_rendu->load($compte_rendu_id);
    if (!$compte_rendu->_id) {
        CAppUI::stepAjax(CAppUI::tr("CCompteRendu-alert_doc_deleted"));
        CApp::rip();
    }
    $compte_rendu->loadContent();
    $compte_rendu->loadComponents();
    $compte_rendu->loadFile();
} else {
    if ($modele_id == 0 && !$pack_id) {
        $compte_rendu->valueDefaults();
        $compte_rendu->object_id = $object_id;
        $compte_rendu->object_class = $target_class;
        $compte_rendu->_ref_object = new $target_class();
        $compte_rendu->_ref_object->load($object_id);
        $compte_rendu->updateFormFields();
示例#5
0
 * @link     http://www.mediboard.org
 */
CCanDo::checkRead();
$prat_id = CValue::getOrSession("selPrat");
$compte_rendu_id = CValue::getOrSession("compte_rendu_id");
$mediuser = CMediusers::get();
// L'utilisateur est-il praticien?
if (!$prat_id) {
    if ($mediuser->isPraticien()) {
        $prat_id = $mediuser->user_id;
        CValue::setSession("selPrat", $prat_id);
    }
}
// Compte-rendu selectionné
$compte_rendu = new CCompteRendu();
$compte_rendu->load($compte_rendu_id);
// Accès aux modèles de la fonction et de l'établissement
$module = CModule::getActive("dPcompteRendu");
$is_admin = $module && $module->canAdmin();
$access_function = $is_admin || CAppUI::conf("compteRendu CCompteRendu access_function");
$access_group = $is_admin || CAppUI::conf("compteRendu CCompteRendu access_group");
if ($compte_rendu->_id) {
    if ($compte_rendu->function_id && !$access_function) {
        CAppUI::redirect("m=system&a=access_denied");
    }
    if ($compte_rendu->group_id && !$access_group) {
        CAppUI::redirect("m=system&a=access_denied");
    }
}
$compte_rendu->loadContent();
$compte_rendu->loadRefsNotes();
     $nameFile = "file_name";
 }
 if ($elementClass == "CCompteRendu") {
     $type = "_ref_documents";
     $nameFile = "nom";
 }
 if (array_key_exists($elementId, $object->{$type})) {
     $listFile =& $object->{$type};
     $listFile[$elementId]->canRead();
     $acces_denied = !$listFile[$elementId]->_canRead;
     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();
示例#7
0
$where = array();
CApp::setTimeLimit(300);
$loops = CValue::get("loops", 100);
$trunk = CValue::get("trunk", 100);
mbTrace($loops, "loops");
mbTrace($trunk, "trunk");
$problems = array();
for ($loop = 0; $loop < $loops; $loop++) {
    $starting = $loop * $trunk;
    $ds = $doc->_spec->ds;
    $query = "SELECT `compte_rendu`.`compte_rendu_id`, `contenthtml`.`content` \r\n    FROM compte_rendu, contenthtml\r\n    WHERE compte_rendu.content_id = contenthtml.content_id\r\n    ORDER BY compte_rendu_id DESC\r\n    LIMIT {$starting}, {$trunk}";
    $docs = $ds->loadHashList($query);
    foreach ($docs as $doc_id => $doc_source) {
        // Root node surrounding
        $source = utf8_encode("<div>{$doc_source}</div>");
        // Entity purge
        $source = preg_replace("/&\\w+;/i", "", $source);
        // Escape warnings, returns false if really invalid
        $doc = new CMbXMLDocument();
        if (false == ($validation = $doc->loadXML($source))) {
            $doc = new CCompteRendu();
            $doc->load($doc_id);
            $problems[$doc_id] = $doc;
        }
    }
}
mbTrace(count($problems), "Problems count");
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("problems", $problems);
$smarty->display("check_document.tpl");
/**
 * Retourne la source d'un document
 *
 * @category CompteRendu
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  SVN: $Id:\$
 * @link     http://www.mediboard.org
 */
CCanDo::checkRead();
$cr_id = CValue::get("compte_rendu_id");
$update_date_print = CValue::get("update_date_print", 0);
$cr = new CCompteRendu();
$cr->load($cr_id);
if (!$cr->_id) {
    return;
}
$cr->loadContent();
if (!$cr->canRead()) {
    return;
}
// Mise à jour de la date d'impression
if ($update_date_print) {
    $cr->date_print = "now";
    if ($msg = $cr->store()) {
        CAppUI::setMsg($msg, UI_MSG_ERROR);
    }
}
echo "<!DOCTYPE html>\n<html>\n\t<head>\n\t  <link type=\"text/css\" rel=\"stylesheet\" href=\"style/mediboard/htmlarea.css\" media=\"all\" />\n\t</head>\n\t<body>\n\t  {$cr->_source}\n\t</body>\n</html>";
示例#9
0
<?php

/**
 * $Id$
 *  
 * @category CDA
 * @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::checkAdmin();
$cr = new CCompteRendu();
$cr->load($cr->getRandomValue("compte_rendu_id", true));
$factory = CCDAFactory::factory($cr);
$message = $factory->generateCDA();
$treecda = CCdaTools::parse($message);
$xml = CCdaTools::showxml($message);
$smarty = new CSmartyDP();
$smarty->assign("message", $message);
$smarty->assign("treecda", $treecda);
$smarty->assign("xml", $xml);
$smarty->display("inc_highlightcda.tpl");
示例#10
0
             }
             if ($preface_id) {
                 $component = new CCompteRendu();
                 $component->load($preface_id);
                 $component->loadContent();
                 $preface = $component->_source;
             }
             if ($ending_id) {
                 $component = new CCompteRendu();
                 $component->load($ending_id);
                 $component->loadContent();
                 $ending = $component->_source;
             }
             if ($footer_id) {
                 $component = new CCompteRendu();
                 $component->load($footer_id);
                 $component->loadContent();
                 $footer = $component->_source;
                 $sizefooter = $component->height;
             }
             $content = $compte_rendu->loadHTMLcontent($content, $mode, $margins, CCompteRendu::$fonts[$compte_rendu->font], $compte_rendu->size, true, $type, $header, $sizeheader, $footer, $sizefooter, $preface, $ending);
     }
 } else {
     $content = $compte_rendu->loadHTMLcontent($content, $mode, $margins, CCompteRendu::$fonts[$compte_rendu->font], $compte_rendu->size);
 }
 // Traitement du format de la page
 if ($page_format == "") {
     $page_width = round(72 / 2.54 * $page_width, 2);
     $page_height = round(72 / 2.54 * $page_height, 2);
     $page_format = array(0, 0, $page_width, $page_height);
 }
 /**
  * Remplace l'entête ou le pied de page dans une source html
  *
  * @param string $source       HTML source
  * @param int    $component_id Id of the component
  * @param string $type         Type of the component
  *
  * @return string
  */
 static function replaceComponent($source, $component_id, $type = "header")
 {
     if (strpos($source, "<style type=\"text/css\">") === false) {
         $source = "<style type=\"text/css\">\n        #header {\n          height: 0px;\n          /*DOMPDF top: 0;*/\n        }\n\n        #footer {\n          height: 0px;\n          /*DOMPDF bottom: 0;*/\n        }\n        @media print {\n          body {\n            margin-top: 0px;\n          }\n          hr.pagebreak {\n            padding-top: 0px;\n          }\n        }\n        @media dompdf {\n          body {\n            margin-bottom: 0px;\n          }\n          hr.pagebreak {\n            padding-top: 0px;\n          }\n        }</style>\n        <div id=\"body\">" . $source . "</div>";
     }
     switch ($type) {
         case "header":
             $header = new CCompteRendu();
             $header->load($component_id);
             $header->loadContent(true);
             if ($header->_source) {
                 $header->_source = "<div id=\"header\">" . $header->_source . "</div>";
             }
             $height = $header->height ? $header->height : 0;
             $source = preg_replace("/(#header\\s*\\{\\s*height:\\s*)([0-9]*[\\.0-9]*)px;/", '${1}' . $height . 'px;', $source);
             $source = preg_replace("/(body\\s*\\{\\s*margin-top:\\s*)([0-9]*[\\.0-9]*)px;/", '${1}' . $height . 'px;', $source);
             $source = preg_replace("/(body\\s*\\{\\s*padding-top:\\s*)([0-9]*[\\.0-9]*)px;/", '${1}' . $height . 'px;', $source);
             $source = preg_replace("/(hr.pagebreak\\s*\\{\\s*padding-top:\\s*)([0-9]*[\\.0-9]*)px;/", '${1}' . $height . 'px;', $source, 1);
             $pos_style = strpos($source, "</style>") + 9;
             $pos_header = strpos($source, "<div id=\"header\"");
             $pos_footer = strpos($source, "<div id=\"footer\"");
             $pos_body = strpos($source, "<div id=\"body\">");
             if ($pos_header) {
                 if ($pos_footer) {
                     $source = substr_replace($source, $header->_source, $pos_header, $pos_footer - $pos_header);
                 } else {
                     $source = substr_replace($source, $header->_source, $pos_header, $pos_body - $pos_header);
                 }
             } else {
                 if ($pos_footer) {
                     $source = substr_replace($source, $header->_source, $pos_style, $pos_footer - $pos_style);
                 } else {
                     $source = substr_replace($source, $header->_source, $pos_style, 0);
                 }
             }
             break;
         case "footer":
             $footer = new CCompteRendu();
             $footer->load($component_id);
             $footer->loadContent(true);
             if ($footer->_source) {
                 $footer->_source = "<div id=\"footer\">" . $footer->_source . "</div>";
             }
             $height = $footer->height ? $footer->height : 0;
             $source = preg_replace("/(#footer\\s*\\{\\s*footer:\\s*)([0-9]+[\\.0-9]*)px;/", '${1}' . $height . 'px;', $source);
             $source = preg_replace("/(body\\s*\\{\\s*margin-bottom:\\s*)([0-9]+[\\.0-9]*)px;/", '${1}' . $height . 'px;', $source);
             $pos_footer = strpos($source, "<div id=\"footer\"");
             $pos_body = strpos($source, "<div id=\"body\">");
             if ($pos_footer) {
                 $source = substr_replace($source, $footer->_source, $pos_footer, $pos_body - $pos_footer);
             } else {
                 $source = substr_replace($source, $footer->_source, $pos_body, 0);
             }
     }
     return $source;
 }
示例#12
0
<?php

/**
 * Restauration du lien entre un modèle et les documents de même nom
 *
 * @category CompteRendu
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  SVN: $Id:\$
 * @link     http://www.mediboard.org
 */
$modele_id = CValue::get("modele_id");
$do_it = CValue::get("do_it", 0);
$modele = new CCompteRendu();
$modele->load($modele_id);
$where = array();
$where["object_class"] = " = '{$modele->object_class}'";
$where["nom"] = " = '" . addslashes($modele->nom) . "'";
$where["object_id"] = "IS NOT NULL";
$where["modele_id"] = "IS NULL";
$nb = $modele->countList($where);
if ($do_it) {
    $docs = $modele->loadList($where, null, "100");
    /** @var  $docs CCompteRendu[] */
    $converted = 0;
    if ($nb == 0) {
        CApp::rip();
    }
    foreach ($docs as $_doc) {
        $_doc->loadTargetObject();
示例#13
0
 * Génération du PDF d'un compte-rendu et stream au client ou envoi vers une imprimante réseau
 *
 * @category CompteRendu
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  SVN: $Id:\$
 * @link     http://www.mediboard.org
 */
// Si on a un file_id, on stream le pdf
if ($file_id = CValue::post("file_id")) {
    $file = new CFile();
    $file->load($file_id);
    // Mise à jour de la date d'impression
    $cr = new CCompteRendu();
    $cr->load($file->object_id);
    $cr->loadContent();
    $cr->date_print = "now";
    if ($msg = $cr->store()) {
        CAppUI::setMsg($msg, UI_MSG_ERROR);
    }
    $file->streamFile();
    CApp::rip();
}
$compte_rendu_id = CValue::post("compte_rendu_id");
$stream = CValue::post("stream");
$print_to_server = CValue::post("print_to_server");
$compte_rendu = new CCompteRendu();
$compte_rendu->load($compte_rendu_id);
$compte_rendu->loadContent(1);
$content = $compte_rendu->_source;