Blesta Source Documentation

DownloadManagerUrls extends DownloadManagerModel

Download Manager Files

Manages file downloads

Table of Contents

Methods

__construct() Initialize
add() Adds a download url
delete() Deletes an existing download url
get() Fetches an existing download url
getAll() Fetch all download urls for a given company
getByUrl() Fetches an existing download url
getCategoryRoutes() Returns a list of all category routes available for stable urls
getFileRoutes() Returns a list of all files available for stable urls
getList() Fetches a paginated list of download urls
getListCount() Return the total number of download urls returned from DownloadManagerUrls::getList(), useful in constructing pagination for the getList() method.
update() Updates an existing download url
getRules() Retrieves a list of rules to validate add/editing urls
Methods

add()

Adds a download url

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

An array containing:

  • url The slug name for the url
  • category_id The ID of the category where the download file belongs
  • file_id The ID of the file for the download url (optional)
  • company_id The ID of the company (optional)
Return values
int

The ID of the download url

delete()

Deletes an existing download url

public delete(int $url_id) : bool
Parameters
$url_id : int

The ID of the url to delete

Return values
bool

True if the url was successfully removed

get()

Fetches an existing download url

public get(int $url_id) : stdClass
Parameters
$url_id : int

The ID of the download url to fetch

Return values
stdClass

An object representing the download url

getAll()

Fetch all download urls for a given company

public getAll(int $company_id) : array<string|int, mixed>
Parameters
$company_id : int

The ID of the company to which obtain the download urls

Return values
array<string|int, mixed>

An array containing all the download urls

getByUrl()

Fetches an existing download url

public getByUrl(string $url) : stdClass
Parameters
$url : string

The name of the download url to fetch

Return values
stdClass

An object representing the download url

getCategoryRoutes()

Returns a list of all category routes available for stable urls

public getCategoryRoutes(int $company_id[, int $parent_id = null ][, string $parent_route = '' ]) : array<string|int, mixed>
Parameters
$company_id : int

The ID of the company from which to fetch categories

$parent_id : int = null

The parent category ID whose categories to fetch

$parent_route : string = ''

The full category route of the parent category

Return values
array<string|int, mixed>

A list containing all the categories routes

getFileRoutes()

Returns a list of all files available for stable urls

public getFileRoutes(int $company_id) : array<string|int, mixed>
Parameters
$company_id : int

The ID of the company from which to fetch files

Return values
array<string|int, mixed>

A list of all files

getList()

Fetches a paginated list of download urls

public getList(int $company_id[, int $page = 1 ][, array<string|int, mixed> $order_by = ['id' => 'DESC'] ]) : array<string|int, mixed>
Parameters
$company_id : int

The ID of the company to which obtain the download urls

$page : int = 1

The page to return results for (optional, default 1)

$order_by : array<string|int, mixed> = ['id' => 'DESC']

The sort and order conditions (e.g. array('sort_field'=>"ASC"), optional)

Return values
array<string|int, mixed>

An array of stdClass objects representing all download urls

getListCount()

Return the total number of download urls returned from DownloadManagerUrls::getList(), useful in constructing pagination for the getList() method.

public getListCount(int $company_id) : int
Parameters
$company_id : int

The ID of the company to which obtain the download urls

Tags
see
DownloadManagerUrls::getList()
Return values
int

The total number of download urls

update()

Updates an existing download url

public update(int $url_id, array<string|int, mixed> $vars) : int
Parameters
$url_id : int

The ID of the url to update

$vars : array<string|int, mixed>

An array containing:

  • url The slug name for the url
  • category_id The ID of the category where the download file belongs
  • file_id The ID of the file for the download URL (optional)
Return values
int

The ID of the download url

getRules()

Retrieves a list of rules to validate add/editing urls

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

A list of input vars to validate

$edit : bool = false

True to fetch the edit rules, false to fetch the add rules (optional, default false)

Return values
array<string|int, mixed>

A list of rules

Tags
subpackage

plugins.downloadmanager.models

copyright

Copyright (c) 2022, Phillips Data, Inc.

license

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

link

Blesta


        
On this page

Search results