You are here

function print_pdf_block_view in Printer, email and PDF versions 7

Same name and namespace in other branches
  1. 7.2 print_pdf/print_pdf.module \print_pdf_block_view()

Implements hook_block_view().

File

print_pdf/print_pdf.module, line 172
Displays Printer-friendly versions of Drupal pages.

Code

function print_pdf_block_view($delta = 0) {
  $block = array();
  switch ($delta) {
    case 'print_pdf-top':
      $block['subject'] = t('Most PDFd');
      $result = db_query_range("SELECT path FROM {print_pdf_page_counter} LEFT JOIN {node} n ON path = CONCAT('node/', n.nid) WHERE status <> 0 OR status IS NULL ORDER BY totalcount DESC", 0, 3)
        ->fetchAll();
      if (count($result)) {
        $block['content'] = '<div class="item-list"><ul>';
        foreach ($result as $obj) {
          $block['content'] .= '<li>' . l(_print_get_title($obj->path), $obj->path) . '</li>';
        }
        $block['content'] .= '</ul></div>';
      }
      break;
  }
  return $block;
}