You are here

function domain_theme_batch in Domain Access 6.2

Same name and namespace in other branches
  1. 5 domain_theme/domain_theme.module \domain_theme_batch()

Custom handler for domain_theme_domainbatch().

Parameters

$values: The form values passed by the FormsAPI.

1 string reference to 'domain_theme_batch'
domain_theme_domainbatch in domain_theme/domain_theme.module
Implement hook_domainbatch()

File

domain_theme/domain_theme.module, line 239
Domain Theme module for the Domain Access module group.

Code

function domain_theme_batch($values) {
  foreach ($values['domain_batch'] as $key => $value) {
    if ($key > 0) {

      // Clear out the old theme.
      db_query("UPDATE {domain_theme} SET status = 0 WHERE domain_id = %d", $key);
      $data = db_fetch_array(db_query("SELECT theme FROM {domain_theme} WHERE theme = '%s' AND domain_id = %d", $value, $key));
      if (isset($data['theme'])) {
        db_query("UPDATE {domain_theme} SET status = 1 WHERE theme = '%s' AND domain_id = %d", $value, $key);
      }
      else {
        db_query("INSERT INTO {domain_theme} (domain_id, theme, status) VALUES (%d, '%s', 1)", $key, $value);
      }
    }
    else {
      variable_set('theme_default', $value);
    }
  }
}