You are here

function globallink_update_status in GlobalLink Connect for Drupal 7.5

Same name and namespace in other branches
  1. 7.7 globallink_background_jobs.inc \globallink_update_status()
  2. 7.6 globallink_node.inc \globallink_update_status()

Updates the translation status.

Parameters

object $globallink: The GlobalLink translation data.

4 calls to globallink_update_status()
globallink_auto_receive in ./globallink.module
Automatically receives translated contents.
globallink_dashboard_receive_submit in ./globallink_receive_translations.inc
Handles GlobalLink form submission.
globallink_get_translated_content in ./globallink_node.inc
Gets translated content.
globallink_update_deleted_records in ./globallink_node.inc
Updates deleted records.

File

./globallink_node.inc, line 519

Code

function globallink_update_status(&$globallink) {
  switch ($globallink->status) {
    case 'Source Deleted':
      $row = globallink_get_row_by_nid_and_locale($globallink->nid, $globallink->sourceLocale, $globallink->targetLocale);
      db_update('globallink_core')
        ->fields(array(
        'status' => 'Source Deleted',
        'document_ticket' => '',
        'submission_ticket' => '',
        'timestamp' => REQUEST_TIME,
      ))
        ->condition('rid', $row->rid, '=')
        ->execute();
      break;
    case 'Error':
      $row = globallink_get_row_by_nid_and_locale($globallink->nid, $globallink->sourceLocale, $globallink->targetLocale);
      db_update('globallink_core')
        ->fields(array(
        'status' => 'Error',
        'timestamp' => REQUEST_TIME,
      ))
        ->condition('rid', $row->rid, '=')
        ->execute();
      break;
    default:
      $row = globallink_get_row_by_nid_and_locale($globallink->nid, $globallink->sourceLocale, $globallink->targetLocale);
      $node = node_load($row->nid);
      if ($node->vid != $row->vid) {
        db_update('globallink_core')
          ->fields(array(
          'vid' => $node->vid,
          'title' => $node->title,
          'status' => 'Pending Translations',
          'timestamp' => REQUEST_TIME,
        ))
          ->condition('rid', $row->rid, '=')
          ->execute();
      }
      else {
        db_update('globallink_core')
          ->fields(array(
          'status' => 'Pending Translations',
          'timestamp' => REQUEST_TIME,
        ))
          ->condition('rid', $row->rid, '=')
          ->execute();
      }
  }
}