Example #1
0
}
$calendar->guid = "CPlanning-{$mode}-{$date}";
$calendar->title = "Astreintes-{$mode}-{$date}";
$astreintes = $astreinte->loadList($where, $order);
/** @var $astreintes CPlageAstreinte[] */
foreach ($astreintes as $_astreinte) {
    $length = CMbDT::minutesRelative($_astreinte->start, $_astreinte->end);
    //not in the current group
    $_astreinte->loadRefUser();
    $_astreinte->loadRefColor();
    $libelle = "<span style=\"text-align:center;\">";
    $libelle .= $_astreinte->libelle ? "<strong>{$_astreinte->libelle}</strong><br/>" : null;
    $libelle .= $_astreinte->_ref_user . '<br/>' . $_astreinte->phone_astreinte . "</span>";
    $libelle = CMbString::purifyHTML($libelle);
    $plage = new CPlanningEvent($_astreinte->_guid, $_astreinte->start, $length, $libelle, "#" . $_astreinte->_color, true, 'astreinte', false, false);
    $plage->setObject($_astreinte);
    $plage->plage["id"] = $_astreinte->_id;
    $plage->type = $_astreinte->type;
    $plage->end = $_astreinte->end;
    $plage->display_hours = true;
    if ($_astreinte->getPerm(PERM_EDIT)) {
        $plage->addMenuItem("edit", utf8_encode("Modifier l'astreinte"));
    }
    //add the event to the planning
    $calendar->addEvent($plage);
}
$calendar->hour_min = "00";
$calendar->rearrange();
//smarty
$smarty = new CSmartyDP();
$smarty->assign("date", $date);
Example #2
0
     $event->title .= "\n    <strong>" . CMbDT::format($_plage->debut, "%H:%M") . " - " . CMbDT::format($_plage->fin, "%H:%M") . "</strong>\n     " . count($_plage->_ref_operations) . " " . CAppUI::tr('COperation');
     if (count($_plage->_ref_operations) > 1) {
         $event->title .= "s";
     }
     $event->title .= "<small>";
     $event->title .= "<br/>{$_plage->_ref_salle}";
     if ($function_id && !$_plage->spec_id) {
         $event->title .= " - " . $_prat->_shortview . "";
     }
     $event->title .= "<br/>Durée cumulée : ";
     $event->title .= $_plage->_cumulative_minutes ? CMbDT::transform("+ {$_plage->_cumulative_minutes} MINUTES", "00:00:00", "%Hh%M") : " &mdash;";
     $event->title .= "</small>";
     $event->type = $_plage->_class;
     $event->datas = array("id" => $_plage->_id);
     $event->css_class = $_plage->_class;
     $event->setObject($_plage);
     $calendar->days[$_plage->date][$_plage->_guid] = $event;
 }
 // hors plage
 $sql = "\n    SELECT plageop_id, date, chir_id,\n      SEC_TO_TIME(SUM(TIME_TO_SEC(temp_operation))) as accumulated_time,\n      MIN(time_operation) AS first_time,\n      MAX(time_operation) AS last_time,\n      COUNT(*) AS nb_op\n    FROM operations, sejour\n    WHERE (date BETWEEN  '{$calendar->date_min}' AND  '{$calendar->date_max}')\n    AND plageop_id IS NULL\n    AND sejour.sejour_id = operations.sejour_id\n    AND sejour.group_id = '{$group_id}'\n    AND (chir_id = '{$_prat->_id}' OR anesth_id = '{$_prat->_id}')\n    AND operations.annulee = '0'\n    AND sejour.annule = '0'\n    GROUP BY date, plageop_id";
 $hps = $ds->loadList($sql);
 foreach ($hps as $_hp) {
     $guid = "hps_" . $_hp["date"] . $_prat->_id;
     $event = new CPlanningEvent($guid, $_hp["date"] . " " . $_hp["first_time"], CMbDT::minutesRelative($_hp["date"] . " 00:00:00", $_hp["date"] . " " . $_hp["accumulated_time"]));
     $event->title = "<strong>" . CMbDT::format($_hp["first_time"], '%H:%M') . " - " . CMbDT::format($_hp["last_time"], "%H:%M") . "</strong> " . $_hp["nb_op"] . " " . CAppUI::tr("CIntervHorsPlage") . "<small>";
     if ($function_id) {
         $event->title .= " - " . $_prat->_shortview;
     }
     $event->title .= "<br/>Durée cumulée : " . CMbDT::format($_hp["accumulated_time"], '%Hh%M');
     $event->title .= "</small>";
     $event->datas = array("date" => $_hp['date'], "chir_id" => $_hp["chir_id"]);