Object: InvFile

The InvFile object is the standard object wrapper for all database records. The InvFile class is extended by other file types (such as InvDocument for example) to add the necessary database tables and field descriptions, and to optionally add new methods or properties where required. As such, the majority of dotAdmin database interactions and accompanying template code will be implemented though a child of the InvFile class.

Methods

create()

Creates a new blank  file. On success returns  true. On error returns false.

delete()

Deletes current open file. On success returns true. On error returns false.

getHTML($name , [$tag])

Fetch value of file variable $name encoded for html output. If the original value is a plain text string, it will be returned HTML escaped and with newlines replaced with <br> tags. If value is not set or does not exist, the method will return null. If $tag is passed, and the original value is a plain text string, it will be wrapped in the $tag as follows <$tag>$response</$tag>

getObjects($name)

Fieldgroup type values in a file will be returned by the getValue() as an array of arrays contain the values. Using getObjects instead returns the data as an array of objects, with each object having getValue() and getHTML() methods of its own for accessing the properties of that fieldset. This is better suited to HTML output in a template.

getValue($name)

Fetch value of file variable $name. Will be returned as a plain text string or and array. If value is not set or does not exist, will return null.

open($id)

Opens a file of id $id. On success, returns true, If no such file exists, or on error, returns false.

openBy($name , $value)

Opens a file where field name $name = value $value. When a single result is found returns true, otherwise returns false.

This method can be used to find documents by more than one SELECT condition by passing arrays of fields and values to the method.

save()

Saves current open file. On success returns id of saved document. On error returns false.

updateValue($name , $value)

Update value of file variable $name to $value. Returns true on success or false on error.

Contact Us

Address: 22a Fishergate York, YO10 4AB · Tel: 01904 636677 · Email: info@dotadmin.com