Exemplo n.º 1
0
        }
        $name = api_get_person_name($user['firstname'], $user['lastname']) . ' (' . $user['username'] . ')' . $officialCode;
        if ($orderUserListByOfficialCode === 'true') {
            $officialCode = !empty($user['official_code']) ? $user['official_code'] . " - " : '? - ';
            $name = $officialCode . " " . api_get_person_name($user['firstname'], $user['lastname']) . ' (' . $user['username'] . ')';
        }
        $possible_users[$user['user_id']] = $name . $groupNameListToString;
    }
}
$group_tutors_element = $form->addElement('advmultiselect', 'group_tutors', get_lang('GroupTutors'), $possible_users, 'style="width: 280px;"');
// submit button
$form->addButtonSave(get_lang('SaveSettings'));
if ($form->validate()) {
    $values = $form->exportValues();
    // Storing the tutors (we first remove all the tutors and then add only those who were selected)
    GroupManager::unsubscribe_all_tutors($current_group['id']);
    if (isset($_POST['group_tutors']) && count($_POST['group_tutors']) > 0) {
        GroupManager::subscribe_tutors($values['group_tutors'], $current_group['id']);
    }
    // Returning to the group area (note: this is inconsistent with the rest of chamilo)
    $cat = GroupManager::get_category_from_group($current_group['id']);
    if (isset($_POST['group_members']) && count($_POST['group_members']) > $max_member && $max_member != GroupManager::MEMBER_PER_GROUP_NO_LIMIT) {
        Display::addFlash(Display::return_message(get_lang('GroupTooMuchMembers'), 'warning'));
        header('Location: group.php?' . api_get_cidreq(true, false));
    } else {
        Display::addFlash(Display::return_message(get_lang('GroupSettingsModified'), 'success'));
        header('Location: group.php?' . api_get_cidreq(true, false) . '&category=' . $cat['id']);
    }
    exit;
}
$defaults = $current_group;