static function countData() { $fs = new self(); return $fs->countList(); }
/** * Count the messages archived by the given user * * @param CMediusers $user The user * * @return int The number of archived messages */ public static function countArchivedFor($user) { $user_message = new self(); $where = array('to_user_id' => "= '{$user->_id}'", 'datetime_sent' => "IS NOT NULL", 'archived' => "= '1'", 'deleted' => "= '0'"); return $user_message->countList($where); }
/** * count the number of consultations asking to be * * @param array() $chir_ids list of chir ids * @param Date|null $day date targeted, default = today * * @return int number of result */ static function countDesistementsForDay($chir_ids, $day = null) { $date = CMbDT::date($day); $consultation = new self(); $ds = $consultation->getDS(); $where = array("plageconsult.date" => " > '{$date}'", "consultation.si_desistement" => "= '1'", "consultation.annule" => "= '0'"); $where[] = "plageconsult.chir_id " . $ds->prepareIn($chir_ids) . " OR plageconsult.remplacant_id " . $ds->prepareIn($chir_ids); $ljoin = array("plageconsult" => "plageconsult.plageconsult_id = consultation.plageconsult_id"); return $consultation->countList($where, null, $ljoin); }
/** * Compte les prestations journalières de l'établissement * pour un éventuel type d'hospitalisation donné * @return int */ static function countCurrentList($type = null) { $prestation = new self(); $where = array("group_id" => "= '" . CGroups::loadCurrent()->_id . "'"); if ($type) { $where[] = "type_hospi IS NULL OR type_hospi = '{$type}'"; } return $prestation->countList($where, "nom"); }
/** * check if we can access to the view following the configuration and already granted. * * @param CSejour $sejour sejour object * * @return bool */ static function canAccess($sejour) { $group = $sejour->loadRefEtablissement(); $user = CMediusers::get(); //check for config and elements if (!$sejour->_id || !CAppUI::conf("admin CBrisDeGlace enable_bris_de_glace", $group) || $sejour->praticien_id == $user->_id || !$user->use_bris_de_glace) { return true; } $today = CMbDT::date(); $bris = new self(); $where = array(); $where["date"] = " BETWEEN '{$today} 00:00:00' AND '{$today} 23:59:59'"; $where["object_class"] = " = 'CSejour'"; $where["object_id"] = " = '{$sejour->_id}'"; $where["user_id"] = " = '{$user->_id}'"; // no need of bris de glace if ($bris->countList($where)) { return true; } return false; }
/** * count the list of access for a sejour * * @param $sejour * * @return int */ static function countListForSejour($sejour) { $log = new self(); $where = array(); $where["object_class"] = " = '{$sejour->_class}'"; $where["object_id"] = " = '{$sejour->_id}' "; return $log->countList($where); }