本文整理汇总了PHP中CUser::loadMatchingObject方法的典型用法代码示例。如果您正苦于以下问题:PHP CUser::loadMatchingObject方法的具体用法?PHP CUser::loadMatchingObject怎么用?PHP CUser::loadMatchingObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUser
的用法示例。
在下文中一共展示了CUser::loadMatchingObject方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMedecins
/**
* Récupération des médecins
*
* @param DOMNode $node Node
* @param CSejour $mbVenue Venue
*
* @return CSejour
*/
function getMedecins(DOMNode $node, CSejour $mbVenue)
{
$xpath = new CHPrimXPath($node->ownerDocument);
$sender = $this->_ref_echange_hprim->_ref_sender;
$medecins = $xpath->queryUniqueNode("hprim:medecins", $node);
if ($medecins instanceof DOMElement) {
$medecin = $medecins->childNodes;
foreach ($medecin as $_med) {
$mediuser_id = $this->getMedecin($_med);
$lien = $xpath->getValueAttributNode($_med, "lien");
if ($lien == "rsp") {
$mbVenue->praticien_id = $mediuser_id;
}
}
}
// Dans le cas ou la venue ne contient pas de medecin responsable
// Attribution d'un medecin indeterminé
if (!$mbVenue->praticien_id) {
$user = new CUser();
$mediuser = new CMediusers();
$user->user_last_name = CAppUI::conf("hprimxml medecinIndetermine") . " {$sender->group_id}";
if (!$user->loadMatchingObject()) {
$mediuser->_user_last_name = $user->user_last_name;
$mediuser->_id = $this->createPraticien($mediuser);
} else {
$user->loadRefMediuser();
$mediuser = $user->_ref_mediuser;
}
$mbVenue->praticien_id = $mediuser->_id;
}
return $mbVenue;
}
示例2: createDoctor
/**
* Create the mediuser
*
* @param CMediusers $mediuser mediuser
*
* @return int
*/
function createDoctor(CMediusers $mediuser)
{
$sender = $this->_ref_sender;
$function = new CFunctions();
$function->text = CAppUI::conf("hl7 importFunctionName");
$function->group_id = $sender->group_id;
$function->loadMatchingObjectEsc();
if (!$function->_id) {
$function->type = "cabinet";
$function->compta_partagee = 0;
$function->color = "ffffff";
$function->store();
}
$mediuser->function_id = $function->_id;
$mediuser->makeUsernamePassword($mediuser->_user_first_name, $mediuser->_user_last_name, null, true);
$mediuser->_user_type = 13;
// Medecin
$mediuser->actif = CAppUI::conf("hl7 doctorActif") ? 1 : 0;
$user = new CUser();
$user->user_last_name = $mediuser->_user_last_name;
$user->user_first_name = $mediuser->_user_first_name;
// On recherche par le seek
$users = $user->seek("{$user->user_last_name} {$user->user_first_name}");
if (count($users) == 1) {
$user = reset($users);
$user->loadRefMediuser();
$mediuser = $user->_ref_mediuser;
} else {
// Dernière recherche si le login est déjà existant
$user = new CUser();
$user->user_username = $mediuser->_user_username;
if ($user->loadMatchingObject()) {
// On affecte un username aléatoire
$mediuser->_user_username .= rand(1, 10);
}
$mediuser->store();
}
return $mediuser->_id;
}
示例3: CUser
$mediuser->_user_password = $results[$i]["password"];
}
// Username
if ($results[$i]["username"]) {
$mediuser->_user_username = $results[$i]["username"];
}
$user = new CUser();
$user->user_username = $mediuser->_user_username;
if ($user->loadMatchingObject()) {
$unfound["user"][$mediuser->_user_last_name] = true;
}
// Profil
if ($profil_name = $results[$i]["profil_name"]) {
$profil = new CUser();
$profil->user_username = $profil_name;
$profil->loadMatchingObject();
if ($profil->_id) {
$mediuser->_profile_id = $profil->_id;
} else {
$unfound["profil_name"][$profil_name] = true;
}
}
$group_id = CGroups::loadCurrent()->_id;
// Fonction
$function = new CFunctions();
$function->group_id = $group_id;
$function->text = $results[$i]["function_name"];
$function->loadMatchingObject();
if (!$function->_id) {
if (in_array($results[$i]["type"], array("3", "4", "13"))) {
$function->type = "cabinet";
示例4: searchAndMap
/**
* Search and map a user inside the LDAP
*
* @param CUser $user
* @param CSourceLDAP $source_ldap
* @param resource $ldapconn
* @param string $person [optional]
* @param string $filter [optional]
* @param boolean $force_create [optional]
*
* @return CUser
*/
static function searchAndMap(CUser $user, CSourceLDAP $source_ldap, $ldapconn, $person = null, $filter = null, $force_create = false)
{
if (!$person) {
$person = $user->user_username;
}
$person = utf8_encode($person);
if (!$filter) {
$filter = "(samaccountname={$person})";
}
$results = $source_ldap->ldap_search($ldapconn, $filter);
if (!$results || $results["count"] == 0) {
$user->_bound = false;
$user->_count_ldap = 0;
return $user;
}
if ($results["count"] > 1) {
throw new CMbException("CSourceLDAP_too-many-results");
}
$results = $results[0];
$idex = new CIdSante400();
$idex->tag = CAppUI::conf("admin LDAP ldap_tag");
$idex->object_class = "CUser";
$idex->id400 = self::getObjectGUID($results);
$idex->loadMatchingObject();
// On sauvegarde le password renseigné
$user_password = $user->user_password;
$_user_password = $user->_user_password;
// objectguid retrouvé on charge le user
if ($idex->_id) {
$user = new CUser();
$user->load($idex->object_id);
} else {
// objectguid non retrouvé on associe à l'user courant l'objectguid
// Si on est pas en mode création on le recherche
if (!$force_create) {
// Suppression du password pour le loadMatchingObject
$user->user_password = null;
$user->_user_password = null;
$user->loadMatchingObject();
if (!$user->_id) {
throw new CMbException("Auth-failed-user-unknown");
}
}
}
$user->_bound = true;
$user = self::mapTo($user, $results);
// Save Mediuser variables
$actif = $user->_user_actif;
$deb_activite = $user->_user_deb_activite;
$fin_activite = $user->_user_fin_activite;
// Restore User password variables
$user->user_password = $user_password;
$user->_user_password = $_user_password;
if (!$user->user_type) {
$user->user_type = 0;
}
// Pas de profil
$user->template = 0;
$user->user_login_errors = 0;
$user->repair();
$msg = $user->store();
if ($msg) {
throw new CMbException($msg);
}
if (!$force_create && !$user->_ref_mediuser->actif || $force_create && !$actif) {
throw new CMbException("Auth-failed-user-deactivated");
}
// Restore Mediuser variables
$user->_user_actif = $actif;
$user->_user_deb_activite = $deb_activite;
$user->_user_fin_activite = $fin_activite;
$user->_count_ldap = 1;
if (!$idex->_id) {
$idex->object_id = $user->_id;
$idex->last_update = CMbDT::dateTime();
if ($msg = $idex->store()) {
throw new CMbException($msg);
}
}
return $user;
}
示例5: checkPasswordAttempt
/**
* Check wether login/password is found
* Handle password attempts count
*
* @param CUser $user User whose password attempt to check
*
* @return bool True is attempt is successful
*/
static function checkPasswordAttempt(CUser $user)
{
$sibling = new CUser();
$sibling->user_username = $user->user_username;
$sibling->loadMatchingObject();
$sibling->loadRefMediuser();
$mediuser = $sibling->_ref_mediuser;
if ($mediuser && $mediuser->_id) {
if (!$mediuser->actif) {
self::setMsg("Auth-failed-user-deactivated", UI_MSG_ERROR);
return false;
}
$today = CMbDT::date();
$deb = $mediuser->deb_activite;
$fin = $mediuser->fin_activite;
// Check if the user is in his activity period
if ($deb && $deb > $today || $fin && $fin <= $today) {
self::setMsg("Auth-failed-user-deactivated", UI_MSG_ERROR);
return false;
}
}
if ($sibling->_login_locked) {
self::setMsg("Auth-failed-user-locked", UI_MSG_ERROR);
return false;
}
// Wrong login and/or password
if (!$user->_id) {
self::setMsg("Auth-failed-combination", UI_MSG_ERROR);
// If the user exists, but has given a wrong password let's increment his error count
if ($user->loginErrorsReady() && $sibling->_id) {
$sibling->user_login_errors++;
$sibling->store();
$remainingAttempts = max(0, self::conf("admin CUser max_login_attempts") - $sibling->user_login_errors);
self::setMsg("Auth-failed-tried", UI_MSG_ERROR, $sibling->user_login_errors, $remainingAttempts);
}
return false;
}
return true;
}
示例6: CUser
continue;
}
$user = new CUser();
$user->user_last_name = $results[$i]["lastname"];
$user->user_first_name = $results[$i]["firstname"];
$count = $user->countMatchingList();
if ($count == "0") {
$results[$i]["error"] = "L'utilisateur n'a pas été retrouvé dans Mediboard";
$i++;
continue;
} elseif ($count > 1) {
$results[$i]["error"] = "Plusieurs utilisateurs correspondent à cette recherche";
$i++;
continue;
}
$user->loadMatchingObject();
$mediuser = $user->loadRefMediuser();
$mediuser->adeli = $results[$i]["adeli"];
if ($msg = $mediuser->store()) {
CAppUI::setMsg($msg, UI_MSG_ERROR);
$results[$i]["error"] = $msg;
$i++;
continue;
}
$i++;
}
}
CAppUI::callbackAjax('$("systemMsg").insert', CAppUI::getMsg());
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("results", $results);