}
}
if ($promo_content) {
    $list->content($promo_content);
    $ad_list_output = '<form accept-charset="UTF-8" action="ad.list.php" method="get">' . "\n";
    $ad_list_output .= $list->format_headings();
    $ad_list_output .= $list->format_content();
    $ad_list_output .= '</form>' . "\n";
} else {
    $link->url('ad.promo-create.php');
    $link->tap('Create one now');
    $ad_list_output = $message->info_dialog('Huh. Looks like you haven’t uploaded any ads. ' . $link->paint() . '.');
}
$link->url('ad.promo-create.php');
$link->tap('Create an ad');
$ad_list_output .= $link->button_primary('new');
///////// Display the slots.
// Get all slots for this theme.
$slot_list = get_slots($current_theme['theme_id'], 'ad', $db);
// How many ads are in each slot?
if ($slot_list) {
    foreach ($slot_list as $key => $val) {
        $ad_slot_match_list = get_ad_slot_matches($key, null, $db);
        $slot_list[$key]['ad_count'] = count($ad_slot_match_list);
    }
}
if ($slot_list) {
    $heading_list = array();
    // reset
    $heading_list[] = array('value' => 'Name', 'class' => 'nudge');
    $heading_list[] = array('value' => 'Size', 'class' => 'nudge');
        $action_output = $delete_link->icon_link();
        $action_output .= $edit_link->icon_link();
        $list_items[$key] = array('select' => $val['rank'], 'title' => $val['title'], 'tally' => $val['tally'], 'action' => $action_output);
    }
    $list->draggable(false);
    $list->row_class('chapter');
    $list->headings($heading_list);
    $list->content($list_items);
    $list_output = $list->format_headings();
    $list_output .= $list->format_content();
} else {
    $list_output .= 'I didn’t find any types of marker.';
}
$link->url('marker-type.create.php');
$link->tap('Create');
$create_output = $link->button_primary('new');
$view->group_h2('Organization');
$view->group_instruction('Markers denote the beginnings of sections, like chapters, scenes and supplemental pages. Tap to edit each type.');
$view->group_contents($list_output);
$content_output .= $view->format_group() . '<hr />';
$view->group_h2('Create');
$view->group_instruction('Make a new marker type.');
$view->group_contents($create_output);
$content_output .= $view->format_group();
$view->page_title('Marker types: ' . $book->info['title']);
$view->tooltype('chapter');
$view->headline('Marker types');
$output = $view->open_view();
$output .= $view->view_header();
$output .= $alert_output;
$output .= $content_output;