?
Path : /home/admin/public_html/libs-bak/ |
Current File : /home/admin/public_html/libs-bak/backoff_30_nov.php |
<? class backoff extends MySql { var $_Limit; var $_total; var $_Next_Page; var $_Start; var $_a; var $_z; var $_az; var $_link; var $_first_page_link; var $_previous_page_link; var $_last_page_link; var $_next_page_link; var $_Page; var $_total_links; function setOrder(){ if($this->_Page==1){$count=$this->_total;}else{ $cal_page=$this->_Page-1; $perpage=$cal_page*$this->_Limit; $count=$this->_total-$perpage; return $count; } return $count; } function setPage(){ if($_GET['page']){$this->_Page = $_GET['page'];}else{$this->_Page = 1;} return $this->_Page; } function MakeLinkNavigator($MLlink, $MLget, $MLvalue, $what){ $getQueryString = ""; if (!empty($_SERVER['QUERY_STRING'])) { $params = explode("&", $_SERVER['QUERY_STRING']); $newParams = array(); foreach ($params as $param) { if (stristr($param, $MLget) == false) { array_push($newParams, $param); } }//end foreach $params as $param if (count($newParams) != 0) { $getQueryString = "&" . implode("&", $newParams); } }//end if empty($_SERVER['..... $getQueryString = sprintf("%s=%s%s",$MLget , $MLvalue, $getQueryString); $this->_link = $MLlink."?".$getQueryString; // $this->_link=$_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING']; if($what == 1){return $this->_link;} if($what == 0){return $newParams;} }//end function MakeLinkNavigato function total_links($total_link){ if($total_link==""){ $this->_total_links = 9; }else{ $this->_total_links=$total_link;} return $this->_total_links; } function PageNavigator(){ //Total links / navigator if($this->_total_links>$this->_Next_Page ){$this->_total_links=$this->_Next_Page;} $Ceil2total_links = ceil($this->_total_links/2); $Floor2total_links = floor($this->_total_links/2); $this->_first_page_link = $this->MakeLinkNavigator($_SERVER['PHP_SELF'], "page", 1, 1); $this->_previous_page_link = $this->MakeLinkNavigator($_SERVER['PHP_SELF'], "page", $this->_Page-1, 1); $this->_last_page_link = $this->MakeLinkNavigator($_SERVER['PHP_SELF'], "page", $this->_Next_Page , 1); $this->_next_page_link = $this->MakeLinkNavigator($_SERVER['PHP_SELF'], "page", $this->_Page+1, 1); $this->_a = 1; $this->_z = $this->_total_links; if( $this->_Next_Page<=$this->_total_links){ $this->_z = $this->_Next_Page; }else{ if(isset($this->_Page) && ($this->_Page > $Ceil2total_links)){ $this->_a = $this->_Page-$Floor2total_links; $this->_z = $this->_Page+$Floor2total_links; } if(isset($this->_Page) && ($this->_Page > ($this->_Limit-$Ceil2total_links))){ $this->_a = $this->_Next_Page-$this->_total_links+1; $this->_z = $this->_Next_Page; } } }//end function function jump2page(){ $output.="<form name=\"navigator1\" action=\"\" method='GET'> Jump Page: <select style='width: 50px;' name=\"page\" id=\"page\" onChange=\"sort_data('x','x','x')\">"; for($this->_az=1; $this->_az<= $this->_Next_Page; $this->_az++){ if($this->_az==$this->_Page){$pgnr=' selected';}else{$pgnr='';} $output.= "<option value='{$this->_az}'{$pgnr}>{$this->_az}-{$this->_Next_Page}</option>"; } $output.="</select>"; if($_GET){ foreach ($_GET as $key => $value){ if($key != "Submit" && $key != "page"){ $output.= "<input type='hidden' name='$key' value='$value'>\n"; } } } $output.="</form>"; return $output; }//end jump function PageLink(){ $output.="Page| "; for($i=$this->_a; $i<=$this->_z; $i++){ if($this->_Page == $i){ $output.= "<span id='this_page'>{$i}</span> "; }else{ $output.= " <a href='".$this->MakeLinkNavigator($_SERVER['PHP_SELF'], "page", $i, 1)."'>{$i}</a> "; } } return $output; }//end function total_record(){ $output.="Found ".$this->_total." Record "; $output.="Page {$this->_Page} / ".$this->_Next_Page.""; return $output; }//end function jum2page function PreNext(){ if( $this->_Next_Page > 1){ if($this->_Page>1){ $output.= "<a href='{$this->_first_page_link}'>First </a>"; $output.= "<a href='{$this->_previous_page_link}'>Previous </a>"; }else{ $output.= "First "; $output.= "Previous "; } if($this->_Page< $this->_Next_Page){ $output.= "<a href='{$this->_next_page_link}'>Next </a>"; $output.= "<a href='{$this->_last_page_link}'>Last</a>"; }else{ $output.= "Next "; $output.= "Last"; } }else{$output.= "First "; $output.= "Previous "; $output.= "Next "; $output.= "Last"; }//end if $this->_Next_Page>1 return $output; } function PerPageDropList(){ //$this->_link=$_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING']; $list=array("5","10","15","20","25","30","35","40","45","50"); $output=" <form method=\"GET\" action=\"\" name=\"listpage\"> <select size=\"1\" name=\"limit\" onchange=\"document.listpage.submit()\">"; foreach($list as $key=>$value){ if($value==$this->_Limit){$pgnr=' selected';}else{$pgnr='';} $output.= "<option value='{$value}'{$pgnr}>{$value}</option>"; } if (!in_array($this->_Limit, $list)) { $output.="<option value='$this->_Limit' selected>$this->_Limit</option"; } $output.="</select>"; if($_GET){ foreach ($_GET as $key => $value){ if($key != "Submit"&&$key!="limit"){ $output.= "<input type='hidden' name='$key' value='$value'>\n"; } } } $output.="</form>"; return $output; } function set_per_page(){ $output.="<form method=\"GET\" action=\"\" name=\"listpage2\"> <table width=\"180\"><tr><td width=\"80\" align=\"left\"># Per Page</td><td width=\"100\" align=\"left\"> <input type='textbox' name='limit' size=3 value=\"$this->_Limit\"> <input type='Submit' value=' Ok '>"; if($_GET){ foreach ($_GET as $key => $value){ if($key != "Submit"&&$key!="limit"){ $output.= "<input type='hidden' name='$key' value='$value'>\n"; } } } $output.="</td></tr></table></form>"; return $output; } function setLimit($limit){ global $_Limit; $this->_Limit=$_GET['limit']; if($this->_Limit==""){$this->_Limit=$_Limit;} if($this->_Limit==""){$this->_Limit=$limit;} $_SESSION['_Limit']=$this->_Limit; return $this->_Limit; } }//end class ?>