/** * Restrict the query by these fields. * @param QUERY $query The query to which to apply parameters. * @param stdClass $obj The object from which to extract parameters. */ public function apply_to_query($query, $obj) { parent::apply_to_query($query, $obj); $kinds = $this->app->display_options->entry_kinds(); if (sizeof($obj->parameters['kind']) == sizeof($kinds)) { if ($obj->parameters['not_kind']) { $query->restrict('0'); } } else { if (sizeof($obj->parameters['kind']) == 0) { if (!$obj->parameters['not_kind']) { $query->restrict('0'); } } else { if ($obj->parameters['not_kind']) { $operator = Operator_not_in; } else { $operator = Operator_in; } $query->restrict_by_op('entry.kind', $obj->parameters['kind'], $operator); } } }
/** * Restrict the query by these fields. * @param QUERY $query The query to which to apply parameters. * @param object $obj The object from which to extract parameters. */ public function apply_to_query($query, $obj) { parent::apply_to_query($query, $obj); if ($obj->parameters['colder_than'] != '') { $query->restrict('jrnl.hi_temp < ' . $obj->parameters['colder_than']); } if ($obj->parameters['warmer_than'] != '') { $query->restrict('jrnl.lo_temp > ' . $obj->parameters['warmer_than']); } if ($obj->parameters['weather_type'] != '') { if ($obj->parameters['not_weather_type']) { $operator = Operator_not_in; } else { $operator = Operator_in; } $query->restrict_by_op('jrnl.weather_type', $obj->parameters['weather_type'], $operator); } }