Esempio n. 1
0
 /**
  * count the number of alerts for this bloc
  *
  * @param array $key_ids list of salle keys
  *
  * @return int
  */
 static function countAlertesIntervsForSalles($key_ids)
 {
     if (!count($key_ids)) {
         return 0;
     }
     $inSalles = CSQLDataSource::prepareIn($key_ids);
     $alerte = new CAlert();
     $ljoin = array();
     $ljoin["operations"] = "operations.operation_id = alert.object_id";
     $ljoin["plagesop"] = "plagesop.plageop_id = operations.plageop_id";
     $where = array();
     $where["alert.object_class"] = "= 'COperation'";
     $where["alert.tag"] = "= 'mouvement_intervention'";
     $where["alert.handled"] = "= '0'";
     $where[] = "operations.salle_id " . $inSalles . " OR plagesop.salle_id " . $inSalles . " OR (plagesop.salle_id IS NULL AND operations.salle_id IS NULL)";
     return $alerte->countList($where, null, $ljoin);
 }
Esempio n. 2
0
 function countAlertsNotHandled($level = null, $tag = null)
 {
     if ($tag == "observation") {
         $alert = new CAlert();
         $where = array("object_class" => "= 'CObservationMedicale'", "object_id" => CSQLDataSource::prepareIn($this->loadBackIds("observations")), "level" => "= 'medium'", "handled" => "= '0'", "tag" => "= '" . CObservationMedicale::$tag_alerte . "'");
         return $this->_count_alerts_not_handled = $alert->countList($where);
     }
     return parent::countAlertsNotHandled($level, $tag);
 }