You are here

function uc_attribute_bulk_update_form in Ubercart 6.2

Form builder for bulk product updates.

See also

uc_attribute_bulk_update_flush()

uc_attribute_bulk_update_flush_all()

theme_uc_attribute_bulk_update_form()

1 string reference to 'uc_attribute_bulk_update_form'
uc_attribute_menu in uc_attribute/uc_attribute.module
Implements hook_menu().

File

uc_attribute/uc_attribute.admin.inc, line 201
Attribute administration menu items.

Code

function uc_attribute_bulk_update_form($form_state, $class) {
  drupal_set_title(check_plain($class->name));
  $form['node_type'] = array(
    '#type' => 'value',
    '#value' => $class->pcid,
  );

  // Select all products with current class.
  $result = pager_query("SELECT n.nid, n.title, n.status, nt.name FROM {node} n LEFT JOIN {node_type} nt ON nt.type = n.type WHERE nt.type = '%s'", 50, 0, NULL, $class->pcid);
  $nodes = array();
  while ($node = db_fetch_object($result)) {
    $nodes[$node->nid] = '';
    $form['title'][$node->nid] = array(
      '#value' => l($node->title, 'node/' . $node->nid),
    );
    $form['status'][$node->nid] = array(
      '#value' => $node->status ? t('published') : t('not published'),
    );
    $form['type'][$node->nid] = array(
      '#value' => check_plain($node->name),
    );
  }
  $form['nodes'] = array(
    '#type' => 'checkboxes',
    '#options' => $nodes,
  );
  $form['flush'] = array(
    '#type' => 'submit',
    '#value' => t('Flush selected'),
    '#submit' => array(
      'uc_attribute_bulk_update_flush',
    ),
  );
  $form['flush_all'] = array(
    '#type' => 'submit',
    '#value' => t('Flush all'),
    '#submit' => array(
      'uc_attribute_bulk_update_flush_all',
    ),
  );
  $form['pager'] = array(
    '#value' => theme('pager', NULL, 50, 0),
  );
  return $form;
}