@@ -79,10 +79,10 @@ discard block |
||
79 | 79 | |
80 | 80 | if ($this->Banner->save($dados)) { |
81 | 81 | $this->Session->setFlash('Banner editado com sucesso!','default','good'); |
82 | - return $this->redirect('/banner/listar_cadastros'); |
|
82 | + return $this->redirect('/banner/listar_cadastros'); |
|
83 | 83 | } else { |
84 | 84 | $this->Session->setFlash('Ocorreu um erro ao editar o Banner!','default','good'); |
85 | - return $this->redirect('/banner/listar_cadastros'); |
|
85 | + return $this->redirect('/banner/listar_cadastros'); |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | |
@@ -111,10 +111,10 @@ discard block |
||
111 | 111 | |
112 | 112 | if($this->Banner->save($dados)) { |
113 | 113 | $this->Session->setFlash('Banner salvo com sucesso!'); |
114 | - return $this->redirect('/banner/listar_cadastros'); |
|
114 | + return $this->redirect('/banner/listar_cadastros'); |
|
115 | 115 | } else { |
116 | 116 | $this->Session->setFlash('Ocorreu um erro ao salva o banner!'); |
117 | - return $this->redirect('/banner/listar_cadastros'); |
|
117 | + return $this->redirect('/banner/listar_cadastros'); |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | |
136 | 136 | $oImg->redimensiona($categoriaBanner['CategoriaBanner']['width'], $categoriaBanner['CategoriaBanner']['height'], 'crop'); |
137 | 137 | |
138 | - $oImg->grava($dir . $nameImage); |
|
138 | + $oImg->grava($dir . $nameImage); |
|
139 | 139 | |
140 | 140 | } else { |
141 | 141 |
@@ -18,58 +18,58 @@ discard block |
||
18 | 18 | protected $usuario; |
19 | 19 | |
20 | 20 | public function beforeFilter(){ |
21 | - $lojaSession = $this->Session->read('Usuario.loja'); |
|
21 | + $lojaSession = $this->Session->read('Usuario.loja'); |
|
22 | 22 | |
23 | - if (isset($lojaSession)) |
|
24 | - { |
|
25 | - if (isset($this->params['loja'])) |
|
26 | - { |
|
27 | - if ($this->params['loja'] != $lojaSession) |
|
28 | - { |
|
29 | - $loja = $this->params['loja']; |
|
30 | - } |
|
31 | - else |
|
32 | - { |
|
33 | - $loja = $lojaSession; |
|
34 | - } |
|
35 | - } |
|
36 | - else |
|
37 | - { |
|
38 | - $loja = $lojaSession; |
|
39 | - } |
|
40 | - } |
|
41 | - else |
|
42 | - { |
|
43 | - $loja = $this->params['loja']; |
|
44 | - } |
|
23 | + if (isset($lojaSession)) |
|
24 | + { |
|
25 | + if (isset($this->params['loja'])) |
|
26 | + { |
|
27 | + if ($this->params['loja'] != $lojaSession) |
|
28 | + { |
|
29 | + $loja = $this->params['loja']; |
|
30 | + } |
|
31 | + else |
|
32 | + { |
|
33 | + $loja = $lojaSession; |
|
34 | + } |
|
35 | + } |
|
36 | + else |
|
37 | + { |
|
38 | + $loja = $lojaSession; |
|
39 | + } |
|
40 | + } |
|
41 | + else |
|
42 | + { |
|
43 | + $loja = $this->params['loja']; |
|
44 | + } |
|
45 | 45 | |
46 | - if (!isset($loja)) |
|
47 | - { |
|
48 | - echo 'Loja não existe'; |
|
49 | - exit; |
|
50 | - } |
|
51 | - else |
|
52 | - { |
|
53 | - $this->loadModel('Usuario'); |
|
54 | - |
|
55 | - $this->usuario = $this->Usuario->find('first', array( |
|
56 | - 'conditions' => array( |
|
57 | - 'Usuario.loja' => $loja |
|
58 | - ) |
|
59 | - ) |
|
60 | - ); |
|
61 | - |
|
62 | - if (empty($this->usuario)) |
|
63 | - { |
|
64 | - echo 'Loja não existe'; |
|
65 | - exit; |
|
66 | - } |
|
67 | - |
|
68 | - $this->Session->write('Usuario.id', $this->usuario['Usuario']['id']);//gambi temporaria |
|
69 | - $this->Session->write('Usuario.loja', $this->usuario['Usuario']['loja']);//gambi temporaria |
|
70 | - |
|
71 | - $this->layout = $this->usuario['Usuario']['layout_loja']; |
|
72 | - } |
|
46 | + if (!isset($loja)) |
|
47 | + { |
|
48 | + echo 'Loja não existe'; |
|
49 | + exit; |
|
50 | + } |
|
51 | + else |
|
52 | + { |
|
53 | + $this->loadModel('Usuario'); |
|
54 | + |
|
55 | + $this->usuario = $this->Usuario->find('first', array( |
|
56 | + 'conditions' => array( |
|
57 | + 'Usuario.loja' => $loja |
|
58 | + ) |
|
59 | + ) |
|
60 | + ); |
|
61 | + |
|
62 | + if (empty($this->usuario)) |
|
63 | + { |
|
64 | + echo 'Loja não existe'; |
|
65 | + exit; |
|
66 | + } |
|
67 | + |
|
68 | + $this->Session->write('Usuario.id', $this->usuario['Usuario']['id']);//gambi temporaria |
|
69 | + $this->Session->write('Usuario.loja', $this->usuario['Usuario']['loja']);//gambi temporaria |
|
70 | + |
|
71 | + $this->layout = $this->usuario['Usuario']['layout_loja']; |
|
72 | + } |
|
73 | 73 | |
74 | 74 | return true; |
75 | 75 | } |
@@ -77,21 +77,21 @@ discard block |
||
77 | 77 | public function loadProducts($id_categoria = null, $id_produto = null) { |
78 | 78 | $this->loadModel('Produto'); |
79 | 79 | |
80 | - $params = array('conditions' => |
|
81 | - array( |
|
82 | - 'Produto.ativo' => 1, |
|
83 | - 'Produto.id_usuario' => $this->Session->read('Usuario.id') |
|
84 | - ), |
|
85 | - 'limit' => 8 |
|
86 | - ); |
|
80 | + $params = array('conditions' => |
|
81 | + array( |
|
82 | + 'Produto.ativo' => 1, |
|
83 | + 'Produto.id_usuario' => $this->Session->read('Usuario.id') |
|
84 | + ), |
|
85 | + 'limit' => 8 |
|
86 | + ); |
|
87 | 87 | |
88 | - if ($id_categoria != null) { |
|
89 | - $params['conditions']['Produto.categoria_id'] = $id_categoria; |
|
90 | - } |
|
88 | + if ($id_categoria != null) { |
|
89 | + $params['conditions']['Produto.categoria_id'] = $id_categoria; |
|
90 | + } |
|
91 | 91 | |
92 | - if ($id_produto != null) { |
|
93 | - $params['conditions']['Produto.id'] = $id_produto; |
|
94 | - } |
|
92 | + if ($id_produto != null) { |
|
93 | + $params['conditions']['Produto.id'] = $id_produto; |
|
94 | + } |
|
95 | 95 | |
96 | 96 | $produtos = $this->Produto->find('all', $params); |
97 | 97 | |
@@ -99,28 +99,28 @@ discard block |
||
99 | 99 | } |
100 | 100 | |
101 | 101 | public function loadBanners($id_banner = null) { |
102 | - $this->loadModel('Banner'); |
|
103 | - |
|
104 | - $params = array( |
|
105 | - 'joins' => array( |
|
106 | - array( |
|
107 | - 'table' => 'categoria_banners', |
|
108 | - 'alias' => 'CategoriaBanner', |
|
109 | - 'type' => 'LEFT', |
|
110 | - 'conditions' => array( |
|
111 | - 'Banner.categoria_banner_id = CategoriaBanner.id', |
|
112 | - ), |
|
113 | - ) |
|
114 | - ), |
|
115 | - 'conditions' => array( |
|
116 | - 'Banner.ativo' => 1, |
|
117 | - 'Banner.usuario_id' => $this->Session->read('Usuario.id') |
|
118 | - ) |
|
119 | - ); |
|
120 | - |
|
121 | - $banners = $this->Banner->find('all', $params); |
|
122 | - |
|
123 | - return $banners; |
|
102 | + $this->loadModel('Banner'); |
|
103 | + |
|
104 | + $params = array( |
|
105 | + 'joins' => array( |
|
106 | + array( |
|
107 | + 'table' => 'categoria_banners', |
|
108 | + 'alias' => 'CategoriaBanner', |
|
109 | + 'type' => 'LEFT', |
|
110 | + 'conditions' => array( |
|
111 | + 'Banner.categoria_banner_id = CategoriaBanner.id', |
|
112 | + ), |
|
113 | + ) |
|
114 | + ), |
|
115 | + 'conditions' => array( |
|
116 | + 'Banner.ativo' => 1, |
|
117 | + 'Banner.usuario_id' => $this->Session->read('Usuario.id') |
|
118 | + ) |
|
119 | + ); |
|
120 | + |
|
121 | + $banners = $this->Banner->find('all', $params); |
|
122 | + |
|
123 | + return $banners; |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | public function addCart() { |
@@ -130,26 +130,26 @@ discard block |
||
130 | 130 | $this->redirect('/' . $this->usuario['Usuario']['loja'] . '/'); |
131 | 131 | } |
132 | 132 | |
133 | - if (!$this->validateProduct($produto)) { |
|
134 | - $this->Session->setFlash('Quantidade de produtos escolhidas é maior do que a disponivel!'); |
|
135 | - $this->redirect('/' . $this->usuario['Usuario']['loja'] . '/'); |
|
136 | - } |
|
133 | + if (!$this->validateProduct($produto)) { |
|
134 | + $this->Session->setFlash('Quantidade de produtos escolhidas é maior do que a disponivel!'); |
|
135 | + $this->redirect('/' . $this->usuario['Usuario']['loja'] . '/'); |
|
136 | + } |
|
137 | 137 | |
138 | 138 | $cont = count($this->Session->read('Produto')); |
139 | 139 | |
140 | 140 | $this->Session->write('Produto.'.$produto['id'].'.id' , $produto['id']); |
141 | - $this->Session->write('Produto.'.$produto['id'].'.quantidade' , $produto['quantidade']); |
|
142 | - $this->Session->write('Produto.'.$produto['id'].'.variacao', $produto['variacao']); |
|
141 | + $this->Session->write('Produto.'.$produto['id'].'.quantidade' , $produto['quantidade']); |
|
142 | + $this->Session->write('Produto.'.$produto['id'].'.variacao', $produto['variacao']); |
|
143 | 143 | |
144 | 144 | $this->redirect('/' . $this->usuario['Usuario']['loja'] . '/cart'); |
145 | 145 | } |
146 | 146 | |
147 | 147 | public function removeProductCart() { |
148 | - if ( ($this->Session->read('Produto.' . $this->params['id'])) !== null ) { |
|
149 | - $this->Session->delete( 'Produto.' . $this->params['id'] ); |
|
150 | - } |
|
148 | + if ( ($this->Session->read('Produto.' . $this->params['id'])) !== null ) { |
|
149 | + $this->Session->delete( 'Produto.' . $this->params['id'] ); |
|
150 | + } |
|
151 | 151 | |
152 | - $this->redirect('/' . $this->usuario['Usuario']['loja'] . '/cart'); |
|
152 | + $this->redirect('/' . $this->usuario['Usuario']['loja'] . '/cart'); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | public function clearCart() { |
@@ -157,368 +157,368 @@ discard block |
||
157 | 157 | } |
158 | 158 | |
159 | 159 | public function loadProductsAndValuesCart() { |
160 | - $this->loadModel('Produto'); |
|
161 | - $this->loadModel('Variacao'); |
|
160 | + $this->loadModel('Produto'); |
|
161 | + $this->loadModel('Variacao'); |
|
162 | 162 | |
163 | - $productsSession = $this->Session->read('Produto'); |
|
163 | + $productsSession = $this->Session->read('Produto'); |
|
164 | 164 | |
165 | - (float) $total = 0.00; |
|
166 | - $produtos = array(); |
|
167 | - foreach ($productsSession as $indice => $item) { |
|
168 | - $produto = $this->Produto->find('all', |
|
169 | - array('conditions' => |
|
170 | - array('Produto.ativo' => 1, |
|
171 | - 'Produto.id' => $item['id'] |
|
172 | - ) |
|
173 | - ) |
|
174 | - ); |
|
165 | + (float) $total = 0.00; |
|
166 | + $produtos = array(); |
|
167 | + foreach ($productsSession as $indice => $item) { |
|
168 | + $produto = $this->Produto->find('all', |
|
169 | + array('conditions' => |
|
170 | + array('Produto.ativo' => 1, |
|
171 | + 'Produto.id' => $item['id'] |
|
172 | + ) |
|
173 | + ) |
|
174 | + ); |
|
175 | 175 | |
176 | - $total += $produto[0]['Produto']['preco'] * $item['quantidade']; |
|
176 | + $total += $produto[0]['Produto']['preco'] * $item['quantidade']; |
|
177 | 177 | |
178 | - $produto[0]['Produto']['quantidade'] = $item['quantidade']; |
|
178 | + $produto[0]['Produto']['quantidade'] = $item['quantidade']; |
|
179 | 179 | |
180 | - $variacao = $this->Variacao->find('all', |
|
181 | - array('conditions' => |
|
182 | - array('Variacao.id' => $item['variacao']) |
|
183 | - ), |
|
184 | - array('fields' => |
|
185 | - array('Variacao.nome_variacao') |
|
186 | - ) |
|
187 | - ); |
|
180 | + $variacao = $this->Variacao->find('all', |
|
181 | + array('conditions' => |
|
182 | + array('Variacao.id' => $item['variacao']) |
|
183 | + ), |
|
184 | + array('fields' => |
|
185 | + array('Variacao.nome_variacao') |
|
186 | + ) |
|
187 | + ); |
|
188 | 188 | |
189 | - $produto[0]['Produto']['variacao'] = $variacao[0]['Variacao']['nome_variacao']; |
|
189 | + $produto[0]['Produto']['variacao'] = $variacao[0]['Variacao']['nome_variacao']; |
|
190 | 190 | |
191 | - $produtos[] = $produto[0]; |
|
192 | - } |
|
191 | + $produtos[] = $produto[0]; |
|
192 | + } |
|
193 | 193 | |
194 | - return array('products_cart' => $produtos, 'total' => $total); |
|
194 | + return array('products_cart' => $produtos, 'total' => $total); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | public function loadCategoriesProducts($id_categoria = null) { |
198 | - $this->loadModel('Categoria'); |
|
198 | + $this->loadModel('Categoria'); |
|
199 | 199 | |
200 | - $params = array('conditions' => |
|
201 | - array('ativo' => 1, |
|
202 | - 'usuario_id' => $this->Session->read('Usuario.id') |
|
203 | - ) |
|
204 | - ); |
|
200 | + $params = array('conditions' => |
|
201 | + array('ativo' => 1, |
|
202 | + 'usuario_id' => $this->Session->read('Usuario.id') |
|
203 | + ) |
|
204 | + ); |
|
205 | 205 | |
206 | - $categorias = $this->Categoria->find('all', $params); |
|
206 | + $categorias = $this->Categoria->find('all', $params); |
|
207 | 207 | |
208 | - return $categorias; |
|
208 | + return $categorias; |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | public function payment() { |
212 | - $andress = $this->request->data('endereco'); |
|
212 | + $andress = $this->request->data('endereco'); |
|
213 | 213 | |
214 | - $client = $this->request->data('cliente'); |
|
214 | + $client = $this->request->data('cliente'); |
|
215 | 215 | |
216 | - $products = $this->loadProductsAndValuesCart(); |
|
216 | + $products = $this->loadProductsAndValuesCart(); |
|
217 | 217 | |
218 | - (float) $valor_frete = number_format($this->Session->read('Frete.valor'), 2, '.', ','); |
|
218 | + (float) $valor_frete = number_format($this->Session->read('Frete.valor'), 2, '.', ','); |
|
219 | 219 | |
220 | - $objVenda = new VendaController(); |
|
220 | + $objVenda = new VendaController(); |
|
221 | 221 | |
222 | - $productsSale = $this->prepareProductsSale($products['products_cart']); |
|
222 | + $productsSale = $this->prepareProductsSale($products['products_cart']); |
|
223 | 223 | |
224 | - $usuario_id = $this->Session->read('Usuario.id'); |
|
224 | + $usuario_id = $this->Session->read('Usuario.id'); |
|
225 | 225 | |
226 | - $retorno_venda = $objVenda->salvar_venda($productsSale, array('forma_pagamento' => 'pagseguro'), array('valor' => $valor_frete + $products['total']), $usuario_id); |
|
226 | + $retorno_venda = $objVenda->salvar_venda($productsSale, array('forma_pagamento' => 'pagseguro'), array('valor' => $valor_frete + $products['total']), $usuario_id); |
|
227 | 227 | |
228 | - $this->paymentPagSeguro($products['products_cart'], $andress, $client, $products['total'], $valor_frete, $retorno_venda['id']); |
|
228 | + $this->paymentPagSeguro($products['products_cart'], $andress, $client, $products['total'], $valor_frete, $retorno_venda['id']); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | public function paymentPagSeguro($products, $andress, $client, $total, $shipping, $id) { |
232 | - $pagamento = new PagamentoController('PagseguroController'); |
|
232 | + $pagamento = new PagamentoController('PagseguroController'); |
|
233 | 233 | |
234 | - $pagamento->setToken($this->usuario['Usuario']['token_pagseguro']); |
|
234 | + $pagamento->setToken($this->usuario['Usuario']['token_pagseguro']); |
|
235 | 235 | |
236 | - $pagamento->setEmail($this->usuario['Usuario']['email_pagseguro']); |
|
236 | + $pagamento->setEmail($this->usuario['Usuario']['email_pagseguro']); |
|
237 | 237 | |
238 | - $pagamento->setProdutos($products); |
|
238 | + $pagamento->setProdutos($products); |
|
239 | 239 | |
240 | - $pagamento->adicionarProdutosGateway(); |
|
240 | + $pagamento->adicionarProdutosGateway(); |
|
241 | 241 | |
242 | - $pagamento->setEndereco($andress); |
|
242 | + $pagamento->setEndereco($andress); |
|
243 | 243 | |
244 | - $pagamento->setReference('#' . $id); |
|
244 | + $pagamento->setReference('#' . $id); |
|
245 | 245 | |
246 | - $pagamento->setValorFrete($shipping); |
|
246 | + $pagamento->setValorFrete($shipping); |
|
247 | 247 | |
248 | - return $this->redirect($pagamento->finalizarPedido()); |
|
248 | + return $this->redirect($pagamento->finalizarPedido()); |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | public function prepareProductsSale($products) { |
252 | - $retorno = array(); |
|
252 | + $retorno = array(); |
|
253 | 253 | |
254 | - foreach ($products as $i => $product) { |
|
255 | - $retorno[$i]['id_produto'] = $product['Produto']['id']; |
|
256 | - $retorno[$i]['quantidade'] = $product['Produto']['quantidade']; |
|
257 | - $retorno[$i]['variacao'] = $product['Produto']['variacao']; |
|
258 | - } |
|
254 | + foreach ($products as $i => $product) { |
|
255 | + $retorno[$i]['id_produto'] = $product['Produto']['id']; |
|
256 | + $retorno[$i]['quantidade'] = $product['Produto']['quantidade']; |
|
257 | + $retorno[$i]['variacao'] = $product['Produto']['variacao']; |
|
258 | + } |
|
259 | 259 | |
260 | - return $retorno; |
|
260 | + return $retorno; |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | public function searchAndressByCep($cep) { |
264 | - $this->layout = 'ajax'; |
|
264 | + $this->layout = 'ajax'; |
|
265 | 265 | |
266 | - $curl = curl_init('http://cep.correiocontrol.com.br/'.$cep.'.js'); |
|
266 | + $curl = curl_init('http://cep.correiocontrol.com.br/'.$cep.'.js'); |
|
267 | 267 | |
268 | - curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); |
|
268 | + curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); |
|
269 | 269 | |
270 | - $resultado = curl_exec($curl); |
|
270 | + $resultado = curl_exec($curl); |
|
271 | 271 | |
272 | - echo $resultado; |
|
272 | + echo $resultado; |
|
273 | 273 | |
274 | - exit(); |
|
274 | + exit(); |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | public function calcTransportAjax() { |
278 | - $this->layout = 'ajax'; |
|
278 | + $this->layout = 'ajax'; |
|
279 | 279 | |
280 | - $cep_destino = $this->request->data('cep_destino'); |
|
281 | - $cep_origem = $this->request->data('cep_origem'); |
|
280 | + $cep_destino = $this->request->data('cep_destino'); |
|
281 | + $cep_origem = $this->request->data('cep_origem'); |
|
282 | 282 | |
283 | - $dataProducts = $this->loadProductsAndValuesCart(); |
|
283 | + $dataProducts = $this->loadProductsAndValuesCart(); |
|
284 | 284 | |
285 | - (float) $peso = 0; |
|
286 | - foreach ($dataProducts['products_cart'] as $i => $product) { |
|
287 | - $peso += $product['Produto']['peso_bruto'] * $product['Produto']['quantidade']; |
|
288 | - } |
|
285 | + (float) $peso = 0; |
|
286 | + foreach ($dataProducts['products_cart'] as $i => $product) { |
|
287 | + $peso += $product['Produto']['peso_bruto'] * $product['Produto']['quantidade']; |
|
288 | + } |
|
289 | 289 | |
290 | - $fretes = $this->transport($cep_destino, $this->usuario['Usuario']['cep_origem'], $peso); |
|
290 | + $fretes = $this->transport($cep_destino, $this->usuario['Usuario']['cep_origem'], $peso); |
|
291 | 291 | |
292 | - $disponiveis = array(); |
|
292 | + $disponiveis = array(); |
|
293 | 293 | |
294 | - $cont = 0; |
|
295 | - foreach ($fretes as $i => $frete) { |
|
296 | - $disponiveis[$cont]['valor'] = (array) $frete->Valor; |
|
297 | - $disponiveis[$cont]['prazo'] = (array) $frete->PrazoEntrega; |
|
298 | - $disponiveis[$cont]['codigo'] = (array) $frete->Codigo; |
|
299 | - $disponiveis[$cont]['valor'] = array_shift($disponiveis[$cont]['valor']); |
|
300 | - $disponiveis[$cont]['prazo'] = array_shift($disponiveis[$cont]['prazo']); |
|
301 | - $disponiveis[$cont]['codigo'] = array_shift($disponiveis[$cont]['codigo']); |
|
294 | + $cont = 0; |
|
295 | + foreach ($fretes as $i => $frete) { |
|
296 | + $disponiveis[$cont]['valor'] = (array) $frete->Valor; |
|
297 | + $disponiveis[$cont]['prazo'] = (array) $frete->PrazoEntrega; |
|
298 | + $disponiveis[$cont]['codigo'] = (array) $frete->Codigo; |
|
299 | + $disponiveis[$cont]['valor'] = array_shift($disponiveis[$cont]['valor']); |
|
300 | + $disponiveis[$cont]['prazo'] = array_shift($disponiveis[$cont]['prazo']); |
|
301 | + $disponiveis[$cont]['codigo'] = array_shift($disponiveis[$cont]['codigo']); |
|
302 | 302 | |
303 | - $cont++; |
|
304 | - } |
|
303 | + $cont++; |
|
304 | + } |
|
305 | 305 | |
306 | - $this->Session->write('Frete.valor', $disponiveis[$cont - 1]['valor']); |
|
306 | + $this->Session->write('Frete.valor', $disponiveis[$cont - 1]['valor']); |
|
307 | 307 | |
308 | - (float) $total = $disponiveis[$cont - 1]['valor'] + $dataProducts['total']; |
|
308 | + (float) $total = $disponiveis[$cont - 1]['valor'] + $dataProducts['total']; |
|
309 | 309 | |
310 | - $total = number_format($total, 2, ',', '.'); |
|
310 | + $total = number_format($total, 2, ',', '.'); |
|
311 | 311 | |
312 | - $retorno = array('frete' => $disponiveis[$cont - 1]['valor'], 'total' => $total); |
|
312 | + $retorno = array('frete' => $disponiveis[$cont - 1]['valor'], 'total' => $total); |
|
313 | 313 | |
314 | - echo json_encode($retorno); |
|
315 | - exit(); |
|
314 | + echo json_encode($retorno); |
|
315 | + exit(); |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | public function transport($cep_destino, $cep_origem, $peso) { |
319 | - $altura = '2'; |
|
320 | - $largura = '11'; |
|
321 | - $comprimento = '16'; |
|
322 | - |
|
323 | - $dados['sCepDestino'] = $cep_destino; |
|
324 | - $dados['sCepOrigem'] = $cep_origem; |
|
325 | - $dados['nVlPeso'] = $peso; |
|
326 | - $dados['nVlComprimento'] = $comprimento; |
|
327 | - $dados['nVlAltura'] = $altura; |
|
328 | - $dados['nVlLargura'] = $largura; |
|
329 | - $dados['nCdServico'] = '41106'; |
|
330 | - $dados['nVlDiametro'] = '2'; |
|
331 | - $dados['nCdFormato'] = '1'; |
|
332 | - $dados['sCdMaoPropria'] = 'n'; |
|
333 | - $dados['nVlValorDeclarado'] = '0'; |
|
334 | - $dados['StrRetorno'] = 'xml'; |
|
319 | + $altura = '2'; |
|
320 | + $largura = '11'; |
|
321 | + $comprimento = '16'; |
|
322 | + |
|
323 | + $dados['sCepDestino'] = $cep_destino; |
|
324 | + $dados['sCepOrigem'] = $cep_origem; |
|
325 | + $dados['nVlPeso'] = $peso; |
|
326 | + $dados['nVlComprimento'] = $comprimento; |
|
327 | + $dados['nVlAltura'] = $altura; |
|
328 | + $dados['nVlLargura'] = $largura; |
|
329 | + $dados['nCdServico'] = '41106'; |
|
330 | + $dados['nVlDiametro'] = '2'; |
|
331 | + $dados['nCdFormato'] = '1'; |
|
332 | + $dados['sCdMaoPropria'] = 'n'; |
|
333 | + $dados['nVlValorDeclarado'] = '0'; |
|
334 | + $dados['StrRetorno'] = 'xml'; |
|
335 | 335 | |
336 | - $dados = http_build_query($dados); |
|
336 | + $dados = http_build_query($dados); |
|
337 | 337 | |
338 | - $curl = curl_init('http://ws.correios.com.br/calculador/CalcPrecoPrazo.aspx' . '?' . $dados); |
|
338 | + $curl = curl_init('http://ws.correios.com.br/calculador/CalcPrecoPrazo.aspx' . '?' . $dados); |
|
339 | 339 | |
340 | - curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); |
|
340 | + curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); |
|
341 | 341 | |
342 | - $resultado = curl_exec($curl); |
|
343 | - $resultado = simplexml_load_string($resultado); |
|
342 | + $resultado = curl_exec($curl); |
|
343 | + $resultado = simplexml_load_string($resultado); |
|
344 | 344 | |
345 | - return $resultado; |
|
345 | + return $resultado; |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | public function saveEmailNewsletter() { |
349 | - $nome = $this->request->data('nome'); |
|
350 | - $email = $this->request->data('email'); |
|
349 | + $nome = $this->request->data('nome'); |
|
350 | + $email = $this->request->data('email'); |
|
351 | 351 | |
352 | - $objNewsletter = new NewsletterController(); |
|
352 | + $objNewsletter = new NewsletterController(); |
|
353 | 353 | |
354 | - if ($objNewsletter->newsletter_cadastro($nome, $email, $this->Session->read('Usuario.id'))) |
|
355 | - { |
|
356 | - echo json_encode(true); |
|
357 | - exit(); |
|
358 | - } |
|
354 | + if ($objNewsletter->newsletter_cadastro($nome, $email, $this->Session->read('Usuario.id'))) |
|
355 | + { |
|
356 | + echo json_encode(true); |
|
357 | + exit(); |
|
358 | + } |
|
359 | 359 | |
360 | - echo json_encode(false); |
|
361 | - exit(); |
|
360 | + echo json_encode(false); |
|
361 | + exit(); |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | public function useCoupon() { |
365 | - $this->layout = 'ajax'; |
|
365 | + $this->layout = 'ajax'; |
|
366 | 366 | |
367 | - $cupom = $this->request->data('cupom'); |
|
368 | - $valor = $this->request->data('valor'); |
|
367 | + $cupom = $this->request->data('cupom'); |
|
368 | + $valor = $this->request->data('valor'); |
|
369 | 369 | |
370 | - $objCupom = new CupomController(); |
|
371 | - $novo_valor = $objCupom->utilizar_cupom($cupom, $valor, $this->Session->read('Usuario.id')); |
|
370 | + $objCupom = new CupomController(); |
|
371 | + $novo_valor = $objCupom->utilizar_cupom($cupom, $valor, $this->Session->read('Usuario.id')); |
|
372 | 372 | |
373 | - if (!$novo_valor) |
|
374 | - { |
|
375 | - echo json_encode(false); |
|
376 | - exit(); |
|
377 | - } |
|
373 | + if (!$novo_valor) |
|
374 | + { |
|
375 | + echo json_encode(false); |
|
376 | + exit(); |
|
377 | + } |
|
378 | 378 | |
379 | - echo json_encode($novo_valor); |
|
380 | - exit(); |
|
379 | + echo json_encode($novo_valor); |
|
380 | + exit(); |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | public function validateProduct($data) { |
384 | - $this->loadModel('Variacao'); |
|
384 | + $this->loadModel('Variacao'); |
|
385 | 385 | |
386 | - $params = array('conditions' => |
|
387 | - array( |
|
388 | - 'Variacao.id' => $data['variacao'] |
|
389 | - ) |
|
390 | - ); |
|
386 | + $params = array('conditions' => |
|
387 | + array( |
|
388 | + 'Variacao.id' => $data['variacao'] |
|
389 | + ) |
|
390 | + ); |
|
391 | 391 | |
392 | - $variacao = $this->Variacao->find('all', $params); |
|
392 | + $variacao = $this->Variacao->find('all', $params); |
|
393 | 393 | |
394 | - if ($variacao[0]['Variacao']['estoque'] <= 0 || $data['quantidade'] > $variacao[0]['Variacao']['estoque']) |
|
395 | - { |
|
396 | - return false; |
|
397 | - } |
|
394 | + if ($variacao[0]['Variacao']['estoque'] <= 0 || $data['quantidade'] > $variacao[0]['Variacao']['estoque']) |
|
395 | + { |
|
396 | + return false; |
|
397 | + } |
|
398 | 398 | |
399 | - return true; |
|
399 | + return true; |
|
400 | 400 | } |
401 | 401 | |
402 | 402 | public function saveClientFromEcommerce($data) { |
403 | - $this->loadModel('Cliente'); |
|
403 | + $this->loadModel('Cliente'); |
|
404 | 404 | |
405 | - $data['senha'] = sha1($data['senha']); |
|
405 | + $data['senha'] = sha1($data['senha']); |
|
406 | 406 | |
407 | - $this->Cliente->set($data); |
|
407 | + $this->Cliente->set($data); |
|
408 | 408 | |
409 | - if (!$this->Cliente->validates()) |
|
410 | - { |
|
411 | - return false; |
|
412 | - } |
|
409 | + if (!$this->Cliente->validates()) |
|
410 | + { |
|
411 | + return false; |
|
412 | + } |
|
413 | 413 | |
414 | - if (!$this->Cliente->save()) |
|
415 | - { |
|
416 | - return false; |
|
417 | - } |
|
414 | + if (!$this->Cliente->save()) |
|
415 | + { |
|
416 | + return false; |
|
417 | + } |
|
418 | 418 | |
419 | - return $this->Cliente->getLastInsertId(); |
|
419 | + return $this->Cliente->getLastInsertId(); |
|
420 | 420 | } |
421 | 421 | |
422 | 422 | public function saveAndressClientFromEcommerce($data) { |
423 | - $this->loadModel('EnderecoClienteCadastro'); |
|
423 | + $this->loadModel('EnderecoClienteCadastro'); |
|
424 | 424 | |
425 | - $this->EnderecoClienteCadastro->set($data); |
|
425 | + $this->EnderecoClienteCadastro->set($data); |
|
426 | 426 | |
427 | - if (!$this->EnderecoClienteCadastro->validates()) |
|
428 | - { |
|
429 | - return false; |
|
430 | - } |
|
427 | + if (!$this->EnderecoClienteCadastro->validates()) |
|
428 | + { |
|
429 | + return false; |
|
430 | + } |
|
431 | 431 | |
432 | - return $this->EnderecoClienteCadastro->save(); |
|
432 | + return $this->EnderecoClienteCadastro->save(); |
|
433 | 433 | } |
434 | 434 | |
435 | 435 | /** |
436 | - * Views |
|
437 | - */ |
|
436 | + * Views |
|
437 | + */ |
|
438 | 438 | public function index() { |
439 | - $this->set('usuario', $this->usuario); |
|
440 | - $this->set('banners', $this->loadBanners()); |
|
441 | - $this->set('categorias', $this->loadCategoriesProducts()); |
|
442 | - $this->set('produtos', $this->loadProducts()); |
|
439 | + $this->set('usuario', $this->usuario); |
|
440 | + $this->set('banners', $this->loadBanners()); |
|
441 | + $this->set('categorias', $this->loadCategoriesProducts()); |
|
442 | + $this->set('produtos', $this->loadProducts()); |
|
443 | 443 | |
444 | - $this->render('/' . $this->usuario['Usuario']['folder_view'] . '/index'); |
|
444 | + $this->render('/' . $this->usuario['Usuario']['folder_view'] . '/index'); |
|
445 | 445 | } |
446 | 446 | |
447 | 447 | public function cart() { |
448 | - $this->set('usuario', $this->usuario); |
|
449 | - $this->set('categorias', $this->loadCategoriesProducts()); |
|
450 | - $products = $this->loadProductsAndValuesCart(); |
|
448 | + $this->set('usuario', $this->usuario); |
|
449 | + $this->set('categorias', $this->loadCategoriesProducts()); |
|
450 | + $products = $this->loadProductsAndValuesCart(); |
|
451 | 451 | |
452 | - $this->set('products', $products['products_cart']); |
|
453 | - $this->set('total', $products['total']); |
|
452 | + $this->set('products', $products['products_cart']); |
|
453 | + $this->set('total', $products['total']); |
|
454 | 454 | |
455 | - $this->render('/' . $this->usuario['Usuario']['folder_view'] . '/cart'); |
|
455 | + $this->render('/' . $this->usuario['Usuario']['folder_view'] . '/cart'); |
|
456 | 456 | } |
457 | 457 | |
458 | 458 | public function checkout() { |
459 | - $this->set('usuario', $this->usuario); |
|
460 | - $this->set('categorias', $this->loadCategoriesProducts()); |
|
461 | - $products = $this->loadProductsAndValuesCart(); |
|
459 | + $this->set('usuario', $this->usuario); |
|
460 | + $this->set('categorias', $this->loadCategoriesProducts()); |
|
461 | + $products = $this->loadProductsAndValuesCart(); |
|
462 | 462 | |
463 | - $this->set('products', $products['products_cart']); |
|
464 | - $this->set('total', $products['total']); |
|
463 | + $this->set('products', $products['products_cart']); |
|
464 | + $this->set('total', $products['total']); |
|
465 | 465 | |
466 | - $this->render('/' . $this->usuario['Usuario']['folder_view'] . '/checkout'); |
|
466 | + $this->render('/' . $this->usuario['Usuario']['folder_view'] . '/checkout'); |
|
467 | 467 | } |
468 | 468 | |
469 | 469 | public function category() { |
470 | - $this->set('usuario', $this->usuario); |
|
471 | - $id = $this->params['id']; |
|
472 | - $nome = $this->params['nome']; |
|
470 | + $this->set('usuario', $this->usuario); |
|
471 | + $id = $this->params['id']; |
|
472 | + $nome = $this->params['nome']; |
|
473 | 473 | |
474 | - $products = $this->loadProducts($id); |
|
474 | + $products = $this->loadProducts($id); |
|
475 | 475 | |
476 | - $this->set('categorias', $this->loadCategoriesProducts()); |
|
477 | - $this->set('produtos', $products); |
|
478 | - $this->set('nameCategory', $nome); |
|
476 | + $this->set('categorias', $this->loadCategoriesProducts()); |
|
477 | + $this->set('produtos', $products); |
|
478 | + $this->set('nameCategory', $nome); |
|
479 | 479 | |
480 | - $this->render('/' . $this->usuario['Usuario']['folder_view'] . '/category'); |
|
480 | + $this->render('/' . $this->usuario['Usuario']['folder_view'] . '/category'); |
|
481 | 481 | } |
482 | 482 | |
483 | 483 | public function product() { |
484 | - $this->set('usuario', $this->usuario); |
|
485 | - $this->loadModel('Produto'); |
|
484 | + $this->set('usuario', $this->usuario); |
|
485 | + $this->loadModel('Produto'); |
|
486 | 486 | |
487 | - $id = $this->params['id']; |
|
487 | + $id = $this->params['id']; |
|
488 | 488 | |
489 | - $this->set('categorias', $this->loadCategoriesProducts()); |
|
489 | + $this->set('categorias', $this->loadCategoriesProducts()); |
|
490 | 490 | |
491 | - $produto = $this->loadProducts(null, $id)[0]; |
|
492 | - |
|
493 | - $this->loadModel('Variacao'); |
|
494 | - |
|
495 | - $query = array ( |
|
496 | - 'joins' => array( |
|
497 | - array( |
|
498 | - 'table' => 'produtos', |
|
499 | - 'alias' => 'Produto', |
|
500 | - 'type' => 'LEFT', |
|
501 | - 'conditions' => array( |
|
502 | - 'Variacao.produto_id = Produto.id', |
|
503 | - ), |
|
504 | - ) |
|
505 | - ), |
|
506 | - 'conditions' => array('Variacao.produto_id' => $id, 'Variacao.ativo' => 1), |
|
507 | - 'fields' => array('Produto.id, Variacao.*'), |
|
508 | - ); |
|
509 | - |
|
510 | - $variacoes = $this->Variacao->find('all', $query); |
|
511 | - $this->set('variacoes', $variacoes); |
|
512 | - |
|
513 | - $this->set('produto', $produto); |
|
514 | - |
|
515 | - $this->render('/' . $this->usuario['Usuario']['folder_view'] . '/product'); |
|
491 | + $produto = $this->loadProducts(null, $id)[0]; |
|
492 | + |
|
493 | + $this->loadModel('Variacao'); |
|
494 | + |
|
495 | + $query = array ( |
|
496 | + 'joins' => array( |
|
497 | + array( |
|
498 | + 'table' => 'produtos', |
|
499 | + 'alias' => 'Produto', |
|
500 | + 'type' => 'LEFT', |
|
501 | + 'conditions' => array( |
|
502 | + 'Variacao.produto_id = Produto.id', |
|
503 | + ), |
|
504 | + ) |
|
505 | + ), |
|
506 | + 'conditions' => array('Variacao.produto_id' => $id, 'Variacao.ativo' => 1), |
|
507 | + 'fields' => array('Produto.id, Variacao.*'), |
|
508 | + ); |
|
509 | + |
|
510 | + $variacoes = $this->Variacao->find('all', $query); |
|
511 | + $this->set('variacoes', $variacoes); |
|
512 | + |
|
513 | + $this->set('produto', $produto); |
|
514 | + |
|
515 | + $this->render('/' . $this->usuario['Usuario']['folder_view'] . '/product'); |
|
516 | 516 | } |
517 | 517 | |
518 | 518 | public function retornopagseguro() { |
519 | - $code = $_GET['code']; |
|
519 | + $code = $_GET['code']; |
|
520 | 520 | |
521 | - pr($code,1); |
|
521 | + pr($code,1); |
|
522 | 522 | } |
523 | 523 | |
524 | 524 | } |
525 | 525 | \ No newline at end of file |
@@ -30,7 +30,7 @@ discard block |
||
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 |
||
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() { |
@@ -214,12 +214,12 @@ discard block |
||
214 | 214 | if(!$retorno) { |
215 | 215 | $this->Session->setFlash('Ocorreu um erro ao salvar as novas infomações, tente novamente!'); |
216 | 216 | |
217 | - return $this->redirect('/usuario/meus_dados'); |
|
217 | + return $this->redirect('/usuario/meus_dados'); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | $this->Session->setFlash('Dados atualizados com sucesso!'); |
221 | 221 | |
222 | - return $this->redirect('/usuario/meus_dados'); |
|
222 | + return $this->redirect('/usuario/meus_dados'); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | public function meus_dados() { |
@@ -234,8 +234,8 @@ discard block |
||
234 | 234 | ) |
235 | 235 | ); |
236 | 236 | |
237 | - $this->set('modulos', $this->modulos); |
|
238 | - $this->set('usuario', $dadosUsuario); |
|
237 | + $this->set('modulos', $this->modulos); |
|
238 | + $this->set('usuario', $dadosUsuario); |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | public function new_token() { |
@@ -269,27 +269,27 @@ discard block |
||
269 | 269 | |
270 | 270 | if ($abriu === true) { |
271 | 271 | |
272 | - // Listando os nomes dos elementos |
|
273 | - for ($i = 0; $i < $z->numFiles; $i++) { |
|
272 | + // Listando os nomes dos elementos |
|
273 | + for ($i = 0; $i < $z->numFiles; $i++) { |
|
274 | 274 | |
275 | - $nome = $z->getNameIndex($i); |
|
275 | + $nome = $z->getNameIndex($i); |
|
276 | 276 | |
277 | - $response = $z->extractTo(ROOT . DS . "app/View/"); |
|
277 | + $response = $z->extractTo(ROOT . DS . "app/View/"); |
|
278 | 278 | |
279 | - } |
|
279 | + } |
|
280 | 280 | |
281 | - // Fechando o arquivo |
|
281 | + // Fechando o arquivo |
|
282 | 282 | |
283 | - $z->close(); |
|
283 | + $z->close(); |
|
284 | 284 | |
285 | 285 | } else { |
286 | - echo 'Erro: ' . $abriu; |
|
286 | + echo 'Erro: ' . $abriu; |
|
287 | 287 | } |
288 | 288 | |
289 | - $nomeLayout = substr($template['name'], 0, -4); |
|
289 | + $nomeLayout = substr($template['name'], 0, -4); |
|
290 | 290 | |
291 | - $origem = ROOT . DS . "app/View/" . $nomeLayout . DS . "Layouts" . DS . $nomeLayout . ".ctp"; |
|
292 | - $destino = ROOT . DS . "app/View/" . "Layouts" . DS . $nomeLayout . ".ctp"; |
|
291 | + $origem = ROOT . DS . "app/View/" . $nomeLayout . DS . "Layouts" . DS . $nomeLayout . ".ctp"; |
|
292 | + $destino = ROOT . DS . "app/View/" . "Layouts" . DS . $nomeLayout . ".ctp"; |
|
293 | 293 | |
294 | 294 | shell_exec("mv " . $origem . " " . $destino); |
295 | 295 |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * Construtor |
31 | 31 | * @param $string caminho da imagem a ser carregada |
32 | 32 | * @return void |
33 | - */ |
|
33 | + */ |
|
34 | 34 | public function m2brimagem( $origem = '', $extensoes_validas = array( 'jpg', 'jpeg', 'jpe', 'gif', 'bmp', 'png' ) ) |
35 | 35 | { |
36 | 36 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * Retorna dados da imagem |
51 | 51 | * @param |
52 | 52 | * @return void |
53 | - */ |
|
53 | + */ |
|
54 | 54 | private function dados() |
55 | 55 | { |
56 | 56 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * Retorna validação da imagem |
89 | 89 | * @param |
90 | 90 | * @return String string com erro de mensagem ou 'OK' para imagem válida |
91 | - */ |
|
91 | + */ |
|
92 | 92 | public function valida() |
93 | 93 | { |
94 | 94 | return $this->erro; |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * Carrega uma nova imagem, fora do construtor |
99 | 99 | * @param String caminho da imagem a ser carregada |
100 | 100 | * @return void |
101 | - */ |
|
101 | + */ |
|
102 | 102 | public function carrega( $origem = '' ) |
103 | 103 | { |
104 | 104 | $this->origem = $origem; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * Busca dimensões e formato real da imagem |
113 | 113 | * @param |
114 | 114 | * @return void |
115 | - */ |
|
115 | + */ |
|
116 | 116 | private function dimensoes() |
117 | 117 | { |
118 | 118 | $dimensoes = getimagesize( $this->origem ); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * Busca dados do arquivo |
129 | 129 | * @param |
130 | 130 | * @return void |
131 | - */ |
|
131 | + */ |
|
132 | 132 | private function dadosArquivo() |
133 | 133 | { |
134 | 134 | // imagem de origem |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * Verifica se o arquivo indicado é uma imagem |
144 | 144 | * @param |
145 | 145 | * @return Boolean true/false |
146 | - */ |
|
146 | + */ |
|
147 | 147 | private function eImagem() |
148 | 148 | { |
149 | 149 | // filtra extensão |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | * Cria objeto de imagem para manipulação no GD |
165 | 165 | * @param |
166 | 166 | * @return void |
167 | - */ |
|
167 | + */ |
|
168 | 168 | private function criaImagem() |
169 | 169 | { |
170 | 170 | switch ( $this->formato ) |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * Armazena os valores RGB para redimensionamento com fill |
199 | 199 | * @param Valores R, G e B |
200 | 200 | * @return Void |
201 | - */ |
|
201 | + */ |
|
202 | 202 | public function rgb( $r, $g, $b ) |
203 | 203 | { |
204 | 204 | $this->rgb = array( $r, $g, $b ); |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | * Armazena posições x e y para crop |
209 | 209 | * @param Array valores x e y |
210 | 210 | * @return Void |
211 | - */ |
|
211 | + */ |
|
212 | 212 | public function posicaoCrop( $x, $y ) |
213 | 213 | { |
214 | 214 | $this->posicao_crop = array( $x, $y, $this->largura, $this->altura ); |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | * @param Int $nova_altura valor em pixels da nova altura da imagem |
221 | 221 | * @param String $tipo método para redimensionamento (padrão [vazio], 'fill' [preenchimento] ou 'crop') |
222 | 222 | * @return Boolean/void |
223 | - */ |
|
223 | + */ |
|
224 | 224 | public function redimensiona( $nova_largura = 0, $nova_altura = 0, $tipo = '' ) |
225 | 225 | { |
226 | 226 | |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | * Redimensiona imagem, modo padrão, sem crop ou fill (distorcendo) |
285 | 285 | * @param |
286 | 286 | * @return void |
287 | - */ |
|
287 | + */ |
|
288 | 288 | private function resize() |
289 | 289 | { |
290 | 290 | // cria imagem de destino temporária |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | * Adiciona cor de fundo à imagem |
299 | 299 | * @param |
300 | 300 | * @return void |
301 | - */ |
|
301 | + */ |
|
302 | 302 | private function preencheImagem() |
303 | 303 | { |
304 | 304 | $corfundo = imagecolorallocate( $this->img_temp, $this->rgb[0], $this->rgb[1], $this->rgb[2] ); |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | * preenchendo espaço vazio com cor rgb especificada |
311 | 311 | * @param |
312 | 312 | * @return void |
313 | - */ |
|
313 | + */ |
|
314 | 314 | private function resizeFill() |
315 | 315 | { |
316 | 316 | // cria imagem de destino temporária |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | * Os Ãndices 2 e 3 correspondem ao tamanho do crop |
347 | 347 | * @param |
348 | 348 | * @return void |
349 | - */ |
|
349 | + */ |
|
350 | 350 | private function calculaPosicaoCrop() |
351 | 351 | { |
352 | 352 | // média altura/largura |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | * http://www.findmotive.com/2006/12/13/php-crop-image/ |
385 | 385 | * atualizado para receber o posicionamento X e Y do crop na imagem |
386 | 386 | * @return void |
387 | - */ |
|
387 | + */ |
|
388 | 388 | private function resizeCrop() |
389 | 389 | { |
390 | 390 | // calcula posicionamento do crop |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | * http://www.php.net/manual/en/ref.image.php#62029 |
411 | 411 | * @param String $tipo tipo de espelhamento: h - horizontal, v - vertical |
412 | 412 | * @return void |
413 | - */ |
|
413 | + */ |
|
414 | 414 | public function flip( $tipo = 'h' ) |
415 | 415 | { |
416 | 416 | $w = imagesx( $this->img ); |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | * @param Int $graus grau para giro |
446 | 446 | * @param Array $rgb cor RGB para preenchimento |
447 | 447 | * @return void |
448 | - */ |
|
448 | + */ |
|
449 | 449 | public function girar( $graus, $rgb = array( 255,255,255 ) ) |
450 | 450 | { |
451 | 451 | $corfundo = imagecolorallocate( $this->img, $rgb[0], $rgb[1], $rgb[2] ); |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | * @param Boolean $truetype true para utilizar fonte truetype, false para fonte do sistema |
463 | 463 | * @param String $fonte nome da fonte truetype a ser utilizada |
464 | 464 | * @return void |
465 | - */ |
|
465 | + */ |
|
466 | 466 | public function legenda( $texto, $tamanho = 10, $x = 0, $y = 0, $rgb = array( 255,255,255 ), $truetype = false, $fonte = '' ) |
467 | 467 | { |
468 | 468 | $cortexto = imagecolorallocate( $this->img, $rgb[0], $rgb[1], $rgb[2] ); |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | * [topo, meio, baixo] + [esquerda, centro, direita] |
539 | 539 | * @param Int $alfa valor para transparência (0-100) |
540 | 540 | * @return void |
541 | - */ |
|
541 | + */ |
|
542 | 542 | public function marcaFixa( $imagem, $posicao, $alfa = 100 ) |
543 | 543 | { |
544 | 544 | |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | * @param String $destino caminho e nome do arquivo a serem criados |
604 | 604 | * @param Int $qualidade qualidade da imagem no caso de JPEG (0-100) |
605 | 605 | * @return void |
606 | - */ |
|
606 | + */ |
|
607 | 607 | public function grava( $destino='', $qualidade = 100 ) |
608 | 608 | { |
609 | 609 | // dados do arquivo de destino |