You are here

function theme_uc_wishlist_view_form in UC Wish List 6

Same name and namespace in other branches
  1. 7 uc_wishlist.pages.inc \theme_uc_wishlist_view_form()

File

./uc_wishlist.pages.inc, line 332
Page callback and functions for wish lists.

Code

function theme_uc_wishlist_view_form($form) {
  $rows = array();
  $own = isset($form['own']) ? TRUE : FALSE;
  $header = array(
    t('Products'),
    '',
    t('Wanted'),
    t('Have'),
    t('Qty.'),
    t('Purchase'),
    array(
      'data' => t('Total'),
      'align' => 'right',
    ),
  );
  if ($own) {
    array_unshift($header, t('Remove'));
  }
  foreach (element_children($form['items']) as $i) {
    $nid = $form['items'][$i]['nid']['#value'];
    $desc = drupal_render($form['items'][$i]['title']) . '<br />';
    $desc .= drupal_render($form['items'][$i]['description']);
    $row = array(
      uc_product_get_picture($nid, 'cart'),
      $desc,
      $form['items'][$i]['wantqty'] ? drupal_render($form['items'][$i]['wantqty']) : '',
      $form['items'][$i]['haveqty'] ? drupal_render($form['items'][$i]['haveqty']) : '',
      $form['items'][$i]['qty'] ? drupal_render($form['items'][$i]['qty']) : '',
      $form['items'][$i]['addcart'] ? drupal_render($form['items'][$i]['addcart']) : '',
      array(
        'data' => uc_currency_format($form['items'][$i]['#total']),
        'nowrap' => 'nowrap',
      ),
    );
    if (isset($form['items'][$i]['remove'])) {
      array_unshift($row, drupal_render($form['items'][$i]['remove']));
    }
    $rows[] = array(
      'data' => $row,
      'valign' => 'top',
    );
  }
  $output = '<div id="wishlist-form-products">' . theme('table', $header, $rows) . '</div>';
  return $output . drupal_render($form);
}