You are here

function _simpleads_campaigns_watch in SimpleAds 7

Helper function. Check campaign criterias and set ads to active/inactive states.

4 calls to _simpleads_campaigns_watch()
simpleads_campaigns_cron in modules/simpleads_campaigns/simpleads_campaigns.module
Implements hook_cron().
simpleads_campaigns_simpleads_ad_click in modules/simpleads_campaigns/simpleads_campaigns.module
Implements hook_simpleads_ad_click().
simpleads_campaigns_simpleads_ad_impression in modules/simpleads_campaigns/simpleads_campaigns.module
Implements hook_simpleads_ad_impression().
simpleads_campaigns_simpleads_preload in modules/simpleads_campaigns/simpleads_campaigns.module
Implements hook_simpleads_preload().

File

modules/simpleads_campaigns/campaigns.helper.inc, line 38
SimpleAds helper functions.

Code

function _simpleads_campaigns_watch() {
  $results = db_select('node', 'n')
    ->fields('n', array(
    'nid',
  ))
    ->condition('n.status', 1)
    ->condition('n.type', 'simpleads_campaign')
    ->orderBy('n.title')
    ->execute();
  foreach ($results as $row) {
    _simpleads_campaigns_complete($row->nid);
  }
}