Example #1
0
function rule_data_file_insert($post, $db)
{
    $new_rule_data_file = new Rule();
    $new_rule_data_file->setDataFileName($post['rdf_name']);
    $new_rule_data_file->setRuleFileID($post['rf_filter']);
    $new_rule_data_file->setDataFileActive($post['validity']);
    $new_rule_data_file->setFilled(true);
    $db->addRuleDataFiles($new_rule_data_file);
}
Example #2
0
 public function getAllRuleDatas($where = '', $wlimit = '')
 {
     $count_str = "SELECT RD.RuleDataID,RD.DataFileID,RDF.DataFileName,\n                  RD.RuleData,RD.Deleted\n                  FROM rule_data RD\n                  LEFT JOIN rule_data_files RDF ON (RDF.DataFileID=RD.DataFileID)\n                  WHERE 1 {$where} ORDER BY RD.RuleDataID DESC {$wlimit}";
     $result = $this->dbh->query($count_str);
     if (PEAR::isError($result)) {
         echo $result->getMessage() . ' - ' . $result->getUserinfo();
         exit;
     }
     $array = $result->fetchAll();
     $result->free();
     $rules_da = array();
     foreach ($array as $rd) {
         $rule_data = new Rule();
         $rule_data->setRuleDataID($rd[0]);
         $rule_data->setDataFileID($rd[1]);
         $rule_data->setDataFileName($rd[2]);
         $rule_data->setRuleData($rd[3]);
         $rule_data->setRuleDataActive($rd[4]);
         $rules_da[] = $rule_data;
     }
     return $rules_da;
 }