title: Add a "show all function" to letter sorted sitemap
body: <p>This is my sitemap: <a href="http://webmaster.fniffi.de/sitemap/H/de.html" rel="nofollow">http://webmaster.fniffi.de/sitemap/H/de.html</a></p>
  
  <p>It's sorted by letters and I'd like to add a button to show all FAQ entries in one list. Or just change it to show all FAQ entries instantly. I don't need the letter sort function. Can anyone assist me in creating such a function. I am a complete PHP noob. </p>
  
  <p>This is my code:</p>
  
  <pre><code>&lt;?php
  
  
  if (!defined('IS_VALID_PHPMYFAQ')) {
  exit();
  }
  
  
  class PMF_Sitemap
  {
  private $_config;
  
  private $type = '';
  private $user = -1;
  private $groups = array();
  
  
   private $groupSupport = false;
  
   public function __construct(PMF_Configuration $config)
  {
      $this-&gt;_config = $config;
  
      if ($this-&gt;_config-&gt;get('security.permLevel') == 'medium') {
          $this-&gt;groupSupport = true;
      }
  }
  
  /**
   * @param integer $userId
   */
  public function setUser($userId = -1)
  {
      $this-&gt;user = $userId;
  }
  
  /**
   * @param array $groups
   */
  public function setGroups(Array $groups)
  {
      $this-&gt;groups = $groups;
  }
  
  /**
   * Returns all available first letters
   *
   * @return array
   * @since  2007-03-30
   * @author Thorsten Rinne &lt;thorsten@phpmyfaq.de&gt;
   */
  public function getAllFirstLetters()
  {
      global $sids;
  
      if ($this-&gt;groupSupport) {
          $permPart = sprintf("( fdg.group_id IN (%s)
          OR
              (fdu.user_id = %d AND fdg.group_id IN (%s)))",
              implode(', ', $this-&gt;groups),
              $this-&gt;user,
              implode(', ', $this-&gt;groups));
      } else {
          $permPart = sprintf("( fdu.user_id = %d OR fdu.user_id = -1 )",
              $this-&gt;user);
      }
  
      $writeLetters = '&lt;ul class="nav"&gt;';
  
      if ($this-&gt;_config-&gt;getDb() instanceof PMF_DB_Sqlite || $this-&gt;_config-&gt;getDb() instanceof PMF_DB_Sqlite3) {
  
          $query = sprintf("
                  SELECT
                      DISTINCT UPPER(SUBSTR(fd.thema, 1, 1)) AS letters
                  FROM
                      %sfaqdata fd
                  LEFT JOIN
                      %sfaqdata_group AS fdg
                  ON
                      fd.id = fdg.record_id
                  LEFT JOIN
                      %sfaqdata_user AS fdu
                  ON
                      fd.id = fdu.record_id
                  WHERE
                      fd.lang = '%s'
                  AND
                      fd.active = 'yes'
                  AND
                      %s
                  ORDER BY
                      letters",
              PMF_Db::getTablePrefix(),
              PMF_Db::getTablePrefix(),
              PMF_Db::getTablePrefix(),
              $this-&gt;_config-&gt;getLanguage()-&gt;getLanguage(),
              $permPart
          );
      } else {
  
          $query = sprintf("
                  SELECT
                      DISTINCT UPPER(SUBSTRING(fd.thema, 1, 1)) AS letters
                  FROM
                      %sfaqdata fd
                  LEFT JOIN
                      %sfaqdata_group AS fdg
                  ON
                      fd.id = fdg.record_id
                  LEFT JOIN
                      %sfaqdata_user AS fdu
                  ON
                      fd.id = fdu.record_id
                  WHERE
                      fd.lang = '%s'
                  AND
                      fd.active = 'yes'
                  AND
                      %s
                  ORDER BY
                      letters",
              PMF_Db::getTablePrefix(),
              PMF_Db::getTablePrefix(),
              PMF_Db::getTablePrefix(),
              $this-&gt;_config-&gt;getLanguage()-&gt;getLanguage(),
              $permPart
          );
      }
  
      $result = $this-&gt;_config-&gt;getDb()-&gt;query($query);
      while ($row = $this-&gt;_config-&gt;getDb()-&gt;fetchObject($result)) {
          $letters = PMF_String::strtoupper($row-&gt;letters);
          if (PMF_String::preg_match("/^[一-龠]+|[ぁ-ん]+|[ァ-ヴー]+|[a-zA-Z0-9]+|[ａ-ｚＡ-Ｚ０-９]/i", $letters)) {
              $url = sprintf(
                  '%s?%saction=sitemap&amp;amp;letter=%s&amp;amp;lang=%s',
                  PMF_Link::getSystemRelativeUri(),
                  $sids,
                  $letters,
                  $this-&gt;_config-&gt;getLanguage()-&gt;getLanguage());
              $oLink         = new PMF_Link($url, $this-&gt;_config);
              $oLink-&gt;text   = (string)$letters;
              $writeLetters .= '&lt;li&gt;' . $oLink-&gt;toHtmlAnchor().'&lt;/li&gt;';
          }
      }
      $writeLetters .= '&lt;/ul&gt;';
  
      return $writeLetters;
  }
  
  /**
   * Returns all records from the current first letter
   *
   * @param  string $letter Letter
   * @return array
   * @since  2007-03-30
   * @author Thorsten Rinne &lt;thorsten@phpmyfaq.de&gt;
   */
  public function getRecordsFromLetter($letter = 'A')
  {
      global $sids, $PMF_LANG;
  
      if ($this-&gt;groupSupport) {
          $permPart = sprintf("( fdg.group_id IN (%s)
          OR
              (fdu.user_id = %d AND fdg.group_id IN (%s)))",
              implode(', ', $this-&gt;groups),
              $this-&gt;user,
              implode(', ', $this-&gt;groups));
      } else {
          $permPart = sprintf("( fdu.user_id = %d OR fdu.user_id = -1 )",
              $this-&gt;user);
      }
  
      $letter = PMF_String::strtoupper($this-&gt;_config-&gt;getDb()-&gt;escape(PMF_String::substr($letter, 0, 1)));
  
      $writeMap = '';
  
      switch($this-&gt;type) {
          case 'db2':
          case 'sqlite':
              $query = sprintf("
                  SELECT
                      fd.thema AS thema,
                      fd.id AS id,
                      fd.lang AS lang,
                      fcr.category_id AS category_id,
                      fd.content AS snap
                  FROM
                      %sfaqcategoryrelations fcr,
                      %sfaqdata fd
                  LEFT JOIN
                      %sfaqdata_group AS fdg
                  ON
                      fd.id = fdg.record_id
                  LEFT JOIN
                      %sfaqdata_user AS fdu
                  ON
                      fd.id = fdu.record_id
                  WHERE
                      fd.id = fcr.record_id
                  AND
                      SUBSTR(fd.thema, 1, 1) = '%s'
                  AND
                      fd.lang = '%s'
                  AND
                      fd.active = 'yes'
                  AND
                      %s",
                  PMF_Db::getTablePrefix(),
                  PMF_Db::getTablePrefix(),
                  PMF_Db::getTablePrefix(),
                  PMF_Db::getTablePrefix(),
                  $letter,
                  $this-&gt;_config-&gt;getLanguage()-&gt;getLanguage(),
                  $permPart);
              break;
  
          default:
              $query = sprintf("
                  SELECT
                      fd.thema AS thema,
                      fd.id AS id,
                      fd.lang AS lang,
                      fcr.category_id AS category_id,
                      fd.content AS snap
                  FROM
                      %sfaqcategoryrelations fcr,
                      %sfaqdata fd
                  LEFT JOIN
                      %sfaqdata_group AS fdg
                  ON
                      fd.id = fdg.record_id
                  LEFT JOIN
                      %sfaqdata_user AS fdu
                  ON
                      fd.id = fdu.record_id
                  WHERE
                      fd.id = fcr.record_id
                  AND
                      SUBSTRING(fd.thema, 1, 1) = '%s'
                  AND
                      fd.lang = '%s'
                  AND
                      fd.active = 'yes'
                  AND
                      %s",
                  PMF_Db::getTablePrefix(),
                  PMF_Db::getTablePrefix(),
                  PMF_Db::getTablePrefix(),
                  PMF_Db::getTablePrefix(),
                  $letter,
                  $this-&gt;_config-&gt;getLanguage()-&gt;getLanguage(),
                  $permPart);
              break;
      }
  
      $result = $this-&gt;_config-&gt;getDb()-&gt;query($query);
      $oldId = 0;
      while ($row = $this-&gt;_config-&gt;getDb()-&gt;fetchObject($result)) {
          if ($oldId != $row-&gt;id) {
              $title = PMF_String::htmlspecialchars($row-&gt;thema, ENT_QUOTES, 'utf-8');
              $url   = sprintf(
                  '%s?%saction=artikel&amp;amp;cat=%d&amp;amp;id=%d&amp;amp;artlang=%s',
                  PMF_Link::getSystemRelativeUri(),
                  $sids,
                  $row-&gt;category_id,
                  $row-&gt;id,
                  $row-&gt;lang
              );
  
              $oLink            = new PMF_Link($url, $this-&gt;_config);
              $oLink-&gt;itemTitle = $row-&gt;thema;
              $oLink-&gt;text      = $title;
              $oLink-&gt;tooltip   = $title;
  
              $writeMap .= '&lt;li&gt;'.$oLink-&gt;toHtmlAnchor().'&lt;br /&gt;'."\n";
              $writeMap .= PMF_Utils::chopString(strip_tags($row-&gt;snap), 25). " ...&lt;/li&gt;\n";
          }
          $oldId = $row-&gt;id;
      }
  
      $writeMap = empty($writeMap) ? '' : '&lt;ul&gt;' . $writeMap . '&lt;/ul&gt;';
  
      return $writeMap;
  }
  }
  </code></pre>