本文整理汇总了PHP中learnpath::get_name方法的典型用法代码示例。如果您正苦于以下问题:PHP learnpath::get_name方法的具体用法?PHP learnpath::get_name怎么用?PHP learnpath::get_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类learnpath
的用法示例。
在下文中一共展示了learnpath::get_name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
/* For licensing terms, see /license.txt */
use Chamilo\CourseBundle\Entity\CItemProperty;
use Chamilo\UserBundle\Entity\User;
require_once '../inc/global.inc.php';
api_protect_course_script();
$is_allowed_to_edit = api_is_allowed_to_edit(false, true, false, false);
if (!$is_allowed_to_edit) {
api_not_allowed(true);
}
$lpId = isset($_GET['lp_id']) ? intval($_GET['lp_id']) : 0;
if (empty($lpId)) {
api_not_allowed(true);
}
$oLP = new learnpath(api_get_course_id(), $lpId, api_get_user_id());
$interbreadcrumb[] = array('url' => 'lp_controller.php?action=list', 'name' => get_lang('LearningPaths'));
$interbreadcrumb[] = array('url' => api_get_self() . "?action=build&lp_id=" . $oLP->get_id(), 'name' => $oLP->get_name());
$courseId = api_get_course_int_id();
$courseCode = api_get_course_id();
$url = api_get_self() . '?' . api_get_cidreq() . '&lp_id=' . $lpId;
$lp = new \learnpath($courseCode, $lpId, api_get_user_id());
$em = Database::getManager();
$session = null;
if (!empty($sessionId)) {
$session = $em->getRepository('ChamiloCoreBundle:Session')->find($sessionId);
}
// Find course.
$course = $em->getRepository('ChamiloCoreBundle:Course')->find($courseId);
// Getting subscribe users to the course.
$subscribedUsers = $em->getRepository('ChamiloCoreBundle:Course')->getSubscribedStudents($course);
$subscribedUsers = $subscribedUsers->getQuery();
$subscribedUsers = $subscribedUsers->execute();
示例2: 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,
//.........这里部分代码省略.........