示例#1
0
 /**
  * Load object
  *
  * @return CMbObject|CMediusers
  */
 function loadRefMetaObject()
 {
     $this->_ref_metaobject = CMbMetaObject::loadFromGuid("{$this->object_class}-{$this->object_id}");
     if ($this->object_class == "CMediusers") {
         $this->_ref_mediuser = $this->_ref_metaobject;
         $this->_ref_mediuser->loadRefFunction();
     }
     return $this->_ref_metaobject;
 }
 /**
  * Charge l'utilisateur qui a enregistré la première fois la constante
  *
  * @return CMediusers
  */
 function loadRefUser()
 {
     if (!$this->user_id) {
         $first_log = $this->loadFirstLog();
         $this->_ref_user = $first_log->loadRefUser();
         $this->_ref_user->loadRefMediuser()->loadRefFunction();
         $this->user_id = $this->_ref_user->_id;
         $this->store();
         return $this->_ref_user = $this->_ref_user->_ref_mediuser;
     }
     $this->_ref_user = $this->loadFwdRef("user_id", true);
     $this->_ref_user->loadRefFunction();
     return $this->_ref_user;
 }
示例#3
0
}
// Sejours pour lesquels le rééducateur est exécutant pour des lignes prescrites mais n'a pas encore d'evenement planifiés
if ($mode == "count" || $mode == "plannable") {
    if (!CModule::getActive("dPprescription")) {
        $counts["plannable"] = null;
        $sejours = array();
    } else {
        // Séjours élligibles
        $where = array();
        $where["sejour.type"] = "= 'ssr'";
        $where["sejour.entree"] = "<= '{$planning->date_max}'";
        $where["sejour.sortie"] = ">= '{$planning->date_min}'";
        $where["sejour.annule"] = "= '0'";
        $sejour_ids = $sejour->loadIds($where);
        // Identifiants de catégorie de prescriptions disponibles
        $function = $mediuser->loadRefFunction();
        $executants = $function->loadBackRefs("executants_prescription");
        $category_ids = CMbArray::pluck($executants, "category_prescription_id");
        // Recherche des lignes de prescriptions executables
        $line = new CPrescriptionLineElement();
        $join = array();
        $where = array();
        $join["element_prescription"] = "element_prescription.element_prescription_id = prescription_line_element.element_prescription_id";
        $where["element_prescription.category_prescription_id"] = $ds->prepareIn($category_ids);
        $join["prescription"] = "prescription.prescription_id = prescription_line_element.prescription_id";
        $where["prescription.type"] = "= 'sejour'";
        $where["prescription.object_class"] = "= 'CSejour'";
        $where["prescription.object_id"] = $ds->prepareIn($sejour_ids);
        $line_ids = $line->loadIds($where, null, null, null, $join);
        // Prescriptions exécutables
        $query = new CRequest();
            }
            foreach ($_sejour->_ref_documents as $_doc) {
                $_doc->canDo();
            }
        }
    }
}
// Praticien concerné
$user = CMediusers::get();
if ($user->isPraticien()) {
    $praticien = $user;
} else {
    $praticien = new CMediusers();
    $praticien->load(CValue::getOrSession("pratSel", CValue::getOrSession("praticien_id")));
}
$praticien->loadRefFunction();
$praticien->_ref_function->loadRefGroup();
$praticien->canDo();
// Compter les modèles d'étiquettes
$modele_etiquette = new CModeleEtiquette();
$where = array();
$where['object_class'] = "= 'COperation'";
$where["group_id"] = " = '" . CGroups::loadCurrent()->_id . "'";
$nb_modeles_etiquettes_operation = $modele_etiquette->countList($where);
$where['object_class'] = "= 'CSejour'";
$nb_modeles_etiquettes_sejour = $modele_etiquette->countList($where);
$nb_printers = 0;
if (CModule::getActive("printing")) {
    // Chargement des imprimantes pour l'impression d'étiquettes
    $user_printers = CMediusers::get();
    $function = $user_printers->loadRefFunction();
示例#5
0
$debut = CMbDT::date("next monday", $debut);
$fin = CMbDT::date("next sunday", $debut);
// L'utilisateur est-il praticien ?
$chir = null;
$mediuser = CMediusers::get();
if ($mediuser->isPraticien()) {
    $chir = $mediuser;
}
// Praticien selectionné
$chirSel = CValue::getOrSession("praticien_id");
if (!$chirSel) {
    $chirSel = $chir ? $chir->user_id : null;
}
$prat = new CMediusers();
$prat->load($chirSel);
$function_prat = $prat->loadRefFunction();
$user = new CMediusers();
$nbjours = 7;
$listPlageConsult = new CPlageconsult();
$listPlageOp = new CPlageOp();
$where = array();
$where["date"] = "= '{$fin}'";
$where["chir_id"] = " = '{$chirSel}'";
$operation = new COperation();
$operation->chir_id = $chirSel;
$operation->date = $fin;
// find for day number
if (!$listPlageConsult->countList($where) && !$listPlageOp->countList($where) && !$operation->countMatchingList()) {
    $nbjours--;
    // Aucune plage le dimanche, on peut donc tester le samedi.
    $dateArr = CMbDT::date("-1 day", $fin);
 * $Id: $
 *
 * @package    Mediboard
 * @subpackage Cabinet
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: $
 */
CCanDo::checkRead();
$chir_id = CValue::get("chir_id");
$field_name = CValue::get("field_name", "_secondary_function_id");
$empty_function_principale = CValue::get("empty_function_principale", 0);
$type_onchange = CValue::get("type_onchange", "consult");
$change_active = CValue::get("change_active", "1");
$chir = new CMediusers();
$chir->load($chir_id);
$chir->loadRefFunction()->loadRefGroup();
/** @var CSecondaryFunction[] $_functions */
$_functions = $chir->loadBackRefs("secondary_functions");
CMbObject::massLoadFwdRef(CMbArray::pluck($_functions, "_ref_function"), "group_id");
foreach ($_functions as $_function) {
    $_function->_ref_function->loadRefGroup();
}
$smarty = new CSmartyDP();
$smarty->assign("_functions", $_functions);
$smarty->assign("chir", $chir);
$smarty->assign("field_name", $field_name);
$smarty->assign("empty_function_principale", $empty_function_principale);
$smarty->assign("type_onchange", $type_onchange);
$smarty->assign("change_active", $change_active);
$smarty->display("inc_refresh_secondary_functions.tpl");
$chir_id = CValue::getOrSession("chir_id");
$mediuser = CMediusers::get($chir_id);
if (!$mediuser->isPraticien()) {
    $mediuser = new CMediusers();
}
$function_id = CValue::getOrSession("function_id");
$type = CValue::getOrSession("type", "interv");
$page = CValue::get("page");
$sejour_type = CValue::get("sejour_type");
$step = 30;
$protocole = new CProtocole();
$where = array();
$chir = new CMediusers();
$chir->load($chir_id);
if ($chir->_id) {
    $chir->loadRefFunction();
    $functions = array($chir->function_id);
    $chir->loadBackRefs("secondary_functions");
    foreach ($chir->_back["secondary_functions"] as $curr_sec_func) {
        $functions[] = $curr_sec_func->function_id;
    }
    $list_functions = implode(",", $functions);
    $where[] = "protocole.chir_id = '{$chir->_id}' OR protocole.function_id IN ({$list_functions})";
} else {
    $where["function_id"] = " = '{$function_id}'";
}
$where["for_sejour"] = $type == 'interv' ? "= '0'" : "= '1'";
if ($sejour_type) {
    $where["type"] = "= '{$sejour_type}'";
}
$order = "libelle_sejour, libelle, codes_ccam";
示例#8
0
 /**
  * Charge toutes les aides à la saisie de l'objet pour un utilisateur donné
  *
  * @param int    $user_id        Utilisateur
  * @param string $keywords       Permet de filtrer les aides commançant par le filtre, si non null
  * @param string $depend_value_1 Valeur de la dépendance 1 lié à l'aide
  * @param string $depend_value_2 Valeur de la dépendance 2 lié à l'aide
  * @param string $object_field   Type d'objet concerné
  * @param string $strict         True or False
  *
  * @return void
  */
 function loadAides($user_id, $keywords = null, $depend_value_1 = null, $depend_value_2 = null, $object_field = null, $strict = "true")
 {
     foreach ($this->_specs as $field => $spec) {
         if (isset($spec->helped)) {
             $this->_aides[$field] = array("no_enum" => null);
         }
     }
     // Chargement de l'utilisateur courant
     $user = new CMediusers();
     $user->load($user_id);
     $user->loadRefFunction();
     // Préparation du chargement des aides
     $ds =& $this->_spec->ds;
     // Construction du Where
     $where = array();
     $where[] = "(user_id = '{$user_id}' OR \n      function_id = '{$user->function_id}' OR \n      group_id = '{$user->_ref_function->group_id}')";
     $where["class"] = $ds->prepare("= %", $this->_class);
     if ($strict == "true") {
         if ($depend_value_1) {
             $where["depend_value_1"] = " = '{$depend_value_1}'";
         }
         if ($depend_value_2) {
             $where["depend_value_2"] = " = '{$depend_value_2}'";
         }
     } else {
         if ($depend_value_1) {
             $where[] = "(depend_value_1 = '{$depend_value_1}' OR depend_value_1 IS NULL)";
         }
         if ($depend_value_2) {
             $where[] = "(depend_value_2 = '{$depend_value_2}' OR depend_value_2 IS NULL)";
         }
     }
     if ($object_field) {
         $where["field"] = " = '{$object_field}'";
     }
     // tri par user puis function puis group (ordre inversé pour avoir ce résultat)
     $order = "group_id, function_id, user_id, depend_value_1, depend_value_2, name, text";
     // Chargement des Aides de l'utilisateur
     $aide = new CAideSaisie();
     // TODO: si on veut ajouter un $limit, il faudrait l'ajouter en argument de la fonction loadAides
     $aides = $aide->seek($keywords, $where, null, null, null, $order);
     $this->orderAides($aides, $depend_value_1, $depend_value_2);
 }
 */
CCanDo::checkEdit();
// Période
$filter = new CPlageconsult();
$filter->_date_min = CValue::getOrSession("_date_min");
$filter->_date_max = CValue::getOrSession("_date_max");
// Tri sur les praticiens
$mediuser = CMediusers::get();
$mediuser->loadRefFunction();
$prat = new CMediusers();
$prat->load(CValue::getOrSession("chir"));
if (!$prat->_id) {
    CAppUI::stepMessage(UI_MSG_WARNING, "CMediusers-warning-undefined");
    return;
}
$prat->loadRefFunction();
$listPrat = array($prat->_id => $prat);
$plageconsult = new CPlageconsult();
$ljoin = array();
$ljoin["consultation"] = "consultation.plageconsult_id = plageconsult.plageconsult_id";
$where = array();
$where[] = "\n  (plageconsult.chir_id  <> '{$prat->_id}' AND \n    (plageconsult.remplacant_id = '{$prat->_id}' OR plageconsult.pour_compte_id = '{$prat->_id}'))\n  OR \n  (plageconsult.chir_id  = '{$prat->_id}' AND \n    ((plageconsult.remplacant_id <> '{$prat->_id}' AND plageconsult.remplacant_id IS NOT NULL)\n      OR \n     (plageconsult.pour_compte_id <> '{$prat->_id}' AND plageconsult.pour_compte_id IS NOT NULL))\n   )";
$where["plageconsult.date"] = " BETWEEN '{$filter->_date_min}' AND '{$filter->_date_max}'";
$where["consultation.annule"] = "= '0'";
$order = "chir_id ASC";
$listPlages = $plageconsult->loadList($where, $order, null, null, $ljoin);
$plages = array();
foreach ($listPlages as $plage) {
    $plage->loadRefsConsultations();
    $plages[$plage->_id]["total"] = 0;
    foreach ($plage->_ref_consultations as $consult) {
示例#10
0
 /**
  * Edition de la facture
  *
  * @param bool $create création ou non du pdf
  *
  * @return void
  */
 function editFacture($create = true)
 {
     if ($create) {
         $this->createPdf();
     }
     foreach ($this->factures as $the_facture) {
         $this->facture = $the_facture;
         $this->facture->loadRefsItems();
         $this->_no_round = false;
         if ($this->facture->cloture && !count($this->facture->_ref_items)) {
             $this->facture->creationLignesFacture();
         }
         $this->patient = $this->facture->loadRefPatient();
         $this->facture->_ref_patient->loadRefsCorrespondantsPatient();
         $this->praticien = $this->facture->loadRefPraticien();
         $this->facture->loadRefAssurance();
         $this->facture->loadRefsObjects();
         $this->facture->loadRefsReglements();
         if ($this->type_pdf == "relance") {
             $this->facture->loadRefsRelances();
         }
         $this->function_prat = $this->praticien->loadRefFunction();
         $this->group = $this->function_prat->loadRefGroup();
         $adherent = $this->facture->loadNumAdherent($this->praticien->adherent);
         $this->adherent = $adherent["compte"];
         if ($this->type_pdf == "BVR") {
             $this->loadTotaux();
             $this->acompte = 0;
             $this->nb_factures = count($this->facture->_montant_factures_caisse);
             $this->num_fact = 0;
             foreach ($this->facture->_montant_factures_caisse as $cle_facture => $montant_facture) {
                 if ($this->acompte < $this->facture->_montant_avec_remise) {
                     $this->editHautFacture($cle_facture, $montant_facture);
                     $this->editBVR($montant_facture);
                 }
             }
         }
         if ($this->type_pdf == "BVR_TS") {
             $this->loadTotaux();
             $this->acompte = 0;
             $this->nb_factures = count($this->facture->_montant_factures_caisse);
             $this->num_fact = 0;
             $montant = 0;
             if ($this->acompte < $this->facture->_montant_avec_remise) {
                 $montant = $this->facture->_montant_avec_remise - $this->facture->_reglements_total_patient;
                 $montant = $montant - $this->facture->_reglements_total_tiers;
                 $this->editHautFacture(" ", $montant);
                 $this->editBVR($montant);
             }
             $this->type_pdf = "justif_TS";
             $this->function_prat->adresse = str_replace("\r\n", ' ', $this->function_prat->adresse);
             $this->patient->adresse = str_replace("\r\n", ' ', $this->patient->adresse);
             $this->editCenterJustificatif(0, $montant);
         } elseif ($this->type_pdf == "justif") {
             $this->function_prat->adresse = str_replace("\r\n", ' ', $this->function_prat->adresse);
             $this->patient->adresse = str_replace("\r\n", ' ', $this->patient->adresse);
             foreach ($this->facture->_montant_factures_caisse as $cle_facture => $montant_facture) {
                 $this->editCenterJustificatif($cle_facture, $montant_facture);
             }
         } elseif ($this->type_pdf == "relance") {
             $this->editRelanceEntete();
             //$this->editHautFacture(1, $this->relance->_montant, true);
             if (CAppUI::conf("ref_pays") == 2) {
                 $this->editBVR($this->relance->_montant);
             }
         }
     }
 }
示例#11
0
 /**
  * load plages for a day or between 2 days
  * check for chir, anesth or function of given prat_id
  *
  * @param string      $prat_id  prat_id (mediuser_id)
  * @param string      $date_min date min to check
  * @param null|string $date_max date max
  *
  * @return CPlageOp[]
  */
 function loadForDays($prat_id, $date_min, $date_max = null)
 {
     $prat = new CMediusers();
     $prat->load($prat_id);
     $function = $prat->loadRefFunction();
     $where = array();
     $where[] = "chir_id = '{$prat_id}' OR anesth_id = '{$prat_id}' OR spec_id = '{$function->_id}'";
     $where["date"] = $date_max ? "BETWEEN '{$date_min}' AND '{$date_max}'" : " = '{$date_min}'";
     return $this->loadList($where);
 }
 /**
  * Get validator
  *
  * @return CMediusers
  */
 function loadRefValidator()
 {
     $this->_ref_validator = $this->loadFwdRef("validator_id", true);
     $this->_ref_validator->loadRefFunction();
     return $this->_ref_validator;
 }
示例#13
0
}
if ($order_col == "lit_id") {
    $sorter_lit = CMbArray::pluck($sejours, "_ref_curr_affectation", "_ref_lit", "_view");
    $sorter_patient_nom = CMbArray::pluck($sejours, "_ref_patient", "nom");
    $sorter_patient_prenom = CMbArray::pluck($sejours, "_ref_patient", "prenom");
    array_multisort($sorter_lit, constant("SORT_{$order_way}"), $sorter_patient_nom, SORT_ASC, $sorter_patient_prenom, SORT_ASC, $sejours);
}
// Ajustements services
$service = new CService();
$service->load($filter->service_id);
$services[$service->_id] = $service;
unset($services[""]);
// Ajustements kinés
$kine = new CMediusers();
$kine->load($filter->referent_id);
$kine->loadRefFunction();
$kines[$kine->_id] = $kine;
unset($kines[""]);
// Tris a posteriori : détruit les clés !
array_multisort(CMbArray::pluck($kines, "_view"), SORT_ASC, $kines);
array_multisort(CMbArray::pluck($services, "_view"), SORT_ASC, $services);
array_multisort(CMbArray::pluck($praticiens, "_view"), SORT_ASC, $praticiens);
// Couleurs
$libelles = CMbArray::pluck($sejours, "libelle");
$colors = CColorLibelleSejour::loadAllFor($libelles);
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("date", $date);
$smarty->assign("filter", $filter);
$smarty->assign("colors", $colors);
$smarty->assign("sejours", $sejours);
 /**
  * Retourne un modèle de nom prédéfini pour un utilisateur et une classe donnés
  *
  * @param CMediusers $user         User
  * @param string     $object_class Target Class
  * @param string     $name         Model Name
  *
  * @return CCompteRendu|null
  */
 static function getSpecialModel($user, $object_class, $name)
 {
     if (!isset(self::$special_names[$object_class][$name])) {
         self::error("no_special", $object_class, $name);
         return null;
     }
     $model = new CCompteRendu();
     if (!$user->_id) {
         return $model;
     }
     $model->nom = $name;
     $model->object_class = $object_class;
     $model->type = CCompteRendu::$special_names[$object_class][$name];
     // Utilisateur
     $model->user_id = $user->_id;
     $model->loadMatchingObject();
     if ($model->_id) {
         return $model;
     }
     // Fonction
     $model->user_id = null;
     $model->function_id = $user->function_id;
     $model->loadMatchingObject();
     if ($model->_id) {
         return $model;
     }
     // Etablissement
     $user->loadRefFunction();
     $model->function_id = null;
     $model->group_id = $user->_ref_function->group_id;
     $model->loadMatchingObject();
     return $model;
 }
示例#15
0
    $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();
}
$object->loadNamedFile("identite.jpg");
$object->loadNamedFile("signature.jpg");
// Savoir s'il est relié au LDAP
if (isset($object->_ref_user)) {
    $object->_ref_user->isLDAPLinked();
}
// Chargement des banques
$banques = array();
if (class_exists("CBanque")) {
    $order = "nom ASC";
    $banque = new CBanque();
    $banques = $banque->loadList(null, $order);
}
 /**
  * Loads the related fields for indexing datum
  *
  * @return array
  */
 function getIndexableData()
 {
     $this->getIndexablePraticien();
     $array["id"] = $this->_id;
     $array["author_id"] = $this->_ref_chir->_id;
     $array["prat_id"] = $this->_ref_chir->_id;
     $array["title"] = $this->libelle;
     $array["body"] = $this->getIndexableBody("");
     $array["date"] = str_replace("-", "/", $this->date);
     $array["function_id"] = $this->_ref_chir->function_id;
     $array["group_id"] = $this->_ref_chir->loadRefFunction()->group_id;
     $array["patient_id"] = $this->getIndexablePatient()->_id;
     $this->loadRefSejour();
     $array["object_ref_id"] = $this->_ref_sejour->_id;
     $array["object_ref_class"] = $this->_ref_sejour->_class;
     return $array;
 }
 /**
  * Charge les praticiens à la compta desquels l'utilisateur courant a accès
  *
  * @param ref $prat_id Si définit, retourne un tableau avec seulement ce praticien
  *
  * @todo Définir verbalement la stratégie
  * @return CMediusers[]
  */
 static function loadPraticiensCompta($prat_id = null)
 {
     // Cas du praticien unique
     if ($prat_id) {
         $prat = new CMediusers();
         $prat->load($prat_id);
         $prat->loadRefFunction();
         return array($prat->_id => $prat);
     }
     // Cas standard
     $user = CMediusers::get();
     $is_admin = in_array(CUser::$types[$user->_user_type], array("Administrator"));
     $is_secretaire = in_array(CUser::$types[$user->_user_type], array("Secrétaire"));
     $is_directeur = in_array(CUser::$types[$user->_user_type], array("Directeur"));
     $function = $user->loadRefFunction();
     $praticiens = array();
     // Liste des praticiens du cabinet
     if ($is_admin || $is_secretaire || $is_directeur || $function->compta_partagee) {
         $function_id = null;
         if (!CAppUI::conf("cabinet Comptabilite show_compta_tiers") && $user->_user_username != "admin") {
             $function_id = $user->function_id;
         }
         if ($is_admin) {
             $praticiens = CConsultation::loadPraticiens(PERM_EDIT, $function_id);
         } else {
             $praticiens = CConsultation::loadPraticiens(PERM_EDIT, $user->function_id);
             // On ajoute les praticiens qui ont délégués leurs compta
             $where = array();
             $where[] = "users_mediboard.compta_deleguee = '1' ||  users_mediboard.user_id " . CSQLDataSource::prepareIn(array_keys($praticiens));
             // Filters on users values
             $where["users_mediboard.actif"] = "= '1'";
             $where["functions_mediboard.group_id"] = "= '" . CGroups::loadCurrent()->_id . "'";
             $ljoin["users"] = "users.user_id = users_mediboard.user_id";
             $ljoin["functions_mediboard"] = "functions_mediboard.function_id = users_mediboard.function_id";
             $order = "users.user_last_name, users.user_first_name";
             $mediuser = new CMediusers();
             /** @var CMediusers[] $mediusers */
             $mediusers = $mediuser->loadListWithPerms(PERM_EDIT, $where, $order, null, null, $ljoin);
             // Associate already loaded function
             foreach ($mediusers as $_mediuser) {
                 $_mediuser->loadRefFunction();
             }
             $praticiens = $mediusers;
         }
     } elseif ($user->isPraticien() && !$user->compta_deleguee) {
         return array($user->_id => $user);
     }
     return $praticiens;
 }
示例#18
0
 /**
  * @see parent::loadRefsFwd()
  */
 function loadRefsFwd()
 {
     $this->loadRefPraticien();
     $this->_ref_praticien->loadRefFunction();
 }
 /**
  * load the user informations
  *
  * @return CMediusers|null
  */
 function loadRefUser()
 {
     $this->_ref_user = $this->loadFwdRef("user_id", true);
     $this->_ref_user->loadRefFunction();
     return $this->_ref_user;
 }
示例#20
0
        CValue::setSession("selConsult");
    }
} else {
    if ($consult->_id && $consult->patient_id) {
        $consult->loadRefPlageConsult();
        if ($prat_id !== $consult->_ref_plageconsult->chir_id) {
            $consult = new CConsultation();
            $selConsult = null;
            CValue::setSession("selConsult");
        }
    }
}
// On charge le praticien
$userSel = new CMediusers();
$userSel->load($prat_id);
$userSel->loadRefFunction();
$canUserSel = $userSel->canDo();
if (!$consult->_id) {
    if ($current_m == "dPurgences") {
        CAppUI::setMsg("Vous devez selectionner une consultation", UI_MSG_ALERT);
        CAppUI::redirect("m=urgences&tab=0");
    }
    $smarty = new CSmartyDP();
    $smarty->assign("consult", $consult);
    $smarty->assign("current_m", $current_m);
    $smarty->assign("date", $date);
    $smarty->assign("vue", $vue);
    $smarty->assign("userSel", $userSel);
    $smarty->display("../../dPcabinet/templates/edit_consultation.tpl");
    CApp::rip();
}
    $thesaurus_entry->load($thesaurus_entry_id);
    $search_types = explode("|", $thesaurus_entry->types);
    $thesaurus_entry->loadRefsTargets();
    foreach ($thesaurus_entry->_atc_targets as $_target) {
        foreach ($_target->_ref_target as $_atc) {
            $object = new CMedicamentClasseATC();
            $_target->_libelle = $object->getLibelle($_target->object_id);
        }
    }
} else {
    $thesaurus_entry->agregation = $search_agregation;
    $thesaurus_entry->entry = $search_body;
    $thesaurus_entry->user_id = $search_user_id;
    $thesaurus_entry->types = is_array($search_types) ? implode(" ", $search_types) : explode(" ", $thesaurus_entry->types);
    $thesaurus_entry->contextes = $search_contexte;
}
$types = array();
$group = CGroups::loadCurrent();
if (CAppUI::conf("search active_handler active_handler_search_types", $group)) {
    $types = explode("|", CAppUI::conf("search active_handler active_handler_search_types", $group));
}
$user = new CMediusers();
$user->load($thesaurus_entry->user_id);
$user->loadRefFunction()->loadRefGroup();
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("thesaurus_entry", $thesaurus_entry);
$smarty->assign("search_types", $search_types);
$smarty->assign("types", $types);
$smarty->assign("user_thesaurus", $user);
$smarty->display("vw_addedit_entry.tpl");
         $listBefore[$keyPlace] =& $consultation;
     }
     if ($consultation->heure >= $plage->fin) {
         $listAfter[$keyPlace] =& $consultation;
     }
     for ($i = 0; $i < $consultation->duree; $i++) {
         if (isset($listPlace[$keyPlace + $i])) {
             $listPlace[$keyPlace + $i]["consultations"][] =& $consultation;
         }
     }
 }
 // Utilisation des prises de rdv
 // Pour ceux de la même fonction
 $user = new CMediusers();
 $user->load($plage->chir_id);
 $function = $user->loadRefFunction();
 if ($function->quotas) {
     $quotas = $function->quotas;
 }
 $listPrat = CConsultation::loadPraticiens(PERM_EDIT, $user->function_id, null, true);
 $listAllPrat = CConsultation::loadPraticiens(null, null, null, true);
 $where = array();
 $where["date"] = $ds->prepare("BETWEEN %1 AND %2", "{$plage->date}", "{$plage->date}");
 $where[] = "libelle != 'automatique' OR libelle IS NULL";
 $where["chir_id"] = " = '{$user->_id}'";
 if ($display_nb_consult == "cab" || $display_nb_consult == "etab") {
     $where["chir_id"] = CSQLDataSource::prepareIn(array_keys($listPrat));
     /** @var CPlageconsult[] $plages_func */
     $plages_func = $plage->loadList($where);
     $utilisation_func = utilisation_rdv($plages_func, $listPlace, $plage);
 }
示例#23
0
 /**
  * Charge les packs pour un propriétaire donné
  * 
  * @param int    $id           identifiant du propriétaire
  * @param string $owner        [optional]
  * @param string $object_class [optional]
  * 
  * @todo: refactor this to be in a super class
  * 
  * @return array
  */
 static function loadAllPacksFor($id, $owner = 'user', $object_class = null)
 {
     // Accès aux packs de modèles de la fonction et de l'établissement
     $module = CModule::getActive("dPcompteRendu");
     $is_admin = $module && $module->canAdmin();
     $access_function = $is_admin || CAppUI::conf("compteRendu CCompteRendu access_function");
     $access_group = $is_admin || CAppUI::conf("compteRendu CCompteRendu access_group");
     $packs = array();
     $packs["prat"] = array();
     if ($access_function) {
         $packs["func"] = array();
     }
     if ($access_group) {
         $packs["etab"] = array();
     }
     // Clauses de recherche
     $pack = new CPack();
     $where = array();
     if ($object_class) {
         $where["object_class"] = "= '{$object_class}'";
     }
     $order = "object_class, nom";
     switch ($owner) {
         case 'prat':
             // Modèle du praticien
             $user = new CMediusers();
             if (!$user->load($id)) {
                 return $packs;
             }
             $user->loadRefFunction();
             $where["user_id"] = "= '{$user->_id}'";
             $where["function_id"] = "IS NULL";
             $where["group_id"] = "IS NULL";
             $packs["prat"] = $pack->loadlist($where, $order);
         case 'func':
             // Modèle de la fonction
             if (isset($packs["func"])) {
                 if (isset($user)) {
                     $func_id = $user->function_id;
                 } else {
                     $func = new CFunctions();
                     if (!$func->load($id)) {
                         return $packs;
                     }
                     $func_id = $func->_id;
                 }
                 $where["user_id"] = "IS NULL";
                 $where["function_id"] = "= '{$func_id}'";
                 $where["group_id"] = "IS NULL";
                 $packs["func"] = $pack->loadlist($where, $order);
             }
         case 'etab':
             // Modèle de l'établissement
             if (isset($packs["etab"])) {
                 $etab_id = CGroups::loadCurrent()->_id;
                 if ($owner == 'etab') {
                     $etab = new CGroups();
                     if (!$etab->load($id)) {
                         return $packs;
                     }
                     $etab_id = $etab->_id;
                 } else {
                     if (isset($func)) {
                         $etab_id = $func->group_id;
                     } else {
                         if (isset($func_id)) {
                             $func = new CFunctions();
                             $func->load($func_id);
                             $etab_id = $func->group_id;
                         }
                     }
                 }
                 $where["user_id"] = "IS NULL";
                 $where["function_id"] = "IS NULL";
                 $where["group_id"] = " = '{$etab_id}'";
                 $packs["etab"] = $pack->loadlist($where, $order);
             }
             break;
         default:
             trigger_error("Wrong type '{$owner}'", E_WARNING);
     }
     return $packs;
 }