diff weight/probability/ad_weight_probability.module @ 7:6aeff3329e01 ad

maj module ad 2.1rc1
author piotre
date Mon, 20 Jul 2009 13:54:40 +0000
parents 0d1c70d51fbe
children
line wrap: on
line diff
--- a/weight/probability/ad_weight_probability.module	Thu May 28 14:53:07 2009 +0000
+++ b/weight/probability/ad_weight_probability.module	Mon Jul 20 13:54:40 2009 +0000
@@ -1,5 +1,5 @@
 <?php
-// $Id: ad_weight_probability.module,v 1.1.4.6 2009/04/22 15:14:46 jeremy Exp $
+// $Id: ad_weight_probability.module,v 1.1.4.8 2009/07/11 16:39:22 jeremy Exp $
 
 /**
  * @file
@@ -36,6 +36,22 @@
     );
     $form['weighting']['#weight'] = -1;
   }
+  // TODO: This hack requires that the ad_channel module is enabled to work.
+  // Ultimately ad.admin.inc should be enhanced to allow plug-in modules to
+  // modify the overview page.
+  else if ($form_id == 'ad_admin_ads' && function_exists('ad_channel_form_alter')) {
+    if (variable_get('ad_channel_admin_list', AD_CHANNEL_LIST_CHANNEL) != AD_CHANNEL_LIST_GROUP) {
+      $weights = _ad_weight_probability_weights();
+      // ensure a filter has not been set that yeilds no results
+      if (isset($form['title']) && is_array($form['title'])) {
+        foreach ($form['title'] as $aid => $value) {
+          $node->nid = $aid;
+          $result = _ad_weight_probability_node_load($node);
+          $form['probability'][$aid]['#value'] = $weights[$result['probability']];
+        }
+      }
+    }
+  }
 }
 
 /**