示例#1
0
 /**
  * Overwrites base __construct method and sets $page and $rpp variables
  */
 public function __construct($class, $maxPerPage = null)
 {
     $request = sfContext::getInstance()->getRequest();
     if ($request->isXmlHttpRequest()) {
         if (!$maxPerPage) {
             $maxPerPage = $request->getParameter('limit', $this->default_maxPerPage);
             if (!preg_match('/^[1-9][0-9]+$/', $maxPerPage)) {
                 $maxPerPage = $this->default_maxPerPage;
             }
         }
         $page = $request->getParameter('start', 0) / $maxPerPage + 1;
     } else {
         if (!$maxPerPage) {
             $maxPerPage = $this->default_maxPerPage;
             if (!preg_match('/^[1-9][0-9]+$/', $maxPerPage)) {
                 $maxPerPage = $this->default_maxPerPage;
             }
         }
         $page = $request->getParameter('page', 1);
     }
     $this->setPage($page);
     parent::__construct($class, $maxPerPage);
 }
 /**
  * Constructor
  * @param object         $class
  * @param integer        $maxPerPage
  * @param sfSphinxClient $sphinx
  */
 public function __construct($class, $maxPerPage = 10, sfSphinxClient $sphinx)
 {
     parent::__construct($class, $maxPerPage);
     $this->sphinx = $sphinx;
 }
 /**
  * __construct
  *
  * @return void
  */
 public function __construct($class, $defaultMaxPerPage = 10)
 {
     parent::__construct($class, $defaultMaxPerPage);
     $this->setFinder(sfPropelFinder::from($class));
 }