diff --git a/main/inc/Entity/Course.php b/main/inc/Entity/Course.php index 5ec073f52c..e4e53d48f4 100644 --- a/main/inc/Entity/Course.php +++ b/main/inc/Entity/Course.php @@ -207,10 +207,16 @@ class Course **/ private $items; + /** + * @ORM\OneToMany(targetEntity="CurriculumCategory", mappedBy="course") + **/ + //private $curriculumCategories; + public function __construct() { $this->users = new ArrayCollection(); $this->items = new ArrayCollection(); + //$this->curriculumCategories = new ArrayCollection(); } public function getItems() diff --git a/main/inc/Entity/CurriculumCategory.php b/main/inc/Entity/CurriculumCategory.php index 750b1ee0c1..c678e54ccd 100644 --- a/main/inc/Entity/CurriculumCategory.php +++ b/main/inc/Entity/CurriculumCategory.php @@ -6,7 +6,6 @@ use Doctrine\ORM\Mapping as ORM; use Gedmo\Mapping\Annotation as Gedmo; use Doctrine\Common\Collections\ArrayCollection; - /** * CurriculumCategory * @@ -110,11 +109,35 @@ class CurriculumCategory */ private $items; + /** + * @ORM\ManyToOne(targetEntity="Course") + * @ORM\JoinColumn(name="c_id", referencedColumnName="id") + */ + private $course; + public function __construct() { $this->items = new ArrayCollection(); } + /** + * @return mixed + */ + public function getCourse() + { + return $this->course; + } + + /** + * @param Course $course + * @return mixed + */ + public function setCourse(Course $course) + { + $this->course = $course; + } + + public function getItems() { return $this->items; diff --git a/main/inc/Entity/Repository/UserRepository.php b/main/inc/Entity/Repository/UserRepository.php index 819cf668f3..b65054b4cb 100644 --- a/main/inc/Entity/Repository/UserRepository.php +++ b/main/inc/Entity/Repository/UserRepository.php @@ -9,7 +9,6 @@ use Doctrine\ORM\NoResultException; use Symfony\Component\Security\Core\Exception\UsernameNotFoundException; use Symfony\Component\Security\Core\Exception\UnsupportedUserException; - /** * Class UserRepository * @package Entity\Repository @@ -76,12 +75,11 @@ class UserRepository extends EntityRepository implements UserProviderInterface public function refreshUser(UserInterface $user) { return $user; - - $class = get_class($user); + /*$class = get_class($user); if (!$this->supportsClass($class)) { throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', $class)); } - return $this->loadUserByUsername($user->getUsername()); + return $this->loadUserByUsername($user->getUsername());*/ } /** diff --git a/main/inc/Entity/User.php b/main/inc/Entity/User.php index aa4fe65e64..f1a715c15b 100644 --- a/main/inc/Entity/User.php +++ b/main/inc/Entity/User.php @@ -6,6 +6,7 @@ use Doctrine\ORM\Mapping as ORM; use Doctrine\Common\Collections\Criteria; use Doctrine\Common\Collections\ArrayCollection; use Symfony\Component\Security\Core\User\AdvancedUserInterface; +use ChamiloLMS\Component\Auth; /** * User @@ -314,7 +315,9 @@ class User implements AdvancedUserInterface, \Serializable */ public function getRoles() { - return $this->roles->toArray(); + $roles = $this->roles->toArray(); + //$roles[] = new Auth\Role($this); + return $roles; } /** diff --git a/main/inc/routes.php b/main/inc/routes.php index c3c55320fa..4e64be5699 100644 --- a/main/inc/routes.php +++ b/main/inc/routes.php @@ -666,10 +666,11 @@ if ($alreadyInstalled) { $app->mount('/admin/jury_president', new ChamiloLMS\Provider\ReflectionControllerProvider('jury_president.controller')); $app->mount('/admin/jury_member', new ChamiloLMS\Provider\ReflectionControllerProvider('jury_member.controller')); - $app->mount('/courses/{courseCode}/curriculum/category', new ChamiloLMS\Provider\ReflectionControllerProvider('curriculum_category.controller')); - $app->mount('/courses/{courseCode}/curriculum/item', new ChamiloLMS\Provider\ReflectionControllerProvider('curriculum_item.controller')); - $app->mount('/courses/{courseCode}/curriculum/user', new ChamiloLMS\Provider\ReflectionControllerProvider('curriculum_user.controller')); - $app->mount('/courses/{courseCode}/curriculum', new ChamiloLMS\Provider\ReflectionControllerProvider('curriculum.controller')); + + $app->mount('/courses/{course}/curriculum/category', new ChamiloLMS\Provider\ReflectionControllerProvider('curriculum_category.controller')); + $app->mount('/courses/{course}/curriculum/item', new ChamiloLMS\Provider\ReflectionControllerProvider('curriculum_item.controller')); + $app->mount('/courses/{course}/curriculum/user', new ChamiloLMS\Provider\ReflectionControllerProvider('curriculum_user.controller')); + $app->mount('/courses/{course}/curriculum', new ChamiloLMS\Provider\ReflectionControllerProvider('curriculum.controller')); } diff --git a/main/inc/services.php b/main/inc/services.php index 48d9b0607c..8583116960 100644 --- a/main/inc/services.php +++ b/main/inc/services.php @@ -716,4 +716,3 @@ $app['curriculum.controller'] = $app->share( return new ChamiloLMS\Controller\Tool\Curriculum\CurriculumController($app); } ); - diff --git a/main/template/default/crud_macros/course_crud.tpl b/main/template/default/crud_macros/course_crud.tpl index f1957ef2ce..ca8778857c 100644 --- a/main/template/default/crud_macros/course_crud.tpl +++ b/main/template/default/crud_macros/course_crud.tpl @@ -1,48 +1,48 @@ -{% macro list(items, links, courseCode) %} - +{% macro list(items, links, course) %} + {{ 'Add' |trans }} {% for item in items %} {% endfor %}
- + {{ item.name }} - {{ 'Edit' |trans }} - {{ 'Delete' |trans }} + {{ 'Edit' |trans }} + {{ 'Delete' |trans }}
{% endmacro %} -{% macro add(form, links, courseCode) %} - +{% macro add(form, links, course) %} + {{ 'List' |trans }}
-
+ {{ form_widget(form) }}
{% endmacro %} -{% macro edit(form, links, courseCode) %} - +{% macro edit(form, links, course) %} + {{ 'List' |trans }} -
+ {{ form_widget(form) }}
{% endmacro %} -{% macro read(item, links, courseCode) %} - +{% macro read(item, links, course) %} + {{ 'List' |trans }} - + {{ 'Edit' |trans }}

{{ item.id }}

diff --git a/main/template/default/tool/curriculum/category/add.tpl b/main/template/default/tool/curriculum/category/add.tpl index 2731f9cce2..146e5af322 100644 --- a/main/template/default/tool/curriculum/category/add.tpl +++ b/main/template/default/tool/curriculum/category/add.tpl @@ -1,5 +1,5 @@ {% 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, app.request.get('courseCode')) }} + {{ actions.add(form, links, course) }} {% endblock %} diff --git a/main/template/default/tool/curriculum/category/add_from_parent.tpl b/main/template/default/tool/curriculum/category/add_from_parent.tpl index 09e66e8427..640a92b930 100644 --- a/main/template/default/tool/curriculum/category/add_from_parent.tpl +++ b/main/template/default/tool/curriculum/category/add_from_parent.tpl @@ -1,10 +1,10 @@ {% extends app.template_style ~ "/layout/layout_1_col.tpl" %} {% block content %} - - List + + {{ 'Listing' |trans }}
-
+ {{ form_widget(form) }}
{% endblock %} diff --git a/main/template/default/tool/curriculum/category/edit.tpl b/main/template/default/tool/curriculum/category/edit.tpl index 66ed4c6eb0..e8ee9615b8 100644 --- a/main/template/default/tool/curriculum/category/edit.tpl +++ b/main/template/default/tool/curriculum/category/edit.tpl @@ -1,5 +1,5 @@ {% 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, app.request.get('courseCode')) }} + {{ actions.edit(form, links, course) }} {% endblock %} diff --git a/main/template/default/tool/curriculum/category/list.tpl b/main/template/default/tool/curriculum/category/list.tpl index 290601a7c1..e6f1cca293 100644 --- a/main/template/default/tool/curriculum/category/list.tpl +++ b/main/template/default/tool/curriculum/category/list.tpl @@ -1,7 +1,7 @@ {% extends app.template_style ~ "/layout/layout_1_col.tpl" %} {% block content %} - - Add + + {{ 'Add' |trans }} {{ tree }} {% endblock %} diff --git a/main/template/default/tool/curriculum/category/read.tpl b/main/template/default/tool/curriculum/category/read.tpl index ff196288ac..852492d54f 100644 --- a/main/template/default/tool/curriculum/category/read.tpl +++ b/main/template/default/tool/curriculum/category/read.tpl @@ -5,7 +5,7 @@