public function listagemAction() { $this->view->bodyClass = 'pg-interna'; $vista = Services::get('vista_rest'); $this->view->listas = $vista->getListasBusca(); $bairros = Gravi_Service_ImochatService::getBairros(); $this->view->bairros = $bairros['hoods']; }
protected function _initLayout() { $layout = Zend_Layout::startMvc(); Zend_Controller_Front::getInstance()->registerPlugin(new Module_LayoutPlugin()); $http = new Zend_Controller_Request_Http(); $viewSession = $http->getCookie('viewsite'); if (empty($viewSession)) { Gravi_Service_ImochatService::SaveSiteView(); setcookie('viewsite', 'true', time() + 60 * 60, '/'); } }
public function indexAction() { $this->view->headScript()->appendFile($this->view->serverUrl() . BASEDIR . '/res/js/imoveis.js'); $this->view->headScript()->appendFile($this->view->serverUrl() . BASEDIR . '/res/js/index.js'); $vista = Services::get('vista_rest'); $this->view->listas = $vista->getListasBusca(); $vista->reset(); $pagination = array('pagina' => 1, 'quantidade' => 4); $banners = Gravi_Service_ImochatService::getBanners(); $this->view->banners = $banners['banners']; $filtroWidget1 = array('Destinacao' => 'ALUGUEL', 'EmDestaque' => 'Sim'); $order = array('DataCadastro' => 'desc'); $vista->buscaImoveis($filtroWidget1, $pagination, $order); $this->view->widget1 = $vista->getResult(); $vista->reset(); $filtroWidget2 = array('Destinacao' => 'VENDA', 'EmDestaque' => 'Sim'); $pagination = array('pagina' => 1, 'quantidade' => 4); $vista->buscaImoveis($filtroWidget2, $pagination, $order); $this->view->widget2 = $vista->getResult(); $filtroWidget3 = array('Destinacao' => 'VENDA', 'Lancamento' => 'Sim'); $pagination = array('pagina' => 1, 'quantidade' => 8); $vista->buscaImoveis($filtroWidget3, $pagination, $order); $this->view->widget3 = $vista->getResult(); }
public function indexAction() { $vista = Services::get('vista_rest'); $this->view->listas = $vista->getListasBusca(); $form = new Site_Form_FaleConoscoForm(); $this->view->form = $form; $this->view->bodyClass = 'pg-interna'; $params = $this->_request->getParams(); $this->view->headScript()->appendFile($this->view->serverUrl() . BASEDIR . '/res/js/faleconosco.js'); $acao = $this->getRequest()->getParam('acao'); $this->view->proposta = $acao == 'proposta'; $this->view->subject = $this->getRequest()->getParam('s'); if ($this->_request->isPost()) { try { $vista = Services::get('vista_rest'); $vista->getAuthEmail(); $smtpData = $vista->getResult(); $config = array('auth' => 'login', 'username' => $smtpData['user'], 'password' => $smtpData['pass'], 'port' => $smtpData['port']); // print_r($smtpData); exit; $transport = new Zend_Mail_Transport_Smtp($smtpData['smtp'], $config); Zend_Mail::setDefaultTransport($transport); $html = new Zend_View(); $html->setScriptPath(APPLICATION_PATH . '/modules/site/views/scripts/fale-conosco/'); $html->data = $params; $emailBody = $html->render('email-body.phtml'); $mail = new Zend_Mail('UTF-8'); $configData = Gravi_Service_ImochatService::getSiteConfig(); $config = $configData['config']; $mail->setBodyHtml($emailBody); $mail->setFrom($config['contact_email'], $params['nome']); // Teste Local // $mail->addTo('*****@*****.**', 'AG3'); $mail->addTo($config['contact_email'], 'AG3'); $assunto = isset($params['assunto']) ? $params['assunto'] : ''; $subjects = array('contato' => 'SITE AG3 - ' . $assunto . ' - CONTATO PELO SITE', 'interesse' => 'SITE AG3 - ' . $assunto . ' - INTERESSE EM IMÓVEL', 'ligamos' => 'SITE AG3 - ' . $assunto . ' - LIGAMOS PARA VOCÊ'); $subject = 'contato'; if (isset($params['subject']) && isset($subjects[$params['subject']])) { $subject = $params['subject']; } if (isset($params['curriculo'])) { $filename = $params['curriculo-name']; $ext = pathinfo($filename, PATHINFO_EXTENSION); $allowed = array('doc', 'docx', 'pdf', 'xls', 'xlsx', 'odt', 'zip', 'rar'); if (!in_array($ext, $allowed)) { $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); echo 'O currículo enviado está em um formato não aceito!'; return; } $file = explode(',', $params['curriculo']); $base64 = $file[1]; $data = explode(':', $file[0]); $mime = str_replace(';base64', '', $data[1]); $at = $mail->createAttachment(base64_decode($base64)); $at->type = $mime; $at->disposition = Zend_Mime::DISPOSITION_INLINE; $at->encoding = Zend_Mime::ENCODING_BASE64; $at->filename = $filename; } $location = Gravi_Geolocation::getVisitorLocation(); $contactData = array('client_name' => $params['nome'], 'email' => $params['email'], 'phone' => $params['fone'], 'message' => $params['mensagem']); foreach (array('city' => 'city', 'region' => 'region', 'lat' => 'lat', 'lon' => 'lng', 'isp' => 'isp', 'query' => 'ip') as $info => $dest) { !isset($location[$info]) || ($contactData[$dest] = $location[$info]); } if (in_array($params['subject'], array('interesse', 'oferta'))) { $contactData['property_id'] = $params['imovel']; Gravi_Service_ImochatService::SaveSiteOffer($contactData); } else { Gravi_Service_ImochatService::SaveSiteContact($contactData); } $mail->setSubject($subjects[$subject]); $mail->send(); $this->view->success = true; if ($this->_request->isXmlHttpRequest()) { $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); echo 'Sua mensagem foi enviada. Obrigado!'; return; } } catch (Exception $e) { print_r($e->getMessage()); exit; } } }
public function detalhesAction() { $vista = Services::get('vista_rest'); $this->view->listas = $vista->getListasBusca(); $this->view->bodyClass = 'pg-interna'; $this->view->headScript()->appendFile($this->view->serverUrl() . BASEDIR . '/res/js/imoveis.js'); $this->view->headScript()->appendFile($this->view->serverUrl() . BASEDIR . '/res/js/detalhes.js'); $imoCodigo = $this->_request->getParam('codigo'); Gravi_Service_ImochatService::SavePropertyView($imoCodigo); if (empty($imoCodigo)) { //TODO -- Criar tela de imovel não encontrado } $vista = Services::get('vista_rest'); $vista->getDadosImovel($imoCodigo); $dadosImovel = $vista->getResult(); if (empty($dadosImovel['Codigo'])) { $this->_helper->viewRenderer('not-found'); } else { $semelhantes = $this->getSemelhantes($dadosImovel); $this->view->semelhantes = $semelhantes; $form = new Site_Form_FaleConoscoForm(); $form->mensagem->setValue('Tenho interesse no imóvel código ' . $dadosImovel['Codigo'] . ', solicito contato por e-mail'); $this->view->form = $form; } $this->view->fav = false; $favs = $this->getRequest()->getCookie('favs'); if (!empty($favs) && in_array($imoCodigo, json_decode(base64_decode($favs)))) { $this->view->fav = true; } $this->view->imovel = $dadosImovel; }