<?php define('DIR_SITE_ROOT', '../'); require_once DIR_SITE_ROOT . '/config/config.php'; require_once "lib_db_mysql.php"; /* @var $db db_mysql*/ $db = new db_mysql(); //incluindo bibliotecas: include_once 'lib_datetime.php'; include_once 'funcoes.php'; /* @var $user logon*/ $db->abreConexao(NUM_CONEXAO); $sql = sprintf("SELECT d.Nome AS DataSet, d.Descricao AS Desc_DataSet, \r\n\t\t\t\t\tp.Nome AS Pergunta, p.Descricao AS Desc_Pergunta\r\n\t\t\t\tFROM DataSet d, Pergunta p\r\n\t\t\t\tWHERE d.IdDataSet = %s\r\n\t\t\t\t AND d.IdDataSet = p.IdDataSet\r\n\t\t\t\t AND p.Status = 'A'", $user->getDatasetID()); $db->query($sql); $tmp = $db->fetch_assoc(); echo "<b>" . $tmp["DataSet"] . "</b><br>" . $tmp["Desc_DataSet"] . "<br><br>"; do { echo $tmp["Pergunta"] . "<br>" . $tmp["Desc_Pergunta"] . "<br><br>"; } while ($tmp = $db->fetch_assoc());
/* @var $user logon*/ $db->abreConexao(NUM_CONEXAO); if (!$user->LOGED) { die("usuario nao logado"); } $datasetID = $user->getDatasetID(); $sql = sprintf('SELECT manual_evaluation_strategy FROM dataset WHERE id = %s', $datasetID); $db->query($sql); $manualEvaluationStrategy = $db->result(0, 0); switch (true) { case isset($_GET["tituloframe"]) && $_GET["tituloframe"]: if ($manualEvaluationStrategy == 'Q') { if (isset($_GET["idurl"]) && $_GET["idurl"]) { $sql = sprintf("SELECT url FROM document WHERE id = %s", addslashes($_GET["idurl"])); $db->query($sql); $url = $db->fetch_assoc(); if (!$url) { die("Error"); } $smarty->assign("url", $url); //$smarty->assign("idpergunta",$_GET["idpergunta"]); $db->fechaConexao(); $smarty->display("avaliar_topoframe.tpl"); die; } else { $smarty->assign("url", array('url' => 'none selected.')); $smarty->display("avaliar_topoframe.tpl"); die; } } else { if ($manualEvaluationStrategy == 'D') {
include_once 'lib_datetime.php'; include_once 'funcoes.php'; /* @var $user logon*/ $db->abreConexao(NUM_CONEXAO); header('Content-Type: text/html; charset=utf-8'); $cmd = $_POST["cmd"] ? $_POST["cmd"] : $_GET["cmd"]; switch ($cmd) { case "login": $user->logoff(); $user->forceLogon($_POST["username"], $_POST["password"]); if ($user->ERROR) { echo json_encode(array('success' => false, 'errorCode' => 1, 'message' => 'Invalid username or password.')); } else { $sql = sprintf("select id, username, name, email, administrator, coordinator from collaborator where id = %s", $user->ID); $db->query($sql); $collaborator = $db->fetch_assoc(); //Pega os DataSets que o usuário tem permissão $sql = sprintf("SELECT d.id, d.context, d.status, d.method, dc.role\r\r\n\t\t\t\t\t\t\tFROM dataset d, dataset_collaborator dc\r\r\n\t\t\t\t\t\t\tWHERE d.id = dc.dataset_id\r\r\n\t\t\t\t\t\t\t AND dc.collaborator_id = %s\r\n\t\t\t\t\t\t\t ORDER BY d.context", $user->ID); $db->query($sql); $ds = array(); while ($tmp = $db->fetch_assoc()) { $ds[] = $tmp; } echo json_encode(array('success' => true, 'message' => 'You have successfully logged in.', 'collaborator' => $collaborator, 'datasets' => $ds)); } break; case "coordinate": echo json_encode(array('success' => true, 'url' => "cadastros/datasets.php?selected=1")); break; case "add": include_once 'urlgrabber.php';