Ejemplo n.º 1
0
 public function logar(Login $login)
 {
     $Sql = new Sql();
     $sb = new StringBuilder();
     $sb->append("SELECT *");
     $sb->append("FROM " . T_USUARIO);
     $sb->append(sprintf("WHERE login_usr = %s", $login->getLoginUsr()));
     $sb->append(sprintf("AND senha_usr = %s", $login->getSenhaUsr()));
     $sb->append("AND ativo_usr = 1");
     $retorno = $Sql->ExecutaSQL($sb->toString());
     if (count($retorno) > 0) {
         global $Sess;
         // Dados do Usuario Logado
         $Sess->usuario = $retorno[0];
         // Atualiza o usuário
         $usuario = new Usuarios();
         $usuario->setCodigoUsr(toNumero($retorno[0]['codigo_usr']));
         $usuario->setUltimoacessoUsr(toDateTime());
         $this->alterar($usuario);
         // inicia Sessao
         $Sess->logado_sys = true;
         $Sess->ultimoacesso_sys = time();
         return true;
     }
     return false;
 }
Ejemplo n.º 2
0
 public function enviar()
 {
     try {
         $Sql = new Sql();
         $Sql->inicio();
         $agendaDAO = new AgendaDAO();
         $agenda = $agendaDAO->consultaCodigo(toNumero(GetVar('agenda')));
         $empregadosDAO = new EmpregadosDAO();
         $destinatarios = $empregadosDAO->listarSelecao(GetVar('destinatarios'));
         $emailController = new EmailController();
         $listaEmail = array();
         foreach ($destinatarios as $key => $empregado) {
             if ($empregado['email_emp'] != "") {
                 $listaEmail[] = array("email" => $empregado['email_emp'], "nome" => $empregado['nome_emp']);
             }
             $agendaEnviadoEmpreg = new AgendaEnviadoEmpreg();
             $agendaEnviadoEmpreg->setAgendaAee(toNumero(GetVar('agenda')));
             $agendaEnviadoEmpreg->setEmpregadoAee(toNumero($empregado['codigo_emp']));
             $agendaDAO->cadastrar($agendaEnviadoEmpreg, $codigo_aee, $Sql);
         }
         $emailController->setAssunto("Agendamento de Entrevista");
         $emailController->setConteudo($this->montaAgendamento($agenda[0]));
         $emailController->setListaEmail($listaEmail);
         $return = $emailController->enviarEmail();
         if (is_string($return)) {
             throw new Exception($return);
         }
         $Sql->commit($return);
         $result = $return ? 'Comunicado de Agendamento enviado com sucesso.' : 'Erro ao enviar Comunicado de Agendamento.';
         echo json_encode(array("success" => is_string($return) ? false : $return, "msg" => is_string($return) ? $return : $result));
     } catch (Exception $e) {
         echo json_encode(array("success" => false, "msg" => $e->getMessage()));
     }
 }
Ejemplo n.º 3
0
 public function updateComprovante($id, $parcela, $data, $nome_comprovante)
 {
     $sql = new Sql();
     $sql->conn_bd();
     $query = 'UPDATE parcelas SET data = "' . $data . '" , comprovante = "' . $nome_comprovante . '" WHERE parcela_n = ' . $parcela . ' && id_conta = ' . $id . '';
     mysql_query($query);
 }
Ejemplo n.º 4
0
 public function verificaCli($user, $pass)
 {
     $sql = new Sql();
     $sql->conn();
     $query = "SELECT * FROM usuario";
     //WHERE user = '******' && senha = ".$pass;
     $result = mysql_query($query);
     $cont = 0;
     while (mysql_fetch_array($result)) {
         // $usuario = $row['user'];
         // $senha = $row['senha'];
         $cont++;
         //return true;
     }
     // 		$sql = "SELECT * FROM tabela WHERE id=$id";
     // $query = mysql_query($sql);
     // while($sql = mysql_fetch_array($query)){
     // $nome = $sql["nome"];
     // echo "Resultados para o ID $idNome:$nome";
     // }
     if ($cont > 0) {
         return true;
     } else {
         return false;
     }
 }
 public function search()
 {
     $response = "";
     $sqlhandler = new Sql();
     if ($this->client) {
         $sql = "SELECT * FROM `choice` WHERE content LIKE '%{$this->content}%' LIMIT 0, 1 ";
     } else {
         $sql = "SELECT * FROM `choice` WHERE content LIKE '%{$this->content}%'";
     }
     if ($result = $sqlhandler->excute_query($sql)) {
         if ($result->num_rows == 0) {
             return $this->send_ms("暂时还没有队友碰到这题。");
         }
         while ($row = $result->fetch_assoc()) {
             $key = htmlspecialchars(strtoupper($row['c_key']));
             $time = date('g:i A d / M / Y D', $row['c_time']);
             $content = htmlspecialchars(stripcslashes($row['content']));
             $user = htmlspecialchars(stripcslashes($row['c_user']));
             if ($this->client) {
                 $response .= $content . "|" . $key . "|" . $user;
             } else {
                 $response .= "<p><strong>题目:</strong><span><pre>{$content}</pre></span></p><p><strong>答案:</strong><span class=\"answer\">{$key}</span></p><p class=\"post_info\"><span class=\"glyphicon glyphicon-user\" aria-hidden=\"true\"></span> {$user} &nbsp;&nbsp;&nbsp;&nbsp; <span class=\"glyphicon glyphicon-time\" aria-hidden=\"true\"></span> {$time}</p>";
             }
             //$response .= "{\"content\": \"{$content}\", \"key\": \"{$key}\", \"user\": \"{$user}\", \"time\": \"{$time}\"},";
         }
         //$response = rtrim($response, ',') . "]";
         //<p><strong>题目:</strong><span><pre>{$content}</pre></span></p><p><strong>答案:</strong><span class=\"answer\">{$key}</span></p><p class=\"post_info\"><span class=\"glyphicon glyphicon-user\" aria-hidden=\"true\"></span> {$user} &nbsp;&nbsp;&nbsp;&nbsp; <span class=\"glyphicon glyphicon-time\" aria-hidden=\"true\"></span> {$time}</p>";
     }
     return $this->send_ms($response);
 }
Ejemplo n.º 6
0
 /**
  * Returns all states ordered by name
  *
  * @return TableEntitySetInterface
  */
 public function getOrderedByName()
 {
     $sql = new Sql($this->getAdapter());
     $select = $sql->select();
     $select->from($this->tableGateway->getTable());
     $select->order('state_name asc');
     return $this->tableGateway->selectWith($select);
 }
Ejemplo n.º 7
0
 public function limpa_materiais_produto($id_produto)
 {
     $sql = new Sql();
     $sql->conn_bd();
     $g = new Glob();
     $query = "DELETE FROM produto_materiais WHERE id_produto = '%s'";
     $result = $g->tratar_query($query, $id_produto);
 }
 public function __construct($name)
 {
     $s = new Sql();
     $connect = $s->connectToDatabase('recruit');
     $jbID = $s->createJobPosition($connect, $name);
     $this->jpID = $jbID;
     $this->jobPositionName = $name;
 }
 public function getStatus()
 {
     $s = new Sql();
     $connect = $s->connectToDatabase('recruit');
     $data = mysqli_query($connect, "SELECT sessionstatus.status FROM sessionstatus,recruitmentsession WHERE recruitmentsession.sessionStatusID=sessionstatus.sessionStatusID AND RSID='{$this->RSID}'");
     $row = $data->fetch_row();
     return $row[0];
 }
Ejemplo n.º 10
0
 public function eliminarCategoria($id)
 {
     $sql = new Sql();
     $sql->addTable('tipos');
     $sql->setOpcion('delete');
     $sql->addWhere("`idTipo =`" . $id);
     Persistence::eliminar($sql);
 }
 public function setThresholdPeriod($thresholdPeriod)
 {
     $this->thresholdPeriodYears = $thresholdPeriod;
     $s = new Sql();
     global $databaseName;
     $connectValue = $s->connectToDatabase($databaseName);
     $row = $s->insertToConfig($connectValue, $thresholdPeriod);
 }
Ejemplo n.º 12
0
 public function atualiza_cbo_x_exames($id_cbo, $array_id_exames)
 {
     $sql = new Sql();
     $sql->conn_bd();
     $g = new Glob();
     mysql_query("DELETE FROM cbo_exames WHERE id_cbo = " . $id_cbo);
     $this->add_cbo_x_exames($array_id_exames, $id_cbo);
 }
Ejemplo n.º 13
0
 public function eliminarDetalleProductoSucursalByProductolId($id)
 {
     $sql = new Sql();
     $sql->addTable('detalleProductoSucursales');
     $sql->setOpcion('delete');
     $sql->addWhere("`pedidoId =`" . $id);
     Persistence::eliminar($sql);
 }
Ejemplo n.º 14
0
 /**
  * @covers Gacela\DataSource\Query\Sql::bind
  * @dataProvider providerDates
  */
 public function testBindISO8601DateValue($date, $bound)
 {
     $time = time();
     $this->object->where('date = :date', array(':date' => $date));
     $where = $this->object->where;
     list($sql, $binds) = $this->object->assemble();
     $this->assertSame($bound, $binds[':date']);
 }
Ejemplo n.º 15
0
 public function listarElogio($_prElogio)
 {
     $Sql = new Sql();
     $sb = new StringBuilder();
     $sb->append("SELECT *");
     $sb->append("FROM " . T_ELOGIO);
     $sb->append(sprintf("WHERE codigo_elo =  %s", toNumero($_prElogio)));
     return $Sql->ExecutaSQL($sb->toString());
 }
Ejemplo n.º 16
0
function load_db_connection()
{
    global $Sql, $Errorh;
    import('core/errors');
    $Errorh = new Errors();
    import('db/mysql');
    $Sql = new Sql();
    $Sql->auto_connect();
}
Ejemplo n.º 17
0
 public function consultaCodigo($_prCodigo)
 {
     $sb = new StringBuilder();
     $Sql = new Sql();
     $sb->append("SELECT *");
     $sb->append("FROM " . T_AGENDA);
     $sb->append(sprintf("WHERE codigo_age = %s", $_prCodigo));
     return $Sql->executaSQL($sb->toString());
 }
Ejemplo n.º 18
0
 public function existe(Usuarios $_prClasse)
 {
     $sb = new StringBuilder();
     $Sql = new Sql();
     $sb->append("SELECT 1 AS TOTAL");
     $sb->append("FROM " . T_USUARIO);
     $sb->append("WHERE UPPER(login_usr) = " . strtoupper($_prClasse->getLoginUsr()));
     $retorno = $Sql->ExecutaSQL($sb->toString());
     return $retorno[0]['TOTAL'] > 0 ? true : false;
 }
Ejemplo n.º 19
0
 public function ejecutar(Sql $sql, $ejecucion, &$mensaje)
 {
     $funcion = $sql->getFuncion();
     if ($funcion == "select") {
         $datos = $this->_traerDatos($sql, $ejecucion, $mensaje);
     } else {
         $datos = $this->_modificarDatos($sql, $ejecucion, $mensaje);
     }
     return $datos;
 }
Ejemplo n.º 20
0
 public function listarSelecao($_prSelecao = 0)
 {
     $sb = new StringBuilder();
     $Sql = new Sql();
     $sb->append("SELECT *");
     $sb->append("FROM " . T_EMP);
     if ($_prSelecao > 0) {
         $sb->append(sprintf("WHERE codigo_emp IN (%s)", $_prSelecao));
     }
     return $Sql->executaSQL($sb->toString());
 }
Ejemplo n.º 21
0
 public function add_obs_bd()
 {
     $sql = new Sql();
     $sql->conn_bd();
     $g = new Glob();
     $query = "INSERT INTO obs_supervisor (id_supervisor, observacao) VALUES ('%s','%s')";
     if ($g->tratar_query($query, $this->id_supervisor, $this->observacao)) {
         $result = mysql_query("SELECT * FROM obs_supervisor ORDER BY id DESC");
     }
     $row = mysql_fetch_array($result, MYSQL_ASSOC);
     return $row['id'];
 }
Ejemplo n.º 22
0
 public function get_func_epi($id_func)
 {
     $sql = new Sql();
     $sql->conn_bd();
     $g = new Glob();
     $query = "SELECT * FROM funcionario_epi WHERE id='%s'";
     if ($g->tratar_query($query, $id)) {
         return true;
     } else {
         return false;
     }
 }
Ejemplo n.º 23
0
 public function atualiza_endereco($rua, $numero, $id_cidade, $id_endereco, $bairro, $cep)
 {
     $sql = new Sql();
     $sql->conn_bd();
     $g = new Glob();
     $query = "UPDATE endereco SET rua='%s', numero='%s', id_cidade='%s', bairro = '%s', cep = '%s' WHERE id='%s' ";
     if ($g->tratar_query($query, $rua, $numero, $id_cidade, $bairro, $cep, $id_endereco)) {
         return true;
     } else {
         return false;
     }
 }
Ejemplo n.º 24
0
 public function atualizaTempLimitAtraso($valor)
 {
     $sql = new Sql();
     $sql->conn_bd();
     $query = "UPDATE config SET valor = '{$valor}' WHERE descricao = 'temp_limit_atraso'";
     if (mysql_query($query)) {
         $_SESSION['temp_limit_atraso'] = $valor;
         return true;
     } else {
         return false;
     }
 }
Ejemplo n.º 25
0
 private function _crearLoad()
 {
     $bd = new MySQL();
     $sql = new Sql();
     $base = $bd->getBase();
     $tb = $bd->getTabla();
     $tabla = $base . ".{$tb}";
     $sql->addTable($tabla);
     $sql->addSelect("*");
     $sql->addWhere("codigo = :codigo");
     return $sql;
 }
Ejemplo n.º 26
0
 public function drop_exames($id_funcionario)
 {
     $sql = new Sql();
     $sql->conn_bd();
     $g = new Glob();
     $query = 'DELETE FROM funcionario_exames WHERE id_funcionario = "%s"';
     if ($g->tratar_query($query, $id_funcionario)) {
         return true;
     } else {
         return false;
     }
 }
Ejemplo n.º 27
0
 public function listaDestinatarios($_prComunicado)
 {
     $sb = new StringBuilder();
     $Sql = new Sql();
     $sb->append("SELECT *");
     $sb->append("FROM " . T_COMEMP);
     $sb->append("LEFT JOIN");
     $sb->append(T_EMP);
     $sb->append("ON codigo_emp = empregado_coe");
     $sb->append(sprintf("WHERE comunicado_coe = %s", $_prComunicado));
     return $Sql->executaSQL($sb->toString());
 }
Ejemplo n.º 28
0
 static function setUp()
 {
     set_include_path(implode(PATH_SEPARATOR, array(realpath(dirname(__FILE__) . '/../application'), realpath(dirname(__FILE__) . '/../library'), get_include_path())));
     require_once realpath(dirname(__FILE__) . '/../application/Bootstrap.php');
     require_once 'Zend/Loader/Autoloader.php';
     Zend_Loader_Autoloader::getInstance();
     self::$bootstrap = new Bootstrap(getenv('APPLICATION_ENV'));
     Zend_Session::$_unitTestEnabled = true;
     Zend_Loader::loadClass('Sql');
     $sql = new Sql();
     $sql->reset();
 }
 public function __construct($name, $jb)
 {
     $s = new Sql();
     $connectValue = $s->connectToDatabase($databaseName);
     $this->name = $name;
     $this->dateCreated = date("Y-m-d");
     $this->jobPosition = $jb;
     $RSID = $s->setSessionQuery($connectValue, $name, $this->dateCreated, $jb);
     echo "RecruitmentSession works " . $RSID . "";
     //$recSesID = $RSID;
     // Set session variables
     //$_SESSION["rSessionID"] = $RSID;
 }
Ejemplo n.º 30
0
 public function get_name_all_grupo()
 {
     $sql = new Sql();
     $sql->conn_bd();
     $aux = 0;
     $query = mysql_query("SELECT * FROM grupo WHERE oculto = 0");
     while ($result = mysql_fetch_array($query)) {
         $return[$aux][0] = $result['id'];
         $return[$aux][1] = $result['nome'];
         $aux++;
     }
     return $return;
 }