You are here

function ad_channel_admin_container_submit in Advertisement 7

Same name and namespace in other branches
  1. 5.2 channel/ad_channel.module \ad_channel_admin_container_submit()
  2. 6.3 channel/ad_channel.module \ad_channel_admin_container_submit()
  3. 6.2 channel/ad_channel.module \ad_channel_admin_container_submit()

Save the container.

File

channel/ad_channel.module, line 989
Ad Channel module.

Code

function ad_channel_admin_container_submit($form, &$form_state) {
  switch ($form_state['values']['op']) {
    case t('Create'):
      db_query("INSERT INTO {ad_channel_container} (name, description, weight) VALUES('%s', '%s', %d)", $form_state['values']['name'], $form_state['values']['description'], $form_state['values']['weight']);
      drupal_set_message(t('The %name container has been created.', array(
        '%name' => $form_state['values']['name'],
      )));
      break;
    case t('Update'):
      db_query("UPDATE {ad_channel_container} SET name = '%s', description = '%s', weight = '%s' WHERE conid = %d", $form_state['values']['name'], $form_state['values']['description'], $form_state['values']['weight'], $form_state['values']['conid']);
      drupal_set_message(t('The %name container has been updated.', array(
        '%name' => $form_state['values']['name'],
      )));
      break;
    case t('Delete'):
      drupal_goto('admin/content/ad/channel/container/' . $form_state['values']['conid'] . '/delete');
  }
  drupal_goto('admin/content/ad/channel');
}