Ejemplo n.º 1
0
 function launch()
 {
     global $interface;
     global $configArray;
     $results = array();
     $epubFile = new EContentItem();
     $currentPage = isset($_REQUEST['page']) ? $_REQUEST['page'] : 1;
     $recordsPerPage = 25;
     $searchUrl = $configArray['Site']['path'] . '/EContent/Search';
     $searchParams = array();
     foreach ($_REQUEST as $key => $value) {
         if (!in_array($key, array('module', 'action', 'page'))) {
             $searchParams[] = "{$key}={$value}";
         }
     }
     $searchUrl = $searchUrl . '?page=%d&' . implode('&', $searchParams);
     $interface->assign('page', $currentPage);
     $epubFile = new EContentRecord();
     if (isset($_REQUEST['sortOptions'])) {
         $epubFile->orderBy($_REQUEST['sortOptions']);
         $interface->assign('sort', $_REQUEST['sortOptions']);
     }
     $numTotalFiles = $epubFile->count();
     $epubFile->limit(($currentPage - 1) * $recordsPerPage, 20);
     $epubFile->find();
     if ($epubFile->N > 0) {
         while ($epubFile->fetch()) {
             $results[] = clone $epubFile;
         }
     }
     $interface->assign('results', $results);
     $options = array('totalItems' => $numTotalFiles, 'fileName' => $searchUrl, 'perPage' => $recordsPerPage);
     $pager = new VuFindPager($options);
     $interface->assign('pageLinks', $pager->getLinks());
     $interface->setTemplate('search.tpl');
     $interface->display('layout.tpl');
 }