Esempio n. 1
0
$tpl = new Template(null);
$tpl->assign('unique_file_id', api_get_unique_id());
$tpl->assign('course_code', api_get_course_id());
$tpl->assign('php_session_id', session_id());
$tpl->assign('filename', $lp_item->get_title() . '_nano.wav');
$tpl->assign('enable_nanogong', api_get_setting('enable_nanogong') == 'true' ? 1 : 0);
$tpl->assign('enable_wami', api_get_setting('enable_wami_record') == 'true' ? 1 : 0);
$tpl->assign('cur_dir_path', '/audio');
$tpl->assign('lp_item_id', $lp_item_id);
$tpl->assign('lp_dir', api_remove_trailing_slash($lpPathInfo['dir']));
$recordVoiceForm .= $tpl->fetch('default/learnpath/record_voice.tpl');
$form->addElement('header', get_lang('Or'));
$form->addElement('header', get_lang('AudioFile'));
$form->addElement('html', sprintf(get_lang('AudioFileForItemX'), $lp_item->get_title()));
if (!empty($file)) {
    $audioPlayer = '<div id="preview">' . Display::getMediaPlayer($file, array('url' => $urlFile)) . "</div>";
    $form->addElement('label', get_lang('Listen'), $audioPlayer);
    $url = api_get_path(WEB_CODE_PATH) . 'newscorm/lp_controller.php?lp_id=' . $_SESSION['oLP']->get_id() . '&action=add_audio&id=' . $lp_item_id . '&delete_file=1&' . api_get_cidreq();
    $form->addElement('label', null, Display::url(get_lang('RemoveAudio'), $url, array('class' => 'btn btn-danger')));
} else {
    $form->addElement('file', 'file');
    $form->addElement('hidden', 'id', $lp_item_id);
    $form->addButtonSave(get_lang('Save'));
}
$form->addElement('header', get_lang('Or'));
$courseInfo = api_get_course_info();
$documentTree = DocumentManager::get_document_preview($courseInfo, false, null, api_get_session_id(), false, '', urlencode('lp_controller.php?action=add_audio&lp_id=' . $_SESSION['oLP']->get_id() . '&id=' . $lp_item_id), false, true);
$page .= $recordVoiceForm;
$page .= $form->return_form();
$page .= '<legend>' . get_lang('SelectAnAudioFileFromDocuments') . '</legend>';
$page .= $documentTree;
Esempio n. 2
0
 /**
  * Returns the HTML necessary to print a mediaplayer block inside a page
  * @return string	The mediaplayer HTML
  */
 public function get_mediaplayer($autostart = 'true')
 {
     $course_id = api_get_course_int_id();
     $_course = api_get_course_info();
     $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
     $tbl_lp_item_view = Database::get_course_table(TABLE_LP_ITEM_VIEW);
     // Getting all the information about the item.
     $sql = "SELECT * FROM " . $tbl_lp_item . " as lp\n                INNER  JOIN " . $tbl_lp_item_view . " as lp_view on lp.id = lp_view.lp_item_id\n                WHERE  lp.id = '" . $_SESSION['oLP']->current . "' AND\n                       lp.c_id = {$course_id} AND\n                       lp_view.c_id = {$course_id}";
     $result = Database::query($sql);
     $row = Database::fetch_assoc($result);
     $output = '';
     if (!empty($row['audio'])) {
         $list = $_SESSION['oLP']->get_toc();
         $type_quiz = false;
         foreach ($list as $toc) {
             if ($toc['id'] == $_SESSION['oLP']->current && $toc['type'] == 'quiz') {
                 $type_quiz = true;
             }
         }
         if ($type_quiz) {
             if ($_SESSION['oLP']->prevent_reinit == 1) {
                 $row['status'] === 'completed' ? $autostart_audio = 'false' : ($autostart_audio = 'true');
             } else {
                 $autostart_audio = $autostart;
             }
         } else {
             $autostart_audio = 'true';
         }
         $courseInfo = api_get_course_info();
         $audio = $row['audio'];
         $file = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document/audio/' . $audio;
         $url = api_get_path(WEB_COURSE_PATH) . $courseInfo['path'] . '/document/audio/' . $audio;
         if (!file_exists($file)) {
             $lpPathInfo = $_SESSION['oLP']->generate_lp_folder(api_get_course_info());
             $file = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $lpPathInfo['dir'] . $audio;
             $url = api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/document' . $lpPathInfo['dir'] . $audio;
         }
         $player = Display::getMediaPlayer($file, array('id' => 'lp_audio_media_player', 'url' => $url, 'autoplay' => $autostart_audio, 'width' => '100%'));
         // The mp3 player.
         $output = '<div id="container">';
         $output .= $player;
         $output .= '</div>';
     }
     return $output;
 }
Esempio n. 3
0
$tpl->assign('course_code', api_get_course_id());
$tpl->assign('php_session_id', session_id());
$tpl->assign('filename', $lp_item->get_title().'_nano.wav');
$tpl->assign('enable_nanogong', api_get_setting('enable_nanogong') == 'true' ? 1 : 0);
$tpl->assign('enable_wami', api_get_setting('enable_wami_record') == 'true' ? 1 : 0);
$tpl->assign('cur_dir_path', '/audio');
$tpl->assign('lp_item_id', $lp_item_id);
$tpl->assign('lp_dir', api_remove_trailing_slash($lpPathInfo['dir']));
$recordVoiceForm .= $tpl->fetch('default/learnpath/record_voice.tpl');
$form->addElement('header', get_lang('Or'));
$form->addElement('header', get_lang('AudioFile'));
$form->addElement('html', sprintf(get_lang('AudioFileForItemX'), $lp_item->get_title()));

if (!empty($file)) {
    $audioPlayer = '<div id="preview">'.
        Display::getMediaPlayer($file, array('url' => $urlFile)).
        "</div>";
    $form->addElement('label', get_lang('Listen'), $audioPlayer);
    $url = api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?lp_id='.$_SESSION['oLP']->get_id().'&action=add_audio&id='.$lp_item_id.'&delete_file=1&'.api_get_cidreq();
    $form->addElement('label', null, Display::url(get_lang('RemoveAudio'), $url, array('class' => 'btn btn-danger')));
} else {
    $form->addElement('file', 'file');
    $form->addElement('hidden', 'id', $lp_item_id);
    $form->addElement('button', 'submit', get_lang('Ok'));
}
$form->addElement('header', get_lang('Or'));

$courseInfo = api_get_course_info();
$documentTree = DocumentManager::get_document_preview(
    $courseInfo,
    false,