* @subpackage Labo
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CCanDo::checkRead();
$examen_labo_id = CValue::getOrSession("examen_labo_id");
// Chargement de l'examen demandé
$examen = new CExamenLabo();
// Chargement du catalogue demandé
if (CValue::get("catalogue_labo_id")) {
    $examen_labo_id = null;
    CValue::setSession("examen_labo_id");
}
if ($examen_labo_id) {
    $examen->load($examen_labo_id);
    $examen->loadRefs();
    $examen->getSiblings();
    $examen->getRootCatalogue();
    foreach ($examen->_ref_siblings as &$_sibling) {
        $_sibling->loadClassification();
    }
    $examen->loadClassification();
    $catalogue =& $examen->_ref_catalogue_labo;
} else {
    $catalogue_labo_id = CValue::getOrSession("catalogue_labo_id");
    $catalogue = new CCatalogueLabo();
    $catalogue->load($catalogue_labo_id);
    $examen->catalogue_labo_id = $catalogue->_id;
}
$catalogue->loadRefs();
<?php

/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage Labo
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CCanDo::checkRead();
$examen = new CExamenLabo();
$examen->load(CValue::get("examen_id"));
$patient = new CPatient();
$patient->load(CValue::get("patient_id"));
$item = new CPrescriptionLaboExamen();
$resultats = $item->loadResults($patient->_id, $examen->_id, 20);
// Création du graph
$graph = new CResultatsLaboGraph($patient, $examen, $resultats);
$graph->Stroke();
 /**
  * load results items with given patient and exam
  */
 function loadResults($patient_id, $examen_labo_id, $limit = 10)
 {
     $examen = new CExamenLabo();
     $examen->load($examen_labo_id);
     $order = "date DESC";
     $prescription = new CPrescriptionLabo();
     $prescription->patient_id = $patient_id;
     $prescriptions = $prescription->loadMatchingList($order);
     // Load items for each prescription to preserve prescription date ordering
     $items = array();
     $item = new CPrescriptionLaboExamen();
     foreach ($prescriptions as $_prescription) {
         $item->prescription_labo_id = $_prescription->_id;
         $item->examen_labo_id = $examen_labo_id;
         foreach ($item->loadMatchingList($order) as $_item) {
             $items[$_item->_id] = $_item;
         }
     }
     foreach ($items as &$item) {
         $item->_ref_prescription_labo =& $prescriptions[$item->prescription_labo_id];
         $item->_ref_examen_labo =& $examen;
     }
     return $items;
 }