You are here

function theme_asset_wizard_links in Asset 6

Same name and namespace in other branches
  1. 5.2 asset_wizard.module \theme_asset_wizard_links()
1 theme call to theme_asset_wizard_links()
theme_asset_wizard_page in ./asset_wizard.module

File

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

Code

function theme_asset_wizard_links() {

  // figure out the step we are on
  $step = 0;
  if (arg(2) && !is_numeric(arg(2))) {
    $step = 1;
  }
  elseif (arg(2)) {
    $asset = asset_load(arg(2));
    if ($asset->type == 'directory') {
      $step = 1;
    }
    else {
      if (arg(3) == 'finish') {
        $step = 4;
      }
      elseif (arg(3)) {
        $step = 3;
      }
      else {
        $step = 2;
      }
    }
  }

  // build the links/spans based on what step we're on
  $links = array();
  $aid = is_numeric(arg(2)) ? arg(2) : 0;
  if ($_GET['return'] == 'id') {
    $steps = array(
      'asset/wizard' => t('Start'),
      'asset/wizard/browse' => t('Select an Asset'),
      'asset/wizard/' . $aid . '/finish/' . arg(4) => t('Preview'),
    );
  }
  else {
    $steps = array(
      'asset/wizard' => t('Start'),
      'asset/wizard/browse' => t('Select an Asset'),
      'asset/wizard/' . $aid => t('Select a Format'),
      'asset/wizard/' . $aid . '/' . arg(3) => t('Formatting Options'),
      'asset/wizard/' . $aid . '/finish/' . arg(4) => t('Preview'),
    );
  }
  $i = 0;
  foreach ($steps as $path => $text) {
    if ($step == $i) {
      $links[] = '<span class="active">' . $text . '</span>';
    }
    elseif ($step > $i) {
      $links[] = tbl($text, $path);
    }
    else {
      $links[] = '<span>' . $text . '</span>';
    }
    $i++;
  }
  return '<ul><li>' . join('</li><li>', $links) . '</li></ul>';
}