function ad_channel_admin_channel_submit in Advertisement 5.2
Same name and namespace in other branches
- 6.3 channel/ad_channel.module \ad_channel_admin_channel_submit()
- 6.2 channel/ad_channel.module \ad_channel_admin_channel_submit()
- 7 channel/ad_channel.module \ad_channel_admin_channel_submit()
Save the channel.
File
- channel/
ad_channel.module, line 743 - Ad Channel
Code
function ad_channel_admin_channel_submit($form_id, $form_values) {
switch ($form_values['op']) {
case t('Create'):
db_query("INSERT INTO {ad_channel} (name, description, conid, weight, display, urls, groups) VALUES('%s', '%s', %d, %d, %d, '%s', '%s')", $form_values['name'], $form_values['description'], $form_values['conid'], $form_values['weight'], $form_values['display'], serialize($form_values['urls']), serialize($form_values['groups']));
drupal_set_message(t('The %name channel has been created.', array(
'%name' => $form_values['name'],
)));
break;
case t('Update'):
$groups = array();
// Don't store information about groups that no longer exist.
if (is_array($form_values['groups'])) {
$ad_groups = taxonomy_get_tree(_ad_get_vid());
foreach ($ad_groups as $ad_group) {
if (isset($form_values['groups'][$ad_group->tid])) {
$groups[$ad_group->tid] = $form_values['groups'][$ad_group->tid];
}
}
}
db_query("UPDATE {ad_channel} SET name = '%s', description = '%s', conid = %d, weight = %d, display = %d, urls = '%s', groups = '%s' WHERE chid = %d", $form_values['name'], $form_values['description'], $form_values['conid'], $form_values['weight'], $form_values['display'], serialize($form_values['urls']), serialize($groups), $form_values['chid']);
drupal_set_message(t('The %name channel has been updated.', array(
'%name' => $form_values['name'],
)));
break;
case t('Delete'):
drupal_goto('admin/content/ad/channel/channel/' . $form_values['chid'] . '/delete');
}
drupal_goto('admin/content/ad/channel');
}