[ Index ]
 

Code source de LifeType 1.2.4

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/class/view/admin/ -> adminlinkslistview.class.php (source)

   1  <?php
   2  
   3      lt_include( PLOG_CLASS_PATH."class/view/admin/admintemplatedview.class.php" );
   4      lt_include( PLOG_CLASS_PATH."class/dao/mylinks.class.php" );
   5      lt_include( PLOG_CLASS_PATH."class/dao/mylinkscategories.class.php" );    
   6      lt_include( PLOG_CLASS_PATH."class/data/pager/pager.class.php" );    
   7  
   8      /**
   9       * \ingroup View
  10       * @private
  11       *    
  12       * Shows a list with all the links in the site, also filtering by category
  13       */
  14      class AdminLinksListview extends AdminTemplatedView 
  15      {
  16          var $_page;
  17  
  18          /**
  19           * Constructor. If nothing else, it also has to call the constructor of the parent
  20           * class, BlogAction with the same parameters
  21           */
  22          function AdminLinksListview( $blogInfo, $params = Array())
  23          {        
  24              $this->AdminTemplatedView( $blogInfo, "editlinks" );
  25              
  26              // save the parameters and put them in a nicer place after checking them
  27              if( !isset( $params["showOrder"] ) ) $params["showOrder"] = MYLINKS_CATEGORIES_NO_ORDER;
  28              if( !isset( $params["showCategory"] ) ) $params["showCategory"] = 0;
  29              if( !isset( $params["searchTerms"] ) ) $params["searchTerms"] = "";
  30              
  31              $this->setValue( "showOrder", $params["showOrder"] );
  32              $this->setValue( "showCategory", $params["showCategory"] );
  33              $this->setValue( "searchTerms", $params["searchTerms"] );
  34              $this->_page = $this->getCurrentPageFromRequest();
  35          }
  36  
  37          /**
  38           * Carries out the specified action
  39           */
  40          function render()
  41          {
  42              // get the parameters
  43              $order = $this->getValue( "showOrder" );
  44              $categoryId = $this->getValue( "showCategory");            
  45              $searchTerms = $this->getValue( "searchTerms" );
  46              // get all the links and throw the event
  47              $links = new MyLinks();
  48              $blogLinks = $links->getLinks( $this->_blogInfo->getId(), 
  49                                             $categoryId,
  50                                             $searchTerms,
  51                                             $this->_page,
  52                                             DEFAULT_ITEMS_PER_PAGE );
  53              $this->notifyEvent( EVENT_LINKS_LOADED, Array( "links" => &$blogLinks ));
  54              // get the number of links
  55              $numLinks = $links->getNumLinks( $this->_blogInfo->getId(), $categoryId );
  56              // get all the link categories but we have to respect the order that the user asked
  57              $linkCategories = new MyLinksCategories();
  58              $blogLinkCategories = $linkCategories->getMyLinksCategories( $this->_blogInfo->getId(), $order );
  59              $this->notifyEvent( EVENT_LINK_CATEGORIES_LOADED, Array ( "linkcategories" => &$blogLinkCategories ));
  60              
  61              // prepare the pager
  62              $pager = new Pager( "?op=editLinks&amp;showCategory={$categoryId}&amp;searchTerms={$searchTerms}&amp;page=",
  63                                  $this->_page,
  64                                  $numLinks,
  65                                  DEFAULT_ITEMS_PER_PAGE );
  66  
  67              // put the data in the view
  68              $this->setValue( "links", $blogLinks );
  69              $this->setValue( "linkscategories", $blogLinkCategories );
  70              $this->setValue( "currentcategory", $categoryId );
  71              $this->setValue( "searchTerms", $searchTerms );
  72              $this->setValue( "pager", $pager );
  73          
  74              parent::render();
  75          }
  76      }
  77  ?>


Généré le : Mon Nov 26 21:04:15 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics