本文整理汇总了PHP中CourseManager::get_logged_user_course_html方法的典型用法代码示例。如果您正苦于以下问题:PHP CourseManager::get_logged_user_course_html方法的具体用法?PHP CourseManager::get_logged_user_course_html怎么用?PHP CourseManager::get_logged_user_course_html使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CourseManager
的用法示例。
在下文中一共展示了CourseManager::get_logged_user_course_html方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: return_courses_and_sessions
//.........这里部分代码省略.........
// Loop course content
$html_courses_session = '';
$atLeastOneCourseIsVisible = false;
foreach ($session['courses'] as $course) {
$is_coach_course = api_is_coach($session_id, $course['code']);
$allowed_time = 0;
$dif_time_after = 0;
if ($date_session_start != '0000-00-00') {
if ($is_coach_course) {
$allowed_time = api_strtotime($date_session_start.' 00:00:00') - ($days_access_before_beginning * 86400);
} else {
$allowed_time = api_strtotime($date_session_start.' 00:00:00');
}
if (!isset($_GET['history'])) {
if ($date_session_end != '0000-00-00') {
$endSessionToTms = api_strtotime($date_session_end.' 23:59:59');
if ($session_now > $endSessionToTms) {
$dif_time_after = $session_now - $endSessionToTms;
$dif_time_after = round($dif_time_after/86400);
}
}
}
}
if ($session_now > $allowed_time &&
$days_access_after_end > $dif_time_after - 1
) {
// Read only and accessible.
$atLeastOneCourseIsVisible = true;
if (api_get_setting('hide_courses_in_sessions') == 'false') {
$c = CourseManager::get_logged_user_course_html(
$course,
$session_id,
'session_course_item',
true,
$this->load_directories_preview
);
$html_courses_session .= isset($c[1]) ? $c[1] : null;
}
$count_courses_session++;
}
}
// No courses to show.
if ($atLeastOneCourseIsVisible == false) {
if (empty($html_courses_session)) {
continue;
}
}
if ($count_courses_session > 0) {
$params = array();
$session_box = Display::get_session_title_box($session_id);
$params['icon'] = Display::return_icon(
'window_list.png',
$session_box['title'],
array('id' => 'session_img_' . $session_id),
ICON_SIZE_LARGE
);
$extra_info = !empty($session_box['coach']) ? $session_box['coach'] : null;
$extra_info .= !empty($session_box['coach']) ? ' - '.$session_box['dates'] : $session_box['dates'];
$extra_info .= isset($session_box['duration']) ? ' '.$session_box['duration'] : null;
示例2: returnSessions
/**
* @param int $user_id
* @param string $filter current|history
* @param int $page
* @return bool|null|string
*/
public function returnSessions($user_id, $filter, $page)
{
if (empty($user_id)) {
return false;
}
$app = $this->app;
$loadHistory = isset($filter) && $filter == 'history' ? true : false;
$app['session_menu'] = function ($app) use($loadHistory) {
$menu = $app['knp_menu.factory']->createItem('root', array('childrenAttributes' => array('class' => 'nav nav-tabs', 'currentClass' => 'active')));
$current = $menu->addChild(get_lang('Current'), array('route' => 'userportal', 'routeParameters' => array('filter' => 'current', 'type' => 'sessions')));
$history = $menu->addChild(get_lang('HistoryTrainingSession'), array('route' => 'userportal', 'routeParameters' => array('filter' => 'history', 'type' => 'sessions')));
//@todo use URIVoter
if ($loadHistory) {
$history->setCurrent(true);
} else {
$current->setCurrent(true);
}
return $menu;
};
//@todo move this in template
$app['knp_menu.menus'] = array('actions_menu' => 'session_menu');
$start = ($page - 1) * $this->maxPerPage;
if ($loadHistory) {
// Load sessions in category in *history*.
$nbResults = (int) UserManager::get_sessions_by_category($user_id, true, true, true, null, null, 'no_category');
$session_categories = UserManager::get_sessions_by_category($user_id, true, false, true, $start, $this->maxPerPage, 'no_category');
} else {
// Load sessions in category.
$nbResults = (int) UserManager::get_sessions_by_category($user_id, false, true, false, null, null, 'no_category');
$session_categories = UserManager::get_sessions_by_category($user_id, false, false, false, $start, $this->maxPerPage, 'no_category');
}
$html = null;
// Showing history title
if ($loadHistory) {
// $html .= Display::page_subheader(get_lang('HistoryTrainingSession'));
if (empty($session_categories)) {
$html .= get_lang('YouDoNotHaveAnySessionInItsHistory');
}
}
$load_directories_preview = api_get_setting('show_documents_preview') == 'true' ? true : false;
$sessions_with_no_category = $html;
if (isset($session_categories) && !empty($session_categories)) {
foreach ($session_categories as $session_category) {
$session_category_id = $session_category['session_category']['id'];
// Sessions does not belong to a session category
if ($session_category_id == 0) {
// Independent sessions
if (isset($session_category['sessions'])) {
foreach ($session_category['sessions'] as $session) {
$session_id = $session['session_id'];
// Don't show empty sessions.
if (count($session['courses']) < 1) {
continue;
}
$html_courses_session = '';
$count_courses_session = 0;
foreach ($session['courses'] as $course) {
//Read only and accessible
if (api_get_setting('hide_courses_in_sessions') == 'false') {
$html_courses_session .= CourseManager::get_logged_user_course_html($course, $session_id, $load_directories_preview);
}
$count_courses_session++;
}
if ($count_courses_session > 0) {
$params = array();
$params['icon'] = Display::return_icon('window_list.png', $session['session_name'], array('id' => 'session_img_' . $session_id), ICON_SIZE_LARGE);
$params['is_session'] = true;
//Default session name
$session_link = $session['session_name'];
$params['link'] = null;
if (api_get_setting('session_page_enabled') == 'true' && !api_is_drh()) {
//session name with link
$session_link = Display::tag('a', $session['session_name'], array('href' => api_get_path(WEB_CODE_PATH) . 'session/index.php?session_id=' . $session_id));
$params['link'] = api_get_path(WEB_CODE_PATH) . 'session/index.php?session_id=' . $session_id;
}
$params['title'] = $session_link;
$moved_status = SessionManager::get_session_change_user_reason($session['moved_status']);
$moved_status = isset($moved_status) && !empty($moved_status) ? ' (' . $moved_status . ')' : null;
$params['subtitle'] = isset($session['coach_info']) ? $session['coach_info']['complete_name'] : null . $moved_status;
$params['dates'] = $session['date_message'];
$params['right_actions'] = '';
if (api_is_platform_admin()) {
$params['right_actions'] .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'admin/resume_session.php?id_session=' . $session_id . '">';
$params['right_actions'] .= Display::return_icon('edit.png', get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL) . '</a>';
}
if (api_get_setting('hide_courses_in_sessions') == 'false') {
// $params['extra'] .= $html_courses_session;
}
$sessions_with_no_category .= CourseManager::course_item_parent(CourseManager::course_item_html($params, true), $html_courses_session);
}
}
}
}
}
//.........这里部分代码省略.........
示例3: returnCoursesAndSessions
/**
* Prints the session and course list (user_portal.php)
* @param int $user_id
* @return string
*/
public function returnCoursesAndSessions($user_id)
{
global $_configuration;
$gamificationModeIsActive = api_get_setting('platform.gamification_mode');
$load_history = isset($_GET['history']) && intval($_GET['history']) == 1 ? true : false;
if ($load_history) {
// Load sessions in category in *history*
$session_categories = UserManager::get_sessions_by_category($user_id, true);
} else {
// Load sessions in category
$session_categories = UserManager::get_sessions_by_category($user_id, false);
}
$html = '';
// Showing history title
if ($load_history) {
$html .= Display::page_subheader(get_lang('HistoryTrainingSession'));
if (empty($session_categories)) {
$html .= get_lang('YouDoNotHaveAnySessionInItsHistory');
}
}
$courses_html = '';
$special_courses = '';
$sessionCount = 0;
$courseCount = 0;
// If we're not in the history view...
if (!isset($_GET['history'])) {
// Display special courses.
$specialCourses = CourseManager::display_special_courses($user_id, $this->load_directories_preview);
$special_courses = $specialCourses['html'];
// Display courses.
$courses = CourseManager::display_courses($user_id, $this->load_directories_preview);
$courses_html .= $courses['html'];
$courseCount = $specialCourses['course_count'] + $courses['course_count'];
}
$sessions_with_category = '';
$sessions_with_no_category = '';
$sessionTitleLink = api_get_configuration_value('courses_list_session_title_link');
$sessionTitleLink = $sessionTitleLink === false ? 1 : $sessionTitleLink;
if (is_array($session_categories)) {
foreach ($session_categories as $session_category) {
$session_category_id = $session_category['session_category']['id'];
// Sessions and courses that are not in a session category
if (empty($session_category_id) && isset($session_category['sessions'])) {
// Independent sessions
foreach ($session_category['sessions'] as $session) {
$session_id = $session['session_id'];
// Don't show empty sessions.
if (count($session['courses']) < 1) {
continue;
}
// Courses inside the current session.
$date_session_start = $session['access_start_date'];
$date_session_end = $session['access_end_date'];
$coachAccessStartDate = $session['coach_access_start_date'];
$coachAccessEndDate = $session['coach_access_end_date'];
$session_now = time();
$count_courses_session = 0;
// Loop course content
$html_courses_session = [];
$atLeastOneCourseIsVisible = false;
foreach ($session['courses'] as $course) {
$is_coach_course = api_is_coach($session_id, $course['real_id']);
$allowed_time = 0;
$dif_time_after = 0;
if (!empty($date_session_start) && $date_session_start != '0000-00-00 00:00:00') {
if ($is_coach_course) {
$allowed_time = api_strtotime($coachAccessStartDate);
} else {
$allowed_time = api_strtotime($date_session_start);
}
if (!isset($_GET['history'])) {
if (!empty($date_session_end) && $date_session_end != '0000-00-00 00:00:00') {
$endSessionToTms = api_strtotime($date_session_end);
if ($session_now > $endSessionToTms) {
$dif_time_after = $session_now - $endSessionToTms;
$dif_time_after = round($dif_time_after / 86400);
}
}
}
}
if ($session_now > $allowed_time) {
// Read only and accessible.
$atLeastOneCourseIsVisible = true;
if (api_get_setting('session.hide_courses_in_sessions') == 'false') {
$courseUserHtml = CourseManager::get_logged_user_course_html($course, $session_id, 'session_course_item', true, $this->load_directories_preview);
if (isset($courseUserHtml[1])) {
$course_session = $courseUserHtml[1];
$course_session['skill'] = isset($courseUserHtml['skill']) ? $courseUserHtml['skill'] : '';
$html_courses_session[] = $course_session;
}
}
$count_courses_session++;
}
}
// No courses to show.
//.........这里部分代码省略.........