public function getValidBlockItems(Block $block)
{
$dbHandler = $this->getConnection();
$q = $dbHandler->createSelectQuery();
$q->select('object_id, ezm_pool.node_id, ezm_pool.priority, ts_publication, ts_visible, rotation_until, moved_to')->from($dbHandler->quoteTable('ezm_pool'))->innerJoin($dbHandler->quoteTable('ezcontentobject_tree'), $q->expr->eq('ezcontentobject_tree.node_id', 'ezm_pool.node_id'))->where($q->expr->eq('block_id', $q->bindValue($block->id)), $q->expr->gt('ts_visible', $q->bindValue(0, null, PDO::PARAM_INT)), $q->expr->eq('ts_hidden', $q->bindValue(0, null, PDO::PARAM_INT)))->orderBy('priority', SelectQuery::DESC);
$stmt = $q->prepare();
$stmt->execute();
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
$items = array();
foreach ($rows as $row) {
$items[] = $this->buildBlockItem($row + array('block_id' => $block->id, 'ts_hidden' => 0));
}
return $items;
}