本文整理匯總了PHP中CMbDT::dateTimeFromAD方法的典型用法代碼示例。如果您正苦於以下問題:PHP CMbDT::dateTimeFromAD方法的具體用法?PHP CMbDT::dateTimeFromAD怎麽用?PHP CMbDT::dateTimeFromAD使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CMbDT
的用法示例。
在下文中一共展示了CMbDT::dateTimeFromAD方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: mapTo
/**
* @param CUser $user
* @param array $values
*
* @return CUser
*/
static function mapTo(CUser $user, $values)
{
$user->user_username = self::getValue($values, "samaccountname");
$user->user_first_name = self::getValue($values, "givenname");
$user->user_last_name = self::getValue($values, "sn") ? self::getValue($values, "sn") : self::getValue($values, "samaccountname");
$user->user_phone = self::getValue($values, "telephonenumber");
$user->user_email = self::getValue($values, "mail");
$whencreated = null;
if ($when_created = self::getValue($values, "whencreated")) {
$whencreated = CMbDT::date(CMbDT::dateTimeFromAD($when_created));
}
$accountexpires = null;
if ($account_expires = self::getValue($values, "accountexpires")) {
// 1000000000000000000 = 16-11-4769 01:56:35
if ($account_expires < 1000000000000000000) {
$accountexpires = CMbDT::date(CMbDT::dateTimeFromLDAP($account_expires));
}
}
// 66048,Account: Enabled - DONT_EXPIRE_PASSWORD
// 66080,Account: Enabled - DONT_EXPIRE_PASSWORD - PASSWD_NOTREQD
// 66050 = Disabled
$actif = self::getValue($values, "useraccountcontrol") == 66050 ? 0 : 1;
$user->loadRefMediuser();
if ($user->_id) {
$mediuser = $user->_ref_mediuser;
$mediuser->actif = $actif;
$mediuser->deb_activite = $whencreated;
$mediuser->fin_activite = $accountexpires;
$mediuser->_ldap_store = true;
$mediuser->store();
}
$user->_user_actif = $actif;
$user->_user_deb_activite = $whencreated;
$user->_user_fin_activite = $accountexpires;
return $user;
}