No subject


Wed Jun 27 04:29:36 EDT 2007


Modified: plog/trunk/class/data/pager/pager.class.php
===================================================================
--- plog/trunk/class/data/pager/pager.class.php	2007-07-25 21:57:39 UTC (rev 5729)
+++ plog/trunk/class/data/pager/pager.class.php	2007-07-25 22:01:03 UTC (rev 5730)
@@ -285,6 +285,9 @@
             $this->_startPage        = 1;
             $this->_endPage          = $this->_totalPages;
 			$this->_pageLinks        = $this->generateLinks();
+			
+			if( $this->getCurrentPage() > $this->getTotalPages())
+				$this->_curPage = $this->getEndPage();
         }
 
 		function toJson()

Modified: plog/trunk/class/view/admin/adminarticlecategorieslistview.class.php
===================================================================
--- plog/trunk/class/view/admin/adminarticlecategorieslistview.class.php	2007-07-25 21:57:39 UTC (rev 5729)
+++ plog/trunk/class/view/admin/adminarticlecategorieslistview.class.php	2007-07-25 22:01:03 UTC (rev 5730)
@@ -44,11 +44,18 @@
 						
 			// retrieve the categories in an paged fashion
 			$totalCategories = $categories->getBlogNumCategories( $this->_blogInfo->getId(), true, $this->_searchTerms );
+			
+			// the pager that will be used
+			$pager = new Pager( "?op=editArticleCategories&searchTerms=".$this->_searchTerms."&page=",
+			                    $this->_page,
+								$totalCategories,
+								DEFAULT_ITEMS_PER_PAGE );			
+			
             $blogCategories = $categories->getBlogCategories( $this->_blogInfo->getId(), 
 			                                                  false, 
 															  $categoriesOrder,
 															  $this->_searchTerms,
-															  $this->_page,
+															  $pager->getCurrentPage(),
 															  DEFAULT_ITEMS_PER_PAGE );
 			if( !$blogCategories ) {
 				$blogCategories = Array();
@@ -58,11 +65,6 @@
 			$this->notifyEvent( EVENT_CATEGORIES_LOADED, Array( "categories" => &$blogCategories ));
             $this->setValue( "categories", $blogCategories );
 			
-			// the pager that will be used
-			$pager = new Pager( "?op=editArticleCategories&searchTerms=".$this->_searchTerms."&page=",
-			                    $this->_page,
-								$totalCategories,
-								DEFAULT_ITEMS_PER_PAGE );
 			$this->setValue( "pager", $pager );			
 		}
 

Modified: plog/trunk/class/view/admin/adminarticlecommentslistview.class.php
===================================================================
--- plog/trunk/class/view/admin/adminarticlecommentslistview.class.php	2007-07-25 21:57:39 UTC (rev 5729)
+++ plog/trunk/class/view/admin/adminarticlecommentslistview.class.php	2007-07-25 22:01:03 UTC (rev 5730)
@@ -66,52 +66,60 @@
 		{
 			// load the comments and throw the correct event
 			$comments = new CommentsCommon();
+			
 			if( $this->_article ) {
+				
+				// number of comments
+				$numPostComments = $comments->getNumPostComments( $this->_article->getId(), 
+				                                                  $this->_commentStatus,
+																  $this->_commentType );
+																
+
+				// id of the article, for the pager...
+				$articleId = $this->_article->getId();																
+																
+				// calculate the pager url
+				$pager = new Pager( "?op=editComments&articleId={$articleId}&showStatus=".$this->_commentStatus."&searchTerms=".$this->_searchTerms."&showType=".$this->_commentType."&page=",
+						    $this->_page,
+						    $numPostComments,
+						    DEFAULT_ITEMS_PER_PAGE );				
+				
 				// load only the comments of the given post
 				$postComments = $comments->getPostComments( $this->_article->getId(),
 															COMMENT_ORDER_NEWEST_FIRST,
 															$this->_commentStatus, 
 															$this->_commentType,
-															$this->_page, 
+															$pager->getCurrentPage(), 
 															DEFAULT_ITEMS_PER_PAGE );
+			}
+			else {
 				// number of comments
-				$numPostComments = $comments->getNumPostComments( $this->_article->getId(), 
+				$numPostComments = $comments->getNumBlogComments( $this->_blogInfo->getId(),
 				                                                  $this->_commentStatus,
-																  $this->_commentType );
-				// id of the article, for the pager...
-				$articleId = $this->_article->getId();
-			}
-			else {
+																  $this->_commentType,
+																  $this->_searchTerms );
+																
+				// no article id...
+				$articleId = 0;																
+																
+				// calculate the pager url
+				$pager = new Pager( "?op=editComments&articleId={$articleId}&showStatus=".$this->_commentStatus."&searchTerms=".$this->_searchTerms."&showType=".$this->_commentType."&page=",
+						    $this->_page,
+						    $numPostComments,
+						    DEFAULT_ITEMS_PER_PAGE );				
+				
 				// load all comments given the current status
 				$postComments = $comments->getBlogComments( $this->_blogInfo->getId(),
 				                                            COMMENT_ORDER_NEWEST_FIRST,
 				                                            $this->_commentStatus,
 															$this->_commentType,
 															$this->_searchTerms,
-														    $this->_page,
+														    $pager->getCurrentPage(),
 														    DEFAULT_ITEMS_PER_PAGE );
-				// number of comments
-				$numPostComments = $comments->getNumBlogComments( $this->_blogInfo->getId(),
-				                                                  $this->_commentStatus,
-																  $this->_commentType,
-																  $this->_searchTerms );
-				// no article id...
-				$articleId = 0;
 			}
+			
 			$this->notifyEvent( EVENT_COMMENTS_LOADED, Array( "comments", &$postComments ));
 			
-
-			$pagerUrl = "?op=editComments";
-			if( $this->_commentStatus > -1 )
-				$pagerUrl .= "&articleId={$articleId}&showStatus=".$this->_commentStatus."&searchTerms=".$this->_searchTerms."&showType=".$this->_commentType."&page=";
-			else
-				$pagerUrl .= "&articleId={$articleId}&searchTerms=".$this->_searchTerms."&showType=".$this->_commentType."&page=";
-				
-			// calculate the pager url
-			$pager = new Pager( $pagerUrl,
-					    $this->_page,
-					    $numPostComments,
-					    DEFAULT_ITEMS_PER_PAGE );			
 					
 			$this->setValue( "comments", $postComments);
 			// pass the pager to the view

Modified: plog/trunk/class/view/admin/admincustomfieldslistview.class.php
===================================================================
--- plog/trunk/class/view/admin/admincustomfieldslistview.class.php	2007-07-25 21:57:39 UTC (rev 5729)
+++ plog/trunk/class/view/admin/admincustomfieldslistview.class.php	2007-07-25 22:01:03 UTC (rev 5730)
@@ -34,19 +34,22 @@
 		 */
 		function render()
 		{
-			// load the custom fields that have been defined so far
+
 			$customFields = new CustomFields();
-			$blogFields = $customFields->getBlogCustomFields( $this->_blogInfo->getId(), true, $this->_page, DEFAULT_ITEMS_PER_PAGE );
-			$this->notifyEvent( EVENT_CUSTOM_FIELDS_LOADED, Array( "fields" => &$blogFields ));
-			// and the total number of them too
-			$numBlogFields = $customFields->getNumBlogCustomFields( $this->_blogInfo->getId());
-
+			
+			// load the number of custom fields
+			$numBlogFields = $customFields->getNumBlogCustomFields( $this->_blogInfo->getId());			
+			
 			// create the pager
 			$pager = new Pager( "?op=blogCustomFields&page=",
 					    $this->_page,
 					    $numBlogFields,
-					    DEFAULT_ITEMS_PER_PAGE );
-			
+					    DEFAULT_ITEMS_PER_PAGE );						
+
+			// load the custom fields that have been defined so far			
+			$blogFields = $customFields->getBlogCustomFields( $this->_blogInfo->getId(), true, $pager->getCurrentPage(), DEFAULT_ITEMS_PER_PAGE );
+			$this->notifyEvent( EVENT_CUSTOM_FIELDS_LOADED, Array( "fields" => &$blogFields ));
+
 			// and show them
 			$this->setValue( "fields", $blogFields );
 			$this->setValue( "pager", $pager );

Modified: plog/trunk/class/view/admin/adminlinkcategorieslistview.class.php
===================================================================
--- plog/trunk/class/view/admin/adminlinkcategorieslistview.class.php	2007-07-25 21:57:39 UTC (rev 5729)
+++ plog/trunk/class/view/admin/adminlinkcategorieslistview.class.php	2007-07-25 22:01:03 UTC (rev 5730)
@@ -36,23 +36,25 @@
 			$linkCategoriesOrder = $blogSettings->getValue( "link_categories_order", MYLINKS_CATEGORIES_NO_ORDER );			
 			// get the link categories
             $linkCategories = new MyLinksCategories();
+
+			// get the total number of link categories
+			$numLinkCategories = $linkCategories->getNumMyLinksCategories( $this->_blogInfo->getId(), $searchTerms );
+			
+			// create the pager
+			$pager = new Pager( "?op=editLinkCategories&searchTerms={$searchTerms}&page=",
+			                    $this->_page,
+								$numLinkCategories,
+								DEFAULT_ITEMS_PER_PAGE );											
+
             $blogLinkCategories = $linkCategories->getMyLinksCategories( $this->_blogInfo->getId(), 
 			                                                             $linkCategoriesOrder,
 																		 $searchTerms,
-																		 $this->_page,
+																		 $pager->getCurrentPage(),
 																		 DEFAULT_ITEMS_PER_PAGE );
-			// get the total number of link categories
-			$numLinkCategories = $linkCategories->getNumMyLinksCategories( $this->_blogInfo->getId(), $searchTerms );
 			
 			// throw the event
 			$this->notifyEvent( EVENT_LINK_CATEGORIES_LOADED, Array( "linkcategories" => &$blogLinkCategories ));
 			
-			// create the pager
-			$pager = new Pager( "?op=editLinkCategories&searchTerms={$searchTerms}&page=",
-			                    $this->_page,
-								$numLinkCategories,
-								DEFAULT_ITEMS_PER_PAGE );
-								
             // create the view and fill the template context
             $this->setValue( "linkcategories", $blogLinkCategories );
 			$this->setValue( "searchTerms", $searchTerms );

Modified: plog/trunk/class/view/admin/adminlinkslistview.class.php
===================================================================
--- plog/trunk/class/view/admin/adminlinkslistview.class.php	2007-07-25 21:57:39 UTC (rev 5729)
+++ plog/trunk/class/view/admin/adminlinkslistview.class.php	2007-07-25 22:01:03 UTC (rev 5730)
@@ -45,23 +45,26 @@
 			$this->_searchTerms = $this->getValue( "searchTerms" );
         	// get all the links and throw the event
         	$links = new MyLinks();
+
+			// get the number of links
+			$numLinks = $links->getNumLinks( $this->_blogInfo->getId(), $this->_categoryId );
+			
+			// prepare the pager
+			$pager = new Pager( "?op=editLinks&showCategory={$this->_categoryId}&searchTerms={$this->_searchTerms}&page=",
+			                    $this->_page,
+								$numLinks,
+								DEFAULT_ITEMS_PER_PAGE );
+
             $this->_blogLinks = $links->getLinks( $this->_blogInfo->getId(), 
 			                               $this->_categoryId,
 										   $this->_searchTerms,
-										   $this->_page,
+										   $pager->getCurrentPage(),
 										   DEFAULT_ITEMS_PER_PAGE );
 			$this->notifyEvent( EVENT_LINKS_LOADED, Array( "links" => &$this->_blogLinks ));
-			// get the number of links
-			$numLinks = $links->getNumLinks( $this->_blogInfo->getId(), $this->_categoryId );
 			
 			// put the links in the view
             $this->setValue( "links", $this->_blogLinks );
-			
-			// prepare the pager
-			$pager = new Pager( "?op=editLinks&showCategory={$this->_categoryId}&searchTerms={$this->_searchTerms}&page=",
-			                    $this->_page,
-								$numLinks,
-								DEFAULT_ITEMS_PER_PAGE );			
+						
 			$this->setValue( "pager", $pager );
 		}
 

Modified: plog/trunk/class/view/admin/adminpostslistview.class.php
===================================================================
--- plog/trunk/class/view/admin/adminpostslistview.class.php	2007-07-25 21:57:39 UTC (rev 5729)
+++ plog/trunk/class/view/admin/adminpostslistview.class.php	2007-07-25 22:01:03 UTC (rev 5730)
@@ -141,19 +141,6 @@
 			$blogSettings = $this->_blogInfo->getSettings();
             $articles = new Articles();			
 
-			$posts = $articles->getBlogArticles( $this->_blogInfo->getId(), // the blog id
-			                                     $this->_showMonth, // current month
-												 $this->_itemsPerPage,
-			                                     $this->_showCategory, // current category
-												 $this->_showStatus,  // current status
-												 $this->_showUser,  // current user
-												 0,  // no maxdate
-												 $this->_searchTerms, // current search terms
-												 $blogSettings->getValue( "articles_order", ARTICLES_NEWEST_FIRST ),  // articles order
-												 $this->_locationId, // location id												
-												 $this->_page // current page
-												 );												
-												 
 			// get the total number of posts
 			$numPosts = $articles->getNumBlogArticles( 
 			                                     $this->_blogInfo->getId(), // the blog id
@@ -171,6 +158,19 @@
 								$numPosts, 
 								$this->_itemsPerPage );
 
+			$posts = $articles->getBlogArticles( $this->_blogInfo->getId(), // the blog id
+			                                     $this->_showMonth, // current month
+												 $this->_itemsPerPage,
+			                                     $this->_showCategory, // current category
+												 $this->_showStatus,  // current status
+												 $this->_showUser,  // current user
+												 0,  // no maxdate
+												 $this->_searchTerms, // current search terms
+												 $blogSettings->getValue( "articles_order", ARTICLES_NEWEST_FIRST ),  // articles order
+												 $this->_locationId, // location id												
+												 $pager->getCurrentPage() // current page
+												 );
+
             $this->setValue( "posts", $posts );
 			$this->setValue( "pager", $pager );
 			



More information about the pLog-svn mailing list