mint() public static method

public static mint ( $ver = 1, $node = NULL, $ns = NULL, $time = NULL )
 /**
  * @param WeLearn_DTO_IDTO $dto
  * @return void
  */
 protected function _adicionar(WeLearn_DTO_IDTO &$dto)
 {
     $UUID = UUID::mint();
     $dto->setId($UUID->string);
     $this->_cf->insert($UUID->bytes, $dto->toCassandra());
     $uuidFeed = CassandraUtil::import($dto->getCompartilhamento()->getId())->bytes;
     $this->_comentarioPorCompartilhamentoCF->insert($uuidFeed, array($UUID->bytes => ''));
 }
Beispiel #2
0
 /**
  * @param WeLearn_DTO_IDTO $dto
  * @return void
  */
 protected function _adicionar(WeLearn_DTO_IDTO &$dto)
 {
     $UUID = UUID::mint();
     $cursoUUID = CassandraUtil::import($dto->getCurso()->getId());
     $dto->setNroOrdem($this->recuperarQtdTotalPorCurso($dto->getCurso()) + 1);
     $dto->setId($UUID->string);
     $this->_cf->insert($UUID->bytes, $dto->toCassandra());
     $this->_moduloPorCursoCF->insert($cursoUUID->bytes, array($dto->getNroOrdem() => $UUID->bytes));
     $dto->setPersistido(true);
 }
Beispiel #3
0
 /**
  * @param WeLearn_DTO_IDTO $dto
  * @return void
  */
 protected function _adicionar(WeLearn_DTO_IDTO &$dto)
 {
     $UUID = UUID::mint();
     $forumUUID = CassandraUtil::import($dto->getForum()->getId());
     $dto->setId($UUID->string);
     $dto->setDataCriacao(time());
     $this->_cf->insert($UUID->bytes, $dto->toCassandra());
     $this->_postsPorForumCF->insert($forumUUID->bytes, array($UUID->bytes => ''));
     $dto->setPersistido(true);
 }
Beispiel #4
0
 /**
  * @param WeLearn_DTO_IDTO $dto
  * @return void
  */
 protected function _adicionar(WeLearn_DTO_IDTO &$dto)
 {
     $UUID = UUID::mint();
     $dto->setId($UUID->string);
     $dto->setDataEnvio(time());
     $this->_cf->insert($UUID->bytes, $dto->toCassandra());
     $usuarioId = $dto->getDestinatario()->getId();
     $this->_notificacoesPorUsuarioCF->insert($usuarioId, array($UUID->bytes => ''));
     $this->_notificacoesNovasPorUsuarioCF->insert($usuarioId, array($UUID->bytes => ''));
     $dto->setPersistido(true);
 }
Beispiel #5
0
 /**
  * @param WeLearn_DTO_IDTO $dto
  * @return void
  */
 protected function _adicionar(WeLearn_DTO_IDTO &$dto)
 {
     $UUID = UUID::mint();
     $aulaUUID = CassandraUtil::import($dto->getAula()->getId());
     $dto->setId($UUID->string);
     $dto->setNroOrdem($this->recuperarQtdTotalPorAula($dto->getAula()) + 1);
     $this->_cf->insert($UUID->bytes, $dto->toCassandra());
     $this->_paginaPorAulaCF->insert($aulaUUID->bytes, array($dto->getNroOrdem() => $UUID->bytes));
     $cursoUUID = CassandraUtil::import($dto->getAula()->getModulo()->getCurso()->getId());
     $this->_contadorCF->add($this->_keyContador, $cursoUUID->bytes);
     $dto->setPersistido(true);
 }
 /**
  * @param WeLearn_DTO_IDTO $dto
  * @return void
  */
 protected function _adicionar(WeLearn_DTO_IDTO &$dto)
 {
     if (!$dto->getId()) {
         $UUID = UUID::mint();
         $dto->setId($UUID->string);
     } else {
         $UUID = CassandraUtil::import($dto->getId());
     }
     $avaliacaoUUID = CassandraUtil::import($dto->getAvaliacaoId());
     $this->_cf->insert($UUID->bytes, $dto->toCassandra());
     $this->_questaoPorAvaliacaoCF->insert($avaliacaoUUID->bytes, array($UUID->bytes => ''));
     $dto->setPersistido(true);
 }
 /**
  * @param WeLearn_DTO_IDTO $dto
  * @return void
  */
 protected function _adicionar(WeLearn_DTO_IDTO &$dto)
 {
     $uuidObj = UUID::mint();
     $dto->setId($uuidObj->string);
     $dto->setDataCriacao(time());
     $dto->setStatus(WeLearn_Cursos_StatusSugestaoCurso::EM_ESPERA);
     $this->_cf->insert($uuidObj->bytes, $dto->toCassandra());
     $this->_sugestaoPorAreaCF->insert($dto->getSegmento()->getArea()->getId(), array($uuidObj->bytes => ''));
     $this->_sugestaoPorSegmentoCF->insert($dto->getSegmento()->getId(), array($uuidObj->bytes => ''));
     $this->_sugestaoPorUsuarioCF->insert($dto->getCriador()->getId(), array($uuidObj->bytes => ''));
     $this->_sugestaoPorStatusCF->insert($dto->getStatus(), array($uuidObj->bytes => ''));
     get_instance()->db->insert($this->_mysql_tbl_name, $dto->toMySQL());
     $dto->setPersistido(true);
 }
 /**
  * @param WeLearn_DTO_IDTO $dto
  * @return void
  */
 protected function _adicionar(WeLearn_DTO_IDTO &$dto)
 {
     $UUID = UUID::mint();
     $dto->setId($UUID->string);
     $dto->setDataEnvio(time());
     $this->_cf->insert($UUID->bytes, $dto->toCassandra());
     $remetente = $dto->getRemetente();
     $destinatario = $dto->getDestinatario();
     $array_sort = array($remetente->getId(), $destinatario->getId());
     sort($array_sort);
     $chave_amizade = implode('::', $array_sort);
     $this->_MPPorAmigosCF->insert($chave_amizade, array($UUID->bytes => ''));
     $this->_MPListaAmigosCF->insert($dto->getRemetente()->getId(), array($dto->getDestinatario()->getId() => $dto->getDestinatario()->getId()));
     $this->_MPListaAmigosCF->insert($dto->getDestinatario()->getId(), array($dto->getRemetente()->getId() => $dto->getRemetente()->getId()));
 }
Beispiel #9
0
 /**
  * @param WeLearn_DTO_IDTO $dto
  * @return void
  */
 protected function _adicionar(WeLearn_DTO_IDTO &$dto)
 {
     $UUID = UUID::mint();
     $categoriaUUID = CassandraUtil::import($dto->getCategoria()->getId());
     $dto->setId($UUID->string);
     $dto->setDataCriacao(time());
     $this->_cf->insert($UUID->bytes, $dto->toCassandra());
     $this->_forumPorCategoriaCF->insert($categoriaUUID->bytes, array($UUID->bytes => ''));
     if ($dto->getStatus() == WeLearn_Cursos_Foruns_StatusForum::ATIVO) {
         $this->_forumAtivosCF->insert($categoriaUUID->bytes, array($UUID->bytes => ''));
     } else {
         $this->_forumInativosCF->insert($categoriaUUID->bytes, array($UUID->bytes => ''));
     }
     $dto->setPersistido(true);
 }
Beispiel #10
0
 /**
  * @param WeLearn_DTO_IDTO $dto
  * @return void
  */
 protected function _adicionar(WeLearn_DTO_IDTO &$dto)
 {
     if (!$dto->getId()) {
         $UUID = UUID::mint();
         $dto->setId($UUID->string);
     } else {
         $UUID = CassandraUtil::import($dto->getId());
     }
     $dto->setDataInclusao(time());
     $this->_cf->insert($UUID->bytes, $dto->toCassandra());
     if ($dto instanceof WeLearn_Cursos_Recursos_RecursoRestrito) {
         $aulaUUID = CassandraUtil::import($dto->getAula()->getId());
         $this->_recursosRestritosCF->insert($aulaUUID->bytes, array($UUID->bytes => ''));
     } elseif ($dto instanceof WeLearn_Cursos_Recursos_RecursoGeral) {
         $cursoUUID = CassandraUtil::import($dto->getCurso()->getId());
         $this->_recursosGeraisCF->insert($cursoUUID->bytes, array($UUID->bytes => ''));
     } else {
         throw new WeLearn_Base_Exception('A classe inserida tem que derivar
                                          de WeLearn_Cursos_Recursos_Recurso.');
     }
     $dto->setPersistido(true);
 }
Beispiel #11
0
 protected function _adicionarTimeline(WeLearn_DTO_IDTO &$dto, WeLearn_DTO_IDTO &$usuario)
 {
     if ($dto->getCriador() == $usuario) {
         $this->_adicionar($dto);
     } else {
         $UUID = UUID::mint();
         $dto->setId($UUID->string);
         $this->_cf->insert($UUID->bytes, $dto->toCassandra());
         $this->_TimelineCF->insert($usuario->getId(), array($UUID->bytes => ''));
     }
 }
 /**
  * @param WeLearn_DTO_IDTO $dto
  * @return boolean
  */
 protected function _adicionar(WeLearn_DTO_IDTO &$dto)
 {
     $UUID = UUID::mint();
     $dto->setId($UUID->string);
     $dto->setDataCriacao(time());
     $this->_cf->insert($UUID->bytes, $dto->toCassandra());
     $UUIDCurso = CassandraUtil::import($dto->getCurso()->getId());
     $this->_categoriasPorCursoCF->insert($UUIDCurso->bytes, array($UUID->bytes => ''));
     $dto->setPersistido(true);
 }
Beispiel #13
0
 private function _criar_questao($post)
 {
     $UUIDQuestao = UUID::mint();
     $alternativaDao = WeLearn_DAO_DAOFactory::create('AlternativaAvaliacaoDAO');
     $questaoDao = WeLearn_DAO_DAOFactory::create('QuestaoAvaliacaoDAO');
     $alternativaCorreta = $alternativaDao->criarNovaAlternativaCorreta($post['alternativaCorreta'], $UUIDQuestao->string);
     $alternativasIncorretas = $alternativaDao->criarVariasAlternativasIncorretas($post['alternativaIncorreta'], $UUIDQuestao->string);
     unset($post['alternativaCorreta'], $post['alternativaIncorreta']);
     $novaQuestao = $questaoDao->criarNovo($post);
     $novaQuestao->setId($UUIDQuestao->string);
     $novaQuestao->setAlternativaCorreta($alternativaCorreta);
     $novaQuestao->setAlternativasIncorretas($alternativasIncorretas);
     $novaQuestao->setQtdAlternativas(count($alternativasIncorretas) + 1);
     if ($novaQuestao->getQtdAlternativasExibir() > $novaQuestao->getQtdAlternativas()) {
         $novaQuestao->setQtdAlternativasExibir($novaQuestao->getQtdAlternativas());
     }
     $questaoDao->salvar($novaQuestao);
     $alternativaDao->salvar($novaQuestao->getAlternativaCorreta());
     foreach ($novaQuestao->getAlternativasIncorretas() as $alternativaIncorreta) {
         $alternativaDao->salvar($alternativaIncorreta);
     }
     $response = Zend_Json::encode(array('notificacao' => create_notificacao_array('sucesso', 'A nova questão foi adicionada com sucesso à avaliação!'), 'htmlNovaQuestao' => $this->template->loadPartial('lista', array('listaQuestoes' => array($novaQuestao)), 'curso/conteudo/avaliacao')));
     return create_json_feedback(true, '', $response);
 }
Beispiel #14
0
 /**
  * @param WeLearn_DTO_IDTO $dto
  * @return boolean
  */
 protected function _adicionar(WeLearn_DTO_IDTO &$dto)
 {
     $UUID = UUID::mint();
     $dto->setId($UUID->string);
     $this->_cf->insert($UUID->bytes, $dto->getConviteBasicoToCassandra());
 }
Beispiel #15
0
 /**
  * @param WeLearn_DTO_IDTO $dto
  * @return boolean
  */
 protected function _adicionar(WeLearn_DTO_IDTO &$dto)
 {
     $UUID = UUID::mint();
     $dto->setId($UUID->string);
     $dto->setDataCriacao(time());
     $dto->setStatus(WeLearn_Cursos_StatusCurso::CONTEUDO_BLOQUEADO);
     $this->_cf->insert($UUID->bytes, $dto->toCassandra());
     if (!is_null($dto->getImagem())) {
         $dto->getImagem()->setCursoId($dto->getId());
         $this->_imagemDAO->salvar($dto->getImagem());
     }
     if (!is_null($dto->getConfiguracao())) {
         $dto->getConfiguracao()->setCursoId($dto->getId());
         $this->_configuracaoDAO->salvar($dto->getConfiguracao());
     }
     //indexes
     //Retirando caracteres especiais do nome do curso
     $nomeSimplificado = url_title(convert_accented_characters(strtolower($dto->getNome())));
     $primeiraLetra = $nomeSimplificado[0];
     $this->_cursosPorNomeCF->insert($primeiraLetra, array($nomeSimplificado => $UUID->bytes));
     $this->_cursosPorAreaCF->insert('__todos__', array($UUID->bytes => ''));
     $this->_cursosPorAreaCF->insert($dto->getSegmento()->getArea()->getId(), array($UUID->bytes => ''));
     $this->_cursosPorSegmentoCF->insert($dto->getSegmento()->getId(), array($UUID->bytes => ''));
     $this->_cursosPorCriadorCF->insert($dto->getCriador()->getId(), array($UUID->bytes => ''));
     $this->_usuariosPorCursoCF->insert($UUID->bytes, array($dto->getCriador()->getId() => $dto->getCriador()->getNivelAcesso()));
     get_instance()->db->insert($this->_mysql_tbl_name, $dto->toMySQL());
     $dto->setPersistido(true);
 }
Beispiel #16
0
<!DOCTYPE html>
<html>
    <head>
        <title>DrUUID.Example1</title>
    </head>
<body>
<?php 
include 'vendor/autoload.php';
//use UUID;
error_reporting(E_ALL | E_STRICT);
ini_set('error_reporting', E_ALL | E_STRICT);
ini_set('display_errors', 1);
echo "<pre>\n";
echo "Version 1 (Key: Current time): " . UUID::mint(1) . "\n";
echo "Version 3 (MD5 Hash).........: " . UUID::mint(3, "http://jkingweb.ca/code/php/lib.uuid/", UUID::nsURL) . " (Expected: 5a5f681a-d42f-32a5-88d9-63acbfa109b2)\n";
echo "Version 4 (Random)...........: " . UUID::mint(4) . "\n";
echo "Version 5 (SHA-1 Hash).......: " . UUID::mint(5, "http://jkingweb.ca/code/php/lib.uuid/", UUID::nsURL) . " (Expected: b59aa0b2-e4fa-5a54-bf32-e1183e29f027)\n";
echo "\n</pre>\n";
?>
</body>
</html>
Beispiel #17
0
 public function salvar_upload_temporario()
 {
     if (!isset($_FILES['imagemRecurso'])) {
         $error = create_json_feedback_error_json('O arquivo que está tentando
                                     enviar é muito grande!', 'imagemRecurso');
         $json = create_json_feedback(false, $error);
         die($json);
     }
     $idCertificado = UUID::mint()->string;
     $diretorioTemp = $this->_tempCertificadosDir;
     $upload_config = array('upload_path' => $diretorioTemp, 'file_name' => $idCertificado, 'allowed_types' => 'jpg|jpeg|gif|png', 'max_size' => '5120', 'max_width' => '3000', 'max_height' => '1600');
     $this->load->library('upload', $upload_config);
     if (!$this->upload->do_upload('imagemRecurso')) {
         $errorMsg = $this->upload->display_errors('', '');
         $error = create_json_feedback_error_json($errorMsg, 'imagemRecurso');
         $json = create_json_feedback(false, $error);
     } else {
         $this->load->library('encrypt');
         $this->load->helper('notificacao_js');
         $dadosUpload = $this->upload->data();
         $dadosUpload['urlTemporaria'] = str_replace(FCPATH, base_url(), $dadosUpload['full_path']);
         $dadosUpload['full_path'] = $this->encrypt->encode($dadosUpload['full_path']);
         $dadosUpload['certificadoId'] = $idCertificado;
         $nomeArquivo = $dadosUpload['client_name'];
         unset($dadosUpload['file_path'], $dadosUpload['orig_name'], $dadosUpload['client_name'], $dadosUpload['is_image'], $dadosUpload['image_width'], $dadosUpload['image_height'], $dadosUpload['image_size_str'], $dadosUpload['file_size']);
         $response = Zend_Json::encode(array('upload' => $dadosUpload, 'notificacao' => create_notificacao_array('sucesso', 'O arquivo "' . $nomeArquivo . '" foi carregado com sucesso!')));
         $json = create_json_feedback(true, '', $response);
     }
     echo $json;
 }
Beispiel #18
0
 /**
  * Generate a v5 UUID
  * @return string a byte[] representation of a UUID 
  */
 public static function uuid5($node, $namespace = null)
 {
     $uuid = UUID::mint(5, $node, $namespace);
     return $uuid->bytes;
 }
Beispiel #19
0
    resetUser();
}
if (!empty($_POST['series'])) {
    if ($_POST['volume'] == 0) {
        $_POST['volume'] = null;
    } elseif ($_POST['volume'] == "0") {
        $_POST['volume'] = null;
    }
    require_once '../conf/DbConnectorW.php';
    include_once '../conf/lib.uuid.php';
    $db = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) or die('<p><font color=red>Fehler bei der Datenbankverbindung: ' . mysqli_connect_errno() . ': ' . mysqli_connect_error() . '</p>');
    $sql = "SELECT Author_Auth_ID FROM Series WHERE Ser_ID = {$_POST['series']} ";
    $result = mysqli_query($db, $sql);
    $zeile = mysqli_fetch_array($result);
    $A_ID = $zeile['Author_Auth_ID'];
    $sql_meta = "INSERT INTO Meta (Title, Translator, ISBN, UUID, UUIDI) VALUES ('" . urlencode($_POST[title]) . "', '" . $_POST[translators] . "', '" . $_POST[isbn] . "', '" . UUID::mint(4) . "', '" . UUID::mint(4) . "')";
    mysqli_query($db, $sql_meta) or die;
    $sql_metaID = "SELECT MAX(`Meta_ID`) AS Meta_ID FROM Meta";
    $result_metaID = mysqli_query($db, $sql_metaID) or die;
    $zeile_metaID = mysqli_fetch_array($result_metaID);
    $M_ID = $zeile_metaID['Meta_ID'];
    if (empty($_POST['name']) & empty($_POST['volume'])) {
        $sql = "INSERT INTO Book (Series_Ser_ID, Author_Auth_ID, Meta_Meta_ID) VALUES ({$_POST['series']},{$A_ID},{$M_ID})";
    }
    if (!empty($_POST['name']) & !empty($_POST['volume'])) {
        $sql = "INSERT INTO Book (Book_Name, Book_Vol, Series_Ser_ID, Author_Auth_ID, Meta_Meta_ID) VALUES ('{$_POST['name']}',{$_POST['volume']},{$_POST['series']},{$A_ID},{$M_ID})";
    }
    if (empty($_POST['name']) & !empty($_POST['volume'])) {
        $sql = "INSERT INTO Book (Book_Vol, Series_Ser_ID, Author_Auth_ID, Meta_Meta_ID) VALUES ({$_POST['volume']},{$_POST['series']},{$A_ID},{$M_ID})";
    }
    if (!empty($_POST['name']) & empty($_POST['volume'])) {
 /**
  * Generate a version 1 UUID (time based)
  * you can verify the generated code in:
  * http://www.famkruithof.net/uuid/uuidgen?typeReq=-1
  * 
  * @return string UUID_v1
  */
 protected function get_issue_uuid()
 {
     global $CFG;
     require_once $CFG->dirroot . '/mod/simplecertificate/lib/lib.uuid.php';
     $UUID = UUID::mint(UUID::VERSION_1, self::CERTIFICATE_COMPONENT_NAME);
     return $UUID->__toString();
 }
 /**
  * @param WeLearn_DTO_IDTO $dto
  * @return boolean
  */
 public function _adicionar(WeLearn_DTO_IDTO &$dto)
 {
     $UUID = UUID::mint();
     $enqueteUUID = CassandraUtil::import($dto->getEnqueteId());
     $dto->setId($UUID->string);
     $this->_cf->insert($UUID->bytes, $dto->toCassandra());
     $this->_alternativaPorEnqueteCF->insert($enqueteUUID->bytes, array($UUID->bytes => ''));
     $dto->setPersistido(true);
 }
Beispiel #22
0
 public function salvar_upload_temporario()
 {
     if (!isset($_FILES['arquivoRecurso'])) {
         $error = create_json_feedback_error_json('O arquivo que está tentando
                                     enviar é muito grande!', 'arquivoRecurso');
         $json = create_json_feedback(false, $error);
         die($json);
     }
     $idRecurso = UUID::mint()->string;
     $diretorioTemp = $this->_tempRecursoDir . $idRecurso;
     mkdir($diretorioTemp);
     $upload_config = array('upload_path' => $diretorioTemp, 'allowed_types' => 'jpg|jpeg|gif|png|zip|zipx|rar|tar|gz|tar.gz|pdf' . '|txt|doc|docx|ppt|pptx|pps|ppsx|xls|xlsx|flv|avi' . '|mpg|mov|rm|wmv|wma|mp3', 'max_size' => '25600', 'max_width' => '3000', 'max_height' => '1600');
     $this->load->library('upload', $upload_config);
     if (!$this->upload->do_upload('arquivoRecurso')) {
         rmdir($diretorioTemp);
         $errorMsg = $this->upload->display_errors('', '');
         $error = create_json_feedback_error_json($errorMsg, 'arquivoRecurso');
         $json = create_json_feedback(false, $error);
     } else {
         $this->load->helper('notificacao_js');
         $this->load->library('encrypt');
         $dadosUpload = $this->upload->data();
         $dadosUpload['file_path'] = $this->encrypt->encode($dadosUpload['file_path']);
         $dadosUpload['full_path'] = $this->encrypt->encode($dadosUpload['full_path']);
         $dadosUpload['recursoId'] = $idRecurso;
         $response = Zend_Json::encode(array('upload' => $dadosUpload, 'notificacao' => create_notificacao_array('sucesso', 'O arquivo "' . $dadosUpload['client_name'] . '" foi carregado com sucesso!')));
         $json = create_json_feedback(true, '', $response);
     }
     echo $json;
 }
Beispiel #23
0
 /**
  * Generates an UUID.
  *
  * Default version (4) will generate a random UUID, version 3 will URL based UUID.
  *
  * Added for convinience
  *
  * @param int    $bookVersion UUID version to retrieve, See lib.uuid.manual.html for details.
  * @param string $url
  *
  * @return string The formatted uuid
  */
 function createUUID($bookVersion = 4, $url = null)
 {
     return \UUID::mint($bookVersion, $url, \UUID::nsURL);
 }
 /**
  * @param string $usuarioId
  * @param array $listaDeRS
  * @return void
  */
 private function _salvarListaDeRS($usuarioId, array $listaDeRS)
 {
     if (empty($listaDeRS)) {
         return;
     }
     $batchListaRS = array();
     $listaRSKeys = array();
     foreach ($listaDeRS as $RS) {
         $rsUIID = UUID::mint();
         $RS->setId($rsUIID->string);
         $batchListaRS[$rsUIID->bytes] = $RS->toCassandra();
         $listaRSKeys[$rsUIID->bytes] = '';
         $RS->setPersistido(true);
     }
     $this->_RSCF->batch_insert($batchListaRS);
     $this->_RSPorUsuarioCF->insert($usuarioId, $listaRSKeys);
 }
Beispiel #25
0
 /**
  * @param WeLearn_DTO_IDTO $dto
  * @return boolean
  */
 protected function _adicionar(WeLearn_DTO_IDTO &$dto)
 {
     $UUID = UUID::mint();
     $cursoUUID = CassandraUtil::import($dto->getCurso()->getId());
     $dto->setId($UUID->string);
     $dto->setDataCriacao(time());
     $this->_cf->insert($UUID->bytes, $dto->toCassandra());
     $this->_enquetePorCursoCF->insert($cursoUUID->bytes, array($UUID->bytes => ''));
     if ($dto->getStatus() == WeLearn_Cursos_Enquetes_StatusEnquete::ATIVA) {
         $this->_enquetePorStatusAtivoCF->insert($cursoUUID->bytes, array($UUID->bytes => ''));
     } else {
         $this->_enquetePorStatusInativoCF->insert($cursoUUID->bytes, array($UUID->bytes => ''));
     }
     if ($dto->getSituacao() == WeLearn_Cursos_Enquetes_SituacaoEnquete::ABERTA) {
         $this->_enquetePorSituacaoAbertoCF->insert($cursoUUID->bytes, array($UUID->bytes => ''));
     } else {
         $this->_enquetePorSituacaoFechadoCF->insert($cursoUUID->bytes, array($UUID->bytes => ''));
     }
     $dto->setPersistido(true);
 }
Beispiel #26
0
 /**
  * @param WeLearn_DTO_IDTO $dto
  * @return boolean
  */
 protected function _adicionar(WeLearn_DTO_IDTO &$dto)
 {
     if (!$dto->getId()) {
         $UUID = UUID::mint();
         $dto->setId($UUID->string);
     } else {
         $UUID = UUID::import($dto->getId());
     }
     $cursoUUID = UUID::import($dto->getCurso()->getId());
     $this->_cf->insert($UUID->bytes, $dto->toCassandra());
     $this->_certificadosPorCursoCF->insert($cursoUUID->bytes, array($UUID->bytes => ''));
     $this->alterarAtivo($dto);
     $dto->setPersistido(true);
 }
Beispiel #27
0
 public function salvar_imagem_temporaria()
 {
     $idImagem = str_replace('-', '', UUID::mint()->string);
     $upload_config = array('upload_path' => TEMP_UPLOAD_DIR . 'img/', 'allowed_types' => 'jpg|jpeg|gif|png', 'max_size' => '2048', 'max_width' => '2048', 'max_height' => '1536', 'file_name' => $idImagem);
     $this->load->library('upload', $upload_config);
     if (!$this->upload->do_upload('imagem')) {
         $resultado = array('success' => false, 'error_msg' => $this->upload->display_errors('', ''));
     } else {
         $upload_data = $this->upload->data();
         $image_config = array('source_image' => $upload_data['full_path'], 'width' => 160, 'height' => 130);
         $this->load->library('image_lib', $image_config);
         if (!$this->image_lib->resize()) {
             $resultado = array('success' => false, 'error_msg' => $this->image_lib->display_errors('', ''));
         } else {
             $resultado = array('success' => true, 'upload_data' => array('imagem_id' => $idImagem, 'imagem_url' => site_url('/temp/img/' . $upload_data['file_name']), 'imagem_ext' => $upload_data['file_ext']));
         }
     }
     $json = Zend_Json::encode($resultado);
     echo $json;
 }
 /**
  * @param WeLearn_DTO_IDTO $dto
  * @return boolean
  */
 protected function _adicionar(WeLearn_DTO_IDTO &$dto)
 {
     $UUID = UUID::mint();
     $dto->setId($UUID->string);
     $this->_cf->insert($UUID->bytes, $dto->toCassandra());
     $this->_convitePorDestinatario->insert($dto->getDestinatario()->getId(), array($dto->getRemetente()->getId() => $UUID->bytes));
     $this->_convitePorRemetente->insert($dto->getRemetente()->getId(), array($dto->getDestinatario()->getId() => $UUID->bytes));
     $this->_convitePorDestinatarioPorData->insert($dto->getDestinatario()->getId(), array($UUID->bytes => $UUID->bytes));
     $this->_convitePorRemetentePorData->insert($dto->getRemetente()->getId(), array($UUID->bytes => $UUID->bytes));
 }
Beispiel #29
0
 /**
  * Generates an UUID.
  *
  * Default version (4) will generate a random UUID, version 3 will URL based UUID.
  *
  * Added for convinience
  *
  * @param      $version UUID version to retrieve, See lib.uuid.manual.html for details.
  * @return     string   The formatted uuid
  */
 function createUUID($version = 4, $url = NULL)
 {
     include_once "lib.uuid.php";
     return UUID::mint(4, $url, UUID::nsURL);
 }
Beispiel #30
0
 /**
  * @param WeLearn_DTO_IDTO $dto
  * @return boolean
  */
 protected function _adicionar(WeLearn_DTO_IDTO &$dto)
 {
     $UUID = UUID::mint();
     $paginaUUID = CassandraUtil::import($dto->getPagina()->getId());
     $dto->setId($UUID->string);
     $dto->setDataEnvio(time());
     $this->_cf->insert($UUID->bytes, $dto->toCassandra());
     $this->_comentarioPorPaginaCF->insert($paginaUUID->bytes, array($UUID->bytes => ''));
     $dto->setPersistido(true);
 }