Minahito
minah****@users*****
2006年 1月 11日 (水) 19:17:29 JST
Index: xoops2jp/html/class/criteria.php diff -u xoops2jp/html/class/criteria.php:1.2.8.3 xoops2jp/html/class/criteria.php:1.2.8.4 --- xoops2jp/html/class/criteria.php:1.2.8.3 Wed Oct 19 02:15:05 2005 +++ xoops2jp/html/class/criteria.php Wed Jan 11 19:17:29 2006 @@ -1,5 +1,5 @@ <?php -// $Id: criteria.php,v 1.2.8.3 2005/10/18 17:15:05 minahito Exp $ +// $Id: criteria.php,v 1.2.8.4 2006/01/11 10:17:29 minahito Exp $ // ------------------------------------------------------------------------ // // XOOPS - PHP Content Management System // // Copyright (c) 2000 XOOPS.org // @@ -44,6 +44,12 @@ * @copyright copyright (c) 2000-2003 XOOPS.org */ +define('XOOPS_CRITERIA_ASC', 'ASC'); +define('XOOPS_CRITERIA_DESC', 'DESC'); +define('XOOPS_CRITERIA_STARTWITH', 1); +define('XOOPS_CRITERIA_ENDWITH', 2); +define('XOOPS_CRITERIA_CONTAIN', 3); + /** * A criteria (grammar?) for a database query. * @@ -127,7 +133,10 @@ */ function setOrder($order) { - if ('DESC' == strtoupper($order)) { + if (strtoupper($order) == 'ASC') { + $this->order = 'ASC'; + } + elseif (strtoupper($order) == 'DESC') { $this->order = 'DESC'; } } @@ -174,6 +183,7 @@ /** * @param string $group + * @deprecated */ function setGroupby($group){ $this->groupby = $group; @@ -181,6 +191,7 @@ /** * @return string + * @deprecated */ function getGroupby(){ return ' GROUP BY '.$this->groupby; @@ -263,6 +274,7 @@ * Make the criteria into a SQL "WHERE" clause * * @return string + * @deprecated */ function renderWhere() { @@ -276,6 +288,7 @@ * * @return string * @author Nathan Dial ndial****@trill***** + * @deprecated */ function renderLdap(){ $retval = ''; @@ -317,6 +330,8 @@ var $column; var $operator; var $value; + + var $dtype = 0; /** * Constructor @@ -329,8 +344,20 @@ $this->prefix = $prefix; $this->function = $function; $this->column = $column; - $this->value = $value; $this->operator = $operator; + + // + // Recive DTYPE. This is a prolongation of criterion life operation. + // + if (is_array($value) && count($value)==2) + { + $this->dtype = intval($value[0]); + $this->value = $value[1]; + } + else + { + $this->value = $value; + } } /** @@ -352,12 +379,13 @@ $clause .= " {$this->operator} $value"; return $clause; } - + /** * Generate an LDAP filter from criteria * * @return string * @author Nathan Dial ndial****@trill***** + * @deprecated */ function renderLdap(){ $clause = "(" . $this->column . $this->operator . $this->value . ")"; @@ -368,6 +396,7 @@ * Make a SQL "WHERE" clause * * @return string + * @deprecated */ function renderWhere() { $cond = $this->render();