/** * Get the lists related to an object * * @param CMbObject $object Object to get the check lists of * @param string $date The reference date * @param string $type type de checklist * * @return array */ static function getCheckLists(CMbObject $object, $date, $type = "ouverture_salle") { $daily_check_list_type = new CDailyCheckListType(); $where = array("daily_check_list_type_link.object_class" => "= '{$object->_class}'", "daily_check_list_type_link.object_id IS NULL\r\n OR\r\n daily_check_list_type_link.object_id = '{$object->_id}'"); $where["type"] = " = '{$type}'"; $ljoin = array("daily_check_list_type_link" => "daily_check_list_type_link.list_type_id = daily_check_list_type.daily_check_list_type_id"); /** @var CDailyCheckListType[] $daily_check_list_types */ $daily_check_list_types = $daily_check_list_type->loadGroupList($where, "title", null, "daily_check_list_type_id", $ljoin); /** @var CDailyCheckList[] $daily_check_lists */ $daily_check_lists = array(); $check_list_not_validated = 0; foreach ($daily_check_list_types as $_list_type) { $_list_type->loadRefsCategories(); $daily_check_list = CDailyCheckList::getList($object, $date, null, $_list_type->_id); $daily_check_list->loadItemTypes(); $daily_check_list->loadBackRefs('items'); $daily_check_list->loadRefListType(); if (!$daily_check_list->_id || !$daily_check_list->validator_id) { $check_list_not_validated++; } $daily_check_lists[] = $daily_check_list; } return array($check_list_not_validated, $daily_check_list_types, $daily_check_lists); }
} else { $validateurs = array(); } $object = CMbObject::loadFromGuid($object_guid); // Chargement des 3 check lists de l'OMS $check_lists = array(); $check_item_categories = array(); $check_list = new CDailyCheckList(); $cat = new CDailyCheckItemCategory(); $cat->target_class = $object->_class; // Pre-anesth, pre-op, post-op foreach ($check_list->_specs["type"]->_list as $_type) { if (CDailyCheckList::$types[$_type] != $type_group) { continue; } $list = CDailyCheckList::getList($object, null, $_type); $list->loadItemTypes(); $list->loadRefsFwd(); $list->loadBackRefs('items'); $list->isReadonly(); if ($list->_ref_object instanceof COperation) { $list->_ref_object->loadRefPraticien(); } $check_lists[$_type] = $list; $cat->type = $_type; $check_item_categories[$_type] = $cat->loadMatchingList("title"); } // Création du template $smarty = new CSmartyDP(); $smarty->assign("object", $object); $smarty->assign("check_item_categories", $check_item_categories);
// Pre-anesth, pre-op, post-op foreach ($operation_check_list->_specs["type"]->_list as $type) { $list = CDailyCheckList::getList($selOp, null, $type); $list->loadItemTypes(); $list->loadRefsFwd(); $list->loadBackRefs('items'); $list->isReadonly(); $list->_ref_object->loadRefPraticien(); $operation_check_lists[$type] = $list; $where_cat["type"] = " = '{$type}'"; $operation_check_item_categories[$type] = $cat->loadList($where_cat, "title"); } $type_personnel_no_has = array(); foreach (CDailyCheckListGroup::loadChecklistGroup() as $_checklist_group) { foreach ($_checklist_group->_ref_check_liste_types as $_checklist_type) { $list = CDailyCheckList::getList($selOp, null, null, $_checklist_type->_id); $list->loadItemTypes(); $list->loadRefsFwd(); $list->loadBackRefs('items'); $list->isReadonly(); $list->_ref_object->loadRefPraticien(); $check_lists_no_has[$_checklist_type->_id] = $list; $where_cat = array(); $where_cat["target_class"] = " = 'COperation'"; $where_cat["list_type_id"] = " = '{$_checklist_type->_id}'"; $check_items_no_has_categories[$_checklist_type->_id] = $cat->loadList($where_cat, "title"); } $validateurs = explode("|", $list->loadRefListType()->type_validateur); foreach ($validateurs as $validateur) { $type_personnel_no_has[] = $validateur; }