? affiliates-list-item.tpl.php
? affiliates_theme.patch
Index: affiliates.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/affiliates/affiliates.module,v
retrieving revision 1.1.4.5.2.17
diff -u -p -r1.1.4.5.2.17 affiliates.module
--- affiliates.module 13 Jul 2009 12:45:27 -0000 1.1.4.5.2.17
+++ affiliates.module 15 Jul 2009 17:39:36 -0000
@@ -337,6 +337,19 @@ function affiliates_cron() {
}
}
+/**
+* Implementation of hook_theme().
+*/
+
+function affiliates_theme() {
+ return array(
+ 'list_item' => array(
+ 'template' => 'affiliates-list-item',
+ 'arguments' => array('row' => null),
+ ),
+ );
+}
+
function affiliates_affiliate() {
$affiliate = array();
$op = arg(2);
@@ -1031,7 +1044,7 @@ function affiliates_list() {
if ($user->uid) {
$output .= '
' . variable_get(AFFILIATE_STATS_TEXT, 'Copy and paste the source below to link to us and get affiliate credit.');
- $output .= '
' . "You have " . _get_user_points($user->uid) . " points.";
+ $output .= '
' . t("You have %points points.", array('%points' => _get_user_points($user->uid)));
}
$cat_name = '';
@@ -1049,37 +1062,24 @@ function affiliates_list() {
$cat_name = $row->cat_name;
}
- if ($row->type == "image") {
- // If the type specified is an image (rather than a text link), print image so users can preview
- // what they're going to be adding to their site.
- $output .= "\n
anchor . "\"/>
";
- }
- else {
- // Print text code.
- $output .= $row->label . "
";
- }
-
- // Now add the textarea for copying the code.
- $output .= "
\n";
- //Now add the label assigned through the admin interface.
- $output .= $row->label . " : " . $row->points . " points
";
+ $output .= theme('list_item', $row);
}
print theme('page', $output);
}
+function affiliates_preprocess_list_item(&$vars) {
+ global $user, $base_url;
+
+ $row = $vars['row'];
+ $vars['type'] = $row->type;
+ $vars['anchor'] = $row->anchor;
+ $vars['label'] = $row->label;
+ $vars['points'] = $row->points;
+ $vars['link'] = $base_url . "/aff/" . $user->uid . "/" . (int)$row->ad_id;
+ $vars['base_url'] = $base_url;
+}
+
function affiliates_top_users() {
// This is generated in affiliates_cron() because it stands to be a pretty beefy query and won't scale otherwise.
$obj = cache_get(AFFILIATE_TOP_USERS_PAGE);