Skip to content

Commit

Permalink
feat: gestione tel e mailto per le tabelle datatables
Browse files Browse the repository at this point in the history
  • Loading branch information
MatteoPistorello committed Oct 31, 2024
1 parent 438c10a commit 0b1e4d7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
12 changes: 11 additions & 1 deletion ajax_dataload.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,18 @@
$column['data-color'] = isset($column['data-color']) ? $column['data-color'] : color_inverse(trim($column['data-background']));
}

elseif (preg_match('/^mailto_(.+?)$/', trim($field), $m)) {
$column['class'] = '';
$value = ($r[$field] ? '<a class="btn btn-default btn-sm btn-block" style="font-weight:normal;" href="mailto:'.$r[$field].'" target="_blank"><i class="fa fa-envelope text-primary"></i> '.$r[$field].'</a>' : '');
}

elseif (preg_match('/^tel_(.+?)$/', trim($field), $m)) {
$column['class'] = '';
$value = ($r[$field] ? '<a class="btn btn-default btn-sm btn-block" href="tel:'.$r[$field].'" target="_blank"><i class="fa fa-phone text-primary"></i> '.$r[$field].'</a>' : '');
}

// Link della colonna
if ($field != '_print_') {
if ($field != '_print_' && !preg_match('/^tel_(.+?)$/', trim($field), $m) && !preg_match('/^mailto_(.+?)$/', trim($field), $m)) {
$id_record = $r['id'];
$hash = '';

Expand Down
4 changes: 4 additions & 0 deletions include/manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@
$attr_td .= " width='30'";
$name = str_replace('icon_', 'icon_title_', $name);
$field = str_replace('icon_', '', $field);
} elseif (preg_match('/^mailto_/', (string) $field)) {
$field = str_replace('mailto_', '', $field);
} elseif (preg_match('/^tel_/', (string) $field)) {
$field = str_replace('tel_', '', $field);
}

if (isMobile()) {
Expand Down

0 comments on commit 0b1e4d7

Please sign in to comment.