function farm_quantity_log in farmOS 7
Load all quantity logs that match certain criteria.
Parameters
string $measure: The quantity measure to search for (ie: weight).
string $label: The quantity label to search for.
int $start_time: Unix timestamp limiter. Only logs after this time will be included. Defaults to 0, which will not limit the logs at all.
int $end_time: Unix timestamp limiter. Only logs before this time will be included. Defaults to the current time. Set to 0 to load the absolute last.
bool|null $done: Whether or not to only show logs that are marked as "done". TRUE will limit to logs that are done, and FALSE will limit to logs that are not done. If this is set to NULL, no filtering will be applied. Defaults to TRUE.
string|null $type: The log type to filter by. If this is NULL, no filtering will be applied.
string $category: The log category to search for.
Return value
array Returns an array of log entities.
1 string reference to 'farm_quantity_log'
- farm_update_7040 in ./
farm.install - Enable new Farm Quantity Log module.
File
- modules/
farm/ farm_quantity/ farm_quantity_log/ farm_quantity_log.module, line 205 - Farm quantity log module.
Code
function farm_quantity_log($measure = NULL, $label = NULL, $start_time = 0, $end_time = REQUEST_TIME, $done = TRUE, $type = NULL, $category = NULL) {
// Make a query for loading quantity logs.
$query = farm_quantity_log_query($measure, $label, $start_time, $end_time, $done, $type, $category);
// Execute the query and gather the log ids.
$result = $query
->execute();
$log_ids = array();
foreach ($result as $row) {
if (!empty($row->id)) {
$log_ids[] = $row->id;
}
}
// If there are log IDs, load the logs.
if (!empty($log_ids)) {
return log_load_multiple($log_ids);
}
return array();
}