default: } } $whereOr = array(); foreach ($selection as $_constant) { $whereOr[] = "{$_constant} IS NOT NULL"; } if (!empty($whereOr)) { $where[] = implode(' OR ', $whereOr); } $constant = new CConstantesMedicales(); $constants = $constant->loadList($where, 'datetime DESC', null, 'datetime'); $smarty = new CSmartyDP(); if (!empty($constants)) { $time = false; if ($period) { $time = true; } $graph = new CConstantGraph(CConstantesMedicales::guessHost($context), $context_guid, false, $time); $constants_by_graph = array(1 => array($selection)); $graph->formatGraphDatas(array_reverse($constants, true), $constants_by_graph); $smarty->assign('graphs', array(1 => $graph->graphs[1][0])); $smarty->assign('min_x_index', $graph->min_x_index); $smarty->assign('min_x_value', $graph->min_x_value); if (!$period) { $smarty->assign('patient', $patient); } } else { $smarty->assign('msg', CAppUI::tr('CConstantGraph-msg-no_values')); } $smarty->display('inc_custom_constants_graph.tpl');
/* We display at most 4 graph with cumuled constants */ if (isset(CConstantesMedicales::$list_constantes[$_cste]['cumul_reset_config'])) { if ($cumul_nb < 4) { $list_cumul[] = $_cste; $cumul_nb++; } continue; } /* A most, we display only one graph with at most 5 constants */ if ($cste_nb < 5) { $list_cste[] = $_cste; $cste_nb++; } } } $graph = new CConstantGraph(CConstantesMedicales::guessHost($context), $context_guid, true); $graphs = array(); $titles = array(); if (!empty($list_cste) || !empty($list_cumul)) { // Global structure $graphs_struct = array("Constantes" => $list_cste); foreach ($list_cumul as $_cumul) { $graphs_struct[CAppUI::tr("CConstantesMedicales-{$_cumul}-court")] = array($_cumul); } $where = array('patient_id' => " = '{$context->patient_id}'", 'context_class' => " = '{$context->_class}'", 'context_id' => " = '{$context->_id}'"); $whereOr = array(); $constants_by_graph = array(); $i = 1; foreach ($graphs_struct as $_name => $_fields) { if (empty($_fields)) { continue;
} /** @var CConstantesMedicales[] $list_constantes */ // Les constantes qui correspondent (dans le contexte cette fois) $list_constantes = $constantes->loadList($where, "datetime DESC", $limit); $total_constantes = $constantes->countList($where); $constantes_medicales_grid = CConstantesMedicales::buildGrid($list_constantes, false, true); $const_ids = array(); foreach ($list_constantes as $_cst) { $const_ids[] = $_cst->_id; } $list_constantes = array_reverse($list_constantes, true); $context_guid_graph = $context_guid; if ($selected_context_guid == 'all') { $context_guid_graph = $selected_context_guid; } $graph = new CConstantGraph($host, $context_guid_graph); $graph->formatGraphDatas($list_constantes); // Création du template $smarty = new CSmartyDP(); $smarty->assign('constantes', $constantes); $smarty->assign('context', $context); $smarty->assign('current_context', $current_context); $smarty->assign('context_guid', $context_guid); $smarty->assign('list_contexts', $list_contexts); $smarty->assign('all_contexts', $selected_context_guid == 'all'); $smarty->assign('patient', $patient); $smarty->assign('const_ids', $const_ids); $smarty->assign('latest_constantes', $latest_constantes); $smarty->assign('selection', $selection); $smarty->assign('custom_selection', $custom_selection); $smarty->assign('print', $print);