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


PHP GroupManager::getStudents方法代码示例

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


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

示例1: 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;
 }
开发者ID:daffef,项目名称:chamilo-lms,代码行数:64,代码来源:attendance.lib.php

示例2: getOverview

 /**
  * @param int $courseId
  * @param string $keyword
  * @return string
  */
 public static function getOverview($courseId, $keyword = null)
 {
     $content = null;
     $categories = GroupManager::get_categories();
     if (!empty($categories)) {
         foreach ($categories as $category) {
             if (api_get_setting('allow_group_categories') == 'true') {
                 $content .= '<h2>' . $category['title'] . '</h2>';
             }
             if (!empty($keyword)) {
                 $groups = GroupManager::getGroupListFilterByName($keyword, $category['id'], $courseId);
             } else {
                 $groups = GroupManager::get_group_list($category['id']);
             }
             $content .= '<ul>';
             if (!empty($groups)) {
                 foreach ($groups as $group) {
                     $content .= '<li>';
                     $content .= Display::tag('h3', Security::remove_XSS($group['name']));
                     $users = GroupManager::getTutors($group['id']);
                     if (!empty($users)) {
                         $content .= '<ul>';
                         $content .= "<li>" . Display::tag('h4', get_lang('Tutors')) . "</li><ul>";
                         foreach ($users as $user) {
                             $user_info = api_get_user_info($user['user_id']);
                             $content .= '<li title="' . $user_info['username'] . '">' . $user_info['complete_name_with_username'] . '</li>';
                         }
                         $content .= '</ul>';
                         $content .= '</ul>';
                     }
                     $users = GroupManager::getStudents($group['id']);
                     if (!empty($users)) {
                         $content .= '<ul>';
                         $content .= "<li>" . Display::tag('h4', get_lang('Students')) . "</li><ul>";
                         foreach ($users as $user) {
                             $user_info = api_get_user_info($user['user_id']);
                             $content .= '<li title="' . $user_info['username'] . '">' . $user_info['complete_name_with_username'] . '</li>';
                         }
                         $content .= '</ul>';
                         $content .= '</ul>';
                     }
                     $content .= '</li>';
                 }
             }
             $content .= '</ul>';
         }
     }
     return $content;
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:54,代码来源:groupmanager.lib.php

示例3: saveInvitations

 /**
  * This function saves all the invitations of course users and additional users in the database
  * and sends the invitations by email
  *
  * @param	array	Users array can be both a list of course uids AND a list of additional emailaddresses
  * @param 	string	Title of the invitation, used as the title of the mail
  * @param 	string	Text of the invitation, used as the text of the mail.
  * 				 The text has to contain a **link** string or this will automatically be added to the end
  *
  * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
  * @author Julio Montoya - Adding auto-generated link support
  * @version January 2007
  *
  */
 public static function saveInvitations($users_array, $invitation_title, $invitation_text, $reminder = 0, $sendmail = 0, $remindUnAnswered = 0)
 {
     if (!is_array($users_array)) {
         // Should not happen
         return 0;
     }
     // Getting the survey information
     $survey_data = SurveyManager::get_survey($_GET['survey_id']);
     $survey_invitations = SurveyUtil::get_invitations($survey_data['survey_code']);
     $already_invited = SurveyUtil::get_invited_users($survey_data['code']);
     // Remind unanswered is a special version of remind all reminder
     $exclude_users = array();
     if ($remindUnAnswered == 1) {
         // Remind only unanswered users
         $reminder = 1;
         $exclude_users = SurveyManager::get_people_who_filled_survey($_GET['survey_id']);
     }
     $counter = 0;
     // Nr of invitations "sent" (if sendmail option)
     $course_id = api_get_course_int_id();
     $session_id = api_get_session_id();
     $result = CourseManager::separateUsersGroups($users_array);
     $groupList = $result['groups'];
     $users_array = $result['users'];
     foreach ($groupList as $groupId) {
         $userGroupList = GroupManager::getStudents($groupId);
         $userGroupIdList = array_column($userGroupList, 'user_id');
         $users_array = array_merge($users_array, $userGroupIdList);
         $params = array('c_id' => $course_id, 'session_id' => $session_id, 'group_id' => $groupId, 'survey_code' => $survey_data['code']);
         $invitationExists = self::invitationExists($course_id, $session_id, $groupId, $survey_data['code']);
         if (empty($invitationExists)) {
             self::save_invitation($params);
         }
     }
     $users_array = array_unique($users_array);
     foreach ($users_array as $key => $value) {
         if (!isset($value) || $value == '') {
             continue;
         }
         // Skip user if reminding only unanswered people
         if (in_array($value, $exclude_users)) {
             continue;
         }
         // Get the unique invitation code if we already have it
         if ($reminder == 1 && array_key_exists($value, $survey_invitations)) {
             $invitation_code = $survey_invitations[$value]['invitation_code'];
         } else {
             $invitation_code = md5($value . microtime());
         }
         $new_user = false;
         // User not already invited
         // Store the invitation if user_id not in $already_invited['course_users'] OR email is not in $already_invited['additional_users']
         $addit_users_array = isset($already_invited['additional_users']) && !empty($already_invited['additional_users']) ? explode(';', $already_invited['additional_users']) : array();
         $my_alredy_invited = $already_invited['course_users'] == null ? array() : $already_invited['course_users'];
         if (is_numeric($value) && !in_array($value, $my_alredy_invited) || !is_numeric($value) && !in_array($value, $addit_users_array)) {
             $new_user = true;
             if (!array_key_exists($value, $survey_invitations)) {
                 $params = array('c_id' => $course_id, 'session_id' => $session_id, 'user' => $value, 'survey_code' => $survey_data['code'], 'invitation_code' => $invitation_code, 'invitation_date' => api_get_utc_datetime());
                 self::save_invitation($params);
             }
         }
         // Send the email if checkboxed
         if (($new_user || $reminder == 1) && $sendmail != 0) {
             // Make a change for absolute url
             if (isset($invitation_text)) {
                 $invitation_text = api_html_entity_decode($invitation_text, ENT_QUOTES);
                 $invitation_text = str_replace('src="../../', 'src="' . api_get_path(WEB_PATH), $invitation_text);
                 $invitation_text = trim(stripslashes($invitation_text));
             }
             SurveyUtil::send_invitation_mail($value, $invitation_code, $invitation_title, $invitation_text);
             $counter++;
         }
     }
     return $counter;
     // Number of invitations sent
 }
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:90,代码来源:survey.lib.php


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