public static function setNodeAndTargetsStatus($node_id, $node_status, $targets_status)
 {
     // Set the Node to EDITED.
     self::setNodeStatus($node_id, $node_status);
     // Loop though each target language, and set that target to EDITED.
     $languages = lingotek_get_target_locales();
     foreach ($languages as $lingotek_locale) {
         self::setTargetStatus($node_id, $lingotek_locale, $targets_status);
     }
 }
示例#2
0
 public static function getDownloadableReport()
 {
     $document_ids = array_unique(array_merge(self::getConfigDocIdsByStatus(self::STATUS_PENDING), self::getConfigDocIdsByStatus(self::STATUS_READY)));
     $report = array('download_targets_workflow_complete' => array(), 'download_targets_workflow_complete_count' => 0, 'download_workflow_complete_targets' => array(), 'download_targets_workflow_incomplete' => array(), 'download_targets_workflow_incomplete_count' => 0, 'download_workflow_incomplete_targets' => array());
     if (empty($document_ids)) {
         return $report;
     }
     // if no documents are PENDING, then no need to make the API call.
     $response = lingotek_update_config_progress($document_ids);
     $locales = lingotek_get_target_locales();
     foreach ($document_ids as $document_id) {
         if (!$document_id) {
             continue;
         }
         foreach ($locales as $locale) {
             if (isset($response->byDocumentIdAndTargetLocale->{$document_id}->{$locale})) {
                 $target_status = self::getTargetStatus($document_id, $locale);
                 $doc_target = array('document_id' => $document_id, 'locale' => $locale, 'percent_complete' => $response->byDocumentIdAndTargetLocale->{$document_id}->{$locale});
                 if ($target_status == self::STATUS_READY) {
                     $report['download_targets_workflow_complete'][] = $doc_target;
                     $report['download_targets_workflow_complete_count']++;
                 } elseif ($target_status == self::STATUS_PENDING) {
                     $report['download_targets_workflow_incomplete'][] = $doc_target;
                     $report['download_targets_workflow_incomplete_count']++;
                 }
             }
         }
     }
     return $report;
 }