Completed
Push — master ( 256a55...3c651b )
by Reginaldo
31:32 queued 13:53
created
app/Controller/PagamentoController.php 2 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -13,51 +13,51 @@
 block discarded – undo
13 13
 	}
14 14
 
15 15
 	/**
16
-	* @return void
17
-	* @param String $token
18
-	**/
16
+	 * @return void
17
+	 * @param String $token
18
+	 **/
19 19
 	public function setToken($token)
20 20
 	{
21 21
 		$this->gateway->setToken($token);
22 22
 	}
23 23
 
24 24
 	/**
25
-	* @return void
26
-	* @param String $email
27
-	**/
25
+	 * @return void
26
+	 * @param String $email
27
+	 **/
28 28
 	public function setEmail($email)
29 29
 	{
30 30
 		$this->gateway->setEmail($email);
31 31
 	}
32 32
 
33 33
 	/**
34
-	* @return String $token
35
-	**/
34
+	 * @return String $token
35
+	 **/
36 36
 	public function getToken()
37 37
 	{
38 38
 		return $this->gateway->getToken();
39 39
 	}
40 40
 
41 41
 	/**
42
-	* @return String $email
43
-	**/
42
+	 * @return String $email
43
+	 **/
44 44
 	public function getEmail()
45 45
 	{
46 46
 		return $this->gateway->getEmail();
47 47
 	}
48 48
 
49 49
 	/**
50
-	* @return void
51
-	* @param Array $produtos
52
-	**/
50
+	 * @return void
51
+	 * @param Array $produtos
52
+	 **/
53 53
 	public function setProdutos($produto)
54 54
 	{
55 55
 		$this->gateway->setProdutos($produto);
56 56
 	}
57 57
 
58 58
 	/**
59
-	* @return Array $produto
60
-	**/
59
+	 * @return Array $produto
60
+	 **/
61 61
 	public function getProdutos()
62 62
 	{
63 63
 		return $this->gateway->getProdutos();
Please login to merge, or discard this patch.
Doc Comments   +7 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,6 +7,9 @@  discard block
 block discarded – undo
7 7
 
8 8
 	private $gateway = '';	
9 9
 
10
+	/**
11
+	 * @param string $gateway
12
+	 */
10 13
 	public function __construct($gateway)
11 14
 	{
12 15
 		$this->gateway = new $gateway();
@@ -48,7 +51,7 @@  discard block
 block discarded – undo
48 51
 
49 52
 	/**
50 53
 	* @return void
51
-	* @param Array $produtos
54
+	* @param Array $produto
52 55
 	**/
53 56
 	public function setProdutos($produto)
54 57
 	{
@@ -83,6 +86,9 @@  discard block
 block discarded – undo
83 86
 		return $this->gateway->setEnderecoClienteGateway();
84 87
 	}
85 88
 
89
+	/**
90
+	 * @param string $reference
91
+	 */
86 92
 	public function setReference($reference)
87 93
 	{
88 94
 		$this->gateway->setReference($reference);
Please login to merge, or discard this patch.
app/Controller/PagseguroController.php 3 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 require 'GatewayInterface.php';
4
-include(APP . 'Vendor/PagSeguro/source/PagSeguroLibrary/PagSeguroLibrary.php');
4
+include(APP.'Vendor/PagSeguro/source/PagSeguroLibrary/PagSeguroLibrary.php');
5 5
 
6 6
 class PagseguroController extends AppController implements GatewayInterface
7 7
 {
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
 
125 125
         foreach ($this->getProdutos() as $i => $item) {
126 126
             $this->paymentRequest->addItem(
127
-                '000' . $item['Produto']['id'], 
128
-                $item['Produto']['nome'] . '    Tamanho: '. $item['Produto']['variacao'], 
127
+                '000'.$item['Produto']['id'], 
128
+                $item['Produto']['nome'].'    Tamanho: '.$item['Produto']['variacao'], 
129 129
                 $item['Produto']['quantidade'], 
130 130
                 number_format($item['Produto']['preco'], 2, '.', '')
131 131
             );
Please login to merge, or discard this patch.
Indentation   +196 added lines, -196 removed lines patch added patch discarded remove patch
@@ -6,216 +6,216 @@
 block discarded – undo
6 6
 class PagseguroController extends AppController implements GatewayInterface
7 7
 {
8 8
 
9
-    private $paymentRequest;
10
-    private $email;
11
-    private $token;
12
-    private $produtos = array();
13
-    private $client = array();    
14
-    private $reference;
15
-    private $valor_frete;
16
-
17
-    public function __construct()
18
-    {
19
-        $this->paymentRequest = new PagSeguroPaymentRequest();
20
-        // Set the currency
21
-        $this->paymentRequest->setCurrency("BRL");
22
-    }
9
+	private $paymentRequest;
10
+	private $email;
11
+	private $token;
12
+	private $produtos = array();
13
+	private $client = array();    
14
+	private $reference;
15
+	private $valor_frete;
16
+
17
+	public function __construct()
18
+	{
19
+		$this->paymentRequest = new PagSeguroPaymentRequest();
20
+		// Set the currency
21
+		$this->paymentRequest->setCurrency("BRL");
22
+	}
23 23
     
24
-    // $products, $andress, $client, $total, $valor_frete, $id_venda
25
-    public function finalizarPedido()
26
-    {
27
-        $this->paymentRequest->setReference($this->reference);
28
-        $this->paymentRequest->setShippingCost($this->valor_frete);
24
+	// $products, $andress, $client, $total, $valor_frete, $id_venda
25
+	public function finalizarPedido()
26
+	{
27
+		$this->paymentRequest->setReference($this->reference);
28
+		$this->paymentRequest->setShippingCost($this->valor_frete);
29 29
 
30 30
 
31
-        // Set the url used by PagSeguro to redirect user after checkout process ends
32
-        $this->paymentRequest->setRedirectUrl("http://www.lojamodelo.com.br");
31
+		// Set the url used by PagSeguro to redirect user after checkout process ends
32
+		$this->paymentRequest->setRedirectUrl("http://www.lojamodelo.com.br");
33 33
 
34
-        try {
34
+		try {
35 35
 
36
-            /*
36
+			/*
37 37
              * #### Credentials #####
38 38
              * Replace the parameters below with your credentials
39 39
              * You can also get your credentials from a config file. See an example:
40 40
              * $credentials = PagSeguroConfig::getAccountCredentials();
41 41
             //  */
42 42
 
43
-            // seller authentication
44
-            $credentials = new PagSeguroAccountCredentials($this->email, $this->token);
43
+			// seller authentication
44
+			$credentials = new PagSeguroAccountCredentials($this->email, $this->token);
45 45
 
46
-            // application authentication
47
-            //$credentials = PagSeguroConfig::getApplicationCredentials();
46
+			// application authentication
47
+			//$credentials = PagSeguroConfig::getApplicationCredentials();
48 48
 
49
-            //$credentials->setAuthorizationCode("E231B2C9BCC8474DA2E260B6C8CF60D3");
49
+			//$credentials->setAuthorizationCode("E231B2C9BCC8474DA2E260B6C8CF60D3");
50 50
 
51
-            // Register this payment request in PagSeguro to obtain the payment URL to redirect your customer.
52
-            $url = $this->paymentRequest->register($credentials);
51
+			// Register this payment request in PagSeguro to obtain the payment URL to redirect your customer.
52
+			$url = $this->paymentRequest->register($credentials);
53 53
             
54
-            return $url;
55
-
56
-        } catch (PagSeguroServiceException $e) {
57
-
58
-            die($e->getMessage());
59
-
60
-        }
61
-    }
62
-
63
-    /**
64
-    * @return void
65
-    * @param String $token
66
-    **/
67
-    public function setToken($token)
68
-    {
69
-        $this->token = $token;
70
-    }
71
-
72
-    /**
73
-    * @return String $token
74
-    **/
75
-    public function getToken()
76
-    {
77
-        return $this->token;
78
-    }
79
-
80
-    /**
81
-    * @return void
82
-    * @param String $email
83
-    **/
84
-    public function setEmail($email)
85
-    {
86
-        $this->email = $email;
87
-    }
88
-
89
-    /**
90
-    * @return String $email
91
-    **/
92
-    public function getEmail()
93
-    {
94
-        return $this->email;
95
-    }
96
-
97
-    /**
98
-    * @return void
99
-    * @param Array $produtos
100
-    **/
101
-    public function setProdutos($produtos)
102
-    {
103
-        $this->produtos = $produtos;
104
-    }
105
-
106
-    /**
107
-    * @return Array $produtos
108
-    **/
109
-    public function getProdutos()
110
-    {
111
-        return $this->produtos;
112
-    }
113
-
114
-    /**
115
-    * @param Array Produtos
116
-    * @return Array Produtos
117
-    **/
118
-    public function adicionarProdutosGateway()
119
-    {
120
-        if (empty($this->getProdutos()))
121
-        {
122
-            throw new Exception("Você precisa usar a função setar os dados do produto!", 1);            
123
-        }
124
-
125
-        foreach ($this->getProdutos() as $i => $item) {
126
-            $this->paymentRequest->addItem(
127
-                '000' . $item['Produto']['id'], 
128
-                $item['Produto']['nome'] . '    Tamanho: '. $item['Produto']['variacao'], 
129
-                $item['Produto']['quantidade'], 
130
-                number_format($item['Produto']['preco'], 2, '.', '')
131
-            );
132
-        }
133
-
134
-        return $this->getProdutos();
135
-    }
136
-
137
-    public function setEndereco($endereco)
138
-    {
139
-        $this->endereco = $endereco;
140
-    }
141
-
142
-    public function getEndereco()
143
-    {
144
-        return $this->endereco;
145
-    }
146
-
147
-    public function setEnderecoClienteGateway()
148
-    {
149
-        if (empty($this->endereco))
150
-        {
151
-            throw new Exception("Você precisa usar a função setar os dados do cliente!", 1);            
152
-        }
153
-
154
-        $sedexCode = PagSeguroShippingType::getCodeByType('PAC');
155
-        $paymentRequest->setShippingType($sedexCode);
156
-
157
-        $paymentRequest->setShippingAddress(
158
-            $this->endereco['cep'],
159
-            $this->endereco['endereco'],
160
-            $this->endereco['numero'],
161
-            $this->endereco['complemento'],
162
-            $this->endereco['bairro'],
163
-            $this->endereco['cidade'],
164
-            $this->endereco['estado'],
165
-            'BRA'
166
-        );
167
-
168
-        return $this->getEndereco();
169
-    }
170
-
171
-    public function setReference($reference)
172
-    {
173
-        $this->reference = $reference;
174
-    }
175
-
176
-    public function getReference()
177
-    {
178
-        return $this->reference;
179
-    }
180
-
181
-    public function setValorFrete($valor_frete)
182
-    {
183
-        $this->valor_frete = $valor_frete;
184
-    }
185
-
186
-    public function getValorFrete()
187
-    {
188
-        return $this->valor_frete;
189
-    }
190
-
191
-    public function setClienteGateway()
192
-    {
193
-        if (empty($this->cliente))
194
-        {
195
-            throw new Exception("Você precisa usar a função setar os dados do cliente!", 1);            
196
-        }
197
-
198
-        // Set your customer information.
199
-        $this->paymentRequest->setSender(
200
-            $this->cliente['nome'],
201
-            $this->cliente['email'],
202
-            $this->cliente['ddd'],
203
-            $this->cliente['telefone'],
204
-            'CPF',
205
-            $this->cliente['cpf']
206
-        );
207
-
208
-        return $this->getCliente();
209
-    }
210
-
211
-    public function setCliente($cliente)
212
-    {
213
-        $this->cliente = $cliente;
214
-    }
215
-
216
-    public function getCliente()
217
-    {
218
-        return $this->cliente;
219
-    }
54
+			return $url;
55
+
56
+		} catch (PagSeguroServiceException $e) {
57
+
58
+			die($e->getMessage());
59
+
60
+		}
61
+	}
62
+
63
+	/**
64
+	 * @return void
65
+	 * @param String $token
66
+	 **/
67
+	public function setToken($token)
68
+	{
69
+		$this->token = $token;
70
+	}
71
+
72
+	/**
73
+	 * @return String $token
74
+	 **/
75
+	public function getToken()
76
+	{
77
+		return $this->token;
78
+	}
79
+
80
+	/**
81
+	 * @return void
82
+	 * @param String $email
83
+	 **/
84
+	public function setEmail($email)
85
+	{
86
+		$this->email = $email;
87
+	}
88
+
89
+	/**
90
+	 * @return String $email
91
+	 **/
92
+	public function getEmail()
93
+	{
94
+		return $this->email;
95
+	}
96
+
97
+	/**
98
+	 * @return void
99
+	 * @param Array $produtos
100
+	 **/
101
+	public function setProdutos($produtos)
102
+	{
103
+		$this->produtos = $produtos;
104
+	}
105
+
106
+	/**
107
+	 * @return Array $produtos
108
+	 **/
109
+	public function getProdutos()
110
+	{
111
+		return $this->produtos;
112
+	}
113
+
114
+	/**
115
+	 * @param Array Produtos
116
+	 * @return Array Produtos
117
+	 **/
118
+	public function adicionarProdutosGateway()
119
+	{
120
+		if (empty($this->getProdutos()))
121
+		{
122
+			throw new Exception("Você precisa usar a função setar os dados do produto!", 1);            
123
+		}
124
+
125
+		foreach ($this->getProdutos() as $i => $item) {
126
+			$this->paymentRequest->addItem(
127
+				'000' . $item['Produto']['id'], 
128
+				$item['Produto']['nome'] . '    Tamanho: '. $item['Produto']['variacao'], 
129
+				$item['Produto']['quantidade'], 
130
+				number_format($item['Produto']['preco'], 2, '.', '')
131
+			);
132
+		}
133
+
134
+		return $this->getProdutos();
135
+	}
136
+
137
+	public function setEndereco($endereco)
138
+	{
139
+		$this->endereco = $endereco;
140
+	}
141
+
142
+	public function getEndereco()
143
+	{
144
+		return $this->endereco;
145
+	}
146
+
147
+	public function setEnderecoClienteGateway()
148
+	{
149
+		if (empty($this->endereco))
150
+		{
151
+			throw new Exception("Você precisa usar a função setar os dados do cliente!", 1);            
152
+		}
153
+
154
+		$sedexCode = PagSeguroShippingType::getCodeByType('PAC');
155
+		$paymentRequest->setShippingType($sedexCode);
156
+
157
+		$paymentRequest->setShippingAddress(
158
+			$this->endereco['cep'],
159
+			$this->endereco['endereco'],
160
+			$this->endereco['numero'],
161
+			$this->endereco['complemento'],
162
+			$this->endereco['bairro'],
163
+			$this->endereco['cidade'],
164
+			$this->endereco['estado'],
165
+			'BRA'
166
+		);
167
+
168
+		return $this->getEndereco();
169
+	}
170
+
171
+	public function setReference($reference)
172
+	{
173
+		$this->reference = $reference;
174
+	}
175
+
176
+	public function getReference()
177
+	{
178
+		return $this->reference;
179
+	}
180
+
181
+	public function setValorFrete($valor_frete)
182
+	{
183
+		$this->valor_frete = $valor_frete;
184
+	}
185
+
186
+	public function getValorFrete()
187
+	{
188
+		return $this->valor_frete;
189
+	}
190
+
191
+	public function setClienteGateway()
192
+	{
193
+		if (empty($this->cliente))
194
+		{
195
+			throw new Exception("Você precisa usar a função setar os dados do cliente!", 1);            
196
+		}
197
+
198
+		// Set your customer information.
199
+		$this->paymentRequest->setSender(
200
+			$this->cliente['nome'],
201
+			$this->cliente['email'],
202
+			$this->cliente['ddd'],
203
+			$this->cliente['telefone'],
204
+			'CPF',
205
+			$this->cliente['cpf']
206
+		);
207
+
208
+		return $this->getCliente();
209
+	}
210
+
211
+	public function setCliente($cliente)
212
+	{
213
+		$this->cliente = $cliente;
214
+	}
215
+
216
+	public function getCliente()
217
+	{
218
+		return $this->cliente;
219
+	}
220 220
 
221 221
 }
222 222
\ No newline at end of file
Please login to merge, or discard this patch.
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -168,6 +168,9 @@  discard block
 block discarded – undo
168 168
         return $this->getEndereco();
169 169
     }
170 170
 
171
+    /**
172
+     * @param string $reference
173
+     */
171 174
     public function setReference($reference)
172 175
     {
173 176
         $this->reference = $reference;
@@ -178,6 +181,9 @@  discard block
 block discarded – undo
178 181
         return $this->reference;
179 182
     }
180 183
 
184
+    /**
185
+     * @param double $valor_frete
186
+     */
181 187
     public function setValorFrete($valor_frete)
182 188
     {
183 189
         $this->valor_frete = $valor_frete;
Please login to merge, or discard this patch.
app/Controller/SiteController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 
3 3
 class SiteController extends AppController {
4 4
 
5
-	public function beforeFilter(){
5
+	public function beforeFilter() {
6 6
 		$this->Session->write('Usuario', $_SESSION['information']);
7 7
 
8 8
 		return true;
Please login to merge, or discard this patch.
app/Controller/UsuarioController.php 3 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@
 block discarded – undo
89 89
 
90 90
 		if($resposta >= 1){
91 91
 			return true;
92
-		}else{
92
+		} else{
93 93
 			return false;
94 94
 		}
95 95
 	}
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 		
31 31
 		if (count($resposta) < 1) {
32 32
 			$this->Session->setFlash('Ocorreu um erro ao logar na sua conta, verifique seus dados!');
33
-            return $this->redirect('/home/login');
33
+			return $this->redirect('/home/login');
34 34
 		}
35 35
 
36 36
 		//faz o foreach com o array de dados do usuario
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 		}
47 47
 
48 48
 		$this->Session->setFlash('Bem vindo, '.$this->Session->read('Usuario.nome').'!');
49
-        return $this->redirect('/dashboard/home');
49
+		return $this->redirect('/dashboard/home');
50 50
 	}
51 51
 
52 52
 	public function processar_logout() {
@@ -193,12 +193,12 @@  discard block
 block discarded – undo
193 193
 		if(!$retorno) {
194 194
 			$this->Session->setFlash('Ocorreu um erro ao salvar as novas infomações, tente novamente!');
195 195
             
196
-            return $this->redirect('/usuario/meus_dados');
196
+			return $this->redirect('/usuario/meus_dados');
197 197
 		}
198 198
 
199 199
 		$this->Session->setFlash('Dados atualizados com sucesso!');
200 200
         
201
-        return $this->redirect('/usuario/meus_dados');
201
+		return $this->redirect('/usuario/meus_dados');
202 202
 	}
203 203
 
204 204
 	public function meus_dados() {
@@ -213,8 +213,8 @@  discard block
 block discarded – undo
213 213
 			)
214 214
 		);
215 215
 
216
-    	$this->set('modulos', $this->modulos);
217
-    	$this->set('usuario', $dadosUsuario);
216
+		$this->set('modulos', $this->modulos);
217
+		$this->set('usuario', $dadosUsuario);
218 218
 	}
219 219
 
220 220
 	public function new_token() {
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-class UsuarioController extends AppController{
4
-	public function beforeFilter(){
3
+class UsuarioController extends AppController {
4
+	public function beforeFilter() {
5 5
 		return true;
6 6
    	}
7 7
 
8 8
 	//faz o login no sistema, com a função autentica_email
9
-	public function login(){
10
-		$this->layout = 'ajax';//chama o layout para executar uma função ajax
9
+	public function login() {
10
+		$this->layout = 'ajax'; //chama o layout para executar uma função ajax
11 11
 
12
-		$login_email = $this->request->data['email'];//recebe o post email
13
-		$login_senha = $this->request->data['senha'];//recebe o post senha
12
+		$login_email = $this->request->data['email']; //recebe o post email
13
+		$login_senha = $this->request->data['senha']; //recebe o post senha
14 14
 		echo json_encode(true);
15 15
 	}
16 16
 
@@ -34,15 +34,15 @@  discard block
 block discarded – undo
34 34
 		}
35 35
 
36 36
 		//faz o foreach com o array de dados do usuario
37
-		foreach($resposta as $valor) {
37
+		foreach ($resposta as $valor) {
38 38
 			//escreve a sessao do usuario
39
-			$this->Session->write('Usuario.id',   $valor['Usuario']['id']);
40
-			$this->Session->write('Usuario.nome', $valor['Usuario']['nome']);//nome do usuario
41
-			$this->Session->write('Usuario.email',$valor['Usuario']['email']);//email do usuario
42
-			$this->Session->write('Usuario.senha',$valor['Usuario']['senha']);//senha do usuario criptografada
43
-			$this->Session->write('Usuario.erp',  $valor['Usuario']['erp']);//situacao ativa(1) ou nao(0) no erp
44
-			$this->Session->write('Usuario.ead',  $valor['Usuario']['ead']);//situacao ativa(1) ou nao(0) no ead
45
-			$this->Session->write('Usuario.site', $valor['Usuario']['site']);//situacao ativa(1) ou nao(0) no site
39
+			$this->Session->write('Usuario.id', $valor['Usuario']['id']);
40
+			$this->Session->write('Usuario.nome', $valor['Usuario']['nome']); //nome do usuario
41
+			$this->Session->write('Usuario.email', $valor['Usuario']['email']); //email do usuario
42
+			$this->Session->write('Usuario.senha', $valor['Usuario']['senha']); //senha do usuario criptografada
43
+			$this->Session->write('Usuario.erp', $valor['Usuario']['erp']); //situacao ativa(1) ou nao(0) no erp
44
+			$this->Session->write('Usuario.ead', $valor['Usuario']['ead']); //situacao ativa(1) ou nao(0) no ead
45
+			$this->Session->write('Usuario.site', $valor['Usuario']['site']); //situacao ativa(1) ou nao(0) no site
46 46
 		}
47 47
 
48 48
 		$this->Session->setFlash('Bem vindo, '.$this->Session->read('Usuario.nome').'!');
@@ -54,14 +54,14 @@  discard block
 block discarded – undo
54 54
 		return $this->redirect('/home/login');
55 55
 	}
56 56
 
57
-	public function logout(){
57
+	public function logout() {
58 58
 		$this->Session->Destroy();
59 59
 
60 60
 		echo '<script>location.href="/winners/framework/"</script>';
61 61
 	}
62 62
 
63 63
 	//autentica email verifica se o email e senha existem para efetuar o login, ou outra acao.
64
-	public function autentica_email($email,$senha){
64
+	public function autentica_email($email, $senha) {
65 65
 		$this->loadModel('Usuario');
66 66
 		$resposta = $this->Usuario->find('count', 
67 67
 								array('conditions' => array('AND' => array('Usuario.email' => $email, 'Usuario.senha' => sha1($senha))
@@ -74,10 +74,10 @@  discard block
 block discarded – undo
74 74
 	}			
75 75
 
76 76
 	//se o email estiver livre retorna false, senão retorna true
77
-	public function verificar_email($email){
77
+	public function verificar_email($email) {
78 78
 		$this->layout = 'ajax';
79 79
 		
80
-		if(empty($email)){
80
+		if (empty($email)) {
81 81
 			$email = $this->request->data['email'];
82 82
 		}
83 83
 
@@ -87,14 +87,14 @@  discard block
 block discarded – undo
87 87
 										);
88 88
 		$this->set('resposta', $resposta);
89 89
 
90
-		if($resposta >= 1){
90
+		if ($resposta >= 1) {
91 91
 			return true;
92
-		}else{
92
+		} else {
93 93
 			return false;
94 94
 		}
95 95
 	}
96 96
 
97
-	public function recuperar_dados($email,$senha){
97
+	public function recuperar_dados($email, $senha) {
98 98
 		$this->loadModel('Usuario');
99 99
 		$resposta = $this->Usuario->find('all', 
100 100
 								array('conditions' => array('AND' => array('Usuario.email' => $email, 'Usuario.senha' => sha1($senha))
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	public function notificar_cadastro($nome, $email) {
144 144
 		$headers = "From: [email protected]\n"; // This is the email address the generated message will be from. We recommend using something like [email protected].
145 145
 		$headers .= "Reply-To: $email_address";	
146
-		mail('[email protected], [email protected], [email protected], [email protected]', 'Notificação de cadastro', 'O usuario ' . $nome . ' email ' . $email . ' ', $headers);
146
+		mail('[email protected], [email protected], [email protected], [email protected]', 'Notificação de cadastro', 'O usuario '.$nome.' email '.$email.' ', $headers);
147 147
 	}
148 148
 
149 149
 	public function relacionar_modulos_teste($id) {
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 
191 191
 		$retorno = $this->Usuario->save(array('estoque_minimo' => $estoque_minimo));
192 192
 
193
-		if(!$retorno) {
193
+		if ( ! $retorno) {
194 194
 			$this->Session->setFlash('Ocorreu um erro ao salvar as novas infomações, tente novamente!');
195 195
             
196 196
             return $this->redirect('/usuario/meus_dados');
Please login to merge, or discard this patch.
app/Controller/VendaController.php 5 patches
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -205,58 +205,58 @@
 block discarded – undo
205 205
 		include(APP . 'Vendor/PHPExcel/PHPExcel.php');
206 206
 		include(APP . 'Vendor/PHPExcel/PHPExcel/IOFactory.php');
207 207
 
208
-        $objPHPExcel = new PHPExcel();
209
-        // Definimos o estilo da fonte
210
-        $objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true);
211
-
212
-        $objPHPExcel->getActiveSheet()->getRowDimension('1')->setRowHeight(40);
213
-
214
-        // Criamos as colunas
215
-        $objPHPExcel->setActiveSheetIndex(0)
216
-                    ->setCellValue('A1', "Valor Venda")
217
-                    ->setCellValue('B1', "Custo Médio ")
218
-                    ->setCellValue("C1", "Valor Lucro")
219
-                    ->setCellValue('D1', "ID Venda" );
220
-
221
-
222
-        $vendas = $this->Venda->find('all',
223
-        	array('conditions' => array(
224
-        			'AND' => array(
225
-        				'Venda.ativo' => 1,
226
-        				'Venda.id_usuario' => $this->instancia,
227
-        				'Venda.data_venda' => date('Y-m-d')
228
-        			)
229
-        		)
230
-        	)
231
-        );
232
-
233
-        $i = 2;
234
-        foreach ($vendas as $key => $venda) {
235
-        	$objPHPExcel->setActiveSheetIndex(0)
236
-        				->setCellValue('A'.$i, 'R$ ' . $venda['Venda']['valor'])
237
-        				->setCellValue('B'.$i, 'R$ ' . $venda['Venda']['custo'])
238
-        				->setCellValue('C'.$i, 'R$ ' . $venda['Venda']['valor'] - $venda['Venda']['custo'])
239
-        				->setCellValue('D'.$i, $venda['Venda']['id']);
240
-        	$i++;
241
-        }
242
-
243
-        // Podemos renomear o nome das planilha atual, lembrando que um único arquivo pode ter várias planilhas
244
-        $objPHPExcel->getActiveSheet()->setTitle('Listagem de vendas');
245
-
246
-        // Cabeçalho do arquivo para ele baixar
247
-        header('Content-Type: application/vnd.ms-excel');
248
-        header('Content-Disposition: attachment;filename="relatorio_vendas_'.date('d-m-Y').'.xls"');
249
-        header('Cache-Control: max-age=0');
250
-        // Se for o IE9, isso talvez seja necessário
251
-        header('Cache-Control: max-age=1');
252
-
253
-        // Acessamos o 'Writer' para poder salvar o arquivo
254
-        $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
255
-
256
-        // Salva diretamente no output, poderíamos mudar arqui para um nome de arquivo em um diretório ,caso não quisessemos jogar na tela
257
-        $objWriter->save('php://output'); 
258
-
259
-        exit;
208
+		$objPHPExcel = new PHPExcel();
209
+		// Definimos o estilo da fonte
210
+		$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true);
211
+
212
+		$objPHPExcel->getActiveSheet()->getRowDimension('1')->setRowHeight(40);
213
+
214
+		// Criamos as colunas
215
+		$objPHPExcel->setActiveSheetIndex(0)
216
+					->setCellValue('A1', "Valor Venda")
217
+					->setCellValue('B1', "Custo Médio ")
218
+					->setCellValue("C1", "Valor Lucro")
219
+					->setCellValue('D1', "ID Venda" );
220
+
221
+
222
+		$vendas = $this->Venda->find('all',
223
+			array('conditions' => array(
224
+					'AND' => array(
225
+						'Venda.ativo' => 1,
226
+						'Venda.id_usuario' => $this->instancia,
227
+						'Venda.data_venda' => date('Y-m-d')
228
+					)
229
+				)
230
+			)
231
+		);
232
+
233
+		$i = 2;
234
+		foreach ($vendas as $key => $venda) {
235
+			$objPHPExcel->setActiveSheetIndex(0)
236
+						->setCellValue('A'.$i, 'R$ ' . $venda['Venda']['valor'])
237
+						->setCellValue('B'.$i, 'R$ ' . $venda['Venda']['custo'])
238
+						->setCellValue('C'.$i, 'R$ ' . $venda['Venda']['valor'] - $venda['Venda']['custo'])
239
+						->setCellValue('D'.$i, $venda['Venda']['id']);
240
+			$i++;
241
+		}
242
+
243
+		// Podemos renomear o nome das planilha atual, lembrando que um único arquivo pode ter várias planilhas
244
+		$objPHPExcel->getActiveSheet()->setTitle('Listagem de vendas');
245
+
246
+		// Cabeçalho do arquivo para ele baixar
247
+		header('Content-Type: application/vnd.ms-excel');
248
+		header('Content-Disposition: attachment;filename="relatorio_vendas_'.date('d-m-Y').'.xls"');
249
+		header('Cache-Control: max-age=0');
250
+		// Se for o IE9, isso talvez seja necessário
251
+		header('Cache-Control: max-age=1');
252
+
253
+		// Acessamos o 'Writer' para poder salvar o arquivo
254
+		$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
255
+
256
+		// Salva diretamente no output, poderíamos mudar arqui para um nome de arquivo em um diretório ,caso não quisessemos jogar na tela
257
+		$objWriter->save('php://output'); 
258
+
259
+		exit;
260 260
 	}
261 261
 
262 262
 }
Please login to merge, or discard this patch.
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -350,6 +350,9 @@
 block discarded – undo
350 350
         exit;
351 351
 	}
352 352
 
353
+	/**
354
+	 * @param string $id_usuario
355
+	 */
353 356
 	public function recoverDataToDashboardOneWeek($id_usuario){
354 357
 		$vendas = $this->Venda->find('all',
355 358
 			array('conditions' =>
Please login to merge, or discard this patch.
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -2,8 +2,6 @@
 block discarded – undo
2 2
 
3 3
 require_once(ROOT . DS . 'vendor' . DS . 'autoload.php');
4 4
 
5
-use Dompdf\Dompdf;
6
-
7 5
 include 'ProdutoEstoqueController.php';
8 6
 include 'VendaItensProdutoController.php';
9 7
 include 'LancamentoVendasController.php';
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -509,8 +509,9 @@
 block discarded – undo
509 509
 				)
510 510
 			);
511 511
 
512
-			if (!empty($lancamento))
513
-				$lancamentos[] = $lancamento;
512
+			if (!empty($lancamento)) {
513
+							$lancamentos[] = $lancamento;
514
+			}
514 515
 		}
515 516
 
516 517
 		$valorTotalPgt = $this->calcularTotalVendas($lancamentos);
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-require_once(ROOT . DS . 'vendor' . DS . 'autoload.php');
3
+require_once(ROOT.DS.'vendor'.DS.'autoload.php');
4 4
 
5 5
 use Dompdf\Dompdf;
6 6
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 
176 176
 			if ($produto[0]['Produto']['estoque'] <= 0)
177 177
 			{
178
-				$this->Session->setFlash('O produto (' . $produto[0]['Produto']['nome'] .') não tem mais estoque disponivel!');
178
+				$this->Session->setFlash('O produto ('.$produto[0]['Produto']['nome'].') não tem mais estoque disponivel!');
179 179
 				continue;
180 180
 			}
181 181
 			
@@ -192,11 +192,11 @@  discard block
 block discarded – undo
192 192
 	}
193 193
 
194 194
 	public function s_adicionar_cadastro() {
195
-		$dados_venda 	  = $this->request->data('venda');
195
+		$dados_venda = $this->request->data('venda');
196 196
 		$dados_lancamento = $this->request->data('lancamento');
197
-		$produtos 	      = $this->request->data('produto');
197
+		$produtos = $this->request->data('produto');
198 198
 
199
-		if (!$this->validar_itens_venda($produtos) && !$dados_venda['orcamento']) {
199
+		if ( ! $this->validar_itens_venda($produtos) && ! $dados_venda['orcamento']) {
200 200
 			$this->Session->setFlash('Algum produto adicionado não possui estoque disponivel');
201 201
 			$this->redirect('/venda/adicionar_cadastro');
202 202
 		}
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 		
207 207
 		$salvar_venda = $this->salvar_venda($produtos, $dados_lancamento, $dados_venda);
208 208
 		
209
-		if (!$salvar_venda) {
209
+		if ( ! $salvar_venda) {
210 210
 			$this->Session->setFlash('Ocorreu um erro ao salvar a venda tente novamento');
211 211
 			$this->redirect('/venda/adicionar_cadastro');
212 212
 		}
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 
264 264
 			$objProdutoEstoqueController = new ProdutoEstoqueController();
265 265
 
266
-			if (!$objProdutoEstoqueController->validar_estoque($produto, $item['quantidade'])) {
266
+			if ( ! $objProdutoEstoqueController->validar_estoque($produto, $item['quantidade'])) {
267 267
 				return false;
268 268
 			}			
269 269
 		}
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 		$informacoes['valor']	   = $informacoes['valor'] - $informacoes['desconto'];
282 282
 		$informacoes['orcamento']  = $informacoes['orcamento'];
283 283
 
284
-		if (!$this->Venda->save($informacoes)) {
284
+		if ( ! $this->Venda->save($informacoes)) {
285 285
 			$this->Session->setFlash('Ocorreu algum erro ao salvar a venda');
286 286
 			return false;
287 287
 		}
@@ -304,8 +304,8 @@  discard block
 block discarded – undo
304 304
 	}
305 305
 
306 306
 	public function relatorio_diario() {
307
-		include(APP . 'Vendor/PHPExcel/PHPExcel.php');
308
-		include(APP . 'Vendor/PHPExcel/PHPExcel/IOFactory.php');
307
+		include(APP.'Vendor/PHPExcel/PHPExcel.php');
308
+		include(APP.'Vendor/PHPExcel/PHPExcel/IOFactory.php');
309 309
 
310 310
         $objPHPExcel = new PHPExcel();
311 311
         // Definimos o estilo da fonte
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
                     ->setCellValue('A1', "Valor Venda")
319 319
                     ->setCellValue('B1', "Custo Médio ")
320 320
                     ->setCellValue("C1", "Valor Lucro")
321
-                    ->setCellValue('D1', "ID Venda" );
321
+                    ->setCellValue('D1', "ID Venda");
322 322
 
323 323
 
324 324
         $vendas = $this->Venda->find('all',
@@ -335,9 +335,9 @@  discard block
 block discarded – undo
335 335
         $i = 2;
336 336
         foreach ($vendas as $key => $venda) {
337 337
         	$objPHPExcel->setActiveSheetIndex(0)
338
-        				->setCellValue('A'.$i, 'R$ ' . $venda['Venda']['valor'])
339
-        				->setCellValue('B'.$i, 'R$ ' . $venda['Venda']['custo'])
340
-        				->setCellValue('C'.$i, 'R$ ' . $venda['Venda']['valor'] - $venda['Venda']['custo'])
338
+        				->setCellValue('A'.$i, 'R$ '.$venda['Venda']['valor'])
339
+        				->setCellValue('B'.$i, 'R$ '.$venda['Venda']['custo'])
340
+        				->setCellValue('C'.$i, 'R$ '.$venda['Venda']['valor'] - $venda['Venda']['custo'])
341 341
         				->setCellValue('D'.$i, $venda['Venda']['id']);
342 342
         	$i++;
343 343
         }
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
         exit;
362 362
 	}
363 363
 
364
-	public function recoverDataToDashboardOneWeek($id_usuario){
364
+	public function recoverDataToDashboardOneWeek($id_usuario) {
365 365
 		$vendas = $this->Venda->find('all',
366 366
 			array('conditions' =>
367 367
 				array(
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 		
428 428
 		$ImpressaoFiscalController->userName = $usuario['Usuario']['nome'];
429 429
 
430
-		$ImpressaoFiscalController->corpoTxt .= "Valor: R$ " . number_format($dados_venda['Venda']['valor'], 2, ',', '.') . "\n\n";
430
+		$ImpressaoFiscalController->corpoTxt .= "Valor: R$ ".number_format($dados_venda['Venda']['valor'], 2, ',', '.')."\n\n";
431 431
 		
432 432
 		$dados_lancamento = $this->LancamentoVenda->find('first',
433 433
 			array('conditions' => 
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 			)
439 439
 		);
440 440
 
441
-		$ImpressaoFiscalController->corpoTxt .= "Forma de Pagamento: " . $dados_lancamento['LancamentoVenda']['forma_pagamento'] . "\n\n";
441
+		$ImpressaoFiscalController->corpoTxt .= "Forma de Pagamento: ".$dados_lancamento['LancamentoVenda']['forma_pagamento']."\n\n";
442 442
 		
443 443
 		$produtos = $this->VendaItensProduto->find('all', 
444 444
 			array('conditions' =>
@@ -459,10 +459,10 @@  discard block
 block discarded – undo
459 459
 			$total = $produto['Produto']['preco'] * $item['VendaItensProduto']['quantidade_produto'];
460 460
 
461 461
 			$ImpressaoFiscalController->corpoTxt .= ""
462
-						   . "Produto: " . $produto['Produto']['nome']
463
-						   . "\nQuantidade: " . $item['VendaItensProduto']['quantidade_produto'] 
464
-						   . "\nPreço: R$ " . number_format($produto['Produto']['preco'], 2, ',', '.')
465
-						   . "\nTotal: R$ " . number_format($total, 2, ',', '.')
462
+						   . "Produto: ".$produto['Produto']['nome']
463
+						   . "\nQuantidade: ".$item['VendaItensProduto']['quantidade_produto'] 
464
+						   . "\nPreço: R$ ".number_format($produto['Produto']['preco'], 2, ',', '.')
465
+						   . "\nTotal: R$ ".number_format($total, 2, ',', '.')
466 466
 						   . "\n--------------------------\n";
467 467
 		}
468 468
 
@@ -504,14 +504,14 @@  discard block
 block discarded – undo
504 504
 		$lancamentos = array();
505 505
 
506 506
 		foreach ($vendas as $i => $venda) {
507
-			$lancamento =  $this->LancamentoVenda->find('first', array(
507
+			$lancamento = $this->LancamentoVenda->find('first', array(
508 508
 					'conditions' => array(
509 509
 						'LancamentoVenda.venda_id' => $venda['Venda']['id']
510 510
 					)
511 511
 				)
512 512
 			);
513 513
 
514
-			if (!empty($lancamento))
514
+			if ( ! empty($lancamento))
515 515
 				$lancamentos[] = $lancamento;
516 516
 		}
517 517
 
Please login to merge, or discard this patch.
app/Controller/WAdminController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@
 block discarded – undo
1 1
 <?php
2
-class WAdminController extends AppController{
2
+class WAdminController extends AppController {
3 3
 	
4
-	function index(){
4
+	function index() {
5 5
 		$this->layout = 'wadmin';
6 6
 
7 7
 	}
8 8
 
9
-	function paginas(){
9
+	function paginas() {
10 10
 		$this->layout = 'wadmin';
11 11
 
12 12
 	}
13 13
 
14
-	function atualizar_dados_home(){
14
+	function atualizar_dados_home() {
15 15
 		$this->layout = 'ajax';
16 16
 		$this->loadModel('Pagina_home_siteModel');
17 17
 
18
-		$title_home	= $this->request->data['title_home'];
18
+		$title_home = $this->request->data['title_home'];
19 19
 		$description_home = $this->request->data['description_home'];
20 20
 		$keywords_home = $this->request->data['keywords_home'];
21 21
 		$empresa_home = $this->request->data['empresa_home'];
Please login to merge, or discard this patch.
app/Controller/XStoreController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 class XStoreController extends LojaController
9 9
 {
10 10
 	public function beforeFilter() {
11
-		$this->Session->write('Usuario.id', $_SESSION['information']['id_usuario']);//gambi temporaria
11
+		$this->Session->write('Usuario.id', $_SESSION['information']['id_usuario']); //gambi temporaria
12 12
 
13 13
 		$this->layout = 'xstore';
14 14
 		return true;
Please login to merge, or discard this patch.
app/Model/AviseMeModel.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,9 +7,9 @@
 block discarded – undo
7 7
 class AviseMe extends AppModel
8 8
 {
9 9
 	public  $belongsTo  =  array ( 
10
-        'Produto'  =>  array ( 
11
-            'className'  =>  'Produto' , 
12
-            'foreignKey'  =>  'produto_id' 
13
-        ),
14
-    ); 
10
+		'Produto'  =>  array ( 
11
+			'className'  =>  'Produto' , 
12
+			'foreignKey'  =>  'produto_id' 
13
+		),
14
+	); 
15 15
 }
16 16
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,9 +6,9 @@
 block discarded – undo
6 6
 */
7 7
 class AviseMe extends AppModel
8 8
 {
9
-	public  $belongsTo  =  array ( 
10
-        'Produto'  =>  array ( 
11
-            'className'  =>  'Produto' , 
9
+	public  $belongsTo = array( 
10
+        'Produto'  =>  array( 
11
+            'className'  =>  'Produto', 
12 12
             'foreignKey'  =>  'produto_id' 
13 13
         ),
14 14
     ); 
Please login to merge, or discard this patch.
app/Model/BannerModel.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -2,13 +2,13 @@
 block discarded – undo
2 2
 
3 3
 class Banner extends AppModel {
4 4
 	 public  $belongsTo  =  array ( 
5
-        'Usuario'  =>  array ( 
6
-            'className'  =>  'Usuario' , 
7
-            'foreignKey'  =>  'usuario_id' 
8
-        ),
9
-        'CategoriaBanner'  =>  array ( 
10
-            'className'  =>  'CategoriaBanner' , 
11
-            'foreignKey'  =>  'categoria_banner_id' 
12
-        ),
13
-    ); 
5
+		'Usuario'  =>  array ( 
6
+			'className'  =>  'Usuario' , 
7
+			'foreignKey'  =>  'usuario_id' 
8
+		),
9
+		'CategoriaBanner'  =>  array ( 
10
+			'className'  =>  'CategoriaBanner' , 
11
+			'foreignKey'  =>  'categoria_banner_id' 
12
+		),
13
+	); 
14 14
 }
15 15
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 class Banner extends AppModel {
4
-	 public  $belongsTo  =  array ( 
5
-        'Usuario'  =>  array ( 
6
-            'className'  =>  'Usuario' , 
4
+	 public  $belongsTo = array( 
5
+        'Usuario'  =>  array( 
6
+            'className'  =>  'Usuario', 
7 7
             'foreignKey'  =>  'usuario_id' 
8 8
         ),
9
-        'CategoriaBanner'  =>  array ( 
10
-            'className'  =>  'CategoriaBanner' , 
9
+        'CategoriaBanner'  =>  array( 
10
+            'className'  =>  'CategoriaBanner', 
11 11
             'foreignKey'  =>  'categoria_banner_id' 
12 12
         ),
13 13
     ); 
Please login to merge, or discard this patch.