You are here

public function LingotekPhase::canBeMarkedComplete in Lingotek Translation 7.5

Same name and namespace in other branches
  1. 7.7 lib/Drupal/lingotek/LingotekPhase.php \LingotekPhase::canBeMarkedComplete()
  2. 7.2 lib/Drupal/lingotek/LingotekPhase.php \LingotekPhase::canBeMarkedComplete()
  3. 7.3 lib/Drupal/lingotek/LingotekPhase.php \LingotekPhase::canBeMarkedComplete()
  4. 7.4 lib/Drupal/lingotek/LingotekPhase.php \LingotekPhase::canBeMarkedComplete()
  5. 7.6 lib/Drupal/lingotek/LingotekPhase.php \LingotekPhase::canBeMarkedComplete()

Determines whether or not the current phase is eligible to be marked as complete.

Return value

bool TRUE if the phase can be marked as complete. FALSE otherwise.

File

lib/Drupal/lingotek/LingotekPhase.php, line 81
Defines LingotekPhase.

Class

LingotekPhase
A class representing a Lingotek Workflow Phase.

Code

public function canBeMarkedComplete() {
  $result = FALSE;

  // These phase types need to be at 100% complete in order to
  // be eligible for mark as complete.
  $needs_100_complete_phase_types = array(
    'TRANSLATION',
    'REVIEW',
  );
  if (in_array($this->phase->type, $needs_100_complete_phase_types)) {
    if ($this->phase->percentComplete == 100 && !$this->phase->isMarkedComplete) {
      $result = TRUE;
    }
  }
  elseif (!$this->phase->isMarkedComplete) {

    // All other phase types should be able to be marked as complete regardless
    // of completion percentage.
    $result = TRUE;
  }
  return $result;
}