You are here

function lingotek_pm in Lingotek Translation 7.3

Same name and namespace in other branches
  1. 7.7 lingotek.page.inc \lingotek_pm()
  2. 7.2 lingotek.page.inc \lingotek_pm()
  3. 7.4 lingotek.page.inc \lingotek_pm()
  4. 7.5 lingotek.page.inc \lingotek_pm()
  5. 7.6 lingotek.page.inc \lingotek_pm()

Page callback for the Lingotek local task on node detail pages.

Construct the table summarizing information a Product Manager would want to know about the progress of the translations.

Return value

array A Drupal render array of the page contents.

1 string reference to 'lingotek_pm'
lingotek_menu in ./lingotek.module
Implements hook_menu().

File

./lingotek.page.inc, line 311
Lingotek Tab for Nodes

Code

function lingotek_pm($node) {

  // Display all of the appropriate node management sections (e.g., Upload, Download, Publish)
  $output = array();
  if (class_exists('LingotekDocument')) {
    $document = LingotekDocument::load(lingotek_lingonode($node->nid, 'document_id'));
    if (lingotek_supported_type($node->type) && Lingotek::isSupportedLanguage($node->language)) {
      $node_pushed = lingotek_node_pushed($node);
      $node_auto_upload = lingotek_lingonode($node->nid, 'create_lingotek_document');
      if (!$node_pushed || !$node_auto_upload) {
        $content_push_form = drupal_get_form('lingotek_push_form', $node);
        $output['content_push'] = array(
          '#markup' => drupal_render($content_push_form),
        );
      }
      if ($node_pushed) {
        $download_form = drupal_get_form('lingotek_download_translations_form', $node, $document);
        $output[] = array(
          '#markup' => drupal_render($download_form),
        );

        // Add the mark as complete table if there are complete-eligible phrases.
        if ($document
          ->hasPhasesToComplete()) {
          $drupal_phase_complete_from = drupal_get_form('lingotek_mark_phases_complete', $node, $document);
          $output['mark_complete'] = array(
            '#markup' => drupal_render($drupal_phase_complete_from),
          );
        }
        $lingotek_advanced_parsing_form = drupal_get_form('lingotek_advanced_parsing_upgrade_form');
        $output['upgrade_form'] = array(
          '#markup' => drupal_render($lingotek_advanced_parsing_form),
        );
        $reset_translations_form = drupal_get_form('lingotek_node_content_reset_form', $node);
        $output['reset_translations'] = array(
          '#markup' => drupal_render($reset_translations_form),
        );
      }
    }
    else {
      $output[] = array(
        '#markup' => '<p class="help">' . t('This node is not compatible with Lingotek translation. Either it is not a Lingotek tranlsation-enabled content type or the node does not have a defined language.') . '</p>',
      );
    }

    // Publish form
    $output['publish_form'] = drupal_get_form('lingotek_publish_form', $node);
  }
  return $output;
}