本文整理汇总了PHP中api_get_course_url函数的典型用法代码示例。如果您正苦于以下问题:PHP api_get_course_url函数的具体用法?PHP api_get_course_url怎么用?PHP api_get_course_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了api_get_course_url函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parse_content
/**
* @param int $userId
* @param string $content
* @param string $course_code
* @param int $session_id
*
* @return mixed
*/
public static function parse_content($userId, $content, $course_code, $session_id = 0)
{
$readerInfo = api_get_user_info($userId);
$courseInfo = api_get_course_info($course_code);
$teacher_list = CourseManager::get_teacher_list_from_course_code($courseInfo['code']);
$teacher_name = '';
if (!empty($teacher_list)) {
foreach ($teacher_list as $teacher_data) {
$teacher_name = api_get_person_name($teacher_data['firstname'], $teacher_data['lastname']);
$teacher_email = $teacher_data['email'];
break;
}
}
$courseLink = api_get_course_url($course_code, $session_id);
$data['user_name'] = $readerInfo['username'];
$data['user_firstname'] = $readerInfo['firstname'];
$data['user_lastname'] = $readerInfo['lastname'];
$data['teacher_name'] = $teacher_name;
$data['teacher_email'] = $teacher_email;
$data['course_title'] = $courseInfo['name'];
$data['course_link'] = Display::url($courseLink, $courseLink);
$data['official_code'] = $readerInfo['official_code'];
$content = str_replace(self::get_tags(), $data, $content);
return $content;
}
示例2: get_lang
$pluginMessage = Display::return_message($plugin->get_lang('YouNeedToConfirmYourAgreementCheckYourEmail'));
$hideForm = true;
}
}
}
$form->addElement('header', get_lang('CourseLegalAgreement'));
$form->addElement('label', null, $course_legal);
if ($pluginLegal && !empty($plugin)) {
$form->addElement('label', null, $plugin->getCurrentFile($course_info['real_id'], $session_id));
}
$form->addElement('hidden', 'course_code', $course_code);
$form->addElement('hidden', 'session_id', $session_id);
$form->addElement('checkbox', 'accept_legal', null, get_lang('AcceptLegal'));
$form->addElement('style_submit_button', null, get_lang('Accept'), 'class="save"');
$variable = 'accept_legal_' . $user_id . '_' . $course_info['real_id'] . '_' . $session_id;
$url = api_get_course_url($course_code, $session_id);
if ($form->validate()) {
$accept_legal = $form->exportValue('accept_legal');
if ($accept_legal == 1) {
CourseManager::save_user_legal($user_id, $course_code, $session_id);
if (api_check_user_access_to_legal($course_info['visibility'])) {
Session::write($variable, true);
}
if ($pluginLegal) {
header('Location:' . $url);
exit;
}
}
}
$user_pass_open_course = false;
if (api_check_user_access_to_legal($course_info['visibility']) && Session::read($variable)) {
示例3: show_user_progress
//.........这里部分代码省略.........
}
$html = '';
// Course list
if ($show_courses) {
if (!empty($courses)) {
$html .= Display::page_subheader(Display::return_icon('course.png', get_lang('MyCourses'), array(), ICON_SIZE_SMALL) . ' ' . get_lang('MyCourses'));
$html .= '<table class="data_table" width="100%">';
$html .= '<tr>
' . Display::tag('th', get_lang('Course'), array('width' => '300px')) . '
' . Display::tag('th', get_lang('TimeSpentInTheCourse'), array('class' => 'head')) . '
' . Display::tag('th', get_lang('Progress'), array('class' => 'head')) . '
' . Display::tag('th', get_lang('Score') . Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')), array('class' => 'head')) . '
' . Display::tag('th', get_lang('LastConnexion'), array('class' => 'head')) . '
' . Display::tag('th', get_lang('Details'), array('class' => 'head')) . '
</tr>';
foreach ($courses as $course_code => $course_title) {
$courseInfo = api_get_course_info($course_code);
$courseId = $courseInfo['real_id'];
$total_time_login = Tracking::get_time_spent_on_the_course($user_id, $courseId);
$time = api_time_to_hms($total_time_login);
$progress = Tracking::get_avg_student_progress($user_id, $course_code);
$percentage_score = Tracking::get_avg_student_score($user_id, $course_code, array());
$last_connection = Tracking::get_last_connection_date_on_the_course($user_id, $courseInfo);
if (is_null($progress)) {
$progress = '0%';
} else {
$progress = $progress . '%';
}
if (isset($_GET['course']) && $course_code == $_GET['course'] && empty($_GET['session_id'])) {
$html .= '<tr class="row_odd" style="background-color:#FBF09D">';
} else {
$html .= '<tr class="row_even">';
}
$url = api_get_course_url($course_code, $session_id);
$course_url = Display::url($course_title, $url, array('target' => SESSION_LINK_TARGET));
$html .= '<td>' . $course_url . '</td>';
$html .= '<td align="center">' . $time . '</td>';
$html .= '<td align="center">' . $progress . '</td>';
$html .= '<td align="center">';
if (is_numeric($percentage_score)) {
$html .= $percentage_score . '%';
} else {
$html .= '0%';
}
$html .= '</td>';
$html .= '<td align="center">' . $last_connection . '</td>';
$html .= '<td align="center">';
if (isset($_GET['course']) && $course_code == $_GET['course'] && empty($_GET['session_id'])) {
$html .= '<a href="#">';
$html .= Display::return_icon('2rightarrow_na.png', get_lang('Details'));
} else {
$html .= '<a href="' . api_get_self() . '?course=' . $course_code . $extra_params . '">';
$html .= Display::return_icon('2rightarrow.png', get_lang('Details'));
}
$html .= '</a>';
$html .= '</td></tr>';
}
$html .= '</table>';
}
}
// Session list
if (!empty($course_in_session)) {
$main_session_graph = '';
//Load graphics only when calling to an specific session
$session_graph = array();
$all_exercise_graph_name_list = array();
示例4: return_goto_button
/**
* Display the goto course button of a course in the course catalog
* @param $course
*/
function return_goto_button($course)
{
$html = ' <a class="btn btn-default btn-sm" title="' . get_lang('GoToCourse') . '" href="' . api_get_course_url($course['code']) . '">' . Display::returnFontAwesomeIcon('share') . '</a>';
return $html;
}
示例5: subscribe_user
/**
* Subscribe the user to a given course
* @param string Course code
* @return string Message about results
*/
public function subscribe_user($course_code)
{
$user_id = api_get_user_id();
$all_course_information = CourseManager::get_course_information($course_code);
if ($all_course_information['registration_code'] == '' || $_POST['course_registration_code'] == $all_course_information['registration_code']) {
if (api_is_platform_admin()) {
$status_user_in_new_course = COURSEMANAGER;
} else {
$status_user_in_new_course = null;
}
if (CourseManager::add_user_to_course($user_id, $course_code, $status_user_in_new_course)) {
$send = api_get_course_setting('email_alert_to_teacher_on_new_user_in_course', $course_code);
if ($send == 1) {
CourseManager::email_to_tutor($user_id, $course_code, $send_to_tutor_also = false);
} else {
if ($send == 2) {
CourseManager::email_to_tutor($user_id, $course_code, $send_to_tutor_also = true);
}
}
$url = Display::url($all_course_information['title'], api_get_course_url($course_code));
$message = sprintf(get_lang('EnrollToCourseXSuccessful'), $url);
} else {
$message = get_lang('ErrorContactPlatformAdmin');
}
return array('message' => $message);
} else {
if (isset($_POST['course_registration_code']) && $_POST['course_registration_code'] != $all_course_information['registration_code']) {
return false;
}
$message = get_lang('CourseRequiresPassword') . '<br />';
$message .= $all_course_information['title'] . ' (' . $all_course_information['visual_code'] . ') ';
$action = api_get_path(WEB_CODE_PATH) . "auth/courses.php?action=subscribe_user_with_password&sec_token=" . $_SESSION['sec_token'];
$form = new FormValidator('subscribe_user_with_password', 'post', $action);
$form->addElement('hidden', 'sec_token', $_SESSION['sec_token']);
$form->addElement('hidden', 'subscribe_user_with_password', $all_course_information['code']);
$form->addElement('text', 'course_registration_code');
$form->addButton(get_lang('SubmitRegistrationCode'));
$content = $form->returnForm();
return array('message' => $message, 'content' => $content);
}
}
示例6: return_goto_button
/**
* Display the goto course button of a course in the course catalog
* @param $course
*/
function return_goto_button($course)
{
$html = ' <a class="btn btn-primary" href="' . api_get_course_url($course['code']) . '">' . get_lang('GoToCourse') . '</a>';
return $html;
}
示例7: get_lang
if ($count == 0) {
$upIcon = 'up_na.png';
$urlUp = '#';
}
$orderButtons = Display::url(Display::return_icon($upIcon, get_lang('MoveUp')), $urlUp);
$downIcon = 'down.png';
$downUrl = api_get_self() . '?id_session=' . $sessionId . '&course_id=' . $course->getId() . '&action=move_down';
if ($count + 1 == count($courses)) {
$downIcon = 'down_na.png';
$downUrl = '#';
}
$orderButtons .= Display::url(Display::return_icon($downIcon, get_lang('MoveDown')), $downUrl);
if (!SessionManager::orderCourseIsEnabled()) {
$orderButtons = '';
}
$courseUrl = api_get_course_url($course->getCode(), $sessionId);
// hide_course_breadcrumb the parameter has been added to hide the name
// of the course, that appeared in the default $interbreadcrumb
$courseItem .= '
<tr>
<td class="title">' . Display::url($course->getTitle() . ' (' . $course->getVisualCode() . ')', $courseUrl) . '</td>
<td>' . $coach . '</td>
<td>' . $numberOfUsers . '</td>
<td>
<a href="' . $courseUrl . '">' . Display::return_icon('course_home.gif', get_lang('Course')) . '</a>
' . $orderButtons . '
<a href="session_course_user_list.php?id_session=' . $sessionId . '&course_code=' . $course->getCode() . '">' . Display::return_icon('user.png', get_lang('Edit'), '', ICON_SIZE_SMALL) . '</a>
<a href="' . api_get_path(WEB_CODE_PATH) . '/user/user_import.php?action=import&cidReq=' . $course->getCode() . '&id_session=' . $sessionId . '">' . Display::return_icon('import_csv.png', get_lang('ImportUsersToACourse'), null, ICON_SIZE_SMALL) . '</a>
<a href="../tracking/courseLog.php?id_session=' . $sessionId . '&cidReq=' . $course->getCode() . $orig_param . '&hide_course_breadcrumb=1">' . Display::return_icon('statistics.gif', get_lang('Tracking')) . '</a>
<a href="session_course_edit.php?id_session=' . $sessionId . '&page=resume_session.php&course_code=' . $course->getCode() . '' . $orig_param . '">' . Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL) . '</a>
<a href="' . api_get_self() . '?id_session=' . $sessionId . '&action=delete&idChecked[]=' . $course->getCode() . '" onclick="javascript:if(!confirm(\'' . get_lang('ConfirmYourChoice') . '\')) return false;">' . Display::return_icon('delete.png', get_lang('Delete')) . '</a>
示例8: api_get_path
api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.$sessionId
);
$_SESSION['bc_message'] = 'EnrollToSessionXSuccessful';
$_SESSION['bc_url'] = $url;
$_SESSION['bc_success'] = true;
} else {
$course_code = $_SESSION['bc_codetext'];
$all_course_information = CourseManager::get_course_information($course_code);
if (CourseManager::subscribe_user($user_id, $course_code)) {
$send = api_get_course_setting('email_alert_to_teacher_on_new_user_in_course', $course_code);
if ($send == 1) {
CourseManager::email_to_tutor($user_id, $course_code, $send_to_tutor_also = false);
} else if ($send == 2) {
CourseManager::email_to_tutor($user_id, $course_code, $send_to_tutor_also = true);
}
$url = Display::url($all_course_information['title'], api_get_course_url($course_code));
$_SESSION['bc_message'] = 'EnrollToCourseXSuccessful';
$_SESSION['bc_url'] = $url;
$_SESSION['bc_success'] = true;
} else {
$_SESSION['bc_message'] = 'ErrorContactPlatformAdmin';
$_SESSION['bc_success'] = false;
}
}
// Activate the use
$TABLE_USER = Database::get_main_table(TABLE_MAIN_USER);
$sql = "UPDATE " . $TABLE_USER . " SET active='1' WHERE user_id='" . $_SESSION['bc_user_id'] . "'";
Database::query($sql);
$user_table = Database::get_main_table(TABLE_MAIN_USER);
示例9: api_get_path
echo '</div>';
echo '<div class="col-md-8">';
$teachers = CourseManager::get_teacher_list_from_course_code_to_string($course['real_id']);
$teachers = '<h5>' . $teachers . '</h5>';
echo '<div class="categories-course-description"><h3>' . Text::cut($title, 60) . '</h3>' . $teachers . $rating . '</div>';
echo '<p>';
// we display the icon to subscribe or the text already subscribed
echo '<div class="btn-toolbar">';
if (api_get_setting('show_courses_descriptions_in_catalog') == 'true') {
echo '<a class="ajax btn btn-default" href="' . api_get_path(WEB_CODE_PATH) . 'inc/ajax/course_home.ajax.php?a=show_course_information&code=' . $course['code'] . '" class="thickbox">' . get_lang('Description') . '</a>';
}
// Get access type for course button ("enter" or/and "register")
$access_type = CourseManager::get_access_link_by_user(api_get_user_id(), $course);
// Go To Course button (only if admin, if course public or if student already subscribed)
if ($access_type && in_array('enter', $access_type)) {
echo ' <a class="btn btn-primary" href="' . api_get_course_url($course['code']) . '">' . get_lang('GoToCourse') . '</a>';
}
// Register button
if ($access_type && in_array('register', $access_type)) {
echo ' <a class="btn btn-primary" href="' . api_get_self() . '?action=subscribe_course&sec_token=' . $stok . '&subscribe_course=' . $course['code'] . '&search_term=' . $search_term . '&category_code=' . $code . '">' . get_lang('Subscribe') . '</a>';
}
// If user is already subscribed to the course
if (!api_is_anonymous() && in_array($course['code'], $user_coursecodes)) {
if ($course['unsubscribe'] == UNSUBSCRIBE_ALLOWED) {
echo ' <a class="btn btn-primary" href="' . api_get_self() . '?action=unsubscribe&sec_token=' . $stok . '&unsubscribe=' . $course['code'] . '&search_term=' . $search_term . '&category_code=' . $code . '">' . get_lang('Unsubscribe') . '</a>';
}
echo '<br />';
echo '<br />';
echo Display::label(get_lang("AlreadyRegisteredToCourse"), "info");
}
echo '</div>';
示例10: api_not_allowed
* Security check
*/
if (empty($course_id)) {
api_not_allowed();
}
/**
* Code
*/
$course_info = api_get_course_info_by_id($course_id);
$tpl = new Template(null);
// Build the form
$form = new FormValidator('set_temp_password', 'POST', api_get_self() . '?course_id=' . $course_id . '&session_id=' . $session_id);
$form->addElement('header', get_lang('CourseRequiresPassword'));
$form->addElement('hidden', 'course_id', $course_id);
$form->addElement('hidden', 'session_id', $session_id);
$form->addElement('password', 'course_password', null, get_lang('Password'));
$form->addButtonSave(get_lang('Accept'));
if ($form->validate()) {
$form_values = $form->exportValues();
if ($form_values['course_password'] === $course_info['registration_code']) {
Session::write('course_password_' . $course_info['real_id'], true);
header('Location: ' . api_get_course_url($course_info['code'], $session_id));
exit;
} else {
$tpl->assign('error_message', Display::display_error_message(get_lang('CourseRegistrationCodeIncorrect'), true, true));
}
}
$tpl->assign('form', $form->toHtml());
$content = $tpl->get_template('auth/set_temp_password.tpl');
$tpl->assign('content', $tpl->fetch($content));
$tpl->display_one_col_template();
示例11: CourseBuilder
// Display the header
Display::display_header(get_lang('CopyCourse'));
echo Display::page_header(get_lang('CopyCourse'));
/* MAIN CODE */
// If a CourseSelectForm is posted or we should copy all resources, then copy them
if (isset($_POST['action']) && $_POST['action'] == 'course_select_form' || isset($_POST['copy_option']) && $_POST['copy_option'] == 'full_copy') {
if (isset($_POST['action']) && $_POST['action'] == 'course_select_form') {
$course = CourseSelectForm::get_posted_course('copy_course');
} else {
$cb = new CourseBuilder();
$course = $cb->build();
}
$cr = new CourseRestorer($course);
$cr->set_file_option($_POST['same_file_name_option']);
$cr->restore($_POST['destination_course']);
Display::display_normal_message(get_lang('CopyFinished') . ': <a href="' . api_get_course_url($_POST['destination_course']) . '">' . $_POST['destination_course'] . '</a>', false);
} elseif (isset($_POST['copy_option']) && $_POST['copy_option'] == 'select_items') {
$cb = new CourseBuilder();
$course = $cb->build();
$hidden_fields = array();
$hidden_fields['same_file_name_option'] = $_POST['same_file_name_option'];
$hidden_fields['destination_course'] = $_POST['destination_course'];
CourseSelectForm::display_form($course, $hidden_fields, true);
} else {
$table_c = Database::get_main_table(TABLE_MAIN_COURSE);
$table_cu = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$user_info = api_get_user_info();
$course_info = api_get_course_info();
$sql = 'SELECT * FROM ' . $table_c . ' c, ' . $table_cu . ' cu WHERE cu.c_id = c.id';
if (!api_is_platform_admin()) {
$sql .= ' AND cu.status=1 ';
示例12: array
$course['exercises'][$exercise_item['id']]['data']['exercise_data'] = $exercise;
$course['exercises'][$exercise_item['id']]['data']['results'] = $user_results;
}
}
$final_array[$my_session_id]['data'][$my_course['code']] = $course;
}
}
}
$my_session_list[] = $my_session_id;
}
}*/
$new_course_list = array();
if (!empty($course_list)) {
foreach ($course_list as $course_data) {
if (in_array($course_data['code'], $user_course_list) || api_is_anonymous()) {
$course_data['title'] = Display::url($course_data['title'], api_get_course_url($course_data['code'], $session_id));
} else {
continue;
}
$list = new LearnpathList(api_get_user_id(), $course_data['code'], $session_id, 'publicated_on ASC', true);
$lp_list = $list->get_flat_list();
$lp_count = 0;
if (!empty($lp_list)) {
foreach ($lp_list as $valLp) {
if ($valLp['lp_visibility']) {
$lp_count++;
}
}
}
$course_info = api_get_course_info($course_data['code']);
$exercise_count = count(ExerciseLib::get_all_exercises($course_info, $session_id, true, null, false, 1));
示例13: display_goto_button
/**
* Display the goto course button of a course in the course catalog
* @param $course
*/
function display_goto_button($course)
{
echo ' <a class="btn btn-primary" href="'.api_get_course_url($course['code']).'">'.get_lang('GoToCourse').'</a>';
}
示例14: array
}
$final_array[$my_session_id]['data'][$my_course['code']] = $course;
}
}
}
$my_session_list[] = $my_session_id;
}
}
$new_course_list = array();
if (!empty($course_list)) {
foreach ($course_list as $course_data) {
if (in_array($course_data['code'], $user_course_list)) {
$course_data['title'] = Display::url(
$course_data['title'],
api_get_course_url($course_data['code'], $session_id)
);
} else {
continue;
}
$list = new LearnpathList(
api_get_user_id(),
$course_data['code'],
$session_id,
'publicated_on ASC',
true
);
$lp_list = $list->get_flat_list();
$lp_count = 0;
示例15: api_get_course_url
}
}
$total_score = 0;
if (!empty($exercise_stat_info)) {
$total_score = $exercise_stat_info['exe_result'];
}
$max_score = $objExercise->get_max_score();
Display::display_normal_message(get_lang('Saved') . '<br />', false);
// Display and save questions
ExerciseLib::display_question_list_by_attempt($objExercise, $exe_id, true);
//Unset session for clock time
ExerciseLib::exercise_time_control_delete($objExercise->id, $learnpath_id, $learnpath_item_id);
ExerciseLib::delete_chat_exercise_session($exe_id);
if ($origin != 'learnpath') {
echo '<hr>';
echo Display::url(get_lang('ReturnToCourseHomepage'), api_get_course_url(), array('class' => 'btn btn-primary'));
if (api_is_allowed_to_session_edit()) {
Session::erase('objExercise');
Session::erase('exe_id');
}
Display::display_footer();
} else {
$lp_mode = Session::read('lp_mode');
$url = '../newscorm/lp_controller.php?cidReq=' . api_get_course_id() . '&action=view&lp_id=' . $learnpath_id . '&lp_item_id=' . $learnpath_item_id . '&exeId=' . $exercise_stat_info['exe_id'] . '&fb_type=' . $objExercise->feedback_type;
$href = $lp_mode == 'fullscreen' ? ' window.opener.location.href="' . $url . '" ' : ' top.location.href="' . $url . '"';
if (api_is_allowed_to_session_edit()) {
Session::erase('objExercise');
Session::erase('exe_id');
}
// Record the results in the learning path, using the SCORM interface (API)
echo "<script>window.parent.API.void_save_asset('{$total_score}', '{$max_score}', 0, 'completed');</script>";