From 3cf6a50ff3b89d605581242bda41bc0190af7078 Mon Sep 17 00:00:00 2001 From: Li Jianxuan Date: Wed, 21 Sep 2011 08:35:03 +0000 Subject: [PATCH] =?UTF-8?q?=E7=BB=99=E6=8C=89=E6=95=B0=E6=8D=AE=E9=9B=86?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E5=A2=9E=E5=8A=A0=E4=BA=86=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../default/controllers/DataController.php | 9 +- .../default/views/scripts/data/category.phtml | 88 +++++++++++-------- .../views/scripts/pagination_param.phtml | 26 ++++++ 3 files changed, 84 insertions(+), 39 deletions(-) create mode 100644 application/default/views/scripts/pagination_param.phtml diff --git a/application/default/controllers/DataController.php b/application/default/controllers/DataController.php index 752f3f61..28a1d412 100755 --- a/application/default/controllers/DataController.php +++ b/application/default/controllers/DataController.php @@ -312,7 +312,14 @@ class DataController extends Zend_Controller_Action $this->view->codename=(empty($row->name_zh)?$row->name:$row->name_zh); $sql='select m.* from metadata m,category c where m.id=c.id and c.code=? order by m.title'; $state=$db->query($sql,array($code)); - $this->view->metadata = $state->fetchAll(); + $rows = $state->fetchAll(); + + $paginator = Zend_Paginator::factory($rows); + $paginator->setCurrentPageNumber($this->_getParam('page')); + $paginator->setItemCountPerPage(10); + $paginator->setView($this->view); + Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); + $this->view->paginator=$paginator; } else { //提供全部分类列表 } diff --git a/application/default/views/scripts/data/category.phtml b/application/default/views/scripts/data/category.phtml index 6fc72b63..b36f458e 100755 --- a/application/default/views/scripts/data/category.phtml +++ b/application/default/views/scripts/data/category.phtml @@ -1,39 +1,51 @@ -headTitle($this->config->title->site); - $this->headTitle($this->config->title->data); -$this->headTitle('分类浏览'); -if (!empty($this->codename)) $this->headTitle($this->codename); -$this->headTitle()->setSeparator(' - '); -$this->headLink()->appendStylesheet('/css/metadata.css'); -$this->breadcrumb('首页'); -$this->breadcrumb(''.$this->config->title->data.''); -$this->breadcrumb('分类浏览'); -if (!empty($this->codename)) $this->breadcrumb($this->codename); -$this->breadcrumb()->setSeparator(' > '); -?> -
-partial('data/tools.phtml'); ?> -
- -
-
数据集类别 -
    -category as $cg) : ?> -
  • '>()
  • - -
-
-
-metadata)) : ?> -

当前浏览分类:codename; ?>

-metadata as $md) : ?> -
-
-
-

escape($md['title']);?> -

- 400?$this->escape(mb_substr($md['description'],0,400,'UTF-8').'...'):$this->escape($md['description']);?> -
- +headTitle($this->config->title->site); + $this->headTitle($this->config->title->data); +$this->headTitle('分类浏览'); +if (!empty($this->codename)) $this->headTitle($this->codename); +$this->headTitle()->setSeparator(' - '); +$this->headLink()->appendStylesheet('/css/metadata.css'); +$this->breadcrumb('首页'); +$this->breadcrumb(''.$this->config->title->data.''); +$this->breadcrumb('分类浏览'); +if (!empty($this->codename)) $this->breadcrumb($this->codename); +$this->breadcrumb()->setSeparator(' > '); +?> +
+partial('data/tools.phtml'); ?> +
+ +
+
数据集类别 +
    +category as $cg) : ?> +
  • '>()
  • + +
+
+
+ +paginator)): ?> +paginator as $item): + $i++; + if (mb_strlen($item['description'])>700) + { + $item['description'] = mb_substr($item['description'],0,400,'UTF-8').'...'; + } + if($i%2==0) $style="style='background:#fafafa;'"; + else $style=""; + echo '
+
+

'.$this->escape($item['title']).' +

+

'.$item['description'].'

+
'; +endforeach; +?> + + +paginator; ?> +
\ No newline at end of file diff --git a/application/default/views/scripts/pagination_param.phtml b/application/default/views/scripts/pagination_param.phtml new file mode 100644 index 00000000..bc11a2c9 --- /dev/null +++ b/application/default/views/scripts/pagination_param.phtml @@ -0,0 +1,26 @@ +pageCount): ?> +
+ +previous)): ?> + ">< Previous + + < Previous + + + +pagesInRange as $page): ?> + current): ?> + "> + + + + + + +next)): ?> + ">Next > + + Next > + +
+ \ No newline at end of file