Example #1
0
 /**
  * rearrange the current list of events in a optimized way
  *
  * @param bool $new_mode use the new mode
  *
  * @return null
  */
 function rearrange($new_mode = false)
 {
     $events = array();
     //days
     foreach ($this->events_sorted as $_events_by_day) {
         $intervals = array();
         // tab
         foreach ($_events_by_day as $_events_by_hour) {
             foreach ($_events_by_hour as $_event) {
                 //used as background, skip the rearrange
                 if ($_event->below) {
                     $_event->width = 0.9;
                     $_event->offset = 0.1;
                     continue;
                 }
                 $intervals[$_event->internal_id] = array("lower" => $_event->start, "upper" => $_event->end);
                 $events[$_event->internal_id] = $_event;
             }
         }
         if ($new_mode) {
             $lines = CMbRange::rearrange2($intervals);
             foreach ($lines as $guid => $_line) {
                 /** @var CPlanningEvent $event */
                 $event = $events[$guid];
                 $event->offset = $_line["start"] / $_line["total"] + 0.1;
                 $event->width = ($_line["end"] - $_line["start"]) / $_line["total"] - 0.1;
             }
         } else {
             $lines = CMbRange::rearrange($intervals);
             $lines_count = count($lines);
             foreach ($lines as $_line_number => $_line) {
                 foreach ($_line as $_event_id) {
                     $event = $events[$_event_id];
                     //get the event
                     $event->height = $_line_number;
                     //global = first line
                     $event->width = 1 / $lines_count;
                     $event->offset = $_line_number / $lines_count;
                     if ($this->allow_superposition) {
                         $event->offset += 0.05;
                     }
                     if ($lines_count == 1 && $this->allow_superposition) {
                         $event->width = $event->width - 0.1;
                     }
                     //the line is not the first
                     if ($_line_number >= 1 && $this->allow_superposition) {
                         $event->width = 1 / $lines_count + 0.05;
                         $event->offset = $_line_number / $lines_count - 0.1;
                     }
                 }
             }
         }
     }
 }
Example #2
0
 /**
  * rearrange the current list of events in a optimized way
  *
  * @return null
  */
 function rearrange()
 {
     $events = array();
     //days
     foreach ($this->events_sorted as $_events_by_day) {
         $intervals = array();
         // tab
         foreach ($_events_by_day as $_events_by_hour) {
             foreach ($_events_by_hour as $_event) {
                 //used as background, skip the rearrange
                 if ($_event->below) {
                     $_event->width = 0.9;
                     $_event->offset = 0.1;
                     continue;
                 }
                 $intervals[$_event->internal_id] = array("lower" => $_event->start, "upper" => $_event->end);
                 $events[$_event->internal_id] = $_event;
             }
         }
         $uncollided = array();
         $lines = CMbRange::rearrange($intervals, true, $uncollided);
         $lines_count = count($lines);
         $this->max_height_event = $lines_count > $this->max_height_event ? $lines_count : $this->max_height_event;
         foreach ($lines as $_line_number => $_line) {
             foreach ($_line as $_event_id) {
                 $event = $events[$_event_id];
                 //get the event
                 $event->height = $_line_number;
                 //global = first line
                 $event->width = 1 / $lines_count;
                 $event->offset = $_line_number / $lines_count;
                 if ($this->allow_superposition) {
                     $event->offset += 0.05;
                 }
                 if ($lines_count == 1 && $this->allow_superposition) {
                     $event->width = $event->width - 0.1;
                 }
                 //the line is not the first
                 if ($_line_number >= 1 && $this->allow_superposition) {
                     $event->width = 1 / $lines_count + 0.05;
                     $event->offset = abs($_line_number / $lines_count - 0.1);
                 }
                 // lines uncollided
                 //TODO: fix collisions problems
                 if (in_array($event->internal_id, array_keys($uncollided)) && $_line_number < $lines_count - 1 && !$event->below) {
                     //$event->width = (($lines_count - ($_line_number)) / $lines_count);
                     //$event->width = ($_line_number == 0) ? $event->width-0.1 :$event->width +.05;
                 }
             }
         }
     }
 }
CPatient::massCountPhotoIdentite($patients);
foreach ($affectations as $_affectation_imc) {
    /* @var CAffectation $_affectation_imc*/
    if (CAppUI::conf("dPhospi vue_temporelle show_imc_patient", "CService-" . $_affectation_imc->service_id)) {
        $_affectation_imc->loadRefSejour()->loadRefPatient()->loadRefLatestConstantes(null, array("poids", "taille"));
    }
}
$operations = array();
$suivi_affectation = false;
loadVueTempo($affectations, $suivi_affectation, $lits, $operations, $date_min, $date_max, $period, $prestation_id);
$intervals = array();
if (count($lit->_ref_affectations)) {
    foreach ($lit->_ref_affectations as $_affectation) {
        $intervals[$_affectation->_id] = array("lower" => $_affectation->_entree, "upper" => $_affectation->_sortie);
    }
    $lit->_lines = CMbRange::rearrange($intervals);
}
// Pour les alertes, il est nécessaire de charger les autres lits
// de la chambre concernée ainsi que les affectations
$where = array();
$where["entree"] = "<= '{$date_max}'";
$where["sortie"] = ">= '{$date_min}'";
$lits_ids = $chambre->loadBackIds("lits");
foreach ($lits_ids as $_lit_id) {
    if ($lit_id == $_lit_id) {
        continue;
    }
    $_lit = new C**t();
    $_lit->load($_lit_id);
    $where["lit_id"] = "= '{$_lit->_id}'";
    $_affectations = $affectation->loadList($where);