$where["affectation.entree"] = "BETWEEN '{$date_min}' AND '{$date_max}'"; } else { $where["affectation.sortie"] = "BETWEEN '{$date_min}' AND '{$date_max}'"; } $where["sejour.annule"] = "= '0'"; $affectation = new CAffectation(); $order = "entree, sortie"; /** @var CAffectation[] $affectations */ $affectations = $affectation->loadList($where, $order, null, null, $ljoin); $sejours = CStoredObject::massLoadFwdRef($affectations, "sejour_id"); $patients = CStoredObject::massLoadFwdRef($sejours, "patient_id"); $praticiens = CStoredObject::massLoadFwdRef($sejours, "praticien_id"); $functions = CStoredObject::massLoadFwdRef($praticiens, "function_id"); $lits = CStoredObject::massLoadFwdRef($affectations, "lit_id"); $chambres = CStoredObject::massLoadFwdRef($lits, "chambre_id"); $services = CStoredObject::massLoadFwdRef($chambres, "service_id"); CStoredObject::massLoadBackRefs($sejours, "notes"); // Chargement des NDA CSejour::massLoadNDA($sejours); // Chargement des IPP CPatient::massLoadIPP($patients); foreach ($affectations as $affectation_id => $affectation) { $affectation->loadView(); $affectation->loadRefsAffectations(); $affectation->_ref_prev->loadView(); $affectation->_ref_next->loadView(); $sejour = $affectation->loadRefSejour(); $praticien = $sejour->loadRefPraticien(); if ($filterFunction && $filterFunction != $praticien->function_id) { unset($sejours[$sejour->_id]); continue;
$where["plageconsult.chir_id"] = "= '{$user->_id}'"; } /* @var CConsultation[] $consultations*/ $consultation = new CConsultation(); $consultations = $consultation->loadList($where, null, null, null, $ljoin); $totals["consultations"] = count($consultations); /** @var CPlageConsult[] $plages */ $plages = CStoredObject::massLoadFwdRef($consultations, "plageconsult_id"); CStoredObject::massLoadFwdRef($consultations, "sejour_id"); CStoredObject::massLoadFwdRef($consultations, "patient_id"); // Pré-chargement des users $where = array("user_id" => CSQLDataSource::prepareIn(CMbArray::pluck($plages, "chir_id"))); $user->loadList($where); /** @var CMediusers[] $chirs */ $chirs = CStoredObject::massLoadFwdRef($plages, "chir_id"); CStoredObject::massLoadFwdRef($chirs, "function_id"); CStoredObject::massLoadBackRefs($consultations, "actes_ccam"); foreach ($consultations as $key => $_consult) { // Chargemement des codes CCAM $_consult->loadExtCodesCCAM(); $codes_ccam = $_consult->_ext_codes_ccam; // Nombre d'acte cotés par le praticien et réinitialisation du count pour le cache $nb_actes_ccam = count($_consult->loadRefsActesCCAM()); // Aucun acte prévu ou coté if (!count($codes_ccam) && !$_consult->_count_actes) { $_consult->loadRefSejour(); $_consult->loadRefPraticien()->loadRefFunction(); $_consult->loadRefPatient(); continue; } // Actes prévus restant en suspend
function mapDocs($object, $with_cancelled, $tri) { // Documents et fichiers $object->loadRefsDocItems($with_cancelled); CStoredObject::massLoadFwdRef($object->_ref_documents, "file_category_id"); foreach ($object->_ref_documents as $_doc) { CDocumentItem::makeIconName($_doc); $_doc->loadContent(false); $_doc->loadRefCategory(); $_doc->_ref_object = $object; $this->_all_docs[$this->makePrefix($tri, $object, $_doc)][] = $_doc; } CStoredObject::massLoadFwdRef($object->_ref_files, "file_category_id"); foreach ($object->_ref_files as $_file) { CDocumentItem::makeIconName($_file); $_file->loadRefCategory(); $_file->_ref_object = $object; $this->_all_docs[$this->makePrefix($tri, $object, $_file)][] = $_file; } // Formulaires $ex_link = new CExLink(); $ex_link->setObject($object); $ex_link->level = "object"; $ex_links = $ex_link->loadMatchingList(); $ex_objects = CExLink::massLoadExObjects($ex_links); CStoredObject::massLoadFwdRef($ex_objects, "object_id"); foreach ($ex_links as $_link) { $_ex = $_link->loadRefExObject(); $_ex->updateCreationFields(); $object = $_ex->loadTargetObject(); $_ex->_ex_class_id = $_link->ex_class_id; $_ex->loadRefExClass(); CDocumentItem::makeIconName($_ex->_ref_ex_class); $this->_all_docs[$this->makePrefix($tri, $object, $_ex)][] = $_link; } }
/** * @return CAffectationUniteFonctionnelle[] */ function loadRefAffectationsUF() { /** @var CAffectationUniteFonctionnelle[] $affectations_uf */ $affectations_uf = $this->loadBackRefs("ufs"); CStoredObject::massLoadFwdRef($affectations_uf, "uf_id"); foreach ($affectations_uf as $_aff_uf) { $_aff_uf->loadRefUniteFonctionnelle(); } return $this->_ref_affectations_uf = $affectations_uf; }
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")); } } // Préchargement des users $user = new CUser(); $where = array("user_id" => CSQLDataSource::prepareIn(CMbArray::pluck($_sejours, "praticien_id"))); $users = $user->loadList($where); $praticiens = CStoredObject::massLoadFwdRef($_sejours, "praticien_id"); CStoredObject::massLoadFwdRef($praticiens, "function_id"); CStoredObject::massCountBackRefs($affectations, "affectations_enfant"); $_operations = CStoredObject::massLoadBackRefs($sejours, "operations", "date ASC"); CStoredObject::massLoadFwdRef($_operations, "plageop_id"); loadVueTempo($sejours, $suivi_affectation, null, $operations, $date_min, $date_max, $period, $prestation_id, $functions_filter, $filter_function, $sejours_non_affectes); if (CAppUI::conf("dPadmissions show_deficience")) { CStoredObject::massLoadBackRefs($patients, "dossier_medical"); $dossiers = CMbArray::pluck($sejours, "_ref_patient", "_ref_dossier_medical"); CDossierMedical::massCountAntecedentsByType($dossiers, "deficience"); } loadVueTempo($affectations, $suivi_affectation, null, $operations, $date_min, $date_max, $period, $prestation_id, $functions_filter, $filter_function, $sejours_non_affectes); if (count($affectations) && CAppUI::conf("dPadmissions show_deficience")) { $dossiers = CMbArray::pluck($affectations, "_ref_sejour", "_ref_patient", "_ref_dossier_medical"); CDossierMedical::massCountAntecedentsByType($dossiers, "deficience"); } ksort($sejours_non_affectes, SORT_STRING); $_sejour = new CSejour(); $_sejour->_type_admission = $_type_admission; $smarty = new CSmartyDP();
foreach ($consultations as $_consultation) { if ($_consultation->sejour_id != $_sejour->_id) { continue; } if ($_consultation->type == "entree") { continue; } $_consultation->loadRefPraticien()->loadRefFunction(); $patients_offline[$patient->_guid]["consultations"][$_consultation->_ref_chir->function_id] = $_consultation; } array_multisort(CMbArray::pluck($patients_offline[$patient->_guid]["consultations"], "_datetime"), SORT_DESC, $patients_offline[$patient->_guid]["consultations"]); // Constantes $patients_offline[$patient->_guid]["constantes"] = ""; $cstes = array_reverse($_sejour->loadListConstantesMedicales($where_cste)); if (count($cstes)) { CStoredObject::massLoadFwdRef($cstes, "user_id"); foreach ($cstes as $_cste) { $_cste->loadRefUser(); } $smarty_cstes->assign("constantes_medicales_grid", CConstantesMedicales::buildGrid($cstes, false)); $smarty_cstes->assign("sejour", $_sejour); $patients_offline[$patient->_guid]["constantes"] = $smarty_cstes->fetch("print_constantes.tpl", '', '', 0); } // Plan de soins $page_break = 0; if (count($patients_offline[$patient->_guid]["transmissions"]) || count($patients_offline[$patient->_guid]["observations"]) || count($patients_offline[$patient->_guid]["consultations"]) || $patients_offline[$patient->_guid]["constantes"]) { $page_break = 1; } $params = array("sejours_ids" => $_sejour->_id, "date" => $date, "hours_before" => "2", "hours_after" => "2", "empty_lines" => "2", "dialog" => 1, "mode_lite" => 1, "page_break" => $page_break); $patients_offline[$patient->_guid]["plan_soins"] = CApp::fetch("soins", "offline_plan_soins", $params); // Pour IE9 qui a des soucis avec les espaces entre une fermeture et une ouverture de td
*/ CCanDo::checkRead(); $date = CValue::get("date", CMbDT::date()); $group = CGroups::loadCurrent(); $date_min = CMbDT::date("-" . CAppUI::conf("maternite CGrossesse min_check_terme", $group) . " DAYS", $date); $date_max = CMbDT::date("+" . CAppUI::conf("maternite CGrossesse max_check_terme", $group) . " DAYS", $date); $where = array(); $ljoin = array(); $where["grossesse.terme_prevu"] = "BETWEEN '{$date_min}' AND '{$date_max}'"; $where["grossesse.group_id"] = "= '{$group->_id}' "; $where["grossesse.active"] = "= '1'"; $ljoin["patients"] = "patients.patient_id = grossesse.parturiente_id"; $grossesse = new CGrossesse(); /** @var CStoredObject[] $grossesses */ $grossesses = $grossesse->loadList($where, "terme_prevu ASC, nom ASC", null, null, $ljoin); CStoredObject::massLoadFwdRef($grossesses, "parturiente_id"); CStoredObject::massCountBackRefs($grossesses, "sejours"); $consultations = CStoredObject::massLoadBackRefs($grossesses, "consultations"); CStoredObject::massLoadFwdRef($consultations, "plageconsult_id"); /** @var CGrossesse[] $grossesses */ foreach ($grossesses as $_grossesse) { $_grossesse->loadRefParturiente(); $_grossesse->countRefSejours(); $_grossesse->loadRefsConsultations(true); } $smarty = new CSmartyDP(); $smarty->assign("grossesses", $grossesses); $smarty->assign("date", $date); $smarty->assign("date_min", $date_min); $smarty->assign("date_max", $date_max); $smarty->display("inc_tdb_grossesses.tpl");
$duration_operand = CValue::get("duration_operand"); $filter->duration = CValue::get("duration"); $ds = CSQLDataSource::get('std'); $where = array(); if ($filter->user_id) { $where["user_id"] = $ds->prepare("= ?", $filter->user_id); } if ($filter->_date_min) { $where[] = $ds->prepare("`datetime` >= ?", $filter->_date_min); } if ($filter->_date_max) { $where[] = $ds->prepare("`datetime` >= ?", $filter->_date_max); } if ($filter->duration && in_array($duration_operand, array('<', '<=', '=', '>', '>='))) { $where['duration'] = $ds->prepare("{$duration_operand} ?", $filter->duration); } $order = "datetime DESC"; /** @var CLongRequestLog[] $logs */ $logs = $filter->loadList($where, $order, "{$start}, 50"); $list_count = $filter->countList($where); CStoredObject::massLoadFwdRef($logs, 'user_id'); foreach ($logs as $_log) { $_log->loadRefUser(); $_log->_ref_user->loadRefFunction(); } $smarty = new CSmartyDP(); $smarty->assign("start", $start); $smarty->assign("list_count", $list_count); $smarty->assign("filter", $filter); $smarty->assign("logs", $logs); $smarty->display("inc_list_long_request_logs.tpl");
$hours = array(); while ($date_temp < $date_max) { $hours[] = $date_temp; $date_temp = CMbDT::dateTime("+1 hour", $date_temp); } $operation->_debut_offset = CMbDate::position($debut_op, $date_min, "1hour"); $operation->_fin_offset = CMbDate::position($min_fin_op, $date_min, "1hour"); $operation->_width = $operation->_fin_offset - $operation->_debut_offset; $ressource = new CRessourceMaterielle(); $ressource->type_ressource_id = $type_ressource_id; // Les usages sur la période définie $usages = $ressource->loadRefsUsages($date_min, $date_max); CStoredObject::massLoadFwdRef($usages, "ressource_materielle_id"); $usages_by_ressource = array(); $besoins = CStoredObject::massLoadFwdRef($usages, "besoin_ressource_id"); CStoredObject::massLoadFwdRef($besoins, "operation_id"); $display_alert = array(); foreach ($usages as $_usage) { if (!isset($usages_by_ressource[$_usage->ressource_materielle_id])) { $usages_by_ressource[$_usage->ressource_materielle_id] = array(); } $_ressource = $_usage->loadRefRessource(); $_operation = $_usage->loadRefBesoin()->loadRefOperation(); $_operation->loadRefPlageOp(); $_debut_op = $_operation->_datetime; $_fin_op = CMbDT::addDateTime($_operation->temp_operation, $_debut_op); $fin_retab = CMbDT::addDateTime($_ressource->retablissement, $_fin_op); $_usage->_debut_offset = CMbDate::position(max($date_min, $_debut_op), $date_min, "1hour"); $_usage->_fin_offset = CMbDate::position(min($date_max, $_fin_op), $date_min, "1hour"); $_usage->_width = $_usage->_fin_offset - $_usage->_debut_offset; $_usage->_debut_offset_retablissement = $_usage->_fin_offset;
$group = CGroups::loadCurrent(); $consultation = new CConsultation(); $where = array(); $where["consultation.grossesse_id"] = "IS NOT NULL"; $where["consultation.annule"] = "= '0'"; $where["plageconsult.date"] = "= '{$date}'"; $where["functions_mediboard.group_id"] = "= '{$group->_id}'"; $ljoin = array(); $ljoin["plageconsult"] = "plageconsult.plageconsult_id = consultation.plageconsult_id"; $ljoin["users_mediboard"] = "plageconsult.chir_id = users_mediboard.user_id"; $ljoin["functions_mediboard"] = "functions_mediboard.function_id = users_mediboard.function_id"; $curr_user = CMediusers::get(); if ($curr_user->isPraticien() || $curr_user->isSageFemme()) { $where["plageconsult.chir_id"] = "= '{$curr_user->_id}'"; } /** @var CConsultation[] $listConsults */ $listConsults = $consultation->loadList($where, "heure ASC", null, null, $ljoin); $plages = CStoredObject::massLoadFwdRef($listConsults, "plageconsult_id"); CStoredObject::massLoadFwdRef($plages, "chir_id"); CStoredObject::massLoadFwdRef($listConsults, "sejour_id"); $grossesses = CStoredObject::massLoadFwdRef($listConsults, "grossesse_id"); CStoredObject::massLoadFwdRef($grossesses, "parturiente_id"); foreach ($listConsults as $_consult) { $_consult->loadRefPraticien(); $_consult->loadRefSejour()->loadRefGrossesse(); $_consult->loadRefGrossesse()->loadRefParturiente(); } $smarty = new CSmartyDP(); $smarty->assign("date", $date); $smarty->assign("listConsults", $listConsults); $smarty->display("inc_tdb_consultations.tpl");
} if ($next["CSejour"]->_id) { $next["CSejour"]->loadRefPraticien(); $next["CSejour"]->loadNDA(); $next["CSejour"]->loadRefsNotes(); if ($filter == "dhe") { unset($listConsultations[$_consult->_id]); } } $_consult->_next_sejour_and_operation = $next; } elseif ($filter == "dhe") { unset($listConsultations[$_consult->_id]); } } CStoredObject::massLoadFwdRef($sejours_total, "patient_id"); CStoredObject::massLoadFwdRef($sejours_total, "praticien_id"); CStoredObject::massLoadBackRefs($sejours_total, "notes"); CStoredObject::massLoadBackRefs($sejours_total, "affectations", "sortie DESC"); // Chargement des NDA CSejour::massLoadNDA($sejours_total); // Chargement optimisé des prestations CSejour::massCountPrestationSouhaitees($sejours_total); foreach ($sejours_total as $_sejour) { $_sejour->loadRefPatient(); $_sejour->loadRefPraticien(); $_sejour->loadRefsNotes(); $_sejour->loadRefFirstAffectation(); $_sejour->getDroitsCMU(); } // Création du template $smarty = new CSmartyDP();
/** * attention aux dates, il faut surement checker le log de derniere modif des champs du concept * * @fixme pas trop optimisé */ function getReportedValues(CExClassEvent $event) { $ex_class = $this->_ref_ex_class; $fields = $ex_class->loadRefsAllFields(true); if ($this->_id) { return $fields; } self::$_multiple_load = true; CExClassField::$_load_lite = true; $this->loadRefsLinks(); $latest_ex_objects = array($ex_class->getLatestExObject($this->_ref_object), $ex_class->getLatestExObject($this->_ref_reference_object_1), $ex_class->getLatestExObject($this->_ref_reference_object_2)); if ($this->_ref_object->_id) { $this->_ref_object->loadComplete(); } if ($this->_ref_reference_object_1->_id) { $this->_ref_reference_object_1->loadComplete(); } if ($this->_ref_reference_object_2->_id) { $this->_ref_reference_object_2->loadComplete(); } CStoredObject::massLoadFwdRef($fields, "ex_group_id"); $all_concepts = CStoredObject::massLoadFwdRef($fields, "concept_id"); $all_back_fields = CStoredObject::massLoadBackRefs($all_concepts, "class_fields"); $ex_groups = CStoredObject::massLoadFwdRef($all_back_fields, "ex_group_id"); CStoredObject::massLoadFwdRef($ex_groups, "ex_class_id"); // Cache de concepts $concepts = array(); $ex_classes = array(); // on cherche les champs reportés de l'objet courant foreach ($fields as $_field) { $field_name = $_field->name; $this->_reported_fields[$field_name] = null; // valeur par défaut $spec_obj = $_field->getSpecObject(); $this->{$field_name} = CExClassField::unescapeProp($spec_obj->default); $_concept = null; if ($_field->concept_id) { $_concept = $_field->loadRefConcept(); } // si champ pas reporté, on passe au suivant if (!($_field->report_class || $_field->concept_id && $_concept->native_field)) { continue; } // Native fields if ($_concept && $_concept->native_field) { list($_class, $_path) = explode(" ", $_concept->native_field, 2); if (isset($this->_preview)) { $this->_reported_fields[$field_name] = new $_class(); $this->{$field_name} = "Test"; } else { if ($this->_ref_object->_class == $_class) { $_object = $this->_ref_object; } elseif ($this->_ref_reference_object_1->_class == $_class) { $_object = $this->_ref_reference_object_1; } elseif ($this->_ref_reference_object_2->_class == $_class) { $_object = $this->_ref_reference_object_2; } list($_object, $_path) = CExClassConstraint::getFieldAndObjectStatic($_object, $_path); $_resolved = CExClassConstraint::resolveObjectFieldStatic($_object, $_path); $_obj = $_resolved["object"]; $_field_name = $_resolved["field"]; $this->_reported_fields[$field_name] = $_object; $this->{$field_name} = $_obj->{$_field_name}; } if ($this->{$field_name}) { continue; } } $_report_class = $_field->report_class; // si champ basé sur un concept, il faut parcourir // tous les formulaires qui ont un champ du meme concept if ($_field->concept_id) { if (!isset($concepts[$_field->concept_id])) { $_concept_fields = $_concept->loadRefClassFields(); foreach ($_concept_fields as $_concept_field) { if (!isset($ex_classes[$_concept_field->ex_group_id])) { $ex_classes[$_concept_field->ex_group_id] = $_concept_field->loadRefExClass(); } else { $_concept_field->_ref_ex_class = $ex_classes[$_concept_field->ex_group_id]; } } $concepts[$_field->concept_id] = array($_concept, $_concept_fields); } else { list(, $_concept_fields) = $concepts[$_field->concept_id]; } /** @var CExObject $_latest */ $_latest = null; $_latest_value = null; // on regarde tous les champs du concept foreach ($_concept_fields as $_concept_field) { $_ex_class = $_concept_field->_ref_ex_class; $_concept_latest = null; if ($this->_ref_object->_class == $_report_class) { $_concept_latest = $_ex_class->getLatestExObject($this->_ref_object); } elseif ($this->_ref_reference_object_1->_class == $_report_class) { $_concept_latest = $_ex_class->getLatestExObject($this->_ref_reference_object_1); } elseif ($this->_ref_reference_object_2->_class == $_report_class) { $_concept_latest = $_ex_class->getLatestExObject($this->_ref_reference_object_2); } // si pas d'objet precedemment enregistré if (!$_concept_latest || !$_concept_latest->_id || $_concept_latest->{$_concept_field->name} == "") { continue; } if (!$_latest) { $_latest = $_concept_latest; $_latest_value = $_latest->{$_concept_field->name}; } else { $_date = $_concept_latest->getEditDate(); if ($_date > $_latest->getEditDate()) { $_latest = $_concept_latest; $_latest_value = $_latest->{$_concept_field->name}; } } } if ($_latest) { $_latest->loadTargetObject()->loadComplete(); $this->_reported_fields[$field_name] = $_latest; $this->{$field_name} = self::typeSetSpecIntersect($_field, $_latest_value); } } else { $escape = true; foreach ($latest_ex_objects as $_latest_ex_object) { if ($_latest_ex_object->_id) { $escape = false; break; } } if ($escape) { continue; } /** @var CMbObject $_base */ /* * Comprendre pourquoi parfois il n'y a pas de $_latest_ex_object */ $_base = null; foreach ($latest_ex_objects as $_latest_ex_object) { if (!$_latest_ex_object) { continue; } if ($_latest_ex_object->_ref_reference_object_1 && $_latest_ex_object->_ref_reference_object_1->_class == $_report_class) { $_base = $_latest_ex_object->_ref_reference_object_1; break; } elseif ($_latest_ex_object->_ref_reference_object_2 && $_latest_ex_object->_ref_reference_object_2->_class == $_report_class) { $_base = $_latest_ex_object->_ref_reference_object_2; break; } elseif ($_latest_ex_object->_ref_object && $_latest_ex_object->_ref_object->_class == $_report_class) { $_base = $_latest_ex_object->_ref_object; break; } } if ($this->_ref_object->_id && !$_base) { //$_field_view = CAppUI::tr("$this->_class-$_field->name"); //CAppUI::setMsg("Report de données impossible pour le champ '$_field_view'", UI_MSG_WARNING); continue; } if ($_base->{$field_name} == "") { continue; } $_base->loadTargetObject()->loadComplete(); $_base->loadLastLog(); $this->_reported_fields[$field_name] = $_base; $this->{$field_name} = self::typeSetSpecIntersect($_field, $_base->{$field_name}); } } self::$_multiple_load = false; CExClassField::$_load_lite = false; return $fields; }
$operation = new COperation(); $ljoin = array(); $ljoin["sejour"] = "operations.sejour_id = sejour.sejour_id"; $ljoin["grossesse"] = "sejour.grossesse_id = grossesse.grossesse_id"; $where = array(); // Interv ou travail qui commence le jour choisi et n'a pas terminé d'accoucher $where[] = "operations.date = '{$date}' OR (\n grossesse.datetime_debut_travail IS NOT NULL AND\n DATE(grossesse.datetime_debut_travail) < '{$date}' AND\n grossesse.datetime_accouchement IS NULL\n)"; $where["operations.chir_id"] = CSQLDataSource::prepareIn(array_keys($listChirs)); $where["sejour.grossesse_id"] = "IS NOT NULL"; /** @var CStoredObject[] $urgences */ $urgences = $operation->loadGroupList($where, "salle_id, chir_id", null, null, $ljoin); $reservation_installed = CModule::getActive("reservation"); $diff_hour_urgence = CAppUI::conf("reservation diff_hour_urgence"); $sejours = CStoredObject::massLoadFwdRef($urgences, "sejour_id"); $patients = CStoredObject::massLoadFwdRef($sejours, "patient_id"); CStoredObject::massLoadFwdRef($sejours, "grossesse_id"); $plage = new CPlageOp(); /** @var COperation[] $urgences */ foreach ($urgences as &$urgence) { $urgence->loadRefsFwd(); $urgence->loadRefAnesth(); $urgence->_ref_chir->loadRefsFwd(); $sejour = $urgence->_ref_sejour; $patient = $sejour->loadRefPatient(); $sejour->loadRefGrossesse(); $dossier_medical = $patient->loadRefDossierMedical(); $dossier_medical->loadRefsAntecedents(); $dossier_medical->countAntecedents(); $dossier_medical->countAllergies(); if ($reservation_installed) { $first_log = $urgence->loadFirstLog();
// Chargement de tous les plateaux et des equipements et techniciens associés $plateau_tech = new CPlateauTechnique(); $plateau_tech->group_id = CGroups::loadCurrent()->_id; /** @var CPlateauTechnique[] $plateaux */ $plateaux = $plateau_tech->loadMatchingList(); CMbObject::massLoadBackRefs($plateaux, "equipements", "nom ASC"); foreach ($plateaux as $_plateau) { $_plateau->loadRefsEquipements(); } // Chargement des executants en fonction des category de prescription $executants = array(); $reeducateurs = array(); $selected_cat = ""; $user = CMediusers::get(); $func_cats = CStoredObject::massLoadBackRefs($categories, "functions_category"); CStoredObject::massLoadFwdRef($func_cats, "function_id"); foreach ($categories as $_category) { // Chargement des associations pour chaque catégorie $associations[$_category->_id] = $_category->loadBackRefs("functions_category"); // Parcours des associations trouvées et chargement des utilisateurs /** @var CFunctionCategoryPrescription $_association */ foreach ($associations[$_category->_id] as $_association) { $function = $_association->loadRefFunction(); $function->loadRefsUsers(); foreach ($function->_ref_users as $_user) { $_user->_ref_function = $function; if ($_user->_id == $user->_id && !$selected_cat) { $selected_cat = $_category; } $executants[$_category->_id][$_user->_id] = $_user; $reeducateurs[$_user->_id] = $_user;
$error_logs[] = $error_log; $user_ids = array_merge($user_ids, $error_log->_similar_user_ids); $list_ids = array_merge($list_ids, $error_log->_similar_ids); } // Load users for similar groupings $user_ids = array_unique($user_ids); $user = new CUser(); $users = $user->loadAll($user_ids); } else { $total = $error_log->countList($where); $error_logs = $error_log->loadList($where, $order, $limit, $groupby); $list_ids = CMbArray::pluck($error_logs, "_id"); $users = CStoredObject::massLoadFwdRef($error_logs, "user_id"); } // Get all data CStoredObject::massLoadFwdRef($error_logs, "stacktrace_id"); CStoredObject::massLoadFwdRef($error_logs, "param_GET_id"); CStoredObject::massLoadFwdRef($error_logs, "param_POST_id"); CStoredObject::massLoadFwdRef($error_logs, "session_data_id"); foreach ($error_logs as $_error_log) { $_error_log->loadComplete(); } // Création du template $smarty = new CSmartyDP(); $smarty->assign("error_logs", $error_logs); $smarty->assign("list_ids", $list_ids); $smarty->assign("total", $total); $smarty->assign("start", $start); $smarty->assign("users", $users); $smarty->assign("group_similar", $group_similar); $smarty->display('inc_list_error_logs.tpl');
// 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); $_sejours = CStoredObject::massLoadFwdRef($_affectations, "sejour_id"); CStoredObject::massLoadFwdRef($_sejours, "patient_id"); CStoredObject::massLoadFwdRef($_sejours, "praticien_id"); /** @var $_affectations CAffectation[] */ foreach ($_affectations as $_affectation) { $_sejour = $_affectation->loadRefSejour(); $_sejour->loadRefPraticien(); $_sejour->loadRefPatient(); } $_lit->_ref_affectations = $_affectations; $chambre->_ref_lits[$_lit->_id] = $_lit; } if (!CAppUI::conf("dPhospi hide_alertes_temporel")) { $lit->_ref_chambre->checkChambre(); } $smarty = new CSmartyDP(); $smarty->assign("affectations", $affectations); $smarty->assign("readonly", $readonly);
if ($order_col == "patient_id") { $order = "patients.nom {$order_way}, patients.prenom {$order_way}, sejour.sortie_prevue"; } if ($order_col == "sortie_prevue") { $order = "sejour.sortie_prevue {$order_way}, patients.nom, patients.prenom"; } if ($order_col == "praticien_id") { $order = "users.user_last_name {$order_way}, users.user_first_name"; } /** @var CSejour[] $sejours */ $sejours = $sejour->loadList($where, $order, null, null, $ljoin); $patients = CStoredObject::massLoadFwdRef($sejours, "patient_id"); CStoredObject::massLoadFwdRef($sejours, "etablissement_sortie_id"); CStoredObject::massLoadFwdRef($sejours, "service_sortie_id"); $praticiens = CStoredObject::massLoadFwdRef($sejours, "praticien_id"); $functions = CStoredObject::massLoadFwdRef($praticiens, "function_id"); CStoredObject::massLoadBackRefs($sejours, "affectations"); // Chargement optimisée des prestations CSejour::massCountPrestationSouhaitees($sejours); CStoredObject::massLoadBackRefs($sejours, "notes"); CStoredObject::massLoadBackRefs($patients, "dossier_medical"); $operations = CStoredObject::massLoadBackRefs($sejours, "operations", "date ASC", array("annulee" => "= '0'")); CStoredObject::massLoadBackRefs($operations, "actes_ngap", "lettre_cle DESC"); $order = "code_association, code_acte,code_activite, code_phase, acte_id"; CStoredObject::massLoadBackRefs($operations, "actes_ccam", $order); // Chargement des NDA CSejour::massLoadNDA($sejours); // Chargement des IPP CPatient::massLoadIPP($patients); $maternite_active = CModule::getActive("maternite"); foreach ($sejours as $sejour_id => $_sejour) {
static function massLoadRefAlerte(&$observations = array(), $handled = true) { $alerte = new CAlert(); $where = array("object_class" => "= 'CObservationMedicale'", "object_id" => CSQLDataSource::prepareIn(CMbArray::pluck($observations, "_id")), "level" => "= 'medium'", "tag" => "= '" . self::$tag_alerte . "'"); if (!$handled) { $where["handled"] = "= '0'"; } $alertes = $alerte->loadList($where); CStoredObject::massLoadFwdRef($alertes, "handled_user_id"); foreach ($alertes as $_alerte) { $observations[$_alerte->object_id]->_ref_alerte = $_alerte; } foreach ($observations as $_observation) { if (!$_observation->_ref_alerte) { $_observation->_ref_alerte = new CAlert(); } $_observation->_ref_alerte->loadRefHandledUser(); } }
$plageSel->loadRefChir(); $plageSel->loadRefRemplacant(); $plageSel->loadRefPourCompte(); $plageSel->loadRefsNotes(); $plageSel->loadRefsBack($show_annulees, true, $show_payees); if ($plageSel->_affected && count($plageSel->_ref_consultations)) { $firstconsult = reset($plageSel->_ref_consultations); $_firstconsult_time = substr($firstconsult->heure, 0, 5); $lastconsult = end($plageSel->_ref_consultations); $_lastconsult_time = substr($lastconsult->heure, 0, 5); } $consults = $plageSel->_ref_consultations; CStoredObject::massLoadFwdRef($consults, "sejour_id"); $patients = CMbObject::massLoadFwdRef($consults, "patient_id"); CStoredObject::massCountBackRefs($patients, "notes"); CStoredObject::massLoadFwdRef($consults, "categorie_id"); // Détails sur les consultation affichées foreach ($plageSel->_ref_consultations as $keyConsult => &$consultation) { $consultation->_ref_plageconsult = $plageSel; $consultation->loadRefSejour(); $consultation->loadRefPatient()->loadRefsNotes(); $consultation->loadRefCategorie(); $consultation->countDocItems(); $consultation->_view = "Consult. de " . $consultation->_ref_patient->_view; $consultation->_view .= " (" . CMbDT::format($plageSel->date, "%d/%m/%Y") . ")"; //check 3333tel if (CModule::getActive("3333tel")) { C3333TelTools::checkConsults($consultation, $plageSel->_ref_chir->function_id); } } if ($plageSel->chir_id != $chirSel && $plageSel->remplacant_id != $chirSel && $plageSel->pour_compte_id != $chirSel) {
$php_date_format = '\\1'; break; default: CAppUI::stepAjax('common-error-Invalid parameter', UI_MSG_ERROR); } $order_by[] = "DATE_FORMAT(`{$patient->_spec->table}`.`naissance`, '{$mysql_date_format}')"; $order_by[] = "`{$patient->_spec->table}`.`nom`, `{$patient->_spec->table}`.`prenom`"; $request = new CRequest(); $request->addSelect('`cs`.*'); $request->addTable("{$consult->_spec->table} AS `cs`"); $request->addLJoin($ljoin); $request->addWhere($where); $request->addOrder($order_by); $consultations = $consult->loadQueryList($request->makeSelect()); CStoredObject::massLoadFwdRef($consultations, 'plageconsult_id'); $patients = CStoredObject::massLoadFwdRef($consultations, 'patient_id'); if ($_print_ipp) { CPatient::massLoadIPP($patients); } $sorted_consults = array(); /** @var CConsultation $_consult */ foreach ($consultations as $_consult) { // Implicit loadRefPlageConsult() $_consult->loadRefPraticien(); $_consult->loadRefPatient(); $period = preg_replace('/(\\d{4})-(\\d{2})-(\\d{2})/', $php_date_format, $_consult->_ref_patient->naissance); if (!isset($sorted_consults[$period])) { $sorted_consults[$period] = array(); } $sorted_consults[$period][] = $_consult; }
$whereUrg["service.service_id"] = "IS NULL"; $listInterv["ambu"]["non_place"] = $interv->loadList($whereAmbu, $order, null, null, $ljoin); $listInterv["comp"]["non_place"] = $interv->loadList($whereHospi, $order, null, null, $ljoin); $listInterv["hors_plage"]["non_place"] = $interv->loadList($whereUrg, $order, null, null, $ljoin); $allInterv = array_merge($allInterv, $listInterv["ambu"]["non_place"]); $allInterv = array_merge($allInterv, $listInterv["comp"]["non_place"]); $allInterv = array_merge($allInterv, $listInterv["hors_plage"]["non_place"]); $count_ops["ambu"] += count($listInterv["ambu"]["non_place"]); $count_ops["comp"] += count($listInterv["comp"]["non_place"]); $count_ops["hors_plage"] += count($listInterv["hors_plage"]["non_place"]); // Complétion du chargement $chirs = CStoredObject::massLoadFwdRef($allInterv, "chir_id"); $functions = CStoredObject::massLoadFwdRef($chirs, "function_id"); $plages = CStoredObject::massLoadFwdRef($allInterv, "plageop_id"); $sejours = CStoredObject::massLoadFwdRef($allInterv, "sejour_id"); $patients = CStoredObject::massLoadFwdRef($sejours, "patient_id"); foreach ($allInterv as $_interv) { $_interv->loadRefAffectation(); $_interv->loadRefChir()->loadRefFunction(); $_interv->loadRefPatient()->loadRefLatestConstantes(null, array("poids", "taille")); $_interv->loadRefVisiteAnesth()->loadRefFunction(); $_interv->loadRefsConsultAnesth()->loadRefConsultation()->loadRefPraticien()->loadRefFunction(); } // Création du template $smarty = new CSmartyDP(); $smarty->assign("date", $date); $smarty->assign("listPrat", $listPrat); $smarty->assign("listInterv", $listInterv); $smarty->assign("services", $services); $smarty->assign("selPrat", $selPrat); $smarty->assign("canceled", $canceled);
/** * Display the total matrix templage * * @param string $title Locale string for template title * * @return void */ function display($title) { // Prepare groups-functions-users hierarchy $user = CMediusers::get(); /** @var CMediusers[] $users */ /** @var CFunctions[] $functions */ /** @var CGroups[] $groups */ $users = $user->loadAll(array_keys($this->totals)); $functions = CStoredObject::massLoadFwdRef($users, "function_id"); $groups = CStoredObject::massLoadFwdRef($functions, "group_id"); foreach ($users as $_user) { $_user->loadRefFunction()->loadRefGroup(); // Function-users linkage $function = $functions[$_user->function_id]; $function->_ref_users[$_user->_id] = $_user; // Group-functions linkage $group = $groups[$function->group_id]; $group->_ref_functions[$function->_id] = $function; $display_errors = ini_set("display_errors", false); foreach ($this->totals[$_user->_id] as $_date => $_values) { foreach ($_values as $_part => $_value) { if (is_numeric($_value)) { @($this->sections[$function->_guid][$_date][$_part] += $_value); @($this->sections[$group->_guid][$_date][$_part] += $_value); } } } ini_set("display_errors", $display_errors); } // Display the template $smarty = new CSmartyDP(); $smarty->assign("period", $this->period); $smarty->assign("dates", $this->dates); $smarty->assign("min_date", $this->min_date); $smarty->assign("max_date", $this->max_date); $smarty->assign("totals", $this->totals); $smarty->assign("sections", $this->sections); $smarty->assign("cells", $this->cells); $smarty->assign("users", $users); $smarty->assign("functions", $functions); $smarty->assign("groups", $groups); $smarty->assign("title", $title); $smarty->display("../../../modules/mediusers/templates/user_stats.tpl"); }
/** * Ajoute les données des graphiques de supervision * * @param CTemplateManager $template The template manager * @param CMbObject $object The host object * @param string $name The field name * * @return void */ static function addObservationDataToTemplate(CTemplateManager $template, CMbObject $object, $name) { $prefix = "Supervision"; $group_id = CGroups::loadCurrent()->_id; $results = array(); $times = array(); if ($object->_id) { list($results, $times) = CObservationResultSet::getResultsFor($object, false); $times = array_combine($times, $times); } // CSupervisionGraphAxis $axis = new CSupervisionGraphAxis(); $ds = $axis->getDS(); $where = array("supervision_graph_axis.in_doc_template" => "= '1'", "supervision_graph.owner_class" => "= 'CGroups'", "supervision_graph.owner_id" => $ds->prepare("= ?", $group_id)); $ljoin = array("supervision_graph" => "supervision_graph.supervision_graph_id = supervision_graph_axis.supervision_graph_id"); $order = array("supervision_graph.title", "supervision_graph_axis.title"); /** @var CSupervisionGraphAxis[] $axes */ $axes = $axis->loadList($where, $order, null, null, $ljoin); CStoredObject::massLoadFwdRef($axes, "supervision_graph_id", null, true); foreach ($axes as $_axis) { $_graph = $_axis->loadRefGraph(); $_series = $_axis->loadRefsSeries(); $_axis->loadRefsLabels(); $_data = array_fill_keys($times, array()); foreach ($_series as $_serie) { $_unit_id = $_serie->value_unit_id ?: "none"; $_unit_label = $_serie->loadRefValueUnit(); if (!isset($results[$_serie->value_type_id][$_unit_id])) { continue; } foreach ($results[$_serie->value_type_id][$_unit_id] as $_value) { foreach ($times as $_time) { if ($_value["datetime"] != $_time) { continue; } $_value["unit"] = $_unit_label->label; $_data["{$_time}"][$_serie->_id] = $_value; break; } } } $view = ""; if (count($_data)) { $smarty = new CSmartyDP("modules/dPsalleOp"); $smarty->assign("data", $_data); $smarty->assign("series", $_series); $smarty->assign("times", $times); $view = $smarty->fetch("inc_print_observation_result_set.tpl", '', '', 0); $view = preg_replace('`([\\n\\r])`', '', $view); } $template->addProperty("{$name} - {$prefix} - {$_graph->title} - {$_axis->title}", trim($view), "", false); } // CSupervisionTimedPicture // CSupervisionTimedData $data = array("CSupervisionTimedPicture", "CSupervisionTimedData"); foreach ($data as $_class) { /** @var CSupervisionTimedPicture|CSupervisionTimedData $_object */ $_object = new $_class(); $_table = $_object->_spec->table; $_ds = $_object->getDS(); $where = array("{$_table}.in_doc_template" => "= '1'", "{$_table}.owner_class" => "= 'CGroups'", "{$_table}.owner_id" => $_ds->prepare("= ?", $group_id)); $order = "title"; /** @var CSupervisionTimedPicture[]|CSupervisionTimedData[] $_objects */ $_objects = $_object->loadList($where, $order); foreach ($_objects as $_timed) { $_data = array_fill_keys($times, null); if (!isset($results[$_timed->value_type_id])) { continue; } foreach ($results[$_timed->value_type_id]["none"] as $_value) { foreach ($times as $_time) { if ($_value["datetime"] != $_time) { continue; } if ($_value["file_id"]) { $_file = new CFile(); $_file->load($_value["file_id"]); $_value["datauri"] = $_file->getDataURI(); $_value["file"] = $_file; } $_data["{$_time}"] = $_value; break; } } $view = ""; if (count($_data)) { $smarty = new CSmartyDP("modules/dPsalleOp"); $smarty->assign("data", $_data); $smarty->assign("times", $times); $smarty->assign("timed_data", true); $view = $smarty->fetch("inc_print_observation_result_set.tpl", '', '', 0); $view = preg_replace('`([\\n\\r])`', '', $view); } $template->addProperty("{$name} - {$prefix} - {$_timed->title}", trim($view), "", false); } } }
// Load IPP and NDA $ref_objects = array($ex_object->_ref_object, $ex_object->_ref_reference_object_1, $ex_object->_ref_reference_object_2); foreach ($ref_objects as $_object) { if ($_object instanceof CPatient) { $_object->loadIPP(); continue; } if ($_object instanceof CSejour) { $_object->loadNDA(); $_object->loadRefCurrAffectation($creation_date); continue; } } /** @var CExConcept[] $concepts */ $concepts = CStoredObject::massLoadFwdRef($fields, "concept_id"); $lists = CStoredObject::massLoadFwdRef($concepts, "ex_list_id"); CStoredObject::massLoadBackRefs($lists, "list_items"); CStoredObject::massLoadBackRefs($concepts, "list_items"); $formula_token_values = array(); foreach ($fields as $_field) { /*if ($_field->formula == null) { continue; } */ $formula_token_values[$_field->name] = array("values" => $_field->getFormulaValues(), "formula" => $_field->formula, "formulaView" => utf8_encode($_field->_formula)); } // Création du template $smarty = new CSmartyDP(); $smarty->assign("ex_object", $ex_object); $smarty->assign("ex_object_id", $ex_object_id); $smarty->assign("ex_class_id", $ex_class_id); $smarty->assign("object_guid", $object_guid);
} else { $reference = null; } CExClassField::$_load_lite = true; CExObject::$_multiple_load = true; CExObject::$_load_lite = $detail < 2; $group_id = $group_id ? $group_id : CGroups::loadCurrent()->_id; $where = array("group_id = '{$group_id}' OR group_id IS NULL"); if ($ex_class_id) { $where['ex_class_id'] = "= '{$ex_class_id}'"; } if (empty(CExClass::$_list_cache)) { $ex_class = new CExClass(); /** @var CExClass[] $ex_classes */ $ex_classes = $ex_class->loadList($where, "name"); $categories = CStoredObject::massLoadFwdRef($ex_classes, "category_id"); $categories = CStoredObject::naturalSort($categories, array("title")); $categories = array(new CExClassCategory()) + $categories; foreach ($ex_classes as $_ex_class) { $_category_id = $_ex_class->category_id ?: 0; $categories[$_category_id]->_ref_ex_classes[$_ex_class->_id] = $_ex_class; } if (!CExObject::$_locales_cache_enabled && $detail > 1) { foreach ($ex_classes as $_ex_class) { foreach ($_ex_class->loadRefsGroups() as $_group) { $_group->loadRefsFields(); foreach ($_group->_ref_fields as $_field) { $_field->updateTranslation(); } } }
break; case "entree_prevue": $order = "sejour.entree_prevue ASC"; break; case "entree_reelle": $order = "sejour.entree_reelle ASC"; break; default: $order = "users.user_last_name, users.user_first_name, sejour.entree"; break; } /** @var CSejour[] $sejours */ $sejours = $sejour->loadList($where, $order, null, null, $ljoin); CStoredObject::massLoadFwdRef($sejours, "praticien_id"); CStoredObject::massLoadFwdRef($sejours, "patient_id"); CStoredObject::massLoadFwdRef($sejours, "prestation_id"); CStoredObject::massLoadBackRefs($sejours, "affectations"); $listByPrat = array(); foreach ($sejours as $sejour) { $sejour->loadRefPraticien(); $sejour->loadRefsAffectations(); $sejour->loadRefPatient(); $sejour->loadRefPrestation(); $sejour->loadNDA(); $sejour->_ref_first_affectation->loadRefLit(); $sejour->_ref_first_affectation->_ref_lit->loadCompleteView(); $curr_prat = $sejour->praticien_id; if (!isset($listByPrat[$curr_prat])) { $listByPrat[$curr_prat]["praticien"] = $sejour->_ref_praticien; } $listByPrat[$curr_prat]["sejours"][] = $sejour;
if ($praticien->isAnesth()) { $ljoin = array(); $ljoin["operations"] = "operations.sejour_id = sejour.sejour_id"; $ljoin["plagesop"] = "operations.plageop_id = plagesop.plageop_id"; $where[] = "operations.anesth_id = '{$chirSel}' OR (operations.anesth_id IS NULL AND plagesop.anesth_id = '{$chirSel}')"; } else { $where["sejour.praticien_id"] = "= '{$chirSel}'"; } $where["sejour.entree"] = "<= '{$date} 23:59:59'"; $where["sejour.sortie"] = ">= '{$date} 00:00:00'"; $where["sejour.annule"] = "= '0'"; $where["sejour.group_id"] = "= '" . CGroups::loadCurrent()->_id . "'"; $sejour = new CSejour(); /** @var CSejour[] $listSejours */ $listSejours = $sejour->loadList($where, null, null, null, $ljoin); CStoredObject::massLoadFwdRef($listSejours, "patient_id"); foreach ($listSejours as $_sejour) { $_sejour->loadRefPraticien(); $_sejour->loadRefPatient(); $_sejour->loadRefsOperations(); $_sejour->loadRefCurrAffectation("{$date} " . CMbDT::time()); $_sejour->_ref_curr_affectation->loadRefLit(); $_sejour->_ref_curr_affectation->_ref_lit->loadCompleteView(); } $lits = CMbArray::pluck($listSejours, "_ref_curr_affectation", "_ref_lit"); $sorter_chambre = CMbArray::pluck($lits, "_ref_chambre", "_view"); $sorter_service = CMbArray::pluck($lits, "_ref_chambre", "_ref_service", "_view"); $sorter_lit = CMbArray::pluck($lits, "_view"); $sorter_sejour_sortie = CMbArray::pluck($listSejours, "sortie"); $sorter_sejour_entree = CMbArray::pluck($listSejours, "entree"); array_multisort($sorter_service, SORT_ASC, $sorter_chambre, SORT_ASC, $sorter_lit, SORT_ASC, $sorter_sejour_sortie, SORT_ASC, $sorter_sejour_entree, SORT_DESC, $listSejours);
function massLoadExchanges($objects) { return CStoredObject::massLoadFwdRef($objects, "echange_hprim21_id"); }
$where["facture_cabinet.praticien_id"] = CSQLDataSource::prepareIn(array_keys($listPrat)); $where["reglement.object_class"] = " = 'CFactureCabinet'"; $reglement = new CReglement(); /** @var CReglement[] $reglements */ $reglements = $reglement->loadList($where, " facture_cabinet.facture_id, reglement.date", null, null, $ljoin); $reglement = new CReglement(); // Calcul du récapitulatif // Initialisation du tableau de reglements $recapReglement["total"] = array("nb_consultations" => "0", "du_patient" => "0", "du_tiers" => "0", "nb_reglement_patient" => "0", "nb_reglement_tiers" => "0", "secteur1" => "0", "secteur2" => "0", "secteur3" => "0", "du_tva" => "0"); foreach (array_merge($reglement->_specs["mode"]->_list, array("")) as $_mode) { $recapReglement[$_mode] = array("du_patient" => "0", "du_tiers" => "0", "nb_reglement_patient" => "0", "nb_reglement_tiers" => "0"); } $listReglements = array(); $listConsults = array(); $factures = CStoredObject::massLoadFwdRef($reglements, "object_id"); $patients = CStoredObject::massLoadFwdRef($factures, "patient_id"); CStoredObject::massCountBackRefs($factures, "notes"); foreach ($reglements as $_reglement) { $facture = $_reglement->loadRefFacture(); $facture->loadRefGroup(); $facture->loadRefsNotes(); $facture->loadRefsConsultation(); $facture->loadRefsReglements(); if (count($facture->_ref_consults)) { if (CAppUI::conf("dPccam CCodeCCAM use_cotation_ccam")) { foreach ($facture->_ref_consults as $_consult) { if (!array_key_exists($_consult->_id, $listConsults)) { $listConsults[$_consult->_id] = $_consult; $recapReglement["total"]["secteur1"] += $_consult->secteur1; $recapReglement["total"]["secteur2"] += $_consult->secteur2; $recapReglement["total"]["secteur3"] += $_consult->secteur3;
CCanDo::checkRead(); $function_id = CValue::getOrSession("function_id"); $page_function = intval(CValue::get('page_function', 0)); $step_sec_function = 25; $primary_users = array(); $total_sec_functions = null; $function = new CFunctions(); $function->load($function_id); $total_sec_functions = $function->countBackRefs("users"); /** @var CMediusers[] $primary_users */ $primary_users = $function->loadBackRefs("users", null, "{$page_function}, {$step_sec_function}"); CStoredObject::massLoadFwdRef($primary_users, "_profile_id"); foreach ($primary_users as $_mediuser) { $_mediuser->loadRefProfile(); } /** @var CSecondaryFunction[] $secondaries_functions */ $secondaries_functions = $function->loadBackRefs("secondary_functions"); $users = CMbObject::massLoadFwdRef($secondaries_functions, "user_id"); CStoredObject::massLoadFwdRef($users, "_profile_id"); foreach ($secondaries_functions as $_sec_function) { $_sec_function->loadRefUser(); $_sec_function->_ref_user->loadRefProfile(); } $smarty = new CSmartyDP(); $smarty->assign("function", $function); $smarty->assign("primary_users", $primary_users); $smarty->assign("total_sec_functions", $total_sec_functions); $smarty->assign("page_function", $page_function); $smarty->assign("utypes", CUser::$types); $smarty->assign("secondary_function", new CSecondaryFunction()); $smarty->display("inc_prim_secon_users.tpl");