You are here

function simpleads_block_save in SimpleAds 7

Same name and namespace in other branches
  1. 7.2 includes/blocks.inc \simpleads_block_save()

Implements hook_block_save().

File

./simpleads.module, line 344

Code

function simpleads_block_save($delta = '', $edit = array()) {
  $blocks = db_select('simpleads_blocks', 'sb')
    ->fields('sb')
    ->execute();
  foreach ($blocks as $block) {
    $data = unserialize($block->settings);
    if ($data['block_delta'] == $delta) {
      $data['ads_limit'] = $edit['ads_limit'];
      $data['ads_page'] = $edit['ads_page'];
      $data['ads_width'] = $edit['ads_width'];
      $data['ads_height'] = $edit['ads_height'];
      $data['ads_order'] = $edit['ads_order'];
      $data['ads_rotation_type'] = $edit['ads_rotation_type'];
      $data['ads_rotation_delay'] = $edit['ads_rotation_delay'];
      db_update('simpleads_blocks')
        ->fields(array(
        'settings' => serialize($data),
      ))
        ->condition('tid', $block->tid)
        ->execute();
    }
  }
}