/**
  * Busca a categoria a partir do id
  * @param INT $Category - ID do usuário cadastrado no banco
  * @return STRING - retorna o nome da categoria
  */
 public function getCategory($Category)
 {
     $this->CatId = $Category;
     $read = new Read();
     $read->FullRead("SELECT cat_name FROM " . DB_PRODUTOS_CATEGORIAS . " WHERE cat_id = :id", "id={$this->CatId}");
     return $read->getResult()[0]['cat_name'];
 }
示例#2
0
 private function getSyntax()
 {
     $read = new Read();
     $read->ExeRead($this->Tabela, $this->Termos, $this->Places);
     $this->Rows = $read->getRowCount();
     if ($this->Rows > $this->Limite) {
         $Paginas = ceil($this->Rows / $this->Limite);
         $MaxLinks = $this->MaxLinks;
         $this->Paginator = "<ul class=\"paginator\">";
         $this->Paginator .= "<li><a title=\"{$this->First}\" href=\"{$this->Link}1\">{$this->First}</a></li>";
         for ($iPag = $this->Page - $MaxLinks; $iPag <= $this->Page - 1; $iPag++) {
             if ($iPag >= 1) {
                 $this->Paginator .= "<li><a title=\"Página {$iPag}\" href=\"{$this->Link}{$iPag}\">{$iPag}</a></li>";
             }
         }
         $this->Paginator .= "<li><span class=\"active\">{$this->Page}</span></li>";
         for ($dPag = $this->Page + 1; $dPag <= $this->Page + $MaxLinks; $dPag++) {
             if ($dPag <= $Paginas) {
                 $this->Paginator .= "<li><a title=\"Página {$dPag}\" href=\"{$this->Link}{$dPag}\">{$dPag}</a></li>";
             }
         }
         $this->Paginator .= "<li><a title=\"{$this->Last}\" href=\"{$this->Link}{$Paginas}\">{$this->Last}</a></li>";
         $this->Paginator .= "</ul>";
     }
 }
 /**
  * Busca o login do usuário a partir do user_id
  * @param INT $userid - ID do usuário cadastrado no banco
  * @return STRING - retorna o login do usuário
  */
 public function getUserName($UserId)
 {
     $this->UserId = $UserId;
     $read = new Read();
     $read->FullRead("SELECT user_login FROM " . DB_USERS . " WHERE user_id = :id", "id={$this->UserId}");
     return $read->getResult()[0]['user_login'];
 }
示例#4
0
 private function getSyntax()
 {
     $read = new Read();
     $read->ExeRead($this->Table, $this->Terms, $this->Places);
     $this->Rows = $read->getRowCount();
     // Verifica se tem resultados para que se faça a paginação
     if ($this->Rows > $this->Limit) {
         // Divide a quantidade de resultados (Rows) pelo limite para obter a quantidade de páginas
         $Paginas = ceil($this->Rows / $this->Limit);
         $MaxLinks = $this->MaxLinks;
         $this->Paginator = "<ul class=\"paginator\">";
         $this->Paginator .= "<li><a title=\"{$this->First}\" href=\"{$this->Link}1\">{$this->First}</a></li>";
         for ($iPag = $this->Page - $MaxLinks; $iPag <= $this->Page - 1; $iPag++) {
             if ($iPag >= 1) {
                 $this->Paginator .= "<li><a title=\"Página {$iPag}\" href=\"{$this->Link}{$iPag}\">{$iPag}</a></li>";
             }
         }
         $this->Paginator .= "<li><span class=\"active\">{$this->Page}</span></li>";
         for ($dPag = $this->Page + 1; $dPag <= $this->Page + $MaxLinks; $dPag++) {
             if ($dPag <= $Paginas) {
                 $this->Paginator .= "<li><a title=\"Página {$dPag}\" href=\"{$this->Link}{$dPag}\">{$dPag}</a></li>";
             }
         }
         $this->Paginator .= "<li><a title=\"{$this->Last}\" href=\"{$this->Link}{$Paginas}\">{$this->Last}</a></li>";
         $this->Paginator .= "</ul>";
     }
 }
示例#5
0
 private function getSyntax()
 {
     $read = new Read();
     $read->ExeRead($this->tabela, $this->termos, $this->places);
     $this->rows = $read->getRowCount();
     if ($this->rows > $this->limit) {
         $paginas = ceil($this->rows / $this->limit);
         $maxLinks = $this->maxLinks;
         $this->paginator = "<ul class=\"paginator\">";
         $this->paginator .= "<li><a title=\"{$this->first}\" href=\"{$this->link}1\">{$this->first}</a></li>";
         for ($iPag = $this->page - $maxLinks; $iPag <= $this->page - 1; $iPag++) {
             if ($iPag >= 1) {
                 $this->paginator .= "<li><a title=\"Página {$iPag}\" href=\"{$this->link}{$iPag}\">{$iPag}</a></li>";
             }
         }
         $this->paginator .= "<li><span=\"active\">{$this->page}</li>";
         for ($dPag = $this->page + 1; $dPag <= $this->page + $maxLinks; $dPag++) {
             if ($dPag <= $paginas) {
                 $this->paginator .= "<li><a title=\"Página {$dPag}\" href=\"{$this->link}{$dPag}\">{$dPag}</a></li>";
             }
         }
         $this->paginator .= "<li><a title=\"{$this->last}\" href=\"{$this->link}{$paginas}\">{$this->last}</a></li>";
         $this->paginator .= "</ul>";
     }
 }
 public function ExeStatus($PostId, $PostStatus)
 {
     $this->Post = (int) $PostId;
     $this->Data['post_status'] = (string) $PostStatus;
     $Read = new Read('ws_posts');
     $this->Data['post_id'] = $this->Post;
     $Read->update($this->Data);
 }
示例#7
0
 private function setName()
 {
     $Where = isset($this->Post) ? "post_id != {$this->Post} and" : '';
     $readName = new Read();
     $readName->ExeRead(self::Entity, "where {$Where} post_title = :t", "t={$this->Data['post_title']}");
     if ($readName->getResult()) {
         $this->Data['post_name'] = $this->Data['post_name'] . '-' . $readName->getRowCount();
     }
 }
示例#8
0
 public function Trabalho($parametro)
 {
     include_once 'app/View/header.php';
     $tipoAtividade = new Read();
     $tipoAtividade->ExeRead('tipo_atividades');
     include_once 'app/View/form-trabalho.php';
     $parametro = $parametro;
     include_once 'app/View/footer.php';
 }
示例#9
0
 public static function UserOnline()
 {
     $now = Date('Y-m-d H:i:s');
     $deleteUserOnline = new Delete();
     $deleteUserOnline->ExeDelete('ws_siteviews_online', "WHERE online_endview < :now", "now={$now}");
     $readUserOnline = new Read();
     $readUserOnline->ExeRead('ws_siteviews_online');
     return $readUserOnline->getRowCount();
 }
 private function select()
 {
     $ReadBanco = new Read();
     $ReadBanco->ExeRead(self::entidade, ($this->id != 0 ? 'WHERE id = :id' : null) . ' ORDER BY sigla', $this->id != 0 ? "id={$this->id}" : null);
     if ($ReadBanco->getRowCount() > 0) {
         $this->result = $ReadBanco->getResult();
     } else {
         $this->result = null;
     }
 }
 private function select()
 {
     $read = new Read();
     $read->ExeRead(self::entidade, ($this->id != 0 ? 'WHERE id = :id' : '') . ' ORDER BY nome', $this->id != 0 ? "id={$this->id}" : null);
     if ($read->getRowCount() > 0) {
         $this->result = $read->getResult();
     } else {
         $this->result = null;
     }
 }
 private function getNames($nutri)
 {
     $read = new Read();
     $read->FullRead("SELECT nutri_name FROM " . DB_NUTRICAO . " WHERE nutri_id = :id", "id={$nutri}");
     if ($read->getResult()) {
         return $read->getResult()[0]['nutri_name'];
     } else {
         return null;
     }
 }
示例#13
0
 private function setName()
 {
     $email = $this->Data['email'];
     $readName = new Read();
     $readName->ExeRead(self::Entity, "WHERE cpf = {$this->Data['cpf']} or email = '{$email}'");
     if ($readName->getResult()) {
         $this->Msg = "<script>alert('Ja possui Cadastrado em Nosso Sitema!');</script>";
     } else {
         $this->Create();
     }
 }
示例#14
0
 /**
  * Obtem o player com o id tal
  * @return $Array [] de player
  */
 public static function GetAccountId($id)
 {
     $Read = new Read();
     $Read->ExeRead('players', "WHERE id = :id", "id={$id}");
     $Result = $Read->getResult();
     if ($Result) {
         return $Result;
     } else {
         return false;
     }
 }
示例#15
0
 private function getUser()
 {
     $read = new Read();
     $read->ExeRead('pessoas', "WHERE email = :e AND senha = :p", "e={$this->Email}&p={$this->Senha}");
     if ($read->getResult()) {
         $this->Result = $read->getResult()[0];
         return true;
     } else {
         return false;
     }
 }
 public function getInstituicao($id)
 {
     $read = new Read();
     $read->Reader(self::Entity, 'inner join tb_logradouros on ' . self::Entity . '.tb_logradouros_logradouro_id = tb_logradouros.logradouro_id ' . 'inner join tb_bairros on tb_logradouros.tb_bairros_bairros_id = tb_bairros.bairros_id ' . 'inner join tb_cidade on tb_cidade.cidade_id = tb_bairros.tb_cidade_cidade_id ' . 'where instituicao_id = :id', "id={$id}");
     if ($read->getResult()) {
         $this->result = $read->getResult();
         $this->rowcount = $read->getRowCount();
     } else {
         $this->result = false;
         $this->rowcount = 0;
     }
 }
示例#17
0
 private function getUser()
 {
     $this->senha = md5($this->senha);
     $read = new Read();
     $read->ExeRead('usuario', "WHERE login = :e AND senha = :p", "e={$this->login}&p={$this->senha}");
     if ($read->getResult()) {
         $this->result = $read->getResult()[0];
         return true;
     } else {
         return false;
     }
 }
示例#18
0
 private function getUser()
 {
     $this->Senha = md5($this->Senha);
     $read = new Read();
     $read->ExeRead("ws_users", "WHERE user_email = :e AND user_password = :p", "e={$this->Email}&p={$this->Senha}");
     if ($read->getResult()) {
         $this->Result = $read->getResult()[0];
         return TRUE;
     } else {
         return FALSE;
     }
 }
 private function setName()
 {
     $Where = !empty($this->CatId) ? "category_id != {$this->CatId} AND" : '';
     $categoria = $this->Data['category_title'];
     $readName = new Read();
     $readName->ExeRead(self::Entity, "WHERE {$Where} category_title = :t", "t={$this->Data['category_title']}");
     if ($readName->getResult()) {
         $this->Error = ["<b>Erro ao Cadastrar:</b> Categoria ja está cadastrada", WS_ERROR];
     } else {
         $this->Create();
     }
 }
 private function checkPessoa()
 {
     $ReadPessoa = new Read();
     $ReadPessoa->ExeRead(self::entidade, "WHERE cadastro = :cadastro", "cadastro={$this->dados['cadastro']}");
     if ($ReadPessoa->getRowCount() > 0) {
         $this->result = false;
         $this->error = ["A identificação {$this->dados['cadastro']} já consta no sistema", WS_ALERT];
         return false;
     } else {
         return true;
     }
 }
示例#21
0
 private function GetUser()
 {
     $this->Pass = md5($this->Pass);
     $read = new Read();
     $read->ExeRead('user', "WHERE email = :e AND password = :p", "e={$this->Email}&p={$this->Pass}");
     if ($read->getResult()) {
         $this->Result = $read->getResult()[0];
         return true;
     } else {
         return FALSE;
     }
 }
 public function getMotorista($idmotorista)
 {
     $read = new Read();
     $read->Reader(self::Entity, 'inner join tb_logradouros on ' . self::Entity . '.tb_logradouros_logradouro_id = tb_logradouros.logradouro_id ' . 'inner join tb_bairros on tb_logradouros.tb_bairros_bairros_id = tb_bairros.bairros_id ' . ' where motorista_id = :id', "id={$idmotorista}");
     if ($read->getResult()) {
         $this->result = $read->getResult();
         $this->rowcount = $read->getRowCount();
     } else {
         $this->result = false;
         $this->rowcount = 0;
     }
 }
示例#23
0
文件: read.php 项目: rhardih/biblio
function handle_update()
{
    $read = new Read(intval($_POST['id']));
    if ($read->is_valid) {
        $read['status'] = $_POST['status'];
        if ($read->update()) {
            $title_author = '<b>' . $read['title'] . '</b> by ' . $read['author'];
            notice("Status updated sucessfully for {$title_author}.");
        } else {
            error("An error occured updating {$title_author}");
        }
    }
}
示例#24
0
 public function GravarTrabalho()
 {
     $this->dados = filter_input_array(INPUT_POST, FILTER_DEFAULT);
     if (isset($_FILES['fileUpload'])) {
         $nome = $this->dados['titulo'];
         $ext = strtolower(substr($_FILES['fileUpload']['name'], -4));
         //Pegando extensão do arquivo
         $new_name = $nome . $ext;
         //Definindo um novo nome para o arquivo
         $this->LinkAnexo = $new_name;
         $dir = 'uploads/';
         //Diretório para uploads
         move_uploaded_file($_FILES['fileUpload']['tmp_name'], $dir . $new_name);
         //Fazer upload do arquivo
     } else {
         echo "<script>alert('nao foi possivel anexar o arquivo!');</script>";
     }
     if ($this->dados['tipoAtividade'] == "Palestra") {
         $tipoA = 1;
     } elseif ($this->dados['tipoAtividade'] == "MiniCurso") {
         $tipoA = 2;
     } else {
         $tipoA = 3;
     }
     //atualiza pessoa
     $updateP = new Update();
     $dadosUp = ["curriculo" => $this->dados['perfil'], "nivel" => 1, "telefone" => $this->dados['telefone']];
     $updateP->ExeUpdate('pessoas', $dadosUp, "where codigo = :id", "id={$this->dados['idPes']}");
     //cadastra Trabalho
     $cadastrarT = new Create();
     $Dados = ["resumo" => $this->dados['resumo'], "data_submetido" => date("Y-m-d"), "tipo_atividade" => $tipoA, "anexo" => $this->LinkAnexo, "status" => "N", "titulo" => $this->dados['titulo']];
     $cadastrarT->ExeCreate('trabalhos', $Dados);
     $this->idT = $cadastrarT->getResult();
     // Vincula o auto trabalho
     $cadastraAT = new Create();
     $DadosAT = ["codigo_trabalho" => (int) $this->idT, "codigo_autor" => (int) $this->dados['idPes'], "codigo_evento" => 1];
     $cadastraAT->ExeCreate('autor_trabalho', $DadosAT);
     // pega dados da pessoa
     $pessoa = new Read();
     $pessoa->ExeRead('pessoas', "where codigo = :id", "id={$this->dados['idPes']}");
     foreach ($pessoa->getResult() as $resulPes) {
         extract($resulPes);
         //Enviar o Email.
         $enviarEmail = new Email();
         $DadosEmail = ["Assunto" => "Confirmação da Submição de Trabalho DeepDay", "Mensagem" => "Seu Trabalho foi submetido com sucesso.", "RemetenteNome" => "Equipe DeepDay", "RemetenteEmail" => "*****@*****.**", "DestinoNome" => $nome, "DestinoEmail" => $email];
         $enviarEmail->Enviar($DadosEmail);
     }
     echo "<script>alert('Seu trabalho foi submetido com sucesso!');</script>";
     echo "<script>window.location.assign('" . BASE . "/painel')</script>";
 }
示例#25
0
文件: notes.php 项目: rhardih/biblio
function handle_create()
{
    $read = new Read(intval($_POST['read_id']));
    if ($read->is_valid) {
        $params = array('notes' => $_POST['content']);
        if ($read->update($params)) {
            notice('Updated!');
        } else {
            error_log('update failed');
        }
    } else {
        error('No Read by that id.');
    }
}
示例#26
0
 public function Login($user, $pass)
 {
     $pass = md5($pass);
     $read = new Read();
     $read->Reader('tb_users', 'where user_login = :user and user_pass = :pass', "user={$user}&pass={$pass}");
     if ($read->getResult()) {
         $data = $read->getResult();
         $_SESSION['schoolbus_login'] = array('username' => $data[0]['user_login'], 'user_url' => $data[0]['user_url'], 'user_nome' => $data[0]['user_nome'], 'nivel' => $data[0]['user_nivel']);
         return true;
     } else {
         if (isset($_SESSION['schoolbus_login'])) {
             unset($_SESSION['schoolbus_login']);
         }
         return false;
     }
 }
示例#27
0
文件: widget.php 项目: rhardih/biblio
 function widget($args, $instance)
 {
     extract($args);
     $title = apply_filters('widget_title', $instance['title']);
     $max_columns = $instance['max_columns'];
     $sex = $instance['sex'];
     $show_sex = isset($instance['show_sex']) ? $instance['show_sex'] : false;
     $readings = Read::all(Read::Begun);
     if (count($readings) > 0) {
         echo $before_widget;
         if ($title) {
             echo $before_title . $title . $after_title;
         }
         foreach ($readings as $read) {
             echo '<div class="reading">';
             if ($read['link'] !== '') {
                 echo '<a href="' . $read['link'] . '">';
             }
             if ($read['illustration']) {
                 echo '<img src="' . $read['illustration'] . '" />';
             }
             echo '<b>' . $read['title'] . '</b>';
             if ($read['link'] !== '') {
                 echo '</a>';
             }
             echo '<br />' . $read['author'];
             echo '</div>';
         }
         echo $after_widget;
     }
 }
示例#28
0
 public function testSeek()
 {
     $offset = 5;
     $whence = SEEK_SET;
     $result = 'content';
     $this->driver->expects($this->once())->method('fileSeek')->with($this->resource, $offset, $whence)->will($this->returnValue($result));
     $this->assertEquals($result, $this->file->seek($offset, $whence));
 }
示例#29
0
 /**
  * Sets office and code if they are present.
  * 
  * @access public
  */
 public function __construct($office = null, $code = null)
 {
     parent::__construct();
     $this->add('type', 'article');
     if (null !== $office) {
         $this->setOffice($office);
     }
     if (null !== $code) {
         $this->setCode($code);
     }
 }
 public function show($id, $slug)
 {
     $post = Post::where('id', $id)->where('slug', $slug)->with('user.profile')->firstOrFail();
     Read::setReadPoints($post);
     $title = "Question";
     $currentQuestion = Question::getCurrentQuestion();
     $points_pct = Question::getTotalPointsPct($currentQuestion);
     $remaining_time = Question::getRemainingTime($currentQuestion);
     $posts = Post::getRandPosts($currentQuestion);
     return View::make('posts.show')->with(['question' => $currentQuestion, 'remaining_time' => $remaining_time, 'points_pct' => $points_pct, 'posts' => $posts, 'selected_post' => $post, 'title' => $title]);
 }