本文整理汇总了PHP中GroupManager::get_subscribed_tutors方法的典型用法代码示例。如果您正苦于以下问题:PHP GroupManager::get_subscribed_tutors方法的具体用法?PHP GroupManager::get_subscribed_tutors怎么用?PHP GroupManager::get_subscribed_tutors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GroupManager
的用法示例。
在下文中一共展示了GroupManager::get_subscribed_tutors方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: auto_add_page_users
/**
* Function wizard individual assignment
* @author Juan Carlos Raña <herodoto@telefonica.net>
*/
public function auto_add_page_users($values)
{
$assignment_type = $values['assignment'];
$session_id = $this->session_id;
$groupId = api_get_group_id();
if ($groupId == 0) {
//extract course members
if (!empty($session_id)) {
$a_users_to_add = CourseManager::get_user_list_from_course_code(api_get_course_id(), $session_id);
} else {
$a_users_to_add = CourseManager::get_user_list_from_course_code(api_get_course_id(), 0);
}
} else {
//extract group members
$subscribed_users = GroupManager::get_subscribed_users($groupId);
$subscribed_tutors = GroupManager::get_subscribed_tutors($groupId);
$a_users_to_add_with_duplicates = array_merge($subscribed_users, $subscribed_tutors);
//remove duplicates
$a_users_to_add = $a_users_to_add_with_duplicates;
//array_walk($a_users_to_add, create_function('&$value,$key', '$value = json_encode($value);'));
$a_users_to_add = array_unique($a_users_to_add);
//array_walk($a_users_to_add, create_function('&$value,$key', '$value = json_decode($value, true);'));
}
$all_students_pages = array();
// Data about teacher
$userId = api_get_user_id();
$userinfo = api_get_user_info($userId);
$username = api_htmlentities(sprintf(get_lang('LoginX'), $userinfo['username'], ENT_QUOTES));
$name = $userinfo['complete_name'] . " - " . $username;
$photo = '<img src="' . $userinfo['avatar'] . '" alt="' . $name . '" width="40" height="50" align="top" title="' . $name . '" />';
// teacher assignment title
$title_orig = $values['title'];
// teacher assignment reflink
$link2teacher = $values['title'] = $title_orig . "_uass" . $userId;
// first: teacher name, photo, and assignment description (original content)
$content_orig_A = '<div align="center" style="background-color: #F5F8FB; border:solid; border-color: #E6E6E6">
<table border="0">
<tr><td style="font-size:24px">' . get_lang('AssignmentDesc') . '</td></tr>
<tr><td>' . $photo . '<br />' . Display::tag('span', api_get_person_name($userinfo['firstname'], $userinfo['lastname']), array('title' => $username)) . '</td></tr>
</table></div>';
$content_orig_B = '<br/><div align="center" style="font-size:24px">' . get_lang('AssignmentDescription') . ': ' . $title_orig . '</div><br/>' . $_POST['content'];
//Second: student list (names, photo and links to their works).
//Third: Create Students work pages.
foreach ($a_users_to_add as $o_user_to_add) {
if ($o_user_to_add['user_id'] != $userId) {
// except that puts the task
$assig_user_id = $o_user_to_add['user_id'];
// identifies each page as created by the student, not by teacher
$userPicture = UserManager::getUserPicture($assig_user_id);
$username = api_htmlentities(sprintf(get_lang('LoginX'), $o_user_to_add['username'], ENT_QUOTES));
$name = api_get_person_name($o_user_to_add['firstname'], $o_user_to_add['lastname']) . " . " . $username;
$photo = '<img src="' . $userPicture . '" alt="' . $name . '" width="40" height="50" align="bottom" title="' . $name . '" />';
$is_tutor_of_group = GroupManager::is_tutor_of_group($assig_user_id, $groupId);
//student is tutor
$is_tutor_and_member = GroupManager::is_tutor_of_group($assig_user_id, $groupId) && GroupManager::is_subscribed($assig_user_id, $groupId);
// student is tutor and member
if ($is_tutor_and_member) {
$status_in_group = get_lang('GroupTutorAndMember');
} else {
if ($is_tutor_of_group) {
$status_in_group = get_lang('GroupTutor');
} else {
$status_in_group = " ";
//get_lang('GroupStandardMember')
}
}
if ($assignment_type == 1) {
$values['title'] = $title_orig;
$values['content'] = '<div align="center" style="background-color: #F5F8FB; border:solid; border-color: #E6E6E6">
<table border="0">
<tr><td style="font-size:24px">' . get_lang('AssignmentWork') . '</td></tr>
<tr><td>' . $photo . '<br />' . $name . '</td></tr></table>
</div>[[' . $link2teacher . ' | ' . get_lang('AssignmentLinktoTeacherPage') . ']] ';
//If $content_orig_B is added here, the task written by the professor was copied to the page of each student. TODO: config options
// AssignmentLinktoTeacherPage
$all_students_pages[] = '<li>' . Display::tag('span', strtoupper($o_user_to_add['lastname']) . ', ' . $o_user_to_add['firstname'], array('title' => $username)) . ' [[' . $_POST['title'] . "_uass" . $assig_user_id . ' | ' . $photo . ']] ' . $status_in_group . '</li>';
//don't change this line without guaranteeing that users will be ordered by last names in the following format (surname, name)
$values['assignment'] = 2;
}
$this->assig_user_id = $assig_user_id;
self::save_new_wiki($values);
}
}
foreach ($a_users_to_add as $o_user_to_add) {
if ($o_user_to_add['user_id'] == $userId) {
$assig_user_id = $o_user_to_add['user_id'];
if ($assignment_type == 1) {
$values['title'] = $title_orig;
$values['comment'] = get_lang('AssignmentDesc');
sort($all_students_pages);
$values['content'] = $content_orig_A . $content_orig_B . '<br/>
<div align="center" style="font-size:18px; background-color: #F5F8FB; border:solid; border-color:#E6E6E6">
' . get_lang('AssignmentLinkstoStudentsPage') . '
</div><br/>
<div style="background-color: #F5F8FB; border:solid; border-color:#E6E6E6">
<ol>' . implode($all_students_pages) . '</ol>
//.........这里部分代码省略.........
示例2: function
}
}
}
/* MAIN CODE */
$htmlHeadXtra[] = '<script>
$(document).ready( function() {
$("#max_member").on("focus", function() {
$("#max_member_selected").attr("checked", true);
});
});
</script>';
// Build form
$form = new FormValidator('group_edit', 'post', api_get_self() . '?' . api_get_cidreq());
$form->addElement('hidden', 'action');
// Group tutors
$group_tutor_list = GroupManager::get_subscribed_tutors($current_group['id']);
$selected_tutors = array();
foreach ($group_tutor_list as $index => $user) {
$selected_tutors[] = $user['user_id'];
}
$complete_user_list = GroupManager::fill_groups_list($current_group['id']);
$possible_users = array();
$userGroup = new UserGroup();
$orderUserListByOfficialCode = api_get_setting('order_user_list_by_official_code');
if (!empty($complete_user_list)) {
usort($complete_user_list, 'sort_users');
foreach ($complete_user_list as $index => $user) {
$officialCode = !empty($user['official_code']) ? ' - ' . $user['official_code'] : null;
$groups = $userGroup->getUserGroupListByUser($user['user_id']);
$groupNameListToString = '';
if (!empty($groups)) {
示例3: auto_add_page_users
/**
* Function wizard individual assignment
* @author Juan Carlos Raña <herodoto@telefonica.net>
*/
function auto_add_page_users($assignment_type)
{
global $assig_user_id, $session_id;
//$assig_user_id is need to identify end reflinks
$_clean['group_id'] = (int) $_SESSION['_gid'];
if ($_clean['group_id'] == 0) {
//extract course members
if (!empty($session_id)) {
$a_users_to_add = CourseManager::get_user_list_from_course_code($_SESSION['_course']['id'], $session_id);
} else {
$a_users_to_add = CourseManager::get_user_list_from_course_code($_SESSION['_course']['id'], 0);
}
} else {
//extract group members
$subscribed_users = GroupManager::get_subscribed_users($_clean['group_id']);
$subscribed_tutors = GroupManager::get_subscribed_tutors($_clean['group_id']);
$a_users_to_add_with_duplicates = array_merge($subscribed_users, $subscribed_tutors);
//remove duplicates
$a_users_to_add = $a_users_to_add_with_duplicates;
//array_walk($a_users_to_add, create_function('&$value,$key', '$value = json_encode($value);'));
$a_users_to_add = array_unique($a_users_to_add);
//array_walk($a_users_to_add, create_function('&$value,$key', '$value = json_decode($value, true);'));
}
//echo print_r($a_users_to_add);
$all_students_pages = array();
//data about teacher
$userinfo = api_get_user_info(api_get_user_id());
$name = $userinfo['complete_name_login_as'];
if (api_get_user_id() != 0) {
$image_path = UserManager::get_user_picture_path_by_id(api_get_user_id(), 'web', false, true);
$image_repository = $image_path['dir'];
$existing_image = $image_path['file'];
$photo = '<img src="' . $image_repository . $existing_image . '" alt="' . $name . '" width="40" height="50" align="top" title="' . $name . '" />';
} else {
$photo = '<img src="' . api_get_path(WEB_CODE_PATH) . "img/unknown.jpg" . '" alt="' . $name . '" width="40" height="50" align="top" title="' . $name . '" />';
}
//teacher assignment title
$title_orig = $_POST['title'];
//teacher assignment reflink
$link2teacher = $_POST['title'] = $title_orig . "_uass" . api_get_user_id();
//first: teacher name, photo, and assignment description (original content)
// $content_orig_A='<div align="center" style="background-color: #F5F8FB; border:double">'.$photo.'<br />'.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).'<br />('.get_lang('Teacher').')</div><br/><div>';
$content_orig_A = '<div align="center" style="background-color: #F5F8FB; border:solid; border-color: #E6E6E6"><table border="0"><tr><td style="font-size:24px">' . get_lang('AssignmentDesc') . '</td></tr><tr><td>' . $photo . '<br />' . Display::tag('span', $name) . '</td></tr></table></div>';
$content_orig_B = '<br/><div align="center" style="font-size:24px">' . get_lang('AssignmentDescription') . ': ' . $title_orig . '</div><br/>' . $_POST['content'];
//Second: student list (names, photo and links to their works).
//Third: Create Students work pages.
foreach ($a_users_to_add as $user_id => $o_user_to_add) {
if ($o_user_to_add['user_id'] != api_get_user_id()) {
$assig_user_id = $o_user_to_add['user_id'];
//identifies each page as created by the student, not by teacher
$image_path = UserManager::get_user_picture_path_by_id($assig_user_id, 'web', false, true);
$image_repository = $image_path['dir'];
$existing_image = $image_path['file'];
$username = api_htmlentities(sprintf(get_lang('LoginX'), $o_user_to_add['username'], ENT_QUOTES));
$name = api_get_person_name($o_user_to_add['firstname'], $o_user_to_add['lastname']) . " . " . $username;
$photo = '<img src="' . $image_repository . $existing_image . '" alt="' . $name . '" width="40" height="50" align="bottom" title="' . $name . '" />';
$is_tutor_of_group = GroupManager::is_tutor_of_group($assig_user_id, $_clean['group_id']);
//student is tutor
$is_tutor_and_member = GroupManager::is_tutor_of_group($assig_user_id, $_clean['group_id']) && GroupManager::is_subscribed($assig_user_id, $_clean['group_id']);
//student is tutor and member
if ($is_tutor_and_member) {
$status_in_group = get_lang('GroupTutorAndMember');
} else {
if ($is_tutor_of_group) {
$status_in_group = get_lang('GroupTutor');
} else {
$status_in_group = " ";
//get_lang('GroupStandardMember')
}
}
if ($assignment_type == 1) {
$_POST['title'] = $title_orig;
$_POST['comment'] = get_lang('AssignmentFirstComToStudent');
$_POST['content'] = '<div align="center" style="background-color: #F5F8FB; border:solid; border-color: #E6E6E6"><table border="0"><tr><td style="font-size:24px">' . get_lang('AssignmentWork') . '</td></tr><tr><td>' . $photo . '<br />' . $name . '</td></tr></table></div>[[' . $link2teacher . ' | ' . get_lang('AssignmentLinktoTeacherPage') . ']] ';
//If $content_orig_B is added here, the task written by the professor was copied to the page of each student. TODO: config options
//AssignmentLinktoTeacherPage
$all_students_pages[] = '<li>' . Display::tag('span', strtoupper($o_user_to_add['lastname']) . ', ' . $o_user_to_add['firstname'], array('title' => $username)) . ' [[' . $_POST['title'] . "_uass" . $assig_user_id . ' | ' . $photo . ']] ' . $status_in_group . '</li>';
//don't change this line without guaranteeing that users will be ordered by last names in the following format (surname, name)
//$all_students_pages[] = '<li><table border="0"><tr><td width="200">'.api_get_person_name($o_user_to_add['lastname'], $o_user_to_add['firstname']).'</td><td>[['.$_POST['title']."_uass".$assig_user_id.' | '.$photo.']] '.$status_in_group.'</td></tr></table></li>';
$_POST['assignment'] = 2;
}
save_new_wiki();
}
}
//end foreach for each user
foreach ($a_users_to_add as $user_id => $o_user_to_add) {
if ($o_user_to_add['user_id'] == api_get_user_id()) {
$assig_user_id = $o_user_to_add['user_id'];
if ($assignment_type == 1) {
$_POST['title'] = $title_orig;
$_POST['comment'] = get_lang('AssignmentDesc');
sort($all_students_pages);
$_POST['content'] = $content_orig_A . $content_orig_B . '<br/><div align="center" style="font-size:18px; background-color: #F5F8FB; border:solid; border-color:#E6E6E6">' . get_lang('AssignmentLinkstoStudentsPage') . '</div><br/><div style="background-color: #F5F8FB; border:solid; border-color:#E6E6E6"><ol>' . implode($all_students_pages) . '</ol></div><br/>';
$_POST['assignment'] = 1;
}
save_new_wiki();
//.........这里部分代码省略.........