function addFieldRule(&$group, &$field, &$logic, &$values, $type = 0)
{
global $pommo;
$dbo =& Pommo::$_dbo;
$type = $type == 'or' ? 1 : 0;
// remove previous filters
Pommo_Rules::deleteRule($group, $field, $logic);
// get the field
require_once Pommo::$_baseDir . 'classes/Pommo_Fields.php';
$field = current(Pommo_Fields::get(array('id' => $field)));
foreach ($values as $value) {
// if this is a date type field, convert the values from human readable date
// strings to timestamps appropriate for matching
if ($field['type'] == 'date') {
$value = Pommo_Helper::timeFromStr($value);
}
$v[] = $dbo->prepare("(%i,%i,'%s','%s',%i)", array($group, $field['id'], $logic, $value, $type));
}
$query = "\n\t\t\tINSERT INTO " . $dbo->table['group_rules'] . "\n\t\t\t(group_id, field_id, logic, value, type)\n\t\t\tVALUES " . implode(',', $v);
return $dbo->affected($query);
}