Class information All sources on /Servers/htdocs/test/2013/TagAndBin/server/php and sub paths Fri 7 Nov 14 at 10:57
Key to link symbols Top of page Source file blurb Class Property or Method
Member visibility Public Protected Private Static
Other symbols Overriden method Abstract class/method Hook (Search for 'Hookup points')
Highlighting Globals Object property(dot notation) Objects Functions

Alphabetical Family
BackEndInterface
BatchData
BatchesListing
BatchesTF
BatchInfo
BatchReturn
BeInterfaceNoDB1
ColumnSpec
fileTabulate
LoginResponse
LogsTF
Message
MessagesTF
Receipt
ReceiptsTF
SampleData
SampleReturn
SamplesTF
SessionsTF
Slate
SlateKeyDef
TableSpec
TextFile
UsersTF
BackEndInterface
    BeInterfaceNoDB1
BatchData
BatchesListing
BatchInfo
BatchReturn
ColumnSpec
fileTabulate
LoginResponse
Message
Receipt
SampleData
SampleReturn
Slate
SlateKeyDef
TableSpec
TextFile
    UsersTF
    SessionsTF
    BatchesTF
    SamplesTF
    LogsTF
    MessagesTF
    ReceiptsTF

BackEndInterface

8 /Servers/htdocs/test/2013/TagAndBin/server/php/BackEndInterface.php
ABSTRACT
This is a specification for the interface between the server front-end
and the server back-end. This will then be sub-classed with real code
to implement the methods declared here. The front-end should not call
any other back-end functions.
CurrentBatchForUser
122 BackEndInterface
$UserIdReturns the batchId or false for the given user.
One use is to check a user doesn't have a batch in progress and is trying
to start another one.
EndBatch
138 BackEndInterface
$UserId
$SessionId
$BatchId
$Data
Finish working on a batch.
UserId Required for checking/user getting in a tangle analysis
SessionId Required for checking
BatchId Required for checking
Data a BatchReturn object.
OK: Returns a Receipt object (status property=2)
Error: object with .status and .message properties
See IsValidBatch()
status = 0,1,3,4 See IsValidBatch()
status = 5..8 Loony! Sanity checks on data fail
status = 9 Weird system fault
GetBackEndVersion
190 BackEndInterface
()Return a string that identifies the backend being used
GetListOfAvailableSlates
95 BackEndInterface
$UserId=null
$Modes='ALL'
Extract information from ListOfAvailableBatches()
Return BatchesListing object without batch elements of BatchInfo items
GetMOTD
195 BackEndInterface
()Return a message of the day string. (May be empty.)
GetMessages
174 BackEndInterface
$userId
$Number
Ask if there are any messages 'addressed' to this user.
Number ... (a) < 100 How many most-recent messages
(b) > 100 Unix timestamp for later-than specified date
Return an array of Message objects
GetSlate
101 BackEndInterface
$SlateIdGet slate and all associated files
Return (a) error string
or (b) a Slate object
IsUserLoggedIn
34 BackEndInterface
$UserIdSee if there is a session already assigned to this user
UserId String. Non-alpha-numerics will be stripped-out and uppercased
Return SessionId or false
IsValidBatch
108 BackEndInterface
$UserId
$SessionId
$BatchId
Check the session is live and allocated to the specified user
UserId String. Non-alpha-numerics will be stripped-out and uppercased
SessionId String. Nonce obtained from Login()
BatchId String. Id obtained from StartBatch()
Return integer status
0 ... user or session error
1 ... batch unknown
2 ... batch in progress
3 ... batch finished
4 ... batch held by another session/user
IsValidSession
56 BackEndInterface
$UserId
$SessionId
Check the session is live and allocated to the specified user
UserId String. Non-alpha-numerics will be stripped-out and uppercased
SessionId String. Nonce obtained from Login()
Return Boolean
IsValidUser
26 BackEndInterface
$UserId
$Password
Checks existence and validity of user
UserId String. Non-alpha-numerics will be stripped-out and uppercased
$Password String. Non-alpha-numerics will be stripped-out but case remains significant
Return Boolean
ListOfAvailableBatches
73 BackEndInterface
$SlateName=null
$UserId=null
$Modes='ALL'
Fetch an array of batches that the user may select from. An arbitary message may
be returned for the benefit of the user.
SlateName Optional. Restrict to specified slate
UserId Optional. May be used to filter results
Modes Optional. Default is all. Constants are defined in BatchInfo object
BatchInfo::BM_ALL, BatchInfo::BM_FRESH, BatchInfo::BM_CHECKING, BatchInfo::BM_PRACTISE
Return a BatchesListing object
ListReceipts
182 BackEndInterface
$userId
$Number
Fetch a list of recent receipts
Number ... (a) < 100 How many most-recent receipts
(b) > 100 Unix timestamp for later-than specified date
Return an array of Receipt objects
Login
48 BackEndInterface
$UserId
$Password
Attempt login
UserId String. Non-alpha-numerics will be stripped-out and uppercased
Password String. Non-alpha-numerics will be stripped-out but case remains significant
Return a LoginResponse object
Logout
41 BackEndInterface
$UserIdForce termination of all sessions
UserId String. Non-alpha-numerics will be stripped-out and uppercased
Return TRUE
NextAvailableBatch
85 BackEndInterface
$SlateName=null
$UserId=null
$Modes='ALL'
Returns zero or one batchInfo objects with an optional information message.
This is cut-down version of GetListOfAvailableBatches() where the user has no choice
in which batch to work on.
Arguments as for GetListOfAvailableBatches()
Returns (a) error string
or (b) a single BatchInfo object
PutMessage
165 BackEndInterface
$UserId
$Context
$Message
The user wishes to contact their supervisor.
Context is a string which may contain details of the current sample in easily
readable form (if applicable) For example "Slate=foo, Batch=12345, Index=13"
Return a string 'OK' or an error message
StartBatch
129 BackEndInterface
$UserId
$SessionId
$SlateId
$Mode
Command from the user/client that a batch is to be worked on.
The UserId and SessionId are required as validation tokens and possibly
filters as for the availability testing functions
Return (a) error string
or (b) a BatchData object

BatchData

126 /Servers/htdocs/test/2013/TagAndBin/server/php/DataInterface.php
Complete batch of work (server to client)
$batchId
 
Batch id --> BatchInfo.id
$message
 
Optional string
$samples
 
Array of SampleData objects
$samplesCount
 
Must match $samples
$slateId
 
Must match current slate

BatchesListing

50 /Servers/htdocs/test/2013/TagAndBin/server/php/DataInterface.php
Table of batch availabilities
Response to ListOfAvailableBatches()
$criteria
 
Description of criteria used to select slates
$listing
 
Array of BatchInfo objects
$message
 
Optional message

BatchesTF

223 /Servers/htdocs/test/2013/TagAndBin/server/php/back/NoDB1Data.php TextFile
BatchesForUser
272 BatchesTF
$UserId
$LiveOnly=false
Return array of cursors (or null).
LiveOnly set true for only open sessions
Display
293 BatchesTF
()
 
MarkBatchFinished
287 BatchesTF
$BatchId
$DoneCount
Mark the batch as being finished
MarkBatchStarted
281 BatchesTF
$BatchId
$UserId
$SessionId
Mark the batch as being started
NextReadyBatch
261 BatchesTF
$SlateName
$Mode
Return null or a complete batch record (assoc. array)
NotYetStarted
252 BatchesTF
$SlateName=nullFetch unstarted batches. Optionally filter by SlateName
RegisterBatch
231 BatchesTF
$SlateName
$Mode
$BatchSize
A new batch is available (eg by CONSOLEbatchup()) and we want to make
it available for picking by a user to work on.
SlateName tells which slate will be used
Mode is one of BM_PRACTISE, BM_TEST and BM_NORMAL
Return number -> id or string ->error
__construct
224 BatchesTF
()
 
TextFile
$autoTimeBumper TextFile
$autotimeOffset TextFile
$err TextFile
$filename TextFile
$filetime TextFile
$hasChanged TextFile
$idField TextFile
$immediateWrites TextFile
$insertIdMode TextFile
$isOpen TextFile
$lastFreshId TextFile
$maxAutoInc TextFile
$records TextFile
$SortDir TextFile
$SortFieldTextFile
$writesSuspended TextFile
AddOneRecordTextFile
ClearTextFile
CollectTextFile
ColumnSetTextFile
CreateRecordTextFile
CursorOfTextFile
DeleteIdTextFile
DeleteRecordsTextFile
DeleteRecordTextFile
DescribeTextFile
ErrorTextFile
FindFieldMatchTextFile
FindMatchingTextFile
FindRecordsTextFile
FlushTextFile
GetValuesForCursorTextFile
GetValuesForIdTextFile
InstantGetFromFileTextFile
InstantRecordReplaceTextFile
ReadRecordTextFile
ResumeWritesTextFile
SetTextFile
SortTextFile
SuspendWritesTextFile
TabulateTextFile
UnionSetTextFile
UpdateRecordTextFile
_CloseTextFile
_CRTextFile
_FMTextFile
_GetFreshAutoIncTextFile
_GetFreshAutoTimeTextFile
_GetFreshIdTextFile
_GetFreshRandTextFile
_IdExistsTextFile
_ReadTextFile
_WriteTextFile
__constructTextFile
__destructTextFile

BatchInfo

35 /Servers/htdocs/test/2013/TagAndBin/server/php/DataInterface.php
$BM_All 7 Option for ListOfAvailableBatches()
$BM_CHECKING 2 .batchMode enumeration
$BM_FRESH 1 .batchMode enumeration
$BM_PRACTICE 4 .batchMode enumeration
$batchId
 
When responding to NextAvailableBatch()
$batchMode
 
One of the BM_ values
$slateId
 
 
$slateInfo
 
 
$slateMode
 
 
$slateTitle
 
 
$waitingCount
 
How many available (When responding to ListOfAvailableBatches())

BatchReturn

171 /Servers/htdocs/test/2013/TagAndBin/server/php/DataInterface.php
Complete batch of work being returned (Client to server)
$batchId
 
Batch id --> BatchInfo.id
$batchMode
 
one of the BM_ values
$completionFlags
 
? Possibly flag abandoned/cancelled
$doneCount
 
Number with definite result
$endTime
 
When screener finished last sample (local time)
$receivedTime
 
When batch was received by client (local time)
$samples
 
Array of SampleReturn objects
$screenedCount
 
Must match $samples
$slateId
 
Must match current slate
$startTime
 
When screener started first sample (local time)

BeInterfaceNoDB1

20 /Servers/htdocs/test/2013/TagAndBin/server/php/back/NoDB1Interface.php BackEndInterface
CurrentBatchForUser
241 BeInterfaceNoDB1
$UserId
$BATCHES
 
EndBatch
311 BeInterfaceNoDB1
$UserId
$SessionId
$BatchId
$Data
$BATCHES
$SAMPLES
$LOGS
$MESSAGES
$RECEIPTS
 
GetBackEndVersion
444 BeInterfaceNoDB1
()
 
GetListOfAvailableSlates
171 BeInterfaceNoDB1
$UserId=null
$Modes='ALL'
 
GetMOTD
449 BeInterfaceNoDB1
()
 
GetMessages
434 BeInterfaceNoDB1
$userId
$Number
 
GetSlate
193 BeInterfaceNoDB1
$SlateId
 
IsUserLoggedIn
41 BeInterfaceNoDB1
$UserId
$SESSIONS
 
IsValidBatch
226 BeInterfaceNoDB1
$UserId
$SessionId
$BatchId
$BATCHES
 
IsValidSession
110 BeInterfaceNoDB1
$UserId
$SessionId
$SESSIONS
 
IsValidUser
33 BeInterfaceNoDB1
$UserId
$Password
$USERS
 
ListOfAvailableBatches
127 BeInterfaceNoDB1
$SlateName=null
$UserId=null
$Modes='ALL'
$BATCHES
All arguments are ignored. Anything here will be 'new'
UserId and Modes are ignored.
ListReceipts
439 BeInterfaceNoDB1
$userId
$Number
 
Login
69 BeInterfaceNoDB1
$UserId
$Password
$LOGS
$SESSIONS
$USERS
This is a little complicated round the edges...
1 Check password etc. (Obviously fail if bad)
2 What to do if user is already logged-in? (ie has a session open)
Send message 'already logged in' ...
Make sure the USER record matches. This is the important bit as
the USER keeps track of logins as well and we might have a duff
reset of the USER. (Theres a lot of possible mis-matches)
Logout
49 BeInterfaceNoDB1
$UserId
$SESSIONS
$BATCHES
 
NextAvailableBatch
159 BeInterfaceNoDB1
$SlateName=null
$UserId=null
$Modes='ALL'
 
PutMessage
428 BeInterfaceNoDB1
$UserId
$Context
$Message
 
StartBatch
252 BeInterfaceNoDB1
$UserId
$SessionId
$SlateId
$Mode
$BATCHES
$SAMPLES
 
BackEndInterface
CurrentBatchForUserBackEndInterface
EndBatchBackEndInterface
GetBackEndVersionBackEndInterface
GetListOfAvailableSlatesBackEndInterface
GetMessagesBackEndInterface
GetMOTDBackEndInterface
GetSlateBackEndInterface
IsUserLoggedInBackEndInterface
IsValidBatchBackEndInterface
IsValidSessionBackEndInterface
IsValidUserBackEndInterface
ListOfAvailableBatchesBackEndInterface
ListReceiptsBackEndInterface
LoginBackEndInterface
LogoutBackEndInterface
NextAvailableBatchBackEndInterface
PutMessageBackEndInterface
StartBatchBackEndInterface

ColumnSpec

40 /Servers/htdocs/test/2013/TagAndBin/server/php/back/fileTabulate.php
$customFun null Possibly specify a function for this column
$fieldName '' Name of field (Case sensitive)
$heading '' Text to go in heading. May be html.
$html '' <td...../td> with ? at value-substitution point. Blank is equiv to '<td>?</td>'
$isIndex false Are we using this to identify records?
Displayed
64 ColumnSpec
()
 
__construct
47 ColumnSpec
$FieldName
$Heading=''
$Html='<td>?</td>'
$IsIndex=false
$Custom=null
 

fileTabulate

72 /Servers/htdocs/test/2013/TagAndBin/server/php/back/fileTabulate.php
$actionButs '' HTML for update/delete buttons as applicable
$addButton '' HTML for an add button if applicable
$columns null array of ColumnSpecs
$fileObj null Used if passed a TextFile object
$filename '' Used if raw access to textfile
$layout null specification for whole table
$theading '' Table title and heading and
BuildFramework
104 fileTabulate
()
 
CreateTR
135 fileTabulate
$RecordCreate the html for a row
Record is an object. If none of the columns is marked as isIndex then
we look in the record for a property called 'id';
CreateTable
166 fileTabulate
$Filters=null
$SortBy=''
$SortUp=true
 
SetColumns
96 fileTabulate
$Columns
 
SetLayout
91 fileTabulate
$Layout
 
__construct
81 fileTabulate
$FileNameOrObject
$LayoutSpec
$ColumnSpecs
 

LoginResponse

19 /Servers/htdocs/test/2013/TagAndBin/server/php/DataInterface.php
Response to Login() request
$message
 
Optional MOTD etc.
Line to go in BatchesListing
$ok
 
Boolean
$sessionId
 
Unique nonce or null if $ok is false
$userId
 
As supplied

LogsTF

430 /Servers/htdocs/test/2013/TagAndBin/server/php/back/NoDB1Data.php TextFile
id AUTOTIME
type 'BadData','UserAct','SysFault'
text
BadDataError
438 LogsTF
$ErrorMsgThe supplied arguments are not suitable
Display
458 LogsTF
()
 
OddActivityError
453 LogsTF
$ErrorMsgProbably the user is trying to do something not permitted
SystemFault
448 LogsTF
$ErrorMsgThere is some server error
UserActivity
443 LogsTF
$MsgEveryday, normal, activity
__construct
434 LogsTF
()
 
TextFile
$autoTimeBumper TextFile
$autotimeOffset TextFile
$err TextFile
$filename TextFile
$filetime TextFile
$hasChanged TextFile
$idField TextFile
$immediateWrites TextFile
$insertIdMode TextFile
$isOpen TextFile
$lastFreshId TextFile
$maxAutoInc TextFile
$records TextFile
$SortDir TextFile
$SortFieldTextFile
$writesSuspended TextFile
AddOneRecordTextFile
ClearTextFile
CollectTextFile
ColumnSetTextFile
CreateRecordTextFile
CursorOfTextFile
DeleteIdTextFile
DeleteRecordsTextFile
DeleteRecordTextFile
DescribeTextFile
ErrorTextFile
FindFieldMatchTextFile
FindMatchingTextFile
FindRecordsTextFile
FlushTextFile
GetValuesForCursorTextFile
GetValuesForIdTextFile
InstantGetFromFileTextFile
InstantRecordReplaceTextFile
ReadRecordTextFile
ResumeWritesTextFile
SetTextFile
SortTextFile
SuspendWritesTextFile
TabulateTextFile
UnionSetTextFile
UpdateRecordTextFile
_CloseTextFile
_CRTextFile
_FMTextFile
_GetFreshAutoIncTextFile
_GetFreshAutoTimeTextFile
_GetFreshIdTextFile
_GetFreshRandTextFile
_IdExistsTextFile
_ReadTextFile
_WriteTextFile
__constructTextFile
__destructTextFile

Message

95 /Servers/htdocs/test/2013/TagAndBin/server/php/DataInterface.php
Contains a complete message to or from user
$context
 
Context text (eg ref to batch/ix to identify sampla)
$flags
 
not yet used
$from
 
user id
$text
 
body of message
$timestamp
 
UNIX timestamp (local to sender)
$to
 
user id

MessagesTF

499 /Servers/htdocs/test/2013/TagAndBin/server/php/back/NoDB1Data.php TextFile
id AutoTime
from str -> user
to str -> user
message str use format subjecttext
context str Reference to data eg sample id
done boolean
backId reference to previous message id
Add
511 MessagesTF
$From
$To
$Message
$Link=''
Link has tech info about any connected data eg reference to sample
DeleteMessage
530 MessagesTF
$Id
 
DeleteOldMessages
534 MessagesTF
$DaysOld
 
DeleteUsersMessages
532 MessagesTF
$UserId
 
Display
542 MessagesTF
()
 
History
523 MessagesTF
$Id
 
Journalise
538 MessagesTF
()
 
ListUnread
536 MessagesTF
$Recipient
 
ListUserHistory
526 MessagesTF
$UserId
$Role
$Limit
Role is From,To or both
MarkDone
516 MessagesTF
$Id
 
Reply
519 MessagesTF
$Id
$Message
$Done=true
 
__construct
507 MessagesTF
()
 
TextFile
$autoTimeBumper TextFile
$autotimeOffset TextFile
$err TextFile
$filename TextFile
$filetime TextFile
$hasChanged TextFile
$idField TextFile
$immediateWrites TextFile
$insertIdMode TextFile
$isOpen TextFile
$lastFreshId TextFile
$maxAutoInc TextFile
$records TextFile
$SortDir TextFile
$SortFieldTextFile
$writesSuspended TextFile
AddOneRecordTextFile
ClearTextFile
CollectTextFile
ColumnSetTextFile
CreateRecordTextFile
CursorOfTextFile
DeleteIdTextFile
DeleteRecordsTextFile
DeleteRecordTextFile
DescribeTextFile
ErrorTextFile
FindFieldMatchTextFile
FindMatchingTextFile
FindRecordsTextFile
FlushTextFile
GetValuesForCursorTextFile
GetValuesForIdTextFile
InstantGetFromFileTextFile
InstantRecordReplaceTextFile
ReadRecordTextFile
ResumeWritesTextFile
SetTextFile
SortTextFile
SuspendWritesTextFile
TabulateTextFile
UnionSetTextFile
UpdateRecordTextFile
_CloseTextFile
_CRTextFile
_FMTextFile
_GetFreshAutoIncTextFile
_GetFreshAutoTimeTextFile
_GetFreshIdTextFile
_GetFreshRandTextFile
_IdExistsTextFile
_ReadTextFile
_WriteTextFile
__constructTextFile
__destructTextFile

Receipt

108 /Servers/htdocs/test/2013/TagAndBin/server/php/DataInterface.php
Information about the work done on a batch in user-readable form
$batchId
 
Unique identifier of batch --> BatchInfo.id
$created
 
String date/time (Server) T/stamp for when receipt was created
$finished
 
String date/time (Client)
$id
 
Unique identifier of receipt
$message
 
Error or 'OK thanks message'
$missingCount
 
Number of samples without picks
$mode
 
"Process", "Check" or "Practise"
$sampleCount
 
Number of samples offered
$slateId
 
Id or description
$started
 
String date/time (Client)
$status
 
Number 0..4 EndBatch() response (2=OK)
$userId
 
 

ReceiptsTF

574 /Servers/htdocs/test/2013/TagAndBin/server/php/back/NoDB1Data.php TextFile
***See Receipt object definition***
id AutoInc
batchId str -> batch.id
userId str -> user.id
status num 0..4 (2=OK)
message str
started str date/time hh:mm dd-mmm-yy Client time
finished str date/time hh:mm dd-mmm-yy Client time
created str date/time hh:mm dd-mmm-yy Server time
sampleCount num Total in batch
missingCount num Number not picked - hopefully 0
slate str name of slate
mode 'Select','Check' or 'Practise'
AddReceipt
594 ReceiptsTF
$ReceiptData
 
GetReceiptsForUser
598 ReceiptsTF
$UserId
$EarliestId
 
__construct
590 ReceiptsTF
()
 
TextFile
$autoTimeBumper TextFile
$autotimeOffset TextFile
$err TextFile
$filename TextFile
$filetime TextFile
$hasChanged TextFile
$idField TextFile
$immediateWrites TextFile
$insertIdMode TextFile
$isOpen TextFile
$lastFreshId TextFile
$maxAutoInc TextFile
$records TextFile
$SortDir TextFile
$SortFieldTextFile
$writesSuspended TextFile
AddOneRecordTextFile
ClearTextFile
CollectTextFile
ColumnSetTextFile
CreateRecordTextFile
CursorOfTextFile
DeleteIdTextFile
DeleteRecordsTextFile
DeleteRecordTextFile
DescribeTextFile
ErrorTextFile
FindFieldMatchTextFile
FindMatchingTextFile
FindRecordsTextFile
FlushTextFile
GetValuesForCursorTextFile
GetValuesForIdTextFile
InstantGetFromFileTextFile
InstantRecordReplaceTextFile
ReadRecordTextFile
ResumeWritesTextFile
SetTextFile
SortTextFile
SuspendWritesTextFile
TabulateTextFile
UnionSetTextFile
UpdateRecordTextFile
_CloseTextFile
_CRTextFile
_FMTextFile
_GetFreshAutoIncTextFile
_GetFreshAutoTimeTextFile
_GetFreshIdTextFile
_GetFreshRandTextFile
_IdExistsTextFile
_ReadTextFile
_WriteTextFile
__constructTextFile
__destructTextFile

SampleData

138 /Servers/htdocs/test/2013/TagAndBin/server/php/DataInterface.php
A single item to be examined (Server to Client)
$batchId
 
Batch id --> BatchInfo.id
$content
 
Either html or a filename
$flags
 
Not used at present
$id
 
Globally unique sample identifier
$index
 
Count within the batch 1..batch size
$reference
 
An optional identifier that is meaningful in 'real world' eg "Mary Smith's test result-left side"
$type
 
Content type I=Image filename H=As-is HTML

SampleReturn

151 /Servers/htdocs/test/2013/TagAndBin/server/php/DataInterface.php
A single item having been examined (Client to Server)
This is SampleData modified:
REMOVED ADDED
.reference .dwellTime
.content .tagNums
.type .screeners note
.flags .timestamp
$batchId
 
Batch id --> BatchInfo.id
$dwellTime
 
ms On screener's screen
$id
 
Globally unique
$index
 
Count within the batch 1..batch size
$localTime
 
Client local time
$note
 
Optional message (alert) from screener
$tagNums
 
tag numbers array. Special values: Zero length array=not attempted. String=Abandoned/skipped

SamplesTF

334 /Servers/htdocs/test/2013/TagAndBin/server/php/back/NoDB1Data.php TextFile
id AUTOTIME
batchId
status U/S/P
filename payload
annotation optional string with external reference etc.
index int 1...batch size
sent timestamp
received timestamp
dwell milliseconds on client screen
picks Array of numbers 0-19
note screenersNote
CreateBatch
359 SamplesTF
$BatchId
$ArrayOfFilenames
Create a batch-load of samples given the (image) filenames
Display
377 SamplesTF
()
 
MarkSent
396 SamplesTF
$SampleId
 
UpdatePicks
403 SamplesTF
$SampleId
$Dwell
$Picks
$Note=''
 
WipeBatch
351 SamplesTF
$BatchId
 
__construct
346 SamplesTF
()
 
TextFile
$autoTimeBumper TextFile
$autotimeOffset TextFile
$err TextFile
$filename TextFile
$filetime TextFile
$hasChanged TextFile
$idField TextFile
$immediateWrites TextFile
$insertIdMode TextFile
$isOpen TextFile
$lastFreshId TextFile
$maxAutoInc TextFile
$records TextFile
$SortDir TextFile
$SortFieldTextFile
$writesSuspended TextFile
AddOneRecordTextFile
ClearTextFile
CollectTextFile
ColumnSetTextFile
CreateRecordTextFile
CursorOfTextFile
DeleteIdTextFile
DeleteRecordsTextFile
DeleteRecordTextFile
DescribeTextFile
ErrorTextFile
FindFieldMatchTextFile
FindMatchingTextFile
FindRecordsTextFile
FlushTextFile
GetValuesForCursorTextFile
GetValuesForIdTextFile
InstantGetFromFileTextFile
InstantRecordReplaceTextFile
ReadRecordTextFile
ResumeWritesTextFile
SetTextFile
SortTextFile
SuspendWritesTextFile
TabulateTextFile
UnionSetTextFile
UpdateRecordTextFile
_CloseTextFile
_CRTextFile
_FMTextFile
_GetFreshAutoIncTextFile
_GetFreshAutoTimeTextFile
_GetFreshIdTextFile
_GetFreshRandTextFile
_IdExistsTextFile
_ReadTextFile
_WriteTextFile
__constructTextFile
__destructTextFile

SessionsTF

127 /Servers/htdocs/test/2013/TagAndBin/server/php/back/NoDB1Data.php TextFile
Display
172 SessionsTF
()| id=>Required identifier
| sid=>num session
| slateId=>str name
| mode=>int see above
| uid=>str user
| startTime=>int -1 = not yet
| endTime=>int -1 = not yet
| sent=>num how many left
| doneCount=>num How many completed when batch returned
| sesNonce SessionNonce valid for a user/session
IsUserLoggedIn
159 SessionsTF
$UserId Can we find any live sessions for this user.
Return null or first session id
NewSession
132 SessionsTF
$UserIdReturns session Id of new session or false
SessionsForUser
145 SessionsTF
$UserId
$LiveOnly=false
Return array of matching records (or null).
LiveOnly set true for only open sessions
__construct
128 SessionsTF
()
 
TextFile
$autoTimeBumper TextFile
$autotimeOffset TextFile
$err TextFile
$filename TextFile
$filetime TextFile
$hasChanged TextFile
$idField TextFile
$immediateWrites TextFile
$insertIdMode TextFile
$isOpen TextFile
$lastFreshId TextFile
$maxAutoInc TextFile
$records TextFile
$SortDir TextFile
$SortFieldTextFile
$writesSuspended TextFile
AddOneRecordTextFile
ClearTextFile
CollectTextFile
ColumnSetTextFile
CreateRecordTextFile
CursorOfTextFile
DeleteIdTextFile
DeleteRecordsTextFile
DeleteRecordTextFile
DescribeTextFile
ErrorTextFile
FindFieldMatchTextFile
FindMatchingTextFile
FindRecordsTextFile
FlushTextFile
GetValuesForCursorTextFile
GetValuesForIdTextFile
InstantGetFromFileTextFile
InstantRecordReplaceTextFile
ReadRecordTextFile
ResumeWritesTextFile
SetTextFile
SortTextFile
SuspendWritesTextFile
TabulateTextFile
UnionSetTextFile
UpdateRecordTextFile
_CloseTextFile
_CRTextFile
_FMTextFile
_GetFreshAutoIncTextFile
_GetFreshAutoTimeTextFile
_GetFreshIdTextFile
_GetFreshRandTextFile
_IdExistsTextFile
_ReadTextFile
_WriteTextFile
__constructTextFile
__destructTextFile

Slate

69 /Servers/htdocs/test/2013/TagAndBin/server/php/DataInterface.php
Describes a protocol for screening (Server to Client)
$SM_CLASIFY 'classify' Constant. Classify with 1 key (or alt+ 1 key)
$SM_MENU 'menu' Constant. Triggers actions in menu.js for mode property
$SM_SEQUENCE 'pattern' Fixed number of stages each for a single tag.
$SM_TAG 'tag' Add 1 or more tags
$SM_TREE 'tree' Multi-level classification with lower levels being greater level of detail.
$completion
 
HTML for finished screen
$css
 
CSS
$help
 
HTML for help panel
$id
 
Unique alpaha or numeric
$info
 
Longer description
$instruction
 
HTML for introductory instructions
$keys
 
Array of SlateKeyDef objects
$mode
 
See SM_ constants above
$noTagsFlag
 
True if allow skipping of samples AKA Don't know allowed
$template
 
HTML for layout of exch sample
$title
 
Simple, short description

SlateKeyDef

60 /Servers/htdocs/test/2013/TagAndBin/server/php/DataInterface.php
Defines a key assignment for Slate.keys array
$info
 
text to appear in tips optional
$key
 
0-9 or 0-9 with 'a' suffix. required
$label
 
text to appear on grid required

TableSpec

32 /Servers/htdocs/test/2013/TagAndBin/server/php/back/fileTabulate.php
$addURL ''
 
$cssClasses ''
 
$delURL ''
 
$title ''
 
$updateURL ''
 

TextFile

11 /Servers/htdocs/test/2013/TagAndBin/server/php/back/fileUtils.php
Random access to text files (JSON)
Arbitary objects.
No locking! No security! No nothing!
$SortDir true
 
$SortField
 
 
$autoTimeBumper -1 Used to add entropy to auto incrementing using timestamp
$autotimeOffset 0 Autotime values are normally just current UNIX timestamp
$err '' possible error message
$filename '' what's the name of the file
$filetime 0 Last read/write time by this object of file
$hasChanged false version in memory is newer than version on disc
$idField '' Name of field being used as an Id (if any)
$immediateWrites true write after every change. If False use Flush() or unset()
$insertIdMode '' How do we deal with missing Ids for insert
$isOpen false We've got records
$lastFreshId '' Most recent id created
$maxAutoInc -1 if auto-incrementing
$records array() data. (Array of arraysstrings in JSON)
$writesSuspended false set true to block pending writes when doing bulk changes
AddOneRecord
172 TextFile
$Record See Set();
Record is either an assoc array or an object. If an object then the public properties
will be used.
The id field will be set according to the normal Set() rules
Returns the value of the id field.
Example: | $myStructure['serial']=$table->Add($myStructure);
| if($table->Error()){ print('ERROR! '.$myStructure['serial']);
[T]
Clear
76 TextFile
()Remove the file from disc and all records from memory.
Note that subsequent changes will cause a file to be recreated.
Collect
655 TextFile
$ArrayOfCursors
$FieldNames=''
Given an array of cursors Return a data array
See GetValuesForCursor() for FieldNames and Return formats
ColumnSet
523 TextFile
$Cursors
$FieldName
$NewValue
Bulk update of records
Cursors array of index pointers into records
FieldName name of field to update. If it doesn't exist it will be created
NewValue either a value or null if field is to be unset
(No callback facility for NewValue yet)
CreateRecord
159 TextFile
$Data Low-level add array of data. Return cursor.
Normally use Set()
CursorOf
303 TextFile
$Id Look up the cursor for the Id that matches the Index Field
Return -1 if not found or error
DeleteId
485 TextFile
$IdDelete the record specified by the Id.
Return true if successful
DeleteRecord
462 TextFile
$CursorWARNING Not safe to be called multiple times without a re-getting of
cursors. Typically use DeleteRecords() when you've got a
bunch of records to delete.
DeleteRecords
474 TextFile
$ArrayOfCursorsAlways use this when deleting multiple records
Describe
391 TextFile
$NoOfRecordsToList=3Return HTML table of fields discovered and other basic info and stats
Error
194 TextFile
()Return any error from *last* call or empty string.
Example | $myTable->Set($stuff);
| if($myTable->Error())print('Oh noes!');
FindFieldMatch
564 TextFile
$FieldNameOrIndex
$LowValue
$HighValue=null
Return array of cursors or null.
If HighValue is omitted then this is an equality test
FindMatching
572 TextFile
$ArrayOfMatchCriteriaEach element of array is array of three or four values: AndOrFlag, FieldName, Low/equals. High
AndOrFlag ... 'AND' or 'OR' (Ignored for 1st filter)
Returns array of index pointers into records or null
FindRecords
544 TextFile
$CallbackFilter=null
$ArgsArray=null
Select records based on some callback function
If there is no callback then Return them all
Return an array of cursors or null
Flush
91 TextFile
() Purge anything in the buffer to disc
GetValuesForCursor
680 TextFile
$Cursor
$FieldNames=''
Cursor is numeric index into records array
FieldNames describes what fields are to be returned
(a) Array
(b) String with one or more fields split by commas eg 'foo,bar,fox'
(c) Empty string
Returns (A) empty array if nothing found
(B) array of field=>value pairs
(C) single value if only one field returned
GetValuesForId
667 TextFile
$Id
$FieldNames
Id is value to match with id field given in create
FieldNames See GetValuesForCursor() Empty string is all.
Returns (a) empty array if nothing found
(b) array of field=>value pairs
(c) single value if only one field returned
InstantGetFromFile
723 TextFile
$Filename
$IndexField
$Id
$FieldNames
Returns null if not found
Deprecated
InstantRecordReplace
736 TextFile
$Filename
$IndexField
$Record
Instant update of a specific record
Return empty string for OK or error message
Deprecated
ReadRecord
500 TextFile
$CursorCursor is just an index into the records.
NOTE Any sort, insert or delete action will invalidate a previously
obtained cursor.
ResumeWrites
150 TextFile
()See SuspendWrites()
If there are any pending changes these will be written immediately
Set
215 TextFile
$Records
$UpdateMode='REPLACE'
Multi-record insert/update
Records ........ Array of records(ie. array(array(fname=>val,fname=>val))
UpdateMode ..... (String) How to deal with unspecified existing data
REPLACE ...... New record completely replaces existing
UNION ........ Combine the two records
FRESHEN ...... Only update existing fields in existing record
Example
old : name=>Fred age=>44 wife=>Mary
new : name=>Fred age=>45 job=>Mechanic
REPLACE : name=>Fred age=>45 job=>Mechanic
UNION : name=>Fred age=>45 wife=>Mary job=>Mechanic (wife unaffected)
FRESHEN : name=>Fred age=>45 wife=>Mary (job ignored)
Returns an array of records
- Possibly with with an id field added
- With a SETRESULT field set to 'OK' or an error message string
- Special case of a null array indicates an error
Errors:
String in ->err or empty string if all OK
Each result has a SETRESULT field
If any failures in records (ie any not OK) then ->err will be set
Sort
642 TextFile
$Fieldname
$Ascending=true
Sort the table im memory.
Notes
(a) This will destroy cursor pointings!
(b) Flush must be called if you want the results saved to disk
SuspendWrites
142 TextFile
()Temporarily halt immediate writes. This is used when making batch changes.
See also ResumeWrites()
Tabulate
610 TextFile
$Fields
$Matches=null
$SortField=''
$SortUp=true
Returns data in a two-dimensional array
Fields is an array of field names or '*' for all
Matches is a array to be passed to FindMatching() or '*' for no filtering qv.
SortField and SortUp are arguments for Sort() qv.
UnionSet
204 TextFile
$Records See Set();
Use for updating a subset of fields without removing any unspecified
eg Data : Age=40,Name=Fred,Wife=Mary
Args : Age=41
Will just update age field. (Set() would remove wife/name)
UpdateRecord
511 TextFile
$Cursor
$Data
Low-level replace record
Normally use Set(). See also CreateRecord().
_CR
754 TextFile
$R1
$R2
Compare records. Called by Sort()
_Close
134 TextFile
()
 
_FM
774 TextFile
$Args
$Record
Args ... array of $FieldName,$LowValue,$HighValue
Called by FindFieldMatch()
_GetFreshAutoInc
376 TextFile
()Bump-up using a plus-one serial.
_GetFreshAutoTime
367 TextFile
()Use timestamp as id but be prepared to bump-up from actual current
if we've got a clash from adding a batch of records all in one go
_GetFreshId
331 TextFile
$InsertIdModeWe want to insert a record but we need an id for it.
RAND10 ....... 10 Character random hash
RAND20 ....... 20 Character random hash
AUTOINC ...... Auto-increment
AUTOTIME ..... Timestamp+auto-increment
Return -1 if an issue
_GetFreshRand
358 TextFile
$LengthReturn a unique id with the specified length
_IdExists
323 TextFile
$IdDoes the specified Id exist. See CursorOf()
Outside callers would use FindFieldMatch()
_Read
114 TextFile
()Load data from disc into memory ready for use
_Write
97 TextFile
$Force=falseif Force is true it will override (but not reset) writesSuspended flag
__construct
43 TextFile
$Filename
$IdField=''
$InsertIdMode='RAND10'
$ImmediateWrites=true
Filename Complete text file path
IdField Name of field to use to identify records
InsertIdMode ... How to deal with Records that have blank/missing IdFields
REQUIRED ..... Blank ID's not allowed
RAND10 ....... 10 Character random hash(default)
AUTOINC ...... Auto-increment
AUTOTIME ..... Timestamp+auto-increment
DISALLOW ..... Raise an error if we try to update an existing record
ImmediateWrites Boolean (defaults to true) which writes after every change
__destruct
68 TextFile
()We may have buffered writes. Before destroying we may need to flush it.

UsersTF

18 /Servers/htdocs/test/2013/TagAndBin/server/php/back/NoDB1Data.php TextFile
id REQUIRED
pwHash str
currentBatch str
currentSession str missing or MT string if logged-out
lastLogin timestamp
sessions array of pointers to sessions
AddUser
30 UsersTF
$UserId
$Password
User must be new (if not Returns false)
CheckPassword
56 UsersTF
$UserId
$Password
Return boolean
DeleteUser
46 UsersTF
$UserId Remove user from this table. NB NO checking of related tables
Display
98 UsersTF
()| id=>ATI
| uid=>str
| startTime=>int
| endTime=>int
EndSession
91 UsersTF
$UserIdLog-out user from session
HashPw
51 UsersTF
$UserId
$Password
Creat a hash from pw and user Id
IsLoggedIn
82 UsersTF
$UserIdReturn -1 if user id is bad
0 if user is not logged into a session
1 if user has a current session
StartSession
67 UsersTF
$UserId
$SessionId
Return -1 if user id is bad
0 if OK
1 if user has a current session.(Fails! Use external handler to
clean-up any open session.
UpdatePassword
39 UsersTF
$UserId
$Password
Change for existing user. New user is an error (Return false)
__construct
25 UsersTF
()
 
TextFile
$autoTimeBumper TextFile
$autotimeOffset TextFile
$err TextFile
$filename TextFile
$filetime TextFile
$hasChanged TextFile
$idField TextFile
$immediateWrites TextFile
$insertIdMode TextFile
$isOpen TextFile
$lastFreshId TextFile
$maxAutoInc TextFile
$records TextFile
$SortDir TextFile
$SortFieldTextFile
$writesSuspended TextFile
AddOneRecordTextFile
ClearTextFile
CollectTextFile
ColumnSetTextFile
CreateRecordTextFile
CursorOfTextFile
DeleteIdTextFile
DeleteRecordsTextFile
DeleteRecordTextFile
DescribeTextFile
ErrorTextFile
FindFieldMatchTextFile
FindMatchingTextFile
FindRecordsTextFile
FlushTextFile
GetValuesForCursorTextFile
GetValuesForIdTextFile
InstantGetFromFileTextFile
InstantRecordReplaceTextFile
ReadRecordTextFile
ResumeWritesTextFile
SetTextFile
SortTextFile
SuspendWritesTextFile
TabulateTextFile
UnionSetTextFile
UpdateRecordTextFile
_CloseTextFile
_CRTextFile
_FMTextFile
_GetFreshAutoIncTextFile
_GetFreshAutoTimeTextFile
_GetFreshIdTextFile
_GetFreshRandTextFile
_IdExistsTextFile
_ReadTextFile
_WriteTextFile
__constructTextFile
__destructTextFile

Source files

BackEndInterface.php BackEndInterface
 * Actual interfaces should extend this.
 *
ClientServerProtocol.php
   Specific interface methods are described in BackEndInterface.php
DataInterface.php BatchData
BatchInfo
BatchReturn
BatchesListing
LoginResponse
Message
Receipt
SampleData
SampleReturn
Slate
SlateKeyDef
   
   ***NOTE***
   These are described here primarily for the purposes of documentation.
   These are data-only objects rather than functional classes.
   Incomming (ie. from client) will be assoc arrays (via JSON of course)
   Outgoing will be converted into plain JSON data automatically.
   For example a LoginResponse will be coded in PHP something like
     $LogResp->message = 'foo';
   while a BatchReturn (from client) will be coded as
     $bid = $BatchRet['batchId'];
   Being arrays means the incomming data can be extracted() but note some
   data structures are nested arrays.
NoDB1.php
sesfun.php
/win/Server/htdocs/vulpeculox/misc/php/dump.php
NoDB1Data.php
NoDB1Slate.php
NoDB1Interface.php
DATA_PATH : ../../../data/NoDB1/
SLATE_PATH : ../../../slates/
UNSORTED_PATH : DATA_PATH . unsorted/ ....... From POV of PHP code
CLI_UNSORTED_PATH : /test/2013/TagAndBin/data/NoDB1/unsorted/ ....... From POV of *client*
BATCH_PATH : DATA_PATH . batches/
SORTED_PATH : DATA_PATH . sorted/
BATCH_SIZE : 5
ALLOW_PARTIAL_BATCHES : false ....... allow smaller than standard batches?
SLATE_ID : shapesbin ....... only one in this application
USER_DATA : users.json ....... catalogue of users id|pw
SESSION_DATA : session.json ....... currently active sessions
BATCH_DATA : batch.json ....... currently active batches
LOG_DATA : log.json ....... documentary record
 *    Uses just the file system
 *    Method is single classification by moving files from unsorted to sorted bins
 * 
 * Architecture
 *    All code in this file.  Various functions are implemented with GET argument 'action'
 *    eg NoDB1.php?action=batchup
 * 
 * Notes
 *    This is not meant to be production-quality code
NoDB1Data.php
fileTabulate.php
BatchesTF
LogsTF
MessagesTF
ReceiptsTF
SamplesTF
SessionsTF
UsersTF
 *   USERS, SESSIONS, BATCHES, PICKS and LOGS
NoDB1Interface.php
../BackEndInterface.php
../DataInterface.php
ARGS_IN_GET : ΩULL ....... passed to interface methods to indicate that
DATEFORMAT : D j M y H:i ....... day d mon yy hh:mm
BeInterfaceNoDB1
  Note:  All the public facing calls have the following structure
    public function Foo($A1,$A2...){
    if($A1==ARGS_IN_GET){
      return $this->StartBatch(Arg('A1'),Arg('A2')...);
    }
  The purpose of this is to allow the NoDB program to accept an 'Action' parameter from GET
  then in effect say "I can't be bothered fishing out the GETs, so you do it Foo().  I'll flag
  the need to do this with an out of band first arg."
NoDB1Slate.php
fileTabulate.php
/win/Server/htdocs/vulpeculox/misc/php/dump.php
fileUtils.php
ColumnSpec
TableSpec
fileTabulate
 *  File tabulation through to screen and back.   
 * Basic CRUD eventually.  For now just display.
fileUtils.php
/win/Server/htdocs/vulpeculox/misc/php/dump.php
TextFile
 * File access utilities   
 * Basic CRUD
 *  
 *
common.php
EDITED : false
LOG_PATH : ../../logs/
SLATES : ../../slates/
VULPECULOX_VERSION : 0.0 PHP FILE MOVE Dec13
IMPLEMENTERS_VERSION : undefined
LOG_FRONTEND : true
LOG_BACKEND : true

//======================================================================  
//  ooooo      ooo                           .o8                    
//  `888b.     `8'                          "888                    
//   8 `88b.    8   .ooooo.   .ooooo.   .oooo888   .oooo.o          
//   8   `88b.  8  d88' `88b d88' `88b d88' `888  d88(  "8          
//   8     `88b.8  888ooo888 888ooo888 888   888  `"Y88b.           
//   8       `888  888    .o 888    .o 888   888  o.  )88b          
//  o8o        `8  `Y8bod8P' `Y8bod8P' `Y8bod88P" 8""888P'          
//                  .o8   o8o      .    o8o                         
//                 "888   `"'    .o8    `"'                         
//   .ooooo.   .oooo888  oooo  .o888oo oooo  ooo. .oo.    .oooooooo 
//  d88' `88b d88' `888  `888    888   `888  `888P"Y88b  888' `88b  
//  888ooo888 888   888   888    888    888   888   888  888   888  
//  888    .o 888   888   888    888 .  888   888   888  `88bod8P'  
//  `Y8bod8P' `Y8bod88P" o888o   "888" o888o o888o o888o `8oooooo.  
//                                                       d"     YD  
//                                                       "Y88888P'  
//======================================================================
index.php
?>
slate.php
require_once('common.php');

// read the slate name and make sure it is sensible
$slateName = $_GET['slate'];
if(!$slateName){$slateName='welcome';}
if(preg_match("/[a-z]{4,20}/i",$slateName)==0){$slateName='welcome';}

// find it in the slates
$fname  = SLATES . $slateName . '/slate.js';
if(!file_exists($fname)){
   header("HTTP/1.0 404 File $fname Not Found");
   die();
}

// read the data (JSON), strip comments
$slateArray = file($fname);
$slateText = '';
foreach($slateArray as $l){
  $split = explode('//',$l);
  if($split[0]){$slateText .= $split[0];}
}
//print('<hr>'.$slateText.'<hr>');

//  Decode/encode to tidy-up any json errors  
try{
  $slateData = json_decode($slateText);
  $slateJson = json_encode($slateData);
}catch(Exception $e) {
   header("HTTP/1.0 501 File $fname is faulty");
   exit;
}
//print_r($slateData);

// Read the template file and insert into the slate
$fname  = SLATES . $slateName . '/template.htm';
if(!file_exists($fname)){
   header("HTTP/1.0 404 File $fname Not Found");
   die();
}
$slateData->template=file_get_contents($fname);

// Read remaining optional slate files into the slate object
$fname  = SLATES . $slateName . '/help.htm';
if(file_exists($fname)){$slateData->help=file_get_contents($fname);}
$fname  = SLATES . $slateName . '/instruction.htm';
if(file_exists($fname)){$slateData->instruction=file_get_contents($fname);}
$fname  = SLATES . $slateName . '/completion.htm';
if(file_exists($fname)){$slateData->completion=file_get_contents($fname);}
$fname  = SLATES . $slateName . '/slate.css';
if(file_exists($fname)){$slateData->css=file_get_contents($fname);}

// return the slate to the client
send(json_encode($slateData));

?>
Trace Fri 7 Nov at 10:57:58
Trace buffer is empty