Changeset - 50ef4e0d73dc
[Not reviewed]
default
0 1 0
Nathan Brink (binki) - 14 years ago 2012-02-09 17:20:01
ohnobinki@ohnopublishing.net
Clean up Previous and Next links when viewing a paginated list of possible schedules.
1 file changed with 18 insertions and 10 deletions:
0 comments (0 inline, 0 general)
inc/class.schedule.php
Show inline comments
 
@@ -615,29 +615,29 @@ class Schedule
 
	for($nn = $first_permutation + 1; $nn <= $last_permutation; $nn++)
 
	  {
 
	    if (!empty($suppressed_permutations[$nn - 1]))
 
	      continue;
 
	    echo  "<li><a href=\"#tabs-" . $nn . "\">&nbsp;" . $nn . "&nbsp;</a></li>\n";
 
	  }
 
			
 
	echo "    </ul></div>\n  \n";
 

	
 
	echo "    <div id=\"pagers\">\n";
 
	/* Previous button */
 
	if ($page > 0)
 
	  echo '      <div id="pager-previous" class="pager left"><a href="' . htmlentities($this->my_url($page - 1)) . '">&laquo; Previous</a></div>' . "\n";
 
	  echo '      <div id="pager-previous" class="pager left"><a href="' . htmlentities($this->my_url($page - 1), ENT_QUOTES) . '" rel="prev prefetch">&laquo; Previous</a></div>' . "\n";
 

	
 
	/* Next button */
 
	if ($page + 1 < $npages)
 
	  echo '      <div id="pager-next" class="pager right"><a href="' . htmlentities($this->my_url($page + 1)) . '">Next &raquo;</a></div>' . "\n";
 
	  echo '      <div id="pager-next" class="pager right"><a href="' . htmlentities($this->my_url($page + 1), ENT_QUOTES) . '" rel="next prefetch">Next &raquo;</a></div>' . "\n";
 
	echo "    </div> <!-- id=\"pagers\" -->\n";
 

	
 

	
 
	echo "  <div class=\"scroller\">\n"
 
	  . "    <div class=\"scontent\">\n";
 
		
 
	for($i = $first_permutation; $i < $last_permutation; $i++)
 
	  {
 
	    /*
 
	     * Skip suppressed permutations, such as when displaying a
 
	     * page for printing a particular permutation.
 
	     */
 
@@ -932,36 +932,44 @@ class Schedule
 
   *   The ID of the schedule to link to.
 
   * \param $page
 
   *   The page/tab of the schedule to link to. Defaults to 0.
 
   * \return
 
   *   A string, the URL used to access the specified
 
   *   schedule. Remember that if this string is inserted into an
 
   *   XHTML document, htmlentities() must be called on it.
 
   */
 
  public static function url($id, $page = 0)
 
  {
 
    global $clean_urls;
 

	
 
    $url = '';
 
    if (!$clean_urls)
 
      $url .= 'process.php?s=';
 

	
 
    $url .= (int)$id;
 
    $query = array();
 
    if ($clean_urls)
 
      $url .= '?';
 
      $url = (int)$id;
 
    else
 
      $url .= '&';
 
      {
 
        $url = 'process.php';
 
        $query['s'] = (int)$id;
 
      }
 

	
 
    if ($page)
 
      $url .= 'page=' . (int)$page . '&';
 
      $query['page'] = (int)$page;
 

	
 
    if (!empty($query))
 
      {
 
        $query_processed = array();
 
        foreach ($query as $key => $value)
 
          $query_processed[] = $key . '=' . rawurlencode($value);
 

	
 
        $url .= '?' . implode('&', $query_processed);
 
      }
 

	
 
    return $url;
 
  }
 

	
 
  /**
 
   * \brief
 
   *   Return the URL used to access this schedule.
 
   *
 
   * Convenience wrapper around Schedule::url().
 
   *
 
   * \param $page
 
   *   Which page (tab) of the schedule to link to.
0 comments (0 inline, 0 general)