本文整理汇总了PHP中GroupManager::getStudentsAndTutors方法的典型用法代码示例。如果您正苦于以下问题:PHP GroupManager::getStudentsAndTutors方法的具体用法?PHP GroupManager::getStudentsAndTutors怎么用?PHP GroupManager::getStudentsAndTutors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GroupManager
的用法示例。
在下文中一共展示了GroupManager::getStudentsAndTutors方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show_to_form_group
/**
* this function shows the form for sending a message to a specific group or user.
*/
public static function show_to_form_group($group_id)
{
echo "<table id=\"recipient_list\" >";
echo "<tr>";
echo "<td>";
echo "<select id=\"not_selected_form\" name=\"not_selected_form[]\" size=5 style=\"width:200px\" multiple>";
$group_users = GroupManager::getStudentsAndTutors($group_id);
foreach ($group_users as $user) {
echo '<option value="' . $user['user_id'] . '" title="' . sprintf(get_lang('LoginX'), $user['username']) . '" >' . api_get_person_name($user['firstname'], $user['lastname']) . '</option>';
}
echo '</select>';
echo "</td>";
// the buttons for adding or removing groups/users
echo "<td valign=\"middle\">";
echo '<button class="btn btn-default" type="button" onClick="javascript: move(this.form.elements[1], this.form.elements[4])" onClick="javascript: move(this.form.elements[1], this.form.elements[4])"><em class="fa fa-arrow-right"></em></button>';
echo '<br /> <br />';
echo '<button class="btn btn-default" type="button" onClick="javascript: move(this.form.elements[4], this.form.elements[1])" onClick="javascript: move(this.form.elements[4], this.form.elements[1])"><em class="fa fa-arrow-left"></em></button>';
echo "</td>";
echo "<td>";
echo "<select id=\"selectedform\" name=\"selectedform[]\" size=5 style=\"width:200px\" multiple>";
echo '</select>';
echo "</td>";
echo "</tr>";
echo "</table>";
}
示例2: unsubscribeGroupsToItem
/**
* Unsubscribe groups to item
* @param $tool
* @param Course $course
* @param Session $session
* @param $itemId
* @param $groups
*/
public function unsubscribeGroupsToItem($tool, Course $course, Session $session = null, $itemId, $groups, $unsubscribeUserToo = false)
{
if (!empty($groups)) {
$em = $this->getEntityManager();
foreach ($groups as $groupId) {
$item = $this->findOneBy(array('tool' => $tool, 'session' => $session, 'ref' => $itemId, 'group' => $groupId));
if ($item) {
$em->remove($item);
}
if ($unsubscribeUserToo) {
//Adding users from this group to the item
$users = \GroupManager::getStudentsAndTutors($groupId);
$newUserList = array();
if (!empty($users)) {
foreach ($users as $user) {
$newUserList[] = $user['user_id'];
}
$this->unsubcribeUsersToItem('learnpath', $course, $session, $itemId, $newUserList);
}
}
}
$em->flush();
}
}