Exemplo n.º 1
0
            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));
Exemplo n.º 2
0
    $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()));
Exemplo n.º 3
0
$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));