$css_classes[] = $class;
    $css_classes[] = $sejour->_guid;
    $css_classes[] = $equipement->_guid;
    // Title and color in prescription case
    if ($line = $_evenement->loadRefPrescriptionLineElement()) {
        $element = $line->_ref_element_prescription;
        $category = $element->loadRefCategory();
        $title .= $category->_view;
        // Color
        $color = $element->_color ? "#{$element->_color}" : null;
        // CSS Class
        $css_classes[] = $element->_guid;
        $css_classes[] = $category->_guid;
    }
    $event = new CPlanningEvent($_evenement->_guid, $_evenement->debut, $_evenement->duree, $title, $color, $important, $css_classes);
    $planning->addEvent($event);
}
$config = $surveillance ? CAppUI::conf("ssr occupation_surveillance") : CAppUI::conf("ssr occupation_technicien");
// Labels de charge sur la journée
$ds = CSQLDataSource::get("std");
$query = "SELECT SUM(duree) as total, DATE(debut) as date\n  FROM evenement_ssr\n  WHERE therapeute_id = '{$kine->_id}'\n  AND debut BETWEEN '{$planning->_date_min_planning} 00:00:00' AND '{$planning->_date_max_planning} 23:59:59'";
$query .= $surveillance ? "AND type_seance = 'non_dediee'" : "AND type_seance <> 'non_dediee'";
$query .= " GROUP BY DATE(debut)";
$duree_occupation = $ds->loadList($query);
foreach ($duree_occupation as $_occupation) {
    $duree_occupation = $_occupation["total"];
    $color = "#fff";
    if ($duree_occupation < $config["faible"]) {
        $color = "#8f8";
    }
    if ($duree_occupation > $config["eleve"]) {
if (isset($current_bloc)) {
    $planning->title .= " - {$current_bloc->nom}";
}
$planning->guid = "planning_interv";
$planning->hour_min = str_pad(CAppUI::conf("reservation debut_planning"), 2, 0, STR_PAD_LEFT);
$planning->dragndrop = $planning->resizable = CCanDo::edit() ? 1 : 0;
//hack for "false => 0"
$planning->hour_divider = 12;
$planning->show_half = true;
$i = 0;
$today = CMbDT::date();
foreach ($salles as $_salle) {
    $label_day = $bloc_id ? $_salle->_shortview : str_replace("-", "<br/>", $_salle->_view);
    $planning->addDayLabel($i, $label_day, null, null, null, true, array("salle_id" => $_salle->_id));
    if ($today == $date_planning) {
        $planning->addEvent(new CPlanningEvent(null, "{$i} " . CMbDT::time(), null, null, "red", null, "now"));
    }
    $i++;
}
// Tri des opérations par salle
$operations_by_salle = array();
foreach ($operations as $key => $_operation) {
    /** @var COperation $_operation */
    if (!$_operation->salle_id) {
        unset($operations[$key]);
        continue;
    }
    if (!isset($operations_by_salle[$_operation->salle_id])) {
        $operations_by_salle[$_operation->salle_id] = array();
    }
    // only hors plage