public function save($args)
 {
     parent::save();
     $db = Loader::db();
     $db->Execute('delete from UserPermissionViewAttributeAccessList where paID = ?', array($this->getPermissionAccessID()));
     $db->Execute('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->Execute('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->Execute('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->Execute('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->Execute('insert into UserPermissionViewAttributeAccessListCustom (paID, peID, akID) values (?, ?, ?)', $v);
             }
         }
     }
 }
 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);
             }
         }
     }
 }