function ad_image_global_settings_submit in Advertisement 5
Same name and namespace in other branches
- 5.2 image/ad_image.module \ad_image_global_settings_submit()
- 6.3 image/ad_image.module \ad_image_global_settings_submit()
- 6 image/ad_image.module \ad_image_global_settings_submit()
- 6.2 image/ad_image.module \ad_image_global_settings_submit()
- 7 image/ad_image.module \ad_image_global_settings_submit()
Save min and max image width and height values for ad groups.
File
- image/
ad_image.module, line 117 - Enhances the ad module to support banner ads.
Code
function ad_image_global_settings_submit($form_id, $form_values) {
$groups = module_invoke('ad', 'groups_list', TRUE);
foreach ($groups as $group) {
// TODO: Update the database schema, convert gid to tid.
$gid = db_result(db_query('SELECT gid FROM {ad_image_format} WHERE gid = %d', $group->tid));
if (is_numeric($gid)) {
db_query("UPDATE {ad_image_format} SET min_width = %d, max_width = %d, min_height = %d, max_height = %d WHERE gid = %d", $form_values["min-width-{$group->tid}"], $form_values["max-width-{$group->tid}"], $form_values["min-height-{$group->tid}"], $form_values["max-height-{$group->tid}"], $group->tid);
}
else {
db_query("INSERT INTO {ad_image_format} (gid, min_width, max_width, min_height, max_height) VALUES (%d, %d, %d, %d, %d)", $group->tid, $form_values["min-width-{$group->tid}"], $form_values["max-width-{$group->tid}"], $form_values["min-height-{$group->tid}"], $form_values["max-height-{$group->tid}"]);
}
}
drupal_set_message('Image ad global settings updated.');
}