本文整理汇总了PHP中CourseManager::get_access_settings方法的典型用法代码示例。如果您正苦于以下问题:PHP CourseManager::get_access_settings方法的具体用法?PHP CourseManager::get_access_settings怎么用?PHP CourseManager::get_access_settings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CourseManager
的用法示例。
在下文中一共展示了CourseManager::get_access_settings方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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, $class = 'courses', $session_accessible = true, $load_dirs = false)
{
$entityManager = Database::getManager();
$user_id = api_get_user_id();
$course_info = api_get_course_info_by_id($course['real_id']);
$status_course = CourseManager::get_user_in_course_status($user_id, $course_info['code']);
$course_info['status'] = empty($session_id) ? $status_course : STUDENT;
$course_info['id_session'] = $session_id;
$objUser = $entityManager->find('ChamiloUserBundle:User', $user_id);
$objCourse = $entityManager->find('ChamiloCoreBundle:Course', $course['real_id']);
$objSession = $entityManager->find('ChamiloCoreBundle:Session', $session_id);
/*$date_start = $sess[$course_info['id_session']]['access_start_date'];
$date_end = $sess[$course_info['id_session']]['access_end_date'];*/
$now = date('Y-m-d h:i:s');
// Table definitions
$main_user_table = Database::get_main_table(TABLE_MAIN_USER);
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_session_category = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY);
$course_access_settings = CourseManager::get_access_settings($course_info['code']);
$course_visibility = $course_access_settings['visibility'];
if ($course_visibility == COURSE_VISIBILITY_HIDDEN) {
return '';
}
$user_in_course_status = CourseManager::get_user_in_course_status(api_get_user_id(), $course_info['code']);
$is_coach = api_is_coach($course_info['id_session'], $course_info['real_id']);
// Display course entry.
// Show a hyperlink to the course, unless the course is closed and user is not course admin.
$session_url = '';
$session_title = '';
$params = array();
$params['icon'] = Display::return_icon('blackboard_blue.png', api_htmlentities($course_info['name']), array(), ICON_SIZE_LARGE);
// Display the "what's new" icons
$notifications = '';
if ($course_visibility != COURSE_VISIBILITY_CLOSED && $course_visibility != COURSE_VISIBILITY_HIDDEN) {
$notifications .= Display::show_notification($course_info);
}
if ($session_accessible) {
if ($course_visibility != COURSE_VISIBILITY_CLOSED || $user_in_course_status == COURSEMANAGER) {
if (empty($course_info['id_session'])) {
$course_info['id_session'] = 0;
}
$sessionCourseAvailable = false;
$sessionCourseStatus = api_get_session_visibility($session_id, $course_info['real_id']);
if (in_array($sessionCourseStatus, array(SESSION_VISIBLE_READ_ONLY, SESSION_VISIBLE, SESSION_AVAILABLE))) {
$sessionCourseAvailable = true;
}
if ($user_in_course_status == COURSEMANAGER || $sessionCourseAvailable) {
$session_url = $course_info['course_public_url'] . '?id_session=' . $course_info['id_session'];
$session_title = '<h4><a href="' . $session_url . '">' . $course_info['name'] . '</a>' . $notifications . '</h4>';
} else {
$session_title = $course_info['name'];
}
} else {
$session_title = $course_info['name'] . ' ' . Display::tag('span', get_lang('CourseClosed'), array('class' => 'item_closed'));
}
} else {
$session_title = $course_info['name'];
}
$showCustomIcon = api_get_setting('course.course_images_in_courses_list');
$iconName = basename($course_info['course_image']);
if ($showCustomIcon === 'true' && $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('course.display_coursecode_in_courselist') == 'true') {
$session_title .= ' (' . $course_info['visual_code'] . ') ';
}
//.........这里部分代码省略.........
示例2: get_logged_user_course_html
/**
* Helper functions definition
*/
public static function get_logged_user_course_html($my_course, $count)
{
$result = '';
// Table definitions
$main_user_table = Database::get_main_table(TABLE_MAIN_USER);
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$course_code = $my_course['code'];
$course_directory = $my_course['course_info']['directory'];
$course_title = $my_course['course_info']['title'];
$course_access_settings = CourseManager::get_access_settings($course_code);
$course_visibility = $course_access_settings['visibility'];
$user_in_course_status = CourseManager::get_user_in_course_status(api_get_user_id(), $course_code);
//$valor = api_get_settings_params();
$course_path = api_get_path(SYS_COURSE_PATH) . $course_directory;
// course path
if (api_get_setting('course.course_images_in_courses_list') === 'true') {
if (file_exists($course_path . '/course-pic85x85.png')) {
$image = $my_course['course_info']['course_image'];
$imageCourse = Display::img($image, $course_title, array('class' => 'img-course'));
} else {
$imageCourse = Display::return_icon('session_default_small.png', $course_title, array('class' => 'img-course'));
}
} else {
$imageCourse = Display::return_icon('course.png', get_lang('Course'), array('class' => 'img-default'));
}
//display course entry
if (api_get_setting('course.course_images_in_courses_list') === 'true') {
$result .= '<li id="course_' . $count . '" class="list-group-item" style="min-height:65px;">';
} else {
$result .= '<li id="course_' . $count . '" class="list-group-item" style="min-height:44px;">';
}
$result .= $imageCourse;
//show a hyperlink to the course, unless the course is closed and user is not course admin
if ($course_visibility != COURSE_VISIBILITY_HIDDEN && ($course_visibility != COURSE_VISIBILITY_CLOSED || $user_in_course_status == COURSEMANAGER)) {
$result .= '<span class="title">' . $course_title . '<span>';
} else {
$result .= $course_title . " " . " " . get_lang('CourseClosed') . "";
}
$result .= '</li>';
$session = '';
if (!empty($my_course['session_name']) && !empty($my_course['id_session'])) {
// Request for the name of the general coach
$sql = 'SELECT lastname, firstname
FROM ' . $tbl_session . ' ts
LEFT JOIN ' . $main_user_table . ' tu
ON ts.id_coach = tu.user_id
WHERE ts.id=' . (int) $my_course['id_session'] . ' LIMIT 1';
$rs = Database::query($sql);
$sessioncoach = Database::store_result($rs);
$sessioncoach = $sessioncoach[0];
$session = array();
$session['title'] = $my_course['session_name'];
if ($my_course['access_start_date'] == '0000-00-00') {
$session['dates'] = get_lang('WithoutTimeLimits');
if (api_get_setting('session.show_session_coach') === 'true') {
$session['coach'] = get_lang('GeneralCoach') . ': ' . api_get_person_name($sessioncoach['firstname'], $sessioncoach['lastname']);
}
} else {
$session['dates'] = ' - ' . get_lang('From') . ' ' . $my_course['access_start_date'] . ' ' . get_lang('To') . ' ' . $my_course['access_end_date'];
if (api_get_setting('session.show_session_coach') === 'true') {
$session['coach'] = get_lang('GeneralCoach') . ': ' . api_get_person_name($sessioncoach['firstname'], $sessioncoach['lastname']);
}
}
}
$my_course['id_session'] = isset($my_course['id_session']) ? $my_course['id_session'] : 0;
$output = array($my_course['user_course_cat'], $result, $my_course['id_session'], $session);
return $output;
}
示例3: get_lang
* @package chamilo.course_info
*/
$current_course_tool = TOOL_COURSE_SETTING;
$this_section = SECTION_COURSES;
$nameTools = get_lang('ModifInfo');
api_protect_course_script(true);
api_block_anonymous_users();
$_course = api_get_course_info();
/* Constants and variables */
define('MODULE_HELP_NAME', 'Settings');
define('COURSE_CHANGE_PROPERTIES', 'COURSE_CHANGE_PROPERTIES');
$currentCourseRepository = $_course['path'];
$is_allowedToEdit = $is_courseAdmin || $is_platformAdmin;
$course_code = api_get_course_id();
$courseId = api_get_course_int_id();
$course_access_settings = CourseManager::get_access_settings($course_code);
//LOGIC FUNCTIONS
function is_settings_editable()
{
return true;
//return isset($GLOBALS['course_info_is_editable']) && $GLOBALS['course_info_is_editable'];
}
/* MAIN CODE */
if (!$is_allowedToEdit) {
api_not_allowed(true);
}
$htmlHeadXtra[] = api_get_css('components/cropper/dist/cropper.min.css');
$htmlHeadXtra[] = api_get_js('components/cropper/dist/cropper.min.js');
$htmlHeadXtra[] = '<script>
$(document).ready(function() {
var $image = $("#previewImage");
示例4: get_logged_user_course_html
/**
* Helper functions definition
*/
public static function get_logged_user_course_html($my_course, $count)
{
//initialise
$result = '';
$course_code = $my_course['code'];
$course_title = $my_course['course_info']['title'];
$course_id = $my_course['course_info']['real_id'];
$course_access_settings = CourseManager::get_access_settings($course_code);
$course_visibility = $course_access_settings['visibility'];
$user_in_course_status = CourseManager::get_user_in_course_status(api_get_user_id(), $course_code);
$s_htlm_status_icon = Display::return_icon('course.gif', get_lang('Course'));
//display course entry
$result .= '<div id="div_' . $count . '">';
$result .= '<h3>' . Display::return_icon('nolines_plus.gif', null, array('id' => 'btn_' . $count, 'onclick' => 'toogle_course(this,\'' . $course_id . '\' )'));
$result .= $s_htlm_status_icon;
//show a hyperlink to the course, unless the course is closed and user is not course admin
if ($course_visibility != COURSE_VISIBILITY_HIDDEN && ($course_visibility != COURSE_VISIBILITY_CLOSED || $user_in_course_status == COURSEMANAGER)) {
$result .= '<a href="javascript:void(0)" id="ln_' . $count . '" onclick=toogle_course(this,\'' . $course_id . '\');> ' . $course_title . '</a>';
} else {
$result .= $course_title . " " . " " . get_lang('CourseClosed') . "";
}
$result .= '</h3>';
$result .= '</li>';
$result .= '</div>';
return $result;
}
示例5: get_logged_user_course_html
/**
* Helper functions definition
*/
public static function get_logged_user_course_html($my_course, $count)
{
global $nosession, $nbDigestEntries, $orderKey, $digest, $thisCourseSysCode;
if (!$nosession) {
global $now, $date_start, $date_end;
}
//initialise
$result = '';
// Table definitions
$main_user_table = Database :: get_main_table(TABLE_MAIN_USER);
$tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
$course_code = $my_course['code'];
$course_visual_code = $my_course['course_info']['official_code'];
$course_title = $my_course['course_info']['title'];
$course_info = Database :: get_course_info($course_code);
$course_id = $course_info['real_id'];
$course_access_settings = CourseManager :: get_access_settings($course_code);
$course_visibility = $course_access_settings['visibility'];
$user_in_course_status = CourseManager :: get_user_in_course_status(api_get_user_id(), $course_code);
//function logic - act on the data
$is_virtual_course = CourseManager :: is_virtual_course_from_system_code($course_code);
if ($is_virtual_course) {
// If the current user is also subscribed in the real course to which this
// virtual course is linked, we don't need to display the virtual course entry in
// the course list - it is combined with the real course entry.
$target_course_code = CourseManager :: get_target_of_linked_course($course_code);
$is_subscribed_in_target_course = CourseManager :: is_user_subscribed_in_course(api_get_user_id(), $target_course_code);
if ($is_subscribed_in_target_course) {
return; //do not display this course entry
}
}
$s_htlm_status_icon = Display::return_icon('course.gif', get_lang('Course'));
//display course entry
$result .= '<div id="div_'.$count.'">';
//$result .= '<h3><img src="../img/nolines_plus.gif" id="btn_'.$count.'" onclick="toogle_course(this,\''.$course_id.'\' )">';
$result .= $s_htlm_status_icon;
//show a hyperlink to the course, unless the course is closed and user is not course admin
if ($course_visibility != COURSE_VISIBILITY_HIDDEN && ($course_visibility != COURSE_VISIBILITY_CLOSED || $user_in_course_status == COURSEMANAGER)) {
//$result .= '<a href="javascript:void(0)" id="ln_'.$count.'" onclick=toogle_course(this,\''.$course_id.'\');> '.$course_title.'</a>';
$result .= $course_title;
} else {
$result .= $course_title." "." ".get_lang('CourseClosed')."";
}
$result .= '</h3>';
//$current_course_settings = CourseManager :: get_access_settings($my_course['k']);
// display the what's new icons
/*if ($nbDigestEntries > 0) {
reset($digest);
$result .= '<ul>';
while (list ($key2) = each($digest[$thisCourseSysCode])) {
$result .= '<li>';
if ($orderKey[1] == 'keyTools') {
$result .= "<a href=\"$toolsList[$key2] [\"path\"] $thisCourseSysCode \">";
$result .= "$toolsList[$key2][\"name\"]</a>";
} else {
$result .= api_convert_and_format_date($key2, DATE_FORMAT_LONG, date_default_timezone_get());
}
$result .= '</li>';
$result .= '<ul>';
reset($digest[$thisCourseSysCode][$key2]);
while (list ($key3, $dataFromCourse) = each($digest[$thisCourseSysCode][$key2])) {
$result .= '<li>';
if ($orderKey[2] == 'keyTools') {
$result .= "<a href=\"$toolsList[$key3] [\"path\"] $thisCourseSysCode \">";
$result .= "$toolsList[$key3][\"name\"]</a>";
} else {
$result .= api_convert_and_format_date($key3, DATE_FORMAT_LONG, date_default_timezone_get());
}
$result .= '<ul compact="compact">';
reset($digest[$thisCourseSysCode][$key2][$key3]);
while (list ($key4, $dataFromCourse) = each($digest[$thisCourseSysCode][$key2][$key3])) {
$result .= '<li>';
$result .= htmlspecialchars(substr(strip_tags($dataFromCourse), 0, CONFVAL_NB_CHAR_FROM_CONTENT));
$result .= '</li>';
}
$result .= '</ul>';
$result .= '</li>';
}
$result .= '</ul>';
$result .= '</li>';
}
$result .= '</ul>';
}*/
$result .= '</li>';
$result .= '</div>';
if (!$nosession) {
$session = '';
//.........这里部分代码省略.........