本文整理汇总了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;
}
}