2 // Copyright (C) 2010-2011 Aron Racho <aron@mi-squred.com>
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
10 * Description of RuleCriteriaDatabaseCustom
14 class RuleCriteriaDatabaseCustom
extends RuleCriteria
21 var $frequencyComparator;
32 $this->table
= $table;
33 $this->column
= $column;
34 $this->valueComparator
= $valueComparator;
35 $this->value
= $value;
36 $this->frequencyComparator
= $frequencyComparator;
37 $this->frequency
= $frequency;
40 function getRequirements()
44 $requirements .= xl("Value") . ": ";
45 $requirements .= $this->decodeComparator($this->valueComparator
) . " " . $this->value
;
46 $requirements .= " | ";
49 $requirements .= xl("Frequency") . ": ";
50 $requirements .= $this->decodeComparator($this->frequencyComparator
) . " " . $this->frequency
;
57 return xl($this->table
) . "." . xl($this->column
);
65 function getTableNameOptions()
68 $stmts = sqlStatement("SHOW TABLES");
69 for ($iter=0; $row=sqlFetchArray($stmts); $iter++
) {
70 foreach ($row as $key => $value) {
71 array_push($options, array( "id" => out($value), "label" => out(xl($value)) ));
80 $dbView = parent
::getDbView();
82 $dbView->method
= "database";
83 $dbView->methodDetail
= "";
86 . $this->table
. "::" . $this->column
. "::"
87 . $this->valueComparator
. "::" . $this->value
. "::"
88 . $this->frequencyComparator
. "::" . $this->frequency
;
92 function updateFromRequest()
94 parent
::updateFromRequest();
96 $this->table
= _post("fld_table");
97 $this->column
= _post("fld_column");
98 $this->value
= _post("fld_value");
99 $this->valueComparator
= _post("fld_value_comparator");
100 $this->frequency
= _post("fld_frequency");
101 $this->frequencyComparator
= _post("fld_frequency_comparator");