示例#1
0
<?php

/**
 * Tâche automatique de suppression de documents déclarés temporaires
 *
 * @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::checkEdit();
$modele = new CCompteRendu();
$limit = CValue::get("limit", 100);
$where = array();
$where["object_id"] = "IS NULL";
$where["purgeable"] = "= '1'";
$modeles = $modele->loadList($where);
CMbObject::massCountBackRefs($modeles, "documents_generated");
foreach ($modeles as $_modele) {
    $documents = $_modele->loadBackRefs("documents_generated", null, $limit);
    foreach ($documents as $_doc) {
        $_doc->delete();
    }
}
示例#2
0
$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);
$count["CCompteRendu"] = $document->countList($where);
// Sending
$max_send = CAppUI::conf("dPfiles CDocumentSender auto_max_send");
foreach ($items as $_items) {
    $sent = 0;
    /** @var CDocumentItem[] $_items */
    foreach ($_items as $_item) {
        $_item->loadTargetObject();
        if ($do && !$_item->_send_problem) {
            // Max sent
            if (++$sent > $max_send) {
                break;
            }
            $_item->_send = "1";
            $_item->_send_problem = $_item->store();
     $where["user_log.date"] = "BETWEEN '{$date_docs_min} 00:00:00' AND '{$date_docs_max} 23:59:59'";
 }
 if ($prat_docs) {
     $where["author_id"] = " = '{$prat_docs}'";
 } else {
     if ($specialite_docs) {
         if (!isset($ljoin["user_log"])) {
             $ljoin["user_log"] = "compte_rendu.compte_rendu_id = user_log.object_id\n       AND user_log.object_class = 'CCompteRendu'\n       AND user_log.type = 'create'";
         }
         $ljoin["users_mediboard"] = "user_log.user_id = users_mediboard.user_id";
         $where["users_mediboard.function_id"] = " = '{$specialite_docs}'";
     }
 }
 $total_docs = $cr->countList($where, null, $ljoin);
 /** @var CCompteRendu[] $docs */
 $docs = $cr->loadList($where, "user_log.date desc", "{$page}, 30", null, $ljoin);
 switch ($section_search) {
     case "sejour":
         $sejours = CMbObject::massLoadFwdRef($docs, "object_id", "CSejour");
         CMbObject::massLoadFwdRef($sejours, "patient_id");
         foreach ($docs as $_doc) {
             /** @var CSejour $sejour */
             $sejour = $_doc->loadTargetObject();
             $sejour->loadRefPatient();
             $sejour->loadNDA();
             $sejour->loadRefsOperations();
             $_doc->_date = $_doc->loadFirstLog()->date;
         }
         break;
     case "intervention":
         $operations = CMbObject::massLoadFwdRef($docs, "object_id", "COperation");
示例#4
0
 * @version  SVN: $Id:\$
 * @link     http://www.mediboard.org
 */
$nbDoc = CView::get("nbDoc", "str");
CView::checkin();
$documents = array();
$pdf = new CMbPDFMerger();
CMbArray::removeValue("0", $nbDoc);
if (!count($nbDoc)) {
    CAppUI::stepAjax("Aucun document à imprimer !");
    CApp::rip();
}
$compte_rendu = new CCompteRendu();
$where = array("compte_rendu_id" => CSQLDataSource::prepareIn(array_keys($nbDoc)));
/** @var $_compte_rendu CCompteRendu */
foreach ($compte_rendu->loadList($where) as $_compte_rendu) {
    $_compte_rendu->date_print = CMbDT::dateTime();
    $_compte_rendu->store();
    $_compte_rendu->makePDFpreview(1);
    $nb_print = $nbDoc[$_compte_rendu->_id];
    for ($i = 1; $i <= $nb_print; $i++) {
        $pdf->addPDF($_compte_rendu->_ref_file->_file_path);
    }
}
// Stream du PDF au client avec ouverture automatique
// Si aucun pdf, alors PDFMerger génère une exception que l'on catche
try {
    $pdf->merge("browser", "documents.pdf");
} catch (Exception $e) {
    CApp::rip();
}
示例#5
0
<?php

/**
 * Onglet de configuration
 *
 * @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::checkAdmin();
$arch = exec("arch");
$can_64bit = $arch == "x86_64";
$modele = new CCompteRendu();
$where = array();
$where["object_id"] = "IS NULL";
$where["type"] = " = 'body'";
$modeles = $modele->loadList($where, "nom");
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("dompdf_installed", file_exists("lib/dompdf/include/dompdf.cls.php"));
$smarty->assign("wkhtmltopdf_installed", file_exists("lib/wkhtmltopdf/wkhtmltopdf-i386") || file_exists("lib/wkhtmltopdf/wkhtmltopdf-amd64"));
$smarty->assign("can_64bit", $can_64bit);
$smarty->assign("modeles", $modeles);
$smarty->display('configure.tpl');
{
    foreach ($xml->childNodes as $_node) {
        /** @var $_node DOMElement */
        if ($_node->nodeName === "span" && ($_node->getAttribute("class") === "name" || $_node->getAttribute("class") === "field") && $_node->childNodes->length != 1 && $_node->firstChild && ($_node->firstChild->nodeType != XML_TEXT_NODE || !preg_match("/\\[.+\\]/", $_node->nodeValue))) {
            return true;
        }
        if ($_node->childNodes) {
            searchSpan($_node);
        }
    }
    return false;
}
$compte_rendu = new CCompteRendu();
$where = array();
$where["object_id"] = "IS NULL";
$compte_rendus = $compte_rendu->loadList($where, null, "350000");
/** @var  $compte_rendus CCompteRendu[] */
$list = array();
/** @var DOMDocument $xml */
$xml = new DOMDocument('1.0', 'iso-8859-1');
foreach ($compte_rendus as $_compte_rendu) {
    mbLog($_compte_rendu->_id);
    $_compte_rendu->loadContent();
    $content = CMbString::convertHTMLToXMLEntities($_compte_rendu->_source);
    $content = utf8_encode(CHtmlToPDF::cleanWord($content));
    $xml->loadXML("<div>" . $content . "</div>");
    if (searchSpan($xml->documentElement)) {
        $list[] = $_compte_rendu;
    }
}
$smarty = new CSmartyDP();
 /**
  * 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;
 }
示例#8
0
/**
 * $Id$
 *  
 * @category CompteRendu
 * @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();
$limit = CValue::get("limit", "100");
$compte_rendu = new CCompteRendu();
$where = array();
$where["factory"] = "IS NULL";
$compte_rendus = $compte_rendu->loadList($where, null, $limit);
$count = count($compte_rendus);
$errors = 0;
$msgs = array();
CMbObject::massLoadBackRefs($compte_rendus, "files");
foreach ($compte_rendus as $_compte_rendu) {
    $file = $_compte_rendu->loadFile();
    $file_content = $file->_file_path && file_exists($file->_file_path) ? file_get_contents($file->_file_path) : "";
    if ($file_content === "") {
        $_compte_rendu->factory = "none";
    } else {
        $_compte_rendu->factory = strpos($file_content, "/Creator (DOMPDF)") !== false ? "CDomPDFConverter" : "CWkHtmlToPDFConverter";
    }
    if ($msg = $_compte_rendu->store()) {
        $msgs[] = $msg;
        $errors++;
示例#9
0
 * @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();
        if (!$_doc->_ref_object->_id) {
            // Objet référencé qui n'existe plus.
            // Suppression du document.
            $_doc->delete();
            continue;
        }
        $_doc->modele_id = $modele_id;
        if ($msg = $_doc->store()) {