Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jimsafley committed Oct 4, 2011
0 parents commit d988bf3
Show file tree
Hide file tree
Showing 13 changed files with 3,328 additions and 0 deletions.
Empty file added README
Empty file.
95 changes: 95 additions & 0 deletions ScriptoAdapterDrupal.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<?php
require_once 'Scripto/Adapter/Interface.php';

/**
* @todo self::getDocumentPages()
* @todo self::getDocumentFirstPageId()
* @todo self::documentTranscriptionIsImported()
* @todo self::documentPageTranscriptionIsImported()
* @todo self::importDocumentPageTranscription()
* @todo self::importDocumentTranscription()
*/
class ScriptoAdapterDrupal implements Scripto_Adapter_Interface {

public function documentExists($documentId) {

// Verify that the node exists.
$node = node_load($documentId);
if (!$node) {
return false;
}
return true;
}

public function documentPageExists($documentId, $pageId) {

// Verify that the node exists.
$node = node_load($documentId);
if (!$node) {
return false;
}

// Verify that the file exists.
$file = file_load($pageId);
if (!$file) {
return false;
}

// Verify that the file belongs to the specified node.
$sql = "
SELECT *
FROM {file_usage}
WHERE fid = :fid
AND module = :module
AND type = :type
AND id = :id";
$result = db_query($sql, array(':fid' => $file->fid, ':module' => 'file',
':type' => 'node', ':id' => $node->nid));
if (!$result->fetchAll()) {
return false;
}

return true;
}

public function getDocumentPages($documentId) {
$node = node_load($documentId);
return;
}

public function getDocumentPageFileUrl($documentId, $pageId) {
$file = file_load($pageId);
return file_create_url($file->uri);
}

public function getDocumentFirstPageId($documentId) {
$node = node_load($documentId);
return;
}

public function getDocumentTitle($documentId) {
$node = node_load($documentId);
return $node->title;
}

public function getDocumentPageName($documentId, $pageId) {
$file = file_load($pageId);
return $file->filename;
}

public function documentTranscriptionIsImported($documentId) {

}

public function documentPageTranscriptionIsImported($documentId, $pageId) {

}

public function importDocumentPageTranscription($documentId, $pageId, $text) {

}

public function importDocumentTranscription($documentId, $text) {

}
}
Loading

0 comments on commit d988bf3

Please sign in to comment.