/** * Charge la liste de plages et opérations pour un jour donné * Analogue à CMediusers::loadRefsForDay * * @param string $date Date to look for * @param bool $second_chir Use chir_2, chir_3 and chir_4 * * @return void */ function loadRefsForDay($date, $second_chir = false) { // Liste des utilisateurs $user = new CMediusers(); $listPrats = $user->loadPraticiens(PERM_READ); // Liste des fonctions $function = new CFunctions(); $listFunctions = $function->loadListWithPerms(PERM_READ); // Plages d'opérations $plage = new CPlageOp(); $conf_chambre_operation = $plage->conf("chambre_operation"); $ljoin = array(); $add_where = ""; $add_or_where = ""; if ($second_chir) { $ljoin["operations"] = "plagesop.plageop_id = operations.plageop_id"; $prepare_prats = CSQLDataSource::prepareIn(array_keys($listPrats)); $add_where = "operations.chir_id " . $prepare_prats . " OR operations.chir_2_id " . $prepare_prats . " OR operations.chir_3_id " . $prepare_prats . " OR operations.chir_4_id " . $prepare_prats; $add_or_where = " OR {$add_where}"; } $where = array(); $where["plagesop.date"] = "= '{$date}'"; $where["plagesop.salle_id"] = "= '{$this->_id}'"; $where[] = "`plagesop`.`chir_id` " . CSQLDataSource::prepareIn(array_keys($listPrats)) . " OR `plagesop`.`spec_id` " . CSQLDataSource::prepareIn(array_keys($listFunctions)) . $add_or_where; $order = "debut"; $this->_ref_plages = $plage->loadList($where, $order, null, "plageop_id", $ljoin); // Chargement d'optimisation CMbObject::massLoadFwdRef($this->_ref_plages, "chir_id"); CMbObject::massLoadFwdRef($this->_ref_plages, "anesth_id"); CMbObject::massLoadFwdRef($this->_ref_plages, "spec_id"); CMbObject::massLoadFwdRef($this->_ref_plages, "salle_id"); CMbObject::massCountBackRefs($this->_ref_plages, "notes"); CMbObject::massCountBackRefs($this->_ref_plages, "affectations_personnel"); foreach ($this->_ref_plages as $_plage) { /** @var CPlageOp $_plage */ $_plage->loadRefChir(); $_plage->loadRefAnesth(); $_plage->loadRefSpec(); $_plage->loadRefSalle(); $_plage->makeView(); $_plage->loadRefsOperations(); $_plage->loadRefsNotes(); $_plage->loadAffectationsPersonnel(); $_plage->_unordered_operations = array(); // Chargement d'optimisation CMbObject::massLoadFwdRef($_plage->_ref_operations, "chir_id"); $sejours = CMbObject::massLoadFwdRef($_plage->_ref_operations, "sejour_id"); CMbObject::massLoadFwdRef($sejours, "patient_id"); foreach ($_plage->_ref_operations as $operation) { $operation->loadRefAnesth(); $operation->loadRefChirs(); $operation->loadRefPatient(); $operation->loadExtCodesCCAM(); $operation->loadRefPlageOp(); if ($conf_chambre_operation) { $operation->loadRefAffectation(); } // Extraire les interventions non placées if ($operation->rank == 0) { $_plage->_unordered_operations[$operation->_id] = $operation; unset($_plage->_ref_operations[$operation->_id]); } } } // Interventions déplacés $deplacee = new COperation(); $ljoin = array(); $ljoin["plagesop"] = "operations.plageop_id = plagesop.plageop_id"; $where = array(); $where["operations.plageop_id"] = "IS NOT NULL"; $where["plagesop.salle_id"] = "!= operations.salle_id"; $where["plagesop.date"] = "= '{$date}'"; $where["operations.salle_id"] = "= '{$this->_id}'"; $where[] = "`plagesop`.`chir_id` " . CSQLDataSource::prepareIn(array_keys($listPrats)) . " OR `plagesop`.`spec_id` " . CSQLDataSource::prepareIn(array_keys($listFunctions)) . $add_or_where; $order = "operations.time_operation"; $this->_ref_deplacees = $deplacee->loadList($where, $order, null, "operation_id", $ljoin); // Chargement d'optimisation CMbObject::massLoadFwdRef($this->_ref_deplacees, "chir_id"); $sejours_deplacees = CMbObject::massLoadFwdRef($this->_ref_deplacees, "sejour_id"); CMbObject::massLoadFwdRef($sejours_deplacees, "patient_id"); foreach ($this->_ref_deplacees as $_deplacee) { /** @var COperation $_deplacee */ $_deplacee->loadRefChirs(); $_deplacee->loadRefPatient(); $_deplacee->loadExtCodesCCAM(); $_deplacee->loadRefPlageOp(); } // Hors plage $urgence = new COperation(); $ljoin = array(); $ljoin["plagesop"] = "operations.plageop_id = plagesop.plageop_id"; $where = array(); $where["operations.date"] = "= '{$date}'"; $where["operations.plageop_id"] = "IS NULL"; $where["operations.salle_id"] = "= '{$this->_id}'"; if ($second_chir) { $where[] = $add_where; } else { $where["operations.chir_id"] = CSQLDataSource::prepareIn(array_keys($listPrats)); } $order = "time_operation, chir_id"; $this->_ref_urgences = $urgence->loadList($where, $order, null, "operation_id"); // Chargement d'optimisation CMbObject::massLoadFwdRef($this->_ref_urgences, "chir_id"); $sejours_urgences = CMbObject::massLoadFwdRef($this->_ref_urgences, "sejour_id"); CMbObject::massLoadFwdRef($sejours_urgences, "patient_id"); foreach ($this->_ref_urgences as $_urgence) { /** @var COperation $_urgence */ $_urgence->loadRefChirs(); $_urgence->loadRefPatient(); $_urgence->loadExtCodesCCAM(); $_urgence->loadRefPlageOp(); if ($conf_chambre_operation) { $_urgence->loadRefAffectation(); } } }
<?php /** * $Id: vw_edit_packs.php 19285 2013-05-26 13:10:13Z phenxdesign $ * * @package Mediboard * @subpackage Labo * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision: 19285 $ */ CCanDo::checkRead(); $user = CMediusers::get(); // Chargement des fontions $function = new CFunctions(); $listFunctions = $function->loadListWithPerms(PERM_EDIT); // Chargement du pack demandé $pack = new CPackExamensLabo(); $pack->load(CValue::getOrSession("pack_examens_labo_id")); if ($pack->_id && $pack->getPerm(PERM_EDIT)) { $pack->loadRefs(); } else { $pack = new CPackExamensLabo(); } //Chargement de tous les packs $where = array("function_id IS NULL OR function_id " . CSQLDataSource::prepareIn(array_keys($listFunctions))); $where["obsolete"] = " = '0'"; $order = "libelle"; $listPacks = $pack->loadList($where, $order); foreach ($listPacks as $key => $curr_pack) { $listPacks[$key]->loadRefs();
* @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version SVN: $Id:$ * @link http://www.mediboard.org */ CCanDo::checkRead(); $user_id = CValue::getOrSession("user_id"); // Récupération des fonctions $group = CGroups::loadCurrent(); if ($group->_id) { $functions = $group->loadFunctions(); } else { // Cas du admin qui n'a pas de mediuser, et donc pas de group_id $function = new CFunctions(); $where = array("actif" => "='1'"); $functions = $function->loadListWithPerms(PERM_READ, $where); } // Récupération du user à ajouter/editer $object = new CMediusers(); if (CValue::get("no_association")) { $object->user_id = $user_id; $object->updateFormFields(); $object->_user_id = $user_id; $object->_id = null; $object->actif = CValue::get("ldap_user_actif", 1); $object->deb_activite = CValue::get("ldap_user_deb_activite"); $object->fin_activite = CValue::get("ldap_user_fin_activite"); } else { $object->load($user_id); $object->loadRefFunction(); $object->loadRefProfile();
if ($function_id) { $listChir = CConsultation::loadPraticiens(PERM_EDIT, $function_id, null, true); foreach ($listChir as $_chir) { $_chir->loadRefFunction(); } } else { $listChir = CConsultation::loadPraticiens(PERM_EDIT); } // Liste des consultations a avancer si desistement $ds = $plage->getDS(); $now = CMbDT::date(); // get desistements $count_si_desistement = CConsultation::countDesistementsForDay($function_id ? array_keys($listChir) : array($chirSel), $now); // Liste des praticiens $fnc = new CFunctions(); $listFnc = $fnc->loadListWithPerms(PERM_READ, array("group_id" => " = '{$group->_id}' "), 'text'); $mediuser = new CMediusers(); foreach ($listFnc as $id => $_fnc) { $users = $mediuser->loadProfessionnelDeSanteByPref(PERM_READ, $_fnc->_id, null, true); if (!count($users)) { unset($listFnc[$id]); } } // if only one function and function_id if (count($listFnc) == 1 && !$chirSel) { $function_id = reset($listFnc)->_id; } // Période $today = CMbDT::date(); $debut = CValue::getOrSession("debut", $today); $debut = CMbDT::date("last sunday", $debut);
$user = CMediusers::get(); $praticien = new CMediusers(); $praticien->load($filter->_prat_id); // dans le cas d'un anesthesiste, vider le prat_id si l'anesthesiste veut voir tous // les plannings sinon laisser son prat_id pour afficher son planning perso if ($praticien->isFromType(array("Anesthésiste")) && !$filter->_planning_perso) { $filter->_prat_id = null; } // Filtre sur les praticiens ou les spécialités $function = new CFunctions(); $functions = array(); $praticiens = array(); // Aucun filtre de séléctionné : tous les éléments auxquels on a le droit if (!$filter->_specialite && !$filter->_prat_id) { if (!$user->isFromType(array("Anesthésiste")) && !$praticien->isFromType(array("Anesthésiste"))) { $functions = $function->loadListWithPerms(PERM_READ); $praticiens = $user->loadPraticiens(); } else { $functions = $function->loadList(); $praticiens = $praticien->loadList(); } } elseif ($filter->_specialite) { // Filtre sur la specialité : la spec et ses chirs primaires et secondaires $function->load($filter->_specialite); $function->loadBackRefs("users"); $function->loadBackRefs("secondary_functions"); $functions[$function->_id] = $function; $praticiens = $function->_back["users"]; /** @var CSecondaryFunction $sec_func */ foreach ($function->_back["secondary_functions"] as $sec_func) { if (!isset($praticiens[$sec_func->user_id])) {
<?php /** * $Id$ * * @category Cabinet * @package Mediboard * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ * @link http://www.mediboard.org */ CCanDo::checkRead(); $group = CGroups::loadCurrent(); $today = CMbDT::date(); $date = CValue::getOrSession("date", $today); $function_id = CValue::getOrSession("function_id"); $function = new CFunctions(); $functions = $function->loadListWithPerms(PERM_READ, array("group_id" => " = '{$group->_id}' "), "text"); // smarty $smarty = new CSmartyDP(); $smarty->assign("date", $date); $smarty->assign("function_id", $function_id); $smarty->assign("functions", $functions); $smarty->display("vw_journee_new.tpl");
* * @package Mediboard * @subpackage Hospi * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ */ $printer_id = CValue::getOrSession("printer_id", 0); $printer = new CPrinter(); $printer->load($printer_id); if ($printer->_id) { $printer->loadTargetObject(); } $source = new CSourceLPR(); $sources = $source->loadlist(); if (!$sources) { $sources = array(); } $source = new CSourceSMB(); $sources_smb = $source->loadlist(); if ($sources_smb) { $sources = array_merge($sources, $sources_smb); } $function = new CFunctions(); $order_by = "text"; $functions = $function->loadListWithPerms(PERM_READ, null, $order_by); $smarty = new CSmartyDP(); $smarty->assign("printer", $printer); $smarty->assign("sources", $sources); $smarty->assign("functions", $functions); $smarty->display("inc_edit_printer.tpl");