chore: 添加多个图片和资源文件
添加了管理后台所需的图片资源、Excel文件、安装程序以及设计相关的图片文件
This commit is contained in:
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
////////////////// 分页类
|
||||
/******************** 使用方法 ******************
|
||||
$p=new page;
|
||||
////以下参数必需赋值
|
||||
$p->offset=$offset; //记录指针
|
||||
$p->total=100; //总记录数
|
||||
////以下参数可以默认
|
||||
$p->page_size=20; //每页显示记录数
|
||||
$p->show_page_num=7; //7,9,11
|
||||
$p->path=$_SERVER[PHP_SELF]; //跳转地址
|
||||
$p->arr_var=array("a"=>$a,"b"=>$b,"c"=>$c); //要传递的其他参数
|
||||
////输出
|
||||
echo $p->show();
|
||||
***********************************************/
|
||||
class page{
|
||||
var $total,$offset,$page_size,$arr_var,$style,$show_page_num;
|
||||
//显示
|
||||
function show(){
|
||||
$page_size=($this->page_size)?($this->page_size):20;
|
||||
$show_page_num=($this->show_page_num)?($this->show_page_num):9;
|
||||
$offset=($this->offset)?($this->offset):0;
|
||||
$style=($this->style)?($this->style):1;
|
||||
$path=$this->path;
|
||||
if($style==1){
|
||||
$color1="#000000";
|
||||
$color2="#666666";
|
||||
}else{
|
||||
$color1="#ffffff";
|
||||
$color2="#cccccc";
|
||||
}
|
||||
$total=$this->total;
|
||||
$arr_var=$this->arr_var;
|
||||
if(is_array($arr_var)){
|
||||
foreach($arr_var as $key=>$value){
|
||||
$other_var.="&".$key."=".urlencode($value);
|
||||
}
|
||||
}
|
||||
//
|
||||
$total_page_num=ceil($total/$page_size);
|
||||
$this_page=$offset>0?$offset/$page_size+1:1;
|
||||
$r_str.="<span style='color:".$color2.";'> 总计<b>".$total."</b>条/<b>".$total_page_num."</b>页 ";
|
||||
//pre page
|
||||
$pre_offset=($this_page-2)*$page_size;
|
||||
if($this_page>1)
|
||||
$r_str.="<a href=\"".$path."?offset=".$pre_offset.$other_var."\" style='color:".$color1.";'>‹‹</a> ";
|
||||
else
|
||||
$r_str.="<b style='color:".$color1.";'>‹‹</b> ";
|
||||
if($total_page_num>$show_page_num){
|
||||
$p_middle1=$this_page-($show_page_num-3)/2;
|
||||
$p_middle2=$this_page+($show_page_num-3)/2;
|
||||
//first page
|
||||
if($p_middle1<=0){
|
||||
$p_middle2=$p_middle2-$p_middle1+1;
|
||||
$p_middle1=1;
|
||||
}
|
||||
$r_first_page="";
|
||||
if($p_middle1>0){
|
||||
if($p_middle1>1){
|
||||
$r_first_page.="<a href=\"".$path."?offset=0".$other_var."\" title=\"1\" style='color:".$color1.";'>1...</a> ";
|
||||
}else{
|
||||
if($this_page==1)
|
||||
$r_first_page.="<b style='color:".$color1.";'>".$this_page."</b> ";
|
||||
else
|
||||
$r_first_page.="<a href=\"".$path."?offset=0".$other_var."\" title=\"1\" style='color:".$color1.";'>1</a> ";
|
||||
}
|
||||
}
|
||||
$r_str.=$r_first_page;
|
||||
$tmp=$p_middle2-$total_page_num;
|
||||
if($tmp>0){
|
||||
$p_middle2=$total_page_num;
|
||||
$p_middle1=$p_middle1-$tmp;
|
||||
}
|
||||
//middle page
|
||||
for($p=$p_middle1;$p<=$p_middle2;$p++){
|
||||
if($p>1 && $p<=$total_page_num){
|
||||
if($p==$this_page)
|
||||
$r_str.="<b>".$p."</b> ";
|
||||
else
|
||||
$r_str.="<a href=\"".$path."?offset=".(($p-1)*$page_size).$other_var."\" title=\"".$p."\" style='color:".$color1.";'>".$p."</a> ";
|
||||
}
|
||||
}
|
||||
//last page
|
||||
if($total_page_num>$p_middle2){
|
||||
$r_last_page="";
|
||||
if($p_middle2<=$total_page_num-1){
|
||||
$r_last_page.="<a href=\"".$path."?offset=".(($total_page_num-1)*$page_size).$other_var."\" title=\"".$total_page_num."\" style='color:".$color1.";'>...".$total_page_num."</a> ";
|
||||
}else{
|
||||
if($this_page==$total_page_num)
|
||||
$r_last_page.="<b style='color:".$color1.";'>".$this_page."</b> ";
|
||||
else
|
||||
$r_last_page.="<a href=\"".$path."?offset=".(($total_page_num-1)*$page_size).$other_var."\" title=\"".$total_page_num."\" style='color:".$color1.";'>".$total_page_num."</a> ";
|
||||
}
|
||||
$r_str.=$r_last_page;
|
||||
}
|
||||
}else{
|
||||
for($p=1;$p<=$total_page_num;$p++){
|
||||
if($this_page==$p)
|
||||
$r_str.="<b style='color:".$color1.";'>".$this_page."</b> ";
|
||||
else
|
||||
$r_str.="<a href=\"".$path."?offset=".(($p-1)*$page_size).$other_var."\" title=\"".$p."\" style='color:".$color1.";'>".$p."</a> ";
|
||||
}
|
||||
}
|
||||
//next page
|
||||
$next_offset=$this_page*$page_size;
|
||||
if($this_page<$total_page_num)
|
||||
$r_str.="<a href=\"".$path."?offset=".$next_offset.$other_var."\" style='color:".$color1.";'>››</a> ";
|
||||
else
|
||||
$r_str.="<b style='color:".$color1.";'>››</b> ";
|
||||
//form
|
||||
$r_str.="转到 第<input type=text style='font-size:12px;width:25px' onblur=\"if(this.value>0 && this.value<=".$total_page_num.") window.location='".$path."?offset='+((this.value-1)*".$page_size.")+'".$other_var."';\" value=''>页</span>";
|
||||
return $r_str;
|
||||
}
|
||||
}
|
||||
////////////////// 分页类结束
|
||||
?>
|
||||
Reference in New Issue
Block a user