system/classes/searchcriteria.class.php
branchHEAD
changeset 7398 e1700815379b
parent 7387 39932e68c099
child 7660 3f3700aee0c2
     1.1 --- a/system/classes/searchcriteria.class.php	Sun Oct 18 02:05:53 2009 +0100
     1.2 +++ b/system/classes/searchcriteria.class.php	Thu Oct 29 13:01:33 2009 +0100
     1.3 @@ -2,7 +2,7 @@
     1.4  
     1.5  /* Reminder: always indent with 4 spaces (no tabs). */
     1.6  // +---------------------------------------------------------------------------+
     1.7 -// | Geeklog 1.6                                                               |
     1.8 +// | Geeklog 1.6.1                                                             |
     1.9  // +---------------------------------------------------------------------------+
    1.10  // | searchcriteria.class.php                                                  |
    1.11  // |                                                                           |
    1.12 @@ -41,7 +41,10 @@
    1.13      var $_url_rewrite;
    1.14      var $_append_query;
    1.15      var $_results = array();
    1.16 +    var $_callback_func = '';
    1.17 +    var $_total_results = 0;
    1.18  
    1.19 +    // CONSTRUCTOR
    1.20      function SearchCriteria( $pluginName, $pluginLabel )
    1.21      {
    1.22          $this->_pluginName = $pluginName;
    1.23 @@ -49,16 +52,18 @@
    1.24          $this->_rank = 3;
    1.25          $this->_url_rewrite = false;
    1.26          $this->_append_query = true;
    1.27 +        $this->_total_results = 0;
    1.28      }
    1.29  
    1.30 -    function setSQL( $sql )
    1.31 +    // GENERAL METHODS
    1.32 +    function getName()
    1.33      {
    1.34 -        $this->_sql = $sql;
    1.35 +        return $this->_pluginName;
    1.36      }
    1.37  
    1.38 -    function setFTSQL( $ftsql )
    1.39 +    function getLabel()
    1.40      {
    1.41 -        $this->_ftsql = $ftsql;
    1.42 +        return $this->_pluginLabel;
    1.43      }
    1.44  
    1.45      function setRank( $rank )
    1.46 @@ -81,33 +86,6 @@
    1.47          $this->_results = $result_arr;
    1.48      }
    1.49  
    1.50 -    function getSQL()
    1.51 -    {
    1.52 -        return $this->_sql;
    1.53 -    }
    1.54 -
    1.55 -    function getFTSQL()
    1.56 -    {
    1.57 -        global $_DB_dbms;
    1.58 -
    1.59 -        // When only one SQL statment is set we assume it is for MySQL
    1.60 -        if ($this->_ftsql != '' && (is_string($this->_ftsql) && $_DB_dbms == 'mysql') || is_array($this->_ftsql)) {
    1.61 -            return $this->_ftsql;
    1.62 -        } else {
    1.63 -            return '';
    1.64 -        }
    1.65 -    }
    1.66 -
    1.67 -    function getName()
    1.68 -    {
    1.69 -        return $this->_pluginName;
    1.70 -    }
    1.71 -
    1.72 -    function getLabel()
    1.73 -    {
    1.74 -        return $this->_pluginLabel;
    1.75 -    }
    1.76 -
    1.77      function getRank()
    1.78      {
    1.79          return $this->_rank;
    1.80 @@ -128,6 +106,55 @@
    1.81          return $this->_results;
    1.82      }
    1.83  
    1.84 +    // CALLBACK METHODS
    1.85 +    function setCallback( $func )
    1.86 +    {
    1.87 +        $this->_callback_func = $func;
    1.88 +    }
    1.89 +
    1.90 +    function getCallback()
    1.91 +    {
    1.92 +        return $this->_callback_func;
    1.93 +    }
    1.94 +
    1.95 +    function setTotal( $total_results )
    1.96 +    {
    1.97 +        $this->_total_results = $total_results;
    1.98 +    }
    1.99 +
   1.100 +    function getTotal()
   1.101 +    {
   1.102 +        return $this->_total_results;
   1.103 +    }
   1.104 +
   1.105 +    // SQL METHODS
   1.106 +    function setSQL( $sql )
   1.107 +    {
   1.108 +        $this->_sql = $sql;
   1.109 +    }
   1.110 +
   1.111 +    function setFTSQL( $ftsql )
   1.112 +    {
   1.113 +        $this->_ftsql = $ftsql;
   1.114 +    }
   1.115 +
   1.116 +    function getSQL()
   1.117 +    {
   1.118 +        return $this->_sql;
   1.119 +    }
   1.120 +
   1.121 +    function getFTSQL()
   1.122 +    {
   1.123 +        global $_DB_dbms;
   1.124 +
   1.125 +        // When only one SQL statment is set we assume it is for MySQL
   1.126 +        if ($this->_ftsql != '' && (is_string($this->_ftsql) && $_DB_dbms == 'mysql') || is_array($this->_ftsql)) {
   1.127 +            return $this->_ftsql;
   1.128 +        } else {
   1.129 +            return '';
   1.130 +        }
   1.131 +    }
   1.132 +
   1.133      function buildSearchSQL( $keyType, $query, $columns, $sql = '' )
   1.134      {
   1.135          if ($keyType == 'all')
   1.136 @@ -208,7 +235,7 @@
   1.137              }
   1.138          }
   1.139  
   1.140 -        return "";
   1.141 +        return '';
   1.142      }
   1.143  }
   1.144