function video_block_list in Video 6
Same name and namespace in other branches
- 5 video.module \video_block_list()
- 6.2 video.module \video_block_list()
Query DB for block content
Parameters
$delta: int 0, 1, 2, or 3. Determines which type of block is being accessed.
Return value
string HTML content for a block
1 call to video_block_list()
- video_block in ./
video.module - Hook block. Does all the interaction with the drupal block system. Uses video_block_list() for DB queries.
File
- ./
video.module, line 957 - video.module
Code
function video_block_list($delta = 0) {
$count = variable_get("video_block_limit_{$delta}", 10);
switch ($delta) {
case 0:
$orderby = 'n.created';
break;
case 1:
$orderby = 'v.download_counter + v.play_counter';
break;
case 2:
$orderby = 'v.play_counter';
break;
case 3:
$orderby = 'v.download_counter';
break;
case 4:
$count = 1;
$orderby = 'RAND()';
break;
}
return node_title_list(db_query_range(db_rewrite_sql("SELECT n.nid, n.title, {$orderby} FROM {node} n INNER JOIN {video} v ON n.vid = v.vid WHERE n.type = 'video' AND n.status = 1 AND n.moderate = 0 ORDER BY {$orderby} DESC"), 0, $count));
}