You are here

function _bootstrap_tour_list_tours in Bootstrap Tour 7

Administrative list of guided tours with statistics

Return value

string

File

./bootstrap_tour.admin.inc, line 454

Code

function _bootstrap_tour_list_tours() {
  $tours = _bootstrap_tour_get_data();

  // Check if we have guided tours in the database
  if (count($tours) > 0) {
    $rows = array();

    // Add the tours' data as rows to the table
    foreach ($tours as $tour) {
      $rows[] = array(
        l($tour->title, 'admin/config/content/bootstrap_tour/configure_tour/' . $tour->tour_id) . '<br />' . $tour->description,
        $tour->visible ? t('Yes') : t('No'),
        $tour->start_count,
        $tour->finish_count,
        ($tour->start_count > 0 ? round($tour->finish_count / $tour->start_count * 100, 2) : 0) . '%',
      );
    }
    $return = theme_table(array(
      'header' => array(
        t('Title/Description'),
        t('Visible'),
        t('Started'),
        t('Finished'),
        t('Ratio'),
      ),
      'rows' => $rows,
      'attributes' => array(),
      'caption' => '',
      'colgroups' => array(),
      'sticky' => true,
      'empty' => '',
    ));
  }
  else {
    $return = '<h2>' . t('No tours in the database!') . '</h2>';
  }
  return $return;
}