Esempio n. 1
0
 /**
  * Load specialties
  *
  * @param string $perm_type     Type
  * @param int    $include_empty Include empty
  *
  * @return CStoredObject[]
  */
 function loadSpecialites($perm_type = null, $include_empty = 0)
 {
     $group_id = CGroups::loadCurrent()->_id;
     $where = array("functions_mediboard.type" => "= 'cabinet'", "functions_mediboard.group_id" => "= '{$group_id}'");
     $ljoin = array();
     if (!$include_empty) {
         // Fonctions secondaires actives
         $sec_function = new CSecondaryFunction();
         $where_secondary = array();
         $ljoin_secondary = array();
         $ljoin_secondary["functions_mediboard"] = "functions_mediboard.type = 'cabinet'\r\n                                                 AND functions_mediboard.group_id = '{$group_id}'\r\n                                                 AND functions_mediboard.function_id = secondary_functions.secondary_function_id";
         $ljoin_secondary["users_mediboard"] = "users_mediboard.actif = '1'\r\n                                             AND users_mediboard.function_id = secondary_functions.secondary_function_id";
         $group = "secondary_function.function_id";
         $sec_functions = $sec_function->loadListWithPerms($perm_type, $where_secondary, null, null, $group, $ljoin);
         $in_functions = CSQLDataSource::prepareIn(CMbArray::pluck($sec_functions, "function_id"));
         $ljoin["users_mediboard"] = "users_mediboard.actif = '1' AND users_mediboard.function_id = functions_mediboard.function_id";
         $where[] = "users_mediboard.user_id IS NOT NULL OR functions_mediboard.function_id {$in_functions}";
     }
     return $this->loadListWithPerms($perm_type, $where, "text", null, "functions_mediboard.function_id", $ljoin);
 }
 /**
  * @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);
 }
    $where["fast_edit"] = " = '0'";
    $where["fast_edit_pdf"] = " = '0'";
}
$where["object_class"] = "= '{$object_class}'";
$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();