You are here

function dynamic_banner_admin_form_submit in Dynamic Banner 7

Same name and namespace in other branches
  1. 6 includes/callbacks.inc \dynamic_banner_admin_form_submit()
  2. 7.2 dynamic_banner.module \dynamic_banner_admin_form_submit()
  3. 8.x dynamic_banner.module \dynamic_banner_admin_form_submit()

Save a new Banner to the database

File

includes/callbacks.inc, line 624
Dynamic Banner Admin Pages and various other functions to make them work Most of the code in this file was derived from path module

Code

function dynamic_banner_admin_form_submit($form, &$form_state) {

  // define a sort of struct array for display mode for form translation

  //$mode_struct = array('normal', 'time_based', 'rotating', 'fade');

  // extra validation check to make sure
  if ($form_state['values']['image_type'] == t('Use Existing Image(s)')) {
    $imgurl = $form_state['values']['imgurl'];
  }
  else {
    $imgurl = NULL;
  }
  if ($form_state['values']['image_type'] == t('Upload New Image(s)')) {
    $imgfid = $form_state['values']['image'];
  }
  else {
    $imgfid = NULL;
  }
  $path = $form_state['values']['path'];
  $text = $form_state['values']['text'];
  $link = $form_state['values']['link'];
  $mode = $form_state['values']['mode'];

  //$time_on  = $form_state['values']['time_on'];// these are arrays we need a time handler

  //$time_off = $form_state['values']['time_off'];
  $dbid = $form_state['values']['dbid'];
  $time_on = NULL;
  $time_off = NULL;

  // Save the banner
  dynamic_banner_set_banner($path, $imgurl, $imgfid, $text, $link, $mode, $time_on, $time_off, $dbid);
  drupal_set_message(t('The banner has been saved.'));
  $form_state['redirect'] = 'admin/structure/banners';
}