function getLearnPathDetailByClass($path_id, $courseUserList) { $classList = get_class_list_of_course(claro_get_current_course_id()); foreach ($courseUserList as $user) { $userList[$user['user_id']] = $user; } //prepare userlist per class while keeping track of classless users $classlessUserList = $userList; foreach ($classList as $classKey => $class) { $classList[$classKey]['userList'] = array_intersect_key($userList, array_flip(get_class_list_user_id_list(array($class['id'])))); $classList[$classKey]['name'] = ucfirst(get_lang('class')) . ' ' . $classList[$classKey]['name']; $classlessUserList = array_diff_key($classlessUserList, $classList[$classKey]['userList']); } //add remaining users to a "classless" class array_unshift($classList, array('name' => '', 'userList' => $classlessUserList)); $out = ''; foreach ($classList as $class) { if (empty($class['userList'])) { continue; } if (!empty($class['name'])) { $out .= '<span style="font-weight: bold;">' . $class['name'] . '</span><br />'; } $out .= getLearnPathDetailTable($path_id, $class['userList']); } return $out; }
/** * Exports the users in a class to a CSV file * @param int $id id of the class * @param array $fields optionnal names for the headers of the generated csv * @return string * @author schampagne <http://forum.claroline.net/memberlist.php?mode=viewprofile&u=45044> */ function export_user_list_for_class($class_id, $fields = array('user_id', 'username', 'lastname', 'firstname', 'email', 'officialCode')) { return csv_export_user_list(get_class_list_user_id_list(array($class_id)), $fields); }
$classIdList = array_merge($classIdList, getSubClasses($elmtId)); break; case 'GROUP': $groupIdList[] = $elmtId; break; case 'USER': $userIdList[] = $elmtId; break; } } // end foreach /* * Select the students of the different groups */ if (!empty($classIdList)) { $userIdList = array_merge($userIdList, get_class_list_user_id_list($classIdList)); } if (!empty($groupIdList)) { $userIdList = array_merge($userIdList, get_group_list_user_id_list($groupIdList)); } // subject $subject = $_REQUEST['subject']; if (empty($subject)) { $subject .= get_lang('Message from your lecturer'); } // content $body = $_REQUEST['content']; $message = new MessageToSend(claro_get_current_user_id(), $subject, $body); $message->setCourse(claro_get_current_course_id()); $recipient = new UserListRecipient(); $recipient->addUserIdList($userIdList);