You are here

function event_admin_events_submit in Event Calendar 7

Process event_admin_events form submissions.

Execute the chosen 'Update option' on the selected nodes.

1 string reference to 'event_admin_events_submit'
event_admin_events in ./event_calendar.list.inc
Form builder: Builds the event administration overview.

File

./event_calendar.list.inc, line 293
Event administration UI.

Code

function event_admin_events_submit($form, &$form_state) {

  // Filter out unchecked event nodes.
  $events = array_filter($form_state['values']['events']);

  // Find out the term id.
  $op = $form_state['values']['operation'];
  global $user;
  $node_type = variable_get('event_calendar_node_type', 'event_calendar');

  // Update each selected event node with new taxonomy status.
  foreach ($events as $nid) {
    $obj = node_load($nid);
    $field_lang_code = field_language('node', $obj, 'event_calendar_date', LANGUAGE_NONE);
    $obj->event_calendar_status[$field_lang_code][0]['tid'] = $op;
    $node_save = node_save($obj);
  }
  drupal_set_message(t('The status has been changed.'));
}