function votingapi_votingapi_storage_select_votes in Voting API 7.2
Same name and namespace in other branches
- 6.2 votingapi.module \votingapi_votingapi_storage_select_votes()
Implements of hook_votingapi_storage_select_votes().
File
- ./
votingapi.module, line 267 - A generalized voting API for Drupal.
Code
function votingapi_votingapi_storage_select_votes($criteria, $limit) {
$query = db_select('votingapi_vote')
->fields('votingapi_vote');
foreach ($criteria as $key => $value) {
if ($key == 'timestamp') {
$query
->condition($key, $value, '>');
}
else {
$query
->condition($key, $value, is_array($value) ? 'IN' : '=');
}
}
if (!empty($limit)) {
$query
->range(0, $limit);
}
return $query
->execute()
->fetchAll(PDO::FETCH_ASSOC);
}