Exemple #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);
}
Exemple #2
0
 public function getAllRuleDataFiles($where = '')
 {
     $count_str = "SELECT RDF.DataFileID,COUNT(RD.RuleDataID),\n                  RDF.DataFileName,RF.RuleFileName,RDF.Deleted from rule_data_files RDF\n                  LEFT JOIN rule_files RF ON (RF.RuleFileID=RDF.RuleFileID AND RF.Deleted=0)\n                  LEFT JOIN rule_data RD ON (RD.DataFileID=RDF.DataFileID AND RD.Deleted=0)\n                  WHERE 1 {$where} GROUP BY RDF.DataFileID";
     $result = $this->dbh->query($count_str);
     if (PEAR::isError($result)) {
         echo $result->getMessage() . ' - ' . $result->getUserinfo();
         exit;
     }
     $array = $result->fetchAll();
     $result->free();
     $rule_dfiles_a = array();
     foreach ($array as $rd) {
         $rule_dfile = new Rule();
         $rule_dfile->setDataFileID($rd[0]);
         $rule_dfile->setRuleDataCount($rd[1]);
         $rule_dfile->setDataFileName($rd[2]);
         $rule_dfile->setRuleFileName($rd[3]);
         $rule_dfile->setDataFileActive($rd[4]);
         $rule_dfiles_a[] = $rule_dfile;
     }
     return $rule_dfiles_a;
 }