Galette API documentation
Gestionnaire d’Adhérents en Ligne Extrêmement Tarabiscoté mais Tellement Efficace
1.0.0
Galette\Entity\Document Class Reference
Inheritance diagram for Galette\Entity\Document:
Collaboration diagram for Galette\Entity\Document:

Public Member Functions

 __construct (Db $zdb, int|ArrayObject $args=null)
 
 getList (string $type=null)
 
 getTypedList ()
 
 canShow (Login $login)
 
 store (array $post, array $files)
 
 remove (array $ids=null)
 
 getURL ()
 
 getId ()
 
 getDocumentFilename ()
 
 setComment (?string $comment)
 
 getComment ()
 
 setType (string $type)
 
 getType ()
 
 getCreationDate (bool $formatted=true)
 
 getSystemTypes (bool $translated=true)
 
 getSystemType (string $type, bool $translated=true)
 
 getTypes ()
 
 handleFiles (array $files)
 
 getErrors ()
 
 writeOnDisk (string $tmpfile, bool $ajax)
 

Public Attributes

const TABLE = 'documents'
 
const PK = 'id_document'
 
const STATUS = 'status'
 
const RULES = 'rules'
 
const ADHESION = 'adhesion'
 
const MINUTES = 'minutes'
 
const VOTES = 'votes'
 
- Public Attributes inherited from Galette\IO\FileInterface
const INVALID_FILENAME = -1
 
const INVALID_EXTENSION = -2
 
const FILE_TOO_BIG = -3
 
const IMAGE_TOO_SMALL = -4
 
const MIME_NOT_ALLOWED = -5
 
const NEW_FILE_EXISTS = -6
 
const INVALID_FILE = -7
 
const CANT_WRITE = -8
 
const MAX_FILE_SIZE = 2048
 
const MIN_CROP_SIZE = 267
 

Protected Member Functions

 removeFile ()
 

Protected Attributes

writeOnDisk as trait_writeOnDisk
 
string $store_path = GALETTE_DOCUMENTS_PATH
 

Detailed Description

Documents

Author
Johan Cwiklinski johan.nosp@m.@x-t.nosp@m.nd.be

Constructor & Destructor Documentation

◆ __construct()

Galette\Entity\Document::__construct ( Db  $zdb,
int|ArrayObject  $args = null 
)

Main constructor

Parameters
Db$zdbDatabase instance
int|ArrayObject<string,int|string>|null$args Arguments

Member Function Documentation

◆ canShow()

Galette\Entity\Document::canShow ( Login  $login)

Check if a document can be shown

Parameters
Login$loginLogin
Returns
boolean

◆ getComment()

Galette\Entity\Document::getComment ( )

Get comment

Returns
?string

◆ getCreationDate()

Galette\Entity\Document::getCreationDate ( bool  $formatted = true)

Get creation date

Parameters
boolean$formattedReturn formatted date (default) or not
Returns
string|DateTime

◆ getDocumentFilename()

Galette\Entity\Document::getDocumentFilename ( )

Get document file name

Returns
string

◆ getErrors()

Galette\Entity\Document::getErrors ( )

Get errors

Returns
string[]

◆ getId()

Galette\Entity\Document::getId ( )

Get document ID

Returns
?int

◆ getList()

Galette\Entity\Document::getList ( string  $type = null)

Get documents

Parameters
string | null$typeType to retrieve
Returns
array<int,Document>
Exceptions
Throwable

◆ getSystemType()

Galette\Entity\Document::getSystemType ( string  $type,
bool  $translated = true 
)

Get system documents types

Parameters
string$typeDocument type
boolean$translatedReturn translated types (default) or not
Returns
string

◆ getSystemTypes()

Galette\Entity\Document::getSystemTypes ( bool  $translated = true)

Get system social types

Parameters
boolean$translatedReturn translated types (default) or not
Returns
array<string,string>

◆ getType()

Galette\Entity\Document::getType ( )

Get type

Returns
string

◆ getTypedList()

Galette\Entity\Document::getTypedList ( )

Get list by type

Returns
array<string, array<int, Document>>
Exceptions
Throwable

◆ getTypes()

Galette\Entity\Document::getTypes ( )

Get all known types

Returns
array<string,string>
Exceptions
Throwable

◆ getURL()

Galette\Entity\Document::getURL ( )

Get file URL

Returns
string

◆ handleFiles()

Galette\Entity\Document::handleFiles ( array  $files)

Handle files

Parameters
array<string,mixed>$files Files sent
Returns
array<string>|true

◆ remove()

Galette\Entity\Document::remove ( array  $ids = null)

Remove document

Parameters
array<int>|null$ids IDs to remove, default to current id
Returns
boolean

◆ removeFile()

Galette\Entity\Document::removeFile ( )
protected

Remove document file

Returns
bool

◆ setComment()

Galette\Entity\Document::setComment ( ?string  $comment)

Set comment

Parameters
?string$comment Comment to set
Returns
self

◆ setType()

Galette\Entity\Document::setType ( string  $type)

Set type

Parameters
string$typeType
Returns
self

◆ store()

Galette\Entity\Document::store ( array  $post,
array  $files 
)

Store document in database

Parameters
array<string,mixed>$post POST data
array<string,mixed>$files Files
Returns
boolean

◆ writeOnDisk()

Galette\Entity\Document::writeOnDisk ( string  $tmpfile,
bool  $ajax 
)

Write file on disk

Parameters
string$tmpfileTemporary file
bool$ajaxIf the file comes from an ajax call (dnd)
Returns
bool|int

The documentation for this class was generated from the following file: