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');
if (empty($_fields)) { continue; } foreach ($_fields as $_field) { $whereOr[] = "{$_field} IS NOT NULL"; } $constants_by_graph[$i] = array($_fields); $i++; } if (!empty($whereOr)) { $where[] = implode(' OR ', $whereOr); $constants = array_reverse($const->loadList($where, 'datetime DESC', 10), true); } else { $constants = array(new CConstantesMedicales()); } $graph->formatGraphDatas($constants, $constants_by_graph); /* Sorting the graphs data by tab name */ foreach ($graph->graphs as $_key => $_graph) { if (($name = array_search($constants_by_graph[$_key][0], $graphs_struct)) !== false) { $graphs[md5($name)] = $_graph[0]; } } foreach ($graphs_struct as $title => $consts) { $titles[md5($title)] = $title; } } else { $graph->min_x_index = 0; $graph->min_x_value = 0; } // Création du template $smarty = new CSmartyDP();
/** @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); $smarty->assign('graphs_data', $graph->graphs);