Skip to main content

Portale v2

Webservice REST


Handler: include/Webservices/CustomerPortal.php

Headers:
• Authorization: Basic base64_encode("username:accesskey")
• Content-Type: application/json

NomeName ParametriParameters DescrizioneDescription
portal.info   PermetteAllows diyou ottenereto informazioniobtain sullainformation licenzaon ethe ilicense loghiand utilizzatilogos dall'installazioneused diby the connected vtenext collegata.installation.
portal.login
Body
. username: string (*)
. password: string (*)
. language: string
PermetteAllows diyou eseguireto illog loginin nelto portalethe clienticustomer fornendoportal l'by providing the email (username) e laand password delof contatto.the Ilcontact. servizioThe restituisceservice l'returns the accesskey dato utilizzarebe nelleused chiamatein successivesubsequent comecalls as a header (Authorization).
portal.logout

Headers

. Authorization

PermetteAllows diyou eseguire ilto logout delthe contattocontact dalfrom portale.the portal.
portal.send_mail_for_password
Body
. email: string (*)
. language: string
PermetteAllows ilyou recuperoto dellarecover the password diof una contatto del portale.contact.
portal.modules_list

Headers

. Authorization

Body
. language: string (*)
PermetteAllows diyou ottenereto unaobtain listaa dilist moduliof abilitatimodules perenabled ilfor profilothe delcontact's contatto.profile.
portal.get_list

Headers

. Authorization

Body

. module: string (*)

. language: string

. folderid: int

PermetteAllows diyou ottenereto laobtain listathe deilist recordof direcords unof moduloa filtratimodule perfiltered laby visibilitàthe delvisibility contatto/aziendaof delthe contatto.contact/contact's Ilcompany. parametroThe "folderid" vieneparameter utilizzatois dalused moduloby the Documents permodule ottenereto iget documentithe didocuments unaof cartellaa specifica.specific folder.
portal.get_blocks

Headers

. Authorization

Body

. module: string (*)

. language: string

. mode: string (edit, create, detail, list) (*)

PermetteAllows diyou ottenereto laobtain listathe deilist blocchiof ethe deiblocks relativiand campithe direlated unfields moduloof filtratia permodule lafiltered visibilitàby delthe profilo.profile visibility.
portal.get_record

Headers

. Authorization

Body

. module: string (*)

. id: int (*)

SeIf ilthe contattocontact hahas ivisibility permessipermissions difor visibilitàthe perindicated ilrecord, recordit indicato,allows permetteyou dito ottenereobtain iits suoi dati.data.

portal.save_record

Headers

. Authorization

Body

. module: string (*)

. id: int (*)

. values: encoded (*)

SeIf ilthe contattocontact hahas iwrite permessipermissions difor scritturathe perindicated ilrecord, recordit indicato,allows permetteits il suo salvataggio.saving.
portal.delete_record

Headers

. Authorization

Body

. module: string (*)

. id: int (*)

SeIf ilthe contattocontact hahas idelete permessipermissions difor eliminazionethe perindicated ilrecord, recordit indicato,allows permetteits la sua cancellazione.deletion.
portal.write_ticket_comment

Headers

. Authorization

Body

. id: int (*)

. comment: string (*)

PermetteAllows layou scritturato diwrite una commentocomment all'internowithin delthe ticketindicated indicato.ticket.
portal.get_attachments

Headers

. Authorization

Body

. id: int (*)

PermetteAllows diyou ottenereto laobtain listathe deilist documentiof deldocuments of the specified record specificatofiltered filtratiby perthe lavisibility visibilitàof delthe contatto/aziendacontact/contact's del contatto.company.
portal.download_attachment

Headers

. Authorization

Body

. relid: int (*)

. docid: int

SeIf ilthe contattocontact hahas ilpermission permessoto diview visualizzarethe l'allegatoattachment (relid), permetteit ilallows suoits download.
portal.upload_attachment

Headers

. Authorization

Body

. relid: int (*)

. title: string (*)

PermetteAllows ilthe caricamentouploading diof unan allegatoattachment relazionatorelated alto the specified record specificato (relid). SiYou puòcan indicareindicate ilthe nomename (title) delof documentothe chedocument verràthat generato.will be generated.
portal.provide_confidential_info

Headers

. Authorization

Body

. id: int (*)

. comments: string

. data: string (*)

. request_commentid: int (*)

PermetteAllows diyou rispondereto adrespond unato richiestaa direquest informazionifor confidenziali.confidential Ilinformation. parametroThe "id" indicaparameter l'idindicates delthe ticket,ticket ilid, parametrothe "comments" indicaparameter ilindicates commentothe nonunencrypted cifrato,comment, il parametrothe "data" indicaparameter laindicates rispostathe confidenzialeconfidential eresponse, iland parametrothe "request_commentid" indicaparameter l'indicates the id delof commentothe acomment cuito fornirewhich lathe rispostaconfidential confidenziale.response should be provided .
portal.get_home_widgets

Headers

. Authorization

Body

. language: string

PermetteAllows diyou ottenereto iobtain widgetthe configuratiwidgets nelconfigured profiloin associatothe alprofile contatto.associated with the contact.
portal.save_authenticate_cookie

Headers

. Authorization

Body

. contactid: int (*)

FornisceProvides unan hash dato memorizzarebe stored in una cookie perto permettereremember dithe ricordarecontact's l'accesso del contatto.login.
portal.check_authenticate_cookie

Headers

. Authorization

Body

. contactid: int (*)

. hash: string (*)

PermetteAllows diyou verificareto l'verify the hash utilizzatoused perto ricordareremember l'accessothe delcontact's contatto.login.
portal.change_password

Headers

. Authorization

Body

. username: string (*)

. old_password: string (*)

. password: string (*)

. language: string

PermetteAllows diyou cambiareto lachange passwordthe delcontact's contatto.password.
RegistrareRegister una nuovonew REST webservice REST

QuestoThis script devemust esserebe eseguitorun in una file all'interno diwithin vtenext (es.e.g. plugins/script/script.php).

$parameters = ['param1' => 'string', 'param2' => 'encoded'];
$perm = 'read'; // read, write, readwrite
SDK::setRestOperation('portal.foo', 'include/Webservices/CustomerPortal.php', 'CustomerPortalRestApi.foo', $parameters, $perm);
EstendereExtend unan webserviceexisting REST esistentewebservice

QuestoThis script devemust esserebe eseguitorun in una file all'interno diwithin vtenext (es.e.g. "plugins/script/script.php").

SDK::setClass('CustomerPortalRestApi', 'CustomerPortalRestApi2', 'modules/SDK/src/CustomerPortalRestApi2.php');

CreareCreate una nuovonew file dato posizionareplace all'interno diinside vtenext (es.e.g. "modules/SDK/src/CustomerPortalRestApi2.php").

<?php
require_once('include/Webservices/CustomerPortal.php');

class CustomerPortalRestApi2 extends CustomerPortalRestApi {

	function get_list($module, $language, $folderid = 0) {
		// return parent::get_list($module, $language, $folderid);
		// your custom code here
	}

}

StrutturaStructure delleof cartelle/filemain principalifolders/files


LaThe cartellaportal delfolder portaleis silocated trovaat: in: VTE_ROOT/portal/v2

LeThe cartelle/filemain principalifolders/files delof nuovothe portalenew sono:portal are:

NomeFolder/file cartella/filename DescrizioneDescription
app ContieneContains ithe filefiles eand lethe logichelogic perof ilthe funzionamento del portale.portal.
app/controllers ContieneContains ithe filefiles chethat gestisconomanage lethe azioni diportal's default del portaleactions (es.e.g. Login, Logout, Edit, Detail, ecc.etc.).
app/fields ContieneContains ithe filefiles chethat gestisconomanage ithe campiportal deimodule moduli del portale.fields.
app/modules Contiene delle logicheContains custom dilogic alcuniof moduli disome vtenext modules (es.e.g. Documents, Processes, HelpDesk, ecc.etc.).
app/PortalModule.php ClasseClass chethat gestiscemanages lethe azioniactions deiof modulithe delportal portalemodules (es.e.g. Create, Detail, Edit, ecc.etc.). LaThe classeclass puòcan esserebe estesaextended perto modificarechange i comportamenti dithe default dibehaviors unof modulo.a module.
config ContieneContains ithe fileportal diconfiguration configurazione del portale.files.
public ContieneContains ithe fileportal's pubblicipublic del portalefiles (es.e.g. index.php, css, javascript, immagini,images, ecc.etc.).
resources ContieneContains lethe risorseresources utilizzateused dalby portalethe comeportal isuch fileas pertranslation le traduzionifiles (lang) eand i templatetemplates (templates).
sdk LaThe cartellafolder èis utilizzataused perto inserireinsert nuovenew personalizzazionicustomizations perfor ilthe cliente.customer.
storage ContieneContains itemporary file temporaneifiles (es.e.g. cache, logs, ecc.etc.).
vendor ContieneContains lethe librerieexternal esternelibraries utilizzateused dalby portale.the portal.

Request lifecycle


 

drawing-6-1694591374.png

 

ConfigurazionePortal del portaleconfiguration


IlThe portal configuration file diis configurazione del portale si trovalocated in "config/portal.config.php".

PerTo sovrascrivereoverwrite ithe parametriparameters deve essere utilizzato il filethe "config/sdk.config.php" altrimenti,file must be used otherwise, in casocase diof aggiornamentoupdating dellathe versioneversion diof vtenext, lethe modifichechanges potrebberocould esserebe perse.lost.

EccoHere lais listathe deilist parametriof supportatiparameters dalsupported nuovoby portale:the new portal:

ParametroParameter TipoType Default DescrizioneDescription
portal_url String $PORTAL_URL
(config.inc.php)
IndicaIndicates l'the URL delof portalethe clienti.customer Seportal. laIf cartellathe delportal portalefolder siis trovainside all'internothe dellavtenext root directorydirectory, dithe vtenext,variable lawill variabilebe verràset impostatato conthe ilvalue valoreof della variabilethe $PORTAL_URL impostatavariable nelset filein the config.inc.php.php file.
vte_url String $site_URL (config.inc.php) IndicaIndicates l'the URL diof vtenext eand vieneis utilizzatoused perto ottenereobtain iits relatividata dativia tramite lethe rest API. SeIf lathe cartellaportal delfolder portaleis siinside trovathe all'interno dellavtenext root directorydirectory, dithe vtenext,variable lawill variabilebe verràset impostatato conthe ilvalue valoreof della variabilethe $site_URL impostatavariable nelset filein the config.inc.php.php file.
default_language
String
it_it
IndicaIndicates lathe linguadefault predefinitalanguage utilizzataused nelin portalethe clienti.customer Ilportal. valoreThe puòvalue esserecan sostituitobe conreplaced unawith linguaa supportatasupported language (vedi parametrosee "languages") parameter).
languages
Array
['en_us' => 'US English', 'it_it' => 'IT Italiano']
IndicaIndicates lethe linguelanguages supportate​​supported nelin portalethe clienti.customer portal.
PerTo aggiungereadd unaa nuovanew lingualanguage siyou deveneed creareto uncreate nuovoa new file nellain cartellathe resources/lang.lang folder.
production
Bool false QuestaThis configurazioneconfiguration indicaindicates sewhether glierrors errorishould devonobe esseredisplayed visualizzatior onot. meno.If Sethe l'ambienteenvironment èis diproduction, produzione,the ilvalue valorewill verràbe impostatoset suto true perto disabilitaredisable laerror visualizzazionedisplay. degliIf errori.the Seenvironment l'ambienteis èdevelopment, dithe sviluppo,value ilwill valorebe verràset impostato suto false perto consentireallow laerrors visualizzazioneto degli errori.appear.
default_module
String   IndicaIndicates ilthe modulodefault predefinitomodule dato caricareload dopoafter l'accessologging alinto portale.the Ilportal. valoreThe puòvalue esserecan sostituitobe conreplaced ilwith nomethe delname moduloof desideratothe desired module (devemust esserebe abilitatoenabled dafrom profilo)profile). SeIf ilthe parametroparameter èis vuoto,empty, verràthe caricata laportal home delwill portale.be loaded.
favicon
String
assets/img/VTENEXT_favicon.ico
IndicaIndicates ilthe percorsopath dellaof faviconthe dafavicon. caricareThe nelvalue portaleis clienti.relative Ilto valorethe èpublic relativo alla cartella public.folder.
login_logo
String
assets/img/VTENEXT_login.png

IndicaIndicates ilthe percorsopath delof the logo dato caricareload all'internoon dellathe paginalogin dipage. login.The Ilvalue valoreis èrelative relativoto allathe cartellapublic public.folder.

[UPDATE] IlThe logo devemust esserebe caricatoloaded nelle impostazioni diin vtenext settings > Loghi.Logos.

login_background
String   IndicaIndicates ilthe percorsopath delloof sfondothe dabackground caricareto all'internoload dellaon paginathe dilogin login.page. IlThe valorevalue èis relativorelative allato cartellathe public.public folder.
header_logo_sm
String
assets/img/VTENEXT_toggle.png
IndicaIndicates ilthe percorsopath dell'iconaof dathe caricareicon nellato barraload lateralein minimizzata.the Ilminimized valoresidebar. èThe relativovalue allais cartellarelative public.to the public folder.
[UPDATE] L'iconaThe deveicon esseremust caricatabe nelleloaded impostazioni diin vtenext settings > Loghi.Logos.
header_logo_lg
String
assets/img/VTENEXT_header.png
IndicaIndicates ilthe percorsopath dell'iconaof dathe caricareicon nellato barraload lateralein allargata.the Ilexpanded valoresidebar. èThe relativovalue allais cartellarelative public.to the public folder.
[UPDATE] L'iconaThe deveicon esseremust caricatabe nelleloaded impostazioni diin vtenext settings > Loghi.Logos.
helpdesk_logo
String
assets/img/helpdesk.png
IndicaIndicates ilthe logo utilizzatoused perto visualizzaredisplay lathe rispostaresponse datagiven dall'assistenzaby clienti.customer Ilsupport. valoreThe èvalue relativois allarelative cartellato public.the public folder.
sidebar_theme
String
sidebar-dark-primary
IndicaIndicates lathe classeclass dellaof barrathe lateralemain principale.sidebar.
PuòIt averecan unahave luminositàa "dark" oor "light". brightness.
PuòIt averecan anchealso unahave variantea dicolor colore,variant, comesuch as "primary", "success", "warning", "info", "danger".
enable_sidebar_search
Bool
false
ConsenteEnable/disable dithe attivare/disattivaresearch labar barrain dithe ricercamain nella barra laterale principale.sidebar.
csrf_secret
String
$csrf_secret (config.inc.php)
IndicaIndicates lathe chiavesecret segretakey utilizzataused perto generaregenerate una tokencsrf csrf.token. SeIf lathe cartellaportal delfolder portaleis siinside trovathe all'interno dellavtenext root directorydirectory, dithe vtenext,variable lawill variabilebe verràset impostatato conthe ilvalue valoreof della variabilethe $csrf_secret impostatavariable nelset filein the config.inc.php.php file.
upload_dir
String   IndicaIndicates ilthe nomename dellaof cartellathe utilizzatafolder perused ilfor caricamentouploading dei file.files.
browser_title_prefix
String   IndicaIndicates l'etichettathe delprefix prefissolabel dato utilizzareuse perfor ilthe titolobrowser deltitle. browser.The Ilvalue valorecan puòbe esserereplaced sostituitowith conthe l'etichettadesired desiderata.label.
browser_title_suffix
String
customer_portal
IndicaIndicates l'etichettathe delsuffix suffissolabel dato utilizzareuse perfor ilthe titolobrowser deltitle. browser.The Ilvalue valorecan puòbe esserereplaced sostituitowith conthe l'etichettadesired desiderata.label.
remember_cookie_name
String
portal_login_hash
IndicaIndicates ilthe nomename delof the cookie utilizzatoused perto ricordareremember l'autenticazioneuser dell'utente.authentication.
login_expire_time
Int
2592000 (one month)
IndicaIndicates lathe scadenzaexpiration delof the cookie utilizzatoused perto ricordareremember l'autenticazioneuser dell'utente.authentication. IlThe valorevalue puòcan esserebe sostituitoreplaced conwith ilthe numerodesired dinumber secondiof desiderato.seconds.
default_timezone
String
Europe/Rome
IndicaIndicates ilthe fusodefault orariotime predefinitozone utilizzatoused nelin portalethe clienti.customer Questaportal. configurazioneThis deveconfiguration esseremust ugualebe allathe variabilesame as the $default_timezone impostatavariable nelset filein the vtenext config.inc.php di vtenext.file.
module_icons
Array
[]
ConWith questathis configurazioneconfiguration èyou possibilecan sovrascrivereoverride lethe iconedefault predefiniteicons utilizzateused perfor imodules modulienabled abilitatiin nelthe portalecustomer clienti.portal. LeThe iconedefault predefiniteform deiicons moduliare si trovanofound in app/layouts/PortalLayout.php. IThe nominames delleof iconethe siicons possonocan trovarebe quifound here https://fonts.google.com/icons.
sdk_languages
Array
[]
ConWith questathis configurazioneconfiguration siyou possonocan aggiungereadd nuovenew etichettelabels oor modificaremodify quelleexisting esistenti.ones.
SiYou deveneed creareto uncreate nuovoa new file nellain cartellathe sdk.sdk folder.
sdk_global_php
Array
[]
ConWith questathis configurazioneconfiguration siyou possonocan aggiungereadd php files to load on each page (they should contain classes/functions).
You need to create a new file php da caricare in ognithe paginasdk (dovrebbero contenere classi/funzioni).
Si deve creare un nuovo file nella cartella sdk.folder.
sdk_global_js
Array
[]
ConWith questathis configurazioneconfiguration siyou possonocan aggiungereadd js dato caricareload globally.
You need to create a livello globale.
Si deve creare un nuovonew file nellain cartellathe public/assets/sdk.sdk folder.
sdk_module_js
Array
[]
ConWith questathis configurazioneconfiguration siyou possonocan aggiungereadd js dato caricareload perfor una modulospecific specifico.module.
SiYou deveneed creareto uncreate nuovoa new file nellain cartellathe public/assets/sdk.sdk folder.
sdk_global_css
Array
[]
ConWith questathis configurazioneconfiguration siyou possonocan aggiungereadd css dato caricareload globally.
You need to create a livello globale.
Si deve creare un nuovonew file nellain cartellathe public/assets/sdk.sdk folder.
sdk_controllers
Array
[]
ConWith questathis configurazioneconfiguration siyou possonocan aggiungereadd azionicustom personalizzateactions (campo "action" nell'url)field in the URL). 
L'The array rappresentarepresents un'associazionean traassociation ilbetween nomethe dell'azioneaction ename iland the file chethat contienecontains la classethe controller perclass gestireto lahandle richiesta.the request.
SiYou deveneed creareto uncreate nuovoa new file nellain cartellathe sdk.sdk folder.
sdk_module
Array
[]
ConWith questathis configurazioneconfiguration siyou possonocan aggiungereadd personalizzazionicustomizations suon una modulospecific specifico.module.
L'The array rappresentarepresents un'associazionean traassociation ilbetween nomethe delmodule moduloname eand ilthe file chethat contienecontains lathe classemodule's estesaextended delclass. modulo.
SiYou deveneed creareto uncreate nuovoa new file nellain cartellathe sdk.sdk folder.
sdk_menu
Array
[]
ConWith questathis configurazioneconfiguration siyou possonocan aggiungereadd aggiungere voci dicustom menu personalizzateitems nellain barrathe laterale.sidebar.
SiYou deveneed creareto uncreate nuovoa new file nellain cartellathe sdk.sdk folder.

API Reference - Classi,Main metodi,classes, funzionimethods, efunctions variabiliand principalivariables


\app\Request
MetodoMethod ArgomentiArguments DescrizioneDescription
get()
$keys = null, $purify = false

PermetteAllows diyou ottenereto unoget oone piùor parametrimore dallaparameters variabilefrom globalethe global variable $_GET. SeIf ilthe secondosecond argomentoargument èis impostatoset ato "true", ithe parametriparameters vengonoare purificatipurified attraversothrough la libreriathe HTML Purifier.Purifier Esempio:library. Example:

$request->get('foo');
$request->get(['foo', 'bar']);
$request->get('foo', true);
post()
$keys = null, $purify = false

PermetteAllows diyou ottenereto unoget oone piùor parametrimore dallaparameters variabilefrom globalethe global variable $_POST. SeIf ilthe secondosecond argomentoargument èis impostatoset ato "true", ithe parametriparameters vengonoare purificatipurified attraversothrough la libreriathe HTML Purifier.Purifier Esempio:library. Example:

$request->post('foo');
$request->post(['foo', 'bar']);
$request->post('foo', true);
files()
$key

PermetteAllows diyou ottenereto iget filefiles caricatiuploaded attraversovia il metodothe HTTP POST emethod organizzatiand tramiteorganized lavia variabilethe globaleglobal variable $_FILES.

$request->files('attachments');
cookie()
$keys = null, $purify = false

PermetteAllows diyou ottenereto unoobtain oone piùor parametrimore dallaparameters variabilefrom globalethe global variable $_COOKIE. SeIf ilthe secondosecond argomentoargument èis impostatoset ato "true", ithe parametriparameters vengonoare purificatipurified attraversothrough la libreriathe HTML Purifier.Purifier Esempio:library. Example:

$request->cookie('foo');
server()
$keys = null, $purify = false

PermetteAllows diyou ottenereto unoget oone piùor parametrimore dallaparameters variabilefrom globalethe global variable $_SERVER. SeIf ilthe secondosecond argomentoargument èis impostatoset ato "true", ithe parametriparameters vengonoare purificatipurified attraversothrough la libreriathe HTML Purifier.Purifier Esempio:library. Example:

$request->server('');
isGet()
  RitornaReturns true seif ilthe metodorequest dellamethod richiesta èis GET.
isPost()
  RitornaReturns true seif ilthe metodorequest dellamethod richiesta èis POST.
isAjax()
  RitornaReturns true seif lathe richiestarequest èis AJAX.​
purify()
$input
PurificaPurify la variabilethe $input attraverso lavariable libreriathrough the HTML Purifier.Purifier library.
\app\Response
MetodoMethod ArgomentiArguments DescrizioneDescription
__construct()
$content = '', $statusCode = 200, $headers = []
InizializzaInitializes una nuovo oggettonew \app\Response() conobject ilwith contenutothe dellaresponse rispostacontent ($content), ilreturn codice di ritornocode ($statusCode), e gli header diand default headers ($headers).
setContent()
$content
ImpostaSet ilthe contenutocontent dellaof risposta.the response.
setStatusCode()
$statusCode
ImpostaSet ilthe codiceresponse direturn ritorna della risposta.code.
setHeader()
$header, $replace = true
ImpostaSet una nuovonew header nellain risposta.the Conresponse. ilWith secondothe argomentosecond èargument possibileit indicareis sepossible l'headerto deveindicate sostituirewhether oppureor nonot unthe header precedentemust giàreplace impostato.a previous header already set.
setMimeType()
$mimeType = 'text/html'

ImpostaSets ilthe mimeresponse delcontent contenuto della risposta.mime.

json()
$data
ImpostaSet ilresponse contenutocontent della risposta conwith $data convertitoconverted in formatoto JSON eformat mimeand 'application/json'. mime.
redirect()
$page
EseguePerforms una redirect versoto $page.
downloadFile()
$fullpath
PermetteAllows lodownloading scaricamentoof di una file posizionatolocated in $fullpath.
output()
  EsegueOutputs l'outputthe delcontent, contenuto,response delcode, codiceand diheaders rispostayou e degli header impostati.set.
\app\Session
MetodoMethod ArgomentiArguments DescrizioneDescription
set()
$key, $value = ''
ImpostaSet ilthe valorevalue $value conwith chiavekey $key in $_SESSION.
get()
$key
PermetteAllows diyou ottenereto ilget valorethe convalue chiavewith key $key dafrom $_SESSION.
flash()
$key PermetteAllows diyou ottenereto ilget valorethe convalue chiavewith key $key dafrom $_SESSION. Successivamente,Next, la chiavethe $key verràwill eliminatabe dadeleted from $_SESSION.​
remove()
$key EliminaDelete la chiavethe $key dafrom $_SESSION.
hasKey()
$key RitornaReturns true se esiste la chiaveif $key exists in $_SESSION.
setMulti()
$keys PermetteAllows diyou scrivereto valoriwrite multiplimultiple invalues ​​to $_SESSION.
removeMulti()
$keys
EliminaDelete valorimultiple multiplivalues ​​in $_SESSION.
append()
$key, $value = ''
ImpostaSet la chiavethe $key comeas unan array in $_SESSION eand ilthe valorevalue $value vieneis aggiuntoadded ato quest'ultimo.it.
\app\Config
MetodoMethod ArgomentiArguments DescrizioneDescription
has()
$key
RitornaReturns true se esiste la chiaveif $key nellaexists configurazionein globale.the global configuration.
get()
$key
PermetteAllows diyou ottenereto ilget valorethe convalue chiavewith key $key dallafrom configurazionethe globale.global configuration.
set()
$key, $value
ImpostaSet ilthe valorevalue $value conwith chiavekey $key nellain configurazionethe globale.global configuration.
getAll()
  PermetteIt diallows ottenereyou unato listaobtain chiave-valorea conkey-value tuttalist lawith configurazioneall globale.the global configuration.
setMulti()
$values
PermetteAllows diyou scrivereto valoriwrite multiplimultiple nellavalues configurazione​​into globale.the global configuration.
clear()
$key
EliminaDelete la chiavethe $key dallafrom configurazionethe globale.global configuration.
clearAll()
  EliminaDelete tuttiall ivalues valori​​from dallathe configurazioneglobal globale.configuration.
\app\PortalModule
VariabileVariable Default DescrizioneDescription
$hasComments
false
IndicaIndicates sewhether ilthe modulomodule supportasupports il blocco commenti.comments.
$hasAttachments
false
IndicaIndicates sewhether ilthe modulomodule supportasupports gli allegati.attachments.
$enableEdit
true
IndicaIndicates sewhether ilthe modulomodule puòcan esserebe modificatomodified (modalitàedit edit)mode).
$formColumns
3 IndicaIndicates ilthe numeronumber diof colonnecolumns dato utilizzareuse perfor ladisplaying visualizzazione dei campifields in Create, Edit eand Detail.
$listTemplate
List.tpl
IndicaIndicates ilthe template utilizzatoused perfor ladisplaying visualizzazionea di una listalist (action List).
$referenceListTemplate
sections/ReferenceList.tpl
IndicaIndicates ilthe template utilizzatoused perfor ladisplaying visualizzazionea direlated una lista relazionatalist (uitype 10).
$detailTemplate
Detail.tpl
IndicaIndicates ilthe template utilizzatoused perto ladisplay visualizzazionethe deldetail dettaglioof di una record (action Detail).
$editTemplate
Edit.tpl
IndicaIndicates ilthe template utilizzatoused perto ladisplay visualizzazionethe dellaedit modificaof di una record (action Edit).
$notAuthorizedTemplate
PageNotAuthorized.tpl
IndicaIndicates ilthe template utilizzatoused perto visualizzaredisplay una errorepermission di permessoerror (es.e.g. record nonnot trovatofound oor erroripermission di permessi)errors).
MetodoMethod ArgomentiArguments DescrizioneDescription
__construct()
$module
$module indicaindicates ilthe nomename delof modulothe permodule ottenereto un'instanzaobtain dellaan classe.instance Seof ilthe moduloclass. èIf statothe estesomodule tramitehas sdkbeen alloraextended verràvia ritornataSDK un'istanzathen dellaan classeinstance estesa.of the extended class will be returned.
prepareList()
$viewer, $request
MetodoMethod utilizzatoused perfor ladisplaying visualizzazionea di una listalist (action List).
postProcessList()
$viewer, $request QuestoThis metodomethod puòcan esserebe utilizzatoused dalleby classiextended esteseclasses perto inserire/modificareinsert/modify idata datiset impostati nellain prepareList().
prepareEdit()
$viewer, $request MetodoMethod utilizzatoused perto ladisplay visualizzazionethe dellaedit modificaof di una record (action Edit).
postProcessEdit()
$viewer, $request QuestoThis metodomethod puòcan esserebe utilizzatoused dalleby classiextended esteseclasses perto inserire/modificareinsert/modify ithe datidata impostatiset nellain prepareEdit().
prepareDetail()
$viewer, $request
MetodoMethod utilizzatoused perto ladisplay visualizzazionethe deldetail dettaglioof di una record (action Detail).
postProcessDetail()
$viewer, $request QuestoThis metodomethod puòcan esserebe utilizzatoused dalleby classiextended esteseclasses perto inserire/modificareinsert/modify idata datiset impostati nellain prepareDetail().
saveRecord()
$request
MetodoMethod utilizzatoused perto ilsave salvataggio di una record (action Save).
postProcessSaveValues()
$request, &$values
QuestoThis metodomethod puòcan esserebe utilizzatoused dalleby classiextended esteseclasses perto inserire/modificareinsert/modify idata datiset impostati nellain saveRecord().
isPermitted()
$module, $action = self::ACTION_LIST, $recordValues = []

RitornaReturns seif ilthe contattocontact hahas ilpermission permessoto diperform eseguirea unacertain determinata azione.action.

ListaList azioniof supportate:supported actions:

. ACTION_LIST
. ACTION_CREATE
. ACTION_EDIT
. ACTION_DETAIL
. ACTION_DELETE
. ACTION_SAVE
. ACTION_ADD_COMMENTS
. ACTION_UPLOAD_ATTACHMENTS
. ACTION_CHANGE_PWD
. ACTION_SOLVE_TICKET
\app\clients\PortalRestClient
MetodoMethod ArgomentiArguments DescrizioneDescription
get()
$restName, $queryParameters = [], $headers = [] PermetteAllows diyou eseguireto unaperform richiestaa GET versorequest to vtenext.
post()
$restName, $queryParameters = [], $bodyParameters = [], $headers = [] PermetteAllows diyou eseguireto unaperform richiestaa POST versorequest to vtenext.
postMultipart()
$restName, $queryParameters = [], $bodyParameters = [], $fileParameters = [], $headers = []

PermetteAllows diyou eseguireto unaperform richiestaa multipart POST multipartrequest versoto vtenext.

patch()
$restName, $queryParameters = [], $bodyParameters = [], $headers = []
PermetteAllows diyou eseguireto unaexecute richiestaa PATCH versorequest to vtenext.
delete()
$restName, $queryParameters = [], $headers = []
PermetteAllows diyou eseguireto unaexecute richiestaa DELETE versorequest to vtenext.
postDownload()
$restName, $queryParameters = [], $bodyParameters = [], $headers = []
PermetteAllows diyou eseguireto unaperform richiestaa POST perrequest scaricareto undownload a vtenext file di vtenext in modalitàstream stream.mode.
Helpers
FunzioneFunction ArgomentiArguments DescrizioneDescription
preprint()
$var
print_r formattatoformatted con tagwith <pre> tag
predump()
$var var_dump formattatoformatted con tagwith <pre> tags
encodeForHtml()
$value, $charset = 'UTF-8'
CodificaEncode il valorethe $value pervalue essereto inseritobe ininserted unainto paginaan HTML.HTML page.
encodeForHtmlAttr()
$value, $enclosing = '"'
CodificaEncode il valorethe $value pervalue essereto inseritobe all'internoplaced diinside unan attributo di unHTML tag HTML.attribute.
encodeForJs()
$value, $enclosing = '"'
CodificaEncode il valorethe $value pervalue essereto inseritobe all'internoplaced diinside unoa javascript <script> javascript..
htmlAttr()
$attributes
CodificaEncode unaa listalist diof attributiattributes perto esserebe inseritiplaced all'internoinside dian unHTML tag HTML.tag.
config()
$key
PermetteAllows diyou ottenereto ilget valorethe convalue chiavewith key $key dallafrom configurazionethe globale.global configuration.
trans()
$key, $args = []
PermetteTranslate lathe traduzione di un'etichettalabel $key.
listUrl()
$module
GeneraGenerate una link perto aprireopen unaa lista.list.
createUrl()
$module
GeneraGenerates una link perto aprireopen lathe creazionecreation diof una record.
createDocUrl()
$module, $folderId
GeneraGenerates una link perto aprireopen lathe creazionecreation diof una documento.document.
detailUrl()
$module, $record
GeneraGenerates una link perto aprireopen ilthe dettagliodetail diof una record.
editUrl()
$module, $record
GeneraGenerates una link perto aprireopen lathe modificaediting diof una record.
downloadUrl()
$record, $documentId
GeneraGenerates una link per eseguire ilto download dia un documento.document.
docFolderUrl()
$module, $folderId
GeneraGenerates una link perto aprireopen unaa cartellaspecific specificafolder nelin modulothe documenti.documents module.
returnUrl()
$request
GeneraGenerate una return link di ritorno indietro (es. azionee.g. "Annulla")Cancel" action).
portalLanguage()
  RitornaReturns lathe lingualanguage utilizzataused nelin portale.the portal.
setPortalLanguage()
$language
ImpostaSet la linguathe $language nelin portale.the portal.
getBrowserTitle()
$title
RitornaReturns ilthe titolotitle dato impostarebe set in una paginaan HTML delpage portale.of the portal.
getModuleLabel()
$module
RitornaReturns lathe traduzionetranslation delof modulothe module $module.
getSingleModuleLabel()
$module
RitornaReturns lathe traduzionesingular singolaretranslation delof modulothe module $module.
getMaxUploadSize()
  RitornaReturns lathe dimensione massima dimaximum upload nelsize portale.in the portal.
setPortalCookie()
$name, $value = "", $expires_or_options, $httponly = false
ImpostaSet una cookie nelin portale.the portal.
unsetPortalCookie()
$name, $httponly = false
RimuoveRemoves una cookie dalfrom portale.the portal.
csrfToken()
  RitornaReturns ilthe tokencsrf csrf.token.
csrfInputName()
  RitornaReturns ilthe nomename dell'of the input perfor l'inviosending delthe tokencsrf csrf.token.
flashPortalError()
$error
PermetteAllows diyou visualizzareto undisplay messaggioa ditimed erroreerror temporizzato.message.
flashPortalMessage()
$message
PermetteAllows diyou visualizzareto undisplay messaggioa temporizzato.timed message.
customerId()
  RitornaReturns l'idthe delID contattoof autenticato.the authenticated contact.
customerEmail()
  RitornaReturns l'the email delof contattothe autenticato.authenticated contact.
customerUsername()
  RitornaReturns ilthe nomename eand cognomesurname delof contattothe autenticato.authenticated contact.
resourcever()
$filename
PermetteAllows ilthe versionamentoversioning di fileof css eand javascript.javascript files.
basePath()
$path = ''
RitornaReturns ilthe percorsopath dellato cartellathe portal base delfolder. portale. Se viene indicatoIf $path vieneis creato e restituito un percorsospecified, a partirepath dallais cartellacreated base.and returned starting from the base folder.
appPath()
$path = ''
RitornaReturns ilthe percorsopath dellato cartellathe portal's "app" delfolder. portale. Se viene indicatoIf $path vieneis creato e restituito un percorsospecified, a partirepath dallais cartellacreated and returned starting from the "app". folder.
configPath()
$path = ''
RitornaReturns ilthe percorsopath dellato cartellathe portal's "config" delfolder. portale. Se viene indicatoIf $path vieneis creato e restituito un percorsospecified, a partirepath dallais cartellacreated and returned starting from the "config". folder.
resourcesPath()
$path = ''
RitornaReturns ilthe percorsopath dellato cartellathe portal's "resources" delfolder. portale. Se viene indicatoIf $path vieneis creato e restituito un percorsospecified, a partirepath dallais cartellacreated and returned starting from the "resources". folder.
langPath()
only $lang
RitornaReturns ilthe percorsopath delto the indicated language file della lingua $lang indicata.lang.
storagePath()
$path = ''
RitornaReturns ilthe percorsopath dellato cartellathe portal's "storage" delfolder. portale. Se viene indicatoIf $path vieneis creato e restituito un percorsospecified, a partirepath dallais cartellacreated and returned starting from the "storage". folder.
publicPath()
$path = ''
RitornaReturns ilthe percorsopath dellato cartellathe portal's "public" delfolder. portale. Se viene indicatoIf $path vieneis creato e restituito un percorsospecified, a partirepath dallais cartellacreated and returned starting from the "public". folder.
vtePath()
$path = ''
RitornaReturns ilthe percorsopath dellato cartellathe divtenext vtenext.folder. Se viene indicatoIf $path vieneis creato e restituito un percorsoindicated, a partirepath dallais cartellacreated diand vtenext.returned starting from the vtenext folder.
sdkPath()
$path = ''
RitornaReturns ilthe percorsopath dellato cartellathe portal's "sdk" delfolder. portale. Se viene indicatoIf $path vieneis creato e restituito un percorsoindicated, a partirepath dallais cartellacreated and returned starting from the "sdk". folder.
sdkAssetsPath()
$path = ''
RitornaReturns ilthe percorsopath dellato cartellathe portal's "public/assets/sdk" delfolder. portale. Se viene indicatoIf $path vieneis creato e restituito un percorsospecified, a partirepath dallais cartellacreated and returned starting from the "public/assets/sdk". folder.
publicRelPath()
$assetPath
Ritorna un percorso relativoReturns a partirerelative dallapath cartellastarting from the "public". folder.

EsempiExamples


CreazioneCreating dia un nuovonew controller

EccoHere unis esempioan diexample comeof crearehow unto nuovocreate a new controller perto gestiremanage un'azionea custom nelaction nuovoin portalethe clienti.new customer portal.

  • ModificareEdit "config/sdk.config.php" inserendoto ilinsert nuovoa new controller
return [
	'sdk_controllers' => [
		'SampleVte' => 'controllers/SampleVteController.php',
	]
];
  • ImplementareImplement la classethe SampleVteController class in "sdk/controllers/SampleVteController.php"
<?php

class SampleVteController extends \app\controllers\BaseController {
	
	public function index($request) {
		return $this->displaySomething($request);
	}

	protected function displaySomething($request) {
		$parameter1 = $request->get('parameter1', true);
		$parameter2 = $request->get('parameter2', true);

		$this->viewer->assign('PARAMETER1', $parameter1);
		$this->viewer->assign('PARAMETER2', $parameter2);

		$layout = \app\LayoutFactory::getPortalLayout($this->viewer, $this->client, $request);
		$output = $this->fetchWithLayout('sdk/SampleVte.tpl', $layout);

		return new \app\Response($output);
	}
	
}
  • CreareCreate una nuovonew template in "resources/templates/sdk/SampleVte.tpl"
{extends file='layouts/PortalLayout.tpl'}

{block name=content}
	<h1>Sample Vte</h1>
{/block}
  • ModificareModify "config/sdk.config.php" indicandoindicating unan sdk file sdkfor perinserting l'inserimentonew dientries nuoviin vocithe nelside menù lateralemenu
return [
	'sdk_controllers' => [
		'SampleVte' => 'controllers/SampleVteController.php',
	],
  	'sdk_menu' => [
		'samplevte-menu.php',
	]
];
  • ModificareEdit il filethe "sdk/samplevte-menu.php" file
<?php

return [
	[
		'text' => trans('SampleVte'),
		'active' => false,
		'prefix' => [
			'type' => 'icon',
			'icon_style' => 'material',
			'icon_name' => 'pie_chart',
		],
		'action' => [
			'type' => 'link',
			'link_href' => "index.php?action=SampleVte",
		],
	],
];

image-1694533951130.48.16.png

EstensioneExtending dia un modulomodule

EccoHere unis esempioan diexample comeof estenderehow leto funzionalitàextend dithe unfunctionality moduloof nela nuovoform portalein clienti.the new customer portal.

  • ModificareEdit "config/sdk.config.php"
return [
	'sdk_module' => [
		'Contacts' => 'modules/ContactsModule.php',
	]
];
  • ImplementareImplement la classethe ContactsModule class in "sdk/modules/ContactsModule.php"
<?php

class ContactsModule extends \app\PortalModule {
	
	public $hasComments = true;

	public $formColumns = 2;

	public function canAddComments() {
		return true;
	}
	
}

image-1694596916198.20.03.png