[xoops-cvslog 1362] CVS update: xoops2jp/html/class

Back to archive index

Minahito minah****@users*****
2005年 12月 25日 (日) 15:57:39 JST


Index: xoops2jp/html/class/XCube_PageNavigator.class.php
diff -u xoops2jp/html/class/XCube_PageNavigator.class.php:1.1.2.3 xoops2jp/html/class/XCube_PageNavigator.class.php:1.1.2.4
--- xoops2jp/html/class/XCube_PageNavigator.class.php:1.1.2.3	Tue Nov 22 09:31:12 2005
+++ xoops2jp/html/class/XCube_PageNavigator.class.php	Sun Dec 25 15:57:39 2005
@@ -13,6 +13,8 @@
 	var $mPerpage=20;
 	var $mUrl=null;
 	
+	var $mPrefix = null;
+
 	var $mExtra=array();
 	
 	var $mFlags=0;
@@ -26,11 +28,16 @@
 	
 	function fetch()
 	{
-		if($this->mFlags & XCUBE_PAGENAVI_START)
-			$this->mStart = isset($_REQUEST['start']) ? intval($_REQUEST['start']) : 0;
+		$startKey = $this->getStartKey();
+		$perpageKey = $this->getPerpageKey();
+		
+		if ($this->mFlags & XCUBE_PAGENAVI_START) {
+			$this->mStart = isset($_REQUEST[$startKey]) ? intval($_REQUEST[$startKey]) : 0;
+		}
 
-		if($this->mFlags & XCUBE_PAGENAVI_PERPAGE)
-			$this->mPerpage = isset($_REQUEST['perpage']) ? intval($_REQUEST['perpage']) : 20;
+		if ($this->mFlags & XCUBE_PAGENAVI_PERPAGE) {
+			$this->mPerpage = isset($_REQUEST[$perpageKey]) ? intval($_REQUEST[$perpageKey]) : 20;
+		}
 	}
 
 	function addExtra($key,$value)
@@ -53,18 +60,18 @@
 				$tarr[]=$key."=".urlencode($value);
 			}
 			if(strpos($this->mUrl,"?")!==false) {
-				return $this->mUrl."&".implode("&",$tarr)."&start=";
+				return $this->mUrl."&".implode("&",$tarr)."&" . $this->getStartKey() . "=";
 			}
 			else {
-				return $this->mUrl."?".implode("&",$tarr)."&start=";
+				return $this->mUrl."?".implode("&",$tarr)."&" . $this->getStartKey() . "=";
 			}
 		}
 		else {
 			if(strpos($this->mUrl,"?")!==false) {
-				return $this->mUrl."&start=";
+				return $this->mUrl."&" . $this->getStartKey() . "=";
 			}
 			else {
-				return $this->mUrl."?start=";
+				return $this->mUrl."?" . $this->getStartKey() . "=";
 			}
 		}
 	}
@@ -74,12 +81,12 @@
 	 */
 	function renderSortUrl()
 	{
-		return $this->getRenderUrl().$this->mStart;
+		return $this->getRenderUrl() . $this->mStart;
 	}
 
 	function setStart($start)
 	{
-		$this->mStart=$start;
+		$this->mStart = intval($start);
 	}
 	
 	function getStart()
@@ -89,7 +96,7 @@
 	
 	function setTotal($total)
 	{
-		$this->mTotal=$total;
+		$this->mTotal = intval($total);
 	}
 	
 	function getTotal()
@@ -99,14 +106,33 @@
 	
 	function setPerpage($perpage)
 	{
-		$this->mPerpage=$perpage;
+		$this->mPerpage = intval($perpage);
 	}
 	
 	function getPerpage()
 	{
 		return $this->mPerpage;
 	}
+
+	function setPrefix($prefix)
+	{
+		$this->mPrefix = $prefix;
+	}
 	
+	function getPrefix()
+	{
+		return $this->mPrefix;
+	}
+
+	function getStartKey()
+	{
+		return $this->mPrefix . "start";
+	}
+
+	function getPerpageKey()
+	{
+		return $this->mPrefix . "perpage";
+	}
 }
 
 ?>
\ No newline at end of file


xoops-cvslog メーリングリストの案内
Back to archive index