Example #1
0
function Main()
{
    header('Content-Type: text/html; charset=iso-8859-1');
    $session = $_SESSION['casores'] ? $_SESSION['casores'] : $_SESSION['caso'];
    //if (((isset($_SESSION['casores'])) && ($_SESSION['casores'] > 0)) || ((isset($_SESSION['caso'])) && ($_SESSION['caso'] > 0)))
    if ($session) {
        $midia = $_POST['midia'];
        $clsmid = new Midia();
        //$clsmid->setCodCaso($_SESSION['casores']);
        $clsmid->setCodCaso($session);
        $clsmid->setCodMidia(base64_decode($midia));
        if ($clsmid->CarregaPorCodigoEspecifico()) {
            if ($clsmid->getTipoMidia() == Comuns::TIPO_MIDIA_VIDEO) {
                $vidplayer = new VideoPlayer($clsmid->getURL(), !is_null($clsmid->getLargura()) ? $clsmid->getLargura() : 320, !is_null($clsmid->getAltura()) ? $clsmid->getAltura() : 290, 'false', 'true');
                if ($vidplayer) {
                    $html = '<player>' . ($vidplayer->player() != "" ? $vidplayer->player() : $vidplayer->getLastError()) . '</player>';
                    $html .= '<descricao>' . (is_null($clsmid->getDescricao()) ? '' : $clsmid->getDescricao()) . '</descricao>';
                    $html .= '<complemento>' . (is_null($clsmid->getComplemento()) ? '' : $clsmid->getComplemento()) . '</complemento>';
                    $html .= '<btnfechar><a href="javascript:void(0);" onclick="jQuery(\'#view-midia\').html(\'\');" class="btnFecharMidia">@lng[Fechar]</a></btnfechar>';
                } else {
                    $html = "ERRO";
                }
            } else {
                if ($clsmid->getTipoMidia() == Comuns::TIPO_MIDIA_AUDIO) {
                    $audplayer = new AudioPlayer($clsmid->getURL(), 'false', 'true');
                    if ($audplayer) {
                        $html = '<player>' . $audplayer->player() . '</player>';
                        $html .= '<descricao>' . (is_null($clsmid->getDescricao()) ? '' : $clsmid->getDescricao()) . '</descricao>';
                        $html .= '<complemento>' . (is_null($clsmid->getComplemento()) ? '' : $clsmid->getComplemento()) . '</complemento>';
                        $html .= '<btnfechar><a href="javascript:void(0);" onclick="fntFechaMidia();" class="btnFecharMidia">@lng[Fechar]</a></btnfechar>';
                    } else {
                        $html = "ERRO";
                    }
                } else {
                    if ($clsmid->getTipoMidia() == Comuns::TIPO_MIDIA_IMAGEM) {
                        $html = '<player><img src="viewimagem.php?img=' . base64_encode($clsmid->getCodMidia()) . '&ex=f" alt="' . $clsmid->getDescricao() . '" title="' . $clsmid->getDescricao() . '" /></player>';
                        $html .= '<descricao>' . (is_null($clsmid->getDescricao()) ? '' : $clsmid->getDescricao()) . '</descricao>';
                        $html .= '<complemento>' . (is_null($clsmid->getComplemento()) ? '' : $clsmid->getComplemento()) . '</complemento>';
                    }
                }
            }
        }
        echo $html;
    } else {
        echo "ERRO. @lng[Seção não definida]";
    }
}
Example #2
0
 private function BuscaDadosSaibaMais($chaveAtual)
 {
     $sql = "select mescasomontagemanexos.TipoConteudo, mescasomontagemanexos.CodConteudo ";
     $sql .= "\t, mesmidia.Descricao as DescricaoMidia, mesmidia.Complemento as ComplementoMidia, mesmidia.url as UrlMidia, mesmidia.CodTipo as CodTipoMidia ";
     $sql .= "\t, mescasoconteudo.Descricao as DescricaoConteudo, mescasoconteudo.Texto as TextoConteudo, mescasoconteudo.Tipo as CodTipoConteudo ";
     $sql .= "from mescasomontagemanexos ";
     $sql .= "left outer join mesmidia ";
     $sql .= " \tON mesmidia.CodCaso = mescasomontagemanexos.CodCaso ";
     $sql .= " \tAND mesmidia.CodMidia = mescasomontagemanexos.CodConteudo ";
     $sql .= "left outer join mescasoconteudo ";
     $sql .= " \tON mescasoconteudo.CodCaso = mescasomontagemanexos.CodCaso ";
     $sql .= " \tAND mescasoconteudo.CodConteudo = mescasomontagemanexos.CodConteudo ";
     $sql .= "where CodChave = :pCodChave ";
     $cnn = Conexao2::getInstance();
     $cmd = $cnn->prepare($sql);
     $cmd->bindParam(":pCodChave", $chaveAtual, PDO::PARAM_STR);
     $cmd->execute();
     if ($cmd->errorCode() == Comuns::QUERY_OK) {
         if ($cmd->rowCount() > 0) {
             $html = '';
             while ($item = $cmd->fetch(PDO::FETCH_OBJ)) {
                 if (strtoupper($item->TipoConteudo) == "C") {
                     $html .= '<strong>' . $item->DescricaoConteudo . '</strong>';
                     $html .= '<br />' . $item->TextoConteudo;
                 } else {
                     if ($item->CodTipoMidia == Comuns::TIPO_MIDIA_VIDEO) {
                         $vidplayer = new VideoPlayer($item->UrlMidia, 320, 290, 'false', 'true');
                         if ($vidplayer) {
                             $html .= '<strong>' . $item->DescricaoMidia . '</strong>';
                             $html .= '<p>' . $item->ComplementoMidia . '</p>';
                             $html .= '<br />' . $vidplayer->player();
                         } else {
                             $html = "@lng[ERRO ao gerar vídeo]";
                         }
                     } else {
                         if ($item->CodTipoMidia == Comuns::TIPO_MIDIA_AUDIO) {
                             $audplayer = new AudioPlayer($item->UrlMidia, 'false', 'true');
                             if ($audplayer) {
                                 $html .= '<strong>' . $item->DescricaoMidia . '</strong>';
                                 $html .= '<p>' . $item->ComplementoMidia . '</p>';
                                 $html .= '<br />' . $audplayer->player();
                             } else {
                                 $html = "ERRO";
                             }
                         } else {
                             if ($item->CodTipoMidia == Comuns::TIPO_MIDIA_IMAGEM) {
                                 $html .= '<strong>' . $item->DescricaoMidia . '</strong>';
                                 $html .= '<p>' . $item->ComplementoMidia . '</p>';
                                 $html .= '<br /><img src="viewimagem.php?img=' . base64_encode($item->CodConteudo) . '&ex=f" alt="' . $item->DescricaoMidia . '" title="' . $item->DescricaoMidia . '" /></player>';
                             } else {
                                 $html .= '<strong>' . $item->DescricaoMidia . '</strong>';
                                 $html .= '<p>' . $item->ComplementoMidia . '</p>';
                                 $html .= '<a href="' . $item->UrlMidia . '">Download</a>';
                             }
                         }
                     }
                 }
             }
         }
         return $html;
     } else {
         $msg = $cmd->errorInfo();
         $this->msg_erro = $msg[2];
         //return false;
         return $this->msg_erro;
     }
 }
Example #3
0
            if (strtoupper($audioType) == "MP4") {
                $this->advancedMusicPlayer->playMp4($filename);
            }
        }
    }
}
// Creating new class of MediaPlayer which uses our adaptor (optional)
class AudioPlayer implements MediaPlayer
{
    private $mediaAdapter;
    public function play($audioType, $filename)
    {
        // in-built support for mp3 music file
        if (strtoupper($audioType) == "MP3") {
            echo "Playing mp3 file. Name: {$filename}\n";
        } else {
            if (strtoupper($audioType) == "VLC" || strtoupper($audioType) == "MP4") {
                $this->mediaAdapter = new MediaAdapter($audioType);
                $this->mediaAdapter->play($audioType, $filename);
            } else {
                echo "Invalid media. {$audioType} format not supported\n";
            }
        }
    }
}
// We can now use the AudioPlayer to play different types of audio formats
$audioPlayer = new AudioPlayer();
$audioPlayer->play("mp3", "beyond the horizon.mp3");
$audioPlayer->play("mp4", "alone.mp4");
$audioPlayer->play("vlc", "far far away.vlc");
$audioPlayer->play("avi", "mind me.avi");
 /**
  * function getMediaLink
  *
  * @param  $media_data -
  * @return string      - the html string containing the appropriate link for the given media
  */
 public function getMediaLink($media_data = array())
 {
     $media_type = $media_data[1];
     if (isset($media_data['type'])) {
         $media_type = $media_data['type'];
     }
     $media_value = $media_data[2];
     if (isset($media_data['value'])) {
         $media_value = $media_data['value'];
     }
     $media_real_file_name = $media_data[3];
     $path_to_media = $media_data[4];
     $media_title = isset($media_data[5]) ? $media_data[5] : null;
     if (isset($media_data['title'])) {
         $media_title = $media_data['title'];
     }
     if ($media_type === _IMAGE || $media_type === _MONTESSORI) {
         $viewing_prefs = isset($this->viewing_preferences[_IMAGE]) ? $this->viewing_preferences[_IMAGE] : null;
         return ImageViewer::link($this->media_path, $media_value, $media_real_file_name, $path_to_media, $viewing_prefs, $media_title, $media_type);
     } else {
         if ($media_type === _SOUND || $media_type === _PRONOUNCE) {
             $viewing_prefs = isset($this->viewing_preferences[_SOUND]) ? $this->viewing_preferences[_SOUND] : null;
             return AudioPlayer::link($this->media_path, $media_value, $media_real_file_name, $path_to_media, $viewing_prefs, $media_title, $media_type);
         } else {
             if ($media_type === _VIDEO || $media_type === _LABIALE || $media_type === _LIS || $media_type === _FINGER_SPELLING) {
                 $viewing_prefs = isset($this->viewing_preferences[_VIDEO]) ? $this->viewing_preferences[_VIDEO] : null;
                 return VideoPlayer::link($this->media_path, $media_value, $media_real_file_name, $path_to_media, $viewing_prefs, $media_title, $media_type);
             } else {
                 if ($media_type === _DOC) {
                     $viewing_prefs = isset($this->viewing_preferences[_DOC]) ? $this->viewing_preferences[_DOC] : null;
                     return DocumentViewer::link($this->media_path, $media_value, $media_real_file_name, $path_to_media, $viewing_prefs, $media_title);
                 } else {
                     if ($media_type === _LINK) {
                         $viewing_prefs = isset($this->viewing_preferences[_LINK]) ? $this->viewing_preferences[_LINK] : null;
                         return ExternalLinkViewer::view($this->media_path, $media_value, $viewing_prefs);
                     } else {
                         return '';
                     }
                 }
             }
         }
     }
 }