$object_ref_id = CValue::get("object_ref_id");
$object_ref_class = CValue::get("object_ref_class");
$fuzzy_search = CValue::get("fuzzy_search", null);
$fuzzy_search = CValue::get("fuzzy_search", null);
$types = CValue::get("types", array());
// Recherche par aggreg pour les logs
if ($date || $user_id) {
    $client_index = new CSearchLog();
    $client_index->createClient();
    $client_index->loadIndex($client_index->loadNameIndex());
    $date = CMbDT::format($date, "%Y/%m/%d");
    $words .= "date:[" . $date . " TO " . "{$date}] user_id:(" . $user_id . ")";
    $agregation = array();
    $tabActive = "";
    if (!$types) {
        $types = $client_index->loadContextes();
    }
} else {
    $client_index = new CSearch();
    $client_index->createClient();
    $client_index->loadIndex();
    $words .= " object_ref_class:" . $object_ref_class . " " . "object_ref_id:" . $object_ref_id;
    $results = $client_index->queryByType($words, null, $types);
    $agregation = $results->getAggregation("ref_type");
    $tabActive = $agregation["buckets"][0]["key"];
}
try {
    $results = $client_index->queryByType($words, $client_index->_index->getName(), $types);
    $agregation = $results->getAggregation("ref_type");
    $tabActive = $agregation["buckets"][0]["key"];
} catch (Exception $e) {
Esempio n. 2
0
$date = CMbDT::date("-1 month");
$user = CMediusers::get();
$user->loadRefFunction()->loadRefGroup();
$entry = new CSearchThesaurusEntry();
$entry->user_id = "{$user->_id}";
$thesaurus = $entry->loadMatchingList();
foreach ($thesaurus as $_thesaurus) {
    /** @var $_thesaurus  CSearchThesaurusEntry */
    $_thesaurus->loadRefsTargets();
}
$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));
}
$log = new CSearchLog();
$log->testConnection($group);
$contextes = $log->loadContextes();
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("date", $date);
$smarty->assign("start", 0);
$smarty->assign("results", array());
$smarty->assign("time", 0);
$smarty->assign("nbresult", 0);
$smarty->assign("thesaurus", $thesaurus);
$smarty->assign("entry", $entry);
$smarty->assign("types", $types);
$smarty->assign("user", $user);
$smarty->assign("contextes", $contextes);
$smarty->display("vw_search_thesaurus.tpl");
Esempio n. 3
0
 * @link     http://www.mediboard.org
 */
$user = CMediusers::get();
$user->loadRefFunction()->loadRefGroup();
$start = (int) CValue::get("start_thesaurus", 0);
$choose = CValue::get("_choose");
$entry = new CSearchThesaurusEntry();
$ds = $entry->getDS();
$where = array();
$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));
}
$contextes = CValue::get("contextes");
$contextes = $contextes ? $contextes : CSearchLog::loadContextes();
$where["contextes"] = $entry->_spec->ds->prepareIn($contextes);
if ($choose) {
    $select_choose = explode(" ", $choose);
    $chaine = " = {$select_choose['1']}";
    $data = $ds->prepare($chaine);
    switch ($select_choose[0]) {
        case "user_id":
            $where["user_id"] = $data;
            break;
        case "function_id":
            $where["function_id"] = $data;
            break;
        case "group_id":
            $where["group_id"] = $data;
            break;