You are here

function book_copy_explain in Book Copy 6

1 string reference to 'book_copy_explain'
book_copy_menu in ./book_copy.module
implementation of hook_menu

File

./book_copy.module, line 476

Code

function book_copy_explain($book, $subtree = 0) {
  $table = array();
  $output = '';
  if (book_copy_can_copy($book->book['bid'], $subtree, $data)) {
    if ($subtree != 0) {
      $output = t('You can copy this sub-section of the book.');
    }
    else {
      $output = t('You can copy this book.');
    }
  }
  else {
    if ($subtree != 0) {
      $output = t('You cannot copy this sub-section of the book. ');
    }
    else {
      $output = t('You cannot copy this book. ');
    }
    $output .= t('In order to copy this book the following issue(s) must be addressed. Please contact your site administrator for help.');
  }
  $table['headers'] = $data['headers'];
  unset($data['headers']);
  $table['rows'] = array();
  foreach ($data as $nid => $column) {
    $row = array();
    $hide = TRUE;
    foreach ($table['headers'] as $key => $header) {
      if ($column[$key]['status'] === FALSE) {
        $row['data'][] = t('N(%message)', array(
          '%message' => $column[$key]['message'],
        ));
        $hide = FALSE;
      }
      elseif ($column[$key]['status'] === TRUE) {
        $row['data'][] = t('Y');
      }
      else {
        $row['data'][] = $column[$key];
      }
    }
    if (!$hide) {
      $table['rows'][] = $row;
    }
  }
  if (!empty($table['rows'])) {
    $output .= theme_table($table['headers'], $table['rows']);
  }
  return $output;
}