本文整理汇总了PHP中UserAccess::save方法的典型用法代码示例。如果您正苦于以下问题:PHP UserAccess::save方法的具体用法?PHP UserAccess::save怎么用?PHP UserAccess::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserAccess
的用法示例。
在下文中一共展示了UserAccess::save方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
public function save($args = array())
{
parent::save();
$db = Database::connection();
$db->executeQuery('delete from UserPermissionViewAttributeAccessList where paID = ?', array($this->getPermissionAccessID()));
$db->executeQuery('delete from UserPermissionViewAttributeAccessListCustom where paID = ?', array($this->getPermissionAccessID()));
if (is_array($args['viewAttributesIncluded'])) {
foreach ($args['viewAttributesIncluded'] as $peID => $permission) {
$v = array($this->getPermissionAccessID(), $peID, $permission);
$db->executeQuery('insert into UserPermissionViewAttributeAccessList (paID, peID, permission) values (?, ?, ?)', $v);
}
}
if (is_array($args['viewAttributesExcluded'])) {
foreach ($args['viewAttributesExcluded'] as $peID => $permission) {
$v = array($this->getPermissionAccessID(), $peID, $permission);
$db->executeQuery('insert into UserPermissionViewAttributeAccessList (paID, peID, permission) values (?, ?, ?)', $v);
}
}
if (is_array($args['akIDInclude'])) {
foreach ($args['akIDInclude'] as $peID => $akIDs) {
foreach ($akIDs as $akID) {
$v = array($this->getPermissionAccessID(), $peID, $akID);
$db->executeQuery('insert into UserPermissionViewAttributeAccessListCustom (paID, peID, akID) values (?, ?, ?)', $v);
}
}
}
if (is_array($args['akIDExclude'])) {
foreach ($args['akIDExclude'] as $peID => $akIDs) {
foreach ($akIDs as $akID) {
$v = array($this->getPermissionAccessID(), $peID, $akID);
$db->executeQuery('insert into UserPermissionViewAttributeAccessListCustom (paID, peID, akID) values (?, ?, ?)', $v);
}
}
}
}
示例2: addUserEvent
public static function addUserEvent(User $user, $ip, $eventType)
{
switch ($eventType) {
case UserAccessType::login:
case UserAccessType::addreview:
case UserAccessType::editreview:
break;
default:
throw new Exception('invalid event type.');
}
$event = new UserAccess();
$event->setUser($user);
$event->setIpv4Address($ip);
$event->setUserAccessType(UserAccessTypeQuery::create()->findOneByType($eventType));
$datetime = new DateTime();
$datetime->getTimestamp();
$event->setAccess($datetime);
$event->save();
}
示例3: save
public function save($args)
{
parent::save();
$db = Loader::db();
$db->Execute('delete from UserPermissionEditPropertyAccessList where paID = ?', array($this->getPermissionAccessID()));
$db->Execute('delete from UserPermissionEditPropertyAttributeAccessListCustom where paID = ?', array($this->getPermissionAccessID()));
if (is_array($args['propertiesIncluded'])) {
foreach ($args['propertiesIncluded'] as $peID => $attributePermission) {
$allowEditUName = 0;
$allowEditUEmail = 0;
$allowEditUPassword = 0;
$allowEditUAvatar = 0;
$allowEditUTimezone = 0;
$allowEditUDefaultLanguage = 0;
if (!empty($args['allowEditUName'][$peID])) {
$allowEditUName = $args['allowEditUName'][$peID];
}
if (!empty($args['allowEditUEmail'][$peID])) {
$allowEditUEmail = $args['allowEditUEmail'][$peID];
}
if (!empty($args['allowEditUPassword'][$peID])) {
$allowEditUPassword = $args['allowEditUPassword'][$peID];
}
if (!empty($args['allowEditUAvatar'][$peID])) {
$allowEditUAvatar = $args['allowEditUAvatar'][$peID];
}
if (!empty($args['allowEditUTimezone'][$peID])) {
$allowEditUTimezone = $args['allowEditUTimezone'][$peID];
}
if (!empty($args['allowEditUDefaultLanguage'][$peID])) {
$allowEditUDefaultLanguage = $args['allowEditUDefaultLanguage'][$peID];
}
$v = array($this->getPermissionAccessID(), $peID, $attributePermission, $allowEditUName, $allowEditUEmail, $allowEditUPassword, $allowEditUAvatar, $allowEditUTimezone, $allowEditUDefaultLanguage);
$db->Execute('insert into UserPermissionEditPropertyAccessList (paID, peID, attributePermission, uName, uEmail, uPassword, uAvatar, uTimezone, uDefaultLanguage) values (?, ?, ?, ?, ?, ?, ?, ?, ?)', $v);
}
}
if (is_array($args['propertiesExcluded'])) {
foreach ($args['propertiesExcluded'] as $peID => $attributePermission) {
$allowEditUNameExcluded = 0;
$allowEditUEmailExcluded = 0;
$allowEditUPasswordExcluded = 0;
$allowEditUAvatarExcluded = 0;
$allowEditUTimezoneExcluded = 0;
$allowEditUDefaultLanguageExcluded = 0;
if (!empty($args['allowEditUNameExcluded'][$peID])) {
$allowEditUNameExcluded = $args['allowEditUNameExcluded'][$peID];
}
if (!empty($args['allowEditUEmailExcluded'][$peID])) {
$allowEditUEmailExcluded = $args['allowEditUEmailExcluded'][$peID];
}
if (!empty($args['allowEditUPasswordExcluded'][$peID])) {
$allowEditUPasswordExcluded = $args['allowEditUPasswordExcluded'][$peID];
}
if (!empty($args['allowEditUAvatarExcluded'][$peID])) {
$allowEditUAvatarExcluded = $args['allowEditUAvatarExcluded'][$peID];
}
if (!empty($args['allowEditUTimezoneExcluded'][$peID])) {
$allowEditUTimezoneExcluded = $args['allowEditUTimezoneExcluded'][$peID];
}
if (!empty($args['allowEditUDefaultLanguageExcluded'][$peID])) {
$allowEditUDefaultLanguageExcluded = $args['allowEditUDefaultLanguageExcluded'][$peID];
}
$v = array($this->getPermissionAccessID(), $peID, $attributePermission, $allowEditUNameExcluded, $allowEditUEmailExcluded, $allowEditUPasswordExcluded, $allowEditUAvatarExcluded, $allowEditUTimezoneExcluded, $allowEditUDefaultLanguageExcluded);
$db->Execute('insert into UserPermissionEditPropertyAccessList (paID, peID, attributePermission, uName, uEmail, uPassword, uAvatar, uTimezone, uDefaultLanguage) values (?, ?, ?, ?, ?, ?, ?, ?, ?)', $v);
}
}
if (is_array($args['akIDInclude'])) {
foreach ($args['akIDInclude'] as $peID => $akIDs) {
foreach ($akIDs as $akID) {
$v = array($this->getPermissionAccessID(), $peID, $akID);
$db->Execute('insert into UserPermissionEditPropertyAttributeAccessListCustom (paID, peID, akID) values (?, ?, ?)', $v);
}
}
}
if (is_array($args['akIDExclude'])) {
foreach ($args['akIDExclude'] as $peID => $akIDs) {
foreach ($akIDs as $akID) {
$v = array($this->getPermissionAccessID(), $peID, $akID);
$db->Execute('insert into UserPermissionEditPropertyAttributeAccessListCustom (paID, peID, akID) values (?, ?, ?)', $v);
}
}
}
}