/**
     * Class Constructor
     *
     * @param   object  $obj_db
     * @param   integer	$int_num_show
     */
    public function __construct($obj_db, $int_num_show)
    {
        parent::__construct($obj_db, $int_num_show);
        if (!class_exists('SphinxClient')) {
            throw new Exception('SPHINX API Library is not installed yet!');
        } else {
            $this->sphinx = new SphinxClient();
            // check searchd status
            $_sphinx_status = $this->sphinx->Status();
            if (!$_sphinx_status) {
                throw new Exception('SPHINX Server is not running! Please
			      check if it already configured correctly.');
            }
            // defaults
            $this->options['mode'] = SPH_MATCH_EXTENDED2;
            $this->options['ranker'] = SPH_RANK_PROXIMITY_BM25;
            // get page number from http get var
            if (!isset($_GET['page']) or $_GET['page'] < 1) {
                $_page = 1;
            } else {
                $_page = (int) $_GET['page'];
            }
            $this->current_page = $_page;
            // count the row offset
            if ($this->current_page <= 1) {
                $_offset = 0;
            } else {
                $this->offset = $this->current_page * $this->num2show - $this->num2show;
            }
        }
    }
 /**
  * Class Constructor
  *
  * @param   object  $obj_db
  * @param   integer	$int_num_show
  */
 public function __construct($obj_db, $int_num_show)
 {
     parent::__construct($obj_db, $int_num_show);
     if (!class_exists('MongoClient')) {
         throw new Exception('PHP Mongodb extension library is not installed yet!');
     } else {
         $Mongo = new MongoClient();
         // select database
         $this->Biblio = $Mongo->slims->biblio;
         // get page number from http get var
         if (!isset($_GET['page']) or $_GET['page'] < 1) {
             $_page = 1;
         } else {
             $_page = (int) $_GET['page'];
         }
         $this->current_page = $_page;
         // count the row offset
         if ($this->current_page <= 1) {
             $_offset = 0;
         } else {
             $this->offset = $this->current_page * $this->num2show - $this->num2show;
         }
     }
 }
예제 #3
0
 /**
  * Class Constructor
  *
  * @param   object  $obj_db
  * @param   integer	$int_num_show
  */
 public function __construct($obj_db, $int_num_show)
 {
     parent::__construct($obj_db, $int_num_show);
 }