当前位置: 首页>>代码示例>>PHP>>正文


PHP CourseManager::get_student_list_from_course_code方法代码示例

本文整理汇总了PHP中CourseManager::get_student_list_from_course_code方法的典型用法代码示例。如果您正苦于以下问题:PHP CourseManager::get_student_list_from_course_code方法的具体用法?PHP CourseManager::get_student_list_from_course_code怎么用?PHP CourseManager::get_student_list_from_course_code使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CourseManager的用法示例。


在下文中一共展示了CourseManager::get_student_list_from_course_code方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: warnUsersByEmail

 /**
  * @param int    $courseId
  * @param int    $sessionId
  * @param string $filePath
  */
 public function warnUsersByEmail($courseId, $sessionId, $filePath = null)
 {
     $courseInfo = api_get_course_info_by_id($courseId);
     $courseCode = $courseInfo['code'];
     if (empty($sessionId)) {
         $students = CourseManager::get_student_list_from_course_code($courseCode, false);
     } else {
         $students = CourseManager::get_student_list_from_course_code($courseCode, true, $sessionId);
     }
     $url = api_get_course_url($courseCode, $sessionId);
     $url = Display::url($url, $url);
     $subject = $this->get_lang("AgreementUpdated");
     $message = sprintf($this->get_lang("AgreementWasUpdatedClickHere"), $url);
     $dataFile = array();
     if (!empty($filePath)) {
         $dataFile = array('path' => $filePath, 'filename' => basename($filePath));
         $message = sprintf($this->get_lang("AgreementWasUpdatedClickHere"), $url) . " \n";
         $message .= $this->get_lang("TheAgreementIsAttachedInThisEmail");
     }
     if (!empty($students)) {
         foreach ($students as $student) {
             $userInfo = api_get_user_info($student['user_id']);
             api_mail_html($userInfo['complete_name'], $userInfo['email'], $subject, $message, null, null, null, $dataFile);
             //MessageManager::send_message_simple($student['user_id'], $subject, $message);
         }
     }
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:32,代码来源:CourseLegalPlugin.php

示例2: ucwords

                 $title = ucwords(strtolower(trim($exercises[$cnt - 4]['title'])));
             }
             $columns[] = 'exer' . $i;
             $column_names[] = $title;
             $i++;
             break;
     }
 }
 $quizIds = array();
 if (!empty($exercises)) {
     foreach ($exercises as $exercise) {
         $quizIds[] = $exercise['id'];
     }
 }
 $course = api_get_course_info_by_id($_GET['course_id']);
 $listUserSess = CourseManager::get_student_list_from_course_code($course['code'], true, $_GET['session_id']);
 $usersId = array_keys($listUserSess);
 $users = UserManager::get_user_list_by_ids($usersId, null, "lastname, firstname", "{$start} , {$limit}");
 $exeResults = $objExercise->getExerciseAndResult($_GET['course_id'], $_GET['session_id'], $quizIds);
 $arrGrade = array();
 foreach ($exeResults as $exeResult) {
     $arrGrade[$exeResult['exe_user_id']][$exeResult['exe_exo_id']] = $exeResult['exe_result'];
 }
 $result = array();
 $i = 0;
 foreach ($users as $user) {
     $sessionInfo = SessionManager::fetch($listUserSess[$user['user_id']]['id_session']);
     $result[$i]['session'] = $sessionInfo['name'];
     $result[$i]['username'] = $user['username'];
     $result[$i]['name'] = $user['lastname'] . " " . $user['firstname'];
     $j = 1;
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:model.ajax.php

示例3: get_lang

$nameTools = get_lang('Tracking');

// Display the header.
Display::display_header($nameTools, 'Tracking');

// getting all the students of the course
if (empty($session_id)) {
    // Registered students in a course outside session.
    $a_students = CourseManager::get_student_list_from_course_code(
        api_get_course_id()
    );
} else {
    // Registered students in session.
    $a_students = CourseManager::get_student_list_from_course_code(
        api_get_course_id(),
        true,
        $sessionId
    );
}

$nbStudents = count($a_students);
$extra_info = array();

// Getting all the additional information of an additional profile field.
if (isset($_GET['additional_profile_field']) &&
    is_numeric($_GET['additional_profile_field'])
) {
    $user_array = array();
    foreach ($a_students as $key => $item) {
        $user_array[] = $key;
    }
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:courseLog.php

示例4: get_lang

    $html_result .= '<tr><th>' . get_lang('Quiz') . '</th>';
    $html_result .= '<th>' . get_lang('User') . '</th>';
    //$html_result .= '<th>'.sprintf(get_lang('ExamPassX'), $filter_score).'</th>';
    $html_result .= '<th>' . get_lang('Percentage') . ' %</th>';
    $html_result .= '<th>' . get_lang('Status') . '</th>';
    $html_result .= '<th>' . get_lang('Attempts') . '</th>';
    $html_result .= '</tr>';
}
$table = Database::get_course_table(TABLE_TOOL_LIST);
$t_quiz = Database::get_course_table(TABLE_QUIZ_TEST);
$export_array_global = $export_array = array();
if (!empty($course_list) && is_array($course_list)) {
    foreach ($course_list as $current_course) {
        $global_row = $row_not_global = array();
        $course_id = $current_course['real_id'];
        $a_students = CourseManager::get_student_list_from_course_code($course_id, false);
        $total_students = count($a_students);
        $sqlExercices = "SELECT count(id) as count FROM " . $t_quiz . " AS quiz WHERE active='1' AND c_id = {$course_id} ";
        $resultExercices = Database::query($sqlExercices);
        $data_exercises = Database::store_result($resultExercices);
        $exercise_count = $data_exercises[0]['count'];
        if ($global) {
            if ($exercise_count == 0) {
                $exercise_count = 2;
            }
            $html_result .= "<tr class='{$s_css_class}'>\n                                <td rowspan={$exercise_count}>";
            $html_result .= $current_course['title'];
            $html_result .= "</td>";
        }
        $sql = "SELECT visibility FROM {$table} WHERE c_id = {$course_id} AND name='quiz'";
        $resultVisibilityQuizz = Database::query($sql);
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:31,代码来源:exams.php

示例5: display_form_user_subscribe

 /**
  * Displays the form to register users in a blog (in a course)
  * The listed users are users subcribed in the course.
  * @author Toon Keppens
  *
  * @param Integer $blog_id
  *
  * @return Html Form with sortable table with users to subcribe in a blog, in a course.
  */
 public static function display_form_user_subscribe($blog_id)
 {
     $_course = api_get_course_info();
     $is_western_name_order = api_is_western_name_order();
     $session_id = api_get_session_id();
     $course_id = $_course['real_id'];
     $currentCourse = $_course['code'];
     $tbl_users = Database::get_main_table(TABLE_MAIN_USER);
     $tbl_blogs_rel_user = Database::get_course_table(TABLE_BLOGS_REL_USER);
     echo '<legend>' . get_lang('SubscribeMembers') . '</legend>';
     $properties["width"] = "100%";
     // Get blog members' id.
     $sql = "SELECT user.user_id FROM {$tbl_users} user\n\t\t\t\tINNER JOIN {$tbl_blogs_rel_user} blogs_rel_user\n\t\t\t\tON user.user_id = blogs_rel_user.user_id\n\t\t\t\tWHERE blogs_rel_user.c_id = {$course_id} AND blogs_rel_user.blog_id = '" . intval($blog_id) . "'";
     $result = Database::query($sql);
     $blog_member_ids = array();
     while ($user = Database::fetch_array($result)) {
         $blog_member_ids[] = $user['user_id'];
     }
     // Set table headers
     $column_header[] = array('', false, '');
     if ($is_western_name_order) {
         $column_header[] = array(get_lang('FirstName'), true, '');
         $column_header[] = array(get_lang('LastName'), true, '');
     } else {
         $column_header[] = array(get_lang('LastName'), true, '');
         $column_header[] = array(get_lang('FirstName'), true, '');
     }
     $column_header[] = array(get_lang('Email'), false, '');
     $column_header[] = array(get_lang('Register'), false, '');
     $student_list = CourseManager::get_student_list_from_course_code($currentCourse, false, $session_id);
     $user_data = array();
     // Add users that are not in this blog to the list.
     foreach ($student_list as $key => $user) {
         if (isset($user['id_user'])) {
             $user['user_id'] = $user['id_user'];
         }
         if (!in_array($user['user_id'], $blog_member_ids)) {
             $a_infosUser = api_get_user_info($user['user_id']);
             $row = array();
             $row[] = '<input type="checkbox" name="user[]" value="' . $a_infosUser['user_id'] . '" ' . (isset($_GET['selectall']) && $_GET['selectall'] == "subscribe" ? ' checked="checked" ' : '') . '/>';
             $username = api_htmlentities(sprintf(get_lang('LoginX'), $a_infosUser["username"]), ENT_QUOTES);
             if ($is_western_name_order) {
                 $row[] = $a_infosUser["firstname"];
                 $row[] = Display::tag('span', $a_infosUser["lastname"], array('title' => $username));
             } else {
                 $row[] = Display::tag('span', $a_infosUser["lastname"], array('title' => $username));
                 $row[] = $a_infosUser["firstname"];
             }
             $row[] = Display::icon_mailto_link($a_infosUser["email"]);
             //Link to register users
             if ($a_infosUser["user_id"] != $_SESSION['_user']['user_id']) {
                 $row[] = "<a class=\"btn btn-primary \" href=\"" . api_get_self() . "?action=manage_members&blog_id={$blog_id}&register=yes&user_id=" . $a_infosUser["user_id"] . "\">" . get_lang('Register') . "</a>";
             } else {
                 $row[] = '';
             }
             $user_data[] = $row;
         }
     }
     // Display
     $query_vars['action'] = 'manage_members';
     $query_vars['blog_id'] = $blog_id;
     echo '<form method="post" action="blog.php?action=manage_members&blog_id=' . $blog_id . '">';
     Display::display_sortable_table($column_header, $user_data, null, null, $query_vars);
     $link = '';
     $link .= isset($_GET['action']) ? 'action=' . Security::remove_XSS($_GET['action']) . '&' : '';
     $link .= "blog_id={$blog_id}&";
     echo '<a href="blog.php?' . $link . 'selectall=subscribe">' . get_lang('SelectAll') . '</a> - ';
     echo '<a href="blog.php?' . $link . '">' . get_lang('UnSelectAll') . '</a> ';
     echo get_lang('WithSelected') . ' : ';
     echo '<select name="action">';
     echo '<option value="select_subscribe">' . get_lang('Register') . '</option>';
     echo '</select>';
     echo '<input type="hidden" name="register" value="true" />';
     echo '<button class="save" type="submit">' . get_lang('Ok') . '</button>';
     echo '</form>';
 }
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:85,代码来源:blog.lib.php

示例6: isset

require_once '../inc/global.inc.php';
require_once 'exercise.lib.php';
$this_section = SECTION_COURSES;
$exercise_id = isset($_GET['exerciseId']) && !empty($_GET['exerciseId']) ? intval($_GET['exerciseId']) : 0;
$gradebook = isset($gradebook) ? $gradebook : null;
$objExercise = new Exercise();
$result = $objExercise->read($exercise_id);
if (!$result) {
    api_not_allowed(true);
}
$sessionId = api_get_session_id();
$courseCode = api_get_course_id();
if (empty($sessionId)) {
    $students = CourseManager::get_student_list_from_course_code($courseCode, false);
} else {
    $students = CourseManager::get_student_list_from_course_code($courseCode, true, $sessionId);
}
$count_students = count($students);
$question_list = $objExercise->get_validated_question_list();
$data = array();
// Question title 	# of students who tool it 	Lowest score 	Average 	Highest score 	Maximum score
$headers = array(get_lang('Question'), get_lang('QuestionType'), get_lang('NumberStudentWhoSelectedIt'), get_lang('LowestScore'), get_lang('AverageScore'), get_lang('HighestScore'), get_lang('Weighting'));
if (!empty($question_list)) {
    foreach ($question_list as $question_id) {
        $question_obj = Question::read($question_id);
        $exercise_stats = get_student_stats_by_question($question_id, $exercise_id, $courseCode, $sessionId);
        $count_users = get_number_students_question_with_answer_count($question_id, $exercise_id, $courseCode, $sessionId);
        $data[$question_id]['name'] = cut($question_obj->question, 100);
        $data[$question_id]['type'] = $question_obj->get_question_type_name();
        $percentange = 0;
        if ($count_students) {
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:stats.php

示例7: get_number_students_question_with_answer_count

 /**
  * @param int $question_id
  * @param int $exercise_id
  * @param string $course_code
  * @param int $session_id
  * @param string $questionType
  * @return int
  */
 public static function get_number_students_question_with_answer_count($question_id, $exercise_id, $course_code, $session_id, $questionType = '')
 {
     $track_exercises = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
     $track_attempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
     $courseUser = Database::get_main_table(TABLE_MAIN_COURSE_USER);
     $courseTable = Database::get_main_table(TABLE_MAIN_COURSE);
     $courseUserSession = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
     $question_id = intval($question_id);
     $exercise_id = intval($exercise_id);
     $courseId = api_get_course_int_id($course_code);
     $session_id = intval($session_id);
     if ($questionType == FILL_IN_BLANKS) {
         $listStudentsId = array();
         $listAllStudentInfo = CourseManager::get_student_list_from_course_code(api_get_course_id(), true);
         foreach ($listAllStudentInfo as $i => $listStudentInfo) {
             $listStudentsId[] = $listStudentInfo['user_id'];
         }
         $listFillTheBlankResult = getFillTheBlankTabResult($exercise_id, $question_id, $listStudentsId, '1970-01-01', '3000-01-01');
         return getNbResultFillBlankAll($listFillTheBlankResult);
     }
     if (empty($session_id)) {
         $courseCondition = "\n            INNER JOIN {$courseUser} cu\n            ON cu.c_id = c.id AND cu.user_id  = exe_user_id";
         $courseConditionWhere = " AND relation_type <> 2 AND cu.status = " . STUDENT;
     } else {
         $courseCondition = "\n            INNER JOIN {$courseUserSession} cu\n            ON cu.c_id = c.id AND cu.user_id = exe_user_id";
         $courseConditionWhere = " AND cu.status = 0 ";
     }
     $sql = "SELECT DISTINCT exe_user_id\n    \t\tFROM {$track_exercises} e\n    \t\tINNER JOIN {$track_attempt} a\n    \t\tON (\n    \t\t    a.exe_id = e.exe_id AND\n    \t\t    e.c_id = a.c_id AND\n    \t\t    e.session_id  = a.session_id\n            )\n            INNER JOIN {$courseTable} c\n            ON (c.id = a.c_id)\n    \t\t{$courseCondition}\n    \t\tWHERE\n    \t\t    exe_exo_id = {$exercise_id} AND\n                a.c_id = {$courseId} AND\n                e.session_id = {$session_id} AND\n                question_id = {$question_id} AND\n                answer <> '0' AND\n                e.status = ''\n                {$courseConditionWhere}\n            ";
     $result = Database::query($sql);
     $return = 0;
     if ($result) {
         $return = Database::num_rows($result);
     }
     return $return;
 }
开发者ID:feroli1000,项目名称:chamilo-lms,代码行数:43,代码来源:exercise.lib.php

示例8: array

if (isset($_GET['origin']) && $_GET['origin'] == 'resume_session') {
    $interbreadcrumb[] = array('url' => '../session/index.php', 'name' => get_lang('PlatformAdmin'));
    $interbreadcrumb[] = array('url' => '../session/session_list.php', 'name' => get_lang('SessionList'));
    $interbreadcrumb[] = array('url' => '../session/resume_session.php?id_session=' . api_get_session_id(), 'name' => get_lang('SessionOverview'));
}
$view = isset($_REQUEST['view']) ? $_REQUEST['view'] : '';
$nameTools = get_lang('Tracking');
// Display the header.
Display::display_header($nameTools, 'Tracking');
// getting all the students of the course
if (empty($session_id)) {
    // Registered students in a course outside session.
    $a_students = CourseManager::get_student_list_from_course_code($course_info['real_id']);
} else {
    // Registered students in session.
    $a_students = CourseManager::get_student_list_from_course_code($course_info['real_id'], true, $session_id);
}
$nbStudents = count($a_students);
// Gettting all the additional information of an additional profile field.
if (isset($_GET['additional_profile_field']) && is_numeric($_GET['additional_profile_field'])) {
    $user_array = array();
    foreach ($a_students as $key => $item) {
        $user_array[] = $key;
    }
    // Fetching only the user that are loaded NOT ALL user in the portal.
    $additional_user_profile_info = TrackingCourseLog::get_addtional_profile_information_of_field_by_user($_GET['additional_profile_field'], $user_array);
    $extra_info = UserManager::get_extra_field_information($_GET['additional_profile_field']);
}
/* MAIN CODE */
echo '<div class="actions">';
echo Display::url(Display::return_icon('user_na.png', get_lang('StudentsTracking'), array(), 32), '#');
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:31,代码来源:courseLog.php

示例9: array

//$tbl_learnpath_chapter = Database::get_course_table(TABLE_LEARNPATH_CHAPTER);
$tbl_learnpath_main = Database::get_course_table(TABLE_LP_MAIN);
$tbl_learnpath_item = Database::get_course_table(TABLE_LP_ITEM);
$tbl_learnpath_view = Database::get_course_table(TABLE_LP_VIEW);
$tbl_learnpath_item_view = Database::get_course_table(TABLE_LP_ITEM_VIEW);
if (isset($_GET['origin']) && $_GET['origin'] == 'resume_session') {
    $interbreadcrumb[] = array('url' => '../admin/index.php', 'name' => get_lang('PlatformAdmin'));
    $interbreadcrumb[] = array('url' => '../admin/session_list.php', 'name' => get_lang('SessionList'));
    $interbreadcrumb[] = array('url' => '../admin/resume_session.php?id_session=' . $_SESSION['id_session'], 'name' => get_lang('SessionOverview'));
}
$view = isset($_REQUEST['view']) ? $_REQUEST['view'] : '';
$nameTools = get_lang('Tracking');
Display::display_header($nameTools, 'Tracking');
require api_get_path(LIBRARY_PATH) . 'statsUtils.lib.inc.php';
require '../resourcelinker/resourcelinker.inc.php';
$a_students = CourseManager::get_student_list_from_course_code($_course['id'], true, empty($_SESSION['id_session']) ? null : $_SESSION['id_session']);
$nbStudents = count($a_students);
/**
 * count the number of students in this course (used for SortableTable)
 */
function count_student_in_course()
{
    global $nbStudents;
    return $nbStudents;
}
function sort_users($a, $b)
{
    $a = trim(api_strtolower($a[$_SESSION['tracking_column']]));
    $b = trim(api_strtolower($b[$_SESSION['tracking_column']]));
    if ($_SESSION['tracking_direction'] == 'DESC') {
        return strcmp($b, $a);
开发者ID:RusticiSoftware,项目名称:SCORMCloud_DokeosMod,代码行数:31,代码来源:courseLog.php

示例10: send_email_on_homework_creation

/**
 * Sends an email to the students of a course when a homework is created
 *
 * @param string course_id
 *
 * @author Guillaume Viguier <guillaume.viguier@beeznest.com>
 * @author Julio Montoya <gugli100@gmail.com> Adding session support - 2011
 */
function send_email_on_homework_creation($course_id)
{
    // Get the students of the course
    $session_id = api_get_session_id();
    if (empty($session_id)) {
        $students = CourseManager::get_student_list_from_course_code($course_id);
    } else {
        $students = CourseManager::get_student_list_from_course_code($course_id, true, $session_id);
    }
    $emailsubject = '[' . api_get_setting('siteName') . '] '.get_lang('HomeworkCreated');
    $currentUser = api_get_user_info(api_get_user_id());
    if (!empty($students)) {
        foreach($students as $student) {
            $user_info = api_get_user_info($student["user_id"]);
            if(!empty($user_info["mail"])) {
                $name_user = api_get_person_name(
                    $user_info["firstname"],
                    $user_info["lastname"],
                    null,
                    PERSON_NAME_EMAIL_ADDRESS
                );
                $emailbody = get_lang('Dear')." ".$name_user.",\n\n";
                $emailbody .= get_lang('HomeworkHasBeenCreatedForTheCourse')." ".$course_id.". "."\n\n".get_lang('PleaseCheckHomeworkPage');
                $emailbody .= "\n\n".api_get_person_name($currentUser["firstname"], $currentUser["lastname"]);

                $additionalParameters = array(
                    'smsType' => ClockworksmsPlugin::ASSIGNMENT_BEEN_CREATED_COURSE,
                    'userId' => $student["user_id"],
                    'courseTitle' => $course_id
                );

                api_mail_html(
                    $name_user,
                    $user_info["mail"],
                    $emailsubject,
                    $emailbody,
                    api_get_person_name(
                        $currentUser["firstname"],
                        $currentUser["lastname"],
                        null,
                        PERSON_NAME_EMAIL_ADDRESS
                    ),
                    $currentUser["mail"],
                    null,
                    null,
                    null,
                    $additionalParameters
                );
            }
        }
    }
}
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:60,代码来源:work.lib.php

示例11: send_email_on_homework_creation

/**
 * Sends an email to the students of a course when a homework is created
 *
 * @param string course_id
 *
 * @author Guillaume Viguier <guillaume.viguier@beeznest.com>
 * @author Julio Montoya <gugli100@gmail.com> Adding session support - 2011
 */
function send_email_on_homework_creation($course_id)
{
    // Get the students of the course
    $session_id = api_get_session_id();
    if (empty($session_id)) {
        $students = CourseManager::get_student_list_from_course_code($course_id);
    } else {
        $students = CourseManager::get_student_list_from_course_code($course_id, true, $session_id);
    }
    $emailsubject = '[' . api_get_setting('platform.site_name') . '] ' . get_lang('HomeworkCreated');
    $currentUser = api_get_user_info(api_get_user_id());
    if (!empty($students)) {
        foreach ($students as $student) {
            $user_info = api_get_user_info($student["user_id"]);
            if (!empty($user_info["mail"])) {
                $name_user = api_get_person_name($user_info["firstname"], $user_info["lastname"], null, PERSON_NAME_EMAIL_ADDRESS);
                $emailbody = get_lang('Dear') . " " . $name_user . ",\n\n";
                $emailbody .= get_lang('HomeworkHasBeenCreatedForTheCourse') . " " . $course_id . ". " . "\n\n" . get_lang('PleaseCheckHomeworkPage');
                $emailbody .= "\n\n" . api_get_person_name($currentUser["firstname"], $currentUser["lastname"]);
                @api_mail($name_user, $user_info["mail"], $emailsubject, $emailbody, api_get_person_name($currentUser["firstname"], $currentUser["lastname"], null, PERSON_NAME_EMAIL_ADDRESS), $currentUser["mail"]);
            }
        }
    }
}
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:32,代码来源:work.lib.php

示例12: processStudentList

/**
 * @param $filter_score
 * @param $global
 * @param $exercise
 * @param $courseInfo
 * @param $sessionId
 * @param $newSessionList
 * @return array
 */
function processStudentList($filter_score, $global, $exercise, $courseInfo, $sessionId, $newSessionList)
{
    if (isset($exercise['id']) && empty($exercise['id']) || !isset($exercise['id'])) {
        return array('html' => '', 'export_array_global' => [], 'total_students' => 0);
    }
    $exerciseStatsTable = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
    $courseId = api_get_course_int_id($courseInfo['code']);
    if (empty($sessionId)) {
        $students = CourseManager::get_student_list_from_course_code($courseInfo['code'], false, 0, null, null, false);
    } else {
        $students = CourseManager::get_student_list_from_course_code($courseInfo['code'], true, $sessionId, null, null, false);
    }
    $html = null;
    $totalStudents = count($students);
    if (!$global) {
        $html .= "<tr>";
    }
    if (!$global) {
        $html .= '<td rowspan="' . $totalStudents . '">';
    } else {
        $html .= '<td>';
    }
    $html .= $exercise['title'];
    if ($global && !empty($sessionId)) {
        $sessionName = isset($newSessionList[$sessionId]) ? $newSessionList[$sessionId] : null;
        $html .= Display::return_icon('star.png', get_lang('Session')) . ' (' . $sessionName . ')';
    }
    $html .= '</td>';
    $globalRow = array($courseInfo['title'], $exercise['title']);
    $total_with_parameter_score = 0;
    $taken = 0;
    $export_array_global = array();
    $studentResult = array();
    foreach ($students as $student) {
        $studentId = isset($student['user_id']) ? $student['user_id'] : $student['id_user'];
        $sql = "SELECT COUNT(ex.exe_id) as count\n                FROM {$exerciseStatsTable} AS ex\n                WHERE\n                    ex.c_id = {$courseId} AND\n                    ex.exe_exo_id = " . $exercise['id'] . " AND\n                    exe_user_id= {$studentId} AND\n                    session_id = {$sessionId}\n                ";
        $result = Database::query($sql);
        $attempts = Database::fetch_array($result);
        $sql = "SELECT exe_id, exe_result, exe_weighting\n                FROM {$exerciseStatsTable}\n                WHERE\n                    exe_user_id = {$studentId} AND\n                    c_id = {$courseId} AND\n                    exe_exo_id = " . $exercise['id'] . " AND\n                    session_id = {$sessionId}\n                ORDER BY exe_result DESC\n                LIMIT 1";
        $result = Database::query($sql);
        $score = 0;
        $weighting = 0;
        while ($scoreInfo = Database::fetch_array($result)) {
            $score = $score + $scoreInfo['exe_result'];
            $weighting = $weighting + $scoreInfo['exe_weighting'];
        }
        $percentageScore = 0;
        if ($weighting != 0) {
            $percentageScore = round($score * 100 / $weighting);
        }
        if ($attempts['count'] > 0) {
            $taken++;
        }
        if ($percentageScore >= $filter_score) {
            $total_with_parameter_score++;
        }
        $tempArray = array();
        if (!$global) {
            $userInfo = api_get_user_info($studentId);
            // User
            $userRow = '<td>';
            $userRow .= $userInfo['complete_name'];
            $userRow .= '</td>';
            // Best result
            if (!empty($attempts['count'])) {
                $userRow .= '<td>';
                $userRow .= $percentageScore;
                $tempArray[] = $percentageScore;
                $userRow .= '</td>';
                if ($percentageScore >= $filter_score) {
                    $userRow .= '<td style="background-color:#DFFFA8">';
                    $userRow .= get_lang('PassExam') . '</td>';
                    $tempArray[] = get_lang('PassExam');
                } else {
                    $userRow .= '<td style="background-color:#FC9A9E"  >';
                    $userRow .= get_lang('ExamFail') . '</td>';
                    $tempArray[] = get_lang('ExamFail');
                }
                $userRow .= '<td>';
                $userRow .= $attempts['count'];
                $tempArray[] = $attempts['count'];
                $userRow .= '</td>';
            } else {
                $score = '-';
                $userRow .= '<td>';
                $userRow .= '-';
                $tempArray[] = '-';
                $userRow .= '</td>';
                $userRow .= '<td style="background-color:#FCE89A">';
                $userRow .= get_lang('NoAttempt');
                $tempArray[] = get_lang('NoAttempt');
//.........这里部分代码省略.........
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:101,代码来源:exams.php

示例13: send_email_on_homework_creation

/**
 * Sends an email to the students of a course when a homework is created
 *
 * @param int $courseId course_id
 * @param int $sessionId session_id
 * @param int $workId work_id
 *
 *
 * @author Guillaume Viguier <guillaume.viguier@beeznest.com>
 * @author Julio Montoya <gugli100@gmail.com> Adding session support - 2011
 */
function send_email_on_homework_creation($courseId, $sessionId = 0, $workId)
{
    $courseInfo = api_get_course_info_by_id($courseId);
    $courseCode = $courseInfo['code'];
    // Get the students of the course
    if (empty($session_id)) {
        $students = CourseManager::get_student_list_from_course_code($courseCode);
    } else {
        $students = CourseManager::get_student_list_from_course_code($courseCode, true, $sessionId);
    }
    $emailsubject = '[' . api_get_setting('platform.site_name') . '] ' . get_lang('HomeworkCreated');
    $currentUser = api_get_user_info(api_get_user_id());
    if (!empty($students)) {
        foreach ($students as $student) {
            $user_info = api_get_user_info($student["user_id"]);
            if (!empty($user_info["mail"])) {
                $name_user = api_get_person_name($user_info["firstname"], $user_info["lastname"], null, PERSON_NAME_EMAIL_ADDRESS);
                $link = api_get_path(WEB_CODE_PATH) . 'work/work_list_all.php?' . api_get_cidreq() . '&id=' . $workId;
                $emailbody = get_lang('Dear') . " " . $name_user . ",\n\n";
                $emailbody .= get_lang('HomeworkHasBeenCreatedForTheCourse') . " " . $courseCode . ". " . "\n\n" . '<a href="' . $link . '">' . get_lang('PleaseCheckHomeworkPage') . '</a>';
                $emailbody .= "\n\n" . api_get_person_name($currentUser["firstname"], $currentUser["lastname"]);
                $additionalParameters = array('smsType' => SmsPlugin::ASSIGNMENT_BEEN_CREATED_COURSE, 'userId' => $student["user_id"], 'courseTitle' => $courseCode, 'link' => $link);
                api_mail_html($name_user, $user_info["mail"], $emailsubject, $emailbody, api_get_person_name($currentUser["firstname"], $currentUser["lastname"], null, PERSON_NAME_EMAIL_ADDRESS), $currentUser["mail"], null, null, null, $additionalParameters);
            }
        }
    }
}
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:38,代码来源:work.lib.php

示例14: intval

     $coach_id = intval($_GET['id_coach']);
 } else {
     $coach_id = api_get_user_id();
 }
 if (api_is_drh()) {
     $page_title = get_lang('YourStudents');
     if (empty($session_id)) {
         if (isset($_GET['user_id'])) {
             $user_id = intval($_GET['user_id']);
             $user_info = api_get_user_info($user_id);
             $page_title = api_get_person_name($user_info['firstname'], $user_info['lastname']) . ' : ' . get_lang('Students');
             $courses_by_teacher = CourseManager::get_course_list_of_user_as_course_admin($user_id);
             $students_by_course = array();
             if (!empty($courses_by_teacher)) {
                 foreach ($courses_by_teacher as $course) {
                     $students_by_course = array_keys(CourseManager::get_student_list_from_course_code($course['real_id']));
                     if (count($students_by_course) > 0) {
                         foreach ($students_by_course as $student_by_course) {
                             $students[] = $student_by_course;
                         }
                     }
                 }
             }
             if (!empty($students)) {
                 $students = array_unique($students);
             }
         } else {
             $students = array_keys(UserManager::get_users_followed_by_drh(api_get_user_id(), STUDENT));
         }
         $courses_of_the_platform = CourseManager::get_real_course_list();
         foreach ($courses_of_the_platform as $course) {
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:31,代码来源:student.php


注:本文中的CourseManager::get_student_list_from_course_code方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。