예제 #1
0
 /**
  * @return CFunctions[]
  */
 static function loadCurrentFunctions()
 {
     $user = CMediusers::get();
     $group_id = CGroups::loadCurrent()->_id;
     $secondary_function = new CSecondaryFunction();
     $ljoin = array();
     $where = array();
     $where["group_id"] = "= '{$group_id}'";
     $where["user_id"] = "= '{$user->_id}'";
     $ljoin["functions_mediboard"] = "functions_mediboard.function_id = secondary_function.function_id";
     return $user->_ref_current_functions = $secondary_function->loadList($where, null, null, null, $ljoin);
 }
예제 #2
0
$where["type"] = "= 'body'";
// Niveau utilisateur
$where["user_id"] = " = '{$curr_user->_id}'";
if ($user->canEdit()) {
    $where["user_id"] = "IN ('{$user->_id}', '{$curr_user->_id}')";
}
$modeles = $compte_rendu->seek($keywords, $where, 100, false, null, "nom");
// Niveau fonction
// Inclusion des fonctions secondaires de l'utilisateur connecté
// et de l'utilisateur concerné
unset($where["user_id"]);
$sec_function = new CSecondaryFunction();
$whereSecFunc = array();
$whereSecFunc["user_id"] = " = '{$curr_user->_id}'";
if ($user->canEdit()) {
    $whereSecFunc["user_id"] = "IN ('{$user->_id}', '{$curr_user->_id}')";
}
$function_sec = $sec_function->loadList($whereSecFunc);
$function_ids = array_merge(CMbArray::pluck($function_sec, "function_id"), array($user->function_id, $curr_user->function_id));
$where["function_id"] = CSQLDataSource::prepareIn($function_ids);
$modeles = array_merge($modeles, $compte_rendu->seek($keywords, $where, 100, false, null, "nom"));
// Niveau établissement
unset($where["function_id"]);
$where["group_id"] = " = '{$user->_group_id}'";
$modeles = array_merge($modeles, $compte_rendu->seek($keywords, $where, 100, false, null, "nom"));
$modeles = CModelObject::naturalSort($modeles, array("nom"), true);
$smarty = new CSmartyDP();
$smarty->assign("modeles", $modeles);
$smarty->assign("nodebug", true);
$smarty->assign("keywords", $keywords);
$smarty->display("inc_modele_autocomplete.tpl");