From d8907493a47e4d82c802548efbf4216b47ecae2e Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Thu, 31 Jul 2014 10:55:41 +0200 Subject: [PATCH] Adding notebook demo bundle --- app/AppKernel.php | 3 +- app/config/config.yml | 1 + app/config/routing.yml | 3 ++ app/config/routing_courses.yml | 2 + main/admin/course_add.php | 6 +-- .../NotebookBundle/Admin/CNotebookAdmin.php | 53 +++++++++++++++++++ .../Controller/CNotebookAdminController.php | 13 +++++ .../Entity/CNotebook.php | 3 +- .../NotebookBundle/Resources/config/admin.yml | 12 +++++ .../Resources/config/routing.yml | 5 ++ .../Resources/config/services.yml | 7 +++ .../Resources/views/index.html.twig | 2 + 12 files changed, 104 insertions(+), 6 deletions(-) create mode 100644 app/config/routing_courses.yml create mode 100644 src/ChamiloLMS/NotebookBundle/Admin/CNotebookAdmin.php create mode 100644 src/ChamiloLMS/NotebookBundle/Controller/CNotebookAdminController.php rename src/ChamiloLMS/{CourseBundle => NotebookBundle}/Entity/CNotebook.php (99%) create mode 100644 src/ChamiloLMS/NotebookBundle/Resources/config/admin.yml create mode 100644 src/ChamiloLMS/NotebookBundle/Resources/config/routing.yml create mode 100644 src/ChamiloLMS/NotebookBundle/Resources/config/services.yml create mode 100644 src/ChamiloLMS/NotebookBundle/Resources/views/index.html.twig diff --git a/app/AppKernel.php b/app/AppKernel.php index 4bbdd039a1..59a3ba4ca1 100644 --- a/app/AppKernel.php +++ b/app/AppKernel.php @@ -129,7 +129,8 @@ class AppKernel extends Kernel new ChamiloLMS\InstallerBundle\ChamiloLMSInstallerBundle(), new ChamiloLMS\MessageBundle\ChamiloLMSMessageBundle(), - new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle() + new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(), + new ChamiloLMS\NotebookBundle\ChamiloLMSNotebookBundle(), ); if (in_array($this->getEnvironment(), array('dev', 'test'))) { diff --git a/app/config/config.yml b/app/config/config.yml index 3dbfe03df7..e7167b479e 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -4,6 +4,7 @@ imports: - { resource: assetic.yml } - { resource: @ChamiloLMSCoreBundle/Resources/config/admin.yml } + - { resource: @ChamiloLMSNotebookBundle/Resources/config/admin.yml } # Mopa Bootstrap - { resource: mopa/mopa_bootstrap.yml } diff --git a/app/config/routing.yml b/app/config/routing.yml index b8e336104d..d252699aeb 100644 --- a/app/config/routing.yml +++ b/app/config/routing.yml @@ -2,6 +2,9 @@ chamilo_lms_course: resource: "@ChamiloLMSCourseBundle/Resources/config/routing.yml" prefix: / +_courses: + resource: routing_courses.yml + _front: resource: routing_front.yml diff --git a/app/config/routing_courses.yml b/app/config/routing_courses.yml new file mode 100644 index 0000000000..47fa166b9d --- /dev/null +++ b/app/config/routing_courses.yml @@ -0,0 +1,2 @@ +notebook: + resource: "@ChamiloLMSNotebookBundle/Resources/config/routing.yml" diff --git a/main/admin/course_add.php b/main/admin/course_add.php index 59ce5023f4..1249b5a4a3 100644 --- a/main/admin/course_add.php +++ b/main/admin/course_add.php @@ -127,14 +127,14 @@ $form->setDefaults($values); // Validate the form if ($form->validate()) { $course = $form->exportValues(); - $teacher_id = $course['tutor_id']; - $course_teachers = $course['course_teachers']; + //$teacher_id = $course['tutor_id']; + $course_teachers = isset($course['course_teachers']) ? $course['course_teachers'] : array(); $course['disk_quota'] = $course['disk_quota']*1024*1024; $course['exemplary_content'] = empty($course['exemplary_content']) ? false : true; $course['teachers'] = $course_teachers; - $course['user_id'] = $teacher_id; + //$course['user_id'] = $teacher_id; $course['wanted_code'] = $course['visual_code']; $course['gradebook_model_id'] = isset($course['gradebook_model_id']) ? $course['gradebook_model_id'] : null; // Fixing category code diff --git a/src/ChamiloLMS/NotebookBundle/Admin/CNotebookAdmin.php b/src/ChamiloLMS/NotebookBundle/Admin/CNotebookAdmin.php new file mode 100644 index 0000000000..08126c7d92 --- /dev/null +++ b/src/ChamiloLMS/NotebookBundle/Admin/CNotebookAdmin.php @@ -0,0 +1,53 @@ +add('title') + ->add('description', 'textarea', array('attr' => array('class'=> 'ckeditor'))) + ; + } + + /** + * @param DatagridMapper $datagridMapper + */ + protected function configureDatagridFilters(DatagridMapper $datagridMapper) + { + $datagridMapper + ->add('title') + ; + } + + /** + * @param ListMapper $listMapper + */ + protected function configureListFields(ListMapper $listMapper) + { + $listMapper + ->addIdentifier('id') + ->addIdentifier('title') + ; + } +} diff --git a/src/ChamiloLMS/NotebookBundle/Controller/CNotebookAdminController.php b/src/ChamiloLMS/NotebookBundle/Controller/CNotebookAdminController.php new file mode 100644 index 0000000000..dfb6619c20 --- /dev/null +++ b/src/ChamiloLMS/NotebookBundle/Controller/CNotebookAdminController.php @@ -0,0 +1,13 @@ +