本文整理汇总了PHP中CourseManager::get_user_in_course_status方法的典型用法代码示例。如果您正苦于以下问题:PHP CourseManager::get_user_in_course_status方法的具体用法?PHP CourseManager::get_user_in_course_status怎么用?PHP CourseManager::get_user_in_course_status使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CourseManager
的用法示例。
在下文中一共展示了CourseManager::get_user_in_course_status方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_myagendaitems
/**
* This function retrieves all the agenda items of all the courses the user is subscribed to
*/
function get_myagendaitems($user_id, $courses_dbs, $month, $year)
{
global $setting_agenda_link;
$user_id = intval($user_id);
$items = array();
$my_list = array();
// get agenda-items for every course
foreach ($courses_dbs as $key => $array_course_info) {
//databases of the courses
$TABLEAGENDA = Database::get_course_table(TABLE_AGENDA);
$TABLE_ITEMPROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
$group_memberships = GroupManager::get_group_ids($array_course_info["real_id"], $user_id);
$course_user_status = CourseManager::get_user_in_course_status($user_id, $array_course_info["code"]);
// if the user is administrator of that course we show all the agenda items
if ($course_user_status == '1') {
//echo "course admin";
$sqlquery = "SELECT DISTINCT agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref\n\t\t\t\t\t\t\tFROM " . $TABLEAGENDA . " agenda,\n\t\t\t\t\t\t\t\t " . $TABLE_ITEMPROPERTY . " ip\n\t\t\t\t\t\t\tWHERE agenda.id = ip.ref\n\t\t\t\t\t\t\tAND MONTH(agenda.start_date)='" . $month . "'\n\t\t\t\t\t\t\tAND YEAR(agenda.start_date)='" . $year . "'\n\t\t\t\t\t\t\tAND ip.tool='" . TOOL_CALENDAR_EVENT . "'\n\t\t\t\t\t\t\tAND ip.visibility='1'\n\t\t\t\t\t\t\tGROUP BY agenda.id\n\t\t\t\t\t\t\tORDER BY start_date ";
} else {
// if the user is not an administrator of that course
if (is_array($group_memberships) && count($group_memberships) > 0) {
$sqlquery = "SELECT\tagenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref\n\t\t\t\t\t\t\t\tFROM " . $TABLEAGENDA . " agenda,\n\t\t\t\t\t\t\t\t\t" . $TABLE_ITEMPROPERTY . " ip\n\t\t\t\t\t\t\t\tWHERE agenda.id = ip.ref\n\t\t\t\t\t\t\t\tAND MONTH(agenda.start_date)='" . $month . "'\n\t\t\t\t\t\t\t\tAND YEAR(agenda.start_date)='" . $year . "'\n\t\t\t\t\t\t\t\tAND ip.tool='" . TOOL_CALENDAR_EVENT . "'\n\t\t\t\t\t\t\t\tAND\t( ip.to_user_id='" . $user_id . "' OR ip.to_group_id IN (0, " . implode(", ", $group_memberships) . ") )\n\t\t\t\t\t\t\t\tAND ip.visibility='1'\n\t\t\t\t\t\t\t\tORDER BY start_date ";
} else {
$sqlquery = "SELECT agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref\n\t\t\t\t\t\t\t\tFROM " . $TABLEAGENDA . " agenda,\n\t\t\t\t\t\t\t\t\t" . $TABLE_ITEMPROPERTY . " ip\n\t\t\t\t\t\t\t\tWHERE agenda.id = ip.ref\n\t\t\t\t\t\t\t\tAND MONTH(agenda.start_date)='" . $month . "'\n\t\t\t\t\t\t\t\tAND YEAR(agenda.start_date)='" . $year . "'\n\t\t\t\t\t\t\t\tAND ip.tool='" . TOOL_CALENDAR_EVENT . "'\n\t\t\t\t\t\t\t\tAND ( ip.to_user_id='" . $user_id . "' OR ip.to_group_id='0')\n\t\t\t\t\t\t\t\tAND ip.visibility='1'\n\t\t\t\t\t\t\t\tORDER BY start_date ";
}
}
$result = Database::query($sqlquery);
while ($item = Database::fetch_array($result, 'ASSOC')) {
$agendaday = -1;
if ($item['start_date'] != '0000-00-00 00:00:00') {
$item['start_date'] = api_get_local_time($item['start_date']);
$item['start_date_tms'] = api_strtotime($item['start_date']);
$agendaday = date("j", $item['start_date_tms']);
}
if ($item['end_date'] != '0000-00-00 00:00:00') {
$item['end_date'] = api_get_local_time($item['end_date']);
}
$url = api_get_path(WEB_CODE_PATH) . "calendar/agenda.php?cidReq=" . urlencode($array_course_info["code"]) . "&day={$agendaday}&month={$month}&year={$year}#{$agendaday}";
$item['url'] = $url;
$item['course_name'] = $array_course_info['title'];
$item['calendar_type'] = 'course';
$item['course_id'] = $array_course_info['course_id'];
$my_list[$agendaday][] = $item;
}
}
// sorting by hour for every day
$agendaitems = array();
while (list($agendaday, $tmpitems) = each($items)) {
if (!isset($agendaitems[$agendaday])) {
$agendaitems[$agendaday] = '';
}
sort($tmpitems);
while (list($key, $val) = each($tmpitems)) {
$agendaitems[$agendaday] .= $val;
}
}
return $my_list;
}
示例2: get_users_rel_course
/**
* Get registered users inside current course
* @param int $attendance_id attendance id for showing attendance result field (optional)
* @param int $groupId
* @return array users data
*/
public function get_users_rel_course($attendance_id = 0, $groupId = null)
{
$current_session_id = api_get_session_id();
$current_course_id = api_get_course_id();
$currentCourseIntId = api_get_course_int_id();
$studentInGroup = array();
if (!empty($current_session_id)) {
$a_course_users = CourseManager::get_user_list_from_course_code($current_course_id, $current_session_id, '', 'lastname');
} else {
$a_course_users = CourseManager::get_user_list_from_course_code($current_course_id, 0, '', 'lastname');
if (!empty($groupId)) {
$students = GroupManager::getStudents($groupId);
if (!empty($students)) {
foreach ($students as $student) {
$studentInGroup[$student['user_id']] = true;
}
}
}
}
// get registered users inside current course
$a_users = array();
foreach ($a_course_users as $key => $user_data) {
$value = array();
$uid = $user_data['user_id'];
$userInfo = api_get_user_info($uid);
$status = $user_data['status'];
if (!empty($groupId)) {
if (!isset($studentInGroup[$uid])) {
continue;
}
}
$user_status_in_session = null;
$user_status_in_course = null;
if (api_get_session_id()) {
$user_status_in_session = SessionManager::get_user_status_in_course_session($uid, $currentCourseIntId, $current_session_id);
} else {
$user_status_in_course = CourseManager::get_user_in_course_status($uid, $current_course_id);
}
// Not taking into account DRH or COURSEMANAGER
if ($uid <= 1 || $status == DRH || $user_status_in_course == COURSEMANAGER || $user_status_in_session == 2) {
continue;
}
if (!empty($attendance_id)) {
$user_faults = $this->get_faults_of_user($uid, $attendance_id, $groupId);
$value['attendance_result'] = $user_faults['faults'] . '/' . $user_faults['total'] . ' (' . $user_faults['faults_porcent'] . '%)';
$value['result_color_bar'] = $user_faults['color_bar'];
}
$photo = Display::img($userInfo['avatar_small'], $userInfo['complete_name'], [], false);
$value['photo'] = $photo;
$value['firstname'] = $user_data['firstname'];
$value['lastname'] = $user_data['lastname'];
$value['username'] = $user_data['username'];
$value['user_id'] = $uid;
//Sending only 5 items in the array instead of 60
$a_users[$key] = $value;
}
return $a_users;
}
示例3: array
$row = array();
$row[] = Display::url($url['url'], $url['url']);
$csvContent[] = array_map('strip_tags', $row);
$data[] = $row;
}
$urlInformation = Display::page_subheader(get_lang('URLList'));
$urlInformation .= Display::return_sortable_table($header, $data, array(), array(), array('user_id' => intval($_GET['user_id'])));
} else {
$urlInformation = '<p>' . get_lang('NoUrlForThisUser') . '</p>';
}
}
$message = null;
if (isset($_GET['action'])) {
switch ($_GET['action']) {
case 'unsubscribe':
if (CourseManager::get_user_in_course_status($_GET['user_id'], $_GET['course_code']) == STUDENT) {
CourseManager::unsubscribe_user($_GET['user_id'], $_GET['course_code'], $_GET['id_session']);
$message = Display::return_message(get_lang('UserUnsubscribed'));
} else {
$message = Display::return_message(get_lang('CannotUnsubscribeUserFromCourse'), 'error');
}
break;
case 'unsubscribeSessionCourse':
SessionManager::removeUsersFromCourseSession(array($_GET['user_id']), $_GET['id_session'], api_get_course_info($_GET['course_code']));
$message = Display::return_message(get_lang('UserUnsubscribed'));
break;
case 'export':
Export::arrayToCsv($csvContent, 'user_information_' . $user);
exit;
break;
}
示例4: display_header_gradebook
/**
* Displays the header for the gradebook containing the navigation tree and links
* @param Category $catobj
* @param int $showtree '1' will show the browse tree and naviation buttons
* @param boolean $is_course_admin
* @param boolean $is_platform_admin
* @param boolean Whether to show or not the link to add a new qualification
* (we hide it in case of the course-embedded tool where we have only one
* calification per course or session)
* @param boolean Whether to show or not the link to add a new item inside
* the qualification (we hide it in case of the course-embedded tool
* where we have only one calification per course or session)
* @return void Everything is printed on screen upon closing
*/
static function display_header_gradebook($catobj, $showtree, $selectcat, $is_course_admin, $is_platform_admin, $simple_search_form, $show_add_qualification = true, $show_add_link = true, $certificateLinkInfo = null)
{
// Student.
$status = CourseManager::get_user_in_course_status(api_get_user_id(), api_get_course_id());
$objcat = new Category();
$course_id = Database::get_course_by_category($selectcat);
$message_resource = $objcat->show_message_resource_delete($course_id);
$grade_model_id = $catobj->get_grade_model_id();
$header = null;
//@todo move these in a function
$sum_categories_weight_array = array();
if (isset($catobj) && !empty($catobj)) {
$categories = Category::load(null, null, null, $catobj->get_id());
if (!empty($categories)) {
foreach ($categories as $category) {
$sum_categories_weight_array[$category->get_id()] = $category->get_weight();
}
} else {
$sum_categories_weight_array[$catobj->get_id()] = $catobj->get_weight();
}
}
if (!$is_course_admin && $status != 1 && $selectcat != 0) {
$user_id = api_get_user_id();
$catcourse = Category::load($catobj->get_id());
$main_weight = $catcourse[0]->get_weight();
$scoredisplay = ScoreDisplay::instance();
//$categories = Category::getCategories($catcourse[0]->get_id());
// generating the total score for a course
/*if (count($categories) > 0) {
foreach ($categories as $category) {
$allevals = $category->get_evaluations($user_id, true);
$alllinks = $category->get_links($user_id, true);
$catEvalsLinks = array_merge($allevals, $alllinks);
}
}*/
$allevals = $catcourse[0]->get_evaluations($user_id, true);
$alllinks = $catcourse[0]->get_links($user_id, true);
$allEvalsLinks = array_merge($allevals, $alllinks);
$item_value_total = 0;
$scoreinfo = null;
for ($count = 0; $count < count($allEvalsLinks); $count++) {
$item = $allEvalsLinks[$count];
$score = $item->calc_score($user_id);
if (!empty($score)) {
$divide = $score[1] == 0 ? 1 : $score[1];
//$sub_cat_percentage = $sum_categories_weight_array[$item->get_category_id()];
//$item_value = $score[0] / $divide * $item->get_weight() / $sub_cat_percentage * $sub_cat_percentage / $main_weight * $main_weight;
$item_value = $score[0] / $divide * $item->get_weight();
//var_dump($score[0], $divide, $item->get_weight(), $sub_cat_percentage, $main_weight, $item_value);
$item_value_total += $item_value;
}
}
$item_total = $main_weight;
$total_score = array($item_value_total, $item_total);
$scorecourse_display = $scoredisplay->display_score($total_score, SCORE_DIV_PERCENT);
if (!$catobj->get_id() == '0' && !isset($_GET['studentoverview']) && !isset($_GET['search'])) {
$certificateLink = null;
if (!empty($certificateLinkInfo) && isset($certificateLinkInfo['certificate_link'])) {
$certificateLink .= '<span style="float:right"> ' . $certificateLinkInfo['certificate_link'] . "</span>";
}
$scoreinfo .= '<h4>' . get_lang('Total') . ' : ' . $scorecourse_display . $certificateLink . '</h4>';
}
Display::display_normal_message($scoreinfo, false);
}
// show navigation tree and buttons?
if ($showtree == '1' || isset($_GET['studentoverview'])) {
$header = '<div class="actions"><table>';
$header .= '<tr>';
if (!$selectcat == '0') {
$header .= '<td><a href="' . api_get_self() . '?selectcat=' . $catobj->get_parent_id() . '">' . Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('RootCat'), '', ICON_SIZE_MEDIUM) . '</a></td>';
}
$header .= '<td>' . get_lang('CurrentCategory') . '</td>' . '<td><form name="selector"><select name="selectcat" onchange="document.selector.submit()">';
$cats = Category::load();
$tree = $cats[0]->get_tree();
unset($cats);
$line = null;
foreach ($tree as $cat) {
for ($i = 0; $i < $cat[2]; $i++) {
$line .= '—';
}
$line = isset($line) ? $line : '';
if (isset($_GET['selectcat']) && $_GET['selectcat'] == $cat[0]) {
$header .= '<option selected value=' . $cat[0] . '>' . $line . ' ' . $cat[1] . '</option>';
} else {
$header .= '<option value=' . $cat[0] . '>' . $line . ' ' . $cat[1] . '</option>';
}
//.........这里部分代码省略.........
示例5: 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'] . ') ';
}
//.........这里部分代码省略.........
示例6: api_get_user_platform_status
/**
* @param int $user_id
*
* @return array
*/
function api_get_user_platform_status($user_id = null)
{
$status = array();
$user_id = intval($user_id);
if (empty($user_id)) {
$user_id = api_get_user_id();
}
if (empty($user_id)) {
return false;
}
$group_id = api_get_group_id();
$course_id = api_get_course_int_id();
$course_code = api_get_course_id();
$session_id = api_get_session_id();
//Group (in course)
if ($group_id && $course_id) {
$group_status = array();
$is_subscribed = GroupManager::is_subscribed($user_id, $group_id);
if ($is_subscribed) {
$group_status = array('id' => $group_id, 'status' => 'student');
$is_tutor = GroupManager::is_tutor_of_group($user_id, $group_id);
if ($is_tutor) {
$group_status['status'] = 'tutor';
} else {
$group_status['status'] = 'student';
}
}
$status['group'] = $group_status;
}
//Session
if ($session_id && $course_id) {
$session_status = array('id' => $session_id, 'course_id' => $course_id);
$session_user_status = SessionManager::get_user_status_in_course_session($user_id, $course_id, $session_id);
switch ($session_user_status) {
case 0:
$session_status['status'] = 'student';
break;
case 2:
$session_status['status'] = 'coach';
break;
}
$is_general_coach = SessionManager::user_is_general_coach($user_id, $session_id);
if ($is_general_coach) {
$session_status['status'] = 'general_coach';
}
$status['session'] = $session_status;
} elseif ($course_id) {
//Course
$course_status = array();
if ($course_id) {
$user_course_status = CourseManager::get_user_in_course_status($user_id, $course_code);
if ($user_course_status) {
$course_status = array('id' => $course_id);
switch ($user_course_status) {
case 1:
$course_status['status'] = 'teacher';
break;
case 5:
$course_status['status'] = 'student';
//check if tutor
$tutor_course_status = CourseManager::get_tutor_in_course_status($user_id, $course_code);
if ($tutor_course_status) {
$course_status['status'] = 'tutor';
}
break;
}
}
}
$status['course'] = $course_status;
}
return $status;
}
示例7: 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 = '';
//.........这里部分代码省略.........
示例8: build_edit_column
private function build_edit_column($item)
{
$status = CourseManager::get_user_in_course_status(api_get_user_id(), api_get_course_id());
$locked_status = $this->evaluation->get_locked();
if (api_is_allowed_to_edit(null, true) && $locked_status == 0) {
//api_is_course_admin()
$edit_column = '<a href="' . api_get_self() . '?editres=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id() . '&' . api_get_cidreq() . '">' . Display::return_icon('edit.png', get_lang('Modify'), '', '22') . '</a>';
$edit_column .= ' <a href="' . api_get_self() . '?delete_mark=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id() . '&' . api_get_cidreq() . '">' . Display::return_icon('delete.png', get_lang('Delete'), '', '22') . '</a>';
}
if ($this->evaluation->get_course_code() == null) {
$edit_column .= ' <a href="' . api_get_self() . '?resultdelete=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id() . '" onclick="return confirmationuser();">
<img src="../img/delete.gif" border="0" title="' . get_lang('Delete') . '" alt="" /></a>';
$edit_column .= ' <a href="user_stats.php?userid=' . $item['id'] . '&selecteval=' . $this->evaluation->get_id() . '&' . api_get_cidreq() . '">
<img src="../img/statistics.gif" width="17px" border="0" title="' . get_lang('Statistics') . '" alt="" /></a>';
}
// Evaluation's origin is a link
if ($this->evaluation->get_category_id() < 0) {
$link = LinkFactory::get_evaluation_link($this->evaluation->get_id());
$doc_url = $link->get_view_url($item['id']);
if ($doc_url != null) {
$edit_column .= ' <a href="' . $doc_url . '" target="_blank">' . '<img src="' . api_get_path(WEB_CODE_PATH) . 'img/link.gif" border="0" title="' . get_lang('OpenDocument') . '" alt="" />' . '</a>';
}
}
return $edit_column;
}
示例9: 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;
}
示例10: 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;
}
示例11: array
$action = $_REQUEST['action'];
//safe as only used in if()'s
$seek = array('/', '%2F', '..');
$destroy = array('', '', '');
$cidReq = str_replace($seek, $destroy, $_REQUEST["cidReq"]);
$cidReq = Security::remove_XSS($cidReq);
$user_id = api_get_user_id();
$coursePath = api_get_path(SYS_COURSE_PATH) . $cidReq . '/document';
$_course = CourseManager::get_course_information($cidReq);
if ($_course == null) {
die("problem when fetching course information");
}
// stupid variable initialisation for old version of DocumentManager functions.
$_course['path'] = $_course['directory'];
$_course['dbName'] = $_course['db_name'];
$is_manager = CourseManager::get_user_in_course_status($user_id, $cidReq) == COURSEMANAGER;
if ($debug > 0) {
error_log($coursePath, 0);
}
// FIXME: check security around $_REQUEST["cwd"]
$cwd = $_REQUEST['cwd'];
// treat /..
$nParent = 0;
// the number of /.. into the url
while (substr($cwd, -3, 3) == '/..') {
// go to parent directory
$cwd = substr($cwd, 0, -3);
if (strlen($cwd) == 0) {
$cwd = '/';
}
$nParent++;
示例12: build_edit_icons_eval
/**
* Builds the course or platform admin icons to edit an evaluation
* @param Evaluation $eval evaluation object
* @param int $selectcat id of selected category
*/
public static function build_edit_icons_eval($eval, $selectcat)
{
$status = CourseManager::get_user_in_course_status(api_get_user_id(), api_get_course_id());
$is_locked = $eval->is_locked();
$eval->get_course_code();
$cat = new Category();
$message_eval = $cat->show_message_resource_delete($eval->get_course_code());
if ($message_eval === false && api_is_allowed_to_edit(null, true)) {
$visibility_icon = $eval->is_visible() == 0 ? 'invisible' : 'visible';
$visibility_command = $eval->is_visible() == 0 ? 'set_visible' : 'set_invisible';
if ($is_locked && !api_is_platform_admin()) {
$modify_icons = Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL);
} else {
$modify_icons = '<a href="gradebook_edit_eval.php?editeval=' . $eval->get_id() . '&cidReq=' . $eval->get_course_code() . '&id_session=' . $eval->getSessionId() . '">' . Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
}
$modify_icons .= ' <a href="' . api_get_self() . '?visibleeval=' . $eval->get_id() . '&' . $visibility_command . '=&selectcat=' . $selectcat . '&id_session=' . $eval->getSessionId() . ' ">' . Display::return_icon($visibility_icon . '.png', get_lang('Visible'), '', ICON_SIZE_SMALL) . '</a>';
if (api_is_allowed_to_edit(null, true)) {
$modify_icons .= ' <a href="gradebook_showlog_eval.php?visiblelog=' . $eval->get_id() . '&selectcat=' . $selectcat . ' &cidReq=' . $eval->get_course_code() . '&id_session=' . $eval->getSessionId() . '">' . Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL) . '</a>';
}
/*
if ($locked_status == 0){
$modify_icons .= " <a href=\"javascript:if (confirm('".addslashes(get_lang('AreYouSureToLockedTheEvaluation'))."')) { location.href='".api_get_self().'?lockedeval=' . $eval->get_id() . '&selectcat=' . $selectcat . ' &cidReq='.$eval->get_course_code()."'; }\">".Display::return_icon('unlock.png',get_lang('LockEvaluation'), array(), ICON_SIZE_SMALL)."</a>";
} else {
if (api_is_platform_admin()){
$modify_icons .= " <a href=\"javascript:if (confirm('".addslashes(get_lang('AreYouSureToUnLockedTheEvaluation'))."')) { location.href='".api_get_self().'?lockedeval=' . $eval->get_id() . '&typelocked=&selectcat=' . $selectcat . ' &cidReq='.$eval->get_course_code()."';\">".Display::return_icon('lock.png',get_lang('UnLockEvaluation'), array(), ICON_SIZE_SMALL)."</a>";
} else {
$modify_icons .= ' <img src="../img/locked_na.png" border="0" title="' . get_lang('TheEvaluationIsLocked') . '" alt="" />';
}
} */
if ($is_locked && !api_is_platform_admin()) {
$modify_icons .= ' ' . Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL);
} else {
$modify_icons .= ' <a href="' . api_get_self() . '?deleteeval=' . $eval->get_id() . '&selectcat=' . $selectcat . ' &cidReq=' . $eval->get_course_code() . '&id_session=' . $eval->getSessionId() . '" onclick="return confirmation();">' . Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>';
}
return $modify_icons;
}
}
示例13: unsubscribe_from_course
/**
* Unsubscribe a class from a course.
* Only students are unsubscribed. If a user is member of 2 classes which
* are both subscribed to the course, the user stays in the course.
* @param int $class_id The class id
* @param string $course_code The course code
*/
public static function unsubscribe_from_course($class_id, $course_code)
{
$tbl_course_class = Database::get_main_table(TABLE_MAIN_COURSE_CLASS);
$tbl_class_user = Database::get_main_table(TABLE_MAIN_CLASS_USER);
$sql = "SELECT cu.user_id,COUNT(cc.class_id) FROM {$tbl_course_class} cc, {$tbl_class_user} cu WHERE cc.class_id = cu.class_id AND cc.course_code = '" . Database::escape_string($course_code) . "' GROUP BY cu.user_id HAVING COUNT(cc.class_id) = 1";
$single_class_users = Database::query($sql);
while ($single_class_user = Database::fetch_object($single_class_users)) {
$sql = "SELECT * FROM {$tbl_class_user} WHERE class_id = '" . intval($class_id) . "' AND user_id = '" . Database::escape_string($single_class_user->user_id) . "'";
$res = Database::query($sql);
if (Database::num_rows($res) > 0) {
if (CourseManager::get_user_in_course_status($single_class_user->user_id, $course_code) == STUDENT) {
CourseManager::unsubscribe_user($single_class_user->user_id, $course_code);
}
}
}
$sql = "DELETE FROM {$tbl_course_class} WHERE course_code = '" . Database::escape_string($course_code) . "' AND class_id = '" . Database::escape_string($class_id) . "'";
Database::query($sql);
}
示例14: get_sessions_by_category
//.........这里部分代码省略.........
// First take $row2, as it contains less data and this data is enough
while ($row2 = Database::fetch_array($result2)) {
$join[] = $row2;
$ordered_join[] = $row2;
$ids[] = $row2['id'];
}
}
if (Database::num_rows($result1) > 0) {
// Now add the diff with $row1, ordering elements as planned by query
$i = 0;
while ($row1 = Database::fetch_array($result1)) {
if (!in_array($row1['id'], $ids)) {
if ($reverse_order) {
while (isset($join[$i]) && strcmp($row1['session_category_name'], $join[$i]['session_category_name']) <= 0) {
$ordered_join[] = $join[$i];
$i++;
}
} else {
while (isset($join[$i]) && strcmp($row1['session_category_name'], $join[$i]['session_category_name']) > 0) {
$ordered_join[] = $join[$i];
$i++;
}
if (isset($join[$i]) && strcmp($row1['session_category_name'], $join[$i]['session_category_name']) === 0) {
while (isset($join[$i]) && isset($row1['short_name']) && strcmp($row1['short_name'], $join[$i]['short_name']) > 0) {
$ordered_join[] = $join[$i];
$i++;
}
}
}
$ordered_join[] = $row1;
$join[] = $row1;
}
}
}
if (count($ordered_join) == 0) {
$ordered_join = $join;
}
if (count($ordered_join) > 0) {
foreach ($ordered_join as $row) {
if ($get_count) {
return $row['total_rows'];
}
$categories[$row['session_category_id']]['session_category']['id'] = $row['session_category_id'];
$categories[$row['session_category_id']]['session_category']['name'] = $row['session_category_name'];
$categories[$row['session_category_id']]['session_category']['date_start'] = $row['session_category_date_start'];
$categories[$row['session_category_id']]['session_category']['date_end'] = $row['session_category_date_end'];
$session_id = $row['id'];
// The only usage of $session_info is to call
// api_get_session_date_validation, which only needs id and
// dates from the session itself, so really no need to query
// the session table again
$session_info = $row;
// Checking session visibility
$visibility = api_get_session_visibility($session_id, null, $ignore_visibility_for_admins);
switch ($visibility) {
case SESSION_VISIBLE_READ_ONLY:
case SESSION_VISIBLE:
case SESSION_AVAILABLE:
break;
case SESSION_INVISIBLE:
continue 2;
}
if ($is_time_over == false) {
$date_validation = api_get_session_date_validation($session_info, null, false, false);
if (!$date_validation) {
continue;
}
}
$categories[$row['session_category_id']]['sessions'][$row['id']]['session_name'] = $row['name'];
$categories[$row['session_category_id']]['sessions'][$row['id']]['session_id'] = $row['id'];
$categories[$row['session_category_id']]['sessions'][$row['id']]['id_coach'] = $row['id_coach'];
if (isset($row['id_coach']) && !empty($row['id_coach'])) {
$user_info = api_get_user_info($row['id_coach']);
$categories[$row['session_category_id']]['sessions'][$row['id']]['coach_info'] = $user_info;
}
$categories[$row['session_category_id']]['sessions'][$row['id']]['access_start_date'] = $row['access_start_date'];
$categories[$row['session_category_id']]['sessions'][$row['id']]['access_end_date'] = $row['access_end_date'];
$categories[$row['session_category_id']]['sessions'][$row['id']]['coach_access_start_date'] = $row['coach_access_start_date'];
$categories[$row['session_category_id']]['sessions'][$row['id']]['coach_access_end_date'] = $row['coach_access_end_date'];
$date_message = SessionManager::parseSessionDates($row);
$categories[$row['session_category_id']]['sessions'][$row['id']]['date_message'] = $date_message;
$courses = UserManager::get_courses_list_by_session($user_id, $row['id']);
$course_list = array();
foreach ($courses as $course) {
// Checking course session visibility
$visibility = api_get_session_visibility($session_id, $course['real_id']);
if ($visibility == SESSION_INVISIBLE) {
continue;
}
$user_status_in_course = CourseManager::get_user_in_course_status($user_id, $course['code']);
$course['user_status_in_course'] = $user_status_in_course;
$course_list[] = $course;
}
$categories[$row['session_category_id']]['sessions'][$row['id']]['courses'] = $course_list;
$categories[$row['session_category_id']]['sessions'][$row['id']]['moved_to'] = isset($row['moved_to']) ? $row['moved_to'] : null;
$categories[$row['session_category_id']]['sessions'][$row['id']]['moved_status'] = isset($row['moved_status']) ? $row['moved_status'] : null;
}
}
return $categories;
}
示例15: printf
printf('<courseobject>');
foreach ($_SESSION['_course'] as $key => $val) {
printf('<%s>%s</%s>', $key, api_utf8_encode($val), $key);
}
printf('</courseobject>');
printf('<userobject>');
foreach ($_SESSION['_user'] as $key => $val) {
if ($key != "auth_source") {
if (($key == "lastName" || $key == "firstName") && strlen($val) == 0) {
$val = get_lang('Unknown');
}
printf('<%s>%s</%s>', $key, api_utf8_encode($val), $key);
}
}
printf('<sid>%s</sid>', session_id());
$isadmin = CourseManager::get_user_in_course_status($_SESSION['_user']['user_id'], $_SESSION['_course']['sysCode']) == COURSEMANAGER || api_is_platform_admin() || api_is_course_tutor() || api_is_course_admin() || api_is_course_coach() ? "true" : "false";
printf('<key>%s</key>', md5($confkey . $challenge));
printf('<challenge>%s</challenge>', $challenge);
printf('<isUploadAllowed>%s</isUploadAllowed>', $isadmin);
printf('<canStartModerator>%s</canStartModerator>', $isadmin == 'true' || $_SESSION["roomType"] == "conference" ? 'true' : 'false');
printf('<mustStartModerator>%s</mustStartModerator>', $isadmin == 'true' || $_SESSION["roomType"] == "conference" ? 'true' : 'false');
printf('</userobject>');
printf('<config>');
printf('<host>' . api_get_setting('service_visio', 'visio_host') . '</host>');
printf('<port>' . api_get_setting('service_visio', 'visio_port') . '</port>');
printf('</config>');
$path = preg_replace('/^([^:]*:\\/\\/)/', '', api_get_path(WEB_PATH));
$path = str_replace('/', '_', $path);
printf('<roomConfig>');
printf('<portal>%s</portal>', $path);
printf('<roomType>%s</roomType>', $_SESSION['roomType']);