Blesta Source Documentation

ClientDocumentsFiles extends ClientDocumentsModel

Client Documents Files model

Table of Contents

Methods

__construct() Constructor
add() Adds a new document
delete() Deletes a document
get() Retrieves a document
getAll() Retrieves all documents for a given client
makeFileName() Converts the given file name into an appropriate file name to store to disk
getRules() Return rules required for validating documents
Methods

add()

Adds a new document

public add(array<string|int, mixed> $vars, array<string|int, mixed> $files) : int
Parameters
$vars : array<string|int, mixed>

A list of input vars including:

  • client_id
  • name
  • description
$files : array<string|int, mixed>

A list of files in the format of post data $_FILES

Return values
int

The ID of the document added, void on error

delete()

Deletes a document

public delete(int $document_id) : mixed
Parameters
$document_id : int

The ID of the document to delete

get()

Retrieves a document

public get(int $document_id) : mixed
Parameters
$document_id : int

The ID of the document to fetch

Return values
mixed

A stdClass object representing the document, false if no such document exists

getAll()

Retrieves all documents for a given client

public getAll(int $client_id[, array<string|int, mixed> $order_by = ['date_added' => 'desc'] ]) : array<string|int, mixed>
Parameters
$client_id : int

The ID of the client whose documents to fetch

$order_by : array<string|int, mixed> = ['date_added' => 'desc']

A key/value pair where each key is a field and each value is the sort direction

Return values
array<string|int, mixed>

An array of stdClass objects, each representing a document

makeFileName()

Converts the given file name into an appropriate file name to store to disk

public makeFileName(string $file_name) : string
Parameters
$file_name : string

The name of the file to rename

Return values
string

The rewritten file name in the format of YmdTHisO_[hash][ext] (e.g. 20121009T154802+0000_1f3870be274f6c49b3e31a0c6728957f.txt)

getRules()

Return rules required for validating documents

private getRules(array<string|int, mixed> $vars[, bool $edit = false ]) : array<string|int, mixed>
Parameters
$vars : array<string|int, mixed>

An array of input data

$edit : bool = false

Whether or not this is an edit

Return values
array<string|int, mixed>

An array of rules

Tags
subpackage

plugins.clientdocuments

copyright

Copyright (c) 2014, Phillips Data, Inc.

license

http://www.blesta.com/license/ The Blesta License Agreement

link

Blesta


        
On this page

Search results