|
dolibarr 23.0.3
|
Class ExternalModules. More...
Public Member Functions | |
| __construct ($debug=false) | |
| Constructor. | |
| loadRemoteSources ($debug=false) | |
| loadRemoteSources | |
| callApi ($resource, $options=false) | |
| Test if we can access to remote Dolistore market place. | |
| fetchModulesFromFile ($options=array()) | |
| Fetch modules from a cache YAML file. | |
| getCategories ($active=0) | |
| Generate HTML for categories and their children. | |
| getProducts ($options) | |
| Generate HTML for products. | |
| buildSorter (string $key) | |
| Sort an array by a key. | |
| versionCompare ($v1, $v2) | |
| version compare | |
| get_previous_link ($text='<<') | |
| get previous link | |
| get_next_link ($text='> >') | |
| get next link | |
| get_previous_url () | |
| get previous url | |
| get_next_url () | |
| get next url | |
| getPagination () | |
| Generate pagination for navigating through pages of products. | |
| getRemoteYamlFile ($file_source_url, $cache_time) | |
| Get YAML file from remote source and put it into the cache file. | |
| readYaml ($yaml) | |
| Read a YAML string and convert it to an array. | |
| adaptData ($data, $source) | |
| Adapter data fetched from github remote source to the expected format. | |
| applyFilters ($list, $options) | |
| Apply filters to the data. | |
| checkApiStatus () | |
| Check if an Dolistore API is up. | |
| libStatus ($status, $mode=3, $moretext='') | |
| Retrieve the status icon. | |
Protected Member Functions | |
| checkStatusCode ($request) | |
| Check the status code of the request. | |
Class ExternalModules.
Definition at line 26 of file externalModules.class.php.
| ExternalModules::__construct | ( | $debug = false | ) |
Constructor.
| boolean | $debug | Enable debug of request on screen |
Definition at line 143 of file externalModules.class.php.
References getDolGlobalString().
| ExternalModules::adaptData | ( | $data, | |
| $source ) |
Adapter data fetched from github remote source to the expected format.
| array<string,mixed>|list<array<string,array<string,string|null>|string|null>> | $data Data fetched from github remote source | |
| string | $source | Source of the data |
Definition at line 1030 of file externalModules.class.php.
Referenced by getProducts().
| ExternalModules::applyFilters | ( | $list, | |
| $options ) |
Apply filters to the data.
| list<array<string,mixed>> | $list Data to filter |
| array<string,mixed> | $options Options for the filter |
Compare creation times
| array<string,mixed> | $a First product for comparison. |
| array<string,mixed> | $b Second product for comparison. |
Filter packages that have a label or description with the search string
| array<string,mixed> | $package |
Filter the packages that belong to the filtered category
| array<string,mixed> | $package |
Definition at line 1155 of file externalModules.class.php.
Referenced by getProducts().
| ExternalModules::buildSorter | ( | string | $key | ) |
Sort an array by a key.
| string | $key | Key to sort by |
| array<string,mixed> | $a |
| array<string,mixed> | $b |
Definition at line 677 of file externalModules.class.php.
Referenced by getCategories().
| ExternalModules::callApi | ( | $resource, | |
| $options = false ) |
Test if we can access to remote Dolistore market place.
| string | $resource | Resource relative URL ('categories' or 'products') |
| array<string,mixed>|false | $options Options for the request |
Definition at line 202 of file externalModules.class.php.
References getDolGlobalString(), and getURLContent().
Referenced by checkApiStatus(), getCategories(), and getProducts().
| ExternalModules::checkApiStatus | ( | ) |
Check if an Dolistore API is up.
Definition at line 1220 of file externalModules.class.php.
References callApi(), and checkStatusCode().
Referenced by loadRemoteSources().
|
protected |
Check the status code of the request.
| array{status_code:int,response:null|string|array{curl_error_msg:string,errors:array{code:int,message:string}[]}} | $request Response elements of CURL request |
Definition at line 878 of file externalModules.class.php.
Referenced by checkApiStatus().
| ExternalModules::fetchModulesFromFile | ( | $options = array() | ) |
Fetch modules from a cache YAML file.
| array<string,mixed> | $options Options for filter |
Definition at line 260 of file externalModules.class.php.
References dol_syslog(), and readYaml().
Referenced by getProducts().
| ExternalModules::get_next_link | ( | $text = '>>' | ) |
get next link
| string | $text | symbol next |
Definition at line 753 of file externalModules.class.php.
References dol_escape_htmltag().
| ExternalModules::get_next_url | ( | ) |
| ExternalModules::get_previous_link | ( | $text = '<<' | ) |
get previous link
| string | $text | symbol previous |
Definition at line 740 of file externalModules.class.php.
References dol_escape_htmltag().
| ExternalModules::get_previous_url | ( | ) |
get previous url
Definition at line 765 of file externalModules.class.php.
| ExternalModules::getCategories | ( | $active = 0 | ) |
Generate HTML for categories and their children.
| int | $active | The active category id |
Definition at line 284 of file externalModules.class.php.
References buildSorter(), callApi(), and dol_escape_htmltag().
| ExternalModules::getPagination | ( | ) |
Generate pagination for navigating through pages of products.
Definition at line 816 of file externalModules.class.php.
References ajax_autoselect(), and dol_escape_htmltag().
| ExternalModules::getProducts | ( | $options | ) |
Generate HTML for products.
| array<string,mixed> | $options Options for the request |
Definition at line 329 of file externalModules.class.php.
References $id, adaptData(), applyFilters(), callApi(), dol_escape_htmltag(), dol_now(), dol_print_date(), dol_string_nohtmltag(), dol_stringtotime(), dolPrintHTML(), fetchModulesFromFile(), getDolGlobalInt(), getDolOptimizeSmallScreen(), img_picto(), price2num(), and versionCompare().
| ExternalModules::getRemoteYamlFile | ( | $file_source_url, | |
| $cache_time ) |
Get YAML file from remote source and put it into the cache file.
| string | $file_source_url | URL of the remote source |
| int | $cache_time | Cache time |
Definition at line 920 of file externalModules.class.php.
References dol_is_dir(), dol_mkdir(), dol_now(), dolChmod(), and getURLContent().
Referenced by loadRemoteSources().
| ExternalModules::libStatus | ( | $status, | |
| $mode = 3, | |||
| $moretext = '' ) |
Retrieve the status icon.
| mixed | $status | Status |
| mixed | $mode | Mode |
| string | $moretext | More text to show on tooltip |
Definition at line 1241 of file externalModules.class.php.
References dolGetStatus().
| ExternalModules::loadRemoteSources | ( | $debug = false | ) |
loadRemoteSources
| boolean | $debug | Enable debug of request on screen |
Definition at line 174 of file externalModules.class.php.
References checkApiStatus(), dol_is_file(), getDolGlobalInt(), getDolGlobalString(), and getRemoteYamlFile().
| ExternalModules::readYaml | ( | $yaml | ) |
Read a YAML string and convert it to an array.
| string | $yaml | YAML string |
Definition at line 958 of file externalModules.class.php.
Referenced by fetchModulesFromFile().
| ExternalModules::versionCompare | ( | $v1, | |
| $v2 ) |
version compare
| string | $v1 | version 1 |
| string | $v2 | version 2 |
Definition at line 700 of file externalModules.class.php.
Referenced by getProducts().