/**
 *  @todo make it work lazy bum!
 */
function YahooAnswers($page)
{
    $url = 'http://answers.yahoo.com/search/search_result?page=1&p=%s&scope=all&fltr=_en&question_status=all&date_submitted=all&category=0&answer_count=any&filter_search=1';
    $data = Internet::Grab(sprintf($url, str_replace(' ', '+', $page->keyword)));
    preg_match_all('/h3><a.+?"(.+?)<ul/', $data, $qa);
    // $gContent = preg_replace("/(<\/?)(\w+)([^>]*>)/e"," ",$gContent);
}
Ejemplo n.º 2
0
 function GetImage($keyword)
 {
     $keyword = str_replace(" ", "+", $keyword);
     $content = Internet::Grab(sprintf("http://images.search.yahoo.com/search/images?p=%s&ei=UTF-8", $keyword));
     if (preg_match_all("/thumbnail\\.aspx\\?q=(.+?)\"/", $content, $matches) == 0) {
         shuffle($matches[1]);
     }
     return Internet::Grab(sprintf("http://ts3.mm.bing.net/images/thumbnail.aspx?q=%s", str_replace("&amp;", "&", $matches[1][0])));
 }
Ejemplo n.º 3
0
 function EnrichContent($content, $keyword, $args)
 {
     $url = sprintf("http://www.google.com/search?hl=en&source=hp&q=%s&aq=f&aqi=&aql=&oq=&gs_rfai=&num=100", str_replace(" ", "+", $keyword));
     preg_match_all("/class=l>(.+?)<span class=f><cite>/si", Internet::Grab($url), $cmatches);
     $gContent = implode(" ", $cmatches[1]);
     $gContent = preg_replace("/(<\\/?)(\\w+)([^>]*>)/e", " ", $gContent);
     $content .= $gContent;
     return $content;
 }
Ejemplo n.º 4
0
 function EnrichContent($content, $keyword, $args)
 {
     $kw = str_replace(" ", "+", $keyword);
     $url = sprintf("http://www.bing.com/search?q=%s+language:en&go=&form=QBRE&filt=all", $kw);
     preg_match_all("/<h3><a (.+?)<\\/p/si", Internet::Grab($url), $cmatches);
     $gContent = implode(" ", $cmatches[1]);
     $gContent = preg_replace("/(<\\/?)(\\w+)([^>]*>)/e", " ", $gContent);
     $content .= $gContent;
     return $content;
 }
Ejemplo n.º 5
0
 function GetImage($keyword)
 {
     $keyword = str_replace(" ", "+", $keyword);
     $content = Internet::Grab("http://www.sxc.hu/browse.phtml?f=search&txt={$keyword}&w=1&x=0&y=0");
     if (preg_match_all("/showtrail\\(300,[0-9]+,'(.+?)'/", $content, $matches) == 0) {
         $keyword = str_replace(" ", "-", $keyword);
         $content = Internet::Grab("http://www.sxc.hu/browse.phtml?f=search&txt={$keyword}&w=1&x=0&y=0");
         if (preg_match_all("/showtrail\\(300,[0-9]+,'(.+?)'/", $content, $matches) == 0) {
             return null;
         }
     }
     shuffle($matches[1]);
     return Internet::Grab(sprintf("http://www.sxc.hu/%s", $matches[1][0]));
 }
Ejemplo n.º 6
0
 /**
  * Grab some file from the internets
  *
  * @param string $url
  * @return string $data
  */
 public static function Grab($url)
 {
     $data = '';
     $url = str_replace(" ", "+", $url);
     $data = Internet::GrabSimple($url);
     if (!empty($data)) {
         return $data;
     }
     $data = Internet::GrabCurl($url);
     if (!empty($data)) {
         return $data;
     }
     $data = Internet::GrabSockets($url);
     return $data;
 }
Ejemplo n.º 7
0
 function EnrichContent($content, $keyword, $args)
 {
     $feeder = array('http://news.search.yahoo.com/rss?ei=UTF-8&p=%s&fr=sfp', 'http://blogsearch.google.com/blogsearch_feeds?hl=en&q=%s&ie=utf-8&num=10&output=rss', 'http://www.bing.com/search?q=%s+language:en&go=&form=QBLH&filt=all&format=rss');
     shuffle($feeder);
     $link = sprintf($feeder[0], str_replace(' ', '+', $keyword));
     $feed = Internet::Grab($link);
     preg_match_all('/<description>(.+?)<\\/description>/si', $feed, $des);
     preg_match_all('/<title>(.+?)<\\/title>/si', $feed, $tit);
     $retArr = array_merge($tit[1], $des[1]);
     if (count($retArr) == 0 || !is_array($retArr)) {
         return $content;
     }
     shuffle($retArr);
     $ret = sprintf('%s %s', $content, implode(' ', $retArr));
     return $ret;
 }
Ejemplo n.º 8
0
 function EnrichContent($content, $keyword, $args)
 {
     $ArticleDashboards = array('http://www.afroarticles.com/article-dashboard/indexser.php?search=%s', 'http://www.keywordarticles.org/indexser.php?search=%s', 'http://www.purearticle.com/indexser.php?search=%s', 'http://www.upublish.info/indexser.php?search=%s');
     shuffle($ArticleDashboards);
     $url = sprintf($ArticleDashboards[0], str_replace(" ", "+", $keyword));
     preg_match_all("/<li><a href=\"(.+?)\"/", Internet::Grab($url), $umatches);
     if (count($umatches[1]) == 0) {
         return $content;
     }
     shuffle($umatches[1]);
     preg_match_all("/<p class=\"articletext\">(.+?)<\\/p/", Internet::Grab($umatches[1][0]), $cmatches);
     foreach ($cmatches[1] as $c) {
         if (strlen($c) >= 1000) {
             $adContent .= $c;
             break;
         }
     }
     $adContent = preg_replace("/(<\\/?)(\\w+)([^>]*>)/e", "", $adContent);
     $content .= $adContent;
     return $content;
 }
Ejemplo n.º 9
0
 /**
  * builds a location object from JSON object
  * @param type $vo_json JSON representation of the location object
  * @return Location the location object 
  * @author Rob Kurst <*****@*****.**>
  */
 static function buildFromJSON($vo_json)
 {
     $o_location = new Location();
     if (array_key_exists("location_annual_revenue", $vo_json)) {
         $o_location->setAnnualRevenue($vo_json["location_annual_revenue"]);
     }
     if (array_key_exists("location_contact_name", $vo_json)) {
         $o_location->setContactName($vo_json["location_contact_name"]);
     }
     if (array_key_exists("location_contact_email", $vo_json)) {
         $o_location->setContactEmail($vo_json["location_contact_email"]);
     }
     if (array_key_exists("location_efax", $vo_json)) {
         $o_location->setEFax($vo_json["location_efax"]);
     }
     if (array_key_exists("location_contact_mobile", $vo_json)) {
         $o_location->setContactMobile($vo_json["location_contact_mobile"]);
     }
     if (array_key_exists("location_contact_title", $vo_json)) {
         $o_location->setContactTitle($vo_json["location_contact_title"]);
     }
     if (array_key_exists("location_contact_same_as_owner", $vo_json)) {
         $o_location->setContactSameAsOwner($vo_json["location_contact_same_as_owner"]);
     }
     if (array_key_exists("location_fax", $vo_json)) {
         $o_location->setFax($vo_json["location_fax"]);
     }
     if (array_key_exists("location_industry", $vo_json)) {
         $o_location->setIndustry($vo_json["location_industry"]);
     }
     if (array_key_exists("location_ownership", $vo_json)) {
         $o_location->setOwnership($vo_json["location_ownership"]);
     }
     if (array_key_exists("location_years_in_business", $vo_json)) {
         $o_location->setYearsInBusiness($vo_json["location_years_in_business"]);
     }
     if (array_key_exists("location_organization_mission", $vo_json)) {
         $o_location->setOrganizationMission($vo_json["location_organization_mission"]);
     }
     if (array_key_exists("location_entity_start_date", $vo_json)) {
         $o_location->setEntityStartDate(date("m/d/Y H:i:s", strtotime($vo_json["location_entity_start_date"])));
     }
     if (array_key_exists("location_entity_state", $vo_json)) {
         $o_location->setEntityState($vo_json["location_entity_state"]);
     }
     if (array_key_exists("location_alternative_fax", $vo_json)) {
         $o_location->setAlternativeFax($vo_json["location_alternative_fax"]);
     }
     if (array_key_exists("location_year_incorporated", $vo_json)) {
         $o_location->setYearIncorporated($vo_json["location_year_incorporated"]);
     }
     if (array_key_exists("location_description_of_products_and_services", $vo_json)) {
         $o_location->setDescriptionOfProductsAndServices($vo_json["location_description_of_products_and_services"]);
     }
     if (array_key_exists("location_length_of_current_ownership", $vo_json)) {
         $o_location->setLengthOfCurrentOwnership($vo_json["location_length_of_current_ownership"]);
     }
     if (array_key_exists("location_quantity_of_locations", $vo_json)) {
         $o_location->setQuantityOfLocation($vo_json["location_quantity_of_locations"]);
     }
     if (array_key_exists("location_waive_pg", $vo_json)) {
         $o_location->setWaivePg($vo_json["location_waive_pg"]);
     }
     if (array_key_exists("location_partner_biller_id", $vo_json)) {
         $o_location->setPartnerBillerId($vo_json["location_partner_biller_id"]);
     }
     if (array_key_exists("location_partner_reseller_id", $vo_json)) {
         $o_location->setPartnerResellerId($vo_json["location_partner_reseller_id"]);
     }
     if (array_key_exists("location_partner_sub_account_id", $vo_json)) {
         $o_location->setPartnerSubAccountId($vo_json["location_partner_sub_account_id"]);
     }
     if (array_key_exists("location_program_pricing", $vo_json)) {
         $o_location->setProgramPricing($vo_json["location_program_pricing"]);
     }
     if (array_key_exists("location_program_details", $vo_json)) {
         $o_location->setProgramDetails($vo_json["location_program_details"]);
     }
     if (array_key_exists("location_lead_sources", $vo_json)) {
         $o_lead_sources = $vo_json["location_lead_sources"];
         for ($n_index = 0, $n_size = count($o_lead_sources); $n_index < $n_size; $n_index++) {
             $o_location->addLeadSource($o_lead_sources[$n_index]);
         }
     }
     if (array_key_exists("location_sales_agent_name", $vo_json)) {
         $o_location->setSalesAgentName($vo_json["location_sales_agent_name"]);
     }
     if (array_key_exists("location_parent_id", $vo_json)) {
         $o_location->setParentId($vo_json["location_parent_id"]);
     }
     if (array_key_exists("location_additional_description", $vo_json)) {
         $o_location->setAdditionalDescription($vo_json["location_additional_description"]);
     }
     if (array_key_exists("location_description", $vo_json)) {
         $o_location->setDescription($vo_json["location_description"]);
     }
     if (array_key_exists("location_new_visa_utility_acceptor", $vo_json)) {
         $o_location->setNewVisaUtilityAcceptor($vo_json["location_new_visa_utility_acceptor"]);
     }
     if (array_key_exists("location_tax_exempt", $vo_json)) {
         $o_location->setTaxExempt($vo_json["location_tax_exempt"]);
     }
     if (array_key_exists("location_total_customers", $vo_json)) {
         $o_location->setTotalCustomers($vo_json["location_total_customers"]);
     }
     if (array_key_exists("location_utility_ownership", $vo_json)) {
         $o_location->setUtilityOwnership($vo_json["location_utility_ownership"]);
     }
     if (array_key_exists("location_terminals", $vo_json)) {
         $o_terminals = $vo_json["location_terminals"];
         for ($n_index = 0, $n_size = count($o_terminals); $n_index < $n_size; $n_index++) {
             $o_location->addTerminal($o_terminals[$n_index]);
         }
     }
     if (array_key_exists("location_principal_contacts", $vo_json)) {
         $o_contacts = $vo_json["location_principal_contacts"];
         for ($n_index = 0, $n_size = count($o_contacts); $n_index < $n_size; $n_index++) {
             $o_contact = PrincipalContact::buildFromJSON($o_contacts[$n_index]);
             $o_location->addPrincipalContact($o_contact);
         }
     }
     if (array_key_exists("location_bc_details", $vo_json) && $vo_json["location_bc_details"] != null) {
         $o_location->setBankCardDetails(BankCardDetails::buildFromJSON($vo_json["location_bc_details"]));
     }
     if (array_key_exists("location_ach_details", $vo_json) && $vo_json["location_ach_details"] != null) {
         $o_location->setAchDetails(ACHDetails::buildFromJSON($vo_json["location_ach_details"]));
     }
     if (array_key_exists("location_moto", $vo_json) && $vo_json["location_moto"] != null) {
         $o_location->setMoto(MOTO::buildFromJSON($vo_json["location_moto"]));
     }
     if (array_key_exists("location_internet", $vo_json) && $vo_json["location_internet"] != null) {
         $o_location->setInternet(Internet::buildFromJSON($vo_json["location_internet"]));
     }
     if (array_key_exists("location_pos", $vo_json) && $vo_json["location_pos"] != null) {
         $o_location->setPos(POS::buildFromJSON($vo_json["location_pos"]));
     }
     if (array_key_exists("location_dba_address", $vo_json)) {
         $o_dba_address = Address::buildFromJSON($vo_json["location_dba_address"]);
         $o_location->setDBAAddress($o_dba_address);
     }
     if (array_key_exists("location_chargeback_fax", $vo_json)) {
         $o_location->setChargebackFax($vo_json["location_chargeback_fax"]);
     }
     return $o_location;
 }
 public function vinculoAction()
 {
     $this->_helper->layout->disableLayout();
     $v = new TbVinculo();
     $pp = new PreProjeto();
     $vprp = new tbVinculoPropostaResponsavelProjeto();
     $emailDAO = new EmailDAO();
     $internetDAO = new Internet();
     /*Temos que ver aonde vamos buscar o email do cara?*/
     $buscarEmail = $internetDAO->buscarEmailAgente(null, $_POST['idAgente'], 1, null, true);
     $emailProponente = $buscarEmail[0]->Email;
     $assunto = 'Solicitação de vinculo ao responsável';
     $texto = 'Favor verificar o vinculo solicitado no Sistema SALIC WEB';
     if (isset($_POST['solicitarvinculo'])) {
         $idAgenteProponente = $_POST['idAgente'];
         $idUsuarioResponsavel = $this->idResponsavel;
         $dados = array('idUsuarioResponsavel' => $idUsuarioResponsavel, 'idAgenteProponente' => $idAgenteProponente, 'dtVinculo' => new Zend_Db_Expr('GETDATE()'), 'siVinculo' => 0);
         try {
             $where['idAgenteProponente   = ?'] = $idAgenteProponente;
             $where['idUsuarioResponsavel = ?'] = $idUsuarioResponsavel;
             $vinculocadastrado = $v->buscar($where);
             if (count($vinculocadastrado) > 0) {
                 $v->alterar($dados, $where);
             } else {
                 $v->inserir($dados);
             }
             $enviarEmail = $emailDAO->enviarEmail($emailProponente, $assunto, $texto);
             echo json_encode(array('error' => false));
         } catch (Zend_Exception $e) {
             echo json_encode(array('error' => true));
         }
     }
     if (isset($_POST['solicitarvinculoproposta'])) {
         $idpreprojeto = $_POST['idpreprojeto'];
         $buscarpreprojeto = $pp->buscar(array('idPreProjeto = ?' => $idpreprojeto))->current();
         $idAgenteProponente = $buscarpreprojeto->idAgente;
         $idUsuarioResponsavel = $this->idUsuario;
         $buscarvinculo = $v->buscar(array('idAgenteProponente = ? ' => $idAgenteProponente, 'idUsuarioResponsavel = ?' => $idUsuarioResponsavel))->current();
         $idVinculo = $buscarvinculo->idVinculo;
         $dados = array('idVinculo' => $idVinculo, 'idPreProjeto' => $idpreprojeto, 'siVinculoProposta' => 0);
         try {
             $vprp->inserir($dados);
             echo json_encode(array('error' => false));
         } catch (Zend_Exception $e) {
             echo json_encode(array('error' => true));
         }
     }
     if (isset($_POST['aceitevinculo'])) {
         $dados = array('siVinculoProposta' => $_POST['stVinculoProposta']);
         $where = "idVinculoProposta = {$_POST['idVinculoProposta']}";
         try {
             $vprp->alterar($dados, $where);
             echo json_encode(array('error' => false));
         } catch (Zend_Exception $e) {
             echo json_encode(array('error' => true));
         }
     }
     if (isset($_POST['desvincular'])) {
         $dados = array('siVinculoProposta' => 1);
         $where = "idVinculoProposta = {$_POST['idVinculoProposta']}";
         try {
             $vprp->alterar($dados, $where);
             echo json_encode(array('error' => false));
         } catch (Zend_Exception $e) {
             echo json_encode(array('error' => true));
         }
     }
     exit;
 }
 public function regerarsenhaAction()
 {
     if (isset($_POST['alterar'])) {
         $cpf = Mascara::delMaskCPF($_POST['cpf']);
         $nome = $_POST['nome'];
         $senha = Gerarsenha::gerasenha(15, true, true, true, true);
         $senhaFinal = EncriptaSenhaDAO::encriptaSenha($cpf, $senha);
         $usuarios = new Usuario();
         $usuariosBuscar = $usuarios->buscar(array('usu_identificacao = ?' => $cpf))->current();
         if ($usuariosBuscar) {
             $usuariosDados = $usuariosBuscar->toArray();
             $dados = array("usu_codigo" => $usuariosDados['usu_codigo'], "usu_identificacao" => $usuariosDados['usu_identificacao'], "usu_senha" => $senhaFinal[0]->senha, "usu_data_atualizacao" => date("Y-m-d"));
             $usuariosSave = $usuarios->salvar($dados);
             $email = $_POST['email'];
             $assunto = "Alteração da senha de acesso";
             $perfil = "SALICWEB";
             $mens .= "Ol&aacute; " . $nome . ",<br><br>";
             $mens .= "Senha....: " . $senha . "<br><br>";
             $mens .= "Esta &eacute; a sua senha tempor&aacute;ria de acesso ao Sistema de Apresentaç?o de Projetos via Web do ";
             $mens .= "Minist&eacute;rio da Cultura.<br><br>Lembramos que a mesma dever&aacute; ser ";
             $mens .= "trocada no seu primeiro acesso ao sistema.<br><br>";
             $mens .= "Esta &eacute; uma mensagem autom&aacute;tica. Por favor n&atilde;o responda.<br><br>";
             $mens .= "Atenciosamente,<br>Minist&eacute;rio da Cultura";
             $enviaEmail = EmailDAO::enviarEmail($email, $assunto, $mens, $perfil);
             parent::message("Senha gerada com sucesso. Verifique seu email!", "/principal", "CONFIRM");
         }
     }
     if (isset($_POST['cpf'])) {
         $this->_helper->layout->disableLayout();
         // desabilita o Zend_Layout
         $cpf = $_POST['cpf'];
         $usuario = new Usuario();
         $usuariosBuscar = $usuario->pesquisarUsuarioOrgao(array('usu_identificacao = ?' => $cpf))->current();
         if (empty($usuariosBuscar)) {
             $dados['semdados'] = 'semdados';
             $json = json_encode($dados);
             echo $json;
             die;
         }
         $agentes = new Agentes();
         $agentesBuscar = $agentes->buscar(array('CNPJCPF = ?' => $cpf))->current();
         if (empty($agentesBuscar)) {
             $dados['semdados'] = 'semdados';
             $json = json_encode($dados);
             echo $json;
             die;
         }
         $idAgente = $agentesBuscar['idAgente'];
         $internet = new Internet();
         $internetBuscar = $internet->buscar(array('idAgente = ?' => $idAgente))->toArray();
         if (empty($internetBuscar)) {
             $dados['sememail'] = 'sememail';
             $json = json_encode($dados);
             echo $json;
             die;
         }
         $json = array('error' => false);
         if ($usuariosBuscar && $agentesBuscar && $internetBuscar) {
             $usuarioResultado = $usuariosBuscar->toArray();
             $usuarioResultado["usu_nome"] = utf8_decode(htmlentities($usuarioResultado["usu_nome"]));
             $mesclagem = array_merge($usuarioResultado, $internetBuscar[0]);
             $json = json_encode($mesclagem);
         }
         echo $json;
         die;
     }
 }
Ejemplo n.º 12
0
 public function uploadAction()
 {
     //======================= INSTANCIA AS DAO ===========================
     $tbArquivoDAO = new tbArquivo();
     $tbArquivoImagemDAO = new tbArquivoImagem();
     $tbDocumentoDAO = new tbDocumento();
     $ProcuracaoDAO = new Procuracao();
     $tbVinculoPropostaDAO = new tbVinculoPropostaResponsavelProjeto();
     $tbVinculoDAO = new TbVinculo();
     $Sgcacesso = new Sgcacesso();
     $Agentes = new Agentes();
     $Nomes = new Nomes();
     $Visao = new Visao();
     $Internet = new Internet();
     //================== VARIÁVEIS PASSADAS VIA POST =====================
     $responsavel = $this->_request->getParam("responsavel");
     $proponente = $this->_request->getParam("proponente");
     $dsObservacao = $this->_request->getParam("dsObservacao");
     $arrayProjetos = $this->_request->getParam("projetos");
     // ==================== Dados do arquivo de upload ===============================
     $arquivoNome = $_FILES['divulgacao']['name'];
     // nome
     $arquivoTemp = $_FILES['divulgacao']['tmp_name'];
     // nome tempor�rio
     $arquivoTipo = $_FILES['divulgacao']['type'];
     // tipo
     $arquivoTamanho = $_FILES['divulgacao']['size'];
     // tamanho
     $arquivoExtensao = Upload::getExtensao($arquivoNome);
     // extens�o
     $arquivoBinario = Upload::setBinario($arquivoTemp);
     // bin�rio
     $arquivoHash = Upload::setHash($arquivoTemp);
     // hash
     //================= VALIDA O RESPONSAVEL E PROPONENTE ================
     if ($responsavel == 0) {
         $responsavel = $this->idResponsavel;
     }
     if ($proponente == 0) {
         $proponente = $this->idAgente;
     }
     //========= BUSCA O IDVINCULO COM AS INFORMAÇÕES PASSADAS =============
     $whereVinculo['idUsuarioResponsavel = ?'] = $responsavel;
     $whereVinculo['idAgenteProponente = ?'] = $proponente;
     $buscarVinculo = $tbVinculoDAO->buscar($whereVinculo);
     try {
         // ==================== Insere na Tabela tbArquivo ===============================
         $dadosArquivo = array('nmArquivo' => $arquivoNome, 'sgExtensao' => $arquivoExtensao, 'dsTipoPadronizado' => $arquivoTipo, 'nrTamanho' => $arquivoTamanho, 'dtEnvio' => new Zend_Db_Expr('GETDATE()'), 'dsHash' => $arquivoHash, 'stAtivo' => 'A');
         $idArquivo = $tbArquivoDAO->inserir($dadosArquivo);
         // ==================== Insere na Tabela tbArquivoImagem ===============================
         $dadosBinario = array('idArquivo' => $idArquivo, 'biArquivo' => new Zend_Db_Expr("CONVERT(varbinary(MAX), {$arquivoBinario})"));
         $idArquivo = $tbArquivoImagemDAO->inserir($dadosBinario);
         // ==================== Insere na Tabela tbDocumento ===============================
         $dados = array('idTipoDocumento' => 17, 'idArquivo' => $idArquivo, 'dsDocumento' => $_POST['dsObservacao'], 'dtEmissaoDocumento' => NULL, 'dtValidadeDocumento' => NULL, 'idTipoEventoOrigem' => NULL, 'nmTitulo' => 'Procuracao');
         $idDocumento = $tbDocumentoDAO->inserir($dados);
         $idDocumento = $idDocumento['idDocumento'];
         //======== MONTA UM ARRAY COM AS INFORMAÇÕES DO VINCULO PROPOSTA========
         for ($i = 0; $i < sizeof($arrayProjetos); $i++) {
             $arrayVinculoProposta = array('idVinculo' => $buscarVinculo[0]->idVinculo, 'idPreProjeto' => $arrayProjetos[$i], 'siVinculoProposta' => 0);
             // Salva as informações retornando o idVinculo Proposta
             $idVinculoProposta = $tbVinculoPropostaDAO->inserir($arrayVinculoProposta);
             // ==================== Insere na Tabela Procuracao ===============================
             $dadosVinculoProjeto = array('idVinculoProposta' => $idVinculoProposta, 'idDocumento' => $idDocumento, 'siProcuracao' => 0, 'dsObservacao' => $dsObservacao, 'dsJustificativa' => '');
             $inserirproposta = $ProcuracaoDAO->inserir($dadosVinculoProjeto);
         }
         // ======== CADASTRA A VISÃO DE PROCURADOR PARA O RESPONSÁVEL CASO A MESMA NÃO EXISTA ========
         $buscarDadosResponsavel = $Sgcacesso->buscar(array('IdUSuario = ?' => $responsavel))->current();
         // busca os dados do responsável
         $buscarDadosAgente = $Agentes->buscar(array('CNPJCPF = ?' => $buscarDadosResponsavel['Cpf']))->current();
         // verifica se o responsável é um agente
         if ($buscarDadosAgente) {
             // verifica se tem visão de procurador
             $buscarVisao = $Visao->buscar(array('idAgente = ?' => $buscarDadosAgente['idAgente'], 'Visao = ?' => 247))->current();
             if (!$buscarVisao) {
                 $dadosVisao = array('idAgente' => $buscarDadosAgente['idAgente'], 'Visao' => 247, 'Usuario' => empty($this->idUsuario) ? $this->idAgente : $this->idUsuario, 'stAtivo' => 'A');
                 $Visao->inserir($dadosVisao);
                 // cadastra a visão de procurador
             }
         } else {
             // cadastra como agente
             $dadosNovoAgente = array('CNPJCPF' => $buscarDadosResponsavel['Cpf'], 'TipoPessoa' => 0, 'Status' => 0, 'Usuario' => empty($this->idUsuario) ? $this->idAgente : $this->idUsuario);
             $Agentes->inserir($dadosNovoAgente);
             // cadastra o agente
             $idAgenteNovo = $Agentes->BuscaAgente($buscarDadosResponsavel['Cpf']);
             $idAgenteNovo = $idAgenteNovo[0]->idAgente;
             // pega o id do agente cadastrado
             $dadosNome = array('idAgente' => $idAgenteNovo, 'TipoNome' => 18, 'Descricao' => $buscarDadosResponsavel['Nome'], 'Status' => 0, 'Usuario' => empty($this->idUsuario) ? $this->idAgente : $this->idUsuario);
             $Nomes->inserir($dadosNome);
             // cadastra o nome do agente
             $dadosVisao = array('idAgente' => $idAgenteNovo, 'Visao' => 247, 'Usuario' => empty($this->idUsuario) ? $this->idAgente : $this->idUsuario, 'stAtivo' => 'A');
             $Visao->inserir($dadosVisao);
             // cadastra a visão de procurador
             $dadosInternet = array('idAgente' => $idAgenteNovo, 'TipoInternet' => 28, 'Descricao' => $buscarDadosResponsavel['Email'], 'Status' => 1, 'Divulgar' => 1, 'Usuario' => empty($this->idUsuario) ? $this->idAgente : $this->idUsuario);
             $Internet->inserir($dadosInternet);
             // cadastra o email do procurador
         }
         parent::message("Procura&ccedil;&atilde;o cadastrada com sucesso!", "procuracao/cadastramento", "CONFIRM");
     } catch (Zend_Exception $e) {
         parent::message("Error" . $e->getMessage(), "procuracao/cadastramento", "ERROR");
         //	            parent::message("&Eacute; necess&aacute;rio um v&iacute;nculo para enviar o cadastramento da procura&ccedil;&atilde;o", "procuracao/index?idPreProjeto=" . $idpreprojeto, "ERROR");
     }
     exit;
 }
Ejemplo n.º 13
0
 static function buildFromJSON($vo_json)
 {
     //var_dump( $vo_json );
     $o_internet = new Internet();
     if (array_key_exists("internet_days_between_order_and_shipping", $vo_json)) {
         $o_internet->setDaysBetweenOrderAndShipping($vo_json["internet_days_between_order_and_shipping"]);
     }
     if (array_key_exists("internet_delivery_confimation", $vo_json)) {
         $o_delivery_confirmation = $vo_json["internet_delivery_confimation"];
         for ($n_index = 0, $n_size = count($o_delivery_confirmation); $n_index < $n_size; $n_index++) {
             $o_internet->addDeliveryConfirmation($o_delivery_confirmation[$n_index]);
         }
     }
     if (array_key_exists("internet_deposit", $vo_json)) {
         $o_internet->setDeposit($vo_json["internet_deposit"]);
     }
     if (array_key_exists("internet_deposit_required", $vo_json)) {
         $o_internet->setDepositRequired($vo_json["internet_deposit_required"]);
     }
     if (array_key_exists("internet_delivery_of_goods", $vo_json)) {
         $o_internet->setDeliveryOfGoods($vo_json["internet_delivery_of_goods"]);
     }
     if (array_key_exists("internet_return_policy_time_period", $vo_json)) {
         $o_internet->setReturnPolicyTimePeriod($vo_json["internet_return_policy_time_period"]);
     }
     if (array_key_exists("internet_return_policy", $vo_json)) {
         $o_return_policy = $vo_json["internet_return_policy"];
         for ($n_index = 0, $n_size = count($o_return_policy); $n_index < $n_size; $n_index++) {
             $o_internet->addReturnPolicy($o_return_policy[$n_index]);
         }
     }
     if (array_key_exists("internet_shipped_goods", $vo_json)) {
         $o_shipped_goods = $vo_json["internet_shipped_goods"];
         for ($n_index = 0, $n_size = count($o_shipped_goods); $n_index < $n_size; $n_index++) {
             $o_internet->addShippedGoods($o_shipped_goods[$n_index]);
         }
     }
     if (array_key_exists("internet_fulfillment_vendor_utilized", $vo_json)) {
         $o_internet->setFulfillmentVendorUtilized($vo_json["internet_fulfillment_vendor_utilized"]);
     }
     if (array_key_exists("internet_percent_of_sales_to_non_us_cardholders", $vo_json)) {
         $o_internet->setPercentOfSalesToNonUsCardHolders($vo_json["internet_percent_of_sales_to_non_us_cardholders"]);
     }
     if (array_key_exists("internet_website_ip", $vo_json)) {
         $o_internet->setWebsiteIpAddress($vo_json["internet_website_ip"]);
     }
     if (array_key_exists("internet_applicant_owns_web_domain_and_content", $vo_json)) {
         $o_internet->setApplicantOwnsWebDomainAndContent($vo_json["internet_applicant_owns_web_domain_and_content"]);
     }
     if (array_key_exists("internet_policies_accessible_on_website", $vo_json)) {
         $o_policies = $vo_json["internet_policies_accessible_on_website"];
         for ($n_index = 0, $n_size = count($o_policies); $n_index < $n_size; $n_index++) {
             $o_internet->addPoliciesAccessibleOnWebsite($o_policies[$n_index]);
         }
     }
     if (array_key_exists("internet_web_host_vendor_name", $vo_json)) {
         $o_internet->setWebHostVendorName($vo_json["internet_web_host_vendor_name"]);
     }
     if (array_key_exists("internet_ssl_certificate_issuer", $vo_json)) {
         $o_internet->setSslCertificateIssuer($vo_json["internet_ssl_certificate_issuer"]);
     }
     if (array_key_exists("internet_ssl_certificate_number", $vo_json)) {
         $o_internet->setSslCertificateNumber($vo_json["internet_ssl_certificate_number"]);
     }
     if (array_key_exists("internet_ssl_certificate_type", $vo_json)) {
         $o_internet->setSslCertificateType($vo_json["internet_ssl_certificate_type"]);
     }
     if (array_key_exists("internet_gateway_software_name", $vo_json)) {
         $o_internet->setGatewaySoftwareName($vo_json["internet_gateway_software_name"]);
     }
     if (array_key_exists("internet_gateway_software_version", $vo_json)) {
         $o_internet->setGatewaySoftwareVersion($vo_json["internet_gateway_software_version"]);
     }
     if (array_key_exists("internet_gateway_software_vendor", $vo_json)) {
         $o_internet->setGatewaySoftwareVendor($vo_json["internet_gateway_software_vendor"]);
     }
     if (array_key_exists("internet_temp_login_credentials", $vo_json)) {
         $o_internet->setTempLoginCredentials($vo_json["internet_temp_login_credentials"]);
     }
     if (array_key_exists("internet_inventory_owner", $vo_json)) {
         $o_internet->setInventoryOwner($vo_json["internet_inventory_owner"]);
     }
     if (array_key_exists("internet_fulfillment_vendor", $vo_json)) {
         $o_internet->setFulfillmentVendor($vo_json["internet_fulfillment_vendor"]);
     }
     if (array_key_exists("internet_fulfillment_vendor_phone_number", $vo_json)) {
         $o_internet->setFulfillmentVendorPhoneNumber($vo_json["internet_fulfillment_vendor_phone_number"]);
     }
     return $o_internet;
 }