本文整理汇总了PHP中api_is_allowed_to_create_course函数的典型用法代码示例。如果您正苦于以下问题:PHP api_is_allowed_to_create_course函数的具体用法?PHP api_is_allowed_to_create_course怎么用?PHP api_is_allowed_to_create_course使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了api_is_allowed_to_create_course函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
/**
*
* @return string
*/
public function indexAction(Application $app, $id)
{
$actions = null;
if (api_is_platform_admin()) {
$actions = '<a href="' . api_get_path(WEB_PATH) . 'main/admin/system_announcements.php">' . \Display::return_icon('edit.png', get_lang('EditSystemAnnouncement'), array(), 32) . '</a>';
}
if (api_is_anonymous()) {
$visibility = \SystemAnnouncementManager::VISIBLE_GUEST;
} else {
$visibility = api_is_allowed_to_create_course() ? \SystemAnnouncementManager::VISIBLE_TEACHER : \SystemAnnouncementManager::VISIBLE_STUDENT;
}
$content = \SystemAnnouncementManager::display_announcements_slider($visibility, $id);
$app['template']->assign('content', $content);
$app['template']->assign('actions', $actions);
$response = $app['template']->renderLayout('layout_1_col.tpl');
return new Response($response, 200, array());
}
示例2: return_course_block
function return_course_block() {
$html = '';
$show_create_link = false;
$show_course_link = false;
if ((api_get_setting('allow_users_to_create_courses') == 'false' && !api_is_platform_admin()) || api_is_student()) {
$display_add_course_link = false;
} else {
$display_add_course_link = true;
}
//$display_add_course_link = api_is_allowed_to_create_course() && ($_SESSION['studentview'] != 'studentenview');
if ($display_add_course_link) {
$show_create_link = true;
}
if (api_is_platform_admin() || api_is_course_admin() || api_is_allowed_to_create_course()) {
$show_course_link = true;
} else {
if (api_get_setting('allow_students_to_browse_courses') == 'true') {
$show_course_link = true;
}
}
// My account section
$my_account_content = '<ul class="nav nav-list">';
if ($show_create_link) {
$my_account_content .= '<li class="add-course"><a href="main/create_course/add_course.php">';
if (api_get_setting('course_validation') == 'true' && !api_is_platform_admin()) {
$my_account_content .= get_lang('CreateCourseRequest');
} else {
$my_account_content .= get_lang('CourseCreate');
}
$my_account_content .= '</a></li>';
}
//Sort courses
$url = api_get_path(WEB_CODE_PATH).'auth/courses.php?action=sortmycourses';
$my_account_content .= '<li class="order-course">'.Display::url(get_lang('SortMyCourses'), $url, array('class' => 'sort course')).'</li>';
// Session history
if (isset($_GET['history']) && intval($_GET['history']) == 1) {
$my_account_content .= '<li class="history-course"><a href="user_portal.php">'.get_lang('DisplayTrainingList').'</a></li>';
} else {
$my_account_content .= '<li class="history-course"><a href="user_portal.php?history=1" >'.get_lang('HistoryTrainingSessions').'</a></li>';
}
// Course catalog
if ($show_course_link) {
if (!api_is_drh()) {
$my_account_content .= '<li class="list-course"><a href="main/auth/courses.php" >'.get_lang('CourseCatalog').'</a></li>';
} else {
$my_account_content .= '<li><a href="main/dashboard/index.php">'.get_lang('Dashboard').'</a></li>';
}
}
$my_account_content .= '</ul>';
if (!empty($my_account_content)) {
$html = self::show_right_block(get_lang('Courses'), $my_account_content, 'course_block');
}
return $html;
}
示例3: api_block_anonymous_users
<?php
/* For licensing terms, see /license.txt */
/**
* Implements the tracking of students in the Reporting pages
* @package chamilo.reporting
*/
//require_once '../inc/global.inc.php';
api_block_anonymous_users();
if (!api_is_allowed_to_create_course() && !api_is_session_admin() && !api_is_drh() && !api_is_student_boss()) {
// Check if the user is tutor of the course
$user_course_status = CourseManager::get_tutor_in_course_status(api_get_user_id(), api_get_course_id());
if ($user_course_status != 1) {
api_not_allowed(true);
}
}
$alloAssignSkill = api_is_platform_admin(false, true);
$htmlHeadXtra[] = '<script>
function show_image(image,width,height) {
width = parseInt(width) + 20;
height = parseInt(height) + 20;
window_x = window.open(image,\'windowX\',\'width=\'+ width + \', height=\'+ height + \'\');
}
</script>';
$export = isset($_GET['export']) ? $_GET['export'] : false;
$sessionId = isset($_GET['id_session']) ? intval($_GET['id_session']) : 0;
$origin = isset($_GET['origin']) ? Security::remove_XSS($_GET['origin']) : '';
if (empty($sessionId)) {
$sessionId = api_get_session_id();
}
if ($export) {
示例4: return_course_block
/**
* @return null|string
*/
public function return_course_block()
{
$html = '';
$show_create_link = false;
$show_course_link = false;
if (api_get_setting('course.allow_users_to_create_courses') == 'false' && !api_is_platform_admin() || api_is_student()) {
$display_add_course_link = false;
} else {
$display_add_course_link = true;
}
if ($display_add_course_link) {
$show_create_link = true;
}
if (api_is_platform_admin() || api_is_course_admin() || api_is_allowed_to_create_course()) {
$show_course_link = true;
} else {
if (api_get_setting('display.allow_students_to_browse_courses') == 'true') {
$show_course_link = true;
}
}
// My account section
$my_account_content = '<ul class="nav nav-pills nav-stacked">';
if ($show_create_link) {
$my_account_content .= '<li class="add-course"><a href="main/create_course/add_course.php">';
if (api_get_setting('course.course_validation') == 'true' && !api_is_platform_admin()) {
$my_account_content .= Display::return_icon('new-course.png', get_lang('CreateCourseRequest'), null, ICON_SIZE_SMALL);
$my_account_content .= get_lang('CreateCourseRequest');
} else {
$my_account_content .= Display::return_icon('new-course.png', get_lang('CourseCreate'), null, ICON_SIZE_SMALL);
$my_account_content .= get_lang('CourseCreate');
}
$my_account_content .= '</a></li>';
if (SessionManager::allowToManageSessions()) {
$my_account_content .= '<li class="add-course"><a href="main/session/session_add.php">';
$my_account_content .= Display::return_icon('session.png', get_lang('AddSession'), null, ICON_SIZE_SMALL);
$my_account_content .= get_lang('AddSession');
$my_account_content .= '</a></li>';
}
}
//Sort courses
$url = api_get_path(WEB_CODE_PATH) . 'auth/courses.php?action=sortmycourses';
$img_order = Display::return_icon('order-course.png', get_lang('SortMyCourses'), null, ICON_SIZE_SMALL);
$my_account_content .= '<li class="order-course">' . Display::url($img_order . get_lang('SortMyCourses'), $url, array('class' => 'sort course')) . '</li>';
// Session history
if (isset($_GET['history']) && intval($_GET['history']) == 1) {
$my_account_content .= '<li class="history-course"><a href="user_portal.php">' . Display::return_icon('history-course.png', get_lang('DisplayTrainingList'), null, ICON_SIZE_SMALL) . get_lang('DisplayTrainingList') . '</a></li>';
} else {
$my_account_content .= '<li class="history-course"><a href="user_portal.php?history=1" >' . Display::return_icon('history-course.png', get_lang('HistoryTrainingSessions'), null, ICON_SIZE_SMALL) . get_lang('HistoryTrainingSessions') . '</a></li>';
}
// Course catalog
if ($show_course_link) {
if (!api_is_drh()) {
$my_account_content .= '<li class="list-course"><a href="main/auth/courses.php" >' . Display::return_icon('catalog-course.png', get_lang('CourseCatalog'), null, ICON_SIZE_SMALL) . get_lang('CourseCatalog') . '</a></li>';
} else {
$my_account_content .= '<li><a href="main/dashboard/index.php">' . get_lang('Dashboard') . '</a></li>';
}
}
$my_account_content .= '</ul>';
if (!empty($my_account_content)) {
$html = self::show_right_block(get_lang('Courses'), $my_account_content, 'course_block', null, 'course', 'courseCollapse');
}
return $html;
}
示例5: get_lang
</tr>
<tr>
<td>
' . get_lang('NbCoursesPerSession') . '
</td>
<td align="right">
' . $nb_courses_per_session . '
</td>
</tr>
</table>
<a href="session.php">' . get_lang('SeeSessionList') . '</a>
</div>';
}
}
echo '<div class="clear"> </div>';
if (api_is_allowed_to_create_course() && $view == 'teacher') {
if ($nb_teacher_courses) {
$table = new SortableTable('tracking_list_course', 'count_teacher_courses');
$parameters['view'] = 'teacher';
$parameters['class'] = 'data_table';
$table->set_additional_parameters($parameters);
$table->set_header(0, get_lang('CourseTitle'), false, 'align="center"');
$table->set_header(1, get_lang('NbStudents'), false);
$table->set_header(2, get_lang('AvgTimeSpentInTheCourse') . Display::return_icon('info3.gif', get_lang('TimeOfActiveByTraining'), array('align' => 'absmiddle', 'hspace' => '3px')), false);
$table->set_header(3, get_lang('AvgStudentsProgress') . Display::return_icon('info3.gif', get_lang('AvgAllUsersInAllCourses'), array('align' => 'absmiddle', 'hspace' => '3px')), false);
$table->set_header(4, get_lang('AvgCourseScore') . Display::return_icon('info3.gif', get_lang('AvgAllUsersInAllCourses'), array('align' => 'absmiddle', 'hspace' => '3px')), false);
$table->set_header(5, get_lang('AvgExercisesScore') . Display::return_icon('info3.gif', get_lang('AvgAllUsersInAllCourses'), array('align' => 'absmiddle', 'hspace' => '3px')), false);
$table->set_header(6, get_lang('AvgMessages'), false);
$table->set_header(7, get_lang('AvgAssignments'), false);
$table->set_header(8, get_lang('Details'), false);
$csv_content[] = array(get_lang('CourseTitle'), get_lang('NbStudents'), get_lang('AvgTimeSpentInTheCourse'), get_lang('AvgStudentsProgress'), get_lang('AvgCourseScore'), get_lang('AvgExercisesScore'), get_lang('AvgMessages'), get_lang('AvgAssignments'));
示例6: isset
*/
$pathopen = isset($_REQUEST['pathopen']) ? $_REQUEST['pathopen'] : null;
// Including the global initialization file
require_once '../inc/global.inc.php';
$current_course_tool = TOOL_TRACKING;
$course_info = api_get_course_info();
$from_myspace = false;
$from = isset($_GET['from']) ? $_GET['from'] : null;
if ($from == 'myspace') {
$from_myspace = true;
$this_section = "session_my_space";
} else {
$this_section = SECTION_COURSES;
}
// Access restrictions.
$is_allowedToTrack = api_is_platform_admin() || api_is_allowed_to_create_course() || api_is_session_admin() || api_is_drh() || api_is_course_tutor();
if (!$is_allowedToTrack) {
api_not_allowed();
exit;
}
// Including additional libraries.
require_once api_get_path(SYS_CODE_PATH) . 'resourcelinker/resourcelinker.inc.php';
// Starting the output buffering when we are exporting the information.
$export_csv = isset($_GET['export']) && $_GET['export'] == 'csv' ? true : false;
$session_id = intval($_REQUEST['id_session']);
if ($export_csv) {
ob_start();
}
if (empty($session_id)) {
$session_id = api_get_session_id();
}
示例7: count_nb_announcement
/**
* @param int $start
* @param string $user_id
* @return int
*/
public static function count_nb_announcement($start = 0, $user_id = '')
{
$start = intval($start);
$visibility = api_is_allowed_to_create_course() ? self::VISIBLE_TEACHER : self::VISIBLE_STUDENT;
$user_selected_language = api_get_interface_language();
$db_table = Database::get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
$sql = 'SELECT id FROM ' . $db_table . ' WHERE (lang="' . $user_selected_language . '" OR lang IS NULL) ';
if (isset($user_id)) {
switch ($visibility) {
case self::VISIBLE_GUEST:
$sql .= " AND visible_guest = 1 ";
break;
case self::VISIBLE_STUDENT:
$sql .= " AND visible_student = 1 ";
break;
case self::VISIBLE_TEACHER:
$sql .= " AND visible_teacher = 1 ";
break;
}
}
$current_access_url_id = 1;
if (api_is_multiple_url_enabled()) {
$current_access_url_id = api_get_current_access_url_id();
}
$sql .= " AND access_url_id = '{$current_access_url_id}' ";
$sql .= 'LIMIT ' . $start . ', 21';
$announcements = Database::query($sql);
$i = 0;
while ($rows = Database::fetch_array($announcements)) {
$i++;
}
return $i;
}
示例8: intval
if (api_is_platform_admin()) {
$user_id = intval($_POST['user_id']);
$list_course_all_info = CourseManager::get_courses_list_by_user_id($user_id, false);
if (!empty($list_course_all_info)) {
foreach ($list_course_all_info as $course_item) {
$course_info = api_get_course_info($course_item['code']);
echo $course_info['title'] . '<br />';
}
} else {
echo get_lang('UserHasNoCourse');
}
}
break;
case 'search_category':
require_once api_get_path(LIBRARY_PATH) . 'course_category.lib.php';
if (api_is_platform_admin() || api_is_allowed_to_create_course()) {
$results = searchCategoryByKeyword($_REQUEST['q']);
if (!empty($results)) {
foreach ($results as &$item) {
$item['id'] = $item['code'];
$item['text'] = '(' . $item['code'] . ') ' . $item['name'];
}
echo json_encode($results);
} else {
echo json_encode(array());
}
}
break;
case 'search_course':
if (api_is_platform_admin()) {
if (!empty($_GET['session_id']) && intval($_GET['session_id'])) {
示例9: getTabs
/**
* Determines the possible tabs (=sections) that are available.
* This function is used when creating the tabs in the third header line and
* all the sections that do not appear there (as determined by the
* platform admin on the Chamilo configuration settings page)
* will appear in the right hand menu that appears on several other pages
* @return array containing all the possible tabs
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
*/
public function getTabs()
{
$_course = api_get_course_info();
$navigation = array();
// Campus Homepage
$navigation[SECTION_CAMPUS]['url'] = $this->urlGenerator->generate('index');
$navigation[SECTION_CAMPUS]['title'] = get_lang('CampusHomepage');
// My Courses
$navigation['mycourses']['url'] = $this->urlGenerator->generate('userportal');
$navigation['mycourses']['title'] = get_lang('MyCourses');
$webCodePath = $this->urlGenerator->generate('root') . '/main/';
// My Profile
if (api_is_profile_readable()) {
$navigation['myprofile']['url'] = $webCodePath . 'auth/profile.php' . (!empty($_course['path']) ? '?coursePath=' . $_course['path'] . '&courseCode=' . $_course['official_code'] : '');
$navigation['myprofile']['title'] = get_lang('ModifyProfile');
}
// Link to my agenda
$navigation['myagenda']['url'] = $webCodePath . 'calendar/agenda_js.php?type=personal';
$navigation['myagenda']['title'] = get_lang('MyAgenda');
// Gradebook
if (api_get_setting('gradebook_enable') == 'true') {
$navigation['mygradebook']['url'] = api_get_path(WEB_CODE_PATH) . 'gradebook/gradebook.php' . (!empty($_course['path']) ? '?coursePath=' . $_course['path'] . '&courseCode=' . $_course['official_code'] : '');
$navigation['mygradebook']['title'] = get_lang('MyGradebook');
}
// Reporting
if (api_is_allowed_to_create_course() || api_is_drh() || api_is_session_admin()) {
// Link to my space
$navigation['session_my_space']['url'] = $webCodePath . 'mySpace/index.php';
$navigation['session_my_space']['title'] = get_lang('MySpace');
} else {
// Link to my progress
$navigation['session_my_progress']['url'] = $webCodePath . 'auth/my_progress.php';
$navigation['session_my_progress']['title'] = get_lang('MyProgress');
}
// Social
if (api_get_setting('social.allow_social_tool') == 'true') {
$navigation['social']['url'] = $webCodePath . 'social/home.php';
$navigation['social']['title'] = get_lang('SocialNetwork');
}
// Dashboard
if (api_is_platform_admin() || api_is_drh() || api_is_session_admin()) {
$navigation['dashboard']['url'] = $webCodePath . 'dashboard/index.php';
$navigation['dashboard']['title'] = get_lang('Dashboard');
}
// Custom tabs
for ($i = 1; $i <= 3; $i++) {
if (api_get_setting('custom_tab_' . $i . '_name') && api_get_setting('custom_tab_' . $i . '_url')) {
$navigation['custom_tab_' . $i]['url'] = api_get_setting('custom_tab_' . $i . '_url');
$navigation['custom_tab_' . $i]['title'] = api_get_setting('custom_tab_' . $i . '_name');
}
}
// Adding block settings for each role
if (isset($this->app['allow_admin_toolbar'])) {
$roleTemplate = array();
foreach ($this->app['allow_admin_toolbar'] as $role) {
if ($this->security->getToken() && $this->security->isGranted($role)) {
// Fixes in order to match the templates
if ($role == 'ROLE_ADMIN') {
$role = 'administrator';
}
if ($role == 'ROLE_QUESTION_MANAGER') {
$role = 'QUESTION_MANAGER';
}
$stripRole = strtolower(str_replace('ROLE_', '', $role));
$roleTemplate[] = $stripRole;
}
}
if (!empty($roleTemplate)) {
if (api_get_setting('show_tabs', 'platform_administration') == 'true') {
//$navigation['admin']['url'] = api_get_path(WEB_PUBLIC_PATH).'admin';
//$navigation['admin']['title'] = get_lang('PlatformAdmin');
}
}
$this->app['admin_toolbar_roles'] = $roleTemplate;
}
return $navigation;
}
示例10: returnNavigationArray
/**
* Gets the main menu
*
* @return array
*/
public function returnNavigationArray()
{
$navigation = array();
$menu_navigation = array();
$possible_tabs = $this->getTabs();
// Campus Homepage
if (api_get_setting('show_tabs', 'campus_homepage') == 'true') {
$navigation[SECTION_CAMPUS] = $possible_tabs[SECTION_CAMPUS];
} else {
$menu_navigation[SECTION_CAMPUS] = $possible_tabs[SECTION_CAMPUS];
}
if (api_get_user_id() && !api_is_anonymous()) {
// My Courses
if (api_get_setting('show_tabs', 'my_courses') == 'true') {
$navigation['mycourses'] = $possible_tabs['mycourses'];
} else {
$menu_navigation['mycourses'] = $possible_tabs['mycourses'];
}
// My Profile
if (api_get_setting('show_tabs', 'my_profile') == 'true' && api_get_setting('allow_social_tool') != 'true') {
if (isset($possible_tabs['myprofile'])) {
$navigation['myprofile'] = $possible_tabs['myprofile'];
}
} else {
if (isset($possible_tabs['myprofile'])) {
$menu_navigation['myprofile'] = $possible_tabs['myprofile'];
}
}
// My Agenda
if (api_get_setting('show_tabs', 'my_agenda') == 'true') {
$navigation['myagenda'] = $possible_tabs['myagenda'];
} else {
$menu_navigation['myagenda'] = $possible_tabs['myagenda'];
}
// Gradebook
if (api_get_setting('gradebook_enable') == 'true') {
if (api_get_setting('show_tabs', 'my_gradebook') == 'true') {
$navigation['mygradebook'] = $possible_tabs['mygradebook'];
} else {
$menu_navigation['mygradebook'] = $possible_tabs['mygradebook'];
}
}
// Reporting
if (api_get_setting('show_tabs', 'reporting') == 'true') {
if (api_is_allowed_to_create_course() || api_is_drh() || api_is_session_admin()) {
$navigation['session_my_space'] = $possible_tabs['session_my_space'];
} else {
$navigation['session_my_space'] = $possible_tabs['session_my_progress'];
}
} else {
if (api_is_allowed_to_create_course() || api_is_drh() || api_is_session_admin()) {
$menu_navigation['session_my_space'] = $possible_tabs['session_my_space'];
} else {
$menu_navigation['session_my_space'] = $possible_tabs['session_my_progress'];
}
}
// Social Networking
if (api_get_setting('show_tabs', 'social') == 'true') {
if (api_get_setting('allow_social_tool') == 'true') {
$navigation['social'] = $possible_tabs['social'];
}
} else {
$menu_navigation['social'] = isset($possible_tabs['social']) ? $possible_tabs['social'] : null;
}
// Dashboard
if (api_get_setting('show_tabs', 'dashboard') == 'true') {
if (api_is_platform_admin() || api_is_drh() || api_is_session_admin()) {
$navigation['dashboard'] = $possible_tabs['dashboard'];
}
} else {
$menu_navigation['dashboard'] = isset($possible_tabs['dashboard']) ? $possible_tabs['dashboard'] : null;
}
if (isset($possible_tabs['admin'])) {
$navigation['platform_admin'] = $possible_tabs['admin'];
$navigation['platform_admin'] = $possible_tabs['admin'];
}
// Reports
if (!empty($possible_tabs['reports'])) {
if (api_get_setting('show_tabs', 'reports') == 'true') {
if ((api_is_platform_admin() || api_is_drh() || api_is_session_admin()) && Rights::hasRight('show_tabs:reports')) {
$navigation['reports'] = $possible_tabs['reports'];
}
} else {
$menu_navigation['reports'] = $possible_tabs['reports'];
}
}
// Custom tabs
for ($i = 1; $i <= 3; $i++) {
if (api_get_setting('show_tabs', 'custom_tab_' . $i) == 'true') {
if (isset($possible_tabs['custom_tab_' . $i])) {
$navigation['custom_tab_' . $i] = $possible_tabs['custom_tab_' . $i];
}
} else {
if (isset($possible_tabs['custom_tab_' . $i])) {
$menu_navigation['custom_tab_' . $i] = $possible_tabs['custom_tab_' . $i];
//.........这里部分代码省略.........
示例11: rsort_users
} else {
return -1;
}
}
function rsort_users($a, $b)
{
global $tracking_column;
if ($b[$tracking_column] > $a[$tracking_column]) {
return 1;
} else {
return -1;
}
}
/* MAIN CODE */
//if ($isCoach || api_is_platform_admin() || api_is_drh()) {
if (api_is_allowed_to_create_course() || api_is_drh()) {
if ($export_csv) {
$is_western_name_order = api_is_western_name_order(PERSON_NAME_DATA_EXPORT);
} else {
$is_western_name_order = api_is_western_name_order();
}
$sort_by_first_name = api_sort_by_first_name();
if (api_is_drh()) {
$menu_items = array();
$menu_items[] = Display::url(Display::return_icon('stats.png', get_lang('MyStats'), '', ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH) . "auth/my_progress.php");
$menu_items[] = Display::return_icon('user_na.png', get_lang('Students'), array(), 32);
$menu_items[] = Display::url(Display::return_icon('teacher.png', get_lang('Trainers'), array(), 32), 'teachers.php');
$menu_items[] = Display::url(Display::return_icon('course.png', get_lang('Courses'), array(), 32), 'course.php');
$menu_items[] = Display::url(Display::return_icon('session.png', get_lang('Sessions'), array(), 32), 'session.php');
echo '<div class="actions">';
$nb_menu_items = count($menu_items);
示例12: get_courses_list_by_session
/**
* Gives a list of courses for the given user in the given session
* @param integer $user_id
* @return array list of statuses (session_id-course_code => status)
*/
public static function get_courses_list_by_session($user_id, $session_id)
{
// Database Table Definitions
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$user_id = intval($user_id);
$session_id = intval($session_id);
//we filter the courses from the URL
$join_access_url = $where_access_url = '';
if (api_get_multiple_access_url()) {
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) {
$tbl_url_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
$join_access_url = " , {$tbl_url_session} url_rel_session ";
$where_access_url = " AND access_url_id = {$access_url_id} AND url_rel_session.session_id = {$session_id} ";
}
}
$personal_course_list = array();
$courses = array();
// this query is very similar to the above query, but it will check the session_rel_course_user table if there are courses registered to our user or not
$personal_course_list_sql = "SELECT DISTINCT scu.c_id as id\n FROM {$tbl_session_course_user} as scu {$join_access_url}\n WHERE scu.id_user = {$user_id} AND scu.id_session = {$session_id} {$where_access_url}\n ORDER BY c_id";
$course_list_sql_result = Database::query($personal_course_list_sql);
if (Database::num_rows($course_list_sql_result) > 0) {
while ($result_row = Database::fetch_array($course_list_sql_result)) {
$result_row['status'] = 5;
if (!in_array($result_row['id'], $courses)) {
$personal_course_list[] = $result_row;
$courses[] = $result_row['id'];
}
}
}
if (api_is_allowed_to_create_course()) {
$personal_course_list_sql = "SELECT DISTINCT scu.c_id as id\n FROM {$tbl_session_course_user} as scu, {$tbl_session} as s {$join_access_url}\n WHERE s.id = {$session_id} AND scu.id_session = s.id AND ((scu.id_user={$user_id} AND scu.status=2) OR s.id_coach = {$user_id})\n {$where_access_url}\n ORDER BY c_id";
$course_list_sql_result = Database::query($personal_course_list_sql);
if (Database::num_rows($course_list_sql_result) > 0) {
while ($result_row = Database::fetch_array($course_list_sql_result)) {
$result_row['status'] = 2;
if (!in_array($result_row['id'], $courses)) {
$personal_course_list[] = $result_row;
$courses[] = $result_row['id'];
}
}
}
}
if (api_is_drh()) {
$session_list = SessionManager::get_sessions_followed_by_drh($user_id);
$session_list = array_keys($session_list);
if (in_array($session_id, $session_list)) {
$course_list = SessionManager::get_course_list_by_session_id($session_id);
if (!empty($course_list)) {
foreach ($course_list as $course) {
$personal_course_list[] = $course;
}
}
}
} else {
//check if user is general coach for this session
$s = api_get_session_info($session_id);
if ($s['id_coach'] == $user_id) {
$course_list = SessionManager::get_course_list_by_session_id($session_id);
if (!empty($course_list)) {
foreach ($course_list as $course) {
if (!in_array($course['id'], $courses)) {
$personal_course_list[] = $course;
}
}
}
}
}
return $personal_course_list;
}
示例13: get_lang
<?php
/* For licensing terms, see /license.txt */
// including necessary files
require_once 'main/inc/global.inc.php';
$tool_name = get_lang('SystemAnnouncements');
$actions = '';
if (api_is_platform_admin()) {
$actions = '<a href="' . api_get_path(WEB_PATH) . 'main/admin/system_announcements.php">' . Display::return_icon('edit.png', get_lang('EditSystemAnnouncement'), array(), 32) . '</a>';
}
if (api_is_anonymous()) {
$visibility = SystemAnnouncementManager::VISIBLE_GUEST;
} else {
$visibility = api_is_allowed_to_create_course() ? SystemAnnouncementManager::VISIBLE_TEACHER : SystemAnnouncementManager::VISIBLE_STUDENT;
}
if (!isset($_GET['id']) || empty($_GET['id'])) {
$content = SystemAnnouncementManager::display_announcements_slider($visibility, $_GET['id']);
} else {
$content = SystemAnnouncementManager::displayAnnouncement($_GET['id'], $visibility);
}
$tpl = new Template($tool_name);
$tpl->assign('actions', $actions);
//$tpl->assign('message', $message);
$tpl->assign('content', $content);
$tpl->display_one_col_template();
示例14: count
$count_sessions = count($sessions);
}
if ($count_courses || $count_sessions) {
// If we are in course.
if (empty($session_id)) {
if ($count_courses) {
$title = '<img src="' . api_get_path(WEB_IMG_PATH) . 'course.gif"> ' . get_lang('Courses') . ' (' . $count_courses . ') ';
}
} else {
//If we are in Course Session
$session_name = api_get_session_name($session_id);
$title = Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL) . ' ' . $session_name;
$menu_items[] = '<a href="' . api_get_self() . '?view=teacher">' . get_lang('TeacherInterface') . '</a>';
}
}
if ((api_is_allowed_to_create_course() || api_is_drh()) && in_array($view, array('teacher', 'drh'))) {
//Courses
if ($count_courses) {
echo Display::page_subheader($title);
$data = MySpace::get_course_data(null, null, null, null, $courses, $csv_content, $charset);
$table = new SortableTable('courses_my_space', 'get_number_of_courses');
$parameters['view'] = 'teacher';
$parameters['class'] = 'data_table';
$table->set_additional_parameters($parameters);
$table->set_header(0, get_lang('CourseTitle'), false);
$table->set_header(1, get_lang('NbStudents'), false);
$table->set_header(2, get_lang('AvgTimeSpentInTheCourse') . ' ' . Display::return_icon('info3.gif', get_lang('TimeOfActiveByTraining'), array('align' => 'absmiddle', 'hspace' => '3px')), false);
$table->set_header(3, get_lang('AvgStudentsProgress') . ' ' . Display::return_icon('info3.gif', get_lang('AvgAllUsersInAllCourses'), array('align' => 'absmiddle', 'hspace' => '3px')), false);
$table->set_header(4, get_lang('AvgCourseScore') . ' ' . Display::return_icon('info3.gif', get_lang('AvgAllUsersInAllCourses'), array('align' => 'absmiddle', 'hspace' => '3px')), false);
$table->set_header(5, get_lang('AvgExercisesScore') . ' ' . Display::return_icon('info3.gif', get_lang('AvgAllUsersInAllCourses'), array('align' => 'absmiddle', 'hspace' => '3px')), false);
$table->set_header(6, get_lang('AvgMessages'), false);
示例15: injectMainMenuEntry
/**
* Add a "Videocast" entry to the main menu under conditions
*
* @param string $content
*
* @return string|false String if the content has been altered, FALSE otherwise
*/
protected function injectMainMenuEntry($content)
{
global $this_section;
// The user must be authenticated
if (!api_get_user_id()) {
return false;
}
// The user must be able to create courses to access its briefcase
if (!api_is_allowed_to_create_course() and !api_is_session_admin()) {
return false;
}
return preg_replace('/(<ul id="dokeostabs">.+)<\\/ul>/m', sprintf('${1}<a href="%s" target="_top"><li class="tab_libcast%s"><div><span>Videocast</span></div></li></a></ul>', $this->getHomeUrl() . '/briefcase.php', $this_section == 'libcast' ? '_current' : ''), $content);
}