Esempio n. 1
0
 public function recuperarTodosPorAvaliacao(WeLearn_Cursos_Avaliacoes_Avaliacao $avaliacao, $de = '', $ate = '', $count = QuestaoAvaliacaoDAO::MAX_QUESTOES)
 {
     if ($de != '') {
         $de = CassandraUtil::import($de)->bytes;
     }
     if ($ate != '') {
         $ate = CassandraUtil::import($ate)->bytes;
     }
     $avaliacaoUUID = CassandraUtil::import($avaliacao->getId());
     $ids = array_keys($this->_questaoPorAvaliacaoCF->get($avaliacaoUUID->bytes, null, $de, $ate, false, $count));
     $columns = $this->_cf->multiget($ids);
     return $this->_criarVariosFromCassandra($columns);
 }
Esempio n. 2
0
 /**
  * @param WeLearn_Cursos_Conteudo_Modulo $modulo
  * @param string $de
  * @param string $ate
  * @param int $count
  */
 public function recuperarTodosPorModulo(WeLearn_Cursos_Conteudo_Modulo $modulo, $de = '', $ate = '', $count = self::MAX_AULAS, $invertido = false)
 {
     $moduloUUID = CassandraUtil::import($modulo->getId());
     $aulasIds = $this->_aulaPorModuloCF->get($moduloUUID->bytes, null, $de, $ate, $invertido, $count);
     $columns = $this->_cf->multiget($aulasIds);
     return $this->_criarVariosFromCassandra($columns);
 }
Esempio n. 3
0
 /**
  * @param WeLearn_Cursos_Curso $doCurso
  * @param int $nroOrdem
  * @return WeLearn_Cursos_Conteudo_Modulo
  */
 public function recuperarPorOrdem(WeLearn_Cursos_Curso $doCurso, $nroOrdem)
 {
     $cursoUUID = UUID::import($doCurso->getId())->bytes;
     $idModulo = $this->_moduloPorCursoCF->get($cursoUUID, array((int) $nroOrdem));
     $idModulo = $idModulo[$nroOrdem];
     $column = $this->_cf->get($idModulo);
     return $this->_criarFromCassandra($column, $doCurso);
 }
Esempio n. 4
0
 public function removerTodosPorPagina(WeLearn_Cursos_Conteudo_Pagina $pagina)
 {
     $paginaUUID = CassandraUtil::import($pagina->getId());
     $idsRemover = array_keys($this->_comentarioPorPaginaCF->get($paginaUUID->bytes, null, '', '', false, 1000000));
     $this->_comentarioPorPaginaCF->remove($paginaUUID->bytes);
     foreach ($idsRemover as $id) {
         $this->_cf->remove($id);
     }
 }
Esempio n. 5
0
 /**
  * @param string $chaveParticipacaoCurso
  * @return int
  */
 public function recuperarQtdTotalPaginasVistas($chaveParticipacaoCurso)
 {
     try {
         $totalPaginasVistas = $this->_contadorCF->get($this->_keyContador, array($chaveParticipacaoCurso));
         return $totalPaginasVistas[$chaveParticipacaoCurso];
     } catch (cassandra_NotFoundException $e) {
         return 0;
     }
 }
 /**
  * @param WeLearn_Cursos_Curso $curso
  */
 public function removerTodosPorCurso(WeLearn_Cursos_Curso $curso)
 {
     $cursoUUID = UUID::import($curso->getId());
     $idsGerenciadores = array_keys($this->_gerenciadoresPorCursoCF->get($cursoUUID->bytes, null, $de, $ate, false, $count));
     $idsConvites = array_keys($this->_convitesGerenciadorPorCursoCF->get($cursoUUID->bytes, null, $de, $ate, false, $count));
     $this->_gerenciadoresPorCursoCF->remove($cursoUUID->bytes);
     $this->_convitesGerenciadorPorCursoCF->remove($cursoUUID->bytes);
     $this->_cursoDao->removerTodosGerenciadores($idsGerenciadores, $curso);
     $this->_cursoDao->removerTodosConvitesGerenciador($idsConvites, $curso);
 }
Esempio n. 7
0
 /**
  * @param WeLearn_Cursos_Curso $curso
  * @return int
  */
 public function recuperarQtdTotalPorCurso(WeLearn_Cursos_Curso $curso)
 {
     $cursoUUID = CassandraUtil::import($curso->getId());
     try {
         $column = $this->_contadorCF->get($this->_keyContador, array($cursoUUID->bytes));
         $totalPaginas = $column[$cursoUUID->bytes];
     } catch (cassandra_NotFoundException $e) {
         $totalPaginas = 0;
     }
     return $totalPaginas;
 }
Esempio n. 8
0
 /**
  * @param WeLearn_Cursos_ParticipacaoCurso $participacaoCurso
  * @return array
  */
 public function recuperarTodos(WeLearn_Cursos_ParticipacaoCurso $participacaoCurso)
 {
     $count = AulaDAO::MAX_AULAS;
     $CFKey = $participacaoCurso->getCFKey();
     $columns = $this->_cf->get($CFKey, null, '', '', false, $count);
     $controlesAula = array();
     foreach ($columns as $column) {
         $controlesAula[] = $this->_criarFromCassandra($column, $participacaoCurso);
     }
     return $controlesAula;
 }
 /**
  * @param string $usuarioId
  * @return void
  */
 private function _removerListaDeRS($usuarioId)
 {
     try {
         $idsRS = array_keys($this->_RSPorUsuarioCF->get($usuarioId));
         foreach ($idsRS as $id) {
             $this->_RSCF->remove($id);
         }
         $this->_RSPorUsuarioCF->remove($usuarioId);
     } catch (cassandra_NotFoundException $e) {
         return;
     }
 }
Esempio n. 10
0
 protected function getValue($key)
 {
     if (isset($this->cache[$key])) {
         return $this->cache[$key];
     }
     $cf = new ColumnFamily($this->cassandra, $this->config['column_family']);
     try {
         $value = array_shift($cf->get($key, new ColumnSlice("", "")));
     } catch (\cassandra\NotFoundException $e) {
         return false;
     }
     return json_decode($value, true);
 }
Esempio n. 11
0
 public function recuperarTodosRestritos(WeLearn_Cursos_Conteudo_Aula $aula, $de = '', $ate = '', $count = 10)
 {
     $aulaUUID = CassandraUtil::import($aula->getId());
     if ($de != '') {
         $de = CassandraUtil::import($de)->bytes;
     }
     if ($ate != '') {
         $ate = CassandraUtil::import($ate)->bytes;
     }
     $idsRecursos = array_keys($this->_recursosRestritosCF->get($aulaUUID->bytes, null, $de, $ate, false, $count));
     $columns = $this->_cf->multiget($idsRecursos);
     return $this->_criarVariosFromCassandra($columns, $aula);
 }
Esempio n. 12
0
 /**
  * @param mixed $de
  * @param mixed $ate
  * @param array|null $filtros
  * @return array
  */
 public function recuperarTodos($de = '', $ate = '', array $filtros = null)
 {
     $count = isset($filtros['count']) && is_int($filtros['count']) ? $filtros['count'] : ColumnFamily::DEFAULT_COLUMN_COUNT;
     //Todos os segmentos em uma área específfica
     if (is_array($filtros) && isset($filtros['areaId'])) {
         $segmentos_em_area = $this->_segmentosEmAreaCF->get($filtros['areaId'], null, $de, $ate, false, $count);
         if (!empty($segmentos_em_area)) {
             $dados_segmentos = $this->_cf->multiget(array_keys($segmentos_em_area));
             if (!empty($dados_segmentos)) {
                 $area = $this->_areaDAO->recuperar($filtros['areaId']);
                 $listaSegmentos = array();
                 foreach ($dados_segmentos as $key => $columns) {
                     $columns['area'] = $area;
                     $segmento = new WeLearn_Cursos_Segmento();
                     $segmento->fromCassandra($columns);
                     $segmento->setPersistido(true);
                     $listaSegmentos[] = $segmento;
                 }
                 return $listaSegmentos;
             }
         }
     } else {
         //Todos os segmentos cadastrados no serviço.
         $dados_segmentos = $this->_cf->get_range($de, $ate, $count);
         if (!empty($dados_segmentos)) {
             $listaSegmentos = array();
             foreach ($dados_segmentos as $key => $columns) {
                 $columns['area'] = $this->_areaDAO->recuperar($columns['area']);
                 $segmento = new WeLearn_Cursos_Segmento();
                 $segmento->fromCassandra($columns);
                 $segmento->setPersistido(true);
                 $listaSegmentos[] = $segmento;
             }
             return $listaSegmentos;
         }
     }
     return false;
 }
Esempio n. 13
0
 /**
  * @param WeLearn_Usuarios_Usuario $usuario
  * @return void
  */
 public function limparNovas(WeLearn_Usuarios_Usuario $usuario)
 {
     try {
         $cfKeys = array_keys($this->_notificacoesNovasPorUsuarioCF->get($usuario->getId(), null, '', '', false, 1000000));
     } catch (cassandra_NotFoundException $e) {
         return;
     }
     $batchAtualizacao = array();
     for ($i = 0; $i < count($cfKeys); $i++) {
         $batchAtualizacao[$cfKeys[$i]] = array('status' => WeLearn_Notificacoes_StatusNotificacao::LIDO);
     }
     $this->_cf->batch_insert($batchAtualizacao);
     $this->_notificacoesNovasPorUsuarioCF->remove($usuario->getId());
 }
Esempio n. 14
0
 function getEventsPageTagCloud($connection, $se)
 {
     $rowsFound = false;
     $sql = new ColumnFamily($connection, 'SOCIALEVENTTAG_SOCIALEVENT');
     $cloudquery = new ColumnFamily($connection, 'SOCIALEVENTTAG');
     $index_exp = CassandraUtil::create_index_expression('socialeventid', $se);
     $index_clause = CassandraUtil::create_index_clause(array($index_exp));
     $result = $sql->get_indexed_slices($index_clause);
     if (!empty($result)) {
         foreach ($result as $key => $value) {
             if ($value['socialeventtagid'] != NULL) {
                 $cloudresult = $cloudquery->get($value['socialeventtagid']);
                 if ($cloudresult['refcount'] > 0) {
                     $rowsFound = true;
                     $tags[$cloudresult['tag']] = $cloudresult['refcount'];
                 }
             }
         }
     }
     unset($cloudresult);
     if ($rowsFound) {
         // change these font sizes if you will
         $max_size = 250;
         // max font size in %
         $min_size = 100;
         // min font size in %
         // get the largest and smallest array values
         $max_count = max(array_values($tags));
         $min_count = min(array_values($tags));
         // find the range of values
         $spread = $max_count - $min_count;
         if (0 == $spread) {
             // we don't want to divide by zero
             $spread = 1;
         }
         // determine the font-size increment
         // this is the increase per tag count (times used)
         $step = ($max_size - $min_size) / $spread;
         // loop through our tag array
         foreach ($tags as $key => $value) {
             $size = $min_size + ($value - $min_count) * $step;
             // uncomment if you want sizes in whole %:
             $size = ceil($size);
             $eventTagCloud = $eventTagCloud . " " . '<a href="taggedEvents.php?tag=' . $key . '" style="font-size:' . $size . '%" title="' . $value . ' events tagged with ' . $key . '" >' . $key . '</a> ';
         }
     }
     return $eventTagCloud;
 }
Esempio n. 15
0
 /**
  * @param WeLearn_Usuarios_Aluno $aluno
  * @param string $de
  * @param string $ate
  * @param int $count
  * @return array
  */
 public function recuperarTodosPorAluno(WeLearn_Usuarios_Aluno $aluno, $de = '', $ate = '', $count = 20)
 {
     if ($de != '') {
         $de = UUID::import($de)->bytes;
     }
     if ($ate != '') {
         $ate = UUID::import($ate)->bytes;
     }
     $idsCertificados = array_keys($this->_certificadosPorAlunoCF->get($aluno->getId(), null, $de, $ate, true, $count));
     try {
         $columns = $this->_cf->multiget($idsCertificados);
     } catch (cassandra_NotFoundException $e) {
         $columns = $this->_recuperarRestantesPorAluno($idsCertificados, $aluno);
     }
     return $this->_criarVariosFromCassandra($columns);
 }
Esempio n. 16
0
 private function _criarFromCassandra(array $column, WeLearn_Cursos_ParticipacaoCurso $participacaoCurso, WeLearn_Cursos_Avaliacoes_Avaliacao $avaliacao = null)
 {
     $column['participacaoCurso'] = $participacaoCurso;
     $column['avaliacao'] = $avaliacao instanceof WeLearn_Cursos_Avaliacoes_Avaliacao ? $avaliacao : $this->_avaliacaoDao->recuperar($column['avaliacao']);
     $controleAvaliacao = $this->criarNovo();
     $controleAvaliacao->fromCassandra($column);
     try {
         $respostasIds = $this->_respostasAvaliacaoCF->get($controleAvaliacao->getId());
         $UUIDs = array();
         foreach ($respostasIds as $id) {
             $UUIDs[] = UUID::import($id)->bytes;
         }
         $controleAvaliacao->setRespostas($this->_alternativasDao->recuperarTodosPorUUIDs($UUIDs));
     } catch (cassandra_NotFoundException $e) {
     }
     return $controleAvaliacao;
 }
Esempio n. 17
0
 /**
  * Fetches a row from this column family.
  *
  * @param string $key row key to fetch
  * @param mixed[] $columns limit the columns or super columns fetched to this list 
  * @param mixed $columnStart only fetch columns with name >= this
  * @param mixed $columnFinish only fetch columns with name <= this
  * @param bool $columnReversed fetch the columns in reverse order
  * @param int $columnCount limit the number of columns returned to this amount
  * @param mixed $superColumn return only columns in this super column
  * @param cassandra_ConsistencyLevel $readConsistencyLevel affects the guaranteed
  *        number of nodes that must respond before the operation returns
  *
  * @return mixed array(column_name => column_value)
  */
 public function get($key, $columns = null, $columnStart = "", $columnFinish = "", $columnReversed = false, $columnCount = ColumnFamily::DEFAULT_COLUMN_COUNT, $superColumn = null, $readConsistencyLevel = null)
 {
     if (empty($this->_columnFamily)) {
         $this->init();
     }
     try {
         $attributes = $this->_columnFamily->get($key, $columns, $columnStart, $columnFinish, $columnReversed, $columnCount, $superColumn, $readConsistencyLevel);
     } catch (Exception $exc) {
         Yii::log($exc, 'error', 'extension.lz_cassandra.ar.ECassandraCF');
         return null;
     }
     /*if (empty($attributes)) // ->> if a row not found, an cassandra_NotFoundException will be raised :( -> bad implementation!!!
     		return null;*/
     $this->_attributes = $attributes;
     $this->_rowKey = $key;
     return $this;
 }
Esempio n. 18
0
 /**
  * @param WeLearn_Cursos_Curso $curso
  * @param $situacao
  * @param string $de
  * @param string $ate
  * @param int $count
  * @return array
  */
 public function recuperarTodosPorSituacao(WeLearn_Cursos_Curso $curso, $situacao, $de = '', $ate = '', $count = 10)
 {
     if ($de != '') {
         $de = CassandraUtil::import($de)->bytes;
     }
     if ($ate != '') {
         $ate = CassandraUtil::import($ate)->bytes;
     }
     $cursoUUID = CassandraUtil::import($curso->getId());
     if ($situacao == WeLearn_Cursos_Enquetes_SituacaoEnquete::ABERTA) {
         $idsEnquetes = $this->_enquetePorSituacaoAbertoCF->get($cursoUUID->bytes, null, $de, $ate, true, $count);
     } else {
         $idsEnquetes = $this->_enquetePorSituacaoFechadoCF->get($cursoUUID->bytes, null, $de, $ate, true, $count);
     }
     $idsEnquetes = array_keys($idsEnquetes);
     $columns = $this->_cf->multiget($idsEnquetes);
     return $this->_criarVariosFromCassandra($columns, $curso);
 }
Esempio n. 19
0
 /**
  * @param string $usuario
  * @param string $senha
  * @return WeLearn_DTO_IDTO
  * @throws WeLearn_Usuarios_AutenticacaoLoginInvalidoException|WeLearn_Usuarios_AutenticacaoSenhaInvalidaException
  */
 public function autenticar($usuario, $senha)
 {
     $usuario = (string) $usuario;
     $senha = (string) $senha;
     try {
         //Se for um email.
         if (filter_var($usuario, FILTER_VALIDATE_EMAIL)) {
             $emailUsuario = $this->_emailUsuarioCF->get($usuario);
             $objUsuario = $this->recuperar($emailUsuario['usuarioId']);
         } else {
             $objUsuario = $this->recuperar($usuario);
         }
         //Caso a senha for menor que 24 caracteres não é md5, necessário encriptar.
         $senha = strlen($senha) <= 24 ? md5($senha) : $senha;
         if ($objUsuario->getSenha() == $senha) {
             return $objUsuario;
         } else {
             throw new WeLearn_Usuarios_AutenticacaoSenhaInvalidaException($senha);
         }
     } catch (cassandra_NotFoundException $e) {
         throw new WeLearn_Usuarios_AutenticacaoLoginInvalidoException($usuario);
     }
 }
Esempio n. 20
0
$username = $_REQUEST['username'];
$connection = DBConnection::getInstance();
$events = Events_Controller::getInstance();
$friends = Users_Controller::getInstance();
$friendCloud = $friends->getFriendCloud($username, $conn);
$incomingRequests = $friends->incomingRequests($username, $conn);
$outgoingRequests = $friends->outgoingRequests($username, $conn);
$flag = false;
$recentlyPostedEvents = $events->getRecentlyPostedEventsOfUser($username, $conn, $flag, null);
$column_family = new ColumnFamily($conn, 'PERSON');
$index_exp = CassandraUtil::create_index_expression('username', $username);
$index_clause = CassandraUtil::create_index_clause(array($index_exp));
$rows = $column_family->get_indexed_slices($index_clause);
$column_family1 = new ColumnFamily($conn, 'ADDRESS');
foreach ($rows as $key => $row) {
    $addr_rows = $column_family1->get($row['ADDRESS_addressid']);
    $row['street1'] = $addr_rows['street1'];
    $row['street2'] = $addr_rows['street2'];
    $row['city'] = $addr_rows['city'];
    $row['state'] = $addr_rows['state'];
    $row['zip'] = $addr_rows['zip'];
    $row['country'] = $addr_rows['country'];
}
$username = $row['username'];
$firstname = $row['firstname'];
$lastname = $row['lastname'];
$email = $row['email'];
$telephone = $row['telephone'];
$image = $row['imagethumburl'];
$summary = $row['summary'];
$timezone = $row['timezone'];
Esempio n. 21
0
    $hour = substr($eventdate, 11, 2);
    $minute = substr($eventdate, 14, 2);
    $street1 = $row['street1'];
    $street2 = $row['street2'];
    $city = $row['city'];
    $state = $row['state'];
    $zip = $row['zip'];
    $country = $row['country'];
    unset($result);
    //    $q1="select tag from SOCIALEVENTTAG as st, SOCIALEVENTTAG_SOCIALEVENT as sst where sst.socialeventid='$se' and sst.socialeventtagid=st.socialeventtagid order by tag ASC";
    //    $result1 = $connection->query($q1);
    $sql = new ColumnFamily($conn, 'SOCIALEVENTTAG_SOCIALEVENT');
    $index_exp = CassandraUtil::create_index_expression('socialeventid', $se);
    $index_clause = CassandraUtil::create_index_clause(array($index_exp));
    $result1 = $sql->get_indexed_slices($index_clause, $columns = array('socialeventtagid'));
    $q1 = new ColumnFamily($conn, 'SOCIALEVENTTAG');
    foreach ($result1 as $key1 => $col1) {
        $row = $q1->get($col1['socialeventtagid']);
        $tg = $row['tag'];
        $tags = $tags . " " . $tg;
    }
    unset($result1);
}
if (!is_null($se) && (is_null($_SESSION["uname"]) || !($_SESSION["uname"] == $submitter))) {
    $fillMessage = "<font color=red>You can only edit events you created.</font> ";
} else {
    ob_start();
    require "../views/addEvent.php";
    $fillContent = ob_get_clean();
}
require_once "../views/site.php";
Esempio n. 22
0
    if (isset($_POST['addeventsubmit'])) {
        $imagethumb = "E" . $eventid . "T" . $img_ext;
    } else {
        if (isset($_POST['addeventsubmitupdate'])) {
            $imagethumb = "E" . $evid . "T" . $img_ext;
        }
    }
} else {
    if (isset($_POST['addeventsubmit'])) {
        $default_image = true;
        $modified_image_name = "";
        $imagethumb = "";
    } else {
        if (isset($_POST['addeventsubmitupdate'])) {
            $imgq = new ColumnFamily($conn, 'SOCIALEVENT');
            $imgqresult = $imgq->get($evid, $columns = array('imageurl', 'imagethumburl'));
            if ($imgqresult) {
                $modified_image_name = $imgqresult['imageurl'];
                $imagethumb = $imgqresult['imagethumburl'];
            }
            unset($imgqresult);
        }
    }
}
// 8. Determine literature file names.
$default_literature = false;
if ($literature_name != "") {
    $pos = strpos($literature_name, '.');
    $lit_ext = substr($literature_name, $pos, strlen($literature_name));
    if (isset($_POST['addeventsubmit'])) {
        $modified_literature_name = "E" . $eventid . "L" . $lit_ext;
Esempio n. 23
0
 function getIndexEvents($zipcode, $order, $eventdate, $offset, $seid, $signedinuser, $connection)
 {
     if (!is_null($seid)) {
         $eventsQuery = new ColumnFamily($connection, 'SOCIALEVENT');
         $eventsresult = $eventsQuery->get($seid, $columns = array('socialeventid', 'title', 'summary', 'imagethumburl', 'createdtimestamp', 'eventdate', 'submitterusername'));
     } else {
         if (!is_null($eventdate)) {
             $eventsQuery = new ColumnFamily($connection, 'SOCIALEVENT');
             $index_exp = CassandraUtil::create_index_expression('eventdate', $eventdate);
             $index_clause = CassandraUtil::create_index_clause(array($index_exp));
             $result = $eventsQuery->get_indexed_slices($index_clause);
             $query = new ColumnFamily($connection, 'ADDRESS');
             foreach ($result as $key => $value) {
                 $index_exp1 = CassandraUtil::create_index_expression('ADDRESS_addressid', $value['ADDRESS_addressid']);
                 $index_clause1 = CassandraUtil::create_index_clause(array($index_exp1), $offset, 10);
                 $result1 = $query->get_indexed_slices($index_clause1);
                 foreach ($result1 as $key1 => $value1) {
                     $value['socialeventid'] = $key;
                     array_push($eventsresult, $key, $value);
                 }
             }
         } else {
             $eventsresult = $this->getHomePageEvents($zipcode, $order, $offset, $connection);
         }
     }
     $dateFormat = "l,  F j,  Y,  h:i A";
     ob_start();
     foreach ($eventsresult as $key => $row) {
         $rowsFound = true;
         $title = $row['title'];
         if ($seid != NULL) {
             $se = $seid;
         } else {
             $se = $key;
         }
         $image = $row['imagethumburl'];
         $summary = $row['summary'];
         $submitter = $row['submitterUserName'];
         $ed = $row['eventdate'];
         $cd = trim($this->formatdatetime($dateFormat, $row['createdtimestamp']));
         require "../views/indexEvents.php";
     }
     unset($eventsresult);
     $indexEvents = ob_get_contents();
     ob_end_clean();
     return $indexEvents;
 }
if($system != null && $passwd != null) {
  require_once("/home/frozen/phpcassa.php");
  $error = "Login failed. User does not exist or incorrect password.";
  try {
    $conn = cassandra_connect(KS_FO);
    $sys = new ColumnFamily($conn, CF_SYSTEMS);
    $system_info = $r = $sys->get($system);
    if($r["status"] == "assigned" && $r["subscription"] != ""
        && hash("sha256", ".:$system.$passwd:.") == $r["slogin_www"]) {
      $_SESSION[$k_system] = $system;
      $_SESSION[$k_passwd] = $passwd;
      unset($error);
      $logged_in = true;
      $sub = new ColumnFamily($conn, CF_SUBSCRIPTIONS);
      $sub_info = $sub->get($system_info["subscription"]);
    }
  } catch (Exception $e) { }
}

if($logged_in) {
  if($request == "reboot") { // Ajax callback
    if($system_info["flag_allow_web_reset"] == 0) {
      echo "That system cannot be reset from the web";
    } else {
      try {
        $sys->insert($system, array("control" => "reset"));
        echo "Reboot is in progress";
      } catch (Exception $e) { 
        echo "An error occured";
      }
    $keyspace_name = '';
    if (isset($_POST['keyspace_name'])) {
        $keyspace_name = $_POST['keyspace_name'];
    }
    $columnfamily_name = '';
    if (isset($_POST['columnfamily_name'])) {
        $columnfamily_name = $_POST['columnfamily_name'];
    }
    try {
        $pool = new ConnectionPool($keyspace_name, $cluster_helper->getArrayOfNodesForCurrentCluster(), null, 5, 5000, 5000, 10000, $cluster_helper->getCredentialsForCurrentCluster());
        $column_family = new ColumnFamily($pool, $columnfamily_name);
        if ($action == 'dec') {
            $value *= -1;
        }
        $column_family->add($key, $column, $value, $super_column);
        $new_value = $column_family->get($key);
        if ($column_family->cfdef->column_type == 'Super') {
            $new_value = $new_value[$super_column][$column];
        } else {
            $new_value = $new_value[$column];
        }
        redirect('counters.php?keyspace_name=' . $keyspace_name . '&columnfamily_name=' . $columnfamily_name . '&new_value=' . $new_value);
    } catch (Exception $e) {
        $_SESSION['message'] = $e->getMessage();
        redirect('counters.php?keyspace_name=' . $keyspace_name . '&columnfamily_name=' . $columnfamily_name . '&error=1');
    }
}
if (!$included_header) {
    echo getHTML('header.php');
    if (!$is_valid_action) {
        // No action specified
Esempio n. 26
0
$cid = $_POST['editingcid'];
$editcomments = $_POST['editcomments'];
$tagslist = Tags_Controller::getInstance();
$events = Events_Controller::getInstance();
$username = $_SESSION["uname"];
$dateFormat = "l,  F j,  Y,  h:i A";
$txBegun = false;
$eventTaglist = $tagslist->getEventsPageTagCloud($conn, $se);
$numAttendees = $events->getNumAttendees($se, $conn);
$_SESSION["numofattendees"] = $numAttendees;
$rating = $_SESSION["rating"];
$column_family = new ColumnFamily($conn, 'SOCIALEVENT');
$result = $column_family->get($se);
$column_family1 = new ColumnFamily($conn, 'ADDRESS');
$addr_id = $result['ADDRESS_addressid'];
$addr_rows = $column_family1->get($addr_id);
$result['street1'] = $addr_rows['street1'];
$result['street2'] = $addr_rows['street2'];
$result['city'] = $addr_rows['city'];
$result['state'] = $addr_rows['state'];
$result['zip'] = $addr_rows['zip'];
$result['country'] = $addr_rows['country'];
$result['latitude'] = $addr_rows['latitude'];
$result['longitude'] = $addr_rows['longitude'];
// see if any rows were returned
if ($result) {
    $x = trim($result['latitude']);
    $y = trim($result['longitude']);
    $title = trim($result['title']);
    $description = trim($result['description']);
    $submitter = $result['submitterUserName'];