You are here

function _photos_to_sub_submit in Album Photos 6.2

Same name and namespace in other branches
  1. 7.3 inc/photos.edit.inc \_photos_to_sub_submit()
1 string reference to '_photos_to_sub_submit'
_photos_to_sub in inc/photos.edit.inc

File

inc/photos.edit.inc, line 466

Code

function _photos_to_sub_submit($form, &$form_state) {
  if (!$form_state['values']['fid']) {
    return;
  }
  foreach ($form_state['values']['sub'] as $key => $sub) {
    if ($sub) {
      $into[] = '(' . $key . ',' . $form_state['values']['fid'] . ')';
      $nids[] = $key;
    }
  }
  if ($into[0]) {
    db_query('INSERT INTO {x_node} (nid, fid) VALUES ' . implode(',', $into));
    foreach ($nids as $nid) {
      photos_set_count('node_node', $nid);
    }
    drupal_set_message(t('Successfully sent the %count sub-album', array(
      '%count' => count($into),
    )));
  }
}