本文整理汇总了PHP中Display::show_notification方法的典型用法代码示例。如果您正苦于以下问题:PHP Display::show_notification方法的具体用法?PHP Display::show_notification怎么用?PHP Display::show_notification使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Display
的用法示例。
在下文中一共展示了Display::show_notification方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayCourses
/**
* @param int $user_id
* @param $filter
* @param bool $load_dirs
* @param int $getCount
* @param int $start
* @param null $maxPerPage
* @return null|string
*/
public static function displayCourses($user_id, $filter, $load_dirs, $getCount, $start = null, $maxPerPage = null)
{
// Table definitions
$TABLECOURS = Database::get_main_table(TABLE_MAIN_COURSE);
$TABLECOURSUSER = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$TABLE_ACCESS_URL_REL_COURSE = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$current_url_id = api_get_current_access_url_id();
// Get course list auto-register
$special_course_list = self::get_special_course_list();
$without_special_courses = '';
if (!empty($special_course_list)) {
//$without_special_courses = ' AND course.code NOT IN ("'.implode('","',$special_course_list).'")';
}
$select = " SELECT DISTINCT\n course.id,\n course.title,\n course.code,\n course.subscribe subscr,\n course.unsubscribe unsubscr,\n course_rel_user.status status,\n course_rel_user.sort sort,\n course_rel_user.user_course_cat user_course_cat,\n course.id as real_id\n ";
$from = "{$TABLECOURS} course, {$TABLECOURSUSER} course_rel_user, {$TABLE_ACCESS_URL_REL_COURSE} url ";
$where = " course.id = course_rel_user.c_id AND\n url.c_id = course.id AND\n course_rel_user.user_id = '" . $user_id . "' AND\n course_rel_user.user_course_cat = 0\n ";
$order = " ORDER BY course_rel_user.user_course_cat, course_rel_user.sort ASC";
if ($getCount) {
$select = "SELECT count(course.id) as total";
}
$sql = "{$select} FROM {$from} WHERE {$where} {$without_special_courses} ";
// corresponding to the current URL.
if (api_get_multiple_access_url() && $current_url_id != -1) {
$sql .= " AND url.c_id = course.id AND access_url_id='" . $current_url_id . "'";
}
$sql .= $order;
if (isset($start) && isset($maxPerPage)) {
$start = intval($start);
$maxPerPage = intval($maxPerPage);
$limitCondition = " LIMIT {$start}, {$maxPerPage}";
$sql .= $limitCondition;
}
if ($getCount) {
$result = Database::query($sql);
$row = Database::fetch_array($result);
return $row['total'];
}
$result = Database::query($sql);
$html = null;
$course_list = array();
// Browse through all courses.
while ($course = Database::fetch_array($result)) {
$course_info = api_get_course_info($course['code']);
$course_info['id_session'] = null;
$course_info['status'] = $course['status'];
//In order to avoid doubles
if (in_array($course_info['real_id'], $course_list)) {
continue;
} else {
$course_list[] = $course_info['real_id'];
}
// For each course, get if there is any notification icon to show
// (something that would have changed since the user's last visit).
$show_notification = Display::show_notification($course_info);
// New code displaying the user's status in respect to this course.
$status_icon = Display::return_icon('blackboard.png', $course_info['title'], array(), ICON_SIZE_LARGE);
$params = array();
$params['right_actions'] = '';
if (api_is_platform_admin()) {
if ($load_dirs) {
$params['right_actions'] .= '<a id="document_preview_' . $course_info['real_id'] . '_0" class="document_preview" href="javascript:void(0);">' . Display::return_icon('folder.png', get_lang('Documents'), array('align' => 'absmiddle'), ICON_SIZE_SMALL) . '</a>';
$params['right_actions'] .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course['code'] . '">' . Display::return_icon('edit.png', get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL) . '</a>';
$params['right_actions'] .= Display::div('', array('id' => 'document_result_' . $course_info['real_id'] . '_0', 'class' => 'document_preview_container'));
} else {
$params['right_actions'] .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course['code'] . '">' . Display::return_icon('edit.png', get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL) . '</a>';
}
if ($course_info['status'] == COURSEMANAGER) {
//echo Display::return_icon('teachers.gif', get_lang('Status').': '.get_lang('Teacher'), array('style'=>'width: 11px; height: 11px;'));
}
} else {
if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED) {
if ($load_dirs) {
$params['right_actions'] .= '<a id="document_preview_' . $course_info['real_id'] . '_0" class="document_preview" href="javascript:void(0);">' . Display::return_icon('folder.png', get_lang('Documents'), array('align' => 'absmiddle'), ICON_SIZE_SMALL) . '</a>';
$params['right_actions'] .= Display::div('', array('id' => 'document_result_' . $course_info['real_id'] . '_0', 'class' => 'document_preview_container'));
} else {
if ($course_info['status'] == COURSEMANAGER) {
$params['right_actions'] .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course['code'] . '">' . Display::return_icon('edit.png', get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL) . '</a>';
}
}
}
}
$course_title_url = '';
if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED || $course['status'] == COURSEMANAGER) {
//$course_title_url = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/index.php?id_session=0';
$course_title_url = api_get_path(WEB_COURSE_PATH) . $course_info['code'] . '/index.php?id_session=0';
$course_title = Display::url($course_info['title'], $course_title_url);
} else {
$course_title = $course_info['title'] . " " . Display::tag('span', get_lang('CourseClosed'), array('class' => 'item_closed'));
}
// Start displaying the course block itself
if (api_get_setting('course.display_coursecode_in_courselist') == 'true') {
//.........这里部分代码省略.........
示例2: getCourseParamsForDisplay
/**
* Return tab of params to display a course title in the My Courses tab
* Check visibility, right, and notification icons, and load_dirs option
* @param $courseId
* @param bool $loadDirs
* @return array
*/
public static function getCourseParamsForDisplay($courseId, $loadDirs = false)
{
$user_id = api_get_user_id();
// Table definitions
$TABLECOURS = Database::get_main_table(TABLE_MAIN_COURSE);
$TABLECOURSUSER = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$TABLE_ACCESS_URL_REL_COURSE = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$current_url_id = api_get_current_access_url_id();
// Get course list auto-register
$special_course_list = self::get_special_course_list();
$without_special_courses = '';
if (!empty($special_course_list)) {
$without_special_courses = ' AND course.code NOT IN ("' . implode('","', $special_course_list) . '")';
}
//AND course_rel_user.relation_type<>".COURSE_RELATION_TYPE_RRHH."
$sql = "SELECT course.id, course.title, course.code, course.subscribe subscr, course.unsubscribe unsubscr, course_rel_user.status status,\n course_rel_user.sort sort, course_rel_user.user_course_cat user_course_cat\n FROM {$TABLECOURS} course,\n {$TABLECOURSUSER} course_rel_user, " . $TABLE_ACCESS_URL_REL_COURSE . " url\n WHERE course.id=" . intval($courseId) . "\n AND course.id = course_rel_user.c_id\n AND url.c_id = course.id\n AND course_rel_user.user_id = " . intval($user_id) . "\n {$without_special_courses} ";
// If multiple URL access mode is enabled, only fetch courses
// corresponding to the current URL.
if (api_get_multiple_access_url() && $current_url_id != -1) {
$sql .= " AND url.course_code=course.code AND access_url_id=" . intval($current_url_id);
}
// Use user's classification for courses (if any).
$sql .= " ORDER BY course_rel_user.user_course_cat, course_rel_user.sort ASC";
$result = Database::query($sql);
// Browse through all courses. We can only have one course because of the course.id=".intval($courseId) in sql query
$course = Database::fetch_array($result);
$course_info = api_get_course_info($course['code']);
//$course['id_session'] = null;
$course_info['id_session'] = null;
$course_info['status'] = $course['status'];
// For each course, get if there is any notification icon to show
// (something that would have changed since the user's last visit).
$show_notification = Display::show_notification($course_info);
// New code displaying the user's status in respect to this course.
$status_icon = Display::return_icon('blackboard.png', $course_info['title'], array(), ICON_SIZE_LARGE);
$params = array();
$params['right_actions'] = '';
if (api_is_platform_admin()) {
if ($loadDirs) {
$params['right_actions'] .= '<a id="document_preview_' . $course_info['real_id'] . '_0" class="document_preview" href="javascript:void(0);">' . Display::return_icon('folder.png', get_lang('Documents'), array('align' => 'absmiddle'), ICON_SIZE_SMALL) . '</a>';
$params['right_actions'] .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course['code'] . '">' . Display::return_icon('edit.png', get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL) . '</a>';
$params['right_actions'] .= Display::div('', array('id' => 'document_result_' . $course_info['real_id'] . '_0', 'class' => 'document_preview_container'));
} else {
$params['right_actions'] .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course['code'] . '">' . Display::return_icon('edit.png', get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL) . '</a>';
}
if ($course_info['status'] == COURSEMANAGER) {
//echo Display::return_icon('teachers.gif', get_lang('Status').': '.get_lang('Teacher'), array('style'=>'width: 11px; height: 11px;'));
}
} else {
if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED) {
if ($loadDirs) {
$params['right_actions'] .= '<a id="document_preview_' . $course_info['real_id'] . '_0" class="document_preview" href="javascript:void(0);">' . Display::return_icon('folder.png', get_lang('Documents'), array('align' => 'absmiddle'), ICON_SIZE_SMALL) . '</a>';
$params['right_actions'] .= Display::div('', array('id' => 'document_result_' . $course_info['real_id'] . '_0', 'class' => 'document_preview_container'));
} else {
if ($course_info['status'] == COURSEMANAGER) {
$params['right_actions'] .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course['code'] . '">' . Display::return_icon('edit.png', get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL) . '</a>';
}
}
}
}
$course_title_url = '';
if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED || $course['status'] == COURSEMANAGER) {
$course_title_url = api_get_path(WEB_COURSE_PATH) . $course_info['path'] . '/?id_session=0';
$course_title = Display::url($course_info['title'], $course_title_url);
} else {
$course_title = $course_info['title'] . " " . Display::tag('span', get_lang('CourseClosed'), array('class' => 'item_closed'));
}
// Start displaying the course block itself
if (api_get_setting('display_coursecode_in_courselist') == 'true') {
$course_title .= ' (' . $course_info['visual_code'] . ') ';
}
$teachers = '';
if (api_get_setting('display_teacher_in_courselist') == 'true') {
$teachers = CourseManager::get_teacher_list_from_course_code_to_string($course['code'], self::USER_SEPARATOR, true);
}
$params['link'] = $course_title_url;
$params['icon'] = $status_icon;
$params['title'] = $course_title;
$params['teachers'] = $teachers;
if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED) {
$params['notifications'] = $show_notification;
}
return $params;
}
示例3: get_logged_user_course_html
/**
* Display code for one specific course a logged in user is subscribed to.
* Shows a link to the course, what's new icons...
*
* $my_course['d'] - course directory
* $my_course['i'] - course title
* $my_course['c'] - visual course code
* $my_course['k'] - system course code
*
* @param array Course details
* @param integer Session ID
* @param string CSS class to apply to course entry
* @param boolean Whether the session is supposedly accessible now (not in the case it has passed and is in invisible/unaccessible mode)
* @param bool Whether to show the document quick-loader or not
* @return string The HTML to be printed for the course entry
*
* @version 1.0.3
* @todo refactor into different functions for database calls | logic | display
* @todo replace single-character $my_course['d'] indices
* @todo move code for what's new icons to a separate function to clear things up
* @todo add a parameter user_id so that it is possible to show the courselist of other users (=generalisation). This will prevent having to write a new function for this.
*/
public static function get_logged_user_course_html($course, $session_id = 0, $load_dirs = false)
{
$course_info = api_get_course_info_by_id($course['id']);
$course_info['id_session'] = $session_id;
// Display course entry.
// Show a link to the course, unless the course is closed and user is not course admin.
$session_url = '';
if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED || $course_info['user_status_in_course'] == COURSEMANAGER) {
$session_url = api_get_path(WEB_COURSE_PATH) . $course_info['path'] . '/index.php?id_session=' . $course_info['id_session'];
$session_title = '<a href="' . api_get_path(WEB_COURSE_PATH) . $course_info['path'] . '/index.php?id_session=' . $course_info['id_session'] . '">' . $course_info['name'] . '</a>';
} else {
$session_title = $course_info['name'] . ' ' . Display::tag('span', get_lang('CourseClosed'), array('class' => 'item_closed'));
}
$params = array();
$params['icon'] = Display::return_icon('blackboard_blue.png', $course_info['name'], array(), ICON_SIZE_LARGE);
$params['link'] = $session_url;
$params['title'] = $session_title;
$params['right_actions'] = '';
if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED) {
if ($load_dirs) {
$params['right_actions'] .= '<a id="document_preview_' . $course_info['real_id'] . '_' . $course_info['id_session'] . '" class="document_preview" href="javascript:void(0);">' . Display::return_icon('folder.png', get_lang('Documents'), array('align' => 'absmiddle'), ICON_SIZE_SMALL) . '</a>';
$params['right_actions'] .= Display::div('', array('id' => 'document_result_' . $course_info['real_id'] . '_' . $course_info['id_session'], 'class' => 'document_preview_container'));
}
}
if (api_get_setting('course.display_coursecode_in_courselist') == 'true') {
$session_title .= ' (' . $course_info['visual_code'] . ') ';
}
if (api_get_setting('course.display_teacher_in_courselist') == 'true') {
$teacher_list = CourseManager::get_teacher_list_from_course_code_to_string($course_info['real_id'], self::USER_SEPARATOR, true);
$course_coachs = CourseManager::get_coachs_from_course_to_string($course_info['id_session'], $course_info['real_id'], self::USER_SEPARATOR, true);
$params['teachers'] = $teacher_list;
$params['coaches'] = $course_coachs;
}
$session_title .= isset($course['special_course']) ? ' ' . Display::return_icon('klipper.png', get_lang('CourseAutoRegister')) : '';
// Display the "what's new" icons
if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED) {
$session_title .= Display::show_notification($course_info);
}
$params['title'] = $session_title;
$params['extra'] = '';
$html = self::course_item_html($params, true);
return $html;
}
示例4: get_logged_user_course_html
//.........这里部分代码省略.........
$session_title = '<a href="' . api_get_path(WEB_COURSE_PATH) . $course_info['path'] . '/?id_session=' . $course_info['id_session'] . '">' . $course_info['name'] . '</a>';
} else {
$session_title = $course_info['name'];
}
} else {
$session_url = api_get_path(WEB_COURSE_PATH) . $course_info['path'] . '/';
$session_title = '<a href="' . api_get_path(WEB_COURSE_PATH) . $course_info['path'] . '/">' . $course_info['name'] . '</a>';
}
} else {
$session_title = $course_info['name'] . ' ' . Display::tag('span', get_lang('CourseClosed'), array('class' => 'item_closed'));
}
} else {
$session_title = $course_info['name'];
}
$params = array();
$params['icon'] = Display::return_icon('blackboard_blue.png', api_htmlentities($course_info['name']), array(), ICON_SIZE_LARGE);
$showCustomIcon = api_get_configuration_value('course_images_in_courses_list');
$iconName = basename($course_info['course_image']);
if ($showCustomIcon && $iconName != 'course.png') {
$params['icon'] = Display::img($course_info['course_image'], api_htmlentities($course_info['name']), array());
}
$params['link'] = $session_url;
$params['title'] = $session_title;
$params['right_actions'] = '';
if ($course_visibility != COURSE_VISIBILITY_CLOSED && $course_visibility != COURSE_VISIBILITY_HIDDEN) {
if ($load_dirs) {
$params['right_actions'] .= '<a id="document_preview_' . $course_info['real_id'] . '_' . $course_info['id_session'] . '" class="document_preview" href="javascript:void(0);">' . Display::return_icon('folder.png', get_lang('Documents'), array('align' => 'absmiddle'), ICON_SIZE_SMALL) . '</a>';
$params['right_actions'] .= Display::div('', array('id' => 'document_result_' . $course_info['real_id'] . '_' . $course_info['id_session'], 'class' => 'document_preview_container'));
}
}
if (api_get_setting('display_coursecode_in_courselist') == 'true') {
$session_title .= ' (' . $course_info['visual_code'] . ') ';
}
if (api_get_setting('display_teacher_in_courselist') == 'true') {
$teacher_list = null;
if (!$nosession) {
$teacher_list = CourseManager::get_teacher_list_from_course_code_to_string($course_info['code'], self::USER_SEPARATOR, true);
$course_coachs = CourseManager::get_coachs_from_course_to_string($course_info['id_session'], $course['code'], self::USER_SEPARATOR, true);
if ($course_info['status'] == COURSEMANAGER || $course_info['status'] == STUDENT && empty($course_info['id_session']) || empty($course_info['status'])) {
$params['teachers'] = $teacher_list;
}
if ($course_info['status'] == STUDENT && !empty($course_info['id_session']) || $is_coach && $course_info['status'] != COURSEMANAGER) {
$params['coaches'] = $course_coachs;
}
} else {
$params['teachers'] = $teacher_list;
}
}
$session_title .= isset($course['special_course']) ? ' ' . Display::return_icon('klipper.png', get_lang('CourseAutoRegister')) : '';
// Display the "what's new" icons
if ($course_visibility != COURSE_VISIBILITY_CLOSED && $course_visibility != COURSE_VISIBILITY_HIDDEN) {
$session_title .= Display::show_notification($course_info);
}
$params['title'] = $session_title;
$params['extra'] = '';
$html = self::course_item_html($params, true);
$session_category_id = null;
if (!$nosession) {
$session = '';
$active = false;
if (!empty($course_info['session_name'])) {
// Request for the name of the general coach
$sql = 'SELECT lastname, firstname,sc.name
FROM ' . $tbl_session . ' ts
LEFT JOIN ' . $main_user_table . ' tu
ON ts.id_coach = tu.user_id
INNER JOIN ' . $tbl_session_category . ' sc ON ts.session_category_id = sc.id
WHERE ts.id=' . (int) $course_info['id_session'] . ' LIMIT 1';
$rs = Database::query($sql);
$sessioncoach = Database::store_result($rs);
$sessioncoach = $sessioncoach[0];
$session = array();
$session['title'] = $course_info['session_name'];
$session_category_id = CourseManager::get_session_category_id_by_session_id($course_info['id_session']);
$session['category'] = $sessioncoach['name'];
if ($course_info['date_start'] == '0000-00-00') {
//$session['dates'] = get_lang('WithoutTimeLimits');
$session['dates'] = '';
if (api_get_setting('show_session_coach') === 'true') {
$session['coach'] = get_lang('GeneralCoach') . ': ' . api_get_person_name($sessioncoach['firstname'], $sessioncoach['lastname']);
}
$active = true;
} else {
$session['dates'] = ' - ' . get_lang('From') . ' ' . $course_info['date_start'] . ' ' . get_lang('To') . ' ' . $course_info['date_end'];
if (api_get_setting('show_session_coach') === 'true') {
$session['coach'] = get_lang('GeneralCoach') . ': ' . api_get_person_name($sessioncoach['firstname'], $sessioncoach['lastname']);
}
$active = $date_start <= $now && $date_end >= $now;
}
}
$user_course_category = '';
if (isset($course_info['user_course_cat'])) {
$user_course_category = $course_info['user_course_cat'];
}
$output = array($user_course_category, $html, $course_info['id_session'], $session, 'active' => $active, 'session_category_id' => $session_category_id);
} else {
$output = array($course_info['user_course_cat'], $html);
}
return $output;
}