本文整理匯總了PHP中UserInfo::setPropertiesFromArray方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserInfo::setPropertiesFromArray方法的具體用法?PHP UserInfo::setPropertiesFromArray怎麽用?PHP UserInfo::setPropertiesFromArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UserInfo
的用法示例。
在下文中一共展示了UserInfo::setPropertiesFromArray方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: get
private function get($where, $var, $userPermissionsArray = null) {
$db = Loader::db();
$q = "select Users.uID, Users.uLastLogin, Users.uIsValidated, Users.uPreviousLogin, Users.uIsFullRecord, Users.uNumLogins, Users.uDateAdded, Users.uIsActive, Users.uLastOnline, Users.uHasAvatar, Users.uName, Users.uEmail, Users.uPassword, Users.uTimezone from Users " . $where;
$r = $db->query($q, array($var));
if ($r && $r->numRows() > 0) {
$ui = new UserInfo;
$row = $r->fetchRow();
$ui->setPropertiesFromArray($row);
$r->free();
}
if (is_object($ui)) {
if ($userPermissionsArray) {
if (isset($userPermissionsArray['permissions'])) {
$ui->permissions = $userPermissionsArray['permissions'];
if ($ui->permissions['canRead']) {
$ui->permissionSet .= 'r:';
}
if ($ui->permissions['canWrite']) {
$ui->permissionSet .= 'wa:';
}
if ($ui->permissions['canAdmin']) {
$ui->permissionSet .= 'adm:';
}
} else {
$ui->permissionSet = $userPermissionsArray['permissionSet'];
$ui->upStartDate = $userPermissionsArray['upStartDate'];
$ui->upEndDate = $userPermissionsArray['upEndDate'];
}
}
return $ui;
}
}
示例2: get
private function get($where, $var)
{
$db = Loader::db();
$q = "select Users.uID, Users.uLastLogin, Users.uLastIP, Users.uIsValidated, Users.uPreviousLogin, Users.uIsFullRecord, Users.uNumLogins, Users.uDateAdded, Users.uIsActive, Users.uLastOnline, Users.uHasAvatar, Users.uName, Users.uEmail, Users.uPassword, Users.uTimezone from Users " . $where;
$r = $db->query($q, array($var));
if ($r && $r->numRows() > 0) {
$ui = new UserInfo();
$row = $r->fetchRow();
$ui->setPropertiesFromArray($row);
$r->free();
}
if (is_object($ui)) {
return $ui;
}
}