You are here

function views_handler_field_amazon_participant::pre_render in Amazon Product Advertisement API 6

Same name and namespace in other branches
  1. 7.2 includes/views_handler_field_amazon_participant.inc \views_handler_field_amazon_participant::pre_render()
  2. 7 includes/views_handler_field_amazon_participant.inc \views_handler_field_amazon_participant::pre_render()

File

includes/views_handler_field_amazon_participant.inc, line 41

Class

views_handler_field_amazon_participant

Code

function pre_render($values) {
  $this->field_alias = $this->aliases['asin'];
  $this->items = array();
  $asins = array();
  foreach ($values as $result) {
    if (!empty($result->{$this->aliases['asin']})) {
      $asins[] = $result->{$this->aliases['asin']};
    }
  }
  $sql = "SELECT aip.participant, aip.asin FROM {amazon_item_participant} aip WHERE aip.asin IN ('" . implode("', '", $asins) . "') ";
  if ($this->options['participant_type'] != '**ALL**') {
    $sql .= " AND aip.type = '%s'";
  }
  $results = db_query($sql, $this->options['participant_type']);
  while ($result = db_fetch_array($results)) {
    $this->items[$result['asin']][] = check_plain($result['participant']);
  }
}