-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
78 lines (42 loc) · 1.36 KB
/
functions.php
File metadata and controls
78 lines (42 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
use \DDev\Model\User;
use \DDev\Model\Cart;
function formatPrice($vlPrice) { // Função que retorna o valor Real passado no formato 9.999,99
if($vlPrice === NULL)
return (float) 0;
return number_format($vlPrice, 2, ',', '.');
}
function checkLogin($inadmin = true){
return User::checkLogin($inadmin);
}
function formatDate($date) { // Realiza a formatação da data passada como parâmetro;
return date('d/m/Y', strtotime($date));
}
//Funções retornar dados do Usuário logado//
function getUserName() { // Retorna o nome do Usuário;
$user = User::getFromSession();
return $user->getdesperson();
}
//Funções retornar dados do Usuário logado//
function getLogin() { // Retorna o nome do Usuário;
$user = User::getFromSession();
return $user->getdeslogin();
}
function getDtregister() { // Retorna Data de registro do Usuario;
$user = User::getFromSession();
$date = $user->getdtregister();
$dataRegistro = formatDate($date);
return $dataRegistro;
}
///////////////////////////////////////////////
function getCartNrQtd(){
$cart = Cart::getFromSession();
$totals = $cart->getProductsTotals();
return $totals['nrqtd'];//Carrinho com o frete
}
function getCartVlSubTotal(){
$cart = Cart::getFromSession();
$totals = $cart->getProductsTotals();
return formatPrice($totals['vlprice']);//Carrinho sem o frete
}
?>