Exemplo n.º 1
0
 public function RetornaListaConfAnexos($strChaveAtual)
 {
     $sql = "select CodConteudo, TipoConteudo ";
     $sql .= "from mescasomontagemanexos ";
     $sql .= "where CodCaso = :pCodCaso ";
     $sql .= "  and CodMontagem = 1 ";
     $sql .= "  and CodChave = :pCodChave ";
     $cnn = Conexao2::getInstance();
     $cmd = $cnn->prepare($sql);
     $cmd->bindParam(":pCodCaso", $this->codcaso, PDO::PARAM_INT);
     $cmd->bindParam(":pCodChave", $strChaveAtual, PDO::PARAM_STR);
     $cmd->execute();
     if ($cmd->errorCode() == Comuns::QUERY_OK) {
         if ($cmd->rowCount() > 0) {
             $html = Comuns::TopoTabelaListagem("", "tabAnexos", array('Descrição', 'Tipo', 'Ações'));
             while ($linha = $cmd->fetch(PDO::FETCH_OBJ)) {
                 if ($linha->TipoConteudo == 'C') {
                     $c = new Conteudo();
                     $c->Carrega($this->codcaso, $linha->CodConteudo);
                     $html .= '<tr>';
                     $html .= '<td>' . $c->getDescricao() . '</td>';
                     $html .= '<td>@lng[Hipertexto]</td>';
                     $html .= '<td>';
                     $html .= '<a href="javascript:void(0);" onclick="javascript:fntDeletaAnexo(\'' . base64_encode($strChaveAtual) . '\', \'C' . base64_encode($linha->CodConteudo) . '\')">' . Comuns::IMG_ACAO_DELETAR . '</a>';
                     $html .= '</td>';
                     $html .= '</tr>';
                 } else {
                     $m = new Midia();
                     $m->setCodCaso($this->codcaso);
                     $m->setCodMidia($linha->CodConteudo);
                     $m->CarregaPorCodigoEspecifico();
                     $html .= '<tr>';
                     $html .= '<td>' . $m->getDescricao() . '</td>';
                     $html .= '<td>' . Comuns::DescreveTipoMidia($m->getTipoMidia()) . '</td>';
                     $html .= '<td>';
                     $html .= '<a href="javascript:void(0);" onclick="javascript:fntDeletaAnexo(\'' . base64_encode($strChaveAtual) . '\', \'M' . base64_encode($linha->CodConteudo) . '\')">' . Comuns::IMG_ACAO_DELETAR . '</a>';
                     $html .= '</td>';
                     $html .= '</tr>';
                 }
             }
             return $html;
         } else {
             return '<strong>@lng[Nenhum item cadastrado]</strong>';
         }
     } else {
         $msg = $cmd->errorInfo();
         $this->msg_erro = $msg[2];
         return false;
     }
 }