Ejemplo n.º 1
0
 }
 // If targeted Folio folder ID and list of local .folio file names are given.
 if ($folio_id && $filenames) {
     // If this is not the first time uploading, delete existing HTML articles.
     if ($status == 'Uploaded') {
         // Pull article metadata from designated Folio folder in Folio Producer.
         $articles = $fp->articles($folio_id);
         $articles = $articles['articles'];
         for ($n = 0; $n < count($articles); $n++) {
             // If article is HTML base?
             if (strstr($articles[$n]['articleMetadata']['tags'], 'DPSBridge')) {
                 // Delete the article from Folio folder in the Folio Producer.
                 $fp->deleteArticle($folio_id, $articles[$n]['id']);
             } else {
                 // Reset non-Drupal article's sort number.
                 $fp->updateArticle($folio_id, $articles[$n]['id'], array('sortOrder' => intval($n)));
             }
         }
     }
     // Increment the offset if there is a cover page, for sorting purposes.
     if (count($filenames) > 0 && $filenames[0] == 'Cover') {
         $offset++;
     }
     // Increment the offset if there is a TOC page, for sorting purposes.
     if (count($filenames) > 1 && $filenames[1] == 'TableofContents') {
         $offset++;
     }
     // Loop through the articles and upload them to the Folio Producer.
     for ($i = 0; $i < count($filenames); $i++) {
         $adjusted_sort_order = ($i + 1 + $offset) * 1000;
         // Checks if the article is not from Drupal.