From 05db83127c41dc997088eac3cce788edc31d0946 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Sun, 18 May 2014 22:00:40 +0200 Subject: [PATCH] Adding symfony2 DI component --- app/SymfonyRequirements.php | 687 ++++ app/autoload.php | 13 + app/bootstrap.php.cache | 3050 +++++++++++++++++ app/check.php | 62 + app/config/parameters.php | 3 + app/config/routing.yml | 18 + app/config/routing_dev.yml | 14 + composer.json | 135 +- main/admin/add_users_to_usergroup.php | 2 +- main/admin/course_list.php | 9 +- main/admin/index.php | 4 - main/admin/user_list.php | 13 +- .../shibboleth_controller.class.php | 4 +- main/course_home/activity.php | 9 +- main/document/document.php | 3 + main/inc/lib/api.lib.php | 97 +- main/inc/lib/chamilo_session.class.php | 73 + main/inc/lib/course.lib.php | 2 +- main/inc/lib/course_home.lib.php | 11 +- main/inc/lib/display.lib.php | 13 +- main/inc/lib/events.lib.inc.php | 4 +- .../lib/formvalidator/FormValidator.class.php | 1 + main/inc/lib/internationalization.lib.php | 7 +- main/inc/lib/security.lib.php | 1 + .../Command/Template/AsseticDumpCommand.php | 97 - src/ChamiloLMS/Controller/BaseController.php | 613 ---- .../Controller/LegacyController.php | 98 - .../Translation/ExportLanguagesCommand.php | 4 +- .../Component/Auth/LoginListener.php | 4 +- .../Component/Auth/LoginSuccessHandler.php | 4 +- .../Component/Auth/LogoutSuccessHandler.php | 2 +- .../{ => CoreBundle}/Component/Auth/Role.php | 6 +- .../Component/Composer/Tasks.php | 6 +- .../Console/Output/BufferedOutput.php | 4 +- .../DataFilesystem/DataFilesystem.php | 10 +- .../Component/Editor/CkEditor/CkEditor.php | 10 +- .../Editor/CkEditor/Toolbar/Basic.php | 6 +- .../Editor/CkEditor/Toolbar/Documents.php | 4 +- .../CkEditor/Toolbar/IntroductionTool.php | 4 +- .../Toolbar/LearningPathDocuments.php | 4 +- .../Editor/CkEditor/Toolbar/Message.php | 4 +- .../CkEditor/Toolbar/TestFreeAnswer.php | 4 +- .../CkEditor/Toolbar/TestFreeAnswerStrict.php | 4 +- .../CkEditor/Toolbar/TestProposedAnswer.php | 4 +- .../Toolbar/TestQuestionDescription.php | 4 +- .../CkEditor/Toolbar/UniqueAnswerImage.php | 4 +- .../Component/Editor/Connector.php | 14 +- .../Component/Editor/Driver/CourseDriver.php | 4 +- .../Editor/Driver/CourseUserDriver.php | 4 +- .../Component/Editor/Driver/Driver.php | 6 +- .../Component/Editor/Driver/DropBoxDriver.php | 14 +- .../Component/Editor/Driver/HomeDriver.php | 4 +- .../Editor/Driver/InterfaceDriver.php | 6 +- .../Editor/Driver/PersonalDriver.php | 4 +- .../Component/Editor/Editor.php | 8 +- .../Component/Editor/Finder.php | 2 +- .../Component/Editor/TinyMce/TinyMce.php | 8 +- .../Editor/TinyMce/Toolbar/Basic.php | 6 +- .../Component/Editor/Toolbar.php | 4 +- .../Component/Mail/MailGenerator.php | 4 +- .../Validator/ConstraintValidatorFactory.php | 2 +- .../Controller/Admin/AdminController.php | 37 +- .../Admin/Administrator/BranchController.php | 26 +- .../Admin/Administrator/JuryController.php | 30 +- .../Administrator/QuestionScoreController.php | 22 +- .../QuestionScoreNameController.php | 15 +- .../Admin/Administrator/RoleController.php | 12 +- .../Admin/Administrator/UpgradeController.php | 8 +- .../Director/BranchDirectorController.php | 41 +- .../Admin/JuryMember/JuryMemberController.php | 40 +- .../JuryPresident/JuryPresidentController.php | 28 +- .../QuestionManagerController.php | 20 +- .../App/Certificate/CertificateController.php | 6 +- .../App/Editor/EditorController.php | 12 +- .../App/ModelAjax/ModelAjaxController.php | 4 +- .../Controller/App/News/NewsController.php | 6 +- .../App/SessionPath/SessionPathController.php | 16 +- .../App/SessionPath/SessionTreeController.php | 12 +- .../CoreBundle/Controller/BaseController.php | 228 ++ .../Controller/CrudController.php | 38 +- .../Controller/CrudControllerInterface.php | 8 +- .../Controller/IndexController.php | 68 +- .../Controller/LegacyController.php | 116 + .../Tool/CourseHome/CourseHomeController.php | 61 +- .../CurriculumCategoryController.php | 18 +- .../Tool/Curriculum/CurriculumController.php | 8 +- .../Curriculum/CurriculumItemController.php | 18 +- .../Curriculum/CurriculumUserController.php | 38 +- .../Tool/Exercise/ExerciseController.php | 4 +- .../Introduction/IntroductionController.php | 18 +- .../LearningPath/LearningPathController.php | 24 +- .../Controller/ToolBaseController.php | 6 +- .../Controller/User/ProfileController.php | 6 +- .../Controller/User/UserController.php | 6 +- .../{ => CoreBundle}/Entity/AccessUrl.php | 2 +- .../Entity/AccessUrlRelCourse.php | 2 +- .../Entity/AccessUrlRelSession.php | 2 +- .../Entity/AccessUrlRelUser.php | 2 +- .../{ => CoreBundle}/Entity/BranchSync.php | 4 +- .../{ => CoreBundle}/Entity/CDropboxFile.php | 2 +- .../{ => CoreBundle}/Entity/CDropboxPost.php | 2 +- .../{ => CoreBundle}/Entity/CGroupInfo.php | 2 +- .../{ => CoreBundle}/Entity/CItemProperty.php | 4 +- .../{ => CoreBundle}/Entity/CLp.php | 4 +- .../{ => CoreBundle}/Entity/CLpCategory.php | 2 +- .../{ => CoreBundle}/Entity/CQuiz.php | 2 +- .../{ => CoreBundle}/Entity/CQuizCategory.php | 2 +- .../{ => CoreBundle}/Entity/CQuizQuestion.php | 4 +- .../Entity/CQuizQuestionRelCategory.php | 4 +- .../Entity/CQuizRelQuestion.php | 2 +- .../{ => CoreBundle}/Entity/CTool.php | 2 +- .../{ => CoreBundle}/Entity/CToolIntro.php | 2 +- .../{ => CoreBundle}/Entity/Course.php | 4 +- .../Entity/CourseFieldValues.php | 2 +- .../{ => CoreBundle}/Entity/CourseRelUser.php | 2 +- .../Entity/CurriculumCategory.php | 2 +- .../Entity/CurriculumItem.php | 2 +- .../Entity/CurriculumItemRelUser.php | 4 +- .../Entity/CurriculumRelUser.php | 2 +- .../{ => CoreBundle}/Entity/ExtraField.php | 2 +- .../Entity/ExtraFieldOptionRelFieldOption.php | 2 +- .../Entity/ExtraFieldValues.php | 2 +- .../{ => CoreBundle}/Entity/Groups.php | 2 +- .../{ => CoreBundle}/Entity/Jury.php | 4 +- .../{ => CoreBundle}/Entity/JuryMembers.php | 2 +- .../{ => CoreBundle}/Entity/QuestionField.php | 2 +- .../Entity/QuestionFieldOptions.php | 0 .../Entity/QuestionFieldValues.php | 2 +- .../{ => CoreBundle}/Entity/QuestionScore.php | 4 +- .../Entity/QuestionScoreName.php | 2 +- .../Repository/BranchSyncRepository.php | 6 +- .../Repository/CQuizCategoryRepository.php | 2 +- .../CQuizQuestionRelCategoryRepository.php | 2 +- .../Repository/CQuizQuestionRepository.php | 2 +- .../Entity/Repository/CourseRepository.php | 8 +- .../CurriculumItemRelUserRepository.php | 6 +- .../Repository/ItemPropertyRepository.php | 12 +- .../Entity/Repository/JuryRepository.php | 6 +- .../Entity/Repository/LpRepository.php | 2 +- .../Entity/Repository/PagesRepository.php | 2 +- .../Repository/QuestionScoreRepository.php | 2 +- .../Repository/SessionTreeRepository.php | 4 +- .../Entity/Repository/UserRepository.php | 10 +- .../{ => CoreBundle}/Entity/Role.php | 2 +- .../{ => CoreBundle}/Entity/Session.php | 2 +- .../Entity/SessionFieldValues.php | 2 +- .../{ => CoreBundle}/Entity/SessionPath.php | 2 +- .../{ => CoreBundle}/Entity/SessionTree.php | 4 +- .../Entity/SystemTemplate.php | 2 +- .../{ => CoreBundle}/Entity/Tool.php | 2 +- .../{ => CoreBundle}/Entity/TrackExercise.php | 2 +- .../Entity/TrackExerciseAttemptJury.php | 2 +- .../{ => CoreBundle}/Entity/User.php | 6 +- .../Entity/UserCourseSessionGroup.php | 2 +- .../Entity/UserFieldValues.php | 2 +- .../Entity/UserSessionPath.php | 2 +- .../{ => CoreBundle}/Entity/Usergroup.php | 2 +- .../Entity/UsergroupRelUser.php | 2 +- .../{ => CoreBundle}/Form/BranchType.php | 4 +- .../Form/CourseHomeToolType.php | 4 +- .../Form/CurriculumCategoryType.php | 6 +- .../CurriculumItemRelUserCollectionType.php | 6 +- .../Form/CurriculumItemRelUserType.php | 6 +- .../Form/CurriculumItemType.php | 2 +- .../{ => CoreBundle}/Form/JuryMembersType.php | 4 +- .../{ => CoreBundle}/Form/JuryType.php | 4 +- .../{ => CoreBundle}/Form/JuryUserType.php | 4 +- .../Form/QuestionScoreNameType.php | 4 +- .../Form/QuestionScoreType.php | 4 +- .../{ => CoreBundle}/Form/RoleType.php | 4 +- .../{ => CoreBundle}/Form/SessionPathType.php | 4 +- .../{ => CoreBundle}/Form/SessionTreeType.php | 4 +- .../Framework/Application.php | 4 +- .../CoreBundle/Framework/Exporter.php | 66 + .../Framework/PageController.php | 28 +- .../{ => CoreBundle}/Framework/Template.php | 11 +- .../{ => CoreBundle}/Framework/Widget.php | 4 +- .../Listener/LoginSuccessHandler.php | 139 + .../Listener/LogoutSuccessHandler.php | 49 + .../Middleware/CourseMiddleware.php | 4 +- .../Provider/ReflectionControllerProvider.php | 6 +- .../{ => CoreBundle}/Resources/config/dev.php | 2 +- .../Resources/config/prod.php | 0 .../Resources/translations/en.po | 0 .../Resources/translations/es.po | 0 .../Resources/translations/fr.po | 0 .../Resources/translations/iso_code.custom.po | 0 .../Admin/administrator/branches/add.tpl | 5 + .../branches/add_from_parent.tpl | 2 +- .../Admin/administrator/branches/edit.tpl | 5 + .../Admin}/administrator/branches/list.tpl | 2 +- .../Admin}/administrator/branches/read.tpl | 2 +- .../views/Admin/administrator/juries/add.tpl | 5 + .../administrator/juries/add_members.tpl | 2 +- .../views/Admin/administrator/juries/edit.tpl | 5 + .../Admin}/administrator/juries/list.tpl | 2 +- .../Admin}/administrator/juries/read.tpl | 2 +- .../administrator/question_score/add.tpl | 5 + .../administrator/question_score/edit.tpl | 5 + .../administrator/question_score/list.tpl | 5 + .../administrator/question_score/read.tpl | 2 +- .../administrator/question_score_name/add.tpl | 5 + .../question_score_name/edit.tpl | 5 + .../question_score_name/list.tpl | 5 + .../question_score_name/read.tpl | 5 + .../views/Admin/administrator/role/add.tpl | 5 + .../views/Admin/administrator/role/edit.tpl | 5 + .../views/Admin/administrator/role/list.tpl | 5 + .../views/Admin/administrator/role/read.tpl | 5 + .../views/Admin/administrator/role_index.tpl} | 0 .../Admin}/administrator/upgrade/index.tpl | 2 +- .../Admin}/administrator/upgrade/upgrade.tpl | 2 +- .../views/Admin/director/branches/list.tpl | 4 + .../views/Admin}/director/branches/read.tpl | 2 +- .../Resources/views/Admin/index.html.twig | 78 + .../views/Admin}/jury_member/index.tpl | 4 +- .../views/Admin}/jury_member/score_user.tpl | 2 +- .../Admin}/jury_president/assign_members.tpl | 2 +- .../Admin/jury_president/check_answers.tpl | 4 + .../views/Admin}/jury_president/index.tpl | 2 +- .../Admin}/question_manager/edit_category.tpl | 6 +- .../Admin}/question_manager/edit_question.tpl | 2 +- .../question_manager/question_categories.tpl | 6 +- .../question_manager/questionmanager.tpl | 2 +- .../Admin}/question_manager/questions.tpl | 2 +- .../Admin}/question_manager/role_index.tpl | 8 +- .../Admin}/question_manager/show_category.tpl | 2 +- .../Admin}/session_manager/role_index.tpl | 4 +- .../views/Index/userportal.html.twig | 12 + .../Resources/views/Legacy/index.html.twig | 12 + .../Resources/views/Menu/primary.html.twig | 8 + .../Resources/views/Tool/CourseHome}/add.tpl | 4 +- .../Resources/views/Tool/CourseHome}/edit.tpl | 4 +- .../views/Tool/CourseHome/index.html.twig | 106 + .../Resources/views/Tool/CourseHome}/list.tpl | 4 +- .../Resources/views/default/agenda/month.tpl | 26 +- .../views/default/app/session_path/add.tpl | 5 + .../views/default/app/session_path/edit.tpl | 5 + .../views/default/app/session_path/list.tpl | 2 +- .../views/default/app/session_path/read.tpl | 2 +- .../app/session_path/session_tree/add.tpl | 5 + .../app/session_path/session_tree/list.tpl | 2 +- .../views/default/auth/categories_list.php | 10 +- .../views/default/auth/courses_categories.php | 0 .../views/default/auth/courses_list.php | 0 .../Resources/views/default/auth/layout.php | 0 .../Resources/views/default/auth/login.tpl | 11 +- .../views/default/course_description/edit.tpl | 16 +- .../default/course_description/index.tpl | 54 +- .../default/course_description/upload.tpl | 4 +- .../default/create_course/add_course.tpl | 16 +- .../views/default/crud_macros/course_crud.tpl | 0 .../views/default/crud_macros/simple_crud.tpl | 0 .../exercise/question/edit_question.tpl | 4 + .../exercise/question/show_question.tpl | 2 +- .../views/default/exercise/question_pool.tpl | 4 +- .../views/default/export/table_pdf.tpl | 32 +- .../default/form/form_custom_template.tpl | 0 .../Resources/views/default/glossary/csv.tpl | 0 .../Resources/views/default/glossary/edit.tpl | 0 .../views/default/glossary/header.tpl | 0 .../views/default/glossary/index.tpl | 12 +- .../views/default/glossary/javascript.tpl | 14 +- .../Resources/views/default/glossary/list.tpl | 22 +- .../views/default/glossary/table.tpl | 38 +- .../views/default/glossary/upload.tpl | 0 .../views/default/index/course_block.tpl | 0 .../default/index/course_session_block.tpl | 1 + .../views/default/index/help_block.tpl | 4 +- .../views/default/index/navigation_block.tpl | 0 .../views/default/index/notice_block.tpl | 0 .../views/default/index/profile_block.tpl | 10 +- .../default/index/profile_social_block.tpl | 4 +- .../views/default/index/session_block.tpl | 0 .../views/default/index/skills_block.tpl | 0 .../views/default/index/teacher_block.tpl | 0 .../views/default/index/user_image_block.tpl | 4 +- .../javascript/editor/ckeditor/elfinder.tpl | 2 +- .../javascript/editor/ckeditor/templates.tpl | 0 .../javascript/editor/elfinder_standalone.tpl | 0 .../javascript/editor/tinymce/elfinder.tpl | 2 +- .../javascript/editor/tinymce/templates.tpl | 0 .../default/javascript/newscorm/minipanel.tpl | 0 .../Resources/views/default/layout/blank.tpl | 0 .../views/default/layout/block_menu.tpl | 0 .../Resources/views/default/layout/bread.tpl | 0 .../views/default/layout/breadcrumb.tpl | 32 + .../default/layout/course_navigation.tpl | 8 +- .../Resources/views/default/layout/error.tpl | 0 .../Resources/views/default/layout/footer.tpl | 5 +- .../Resources/views/default/layout/head.tpl | 0 .../Resources/views/default/layout/header.tpl | 0 .../views/default/layout/hot_course_item.tpl | 0 .../default/layout/hot_course_item_popup.tpl | 0 .../views/default/layout/hot_courses.tpl | 16 +- .../views/default/layout/layout_1_col.tpl | 0 .../views/default/layout/layout_2_col.tpl | 13 +- .../views/default/layout/login_form.tpl | 0 .../Resources/views/default/layout/main.tpl} | 84 +- .../Resources/views/default/layout/menu.tpl | 30 +- .../views/default/layout/messages.tpl | 0 .../views/default/layout/no_layout.tpl | 2 +- .../views/default/layout/page_body.tpl | 8 +- .../views/default/layout/page_post_body.tpl | 0 .../views/default/layout/sidebar.tpl | 87 +- .../Resources/views/default/layout/sniff.tpl | 0 .../views/default/layout/social_layout.tpl | 4 +- .../Resources/views/default/layout/topbar.tpl | 0 .../default/layout/welcome_to_course.tpl | 16 +- .../views/default/learnpath/impress.tpl | 0 .../Resources/views/default/learnpath/lp.tpl | 8 +- .../views/default/learnpath/lp_js.tpl | 0 .../default/learnpath/lp_upload_audio.tpl | 0 .../views/default/learnpath/record_voice.tpl | 24 +- .../default/learnpath/subscribe_users.tpl | 8 +- .../views/default/link/edit_category.tpl | 0 .../views/default/link/edit_link.tpl | 0 .../Resources/views/default/link/index.tpl | 40 +- .../exercise/end_exercise_notification.tpl | 4 +- .../end_exercise_notification_to_user.tpl | 4 +- .../Resources/views/default/mail/layout.tpl | 0 .../views/default/mail/sample/sample.tpl | 2 +- .../default/mail_editor/email_link.js.tpl | 0 .../Resources/views/default/notebook/edit.tpl | 0 .../views/default/notebook/header.tpl | 0 .../views/default/notebook/index.tpl | 14 +- .../views/default/notebook/javascript.tpl | 14 +- .../Resources/views/default/notebook/list.tpl | 14 +- .../views/default/notebook/upload.tpl | 0 .../Resources/views/default/skill/profile.tpl | 24 +- .../views/default/skill/profile_item.tpl | 10 +- .../views/default/skill/skill_ranking.tpl | 0 .../views/default/skill/skill_tree.tpl | 22 +- .../default/skill/skill_tree_student.tpl | 0 .../views/default/skill/skill_wheel.js.tpl | 14 +- .../views/default/skill/skill_wheel.tpl | 60 +- .../default/skill/skill_wheel_student.tpl | 34 +- .../views/default/skill/user_skills.tpl | 0 .../views/default/tool/course_home/index.tpl | 4 +- .../default/tool/course_home/tool/add.tpl | 7 + .../default/tool/course_home/tool/edit.tpl | 7 + .../default/tool/course_home/tool/list.tpl | 83 + .../default/tool/curriculum/category/add.tpl | 5 + .../curriculum/category/add_from_parent.tpl | 2 +- .../default/tool/curriculum/category/edit.tpl | 5 + .../default/tool/curriculum/category/list.tpl | 2 +- .../default/tool/curriculum/category/read.tpl | 2 +- .../tool/curriculum/category/results.tpl | 2 +- .../views/default/tool/curriculum/index.tpl | 2 + .../default/tool/curriculum/item/add.tpl | 5 + .../curriculum/item/add_from_category.tpl | 2 +- .../default/tool/curriculum/item/edit.tpl | 5 + .../default/tool/curriculum/item/list.tpl | 2 +- .../default/tool/curriculum/item/read.tpl | 2 +- .../default/tool/curriculum/user/add.tpl | 5 + .../curriculum/user/add_from_category.tpl | 2 +- .../default/tool/curriculum/user/edit.tpl | 5 + .../tool/curriculum/user/get_user_items.tpl | 2 +- .../default/tool/curriculum/user/list.tpl | 4 +- .../default/tool/curriculum/user/read.tpl | 2 +- .../Resources/views/default/user/files.tpl | 2 +- .../Resources/views/default/user/index.tpl | 5 + .../Resources/views/default/user/me.tpl | 2 +- .../Resources/views/default/user/profile.tpl | 4 +- .../views/default/userportal/course_item.tpl | 0 .../views/default/userportal/course_page.tpl | 2 + .../views/default/userportal/index.tpl | 1 + .../Resources/views/default/work/view.tpl | 0 .../ExerciseAttemptTransactionLog.php | 2 +- .../TransactionExportException.php | 2 +- .../TransactionImportException.php | 2 +- .../Transaction/TransactionLog.php | 2 +- .../Transaction/TransactionLogController.php | 6 +- src/ChamiloLMS/{ => CoreBundle}/app.php | 10 +- src/ChamiloLMS/{ => CoreBundle}/filters.php | 6 +- src/ChamiloLMS/CoreBundle/paths.php | 22 + src/ChamiloLMS/{ => CoreBundle}/routes.php | 2 +- src/ChamiloLMS/{ => CoreBundle}/services.php | 45 +- src/ChamiloLMS/Entity/CTimeline.php | 410 --- src/ChamiloLMS/Entity/Pages.php | 152 - .../Resources/config/route_example.yml | 3 - .../admin/administrator/branches/add.tpl | 5 - .../admin/administrator/branches/edit.tpl | 5 - .../admin/administrator/juries/add.tpl | 5 - .../admin/administrator/juries/edit.tpl | 5 - .../administrator/question_score/add.tpl | 5 - .../administrator/question_score/edit.tpl | 5 - .../administrator/question_score/list.tpl | 5 - .../administrator/question_score_name/add.tpl | 5 - .../question_score_name/edit.tpl | 5 - .../question_score_name/list.tpl | 5 - .../question_score_name/read.tpl | 5 - .../default/admin/administrator/role/add.tpl | 5 - .../default/admin/administrator/role/edit.tpl | 5 - .../default/admin/administrator/role/list.tpl | 5 - .../default/admin/administrator/role/read.tpl | 5 - .../admin/administrator/role_index.tpl | 43 - .../default/admin/director/branches/list.tpl | 4 - .../Resources/views/default/admin/index.tpl | 40 - .../admin/jury_president/check_answers.tpl | 4 - .../views/default/app/session_path/add.tpl | 5 - .../views/default/app/session_path/edit.tpl | 5 - .../app/session_path/session_tree/add.tpl | 5 - .../exercise/question/edit_question.tpl | 4 - .../default/index/course_session_block.tpl | 1 - .../views/default/layout/breadcrumb.tpl | 37 - .../Resources/views/default/layout/head.tpl | 303 -- .../views/default/layout/layout_1_col.tpl | 46 - .../Resources/views/default/layout/main.tpl | 8 - .../default/tool/curriculum/category/add.tpl | 5 - .../default/tool/curriculum/category/edit.tpl | 5 - .../views/default/tool/curriculum/index.tpl | 2 - .../default/tool/curriculum/item/add.tpl | 5 - .../default/tool/curriculum/item/edit.tpl | 5 - .../default/tool/curriculum/user/add.tpl | 5 - .../default/tool/curriculum/user/edit.tpl | 5 - .../Resources/views/default/user/index.tpl | 5 - .../views/default/userportal/course_page.tpl | 2 - .../views/default/userportal/index.tpl | 1 - .../form/form_custom_template.tpl | 500 --- src/ChamiloLMS/paths.php | 22 - web/ChamiloLMS/css/base.css | 2 +- web/ChamiloLMS/css/themes/chamilo/default.css | 14 + web/app.php | 31 + web/app_dev.php | 32 + web/{index.php => index2.php} | 37 +- web/legacy.php | 6 + 427 files changed, 6391 insertions(+), 3783 deletions(-) create mode 100644 app/SymfonyRequirements.php create mode 100644 app/autoload.php create mode 100644 app/bootstrap.php.cache create mode 100644 app/check.php create mode 100644 app/config/parameters.php create mode 100644 app/config/routing.yml create mode 100755 app/config/routing_dev.yml delete mode 100644 main/admin/index.php delete mode 100644 src/ChamiloLMS/Command/Template/AsseticDumpCommand.php delete mode 100644 src/ChamiloLMS/Controller/BaseController.php delete mode 100644 src/ChamiloLMS/Controller/LegacyController.php rename src/ChamiloLMS/{ => CoreBundle}/Command/Translation/ExportLanguagesCommand.php (98%) rename src/ChamiloLMS/{ => CoreBundle}/Component/Auth/LoginListener.php (87%) rename src/ChamiloLMS/{ => CoreBundle}/Component/Auth/LoginSuccessHandler.php (97%) rename src/ChamiloLMS/{ => CoreBundle}/Component/Auth/LogoutSuccessHandler.php (96%) rename src/ChamiloLMS/{ => CoreBundle}/Component/Auth/Role.php (88%) rename src/ChamiloLMS/{ => CoreBundle}/Component/Composer/Tasks.php (87%) rename src/ChamiloLMS/{ => CoreBundle}/Component/Console/Output/BufferedOutput.php (85%) rename src/ChamiloLMS/{ => CoreBundle}/Component/DataFilesystem/DataFilesystem.php (96%) rename src/ChamiloLMS/{ => CoreBundle}/Component/Editor/CkEditor/CkEditor.php (90%) rename src/ChamiloLMS/{ => CoreBundle}/Component/Editor/CkEditor/Toolbar/Basic.php (94%) rename src/ChamiloLMS/{ => CoreBundle}/Component/Editor/CkEditor/Toolbar/Documents.php (90%) rename src/ChamiloLMS/{ => CoreBundle}/Component/Editor/CkEditor/Toolbar/IntroductionTool.php (89%) rename src/ChamiloLMS/{ => CoreBundle}/Component/Editor/CkEditor/Toolbar/LearningPathDocuments.php (89%) rename src/ChamiloLMS/{ => CoreBundle}/Component/Editor/CkEditor/Toolbar/Message.php (84%) rename src/ChamiloLMS/{ => CoreBundle}/Component/Editor/CkEditor/Toolbar/TestFreeAnswer.php (90%) rename src/ChamiloLMS/{ => CoreBundle}/Component/Editor/CkEditor/Toolbar/TestFreeAnswerStrict.php (92%) rename src/ChamiloLMS/{ => CoreBundle}/Component/Editor/CkEditor/Toolbar/TestProposedAnswer.php (87%) rename src/ChamiloLMS/{ => CoreBundle}/Component/Editor/CkEditor/Toolbar/TestQuestionDescription.php (89%) rename src/ChamiloLMS/{ => CoreBundle}/Component/Editor/CkEditor/Toolbar/UniqueAnswerImage.php (85%) rename src/ChamiloLMS/{ => CoreBundle}/Component/Editor/Connector.php (96%) rename src/ChamiloLMS/{ => CoreBundle}/Component/Editor/Driver/CourseDriver.php (97%) rename src/ChamiloLMS/{ => CoreBundle}/Component/Editor/Driver/CourseUserDriver.php (90%) rename src/ChamiloLMS/{ => CoreBundle}/Component/Editor/Driver/Driver.php (86%) rename src/ChamiloLMS/{ => CoreBundle}/Component/Editor/Driver/DropBoxDriver.php (97%) rename src/ChamiloLMS/{ => CoreBundle}/Component/Editor/Driver/HomeDriver.php (91%) rename src/ChamiloLMS/{ => CoreBundle}/Component/Editor/Driver/InterfaceDriver.php (77%) rename src/ChamiloLMS/{ => CoreBundle}/Component/Editor/Driver/PersonalDriver.php (93%) rename src/ChamiloLMS/{ => CoreBundle}/Component/Editor/Editor.php (97%) rename src/ChamiloLMS/{ => CoreBundle}/Component/Editor/Finder.php (83%) rename src/ChamiloLMS/{ => CoreBundle}/Component/Editor/TinyMce/TinyMce.php (90%) rename src/ChamiloLMS/{ => CoreBundle}/Component/Editor/TinyMce/Toolbar/Basic.php (86%) rename src/ChamiloLMS/{ => CoreBundle}/Component/Editor/Toolbar.php (94%) rename src/ChamiloLMS/{ => CoreBundle}/Component/Mail/MailGenerator.php (92%) rename src/ChamiloLMS/{ => CoreBundle}/Component/Validator/ConstraintValidatorFactory.php (94%) rename src/ChamiloLMS/{ => CoreBundle}/Controller/Admin/AdminController.php (94%) rename src/ChamiloLMS/{ => CoreBundle}/Controller/Admin/Administrator/BranchController.php (92%) rename src/ChamiloLMS/{ => CoreBundle}/Controller/Admin/Administrator/JuryController.php (84%) rename src/ChamiloLMS/{ => CoreBundle}/Controller/Admin/Administrator/QuestionScoreController.php (76%) rename src/ChamiloLMS/{ => CoreBundle}/Controller/Admin/Administrator/QuestionScoreNameController.php (54%) rename src/ChamiloLMS/{ => CoreBundle}/Controller/Admin/Administrator/RoleController.php (65%) rename src/ChamiloLMS/{ => CoreBundle}/Controller/Admin/Administrator/UpgradeController.php (96%) rename src/ChamiloLMS/{ => CoreBundle}/Controller/Admin/Director/BranchDirectorController.php (85%) rename src/ChamiloLMS/{ => CoreBundle}/Controller/Admin/JuryMember/JuryMemberController.php (91%) rename src/ChamiloLMS/{ => CoreBundle}/Controller/Admin/JuryPresident/JuryPresidentController.php (91%) rename src/ChamiloLMS/{ => CoreBundle}/Controller/Admin/QuestionManager/QuestionManagerController.php (94%) rename src/ChamiloLMS/{ => CoreBundle}/Controller/App/Certificate/CertificateController.php (75%) rename src/ChamiloLMS/{ => CoreBundle}/Controller/App/Editor/EditorController.php (87%) rename src/ChamiloLMS/{ => CoreBundle}/Controller/App/ModelAjax/ModelAjaxController.php (99%) rename src/ChamiloLMS/{ => CoreBundle}/Controller/App/News/NewsController.php (92%) rename src/ChamiloLMS/{ => CoreBundle}/Controller/App/SessionPath/SessionPathController.php (86%) rename src/ChamiloLMS/{ => CoreBundle}/Controller/App/SessionPath/SessionTreeController.php (72%) create mode 100644 src/ChamiloLMS/CoreBundle/Controller/BaseController.php rename src/ChamiloLMS/{ => CoreBundle}/Controller/CrudController.php (92%) rename src/ChamiloLMS/{ => CoreBundle}/Controller/CrudControllerInterface.php (72%) rename src/ChamiloLMS/{ => CoreBundle}/Controller/IndexController.php (91%) create mode 100644 src/ChamiloLMS/CoreBundle/Controller/LegacyController.php rename src/ChamiloLMS/{ => CoreBundle}/Controller/Tool/CourseHome/CourseHomeController.php (91%) rename src/ChamiloLMS/{ => CoreBundle}/Controller/Tool/Curriculum/CurriculumCategoryController.php (95%) rename src/ChamiloLMS/{ => CoreBundle}/Controller/Tool/Curriculum/CurriculumController.php (81%) rename src/ChamiloLMS/{ => CoreBundle}/Controller/Tool/Curriculum/CurriculumItemController.php (91%) rename src/ChamiloLMS/{ => CoreBundle}/Controller/Tool/Curriculum/CurriculumUserController.php (90%) rename src/ChamiloLMS/{ => CoreBundle}/Controller/Tool/Exercise/ExerciseController.php (98%) rename src/ChamiloLMS/{ => CoreBundle}/Controller/Tool/Introduction/IntroductionController.php (89%) rename src/ChamiloLMS/{ => CoreBundle}/Controller/Tool/LearningPath/LearningPathController.php (87%) rename src/ChamiloLMS/{ => CoreBundle}/Controller/ToolBaseController.php (96%) rename src/ChamiloLMS/{ => CoreBundle}/Controller/User/ProfileController.php (93%) rename src/ChamiloLMS/{ => CoreBundle}/Controller/User/UserController.php (88%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/AccessUrl.php (98%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/AccessUrlRelCourse.php (97%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/AccessUrlRelSession.php (97%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/AccessUrlRelUser.php (97%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/BranchSync.php (98%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/CDropboxFile.php (99%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/CDropboxPost.php (99%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/CGroupInfo.php (99%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/CItemProperty.php (98%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/CLp.php (99%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/CLpCategory.php (97%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/CQuiz.php (99%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/CQuizCategory.php (99%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/CQuizQuestion.php (98%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/CQuizQuestionRelCategory.php (95%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/CQuizRelQuestion.php (98%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/CTool.php (99%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/CToolIntro.php (98%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/Course.php (99%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/CourseFieldValues.php (97%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/CourseRelUser.php (99%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/CurriculumCategory.php (99%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/CurriculumItem.php (98%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/CurriculumItemRelUser.php (96%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/CurriculumRelUser.php (98%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/ExtraField.php (99%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/ExtraFieldOptionRelFieldOption.php (98%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/ExtraFieldValues.php (98%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/Groups.php (99%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/Jury.php (97%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/JuryMembers.php (98%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/QuestionField.php (80%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/QuestionFieldOptions.php (100%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/QuestionFieldValues.php (97%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/QuestionScore.php (90%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/QuestionScoreName.php (98%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/Repository/BranchSyncRepository.php (81%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/Repository/CQuizCategoryRepository.php (78%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/Repository/CQuizQuestionRelCategoryRepository.php (91%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/Repository/CQuizQuestionRepository.php (95%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/Repository/CourseRepository.php (89%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/Repository/CurriculumItemRelUserRepository.php (77%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/Repository/ItemPropertyRepository.php (96%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/Repository/JuryRepository.php (87%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/Repository/LpRepository.php (70%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/Repository/PagesRepository.php (91%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/Repository/QuestionScoreRepository.php (67%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/Repository/SessionTreeRepository.php (66%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/Repository/UserRepository.php (92%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/Role.php (98%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/Session.php (99%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/SessionFieldValues.php (97%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/SessionPath.php (97%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/SessionTree.php (98%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/SystemTemplate.php (98%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/Tool.php (98%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/TrackExercise.php (99%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/TrackExerciseAttemptJury.php (98%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/User.php (99%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/UserCourseSessionGroup.php (94%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/UserFieldValues.php (97%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/UserSessionPath.php (98%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/Usergroup.php (97%) rename src/ChamiloLMS/{ => CoreBundle}/Entity/UsergroupRelUser.php (98%) rename src/ChamiloLMS/{ => CoreBundle}/Form/BranchType.php (95%) rename src/ChamiloLMS/{ => CoreBundle}/Form/CourseHomeToolType.php (92%) rename src/ChamiloLMS/{ => CoreBundle}/Form/CurriculumCategoryType.php (91%) rename src/ChamiloLMS/{ => CoreBundle}/Form/CurriculumItemRelUserCollectionType.php (90%) rename src/ChamiloLMS/{ => CoreBundle}/Form/CurriculumItemRelUserType.php (85%) rename src/ChamiloLMS/{ => CoreBundle}/Form/CurriculumItemType.php (97%) rename src/ChamiloLMS/{ => CoreBundle}/Form/JuryMembersType.php (94%) rename src/ChamiloLMS/{ => CoreBundle}/Form/JuryType.php (93%) rename src/ChamiloLMS/{ => CoreBundle}/Form/JuryUserType.php (86%) rename src/ChamiloLMS/{ => CoreBundle}/Form/QuestionScoreNameType.php (90%) rename src/ChamiloLMS/{ => CoreBundle}/Form/QuestionScoreType.php (85%) rename src/ChamiloLMS/{ => CoreBundle}/Form/RoleType.php (86%) rename src/ChamiloLMS/{ => CoreBundle}/Form/SessionPathType.php (89%) rename src/ChamiloLMS/{ => CoreBundle}/Form/SessionTreeType.php (95%) rename src/ChamiloLMS/{ => CoreBundle}/Framework/Application.php (98%) create mode 100644 src/ChamiloLMS/CoreBundle/Framework/Exporter.php rename src/ChamiloLMS/{ => CoreBundle}/Framework/PageController.php (98%) rename src/ChamiloLMS/{ => CoreBundle}/Framework/Template.php (99%) rename src/ChamiloLMS/{ => CoreBundle}/Framework/Widget.php (61%) create mode 100644 src/ChamiloLMS/CoreBundle/Listener/LoginSuccessHandler.php create mode 100644 src/ChamiloLMS/CoreBundle/Listener/LogoutSuccessHandler.php rename src/ChamiloLMS/{ => CoreBundle}/Middleware/CourseMiddleware.php (71%) rename src/ChamiloLMS/{ => CoreBundle}/Provider/ReflectionControllerProvider.php (97%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/config/dev.php (79%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/config/prod.php (100%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/translations/en.po (100%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/translations/es.po (100%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/translations/fr.po (100%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/translations/iso_code.custom.po (100%) create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/Admin/administrator/branches/add.tpl rename src/ChamiloLMS/{Resources/views/default/admin => CoreBundle/Resources/views/Admin}/administrator/branches/add_from_parent.tpl (81%) create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/Admin/administrator/branches/edit.tpl rename src/ChamiloLMS/{Resources/views/default/admin => CoreBundle/Resources/views/Admin}/administrator/branches/list.tpl (71%) rename src/ChamiloLMS/{Resources/views/default/admin => CoreBundle/Resources/views/Admin}/administrator/branches/read.tpl (84%) create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/Admin/administrator/juries/add.tpl rename src/ChamiloLMS/{Resources/views/default/admin => CoreBundle/Resources/views/Admin}/administrator/juries/add_members.tpl (91%) create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/Admin/administrator/juries/edit.tpl rename src/ChamiloLMS/{Resources/views/default/admin => CoreBundle/Resources/views/Admin}/administrator/juries/list.tpl (92%) rename src/ChamiloLMS/{Resources/views/default/admin => CoreBundle/Resources/views/Admin}/administrator/juries/read.tpl (91%) create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/Admin/administrator/question_score/add.tpl create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/Admin/administrator/question_score/edit.tpl create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/Admin/administrator/question_score/list.tpl rename src/ChamiloLMS/{Resources/views/default/admin => CoreBundle/Resources/views/Admin}/administrator/question_score/read.tpl (82%) create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/Admin/administrator/question_score_name/add.tpl create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/Admin/administrator/question_score_name/edit.tpl create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/Admin/administrator/question_score_name/list.tpl create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/Admin/administrator/question_score_name/read.tpl create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/Admin/administrator/role/add.tpl create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/Admin/administrator/role/edit.tpl create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/Admin/administrator/role/list.tpl create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/Admin/administrator/role/read.tpl rename src/ChamiloLMS/{Resources/views/default/layout/topbar.tpl => CoreBundle/Resources/views/Admin/administrator/role_index.tpl} (100%) rename src/ChamiloLMS/{Resources/views/default/admin => CoreBundle/Resources/views/Admin}/administrator/upgrade/index.tpl (86%) rename src/ChamiloLMS/{Resources/views/default/admin => CoreBundle/Resources/views/Admin}/administrator/upgrade/upgrade.tpl (54%) create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/Admin/director/branches/list.tpl rename src/ChamiloLMS/{Resources/views/default/admin => CoreBundle/Resources/views/Admin}/director/branches/read.tpl (88%) create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/Admin/index.html.twig rename src/ChamiloLMS/{Resources/views/default/admin => CoreBundle/Resources/views/Admin}/jury_member/index.tpl (55%) rename src/ChamiloLMS/{Resources/views/default/admin => CoreBundle/Resources/views/Admin}/jury_member/score_user.tpl (62%) rename src/ChamiloLMS/{Resources/views/default/admin => CoreBundle/Resources/views/Admin}/jury_president/assign_members.tpl (97%) create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/Admin/jury_president/check_answers.tpl rename src/ChamiloLMS/{Resources/views/default/admin => CoreBundle/Resources/views/Admin}/jury_president/index.tpl (93%) rename src/ChamiloLMS/{Resources/views/default/admin => CoreBundle/Resources/views/Admin}/question_manager/edit_category.tpl (87%) rename src/ChamiloLMS/{Resources/views/default/admin => CoreBundle/Resources/views/Admin}/question_manager/edit_question.tpl (58%) rename src/ChamiloLMS/{Resources/views/default/admin => CoreBundle/Resources/views/Admin}/question_manager/question_categories.tpl (88%) rename src/ChamiloLMS/{Resources/views/default/admin => CoreBundle/Resources/views/Admin}/question_manager/questionmanager.tpl (64%) rename src/ChamiloLMS/{Resources/views/default/admin => CoreBundle/Resources/views/Admin}/question_manager/questions.tpl (98%) rename src/ChamiloLMS/{Resources/views/default/admin => CoreBundle/Resources/views/Admin}/question_manager/role_index.tpl (70%) rename src/ChamiloLMS/{Resources/views/default/admin => CoreBundle/Resources/views/Admin}/question_manager/show_category.tpl (61%) rename src/ChamiloLMS/{Resources/views/default/admin => CoreBundle/Resources/views/Admin}/session_manager/role_index.tpl (98%) create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/Index/userportal.html.twig create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/Legacy/index.html.twig create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/Menu/primary.html.twig rename src/ChamiloLMS/{Resources/views/default/tool/course_home/tool => CoreBundle/Resources/views/Tool/CourseHome}/add.tpl (65%) rename src/ChamiloLMS/{Resources/views/default/tool/course_home/tool => CoreBundle/Resources/views/Tool/CourseHome}/edit.tpl (65%) create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/Tool/CourseHome/index.html.twig rename src/ChamiloLMS/{Resources/views/default/tool/course_home/tool => CoreBundle/Resources/views/Tool/CourseHome}/list.tpl (98%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/agenda/month.tpl (95%) create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/default/app/session_path/add.tpl create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/default/app/session_path/edit.tpl rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/app/session_path/list.tpl (91%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/app/session_path/read.tpl (87%) create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/default/app/session_path/session_tree/add.tpl rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/app/session_path/session_tree/list.tpl (92%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/auth/categories_list.php (86%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/auth/courses_categories.php (100%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/auth/courses_list.php (100%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/auth/layout.php (100%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/auth/login.tpl (79%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/course_description/edit.tpl (72%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/course_description/index.tpl (77%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/course_description/upload.tpl (85%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/create_course/add_course.tpl (79%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/crud_macros/course_crud.tpl (100%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/crud_macros/simple_crud.tpl (100%) create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/default/exercise/question/edit_question.tpl rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/exercise/question/show_question.tpl (91%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/exercise/question_pool.tpl (97%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/export/table_pdf.tpl (58%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/form/form_custom_template.tpl (100%) create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/default/glossary/csv.tpl rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/glossary/edit.tpl (100%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/glossary/header.tpl (100%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/glossary/index.tpl (87%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/glossary/javascript.tpl (86%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/glossary/list.tpl (80%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/glossary/table.tpl (72%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/glossary/upload.tpl (100%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/index/course_block.tpl (100%) create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/default/index/course_session_block.tpl rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/index/help_block.tpl (70%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/index/navigation_block.tpl (100%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/index/notice_block.tpl (100%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/index/profile_block.tpl (74%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/index/profile_social_block.tpl (91%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/index/session_block.tpl (100%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/index/skills_block.tpl (100%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/index/teacher_block.tpl (100%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/index/user_image_block.tpl (67%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/javascript/editor/ckeditor/elfinder.tpl (96%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/javascript/editor/ckeditor/templates.tpl (100%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/javascript/editor/elfinder_standalone.tpl (100%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/javascript/editor/tinymce/elfinder.tpl (96%) create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/default/javascript/editor/tinymce/templates.tpl rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/javascript/newscorm/minipanel.tpl (100%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/layout/blank.tpl (100%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/layout/block_menu.tpl (100%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/layout/bread.tpl (100%) create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/default/layout/breadcrumb.tpl rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/layout/course_navigation.tpl (89%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/layout/error.tpl (100%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/layout/footer.tpl (98%) create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/default/layout/head.tpl create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/default/layout/header.tpl rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/layout/hot_course_item.tpl (100%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/layout/hot_course_item_popup.tpl (100%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/layout/hot_courses.tpl (59%) create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/default/layout/layout_1_col.tpl rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/layout/layout_2_col.tpl (83%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/layout/login_form.tpl (100%) rename src/ChamiloLMS/{Resources/views/default/layout/header.tpl => CoreBundle/Resources/views/default/layout/main.tpl} (51%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/layout/menu.tpl (88%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/layout/messages.tpl (100%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/layout/no_layout.tpl (75%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/layout/page_body.tpl (78%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/layout/page_post_body.tpl (100%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/layout/sidebar.tpl (60%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/layout/sniff.tpl (100%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/layout/social_layout.tpl (85%) create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/default/layout/topbar.tpl rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/layout/welcome_to_course.tpl (61%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/learnpath/impress.tpl (100%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/learnpath/lp.tpl (93%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/learnpath/lp_js.tpl (100%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/learnpath/lp_upload_audio.tpl (100%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/learnpath/record_voice.tpl (93%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/learnpath/subscribe_users.tpl (88%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/link/edit_category.tpl (100%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/link/edit_link.tpl (100%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/link/index.tpl (91%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/mail/exercise/end_exercise_notification.tpl (78%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/mail/exercise/end_exercise_notification_to_user.tpl (78%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/mail/layout.tpl (100%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/mail/sample/sample.tpl (86%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/mail_editor/email_link.js.tpl (100%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/notebook/edit.tpl (100%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/notebook/header.tpl (100%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/notebook/index.tpl (86%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/notebook/javascript.tpl (84%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/notebook/list.tpl (88%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/notebook/upload.tpl (100%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/skill/profile.tpl (84%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/skill/profile_item.tpl (62%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/skill/skill_ranking.tpl (100%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/skill/skill_tree.tpl (97%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/skill/skill_tree_student.tpl (100%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/skill/skill_wheel.js.tpl (98%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/skill/skill_wheel.tpl (92%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/skill/skill_wheel_student.tpl (90%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/skill/user_skills.tpl (100%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/tool/course_home/index.tpl (97%) create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/default/tool/course_home/tool/add.tpl create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/default/tool/course_home/tool/edit.tpl create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/default/tool/course_home/tool/list.tpl create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/default/tool/curriculum/category/add.tpl rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/tool/curriculum/category/add_from_parent.tpl (86%) create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/default/tool/curriculum/category/edit.tpl rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/tool/curriculum/category/list.tpl (75%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/tool/curriculum/category/read.tpl (84%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/tool/curriculum/category/results.tpl (88%) create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/default/tool/curriculum/index.tpl create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/default/tool/curriculum/item/add.tpl rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/tool/curriculum/item/add_from_category.tpl (86%) create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/default/tool/curriculum/item/edit.tpl rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/tool/curriculum/item/list.tpl (93%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/tool/curriculum/item/read.tpl (85%) create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/default/tool/curriculum/user/add.tpl rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/tool/curriculum/user/add_from_category.tpl (84%) create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/default/tool/curriculum/user/edit.tpl rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/tool/curriculum/user/get_user_items.tpl (97%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/tool/curriculum/user/list.tpl (98%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/tool/curriculum/user/read.tpl (84%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/user/files.tpl (59%) create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/default/user/index.tpl rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/user/me.tpl (92%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/user/profile.tpl (97%) rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/userportal/course_item.tpl (100%) create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/default/userportal/course_page.tpl create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/default/userportal/index.tpl rename src/ChamiloLMS/{ => CoreBundle}/Resources/views/default/work/view.tpl (100%) rename src/ChamiloLMS/{ => CoreBundle}/Transaction/ExerciseAttemptTransactionLog.php (99%) rename src/ChamiloLMS/{ => CoreBundle}/Transaction/TransactionExportException.php (78%) rename src/ChamiloLMS/{ => CoreBundle}/Transaction/TransactionImportException.php (78%) rename src/ChamiloLMS/{ => CoreBundle}/Transaction/TransactionLog.php (99%) rename src/ChamiloLMS/{ => CoreBundle}/Transaction/TransactionLogController.php (98%) rename src/ChamiloLMS/{ => CoreBundle}/app.php (95%) rename src/ChamiloLMS/{ => CoreBundle}/filters.php (98%) create mode 100644 src/ChamiloLMS/CoreBundle/paths.php rename src/ChamiloLMS/{ => CoreBundle}/routes.php (99%) rename src/ChamiloLMS/{ => CoreBundle}/services.php (95%) delete mode 100644 src/ChamiloLMS/Entity/CTimeline.php delete mode 100755 src/ChamiloLMS/Entity/Pages.php delete mode 100644 src/ChamiloLMS/Resources/config/route_example.yml delete mode 100644 src/ChamiloLMS/Resources/views/default/admin/administrator/branches/add.tpl delete mode 100644 src/ChamiloLMS/Resources/views/default/admin/administrator/branches/edit.tpl delete mode 100644 src/ChamiloLMS/Resources/views/default/admin/administrator/juries/add.tpl delete mode 100644 src/ChamiloLMS/Resources/views/default/admin/administrator/juries/edit.tpl delete mode 100644 src/ChamiloLMS/Resources/views/default/admin/administrator/question_score/add.tpl delete mode 100644 src/ChamiloLMS/Resources/views/default/admin/administrator/question_score/edit.tpl delete mode 100644 src/ChamiloLMS/Resources/views/default/admin/administrator/question_score/list.tpl delete mode 100644 src/ChamiloLMS/Resources/views/default/admin/administrator/question_score_name/add.tpl delete mode 100644 src/ChamiloLMS/Resources/views/default/admin/administrator/question_score_name/edit.tpl delete mode 100644 src/ChamiloLMS/Resources/views/default/admin/administrator/question_score_name/list.tpl delete mode 100644 src/ChamiloLMS/Resources/views/default/admin/administrator/question_score_name/read.tpl delete mode 100644 src/ChamiloLMS/Resources/views/default/admin/administrator/role/add.tpl delete mode 100644 src/ChamiloLMS/Resources/views/default/admin/administrator/role/edit.tpl delete mode 100644 src/ChamiloLMS/Resources/views/default/admin/administrator/role/list.tpl delete mode 100644 src/ChamiloLMS/Resources/views/default/admin/administrator/role/read.tpl delete mode 100644 src/ChamiloLMS/Resources/views/default/admin/administrator/role_index.tpl delete mode 100644 src/ChamiloLMS/Resources/views/default/admin/director/branches/list.tpl delete mode 100644 src/ChamiloLMS/Resources/views/default/admin/index.tpl delete mode 100644 src/ChamiloLMS/Resources/views/default/admin/jury_president/check_answers.tpl delete mode 100644 src/ChamiloLMS/Resources/views/default/app/session_path/add.tpl delete mode 100644 src/ChamiloLMS/Resources/views/default/app/session_path/edit.tpl delete mode 100644 src/ChamiloLMS/Resources/views/default/app/session_path/session_tree/add.tpl delete mode 100644 src/ChamiloLMS/Resources/views/default/exercise/question/edit_question.tpl delete mode 100644 src/ChamiloLMS/Resources/views/default/index/course_session_block.tpl delete mode 100644 src/ChamiloLMS/Resources/views/default/layout/breadcrumb.tpl delete mode 100644 src/ChamiloLMS/Resources/views/default/layout/head.tpl delete mode 100644 src/ChamiloLMS/Resources/views/default/layout/layout_1_col.tpl delete mode 100644 src/ChamiloLMS/Resources/views/default/layout/main.tpl delete mode 100644 src/ChamiloLMS/Resources/views/default/tool/curriculum/category/add.tpl delete mode 100644 src/ChamiloLMS/Resources/views/default/tool/curriculum/category/edit.tpl delete mode 100644 src/ChamiloLMS/Resources/views/default/tool/curriculum/index.tpl delete mode 100644 src/ChamiloLMS/Resources/views/default/tool/curriculum/item/add.tpl delete mode 100644 src/ChamiloLMS/Resources/views/default/tool/curriculum/item/edit.tpl delete mode 100644 src/ChamiloLMS/Resources/views/default/tool/curriculum/user/add.tpl delete mode 100644 src/ChamiloLMS/Resources/views/default/tool/curriculum/user/edit.tpl delete mode 100644 src/ChamiloLMS/Resources/views/default/user/index.tpl delete mode 100644 src/ChamiloLMS/Resources/views/default/userportal/course_page.tpl delete mode 100644 src/ChamiloLMS/Resources/views/default/userportal/index.tpl delete mode 100755 src/ChamiloLMS/Resources/views/jquery_mobile/form/form_custom_template.tpl delete mode 100644 src/ChamiloLMS/paths.php create mode 100644 web/app.php create mode 100644 web/app_dev.php rename web/{index.php => index2.php} (54%) create mode 100644 web/legacy.php diff --git a/app/SymfonyRequirements.php b/app/SymfonyRequirements.php new file mode 100644 index 0000000000..fb70f803fd --- /dev/null +++ b/app/SymfonyRequirements.php @@ -0,0 +1,687 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Users of PHP 5.2 should be able to run the requirements checks. + * This is why the file and all classes must be compatible with PHP 5.2+ + * (e.g. not using namespaces and closures). + * + * ************** CAUTION ************** + * + * DO NOT EDIT THIS FILE as it will be overridden by Composer as part of + * the installation/update process. The original file resides in the + * SensioDistributionBundle. + * + * ************** CAUTION ************** + */ + +/** + * Represents a single PHP requirement, e.g. an installed extension. + * It can be a mandatory requirement or an optional recommendation. + * There is a special subclass, named PhpIniRequirement, to check a php.ini configuration. + * + * @author Tobias Schultze + */ +class Requirement +{ + private $fulfilled; + private $testMessage; + private $helpText; + private $helpHtml; + private $optional; + + /** + * Constructor that initializes the requirement. + * + * @param Boolean $fulfilled Whether the requirement is fulfilled + * @param string $testMessage The message for testing the requirement + * @param string $helpHtml The help text formatted in HTML for resolving the problem + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) + * @param Boolean $optional Whether this is only an optional recommendation not a mandatory requirement + */ + public function __construct($fulfilled, $testMessage, $helpHtml, $helpText = null, $optional = false) + { + $this->fulfilled = (Boolean) $fulfilled; + $this->testMessage = (string) $testMessage; + $this->helpHtml = (string) $helpHtml; + $this->helpText = null === $helpText ? strip_tags($this->helpHtml) : (string) $helpText; + $this->optional = (Boolean) $optional; + } + + /** + * Returns whether the requirement is fulfilled. + * + * @return Boolean true if fulfilled, otherwise false + */ + public function isFulfilled() + { + return $this->fulfilled; + } + + /** + * Returns the message for testing the requirement. + * + * @return string The test message + */ + public function getTestMessage() + { + return $this->testMessage; + } + + /** + * Returns the help text for resolving the problem + * + * @return string The help text + */ + public function getHelpText() + { + return $this->helpText; + } + + /** + * Returns the help text formatted in HTML. + * + * @return string The HTML help + */ + public function getHelpHtml() + { + return $this->helpHtml; + } + + /** + * Returns whether this is only an optional recommendation and not a mandatory requirement. + * + * @return Boolean true if optional, false if mandatory + */ + public function isOptional() + { + return $this->optional; + } +} + +/** + * Represents a PHP requirement in form of a php.ini configuration. + * + * @author Tobias Schultze + */ +class PhpIniRequirement extends Requirement +{ + /** + * Constructor that initializes the requirement. + * + * @param string $cfgName The configuration name used for ini_get() + * @param Boolean|callback $evaluation Either a Boolean indicating whether the configuration should evaluate to true or false, + or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement + * @param Boolean $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false. + This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin. + Example: You require a config to be true but PHP later removes this config and defaults it to true internally. + * @param string|null $testMessage The message for testing the requirement (when null and $evaluation is a Boolean a default message is derived) + * @param string|null $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a Boolean a default help is derived) + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) + * @param Boolean $optional Whether this is only an optional recommendation not a mandatory requirement + */ + public function __construct($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null, $optional = false) + { + $cfgValue = ini_get($cfgName); + + if (is_callable($evaluation)) { + if (null === $testMessage || null === $helpHtml) { + throw new InvalidArgumentException('You must provide the parameters testMessage and helpHtml for a callback evaluation.'); + } + + $fulfilled = call_user_func($evaluation, $cfgValue); + } else { + if (null === $testMessage) { + $testMessage = sprintf('%s %s be %s in php.ini', + $cfgName, + $optional ? 'should' : 'must', + $evaluation ? 'enabled' : 'disabled' + ); + } + + if (null === $helpHtml) { + $helpHtml = sprintf('Set %s to %s in php.ini*.', + $cfgName, + $evaluation ? 'on' : 'off' + ); + } + + $fulfilled = $evaluation == $cfgValue; + } + + parent::__construct($fulfilled || ($approveCfgAbsence && false === $cfgValue), $testMessage, $helpHtml, $helpText, $optional); + } +} + +/** + * A RequirementCollection represents a set of Requirement instances. + * + * @author Tobias Schultze + */ +class RequirementCollection implements IteratorAggregate +{ + private $requirements = array(); + + /** + * Gets the current RequirementCollection as an Iterator. + * + * @return Traversable A Traversable interface + */ + public function getIterator() + { + return new ArrayIterator($this->requirements); + } + + /** + * Adds a Requirement. + * + * @param Requirement $requirement A Requirement instance + */ + public function add(Requirement $requirement) + { + $this->requirements[] = $requirement; + } + + /** + * Adds a mandatory requirement. + * + * @param Boolean $fulfilled Whether the requirement is fulfilled + * @param string $testMessage The message for testing the requirement + * @param string $helpHtml The help text formatted in HTML for resolving the problem + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) + */ + public function addRequirement($fulfilled, $testMessage, $helpHtml, $helpText = null) + { + $this->add(new Requirement($fulfilled, $testMessage, $helpHtml, $helpText, false)); + } + + /** + * Adds an optional recommendation. + * + * @param Boolean $fulfilled Whether the recommendation is fulfilled + * @param string $testMessage The message for testing the recommendation + * @param string $helpHtml The help text formatted in HTML for resolving the problem + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) + */ + public function addRecommendation($fulfilled, $testMessage, $helpHtml, $helpText = null) + { + $this->add(new Requirement($fulfilled, $testMessage, $helpHtml, $helpText, true)); + } + + /** + * Adds a mandatory requirement in form of a php.ini configuration. + * + * @param string $cfgName The configuration name used for ini_get() + * @param Boolean|callback $evaluation Either a Boolean indicating whether the configuration should evaluate to true or false, + or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement + * @param Boolean $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false. + This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin. + Example: You require a config to be true but PHP later removes this config and defaults it to true internally. + * @param string $testMessage The message for testing the requirement (when null and $evaluation is a Boolean a default message is derived) + * @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a Boolean a default help is derived) + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) + */ + public function addPhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null) + { + $this->add(new PhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence, $testMessage, $helpHtml, $helpText, false)); + } + + /** + * Adds an optional recommendation in form of a php.ini configuration. + * + * @param string $cfgName The configuration name used for ini_get() + * @param Boolean|callback $evaluation Either a Boolean indicating whether the configuration should evaluate to true or false, + or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement + * @param Boolean $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false. + This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin. + Example: You require a config to be true but PHP later removes this config and defaults it to true internally. + * @param string $testMessage The message for testing the requirement (when null and $evaluation is a Boolean a default message is derived) + * @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a Boolean a default help is derived) + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) + */ + public function addPhpIniRecommendation($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null) + { + $this->add(new PhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence, $testMessage, $helpHtml, $helpText, true)); + } + + /** + * Adds a requirement collection to the current set of requirements. + * + * @param RequirementCollection $collection A RequirementCollection instance + */ + public function addCollection(RequirementCollection $collection) + { + $this->requirements = array_merge($this->requirements, $collection->all()); + } + + /** + * Returns both requirements and recommendations. + * + * @return array Array of Requirement instances + */ + public function all() + { + return $this->requirements; + } + + /** + * Returns all mandatory requirements. + * + * @return array Array of Requirement instances + */ + public function getRequirements() + { + $array = array(); + foreach ($this->requirements as $req) { + if (!$req->isOptional()) { + $array[] = $req; + } + } + + return $array; + } + + /** + * Returns the mandatory requirements that were not met. + * + * @return array Array of Requirement instances + */ + public function getFailedRequirements() + { + $array = array(); + foreach ($this->requirements as $req) { + if (!$req->isFulfilled() && !$req->isOptional()) { + $array[] = $req; + } + } + + return $array; + } + + /** + * Returns all optional recommendations. + * + * @return array Array of Requirement instances + */ + public function getRecommendations() + { + $array = array(); + foreach ($this->requirements as $req) { + if ($req->isOptional()) { + $array[] = $req; + } + } + + return $array; + } + + /** + * Returns the recommendations that were not met. + * + * @return array Array of Requirement instances + */ + public function getFailedRecommendations() + { + $array = array(); + foreach ($this->requirements as $req) { + if (!$req->isFulfilled() && $req->isOptional()) { + $array[] = $req; + } + } + + return $array; + } + + /** + * Returns whether a php.ini configuration is not correct. + * + * @return Boolean php.ini configuration problem? + */ + public function hasPhpIniConfigIssue() + { + foreach ($this->requirements as $req) { + if (!$req->isFulfilled() && $req instanceof PhpIniRequirement) { + return true; + } + } + + return false; + } + + /** + * Returns the PHP configuration file (php.ini) path. + * + * @return string|false php.ini file path + */ + public function getPhpIniConfigPath() + { + return get_cfg_var('cfg_file_path'); + } +} + +/** + * This class specifies all requirements and optional recommendations that + * are necessary to run the Symfony Standard Edition. + * + * @author Tobias Schultze + * @author Fabien Potencier + */ +class SymfonyRequirements extends RequirementCollection +{ + const REQUIRED_PHP_VERSION = '5.3.3'; + + /** + * Constructor that initializes the requirements. + */ + public function __construct() + { + /* mandatory requirements follow */ + + $installedPhpVersion = phpversion(); + + $this->addRequirement( + version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>='), + sprintf('PHP version must be at least %s (%s installed)', self::REQUIRED_PHP_VERSION, $installedPhpVersion), + sprintf('You are running PHP version "%s", but Symfony needs at least PHP "%s" to run. + Before using Symfony, upgrade your PHP installation, preferably to the latest version.', + $installedPhpVersion, self::REQUIRED_PHP_VERSION), + sprintf('Install PHP %s or newer (installed version is %s)', self::REQUIRED_PHP_VERSION, $installedPhpVersion) + ); + + $this->addRequirement( + version_compare($installedPhpVersion, '5.3.16', '!='), + 'PHP version must not be 5.3.16 as Symfony won\'t work properly with it', + 'Install PHP 5.3.17 or newer (or downgrade to an earlier PHP version)' + ); + + $this->addRequirement( + is_dir(__DIR__.'/../vendor/composer'), + 'Vendor libraries must be installed', + 'Vendor libraries are missing. Install composer following instructions from http://getcomposer.org/. ' . + 'Then run "php composer.phar install" to install them.' + ); + + $baseDir = basename(__DIR__); + + $this->addRequirement( + is_writable(__DIR__.'/cache'), + "$baseDir/cache/ directory must be writable", + "Change the permissions of the \"$baseDir/cache/\" directory so that the web server can write into it." + ); + + $this->addRequirement( + is_writable(__DIR__.'/logs'), + "$baseDir/logs/ directory must be writable", + "Change the permissions of the \"$baseDir/logs/\" directory so that the web server can write into it." + ); + + $this->addPhpIniRequirement( + 'date.timezone', true, false, + 'date.timezone setting must be set', + 'Set the "date.timezone" setting in php.ini* (like Europe/Paris).' + ); + + if (version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>=')) { + $timezones = array(); + foreach (DateTimeZone::listAbbreviations() as $abbreviations) { + foreach ($abbreviations as $abbreviation) { + $timezones[$abbreviation['timezone_id']] = true; + } + } + + $this->addRequirement( + isset($timezones[date_default_timezone_get()]), + sprintf('Configured default timezone "%s" must be supported by your installation of PHP', date_default_timezone_get()), + 'Your default timezone is not supported by PHP. Check for typos in your php.ini file and have a look at the list of deprecated timezones at http://php.net/manual/en/timezones.others.php.' + ); + } + + $this->addRequirement( + function_exists('json_encode'), + 'json_encode() must be available', + 'Install and enable the JSON extension.' + ); + + $this->addRequirement( + function_exists('session_start'), + 'session_start() must be available', + 'Install and enable the session extension.' + ); + + $this->addRequirement( + function_exists('ctype_alpha'), + 'ctype_alpha() must be available', + 'Install and enable the ctype extension.' + ); + + $this->addRequirement( + function_exists('token_get_all'), + 'token_get_all() must be available', + 'Install and enable the Tokenizer extension.' + ); + + $this->addRequirement( + function_exists('simplexml_import_dom'), + 'simplexml_import_dom() must be available', + 'Install and enable the SimpleXML extension.' + ); + + if (function_exists('apc_store') && ini_get('apc.enabled')) { + if (version_compare($installedPhpVersion, '5.4.0', '>=')) { + $this->addRequirement( + version_compare(phpversion('apc'), '3.1.13', '>='), + 'APC version must be at least 3.1.13 when using PHP 5.4', + 'Upgrade your APC extension (3.1.13+).' + ); + } else { + $this->addRequirement( + version_compare(phpversion('apc'), '3.0.17', '>='), + 'APC version must be at least 3.0.17', + 'Upgrade your APC extension (3.0.17+).' + ); + } + } + + $this->addPhpIniRequirement('detect_unicode', false); + + if (extension_loaded('suhosin')) { + $this->addPhpIniRequirement( + 'suhosin.executor.include.whitelist', + create_function('$cfgValue', 'return false !== stripos($cfgValue, "phar");'), + false, + 'suhosin.executor.include.whitelist must be configured correctly in php.ini', + 'Add "phar" to suhosin.executor.include.whitelist in php.ini*.' + ); + } + + if (extension_loaded('xdebug')) { + $this->addPhpIniRequirement( + 'xdebug.show_exception_trace', false, true + ); + + $this->addPhpIniRequirement( + 'xdebug.scream', false, true + ); + + $this->addPhpIniRecommendation( + 'xdebug.max_nesting_level', + create_function('$cfgValue', 'return $cfgValue > 100;'), + true, + 'xdebug.max_nesting_level should be above 100 in php.ini', + 'Set "xdebug.max_nesting_level" to e.g. "250" in php.ini* to stop Xdebug\'s infinite recursion protection erroneously throwing a fatal error in your project.' + ); + } + + $pcreVersion = defined('PCRE_VERSION') ? (float) PCRE_VERSION : null; + + $this->addRequirement( + null !== $pcreVersion, + 'PCRE extension must be available', + 'Install the PCRE extension (version 8.0+).' + ); + + /* optional recommendations follow */ + + $this->addRecommendation( + file_get_contents(__FILE__) === file_get_contents(__DIR__.'/../vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/skeleton/app/SymfonyRequirements.php'), + 'Requirements file should be up-to-date', + 'Your requirements file is outdated. Run composer install and re-check your configuration.' + ); + + $this->addRecommendation( + version_compare($installedPhpVersion, '5.3.4', '>='), + 'You should use at least PHP 5.3.4 due to PHP bug #52083 in earlier versions', + 'Your project might malfunction randomly due to PHP bug #52083 ("Notice: Trying to get property of non-object"). Install PHP 5.3.4 or newer.' + ); + + $this->addRecommendation( + version_compare($installedPhpVersion, '5.3.8', '>='), + 'When using annotations you should have at least PHP 5.3.8 due to PHP bug #55156', + 'Install PHP 5.3.8 or newer if your project uses annotations.' + ); + + $this->addRecommendation( + version_compare($installedPhpVersion, '5.4.0', '!='), + 'You should not use PHP 5.4.0 due to the PHP bug #61453', + 'Your project might not work properly due to the PHP bug #61453 ("Cannot dump definitions which have method calls"). Install PHP 5.4.1 or newer.' + ); + + $this->addRecommendation( + version_compare($installedPhpVersion, '5.4.11', '>='), + 'When using the logout handler from the Symfony Security Component, you should have at least PHP 5.4.11 due to PHP bug #63379 (as a workaround, you can also set invalidate_session to false in the security logout handler configuration)', + 'Install PHP 5.4.11 or newer if your project uses the logout handler from the Symfony Security Component.' + ); + + $this->addRecommendation( + (version_compare($installedPhpVersion, '5.3.18', '>=') && version_compare($installedPhpVersion, '5.4.0', '<')) + || + version_compare($installedPhpVersion, '5.4.8', '>='), + 'You should use PHP 5.3.18+ or PHP 5.4.8+ to always get nice error messages for fatal errors in the development environment due to PHP bug #61767/#60909', + 'Install PHP 5.3.18+ or PHP 5.4.8+ if you want nice error messages for all fatal errors in the development environment.' + ); + + if (null !== $pcreVersion) { + $this->addRecommendation( + $pcreVersion >= 8.0, + sprintf('PCRE extension should be at least version 8.0 (%s installed)', $pcreVersion), + 'PCRE 8.0+ is preconfigured in PHP since 5.3.2 but you are using an outdated version of it. Symfony probably works anyway but it is recommended to upgrade your PCRE extension.' + ); + } + + $this->addRecommendation( + class_exists('DomDocument'), + 'PHP-XML module should be installed', + 'Install and enable the PHP-XML module.' + ); + + $this->addRecommendation( + function_exists('mb_strlen'), + 'mb_strlen() should be available', + 'Install and enable the mbstring extension.' + ); + + $this->addRecommendation( + function_exists('iconv'), + 'iconv() should be available', + 'Install and enable the iconv extension.' + ); + + $this->addRecommendation( + function_exists('utf8_decode'), + 'utf8_decode() should be available', + 'Install and enable the XML extension.' + ); + + if (!defined('PHP_WINDOWS_VERSION_BUILD')) { + $this->addRecommendation( + function_exists('posix_isatty'), + 'posix_isatty() should be available', + 'Install and enable the php_posix extension (used to colorize the CLI output).' + ); + } + + $this->addRecommendation( + class_exists('Locale'), + 'intl extension should be available', + 'Install and enable the intl extension (used for validators).' + ); + + if (class_exists('Collator')) { + $this->addRecommendation( + null !== new Collator('fr_FR'), + 'intl extension should be correctly configured', + 'The intl extension does not behave properly. This problem is typical on PHP 5.3.X x64 WIN builds.' + ); + } + + if (class_exists('Locale')) { + if (defined('INTL_ICU_VERSION')) { + $version = INTL_ICU_VERSION; + } else { + $reflector = new ReflectionExtension('intl'); + + ob_start(); + $reflector->info(); + $output = strip_tags(ob_get_clean()); + + preg_match('/^ICU version +(?:=> )?(.*)$/m', $output, $matches); + $version = $matches[1]; + } + + $this->addRecommendation( + version_compare($version, '4.0', '>='), + 'intl ICU version should be at least 4+', + 'Upgrade your intl extension with a newer ICU version (4+).' + ); + } + + $accelerator = + (extension_loaded('eaccelerator') && ini_get('eaccelerator.enable')) + || + (extension_loaded('apc') && ini_get('apc.enabled')) + || + (extension_loaded('Zend OPcache') && ini_get('opcache.enable')) + || + (extension_loaded('xcache') && ini_get('xcache.cacher')) + || + (extension_loaded('wincache') && ini_get('wincache.ocenabled')) + ; + + $this->addRecommendation( + $accelerator, + 'a PHP accelerator should be installed', + 'Install and enable a PHP accelerator like APC (highly recommended).' + ); + + $this->addPhpIniRecommendation('short_open_tag', false); + + $this->addPhpIniRecommendation('magic_quotes_gpc', false, true); + + $this->addPhpIniRecommendation('register_globals', false, true); + + $this->addPhpIniRecommendation('session.auto_start', false); + + $this->addRecommendation( + class_exists('PDO'), + 'PDO should be installed', + 'Install PDO (mandatory for Doctrine).' + ); + + if (class_exists('PDO')) { + $drivers = PDO::getAvailableDrivers(); + $this->addRecommendation( + count($drivers), + sprintf('PDO should have some drivers installed (currently available: %s)', count($drivers) ? implode(', ', $drivers) : 'none'), + 'Install PDO drivers (mandatory for Doctrine).' + ); + } + } +} diff --git a/app/autoload.php b/app/autoload.php new file mode 100644 index 0000000000..70526bb5e4 --- /dev/null +++ b/app/autoload.php @@ -0,0 +1,13 @@ +parameters = $parameters; +} +public function all() +{ +return $this->parameters; +} +public function keys() +{ +return array_keys($this->parameters); +} +public function replace(array $parameters = array()) +{ +$this->parameters = $parameters; +} +public function add(array $parameters = array()) +{ +$this->parameters = array_replace($this->parameters, $parameters); +} +public function get($path, $default = null, $deep = false) +{ +if (!$deep || false === $pos = strpos($path,'[')) { +return array_key_exists($path, $this->parameters) ? $this->parameters[$path] : $default; +} +$root = substr($path, 0, $pos); +if (!array_key_exists($root, $this->parameters)) { +return $default; +} +$value = $this->parameters[$root]; +$currentKey = null; +for ($i = $pos, $c = strlen($path); $i < $c; $i++) { +$char = $path[$i]; +if ('['=== $char) { +if (null !== $currentKey) { +throw new \InvalidArgumentException(sprintf('Malformed path. Unexpected "[" at position %d.', $i)); +} +$currentKey =''; +} elseif (']'=== $char) { +if (null === $currentKey) { +throw new \InvalidArgumentException(sprintf('Malformed path. Unexpected "]" at position %d.', $i)); +} +if (!is_array($value) || !array_key_exists($currentKey, $value)) { +return $default; +} +$value = $value[$currentKey]; +$currentKey = null; +} else { +if (null === $currentKey) { +throw new \InvalidArgumentException(sprintf('Malformed path. Unexpected "%s" at position %d.', $char, $i)); +} +$currentKey .= $char; +} +} +if (null !== $currentKey) { +throw new \InvalidArgumentException(sprintf('Malformed path. Path must end with "]".')); +} +return $value; +} +public function set($key, $value) +{ +$this->parameters[$key] = $value; +} +public function has($key) +{ +return array_key_exists($key, $this->parameters); +} +public function remove($key) +{ +unset($this->parameters[$key]); +} +public function getAlpha($key, $default ='', $deep = false) +{ +return preg_replace('/[^[:alpha:]]/','', $this->get($key, $default, $deep)); +} +public function getAlnum($key, $default ='', $deep = false) +{ +return preg_replace('/[^[:alnum:]]/','', $this->get($key, $default, $deep)); +} +public function getDigits($key, $default ='', $deep = false) +{ +return str_replace(array('-','+'),'', $this->filter($key, $default, $deep, FILTER_SANITIZE_NUMBER_INT)); +} +public function getInt($key, $default = 0, $deep = false) +{ +return (int) $this->get($key, $default, $deep); +} +public function filter($key, $default = null, $deep = false, $filter = FILTER_DEFAULT, $options = array()) +{ +$value = $this->get($key, $default, $deep); +if (!is_array($options) && $options) { +$options = array('flags'=> $options); +} +if (is_array($value) && !isset($options['flags'])) { +$options['flags'] = FILTER_REQUIRE_ARRAY; +} +return filter_var($value, $filter, $options); +} +public function getIterator() +{ +return new \ArrayIterator($this->parameters); +} +public function count() +{ +return count($this->parameters); +} +} +} +namespace Symfony\Component\HttpFoundation +{ +class HeaderBag implements \IteratorAggregate, \Countable +{ +protected $headers = array(); +protected $cacheControl = array(); +public function __construct(array $headers = array()) +{ +foreach ($headers as $key => $values) { +$this->set($key, $values); +} +} +public function __toString() +{ +if (!$this->headers) { +return''; +} +$max = max(array_map('strlen', array_keys($this->headers))) + 1; +$content =''; +ksort($this->headers); +foreach ($this->headers as $name => $values) { +$name = implode('-', array_map('ucfirst', explode('-', $name))); +foreach ($values as $value) { +$content .= sprintf("%-{$max}s %s\r\n", $name.':', $value); +} +} +return $content; +} +public function all() +{ +return $this->headers; +} +public function keys() +{ +return array_keys($this->headers); +} +public function replace(array $headers = array()) +{ +$this->headers = array(); +$this->add($headers); +} +public function add(array $headers) +{ +foreach ($headers as $key => $values) { +$this->set($key, $values); +} +} +public function get($key, $default = null, $first = true) +{ +$key = strtr(strtolower($key),'_','-'); +if (!array_key_exists($key, $this->headers)) { +if (null === $default) { +return $first ? null : array(); +} +return $first ? $default : array($default); +} +if ($first) { +return count($this->headers[$key]) ? $this->headers[$key][0] : $default; +} +return $this->headers[$key]; +} +public function set($key, $values, $replace = true) +{ +$key = strtr(strtolower($key),'_','-'); +$values = array_values((array) $values); +if (true === $replace || !isset($this->headers[$key])) { +$this->headers[$key] = $values; +} else { +$this->headers[$key] = array_merge($this->headers[$key], $values); +} +if ('cache-control'=== $key) { +$this->cacheControl = $this->parseCacheControl($values[0]); +} +} +public function has($key) +{ +return array_key_exists(strtr(strtolower($key),'_','-'), $this->headers); +} +public function contains($key, $value) +{ +return in_array($value, $this->get($key, null, false)); +} +public function remove($key) +{ +$key = strtr(strtolower($key),'_','-'); +unset($this->headers[$key]); +if ('cache-control'=== $key) { +$this->cacheControl = array(); +} +} +public function getDate($key, \DateTime $default = null) +{ +if (null === $value = $this->get($key)) { +return $default; +} +if (false === $date = \DateTime::createFromFormat(DATE_RFC2822, $value)) { +throw new \RuntimeException(sprintf('The %s HTTP header is not parseable (%s).', $key, $value)); +} +return $date; +} +public function addCacheControlDirective($key, $value = true) +{ +$this->cacheControl[$key] = $value; +$this->set('Cache-Control', $this->getCacheControlHeader()); +} +public function hasCacheControlDirective($key) +{ +return array_key_exists($key, $this->cacheControl); +} +public function getCacheControlDirective($key) +{ +return array_key_exists($key, $this->cacheControl) ? $this->cacheControl[$key] : null; +} +public function removeCacheControlDirective($key) +{ +unset($this->cacheControl[$key]); +$this->set('Cache-Control', $this->getCacheControlHeader()); +} +public function getIterator() +{ +return new \ArrayIterator($this->headers); +} +public function count() +{ +return count($this->headers); +} +protected function getCacheControlHeader() +{ +$parts = array(); +ksort($this->cacheControl); +foreach ($this->cacheControl as $key => $value) { +if (true === $value) { +$parts[] = $key; +} else { +if (preg_match('#[^a-zA-Z0-9._-]#', $value)) { +$value ='"'.$value.'"'; +} +$parts[] = "$key=$value"; +} +} +return implode(', ', $parts); +} +protected function parseCacheControl($header) +{ +$cacheControl = array(); +preg_match_all('#([a-zA-Z][a-zA-Z_-]*)\s*(?:=(?:"([^"]*)"|([^ \t",;]*)))?#', $header, $matches, PREG_SET_ORDER); +foreach ($matches as $match) { +$cacheControl[strtolower($match[1])] = isset($match[3]) ? $match[3] : (isset($match[2]) ? $match[2] : true); +} +return $cacheControl; +} +} +} +namespace Symfony\Component\HttpFoundation +{ +use Symfony\Component\HttpFoundation\File\UploadedFile; +class FileBag extends ParameterBag +{ +private static $fileKeys = array('error','name','size','tmp_name','type'); +public function __construct(array $parameters = array()) +{ +$this->replace($parameters); +} +public function replace(array $files = array()) +{ +$this->parameters = array(); +$this->add($files); +} +public function set($key, $value) +{ +if (!is_array($value) && !$value instanceof UploadedFile) { +throw new \InvalidArgumentException('An uploaded file must be an array or an instance of UploadedFile.'); +} +parent::set($key, $this->convertFileInformation($value)); +} +public function add(array $files = array()) +{ +foreach ($files as $key => $file) { +$this->set($key, $file); +} +} +protected function convertFileInformation($file) +{ +if ($file instanceof UploadedFile) { +return $file; +} +$file = $this->fixPhpFilesArray($file); +if (is_array($file)) { +$keys = array_keys($file); +sort($keys); +if ($keys == self::$fileKeys) { +if (UPLOAD_ERR_NO_FILE == $file['error']) { +$file = null; +} else { +$file = new UploadedFile($file['tmp_name'], $file['name'], $file['type'], $file['size'], $file['error']); +} +} else { +$file = array_map(array($this,'convertFileInformation'), $file); +} +} +return $file; +} +protected function fixPhpFilesArray($data) +{ +if (!is_array($data)) { +return $data; +} +$keys = array_keys($data); +sort($keys); +if (self::$fileKeys != $keys || !isset($data['name']) || !is_array($data['name'])) { +return $data; +} +$files = $data; +foreach (self::$fileKeys as $k) { +unset($files[$k]); +} +foreach (array_keys($data['name']) as $key) { +$files[$key] = $this->fixPhpFilesArray(array('error'=> $data['error'][$key],'name'=> $data['name'][$key],'type'=> $data['type'][$key],'tmp_name'=> $data['tmp_name'][$key],'size'=> $data['size'][$key] +)); +} +return $files; +} +} +} +namespace Symfony\Component\HttpFoundation +{ +class ServerBag extends ParameterBag +{ +public function getHeaders() +{ +$headers = array(); +$contentHeaders = array('CONTENT_LENGTH'=> true,'CONTENT_MD5'=> true,'CONTENT_TYPE'=> true); +foreach ($this->parameters as $key => $value) { +if (0 === strpos($key,'HTTP_')) { +$headers[substr($key, 5)] = $value; +} +elseif (isset($contentHeaders[$key])) { +$headers[$key] = $value; +} +} +if (isset($this->parameters['PHP_AUTH_USER'])) { +$headers['PHP_AUTH_USER'] = $this->parameters['PHP_AUTH_USER']; +$headers['PHP_AUTH_PW'] = isset($this->parameters['PHP_AUTH_PW']) ? $this->parameters['PHP_AUTH_PW'] :''; +} else { +$authorizationHeader = null; +if (isset($this->parameters['HTTP_AUTHORIZATION'])) { +$authorizationHeader = $this->parameters['HTTP_AUTHORIZATION']; +} elseif (isset($this->parameters['REDIRECT_HTTP_AUTHORIZATION'])) { +$authorizationHeader = $this->parameters['REDIRECT_HTTP_AUTHORIZATION']; +} +if (null !== $authorizationHeader) { +if (0 === stripos($authorizationHeader,'basic')) { +$exploded = explode(':', base64_decode(substr($authorizationHeader, 6))); +if (count($exploded) == 2) { +list($headers['PHP_AUTH_USER'], $headers['PHP_AUTH_PW']) = $exploded; +} +} elseif (empty($this->parameters['PHP_AUTH_DIGEST']) && (0 === stripos($authorizationHeader,'digest'))) { +$headers['PHP_AUTH_DIGEST'] = $authorizationHeader; +$this->parameters['PHP_AUTH_DIGEST'] = $authorizationHeader; +} +} +} +if (isset($headers['PHP_AUTH_USER'])) { +$headers['AUTHORIZATION'] ='Basic '.base64_encode($headers['PHP_AUTH_USER'].':'.$headers['PHP_AUTH_PW']); +} elseif (isset($headers['PHP_AUTH_DIGEST'])) { +$headers['AUTHORIZATION'] = $headers['PHP_AUTH_DIGEST']; +} +return $headers; +} +} +} +namespace Symfony\Component\HttpFoundation +{ +use Symfony\Component\HttpFoundation\Session\SessionInterface; +class Request +{ +const HEADER_CLIENT_IP ='client_ip'; +const HEADER_CLIENT_HOST ='client_host'; +const HEADER_CLIENT_PROTO ='client_proto'; +const HEADER_CLIENT_PORT ='client_port'; +protected static $trustedProxies = array(); +protected static $trustedHostPatterns = array(); +protected static $trustedHosts = array(); +protected static $trustedHeaders = array( +self::HEADER_CLIENT_IP =>'X_FORWARDED_FOR', +self::HEADER_CLIENT_HOST =>'X_FORWARDED_HOST', +self::HEADER_CLIENT_PROTO =>'X_FORWARDED_PROTO', +self::HEADER_CLIENT_PORT =>'X_FORWARDED_PORT', +); +protected static $httpMethodParameterOverride = false; +public $attributes; +public $request; +public $query; +public $server; +public $files; +public $cookies; +public $headers; +protected $content; +protected $languages; +protected $charsets; +protected $encodings; +protected $acceptableContentTypes; +protected $pathInfo; +protected $requestUri; +protected $baseUrl; +protected $basePath; +protected $method; +protected $format; +protected $session; +protected $locale; +protected $defaultLocale ='en'; +protected static $formats; +protected static $requestFactory; +public function __construct(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null) +{ +$this->initialize($query, $request, $attributes, $cookies, $files, $server, $content); +} +public function initialize(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null) +{ +$this->request = new ParameterBag($request); +$this->query = new ParameterBag($query); +$this->attributes = new ParameterBag($attributes); +$this->cookies = new ParameterBag($cookies); +$this->files = new FileBag($files); +$this->server = new ServerBag($server); +$this->headers = new HeaderBag($this->server->getHeaders()); +$this->content = $content; +$this->languages = null; +$this->charsets = null; +$this->encodings = null; +$this->acceptableContentTypes = null; +$this->pathInfo = null; +$this->requestUri = null; +$this->baseUrl = null; +$this->basePath = null; +$this->method = null; +$this->format = null; +} +public static function createFromGlobals() +{ +$request = self::createRequestFromFactory($_GET, $_POST, array(), $_COOKIE, $_FILES, $_SERVER); +if (0 === strpos($request->headers->get('CONTENT_TYPE'),'application/x-www-form-urlencoded') +&& in_array(strtoupper($request->server->get('REQUEST_METHOD','GET')), array('PUT','DELETE','PATCH')) +) { +parse_str($request->getContent(), $data); +$request->request = new ParameterBag($data); +} +return $request; +} +public static function create($uri, $method ='GET', $parameters = array(), $cookies = array(), $files = array(), $server = array(), $content = null) +{ +$server = array_replace(array('SERVER_NAME'=>'localhost','SERVER_PORT'=> 80,'HTTP_HOST'=>'localhost','HTTP_USER_AGENT'=>'Symfony/2.X','HTTP_ACCEPT'=>'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8','HTTP_ACCEPT_LANGUAGE'=>'en-us,en;q=0.5','HTTP_ACCEPT_CHARSET'=>'ISO-8859-1,utf-8;q=0.7,*;q=0.7','REMOTE_ADDR'=>'127.0.0.1','SCRIPT_NAME'=>'','SCRIPT_FILENAME'=>'','SERVER_PROTOCOL'=>'HTTP/1.1','REQUEST_TIME'=> time(), +), $server); +$server['PATH_INFO'] =''; +$server['REQUEST_METHOD'] = strtoupper($method); +$components = parse_url($uri); +if (isset($components['host'])) { +$server['SERVER_NAME'] = $components['host']; +$server['HTTP_HOST'] = $components['host']; +} +if (isset($components['scheme'])) { +if ('https'=== $components['scheme']) { +$server['HTTPS'] ='on'; +$server['SERVER_PORT'] = 443; +} else { +unset($server['HTTPS']); +$server['SERVER_PORT'] = 80; +} +} +if (isset($components['port'])) { +$server['SERVER_PORT'] = $components['port']; +$server['HTTP_HOST'] = $server['HTTP_HOST'].':'.$components['port']; +} +if (isset($components['user'])) { +$server['PHP_AUTH_USER'] = $components['user']; +} +if (isset($components['pass'])) { +$server['PHP_AUTH_PW'] = $components['pass']; +} +if (!isset($components['path'])) { +$components['path'] ='/'; +} +switch (strtoupper($method)) { +case'POST': +case'PUT': +case'DELETE': +if (!isset($server['CONTENT_TYPE'])) { +$server['CONTENT_TYPE'] ='application/x-www-form-urlencoded'; +} +case'PATCH': +$request = $parameters; +$query = array(); +break; +default: +$request = array(); +$query = $parameters; +break; +} +$queryString =''; +if (isset($components['query'])) { +parse_str(html_entity_decode($components['query']), $qs); +if ($query) { +$query = array_replace($qs, $query); +$queryString = http_build_query($query,'','&'); +} else { +$query = $qs; +$queryString = $components['query']; +} +} elseif ($query) { +$queryString = http_build_query($query,'','&'); +} +$server['REQUEST_URI'] = $components['path'].(''!== $queryString ?'?'.$queryString :''); +$server['QUERY_STRING'] = $queryString; +return self::createRequestFromFactory($query, $request, array(), $cookies, $files, $server, $content); +} +public static function setFactory($callable) +{ +self::$requestFactory = $callable; +} +public function duplicate(array $query = null, array $request = null, array $attributes = null, array $cookies = null, array $files = null, array $server = null) +{ +$dup = clone $this; +if ($query !== null) { +$dup->query = new ParameterBag($query); +} +if ($request !== null) { +$dup->request = new ParameterBag($request); +} +if ($attributes !== null) { +$dup->attributes = new ParameterBag($attributes); +} +if ($cookies !== null) { +$dup->cookies = new ParameterBag($cookies); +} +if ($files !== null) { +$dup->files = new FileBag($files); +} +if ($server !== null) { +$dup->server = new ServerBag($server); +$dup->headers = new HeaderBag($dup->server->getHeaders()); +} +$dup->languages = null; +$dup->charsets = null; +$dup->encodings = null; +$dup->acceptableContentTypes = null; +$dup->pathInfo = null; +$dup->requestUri = null; +$dup->baseUrl = null; +$dup->basePath = null; +$dup->method = null; +$dup->format = null; +if (!$dup->get('_format') && $this->get('_format')) { +$dup->attributes->set('_format', $this->get('_format')); +} +if (!$dup->getRequestFormat(null)) { +$dup->setRequestFormat($format = $this->getRequestFormat(null)); +} +return $dup; +} +public function __clone() +{ +$this->query = clone $this->query; +$this->request = clone $this->request; +$this->attributes = clone $this->attributes; +$this->cookies = clone $this->cookies; +$this->files = clone $this->files; +$this->server = clone $this->server; +$this->headers = clone $this->headers; +} +public function __toString() +{ +return +sprintf('%s %s %s', $this->getMethod(), $this->getRequestUri(), $this->server->get('SERVER_PROTOCOL'))."\r\n". +$this->headers."\r\n". +$this->getContent(); +} +public function overrideGlobals() +{ +$_GET = $this->query->all(); +$_POST = $this->request->all(); +$_SERVER = $this->server->all(); +$_COOKIE = $this->cookies->all(); +foreach ($this->headers->all() as $key => $value) { +$key = strtoupper(str_replace('-','_', $key)); +if (in_array($key, array('CONTENT_TYPE','CONTENT_LENGTH'))) { +$_SERVER[$key] = implode(', ', $value); +} else { +$_SERVER['HTTP_'.$key] = implode(', ', $value); +} +} +$request = array('g'=> $_GET,'p'=> $_POST,'c'=> $_COOKIE); +$requestOrder = ini_get('request_order') ?: ini_get('variables_order'); +$requestOrder = preg_replace('#[^cgp]#','', strtolower($requestOrder)) ?:'gp'; +$_REQUEST = array(); +foreach (str_split($requestOrder) as $order) { +$_REQUEST = array_merge($_REQUEST, $request[$order]); +} +} +public static function setTrustedProxies(array $proxies) +{ +self::$trustedProxies = $proxies; +} +public static function getTrustedProxies() +{ +return self::$trustedProxies; +} +public static function setTrustedHosts(array $hostPatterns) +{ +self::$trustedHostPatterns = array_map(function ($hostPattern) { +return sprintf('{%s}i', str_replace('}','\\}', $hostPattern)); +}, $hostPatterns); +self::$trustedHosts = array(); +} +public static function getTrustedHosts() +{ +return self::$trustedHostPatterns; +} +public static function setTrustedHeaderName($key, $value) +{ +if (!array_key_exists($key, self::$trustedHeaders)) { +throw new \InvalidArgumentException(sprintf('Unable to set the trusted header name for key "%s".', $key)); +} +self::$trustedHeaders[$key] = $value; +} +public static function getTrustedHeaderName($key) +{ +if (!array_key_exists($key, self::$trustedHeaders)) { +throw new \InvalidArgumentException(sprintf('Unable to get the trusted header name for key "%s".', $key)); +} +return self::$trustedHeaders[$key]; +} +public static function normalizeQueryString($qs) +{ +if (''== $qs) { +return''; +} +$parts = array(); +$order = array(); +foreach (explode('&', $qs) as $param) { +if (''=== $param ||'='=== $param[0]) { +continue; +} +$keyValuePair = explode('=', $param, 2); +$parts[] = isset($keyValuePair[1]) ? +rawurlencode(urldecode($keyValuePair[0])).'='.rawurlencode(urldecode($keyValuePair[1])) : +rawurlencode(urldecode($keyValuePair[0])); +$order[] = urldecode($keyValuePair[0]); +} +array_multisort($order, SORT_ASC, $parts); +return implode('&', $parts); +} +public static function enableHttpMethodParameterOverride() +{ +self::$httpMethodParameterOverride = true; +} +public static function getHttpMethodParameterOverride() +{ +return self::$httpMethodParameterOverride; +} +public function get($key, $default = null, $deep = false) +{ +return $this->query->get($key, $this->attributes->get($key, $this->request->get($key, $default, $deep), $deep), $deep); +} +public function getSession() +{ +return $this->session; +} +public function hasPreviousSession() +{ +return $this->hasSession() && $this->cookies->has($this->session->getName()); +} +public function hasSession() +{ +return null !== $this->session; +} +public function setSession(SessionInterface $session) +{ +$this->session = $session; +} +public function getClientIps() +{ +$ip = $this->server->get('REMOTE_ADDR'); +if (!self::$trustedProxies) { +return array($ip); +} +if (!self::$trustedHeaders[self::HEADER_CLIENT_IP] || !$this->headers->has(self::$trustedHeaders[self::HEADER_CLIENT_IP])) { +return array($ip); +} +$clientIps = array_map('trim', explode(',', $this->headers->get(self::$trustedHeaders[self::HEADER_CLIENT_IP]))); +$clientIps[] = $ip; +$ip = $clientIps[0]; +foreach ($clientIps as $key => $clientIp) { +if (IpUtils::checkIp($clientIp, self::$trustedProxies)) { +unset($clientIps[$key]); +} +} +return $clientIps ? array_reverse($clientIps) : array($ip); +} +public function getClientIp() +{ +$ipAddresses = $this->getClientIps(); +return $ipAddresses[0]; +} +public function getScriptName() +{ +return $this->server->get('SCRIPT_NAME', $this->server->get('ORIG_SCRIPT_NAME','')); +} +public function getPathInfo() +{ +if (null === $this->pathInfo) { +$this->pathInfo = $this->preparePathInfo(); +} +return $this->pathInfo; +} +public function getBasePath() +{ +if (null === $this->basePath) { +$this->basePath = $this->prepareBasePath(); +} +return $this->basePath; +} +public function getBaseUrl() +{ +if (null === $this->baseUrl) { +$this->baseUrl = $this->prepareBaseUrl(); +} +return $this->baseUrl; +} +public function getScheme() +{ +return $this->isSecure() ?'https':'http'; +} +public function getPort() +{ +if (self::$trustedProxies) { +if (self::$trustedHeaders[self::HEADER_CLIENT_PORT] && $port = $this->headers->get(self::$trustedHeaders[self::HEADER_CLIENT_PORT])) { +return $port; +} +if (self::$trustedHeaders[self::HEADER_CLIENT_PROTO] &&'https'=== $this->headers->get(self::$trustedHeaders[self::HEADER_CLIENT_PROTO],'http')) { +return 443; +} +} +if ($host = $this->headers->get('HOST')) { +if (false !== $pos = strrpos($host,':')) { +return intval(substr($host, $pos + 1)); +} +return'https'=== $this->getScheme() ? 443 : 80; +} +return $this->server->get('SERVER_PORT'); +} +public function getUser() +{ +return $this->server->get('PHP_AUTH_USER'); +} +public function getPassword() +{ +return $this->server->get('PHP_AUTH_PW'); +} +public function getUserInfo() +{ +$userinfo = $this->getUser(); +$pass = $this->getPassword(); +if (''!= $pass) { +$userinfo .= ":$pass"; +} +return $userinfo; +} +public function getHttpHost() +{ +$scheme = $this->getScheme(); +$port = $this->getPort(); +if (('http'== $scheme && $port == 80) || ('https'== $scheme && $port == 443)) { +return $this->getHost(); +} +return $this->getHost().':'.$port; +} +public function getRequestUri() +{ +if (null === $this->requestUri) { +$this->requestUri = $this->prepareRequestUri(); +} +return $this->requestUri; +} +public function getSchemeAndHttpHost() +{ +return $this->getScheme().'://'.$this->getHttpHost(); +} +public function getUri() +{ +if (null !== $qs = $this->getQueryString()) { +$qs ='?'.$qs; +} +return $this->getSchemeAndHttpHost().$this->getBaseUrl().$this->getPathInfo().$qs; +} +public function getUriForPath($path) +{ +return $this->getSchemeAndHttpHost().$this->getBaseUrl().$path; +} +public function getQueryString() +{ +$qs = static::normalizeQueryString($this->server->get('QUERY_STRING')); +return''=== $qs ? null : $qs; +} +public function isSecure() +{ +if (self::$trustedProxies && self::$trustedHeaders[self::HEADER_CLIENT_PROTO] && $proto = $this->headers->get(self::$trustedHeaders[self::HEADER_CLIENT_PROTO])) { +return in_array(strtolower(current(explode(',', $proto))), array('https','on','ssl','1')); +} +return'on'== strtolower($this->server->get('HTTPS')) || 1 == $this->server->get('HTTPS'); +} +public function getHost() +{ +if (self::$trustedProxies && self::$trustedHeaders[self::HEADER_CLIENT_HOST] && $host = $this->headers->get(self::$trustedHeaders[self::HEADER_CLIENT_HOST])) { +$elements = explode(',', $host); +$host = $elements[count($elements) - 1]; +} elseif (!$host = $this->headers->get('HOST')) { +if (!$host = $this->server->get('SERVER_NAME')) { +$host = $this->server->get('SERVER_ADDR',''); +} +} +$host = strtolower(preg_replace('/:\d+$/','', trim($host))); +if ($host && !preg_match('/^\[?(?:[a-zA-Z0-9-:\]_]+\.?)+$/', $host)) { +throw new \UnexpectedValueException(sprintf('Invalid Host "%s"', $host)); +} +if (count(self::$trustedHostPatterns) > 0) { +if (in_array($host, self::$trustedHosts)) { +return $host; +} +foreach (self::$trustedHostPatterns as $pattern) { +if (preg_match($pattern, $host)) { +self::$trustedHosts[] = $host; +return $host; +} +} +throw new \UnexpectedValueException(sprintf('Untrusted Host "%s"', $host)); +} +return $host; +} +public function setMethod($method) +{ +$this->method = null; +$this->server->set('REQUEST_METHOD', $method); +} +public function getMethod() +{ +if (null === $this->method) { +$this->method = strtoupper($this->server->get('REQUEST_METHOD','GET')); +if ('POST'=== $this->method) { +if ($method = $this->headers->get('X-HTTP-METHOD-OVERRIDE')) { +$this->method = strtoupper($method); +} elseif (self::$httpMethodParameterOverride) { +$this->method = strtoupper($this->request->get('_method', $this->query->get('_method','POST'))); +} +} +} +return $this->method; +} +public function getRealMethod() +{ +return strtoupper($this->server->get('REQUEST_METHOD','GET')); +} +public function getMimeType($format) +{ +if (null === static::$formats) { +static::initializeFormats(); +} +return isset(static::$formats[$format]) ? static::$formats[$format][0] : null; +} +public function getFormat($mimeType) +{ +if (false !== $pos = strpos($mimeType,';')) { +$mimeType = substr($mimeType, 0, $pos); +} +if (null === static::$formats) { +static::initializeFormats(); +} +foreach (static::$formats as $format => $mimeTypes) { +if (in_array($mimeType, (array) $mimeTypes)) { +return $format; +} +} +} +public function setFormat($format, $mimeTypes) +{ +if (null === static::$formats) { +static::initializeFormats(); +} +static::$formats[$format] = is_array($mimeTypes) ? $mimeTypes : array($mimeTypes); +} +public function getRequestFormat($default ='html') +{ +if (null === $this->format) { +$this->format = $this->get('_format', $default); +} +return $this->format; +} +public function setRequestFormat($format) +{ +$this->format = $format; +} +public function getContentType() +{ +return $this->getFormat($this->headers->get('CONTENT_TYPE')); +} +public function setDefaultLocale($locale) +{ +$this->defaultLocale = $locale; +if (null === $this->locale) { +$this->setPhpDefaultLocale($locale); +} +} +public function setLocale($locale) +{ +$this->setPhpDefaultLocale($this->locale = $locale); +} +public function getLocale() +{ +return null === $this->locale ? $this->defaultLocale : $this->locale; +} +public function isMethod($method) +{ +return $this->getMethod() === strtoupper($method); +} +public function isMethodSafe() +{ +return in_array($this->getMethod(), array('GET','HEAD')); +} +public function getContent($asResource = false) +{ +if (false === $this->content || (true === $asResource && null !== $this->content)) { +throw new \LogicException('getContent() can only be called once when using the resource return type.'); +} +if (true === $asResource) { +$this->content = false; +return fopen('php://input','rb'); +} +if (null === $this->content) { +$this->content = file_get_contents('php://input'); +} +return $this->content; +} +public function getETags() +{ +return preg_split('/\s*,\s*/', $this->headers->get('if_none_match'), null, PREG_SPLIT_NO_EMPTY); +} +public function isNoCache() +{ +return $this->headers->hasCacheControlDirective('no-cache') ||'no-cache'== $this->headers->get('Pragma'); +} +public function getPreferredLanguage(array $locales = null) +{ +$preferredLanguages = $this->getLanguages(); +if (empty($locales)) { +return isset($preferredLanguages[0]) ? $preferredLanguages[0] : null; +} +if (!$preferredLanguages) { +return $locales[0]; +} +$extendedPreferredLanguages = array(); +foreach ($preferredLanguages as $language) { +$extendedPreferredLanguages[] = $language; +if (false !== $position = strpos($language,'_')) { +$superLanguage = substr($language, 0, $position); +if (!in_array($superLanguage, $preferredLanguages)) { +$extendedPreferredLanguages[] = $superLanguage; +} +} +} +$preferredLanguages = array_values(array_intersect($extendedPreferredLanguages, $locales)); +return isset($preferredLanguages[0]) ? $preferredLanguages[0] : $locales[0]; +} +public function getLanguages() +{ +if (null !== $this->languages) { +return $this->languages; +} +$languages = AcceptHeader::fromString($this->headers->get('Accept-Language'))->all(); +$this->languages = array(); +foreach (array_keys($languages) as $lang) { +if (strstr($lang,'-')) { +$codes = explode('-', $lang); +if ($codes[0] =='i') { +if (count($codes) > 1) { +$lang = $codes[1]; +} +} else { +for ($i = 0, $max = count($codes); $i < $max; $i++) { +if ($i == 0) { +$lang = strtolower($codes[0]); +} else { +$lang .='_'.strtoupper($codes[$i]); +} +} +} +} +$this->languages[] = $lang; +} +return $this->languages; +} +public function getCharsets() +{ +if (null !== $this->charsets) { +return $this->charsets; +} +return $this->charsets = array_keys(AcceptHeader::fromString($this->headers->get('Accept-Charset'))->all()); +} +public function getEncodings() +{ +if (null !== $this->encodings) { +return $this->encodings; +} +return $this->encodings = array_keys(AcceptHeader::fromString($this->headers->get('Accept-Encoding'))->all()); +} +public function getAcceptableContentTypes() +{ +if (null !== $this->acceptableContentTypes) { +return $this->acceptableContentTypes; +} +return $this->acceptableContentTypes = array_keys(AcceptHeader::fromString($this->headers->get('Accept'))->all()); +} +public function isXmlHttpRequest() +{ +return'XMLHttpRequest'== $this->headers->get('X-Requested-With'); +} +protected function prepareRequestUri() +{ +$requestUri =''; +if ($this->headers->has('X_ORIGINAL_URL')) { +$requestUri = $this->headers->get('X_ORIGINAL_URL'); +$this->headers->remove('X_ORIGINAL_URL'); +$this->server->remove('HTTP_X_ORIGINAL_URL'); +$this->server->remove('UNENCODED_URL'); +$this->server->remove('IIS_WasUrlRewritten'); +} elseif ($this->headers->has('X_REWRITE_URL')) { +$requestUri = $this->headers->get('X_REWRITE_URL'); +$this->headers->remove('X_REWRITE_URL'); +} elseif ($this->server->get('IIS_WasUrlRewritten') =='1'&& $this->server->get('UNENCODED_URL') !='') { +$requestUri = $this->server->get('UNENCODED_URL'); +$this->server->remove('UNENCODED_URL'); +$this->server->remove('IIS_WasUrlRewritten'); +} elseif ($this->server->has('REQUEST_URI')) { +$requestUri = $this->server->get('REQUEST_URI'); +$schemeAndHttpHost = $this->getSchemeAndHttpHost(); +if (strpos($requestUri, $schemeAndHttpHost) === 0) { +$requestUri = substr($requestUri, strlen($schemeAndHttpHost)); +} +} elseif ($this->server->has('ORIG_PATH_INFO')) { +$requestUri = $this->server->get('ORIG_PATH_INFO'); +if (''!= $this->server->get('QUERY_STRING')) { +$requestUri .='?'.$this->server->get('QUERY_STRING'); +} +$this->server->remove('ORIG_PATH_INFO'); +} +$this->server->set('REQUEST_URI', $requestUri); +return $requestUri; +} +protected function prepareBaseUrl() +{ +$filename = basename($this->server->get('SCRIPT_FILENAME')); +if (basename($this->server->get('SCRIPT_NAME')) === $filename) { +$baseUrl = $this->server->get('SCRIPT_NAME'); +} elseif (basename($this->server->get('PHP_SELF')) === $filename) { +$baseUrl = $this->server->get('PHP_SELF'); +} elseif (basename($this->server->get('ORIG_SCRIPT_NAME')) === $filename) { +$baseUrl = $this->server->get('ORIG_SCRIPT_NAME'); } else { +$path = $this->server->get('PHP_SELF',''); +$file = $this->server->get('SCRIPT_FILENAME',''); +$segs = explode('/', trim($file,'/')); +$segs = array_reverse($segs); +$index = 0; +$last = count($segs); +$baseUrl =''; +do { +$seg = $segs[$index]; +$baseUrl ='/'.$seg.$baseUrl; +++$index; +} while ($last > $index && (false !== $pos = strpos($path, $baseUrl)) && 0 != $pos); +} +$requestUri = $this->getRequestUri(); +if ($baseUrl && false !== $prefix = $this->getUrlencodedPrefix($requestUri, $baseUrl)) { +return $prefix; +} +if ($baseUrl && false !== $prefix = $this->getUrlencodedPrefix($requestUri, dirname($baseUrl))) { +return rtrim($prefix,'/'); +} +$truncatedRequestUri = $requestUri; +if (false !== $pos = strpos($requestUri,'?')) { +$truncatedRequestUri = substr($requestUri, 0, $pos); +} +$basename = basename($baseUrl); +if (empty($basename) || !strpos(rawurldecode($truncatedRequestUri), $basename)) { +return''; +} +if (strlen($requestUri) >= strlen($baseUrl) && (false !== $pos = strpos($requestUri, $baseUrl)) && $pos !== 0) { +$baseUrl = substr($requestUri, 0, $pos + strlen($baseUrl)); +} +return rtrim($baseUrl,'/'); +} +protected function prepareBasePath() +{ +$filename = basename($this->server->get('SCRIPT_FILENAME')); +$baseUrl = $this->getBaseUrl(); +if (empty($baseUrl)) { +return''; +} +if (basename($baseUrl) === $filename) { +$basePath = dirname($baseUrl); +} else { +$basePath = $baseUrl; +} +if ('\\'=== DIRECTORY_SEPARATOR) { +$basePath = str_replace('\\','/', $basePath); +} +return rtrim($basePath,'/'); +} +protected function preparePathInfo() +{ +$baseUrl = $this->getBaseUrl(); +if (null === ($requestUri = $this->getRequestUri())) { +return'/'; +} +$pathInfo ='/'; +if ($pos = strpos($requestUri,'?')) { +$requestUri = substr($requestUri, 0, $pos); +} +if (null !== $baseUrl && false === $pathInfo = substr($requestUri, strlen($baseUrl))) { +return'/'; +} elseif (null === $baseUrl) { +return $requestUri; +} +return (string) $pathInfo; +} +protected static function initializeFormats() +{ +static::$formats = array('html'=> array('text/html','application/xhtml+xml'),'txt'=> array('text/plain'),'js'=> array('application/javascript','application/x-javascript','text/javascript'),'css'=> array('text/css'),'json'=> array('application/json','application/x-json'),'xml'=> array('text/xml','application/xml','application/x-xml'),'rdf'=> array('application/rdf+xml'),'atom'=> array('application/atom+xml'),'rss'=> array('application/rss+xml'), +); +} +private function setPhpDefaultLocale($locale) +{ +try { +if (class_exists('Locale', false)) { +\Locale::setDefault($locale); +} +} catch (\Exception $e) { +} +} +private function getUrlencodedPrefix($string, $prefix) +{ +if (0 !== strpos(rawurldecode($string), $prefix)) { +return false; +} +$len = strlen($prefix); +if (preg_match("#^(%[[:xdigit:]]{2}|.){{$len}}#", $string, $match)) { +return $match[0]; +} +return false; +} +private static function createRequestFromFactory(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null) +{ +if (self::$requestFactory) { +$request = call_user_func(self::$requestFactory, $query, $request, $attributes, $cookies, $files, $server, $content); +if (!$request instanceof Request) { +throw new \LogicException('The Request factory must return an instance of Symfony\Component\HttpFoundation\Request.'); +} +return $request; +} +return new static($query, $request, $attributes, $cookies, $files, $server, $content); +} +} +} +namespace Symfony\Component\HttpFoundation +{ +class Response +{ +const HTTP_CONTINUE = 100; +const HTTP_SWITCHING_PROTOCOLS = 101; +const HTTP_PROCESSING = 102; const HTTP_OK = 200; +const HTTP_CREATED = 201; +const HTTP_ACCEPTED = 202; +const HTTP_NON_AUTHORITATIVE_INFORMATION = 203; +const HTTP_NO_CONTENT = 204; +const HTTP_RESET_CONTENT = 205; +const HTTP_PARTIAL_CONTENT = 206; +const HTTP_MULTI_STATUS = 207; const HTTP_ALREADY_REPORTED = 208; const HTTP_IM_USED = 226; const HTTP_MULTIPLE_CHOICES = 300; +const HTTP_MOVED_PERMANENTLY = 301; +const HTTP_FOUND = 302; +const HTTP_SEE_OTHER = 303; +const HTTP_NOT_MODIFIED = 304; +const HTTP_USE_PROXY = 305; +const HTTP_RESERVED = 306; +const HTTP_TEMPORARY_REDIRECT = 307; +const HTTP_PERMANENTLY_REDIRECT = 308; const HTTP_BAD_REQUEST = 400; +const HTTP_UNAUTHORIZED = 401; +const HTTP_PAYMENT_REQUIRED = 402; +const HTTP_FORBIDDEN = 403; +const HTTP_NOT_FOUND = 404; +const HTTP_METHOD_NOT_ALLOWED = 405; +const HTTP_NOT_ACCEPTABLE = 406; +const HTTP_PROXY_AUTHENTICATION_REQUIRED = 407; +const HTTP_REQUEST_TIMEOUT = 408; +const HTTP_CONFLICT = 409; +const HTTP_GONE = 410; +const HTTP_LENGTH_REQUIRED = 411; +const HTTP_PRECONDITION_FAILED = 412; +const HTTP_REQUEST_ENTITY_TOO_LARGE = 413; +const HTTP_REQUEST_URI_TOO_LONG = 414; +const HTTP_UNSUPPORTED_MEDIA_TYPE = 415; +const HTTP_REQUESTED_RANGE_NOT_SATISFIABLE = 416; +const HTTP_EXPECTATION_FAILED = 417; +const HTTP_I_AM_A_TEAPOT = 418; const HTTP_UNPROCESSABLE_ENTITY = 422; const HTTP_LOCKED = 423; const HTTP_FAILED_DEPENDENCY = 424; const HTTP_RESERVED_FOR_WEBDAV_ADVANCED_COLLECTIONS_EXPIRED_PROPOSAL = 425; const HTTP_UPGRADE_REQUIRED = 426; const HTTP_PRECONDITION_REQUIRED = 428; const HTTP_TOO_MANY_REQUESTS = 429; const HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE = 431; const HTTP_INTERNAL_SERVER_ERROR = 500; +const HTTP_NOT_IMPLEMENTED = 501; +const HTTP_BAD_GATEWAY = 502; +const HTTP_SERVICE_UNAVAILABLE = 503; +const HTTP_GATEWAY_TIMEOUT = 504; +const HTTP_VERSION_NOT_SUPPORTED = 505; +const HTTP_VARIANT_ALSO_NEGOTIATES_EXPERIMENTAL = 506; const HTTP_INSUFFICIENT_STORAGE = 507; const HTTP_LOOP_DETECTED = 508; const HTTP_NOT_EXTENDED = 510; const HTTP_NETWORK_AUTHENTICATION_REQUIRED = 511; +public $headers; +protected $content; +protected $version; +protected $statusCode; +protected $statusText; +protected $charset; +public static $statusTexts = array( +100 =>'Continue', +101 =>'Switching Protocols', +102 =>'Processing', 200 =>'OK', +201 =>'Created', +202 =>'Accepted', +203 =>'Non-Authoritative Information', +204 =>'No Content', +205 =>'Reset Content', +206 =>'Partial Content', +207 =>'Multi-Status', 208 =>'Already Reported', 226 =>'IM Used', 300 =>'Multiple Choices', +301 =>'Moved Permanently', +302 =>'Found', +303 =>'See Other', +304 =>'Not Modified', +305 =>'Use Proxy', +306 =>'Reserved', +307 =>'Temporary Redirect', +308 =>'Permanent Redirect', 400 =>'Bad Request', +401 =>'Unauthorized', +402 =>'Payment Required', +403 =>'Forbidden', +404 =>'Not Found', +405 =>'Method Not Allowed', +406 =>'Not Acceptable', +407 =>'Proxy Authentication Required', +408 =>'Request Timeout', +409 =>'Conflict', +410 =>'Gone', +411 =>'Length Required', +412 =>'Precondition Failed', +413 =>'Request Entity Too Large', +414 =>'Request-URI Too Long', +415 =>'Unsupported Media Type', +416 =>'Requested Range Not Satisfiable', +417 =>'Expectation Failed', +418 =>'I\'m a teapot', 422 =>'Unprocessable Entity', 423 =>'Locked', 424 =>'Failed Dependency', 425 =>'Reserved for WebDAV advanced collections expired proposal', 426 =>'Upgrade Required', 428 =>'Precondition Required', 429 =>'Too Many Requests', 431 =>'Request Header Fields Too Large', 500 =>'Internal Server Error', +501 =>'Not Implemented', +502 =>'Bad Gateway', +503 =>'Service Unavailable', +504 =>'Gateway Timeout', +505 =>'HTTP Version Not Supported', +506 =>'Variant Also Negotiates (Experimental)', 507 =>'Insufficient Storage', 508 =>'Loop Detected', 510 =>'Not Extended', 511 =>'Network Authentication Required', ); +public function __construct($content ='', $status = 200, $headers = array()) +{ +$this->headers = new ResponseHeaderBag($headers); +$this->setContent($content); +$this->setStatusCode($status); +$this->setProtocolVersion('1.0'); +if (!$this->headers->has('Date')) { +$this->setDate(new \DateTime(null, new \DateTimeZone('UTC'))); +} +} +public static function create($content ='', $status = 200, $headers = array()) +{ +return new static($content, $status, $headers); +} +public function __toString() +{ +return +sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText)."\r\n". +$this->headers."\r\n". +$this->getContent(); +} +public function __clone() +{ +$this->headers = clone $this->headers; +} +public function prepare(Request $request) +{ +$headers = $this->headers; +if ($this->isInformational() || in_array($this->statusCode, array(204, 304))) { +$this->setContent(null); +} +if (!$headers->has('Content-Type')) { +$format = $request->getRequestFormat(); +if (null !== $format && $mimeType = $request->getMimeType($format)) { +$headers->set('Content-Type', $mimeType); +} +} +$charset = $this->charset ?:'UTF-8'; +if (!$headers->has('Content-Type')) { +$headers->set('Content-Type','text/html; charset='.$charset); +} elseif (0 === stripos($headers->get('Content-Type'),'text/') && false === stripos($headers->get('Content-Type'),'charset')) { +$headers->set('Content-Type', $headers->get('Content-Type').'; charset='.$charset); +} +if ($headers->has('Transfer-Encoding')) { +$headers->remove('Content-Length'); +} +if ($request->isMethod('HEAD')) { +$length = $headers->get('Content-Length'); +$this->setContent(null); +if ($length) { +$headers->set('Content-Length', $length); +} +} +if ('HTTP/1.0'!= $request->server->get('SERVER_PROTOCOL')) { +$this->setProtocolVersion('1.1'); +} +if ('1.0'== $this->getProtocolVersion() &&'no-cache'== $this->headers->get('Cache-Control')) { +$this->headers->set('pragma','no-cache'); +$this->headers->set('expires', -1); +} +$this->ensureIEOverSSLCompatibility($request); +return $this; +} +public function sendHeaders() +{ +if (headers_sent()) { +return $this; +} +header(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText), true, $this->statusCode); +foreach ($this->headers->allPreserveCase() as $name => $values) { +foreach ($values as $value) { +header($name.': '.$value, false, $this->statusCode); +} +} +foreach ($this->headers->getCookies() as $cookie) { +setcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly()); +} +return $this; +} +public function sendContent() +{ +echo $this->content; +return $this; +} +public function send() +{ +$this->sendHeaders(); +$this->sendContent(); +if (function_exists('fastcgi_finish_request')) { +fastcgi_finish_request(); +} elseif ('cli'!== PHP_SAPI) { +$previous = null; +$obStatus = ob_get_status(1); +while (($level = ob_get_level()) > 0 && $level !== $previous) { +$previous = $level; +if ($obStatus[$level - 1]) { +if (version_compare(PHP_VERSION,'5.4','>=')) { +if (isset($obStatus[$level - 1]['flags']) && ($obStatus[$level - 1]['flags'] & PHP_OUTPUT_HANDLER_REMOVABLE)) { +ob_end_flush(); +} +} else { +if (isset($obStatus[$level - 1]['del']) && $obStatus[$level - 1]['del']) { +ob_end_flush(); +} +} +} +} +flush(); +} +return $this; +} +public function setContent($content) +{ +if (null !== $content && !is_string($content) && !is_numeric($content) && !is_callable(array($content,'__toString'))) { +throw new \UnexpectedValueException(sprintf('The Response content must be a string or object implementing __toString(), "%s" given.', gettype($content))); +} +$this->content = (string) $content; +return $this; +} +public function getContent() +{ +return $this->content; +} +public function setProtocolVersion($version) +{ +$this->version = $version; +return $this; +} +public function getProtocolVersion() +{ +return $this->version; +} +public function setStatusCode($code, $text = null) +{ +$this->statusCode = $code = (int) $code; +if ($this->isInvalid()) { +throw new \InvalidArgumentException(sprintf('The HTTP status code "%s" is not valid.', $code)); +} +if (null === $text) { +$this->statusText = isset(self::$statusTexts[$code]) ? self::$statusTexts[$code] :''; +return $this; +} +if (false === $text) { +$this->statusText =''; +return $this; +} +$this->statusText = $text; +return $this; +} +public function getStatusCode() +{ +return $this->statusCode; +} +public function setCharset($charset) +{ +$this->charset = $charset; +return $this; +} +public function getCharset() +{ +return $this->charset; +} +public function isCacheable() +{ +if (!in_array($this->statusCode, array(200, 203, 300, 301, 302, 404, 410))) { +return false; +} +if ($this->headers->hasCacheControlDirective('no-store') || $this->headers->getCacheControlDirective('private')) { +return false; +} +return $this->isValidateable() || $this->isFresh(); +} +public function isFresh() +{ +return $this->getTtl() > 0; +} +public function isValidateable() +{ +return $this->headers->has('Last-Modified') || $this->headers->has('ETag'); +} +public function setPrivate() +{ +$this->headers->removeCacheControlDirective('public'); +$this->headers->addCacheControlDirective('private'); +return $this; +} +public function setPublic() +{ +$this->headers->addCacheControlDirective('public'); +$this->headers->removeCacheControlDirective('private'); +return $this; +} +public function mustRevalidate() +{ +return $this->headers->hasCacheControlDirective('must-revalidate') || $this->headers->has('proxy-revalidate'); +} +public function getDate() +{ +return $this->headers->getDate('Date', new \DateTime()); +} +public function setDate(\DateTime $date) +{ +$date->setTimezone(new \DateTimeZone('UTC')); +$this->headers->set('Date', $date->format('D, d M Y H:i:s').' GMT'); +return $this; +} +public function getAge() +{ +if (null !== $age = $this->headers->get('Age')) { +return (int) $age; +} +return max(time() - $this->getDate()->format('U'), 0); +} +public function expire() +{ +if ($this->isFresh()) { +$this->headers->set('Age', $this->getMaxAge()); +} +return $this; +} +public function getExpires() +{ +try { +return $this->headers->getDate('Expires'); +} catch (\RuntimeException $e) { +return \DateTime::createFromFormat(DATE_RFC2822,'Sat, 01 Jan 00 00:00:00 +0000'); +} +} +public function setExpires(\DateTime $date = null) +{ +if (null === $date) { +$this->headers->remove('Expires'); +} else { +$date = clone $date; +$date->setTimezone(new \DateTimeZone('UTC')); +$this->headers->set('Expires', $date->format('D, d M Y H:i:s').' GMT'); +} +return $this; +} +public function getMaxAge() +{ +if ($this->headers->hasCacheControlDirective('s-maxage')) { +return (int) $this->headers->getCacheControlDirective('s-maxage'); +} +if ($this->headers->hasCacheControlDirective('max-age')) { +return (int) $this->headers->getCacheControlDirective('max-age'); +} +if (null !== $this->getExpires()) { +return $this->getExpires()->format('U') - $this->getDate()->format('U'); +} +} +public function setMaxAge($value) +{ +$this->headers->addCacheControlDirective('max-age', $value); +return $this; +} +public function setSharedMaxAge($value) +{ +$this->setPublic(); +$this->headers->addCacheControlDirective('s-maxage', $value); +return $this; +} +public function getTtl() +{ +if (null !== $maxAge = $this->getMaxAge()) { +return $maxAge - $this->getAge(); +} +} +public function setTtl($seconds) +{ +$this->setSharedMaxAge($this->getAge() + $seconds); +return $this; +} +public function setClientTtl($seconds) +{ +$this->setMaxAge($this->getAge() + $seconds); +return $this; +} +public function getLastModified() +{ +return $this->headers->getDate('Last-Modified'); +} +public function setLastModified(\DateTime $date = null) +{ +if (null === $date) { +$this->headers->remove('Last-Modified'); +} else { +$date = clone $date; +$date->setTimezone(new \DateTimeZone('UTC')); +$this->headers->set('Last-Modified', $date->format('D, d M Y H:i:s').' GMT'); +} +return $this; +} +public function getEtag() +{ +return $this->headers->get('ETag'); +} +public function setEtag($etag = null, $weak = false) +{ +if (null === $etag) { +$this->headers->remove('Etag'); +} else { +if (0 !== strpos($etag,'"')) { +$etag ='"'.$etag.'"'; +} +$this->headers->set('ETag', (true === $weak ?'W/':'').$etag); +} +return $this; +} +public function setCache(array $options) +{ +if ($diff = array_diff(array_keys($options), array('etag','last_modified','max_age','s_maxage','private','public'))) { +throw new \InvalidArgumentException(sprintf('Response does not support the following options: "%s".', implode('", "', array_values($diff)))); +} +if (isset($options['etag'])) { +$this->setEtag($options['etag']); +} +if (isset($options['last_modified'])) { +$this->setLastModified($options['last_modified']); +} +if (isset($options['max_age'])) { +$this->setMaxAge($options['max_age']); +} +if (isset($options['s_maxage'])) { +$this->setSharedMaxAge($options['s_maxage']); +} +if (isset($options['public'])) { +if ($options['public']) { +$this->setPublic(); +} else { +$this->setPrivate(); +} +} +if (isset($options['private'])) { +if ($options['private']) { +$this->setPrivate(); +} else { +$this->setPublic(); +} +} +return $this; +} +public function setNotModified() +{ +$this->setStatusCode(304); +$this->setContent(null); +foreach (array('Allow','Content-Encoding','Content-Language','Content-Length','Content-MD5','Content-Type','Last-Modified') as $header) { +$this->headers->remove($header); +} +return $this; +} +public function hasVary() +{ +return null !== $this->headers->get('Vary'); +} +public function getVary() +{ +if (!$vary = $this->headers->get('Vary', null, false)) { +return array(); +} +$ret = array(); +foreach ($vary as $item) { +$ret = array_merge($ret, preg_split('/[\s,]+/', $item)); +} +return $ret; +} +public function setVary($headers, $replace = true) +{ +$this->headers->set('Vary', $headers, $replace); +return $this; +} +public function isNotModified(Request $request) +{ +if (!$request->isMethodSafe()) { +return false; +} +$lastModified = $request->headers->get('If-Modified-Since'); +$notModified = false; +if ($etags = $request->getEtags()) { +$notModified = (in_array($this->getEtag(), $etags) || in_array('*', $etags)) && (!$lastModified || $this->headers->get('Last-Modified') == $lastModified); +} elseif ($lastModified) { +$notModified = $lastModified == $this->headers->get('Last-Modified'); +} +if ($notModified) { +$this->setNotModified(); +} +return $notModified; +} +public function isInvalid() +{ +return $this->statusCode < 100 || $this->statusCode >= 600; +} +public function isInformational() +{ +return $this->statusCode >= 100 && $this->statusCode < 200; +} +public function isSuccessful() +{ +return $this->statusCode >= 200 && $this->statusCode < 300; +} +public function isRedirection() +{ +return $this->statusCode >= 300 && $this->statusCode < 400; +} +public function isClientError() +{ +return $this->statusCode >= 400 && $this->statusCode < 500; +} +public function isServerError() +{ +return $this->statusCode >= 500 && $this->statusCode < 600; +} +public function isOk() +{ +return 200 === $this->statusCode; +} +public function isForbidden() +{ +return 403 === $this->statusCode; +} +public function isNotFound() +{ +return 404 === $this->statusCode; +} +public function isRedirect($location = null) +{ +return in_array($this->statusCode, array(201, 301, 302, 303, 307, 308)) && (null === $location ?: $location == $this->headers->get('Location')); +} +public function isEmpty() +{ +return in_array($this->statusCode, array(204, 304)); +} +protected function ensureIEOverSSLCompatibility(Request $request) +{ +if (false !== stripos($this->headers->get('Content-Disposition'),'attachment') && preg_match('/MSIE (.*?);/i', $request->server->get('HTTP_USER_AGENT'), $match) == 1 && true === $request->isSecure()) { +if (intval(preg_replace("/(MSIE )(.*?);/","$2", $match[0])) < 9) { +$this->headers->remove('Cache-Control'); +} +} +} +} +} +namespace Symfony\Component\HttpFoundation +{ +class ResponseHeaderBag extends HeaderBag +{ +const COOKIES_FLAT ='flat'; +const COOKIES_ARRAY ='array'; +const DISPOSITION_ATTACHMENT ='attachment'; +const DISPOSITION_INLINE ='inline'; +protected $computedCacheControl = array(); +protected $cookies = array(); +protected $headerNames = array(); +public function __construct(array $headers = array()) +{ +parent::__construct($headers); +if (!isset($this->headers['cache-control'])) { +$this->set('Cache-Control',''); +} +} +public function __toString() +{ +$cookies =''; +foreach ($this->getCookies() as $cookie) { +$cookies .='Set-Cookie: '.$cookie."\r\n"; +} +ksort($this->headerNames); +return parent::__toString().$cookies; +} +public function allPreserveCase() +{ +return array_combine($this->headerNames, $this->headers); +} +public function replace(array $headers = array()) +{ +$this->headerNames = array(); +parent::replace($headers); +if (!isset($this->headers['cache-control'])) { +$this->set('Cache-Control',''); +} +} +public function set($key, $values, $replace = true) +{ +parent::set($key, $values, $replace); +$uniqueKey = strtr(strtolower($key),'_','-'); +$this->headerNames[$uniqueKey] = $key; +if (in_array($uniqueKey, array('cache-control','etag','last-modified','expires'))) { +$computed = $this->computeCacheControlValue(); +$this->headers['cache-control'] = array($computed); +$this->headerNames['cache-control'] ='Cache-Control'; +$this->computedCacheControl = $this->parseCacheControl($computed); +} +} +public function remove($key) +{ +parent::remove($key); +$uniqueKey = strtr(strtolower($key),'_','-'); +unset($this->headerNames[$uniqueKey]); +if ('cache-control'=== $uniqueKey) { +$this->computedCacheControl = array(); +} +} +public function hasCacheControlDirective($key) +{ +return array_key_exists($key, $this->computedCacheControl); +} +public function getCacheControlDirective($key) +{ +return array_key_exists($key, $this->computedCacheControl) ? $this->computedCacheControl[$key] : null; +} +public function setCookie(Cookie $cookie) +{ +$this->cookies[$cookie->getDomain()][$cookie->getPath()][$cookie->getName()] = $cookie; +} +public function removeCookie($name, $path ='/', $domain = null) +{ +if (null === $path) { +$path ='/'; +} +unset($this->cookies[$domain][$path][$name]); +if (empty($this->cookies[$domain][$path])) { +unset($this->cookies[$domain][$path]); +if (empty($this->cookies[$domain])) { +unset($this->cookies[$domain]); +} +} +} +public function getCookies($format = self::COOKIES_FLAT) +{ +if (!in_array($format, array(self::COOKIES_FLAT, self::COOKIES_ARRAY))) { +throw new \InvalidArgumentException(sprintf('Format "%s" invalid (%s).', $format, implode(', ', array(self::COOKIES_FLAT, self::COOKIES_ARRAY)))); +} +if (self::COOKIES_ARRAY === $format) { +return $this->cookies; +} +$flattenedCookies = array(); +foreach ($this->cookies as $path) { +foreach ($path as $cookies) { +foreach ($cookies as $cookie) { +$flattenedCookies[] = $cookie; +} +} +} +return $flattenedCookies; +} +public function clearCookie($name, $path ='/', $domain = null) +{ +$this->setCookie(new Cookie($name, null, 1, $path, $domain)); +} +public function makeDisposition($disposition, $filename, $filenameFallback ='') +{ +if (!in_array($disposition, array(self::DISPOSITION_ATTACHMENT, self::DISPOSITION_INLINE))) { +throw new \InvalidArgumentException(sprintf('The disposition must be either "%s" or "%s".', self::DISPOSITION_ATTACHMENT, self::DISPOSITION_INLINE)); +} +if (''== $filenameFallback) { +$filenameFallback = $filename; +} +if (!preg_match('/^[\x20-\x7e]*$/', $filenameFallback)) { +throw new \InvalidArgumentException('The filename fallback must only contain ASCII characters.'); +} +if (false !== strpos($filenameFallback,'%')) { +throw new \InvalidArgumentException('The filename fallback cannot contain the "%" character.'); +} +if (false !== strpos($filename,'/') || false !== strpos($filename,'\\') || false !== strpos($filenameFallback,'/') || false !== strpos($filenameFallback,'\\')) { +throw new \InvalidArgumentException('The filename and the fallback cannot contain the "/" and "\\" characters.'); +} +$output = sprintf('%s; filename="%s"', $disposition, str_replace('"','\\"', $filenameFallback)); +if ($filename !== $filenameFallback) { +$output .= sprintf("; filename*=utf-8''%s", rawurlencode($filename)); +} +return $output; +} +protected function computeCacheControlValue() +{ +if (!$this->cacheControl && !$this->has('ETag') && !$this->has('Last-Modified') && !$this->has('Expires')) { +return'no-cache'; +} +if (!$this->cacheControl) { +return'private, must-revalidate'; +} +$header = $this->getCacheControlHeader(); +if (isset($this->cacheControl['public']) || isset($this->cacheControl['private'])) { +return $header; +} +if (!isset($this->cacheControl['s-maxage'])) { +return $header.', private'; +} +return $header; +} +} +} +namespace Symfony\Component\DependencyInjection +{ +interface ContainerAwareInterface +{ +public function setContainer(ContainerInterface $container = null); +} +} +namespace Symfony\Component\DependencyInjection +{ +use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; +use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; +use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; +interface ContainerInterface +{ +const EXCEPTION_ON_INVALID_REFERENCE = 1; +const NULL_ON_INVALID_REFERENCE = 2; +const IGNORE_ON_INVALID_REFERENCE = 3; +const SCOPE_CONTAINER ='container'; +const SCOPE_PROTOTYPE ='prototype'; +public function set($id, $service, $scope = self::SCOPE_CONTAINER); +public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE); +public function has($id); +public function getParameter($name); +public function hasParameter($name); +public function setParameter($name, $value); +public function enterScope($name); +public function leaveScope($name); +public function addScope(ScopeInterface $scope); +public function hasScope($name); +public function isScopeActive($name); +} +} +namespace Symfony\Component\DependencyInjection +{ +interface IntrospectableContainerInterface extends ContainerInterface +{ +public function initialized($id); +} +} +namespace Symfony\Component\DependencyInjection +{ +use Symfony\Component\DependencyInjection\Exception\InactiveScopeException; +use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; +use Symfony\Component\DependencyInjection\Exception\RuntimeException; +use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; +use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; +use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; +use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; +use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; +class Container implements IntrospectableContainerInterface +{ +protected $parameterBag; +protected $services = array(); +protected $methodMap = array(); +protected $aliases = array(); +protected $scopes = array(); +protected $scopeChildren = array(); +protected $scopedServices = array(); +protected $scopeStacks = array(); +protected $loading = array(); +public function __construct(ParameterBagInterface $parameterBag = null) +{ +$this->parameterBag = $parameterBag ?: new ParameterBag(); +$this->set('service_container', $this); +} +public function compile() +{ +$this->parameterBag->resolve(); +$this->parameterBag = new FrozenParameterBag($this->parameterBag->all()); +} +public function isFrozen() +{ +return $this->parameterBag instanceof FrozenParameterBag; +} +public function getParameterBag() +{ +return $this->parameterBag; +} +public function getParameter($name) +{ +return $this->parameterBag->get($name); +} +public function hasParameter($name) +{ +return $this->parameterBag->has($name); +} +public function setParameter($name, $value) +{ +$this->parameterBag->set($name, $value); +} +public function set($id, $service, $scope = self::SCOPE_CONTAINER) +{ +if (self::SCOPE_PROTOTYPE === $scope) { +throw new InvalidArgumentException(sprintf('You cannot set service "%s" of scope "prototype".', $id)); +} +$id = strtolower($id); +if (self::SCOPE_CONTAINER !== $scope) { +if (!isset($this->scopedServices[$scope])) { +throw new RuntimeException(sprintf('You cannot set service "%s" of inactive scope.', $id)); +} +$this->scopedServices[$scope][$id] = $service; +} +$this->services[$id] = $service; +if (method_exists($this, $method ='synchronize'.strtr($id, array('_'=>'','.'=>'_','\\'=>'_')).'Service')) { +$this->$method(); +} +if (self::SCOPE_CONTAINER !== $scope && null === $service) { +unset($this->scopedServices[$scope][$id]); +} +if (null === $service) { +unset($this->services[$id]); +} +} +public function has($id) +{ +$id = strtolower($id); +return isset($this->services[$id]) +|| array_key_exists($id, $this->services) +|| isset($this->aliases[$id]) +|| method_exists($this,'get'.strtr($id, array('_'=>'','.'=>'_','\\'=>'_')).'Service') +; +} +public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE) +{ +foreach (array(false, true) as $strtolower) { +if ($strtolower) { +$id = strtolower($id); +} +if (isset($this->aliases[$id])) { +$id = $this->aliases[$id]; +} +if (isset($this->services[$id]) || array_key_exists($id, $this->services)) { +return $this->services[$id]; +} +} +if (isset($this->loading[$id])) { +throw new ServiceCircularReferenceException($id, array_keys($this->loading)); +} +if (isset($this->methodMap[$id])) { +$method = $this->methodMap[$id]; +} elseif (method_exists($this, $method ='get'.strtr($id, array('_'=>'','.'=>'_','\\'=>'_')).'Service')) { +} else { +if (self::EXCEPTION_ON_INVALID_REFERENCE === $invalidBehavior) { +if (!$id) { +throw new ServiceNotFoundException($id); +} +$alternatives = array(); +foreach (array_keys($this->services) as $key) { +$lev = levenshtein($id, $key); +if ($lev <= strlen($id) / 3 || false !== strpos($key, $id)) { +$alternatives[] = $key; +} +} +throw new ServiceNotFoundException($id, null, null, $alternatives); +} +return; +} +$this->loading[$id] = true; +try { +$service = $this->$method(); +} catch (\Exception $e) { +unset($this->loading[$id]); +if (array_key_exists($id, $this->services)) { +unset($this->services[$id]); +} +if ($e instanceof InactiveScopeException && self::EXCEPTION_ON_INVALID_REFERENCE !== $invalidBehavior) { +return; +} +throw $e; +} +unset($this->loading[$id]); +return $service; +} +public function initialized($id) +{ +$id = strtolower($id); +return isset($this->services[$id]) || array_key_exists($id, $this->services); +} +public function getServiceIds() +{ +$ids = array(); +$r = new \ReflectionClass($this); +foreach ($r->getMethods() as $method) { +if (preg_match('/^get(.+)Service$/', $method->name, $match)) { +$ids[] = self::underscore($match[1]); +} +} +return array_unique(array_merge($ids, array_keys($this->services))); +} +public function enterScope($name) +{ +if (!isset($this->scopes[$name])) { +throw new InvalidArgumentException(sprintf('The scope "%s" does not exist.', $name)); +} +if (self::SCOPE_CONTAINER !== $this->scopes[$name] && !isset($this->scopedServices[$this->scopes[$name]])) { +throw new RuntimeException(sprintf('The parent scope "%s" must be active when entering this scope.', $this->scopes[$name])); +} +if (isset($this->scopedServices[$name])) { +$services = array($this->services, $name => $this->scopedServices[$name]); +unset($this->scopedServices[$name]); +foreach ($this->scopeChildren[$name] as $child) { +if (isset($this->scopedServices[$child])) { +$services[$child] = $this->scopedServices[$child]; +unset($this->scopedServices[$child]); +} +} +$this->services = call_user_func_array('array_diff_key', $services); +array_shift($services); +if (!isset($this->scopeStacks[$name])) { +$this->scopeStacks[$name] = new \SplStack(); +} +$this->scopeStacks[$name]->push($services); +} +$this->scopedServices[$name] = array(); +} +public function leaveScope($name) +{ +if (!isset($this->scopedServices[$name])) { +throw new InvalidArgumentException(sprintf('The scope "%s" is not active.', $name)); +} +$services = array($this->services, $this->scopedServices[$name]); +unset($this->scopedServices[$name]); +foreach ($this->scopeChildren[$name] as $child) { +if (!isset($this->scopedServices[$child])) { +continue; +} +$services[] = $this->scopedServices[$child]; +unset($this->scopedServices[$child]); +} +$this->services = call_user_func_array('array_diff_key', $services); +if (isset($this->scopeStacks[$name]) && count($this->scopeStacks[$name]) > 0) { +$services = $this->scopeStacks[$name]->pop(); +$this->scopedServices += $services; +foreach ($services as $array) { +foreach ($array as $id => $service) { +$this->set($id, $service, $name); +} +} +} +} +public function addScope(ScopeInterface $scope) +{ +$name = $scope->getName(); +$parentScope = $scope->getParentName(); +if (self::SCOPE_CONTAINER === $name || self::SCOPE_PROTOTYPE === $name) { +throw new InvalidArgumentException(sprintf('The scope "%s" is reserved.', $name)); +} +if (isset($this->scopes[$name])) { +throw new InvalidArgumentException(sprintf('A scope with name "%s" already exists.', $name)); +} +if (self::SCOPE_CONTAINER !== $parentScope && !isset($this->scopes[$parentScope])) { +throw new InvalidArgumentException(sprintf('The parent scope "%s" does not exist, or is invalid.', $parentScope)); +} +$this->scopes[$name] = $parentScope; +$this->scopeChildren[$name] = array(); +while ($parentScope !== self::SCOPE_CONTAINER) { +$this->scopeChildren[$parentScope][] = $name; +$parentScope = $this->scopes[$parentScope]; +} +} +public function hasScope($name) +{ +return isset($this->scopes[$name]); +} +public function isScopeActive($name) +{ +return isset($this->scopedServices[$name]); +} +public static function camelize($id) +{ +return strtr(ucwords(strtr($id, array('_'=>' ','.'=>'_ ','\\'=>'_ '))), array(' '=>'')); +} +public static function underscore($id) +{ +return strtolower(preg_replace(array('/([A-Z]+)([A-Z][a-z])/','/([a-z\d])([A-Z])/'), array('\\1_\\2','\\1_\\2'), strtr($id,'_','.'))); +} +} +} +namespace Symfony\Component\HttpKernel +{ +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +interface HttpKernelInterface +{ +const MASTER_REQUEST = 1; +const SUB_REQUEST = 2; +public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true); +} +} +namespace Symfony\Component\HttpKernel +{ +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\HttpKernel\Bundle\BundleInterface; +use Symfony\Component\Config\Loader\LoaderInterface; +interface KernelInterface extends HttpKernelInterface, \Serializable +{ +public function registerBundles(); +public function registerContainerConfiguration(LoaderInterface $loader); +public function boot(); +public function shutdown(); +public function getBundles(); +public function isClassInActiveBundle($class); +public function getBundle($name, $first = true); +public function locateResource($name, $dir = null, $first = true); +public function getName(); +public function getEnvironment(); +public function isDebug(); +public function getRootDir(); +public function getContainer(); +public function getStartTime(); +public function getCacheDir(); +public function getLogDir(); +public function getCharset(); +} +} +namespace Symfony\Component\HttpKernel +{ +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +interface TerminableInterface +{ +public function terminate(Request $request, Response $response); +} +} +namespace Symfony\Component\HttpKernel +{ +use Symfony\Bridge\ProxyManager\LazyProxy\Instantiator\RuntimeInstantiator; +use Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper; +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Dumper\PhpDumper; +use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; +use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; +use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; +use Symfony\Component\DependencyInjection\Loader\IniFileLoader; +use Symfony\Component\DependencyInjection\Loader\PhpFileLoader; +use Symfony\Component\DependencyInjection\Loader\ClosureLoader; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Bundle\BundleInterface; +use Symfony\Component\HttpKernel\Config\FileLocator; +use Symfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass; +use Symfony\Component\HttpKernel\DependencyInjection\AddClassesToCachePass; +use Symfony\Component\Config\Loader\LoaderResolver; +use Symfony\Component\Config\Loader\DelegatingLoader; +use Symfony\Component\Config\ConfigCache; +use Symfony\Component\ClassLoader\ClassCollectionLoader; +abstract class Kernel implements KernelInterface, TerminableInterface +{ +protected $bundles = array(); +protected $bundleMap; +protected $container; +protected $rootDir; +protected $environment; +protected $debug; +protected $booted = false; +protected $name; +protected $startTime; +protected $loadClassCache; +const VERSION ='2.4.4'; +const VERSION_ID ='20404'; +const MAJOR_VERSION ='2'; +const MINOR_VERSION ='4'; +const RELEASE_VERSION ='4'; +const EXTRA_VERSION =''; +public function __construct($environment, $debug) +{ +$this->environment = $environment; +$this->debug = (bool) $debug; +$this->rootDir = $this->getRootDir(); +$this->name = $this->getName(); +if ($this->debug) { +$this->startTime = microtime(true); +} +$this->init(); +} +public function init() +{ +} +public function __clone() +{ +if ($this->debug) { +$this->startTime = microtime(true); +} +$this->booted = false; +$this->container = null; +} +public function boot() +{ +if (true === $this->booted) { +return; +} +if ($this->loadClassCache) { +$this->doLoadClassCache($this->loadClassCache[0], $this->loadClassCache[1]); +} +$this->initializeBundles(); +$this->initializeContainer(); +foreach ($this->getBundles() as $bundle) { +$bundle->setContainer($this->container); +$bundle->boot(); +} +$this->booted = true; +} +public function terminate(Request $request, Response $response) +{ +if (false === $this->booted) { +return; +} +if ($this->getHttpKernel() instanceof TerminableInterface) { +$this->getHttpKernel()->terminate($request, $response); +} +} +public function shutdown() +{ +if (false === $this->booted) { +return; +} +$this->booted = false; +foreach ($this->getBundles() as $bundle) { +$bundle->shutdown(); +$bundle->setContainer(null); +} +$this->container = null; +} +public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true) +{ +if (false === $this->booted) { +$this->boot(); +} +return $this->getHttpKernel()->handle($request, $type, $catch); +} +protected function getHttpKernel() +{ +return $this->container->get('http_kernel'); +} +public function getBundles() +{ +return $this->bundles; +} +public function isClassInActiveBundle($class) +{ +foreach ($this->getBundles() as $bundle) { +if (0 === strpos($class, $bundle->getNamespace())) { +return true; +} +} +return false; +} +public function getBundle($name, $first = true) +{ +if (!isset($this->bundleMap[$name])) { +throw new \InvalidArgumentException(sprintf('Bundle "%s" does not exist or it is not enabled. Maybe you forgot to add it in the registerBundles() method of your %s.php file?', $name, get_class($this))); +} +if (true === $first) { +return $this->bundleMap[$name][0]; +} +return $this->bundleMap[$name]; +} +public function locateResource($name, $dir = null, $first = true) +{ +if ('@'!== $name[0]) { +throw new \InvalidArgumentException(sprintf('A resource name must start with @ ("%s" given).', $name)); +} +if (false !== strpos($name,'..')) { +throw new \RuntimeException(sprintf('File name "%s" contains invalid characters (..).', $name)); +} +$bundleName = substr($name, 1); +$path =''; +if (false !== strpos($bundleName,'/')) { +list($bundleName, $path) = explode('/', $bundleName, 2); +} +$isResource = 0 === strpos($path,'Resources') && null !== $dir; +$overridePath = substr($path, 9); +$resourceBundle = null; +$bundles = $this->getBundle($bundleName, false); +$files = array(); +foreach ($bundles as $bundle) { +if ($isResource && file_exists($file = $dir.'/'.$bundle->getName().$overridePath)) { +if (null !== $resourceBundle) { +throw new \RuntimeException(sprintf('"%s" resource is hidden by a resource from the "%s" derived bundle. Create a "%s" file to override the bundle resource.', +$file, +$resourceBundle, +$dir.'/'.$bundles[0]->getName().$overridePath +)); +} +if ($first) { +return $file; +} +$files[] = $file; +} +if (file_exists($file = $bundle->getPath().'/'.$path)) { +if ($first && !$isResource) { +return $file; +} +$files[] = $file; +$resourceBundle = $bundle->getName(); +} +} +if (count($files) > 0) { +return $first && $isResource ? $files[0] : $files; +} +throw new \InvalidArgumentException(sprintf('Unable to find file "%s".', $name)); +} +public function getName() +{ +if (null === $this->name) { +$this->name = preg_replace('/[^a-zA-Z0-9_]+/','', basename($this->rootDir)); +} +return $this->name; +} +public function getEnvironment() +{ +return $this->environment; +} +public function isDebug() +{ +return $this->debug; +} +public function getRootDir() +{ +if (null === $this->rootDir) { +$r = new \ReflectionObject($this); +$this->rootDir = str_replace('\\','/', dirname($r->getFileName())); +} +return $this->rootDir; +} +public function getContainer() +{ +return $this->container; +} +public function loadClassCache($name ='classes', $extension ='.php') +{ +$this->loadClassCache = array($name, $extension); +} +public function setClassCache(array $classes) +{ +file_put_contents($this->getCacheDir().'/classes.map', sprintf('debug ? $this->startTime : -INF; +} +public function getCacheDir() +{ +return $this->rootDir.'/cache/'.$this->environment; +} +public function getLogDir() +{ +return $this->rootDir.'/logs'; +} +public function getCharset() +{ +return'UTF-8'; +} +protected function doLoadClassCache($name, $extension) +{ +if (!$this->booted && is_file($this->getCacheDir().'/classes.map')) { +ClassCollectionLoader::load(include($this->getCacheDir().'/classes.map'), $this->getCacheDir(), $name, $this->debug, false, $extension); +} +} +protected function initializeBundles() +{ +$this->bundles = array(); +$topMostBundles = array(); +$directChildren = array(); +foreach ($this->registerBundles() as $bundle) { +$name = $bundle->getName(); +if (isset($this->bundles[$name])) { +throw new \LogicException(sprintf('Trying to register two bundles with the same name "%s"', $name)); +} +$this->bundles[$name] = $bundle; +if ($parentName = $bundle->getParent()) { +if (isset($directChildren[$parentName])) { +throw new \LogicException(sprintf('Bundle "%s" is directly extended by two bundles "%s" and "%s".', $parentName, $name, $directChildren[$parentName])); +} +if ($parentName == $name) { +throw new \LogicException(sprintf('Bundle "%s" can not extend itself.', $name)); +} +$directChildren[$parentName] = $name; +} else { +$topMostBundles[$name] = $bundle; +} +} +if (!empty($directChildren) && count($diff = array_diff_key($directChildren, $this->bundles))) { +$diff = array_keys($diff); +throw new \LogicException(sprintf('Bundle "%s" extends bundle "%s", which is not registered.', $directChildren[$diff[0]], $diff[0])); +} +$this->bundleMap = array(); +foreach ($topMostBundles as $name => $bundle) { +$bundleMap = array($bundle); +$hierarchy = array($name); +while (isset($directChildren[$name])) { +$name = $directChildren[$name]; +array_unshift($bundleMap, $this->bundles[$name]); +$hierarchy[] = $name; +} +foreach ($hierarchy as $bundle) { +$this->bundleMap[$bundle] = $bundleMap; +array_pop($bundleMap); +} +} +} +protected function getContainerClass() +{ +return $this->name.ucfirst($this->environment).($this->debug ?'Debug':'').'ProjectContainer'; +} +protected function getContainerBaseClass() +{ +return'Container'; +} +protected function initializeContainer() +{ +$class = $this->getContainerClass(); +$cache = new ConfigCache($this->getCacheDir().'/'.$class.'.php', $this->debug); +$fresh = true; +if (!$cache->isFresh()) { +$container = $this->buildContainer(); +$container->compile(); +$this->dumpContainer($cache, $container, $class, $this->getContainerBaseClass()); +$fresh = false; +} +require_once $cache; +$this->container = new $class(); +$this->container->set('kernel', $this); +if (!$fresh && $this->container->has('cache_warmer')) { +$this->container->get('cache_warmer')->warmUp($this->container->getParameter('kernel.cache_dir')); +} +} +protected function getKernelParameters() +{ +$bundles = array(); +foreach ($this->bundles as $name => $bundle) { +$bundles[$name] = get_class($bundle); +} +return array_merge( +array('kernel.root_dir'=> $this->rootDir,'kernel.environment'=> $this->environment,'kernel.debug'=> $this->debug,'kernel.name'=> $this->name,'kernel.cache_dir'=> $this->getCacheDir(),'kernel.logs_dir'=> $this->getLogDir(),'kernel.bundles'=> $bundles,'kernel.charset'=> $this->getCharset(),'kernel.container_class'=> $this->getContainerClass(), +), +$this->getEnvParameters() +); +} +protected function getEnvParameters() +{ +$parameters = array(); +foreach ($_SERVER as $key => $value) { +if (0 === strpos($key,'SYMFONY__')) { +$parameters[strtolower(str_replace('__','.', substr($key, 9)))] = $value; +} +} +return $parameters; +} +protected function buildContainer() +{ +foreach (array('cache'=> $this->getCacheDir(),'logs'=> $this->getLogDir()) as $name => $dir) { +if (!is_dir($dir)) { +if (false === @mkdir($dir, 0777, true)) { +throw new \RuntimeException(sprintf("Unable to create the %s directory (%s)\n", $name, $dir)); +} +} elseif (!is_writable($dir)) { +throw new \RuntimeException(sprintf("Unable to write in the %s directory (%s)\n", $name, $dir)); +} +} +$container = $this->getContainerBuilder(); +$container->addObjectResource($this); +$this->prepareContainer($container); +if (null !== $cont = $this->registerContainerConfiguration($this->getContainerLoader($container))) { +$container->merge($cont); +} +$container->addCompilerPass(new AddClassesToCachePass($this)); +return $container; +} +protected function prepareContainer(ContainerBuilder $container) +{ +$extensions = array(); +foreach ($this->bundles as $bundle) { +if ($extension = $bundle->getContainerExtension()) { +$container->registerExtension($extension); +$extensions[] = $extension->getAlias(); +} +if ($this->debug) { +$container->addObjectResource($bundle); +} +} +foreach ($this->bundles as $bundle) { +$bundle->build($container); +} +$container->getCompilerPassConfig()->setMergePass(new MergeExtensionConfigurationPass($extensions)); +} +protected function getContainerBuilder() +{ +$container = new ContainerBuilder(new ParameterBag($this->getKernelParameters())); +if (class_exists('ProxyManager\Configuration')) { +$container->setProxyInstantiator(new RuntimeInstantiator()); +} +return $container; +} +protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container, $class, $baseClass) +{ +$dumper = new PhpDumper($container); +if (class_exists('ProxyManager\Configuration')) { +$dumper->setProxyDumper(new ProxyDumper()); +} +$content = $dumper->dump(array('class'=> $class,'base_class'=> $baseClass)); +if (!$this->debug) { +$content = static::stripComments($content); +} +$cache->write($content, $container->getResources()); +} +protected function getContainerLoader(ContainerInterface $container) +{ +$locator = new FileLocator($this); +$resolver = new LoaderResolver(array( +new XmlFileLoader($container, $locator), +new YamlFileLoader($container, $locator), +new IniFileLoader($container, $locator), +new PhpFileLoader($container, $locator), +new ClosureLoader($container), +)); +return new DelegatingLoader($resolver); +} +public static function stripComments($source) +{ +if (!function_exists('token_get_all')) { +return $source; +} +$rawChunk =''; +$output =''; +$tokens = token_get_all($source); +$ignoreSpace = false; +for (reset($tokens); false !== $token = current($tokens); next($tokens)) { +if (is_string($token)) { +$rawChunk .= $token; +} elseif (T_START_HEREDOC === $token[0]) { +$output .= $rawChunk.$token[1]; +do { +$token = next($tokens); +$output .= $token[1]; +} while ($token[0] !== T_END_HEREDOC); +$rawChunk =''; +} elseif (T_WHITESPACE === $token[0]) { +if ($ignoreSpace) { +$ignoreSpace = false; +continue; +} +$rawChunk .= preg_replace(array('/\n{2,}/S'),"\n", $token[1]); +} elseif (in_array($token[0], array(T_COMMENT, T_DOC_COMMENT))) { +$ignoreSpace = true; +} else { +$rawChunk .= $token[1]; +if (T_OPEN_TAG === $token[0]) { +$ignoreSpace = true; +} +} +} +$output .= $rawChunk; +return $output; +} +public function serialize() +{ +return serialize(array($this->environment, $this->debug)); +} +public function unserialize($data) +{ +list($environment, $debug) = unserialize($data); +$this->__construct($environment, $debug); +} +} +} +namespace Symfony\Component\ClassLoader +{ +class ApcClassLoader +{ +private $prefix; +protected $decorated; +public function __construct($prefix, $decorated) +{ +if (!extension_loaded('apc')) { +throw new \RuntimeException('Unable to use ApcClassLoader as APC is not enabled.'); +} +if (!method_exists($decorated,'findFile')) { +throw new \InvalidArgumentException('The class finder must implement a "findFile" method.'); +} +$this->prefix = $prefix; +$this->decorated = $decorated; +} +public function register($prepend = false) +{ +spl_autoload_register(array($this,'loadClass'), true, $prepend); +} +public function unregister() +{ +spl_autoload_unregister(array($this,'loadClass')); +} +public function loadClass($class) +{ +if ($file = $this->findFile($class)) { +require $file; +return true; +} +} +public function findFile($class) +{ +if (false === $file = apc_fetch($this->prefix.$class)) { +apc_store($this->prefix.$class, $file = $this->decorated->findFile($class)); +} +return $file; +} +public function __call($method, $args) +{ +return call_user_func_array(array($this->decorated, $method), $args); +} +} +} +namespace Symfony\Component\HttpKernel\Bundle +{ +use Symfony\Component\DependencyInjection\ContainerAwareInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; +interface BundleInterface extends ContainerAwareInterface +{ +public function boot(); +public function shutdown(); +public function build(ContainerBuilder $container); +public function getContainerExtension(); +public function getParent(); +public function getName(); +public function getNamespace(); +public function getPath(); +} +} +namespace Symfony\Component\DependencyInjection +{ +abstract class ContainerAware implements ContainerAwareInterface +{ +protected $container; +public function setContainer(ContainerInterface $container = null) +{ +$this->container = $container; +} +} +} +namespace Symfony\Component\HttpKernel\Bundle +{ +use Symfony\Component\DependencyInjection\ContainerAware; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Container; +use Symfony\Component\Console\Application; +use Symfony\Component\Finder\Finder; +use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; +abstract class Bundle extends ContainerAware implements BundleInterface +{ +protected $name; +protected $extension; +protected $path; +public function boot() +{ +} +public function shutdown() +{ +} +public function build(ContainerBuilder $container) +{ +} +public function getContainerExtension() +{ +if (null === $this->extension) { +$basename = preg_replace('/Bundle$/','', $this->getName()); +$class = $this->getNamespace().'\\DependencyInjection\\'.$basename.'Extension'; +if (class_exists($class)) { +$extension = new $class(); +$expectedAlias = Container::underscore($basename); +if ($expectedAlias != $extension->getAlias()) { +throw new \LogicException(sprintf('The extension alias for the default extension of a '.'bundle must be the underscored version of the '.'bundle name ("%s" instead of "%s")', +$expectedAlias, $extension->getAlias() +)); +} +$this->extension = $extension; +} else { +$this->extension = false; +} +} +if ($this->extension) { +return $this->extension; +} +} +public function getNamespace() +{ +$class = get_class($this); +return substr($class, 0, strrpos($class,'\\')); +} +public function getPath() +{ +if (null === $this->path) { +$reflected = new \ReflectionObject($this); +$this->path = dirname($reflected->getFileName()); +} +return $this->path; +} +public function getParent() +{ +} +final public function getName() +{ +if (null !== $this->name) { +return $this->name; +} +$name = get_class($this); +$pos = strrpos($name,'\\'); +return $this->name = false === $pos ? $name : substr($name, $pos + 1); +} +public function registerCommands(Application $application) +{ +if (!is_dir($dir = $this->getPath().'/Command')) { +return; +} +$finder = new Finder(); +$finder->files()->name('*Command.php')->in($dir); +$prefix = $this->getNamespace().'\\Command'; +foreach ($finder as $file) { +$ns = $prefix; +if ($relativePath = $file->getRelativePath()) { +$ns .='\\'.strtr($relativePath,'/','\\'); +} +$class = $ns.'\\'.$file->getBasename('.php'); +if ($this->container) { +$alias ='console.command.'.strtolower(str_replace('\\','_', $class)); +if ($this->container->has($alias)) { +continue; +} +} +$r = new \ReflectionClass($class); +if ($r->isSubclassOf('Symfony\\Component\\Console\\Command\\Command') && !$r->isAbstract() && !$r->getConstructor()->getNumberOfRequiredParameters()) { +$application->add($r->newInstance()); +} +} +} +} +} +namespace Symfony\Component\Config +{ +use Symfony\Component\Config\Resource\ResourceInterface; +use Symfony\Component\Filesystem\Filesystem; +class ConfigCache +{ +private $debug; +private $file; +public function __construct($file, $debug) +{ +$this->file = $file; +$this->debug = (bool) $debug; +} +public function __toString() +{ +return $this->file; +} +public function isFresh() +{ +if (!is_file($this->file)) { +return false; +} +if (!$this->debug) { +return true; +} +$metadata = $this->getMetaFile(); +if (!is_file($metadata)) { +return false; +} +$time = filemtime($this->file); +$meta = unserialize(file_get_contents($metadata)); +foreach ($meta as $resource) { +if (!$resource->isFresh($time)) { +return false; +} +} +return true; +} +public function write($content, array $metadata = null) +{ +$mode = 0666 & ~umask(); +$filesystem = new Filesystem(); +$filesystem->dumpFile($this->file, $content, null); +@chmod($this->file, $mode); +if (null !== $metadata && true === $this->debug) { +$filesystem->dumpFile($this->getMetaFile(), serialize($metadata), null); +@chmod($this->getMetaFile(), $mode); +} +} +private function getMetaFile() +{ +return $this->file.'.meta'; +} +} +} +namespace Symfony\Component\HttpKernel +{ +use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface; +use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; +use Symfony\Component\HttpKernel\Event\FilterControllerEvent; +use Symfony\Component\HttpKernel\Event\FilterResponseEvent; +use Symfony\Component\HttpKernel\Event\FinishRequestEvent; +use Symfony\Component\HttpKernel\Event\GetResponseEvent; +use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent; +use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; +use Symfony\Component\HttpKernel\Event\PostResponseEvent; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\RequestStack; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; +class HttpKernel implements HttpKernelInterface, TerminableInterface +{ +protected $dispatcher; +protected $resolver; +protected $requestStack; +public function __construct(EventDispatcherInterface $dispatcher, ControllerResolverInterface $resolver, RequestStack $requestStack = null) +{ +$this->dispatcher = $dispatcher; +$this->resolver = $resolver; +$this->requestStack = $requestStack ?: new RequestStack(); +} +public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true) +{ +try { +return $this->handleRaw($request, $type); +} catch (\Exception $e) { +if (false === $catch) { +$this->finishRequest($request, $type); +throw $e; +} +return $this->handleException($e, $request, $type); +} +} +public function terminate(Request $request, Response $response) +{ +$this->dispatcher->dispatch(KernelEvents::TERMINATE, new PostResponseEvent($this, $request, $response)); +} +private function handleRaw(Request $request, $type = self::MASTER_REQUEST) +{ +$this->requestStack->push($request); +$event = new GetResponseEvent($this, $request, $type); +$this->dispatcher->dispatch(KernelEvents::REQUEST, $event); +if ($event->hasResponse()) { +return $this->filterResponse($event->getResponse(), $request, $type); +} +if (false === $controller = $this->resolver->getController($request)) { +throw new NotFoundHttpException(sprintf('Unable to find the controller for path "%s". Maybe you forgot to add the matching route in your routing configuration?', $request->getPathInfo())); +} +$event = new FilterControllerEvent($this, $controller, $request, $type); +$this->dispatcher->dispatch(KernelEvents::CONTROLLER, $event); +$controller = $event->getController(); +$arguments = $this->resolver->getArguments($request, $controller); +$response = call_user_func_array($controller, $arguments); +if (!$response instanceof Response) { +$event = new GetResponseForControllerResultEvent($this, $request, $type, $response); +$this->dispatcher->dispatch(KernelEvents::VIEW, $event); +if ($event->hasResponse()) { +$response = $event->getResponse(); +} +if (!$response instanceof Response) { +$msg = sprintf('The controller must return a response (%s given).', $this->varToString($response)); +if (null === $response) { +$msg .=' Did you forget to add a return statement somewhere in your controller?'; +} +throw new \LogicException($msg); +} +} +return $this->filterResponse($response, $request, $type); +} +private function filterResponse(Response $response, Request $request, $type) +{ +$event = new FilterResponseEvent($this, $request, $type, $response); +$this->dispatcher->dispatch(KernelEvents::RESPONSE, $event); +$this->finishRequest($request, $type); +return $event->getResponse(); +} +private function finishRequest(Request $request, $type) +{ +$this->dispatcher->dispatch(KernelEvents::FINISH_REQUEST, new FinishRequestEvent($this, $request, $type)); +$this->requestStack->pop(); +} +private function handleException(\Exception $e, $request, $type) +{ +$event = new GetResponseForExceptionEvent($this, $request, $type, $e); +$this->dispatcher->dispatch(KernelEvents::EXCEPTION, $event); +$e = $event->getException(); +if (!$event->hasResponse()) { +$this->finishRequest($request, $type); +throw $e; +} +$response = $event->getResponse(); +if ($response->headers->has('X-Status-Code')) { +$response->setStatusCode($response->headers->get('X-Status-Code')); +$response->headers->remove('X-Status-Code'); +} elseif (!$response->isClientError() && !$response->isServerError() && !$response->isRedirect()) { +if ($e instanceof HttpExceptionInterface) { +$response->setStatusCode($e->getStatusCode()); +$response->headers->add($e->getHeaders()); +} else { +$response->setStatusCode(500); +} +} +try { +return $this->filterResponse($response, $request, $type); +} catch (\Exception $e) { +return $response; +} +} +private function varToString($var) +{ +if (is_object($var)) { +return sprintf('Object(%s)', get_class($var)); +} +if (is_array($var)) { +$a = array(); +foreach ($var as $k => $v) { +$a[] = sprintf('%s => %s', $k, $this->varToString($v)); +} +return sprintf("Array(%s)", implode(', ', $a)); +} +if (is_resource($var)) { +return sprintf('Resource(%s)', get_resource_type($var)); +} +if (null === $var) { +return'null'; +} +if (false === $var) { +return'false'; +} +if (true === $var) { +return'true'; +} +return (string) $var; +} +} +} +namespace Symfony\Component\HttpKernel\DependencyInjection +{ +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\RequestStack; +use Symfony\Component\HttpKernel\HttpKernelInterface; +use Symfony\Component\HttpKernel\HttpKernel; +use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\DependencyInjection\Scope; +class ContainerAwareHttpKernel extends HttpKernel +{ +protected $container; +public function __construct(EventDispatcherInterface $dispatcher, ContainerInterface $container, ControllerResolverInterface $controllerResolver, RequestStack $requestStack = null) +{ +parent::__construct($dispatcher, $controllerResolver, $requestStack); +$this->container = $container; +if (!$container->hasScope('request')) { +$container->addScope(new Scope('request')); +} +} +public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true) +{ +$request->headers->set('X-Php-Ob-Level', ob_get_level()); +$this->container->enterScope('request'); +$this->container->set('request', $request,'request'); +try { +$response = parent::handle($request, $type, $catch); +} catch (\Exception $e) { +$this->container->set('request', null,'request'); +$this->container->leaveScope('request'); +throw $e; +} +$this->container->set('request', null,'request'); +$this->container->leaveScope('request'); +return $response; +} +} +} + +namespace { return $loader; } + \ No newline at end of file diff --git a/app/check.php b/app/check.php new file mode 100644 index 0000000000..91b826befe --- /dev/null +++ b/app/check.php @@ -0,0 +1,62 @@ +getPhpIniConfigPath(); + +echo "********************************\n"; +echo "* *\n"; +echo "* Symfony requirements check *\n"; +echo "* *\n"; +echo "********************************\n\n"; + +echo $iniPath ? sprintf("* Configuration file used by PHP: %s\n\n", $iniPath) : "* WARNING: No configuration file (php.ini) used by PHP!\n\n"; + +echo "** ATTENTION **\n"; +echo "* The PHP CLI can use a different php.ini file\n"; +echo "* than the one used with your web server.\n"; +if ('\\' == DIRECTORY_SEPARATOR) { + echo "* (especially on the Windows platform)\n"; +} +echo "* To be on the safe side, please also launch the requirements check\n"; +echo "* from your web server using the web/config.php script.\n"; + +echo_title('Mandatory requirements'); + +$checkPassed = true; +foreach ($symfonyRequirements->getRequirements() as $req) { + /** @var $req Requirement */ + echo_requirement($req); + if (!$req->isFulfilled()) { + $checkPassed = false; + } +} + +echo_title('Optional recommendations'); + +foreach ($symfonyRequirements->getRecommendations() as $req) { + echo_requirement($req); +} + +exit($checkPassed ? 0 : 1); + +/** + * Prints a Requirement instance + */ +function echo_requirement(Requirement $requirement) +{ + $result = $requirement->isFulfilled() ? 'OK' : ($requirement->isOptional() ? 'WARNING' : 'ERROR'); + echo ' ' . str_pad($result, 9); + echo $requirement->getTestMessage() . "\n"; + + if (!$requirement->isFulfilled()) { + echo sprintf(" %s\n\n", $requirement->getHelpText()); + } +} + +function echo_title($title) +{ + echo "\n** $title **\n\n"; +} diff --git a/app/config/parameters.php b/app/config/parameters.php new file mode 100644 index 0000000000..662f7a08b9 --- /dev/null +++ b/app/config/parameters.php @@ -0,0 +1,3 @@ +setParameter('configuration', $_configuration); diff --git a/app/config/routing.yml b/app/config/routing.yml new file mode 100644 index 0000000000..0bd877127d --- /dev/null +++ b/app/config/routing.yml @@ -0,0 +1,18 @@ +main: + resource: "@ChamiloLMSCoreBundle/Resources/config/routing.yml" + +login_check: + path: /login_check + +login: + path: /login + defaults: { _controller: ChamiloLMSCoreBundle:Security:login } + +secured_logout: + pattern: /secured/logout + +logout: + pattern: /secured/logout + +root: + path: / diff --git a/app/config/routing_dev.yml b/app/config/routing_dev.yml new file mode 100755 index 0000000000..ff93a02ba0 --- /dev/null +++ b/app/config/routing_dev.yml @@ -0,0 +1,14 @@ +_wdt: + resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml" + prefix: /_wdt + +_profiler: + resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml" + prefix: /_profiler + +_configurator: + resource: "@SensioDistributionBundle/Resources/config/routing/webconfigurator.xml" + prefix: /_configurator + +_main: + resource: routing.yml diff --git a/composer.json b/composer.json index a99eeddf4f..1946136eba 100755 --- a/composer.json +++ b/composer.json @@ -9,9 +9,7 @@ }, "autoload": { "psr-0": { - "Entity" : "main/inc/", - "Gedmo": "vendor/gedmo/doctrine-extensions/lib", - "ChamiloLMS" : "src/" + "": "src/" }, "classmap": [ "main/auth", @@ -29,89 +27,66 @@ }, "repositories": [ { - "type": "vcs", - "url": "https://github.com/jmontoyaa/phpqrcode" - }, - { - "type": "vcs", - "url": "https://github.com/jmontoyaa/silex-pagerfanta-provider" - }, - { - "type": "vcs", - "url": "https://github.com/jmontoyaa/XHProfServiceProvider" + "type": "package", + "package": { + "name": "jquery/jquery", + "version": "1.10.2", + "dist": { + "url": "http://code.jquery.com/jquery-1.10.2.js", + "type": "file" + } + } } ], "require": { "php": ">=5.3.3", - "silex/silex": "~1.1", - "symfony/console" : "~2.3", - "symfony/twig-bridge": "~2.3", - "symfony/doctrine-bridge": "~2.3", - "symfony/security": "~2.3", - "symfony/form": "~2.3", - "symfony/property-access": "~2.3", - "symfony/validator": "~2.3", - "symfony/translation": "~2.3", - "symfony/dependency-injection": "~2.3", - "symfony/filesystem": "~2.3", - "symfony/finder": "~2.3", - "monolog/monolog" : ">=1.0.0", - "symfony/config": "~2.3", - "symfony/yaml": "~2.3", - "symfony/locale": "~2.3", - "symfony/monolog-bridge": "~2.3", - "twig/twig": ">=1.8,<2.0-dev", - "braincrafted/bootstrap-bundle": "dev-master", - "dflydev/doctrine-orm-service-provider": "1.0.*@dev", - "doctrine/migrations": "dev-master", + "symfony/symfony": "~2.4", + "doctrine/orm": "~2.2,>=2.2.3", + "doctrine/doctrine-bundle": "~1.2", + "twig/extensions": "~1.0", + "symfony/assetic-bundle": "~2.3", + "symfony/swiftmailer-bundle": "~2.3", + "symfony/monolog-bundle": "~2.4", + "sensio/distribution-bundle": "~2.3", + "sensio/framework-extra-bundle": "~3.0", + "sensio/generator-bundle": "~2.3", + "incenteev/composer-parameter-handler": "~2.0", + "braincrafted/bootstrap-bundle": "~2.0", "gedmo/doctrine-extensions": "~2.3", - "swiftmailer/swiftmailer": ">=4.1.2,<4.2-dev", - "pagerfanta/pagerfanta": "dev-master", - "franmomu/silex-pagerfanta-provider": "1.0.*@dev", - "igorw/config-service-provider": "1.2.*@dev", - "mpdf/mpdf": "v5.6.1", - "ezyang/htmlpurifier": "v4.6.0", - "realityking/pchart": "dev-master", - "imagine/imagine": "0.6.*@dev", - "grom/silex-service-provider": "dev-master", - "knplabs/knp-menu": "2.0.*@dev", - "knplabs/knp-snappy": "dev-master", - "knplabs/console-service-provider": "dev-master", - "jmontoyaa/phpqrcode": "dev-master", - "neutron/silex-filesystem-provider": "dev-master", - "jbroadway/urlify": "1.0.0-stable", - "sensio/framework-extra-bundle": "~2.3", - "chamilo/chash": "dev-master", - "composer/composer": "1.0.0-alpha7", - "flint/flint": "1.6.0", - "icehero/silex-opauth": "dev-master", - "opauth/openid": "0.1.0", - "opauth/facebook": "0.2.1", - "opauth/google": "0.2.2", - "media-alchemyst/media-alchemyst": "0.4.4", - "php-ffmpeg/php-ffmpeg": "0.4.4", - "sunra/php-simple-html-dom-parser": "1.5.0", - "zendframework/zend-config": "~2.3", - "zendframework/zend-feed": "~2.3", - "zendframework/zend-http": "~2.3", - "zendframework/zend-servicemanager": "~2.3", - "sabre/vobject" : "~3.1", - "patchwork/utf8": "1.1.*", - "sonata-project/exporter": "1.3.3" - }, - "require-dev": { - "league/flysystem": "0.3.3", - "symfony/browser-kit": "~2.3", - "symfony/web-profiler-bundle": "~2.3", - "silex/web-profiler": "~1.0", - "natxet/CssMin": "dev-master", - "leafo/lessphp": "dev-master", - "mheap/silex-assetic": "1.0.*@dev", - "filp/whoops": "dev-master", - "jmontoyaa/xhprof-service-provider": "dev-master" + "twbs/bootstrap": "3.0.*", + "jquery/jquery": "1.10.*", + "oyejorge/less.php": "~1.5", + "sonata-project/block-bundle": "~2.2", + "knplabs/knp-menu-bundle": "~1.1", + "white-october/pagerfanta-bundle": "dev-master" }, "scripts": { - "post-install-cmd": "ChamiloLMS\\Composer\\Tasks::postInstall", - "post-update-cmd": "ChamiloLMS\\Composer\\Tasks::postUpdate" + "post-install-cmd": [ + "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters", + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap", + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache", + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets", + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile" + ], + "post-update-cmd": [ + "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters", + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap", + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache", + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets", + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile" + ] + }, + "config": { + "bin-dir": "bin" + }, + "extra": { + "symfony-app-dir": "app", + "symfony-web-dir": "web", + "incenteev-parameters": { + "file": "app/config/parameters.yml" + }, + "branch-alias": { + "dev-master": "2.4-dev" + } } } diff --git a/main/admin/add_users_to_usergroup.php b/main/admin/add_users_to_usergroup.php index 74b47cfcd6..753a4c345d 100644 --- a/main/admin/add_users_to_usergroup.php +++ b/main/admin/add_users_to_usergroup.php @@ -11,7 +11,7 @@ $language_file = array('admin','registration'); $cidReset = true; // including some necessary files -require_once '../inc/global.inc.php'; +//require_once '../inc/global.inc.php'; // setting the section (for the tabs) $this_section = SECTION_PLATFORM_ADMIN; diff --git a/main/admin/course_list.php b/main/admin/course_list.php index 9645274b08..87fdd17308 100644 --- a/main/admin/course_list.php +++ b/main/admin/course_list.php @@ -289,9 +289,6 @@ if (isset ($_GET['search']) && $_GET['search'] == 'advanced') { $content .= $table->return_table(); } -$app['title'] = $tool_name; -$tpl = $app['template']; -$tpl->assign('actions', $actions); -$tpl->assign('message', $message); -$tpl->assign('content', $content); -$tpl->display_one_col_template(); +echo $actions; +echo $message; +echo $content; diff --git a/main/admin/index.php b/main/admin/index.php deleted file mode 100644 index 55f7c40dd7..0000000000 --- a/main/admin/index.php +++ /dev/null @@ -1,4 +0,0 @@ - BeezNest 2011 * @package chamilo.admin */ - +use ChamiloSession as Session; // name of the language file that needs to be included $language_file = array ('registration','admin'); $cidReset = true; @@ -410,7 +410,7 @@ function modify_filter($user_id, $url_params, $row) { ) ) { if (!$user_is_anonymous) { - if ($app['security']->isGranted('ROLE_GLOBAL_ADMIN')) { + if (Session::getSecurity()->isGranted('ROLE_GLOBAL_ADMIN')) { // everything looks good, show "login as" link if ($user_id != $userId) { $result .= ''.Display::return_icon('login_as.gif', get_lang('LoginAs')).'  '; @@ -801,9 +801,8 @@ if ($table->get_total_number_of_items() == 0) { } } -$app['title'] = $tool_name; -$tpl = $app['template']; +echo $message; +echo $actions; +echo $form.$table_result.$extra_search_options; + -$tpl->assign('actions', $actions); -$tpl->assign('message', $message); -$tpl->assign('content', $form.$table_result.$extra_search_options); diff --git a/main/auth/shibboleth/app/controller/shibboleth_controller.class.php b/main/auth/shibboleth/app/controller/shibboleth_controller.class.php index 95c11a6f59..244f2689dc 100644 --- a/main/auth/shibboleth/app/controller/shibboleth_controller.class.php +++ b/main/auth/shibboleth/app/controller/shibboleth_controller.class.php @@ -91,8 +91,8 @@ class ShibbolethController $message = get_lang('already_logged_in'); Shibboleth::display()->message_page($message, $title); } - $html = PageController::displayLoginForm(); - Shibboleth::display()->page($html, $title); + /*$html = PageController::displayLoginForm(); + Shibboleth::display()->page($html, $title);*/ } /** diff --git a/main/course_home/activity.php b/main/course_home/activity.php index aebc12cb01..b52ac7b00c 100644 --- a/main/course_home/activity.php +++ b/main/course_home/activity.php @@ -1,5 +1,6 @@ 'data/', @@ -575,20 +574,20 @@ function api_get_path($path_type, $path = null) { WEB_DATA_COURSE_PATH => 'courses/', WEB_DATA_PATH => '/', SYS_COURSE_PATH => 'data/', - SYS_CSS_PATH => 'web/ChamiloLMS/css/', + SYS_CSS_PATH => 'ChamiloLMS/css/', SYS_LANG_PATH => 'lang/', - WEB_IMG_PATH => 'web/ChamiloLMS/img/', + WEB_IMG_PATH => 'ChamiloLMS/img/', SYS_IMG_PATH => 'web/ChamiloLMS/img/', - WEB_CSS_PATH => 'web/ChamiloLMS/css/', + WEB_CSS_PATH => 'ChamiloLMS/css/', SYS_PLUGIN_PATH => 'plugin/', WEB_PLUGIN_PATH => 'plugin/', WEB_ARCHIVE_PATH => 'temp/', INCLUDE_PATH => 'inc/', LIBRARY_PATH => 'inc/lib/', - SYS_LIBRARY_JS_PATH => 'web/ChamiloLMS/js/', + SYS_LIBRARY_JS_PATH => 'ChamiloLMS/js/', CONFIGURATION_PATH => 'inc/conf/', WEB_LIBRARY_PATH => 'inc/lib/', - WEB_LIBRARY_JS_PATH => 'web/ChamiloLMS/js/', + WEB_LIBRARY_JS_PATH => 'ChamiloLMS/js/', WEB_AJAX_PATH => 'inc/ajax/', SYS_TEST_PATH => 'tests/', WEB_TEMPLATE_PATH => 'template/', @@ -610,16 +609,17 @@ function api_get_path($path_type, $path = null) { static $code_folder; static $course_folder; + global $_configuration; // Always load root_web modifications for multiple url features. - $_configuration = $app->getConfiguration(); // Default $_configuration['root_web'] configuration //$root_web = isset($_configuration['root_web']) ? $_configuration['root_web'] : $app['url_generator']; - $root_web = $app['url_generator']->generate('root'); //$_configuration['root_web']; - $root_web = str_replace('web/', '', $root_web); + + $root_web = Session::getUrlGenerator()->generate('root'); //$_configuration['root_web']; + $rootDir = Session::getRootDir(); // Configuration data for already installed system. - $root_sys = $app['path.base']; + $root_sys = $rootDir; $load_new_config = false; @@ -657,10 +657,10 @@ function api_get_path($path_type, $path = null) { $paths[SYS_PATH] = $root_sys; // Update data path to get it from config file if defined - $paths[SYS_DATA_PATH] = $app['path.data']; - $paths[SYS_LOG_PATH] = $app['path.logs']; - $paths[SYS_CONFIG_PATH] = $app['path.config']; - $paths[SYS_COURSE_PATH] = $app['path.courses']; + $paths[SYS_DATA_PATH] = Session::getDataDir(); + $paths[SYS_LOG_PATH] = Session::getLogDir(); + $paths[SYS_CONFIG_PATH] = Session::getConfigDir(); + $paths[SYS_COURSE_PATH] = Session::getCourseDir(); $paths[SYS_DEFAULT_COURSE_DOCUMENT_PATH] = $paths[SYS_DATA_PATH].'default_course_document/'; @@ -687,7 +687,7 @@ function api_get_path($path_type, $path = null) { // Now we can switch into api_get_path() "terminology". $paths[SYS_LANG_PATH] = $paths[SYS_CODE_PATH].$paths[SYS_LANG_PATH]; $paths[SYS_PLUGIN_PATH] = $paths[SYS_PATH].$paths[SYS_PLUGIN_PATH]; - $paths[SYS_ARCHIVE_PATH] = $app['path.temp']; + $paths[SYS_ARCHIVE_PATH] = Session::getTempDir(); $paths[SYS_TEST_PATH] = $paths[SYS_PATH].$paths[SYS_TEST_PATH]; $paths[SYS_TEMPLATE_PATH] = $paths[SYS_CODE_PATH].$paths[SYS_TEMPLATE_PATH]; $paths[SYS_CSS_PATH] = $paths[SYS_PATH].$paths[SYS_CSS_PATH]; @@ -1365,7 +1365,6 @@ function api_get_course_int_id() { return Session::read('_real_cid', 0); } - /** * Returns the current course directory * @@ -2196,17 +2195,19 @@ function api_get_self() { */ function api_is_platform_admin($allow_sessions_admins = false) { - global $app; - $token = $app['security']->getToken(); + $security = Session::getSecurity(); + if ($security) { + $token = $security->getToken(); - if (!empty($token)) { - if ($app['security']->isGranted('ROLE_ADMIN')) { - return true; - } - if ($allow_sessions_admins) { - if ($app['security']->isGranted('ROLE_SESSION_MANAGER')) { + if (!empty($token)) { + if ($security->isGranted('ROLE_ADMIN')) { return true; } + if ($allow_sessions_admins) { + if ($security->isGranted('ROLE_SESSION_MANAGER')) { + return true; + } + } } } return false; @@ -2217,11 +2218,10 @@ function api_is_platform_admin($allow_sessions_admins = false) */ function api_is_question_manager() { - global $app; - $token = $app['security']->getToken(); - + $security = Session::getSecurity(); + $token = $security->getToken(); if (!empty($token)) { - if ($app['security']->isGranted('ROLE_QUESTION_MANAGER')) { + if ($security->isGranted('ROLE_QUESTION_MANAGER')) { return true; } } @@ -2235,11 +2235,10 @@ function api_is_question_manager() */ function api_is_session_admin() { - global $app; - $token = $app['security']->getToken(); - + $security = Session::getSecurity(); + $token = $security->getToken(); if (!empty($token)) { - if ($app['security']->isGranted('ROLE_SESSION_MANAGER')) { + if ($security->isGranted('ROLE_SESSION_MANAGER')) { return true; } } @@ -2251,11 +2250,10 @@ function api_is_session_admin() * @return boolean True if current user is a human resources manager */ function api_is_drh() { - global $app; - $token = $app['security']->getToken(); - + $security = Session::getSecurity(); + $token = $security->getToken(); if (!empty($token)) { - if ($app['security']->isGranted('ROLE_RRHH')) { + if ($security->isGranted('ROLE_RRHH')) { return true; } } @@ -2267,11 +2265,10 @@ function api_is_drh() { * @return boolean True if current user is a human resources manager */ function api_is_student() { - global $app; - $token = $app['security']->getToken(); - + $security = Session::getSecurity(); + $token = $security->getToken(); if (!empty($token)) { - if ($app['security']->isGranted('ROLE_STUDENT')) { + if ($security->isGranted('ROLE_STUDENT')) { return true; } } @@ -2283,9 +2280,12 @@ function api_is_student() { * @return boolean True if current user is a human resources manager */ function api_is_teacher() { - global $app; - if ($app['security']->isGranted('ROLE_TEACHER')) { - return true; + $security = Session::getSecurity(); + $token = $security->getToken(); + if (!empty($token)) { + if ($security->isGranted('ROLE_TEACHER')) { + return true; + } } return false; } @@ -2973,18 +2973,9 @@ function api_is_anonymous($user_id = null, $db_check = false) { */ function api_not_allowed($printHeaders = false, $message = null) { - global $app; - if (empty($message)) { - $message = 'Unauthorized'; - } - if ($printHeaders == false) { - $app['template.show_footer'] = false; - $app['template.show_header'] = false; - } - return $app->abort('401', $message); + throw new Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; } - /* WHAT'S NEW functions for the what's new icons in the user course list */ diff --git a/main/inc/lib/chamilo_session.class.php b/main/inc/lib/chamilo_session.class.php index 7a21be2031..be458dbc92 100644 --- a/main/inc/lib/chamilo_session.class.php +++ b/main/inc/lib/chamilo_session.class.php @@ -6,6 +6,79 @@ class ChamiloSession { public static $session; + public static $configuration; + public static $urlGenerator; + public static $security; + public static $translator; + + public static $rootDir; + public static $logDir; + public static $tempDir; + public static $dataDir; + public static $courseDir; + public static $configDir; + + public static function getConfigDir() + { + return self::$configDir; + } + + public static function getLogDir() + { + return self::$logDir; + } + + public static function getTempDir() + { + return self::$tempDir; + } + + public static function getRootDir() + { + return self::$rootDir; + } + + public static function getDataDir() + { + return self::$dataDir; + } + + public static function getCourseDir() + { + return self::$courseDir; + } + + /** + * @return Symfony\Component\Routing\Generator\UrlGeneratorInterface + */ + public static function getUrlGenerator() + { + return self::$urlGenerator; + } + + /** + * @return Symfony\Component\HttpFoundation\Session\SessionInterface; + */ + public static function getSession() + { + return self::$session; + } + + /** + * @return Symfony\Component\Security\Core\SecurityContextInterface + */ + public static function getSecurity() + { + return self::$security; + } + + /** + * @return Symfony\Component\Security\Core\SecurityContextInterface + */ + public static function getTranslator() + { + return self::$translator; + } /** * @param $session diff --git a/main/inc/lib/course.lib.php b/main/inc/lib/course.lib.php index 280438fb45..5ec8689a54 100644 --- a/main/inc/lib/course.lib.php +++ b/main/inc/lib/course.lib.php @@ -3740,7 +3740,7 @@ class CourseManager $urlId = api_get_current_access_url_id(); $limit = intval($limit); - //Getting my courses + // Getting my courses $my_course_list = CourseManager::get_courses_list_by_user_id(api_get_user_id()); $my_course_code_list = array(); diff --git a/main/inc/lib/course_home.lib.php b/main/inc/lib/course_home.lib.php index 0a9dc5cf12..adca5c26d9 100644 --- a/main/inc/lib/course_home.lib.php +++ b/main/inc/lib/course_home.lib.php @@ -431,6 +431,7 @@ class CourseHome break; case TOOL_AUTHORING: $sql = "SELECT * FROM $course_tool_table WHERE category = 'authoring' AND c_id = $course_id $condition_session ORDER BY id"; + $result = Database::query($sql); $col_link ="##003399"; break; @@ -642,7 +643,8 @@ class CourseHome if ($tool['image'] == 'scormbuilder.gif') { // Check if the published learnpath is visible for student $published_lp_id = self::get_published_lp_id_from_link($tool['link']); - if (!api_is_allowed_to_edit(null, true) && !learnpath::is_lp_visible_for_student($published_lp_id, api_get_user_id())) { + if (!api_is_allowed_to_edit(null, true) && + !learnpath::is_lp_visible_for_student($published_lp_id, api_get_user_id())) { continue; } } @@ -660,7 +662,9 @@ class CourseHome unset($lnk); $item['extra'] = null; + if ($is_allowed_to_edit && !api_is_coach()) { + if (empty($session_id)) { if ($tool['visibility'] == '1' && $tool['admin'] != '1') { $link['name'] = Display::return_icon( @@ -672,7 +676,7 @@ class CourseHome ); if (!empty($tool['id'])) { $link['cmd'] = $urlGenerator->generate( - 'course_home.controller:hideIconAction', + 'chamilolms_core_tool_coursehome_coursehome_hideicon', array( 'courseCode' => api_get_course_id(), 'iconId' => $tool['id'] @@ -685,7 +689,7 @@ class CourseHome $link['name'] = Display::return_icon('invisible.gif', get_lang('Activate'), array('id' => 'linktool_'.$tool['id']), ICON_SIZE_MEDIUM, false); if (!empty($tool['id'])) { $link['cmd'] = $urlGenerator->generate( - 'course_home.controller:showIconAction', + 'chamilolms_core_tool_coursehome_coursehome_showicon', array( 'courseCode' => api_get_course_id(), 'iconId' => $tool['id'] @@ -922,6 +926,7 @@ class CourseHome $html .= Display::div($content, array('class'=>'activity_content')); $html .= ''; + if ($counter == 1) { $html .= ''; $counter = -1; diff --git a/main/inc/lib/display.lib.php b/main/inc/lib/display.lib.php index 95ad0e3c02..fa3725888d 100644 --- a/main/inc/lib/display.lib.php +++ b/main/inc/lib/display.lib.php @@ -39,9 +39,7 @@ class Display */ public static function display_header($tool_name = '', $help = null, $page_header = null) { - global $app; - $app['classic_layout'] = true; - $app['template']->setTitle($tool_name); + //$app['template']->setTitle($tool_name); } /** @@ -213,7 +211,7 @@ class Display $introduction_section .= '
'; $url = $urlGenerator->generate( - 'introduction.controller:editAction', + 'chamilolms_core_tool_introduction_introduction_edit', array('tool' => $tool, 'courseCode' => api_get_course_id()) ); @@ -227,7 +225,7 @@ class Display // Displays "edit intro && delete intro" commands $introduction_section .= '
'; $url = $urlGenerator->generate( - 'introduction.controller:editAction', + 'chamilolms_core_tool_introduction_introduction_edit', array('tool' => $tool, 'courseCode' => api_get_course_id()) ); @@ -792,9 +790,6 @@ class Display $code_path = api_get_path(SYS_IMG_PATH); $w_code_path = api_get_path(WEB_IMG_PATH); - //$code_path = self::$urlGenerator->generate('root'); - //$w_code_path = self::$urlGenerator->generate('root'); - $image = trim($image); $theme = 'css/'.api_get_visual_theme().'/icons/'; $size_extra = ''; @@ -807,7 +802,6 @@ class Display } // Checking the theme icons folder example: main/css/chamilo/icons/XXX - if (is_file($code_path.$theme.$size_extra.$image)) { $icon = $w_code_path.$theme.$size_extra.$image; } elseif (is_file($code_path.'icons/'.$size_extra.$image)) { @@ -822,7 +816,6 @@ class Display if ($return_only_path) { return $icon; } - $img = self::img($icon, $alt_text, $additional_attributes); if (SHOW_TEXT_NEAR_ICONS == true and !empty($alt_text)) { if ($show_text) { diff --git a/main/inc/lib/events.lib.inc.php b/main/inc/lib/events.lib.inc.php index 667f2fc0ff..036bae499e 100644 --- a/main/inc/lib/events.lib.inc.php +++ b/main/inc/lib/events.lib.inc.php @@ -11,8 +11,8 @@ * * @package chamilo.library */ -use ChamiloLMS\Entity\User; -use ChamiloLMS\Entity\Role; +use ChamiloLMS\CoreBundle\Entity\User; +use ChamiloLMS\CoreBundle\Entity\Role; /** * @author Sebastien Piraux old code diff --git a/main/inc/lib/formvalidator/FormValidator.class.php b/main/inc/lib/formvalidator/FormValidator.class.php index 2e5c9c45c0..9ea4e8a367 100644 --- a/main/inc/lib/formvalidator/FormValidator.class.php +++ b/main/inc/lib/formvalidator/FormValidator.class.php @@ -673,6 +673,7 @@ EOT; function html_filter($html, $mode = NO_HTML) { return $html; + //$filter = new Zend\Filter\StripTags(array('allowTags' => 'a')); $allowed_tags = HTML_QuickForm_Rule_HTML::get_allowed_tags($mode); $cleaned_html = kses($html, $allowed_tags); return $cleaned_html; diff --git a/main/inc/lib/internationalization.lib.php b/main/inc/lib/internationalization.lib.php index 5cc4bb4535..7d1e2eb1c2 100644 --- a/main/inc/lib/internationalization.lib.php +++ b/main/inc/lib/internationalization.lib.php @@ -10,7 +10,7 @@ * @author More authors, mentioned in the correpsonding fragments of this source. * @package chamilo.library */ -use Patchwork\Utf8 as u; +use \ChamiloSession as Session; use Symfony\Component\Intl\DateFormatter\IntlDateFormatter; // Predefined date formats in Chamilo provided by the language sub-system. @@ -49,11 +49,10 @@ define('PERSON_NAME_DATA_EXPORT', PERSON_NAME_EASTERN_ORDER); // Contextual: for */ function get_lang($variable) { - global $app; - $translated = $app['translator']->trans($variable); + $translated = Session::getTranslator()->trans($variable); if ($translated == $variable) { // Check the langVariable for BC - $translated = $app['translator']->trans("lang$variable"); + $translated = Session::getTranslator()->trans("lang$variable"); if ($translated == "lang$variable") { return $variable; } diff --git a/main/inc/lib/security.lib.php b/main/inc/lib/security.lib.php index 43856eefdb..28484cc803 100644 --- a/main/inc/lib/security.lib.php +++ b/main/inc/lib/security.lib.php @@ -260,6 +260,7 @@ class Security */ public static function remove_XSS($var, $user_status = ANONYMOUS, $filter_terms = false) { + return $var; // @todo improvement - HTMLpurifier eats server memory ~ 3M // return $var; if ($filter_terms) { diff --git a/src/ChamiloLMS/Command/Template/AsseticDumpCommand.php b/src/ChamiloLMS/Command/Template/AsseticDumpCommand.php deleted file mode 100644 index db76dc8e75..0000000000 --- a/src/ChamiloLMS/Command/Template/AsseticDumpCommand.php +++ /dev/null @@ -1,97 +0,0 @@ -setName('assetic:dump') - ->setDescription('Dumps all assets to the filesystem') - ->addArgument('theme', InputArgument::OPTIONAL, 'The theme to dump, if none is set then all themes will be generated', null); - } - - /** - * @param InputInterface $input - * @param OutputInterface $output - * @return integer|null|boolean|void - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - /** @var \Silex\Application $app */ - $app = $this->getApplication()->getSilexApplication(); - - $theme = $input->getArgument('theme'); - - // Get all themes - if ($app['assetic.enabled'] == false || !isset($app['assetic.enabled'])) { - $output->writeln("Assetic is not enabled. Change this value to true: assetic.enabled = true"); - return false; - } - - $themes = $app['template']->getStyleSheetFolderList(); - //$themes = array('chamilo', 'public_admin'); - - if (empty($theme)) { - $dialog = $this->getHelperSet()->get('dialog'); - if (!$dialog->askConfirmation( - $output, - 'Are you sure you want to dump css/js of all themes?(y/N)', - false - ) - ) { - return; - } - } else { - $themes = array($theme); - } - - if (!is_dir($app['assetic.path_to_web'])) { - mkdir($app['assetic.path_to_web'], api_get_permissions_for_new_directories()); - $output->writeln("Creating folder in: ".$app['assetic.path_to_web'].""); - } - - foreach ($themes as $theme) { - if (is_dir($app['path.base'].'main/css/'.$theme) && file_exists($app['path.base'].'main/css/'.$theme.'/default.css')) { - $output->writeln("Dumping theme: $theme"); - - /** @var \SilexAssetic\Assetic\Dumper $dumper */ - $dumper = $app['assetic.dumper']; - - $app['assetic.output.path_to_css'] = 'css/'.$theme.'/style.css'; - - $params = array( - $app['path.base'].'main/css/'.$theme => $app['assetic.input.path_to_assets'].'/css/'.$theme - ); - - $app['chamilo.filesystem']->copyFolders($params, $output); - - if (isset($app['twig'])) { - //$dumper->addTwigAssets(); - } - $dumper->dumpAssets(); - } else { - $output->writeln("Seems that theme: $theme doesn't have a $theme/default.css file. Skipping dump."); - } - } - $output->writeln('Dump finished'); - - return true; - } -} diff --git a/src/ChamiloLMS/Controller/BaseController.php b/src/ChamiloLMS/Controller/BaseController.php deleted file mode 100644 index 1f57b2c23d..0000000000 --- a/src/ChamiloLMS/Controller/BaseController.php +++ /dev/null @@ -1,613 +0,0 @@ -app = $app; - // In order to use the Flint Controller. - $this->pimple = $app; - - $className = get_class($this); - $this->classParts = explode('\\', Container::underscore($className)); - - //if (!$this->classnameLabel) { - $this->classNameLabel = str_replace('Controller', '', substr($className, strrpos($className, '\\') + 1)); - //} - } - - /** - * @return array - */ - protected function getClassParts() - { - return $this->classParts; - } - - /** - * Converts string 'ChamiloLMS\Controller\Admin\QuestionManager' into - * 'admin/question_manager' - */ - public function getTemplatePath() - { - $parts = $this->classParts; - - $newPath = array(); - foreach ($parts as $part) { - if (in_array($part, array('chamilo_lms', 'controller')) - //strpos($part, '_controller') > 0 - ) { - continue; - } - $newPath[] = $part; - } - - $template = implode('/', $newPath); - return str_replace('_controller', '', $template); - } - - /** - * Transforms 'QuestionManagerController' to 'question_manager.controller' - * @return string - */ - public function getControllerAlias() - { - $parts = $this->classParts; - $parts = array_reverse($parts); - $alias = str_replace('_controller', '.controller', $parts[0]); - return $alias; - } - - /** - * Translator shortcut - * @param string $variable - * @return string - */ - public function trans($variable) - { - return $this->get('translator')->trans($variable); - } - - /** - * Returns the class name label - * @example RoleController -> Role - * - * @return string the class name label - */ - public function getClassNameLabel() - { - return $this->classNameLabel; - } - - /** - * @return MenuFactoryInterface - */ - public function getMenuFactory() - { - return $this->get('knp_menu.factory'); - } - - /** - * @param string $action - * @return MenuItemInterface - */ - protected function getBreadcrumbs($action) - { - $breadcrumbs = $this->buildBreadcrumbs($action); - - return $breadcrumbs; - } - - /** Main home URL - * @return MenuItemInterface - */ - protected function getHomeBreadCrumb() - { - $menu = $this->getMenuFactory()->createItem( - 'root', - array( - 'childrenAttributes' => array( - 'class' => 'breadcrumb', - 'currentClass' => 'active' - ) - ) - ); - - $menu->addChild( - $this->trans('Home'), - array('uri' => $this->generateUrl('home')) - ); - - return $menu; - } - - /** - * @param $action - * @param MenuItemInterface $menu - * @return MenuItemInterface - */ - public function buildBreadcrumbs($action, MenuItemInterface $menu = null) - { - if (!$menu) { - $menu = $this->getHomeBreadCrumb(); - } - - $menu->addChild( - $this->trans($this->getClassnameLabel().'List'), - array('uri' => $this->generateControllerUrl('listingAction')) - ); - - $action = str_replace( - array($this->getControllerAlias().':', 'Action'), - '', - $action - ); - - switch ($action) { - case 'add': - case 'edit': - $menu->addChild( - $this->trans($this->getClassnameLabel().ucfirst($action)) - //array('uri' => $this->generateControllerUrl($action.'Action')) - ); - break; - } - - return $menu; - } - - /** - * @param array $breadCrumbList - * @return string - */ - protected function parseLegacyBreadCrumb($breadCrumbList = array()) - { - $menu = $this->getHomeBreadCrumb(); - foreach ($breadCrumbList as $item) { - $menu->addChild( - $this->trans($item['title']), - array('uri' => $item['url']) - ); - } - - $renderer = new ListRenderer(new \Knp\Menu\Matcher\Matcher()); - $result = $renderer->render($menu); - - return $result; - } - - /** - * Renders the current controller template - * @param string $name - * @param array $elements - * @return mixed - */ - public function renderTemplate($name, $elements = array()) - { - $name = $this->getTemplatePath().'/'.$name; - - $renderer = new ListRenderer(new \Knp\Menu\Matcher\Matcher()); - $action = $this->getRequest()->get('_route'); - $result = $renderer->render($this->getBreadcrumbs($action)); - $elements['new_breadcrumb'] = $result; - - return $this->getTemplate()->renderTemplate($name, $elements); - } - - /** - * @return \ChamiloLMS\Entity\Course - */ - protected function getCourse() - { - //if (isset($this->app['course'])) { - return $this->app['course']; - //} - return false; - } - - /** - * @return \ChamiloLMS\Entity\Session - */ - protected function getSession() - { - if (isset($this->app['course_session']) && !empty($this->app['course_session'])) { - return $this->app['course_session']; - } - return false; - } - - /** - * @return null|\Symfony\Component\HttpFoundation\Session\SessionInterface - */ - protected function getSessionHandler() - { - return $this->getRequest()->getSession(); - } - - /** - * @return \ChamiloLMS\Framework\Template - */ - protected function getTemplate() - { - return $this->get('template'); - } - - /** - * @return \ChamiloLMS\Component\Editor\Editor - */ - protected function getHtmlEditor() - { - return $this->get('html_editor'); - } - - /** - * @return \ChamiloLMS\Component\Editor\Connector - */ - protected function getEditorConnector() - { - return $this->get('editor_connector'); - } - - /** - * @return \ChamiloLMS\Component\DataFilesystem\DataFilesystem - */ - protected function getDataFileSystem() - { - return $this->get('chamilo.filesystem'); - } - - /** - * @return \ChamiloLMS\Entity\User - */ - public function getUser() - { - $user = parent::getUser(); - if (empty($user)) { - return $this->abort(404, $this->trans('Login required.')); - } - return $user; - } - - /** - * @return \Symfony\Component\Security\Core\SecurityContext - */ - public function getSecurity() - { - return $this->get('security'); - } - - /** - * @return \Doctrine\ORM\EntityManager - */ - protected function getManager() - { - return $this->get('orm.em'); - } - - /** - * @return \Doctrine\DBAL\Connection - */ - protected function getDatabase() - { - return $this->get('db'); - } - - /** - * Shortcut of - * $this->getManager()->getRepository('ChamiloLMS\Entity\MyClass') - * @param string $entity - * @return \Doctrine\ORM\EntityRepository - */ - /*sprotected function getRepository($entity) - { - return $this->getManager()->getRepository('ChamiloLMS\Entity\\'.$entity); - }*/ - - /** - * @see \Silex\Application::sendFile - */ - public function sendFile($file, $status = 200, $headers = array(), $contentDisposition = null) - { - return $this->pimple->sendFile($file, $status, $headers, $contentDisposition); - } - - /** - * Converts an array of URL to absolute URLs using the url_generator service - * @param string $label - * @param array - * @return mixed - * @deprecated - */ - protected function createUrl($label, $parameters = array()) - { - $links = $this->generateLinks(); - $course = $this->getCourse(); - - if (!empty($course)) { - $parameters['course'] = $course->getCode(); - } - $session = $this->getSession(); - if (!empty($session)) { - $parameters['id_session'] = $session->getId(); - } - - $extraParams = $this->getExtraParameters(); - - if (!empty($extraParams)) { - $request = $this->getRequest(); - $dynamicParams = array(); - foreach ($extraParams as $param) { - $value = $request->get($param); - if (!empty($value)) { - $dynamicParams[$param] = $value; - } - } - $parameters = array_merge($parameters, $dynamicParams); - } - - if (isset($links) && is_array($links) && isset($links[$label])) { - $url = $this->generateUrl($links[$label], $parameters); - return $url; - } - return $url = $this->generateUrl($links['list_link']); - } - - /** - * Add extra parameters when generating URLs - * @return array - */ - protected function getExtraParameters() - { - return array(); - } - - /** - * @see Symfony\Component\Routing\RouterInterface::generate() - */ - public function generateUrl( - $name, - array $parameters = array(), - $reference = UrlGeneratorInterface::ABSOLUTE_PATH - ) { - if ($name != 'home') { - $course = $this->getCourse(); - if (!empty($course)) { - $parameters['cidReq'] = $course->getCode(); - } - $session = $this->getSession(); - if (!empty($session)) { - $parameters['id_session'] = $session->getId(); - } - } - return parent::generateUrl($name, $parameters, $reference); - } - - /** - * In a controller like RoleController when calling the indexAction URL - * this function will transform to role.controller:indexAction - * @param string $name - * @param array $parameters - * @param bool $reference - * @return mixed - */ - public function generateControllerUrl( - $name, - array $parameters = array(), - $reference = UrlGeneratorInterface::ABSOLUTE_PATH - ) { - $name = $this->getControllerAlias().':'.$name; - return $this->generateUrl($name, $parameters, $reference); - } - - /** - * @param \Doctrine\ORM\QueryBuilder $qb - * @param string - */ - protected function setCourseParameters(\Doctrine\ORM\QueryBuilder & $qb, $prefix) - { - $course = $this->getCourse(); - if ($course) { - $qb->andWhere($prefix.'.cId = :id'); - $qb->setParameter('id', $course->getId()); - - $session = $this->getSession(); - if (!empty($session)) { - $qb->andWhere($prefix.'.sessionId = :session_id'); - $qb->setParameter('session_id', $session->getId()); - } - } - } - - /** - * Get system setting. - * @param string $variable - * @param string $key - * @return string - */ - public function getSetting($variable, $key = null) - { - $session = $this->getRequest()->getSession(); - $settings = $session->get('_setting'); - if (empty($key)) { - if (isset($settings[$variable])) { - return $settings[$variable]; - } - } else { - if (isset($settings[$variable]) && isset($settings[$variable])) { - return $settings[$variable]; - } - } - } - - /** - * @return bool - */ - public function isCourseTeacher() - { - $course = $this->getCourse(); - if (!$course) { - return false; - } else { - if ($this->getSecurity()->isGranted('ROLE_ADMIN')) { - return true; - } - $course->getId(); - $role = "ROLE_TEACHER_COURSE_".$course->getId().'_SESSION_0'; - - return $this->getSecurity()->isGranted($role); - } - } - - /** - * Add flash messages. - * @param string $message - * @param string $type example: info|success|warning - */ - public function addMessage($message, $type = 'info') - { - if ($type == 'confirmation') { - $type = 'info'; - } - $this->get('session')->getFlashBag()->add($type, $message); - } - - /** - * @param array $breadcrumbs - * @deprecated - */ - protected function setBreadcrumb($breadcrumbs) - { - $course = $this->getCourse(); - //$session = $this->getSession(); - - // Adding course breadcrumb. - if (!empty($course)) { - $courseBreadcrumb = array( - 'name' => \Display::return_icon('home.png').' '.$course->getTitle(), - 'url' => array( - 'route' => 'course', - 'routeParameters' => array( - 'cidReq' => $course->getCode(), - 'id_session' => api_get_session_id() - ) - ) - ); - array_unshift($breadcrumbs, $courseBreadcrumb); - } - - $app = $this->app; - - $app['main_breadcrumb'] = function ($app) use ($breadcrumbs) { - /** @var \Knp\Menu\MenuItem $menu */ - $menu = $app['knp_menu.factory']->createItem( - 'root', - array( - 'childrenAttributes' => array( - 'class' => 'breadcrumb', - 'currentClass' => 'active' - ) - ) - ); - - if (!empty($breadcrumbs)) { - foreach ($breadcrumbs as $item) { - if (empty($item['url'])) { - $item['url'] = array(); - } - $menu->addChild($item['name'], $item['url']); - } - } - - return $menu; - }; - - $matcher = new Matcher(); - $voter = new \Knp\Menu\Silex\Voter\RouteVoter(); - $voter->setRequest($this->getRequest()); - $matcher->addVoter($voter); - $renderer = new \Knp\Menu\Renderer\TwigRenderer( - $this->get('twig'), - 'bread.tpl', - $matcher - ); - $bread = $renderer->render( - $this->get('main_breadcrumb'), - array( - 'template' => 'default/layout/bread.tpl' - ) - ); - $app['breadcrumbs'] = $bread; - } - - /** - * @return array - */ - public function menuList() - { - return array( - 'index', - 'users' => array( - 'list', 'add', 'edit', 'export', 'import', 'profiling', 'roles' - ), - 'courses' => array( - array( - 'list', - 'add', - 'edit', - 'export', - 'import', - 'add_users', - 'import_users', - 'course_categories', - 'extra_fields', - 'question_extra_fields' - ) - ), - 'sessions', - 'classes', - 'appearance', - 'plugins', - 'settings', - 'tools' - ); - } - - public function before(Request $request) - { - - } -} diff --git a/src/ChamiloLMS/Controller/LegacyController.php b/src/ChamiloLMS/Controller/LegacyController.php deleted file mode 100644 index e635687db7..0000000000 --- a/src/ChamiloLMS/Controller/LegacyController.php +++ /dev/null @@ -1,98 +0,0 @@ - - */ -class LegacyController extends BaseController -{ - public $section; - - /** - * Handles default Chamilo scripts handled by Display::display_header() and display_footer() - * - * @param \Silex\Application $app - * @param string $file - * - * @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response|void - */ - public function classicAction(Application $app, $file) - { - $responseHeaders = array(); - $request = $this->getRequest(); - - // get. - $_GET = $request->query->all(); - // post. - $_POST = $request->request->all(); - // echo $request->getMethod(); - - //$_REQUEST = $request->request->all(); - $mainPath = $app['paths']['sys_root'].'main/'; - - $fileToLoad = $mainPath.$file; - - if (is_file($fileToLoad) && - \Security::check_abs_path($fileToLoad, $mainPath) - ) { - $toolNameFromFile = basename(dirname($fileToLoad)); - - // Default values - $_course = api_get_course_info(); - $_user = api_get_user_info(); - $charset = 'UTF-8'; - $debug = $app['debug']; - $text_dir = api_get_text_direction(); - $is_platformAdmin = api_is_platform_admin(); - $_cid = api_get_course_id(); - - // Loading file - ob_start(); - require_once $mainPath.$file; - $out = ob_get_contents(); - ob_end_clean(); - - // No browser cache when executing an exercise. - if ($file == 'exercice/exercise_submit.php') { - $responseHeaders = array( - 'cache-control' => 'no-store, no-cache, must-revalidate' - ); - } - - // Setting page header/footer conditions (important for LPs) - $this->getTemplate()->setFooter($app['template.show_footer']); - $this->getTemplate()->setHeader($app['template.show_header']); - - if (isset($htmlHeadXtra)) { - $this->getTemplate()->addResource($htmlHeadXtra, 'string'); - } - // $interbreadcrumb is loaded in the require_once file. - $interbreadcrumb = isset($interbreadcrumb) ? $interbreadcrumb : null; - $this->getTemplate()->setBreadcrumb($interbreadcrumb); - $breadCrumb = $this->getTemplate()->getBreadCrumbLegacyArray(); - $menu = $this->parseLegacyBreadCrumb($breadCrumb); - $this->getTemplate()->assign('new_breadcrumb', $menu); - $this->getTemplate()->parseResources(); - - if (isset($tpl)) { - $response = $app['twig']->render($app['default_layout']); - } else { - $this->getTemplate()->assign('content', $out); - $response = $app['twig']->render($app['default_layout']); - } - } else { - return $app->abort(404, 'File not found'); - } - - return new Response($response, 200, $responseHeaders); - } -} diff --git a/src/ChamiloLMS/Command/Translation/ExportLanguagesCommand.php b/src/ChamiloLMS/CoreBundle/Command/Translation/ExportLanguagesCommand.php similarity index 98% rename from src/ChamiloLMS/Command/Translation/ExportLanguagesCommand.php rename to src/ChamiloLMS/CoreBundle/Command/Translation/ExportLanguagesCommand.php index 6b779ad087..6bfc2a0375 100644 --- a/src/ChamiloLMS/Command/Translation/ExportLanguagesCommand.php +++ b/src/ChamiloLMS/CoreBundle/Command/Translation/ExportLanguagesCommand.php @@ -1,7 +1,7 @@ getTargetUser(); /*var_dump($user ); var_dump($event->getRequest()->getUser()); diff --git a/src/ChamiloLMS/Component/Auth/LoginSuccessHandler.php b/src/ChamiloLMS/CoreBundle/Component/Auth/LoginSuccessHandler.php similarity index 97% rename from src/ChamiloLMS/Component/Auth/LoginSuccessHandler.php rename to src/ChamiloLMS/CoreBundle/Component/Auth/LoginSuccessHandler.php index 3a4e353794..f3f4734b0b 100644 --- a/src/ChamiloLMS/Component/Auth/LoginSuccessHandler.php +++ b/src/ChamiloLMS/CoreBundle/Component/Auth/LoginSuccessHandler.php @@ -1,6 +1,6 @@ connector->security->isGranted('IS_AUTHENTICATED_FULLY')) { - /** @var \ChamiloLMS\Entity\Repository\UserRepository $repository */ - /*$repository = $this->connector->entityManager->getRepository('ChamiloLMS\Entity\User'); + /** @var \ChamiloLMS\CoreBundle\Entity\Repository\UserRepository $repository */ + /*$repository = $this->connector->entityManager->getRepository('ChamiloLMS\CoreBundle\Entity\User'); $courses = $repository->getCourses($this->connector->user);*/ //if (!empty($courses)) { @@ -206,7 +206,7 @@ class DropBoxDriver extends \elFinderVolumeMySQL implements InterfaceDriver return $this->returnDirectory(); } - $file = $this->connector->entityManager->getRepository('ChamiloLMS\Entity\CDropboxFile')->findOneBy($criteria); + $file = $this->connector->entityManager->getRepository('ChamiloLMS\CoreBundle\Entity\CDropboxFile')->findOneBy($criteria); if ($file) { $stat = $this->transformFileInStat($file); diff --git a/src/ChamiloLMS/Component/Editor/Driver/HomeDriver.php b/src/ChamiloLMS/CoreBundle/Component/Editor/Driver/HomeDriver.php similarity index 91% rename from src/ChamiloLMS/Component/Editor/Driver/HomeDriver.php rename to src/ChamiloLMS/CoreBundle/Component/Editor/Driver/HomeDriver.php index ffaddaf30e..99f0fc1aaf 100644 --- a/src/ChamiloLMS/Component/Editor/Driver/HomeDriver.php +++ b/src/ChamiloLMS/CoreBundle/Component/Editor/Driver/HomeDriver.php @@ -1,11 +1,11 @@ */ class AdminController extends BaseController { /** - * @Route("/") + * @Route("/", name="administration") * @Method({"GET"}) * * @return Response @@ -29,16 +27,13 @@ class AdminController extends BaseController $template = $this->getTemplate(); $security = $this->getSecurity(); - if (!$security->isGranted($this->app['allow_admin_toolbar'])) { - return $this->abort(403, 'Access denied'); + if (!$security->isGranted('ROLE_ADMIN')) { + //return $this->abort(403, 'Access denied'); } if ($security->isGranted('ROLE_ADMIN')) { - $this->loadAdminMenu(); + return $this->loadAdminMenu(); } - $response = $template->renderTemplate('admin/index.tpl'); - - return new Response($response, 200, array()); } /** @@ -58,17 +53,9 @@ class AdminController extends BaseController */ private function loadAdminMenu() { - $template = $this->get('template'); - // Access restrictions. api_protect_admin_script(true); - // @todo fix register/check version - $message = null; - if (!empty($_POST['Register'])) { - register_site(); - $message = \Display::return_message(get_lang('VersionCheckEnabled'), 'confirmation'); - } $adminUrl = api_get_path(WEB_CODE_PATH).'admin/'; $blocks = array(); @@ -273,7 +260,13 @@ class AdminController extends BaseController } $admin_ajax_url = api_get_path(WEB_AJAX_PATH).'admin.ajax.php'; - $template->assign('web_admin_ajax_url', $admin_ajax_url); - $template->assign('blocks', $blocks); + + return $this->render( + 'ChamiloLMSCoreBundle:Admin:index.html.twig', + array( + 'blocks' => $blocks, + 'web_admin_ajax_url' => $admin_ajax_url + ) + ); } } diff --git a/src/ChamiloLMS/Controller/Admin/Administrator/BranchController.php b/src/ChamiloLMS/CoreBundle/Controller/Admin/Administrator/BranchController.php similarity index 92% rename from src/ChamiloLMS/Controller/Admin/Administrator/BranchController.php rename to src/ChamiloLMS/CoreBundle/Controller/Admin/Administrator/BranchController.php index c76f1e1b66..51ec0d40a0 100644 --- a/src/ChamiloLMS/Controller/Admin/Administrator/BranchController.php +++ b/src/ChamiloLMS/CoreBundle/Controller/Admin/Administrator/BranchController.php @@ -1,36 +1,36 @@ */ class BranchController extends CrudController { public function getClass() { - return 'ChamiloLMS\Entity\BranchSync'; + return 'ChamiloLMS\CoreBundle\Entity\BranchSync'; } public function getType() { - return 'ChamiloLMS\Form\BranchType'; + return 'ChamiloLMS\CoreBundle\Form\BranchType'; } public function getControllerAlias() @@ -76,7 +76,7 @@ class BranchController extends CrudController $query = $this->getManager() ->createQueryBuilder() ->select('node') - ->from('ChamiloLMS\Entity\BranchSync', 'node') + ->from('ChamiloLMS\CoreBundle\Entity\BranchSync', 'node') //->where('node.cId = 0') ->orderBy('node.root, node.lft', 'ASC') ->getQuery(); @@ -108,7 +108,7 @@ class BranchController extends CrudController $userIdList = $item->getUserId(); $userId = ($userIdList[0]); - $user = $this->getManager()->getRepository('ChamiloLMS\Entity\User')->find($userId); + $user = $this->getManager()->getRepository('ChamiloLMS\CoreBundle\Entity\User')->find($userId); if (!$user) { throw new \Exception('Unable to found User'); } @@ -151,7 +151,7 @@ class BranchController extends CrudController 'branchId' => $id, 'userId' => $userId ); - $branchUser = $this->getManager()->getRepository('ChamiloLMS\Entity\BranchUsers')->findOneBy($criteria); + $branchUser = $this->getManager()->getRepository('ChamiloLMS\CoreBundle\Entity\BranchUsers')->findOneBy($criteria); if (!$branchUser) { $this->createNotFoundException(); @@ -174,7 +174,7 @@ class BranchController extends CrudController $template = $this->get('template'); $template->assign('links', $this->generateLinks()); - /** @var \ChamiloLMS\Entity\Repository\BranchSyncRepository $repo */ + /** @var \ChamiloLMS\CoreBundle\Entity\Repository\BranchSyncRepository $repo */ $repo = $this->getRepository(); $item = $this->getEntity($id); diff --git a/src/ChamiloLMS/Controller/Admin/Administrator/JuryController.php b/src/ChamiloLMS/CoreBundle/Controller/Admin/Administrator/JuryController.php similarity index 84% rename from src/ChamiloLMS/Controller/Admin/Administrator/JuryController.php rename to src/ChamiloLMS/CoreBundle/Controller/Admin/Administrator/JuryController.php index a3b1a04c1f..bf17d11e59 100644 --- a/src/ChamiloLMS/Controller/Admin/Administrator/JuryController.php +++ b/src/ChamiloLMS/CoreBundle/Controller/Admin/Administrator/JuryController.php @@ -1,32 +1,32 @@ */ class JuryController extends CrudController { public function getClass() { - return 'ChamiloLMS\Entity\Jury'; + return 'ChamiloLMS\CoreBundle\Entity\Jury'; } public function getControllerAlias() @@ -39,7 +39,7 @@ class JuryController extends CrudController */ public function getType() { - return 'ChamiloLMS\Form\JuryType'; + return 'ChamiloLMS\CoreBundle\Form\JuryType'; } /** @@ -73,7 +73,7 @@ class JuryController extends CrudController */ public function removeMemberAction($id) { - $juryMembers = $this->getManager()->getRepository('ChamiloLMS\Entity\JuryMembers')->find($id); + $juryMembers = $this->getManager()->getRepository('ChamiloLMS\CoreBundle\Entity\JuryMembers')->find($id); if ($juryMembers) { $em = $this->getManager(); $em->remove($juryMembers); @@ -95,8 +95,8 @@ class JuryController extends CrudController $keyword = $request->get('tag'); $role = $request->get('role'); - /** @var \ChamiloLMS\Entity\Repository\UserRepository $repo */ - $repo = $this->getManager()->getRepository('ChamiloLMS\Entity\User'); + /** @var \ChamiloLMS\CoreBundle\Entity\Repository\UserRepository $repo */ + $repo = $this->getManager()->getRepository('ChamiloLMS\CoreBundle\Entity\User'); if (empty($role)) { $entities = $repo->searchUserByKeyword($keyword); @@ -106,7 +106,7 @@ class JuryController extends CrudController $data = array(); if ($entities) { - /** @var \ChamiloLMS\Entity\User $entity */ + /** @var \ChamiloLMS\CoreBundle\Entity\User $entity */ foreach ($entities as $entity) { $data[] = array( 'key' => (string) $entity->getUserId(), @@ -136,7 +136,7 @@ class JuryController extends CrudController $userIdList = $item->getUserId(); $userId = ($userIdList[0]); - $user = $this->getManager()->getRepository('ChamiloLMS\Entity\User')->find($userId); + $user = $this->getManager()->getRepository('ChamiloLMS\CoreBundle\Entity\User')->find($userId); if (!$user) { throw new \Exception('Unable to found User'); } diff --git a/src/ChamiloLMS/Controller/Admin/Administrator/QuestionScoreController.php b/src/ChamiloLMS/CoreBundle/Controller/Admin/Administrator/QuestionScoreController.php similarity index 76% rename from src/ChamiloLMS/Controller/Admin/Administrator/QuestionScoreController.php rename to src/ChamiloLMS/CoreBundle/Controller/Admin/Administrator/QuestionScoreController.php index edd8b1346b..758af6758b 100644 --- a/src/ChamiloLMS/Controller/Admin/Administrator/QuestionScoreController.php +++ b/src/ChamiloLMS/CoreBundle/Controller/Admin/Administrator/QuestionScoreController.php @@ -1,29 +1,39 @@ + * @Route("/question_score") */ class QuestionScoreController extends CrudController { + /** + * + * @Route("/") + * @Method({"GET"}) + */ + public function indexAction() + { + + } public function getClass() { - return 'ChamiloLMS\Entity\BranchSync'; + return 'ChamiloLMS\CoreBundle\Entity\BranchSync'; } public function getType() { - return 'ChamiloLMS\Form\QuestionScoreType'; + return 'ChamiloLMS\CoreBundle\Form\QuestionScoreType'; } /** diff --git a/src/ChamiloLMS/Controller/Admin/Administrator/QuestionScoreNameController.php b/src/ChamiloLMS/CoreBundle/Controller/Admin/Administrator/QuestionScoreNameController.php similarity index 54% rename from src/ChamiloLMS/Controller/Admin/Administrator/QuestionScoreNameController.php rename to src/ChamiloLMS/CoreBundle/Controller/Admin/Administrator/QuestionScoreNameController.php index 2c81d8a410..d7c5970327 100644 --- a/src/ChamiloLMS/Controller/Admin/Administrator/QuestionScoreNameController.php +++ b/src/ChamiloLMS/CoreBundle/Controller/Admin/Administrator/QuestionScoreNameController.php @@ -1,15 +1,16 @@ */ @@ -17,12 +18,12 @@ class QuestionScoreNameController extends CrudController { public function getClass() { - return 'ChamiloLMS\Entity\QuestionScoreName'; + return 'ChamiloLMS\CoreBundle\Entity\QuestionScoreName'; } public function getType() { - return 'ChamiloLMS\Form\QuestionScoreNameType'; + return 'ChamiloLMS\CoreBundle\Form\QuestionScoreNameType'; } public function getControllerAlias() diff --git a/src/ChamiloLMS/Controller/Admin/Administrator/RoleController.php b/src/ChamiloLMS/CoreBundle/Controller/Admin/Administrator/RoleController.php similarity index 65% rename from src/ChamiloLMS/Controller/Admin/Administrator/RoleController.php rename to src/ChamiloLMS/CoreBundle/Controller/Admin/Administrator/RoleController.php index b59c9d58c3..d24749a3e8 100644 --- a/src/ChamiloLMS/Controller/Admin/Administrator/RoleController.php +++ b/src/ChamiloLMS/CoreBundle/Controller/Admin/Administrator/RoleController.php @@ -1,14 +1,14 @@ */ class RoleController extends CrudController @@ -18,7 +18,7 @@ class RoleController extends CrudController */ public function getClass() { - return 'ChamiloLMS\Entity\Role'; + return 'ChamiloLMS\CoreBundle\Entity\Role'; } /** @@ -26,7 +26,7 @@ class RoleController extends CrudController */ public function getType() { - return 'ChamiloLMS\Form\RoleType'; + return 'ChamiloLMS\CoreBundle\Form\RoleType'; } /** diff --git a/src/ChamiloLMS/Controller/Admin/Administrator/UpgradeController.php b/src/ChamiloLMS/CoreBundle/Controller/Admin/Administrator/UpgradeController.php similarity index 96% rename from src/ChamiloLMS/Controller/Admin/Administrator/UpgradeController.php rename to src/ChamiloLMS/CoreBundle/Controller/Admin/Administrator/UpgradeController.php index 67b34c2769..b31e6c17c2 100644 --- a/src/ChamiloLMS/Controller/Admin/Administrator/UpgradeController.php +++ b/src/ChamiloLMS/CoreBundle/Controller/Admin/Administrator/UpgradeController.php @@ -1,13 +1,13 @@ */ class UpgradeController extends BaseController diff --git a/src/ChamiloLMS/Controller/Admin/Director/BranchDirectorController.php b/src/ChamiloLMS/CoreBundle/Controller/Admin/Director/BranchDirectorController.php similarity index 85% rename from src/ChamiloLMS/Controller/Admin/Director/BranchDirectorController.php rename to src/ChamiloLMS/CoreBundle/Controller/Admin/Director/BranchDirectorController.php index 4719e91779..0792e6d4e5 100644 --- a/src/ChamiloLMS/Controller/Admin/Director/BranchDirectorController.php +++ b/src/ChamiloLMS/CoreBundle/Controller/Admin/Director/BranchDirectorController.php @@ -1,38 +1,39 @@ */ class BranchDirectorController extends CrudController { public function getClass() { - return 'ChamiloLMS\Entity\BranchSync'; + return 'ChamiloLMS\CoreBundle\Entity\BranchSync'; } public function getType() { - return 'ChamiloLMS\Form\DirectorJuryUserType'; + return 'ChamiloLMS\CoreBundle\Form\DirectorJuryUserType'; } - protected function getControllerAlias() + public function getControllerAlias() { return 'branch_director.controller'; } @@ -40,7 +41,7 @@ class BranchDirectorController extends CrudController /** * {@inheritdoc} */ - protected function getTemplatePath() + public function getTemplatePath() { return 'admin/director/branches/'; } @@ -61,7 +62,7 @@ class BranchDirectorController extends CrudController 'childClose' => '', 'nodeDecorator' => function ($row) { /** @var BranchSync $branch */ - $branch = $this->getManager()->getRepository('ChamiloLMS\Entity\BranchSync')->find($row['id']); + $branch = $this->getManager()->getRepository('ChamiloLMS\CoreBundle\Entity\BranchSync')->find($row['id']); $juries = $branch->getJuries(); /** @var Jury $jury */ $juryList = null; @@ -91,7 +92,7 @@ class BranchDirectorController extends CrudController $query = $this->getManager() ->createQueryBuilder() ->select('node') - ->from('ChamiloLMS\Entity\BranchSync', 'node') + ->from('ChamiloLMS\CoreBundle\Entity\BranchSync', 'node') ->innerJoin('node.users', 'u') ->where('u.userId = :userId') ->setParameter('userId', $userId) @@ -161,7 +162,7 @@ class BranchDirectorController extends CrudController $form->handleRequest($request); if ($form->isValid()) { - $jury = $this->getManager()->getRepository('ChamiloLMS\Entity\Jury')->find($juryId); + $jury = $this->getManager()->getRepository('ChamiloLMS\CoreBundle\Entity\Jury')->find($juryId); $factory = $this->get('security.encoder_factory'); $encoder = $factory->getEncoder($user); diff --git a/src/ChamiloLMS/Controller/Admin/JuryMember/JuryMemberController.php b/src/ChamiloLMS/CoreBundle/Controller/Admin/JuryMember/JuryMemberController.php similarity index 91% rename from src/ChamiloLMS/Controller/Admin/JuryMember/JuryMemberController.php rename to src/ChamiloLMS/CoreBundle/Controller/Admin/JuryMember/JuryMemberController.php index d23efb8c59..689e4056c0 100644 --- a/src/ChamiloLMS/Controller/Admin/JuryMember/JuryMemberController.php +++ b/src/ChamiloLMS/CoreBundle/Controller/Admin/JuryMember/JuryMemberController.php @@ -1,14 +1,14 @@ */ class JuryMemberController extends CrudController @@ -26,7 +26,7 @@ class JuryMemberController extends CrudController public function getClass() { - return 'ChamiloLMS\Entity\Jury'; + return 'ChamiloLMS\CoreBundle\Entity\Jury'; } public function getControllerAlias() @@ -48,7 +48,7 @@ class JuryMemberController extends CrudController */ public function getType() { - return 'ChamiloLMS\Form\JuryType'; + return 'ChamiloLMS\CoreBundle\Form\JuryType'; } /** @@ -147,7 +147,7 @@ class JuryMemberController extends CrudController $this->createNotFoundException(); } - /** @var \ChamiloLMS\Entity\Jury $jury */ + /** @var \ChamiloLMS\CoreBundle\Entity\Jury $jury */ $jury = $this->getRepository()->find($juryId); if (empty($jury)) { @@ -190,7 +190,7 @@ class JuryMemberController extends CrudController if ($security->isGranted('ROLE_JURY_PRESIDENT')) { // Relating user with president if ($member) { - $this->getManager()->getRepository('ChamiloLMS\Entity\JuryMembers')->assignUserToJuryMember( + $this->getManager()->getRepository('ChamiloLMS\CoreBundle\Entity\JuryMembers')->assignUserToJuryMember( $trackExercise['exe_user_id'], $member->getId() ); @@ -204,7 +204,7 @@ class JuryMemberController extends CrudController 'juryUserId' => $userId ); - $trackJury = $this->getManager()->getRepository('ChamiloLMS\Entity\TrackExerciseAttemptJury')->findBy($criteria); + $trackJury = $this->getManager()->getRepository('ChamiloLMS\CoreBundle\Entity\TrackExerciseAttemptJury')->findBy($criteria); if ($trackJury) { $this->get('session')->getFlashBag()->add('info', "You already review this exercise attempt."); @@ -232,11 +232,11 @@ class JuryMemberController extends CrudController $options = array(); if ($modelType) { - /** @var \ChamiloLMS\Entity\QuestionScore $questionScoreName */ - $questionScore = $this->get('orm.em')->getRepository('ChamiloLMS\Entity\QuestionScore')->find($modelType); + /** @var \ChamiloLMS\CoreBundle\Entity\QuestionScore $questionScoreName */ + $questionScore = $this->get('orm.em')->getRepository('ChamiloLMS\CoreBundle\Entity\QuestionScore')->find($modelType); if ($questionScore) { $items = $questionScore->getItems(); - /** @var \ChamiloLMS\Entity\QuestionScoreName $score */ + /** @var \ChamiloLMS\CoreBundle\Entity\QuestionScoreName $score */ foreach ($items as $score) { $options[$score->getId().':'.$score->getScore()] = $score; } @@ -349,8 +349,8 @@ class JuryMemberController extends CrudController public function saveScoreAction($exeId, $juryId) { $questionsAndScore = $this->getRequest()->get('options'); - /** @var \ChamiloLMS\Entity\TrackExercise $attempt */ - $attempt = $this->getManager()->getRepository('ChamiloLMS\Entity\TrackExercise')->find($exeId); + /** @var \ChamiloLMS\CoreBundle\Entity\TrackExercise $attempt */ + $attempt = $this->getManager()->getRepository('ChamiloLMS\CoreBundle\Entity\TrackExercise')->find($exeId); $totalScore = 0; @@ -372,7 +372,7 @@ class JuryMemberController extends CrudController $totalScore += $score; - $obj = $this->getManager()->getRepository('ChamiloLMS\Entity\TrackExerciseAttemptJury')->findOneBy($criteria); + $obj = $this->getManager()->getRepository('ChamiloLMS\CoreBundle\Entity\TrackExerciseAttemptJury')->findOneBy($criteria); if ($obj) { $obj->setQuestionScoreNameId($questionScoreNameId); $obj->setScore($score); diff --git a/src/ChamiloLMS/Controller/Admin/JuryPresident/JuryPresidentController.php b/src/ChamiloLMS/CoreBundle/Controller/Admin/JuryPresident/JuryPresidentController.php similarity index 91% rename from src/ChamiloLMS/Controller/Admin/JuryPresident/JuryPresidentController.php rename to src/ChamiloLMS/CoreBundle/Controller/Admin/JuryPresident/JuryPresidentController.php index 8b67c5d440..500a90f33d 100644 --- a/src/ChamiloLMS/Controller/Admin/JuryPresident/JuryPresidentController.php +++ b/src/ChamiloLMS/CoreBundle/Controller/Admin/JuryPresident/JuryPresidentController.php @@ -1,15 +1,15 @@ */ class JuryPresidentController extends CrudController @@ -32,12 +32,12 @@ class JuryPresidentController extends CrudController public function getClass() { - return 'ChamiloLMS\Entity\BranchSync'; + return 'ChamiloLMS\CoreBundle\Entity\BranchSync'; } public function getType() { - return 'ChamiloLMS\Form\JuryType'; + return 'ChamiloLMS\CoreBundle\Form\JuryType'; } public function getControllerAlias() @@ -138,7 +138,7 @@ class JuryPresidentController extends CrudController */ public function assignUserToJuryMemberAction($userId, $juryMemberId) { - return $this->getManager()->getRepository('ChamiloLMS\Entity\JuryMembers')->assignUserToJuryMember($userId, $juryMemberId); + return $this->getManager()->getRepository('ChamiloLMS\CoreBundle\Entity\JuryMembers')->assignUserToJuryMember($userId, $juryMemberId); } /** @@ -147,7 +147,7 @@ class JuryPresidentController extends CrudController */ public function removeUserToJuryMemberAction($userId, $juryMemberId) { - return $this->getManager()->getRepository('ChamiloLMS\Entity\JuryMembers')->removeUserToJuryMember($userId, $juryMemberId); + return $this->getManager()->getRepository('ChamiloLMS\CoreBundle\Entity\JuryMembers')->removeUserToJuryMember($userId, $juryMemberId); } /** @@ -205,7 +205,7 @@ class JuryPresidentController extends CrudController $randomMembers = array_rand($members, $maxCount); foreach ($randomMembers as $randomMember) { $member = $members[$randomMember]; - $this->getManager()->getRepository('ChamiloLMS\Entity\JuryMembers')->assignUserToJuryMember($userId, $member->getId()); + $this->getManager()->getRepository('ChamiloLMS\CoreBundle\Entity\JuryMembers')->assignUserToJuryMember($userId, $member->getId()); } } $this->get('session')->getFlashBag()->add('success', "Los usuarios fueron asignados al azar"); diff --git a/src/ChamiloLMS/Controller/Admin/QuestionManager/QuestionManagerController.php b/src/ChamiloLMS/CoreBundle/Controller/Admin/QuestionManager/QuestionManagerController.php similarity index 94% rename from src/ChamiloLMS/Controller/Admin/QuestionManager/QuestionManagerController.php rename to src/ChamiloLMS/CoreBundle/Controller/Admin/QuestionManager/QuestionManagerController.php index 97591d9a5e..421c72da1d 100644 --- a/src/ChamiloLMS/Controller/Admin/QuestionManager/QuestionManagerController.php +++ b/src/ChamiloLMS/CoreBundle/Controller/Admin/QuestionManager/QuestionManagerController.php @@ -1,9 +1,9 @@ */ class QuestionManagerController extends BaseController @@ -98,7 +98,7 @@ class QuestionManagerController extends BaseController public function getCategoriesAction($id) { // Getting CQuizCategory repo. - $repo = $this->getManager()->getRepository('ChamiloLMS\Entity\CQuizCategory'); + $repo = $this->getManager()->getRepository('ChamiloLMS\CoreBundle\Entity\CQuizCategory'); $options = array( 'decorate' => true, @@ -143,9 +143,9 @@ class QuestionManagerController extends BaseController // Getting CQuizCategory repo. /** @var \Doctrine\ORM\EntityManager $em */ $em = $this->getManager(); - $repo = $em->getRepository('ChamiloLMS\Entity\CQuizCategory'); + $repo = $em->getRepository('ChamiloLMS\CoreBundle\Entity\CQuizCategory'); - /** @var \ChamiloLMS\Entity\CQuizCategory $category */ + /** @var \ChamiloLMS\CoreBundle\Entity\CQuizCategory $category */ $category = $repo->find($categoryId); $questionColumns = \Question::getQuestionColumns(); @@ -219,7 +219,7 @@ class QuestionManagerController extends BaseController // Getting CQuizCategory repo. /** @var \Gedmo\Tree\Entity\Repository\NestedTreeRepository $repo */ - $repo = $this->getManager()->getRepository('ChamiloLMS\Entity\CQuizCategory'); + $repo = $this->getManager()->getRepository('ChamiloLMS\CoreBundle\Entity\CQuizCategory'); $categoryId = $this->getRequest()->get('categoryId'); $subtree = null; @@ -271,7 +271,7 @@ class QuestionManagerController extends BaseController $qb = $this->getManager()->createQueryBuilder() ->select('node') - ->from('ChamiloLMS\Entity\CQuizCategory', 'node') + ->from('ChamiloLMS\CoreBundle\Entity\CQuizCategory', 'node') ->where('node.cId <> 0 AND node.lvl = 0') ->orderBy('node.root, node.lft', 'ASC'); @@ -286,7 +286,7 @@ class QuestionManagerController extends BaseController $query = $this->getManager() ->createQueryBuilder() ->select('node') - ->from('ChamiloLMS\Entity\CQuizCategory', 'node') + ->from('ChamiloLMS\CoreBundle\Entity\CQuizCategory', 'node') ->where('node.cId = 0 AND node.lvl = 0') ->orderBy('node.root, node.lft', 'ASC') ->getQuery(); @@ -395,7 +395,7 @@ class QuestionManagerController extends BaseController */ public function deleteCategoryAction($id) { - $repo = $this->getManager()->getRepository('ChamiloLMS\Entity\CQuizCategory'); + $repo = $this->getManager()->getRepository('ChamiloLMS\CoreBundle\Entity\CQuizCategory'); $category = $repo->find($id); if (empty($category)) { $this->abort(404); diff --git a/src/ChamiloLMS/Controller/App/Certificate/CertificateController.php b/src/ChamiloLMS/CoreBundle/Controller/App/Certificate/CertificateController.php similarity index 75% rename from src/ChamiloLMS/Controller/App/Certificate/CertificateController.php rename to src/ChamiloLMS/CoreBundle/Controller/App/Certificate/CertificateController.php index af7d5c406f..0518f43929 100644 --- a/src/ChamiloLMS/Controller/App/Certificate/CertificateController.php +++ b/src/ChamiloLMS/CoreBundle/Controller/App/Certificate/CertificateController.php @@ -1,15 +1,15 @@ */ class CertificateController extends BaseController diff --git a/src/ChamiloLMS/Controller/App/Editor/EditorController.php b/src/ChamiloLMS/CoreBundle/Controller/App/Editor/EditorController.php similarity index 87% rename from src/ChamiloLMS/Controller/App/Editor/EditorController.php rename to src/ChamiloLMS/CoreBundle/Controller/App/Editor/EditorController.php index 810cdea211..816127ba14 100644 --- a/src/ChamiloLMS/Controller/App/Editor/EditorController.php +++ b/src/ChamiloLMS/CoreBundle/Controller/App/Editor/EditorController.php @@ -1,17 +1,17 @@ getManager()->getRepository('ChamiloLMS\Entity\SystemTemplate')->findAll(); + $templates = $this->getManager()->getRepository('ChamiloLMS\CoreBundle\Entity\SystemTemplate')->findAll(); $templates = $this->getHtmlEditor()->formatTemplates($templates); $this->getTemplate()->assign('templates', $templates); $response = $this->getTemplate()->renderTemplate('javascript/editor/ckeditor/templates.tpl'); diff --git a/src/ChamiloLMS/Controller/App/ModelAjax/ModelAjaxController.php b/src/ChamiloLMS/CoreBundle/Controller/App/ModelAjax/ModelAjaxController.php similarity index 99% rename from src/ChamiloLMS/Controller/App/ModelAjax/ModelAjaxController.php rename to src/ChamiloLMS/CoreBundle/Controller/App/ModelAjax/ModelAjaxController.php index 4603dabcf6..d402414cf1 100644 --- a/src/ChamiloLMS/Controller/App/ModelAjax/ModelAjaxController.php +++ b/src/ChamiloLMS/CoreBundle/Controller/App/ModelAjax/ModelAjaxController.php @@ -1,14 +1,14 @@ */ class ModelAjaxController diff --git a/src/ChamiloLMS/Controller/App/News/NewsController.php b/src/ChamiloLMS/CoreBundle/Controller/App/News/NewsController.php similarity index 92% rename from src/ChamiloLMS/Controller/App/News/NewsController.php rename to src/ChamiloLMS/CoreBundle/Controller/App/News/NewsController.php index 34d98ff0aa..fac7d44c02 100644 --- a/src/ChamiloLMS/Controller/App/News/NewsController.php +++ b/src/ChamiloLMS/CoreBundle/Controller/App/News/NewsController.php @@ -1,9 +1,9 @@ */ class NewsController extends BaseController diff --git a/src/ChamiloLMS/Controller/App/SessionPath/SessionPathController.php b/src/ChamiloLMS/CoreBundle/Controller/App/SessionPath/SessionPathController.php similarity index 86% rename from src/ChamiloLMS/Controller/App/SessionPath/SessionPathController.php rename to src/ChamiloLMS/CoreBundle/Controller/App/SessionPath/SessionPathController.php index c37d0481a8..7272e9a333 100644 --- a/src/ChamiloLMS/Controller/App/SessionPath/SessionPathController.php +++ b/src/ChamiloLMS/CoreBundle/Controller/App/SessionPath/SessionPathController.php @@ -1,17 +1,17 @@ get('orm.em')->getRepository('ChamiloLMS\Entity\SessionTree'); + $repo = $this->get('orm.em')->getRepository('ChamiloLMS\CoreBundle\Entity\SessionTree'); $query = $this->getManager() ->createQueryBuilder() ->select('node') - ->from('ChamiloLMS\Entity\SessionTree', 'node') + ->from('ChamiloLMS\CoreBundle\Entity\SessionTree', 'node') //->where('node.cId = 0') ->orderBy('node.root, node.lft', 'ASC') ->getQuery(); diff --git a/src/ChamiloLMS/Controller/App/SessionPath/SessionTreeController.php b/src/ChamiloLMS/CoreBundle/Controller/App/SessionPath/SessionTreeController.php similarity index 72% rename from src/ChamiloLMS/Controller/App/SessionPath/SessionTreeController.php rename to src/ChamiloLMS/CoreBundle/Controller/App/SessionPath/SessionTreeController.php index 9c73356327..6715ff84c0 100644 --- a/src/ChamiloLMS/Controller/App/SessionPath/SessionTreeController.php +++ b/src/ChamiloLMS/CoreBundle/Controller/App/SessionPath/SessionTreeController.php @@ -1,17 +1,17 @@ container->get('security.context'); + } + + public function getSessionHandler() + { + return $this->getRequest()->getSession(); + } + + /** + * @return object + */ + public function getTemplate() + { + return $this->container->get('templating'); + } + + /** + * @return NotFoundHttpException + */ + public function abort() + { + return new NotFoundHttpException(); + } + + /** + * Converts string 'ChamiloLMS\CoreBundle\Controller\Admin\QuestionManager' into + * 'admin/question_manager' + */ + public function getTemplatePath() + { + $parts = $this->classParts; + + $newPath = array(); + foreach ($parts as $part) { + if (in_array($part, array('chamilo_lms', 'controller')) + //strpos($part, '_controller') > 0 + ) { + continue; + } + $newPath[] = $part; + } + + $template = implode('/', $newPath); + return str_replace('_controller', '', $template); + } + + /** + * Transforms 'QuestionManagerController' to 'question_manager.controller' + * @return string + */ + public function getControllerAlias() + { + $parts = $this->classParts; + $parts = array_reverse($parts); + $alias = str_replace('_controller', '.controller', $parts[0]); + return $alias; + } + + /** + * Translator shortcut + * @param string $variable + * @return string + */ + public function trans($variable) + { + return $this->container->get('translator')->trans($variable); + } + + /** + * Returns the class name label + * @example RoleController -> Role + * + * @return string the class name label + */ + public function getClassNameLabel() + { + return $this->classNameLabel; + } + + /** + * @return MenuFactoryInterface + */ + public function getMenuFactory() + { + return $this->container->get('knp_menu.factory'); + } + + /** + * @param string $action + * @return MenuItemInterface + */ + protected function getBreadcrumbs($action) + { + $breadcrumbs = $this->buildBreadcrumbs($action); + + return $breadcrumbs; + } + + /** Main home URL + * @return MenuItemInterface + */ + protected function getHomeBreadCrumb() + { + $menu = $this->getMenuFactory()->createItem( + 'root', + array( + 'childrenAttributes' => array( + 'class' => 'breadcrumb', + 'currentClass' => 'active' + ) + ) + ); + + $menu->addChild( + $this->trans('Home'), + array('uri' => $this->generateUrl('home')) + ); + + return $menu; + } + + /** + * @param $action + * @param MenuItemInterface $menu + * @return MenuItemInterface + */ + public function buildBreadcrumbs($action, MenuItemInterface $menu = null) + { + if (!$menu) { + $menu = $this->getHomeBreadCrumb(); + } + + $menu->addChild( + $this->trans($this->getClassnameLabel().'List'), + array('uri' => $this->generateControllerUrl('listingAction')) + ); + + $action = str_replace( + array($this->getControllerAlias().':', 'Action'), + '', + $action + ); + + switch ($action) { + case 'add': + case 'edit': + $menu->addChild( + $this->trans($this->getClassnameLabel().ucfirst($action)) + //array('uri' => $this->generateControllerUrl($action.'Action')) + ); + break; + } + + return $menu; + } + + /** + * @param array $breadCrumbList + * @return string + */ + protected function parseLegacyBreadCrumb($breadCrumbList = array()) + { + $menu = $this->getHomeBreadCrumb(); + foreach ($breadCrumbList as $item) { + $menu->addChild( + $this->trans($item['title']), + array('uri' => $item['url']) + ); + } + + $renderer = new ListRenderer(new \Knp\Menu\Matcher\Matcher()); + $result = $renderer->render($menu); + + return $result; + } + + /** + * Renders the current controller template + * @param string $name + * @param array $elements + * @return mixed + */ + public function renderTemplate($name, $elements = array()) + { + $name = $this->getTemplatePath().'/'.$name; + + $renderer = new ListRenderer(new \Knp\Menu\Matcher\Matcher()); + $action = $this->getRequest()->get('_route'); + $result = $renderer->render($this->getBreadcrumbs($action)); + $elements['new_breadcrumb'] = $result; + + return $this->getTemplate()->renderTemplate($name, $elements); + } + + +} diff --git a/src/ChamiloLMS/Controller/CrudController.php b/src/ChamiloLMS/CoreBundle/Controller/CrudController.php similarity index 92% rename from src/ChamiloLMS/Controller/CrudController.php rename to src/ChamiloLMS/CoreBundle/Controller/CrudController.php index b86f35e836..782959a50e 100644 --- a/src/ChamiloLMS/Controller/CrudController.php +++ b/src/ChamiloLMS/CoreBundle/Controller/CrudController.php @@ -1,7 +1,7 @@ getRepository()->createQueryBuilder('e'); + $query = $qb->getQuery(); + + $source = new \Exporter\Source\DoctrineORMQuerySourceIterator($query, array('id')); + + // Prepare the writer + $writer = new \Exporter\Writer\CsvWriter('data2.csv'); + + $filename = sprintf('export_%s_%s.%s', + strtolower(substr($this->getClassNameLabel(), strripos($this->getClassNameLabel(), '\\') + 1)), + date('Y_m_d_H_i_s', strtotime('now')), + $format + ); + + + return $this->get('exporter')->getResponse( + $format, + $filename, + $this->getDataSourceIterator() + ); + } + + public function getDataSourceIterator() + { + + } + /** * Base "read" action. * @@ -288,6 +321,7 @@ abstract class CrudController extends BaseController implements CrudControllerIn return $this->getList($format); } + /** * @param string $format * @return JsonResponse diff --git a/src/ChamiloLMS/Controller/CrudControllerInterface.php b/src/ChamiloLMS/CoreBundle/Controller/CrudControllerInterface.php similarity index 72% rename from src/ChamiloLMS/Controller/CrudControllerInterface.php rename to src/ChamiloLMS/CoreBundle/Controller/CrudControllerInterface.php index edef22e20f..68d09bb6a3 100644 --- a/src/ChamiloLMS/Controller/CrudControllerInterface.php +++ b/src/ChamiloLMS/CoreBundle/Controller/CrudControllerInterface.php @@ -1,22 +1,22 @@ + * Class IndexController + * author Julio Montoya + * @package ChamiloLMS\CoreBundle\Controller */ class IndexController extends BaseController { /** - * @Route("/index") + * @Route("/index", name="index") + * @Route("/") * @Method({"GET"}) * @return Response */ public function indexAction() { - $template = $this->getTemplate(); + return $this->render( + 'ChamiloLMSCoreBundle:Index:index.html.twig', + array('content' => 'julio') + ); + //$template = $this->get('templating'); // $countries = Intl::getRegionBundle()->getCountryNames('es'); //var_dump($countries); @@ -35,28 +44,21 @@ class IndexController extends BaseController echo $formatter->format(time());*/ $extra = array(); - if ($this->getSetting('use_virtual_keyboard') == 'true') { + /* if ($this->getSetting('use_virtual_keyboard') == 'true') { $extra[] = api_get_css(api_get_path(WEB_LIBRARY_JS_PATH).'keyboard/keyboard.css'); $extra[] = api_get_js('keyboard/jquery.keyboard.js'); - } + }*/ - $template->addResource(api_get_jqgrid_js(), 'string'); + //$template->addResource(api_get_jqgrid_js(), 'string'); - $this->app['this_section'] = SECTION_CAMPUS; + //$this->app['this_section'] = SECTION_CAMPUS; /** @var \PageController $pageController */ - $pageController = $this->get('page_controller'); + //$pageController = $this->get('page_controller'); if (api_get_setting('display_categories_on_homepage') == 'true') { - $template->assign('course_category_block', $pageController->return_courses_in_categories()); + //$template->assign('course_category_block', $pageController->return_courses_in_categories()); } - - // @todo Custom Facebook connection lib could be replaced with opauth - // Facebook connection, if activated - if (api_is_facebook_auth_activated() && !api_get_user_id()) { - facebook_connect(); - } - $this->setLoginForm(); if (!api_is_anonymous()) { @@ -402,7 +404,7 @@ class IndexController extends BaseController } /** - * @Route("/userportal") + * @Route("/userportal", name="userportal") * @Method({"GET"}) * * @param string $type courses|sessions|mycoursecategories @@ -412,21 +414,18 @@ class IndexController extends BaseController */ public function userPortalAction($type = 'courses', $filter = 'current', $page = 1) { - // @todo Use filters like "after/before|finish" to manage user access api_block_anonymous_users(); - // Abort request because the user is not allowed here - @todo use filters - if ($this->app['allowed'] == false) { + /*if ($this->app['allowed'] == false) { return $this->abort(403, 'Not allowed'); - } + }*/ // Main courses and session list $items = null; $type = str_replace('/', '', $type); - /** @var \PageController $pageController */ - $pageController = $this->get('page_controller'); + $pageController = new \ChamiloLMS\CoreBundle\Framework\PageController(); switch ($type) { case 'sessions': @@ -459,26 +458,27 @@ class IndexController extends BaseController return $menu; }; $app['knp_menu.menus'] = array('main' => 'my_main_menu');*/ - $template->assign('content', $items); - $pageController->setCourseSessionMenu(); + /*$pageController->setCourseSessionMenu(); $pageController->setProfileBlock(); $pageController->setUserImageBlock(); $pageController->setCourseBlock($filter); $pageController->setSessionBlock(); $pageController->return_reservation_block(); - $pageController->returnNavigationLinks($template->getNavigationLinks()); + $pageController->returnNavigationLinks($template->getNavigationLinks());*/ - $template->assign('search_block', $pageController->return_search_block()); - $template->assign('classes_block', $pageController->return_classes_block()); + //$template->assign('search_block', $pageController->return_search_block()); + //$template->assign('classes_block', $pageController->return_classes_block()); $pageController->returnSkillsLinks(); // Deleting the session_id. $this->getSessionHandler()->remove('session_id'); - $response = $template->renderTemplate('userportal/index.tpl'); - return new Response($response, 200, array()); + return $this->render( + 'ChamiloLMSCoreBundle:Index:userportal.html.twig', + array('content' => $items) + ); } /** diff --git a/src/ChamiloLMS/CoreBundle/Controller/LegacyController.php b/src/ChamiloLMS/CoreBundle/Controller/LegacyController.php new file mode 100644 index 0000000000..e25874520c --- /dev/null +++ b/src/ChamiloLMS/CoreBundle/Controller/LegacyController.php @@ -0,0 +1,116 @@ + + */ +class LegacyController extends BaseController +{ + public $section; + + /** + * @param $name + * @return Response + */ + public function classicAction($name) + { + $responseHeaders = array(); + $request = $this->getRequest(); + + // get. + $_GET = $request->query->all(); + // post. + $_POST = $request->request->all(); + // echo $request->getMethod(); + + $rootDir = $this->get('kernel')->getRealRootDir(); + + //$_REQUEST = $request->request->all(); + $mainPath = $rootDir.'main/'; + $fileToLoad = $mainPath.$name; + + // Legacy inclusions + Session::setSession($this->getRequest()->getSession()); + $dbConnection = $this->container->get('database_connection'); + $database = new \Database($dbConnection, array()); + Session::$urlGenerator = $this->container->get('router'); + Session::$security = $this->container->get('security.context'); + Session::$translator = $this->container->get('translator'); + Session::$rootDir = $this->container->get('kernel')->getRealRootDir(); + Session::$logDir = $this->container->get('kernel')->getLogDir(); + Session::$dataDir = $this->container->get('kernel')->getDataDir(); + Session::$tempDir = $this->container->get('kernel')->getCacheDir(); + Session::$courseDir = $this->container->get('kernel')->getDataDir(); + Session::$configDir = $this->container->get('kernel')->getConfigDir(); + + if (is_file($fileToLoad) && + \Security::check_abs_path($fileToLoad, $mainPath) + ) { + + $toolNameFromFile = basename(dirname($fileToLoad)); + + // Default values + /*$_course = api_get_course_info(); + $_user = api_get_user_info(); + $charset = 'UTF-8'; + $text_dir = api_get_text_direction(); + $is_platformAdmin = api_is_platform_admin(); + $_cid = api_get_course_id();*/ + $debug = $this->container->get('kernel')->getEnvironment() == 'dev' ? true : false; + + // Loading file + ob_start(); + require_once $fileToLoad; + $out = ob_get_contents(); + ob_end_clean(); + + // No browser cache when executing an exercise. + if ($name == 'exercice/exercise_submit.php') { + $responseHeaders = array( + 'cache-control' => 'no-store, no-cache, must-revalidate' + ); + } + + // Setting page header/footer conditions (important for LPs) + //$this->getTemplate()->setFooter($app['template.show_footer']); + //$this->getTemplate()->setHeader($app['template.show_header']); + + if (isset($htmlHeadXtra)) { + //$this->getTemplate()->addResource($htmlHeadXtra, 'string'); + } + // $interbreadcrumb is loaded in the require_once file. + $interbreadcrumb = isset($interbreadcrumb) ? $interbreadcrumb : null; + //$this->getTemplate()->setBreadcrumb($interbreadcrumb); + //$breadCrumb = $this->getTemplate()->getBreadCrumbLegacyArray(); + //$menu = $this->parseLegacyBreadCrumb($breadCrumb); + //$this->getTemplate()->assign('new_breadcrumb', $menu); + //$this->getTemplate()->parseResources(); + + /*if (isset($tpl)) { + $response = $app['twig']->render($app['default_layout']); + } else { + $this->getTemplate()->assign('content', $out); + $response = $app['twig']->render($app['default_layout']); + }*/ + + return $this->render( + 'ChamiloLMSCoreBundle:Legacy:index.html.twig', + array('content' => $out) + ); + } else { + throw new NotFoundHttpException(); + } + } +} diff --git a/src/ChamiloLMS/Controller/Tool/CourseHome/CourseHomeController.php b/src/ChamiloLMS/CoreBundle/Controller/Tool/CourseHome/CourseHomeController.php similarity index 91% rename from src/ChamiloLMS/Controller/Tool/CourseHome/CourseHomeController.php rename to src/ChamiloLMS/CoreBundle/Controller/Tool/CourseHome/CourseHomeController.php index 57d65d6c09..460a64270d 100644 --- a/src/ChamiloLMS/Controller/Tool/CourseHome/CourseHomeController.php +++ b/src/ChamiloLMS/CoreBundle/Controller/Tool/CourseHome/CourseHomeController.php @@ -1,29 +1,29 @@ + * @Route("/course_home") */ class CourseHomeController extends ToolBaseController { public function getClass() { - return 'ChamiloLMS\Entity\CTool'; + return 'ChamiloLMS\CoreBundle\Entity\CTool'; } /** @@ -31,7 +31,7 @@ class CourseHomeController extends ToolBaseController */ public function getType() { - return 'ChamiloLMS\Form\CourseHomeToolType'; + return 'ChamiloLMS\CoreBundle\Form\CourseHomeToolType'; } /** @@ -60,15 +60,18 @@ class CourseHomeController extends ToolBaseController if ($showAutoLaunchExerciseWarning) { $this->addMessage('TheExerciseAutoLaunchSettingIsONStudentsWillBeRedirectToAnSpecificExercise', 'warning'); } - - if ($this->isCourseTeacher()) { + if (true) { + //if ($this->isCourseTeacher()) { $editIcons = Display::url( Display::return_icon('edit.png'), - $this->generateControllerUrl('iconListAction', array('courseCode' => api_get_course_id())) + $this->generateUrl( + 'chamilolms_core_tool_coursehome_coursehome_iconlist', + array('courseCode' => api_get_course_id()) + ) ); - $this->getTemplate()->assign('edit_icons', $editIcons); + //$this->getTemplate()->addg('edit_icons', $editIcons); } if (!isset($coursesAlreadyVisited[$courseCode])) { @@ -102,22 +105,28 @@ class CourseHomeController extends ToolBaseController $result = require_once api_get_path(SYS_CODE_PATH).'course_home/'.$script; $toolList = $result['tool_list']; - $this->getTemplate()->assign('icons', $result['content']); $introduction = Display::return_introduction_section( - $this->get('url_generator'), + $this->get('router'), TOOL_COURSE_HOMEPAGE, $toolList ); - - $this->getTemplate()->assign('introduction_text', $introduction); - + $sessionInfo = null; if (api_get_setting('show_session_data') == 'true' && $sessionId) { $sessionInfo = \CourseHome::show_session_data($sessionId); - $this->getTemplate()->assign('session_info', $sessionInfo); } - $response = $this->renderTemplate('index.tpl'); + $response = $this->render( + 'ChamiloLMSCoreBundle:Tool:CourseHome/index.html.twig', + array( + 'session_info' => $sessionInfo, + 'icons' => $result['content'], + 'edit_icons' => $editIcons, + 'introduction_text' => $introduction, + 'exercise_warning' => null, + 'lp_warning' => null + ) + ); return new Response($response, 200, array()); } @@ -297,7 +306,7 @@ class CourseHomeController extends ToolBaseController } $entityManager = $this->getManager(); $criteria = array('cId' => api_get_course_int_id(), 'id' => $iconId); - $tool = $this->getRepository('ChamiloLMS\Entity\CTool')->findOneBy($criteria); + $tool = $this->getRepository('ChamiloLMS\CoreBundle\Entity\CTool')->findOneBy($criteria); if ($tool) { $tool->setVisibility(1); } @@ -320,7 +329,7 @@ class CourseHomeController extends ToolBaseController $entityManager = $this->getManager(); $criteria = array('cId' => api_get_course_int_id(), 'id' => $iconId); - $tool = $this->getRepository('ChamiloLMS\Entity\CTool')->findOneBy($criteria); + $tool = $this->getRepository('ChamiloLMS\CoreBundle\Entity\CTool')->findOneBy($criteria); if ($tool) { $tool->setVisibility(0); } @@ -343,7 +352,7 @@ class CourseHomeController extends ToolBaseController $entityManager = $this->getManager(); $criteria = array('cId' => api_get_course_int_id(), 'id' => $iconId, 'added_tool' => 1); - $tool = $this->getRepository('ChamiloLMS\Entity\CTool')->findOneBy($criteria); + $tool = $this->getRepository('ChamiloLMS\CoreBundle\Entity\CTool')->findOneBy($criteria); $entityManager->remove($tool); //$entityManager->flush(); return Display::return_message(get_lang('Deleted'), 'confirmation'); @@ -364,7 +373,7 @@ class CourseHomeController extends ToolBaseController $query = $this->getManager()->createQueryBuilder('a'); $query->select('s'); - $query->from('ChamiloLMS\Entity\CTool', 's'); + $query->from('ChamiloLMS\CoreBundle\Entity\CTool', 's'); $query->where('s.cId = :courseId AND s.sessionId = :sessionId') ->setParameters( array( @@ -382,7 +391,7 @@ class CourseHomeController extends ToolBaseController //$itemsFromSession = $this->getRepository()->findBy($criteria); $query = $this->getManager()->createQueryBuilder('a'); $query->select('s'); - $query->from('ChamiloLMS\Entity\CTool', 's'); + $query->from('ChamiloLMS\CoreBundle\Entity\CTool', 's'); $query->where('s.cId = :courseId AND s.sessionId = 0') ->setParameters( array( @@ -442,7 +451,7 @@ class CourseHomeController extends ToolBaseController $query = $this->getManager()->createQueryBuilder('a'); $query->select('MAX(s.id) as id'); - $query->from('ChamiloLMS\Entity\CTool', 's'); + $query->from('ChamiloLMS\CoreBundle\Entity\CTool', 's'); $query->where('s.cId = :courseId')->setParameter('courseId', $this->getCourse()->getId()); $result = $query->getQuery()->getArrayResult(); $maxId = $result[0]['id'] + 1; diff --git a/src/ChamiloLMS/Controller/Tool/Curriculum/CurriculumCategoryController.php b/src/ChamiloLMS/CoreBundle/Controller/Tool/Curriculum/CurriculumCategoryController.php similarity index 95% rename from src/ChamiloLMS/Controller/Tool/Curriculum/CurriculumCategoryController.php rename to src/ChamiloLMS/CoreBundle/Controller/Tool/Curriculum/CurriculumCategoryController.php index 5d5cde6672..7925866b8a 100644 --- a/src/ChamiloLMS/Controller/Tool/Curriculum/CurriculumCategoryController.php +++ b/src/ChamiloLMS/CoreBundle/Controller/Tool/Curriculum/CurriculumCategoryController.php @@ -1,27 +1,27 @@ */ class CurriculumCategoryController extends CrudController { public function getClass() { - return 'ChamiloLMS\Entity\CurriculumCategory'; + return 'ChamiloLMS\CoreBundle\Entity\CurriculumCategory'; } /** @@ -37,7 +37,7 @@ class CurriculumCategoryController extends CrudController */ public function getType() { - return 'ChamiloLMS\Form\CurriculumCategoryType'; + return 'ChamiloLMS\CoreBundle\Form\CurriculumCategoryType'; } public function getControllerAlias() @@ -123,7 +123,7 @@ class CurriculumCategoryController extends CrudController $qb = $this->getManager() ->createQueryBuilder() ->select('node, i') - ->from('ChamiloLMS\Entity\CurriculumCategory', 'node') + ->from('ChamiloLMS\CoreBundle\Entity\CurriculumCategory', 'node') ->leftJoin('node.items', 'i') ->innerJoin('node.course', 'c') ->orderBy('node.root, node.lft', 'ASC'); @@ -362,7 +362,7 @@ class CurriculumCategoryController extends CrudController $qb = $this->getManager() ->createQueryBuilder() ->select('node.id, u.userId, SUM(i.score) as score') - ->from('ChamiloLMS\Entity\CurriculumCategory', 'node') + ->from('ChamiloLMS\CoreBundle\Entity\CurriculumCategory', 'node') ->innerJoin('node.course', 'c') ->innerJoin('node.items', 'i') ->innerJoin('i.userItems', 'u') diff --git a/src/ChamiloLMS/Controller/Tool/Curriculum/CurriculumController.php b/src/ChamiloLMS/CoreBundle/Controller/Tool/Curriculum/CurriculumController.php similarity index 81% rename from src/ChamiloLMS/Controller/Tool/Curriculum/CurriculumController.php rename to src/ChamiloLMS/CoreBundle/Controller/Tool/Curriculum/CurriculumController.php index af7a8f87f4..936909d1e4 100644 --- a/src/ChamiloLMS/Controller/Tool/Curriculum/CurriculumController.php +++ b/src/ChamiloLMS/CoreBundle/Controller/Tool/Curriculum/CurriculumController.php @@ -1,20 +1,20 @@ */ class CurriculumController extends BaseController diff --git a/src/ChamiloLMS/Controller/Tool/Curriculum/CurriculumItemController.php b/src/ChamiloLMS/CoreBundle/Controller/Tool/Curriculum/CurriculumItemController.php similarity index 91% rename from src/ChamiloLMS/Controller/Tool/Curriculum/CurriculumItemController.php rename to src/ChamiloLMS/CoreBundle/Controller/Tool/Curriculum/CurriculumItemController.php index b259cc78c7..ff90a2a3e3 100644 --- a/src/ChamiloLMS/Controller/Tool/Curriculum/CurriculumItemController.php +++ b/src/ChamiloLMS/CoreBundle/Controller/Tool/Curriculum/CurriculumItemController.php @@ -1,21 +1,21 @@ */ class CurriculumItemController extends CrudController @@ -38,7 +38,7 @@ class CurriculumItemController extends CrudController */ public function getClass() { - return 'ChamiloLMS\Entity\CurriculumItem'; + return 'ChamiloLMS\CoreBundle\Entity\CurriculumItem'; } /** @@ -46,7 +46,7 @@ class CurriculumItemController extends CrudController */ public function getType() { - return 'ChamiloLMS\Form\CurriculumItemType'; + return 'ChamiloLMS\CoreBundle\Form\CurriculumItemType'; } /** @@ -120,7 +120,7 @@ class CurriculumItemController extends CrudController $entity = new CurriculumItem(); - $category = $this->get('orm.em')->getRepository('ChamiloLMS\Entity\CurriculumCategory')->find($id); + $category = $this->get('orm.em')->getRepository('ChamiloLMS\CoreBundle\Entity\CurriculumCategory')->find($id); $entity->setCategory($category); $form = $this->get('form.factory')->create($formType, $entity); diff --git a/src/ChamiloLMS/Controller/Tool/Curriculum/CurriculumUserController.php b/src/ChamiloLMS/CoreBundle/Controller/Tool/Curriculum/CurriculumUserController.php similarity index 90% rename from src/ChamiloLMS/Controller/Tool/Curriculum/CurriculumUserController.php rename to src/ChamiloLMS/CoreBundle/Controller/Tool/Curriculum/CurriculumUserController.php index 9740d0655f..b139c1b6d1 100644 --- a/src/ChamiloLMS/Controller/Tool/Curriculum/CurriculumUserController.php +++ b/src/ChamiloLMS/CoreBundle/Controller/Tool/Curriculum/CurriculumUserController.php @@ -1,16 +1,16 @@ */ class CurriculumUserController extends CrudController @@ -42,7 +42,7 @@ class CurriculumUserController extends CrudController */ public function getClass() { - return 'ChamiloLMS\Entity\CurriculumItemRelUser'; + return 'ChamiloLMS\CoreBundle\Entity\CurriculumItemRelUser'; } /** @@ -50,7 +50,7 @@ class CurriculumUserController extends CrudController */ public function getType() { - return 'ChamiloLMS\Form\CurriculumItemRelUserCollectionType'; + return 'ChamiloLMS\CoreBundle\Form\CurriculumItemRelUserCollectionType'; } protected function generateDefaultCrudRoutes() @@ -95,7 +95,7 @@ class CurriculumUserController extends CrudController $qb = $this->getManager() ->createQueryBuilder() ->select('node, i, u') - ->from('ChamiloLMS\Entity\CurriculumCategory', 'node') + ->from('ChamiloLMS\CoreBundle\Entity\CurriculumCategory', 'node') ->innerJoin('node.course', 'c') ->leftJoin('node.items', 'i') ->leftJoin('i.userItems', 'u', 'WITH', 'u.userId = :userId OR u.userId IS NULL') @@ -109,10 +109,10 @@ class CurriculumUserController extends CrudController $categories = $query->getResult(); $formList = array(); - /** @var \ChamiloLMS\Entity\CurriculumCategory $category */ + /** @var \ChamiloLMS\CoreBundle\Entity\CurriculumCategory $category */ foreach ($categories as $category) { - /** @var \ChamiloLMS\Entity\CurriculumItem $item */ + /** @var \ChamiloLMS\CoreBundle\Entity\CurriculumItem $item */ foreach ($category->getItems() as $item) { $formType = new CurriculumItemRelUserCollectionType($item->getId()); @@ -181,7 +181,7 @@ class CurriculumUserController extends CrudController $query = $this->getManager() ->createQueryBuilder() ->select('node, i, u') - ->from('ChamiloLMS\Entity\CurriculumCategory', 'node') + ->from('ChamiloLMS\CoreBundle\Entity\CurriculumCategory', 'node') ->innerJoin('node.items', 'i') ->innerJoin('i.userItems', 'u') ->orderBy('node.root, node.lft', 'ASC') @@ -192,7 +192,7 @@ class CurriculumUserController extends CrudController $categories = $query->getResult(); - /** @var \ChamiloLMS\Entity\CurriculumCategory $category */ + /** @var \ChamiloLMS\CoreBundle\Entity\CurriculumCategory $category */ $alreadyAdded = array(); foreach ($categories as $category) { @@ -208,7 +208,7 @@ class CurriculumUserController extends CrudController } // @todo check this - $user = $this->get('orm.em')->getRepository('ChamiloLMS\Entity\User')->find($user->getUserId()); + $user = $this->get('orm.em')->getRepository('ChamiloLMS\CoreBundle\Entity\User')->find($user->getUserId()); $counter = 1; $parsed = array(); @@ -315,7 +315,7 @@ class CurriculumUserController extends CrudController $qb = $this->getManager() ->createQueryBuilder() ->select('node, i, u') - ->from('ChamiloLMS\Entity\CurriculumCategory', 'node') + ->from('ChamiloLMS\CoreBundle\Entity\CurriculumCategory', 'node') ->innerJoin('node.course', 'c') ->leftJoin('node.items', 'i') ->leftJoin('i.userItems', 'u', 'WITH', 'u.userId = :userId OR u.userId IS NULL') @@ -325,7 +325,7 @@ class CurriculumUserController extends CrudController $query = $qb->getQuery(); $categories = $query->getResult(); foreach ($categories as $category) { - /** @var \ChamiloLMS\Entity\CurriculumItem $item */ + /** @var \ChamiloLMS\CoreBundle\Entity\CurriculumItem $item */ $score = 0; foreach ($category->getItems() as $item) { @@ -369,12 +369,12 @@ class CurriculumUserController extends CrudController private function getCurriculumCategoryRepository() { - return $this->get('orm.em')->getRepository('ChamiloLMS\Entity\CurriculumCategory'); + return $this->get('orm.em')->getRepository('ChamiloLMS\CoreBundle\Entity\CurriculumCategory'); } private function getCurriculumItemRepository() { - return $this->get('orm.em')->getRepository('ChamiloLMS\Entity\CurriculumItem'); + return $this->get('orm.em')->getRepository('ChamiloLMS\CoreBundle\Entity\CurriculumItem'); } } diff --git a/src/ChamiloLMS/Controller/Tool/Exercise/ExerciseController.php b/src/ChamiloLMS/CoreBundle/Controller/Tool/Exercise/ExerciseController.php similarity index 98% rename from src/ChamiloLMS/Controller/Tool/Exercise/ExerciseController.php rename to src/ChamiloLMS/CoreBundle/Controller/Tool/Exercise/ExerciseController.php index 9ff816673d..91a7e9c9dd 100644 --- a/src/ChamiloLMS/Controller/Tool/Exercise/ExerciseController.php +++ b/src/ChamiloLMS/CoreBundle/Controller/Tool/Exercise/ExerciseController.php @@ -1,9 +1,9 @@ + * @Route("/introduction") */ class IntroductionController extends CrudController { public function getClass() { - return 'ChamiloLMS\Entity\CToolIntro'; + return 'ChamiloLMS\CoreBundle\Entity\CToolIntro'; } public function getType() { - return 'ChamiloLMS\Form\BranchType'; + return 'ChamiloLMS\CoreBundle\Form\BranchType'; } public function getControllerAlias() @@ -57,7 +58,8 @@ class IntroductionController extends CrudController $TBL_INTRODUCTION = \Database::get_course_table(TABLE_TOOL_INTRO); $url = $this->generateUrl( - 'introduction.controller:editAction', + //'introduction.controller:editAction', + 'chamilolms_core_tool_introduction_introduction_edit', array('tool' => $tool, 'courseCode' => api_get_course_id()) ); @@ -119,7 +121,7 @@ class IntroductionController extends CrudController } $url = $this->generateUrl( - 'introduction.controller:editAction', + 'chamilolms_core_tool_introduction_introduction_edit', array('tool' => $tool, 'courseCode' => api_get_course_id()) ); diff --git a/src/ChamiloLMS/Controller/Tool/LearningPath/LearningPathController.php b/src/ChamiloLMS/CoreBundle/Controller/Tool/LearningPath/LearningPathController.php similarity index 87% rename from src/ChamiloLMS/Controller/Tool/LearningPath/LearningPathController.php rename to src/ChamiloLMS/CoreBundle/Controller/Tool/LearningPath/LearningPathController.php index b42a5b3dfe..1a0b4aa42c 100644 --- a/src/ChamiloLMS/Controller/Tool/LearningPath/LearningPathController.php +++ b/src/ChamiloLMS/CoreBundle/Controller/Tool/LearningPath/LearningPathController.php @@ -1,15 +1,15 @@ */ class LearningPathController extends BaseController @@ -60,14 +60,14 @@ class LearningPathController extends BaseController $sessionId = api_get_session_id(); $session = null; if (!empty($sessionId)) { - $session = $app['orm.em']->getRepository('ChamiloLMS\Entity\Session')->find($sessionId); + $session = $app['orm.em']->getRepository('ChamiloLMS\CoreBundle\Entity\Session')->find($sessionId); } // Find course. - $course = $app['orm.em']->getRepository('ChamiloLMS\Entity\Course')->find($courseId); + $course = $app['orm.em']->getRepository('ChamiloLMS\CoreBundle\Entity\Course')->find($courseId); // Getting subscribe users to the course. - $subscribedUsers = $app['orm.em']->getRepository('ChamiloLMS\Entity\Course')->getSubscribedStudents($course); + $subscribedUsers = $app['orm.em']->getRepository('ChamiloLMS\CoreBundle\Entity\Course')->getSubscribedStudents($course); $subscribedUsers = $subscribedUsers->getQuery(); $subscribedUsers = $subscribedUsers->execute(); @@ -78,7 +78,7 @@ class LearningPathController extends BaseController } // Getting subscribed users to a LP. - $subscribedUsersInLp = $app['orm.em']->getRepository('ChamiloLMS\Entity\CItemProperty')->getUsersSubscribedToItem( + $subscribedUsersInLp = $app['orm.em']->getRepository('ChamiloLMS\CoreBundle\Entity\CItemProperty')->getUsersSubscribedToItem( 'learnpath', $lpId, $course, @@ -124,7 +124,7 @@ class LearningPathController extends BaseController } //Subscribed groups to a LP - $subscribedGroupsInLp = $app['orm.em']->getRepository('ChamiloLMS\Entity\CItemProperty')->getGroupsSubscribedToItem( + $subscribedGroupsInLp = $app['orm.em']->getRepository('ChamiloLMS\CoreBundle\Entity\CItemProperty')->getGroupsSubscribedToItem( 'learnpath', $lpId, $course, @@ -151,7 +151,7 @@ class LearningPathController extends BaseController 'expanded' => false, //'class' => 'Entity\Course', //'property' => 'complete_name', - //'query_builder' => function(ChamiloLMS\Entity\Repository\CourseRepository $repo) use ($course) { + //'query_builder' => function(ChamiloLMS\CoreBundle\Entity\Repository\CourseRepository $repo) use ($course) { $repo = $repo->getSubscribedStudents($course); return $repo; }, @@ -164,7 +164,7 @@ class LearningPathController extends BaseController 'required' => false, //'class' => 'Entity\Course', //'property' => 'complete_name', - //'query_builder' => function(ChamiloLMS\Entity\Repository\CourseRepository $repo) use ($course) { + //'query_builder' => function(ChamiloLMS\CoreBundle\Entity\Repository\CourseRepository $repo) use ($course) { // return $repo->getSubscribedStudents($course); //}, 'choices' => $selectedChoices @@ -183,7 +183,7 @@ class LearningPathController extends BaseController $users = $request->get('users'); $userForm = $request->get('user_form'); if (!empty($userForm)) { - $app['orm.em']->getRepository('ChamiloLMS\Entity\CItemProperty')->subscribeUsersToItem( + $app['orm.em']->getRepository('ChamiloLMS\CoreBundle\Entity\CItemProperty')->subscribeUsersToItem( 'learnpath', $course, $session, @@ -197,7 +197,7 @@ class LearningPathController extends BaseController $groupForm = $request->get('group_form'); if (!empty($groupForm)) { - $app['orm.em']->getRepository('ChamiloLMS\Entity\CItemProperty')->subscribeGroupsToItem( + $app['orm.em']->getRepository('ChamiloLMS\CoreBundle\Entity\CItemProperty')->subscribeGroupsToItem( 'learnpath', $course, $session, diff --git a/src/ChamiloLMS/Controller/ToolBaseController.php b/src/ChamiloLMS/CoreBundle/Controller/ToolBaseController.php similarity index 96% rename from src/ChamiloLMS/Controller/ToolBaseController.php rename to src/ChamiloLMS/CoreBundle/Controller/ToolBaseController.php index 09d2dc7cdd..6fa9f81c01 100644 --- a/src/ChamiloLMS/Controller/ToolBaseController.php +++ b/src/ChamiloLMS/CoreBundle/Controller/ToolBaseController.php @@ -1,9 +1,9 @@ */ class UserController extends BaseController diff --git a/src/ChamiloLMS/Entity/AccessUrl.php b/src/ChamiloLMS/CoreBundle/Entity/AccessUrl.php similarity index 98% rename from src/ChamiloLMS/Entity/AccessUrl.php rename to src/ChamiloLMS/CoreBundle/Entity/AccessUrl.php index 15d49854e5..80c6519ae2 100644 --- a/src/ChamiloLMS/Entity/AccessUrl.php +++ b/src/ChamiloLMS/CoreBundle/Entity/AccessUrl.php @@ -1,6 +1,6 @@ select('DISTINCT b'); - $qb->from('ChamiloLMS\Entity\BranchSync', 'b'); + $qb->from('ChamiloLMS\CoreBundle\Entity\BranchSync', 'b'); //Selecting courses for users //$qb->innerJoin('u.courses', 'c'); diff --git a/src/ChamiloLMS/Entity/Repository/CQuizCategoryRepository.php b/src/ChamiloLMS/CoreBundle/Entity/Repository/CQuizCategoryRepository.php similarity index 78% rename from src/ChamiloLMS/Entity/Repository/CQuizCategoryRepository.php rename to src/ChamiloLMS/CoreBundle/Entity/Repository/CQuizCategoryRepository.php index 685e7e0246..8f78a09af9 100644 --- a/src/ChamiloLMS/Entity/Repository/CQuizCategoryRepository.php +++ b/src/ChamiloLMS/CoreBundle/Entity/Repository/CQuizCategoryRepository.php @@ -1,6 +1,6 @@ select('DISTINCT u'); // Loading EntityUser. - $queryBuilder->from('ChamiloLMS\Entity\User', 'u'); + $queryBuilder->from('ChamiloLMS\CoreBundle\Entity\User', 'u'); // Selecting courses for users. $queryBuilder->innerJoin('u.courses', 'c'); @@ -63,11 +63,11 @@ class CourseRepository extends EntityRepository /** * Gets the students subscribed in the course - * @param \ChamiloLMS\Entity\Course $course + * @param \ChamiloLMS\CoreBundle\Entity\Course $course * * @return \Doctrine\ORM\QueryBuilder */ - public function getSubscribedCoaches(\ChamiloLMS\Entity\Course $course) + public function getSubscribedCoaches(\ChamiloLMS\CoreBundle\Entity\Course $course) { $queryBuilder = $this->getSubscribedUsers($course); return $queryBuilder; diff --git a/src/ChamiloLMS/Entity/Repository/CurriculumItemRelUserRepository.php b/src/ChamiloLMS/CoreBundle/Entity/Repository/CurriculumItemRelUserRepository.php similarity index 77% rename from src/ChamiloLMS/Entity/Repository/CurriculumItemRelUserRepository.php rename to src/ChamiloLMS/CoreBundle/Entity/Repository/CurriculumItemRelUserRepository.php index 8043bdbfe7..289b891e94 100644 --- a/src/ChamiloLMS/Entity/Repository/CurriculumItemRelUserRepository.php +++ b/src/ChamiloLMS/CoreBundle/Entity/Repository/CurriculumItemRelUserRepository.php @@ -1,6 +1,6 @@ getMaxRepeat(); $count = $this->createQueryBuilder('a') diff --git a/src/ChamiloLMS/Entity/Repository/ItemPropertyRepository.php b/src/ChamiloLMS/CoreBundle/Entity/Repository/ItemPropertyRepository.php similarity index 96% rename from src/ChamiloLMS/Entity/Repository/ItemPropertyRepository.php rename to src/ChamiloLMS/CoreBundle/Entity/Repository/ItemPropertyRepository.php index 89ddf10ad5..fc4b6c34bd 100644 --- a/src/ChamiloLMS/Entity/Repository/ItemPropertyRepository.php +++ b/src/ChamiloLMS/CoreBundle/Entity/Repository/ItemPropertyRepository.php @@ -1,11 +1,11 @@ find('ChamiloLMS\Entity\CGroupInfo', $groupId); + $groupObj = $em->find('ChamiloLMS\CoreBundle\Entity\CGroupInfo', $groupId); $item->setGroup($groupObj); $item->setTool($tool); $item->setRef($itemId); @@ -204,7 +204,7 @@ class ItemPropertyRepository extends EntityRepository public function subscribeUsersToItem($tool, Course $course, Session $session = null, $itemId, $newUserList = array()) { $em = $this->getEntityManager(); - $user = $em->getRepository('ChamiloLMS\Entity\User'); + $user = $em->getRepository('ChamiloLMS\CoreBundle\Entity\User'); $usersSubscribedToItem = $this->getUsersSubscribedToItem($tool, $itemId, $course, $session); diff --git a/src/ChamiloLMS/Entity/Repository/JuryRepository.php b/src/ChamiloLMS/CoreBundle/Entity/Repository/JuryRepository.php similarity index 87% rename from src/ChamiloLMS/Entity/Repository/JuryRepository.php rename to src/ChamiloLMS/CoreBundle/Entity/Repository/JuryRepository.php index cd3eb421ec..11a0f42517 100644 --- a/src/ChamiloLMS/Entity/Repository/JuryRepository.php +++ b/src/ChamiloLMS/CoreBundle/Entity/Repository/JuryRepository.php @@ -1,6 +1,6 @@ select('DISTINCT u'); // Loading EntityUser - $qb->from('ChamiloLMS\Entity\Jury', 'u'); + $qb->from('ChamiloLMS\CoreBundle\Entity\Jury', 'u'); // Selecting members $qb->innerJoin('u.members', 'c'); diff --git a/src/ChamiloLMS/Entity/Repository/LpRepository.php b/src/ChamiloLMS/CoreBundle/Entity/Repository/LpRepository.php similarity index 70% rename from src/ChamiloLMS/Entity/Repository/LpRepository.php rename to src/ChamiloLMS/CoreBundle/Entity/Repository/LpRepository.php index 2ae924b588..3a88e5ccf6 100644 --- a/src/ChamiloLMS/Entity/Repository/LpRepository.php +++ b/src/ChamiloLMS/CoreBundle/Entity/Repository/LpRepository.php @@ -1,6 +1,6 @@ select('DISTINCT b'); - $qb->from('ChamiloLMS\Entity\User', 'b'); + $qb->from('ChamiloLMS\CoreBundle\Entity\User', 'b'); // Selecting courses for users //$qb->innerJoin('u.courses', 'c'); @@ -111,10 +111,10 @@ class UserRepository extends EntityRepository implements UserProviderInterface $queryBuilder->select('c'); // Loading User. - //$qb->from('ChamiloLMS\Entity\User', 'u'); + //$qb->from('ChamiloLMS\CoreBundle\Entity\User', 'u'); // Selecting course - $queryBuilder->innerJoin('ChamiloLMS\Entity\Course', 'c'); + $queryBuilder->innerJoin('ChamiloLMS\CoreBundle\Entity\Course', 'c'); //@todo check app settings //$qb->add('orderBy', 'u.lastname ASC'); diff --git a/src/ChamiloLMS/Entity/Role.php b/src/ChamiloLMS/CoreBundle/Entity/Role.php similarity index 98% rename from src/ChamiloLMS/Entity/Role.php rename to src/ChamiloLMS/CoreBundle/Entity/Role.php index 3c13a096eb..8ecdcbf5f5 100644 --- a/src/ChamiloLMS/Entity/Role.php +++ b/src/ChamiloLMS/CoreBundle/Entity/Role.php @@ -1,6 +1,6 @@ setDefaults( array( - 'data_class' => 'ChamiloLMS\Entity\BranchSync' + 'data_class' => 'ChamiloLMS\CoreBundle\Entity\BranchSync' ) ); } diff --git a/src/ChamiloLMS/Form/CourseHomeToolType.php b/src/ChamiloLMS/CoreBundle/Form/CourseHomeToolType.php similarity index 92% rename from src/ChamiloLMS/Form/CourseHomeToolType.php rename to src/ChamiloLMS/CoreBundle/Form/CourseHomeToolType.php index 3fb2f86f22..ba54e1ff6e 100644 --- a/src/ChamiloLMS/Form/CourseHomeToolType.php +++ b/src/ChamiloLMS/CoreBundle/Form/CourseHomeToolType.php @@ -1,7 +1,7 @@ setDefaults( array( - 'data_class' => 'ChamiloLMS\Entity\CTool' + 'data_class' => 'ChamiloLMS\CoreBundle\Entity\CTool' ) ); } diff --git a/src/ChamiloLMS/Form/CurriculumCategoryType.php b/src/ChamiloLMS/CoreBundle/Form/CurriculumCategoryType.php similarity index 91% rename from src/ChamiloLMS/Form/CurriculumCategoryType.php rename to src/ChamiloLMS/CoreBundle/Form/CurriculumCategoryType.php index 0710f92152..72e40c8728 100644 --- a/src/ChamiloLMS/Form/CurriculumCategoryType.php +++ b/src/ChamiloLMS/CoreBundle/Form/CurriculumCategoryType.php @@ -1,12 +1,12 @@ setDefaults( array( - 'data_class' => 'ChamiloLMS\Entity\CurriculumCategory' + 'data_class' => 'ChamiloLMS\CoreBundle\Entity\CurriculumCategory' ) ); } diff --git a/src/ChamiloLMS/Form/CurriculumItemRelUserCollectionType.php b/src/ChamiloLMS/CoreBundle/Form/CurriculumItemRelUserCollectionType.php similarity index 90% rename from src/ChamiloLMS/Form/CurriculumItemRelUserCollectionType.php rename to src/ChamiloLMS/CoreBundle/Form/CurriculumItemRelUserCollectionType.php index f154df5cc0..ba953ee4a7 100644 --- a/src/ChamiloLMS/Form/CurriculumItemRelUserCollectionType.php +++ b/src/ChamiloLMS/CoreBundle/Form/CurriculumItemRelUserCollectionType.php @@ -1,7 +1,7 @@ setDefaults( array( - 'data_class' => 'ChamiloLMS\Entity\CurriculumItem' + 'data_class' => 'ChamiloLMS\CoreBundle\Entity\CurriculumItem' ) ); } diff --git a/src/ChamiloLMS/Form/CurriculumItemRelUserType.php b/src/ChamiloLMS/CoreBundle/Form/CurriculumItemRelUserType.php similarity index 85% rename from src/ChamiloLMS/Form/CurriculumItemRelUserType.php rename to src/ChamiloLMS/CoreBundle/Form/CurriculumItemRelUserType.php index 36fc85f509..1e4a6ef953 100644 --- a/src/ChamiloLMS/Form/CurriculumItemRelUserType.php +++ b/src/ChamiloLMS/CoreBundle/Form/CurriculumItemRelUserType.php @@ -1,7 +1,7 @@ setDefaults( array( - 'data_class' => 'ChamiloLMS\Entity\CurriculumItemRelUser', + 'data_class' => 'ChamiloLMS\CoreBundle\Entity\CurriculumItemRelUser', ) ); } diff --git a/src/ChamiloLMS/Form/CurriculumItemType.php b/src/ChamiloLMS/CoreBundle/Form/CurriculumItemType.php similarity index 97% rename from src/ChamiloLMS/Form/CurriculumItemType.php rename to src/ChamiloLMS/CoreBundle/Form/CurriculumItemType.php index 16b5ce088b..94457ef76a 100644 --- a/src/ChamiloLMS/Form/CurriculumItemType.php +++ b/src/ChamiloLMS/CoreBundle/Form/CurriculumItemType.php @@ -1,7 +1,7 @@ setDefaults( array( - 'data_class' => 'ChamiloLMS\Entity\JuryMembers' + 'data_class' => 'ChamiloLMS\CoreBundle\Entity\JuryMembers' ) ); } diff --git a/src/ChamiloLMS/Form/JuryType.php b/src/ChamiloLMS/CoreBundle/Form/JuryType.php similarity index 93% rename from src/ChamiloLMS/Form/JuryType.php rename to src/ChamiloLMS/CoreBundle/Form/JuryType.php index bb052c52bb..a2d32fe5a8 100644 --- a/src/ChamiloLMS/Form/JuryType.php +++ b/src/ChamiloLMS/CoreBundle/Form/JuryType.php @@ -1,7 +1,7 @@ setDefaults( array( - 'data_class' => 'ChamiloLMS\Entity\Jury' + 'data_class' => 'ChamiloLMS\CoreBundle\Entity\Jury' ) ); } diff --git a/src/ChamiloLMS/Form/JuryUserType.php b/src/ChamiloLMS/CoreBundle/Form/JuryUserType.php similarity index 86% rename from src/ChamiloLMS/Form/JuryUserType.php rename to src/ChamiloLMS/CoreBundle/Form/JuryUserType.php index 23a1d8be40..f14be58ac5 100644 --- a/src/ChamiloLMS/Form/JuryUserType.php +++ b/src/ChamiloLMS/CoreBundle/Form/JuryUserType.php @@ -1,7 +1,7 @@ setDefaults( array( - 'data_class' => 'ChamiloLMS\Entity\Jury' + 'data_class' => 'ChamiloLMS\CoreBundle\Entity\Jury' ) ); } diff --git a/src/ChamiloLMS/Form/QuestionScoreNameType.php b/src/ChamiloLMS/CoreBundle/Form/QuestionScoreNameType.php similarity index 90% rename from src/ChamiloLMS/Form/QuestionScoreNameType.php rename to src/ChamiloLMS/CoreBundle/Form/QuestionScoreNameType.php index eefc206ca8..ebcbd3832e 100644 --- a/src/ChamiloLMS/Form/QuestionScoreNameType.php +++ b/src/ChamiloLMS/CoreBundle/Form/QuestionScoreNameType.php @@ -1,7 +1,7 @@ setDefaults( array( - 'data_class' => 'ChamiloLMS\Entity\QuestionScoreName' + 'data_class' => 'ChamiloLMS\CoreBundle\Entity\QuestionScoreName' ) ); } diff --git a/src/ChamiloLMS/Form/QuestionScoreType.php b/src/ChamiloLMS/CoreBundle/Form/QuestionScoreType.php similarity index 85% rename from src/ChamiloLMS/Form/QuestionScoreType.php rename to src/ChamiloLMS/CoreBundle/Form/QuestionScoreType.php index b4d1bd9307..4eb39d47bb 100644 --- a/src/ChamiloLMS/Form/QuestionScoreType.php +++ b/src/ChamiloLMS/CoreBundle/Form/QuestionScoreType.php @@ -1,7 +1,7 @@ setDefaults( array( - 'data_class' => 'ChamiloLMS\Entity\QuestionScore' + 'data_class' => 'ChamiloLMS\CoreBundle\Entity\QuestionScore' ) ); } diff --git a/src/ChamiloLMS/Form/RoleType.php b/src/ChamiloLMS/CoreBundle/Form/RoleType.php similarity index 86% rename from src/ChamiloLMS/Form/RoleType.php rename to src/ChamiloLMS/CoreBundle/Form/RoleType.php index bcfbc8a0a0..5b02572f49 100644 --- a/src/ChamiloLMS/Form/RoleType.php +++ b/src/ChamiloLMS/CoreBundle/Form/RoleType.php @@ -1,7 +1,7 @@ setDefaults( array( - 'data_class' => 'ChamiloLMS\Entity\Role' + 'data_class' => 'ChamiloLMS\CoreBundle\Entity\Role' ) ); } diff --git a/src/ChamiloLMS/Form/SessionPathType.php b/src/ChamiloLMS/CoreBundle/Form/SessionPathType.php similarity index 89% rename from src/ChamiloLMS/Form/SessionPathType.php rename to src/ChamiloLMS/CoreBundle/Form/SessionPathType.php index 9175d5e0d8..de179b562a 100644 --- a/src/ChamiloLMS/Form/SessionPathType.php +++ b/src/ChamiloLMS/CoreBundle/Form/SessionPathType.php @@ -1,7 +1,7 @@ setDefaults( array( - 'data_class' => 'ChamiloLMS\Entity\SessionPath' + 'data_class' => 'ChamiloLMS\CoreBundle\Entity\SessionPath' ) ); } diff --git a/src/ChamiloLMS/Form/SessionTreeType.php b/src/ChamiloLMS/CoreBundle/Form/SessionTreeType.php similarity index 95% rename from src/ChamiloLMS/Form/SessionTreeType.php rename to src/ChamiloLMS/CoreBundle/Form/SessionTreeType.php index ff60745b99..153a78d9a9 100644 --- a/src/ChamiloLMS/Form/SessionTreeType.php +++ b/src/ChamiloLMS/CoreBundle/Form/SessionTreeType.php @@ -1,7 +1,7 @@ setDefaults( array( - 'data_class' => 'ChamiloLMS\Entity\SessionTree' + 'data_class' => 'ChamiloLMS\CoreBundle\Entity\SessionTree' ) ); } diff --git a/src/ChamiloLMS/Framework/Application.php b/src/ChamiloLMS/CoreBundle/Framework/Application.php similarity index 98% rename from src/ChamiloLMS/Framework/Application.php rename to src/ChamiloLMS/CoreBundle/Framework/Application.php index e776079604..e374ff53ce 100644 --- a/src/ChamiloLMS/Framework/Application.php +++ b/src/ChamiloLMS/CoreBundle/Framework/Application.php @@ -1,13 +1,13 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace ChamiloLMS\CoreBundle\Framework\Exporter; + +use Exporter\Source\SourceIteratorInterface; +use Symfony\Component\HttpFoundation\StreamedResponse; + +use Exporter\Writer\XlsWriter; +use Exporter\Writer\XmlWriter; +use Exporter\Writer\JsonWriter; +use Exporter\Writer\CsvWriter; + +class Exporter +{ + /** + * @throws \RuntimeException + * + * @param string $format + * @param string $filename + * @param SourceIteratorInterface $source + * + * @return StreamedResponse + */ + public function getResponse($format, $filename, SourceIteratorInterface $source) + { + switch ($format) { + case 'xls': + $writer = new XlsWriter('php://output'); + $contentType = 'application/vnd.ms-excel'; + break; + case 'xml': + $writer = new XmlWriter('php://output'); + $contentType = 'text/xml'; + break; + case 'json': + $writer = new JsonWriter('php://output'); + $contentType = 'application/json'; + break; + case 'csv': + $writer = new CsvWriter('php://output', ',', '"', "", true, true); + $contentType = 'text/csv'; + break; + default: + throw new \RuntimeException('Invalid format'); + } + + $callback = function() use ($source, $writer) { + $handler = \Exporter\Handler::create($source, $writer); + $handler->export(); + }; + + return new StreamedResponse($callback, 200, array( + 'Content-Type' => $contentType, + 'Content-Disposition' => sprintf('attachment; filename=%s', $filename) + )); + } +} diff --git a/src/ChamiloLMS/Framework/PageController.php b/src/ChamiloLMS/CoreBundle/Framework/PageController.php similarity index 98% rename from src/ChamiloLMS/Framework/PageController.php rename to src/ChamiloLMS/CoreBundle/Framework/PageController.php index 5d810089e3..5c9f9ffc76 100644 --- a/src/ChamiloLMS/Framework/PageController.php +++ b/src/ChamiloLMS/CoreBundle/Framework/PageController.php @@ -1,15 +1,16 @@ app = $app; - } /** * Returns an HTML block with the user picture (as a link in a
) @@ -189,12 +184,11 @@ class PageController */ public function setCourseSessionMenu() { - $app = $this->app; - $courseURL = $app['url_generator']->generate('userportal', array('type' => 'courses')); - $sessionURL = $app['url_generator']->generate('userportal', array('type' => 'sessions')); - $courseCategoriesURL = $app['url_generator']->generate('userportal', array('type' => 'mycoursecategories')); - $specialCoursesURL = $app['url_generator']->generate('userportal', array('type' => 'specialcourses')); - $sessionCategoriesURL = $app['url_generator']->generate('userportal', array('type' => 'sessioncategories')); + $courseURL = Session::$urlGenerator->generate('userportal', array('type' => 'courses')); + $sessionURL = Session::$urlGenerator->generate('userportal', array('type' => 'sessions')); + $courseCategoriesURL = Session::$urlGenerator->generate('userportal', array('type' => 'mycoursecategories')); + $specialCoursesURL = Session::$urlGenerator->generate('userportal', array('type' => 'specialcourses')); + $sessionCategoriesURL = Session::$urlGenerator->generate('userportal', array('type' => 'sessioncategories')); $params = array( array('href' => $courseURL, 'title' => get_lang('Courses')), @@ -309,7 +303,6 @@ class PageController */ public function show_right_block($title, $content, $id, $params = null) { - $app = $this->app; if (!empty($id)) { $params['id'] = $id; } @@ -985,13 +978,14 @@ class PageController )); */ //Pagination using the pagerfanta silex service provider - $this->app['pagerfanta.view.router.name'] = 'userportal'; + /*$this->app['pagerfanta.view.router.name'] = 'userportal'; $this->app['pagerfanta.view.router.params'] = array( 'filter' => $filter, 'type' => 'courses', 'page' => $page ); - $this->app['template']->assign('pagination', $pagerfanta); + $this->app['template']->assign('pagination', $pagerfanta);*/ + // {{ pagerfanta(my_pager, 'twitter_bootstrap3') }} } return $html; diff --git a/src/ChamiloLMS/Framework/Template.php b/src/ChamiloLMS/CoreBundle/Framework/Template.php similarity index 99% rename from src/ChamiloLMS/Framework/Template.php rename to src/ChamiloLMS/CoreBundle/Framework/Template.php index 34bc08a137..14163524da 100644 --- a/src/ChamiloLMS/Framework/Template.php +++ b/src/ChamiloLMS/CoreBundle/Framework/Template.php @@ -1,14 +1,14 @@ * @todo better organization of the class, methods and variables * - * @package ChamiloLMS\Framework + * @package ChamiloLMS\CoreBundle\Framework */ class Template { @@ -56,21 +56,18 @@ class Template private $htmlEditor; /** - * @param Application $app * @param Database $database * @param SecurityContext $security * @param Translator $translator * @param Router $urlGenerator */ public function __construct( - Application $app, Database $database, SecurityContext $security, Translator $translator, Router $urlGenerator //Editor $htmlEditor ) { - $this->app = &$app; $this->security = $security; $this->translator = $translator; $this->urlGenerator = $urlGenerator; diff --git a/src/ChamiloLMS/Framework/Widget.php b/src/ChamiloLMS/CoreBundle/Framework/Widget.php similarity index 61% rename from src/ChamiloLMS/Framework/Widget.php rename to src/ChamiloLMS/CoreBundle/Framework/Widget.php index f7d898163c..903a9adf7b 100644 --- a/src/ChamiloLMS/Framework/Widget.php +++ b/src/ChamiloLMS/CoreBundle/Framework/Widget.php @@ -1,11 +1,11 @@ */ class Widget diff --git a/src/ChamiloLMS/CoreBundle/Listener/LoginSuccessHandler.php b/src/ChamiloLMS/CoreBundle/Listener/LoginSuccessHandler.php new file mode 100644 index 0000000000..36b7a3adc0 --- /dev/null +++ b/src/ChamiloLMS/CoreBundle/Listener/LoginSuccessHandler.php @@ -0,0 +1,139 @@ +container->get('database_connection'); + $database = new \Database($dbConnection, array()); + + $this->router = $urlGenerator; + $this->security = $security; + } + + /** + * @param Request $request + * @param TokenInterface $token + * @return null|RedirectResponse|\Symfony\Component\Security\Http\Authentication\Response + */ + public function onAuthenticationSuccess(Request $request, TokenInterface $token) + { + /** @var User $user */ + $user = $token->getUser(); + $userId = $user->getUserId(); + $session = $request->getSession(); + + \ChamiloSession::setSession($session); + \ChamiloSession::$urlGenerator = $this->router; + + event_login($user); + + $userInfo = api_get_user_info($user->getUserId()); + $userInfo['is_anonymous'] = false; + + $request->getSession()->set('_user', $userInfo); + + // Setting admin permissions. + if ($this->security->isGranted('ROLE_ADMIN')) { + $request->getSession()->set('is_platformAdmin', true); + } + + // Setting teachers permissions. + if ($this->security->isGranted('ROLE_TEACHER')) { + $request->getSession()->set('is_allowedCreateCourse', true); + } + + // Setting last login datetime + $session->set('user_last_login_datetime', api_get_utc_datetime()); + + $response = null; + /* Possible values: index.php, user_portal.php, main/auth/courses.php */ + $pageAfterLogin = api_get_setting('page_after_login'); + + $url = null; + if ($this->security->isGranted('ROLE_STUDENT') && !empty($pageAfterLogin)) { + switch ($pageAfterLogin) { + case 'index.php': + $url = $this->router->generate('index'); + break; + case 'user_portal.php': + $url = $this->router->generate('userportal'); + break; + case 'main/auth/courses.php': + $url = api_get_path(WEB_PUBLIC_PATH).$pageAfterLogin; + break; + } + } + + // Redirecting to a course or a session + + if (api_get_setting('go_to_course_after_login') == 'true') { + + // Get the courses list + $personal_course_list = \UserManager::get_personal_session_course_list($userId); + + $my_session_list = array(); + $count_of_courses_no_sessions = 0; + $count_of_courses_with_sessions = 0; + + foreach ($personal_course_list as $course) { + if (!empty($course['session_id'])) { + $my_session_list[$course['session_id']] = true; + $count_of_courses_with_sessions++; + } else { + $count_of_courses_no_sessions++; + } + } + + $count_of_sessions = count($my_session_list); + + if ($count_of_sessions == 1 && $count_of_courses_no_sessions == 0) { + $key = array_keys($personal_course_list); + $course_info = $personal_course_list[$key[0]]['course_info']; + $id_session = isset($course_info['session_id']) ? $course_info['session_id'] : 0; + + $url = api_get_path(WEB_COURSE_PATH).$course_info['directory'].'/index.php?id_session='.$id_session; + } + + if ($count_of_sessions == 0 && $count_of_courses_no_sessions == 1) { + $key = array_keys($personal_course_list); + $course_info = $personal_course_list[$key[0]]['course_info']; + $url = api_get_path(WEB_COURSE_PATH).$course_info['directory'].'/index.php?id_session=0'; + } + } + + if (!empty($url)) { + $response = new RedirectResponse($url); + } + + // Redirect the user to where they were before the login process begun. + if (empty($response)) { + $refererUrl = $request->headers->get('referer'); + $response = new RedirectResponse($refererUrl); + } + + return $response; + } +} diff --git a/src/ChamiloLMS/CoreBundle/Listener/LogoutSuccessHandler.php b/src/ChamiloLMS/CoreBundle/Listener/LogoutSuccessHandler.php new file mode 100644 index 0000000000..c8f630dfb4 --- /dev/null +++ b/src/ChamiloLMS/CoreBundle/Listener/LogoutSuccessHandler.php @@ -0,0 +1,49 @@ +router = $urlGenerator; + $this->security = $security; + } + + /** + * @param Request $request + * @return null|RedirectResponse + */ + public function onLogoutSuccess(Request $request) + { + $session = $request->getSession(); + \ChamiloSession::setSession($session); + + // Chamilo logout + $userId = api_get_user_id(); + //\Online::logout($userId, false); + + $login = $this->router->generate('index'); + $response = new RedirectResponse($login); + return $response; + } +} diff --git a/src/ChamiloLMS/Middleware/CourseMiddleware.php b/src/ChamiloLMS/CoreBundle/Middleware/CourseMiddleware.php similarity index 71% rename from src/ChamiloLMS/Middleware/CourseMiddleware.php rename to src/ChamiloLMS/CoreBundle/Middleware/CourseMiddleware.php index 7814bfe489..dc78019f64 100644 --- a/src/ChamiloLMS/Middleware/CourseMiddleware.php +++ b/src/ChamiloLMS/CoreBundle/Middleware/CourseMiddleware.php @@ -1,11 +1,11 @@ List diff --git a/src/ChamiloLMS/CoreBundle/Resources/views/Admin/administrator/branches/edit.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/Admin/administrator/branches/edit.tpl new file mode 100644 index 0000000000..f353746136 --- /dev/null +++ b/src/ChamiloLMS/CoreBundle/Resources/views/Admin/administrator/branches/edit.tpl @@ -0,0 +1,5 @@ +{% extends "@template_style/layout/layout_1_col.tpl" %} +{% block content %} + {% import "@template_style/crud_macros/simple_crud.tpl" as actions %} + {{ actions.edit(form, links) }} +{% endblock %} diff --git a/src/ChamiloLMS/Resources/views/default/admin/administrator/branches/list.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/Admin/administrator/branches/list.tpl similarity index 71% rename from src/ChamiloLMS/Resources/views/default/admin/administrator/branches/list.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/Admin/administrator/branches/list.tpl index f88e726e54..a88eec06cd 100644 --- a/src/ChamiloLMS/Resources/views/default/admin/administrator/branches/list.tpl +++ b/src/ChamiloLMS/CoreBundle/Resources/views/Admin/administrator/branches/list.tpl @@ -1,4 +1,4 @@ -{% extends app.template_style ~ "/layout/layout_1_col.tpl" %} +{% extends "@template_style/layout/layout_1_col.tpl" %} {% block content %} {{ 'Add' | trans }} diff --git a/src/ChamiloLMS/Resources/views/default/admin/administrator/branches/read.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/Admin/administrator/branches/read.tpl similarity index 84% rename from src/ChamiloLMS/Resources/views/default/admin/administrator/branches/read.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/Admin/administrator/branches/read.tpl index 413070fbe3..341620273c 100644 --- a/src/ChamiloLMS/Resources/views/default/admin/administrator/branches/read.tpl +++ b/src/ChamiloLMS/CoreBundle/Resources/views/Admin/administrator/branches/read.tpl @@ -1,4 +1,4 @@ -{% extends app.template_style ~ "/layout/layout_1_col.tpl" %} +{% extends "@template_style/layout/layout_1_col.tpl" %} {% block content %} List diff --git a/src/ChamiloLMS/CoreBundle/Resources/views/Admin/administrator/juries/add.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/Admin/administrator/juries/add.tpl new file mode 100644 index 0000000000..7baf80367b --- /dev/null +++ b/src/ChamiloLMS/CoreBundle/Resources/views/Admin/administrator/juries/add.tpl @@ -0,0 +1,5 @@ +{% extends "@template_style/layout/layout_1_col.tpl" %} +{% block content %} + {% import "@template_style/crud_macros/simple_crud.tpl" as actions %} + {{ actions.add(form, links) }} +{% endblock %} diff --git a/src/ChamiloLMS/Resources/views/default/admin/administrator/juries/add_members.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/Admin/administrator/juries/add_members.tpl similarity index 91% rename from src/ChamiloLMS/Resources/views/default/admin/administrator/juries/add_members.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/Admin/administrator/juries/add_members.tpl index bad993d878..e8ed856429 100644 --- a/src/ChamiloLMS/Resources/views/default/admin/administrator/juries/add_members.tpl +++ b/src/ChamiloLMS/CoreBundle/Resources/views/Admin/administrator/juries/add_members.tpl @@ -1,4 +1,4 @@ -{% extends app.template_style ~ "/layout/layout_1_col.tpl" %} +{% extends "@template_style/layout/layout_1_col.tpl" %} {% block content %} +
+
+
+

{{ 'VersionCheck' | trans }}

+
+
+
+
+ {% endif %} + {% endautoescape %} + {% endblock %} + {% endembed %} +{% endblock %} + + diff --git a/src/ChamiloLMS/Resources/views/default/admin/jury_member/index.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/Admin/jury_member/index.tpl similarity index 55% rename from src/ChamiloLMS/Resources/views/default/admin/jury_member/index.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/Admin/jury_member/index.tpl index 2d4614d44c..25b2c391fc 100644 --- a/src/ChamiloLMS/Resources/views/default/admin/jury_member/index.tpl +++ b/src/ChamiloLMS/CoreBundle/Resources/views/Admin/jury_member/index.tpl @@ -1,6 +1,6 @@ -{% extends app.template_style ~ "/layout/layout_1_col.tpl" %} +{% extends "@template_style/layout/layout_1_col.tpl" %} {% block content %}

{{ 'Lista de postulantes' |trans }}

- + {% endblock %} diff --git a/src/ChamiloLMS/Resources/views/default/admin/jury_member/score_user.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/Admin/jury_member/score_user.tpl similarity index 62% rename from src/ChamiloLMS/Resources/views/default/admin/jury_member/score_user.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/Admin/jury_member/score_user.tpl index ea7712f89e..fc8d89f839 100644 --- a/src/ChamiloLMS/Resources/views/default/admin/jury_member/score_user.tpl +++ b/src/ChamiloLMS/CoreBundle/Resources/views/Admin/jury_member/score_user.tpl @@ -1,4 +1,4 @@ -{% extends app.template_style ~ "/layout/layout_1_col.tpl" %} +{% extends "@template_style/layout/layout_1_col.tpl" %} {% block content %}

{{ 'Calificar usuario' |trans }}

diff --git a/src/ChamiloLMS/Resources/views/default/admin/jury_president/assign_members.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/Admin/jury_president/assign_members.tpl similarity index 97% rename from src/ChamiloLMS/Resources/views/default/admin/jury_president/assign_members.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/Admin/jury_president/assign_members.tpl index 4ceaae4000..a45115c371 100644 --- a/src/ChamiloLMS/Resources/views/default/admin/jury_president/assign_members.tpl +++ b/src/ChamiloLMS/CoreBundle/Resources/views/Admin/jury_president/assign_members.tpl @@ -1,4 +1,4 @@ -{% extends app.template_style ~ "/layout/layout_1_col.tpl" %} +{% extends "@template_style/layout/layout_1_col.tpl" %} {% block content %}
Asignar al azar
diff --git a/src/ChamiloLMS/CoreBundle/Resources/views/Admin/jury_president/check_answers.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/Admin/jury_president/check_answers.tpl new file mode 100644 index 0000000000..a841286fcd --- /dev/null +++ b/src/ChamiloLMS/CoreBundle/Resources/views/Admin/jury_president/check_answers.tpl @@ -0,0 +1,4 @@ +{% extends "@template_style/layout/layout_1_col.tpl" %} +{% block content %} + ?? +{% endblock %} diff --git a/src/ChamiloLMS/Resources/views/default/admin/jury_president/index.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/Admin/jury_president/index.tpl similarity index 93% rename from src/ChamiloLMS/Resources/views/default/admin/jury_president/index.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/Admin/jury_president/index.tpl index ad43618c2f..b4fc82c9f0 100644 --- a/src/ChamiloLMS/Resources/views/default/admin/jury_president/index.tpl +++ b/src/ChamiloLMS/CoreBundle/Resources/views/Admin/jury_president/index.tpl @@ -1,4 +1,4 @@ -{% extends app.template_style ~ "/layout/layout_1_col.tpl" %} +{% extends "@template_style/layout/layout_1_col.tpl" %} {% block content %}

{{ 'Actas administrativas' |trans }}

diff --git a/src/ChamiloLMS/Resources/views/default/admin/question_manager/edit_category.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/Admin/question_manager/edit_category.tpl similarity index 87% rename from src/ChamiloLMS/Resources/views/default/admin/question_manager/edit_category.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/Admin/question_manager/edit_category.tpl index 144753ee3b..c91199d260 100644 --- a/src/ChamiloLMS/Resources/views/default/admin/question_manager/edit_category.tpl +++ b/src/ChamiloLMS/CoreBundle/Resources/views/Admin/question_manager/edit_category.tpl @@ -1,4 +1,4 @@ -{% extends app.template_style ~ "/layout/layout_1_col.tpl" %} +{% extends "@template_style/layout/layout_1_col.tpl" %} {% block content %} {% endblock %} diff --git a/src/ChamiloLMS/Resources/views/default/admin/question_manager/questionmanager.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/Admin/question_manager/questionmanager.tpl similarity index 64% rename from src/ChamiloLMS/Resources/views/default/admin/question_manager/questionmanager.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/Admin/question_manager/questionmanager.tpl index ee756f5dca..b4940e9a6f 100644 --- a/src/ChamiloLMS/Resources/views/default/admin/question_manager/questionmanager.tpl +++ b/src/ChamiloLMS/CoreBundle/Resources/views/Admin/question_manager/questionmanager.tpl @@ -1,4 +1,4 @@ -{% extends app.template_style ~ "/layout/layout_1_col.tpl" %} +{% extends "@template_style/layout/layout_1_col.tpl" %} {% block content %} {% include app.template_style ~ '/admin/question_manager/role_index.tpl' %} {% endblock %} diff --git a/src/ChamiloLMS/Resources/views/default/admin/question_manager/questions.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/Admin/question_manager/questions.tpl similarity index 98% rename from src/ChamiloLMS/Resources/views/default/admin/question_manager/questions.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/Admin/question_manager/questions.tpl index 09d78d2261..f91a98f381 100644 --- a/src/ChamiloLMS/Resources/views/default/admin/question_manager/questions.tpl +++ b/src/ChamiloLMS/CoreBundle/Resources/views/Admin/question_manager/questions.tpl @@ -48,7 +48,7 @@ multipleSearch : true, overlay : false, width: 'auto', - caption: '{{ 'Search' | get_lang }}', + caption: '{{ 'Search' | trans }}', formclass:'data_table', onSearch : function() { var postdata = grid.jqGrid('getGridParam', 'postData'); diff --git a/src/ChamiloLMS/Resources/views/default/admin/question_manager/role_index.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/Admin/question_manager/role_index.tpl similarity index 70% rename from src/ChamiloLMS/Resources/views/default/admin/question_manager/role_index.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/Admin/question_manager/role_index.tpl index 1fca237672..a986891b41 100644 --- a/src/ChamiloLMS/Resources/views/default/admin/question_manager/role_index.tpl +++ b/src/ChamiloLMS/CoreBundle/Resources/views/Admin/question_manager/role_index.tpl @@ -1,19 +1,19 @@
-

{{ 'Questions' | get_lang }}

+

{{ 'Questions' | trans }}

diff --git a/src/ChamiloLMS/Resources/views/default/admin/question_manager/show_category.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/Admin/question_manager/show_category.tpl similarity index 61% rename from src/ChamiloLMS/Resources/views/default/admin/question_manager/show_category.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/Admin/question_manager/show_category.tpl index 3198586c5e..cfd9fbb7d8 100644 --- a/src/ChamiloLMS/Resources/views/default/admin/question_manager/show_category.tpl +++ b/src/ChamiloLMS/CoreBundle/Resources/views/Admin/question_manager/show_category.tpl @@ -1,4 +1,4 @@ -{% extends app.template_style ~ "/layout/layout_1_col.tpl" %} +{% extends "@template_style/layout/layout_1_col.tpl" %} {% block content %}

{{ category.title }}

diff --git a/src/ChamiloLMS/Resources/views/default/admin/session_manager/role_index.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/Admin/session_manager/role_index.tpl similarity index 98% rename from src/ChamiloLMS/Resources/views/default/admin/session_manager/role_index.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/Admin/session_manager/role_index.tpl index 09c3c0641d..e36acea7df 100644 --- a/src/ChamiloLMS/Resources/views/default/admin/session_manager/role_index.tpl +++ b/src/ChamiloLMS/CoreBundle/Resources/views/Admin/session_manager/role_index.tpl @@ -1,8 +1,8 @@

- {{ 'Users' | get_lang }} - {{ 'Users' | get_lang }} + {{ 'Users' | trans }} + {{ 'Users' | trans }}

diff --git a/src/ChamiloLMS/Resources/views/default/tool/course_home/tool/edit.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/Tool/CourseHome/edit.tpl similarity index 65% rename from src/ChamiloLMS/Resources/views/default/tool/course_home/tool/edit.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/Tool/CourseHome/edit.tpl index 6fb19f6aeb..bbb0e31efc 100644 --- a/src/ChamiloLMS/Resources/views/default/tool/course_home/tool/edit.tpl +++ b/src/ChamiloLMS/CoreBundle/Resources/views/Tool/CourseHome/edit.tpl @@ -1,6 +1,6 @@ -{% extends app.template_style ~ "/layout/layout_1_col.tpl" %} +{% extends "@template_style/layout/layout_1_col.tpl" %} {% block content %} - {% import app.template_style ~ "/crud_macros/course_crud.tpl" as actions %} + {% import "@template_style/crud_macros/course_crud.tpl" as actions %}
{{ form_widget(form) }}
diff --git a/src/ChamiloLMS/CoreBundle/Resources/views/Tool/CourseHome/index.html.twig b/src/ChamiloLMS/CoreBundle/Resources/views/Tool/CourseHome/index.html.twig new file mode 100644 index 0000000000..2f0262fc68 --- /dev/null +++ b/src/ChamiloLMS/CoreBundle/Resources/views/Tool/CourseHome/index.html.twig @@ -0,0 +1,106 @@ +{% extends 'ChamiloLMSCoreBundle::page.html.twig' %} + +{% block layout %} + {% embed 'ChamiloLMSCoreBundle::3-9.html.twig' %} + {% block content %} + {% autoescape false %} + + + +
+ + +
+ + {% if session_info %} +
+ {{ 'SessionData' | trans }} + + {{ session_info }} +
+
+ {% endif %} + + {{ lp_warning }} + {{ exercise_warning }} + {{ introduction_text }} + {{ edit_icons }} + +
+ {{ icons }} +
+ {% endautoescape %} + {% endblock %} + + {% endembed %} +{% endblock %} + + diff --git a/src/ChamiloLMS/Resources/views/default/tool/course_home/tool/list.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/Tool/CourseHome/list.tpl similarity index 98% rename from src/ChamiloLMS/Resources/views/default/tool/course_home/tool/list.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/Tool/CourseHome/list.tpl index 066e5c4aca..a3ce1a1ae1 100644 --- a/src/ChamiloLMS/Resources/views/default/tool/course_home/tool/list.tpl +++ b/src/ChamiloLMS/CoreBundle/Resources/views/Tool/CourseHome/list.tpl @@ -1,4 +1,4 @@ -{% extends app.template_style ~ "/layout/layout_1_col.tpl" %} +{% extends "@template_style/layout/layout_1_col.tpl" %} {% block content %} {% if items_from_session %} @@ -80,4 +80,4 @@ -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/src/ChamiloLMS/Resources/views/default/agenda/month.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/agenda/month.tpl similarity index 95% rename from src/ChamiloLMS/Resources/views/default/agenda/month.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/default/agenda/month.tpl index 67353738d5..eced9d0482 100644 --- a/src/ChamiloLMS/Resources/views/default/agenda/month.tpl +++ b/src/ChamiloLMS/CoreBundle/Resources/views/default/agenda/month.tpl @@ -1,4 +1,4 @@ -{% extends app.template_style ~ "/layout/layout_1_col.tpl" %} +{% extends "@template_style/layout/layout_1_col.tpl" %} {% block content %} {% for message in messages %} @@ -52,20 +52,20 @@ {% if is_allowed_to_edit %}
- {% for type in types %} - + {% for type in types %} + {{type.title}} - + {% endfor %}
@@ -78,26 +78,26 @@
{% if is_allowed_to_edit %}
- {% if session_id == description.session_id %} - + title="{{'Delete'|trans}}"> - + {% else %} - {{'EditionNotAvailableFromSession'|get_lang}} {% endif %}
{% endif %} - + {{description.type.title}} {{description.title}}
@@ -106,4 +106,4 @@
{% endfor %} - \ No newline at end of file + diff --git a/src/ChamiloLMS/Resources/views/default/course_description/upload.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/course_description/upload.tpl similarity index 85% rename from src/ChamiloLMS/Resources/views/default/course_description/upload.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/default/course_description/upload.tpl index b07f0a87bc..f804cda3f0 100644 --- a/src/ChamiloLMS/Resources/views/default/course_description/upload.tpl +++ b/src/ChamiloLMS/CoreBundle/Resources/views/default/course_description/upload.tpl @@ -6,10 +6,10 @@ -{{form.return_form()}} \ No newline at end of file +{{form.return_form()}} diff --git a/src/ChamiloLMS/Resources/views/default/create_course/add_course.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/create_course/add_course.tpl similarity index 79% rename from src/ChamiloLMS/Resources/views/default/create_course/add_course.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/default/create_course/add_course.tpl index 131ca14435..436ff215c3 100644 --- a/src/ChamiloLMS/Resources/views/default/create_course/add_course.tpl +++ b/src/ChamiloLMS/CoreBundle/Resources/views/default/create_course/add_course.tpl @@ -1,11 +1,11 @@ -{% extends app.template_style ~ "/layout/layout_1_col.tpl" %} +{% extends "@template_style/layout/layout_1_col.tpl" %} {% block content %} {{ just_created_link }} -

{{ 'JustCreated'|get_lang }} {{ course_title }}

+

{{ 'JustCreated'|trans }} {{ course_title }}


-

{{ 'ThingsToDo'|get_lang }}

+

{{ 'ThingsToDo'|trans }}


@@ -26,7 +26,7 @@
@@ -38,7 +38,7 @@
@@ -48,11 +48,11 @@
-{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/src/ChamiloLMS/Resources/views/default/crud_macros/course_crud.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/crud_macros/course_crud.tpl similarity index 100% rename from src/ChamiloLMS/Resources/views/default/crud_macros/course_crud.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/default/crud_macros/course_crud.tpl diff --git a/src/ChamiloLMS/Resources/views/default/crud_macros/simple_crud.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/crud_macros/simple_crud.tpl similarity index 100% rename from src/ChamiloLMS/Resources/views/default/crud_macros/simple_crud.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/default/crud_macros/simple_crud.tpl diff --git a/src/ChamiloLMS/CoreBundle/Resources/views/default/exercise/question/edit_question.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/exercise/question/edit_question.tpl new file mode 100644 index 0000000000..9d8881f26a --- /dev/null +++ b/src/ChamiloLMS/CoreBundle/Resources/views/default/exercise/question/edit_question.tpl @@ -0,0 +1,4 @@ +{% extends "@template_style/layout/layout_1_col.tpl" %} +{% block content %} + {{ form }} +{% endblock %} diff --git a/src/ChamiloLMS/Resources/views/default/exercise/question/show_question.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/exercise/question/show_question.tpl similarity index 91% rename from src/ChamiloLMS/Resources/views/default/exercise/question/show_question.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/default/exercise/question/show_question.tpl index e4e056863a..300ed04174 100644 --- a/src/ChamiloLMS/Resources/views/default/exercise/question/show_question.tpl +++ b/src/ChamiloLMS/CoreBundle/Resources/views/default/exercise/question/show_question.tpl @@ -1,4 +1,4 @@ -{% extends app.template_style ~ "/layout/layout_1_col.tpl" %} +{% extends "@template_style/layout/layout_1_col.tpl" %} {% block content %} {% if (app.request.get('exerciseId')) %} diff --git a/src/ChamiloLMS/Resources/views/default/exercise/question_pool.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/exercise/question_pool.tpl similarity index 97% rename from src/ChamiloLMS/Resources/views/default/exercise/question_pool.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/default/exercise/question_pool.tpl index b7e55a116b..68e597803f 100644 --- a/src/ChamiloLMS/Resources/views/default/exercise/question_pool.tpl +++ b/src/ChamiloLMS/CoreBundle/Resources/views/default/exercise/question_pool.tpl @@ -1,4 +1,4 @@ -{% extends app.template_style ~ "/layout/layout_1_col.tpl" %} +{% extends "@template_style/layout/layout_1_col.tpl" %} {% block content %} \ No newline at end of file + diff --git a/src/ChamiloLMS/Resources/views/default/glossary/list.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/glossary/list.tpl similarity index 80% rename from src/ChamiloLMS/Resources/views/default/glossary/list.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/default/glossary/list.tpl index 89a2cf0f4b..1580371f88 100644 --- a/src/ChamiloLMS/Resources/views/default/glossary/list.tpl +++ b/src/ChamiloLMS/CoreBundle/Resources/views/default/glossary/list.tpl @@ -6,25 +6,25 @@ {% if is_allowed_to_edit %}
{% if session_id == item.session_id %} - + - - + + title="{{'Delete'|trans}}"> - + {% else %} - {{'EditionNotAvailableFromSession'|get_lang}} {% endif %}
{% endif %} - + {{item.name}}
@@ -32,4 +32,4 @@
{% endfor %} - \ No newline at end of file + diff --git a/src/ChamiloLMS/Resources/views/default/glossary/table.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/glossary/table.tpl similarity index 72% rename from src/ChamiloLMS/Resources/views/default/glossary/table.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/default/glossary/table.tpl index 9e9feadf0f..89360f6c0d 100644 --- a/src/ChamiloLMS/Resources/views/default/glossary/table.tpl +++ b/src/ChamiloLMS/CoreBundle/Resources/views/default/glossary/table.tpl @@ -1,14 +1,14 @@ + +{{ new_breadcrumb }} + +{% if ("student_view_enabled" | get_setting) == 'true' %} + {% if is_granted('ROLE_TEACHER') and app.session.get('_cid') %} + + {% endif %} +{% endif %} diff --git a/src/ChamiloLMS/Resources/views/default/layout/course_navigation.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/layout/course_navigation.tpl similarity index 89% rename from src/ChamiloLMS/Resources/views/default/layout/course_navigation.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/default/layout/course_navigation.tpl index 5821245452..bdf94112d2 100644 --- a/src/ChamiloLMS/Resources/views/default/layout/course_navigation.tpl +++ b/src/ChamiloLMS/CoreBundle/Resources/views/default/layout/course_navigation.tpl @@ -1,5 +1,4 @@ {# Course navigation icons #} -{% if app.template.show_header == true %} {% if show_course_shortcut is not null %}
@@ -44,19 +43,18 @@ if (center_el) { center_el.style.margin = '0 190px 0 0'; } - swap_menu_link_el.innerHTML = '{{'Hide'|get_lang}}'; + swap_menu_link_el.innerHTML = '{{'Hide'|trans}}'; createCookie('menu_state',1,10); } else { toolnavlist_el.style.display = 'none'; if (center_el) { center_el.style.margin = '0 0 0 0'; } - swap_menu_link_el.innerHTML = '{{'Show'|get_lang}}'; + swap_menu_link_el.innerHTML = '{{'Show'|trans}}'; createCookie('menu_state',0,10); } } - document.write(''); + document.write(''); {{ show_course_navigation_menu }} {% endif %} -{% endif %} diff --git a/src/ChamiloLMS/Resources/views/default/layout/error.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/layout/error.tpl similarity index 100% rename from src/ChamiloLMS/Resources/views/default/layout/error.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/default/layout/error.tpl diff --git a/src/ChamiloLMS/Resources/views/default/layout/footer.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/layout/footer.tpl similarity index 98% rename from src/ChamiloLMS/Resources/views/default/layout/footer.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/default/layout/footer.tpl index 7b56dda5d1..7b3d4a04cb 100644 --- a/src/ChamiloLMS/Resources/views/default/layout/footer.tpl +++ b/src/ChamiloLMS/CoreBundle/Resources/views/default/layout/footer.tpl @@ -43,7 +43,9 @@ {% endif %} {# Plugins for footer section #} @@ -309,5 +311,4 @@ $(document).ready( function() { }); {% endraw %} -{{ execution_stats }} {% endif %} diff --git a/src/ChamiloLMS/CoreBundle/Resources/views/default/layout/head.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/layout/head.tpl new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/ChamiloLMS/CoreBundle/Resources/views/default/layout/header.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/layout/header.tpl new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/ChamiloLMS/Resources/views/default/layout/hot_course_item.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/layout/hot_course_item.tpl similarity index 100% rename from src/ChamiloLMS/Resources/views/default/layout/hot_course_item.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/default/layout/hot_course_item.tpl diff --git a/src/ChamiloLMS/Resources/views/default/layout/hot_course_item_popup.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/layout/hot_course_item_popup.tpl similarity index 100% rename from src/ChamiloLMS/Resources/views/default/layout/hot_course_item_popup.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/default/layout/hot_course_item_popup.tpl diff --git a/src/ChamiloLMS/Resources/views/default/layout/hot_courses.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/layout/hot_courses.tpl similarity index 59% rename from src/ChamiloLMS/Resources/views/default/layout/hot_courses.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/default/layout/hot_courses.tpl index f9f8d9b3a2..872d879863 100644 --- a/src/ChamiloLMS/Resources/views/default/layout/hot_courses.tpl +++ b/src/ChamiloLMS/CoreBundle/Resources/views/default/layout/hot_courses.tpl @@ -4,16 +4,16 @@ $(document).ready( function() { $('.star-rating li a').on('click', function(event) { var id = $(this).parents('ul').attr('id'); - $('#vote_label2_' + id).html("{{'Loading'|get_lang}}"); + $('#vote_label2_' + id).html("{{'Loading'|trans}}"); $.ajax({ url: $(this).attr('data-link'), success: function(data) { $("#rating_wrapper_"+id).html(data); if (data == 'added') { - //$('#vote_label2_' + id).html("{{'Saved'|get_lang}}"); + //$('#vote_label2_' + id).html("{{'Saved'|trans}}"); } if (data == 'updated') { - //$('#vote_label2_' + id).html("{{'Saved'|get_lang}}"); + //$('#vote_label2_' + id).html("{{'Saved'|trans}}"); } } }); @@ -26,17 +26,17 @@ $(document).ready( function() { {% if _u.is_admin %} {% endif %} - {{ "HottestCourses"|display_page_subheader }} +

{{ "HottestCourses" | display_page_subheader }}

- {% include app.template_style ~ '/layout/hot_course_item.tpl' %} + {% include '@template_style/layout/hot_course_item.tpl' %}
{% endif %} diff --git a/src/ChamiloLMS/CoreBundle/Resources/views/default/layout/layout_1_col.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/layout/layout_1_col.tpl new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/ChamiloLMS/Resources/views/default/layout/layout_2_col.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/layout/layout_2_col.tpl similarity index 83% rename from src/ChamiloLMS/Resources/views/default/layout/layout_2_col.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/default/layout/layout_2_col.tpl index a37b00944f..b942043baf 100644 --- a/src/ChamiloLMS/Resources/views/default/layout/layout_2_col.tpl +++ b/src/ChamiloLMS/CoreBundle/Resources/views/default/layout/layout_2_col.tpl @@ -1,4 +1,4 @@ -{% extends app.template_style ~ "/layout/main.tpl" %} +{% extends "@template_style/layout/main.tpl" %} {% block body %}
@@ -27,13 +27,13 @@ {# ?? #} {{ sniff_notification }} - {% include app.template_style ~ "/layout/page_body.tpl" %} + {% include "@template_style/layout/page_body.tpl" %} {% if content is not null %} {{ content }} {% endif %} - {% include app.template_style ~ "/layout/page_post_body.tpl" %} + {% include "@template_style/layout/page_post_body.tpl" %} {# Announcements #} {% if announcements_block %} @@ -54,7 +54,7 @@ {% endif %} {# Hot courses template #} - {% include app.template_style ~ "/layout/hot_courses.tpl" %} + {% include "@template_style/layout/hot_courses.tpl" %} {# Content bottom #} {% if plugin_content_bottom %} @@ -67,9 +67,6 @@ {# Footer #} - {% include app.template_style ~ "/layout/footer.tpl" %} + {% include "@template_style/layout/footer.tpl" %}
- - - {% endblock %} diff --git a/src/ChamiloLMS/Resources/views/default/layout/login_form.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/layout/login_form.tpl similarity index 100% rename from src/ChamiloLMS/Resources/views/default/layout/login_form.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/default/layout/login_form.tpl diff --git a/src/ChamiloLMS/Resources/views/default/layout/header.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/layout/main.tpl similarity index 51% rename from src/ChamiloLMS/Resources/views/default/layout/header.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/default/layout/main.tpl index 860cdcf847..110565ebe1 100644 --- a/src/ChamiloLMS/Resources/views/default/layout/header.tpl +++ b/src/ChamiloLMS/CoreBundle/Resources/views/default/layout/main.tpl @@ -1,22 +1,19 @@ -{% include app.template_style ~ "/layout/head.tpl" %} -{% set classBody = 'no-sidebar' %} -{% if app.template.show_header == true %} - {% set classBody = '' %} -{% endif %} - -{% set classMain = '' %} -{% if show_toolbar == 1 %} - {% set classMain = 'with-toolbar' %} - {% set classMain = '' %} -{% endif %} +{% include "@template_style/layout/head.tpl" %} + + +{% block header %} -{% set containerClass = 'container-fluid' %} + {% set classMain = '' %} + {% if show_toolbar == 1 %} + {% set classMain = 'with-toolbar' %} + {% set classMain = '' %} + {% endif %} -{% if app.template.show_header == true %} + {% set containerClass = 'container-fluid' %}
@@ -67,41 +64,48 @@ {% endif %} {# menu #} - {% include app.template_style ~ "/layout/menu.tpl" %} + {% include "@template_style/layout/menu.tpl" %}
{# Bug and help notifications #} {% if 0 %} - {% endif %} {# topbar #} - {% include app.template_style ~ "/layout/topbar.tpl" %} + {% include "@template_style/layout/topbar.tpl" %}
- {% include app.template_style ~ "/layout/sidebar.tpl" %} - {# course navigation links/shortcuts need to be activated by the admin #} - {% include app.template_style ~ "/layout/course_navigation.tpl" %} -{% endif %} + +{% endblock %} + +{% block body %} + {% block content %} + {% endblock %} +{% endblock %} + + + + diff --git a/src/ChamiloLMS/Resources/views/default/layout/menu.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/layout/menu.tpl similarity index 88% rename from src/ChamiloLMS/Resources/views/default/layout/menu.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/default/layout/menu.tpl index 7e3aee771c..83e5cc962a 100644 --- a/src/ChamiloLMS/Resources/views/default/layout/menu.tpl +++ b/src/ChamiloLMS/CoreBundle/Resources/views/default/layout/menu.tpl @@ -10,7 +10,9 @@
diff --git a/src/ChamiloLMS/Resources/views/default/layout/messages.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/layout/messages.tpl similarity index 100% rename from src/ChamiloLMS/Resources/views/default/layout/messages.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/default/layout/messages.tpl diff --git a/src/ChamiloLMS/Resources/views/default/layout/no_layout.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/layout/no_layout.tpl similarity index 75% rename from src/ChamiloLMS/Resources/views/default/layout/no_layout.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/default/layout/no_layout.tpl index 58ada5a9bd..7e6be3e6a8 100644 --- a/src/ChamiloLMS/Resources/views/default/layout/no_layout.tpl +++ b/src/ChamiloLMS/CoreBundle/Resources/views/default/layout/no_layout.tpl @@ -1,4 +1,4 @@ -{% include app.template_style ~ "/layout/head.tpl" %} +{% include "@template_style/layout/head.tpl" %} {% block name %} {% endblock %} diff --git a/src/ChamiloLMS/Resources/views/default/layout/page_body.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/layout/page_body.tpl similarity index 78% rename from src/ChamiloLMS/Resources/views/default/layout/page_body.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/default/layout/page_body.tpl index d844af8592..8a89a97f83 100644 --- a/src/ChamiloLMS/Resources/views/default/layout/page_body.tpl +++ b/src/ChamiloLMS/CoreBundle/Resources/views/default/layout/page_body.tpl @@ -6,10 +6,6 @@
{% endif %} - {% if actions_menu != '' %} - {{ knp_menu_render('actions_menu', { 'currentClass': 'active'}) }} - {% endif %} - {# Page header #} @@ -32,12 +28,12 @@ {{ message}} {% endif %} - {% include app.template_style ~ "/layout/messages.tpl" %} + {% include "@template_style/layout/messages.tpl" %} {# Welcome to course block #} {% if welcome_to_course_block %}
- {% include app.template_style ~ "/layout/welcome_to_course.tpl" %} + {% include "@template_style/layout/welcome_to_course.tpl" %}
{% endif %} diff --git a/src/ChamiloLMS/Resources/views/default/layout/page_post_body.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/layout/page_post_body.tpl similarity index 100% rename from src/ChamiloLMS/Resources/views/default/layout/page_post_body.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/default/layout/page_post_body.tpl diff --git a/src/ChamiloLMS/Resources/views/default/layout/sidebar.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/layout/sidebar.tpl similarity index 60% rename from src/ChamiloLMS/Resources/views/default/layout/sidebar.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/default/layout/sidebar.tpl index 88d4fbc27f..681ac902a3 100644 --- a/src/ChamiloLMS/Resources/views/default/layout/sidebar.tpl +++ b/src/ChamiloLMS/CoreBundle/Resources/views/default/layout/sidebar.tpl @@ -23,84 +23,82 @@ {% endif %} - {% if _u.logged == 1 %} + {% if app.user %} {% endif %} @@ -113,51 +111,36 @@ {% endif %} {# if user is not login show the login form #} - {% if _u.logged == 0 %} - {% include app.template_style ~ "/layout/login_form.tpl" %} - {% endif %} + {% render controller("ChamiloLMSCoreBundle:Front:showLogin") %} {# course_session_block #} - {% include app.template_style ~ "/index/course_session_block.tpl" %} + {% render controller("ChamiloLMSCoreBundle:Front:showCourseSessionBlock") %} {# User picture #} - {# include app.template_style ~ "/index/user_image_block.tpl" #} + {# include "@template_style/index/user_image_block.tpl" #} {# User Profile links #} - {# include app.template_style ~ "/index/profile_block.tpl" #} + {# include "@template_style/index/profile_block.tpl" #} {# Social links #} - {# include app.template_style ~ "/index/profile_social_block.tpl" #} + {# include "@template_style/index/profile_social_block.tpl" #} {# Course block - admin #} - {% include app.template_style ~ "/index/course_block.tpl" %} + {% render controller("ChamiloLMSCoreBundle:Front:showCourseBlock") %} {# Course block - teacher #} - {% include app.template_style ~ "/index/teacher_block.tpl" %} + {% render controller("ChamiloLMSCoreBundle:Front:showTeacherBlock") %} {# Session block #} - {% include app.template_style ~ "/index/session_block.tpl" %} - - {# Notice #} - {% include app.template_style ~ "/index/notice_block.tpl" %} - - {# Help #} - {% include app.template_style ~ "/index/help_block.tpl" %} - - {# Links that are not added in the tabs #} - {% include app.template_style ~ "/index/navigation_block.tpl" %} + {% render controller("ChamiloLMSCoreBundle:Front:showSessionBlock") %} - {# Reservation block #} - {{ reservation_block }} + {% render controller("ChamiloLMSCoreBundle:Front:showNoticeBlock") %} - {# Search (xapian) #} - {{ search_block }} + {% render controller("ChamiloLMSCoreBundle:Front:showHelpBlock") %} - {# Classes #} - {{ classes_block }} + {% render controller("ChamiloLMSCoreBundle:Front:showNavigationBlock") %} - {# Skills #} - {% include app.template_style ~ "/index/skills_block.tpl" %} + {% render controller("ChamiloLMSCoreBundle:Front:showSkillsBlock") %} {# Plugin courses sidebar #} {# Plugins for footer section #} diff --git a/src/ChamiloLMS/Resources/views/default/layout/sniff.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/layout/sniff.tpl similarity index 100% rename from src/ChamiloLMS/Resources/views/default/layout/sniff.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/default/layout/sniff.tpl diff --git a/src/ChamiloLMS/Resources/views/default/layout/social_layout.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/layout/social_layout.tpl similarity index 85% rename from src/ChamiloLMS/Resources/views/default/layout/social_layout.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/default/layout/social_layout.tpl index 83a9ee40df..157c5d87a4 100644 --- a/src/ChamiloLMS/Resources/views/default/layout/social_layout.tpl +++ b/src/ChamiloLMS/CoreBundle/Resources/views/default/layout/social_layout.tpl @@ -1,4 +1,4 @@ -{% extends app.template_style ~ "/layout/layout_1_col.tpl" %} +{% extends "@template_style/layout/layout_1_col.tpl" %} {% block content %}
@@ -14,4 +14,4 @@
-{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/src/ChamiloLMS/CoreBundle/Resources/views/default/layout/topbar.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/layout/topbar.tpl new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/ChamiloLMS/Resources/views/default/layout/welcome_to_course.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/layout/welcome_to_course.tpl similarity index 61% rename from src/ChamiloLMS/Resources/views/default/layout/welcome_to_course.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/default/layout/welcome_to_course.tpl index 4fe478ac5e..ab90e5e157 100644 --- a/src/ChamiloLMS/Resources/views/default/layout/welcome_to_course.tpl +++ b/src/ChamiloLMS/CoreBundle/Resources/views/default/layout/welcome_to_course.tpl @@ -1,18 +1,18 @@ -{{ "HelloXAsYouCanSeeYourCourseListIsEmpty"|get_lang | format(_u.complete_name) }} +{{ "HelloXAsYouCanSeeYourCourseListIsEmpty"|trans | format(_u.complete_name) }} {% if count_courses == 0 %} - {{ "PleaseAllowUsALittleTimeToSubscribeYouToOneOfOurCourses"|get_lang }} + {{ "PleaseAllowUsALittleTimeToSubscribeYouToOneOfOurCourses"|trans }} {% else %} {% if "allow_students_to_browse_courses"|get_setting == 'true' %} - - {{ "GoAheadAndBrowseOurCourseCatalogXOnceRegisteredYouWillSeeTheCourseHereX"|get_lang|format(course_catalog_link, course_list_link) }} - + + {{ "GoAheadAndBrowseOurCourseCatalogXOnceRegisteredYouWillSeeTheCourseHereX"|trans|format(course_catalog_link, course_list_link) }} + - {{ "CourseCatalog"|get_lang }} + {{ "CourseCatalog"|trans }} {% else %} - {{ "PleaseAllowUsALittleTimeToSubscribeYouToOneOfOurCourses"|get_lang }} + {{ "PleaseAllowUsALittleTimeToSubscribeYouToOneOfOurCourses"|trans }} {% endif %} -{% endif %} \ No newline at end of file +{% endif %} diff --git a/src/ChamiloLMS/Resources/views/default/learnpath/impress.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/learnpath/impress.tpl similarity index 100% rename from src/ChamiloLMS/Resources/views/default/learnpath/impress.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/default/learnpath/impress.tpl diff --git a/src/ChamiloLMS/Resources/views/default/learnpath/lp.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/learnpath/lp.tpl similarity index 93% rename from src/ChamiloLMS/Resources/views/default/learnpath/lp.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/default/learnpath/lp.tpl index 40aded8c07..822ead5a4a 100644 --- a/src/ChamiloLMS/Resources/views/default/learnpath/lp.tpl +++ b/src/ChamiloLMS/CoreBundle/Resources/views/default/learnpath/lp.tpl @@ -1,13 +1,13 @@ -{% extends app.template_style ~ "/layout/no_layout.tpl" %} +{% extends "@template_style/layout/no_layout.tpl" %} {% block body %} -{% include app.template_style ~ "/learnpath/lp_js.tpl" %} +{% include "@template_style/learnpath/lp_js.tpl" %}
{% if api_is_allowed_to_edit %}
- {% include app.template_style ~ "/layout/breadcrumb.tpl" %} + {% include "@template_style/layout/breadcrumb.tpl" %}
{% endif %} @@ -75,4 +75,4 @@
-{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/src/ChamiloLMS/Resources/views/default/learnpath/lp_js.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/learnpath/lp_js.tpl similarity index 100% rename from src/ChamiloLMS/Resources/views/default/learnpath/lp_js.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/default/learnpath/lp_js.tpl diff --git a/src/ChamiloLMS/Resources/views/default/learnpath/lp_upload_audio.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/learnpath/lp_upload_audio.tpl similarity index 100% rename from src/ChamiloLMS/Resources/views/default/learnpath/lp_upload_audio.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/default/learnpath/lp_upload_audio.tpl diff --git a/src/ChamiloLMS/Resources/views/default/learnpath/record_voice.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/learnpath/record_voice.tpl similarity index 93% rename from src/ChamiloLMS/Resources/views/default/learnpath/record_voice.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/default/learnpath/record_voice.tpl index ad25b11230..9402f80584 100644 --- a/src/ChamiloLMS/Resources/views/default/learnpath/record_voice.tpl +++ b/src/ChamiloLMS/CoreBundle/Resources/views/default/learnpath/record_voice.tpl @@ -6,17 +6,17 @@
- {{ 'RecordAudio' | get_lang }} - + {{ 'RecordAudio' | trans }} +
- {{ 'ActivateAudioRecorder' | get_lang }} + {{ 'ActivateAudioRecorder' | trans }}
@@ -28,8 +28,8 @@
-
@@ -62,11 +62,11 @@ function checkWamiEnable() { function submitVoice() { // lang vars - var lang_no_applet = "{{ 'NanogongNoApplet' | get_lang }}"; - var lang_record_before_save = "{{ 'NanogongRecordBeforeSave' | get_lang }}"; - var lang_give_a_title = "{{ 'NanogongGiveTitle' | get_lang }}"; - var lang_failled_to_submit = "{{ 'NanogongFailledToSubmit' | get_lang }}"; - var lang_submitted = "{{'NanogongSubmitted' | get_lang }}"; + var lang_no_applet = "{{ 'NanogongNoApplet' | trans }}"; + var lang_record_before_save = "{{ 'NanogongRecordBeforeSave' | trans }}"; + var lang_give_a_title = "{{ 'NanogongGiveTitle' | trans }}"; + var lang_failled_to_submit = "{{ 'NanogongFailledToSubmit' | trans }}"; + var lang_submitted = "{{'NanogongSubmitted' | trans }}"; // user and group id //path, url and filename @@ -152,7 +152,7 @@ $(document).ready(function() { return false; }); } else { - $('#record-result').html("{{ 'RecordIsNotAvailable' | get_lang }}"); + $('#record-result').html("{{ 'RecordIsNotAvailable' | trans }}"); } // Start web RTC code diff --git a/src/ChamiloLMS/Resources/views/default/learnpath/subscribe_users.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/learnpath/subscribe_users.tpl similarity index 88% rename from src/ChamiloLMS/Resources/views/default/learnpath/subscribe_users.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/default/learnpath/subscribe_users.tpl index c510ed37d8..b7cb8d4bf5 100644 --- a/src/ChamiloLMS/Resources/views/default/learnpath/subscribe_users.tpl +++ b/src/ChamiloLMS/CoreBundle/Resources/views/default/learnpath/subscribe_users.tpl @@ -1,7 +1,7 @@ -{% extends app.template_style ~ "/layout/layout_1_col.tpl" %} +{% extends "@template_style/layout/layout_1_col.tpl" %} {% block content %} {# -

{{ 'SubscribeUsersToLp' | get_lang }}

+

{{ 'SubscribeUsersToLp' | trans }}

\ No newline at end of file + diff --git a/src/ChamiloLMS/Resources/views/default/notebook/list.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/notebook/list.tpl similarity index 88% rename from src/ChamiloLMS/Resources/views/default/notebook/list.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/default/notebook/list.tpl index b86633dfa3..b47f5d86dd 100644 --- a/src/ChamiloLMS/Resources/views/default/notebook/list.tpl +++ b/src/ChamiloLMS/CoreBundle/Resources/views/default/notebook/list.tpl @@ -5,20 +5,20 @@
{% if is_allowed_to_edit %} {% endif %} - + {{item.title}} - + {% if item.session_id %} {{session_image}} {% endif %} @@ -29,4 +29,4 @@ {% endfor %} - \ No newline at end of file + diff --git a/src/ChamiloLMS/Resources/views/default/notebook/upload.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/notebook/upload.tpl similarity index 100% rename from src/ChamiloLMS/Resources/views/default/notebook/upload.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/default/notebook/upload.tpl diff --git a/src/ChamiloLMS/Resources/views/default/skill/profile.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/skill/profile.tpl similarity index 84% rename from src/ChamiloLMS/Resources/views/default/skill/profile.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/default/skill/profile.tpl index a31fd1f2d6..d1ee19c394 100644 --- a/src/ChamiloLMS/Resources/views/default/skill/profile.tpl +++ b/src/ChamiloLMS/CoreBundle/Resources/views/default/skill/profile.tpl @@ -1,6 +1,6 @@ {% if search_skill_list is not null %}
-

{{"Skills"|get_lang}}

+

{{"Skills"|trans}}

    {% for search_skill_id in search_skill_list %}
  • @@ -9,13 +9,13 @@
  • {% endfor %}
- {{"SaveThisSearch"|get_lang}} + {{"SaveThisSearch"|trans}}
{% endif %} {% if profiles is not null %}
-

{{"SkillProfiles"|get_lang}}

+

{{"SkillProfiles"|trans}}

    {%for profile in profiles %}
  • @@ -33,12 +33,12 @@
+{% endif %} diff --git a/src/ChamiloLMS/Resources/views/default/skill/skill_ranking.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/skill/skill_ranking.tpl similarity index 100% rename from src/ChamiloLMS/Resources/views/default/skill/skill_ranking.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/default/skill/skill_ranking.tpl diff --git a/src/ChamiloLMS/Resources/views/default/skill/skill_tree.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/skill/skill_tree.tpl similarity index 97% rename from src/ChamiloLMS/Resources/views/default/skill/skill_tree.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/default/skill/skill_tree.tpl index 4f1470bb6a..a8c8f6bb60 100644 --- a/src/ChamiloLMS/Resources/views/default/skill/skill_tree.tpl +++ b/src/ChamiloLMS/CoreBundle/Resources/views/default/skill/skill_tree.tpl @@ -142,7 +142,7 @@ jsPlumb.ready(function() { $("#dialog-form").dialog({ buttons: { - "{{"Add"|get_lang}}" : function() { + "{{"Add"|trans}}" : function() { var bValid = true; bValid = bValid && checkLength( name, "name", 1, 255 ); @@ -405,17 +405,17 @@ $(document).ready(function() {
@@ -428,30 +428,30 @@ $(document).ready(function() {
- +
- +
- +
- {{'WithCertificate'|get_lang}} + {{'WithCertificate'|trans}}
- +
diff --git a/src/ChamiloLMS/Resources/views/default/skill/skill_tree_student.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/skill/skill_tree_student.tpl similarity index 100% rename from src/ChamiloLMS/Resources/views/default/skill/skill_tree_student.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/default/skill/skill_tree_student.tpl diff --git a/src/ChamiloLMS/Resources/views/default/skill/skill_wheel.js.tpl b/src/ChamiloLMS/CoreBundle/Resources/views/default/skill/skill_wheel.js.tpl similarity index 98% rename from src/ChamiloLMS/Resources/views/default/skill/skill_wheel.js.tpl rename to src/ChamiloLMS/CoreBundle/Resources/views/default/skill/skill_wheel.js.tpl index 4b4d598ad8..4ef1a0fd7b 100644 --- a/src/ChamiloLMS/Resources/views/default/skill/skill_wheel.js.tpl +++ b/src/ChamiloLMS/CoreBundle/Resources/views/default/skill/skill_wheel.js.tpl @@ -1,5 +1,5 @@ {# topbar #} -{% include app.template_style ~ "/layout/topbar.tpl" %} +{% include "@template_style/layout/topbar.tpl" %} -
-
-
-

{{ 'VersionCheck' | trans }}

-
-
-
-
- {% endif %} - -{% endblock %} diff --git a/src/ChamiloLMS/Resources/views/default/admin/jury_president/check_answers.tpl b/src/ChamiloLMS/Resources/views/default/admin/jury_president/check_answers.tpl deleted file mode 100644 index b789315c3c..0000000000 --- a/src/ChamiloLMS/Resources/views/default/admin/jury_president/check_answers.tpl +++ /dev/null @@ -1,4 +0,0 @@ -{% extends app.template_style ~ "/layout/layout_1_col.tpl" %} -{% block content %} - ?? -{% endblock %} diff --git a/src/ChamiloLMS/Resources/views/default/app/session_path/add.tpl b/src/ChamiloLMS/Resources/views/default/app/session_path/add.tpl deleted file mode 100644 index 950956a36e..0000000000 --- a/src/ChamiloLMS/Resources/views/default/app/session_path/add.tpl +++ /dev/null @@ -1,5 +0,0 @@ -{% extends app.template_style ~ "/layout/layout_1_col.tpl" %} -{% block content %} - {% import app.template_style ~ "/crud_macros/simple_crud.tpl" as actions %} - {{ actions.add(form, links) }} -{% endblock %} diff --git a/src/ChamiloLMS/Resources/views/default/app/session_path/edit.tpl b/src/ChamiloLMS/Resources/views/default/app/session_path/edit.tpl deleted file mode 100644 index 3e71cf7c53..0000000000 --- a/src/ChamiloLMS/Resources/views/default/app/session_path/edit.tpl +++ /dev/null @@ -1,5 +0,0 @@ -{% extends app.template_style ~ "/layout/layout_1_col.tpl" %} -{% block content %} - {% import app.template_style ~ "/crud_macros/simple_crud.tpl" as actions %} - {{ actions.edit(form, links) }} -{% endblock %} diff --git a/src/ChamiloLMS/Resources/views/default/app/session_path/session_tree/add.tpl b/src/ChamiloLMS/Resources/views/default/app/session_path/session_tree/add.tpl deleted file mode 100644 index 950956a36e..0000000000 --- a/src/ChamiloLMS/Resources/views/default/app/session_path/session_tree/add.tpl +++ /dev/null @@ -1,5 +0,0 @@ -{% extends app.template_style ~ "/layout/layout_1_col.tpl" %} -{% block content %} - {% import app.template_style ~ "/crud_macros/simple_crud.tpl" as actions %} - {{ actions.add(form, links) }} -{% endblock %} diff --git a/src/ChamiloLMS/Resources/views/default/exercise/question/edit_question.tpl b/src/ChamiloLMS/Resources/views/default/exercise/question/edit_question.tpl deleted file mode 100644 index 5096b19c55..0000000000 --- a/src/ChamiloLMS/Resources/views/default/exercise/question/edit_question.tpl +++ /dev/null @@ -1,4 +0,0 @@ -{% extends app.template_style ~ "/layout/layout_1_col.tpl" %} -{% block content %} - {{ form }} -{% endblock %} \ No newline at end of file diff --git a/src/ChamiloLMS/Resources/views/default/index/course_session_block.tpl b/src/ChamiloLMS/Resources/views/default/index/course_session_block.tpl deleted file mode 100644 index 17ebdf6d29..0000000000 --- a/src/ChamiloLMS/Resources/views/default/index/course_session_block.tpl +++ /dev/null @@ -1 +0,0 @@ -{% include app.template_style ~ '/layout/block_menu.tpl' with {'block_menu': course_session_block} %} \ No newline at end of file diff --git a/src/ChamiloLMS/Resources/views/default/layout/breadcrumb.tpl b/src/ChamiloLMS/Resources/views/default/layout/breadcrumb.tpl deleted file mode 100644 index 98ab0fde76..0000000000 --- a/src/ChamiloLMS/Resources/views/default/layout/breadcrumb.tpl +++ /dev/null @@ -1,37 +0,0 @@ -{# Breadcrumb #} -{% if app.breadcrumbs %} - {{ app.breadcrumbs }} -{% else %} - - - {{ new_breadcrumb }} - - {% if ("student_view_enabled" | get_setting) == 'true' %} - {% if is_granted('ROLE_TEACHER') and app.session.get('_cid') %} - - {% endif %} - {% endif %} - -{% endif %} - diff --git a/src/ChamiloLMS/Resources/views/default/layout/head.tpl b/src/ChamiloLMS/Resources/views/default/layout/head.tpl deleted file mode 100644 index 345b93f533..0000000000 --- a/src/ChamiloLMS/Resources/views/default/layout/head.tpl +++ /dev/null @@ -1,303 +0,0 @@ - - - - - - - - - - - -{{ prefetch }} -{{ favico }} - - - -{# Use the latest engine in ie8/ie9 or use google chrome engine if available #} -{# Improve usability in portal devices #} - - -{{ title_string }} - -{{ resources }} - -{% block header_end %}{% endblock header_end %} - -{% block extraHead %} -{% endblock %} -{{ header_extra_content }} - diff --git a/src/ChamiloLMS/Resources/views/default/layout/layout_1_col.tpl b/src/ChamiloLMS/Resources/views/default/layout/layout_1_col.tpl deleted file mode 100644 index 0c8d58744e..0000000000 --- a/src/ChamiloLMS/Resources/views/default/layout/layout_1_col.tpl +++ /dev/null @@ -1,46 +0,0 @@ -{% extends app.template_style ~ "/layout/main.tpl" %} - -{# 1 column #} -{% block body %} - {# Plugin top #} - {% if plugin_content_top %} -
- {{ plugin_content_top}} -
- {% endif %} - -
- {# Breadcrumb #} - {% include app.template_style ~ "/layout/breadcrumb.tpl" %} - -
-
-
- - {% include app.template_style ~ "/layout/page_body.tpl" %} - - {% block content %} - {% if content is not null %} - {{ content }} - {% endif %} - {% endblock %} - - {# Plugin bottom #} - {% if plugin_content_bottom %} -
- {{ plugin_content_bottom }} -
- {% endif %} -
- - {# Footer #} - {% include app.template_style ~ "/layout/footer.tpl" %} -
-
-
- - - -{% endblock %} - - diff --git a/src/ChamiloLMS/Resources/views/default/layout/main.tpl b/src/ChamiloLMS/Resources/views/default/layout/main.tpl deleted file mode 100644 index 06203b3f1f..0000000000 --- a/src/ChamiloLMS/Resources/views/default/layout/main.tpl +++ /dev/null @@ -1,8 +0,0 @@ -{% block header %} -{% include app.template_style ~ "/layout/header.tpl" %} -{% endblock %} - -{% block body %} - {% block content %} - {% endblock %} -{% endblock %} diff --git a/src/ChamiloLMS/Resources/views/default/tool/curriculum/category/add.tpl b/src/ChamiloLMS/Resources/views/default/tool/curriculum/category/add.tpl deleted file mode 100644 index 58d6b29321..0000000000 --- a/src/ChamiloLMS/Resources/views/default/tool/curriculum/category/add.tpl +++ /dev/null @@ -1,5 +0,0 @@ -{% extends app.template_style ~ "/layout/layout_1_col.tpl" %} -{% block content %} - {% import app.template_style ~ "/crud_macros/course_crud.tpl" as actions %} - {{ actions.add(form, links, course, course_session) }} -{% endblock %} diff --git a/src/ChamiloLMS/Resources/views/default/tool/curriculum/category/edit.tpl b/src/ChamiloLMS/Resources/views/default/tool/curriculum/category/edit.tpl deleted file mode 100644 index a2713e0f40..0000000000 --- a/src/ChamiloLMS/Resources/views/default/tool/curriculum/category/edit.tpl +++ /dev/null @@ -1,5 +0,0 @@ -{% extends app.template_style ~ "/layout/layout_1_col.tpl" %} -{% block content %} - {% import app.template_style ~ "/crud_macros/course_crud.tpl" as actions %} - {{ actions.edit(form, links, course, course_session) }} -{% endblock %} diff --git a/src/ChamiloLMS/Resources/views/default/tool/curriculum/index.tpl b/src/ChamiloLMS/Resources/views/default/tool/curriculum/index.tpl deleted file mode 100644 index f4c8c153c0..0000000000 --- a/src/ChamiloLMS/Resources/views/default/tool/curriculum/index.tpl +++ /dev/null @@ -1,2 +0,0 @@ -{% extends app.template_style ~ "/layout/layout_1_col.tpl" %} - diff --git a/src/ChamiloLMS/Resources/views/default/tool/curriculum/item/add.tpl b/src/ChamiloLMS/Resources/views/default/tool/curriculum/item/add.tpl deleted file mode 100644 index 58d6b29321..0000000000 --- a/src/ChamiloLMS/Resources/views/default/tool/curriculum/item/add.tpl +++ /dev/null @@ -1,5 +0,0 @@ -{% extends app.template_style ~ "/layout/layout_1_col.tpl" %} -{% block content %} - {% import app.template_style ~ "/crud_macros/course_crud.tpl" as actions %} - {{ actions.add(form, links, course, course_session) }} -{% endblock %} diff --git a/src/ChamiloLMS/Resources/views/default/tool/curriculum/item/edit.tpl b/src/ChamiloLMS/Resources/views/default/tool/curriculum/item/edit.tpl deleted file mode 100644 index a2713e0f40..0000000000 --- a/src/ChamiloLMS/Resources/views/default/tool/curriculum/item/edit.tpl +++ /dev/null @@ -1,5 +0,0 @@ -{% extends app.template_style ~ "/layout/layout_1_col.tpl" %} -{% block content %} - {% import app.template_style ~ "/crud_macros/course_crud.tpl" as actions %} - {{ actions.edit(form, links, course, course_session) }} -{% endblock %} diff --git a/src/ChamiloLMS/Resources/views/default/tool/curriculum/user/add.tpl b/src/ChamiloLMS/Resources/views/default/tool/curriculum/user/add.tpl deleted file mode 100644 index 58d6b29321..0000000000 --- a/src/ChamiloLMS/Resources/views/default/tool/curriculum/user/add.tpl +++ /dev/null @@ -1,5 +0,0 @@ -{% extends app.template_style ~ "/layout/layout_1_col.tpl" %} -{% block content %} - {% import app.template_style ~ "/crud_macros/course_crud.tpl" as actions %} - {{ actions.add(form, links, course, course_session) }} -{% endblock %} diff --git a/src/ChamiloLMS/Resources/views/default/tool/curriculum/user/edit.tpl b/src/ChamiloLMS/Resources/views/default/tool/curriculum/user/edit.tpl deleted file mode 100644 index 7c5f86cf8f..0000000000 --- a/src/ChamiloLMS/Resources/views/default/tool/curriculum/user/edit.tpl +++ /dev/null @@ -1,5 +0,0 @@ -{% extends app.template_style ~ "/layout/layout_1_col.tpl" %} -{% block content %} - {% import app.template_style ~ "/crud_macros/course_crud.tpl" as actions %} - {{ actions.edit(form, links, course, course_session} }} -{% endblock %} diff --git a/src/ChamiloLMS/Resources/views/default/user/index.tpl b/src/ChamiloLMS/Resources/views/default/user/index.tpl deleted file mode 100644 index 4b7ef5c3c7..0000000000 --- a/src/ChamiloLMS/Resources/views/default/user/index.tpl +++ /dev/null @@ -1,5 +0,0 @@ -{% extends app.template_style ~ "/layout/layout_1_col.tpl" %} - -{% block content %} - {{ user.username }} -{% endblock %} diff --git a/src/ChamiloLMS/Resources/views/default/userportal/course_page.tpl b/src/ChamiloLMS/Resources/views/default/userportal/course_page.tpl deleted file mode 100644 index 6a3abe6940..0000000000 --- a/src/ChamiloLMS/Resources/views/default/userportal/course_page.tpl +++ /dev/null @@ -1,2 +0,0 @@ -{% extends app.template_style ~ "/layout/layout_2_col.tpl" %} - diff --git a/src/ChamiloLMS/Resources/views/default/userportal/index.tpl b/src/ChamiloLMS/Resources/views/default/userportal/index.tpl deleted file mode 100644 index 69f40e51da..0000000000 --- a/src/ChamiloLMS/Resources/views/default/userportal/index.tpl +++ /dev/null @@ -1 +0,0 @@ -{% extends app.template_style ~ "/layout/layout_2_col.tpl" %} \ No newline at end of file diff --git a/src/ChamiloLMS/Resources/views/jquery_mobile/form/form_custom_template.tpl b/src/ChamiloLMS/Resources/views/jquery_mobile/form/form_custom_template.tpl deleted file mode 100755 index 662d4d3501..0000000000 --- a/src/ChamiloLMS/Resources/views/jquery_mobile/form/form_custom_template.tpl +++ /dev/null @@ -1,500 +0,0 @@ -{# Widgets #} - -{% block form_widget %} -{% spaceless %} - {% if compound %} - {{ block('form_widget_compound') }} - {% else %} - {{ block('form_widget_simple') }} - {% endif %} -{% endspaceless %} -{% endblock form_widget %} - -{% block form_widget_simple %} -{% spaceless %} - {% set type = type|jquery_mobile('text') %} - {% if attr.prepend_input is defined and attr.append_input is defined and attr.prepend_input is not empty and attr.append_input is not empty %} - {{ block('form_widget_prepend_append_input') }} - {% elseif attr.prepend_input is defined and attr.prepend_input is not empty %} - {{ block('form_widget_prepend_input') }} - {% elseif attr.append_input is defined and attr.append_input is not empty %} - {{ block('form_widget_append_input') }} - {% else %} - - {% endif %} - {% if attr.help_block is defined %} - {{ block('help_block') }} - {% endif %} - {% if attr.help is defined %} - {{ block('help_inline') }} - {% endif %} -{% endspaceless %} -{% endblock form_widget_simple %} - -{% block form_widget_prepend_append_input %} -{% spaceless %} -
- {{ attr.prepend_input|trans({}, translation_domain) }} - {% set append_input = attr.append_input|trans({}, translation_domain) %} - {% set attr = attr|merge({'prepend_input': '', 'append_input': ''}) %} - {{ block('form_widget_simple') }} - {{ append_input }} -
-{% endspaceless %} -{% endblock form_widget_prepend_append_input %} - -{% block form_widget_prepend_input %} -{% spaceless %} -
- {{ attr.prepend_input|trans({}, translation_domain) }} - {% set attr = attr|merge({'prepend_input': ''}) %} - {{ block('form_widget_simple') }} -
-{% endspaceless %} -{% endblock form_widget_prepend_input %} - -{% block form_widget_append_input %} -{% spaceless %} -
- {% set append_input = attr.append_input|trans({}, translation_domain) %} - {% set attr = attr|merge({'append_input': ''}) %} - {{ block('form_widget_simple') }} - {{ append_input }} -
-{% endspaceless %} -{% endblock form_widget_append_input %} - -{% block form_widget_compound %} -{% spaceless %} - {% if form.parent is empty %} - {{ form_errors(form) }} - {% endif %} - {{ block('form_rows') }} - {{ form_rest(form) }} -{% endspaceless %} -{% endblock form_widget_compound %} - -{% block collection_widget %} -{% spaceless %} - {% if prototype is defined %} - {% set attr = attr|merge({'data-prototype': form_row(prototype) }) %} - {% endif %} - {{ block('form_widget') }} -{% endspaceless %} -{% endblock collection_widget %} - -{% block textarea_widget %} -{% spaceless %} - -{% endspaceless %} -{% endblock textarea_widget %} - -{% block choice_widget %} -{% spaceless %} - {% if expanded %} - {{ block('choice_widget_expanded') }} - {% else %} - {{ block('choice_widget_collapsed') }} - {% endif %} -{% endspaceless %} -{% endblock choice_widget %} - -{% block choice_widget_expanded %} -{% spaceless %} - {% set child_vars = {'attr': attr} %} - {% for child in form %} - {{ form_label(child, label, child_vars) }} - {% endfor %} -{% endspaceless %} -{% endblock choice_widget_expanded %} - -{% block choice_widget_collapsed %} -{% spaceless %} - -{% endspaceless %} -{% endblock choice_widget_collapsed %} - -{% block choice_widget_options %} -{% spaceless %} - {% for group_label, choice in options %} - {% if choice is iterable %} - - {% set options = choice %} - {{ block('choice_widget_options') }} - - {% else %} - - {% endif %} - {% endfor %} -{% endspaceless %} -{% endblock choice_widget_options %} - -{% block checkbox_widget %} -{% spaceless %} - -{% endspaceless %} -{% endblock checkbox_widget %} - -{% block radio_widget %} -{% spaceless %} - -{% endspaceless %} -{% endblock radio_widget %} - -{% block datetime_widget %} -{% spaceless %} - {% if widget == 'single_text' %} - {{ block('form_widget_simple') }} - {% else %} -
- {{ form_errors(form.date) }} - {{ form_errors(form.time) }} - {{ form_widget(form.date) }} - {{ form_widget(form.time) }} -
- {% endif %} -{% endspaceless %} -{% endblock datetime_widget %} - -{% block date_widget %} -{% spaceless %} - {% if widget == 'single_text' %} - {{ block('form_widget_simple') }} - {% else %} -
- {{ date_pattern|replace({ - '{{ year }}': form_widget(form.year), - '{{ month }}': form_widget(form.month), - '{{ day }}': form_widget(form.day), - })|raw }} -
- {% endif %} -{% endspaceless %} -{% endblock date_widget %} - -{% block time_widget %} -{% spaceless %} - {% if widget == 'single_text' %} - {{ block('form_widget_simple') }} - {% else %} -
- {{ form_widget(form.hour, { 'attr': { 'size': '1' } }) }}:{{ form_widget(form.minute, { 'attr': { 'size': '1' } }) }}{% if with_seconds %}:{{ form_widget(form.second, { 'attr': { 'size': '1' } }) }}{% endif %} -
- {% endif %} -{% endspaceless %} -{% endblock time_widget %} - -{% block number_widget %} -{% spaceless %} - {# type="number" doesn't work with floats #} - {% set type = type|jquery_mobile('text') %} - {{ block('form_widget_simple') }} -{% endspaceless %} -{% endblock number_widget %} - -{% block integer_widget %} -{% spaceless %} - {% set type = type|jquery_mobile('number') %} - {{ block('form_widget_simple') }} -{% endspaceless %} -{% endblock integer_widget %} - -{% block money_widget %} -{% spaceless %} - {{ money_pattern|replace({ '{{ widget }}': block('form_widget_simple') })|raw }} -{% endspaceless %} -{% endblock money_widget %} - -{% block url_widget %} -{% spaceless %} - {% set type = type|jquery_mobile('url') %} - {{ block('form_widget_simple') }} -{% endspaceless %} -{% endblock url_widget %} - -{% block search_widget %} -{% spaceless %} - {% set attr = attr|merge({'class': (attr.class|jquery_mobile('') ~ ' search-query')|trim}) %} - {% set type = type|jquery_mobile('search') %} - {{ block('form_widget_simple') }} -{% endspaceless %} -{% endblock search_widget %} - -{% block percent_widget %} -{% spaceless %} - {% set type = type|jquery_mobile('text') %} - {{ block('form_widget_simple') }} % -{% endspaceless %} -{% endblock percent_widget %} - -{% block password_widget %} -{% spaceless %} - {% set type = type|jquery_mobile('password') %} - {{ block('form_widget_simple') }} -{% endspaceless %} -{% endblock password_widget %} - -{% block hidden_widget %} -{% spaceless %} - {% set type = type|jquery_mobile('hidden') %} - {{ block('form_widget_simple') }} -{% endspaceless %} -{% endblock hidden_widget %} - -{% block email_widget %} -{% spaceless %} - {% set type = type|jquery_mobile('email') %} - {{ block('form_widget_simple') }} -{% endspaceless %} -{% endblock email_widget %} - -{# Labels #} - -{% block form_label %} -{% spaceless %} - {% if not compound %} - {% set label_attr = label_attr|merge({'for': id}) %} - {% endif %} - {% if required %} - {% set label_attr = label_attr|merge({'class': (label_attr.class|jquery_mobile('') ~ ' required')|trim}) %} - {% endif %} - {% if form_type is defined and form_type == 'horizontal' %} - {% set label_attr = label_attr|merge({'class': (label_attr.class|jquery_mobile('') ~ ' control-label')|trim}) %} - {% endif %} - {% if label is empty %} - {% set label = name|humanize %} - {% endif %} - {{ label|trans({}, translation_domain) }} -{% endspaceless %} -{% endblock form_label %} - -{% block checkbox_label %} -{% spaceless %} - {% if not compound %} - {% set label_attr = label_attr|merge({'for': id}) %} - {% endif %} - {% set label_attr = label_attr|merge({'class': (label_attr.class|jquery_mobile('') ~ ' checkbox')|trim}) %} - {% if attr.inline is defined and attr.inline %} - {% set label_attr = label_attr|merge({'class': (label_attr.class|jquery_mobile('') ~ ' inline')|trim}) %} - {% endif %} - {% if required %} - {% set label_attr = label_attr|merge({'class': (label_attr.class|jquery_mobile('') ~ ' required')|trim}) %} - {% endif %} - {% if label is empty %} - {% set label = name|humanize %} - {% endif %} -{% endspaceless %} - - {{ form_widget(form) }} {{ label|trans({}, translation_domain) }} - -{% endblock checkbox_label %} - -{% block radio_label %} -{% spaceless %} - {% if not compound %} - {% set label_attr = label_attr|merge({'for': id}) %} - {% endif %} - {% set label_attr = label_attr|merge({'class': (label_attr.class|jquery_mobile('') ~ ' radio')|trim}) %} - {% if required %} - {% set label_attr = label_attr|merge({'class': (label_attr.class|jquery_mobile('') ~ ' required')|trim}) %} - {% endif %} - {% if label is empty %} - {% set label = name|humanize %} - {% endif %} -{% endspaceless %} - - {{ form_widget(form) }} {{ label|trans({}, translation_domain) }} - -{% endblock radio_label %} - - -{# Rows #} - -{% block repeated_row %} -{% spaceless %} - {# -No need to render the errors here, as all errors are mapped -to the first child (see RepeatedTypeValidatorExtension). -#} - {{ block('form_rows') }} -{% endspaceless %} -{% endblock repeated_row %} - -{% block form_row %} -{% spaceless %} - {% if form_type is defined and form_type == 'inline' %} - {{ block('inline_row') }} - {% elseif form_type is defined and form_type == 'horizontal' %} - {{ block('horizontal_row') }} - {% else %} - {{ form_label(form) }} - {{ form_widget(form) }} - {{ form_errors(form) }} - {% endif %} -{% endspaceless %} -{% endblock form_row %} - -{% block inline_row %} - {{ form_widget(form) }}  -{% endblock inline_row %} - -{% block horizontal_row %} -{% spaceless %} -
- {{ form_label(form) }} -
- {{ form_widget(form) }} - {{ form_errors(form) }} -
-
-{% endspaceless %} -{% endblock horizontal_row %} - -{% block checkbox_row %} -{% spaceless %} - {# -In order to make the click area bigger, the checkbox is -placed inside the label. See checkbox_label block. -#} - {% if form_type is defined and form_type == 'horizontal' %} - {{ block('horizontal_checkbox_row') }} - {% else %} - {{ form_label(form) }} - {{ form_errors(form) }} - {% endif %} -{% endspaceless %} -{% endblock checkbox_row %} - -{% block horizontal_checkbox_row %} -{% spaceless %} -
-
- {{ form_label(form) }} - {{ form_errors(form) }} -
-
-{% endspaceless %} -{% endblock horizontal_checkbox_row %} - -{% block search_row %} -{% spaceless %} - {{ form_widget(form) }} - {{ form_errors(form) }} -{% endspaceless %} -{% endblock search_row %} - -{% block hidden_row %} - {{ form_widget(form) }} -{% endblock hidden_row %} - -{# Misc #} - -{% block form_enctype %} -{% spaceless %} - {% if multipart %}enctype="multipart/form-data"{% endif %} -{% endspaceless %} -{% endblock form_enctype %} - -{% block form_errors %} -{% spaceless %} - {% if errors|length == 1 %} - {{ - errors[0].messagePluralization is null - ? errors[0].messageTemplate|trans(errors[0].messageParameters, 'validators') - : errors[0].messageTemplate|transchoice(errors[0].messagePluralization, errors[0].messageParameters, 'validators') - }} - {% elseif errors|length > 0 %} -
    - {% for error in errors %} -
  • {{ - error.messagePluralization is null - ? error.messageTemplate|trans(error.messageParameters, 'validators') - : error.messageTemplate|transchoice(error.messagePluralization, error.messageParameters, 'validators') - }}
  • - {% endfor %} -
- {% endif %} -{% endspaceless %} -{% endblock form_errors %} - -{% block form_rest %} -{% spaceless %} - {% for child in form %} - {% if not child.rendered %} - {{ form_row(child) }} - {% endif %} - {% endfor %} -{% endspaceless %} -{% endblock form_rest %} - -{% block help_block %} -{% spaceless %} - {% if attr.help_block is defined %} - {{ attr.help_block|trans({}, translation_domain) }} - {% endif %} -{% endspaceless %} -{% endblock help_block %} - -{% block help_inline %} -{% spaceless %} - {% if attr.help is defined %} - {{ attr.help|trans({}, translation_domain) }} - {% endif %} -{% endspaceless %} -{% endblock help_inline %} - -{# Support #} - -{% block form_rows %} -{% spaceless %} - {% set child_vars = {} %} - {% if form_type is defined %} - {% set child_vars = child_vars|merge({'form_type': form_type}) %} - {% else %} - {% set child_vars = child_vars|merge({'form_type': 'horizontal'}) %} - {% endif %} - - {% for child in form %} - {{ form_row(child, child_vars) }} - {% endfor %} -{% endspaceless %} -{% endblock form_rows %} - -{% block widget_attributes %} -{% spaceless %} - id="{{ id }}" name="{{ full_name }}"{% if read_only %} readonly="readonly"{% endif %}{% if disabled %} disabled="disabled"{% endif %}{% if required %} required="required"{% endif %}{% if max_length %} maxlength="{{ max_length }}"{% endif %}{% if pattern %} pattern="{{ pattern }}"{% endif %} - {% for attrname, attrvalue in attr %}{% if attrname in ['placeholder', 'title'] %}{{ attrname }}="{{ attrvalue|trans({}, translation_domain) }}" {% else %}{{ attrname }}="{{ attrvalue }}" {% endif %}{% endfor %} -{% endspaceless %} -{% endblock widget_attributes %} - -{% block widget_container_attributes %} -{% spaceless %} - {% if id is not empty %}id="{{ id }}" {% endif %} - {% for attrname, attrvalue in attr %}{{ attrname }}="{{ attrvalue }}" {% endfor %} -{% endspaceless %} -{% endblock widget_container_attributes %} - -{# Deprecated in Symfony 2.1, to be removed in 2.3 #} - -{% block generic_label %}{{ block('form_label') }}{% endblock %} -{% block widget_choice_options %}{{ block('choice_widget_options') }}{% endblock %} -{% block field_widget %}{{ block('form_widget_simple') }}{% endblock %} -{% block field_label %}{{ block('form_label') }}{% endblock %} -{% block field_row %}{{ block('form_row') }}{% endblock %} -{% block field_enctype %}{{ block('form_enctype') }}{% endblock %} -{% block field_errors %}{{ block('form_errors') }}{% endblock %} -{% block field_rest %}{{ block('form_rest') }}{% endblock %} -{% block field_rows %}{{ block('form_rows') }}{% endblock %} diff --git a/src/ChamiloLMS/paths.php b/src/ChamiloLMS/paths.php deleted file mode 100644 index 9897c551c7..0000000000 --- a/src/ChamiloLMS/paths.php +++ /dev/null @@ -1,22 +0,0 @@ - __DIR__.'/../../', - /* Application path */ - 'app' => __DIR__.'/../../src/ChamiloLMS', - /* Config */ - 'config' => __DIR__.'/../../config', - - // Can be overwritten in configuration.php - - /* data */ - 'data' => __DIR__.'/../../data', - /* temp */ - 'temp' => __DIR__.'/../../data/temp', - /* courses */ - 'courses' => __DIR__.'/../../data/courses', - /* Log */ - 'logs' => __DIR__.'/../../logs', -); diff --git a/web/ChamiloLMS/css/base.css b/web/ChamiloLMS/css/base.css index 0b066bcbe1..65dad8387c 100644 --- a/web/ChamiloLMS/css/base.css +++ b/web/ChamiloLMS/css/base.css @@ -10,7 +10,7 @@ html { } body { - background-color: #383e4b; + /* background-color: #383e4b;*/ /* The html and body elements cannot have any padding or margin. */ } diff --git a/web/ChamiloLMS/css/themes/chamilo/default.css b/web/ChamiloLMS/css/themes/chamilo/default.css index d1a5a63b6c..a81c708265 100644 --- a/web/ChamiloLMS/css/themes/chamilo/default.css +++ b/web/ChamiloLMS/css/themes/chamilo/default.css @@ -152,3 +152,17 @@ footer { .portal { background-image:url(images/portal.png); } + +.sidebar { + background-color: #F5F5F5; + border-right: 1px solid #EEEEEE; + bottom: 0; + display: block; + left: 0; + overflow-x: hidden; + overflow-y: auto; + padding: 20px; + position: fixed; + top: 51px; + z-index: 1000; +} diff --git a/web/app.php b/web/app.php new file mode 100644 index 0000000000..0db38434c9 --- /dev/null +++ b/web/app.php @@ -0,0 +1,31 @@ +unregister(); +$apcLoader->register(true); +*/ + +require_once __DIR__.'/../app/AppKernel.php'; +//require_once __DIR__.'/../app/AppCache.php'; + +require_once __DIR__.'/legacy.php'; + +$kernel = new AppKernel('prod', true); +$kernel->loadClassCache(); +//$kernel = new AppCache($kernel); + +// When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter +//Request::enableHttpMethodParameterOverride(); +$request = Request::createFromGlobals(); +$response = $kernel->handle($request); +$response->send(); +$kernel->terminate($request, $response); diff --git a/web/app_dev.php b/web/app_dev.php new file mode 100644 index 0000000000..18a26671af --- /dev/null +++ b/web/app_dev.php @@ -0,0 +1,32 @@ +loadClassCache(); +$request = Request::createFromGlobals(); +$response = $kernel->handle($request); +$response->send(); +$kernel->terminate($request, $response); diff --git a/web/index.php b/web/index2.php similarity index 54% rename from web/index.php rename to web/index2.php index 715012eac0..f83c2fc87a 100755 --- a/web/index.php +++ b/web/index2.php @@ -2,7 +2,7 @@ /* For licensing terms, see /license.txt */ /** Composer autoload */ -require_once __DIR__.'/../vendor/autoload.php'; +//require_once __DIR__.'/../vendor/autoload.php'; /** * Classic global.inc.php file now returns a Application object @@ -12,7 +12,7 @@ require_once __DIR__.'/../vendor/autoload.php'; /** * Inclusion of main setup script */ -$app = require_once __DIR__.'/../src/ChamiloLMS/app.php'; + /** * In order to execute Chamilo, you need to call the $app->run() method. @@ -33,4 +33,35 @@ $app = require_once __DIR__.'/../src/ChamiloLMS/app.php'; */ /** @var \Silex\Application $app */ -$app->run(); +//$app->run(); +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Debug\Debug; +error_reporting(-1); + +$loader = require_once __DIR__.'/../app/bootstrap.php.cache'; + +//$app = require_once __DIR__ . '/../src/ChamiloLMS/CoreBundle/app.php'; + +Debug::enable(); +require_once __DIR__.'/../app/AppKernel.php'; + +$kernel = new AppKernel('dev', true); +$kernel->loadClassCache(); +//$kernel = new AppCache($kernel); + +// When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter +//Request::enableHttpMethodParameterOverride(); +$request = Request::createFromGlobals(); + +/*$container = $kernel->getContainer(); +$container->enterScope('request'); +$request = $container->get('request_stack'); +use \ChamiloSession as Session; +Session::setSession($request->getSession());*/ + +//require_once __DIR__. '/../main/inc/lib/api.lib.php'; + +$response = $kernel->handle($request); +$response->send(); +$kernel->terminate($request, $response); + diff --git a/web/legacy.php b/web/legacy.php new file mode 100644 index 0000000000..bf59717d50 --- /dev/null +++ b/web/legacy.php @@ -0,0 +1,6 @@ +