Exemple #1
0
 public static function getNodeIdFromDocId($lingotek_document_id)
 {
     list($id, $type) = LingotekSync::getEntityIdFromDocId($lingotek_document_id);
     return array($id, $type);
 }
 public static function resetNodeInfoByDocId($lingotek_document_id)
 {
     $doc_ids = is_array($lingotek_document_id) ? $lingotek_document_id : array($lingotek_document_id);
     $count = 0;
     foreach ($doc_ids as $doc_id) {
         $node_id = LingotekSync::getNodeIdFromDocId($doc_id);
         // grab before node info is removed
         LingotekSync::removeNodeInfoByDocId($doc_id);
         //remove locally (regardless of success remotely)
         if ($node_id !== FALSE) {
             LingotekSync::setNodeStatus($node_id, LingotekSync::STATUS_EDITED);
             $count++;
         }
     }
     return $count;
 }
 /**
  * Updates the content of an existing Lingotek document with the current node contents.
  *
  * @param stdClass $node
  *   A Drupal node object.
  *
  * @return bool
  *   TRUE on success, FALSE on failure.
  */
 public function updateContentDocument($node)
 {
     switch (get_class($node)) {
         case 'LingotekComment':
             // Comments have their own way to format the content.
             $document_id = $node->getMetadataValue('document_id');
             $content = $node->documentLingotekXML();
             break;
         default:
             // Normal content do the regular formating.
             $document_id = lingotek_lingonode($node->nid, 'document_id');
             $content = lingotek_xml_node_body($node);
             break;
     }
     $parameters = array('documentId' => $document_id, 'documentName' => $node->title, 'documentDesc' => $node->title, 'content' => $content, 'format' => $this->xmlFormat());
     $this->addAdvancedParameters($parameters, $node);
     $result = $this->request('updateContentDocument', $parameters);
     if ($result) {
         LingotekSync::setNodeAndTargetsStatus($node->nid, LingotekSync::STATUS_CURRENT, LingotekSync::STATUS_PENDING);
     }
     return $result ? TRUE : FALSE;
 }