You are here

function simpleads_campaigns_node_presave in SimpleAds 7

Implements hook_node_presave().

File

modules/simpleads_campaigns/simpleads_campaigns.module, line 149

Code

function simpleads_campaigns_node_presave($node) {
  if ($node->type == 'simpleads' && isset($node->campaign)) {
    $node->field_adcamp_list[$node->language][0]['value'] = $node->campaign;
  }
  if ($node->type == 'simpleads_campaign') {
    $start_time = 0;
    if (isset($node->field_adcamp_start[$node->language]) && !empty($node->field_adcamp_start[$node->language][0]['value'])) {
      $start_time = $node->field_adcamp_start[$node->language][0]['value'];
    }
    $start_time = strtotime($start_time);
    if ($start_time != 0) {
      $node->field_adcamp_start[$node->language][0]['value'] = format_date($start_time, 'custom', 'm/d/Y h:i a');
    }
  }
}