@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | */ |
27 | 27 | //Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home')); |
28 | 28 | /** |
29 | - * ...and connect the rest of 'Pages' controller's URLs. |
|
30 | - */ |
|
29 | + * ...and connect the rest of 'Pages' controller's URLs. |
|
30 | + */ |
|
31 | 31 | //Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display')); |
32 | 32 | |
33 | 33 | $dominio = verificar_dominio(); |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | */ |
51 | 51 | require CAKE . 'Config' . DS . 'routes.php'; |
52 | 52 | /** |
53 | - * Função para verificar se o dominio pentece ao site, caso não pertença redireciona ao site correto |
|
54 | - */ |
|
53 | + * Função para verificar se o dominio pentece ao site, caso não pertença redireciona ao site correto |
|
54 | + */ |
|
55 | 55 | function verificar_dominio() { |
56 | 56 | $dominiosWinners = array ( |
57 | 57 | 'winners.local', |
@@ -48,12 +48,12 @@ discard block |
||
48 | 48 | * Load the CakePHP default routes. Only remove this if you do not want to use |
49 | 49 | * the built-in default routes. |
50 | 50 | */ |
51 | - require CAKE . 'Config' . DS . 'routes.php'; |
|
51 | + require CAKE.'Config'.DS.'routes.php'; |
|
52 | 52 | /** |
53 | 53 | * Função para verificar se o dominio pentece ao site, caso não pertença redireciona ao site correto |
54 | 54 | */ |
55 | 55 | function verificar_dominio() { |
56 | - $dominiosWinners = array ( |
|
56 | + $dominiosWinners = array( |
|
57 | 57 | 'winners.local', |
58 | 58 | 'blog.winnersdesenvolvimento.com.br', |
59 | 59 | 'ciawn.com.br', |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | exit(); |
87 | 87 | } |
88 | 88 | |
89 | - $caminho = APP . 'Config/Domain/' . $varDominio . '.php'; |
|
90 | - if (!file_exists($caminho)) |
|
89 | + $caminho = APP.'Config/Domain/'.$varDominio.'.php'; |
|
90 | + if ( ! file_exists($caminho)) |
|
91 | 91 | { |
92 | 92 | $retorno['is_winners'] = true; |
93 | 93 | return $retorno; |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $retorno['is_winners'] = false; |
99 | 99 | $retorno['id_usuario'] = $dominio['id_usuario']; |
100 | 100 | $retorno['controller'] = $dominio['controller']; |
101 | - $retorno['funcao'] = $dominio['funcao']; |
|
101 | + $retorno['funcao'] = $dominio['funcao']; |
|
102 | 102 | |
103 | 103 | return $retorno; |
104 | 104 | } |
@@ -18,17 +18,17 @@ |
||
18 | 18 | */ |
19 | 19 | |
20 | 20 | $ds = DIRECTORY_SEPARATOR; |
21 | -$dispatcher = 'Cake' . $ds . 'Console' . $ds . 'ShellDispatcher.php'; |
|
21 | +$dispatcher = 'Cake'.$ds.'Console'.$ds.'ShellDispatcher.php'; |
|
22 | 22 | |
23 | 23 | if (function_exists('ini_set')) { |
24 | 24 | $root = dirname(dirname(dirname(__FILE__))); |
25 | 25 | |
26 | 26 | // the following line differs from its sibling |
27 | 27 | // /lib/Cake/Console/Templates/skel/Console/cake.php |
28 | - ini_set('include_path', $root . $ds . 'lib' . PATH_SEPARATOR . ini_get('include_path')); |
|
28 | + ini_set('include_path', $root.$ds.'lib'.PATH_SEPARATOR.ini_get('include_path')); |
|
29 | 29 | } |
30 | 30 | |
31 | -if (!include $dispatcher) { |
|
31 | +if ( ! include $dispatcher) { |
|
32 | 32 | trigger_error('Could not locate CakePHP core files.', E_USER_ERROR); |
33 | 33 | } |
34 | 34 | unset($paths, $path, $dispatcher, $root, $ds); |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -class AdminController extends AppController{ |
|
3 | +class AdminController extends AppController { |
|
4 | 4 | |
5 | - public function beforeFilter(){ |
|
5 | + public function beforeFilter() { |
|
6 | 6 | return true; |
7 | 7 | } |
8 | 8 |
@@ -26,14 +26,14 @@ discard block |
||
26 | 26 | |
27 | 27 | if (empty($retorno)) { |
28 | 28 | $this->Session->setFlash('Erro os dados inseridos não foram encotrados!'); |
29 | - return $this->redirect('/admin/usuarios'); |
|
29 | + return $this->redirect('/admin/usuarios'); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | $this->Session->write('Admin.logado', true); |
33 | 33 | |
34 | 34 | $this->Session->setFlash('Sucesso!'); |
35 | 35 | |
36 | - return $this->redirect('/admin/usuarios'); |
|
36 | + return $this->redirect('/admin/usuarios'); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | public function logout() { |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | $this->Session->setFlash('Sucesso!'); |
43 | 43 | |
44 | - return $this->redirect('/admin/login'); |
|
44 | + return $this->redirect('/admin/login'); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | public function usuarios() { |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * Toda vez que determinado controller não precisa de verificação de acesso o |
24 | 24 | * o mesmo precisa ter essa função rescrita somente com um return true |
25 | 25 | */ |
26 | - public function beforeFilter(){ |
|
26 | + public function beforeFilter() { |
|
27 | 27 | if ($this->debug) { |
28 | 28 | return true; |
29 | 29 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | |
102 | 102 | public function verificar_acesso_admin() { |
103 | 103 | $verificar = $this->Session->read('Admin.logado'); |
104 | - if (!$verificar) { |
|
104 | + if ( ! $verificar) { |
|
105 | 105 | $this->Session->setFlash('Você não possui acesso a está área do sistema'); |
106 | 106 | $this->redirect('/admin/login'); |
107 | 107 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | $this->verificar_acesso(); |
32 | 32 | |
33 | - $this->set('modulos', $this->modulos); |
|
33 | + $this->set('modulos', $this->modulos); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /* |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | if (count($dados) < 1) { |
44 | 44 | $this->Session->setFlash('Você não tem acesso a esta area do sistema!'); |
45 | - return $this->redirect('/'); |
|
45 | + return $this->redirect('/'); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | $this->instancia = $dados['id']; |
@@ -79,6 +79,10 @@ |
||
79 | 79 | * Metodo que verifica se determinado modulo está ativo |
80 | 80 | * @param array modulo |
81 | 81 | */ |
82 | + |
|
83 | + /** |
|
84 | + * @param string $modulo |
|
85 | + */ |
|
82 | 86 | function verificar_modulo_ativo($modulo) { |
83 | 87 | $retorno = array_key_exists($modulo, $this->modulos); |
84 | 88 | return $retorno; |
@@ -11,17 +11,17 @@ discard block |
||
11 | 11 | |
12 | 12 | $query = array ( |
13 | 13 | 'joins' => array( |
14 | - array( |
|
15 | - 'table' => 'produtos', |
|
16 | - 'alias' => 'Produto', |
|
17 | - 'type' => 'LEFT', |
|
18 | - 'conditions' => array( |
|
19 | - 'AviseMe.produto_id = Produto.id', |
|
20 | - ), |
|
21 | - ) |
|
14 | + array( |
|
15 | + 'table' => 'produtos', |
|
16 | + 'alias' => 'Produto', |
|
17 | + 'type' => 'LEFT', |
|
18 | + 'conditions' => array( |
|
19 | + 'AviseMe.produto_id = Produto.id', |
|
20 | + ), |
|
21 | + ) |
|
22 | 22 | ), |
23 | - 'conditions' => array('AviseMe.ativo' => 1, 'AviseMe.usuario_id' => $this->instancia), |
|
24 | - 'fields' => array('Produto.nome, AviseMe.email, AviseMe.id, Produto.id'), |
|
23 | + 'conditions' => array('AviseMe.ativo' => 1, 'AviseMe.usuario_id' => $this->instancia), |
|
24 | + 'fields' => array('Produto.nome, AviseMe.email, AviseMe.id, Produto.id'), |
|
25 | 25 | ); |
26 | 26 | |
27 | 27 | $cadastros = $this->AviseMe->find('all', $query); |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
51 | - * @return boolean |
|
52 | - * Cadastra as informações |
|
53 | - **/ |
|
51 | + * @return boolean |
|
52 | + * Cadastra as informações |
|
53 | + **/ |
|
54 | 54 | public function cadastrar_avise_me() |
55 | 55 | { |
56 | 56 | try |
@@ -70,8 +70,7 @@ |
||
70 | 70 | } |
71 | 71 | |
72 | 72 | return true; |
73 | - } |
|
74 | - catch (Exception $e) |
|
73 | + } catch (Exception $e) |
|
75 | 74 | { |
76 | 75 | throw new Exception("Error Processing Request", 1); |
77 | 76 | } |
@@ -79,6 +79,10 @@ |
||
79 | 79 | return false; |
80 | 80 | } |
81 | 81 | |
82 | + /** |
|
83 | + * @param integer $produto_id |
|
84 | + * @param string $email |
|
85 | + */ |
|
82 | 86 | public function enviar_email_aviseme($produto_id, $email) |
83 | 87 | { |
84 | 88 | try { |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | { |
10 | 10 | $this->loadModel('AviseMe'); |
11 | 11 | |
12 | - $query = array ( |
|
12 | + $query = array( |
|
13 | 13 | 'joins' => array( |
14 | 14 | array( |
15 | 15 | 'table' => 'produtos', |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | |
38 | 38 | $id = $this->request->data('id'); |
39 | 39 | |
40 | - $dados = array ('ativo' => '0'); |
|
41 | - $parametros = array ('id' => $id); |
|
40 | + $dados = array('ativo' => '0'); |
|
41 | + $parametros = array('id' => $id); |
|
42 | 42 | |
43 | 43 | if ($this->AviseMe->updateAll($dados, $parametros)) { |
44 | 44 | echo json_encode(true); |
@@ -59,12 +59,12 @@ discard block |
||
59 | 59 | |
60 | 60 | $this->AviseMe->set($this->request->data); |
61 | 61 | |
62 | - if (!$this->AviseMe->validates()) |
|
62 | + if ( ! $this->AviseMe->validates()) |
|
63 | 63 | { |
64 | 64 | return $this->AviseMe->validationErrors; |
65 | 65 | } |
66 | 66 | |
67 | - if (!$this->AviseMe->save($this->request->data)) |
|
67 | + if ( ! $this->AviseMe->save($this->request->data)) |
|
68 | 68 | { |
69 | 69 | return false; |
70 | 70 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | ->subject('Produto Aviso'); |
100 | 100 | |
101 | 101 | $mensagem = ' |
102 | - <p><strong>Nome</strong>: '. $produto[0]['Produto']['nome'] .'</p> |
|
102 | + <p><strong>Nome</strong>: '. $produto[0]['Produto']['nome'].'</p> |
|
103 | 103 | '; |
104 | 104 | |
105 | 105 | if ($email->send($mensagem)) { |
@@ -63,8 +63,9 @@ discard block |
||
63 | 63 | if (!empty($image['name'])) { |
64 | 64 | $retorno = $this->uploadImage($image); |
65 | 65 | |
66 | - if (!$retorno['status']) |
|
67 | - $this->Session->setFlash('Não foi possivel salvar a imagem tente novamente'); |
|
66 | + if (!$retorno['status']) { |
|
67 | + $this->Session->setFlash('Não foi possivel salvar a imagem tente novamente'); |
|
68 | + } |
|
68 | 69 | |
69 | 70 | $dados['imagem'] = $retorno['nome']; |
70 | 71 | } |
@@ -91,8 +92,9 @@ discard block |
||
91 | 92 | |
92 | 93 | $retorno = $this->uploadImage($image); |
93 | 94 | |
94 | - if (!$retorno['status']) |
|
95 | - $this->Session->setFlash('Não foi possivel salvar a imagem tente novamente'); |
|
95 | + if (!$retorno['status']) { |
|
96 | + $this->Session->setFlash('Não foi possivel salvar a imagem tente novamente'); |
|
97 | + } |
|
96 | 98 | |
97 | 99 | $dados['src'] = $retorno['nome']; |
98 | 100 | $dados['usuario_id'] = $this->instancia; |
@@ -114,8 +116,9 @@ discard block |
||
114 | 116 | |
115 | 117 | $returnUpload = move_uploaded_file($image['tmp_name'], $dir . $nameImage); |
116 | 118 | |
117 | - if (!$returnUpload) |
|
118 | - return array('nome' => null, 'status' => false); |
|
119 | + if (!$returnUpload) { |
|
120 | + return array('nome' => null, 'status' => false); |
|
121 | + } |
|
119 | 122 | |
120 | 123 | return array('nome' => $nameImage, 'status' => true); |
121 | 124 | } |
@@ -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 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -require ROOT . DS . 'app/Vendor/m2brimagem.php'; |
|
3 | +require ROOT.DS.'app/Vendor/m2brimagem.php'; |
|
4 | 4 | |
5 | 5 | class BannerController extends AppController { |
6 | 6 | |
@@ -60,12 +60,12 @@ discard block |
||
60 | 60 | public function s_editar_cadastro($id) { |
61 | 61 | $dados = $this->request->data('dados'); |
62 | 62 | |
63 | - $image = $_FILES['imagem']; |
|
63 | + $image = $_FILES['imagem']; |
|
64 | 64 | |
65 | - if (!empty($image['name'])) { |
|
65 | + if ( ! empty($image['name'])) { |
|
66 | 66 | $retorno = $this->uploadImage($image); |
67 | 67 | |
68 | - if (!$retorno['status']) |
|
68 | + if ( ! $retorno['status']) |
|
69 | 69 | $this->Session->setFlash('Não foi possivel salvar a imagem tente novamente'); |
70 | 70 | |
71 | 71 | $dados['imagem'] = $retorno['nome']; |
@@ -78,10 +78,10 @@ discard block |
||
78 | 78 | $this->Banner->id = $id; |
79 | 79 | |
80 | 80 | if ($this->Banner->save($dados)) { |
81 | - $this->Session->setFlash('Banner editado com sucesso!','default','good'); |
|
81 | + $this->Session->setFlash('Banner editado com sucesso!', 'default', 'good'); |
|
82 | 82 | return $this->redirect('/banner/listar_cadastros'); |
83 | 83 | } else { |
84 | - $this->Session->setFlash('Ocorreu um erro ao editar o Banner!','default','good'); |
|
84 | + $this->Session->setFlash('Ocorreu um erro ao editar o Banner!', 'default', 'good'); |
|
85 | 85 | return $this->redirect('/banner/listar_cadastros'); |
86 | 86 | } |
87 | 87 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | public function s_adicionar_cadastro() { |
90 | 90 | $this->loadModel('CategoriaBanner'); |
91 | 91 | |
92 | - $dados = $this->request->data('dados'); |
|
92 | + $dados = $this->request->data('dados'); |
|
93 | 93 | |
94 | 94 | $categoriaBanner = $this->CategoriaBanner->find('first', array( |
95 | 95 | 'conditions' => array( |
@@ -98,18 +98,18 @@ discard block |
||
98 | 98 | ) |
99 | 99 | ); |
100 | 100 | |
101 | - $image = $_FILES['imagem']; |
|
101 | + $image = $_FILES['imagem']; |
|
102 | 102 | |
103 | 103 | $retorno = $this->uploadImage($image, $categoriaBanner); |
104 | 104 | |
105 | - if (!$retorno['status']) |
|
105 | + if ( ! $retorno['status']) |
|
106 | 106 | $this->Session->setFlash('Não foi possivel salvar a imagem tente novamente'); |
107 | 107 | |
108 | 108 | $dados['src'] = $retorno['nome']; |
109 | 109 | $dados['usuario_id'] = $this->instancia; |
110 | 110 | $dados['ativo'] = 1; |
111 | 111 | |
112 | - if($this->Banner->save($dados)) { |
|
112 | + if ($this->Banner->save($dados)) { |
|
113 | 113 | $this->Session->setFlash('Banner salvo com sucesso!'); |
114 | 114 | return $this->redirect('/banner/listar_cadastros'); |
115 | 115 | } else { |
@@ -121,13 +121,13 @@ discard block |
||
121 | 121 | public function uploadImage(&$image, $categoriaBanner) { |
122 | 122 | $type = substr($image['name'], -4); |
123 | 123 | |
124 | - $nameImage = uniqid() . md5($image['name']) . $type; |
|
124 | + $nameImage = uniqid().md5($image['name']).$type; |
|
125 | 125 | |
126 | - $dir = APP . 'webroot/uploads/banner/imagens/'; |
|
126 | + $dir = APP.'webroot/uploads/banner/imagens/'; |
|
127 | 127 | |
128 | - $returnUpload = move_uploaded_file($image['tmp_name'], $dir . $nameImage); |
|
128 | + $returnUpload = move_uploaded_file($image['tmp_name'], $dir.$nameImage); |
|
129 | 129 | |
130 | - $oImg = new m2brimagem($dir . $nameImage); |
|
130 | + $oImg = new m2brimagem($dir.$nameImage); |
|
131 | 131 | |
132 | 132 | $valida = $oImg->valida(); |
133 | 133 | |
@@ -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 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | |
144 | 144 | } |
145 | 145 | |
146 | - if (!$returnUpload) |
|
146 | + if ( ! $returnUpload) |
|
147 | 147 | return array('nome' => null, 'status' => false); |
148 | 148 | |
149 | 149 | return array('nome' => $nameImage, 'status' => true); |
@@ -154,8 +154,8 @@ discard block |
||
154 | 154 | |
155 | 155 | $id = $this->request->data('id'); |
156 | 156 | |
157 | - $dados = array ('ativo' => '0'); |
|
158 | - $parametros = array ('id' => $id); |
|
157 | + $dados = array('ativo' => '0'); |
|
158 | + $parametros = array('id' => $id); |
|
159 | 159 | |
160 | 160 | if ($this->Banner->updateAll($dados, $parametros)) { |
161 | 161 | echo json_encode(true); |
@@ -30,10 +30,10 @@ discard block |
||
30 | 30 | |
31 | 31 | if ($this->CategoriaBanner->save($dados)) { |
32 | 32 | $this->Session->setFlash('Categoria criada com Sucesso!','default','good'); |
33 | - return $this->redirect('/categoria_banner/listar_cadastros'); |
|
33 | + return $this->redirect('/categoria_banner/listar_cadastros'); |
|
34 | 34 | } else { |
35 | 35 | $this->Session->setFlash('Erro ao criar a categoria!','default','good'); |
36 | - return $this->redirect('/categoria_banner/listar_cadastros'); |
|
36 | + return $this->redirect('/categoria_banner/listar_cadastros'); |
|
37 | 37 | } |
38 | 38 | } |
39 | 39 | |
@@ -56,10 +56,10 @@ discard block |
||
56 | 56 | |
57 | 57 | if ($this->CategoriaBanner->save($dados)) { |
58 | 58 | $this->Session->setFlash('Categoria editada com Sucesso!','default','good'); |
59 | - return $this->redirect('/categoria_banner/listar_cadastros'); |
|
59 | + return $this->redirect('/categoria_banner/listar_cadastros'); |
|
60 | 60 | } else { |
61 | 61 | $this->Session->setFlash('Erro ao editar a categoria!','default','good'); |
62 | - return $this->redirect('/categoria_banner/listar_cadastros'); |
|
62 | + return $this->redirect('/categoria_banner/listar_cadastros'); |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 |
@@ -30,10 +30,10 @@ discard block |
||
30 | 30 | $dados['usuario_id'] = $this->instancia; |
31 | 31 | |
32 | 32 | if ($this->Categoria->save($dados)) { |
33 | - $this->Session->setFlash('Categoria criada com Sucesso!','default','good'); |
|
33 | + $this->Session->setFlash('Categoria criada com Sucesso!', 'default', 'good'); |
|
34 | 34 | return $this->redirect('/categoria/listar_cadastros'); |
35 | 35 | } else { |
36 | - $this->Session->setFlash('Erro ao criar a categoria!','default','good'); |
|
36 | + $this->Session->setFlash('Erro ao criar a categoria!', 'default', 'good'); |
|
37 | 37 | return $this->redirect('/categoria/listar_cadastros'); |
38 | 38 | } |
39 | 39 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | $categoria = $this->Categoria->find('first', |
45 | 45 | array('conditions' => |
46 | - array( 'id' => $id ) |
|
46 | + array('id' => $id) |
|
47 | 47 | ) |
48 | 48 | ); |
49 | 49 | |
@@ -60,10 +60,10 @@ discard block |
||
60 | 60 | $this->Categoria->id = $id; |
61 | 61 | |
62 | 62 | if ($this->Categoria->save($dados)) { |
63 | - $this->Session->setFlash('Categoria editada com Sucesso!','default','good'); |
|
63 | + $this->Session->setFlash('Categoria editada com Sucesso!', 'default', 'good'); |
|
64 | 64 | return $this->redirect('/categoria/listar_cadastros'); |
65 | 65 | } else { |
66 | - $this->Session->setFlash('Erro ao editar a categoria!','default','good'); |
|
66 | + $this->Session->setFlash('Erro ao editar a categoria!', 'default', 'good'); |
|
67 | 67 | return $this->redirect('/categoria/listar_cadastros'); |
68 | 68 | } |
69 | 69 | } |
@@ -75,14 +75,14 @@ discard block |
||
75 | 75 | |
76 | 76 | $id = $this->request->data('id'); |
77 | 77 | |
78 | - $dados = array ('ativo' => '0'); |
|
79 | - $parametros = array ('id' => $id); |
|
78 | + $dados = array('ativo' => '0'); |
|
79 | + $parametros = array('id' => $id); |
|
80 | 80 | |
81 | 81 | if ($this->Categoria->updateAll($dados, $parametros)) { |
82 | - $this->Session->setFlash('Categoria excluida com Sucesso!','default','good'); |
|
82 | + $this->Session->setFlash('Categoria excluida com Sucesso!', 'default', 'good'); |
|
83 | 83 | echo json_encode(true); |
84 | 84 | } else { |
85 | - $this->Session->setFlash('Erro ao excluir categoria!','default','good'); |
|
85 | + $this->Session->setFlash('Erro ao excluir categoria!', 'default', 'good'); |
|
86 | 86 | echo json_encode(false); |
87 | 87 | } |
88 | 88 | } |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | |
32 | 32 | if ($this->Categoria->save($dados)) { |
33 | 33 | $this->Session->setFlash('Categoria criada com Sucesso!','default','good'); |
34 | - return $this->redirect('/categoria/listar_cadastros'); |
|
34 | + return $this->redirect('/categoria/listar_cadastros'); |
|
35 | 35 | } else { |
36 | 36 | $this->Session->setFlash('Erro ao criar a categoria!','default','good'); |
37 | - return $this->redirect('/categoria/listar_cadastros'); |
|
37 | + return $this->redirect('/categoria/listar_cadastros'); |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 | |
@@ -61,10 +61,10 @@ discard block |
||
61 | 61 | |
62 | 62 | if ($this->Categoria->save($dados)) { |
63 | 63 | $this->Session->setFlash('Categoria editada com Sucesso!','default','good'); |
64 | - return $this->redirect('/categoria/listar_cadastros'); |
|
64 | + return $this->redirect('/categoria/listar_cadastros'); |
|
65 | 65 | } else { |
66 | 66 | $this->Session->setFlash('Erro ao editar a categoria!','default','good'); |
67 | - return $this->redirect('/categoria/listar_cadastros'); |
|
67 | + return $this->redirect('/categoria/listar_cadastros'); |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 |
@@ -30,10 +30,10 @@ discard block |
||
30 | 30 | $dados['usuario_id'] = $this->instancia; |
31 | 31 | |
32 | 32 | if ($this->Categoria->save($dados)) { |
33 | - $this->Session->setFlash('Categoria criada com Sucesso!','default','good'); |
|
33 | + $this->Session->setFlash('Categoria criada com Sucesso!', 'default', 'good'); |
|
34 | 34 | return $this->redirect('/categoria/listar_cadastros'); |
35 | 35 | } else { |
36 | - $this->Session->setFlash('Erro ao criar a categoria!','default','good'); |
|
36 | + $this->Session->setFlash('Erro ao criar a categoria!', 'default', 'good'); |
|
37 | 37 | return $this->redirect('/categoria/listar_cadastros'); |
38 | 38 | } |
39 | 39 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | $categoria = $this->Categoria->find('first', |
45 | 45 | array('conditions' => |
46 | - array( 'id' => $id ) |
|
46 | + array('id' => $id) |
|
47 | 47 | ) |
48 | 48 | ); |
49 | 49 | |
@@ -60,10 +60,10 @@ discard block |
||
60 | 60 | $this->Categoria->id = $id; |
61 | 61 | |
62 | 62 | if ($this->Categoria->save($dados)) { |
63 | - $this->Session->setFlash('Categoria editada com Sucesso!','default','good'); |
|
63 | + $this->Session->setFlash('Categoria editada com Sucesso!', 'default', 'good'); |
|
64 | 64 | return $this->redirect('/categoria/listar_cadastros'); |
65 | 65 | } else { |
66 | - $this->Session->setFlash('Erro ao editar a categoria!','default','good'); |
|
66 | + $this->Session->setFlash('Erro ao editar a categoria!', 'default', 'good'); |
|
67 | 67 | return $this->redirect('/categoria/listar_cadastros'); |
68 | 68 | } |
69 | 69 | } |
@@ -75,14 +75,14 @@ discard block |
||
75 | 75 | |
76 | 76 | $id = $this->request->data('id'); |
77 | 77 | |
78 | - $dados = array ('ativo' => '0'); |
|
79 | - $parametros = array ('id' => $id); |
|
78 | + $dados = array('ativo' => '0'); |
|
79 | + $parametros = array('id' => $id); |
|
80 | 80 | |
81 | 81 | if ($this->Categoria->updateAll($dados, $parametros)) { |
82 | - $this->Session->setFlash('Categoria excluida com Sucesso!','default','good'); |
|
82 | + $this->Session->setFlash('Categoria excluida com Sucesso!', 'default', 'good'); |
|
83 | 83 | echo json_encode(true); |
84 | 84 | } else { |
85 | - $this->Session->setFlash('Erro ao excluir categoria!','default','good'); |
|
85 | + $this->Session->setFlash('Erro ao excluir categoria!', 'default', 'good'); |
|
86 | 86 | echo json_encode(false); |
87 | 87 | } |
88 | 88 | } |
@@ -30,10 +30,10 @@ discard block |
||
30 | 30 | $this->EnderecoClienteCadastro->save($endereco); |
31 | 31 | |
32 | 32 | $this->Session->setFlash('Cliente salvo com sucesso!'); |
33 | - return $this->redirect('/cliente/listar_cadastros'); |
|
33 | + return $this->redirect('/cliente/listar_cadastros'); |
|
34 | 34 | } else { |
35 | 35 | $this->Session->setFlash('Ocorreu um erro ao salva o cliente!'); |
36 | - return $this->redirect('/cliente/listar_cadastros'); |
|
36 | + return $this->redirect('/cliente/listar_cadastros'); |
|
37 | 37 | } |
38 | 38 | } |
39 | 39 | |
@@ -85,15 +85,15 @@ discard block |
||
85 | 85 | |
86 | 86 | if ($this->Cliente->save($dados)) { |
87 | 87 | $this->Session->setFlash('Cliente editado com sucesso!'); |
88 | - return $this->redirect('/cliente/listar_cadastros'); |
|
88 | + return $this->redirect('/cliente/listar_cadastros'); |
|
89 | 89 | } else { |
90 | 90 | $this->Session->setFlash('Ocorreu um erro ao editar o cliente!'); |
91 | - return $this->redirect('/cliente/listar_cadastros'); |
|
91 | + return $this->redirect('/cliente/listar_cadastros'); |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 | |
95 | 95 | function exportar_clientes() { |
96 | - $this->layout = 'ajax'; |
|
97 | - $this->set('event', $this->Cliente->find('all')); |
|
96 | + $this->layout = 'ajax'; |
|
97 | + $this->set('event', $this->Cliente->find('all')); |
|
98 | 98 | } |
99 | 99 | } |
100 | 100 | \ No newline at end of file |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -class ClienteController extends AppController{ |
|
3 | +class ClienteController extends AppController { |
|
4 | 4 | // public $helpers = array('Excel'); |
5 | 5 | |
6 | 6 | function home() { |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | if ($this->Cliente->save($dados)) { |
25 | 25 | $endereco['id_usuario'] = $this->instancia; |
26 | 26 | $endereco['id_cliente'] = $this->Cliente->id; |
27 | - $endereco['ativo'] = 1; |
|
27 | + $endereco['ativo'] = 1; |
|
28 | 28 | |
29 | 29 | $this->loadModel('EnderecoClienteCadastro'); |
30 | 30 | $this->EnderecoClienteCadastro->save($endereco); |
@@ -42,10 +42,10 @@ discard block |
||
42 | 42 | |
43 | 43 | $id = $this->request->data('id'); |
44 | 44 | |
45 | - $dados = array ('ativo' => '0'); |
|
46 | - $parametros = array ('id' => $id); |
|
45 | + $dados = array('ativo' => '0'); |
|
46 | + $parametros = array('id' => $id); |
|
47 | 47 | |
48 | - if ($this->Cliente->updateAll($dados,$parametros)) { |
|
48 | + if ($this->Cliente->updateAll($dados, $parametros)) { |
|
49 | 49 | echo json_encode(true); |
50 | 50 | } else { |
51 | 51 | echo json_encode(false); |