/** * Fill the order * * @param int $user_id User id * @param string $class Favori class name (CFavoriCCAM or CFavoriCIM10) * @param bool $ref_favori boolean * @param int $tag_id Tag id * * @return array The list ordered */ static function getOrdered($user_id = 0, $class = null, $ref_favori = false, $tag_id = null) { $listOrdered = array(); if ($user_id) { $where["favoris_user"] = "******"; if ($class) { $where["object_class"] = "= '{$class}'"; } $ljoin = array(); if ($tag_id) { $ljoin["tag_item"] = "tag_item.object_id = favoris_id AND tag_item.object_class = 'CFavoriCCAM'"; $where["tag_item.tag_id"] = "= '{$tag_id}'"; } $fav = new CFavoriCCAM(); /** @var CFavoriCCAM[] $favoris */ $favoris = $fav->loadList($where, "favoris_code", null, null, $ljoin); foreach ($favoris as $_favori) { /** @var CDatedCodeCCAM $code */ $code = CDatedCodeCCAM::get($_favori->favoris_code); $code->getChaps(); $code->class = $_favori->object_class; $code->favoris_id = $_favori->favoris_id; $code->occ = 0; if ($ref_favori) { $_favori->loadRefsTagItems(); $code->_ref_favori = $_favori; } $chapitre =& $code->chapitres[0]; $listOrdered[$chapitre["code"]]["nom"] = $chapitre["nom"]; $listOrdered[$chapitre["code"]]["codes"][$_favori->favoris_code] = $code; } } return $listOrdered; }
static function getTree($user_id) { return CFavoriCCAM::getTreeGeneric($user_id, "CFavoriCIM10"); }
} $list[$val_code]->nb_acte = $nb_acte; } } if ($tag_id) { $sorter = CMbArray::pluck($list, "code"); array_multisort($sorter, SORT_ASC, $list); } else { $sorter = CMbArray::pluck($list, "nb_acte"); array_multisort($sorter, SORT_DESC, $list); } $listByProfile[$profile]["favoris"] = $codes_favoris; $listByProfile[$profile]["stats"] = $codes_stats; $listByProfile[$profile]["list"] = $list; } $tag_tree = CFavoriCCAM::getTree($user->_id); $smarty = new CSmartyDP(); $smarty->assign("listByProfile", $listByProfile); $smarty->assign("users", $users); $smarty->assign("object_class", $object_class); $smarty->assign("date", $date); $smarty->assign("_keywords_code", $_keywords_code); $smarty->assign("_all_codes", $_all_codes); $smarty->assign("tag_tree", $tag_tree); $smarty->assign("tag_id", $tag_id); if ($only_list) { $smarty->display("inc_code_selector_ccam.tpl"); } else { $smarty->assign("chir", $chir); $smarty->assign("anesth", $anesth); $smarty->display("code_selector_ccam.tpl");