Beispiel #1
0
 /**
  * @param WeLearn_DTO_IDTO $dto
  * @return boolean
  */
 protected function _atualizar(WeLearn_DTO_IDTO $dto)
 {
     if (strlen($dto->getSenha()) <= 24) {
         //Se a senha foi modificada, necessita encriptar novamente.
         $dto->setSenha(md5($dto->getSenha()));
     }
     $this->_cf->insert($dto->getId(), $dto->toCassandra());
     get_instance()->db->where('id', $dto->getId())->update($this->_mysql_tbl_name, $dto->toMySQL());
 }
Beispiel #2
0
 /**
  * @param WeLearn_DTO_IDTO $dto
  * @return void
  */
 protected function _atualizar(WeLearn_DTO_IDTO $dto)
 {
     $UUID = UUID::import($dto->getId())->bytes;
     $this->_cf->insert($UUID, $dto->toCassandra());
     $usuarioId = $dto->getDestinatario()->getId();
     $this->_notificacoesNovasPorUsuarioCF->remove($usuarioId, array($UUID));
     if ($dto->getStatus() === WeLearn_Notificacoes_StatusNotificacao::NOVO) {
         $this->_notificacoesNovasPorUsuarioCF->insert($usuarioId, array($UUID => ''));
     }
 }
Beispiel #3
0
 /**
  * @param WeLearn_DTO_IDTO $dto
  * @return void
  */
 protected function _atualizar(WeLearn_DTO_IDTO $dto)
 {
     $UUID = CassandraUtil::import($dto->getId());
     $this->_cf->insert($UUID->bytes, $dto->toCassandra());
 }
Beispiel #4
0
 /**
  * @param WeLearn_DTO_IDTO $dto
  * @return boolean
  */
 protected function _atualizar(WeLearn_DTO_IDTO $dto)
 {
     $UUID = CassandraUtil::import($dto->getId());
     $cursoUUID = CassandraUtil::import($dto->getCurso()->getId());
     $dadosAntigos = $this->_cf->get($UUID->bytes, array('status', 'situacao'));
     $statusAntigo = (int) $dadosAntigos['status'];
     $situacaoAntiga = (int) $dadosAntigos['situacao'];
     $this->_cf->insert($UUID->bytes, $dto->toCassandra());
     if ($statusAntigo != $dto->getStatus()) {
         if ($dto->getStatus() == WeLearn_Cursos_Enquetes_StatusEnquete::ATIVA) {
             $this->_enquetePorStatusInativoCF->remove($cursoUUID->bytes, array($UUID->bytes));
             $this->_enquetePorStatusAtivoCF->insert($cursoUUID->bytes, array($UUID->bytes => ''));
         } else {
             $this->_enquetePorStatusAtivoCF->remove($cursoUUID->bytes, array($UUID->bytes));
             $this->_enquetePorStatusInativoCF->insert($cursoUUID->bytes, array($UUID->bytes => ''));
         }
     }
     if ($situacaoAntiga != $dto->getSituacao()) {
         if ($dto->getSituacao() == WeLearn_Cursos_Enquetes_SituacaoEnquete::ABERTA) {
             $this->_enquetePorSituacaoFechadoCF->remove($cursoUUID->bytes, array($UUID->bytes));
             $this->_enquetePorSituacaoAbertoCF->insert($cursoUUID->bytes, array($UUID->bytes => ''));
         } else {
             $this->_enquetePorSituacaoAbertoCF->remove($cursoUUID->bytes, array($UUID->bytes));
             $this->_enquetePorSituacaoFechadoCF->insert($cursoUUID->bytes, array($UUID->bytes => ''));
         }
     }
 }
Beispiel #5
0
 public function removerTimeline(WeLearn_DTO_IDTO &$dto, WeLearn_DTO_IDTO &$usuario)
 {
     if ($dto->getCriador() == $usuario) {
         $this->remover($dto->getId());
     } else {
         $this->_comentarioDAO = WeLearn_DAO_DAOFactory::create('ComentarioFeedDAO');
         $idFeed = CassandraUtil::import($dto->getId())->bytes;
         $this->_cf->remove($idFeed);
         $this->_FeedCF->remove($dto->getCriador()->getId(), array($idFeed));
         $this->_TimelineCF->remove($usuario->getId(), array($idFeed));
         $this->_comentarioDAO->removerTodosPorCompartilhamento($idFeed);
     }
 }
Beispiel #6
0
 /**
  * @param WeLearn_DTO_IDTO $dto
  * @return void
  */
 protected function _atualizar(WeLearn_DTO_IDTO $dto)
 {
     $this->_cf->insert($dto->getId(), $dto->toCassandra());
 }
Beispiel #7
0
 /**
  * @param WeLearn_DTO_IDTO $dto
  * @return boolean
  */
 protected function _adicionar(WeLearn_DTO_IDTO &$dto)
 {
     $dto->setId($dto->getModulo()->getId());
     $UUID = CassandraUtil::import($dto->getId());
     $this->_cf->insert($UUID->bytes, $dto->toCassandra());
     $dto->setPersistido(true);
 }
Beispiel #8
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);
 }
 /**
  * @param WeLearn_DTO_IDTO $dto
  * @return boolean
  */
 protected function _adicionar(WeLearn_DTO_IDTO &$dto)
 {
     $this->_cf->insert($dto->getId(), $dto->toCassandra());
     $this->_controleAvaliacaoPorParticipacaoCF->insert($dto->getParticipacaoCurso()->getId(), array($dto->getAvaliacao()->getModulo()->getNroOrdem() => $dto->getId()));
     if (count($dto->getRespostas()) > 0) {
         $this->_respostasAvaliacaoCF->insert($dto->getId(), $dto->respostasToCassandra());
     }
     $dto->setPersistido(true);
 }
Beispiel #10
0
 /**
  * @param WeLearn_DTO_IDTO $dto
  * @return boolean
  */
 protected function _atualizar(WeLearn_DTO_IDTO $dto)
 {
     $UUID = CassandraUtil::import($dto->getId());
     //Verifica se houve alteração no segmento e reconstroi os indexes.
     $segmentoAtual = $this->_cf->get($UUID->bytes, array('segmento'));
     if ($segmentoAtual['segmento'] != $dto->getSegmento()->getId()) {
         $segmentoAtual = $this->_segmentoDAO->recuperar($segmentoAtual['segmento']);
         $this->_cursosPorAreaCF->remove($segmentoAtual->getArea()->getId(), array($UUID->bytes));
         $this->_cursosPorSegmentoCF->remove($segmentoAtual->getId(), array($UUID->bytes));
         $this->_cursosPorAreaCF->insert($dto->getSegmento()->getArea()->getId(), array($UUID->bytes => ''));
         $this->_cursosPorSegmentoCF->insert($dto->getSegmento()->getId(), array($UUID->bytes => ''));
     }
     $this->_cf->insert($UUID->bytes, $dto->toCassandra());
     if (!is_null($dto->getImagem())) {
         $this->_imagemDAO->salvar($dto->getImagem());
     }
     if (!is_null($dto->getConfiguracao())) {
         $this->_configuracaoDAO->salvar($dto->getConfiguracao());
     }
     get_instance()->db->where('id', $dto->getId())->update($this->_mysql_tbl_name, $dto->toMySQL());
 }