You are here

function asset_wizard_browse in Asset 5.2

Same name and namespace in other branches
  1. 6 asset_wizard.module \asset_wizard_browse()

Step 1: Display a browsable list of assets

Related topics

2 string references to 'asset_wizard_browse'
asset_wizard_menu in ./asset_wizard.module
Implementation of hook_menu().
asset_wizard_methods in ./asset_wizard.module

File

./asset_wizard.module, line 419
Wizard-style interface for Asset.

Code

function asset_wizard_browse($asset = NULL) {
  $config = asset_wizard_get_config();
  if (!$asset) {
    $asset = asset_load(0);
  }
  $items = array();
  if ($asset->aid) {
    $parent = asset_load($asset->pid);
    $parent->link_title = '..';
    $items[] = $parent;
  }
  $types = array();
  $query = 'SELECT aid FROM {asset} WHERE pid=%d';
  $args[] = $asset->aid;
  if ($config['allowed_types']) {
    foreach ($config['allowed_types'] as $type) {
      if ($type) {
        $types[] = $type;
      }
    }
    if ($types) {
      $query .= ' AND type IN ("%s")';
      $args[] = implode('","', $types);
    }
  }
  $result = db_query($query, $args);
  while ($row = db_fetch_object($result)) {

    //$items[$row->aid] = $row->title;
    $items[] = asset_load($row->aid);
  }
  $content = theme('asset_wizard_browse', $items);
  return theme('asset_wizard_page', $content);
}