<?php

/**
 * $Id: httpreq_vw_form_constantes_medicales.php 27073 2015-02-05 14:33:41Z asmiane $
 *
 * @package    Mediboard
 * @subpackage dPpatients
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: 27073 $
 */
$constantes = new CConstantesMedicales();
$perms = $constantes->canDo();
if (!$perms->read) {
    $perms->redirect();
}
$const_id = CValue::get('const_id', 0);
$context_guid = CValue::get('context_guid');
$patient_id = CValue::get('patient_id');
$can_edit = CValue::get('can_edit');
$selection = CValue::get('selection');
$host_guid = CValue::get('host_guid');
$display_graph = CValue::get('display_graph', 1);
$unique_id = CValue::get('unique_id', '');
$context = null;
if ($context_guid) {
    $context = CMbObject::loadFromGuid($context_guid);
}
/** @var CGroups|CService|CRPU $host */
// On cherche le meilleur "herbegement" des constantes, pour charger les configuration adequat
if ($host_guid) {
<?php

/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage dPpatients
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CSessionHandler::writeClose();
$const = new CConstantesMedicales();
$perms = $const->canDo();
if (!$perms->read) {
    $perms->redirect();
}
$context_guid = CValue::get('context_guid');
$context = CStoredObject::loadFromGuid($context_guid);
$ranks = CConstantesMedicales::getConstantsByRank('graph', false, CConstantesMedicales::guessHost($context));
$list_cste = array();
$list_cumul = array();
$cste_nb = 0;
$cumul_nb = 0;
if (array_key_exists(1, $ranks['all'])) {
    /* We only display constants with rank 1 */
    foreach ($ranks['all'][1] as $_cste) {
        if (substr($_cste, 0, 1) === "_") {
            continue;
        }
        /* We display at most 4 graph with cumuled constants */