dolibarr 25.0.0-alpha
Websites Class Reference
Inheritance diagram for Websites:
Collaboration diagram for Websites:

Public Member Functions

 __construct ()
 Constructor.
 
 get ($id)
 Get properties of a website object by id.
 
 getByRef ($ref)
 Get properties of a website object by ref.
 
 index ($sortfield="t.rowid", $sortorder='ASC', $limit=100, $page=0, $sqlfilters='', $properties='')
 List websites.
 
 indexPages ($id, $sortfield="t.pageurl", $sortorder='ASC', $limit=100, $page=0, $sqlfilters='', $properties='')
 List pages of a website.
 
 getPage ($id, $pageid)
 Get properties of a website page by id.
 
 putPage ($id, $pageid, $request_data=null)
 Update a website page.
 
- Public Member Functions inherited from DolibarrApi
 __construct ($db, $cachedir='', $refreshCache=false)
 Constructor.
 

Protected Member Functions

 _cleanObjectDatas ($object)
 Clean sensible object datas @phpstan-template T.
 
- Protected Member Functions inherited from DolibarrApi
 _checkValForAPI ($field, $value, $object)
 Check and convert a string depending on its type/name.
 
 _checkValExtrafieldsForAPI ($field, $value, $object)
 Check and convert a string depending on its type/name.
 
 _filterObjectProperties ($object, $properties)
 Filter properties that will be returned on object.
 
 _checkFilters ($sqlfilters, &$error='')
 Return if a $sqlfilters parameter is valid Function no more used.
 

Private Member Functions

 _fetchWebsite ($id, $ref='')
 Get properties of a website object.
 
 _regeneratePageFiles ($website, $websitepage)
 Regenerate static page files on disk (master.inc.php, alias, tpl content).
 

Additional Inherited Members

- Static Protected Member Functions inherited from DolibarrApi
static _checkAccessToResource ($resource, $resource_id=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $parenttableforentity='')
 Check access by user to a given resource.
 
static _forge_criteria_callback ($matches)
 Function to forge a SQL criteria from a Generic filter string.
 

Detailed Description

Definition at line 37 of file api_websites.class.php.

Member Function Documentation

◆ _cleanObjectDatas()

Websites::_cleanObjectDatas ( $object)
protected

Clean sensible object datas @phpstan-template T.

Parameters
Object$objectObject to clean
Returns
Object Object with cleaned properties

@phpstan-param T $object @phpstan-return T

Reimplemented from DolibarrApi.

Definition at line 438 of file api_websites.class.php.

References $object.

Referenced by _fetchWebsite(), getPage(), index(), indexPages(), and putPage().

◆ _fetchWebsite()

Websites::_fetchWebsite ( $id,
$ref = '' )
private

Get properties of a website object.

Parameters
int$idID of website
string$refRef of website
Returns
Object Object with cleaned properties @phan-return Website @phpstan-return Website
Exceptions
RestException400 Bad value for parameter id or ref
RestException403 Access denied
RestException404 Website not found

Definition at line 522 of file api_websites.class.php.

References $id, DolibarrApi\_checkAccessToResource(), and _cleanObjectDatas().

Referenced by get(), and getByRef().

◆ _regeneratePageFiles()

Websites::_regeneratePageFiles ( $website,
$websitepage )
private

Regenerate static page files on disk (master.inc.php, alias, tpl content).

This replicates the behavior of the web interface in htdocs/website/index.php when a page is updated (action = updatesource/updatecontent).

Parameters
Website$websiteWebsite object
WebsitePage$websitepageWebsitePage object
Returns
void

Definition at line 553 of file api_websites.class.php.

References $conf, dol_mkdir(), dol_syslog(), dolSaveMasterFile(), dolSavePageAlias(), and dolSavePageContent().

Referenced by putPage().

◆ get()

Websites::get ( $id)

Get properties of a website object by id.

Return an array with website information.

Parameters
int$idID of website
Returns
array|mixed Properties of website @phan-return Website @phpstan-return Website

@url GET {id}

Exceptions
RestException403 Access denied
RestException404 Website not found

Definition at line 76 of file api_websites.class.php.

References $id, and _fetchWebsite().

◆ getByRef()

Websites::getByRef ( $ref)

Get properties of a website object by ref.

Return an array with website information.

Parameters
string$refRef of website
Returns
array|mixed Properties of website @phan-return Website @phpstan-return Website

@url GET ref/{ref}

Exceptions
RestException403 Access denied
RestException404 Website not found

Definition at line 96 of file api_websites.class.php.

References _fetchWebsite().

◆ getPage()

Websites::getPage ( $id,
$pageid )

Get properties of a website page by id.

Return an array with page information.

Parameters
int$idID of website
int$pageidID of page
Returns
array|mixed Object with cleaned properties @phan-return WebsitePage @phpstan-return WebsitePage

@url GET {id}/pages/{pageid}

Exceptions
RestException403 Access denied
RestException404 Website or page not found

Definition at line 305 of file api_websites.class.php.

References $id, DolibarrApi\_checkAccessToResource(), and _cleanObjectDatas().

◆ index()

Websites::index ( $sortfield = "t.rowid",
$sortorder = 'ASC',
$limit = 100,
$page = 0,
$sqlfilters = '',
$properties = '' )

List websites.

Get a list of websites

Parameters
string$sortfieldSort field
string$sortorderSort order
int$limitLimit for list
int$pagePage number
string$sqlfiltersOther criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%')"
string$propertiesRestrict the data returned to these properties. Ignored if empty. Comma separated list of properties names
Returns
array Array of website objects @phan-return Website[] @phpstan-return Website[]
Exceptions
RestException400 Bad sqlfilters
RestException403 Access denied
RestException503 Error retrieving list of websites

Definition at line 120 of file api_websites.class.php.

References _cleanObjectDatas(), DolibarrApi\_filterObjectProperties(), and forgeSQLFromUniversalSearchCriteria().

◆ indexPages()

Websites::indexPages ( $id,
$sortfield = "t.pageurl",
$sortorder = 'ASC',
$limit = 100,
$page = 0,
$sqlfilters = '',
$properties = '' )

List pages of a website.

Get a list of pages for a given website

Parameters
int$idID of website
string$sortfieldSort field
string$sortorderSort order
int$limitLimit for list
int$pagePage number
string$sqlfiltersOther criteria to filter answers separated by a comma. Syntax example "(t.pageurl:like:'home')"
string$propertiesRestrict the data returned to these properties. Ignored if empty. Comma separated list of properties names
Returns
array Array of website page objects @phan-return WebsitePage[] @phpstan-return WebsitePage[]

@url GET {id}/pages

Exceptions
RestException400 Bad sqlfilters
RestException403 Access denied
RestException404 Website not found
RestException503 Error retrieving list of pages

Definition at line 212 of file api_websites.class.php.

References $id, DolibarrApi\_checkAccessToResource(), _cleanObjectDatas(), DolibarrApi\_filterObjectProperties(), and forgeSQLFromUniversalSearchCriteria().

◆ putPage()

Websites::putPage ( $id,
$pageid,
$request_data = null )

Update a website page.

Update a page of a website by its ID. The request data can include any field of the website_page table (title, description, content, pageurl, status, etc.).

Parameters
int$idID of website
int$pageidID of page to update
array$request_dataPage data @phan-param ?array<string,string> $request_data @phpstan-param ?array<string,string> $request_data
Returns
array|mixed Object after update @phan-return WebsitePage @phpstan-return WebsitePage

@url PUT {id}/pages/{pageid}

Exceptions
RestException403 Access denied
RestException404 Website or page not found
RestException500 Error updating page

Definition at line 354 of file api_websites.class.php.

References $id, DolibarrApi\_checkAccessToResource(), DolibarrApi\_checkValExtrafieldsForAPI(), DolibarrApi\_checkValForAPI(), _cleanObjectDatas(), _regeneratePageFiles(), dolKeepOnlyPhpCode(), and sanitizeVal().


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