本文整理汇总了PHP中Chamilo\CoreBundle\Framework\Container::getFormFactory方法的典型用法代码示例。如果您正苦于以下问题:PHP Container::getFormFactory方法的具体用法?PHP Container::getFormFactory怎么用?PHP Container::getFormFactory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chamilo\CoreBundle\Framework\Container
的用法示例。
在下文中一共展示了Container::getFormFactory方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: check_session_name
header('Location: add_courses_to_session.php?id_session=' . $session_id . '&add=true&msg=');
exit;
}
}
}
function check_session_name($name)
{
$session = SessionManager::get_session_by_name($name);
return empty($session) ? true : false;
}
Display::display_header($tool_name);
echo '<div class="actions">';
echo '<a href="' . api_get_path(WEB_CODE_PATH) . 'session/session_list.php">' . Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('PlatformAdmin'), '', ICON_SIZE_MEDIUM) . '</a>';
echo '</div>';
$em = Container::getEntityManager();
$request = Container::getRequest();
$session = new Session();
if (!empty($id)) {
$session = $em->getRepository('ChamiloCoreBundle:Session')->find($id);
}
$builder = Container::getFormFactory()->createBuilder(new SessionType(), $session);
$form = $builder->getForm();
$form->handleRequest($request);
if ($form->isValid()) {
$em->flush();
Container::addFlash(get_lang('Updated'));
$url = Container::getRouter()->generate('main', array('name' => 'session/session_list.php'));
header('Location: ' . $url);
exit;
}
echo Container::getTemplate()->render('ChamiloCoreBundle:Legacy:form.html.twig', array('form' => $form->createView(), 'url' => $urlAction));
示例2: empty
$course['exemplary_content'] = empty($course['exemplary_content']) ? false : true;
$course['teachers'] = $course_teachers;
//$course['user_id'] = $teacher_id;
$course['wanted_code'] = $course['visual_code'];
$course['gradebook_model_id'] = isset($course['gradebook_model_id']) ? $course['gradebook_model_id'] : null;
// Fixing category code
$course['course_category'] = $course['category_code'];
$course_info = CourseManager::create_course($course);
header('Location: course_list.php'.($course_info===false?'?action=show_msg&warn='.api_get_last_failure():''));
exit;
}*/
// Display the form.
$content = $form->return_form();
//echo $content;
$em = Container::getEntityManager();
$request = Container::getRequest();
$course = new Course();
$builder = Container::getFormFactory()->createBuilder(new CourseType(), $course);
$form = $builder->getForm();
$form->handleRequest($request);
if ($form->isValid()) {
$course = $form->getData();
$em->persist($course);
$em->flush();
Container::addFlash(get_lang('Updated'));
$url = Container::getRouter()->generate('main', array('name' => 'admin/course_list.php'));
header('Location: ' . $url);
exit;
}
echo Container::getTemplate()->render('ChamiloCoreBundle:Legacy:form.html.twig', array('form' => $form->createView(), 'url' => api_get_self()));
示例3: time
$image_path = UserManager::get_user_picture_path_by_id($user_id, 'web');
$image_dir = $image_path['dir'];
$image = $image_path['file'];
$image_file = $image != '' ? $image_dir . $image : api_get_path(WEB_IMG_PATH) . 'unknown.jpg';
$image_size = api_getimagesize($image_file);
// get the path,width and height from original picture
$big_image = $image_dir . 'big_' . $image;
$big_image_size = api_getimagesize($big_image);
$big_image_width = $big_image_size['width'];
$big_image_height = $big_image_size['height'];
$url_big_image = $big_image . '?rnd=' . time();
// Display form
$content = $form->return_form();
$em = Container::getEntityManager();
$request = Container::getRequest();
$user = new User();
if (!empty($user_id)) {
$user = $em->getRepository('ChamiloUserBundle:User')->find($user_id);
}
$builder = Container::getFormFactory()->createBuilder(new UserType(Container::getSecurity()), $user);
$form = $builder->getForm();
$form->handleRequest($request);
if ($form->isValid()) {
$em->flush();
Container::addFlash(get_lang('Updated'));
$url = Container::getRouter()->generate('main', array('name' => 'admin/user_list.php'));
header('Location: ' . $url);
exit;
}
$urlAction = api_get_self() . '?user_id=' . $user_id;
echo Container::getTemplate()->render('ChamiloCoreBundle:User:create.html.twig', array('form' => $form->createView(), 'url' => $urlAction));