$_evenements = array();
if ($token_evts) {
    $_evenements = explode("|", $token_evts);
}
$count_actes = $actes = array("cdarr" => array(), "csarr" => array());
$evenements = array();
foreach ($_evenements as $_evenement_id) {
    $evenement = new CEvenementSSR();
    $evenement->load($_evenement_id);
    if ($evenement->seance_collective_id) {
        // Recuperation des informations de la seance collective
        $evenement->loadRefSeanceCollective();
        $evenement->debut = $evenement->_ref_seance_collective->debut;
        $evenement->duree = $evenement->_ref_seance_collective->duree;
    }
    $evenement->loadRefSejour()->loadRefPatient();
    // Chargement et comptage des codes de tous les actes
    foreach ($evenement->loadRefsActes() as $_type => $_actes) {
        foreach ($_actes as $_acte) {
            $actes[$_type][$_acte->code] = $_acte->code;
            if (!isset($count_actes[$_type][$_acte->code])) {
                $count_actes[$_type][$_acte->code] = 0;
            }
            $count_actes[$_type][$_acte->code]++;
        }
    }
    // Chargement des codes possibles pour l'evenement
    $line = $evenement->loadRefPrescriptionLineElement();
    $element = $line->_ref_element_prescription;
    foreach ($element->loadRefsCodesSSR() as $_type => $_links) {
        foreach ($_links as $_link_cdarr) {