/** * Define o novo nome da coleção instanciada * @param string $nome * @return \Kernel\Modelo\Livro\Colecao * @throws \Kernel\Exception\LivroException */ public function setNome($nome) { if (!\GGE\Lib\Filter\Types\String::validarTipo($nome)) { throw new \Kernel\Exception\LivroException("O nome informado para o conteúdo programático é inválido"); } $this->nome = $nome; return $this; }
/** * Define o conhecimento * @param string $conhecimento * @return CursoComplementar * @throws BTAlentoException */ public function setConhecimento($conhecimento) { if (!String::validarTipo($conhecimento)) { throw new BTAlentoException("O curso extra informado é inválido"); } $this->conhecimento = $conhecimento; return $this; }
/** * Define o novo nome para o capítulo * @param string $nome * @return Capitulo * @throws LivroException */ public function setNome($nome) { if (!String::validarTipo($nome)) { throw new LivroException("O nome informado para o conteúdo do livro é inválido"); } $this->nome = $nome; return $this; }
/** * Define o nome do registro * @param string $nome O novo nome para o tipo de registro * @return Tipo */ public function setNome($nome) { if (!String::validarTipo($nome)) { throw new RegistrosException("O nome informado para o tipo de " . "registro é inválido"); } $this->nome = $nome; return $this; }
/** * Metodo qeu define o texto contendo as atividades exercidas no periodo informado * @param string $atividades * @return ExpProficional * @throws BTAlentoException */ public function setAtividades($atividades) { if (!String::validarTipo($atividades)) { throw new BTAlentoException("As atividades informadas não são válidas"); } $this->atividades = $atividades; return $this; }
/** * Define a cidade * @param string $cidade * @return Endereco * @throws Exception */ public function setCidade($cidade) { if (!String::validarTipo($cidade)) { throw new Exception("A cidade informada é inválida"); } $this->cidade = $cidade; return $this->setEndereco(); }
/** * Método especialmente criado paar o Sistema GGE de ensino. * Metodo que lista os arquivos de uma pasta da hospedagem original. * * @param string $pasta */ public function arquivosDePastaFtp($pasta) { if (!String::validarTipo($pasta)) { throw new Exception('A pasta informada é inválida'); } if (!($conn = ftp_connect('ftp.gge.com.br'))) { throw new Exception('Falha ao tentar conectar ao servidor'); } if (!ftp_login($conn, 'gge', 'af1yw2w19rxr')) { throw new Exception('Falha ao logar n servidor'); } $arquivosArray = ftp_nlist($conn, "/public_html/v11/uploadArquivos/{$pasta}"); if (!$arquivosArray) { $retorno = array(); } else { $retorno = array_diff($arquivosArray, array('.', '..', 'thumbnail')); } return $retorno; }
/** * Defien o nome do idioma * @param string $nome O nome do idioma a ser inserido * @return Idioma * @throws BTAlentoException */ public function setNome($nome) { if (!String::validarTipo($nome)) { throw new BTAlentoException("O nome do idioma é inválido"); } $this->nome = $nome; return $this; }
/** * Define o nome da pessoa instanciada no momento * @param string $nome O novo nome a ser definido * @return Pessoa * @throws PessoaExceptions */ public function setNome($nome) { if (!String::validarTipo($nome)) { throw new PessoaExceptions("O nome informado não é válido"); } $this->nome = trim($nome); return $this; }
/** * Método usado para adicionar a coluna que informa o usuário que * realizou a inserção do item listado. O objeto referente ao usuário * que realizou a inserção é \Kernel\Modelo\Perfis\UsuarioInteracao. * * @param string $indice A coluna referente ao apontador da tabela * @param string $coluna A coluna do usuário de inserção do registro * * @return Select Um objeto Select contendo a coluna e o alias * para o retorno do usuário */ protected function usrInsert($indice, $coluna = "usuario_insert") { if (!String::validarTipo($indice)) { throw new SqlException('A coluna de indice para o usuário ' . 'de inserção é inválida', 99); } $select = new Select(' '); $sqlUsuario = new SqlUsuario(); return $select->columns(array($coluna => $sqlUsuario->select()->columnsReset()->columns("usuario||','||tipo_usuario||','||" . "funcao_usuario||','||" . Logs::TABELA)->join(Logs::TABELA, array('log_interacao_pk_usuario' => 'pk_usuario', 'log_interacao_pk_tipo_usuario' => 'pk_tipo_usuario'))->where("log_interacao_id_interado={$indice} " . 'and log_interacao_acao=' . Logs::INSERT)->limit(1))); }
/** * Metodo que define o texto de observações do candidato * @param string $observacoes * @return Candidato */ public function setObservacoes($observacoes) { if (String::validarTipo($observacoes)) { $this->observacoes = $observacoes; } return $this; }
/** * Define o novo título para o livro instanciado. * * @param string $titulo * * @throws LivroException */ public function setTitulo($titulo) { if (!String::validarTipo($titulo)) { throw new LivroException('O títudo do livro não é válido'); } $this->titulo = $titulo; return $this; }
/** * Metodo que define o nome da instituição de realização do curso * @param string $instituicao O nome da instituição * @return FormAcademica * @throws BTAlentoException */ public function setInstituicao($instituicao) { if (!String::validarTipo($instituicao)) { throw new BTAlentoException("O nome da instituição informado é inválido"); } $this->instituicao = $instituicao; return $this; }
/** * Método usado para buscas especificas, especialização criada * para permitir o armazenamento de logs de exibições unicas. * Este método adiciona um "limit 1" ao fim da consulta e define o where * baseado na coluna e indice informados * * @param string $coluna A culuna usada para o busca * * @param int $id O indice a ser buscado * * @param Select $select A consulta a ser executada * * @return Model Um objeto contendo os dados de acordo com o indice * informado ou FALSE em caso de erro */ public function get($coluna, $id, Select $select) { if (!(int) $id) { throw new SqlException("Foi informado um indice inválido para a consulta", 65); } if (!String::validarTipo($coluna)) { throw new SqlException("Foi informada uma coluna inválida para a consulta", 66); } $this->defineColuna($coluna, new ResultSetMap(Column::INTEGER)); $this->salvarLog(Logs::GET, $id); $resultset = $this->selectObj($select->where(array($coluna => $id))->limit(1)); if ($resultset->rowCount()) { return $resultset->fetch(); } else { return false; } }
/** * Metodo que define a nova cor do subtipo de registro. * * @param string $cor A nova cor do subtipo * * @return \Kernel\Modelo\Registros\Subtipo * * @throws RegistrosException */ public function setCor($cor) { if (!String::validarTipo($cor)) { throw new RegistrosException('A cor informada para o subtipo é inválida'); } $this->cor = $cor; return $this; }
/** * Método que adiciona a clausula grou by a query. * * @param string|array $colunas As colunas da clausula grou by * * @return Select * * @throws SqlException */ public function groupBy($colunas) { if (!is_string($colunas) && !is_array($colunas)) { throw new SqlException('Query mal formatada', 55); } if (is_string($colunas)) { if (!String::validarTipo($colunas)) { throw new SqlException('Query mal formatada', 56); } $this->group = " GROUP BY({$colunas}) "; } else { if (!count($colunas)) { throw new SqlException('Query mal formatada', 57); } $this->group = ' GROUP BY(' . implode(',', $colunas) . ') '; } return $this; }
/** * Defien o gabarito da questão * @param string $gabarito O gabaritod a questão * @return Questao * @throws QuestaoException */ public function setGabarito($gabarito) { if (is_null($this->tipo)) { throw new QuestaoException("O tipo da questão ainda não " . "foi definido. Não é possivé definir " . "um gabarito sem definir o tipo da questão"); } if ($this->tipo == self::REDACAO) { //Interrompe a execução para o tipo "redação" $this->gabarito = ""; return $this; } if (!String::validarTipo($gabarito)) { throw new QuestaoException("O gabarito informado é inválido"); } //Validando por tipo especifico if ($this->tipo == self::MULTIPLA_ESCOLHA) { if (strlen($gabarito) > 1) { throw new QuestaoException("O gabarito não é válido"); } } elseif ($this->tipo == self::VERDADEIRO_FALSO) { if (strlen($gabarito) != $this->numALternativas) { throw new QuestaoException("Não foram definidas todas " . "as alternativas para o tipo VF"); } } $this->gabarito = $gabarito; return $this; }
/** * Método que executa a conversão do PDF para jpg * @return boolean Retorna TRUE em caso de sucesso ou FALSE em caso de erro * @throws \GGE\Lib\Base\Exception */ public function converter() { if (is_null($this->pdf)) { throw new \GGE\Lib\Base\Exception("O arquivo PDF ainda não foi definido"); } if (is_null($this->destino)) { throw new \GGE\Lib\Base\Exception("Ainda não foi definida uma pasta de destino para as imagens"); } if (!\GGE\Lib\Filter\Types\String::validarTipo($this->mashapeKey)) { throw new \GGE\Lib\Base\Exception("A chave de acesso a API ainda não foi definida"); } // $response = \Unirest\Request::post(self::URL, array("X-Mashape-Key" => "37y9fftqS2msh4qv4qXh4C8bWsg3p1AdUtVjsn9EnxMll5NYse"), array("pdf" => \Unirest\File::add($this->pdf), "resolution" => 150)); die(var_dump($response)); //Iniciando a conversão $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, self::URL); curl_setopt($ch, CURLOPT_HEADER, "X-Mashape-Key: <{$this->mashapeKey}>"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, array("pdf" => new \CURLFile($this->pdf, "application/pdf"), "resolution" => 150)); $resultPost = curl_exec($ch); var_dump($resultPost); $responsePost = json_decode($resultPost); if (!$responsePost) { throw new \GGE\Lib\Base\Exception("Falha ao tentar converter o PDF. Erro no servidor remoto"); } //Lendo e baixando as imagens resultantes curl_setopt($ch, CURLOPT_POST, false); curl_setopt($ch, CURLOPT_POSTFIELDS, array("id" => $responsePost->id, "key" => $responsePost->key)); $resultGet = curl_exec($ch); $responseGet = json_decode($resultGet); if (!$responseGet) { throw new \GGE\Lib\Base\Exception("Falha ao tentar recuperar as imagens resultantes da conversão"); } curl_close($ch); if ($responseGet->status != "done") { throw new \GGE\Lib\Base\Exception("Falha ao ler as imagens. O servidor retornou uma falha"); } //Baixando as imagens para o servidor if (!file_exists($this->destino)) { //Caso a pasta de destino não exista if (!mkdir($this->destino, "0777", TRUE)) { throw new \GGE\Lib\Base\Exception("Falha ao tentar criar a pasta de destino"); } } foreach ($responseGet->pictures as $pic) { if (!copy($pic, $this->destino, urldecode($pic))) { throw new \GGE\Lib\Base\Exception("Ocorreu um erro ao tentar copiar a imagem"); } } return TRUE; }
/** * Define o novo título para o livro instanciado * @param string $titulo * @return \Kernel\Modelo\Livro\Livro * @throws \Kernel\Exception\LivroException */ public function setTitulo($titulo) { if (!\GGE\Lib\Filter\Types\String::validarTipo($titulo)) { throw new \Kernel\Exception\LivroException("O títudo do livro não é válido"); } $this->titulo = $titulo; return $this; }
/** * Define o nome do tópico * @param string $nome * @return \Kernel\Modelo\Livro\Topico * @throws \Kernel\Exception\LivroException */ public function setNome($nome) { if (!\GGE\Lib\Filter\Types\String::validarTipo($nome)) { throw new \Kernel\Exception\LivroException("O nome do tópico é inválido"); } $this->nome = $nome; return $this; }