예제 #1
0
 public function save($args = array())
 {
     $db = Database::connection();
     parent::save();
     $db->executeQuery('delete from AreaPermissionBlockTypeAccessList where paID = ?', array($this->getPermissionAccessID()));
     $db->executeQuery('delete from AreaPermissionBlockTypeAccessListCustom where paID = ?', array($this->getPermissionAccessID()));
     if (is_array($args['blockTypesIncluded'])) {
         foreach ($args['blockTypesIncluded'] as $peID => $permission) {
             $v = array($this->getPermissionAccessID(), $peID, $permission);
             $db->executeQuery('insert into AreaPermissionBlockTypeAccessList (paID, peID, permission) values (?, ?, ?)', $v);
         }
     }
     if (is_array($args['blockTypesExcluded'])) {
         foreach ($args['blockTypesExcluded'] as $peID => $permission) {
             $v = array($this->getPermissionAccessID(), $peID, $permission);
             $db->executeQuery('insert into AreaPermissionBlockTypeAccessList (paID, peID, permission) values (?, ?, ?)', $v);
         }
     }
     if (is_array($args['btIDInclude'])) {
         foreach ($args['btIDInclude'] as $peID => $btIDs) {
             foreach ($btIDs as $btID) {
                 $v = array($this->getPermissionAccessID(), $peID, $btID);
                 $db->executeQuery('insert into AreaPermissionBlockTypeAccessListCustom (paID, peID, btID) values (?, ?, ?)', $v);
             }
         }
     }
     if (is_array($args['btIDExclude'])) {
         foreach ($args['btIDExclude'] as $peID => $btIDs) {
             foreach ($btIDs as $btID) {
                 $v = array($this->getPermissionAccessID(), $peID, $btID);
                 $db->executeQuery('insert into AreaPermissionBlockTypeAccessListCustom (paID, peID, btID) values (?, ?, ?)', $v);
             }
         }
     }
 }