List Info

Thread: link_ShowLinksAdminView.php




link_ShowLinksAdminView.php
user name
2006-07-27 14:56:59
Update of
/var/cvs/Geeklog-2.x/Geeklog-2.x/plugins/link/views
In directory
iowaoutdoors:/tmp/cvs-serv27936/plugins/link/views

Modified Files:
	link_ShowLinksAdminView.php link_ShowLinksView.php 
Log Message:
added very basic links list

Index: link_ShowLinksAdminView.php
============================================================
=======
RCS file:
/var/cvs/Geeklog-2.x/Geeklog-2.x/plugins/link/views/link_Sho
wLinksAdminView.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** link_ShowLinksAdminView.php	7 Jul 2006 19:45:01
-0000	1.11
--- link_ShowLinksAdminView.php	27 Jul 2006 14:56:57
-0000	1.12
***************
*** 65,70 ****
       * Ensure the user is authorized to view the link
       *
!      * This is a pretty simple methd that check the link
ID we got and ensures the user has 
!      * sufficient rights to access it.  A lot of th work
is done by 
       * Geeklog_BaseViewFlexyPlugin::authorizedToView()
       *
--- 65,70 ----
       * Ensure the user is authorized to view the link
       *
!      * This is a pretty simple method that checks the link
ID we got and ensures the user has 
!      * sufficient rights to access.  A lot of th work is
done by 
       * Geeklog_BaseViewFlexyPlugin::authorizedToView()
       *

Index: link_ShowLinksView.php
============================================================
=======
RCS file:
/var/cvs/Geeklog-2.x/Geeklog-2.x/plugins/link/views/link_Sho
wLinksView.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** link_ShowLinksView.php	30 Apr 2006 23:43:07 -0000	1.4
--- link_ShowLinksView.php	27 Jul 2006 14:56:57 -0000	1.5
***************
*** 16,19 ****
--- 16,25 ----
  
  /**
+  * Link model object
+  */
+ //require $glConf['path_plugins'] .
'link/models/GL2Link.php';
+ require 'plugins/link/models/Gl2Link.php';
+ 
+ /**
   * Shows the link plugin's homepage
   *
***************
*** 25,28 ****
--- 31,58 ----
   */
  class link_ShowLinksView extends
Geeklog_BaseViewFlexyPlugin {
+ 	/**
+ 	 * Holds the links to show the user
+ 	 * access public
+ 	 * var array
+ 	 */
+     public $links = null;
+     
+     /**
+      * Ensure the user is authorized to view the link
+      *
+      * This is a pretty simple method that checks the link
ID we got and ensures the user has 
+      * sufficient rights to access.  A lot of th work is
done by 
+      * Geeklog_BaseViewFlexyPlugin::authorizedToView()
+      *
+      * author Tony Bibbs <tonygeeklog.net>
+      * access protected
+      * return boolean True if the user can view the page,
otherwise false
+      *
+      */
+     protected function authorizedToView()
+     {
+         return true;
+     }
+ 
      /**
       * Constructor
***************
*** 40,43 ****
--- 70,92 ----
      }
      
+     
+     /**
+      * Returns the rewrite ID or the link ID in the case
one is available
+      *
+      * param unknown_type $link
+      * return unknown
+      * 
+      */
+     public function getRewriteId($link)
+     {
+         $item = $link->getGl2Item();
+         $rewriteId = $item->getRewriteId();
+         if (empty($rewriteId)) {
+             return $link->getLinkId();
+         } else {
+             return $rewriteId;
+         }
+     }
+     
      /**
       * Shows the login page.
***************
*** 54,57 ****
--- 103,121 ----
          // Show the page
          $this->setPageTitle('Geeklog 2: Links');
+         
+         $pageToGet = $_GET['page'];
+         if (empty($pageToGet)) {
+             $pageToGet = 1;
+         }
+         
+         $dao =
&Geeklog_DAO::singleton(Geeklog_Config::getValue('dao_o
ptions','link'));
+         $this->flexyElements['query'] = new
HTML_Template_Flexy_Element;        
+         if (!empty($_GET['query'])) {
+             $this->links =
$dao->find('getLinksByKeyword', array($_GET['query']
. '%', '%' . $_GET['query'] . '%'), $pageToGet,
$linkConf['links_per_page_admin']);
+            
$this->flexyElements['query']->setValue($_GET['quer
y']);    
+         } else {
+             $this->links = $dao->find('getLinks',
null, $pageToGet, $linkConf['links_per_page_admin']);     
  
+         }
+         
          $this->showHeader();
      	$this->flexyHandle->compile('Home.thtml');
***************
*** 59,62 ****
--- 123,141 ----
          $this->showFooter();
      }
+ 
+     /**
+      * Gets the number of links that will be displayed
+      *
+      * NOTE: this isn't the total number of pages
(remember, this can be paged).  This is the total
+      * on the current page.
+      * 
+      * author Tony Bibbs <tonygeeklog.net>
+      * return int number of links to display
+      * 
+      */
+     public function numLinks()
+     {
+     	return count($this->links);
+     }
  }
  

_______________________________________________
geeklog2-cvs mailing list
geeklog2-cvslists.geeklog.net
http://lists.geeklog.net/mailman/listinfo/geeklog2-cvs

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )