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


PHP Tracking::get_first_connection_date_on_the_course方法代码示例

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


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

示例1: get_user_data

 /**
  * Get data for users list in sortable with pagination
  * @param $from
  * @param $number_of_items
  * @param $column
  * @param $direction
  * @param $includeInvitedUsers boolean Whether include the invited users
  * @return array
  */
 public static function get_user_data($from, $number_of_items, $column, $direction, $includeInvitedUsers = false)
 {
     global $user_ids, $course_code, $additional_user_profile_info, $export_csv, $is_western_name_order, $csv_content, $session_id;
     $course_code = Database::escape_string($course_code);
     $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
     $tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
     $access_url_id = api_get_current_access_url_id();
     // get all users data from a course for sortable with limit
     if (is_array($user_ids)) {
         $user_ids = array_map('intval', $user_ids);
         $condition_user = " WHERE user.user_id IN (" . implode(',', $user_ids) . ") ";
     } else {
         $user_ids = intval($user_ids);
         $condition_user = " WHERE user.user_id = {$user_ids} ";
     }
     if (!empty($_GET['user_keyword'])) {
         $keyword = trim(Database::escape_string($_GET['user_keyword']));
         $condition_user .= " AND (\n                user.firstname LIKE '%" . $keyword . "%' OR\n                user.lastname LIKE '%" . $keyword . "%'  OR\n                user.username LIKE '%" . $keyword . "%'  OR\n                user.email LIKE '%" . $keyword . "%'\n             ) ";
     }
     $url_table = null;
     $url_condition = null;
     if (api_is_multiple_url_enabled()) {
         $url_table = ", " . $tbl_url_rel_user . "as url_users";
         $url_condition = " AND user.user_id = url_users.user_id AND access_url_id='{$access_url_id}'";
     }
     $invitedUsersCondition = '';
     if (!$includeInvitedUsers) {
         $invitedUsersCondition = " AND user.status != " . INVITEE;
     }
     $sql = "SELECT  user.user_id as user_id,\n                    user.official_code  as col0,\n                    user.lastname       as col1,\n                    user.firstname      as col2,\n                    user.username       as col3\n                FROM {$tbl_user} as user {$url_table}\n    \t        {$condition_user} {$url_condition} {$invitedUsersCondition}";
     if (!in_array($direction, array('ASC', 'DESC'))) {
         $direction = 'ASC';
     }
     $column = intval($column);
     $from = intval($from);
     $number_of_items = intval($number_of_items);
     $sql .= " ORDER BY col{$column} {$direction} ";
     $sql .= " LIMIT {$from},{$number_of_items}";
     $res = Database::query($sql);
     $users = array();
     $course_info = api_get_course_info($course_code);
     $total_surveys = 0;
     $total_exercises = ExerciseLib::get_all_exercises($course_info, $session_id, false, null, false, 3);
     if (empty($session_id)) {
         $survey_user_list = array();
         $survey_list = SurveyManager::get_surveys($course_code, $session_id);
         $total_surveys = count($survey_list);
         if (!empty($survey_list)) {
             foreach ($survey_list as $survey) {
                 $user_list = SurveyManager::get_people_who_filled_survey($survey['survey_id'], false, $course_info['real_id']);
                 foreach ($user_list as $user_id) {
                     isset($survey_user_list[$user_id]) ? $survey_user_list[$user_id]++ : ($survey_user_list[$user_id] = 1);
                 }
             }
         }
     }
     while ($user = Database::fetch_array($res, 'ASSOC')) {
         $courseInfo = api_get_course_info($course_code);
         $courseId = $courseInfo['real_id'];
         $user['official_code'] = $user['col0'];
         $user['lastname'] = $user['col1'];
         $user['firstname'] = $user['col2'];
         $user['username'] = $user['col3'];
         $user['time'] = api_time_to_hms(Tracking::get_time_spent_on_the_course($user['user_id'], $courseId, $session_id));
         $avg_student_score = Tracking::get_avg_student_score($user['user_id'], $course_code, array(), $session_id);
         $avg_student_progress = Tracking::get_avg_student_progress($user['user_id'], $course_code, array(), $session_id);
         if (empty($avg_student_progress)) {
             $avg_student_progress = 0;
         }
         $user['average_progress'] = $avg_student_progress . '%';
         $total_user_exercise = Tracking::get_exercise_student_progress($total_exercises, $user['user_id'], $courseId, $session_id);
         $user['exercise_progress'] = $total_user_exercise;
         $total_user_exercise = Tracking::get_exercise_student_average_best_attempt($total_exercises, $user['user_id'], $courseId, $session_id);
         $user['exercise_average_best_attempt'] = $total_user_exercise;
         if (is_numeric($avg_student_score)) {
             $user['student_score'] = $avg_student_score . '%';
         } else {
             $user['student_score'] = $avg_student_score;
         }
         $user['count_assignments'] = Tracking::count_student_assignments($user['user_id'], $course_code, $session_id);
         $user['count_messages'] = Tracking::count_student_messages($user['user_id'], $course_code, $session_id);
         $user['first_connection'] = Tracking::get_first_connection_date_on_the_course($user['user_id'], $courseId, $session_id);
         $user['last_connection'] = Tracking::get_last_connection_date_on_the_course($user['user_id'], $courseInfo, $session_id);
         // we need to display an additional profile field
         $user['additional'] = '';
         if (isset($_GET['additional_profile_field']) && is_numeric($_GET['additional_profile_field'])) {
             if (isset($additional_user_profile_info[$user['user_id']]) && is_array($additional_user_profile_info[$user['user_id']])) {
                 $user['additional'] = implode(', ', $additional_user_profile_info[$user['user_id']]);
             }
         }
         if (empty($session_id)) {
//.........这里部分代码省略.........
开发者ID:feroli1000,项目名称:chamilo-lms,代码行数:101,代码来源:tracking.lib.php

示例2: array

     $row = array();
     $row[] = $student_datas['official_code'];
     $row[] = $student_datas['lastname'];
     $row[] = $student_datas['firstname'];
     $row[] = api_time_to_hms($avg_time_spent);
     if (is_null($avg_student_score)) {
         $avg_student_score = 0;
     }
     if (is_null($avg_student_progress)) {
         $avg_student_progress = 0;
     }
     $row[] = $avg_student_progress . ' %';
     $row[] = $avg_student_score . ' %';
     $row[] = $total_assignments;
     $row[] = $total_messages;
     $row[] = Tracking::get_first_connection_date_on_the_course($student_id, $course_code);
     $row[] = Tracking::get_last_connection_date_on_the_course($student_id, $course_code);
     if ($export_csv) {
         $row[8] = strip_tags($row[8]);
         $csv_content[] = $row;
     }
     $row[] = '<center><a href="../mySpace/myStudents.php?student=' . $student_id . '&details=true&course=' . $course_code . '&origin=tracking_course"><img src="' . api_get_path(WEB_IMG_PATH) . '2rightarrow.gif" border="0" /></a></center>';
     $all_datas[] = $row;
 }
 usort($all_datas, 'sort_users');
 $page = $table->get_pager()->getCurrentPageID();
 $all_datas = array_slice($all_datas, ($page - 1) * $table->per_page, $table->per_page);
 if ($export_csv) {
     usort($csv_content, 'sort_users');
 }
 foreach ($all_datas as $row) {
开发者ID:RusticiSoftware,项目名称:SCORMCloud_DokeosMod,代码行数:31,代码来源:courseLog.php

示例3: export_tracking_user_overview


//.........这里部分代码省略.........
     } else {
         $orderby = 0;
     }
     if ($is_western_name_order != api_is_western_name_order() && ($orderby == 1 || $orderby == 2)) {
         // Swapping the sorting column if name order for export is different than the common name order.
         $orderby = 3 - $orderby;
     }
     if ($_GET['tracking_user_overview_direction']) {
         $direction = $_GET['tracking_user_overview_direction'];
     } else {
         $direction = 'ASC';
     }
     $user_data = MySpace::get_user_data_tracking_overview($from, 1000, $orderby, $direction);
     // the first line of the csv file with the column headers
     $csv_row = array();
     $csv_row[] = get_lang('OfficialCode');
     if ($is_western_name_order) {
         $csv_row[] = get_lang('FirstName', '');
         $csv_row[] = get_lang('LastName', '');
     } else {
         $csv_row[] = get_lang('LastName', '');
         $csv_row[] = get_lang('FirstName', '');
     }
     $csv_row[] = get_lang('LoginName');
     $csv_row[] = get_lang('CourseCode');
     // the additional user defined fields (only those that were selected to be exported)
     $fields = UserManager::get_extra_fields(0, 50, 5, 'ASC');
     if (is_array($_SESSION['additional_export_fields'])) {
         foreach ($_SESSION['additional_export_fields'] as $key => $extra_field_export) {
             $csv_row[] = $fields[$extra_field_export][3];
             $field_names_to_be_exported[] = 'extra_' . $fields[$extra_field_export][1];
         }
     }
     $csv_row[] = get_lang('AvgTimeSpentInTheCourse', '');
     $csv_row[] = get_lang('AvgStudentsProgress', '');
     $csv_row[] = get_lang('AvgCourseScore', '');
     $csv_row[] = get_lang('AvgExercisesScore', '');
     $csv_row[] = get_lang('AvgMessages', '');
     $csv_row[] = get_lang('AvgAssignments', '');
     $csv_row[] = get_lang('TotalExercisesScoreObtained', '');
     $csv_row[] = get_lang('TotalExercisesScorePossible', '');
     $csv_row[] = get_lang('TotalExercisesAnswered', '');
     $csv_row[] = get_lang('TotalExercisesScorePercentage', '');
     $csv_row[] = get_lang('FirstLogin', '');
     $csv_row[] = get_lang('LatestLogin', '');
     $csv_content[] = $csv_row;
     // the other lines (the data)
     foreach ($user_data as $key => $user) {
         // getting all the courses of the user
         $sql = "SELECT * FROM {$tbl_course_user}\n                    WHERE user_id = '" . intval($user[4]) . "' AND relation_type<>" . COURSE_RELATION_TYPE_RRHH . " ";
         $result = Database::query($sql);
         while ($row = Database::fetch_row($result)) {
             $courseInfo = api_get_course_info($row['course_code']);
             $courseId = $courseInfo['real_id'];
             $csv_row = array();
             // user official code
             $csv_row[] = $user[0];
             // user first|last name
             $csv_row[] = $user[1];
             // user last|first name
             $csv_row[] = $user[2];
             // user login name
             $csv_row[] = $user[3];
             // course code
             $csv_row[] = $row[0];
             // the additional defined user fields
             $extra_fields = MySpace::get_user_overview_export_extra_fields($user[4]);
             if (is_array($field_names_to_be_exported)) {
                 foreach ($field_names_to_be_exported as $key => $extra_field_export) {
                     $csv_row[] = $extra_fields[$extra_field_export];
                 }
             }
             // time spent in the course
             $csv_row[] = api_time_to_hms(Tracking::get_time_spent_on_the_course($user[4], $courseId));
             // student progress in course
             $csv_row[] = round(Tracking::get_avg_student_progress($user[4], $row[0]), 2);
             // student score
             $csv_row[] = round(Tracking::get_avg_student_score($user[4], $row[0]), 2);
             // student tes score
             $csv_row[] = round(Tracking::get_avg_student_exercise_score($user[4], $row[0]), 2);
             // student messages
             $csv_row[] = Tracking::count_student_messages($user[4], $row[0]);
             // student assignments
             $csv_row[] = Tracking::count_student_assignments($user[4], $row[0]);
             // student exercises results
             $exercises_results = MySpace::exercises_results($user[4], $row[0]);
             $csv_row[] = $exercises_results['score_obtained'];
             $csv_row[] = $exercises_results['score_possible'];
             $csv_row[] = $exercises_results['questions_answered'];
             $csv_row[] = $exercises_results['percentage'];
             // first connection
             $csv_row[] = Tracking::get_first_connection_date_on_the_course($user[4], $courseId);
             // last connection
             $csv_row[] = strip_tags(Tracking::get_last_connection_date_on_the_course($user[4], $courseInfo));
             $csv_content[] = $csv_row;
         }
     }
     Export::arrayToCsv($csv_content, 'reporting_user_overview');
     exit;
 }
开发者ID:feroli1000,项目名称:chamilo-lms,代码行数:101,代码来源:myspace.lib.php

示例4: export_tracking_user_overview

/**
 * This function exports the table that we see in display_tracking_user_overview()
 *
 * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, Belgium
 * @version Dokeos 1.8.6
 * @since October 2008
 */
function export_tracking_user_overview()
{
    // database table definitions
    $tbl_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
    // the values of the sortable table
    if ($_GET['tracking_user_overview_page_nr']) {
        $from = $_GET['tracking_user_overview_page_nr'];
    } else {
        $from = 0;
    }
    if ($_GET['tracking_user_overview_column']) {
        $orderby = $_GET['tracking_user_overview_column'];
    } else {
        $orderby = 0;
    }
    if ($_GET['tracking_user_overview_direction']) {
        $direction = $_GET['tracking_user_overview_direction'];
    } else {
        $direction = 'ASC';
    }
    $user_data = get_user_data_tracking_overview($from, 1000, $orderby, $direction);
    // the first line of the csv file with the column headers
    $csv_row = array();
    $csv_row[] = get_lang('OfficialCode');
    $csv_row[] = get_lang('LastName');
    $csv_row[] = get_lang('FirstName');
    $csv_row[] = get_lang('LoginName');
    $csv_row[] = get_lang('CourseCode');
    // the additional user defined fields (only those that were selected to be exported)
    require_once api_get_path(LIBRARY_PATH) . 'usermanager.lib.php';
    $fields = UserManager::get_extra_fields(0, 50, 5, 'ASC');
    foreach ($_SESSION['additional_export_fields'] as $key => $extra_field_export) {
        $csv_row[] = $fields[$extra_field_export][3];
        $field_names_to_be_exported[] = 'extra_' . $fields[$extra_field_export][1];
    }
    $csv_row[] = get_lang('AvgTimeSpentInTheCourse');
    $csv_row[] = get_lang('AvgStudentsProgress');
    $csv_row[] = get_lang('AvgCourseScore');
    $csv_row[] = get_lang('AvgExercisesScore');
    $csv_row[] = get_lang('AvgMessages');
    $csv_row[] = get_lang('AvgAssignments');
    $csv_row[] = get_lang('TotalExercisesScoreObtained');
    $csv_row[] = get_lang('TotalExercisesScorePossible');
    $csv_row[] = get_lang('TotalExercisesAnswered');
    $csv_row[] = get_lang('TotalExercisesScorePercentage');
    $csv_row[] = get_lang('FirstLogin');
    $csv_row[] = get_lang('LatestLogin');
    $csv_content[] = $csv_row;
    // the other lines (the data)
    foreach ($user_data as $key => $user) {
        // getting all the courses of the user
        $sql = "SELECT * FROM {$tbl_course_user} WHERE user_id = '" . Database::escape_string($user[4]) . "'";
        $result = api_sql_query($sql, __FILE__, __LINE__);
        while ($row = Database::fetch_row($result)) {
            $csv_row = array();
            // user official code
            $csv_row[] = $user[0];
            // user last name
            $csv_row[] = $user[1];
            // user first name
            $csv_row[] = $user[2];
            // user login name
            $csv_row[] = $user[3];
            // course code
            $csv_row[] = $row[0];
            // the additional defined user fields
            $extra_fields = get_user_overview_export_extra_fields($user[4]);
            foreach ($field_names_to_be_exported as $key => $extra_field_export) {
                $csv_row[] = $extra_fields[$extra_field_export];
            }
            // time spent in the course
            $csv_row[] = api_time_to_hms(Tracking::get_time_spent_on_the_course($user[4], $row[0]));
            // student progress in course
            $csv_row[] = round(Tracking::get_avg_student_progress($user[4], $row[0]), 2);
            // student score
            $csv_row[] = round(Tracking::get_avg_student_score($user[4], $row[0]), 2);
            // student tes score
            $csv_row[] = round(Tracking::get_avg_student_exercise_score($user[4], $row[0]), 2);
            // student messages
            $csv_row[] = Tracking::count_student_messages($user[4], $row[0]);
            // student assignments
            $csv_row[] = Tracking::count_student_assignments($user[4], $row[0]);
            // student exercises results
            $exercises_results = exercises_results($user[4], $row[0]);
            $csv_row[] = $exercises_results['score_obtained'];
            $csv_row[] = $exercises_results['score_possible'];
            $csv_row[] = $exercises_results['questions_answered'];
            $csv_row[] = $exercises_results['percentage'];
            // first connection
            $csv_row[] = Tracking::get_first_connection_date_on_the_course($user[4], $row[0]);
            // last connection
            $csv_row[] = strip_tags(Tracking::get_last_connection_date_on_the_course($user[4], $row[0]));
            $csv_content[] = $csv_row;
//.........这里部分代码省略.........
开发者ID:RusticiSoftware,项目名称:SCORMCloud_DokeosMod,代码行数:101,代码来源:index.php


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