本文整理汇总了PHP中CourseManager::get_group_list_of_course方法的典型用法代码示例。如果您正苦于以下问题:PHP CourseManager::get_group_list_of_course方法的具体用法?PHP CourseManager::get_group_list_of_course怎么用?PHP CourseManager::get_group_list_of_course使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CourseManager
的用法示例。
在下文中一共展示了CourseManager::get_group_list_of_course方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showToForm
/**
* @param FormValidator $form
* @param array $sendTo array('everyone' => false, 'users' => [1, 2], 'groups' => [3, 4])
* @param array $attributes
* @param bool $addOnlyItemsInSendTo
* @param bool $required
* @return bool
*/
public function showToForm($form, $sendTo = array(), $attributes = array(), $addOnlyItemsInSendTo = false, $required = false)
{
if ($this->type != 'course') {
return false;
}
$order = 'lastname';
if (api_is_western_name_order()) {
$order = 'firstname';
}
$userList = CourseManager::get_user_list_from_course_code(api_get_course_id(), $this->sessionId, null, $order);
$groupList = CourseManager::get_group_list_of_course(api_get_course_id(), $this->sessionId);
$this->setSendToSelect($form, $groupList, $userList, $sendTo, $attributes, $addOnlyItemsInSendTo, $required);
return true;
}
示例2: get_course_groups
/**
* this function gets all the groups of the course,
* not including linked courses
*/
public static function get_course_groups()
{
$session_id = api_get_session_id();
if ($session_id != 0) {
$new_group_list = CourseManager::get_group_list_of_course(api_get_course_id(), $session_id, 1);
} else {
$new_group_list = CourseManager::get_group_list_of_course(api_get_course_id(), 0, 1);
}
return $new_group_list;
}
示例3: show_to_form
/**
* @param array $form
* @param $to_already_selected
*/
public static function show_to_form($form, $to_already_selected)
{
$order = 'lastname';
if (api_is_western_name_order()) {
$order = 'firstname';
}
$user_list = CourseManager::get_user_list_from_course_code(api_get_course_id(), api_get_session_id(), null, $order);
$group_list = CourseManager::get_group_list_of_course(api_get_course_id(), api_get_session_id());
self::construct_not_selected_select_form_validator($form, $group_list, $user_list, $to_already_selected);
}
示例4: get_lang
}
//Building the form for Users
$formUsers = new \FormValidator('lp_edit', 'post', $url);
$formUsers->addElement('hidden', 'user_form', 1);
$userMultiSelect = $formUsers->addElement('advmultiselect', 'users', get_lang('Users'), $choices);
$formUsers->addButtonSave(get_lang('Save'));
$defaults = array();
if (!empty($selectedChoices)) {
$defaults['users'] = $selectedChoices;
}
$formUsers->setDefaults($defaults);
//Building the form for Groups
$form = new \FormValidator('lp_edit', 'post', $url);
$form->addElement('hidden', 'group_form', 1);
// Group list
$groupList = \CourseManager::get_group_list_of_course(api_get_course_id(), api_get_session_id(), 1);
$groupChoices = array_column($groupList, 'name', 'id');
// Subscribed groups to a LP
$subscribedGroupsInLp = $em->getRepository('ChamiloCourseBundle:CItemProperty')->getGroupsSubscribedToItem('learnpath', $lpId, $course, $session);
$selectedGroupChoices = array();
/** @var CItemProperty $itemProperty */
foreach ($subscribedGroupsInLp as $itemProperty) {
$selectedGroupChoices[] = $itemProperty->getGroup()->getId();
}
$groupMultiSelect = $form->addElement('advmultiselect', 'groups', get_lang('Groups'), $groupChoices);
// submit button
$form->addButtonSave(get_lang('Save'));
$defaults = array();
if (!empty($selectedGroupChoices)) {
$defaults['groups'] = $selectedGroupChoices;
}
示例5: show_to
function show_to($filter = 0, $id = null)
{
$order = 'lastname';
if (api_is_western_name_order()) {
$order = 'firstname';
}
$user_list = CourseManager::get_user_list_from_course_code(api_get_course_id(), api_get_session_id(), null, $order);
$group_list = CourseManager::get_group_list_of_course(api_get_course_id(), api_get_session_id());
return construct_to_select_form($group_list, $user_list, $filter, $id);
}
示例6: generate_user_group_array
static function generate_user_group_array($course_code, $session_id = 0)
{
$order = api_is_western_name_order() ? 'firstname' : 'lastname';
$user_list = CourseManager::get_real_and_linked_user_list($course_code, true, $session_id, $order);
$group_list = CourseManager::get_group_list_of_course($course_code, $session_id, 1);
$items = self::transform_user_group_array($user_list, $group_list);
return $items;
}
示例7: indexAction
/**
* Index
*
* @param \Silex\Application $app
* @param int $lpId
*
* @todo move calls in repositories
*
* @return Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
*/
public function indexAction(Request $request)
{
///$lpId
$courseId = api_get_course_int_id();
//@todo use the before filter to aborts this course calls
if (empty($courseId)) {
$app->abort(403, 'Course not available');
}
$courseCode = api_get_course_id();
$lp = new \learnpath($courseCode, $lpId, api_get_user_id());
$url = $app['url_generator']->generate('subscribe_users', array('lpId' => $lpId));
//Setting breadcrumb @todo move this in the template lib
$breadcrumb = array(array('url' => api_get_path(WEB_CODE_PATH) . 'newscorm/lp_controller.php?action=list', 'name' => get_lang('LearningPaths')), array('url' => api_get_path(WEB_CODE_PATH) . "newscorm/lp_controller.php?action=build&lp_id=" . $lp->get_id(), 'name' => $lp->get_name()), array('url' => '#', 'name' => get_lang('SubscribeUsers')));
$app['breadcrumb'] = $breadcrumb;
// Find session.
$sessionId = api_get_session_id();
$session = null;
if (!empty($sessionId)) {
$session = $app['orm.em']->getRepository('Chamilo\\CoreBundle\\Entity\\Session')->find($sessionId);
}
// Find course.
$course = $app['orm.em']->getRepository('Chamilo\\CoreBundle\\Entity\\Course')->find($courseId);
// Getting subscribe users to the course.
$subscribedUsers = $app['orm.em']->getRepository('Chamilo\\CoreBundle\\Entity\\Course')->getSubscribedStudents($course);
$subscribedUsers = $subscribedUsers->getQuery();
$subscribedUsers = $subscribedUsers->execute();
// Getting all users in a nice format.
$choices = array();
foreach ($subscribedUsers as $user) {
$choices[$user->getUserId()] = $user->getCompleteNameWithClasses();
}
// Getting subscribed users to a LP.
$subscribedUsersInLp = $app['orm.em']->getRepository('Chamilo\\CoreBundle\\Entity\\CItemProperty')->getUsersSubscribedToItem('learnpath', $lpId, $course, $session);
$selectedChoices = array();
foreach ($subscribedUsersInLp as $itemProperty) {
$selectedChoices[] = $itemProperty->getToUserId();
}
//Building the form for Users
$formUsers = new \FormValidator('lp_edit', 'post', $url);
$formUsers->addElement('hidden', 'user_form', 1);
$formUsers->addElement('header', get_lang('SubscribeUsersToLp'));
$userMultiSelect = $formUsers->addElement('advmultiselect', 'users', get_lang('Users'), $choices);
$userMultiSelect->setButtonAttributes('add');
$userMultiSelect->setButtonAttributes('remove');
$formUsers->addElement('style_submit_button', 'submit', get_lang('Save'), 'class="save"');
$defaults = array();
if (!empty($selectedChoices)) {
$defaults['users'] = $selectedChoices;
}
$formUsers->setDefaults($defaults);
//Building the form for Groups
$form = new \FormValidator('lp_edit', 'post', $url);
$form->addElement('header', get_lang('SubscribeGroupsToLp'));
$form->addElement('hidden', 'group_form', 1);
//Group list
$groupList = \CourseManager::get_group_list_of_course(api_get_course_id(), api_get_session_id(), 1);
$groupChoices = array();
if (!empty($groupList)) {
foreach ($groupList as $group) {
$groupChoices[$group['id']] = $group['name'];
}
}
//Subscribed groups to a LP
$subscribedGroupsInLp = $app['orm.em']->getRepository('Chamilo\\CoreBundle\\Entity\\CItemProperty')->getGroupsSubscribedToItem('learnpath', $lpId, $course, $session);
$selectedGroupChoices = array();
foreach ($subscribedGroupsInLp as $itemProperty) {
$selectedGroupChoices[] = $itemProperty->getToGroupId();
}
$groupMultiSelect = $form->addElement('advmultiselect', 'groups', get_lang('Groups'), $groupChoices);
$groupMultiSelect->setButtonAttributes('add');
$groupMultiSelect->setButtonAttributes('remove');
// submit button
$form->addElement('style_submit_button', 'submit', get_lang('Save'), 'class="save"');
/*$form = $app['form.factory']->createBuilder('form')
->add('origin', 'choice', array(
'label' => get_lang('Origin'),
'multiple' => true,
'required' => false,
'expanded' => false,
//'class' => 'Entity\Course',
//'property' => 'complete_name',
//'query_builder' => function(Chamilo\CoreBundle\Entity\Repository\CourseRepository $repo) use ($course) {
$repo = $repo->getSubscribedStudents($course);
return $repo;
},
'choices' => $choices
))
->add('destination', 'choice', array(
'label' => get_lang('Destination'),
'multiple' => true,
//.........这里部分代码省略.........
示例8: get_course_groups
/**
* this function gets all the groups of the course
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @return array
*/
function get_course_groups()
{
$group_list = CourseManager::get_group_list_of_course(api_get_course_id(), api_get_session_id());
return $group_list;
}