Links

Table Views can display information from the database, but can also display other information like links to external pages, and these links can be built using values from the data base as well.

For this feature, no option type is required,

In the table View page add a column for your link. For example an external PDF, in this case 200 is a with of 200px

 

array_push($td_titles, "200-PDF");

 

Then we need to create an array with the following values, some of them are optional.
"type" is required, this tells that we are going to add a link, when the link is saved in the database we use the value
"col" to specify the database column name where the link is saved
"text" and "title" are optional and both use a database column name to fetch a value from.

 

$tdvalue = array(
'type'=>'link',
'col'=>'URL', //the column of the database where the URL comes from (see 'format' bellow for more options)
'plainText'=> false, //optional, false default, if true 'text' becomes the text of the link, if false, 'text' is the column name of the database where the text comes from
'class'=>'pdfLink',   //optional, class name selector
'toURL'=> true, //true by default
'text'=>'PDF_NAME',  //optional (default: OPEN LINK), leave emtpy if no text is required
'title'=>'PDF_NAME',  //optional (default: is text if any), leave emtpy if no title is required
'attribute'=>'target="_blank"',  //optional, can be any attribute(s) with value(s)
'target'=> '_blank', //optional, _blank by default
'nl2br'=> false, //optional, false by default
'icon'=>'<i class="far fa-external-link"></i>', //optional, default: <i class="far fa-external-link"></i>
'privilege'=> 4 //optional, 4 will show the field only to High and Admin privileges, default is 1
);

array_push($td_fields,$tdvalue);

 

If the link is not saved in the database and we need to create our own URL with values from the database, then we use "format" instead of "col", and we put between "%" the column names from the database that we need to use in the URL, in the following example we use %IID% and %CLID%

 

$tdvalue = array(
'type'=>'link',
'format'=>'/ajax/invoice.php?IID=%IID%&CLID=%CLID%',
'class'=>'extLink',
'text'=>'INVOICE_NUMBER',
'title'=>'',  //leave empty if you don't want a title
'attribute'=>'target="_blank"',
'icon'=>'#',
'encrypt'=> array('IID','CLID'...) //used when format values are encrypted
);

array_push($td_fields,$tdvalue);

 

Finally if the link needs to open a section within KAS, simply use the getPath() function.

 

$tdvalue = array(
'type'=>'link',
'format'=>getPath('BILLING','CLIENTS','EDIT CLIENT','FUSCKDEW','%CLID%'),
'class'=>'localLink',
'text'=>'CLIENT_NAME',
'icon'=>'<i class="far fa-external-link"></i>'
);

array_push($td_fields,$tdvalue);
Get a Quote

Get a Quote