diff --git a/src/Chamilo/AdminBundle/ChamiloAdminBundle.php b/src/Chamilo/AdminBundle/ChamiloAdminBundle.php new file mode 100644 index 000000000..fbdbb135e --- /dev/null +++ b/src/Chamilo/AdminBundle/ChamiloAdminBundle.php @@ -0,0 +1,22 @@ + + + + + + + + +{% endblock %} + +{% block javascripts %} + {{ parent() }} + + + + + + + + + +{% endblock %} + +{% block footer %} +{% endblock %} diff --git a/src/Chamilo/AdminBundle/Resources/views/standard_layout.html.twig b/src/Chamilo/AdminBundle/Resources/views/standard_layout.html.twig new file mode 100644 index 000000000..256ef690c --- /dev/null +++ b/src/Chamilo/AdminBundle/Resources/views/standard_layout.html.twig @@ -0,0 +1,339 @@ +{# + +This file is part of the Sonata package. + +(c) Thomas Rabaix + +For the full copyright and license information, please view the LICENSE +file that was distributed with this source code. + +#} +{% set _preview = block('preview') %} +{% set _form = block('form') %} +{% set _show = block('show') %} +{% set _list_table = block('list_table') %} +{% set _list_filters = block('list_filters') %} +{% set _tab_menu = block('tab_menu') %} +{% set _content = block('content') %} +{% set _title = block('title') %} +{% set _breadcrumb = block('breadcrumb') %} +{% set _actions = block('actions') %} +{% set _navbar_title = block('navbar_title') %} +{% set _list_filters_actions = block('list_filters_actions') %} + + + + + {% block meta_tags %} + + + + {% endblock %} + + {% block stylesheets %} + {% for stylesheet in sonata_admin.adminPool.getOption('stylesheets', []) %} + + {% endfor %} + {% endblock %} + + {% block javascripts %} + + + {% for javascript in sonata_admin.adminPool.getOption('javascripts', []) %} + + {% endfor %} + + {% set locale = app.request.locale %} + {# localize moment #} + {% if locale[:2] != 'en' %} + + {% endif %} + + {# localize select2 #} + {% if sonata_admin.adminPool.getOption('use_select2') %} + {% if locale == 'pt' %}{% set locale = 'pt_PT' %}{% endif %} + + {# omit default EN locale #} + {% if locale[:2] != 'en' %} + + {% endif %} + {% endif %} + {% endblock %} + + + {% block sonata_head_title %} + {{ 'Admin'|trans({}, 'SonataAdminBundle') }} + + {% if _title is not empty %} + {{ _title|raw }} + {% else %} + {% if action is defined %} + - + {% for menu in admin.breadcrumbs(action) %} + {% if not loop.first %} + {% if loop.index != 2 %} + > + {% endif %} + + {{ menu.label }} + {% endif %} + {% endfor %} + {% endif %} + {% endif%} + {% endblock %} + + + + +
+ + {% block sonata_header %} +
+ {% block sonata_header_noscript_warning %} + + {% endblock %} + {% block logo %} + {% spaceless %} + + {% endspaceless %} + {% endblock %} + {% block sonata_nav %} + + {% endblock sonata_nav %} +
+ {% endblock sonata_header %} + + {% block sonata_wrapper %} + {% block sonata_left_side %} + + {% endblock sonata_left_side %} + +
+ {% block sonata_page_content %} +
+ + {% block sonata_page_content_header %} + {% block sonata_page_content_nav %} + {% if _tab_menu is not empty or _actions is not empty or _list_filters_actions is not empty %} + + {% endif %} + {% endblock sonata_page_content_nav %} + {% endblock sonata_page_content_header %} +
+ +
+ {% block sonata_admin_content %} + + {% block notice %} + {% include 'SonataCoreBundle:FlashMessage:render.html.twig' %} + {% endblock notice %} + + {% if _preview is not empty %} +
{{ _preview|raw }}
+ {% endif %} + + {% if _content is not empty %} +
{{ _content|raw }}
+ {% endif %} + + {% if _show is not empty %} +
{{ _show|raw }}
+ {% endif %} + + {% if _form is not empty %} +
{{ _form|raw }}
+ {% endif %} + + {% if _list_table is not empty or _list_filters is not empty %} + {% if _list_filters|trim %} +
+ {{ _list_filters|raw }} +
+ {% endif %} + +
+ {{ _list_table|raw }} +
+ + {% endif %} + {% endblock sonata_admin_content %} +
+ {% endblock sonata_page_content %} +
+ {% endblock sonata_wrapper %} +
+ +{% if sonata_admin.adminPool.getOption('use_bootlint') %} + {% block bootlint %} + {# Bootlint - https://github.com/twbs/bootlint#in-the-browser #} + + {% endblock %} +{% endif %} + + + diff --git a/src/Chamilo/ClassificationBundle/ChamiloClassificationBundle.php b/src/Chamilo/ClassificationBundle/ChamiloClassificationBundle.php new file mode 100644 index 000000000..8e998c13a --- /dev/null +++ b/src/Chamilo/ClassificationBundle/ChamiloClassificationBundle.php @@ -0,0 +1,22 @@ + project. + * + * (c) + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Chamilo\ClassificationBundle\Document; + +use Sonata\ClassificationBundle\Document\BaseCategory as BaseCategory; + +/** + * This file has been generated by the EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends ). + * + * References : + * working with object : http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/working-with-objects.html + * + * @author + */ +class Category extends BaseCategory +{ + /** + * @var int + */ + protected $id; + + /** + * Get id. + * + * @return int $id + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/ClassificationBundle/Document/Tag.php b/src/Chamilo/ClassificationBundle/Document/Tag.php new file mode 100644 index 000000000..8952266a2 --- /dev/null +++ b/src/Chamilo/ClassificationBundle/Document/Tag.php @@ -0,0 +1,40 @@ + project. + * + * (c) + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Chamilo\ClassificationBundle\Document; + +use Sonata\ClassificationBundle\Document\BaseTag as BaseTag; + +/** + * This file has been generated by the EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends ). + * + * References : + * working with object : http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/working-with-objects.html + * + * @author + */ +class Tag extends BaseTag +{ + /** + * @var int + */ + protected $id; + + /** + * Get id. + * + * @return int $id + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/ClassificationBundle/Entity/Category.php b/src/Chamilo/ClassificationBundle/Entity/Category.php new file mode 100644 index 000000000..b83092410 --- /dev/null +++ b/src/Chamilo/ClassificationBundle/Entity/Category.php @@ -0,0 +1,40 @@ + project. + * + * (c) + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Chamilo\ClassificationBundle\Entity; + +use Sonata\ClassificationBundle\Entity\BaseCategory as BaseCategory; + +/** + * This file has been generated by the Sonata EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends ). + * + * References : + * working with object : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en + * + * @author + */ +class Category extends BaseCategory +{ + /** + * @var int + */ + protected $id; + + /** + * Get id. + * + * @return int $id + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/ClassificationBundle/Entity/Collection.php b/src/Chamilo/ClassificationBundle/Entity/Collection.php new file mode 100644 index 000000000..34e407ee5 --- /dev/null +++ b/src/Chamilo/ClassificationBundle/Entity/Collection.php @@ -0,0 +1,40 @@ + project. + * + * (c) + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Chamilo\ClassificationBundle\Entity; + +use Sonata\ClassificationBundle\Entity\BaseCollection as BaseCollection; + +/** + * This file has been generated by the Sonata EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends ). + * + * References : + * working with object : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en + * + * @author + */ +class Collection extends BaseCollection +{ + /** + * @var int + */ + protected $id; + + /** + * Get id. + * + * @return int $id + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/ClassificationBundle/Entity/Context.php b/src/Chamilo/ClassificationBundle/Entity/Context.php new file mode 100644 index 000000000..ae4eeee72 --- /dev/null +++ b/src/Chamilo/ClassificationBundle/Entity/Context.php @@ -0,0 +1,42 @@ + project. + * + * (c) + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Chamilo\ClassificationBundle\Entity; + +use Sonata\ClassificationBundle\Entity\BaseContext as BaseContext; + +/** + * This file has been generated by the Sonata EasyExtends bundle. + * + * @see https://sonata-project.org/bundles/easy-extends + * + * References : + * working with object : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en + * + * @author + */ +class Context extends BaseContext +{ + /** + * @var int + */ + protected $id; + + /** + * Get id. + * + * @return int $id + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/ClassificationBundle/Entity/Tag.php b/src/Chamilo/ClassificationBundle/Entity/Tag.php new file mode 100644 index 000000000..45c3948a0 --- /dev/null +++ b/src/Chamilo/ClassificationBundle/Entity/Tag.php @@ -0,0 +1,40 @@ + project. + * + * (c) + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Chamilo\ClassificationBundle\Entity; + +use Sonata\ClassificationBundle\Entity\BaseTag as BaseTag; + +/** + * This file has been generated by the Sonata EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends ). + * + * References : + * working with object : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en + * + * @author + */ +class Tag extends BaseTag +{ + /** + * @var int + */ + protected $id; + + /** + * Get id. + * + * @return int $id + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/ClassificationBundle/Resources/config/doctrine/Category.mongodb.xml b/src/Chamilo/ClassificationBundle/Resources/config/doctrine/Category.mongodb.xml new file mode 100644 index 000000000..83d06736d --- /dev/null +++ b/src/Chamilo/ClassificationBundle/Resources/config/doctrine/Category.mongodb.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/src/Chamilo/ClassificationBundle/Resources/config/doctrine/Category.orm.xml b/src/Chamilo/ClassificationBundle/Resources/config/doctrine/Category.orm.xml new file mode 100644 index 000000000..d5131f9d8 --- /dev/null +++ b/src/Chamilo/ClassificationBundle/Resources/config/doctrine/Category.orm.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + diff --git a/src/Chamilo/ClassificationBundle/Resources/config/doctrine/Collection.orm.xml b/src/Chamilo/ClassificationBundle/Resources/config/doctrine/Collection.orm.xml new file mode 100644 index 000000000..057e5acd1 --- /dev/null +++ b/src/Chamilo/ClassificationBundle/Resources/config/doctrine/Collection.orm.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + diff --git a/src/Chamilo/ClassificationBundle/Resources/config/doctrine/Context.orm.xml b/src/Chamilo/ClassificationBundle/Resources/config/doctrine/Context.orm.xml new file mode 100644 index 000000000..53afc1965 --- /dev/null +++ b/src/Chamilo/ClassificationBundle/Resources/config/doctrine/Context.orm.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + diff --git a/src/Chamilo/ClassificationBundle/Resources/config/doctrine/Tag.mongodb.xml b/src/Chamilo/ClassificationBundle/Resources/config/doctrine/Tag.mongodb.xml new file mode 100644 index 000000000..e71de9a53 --- /dev/null +++ b/src/Chamilo/ClassificationBundle/Resources/config/doctrine/Tag.mongodb.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/src/Chamilo/ClassificationBundle/Resources/config/doctrine/Tag.orm.xml b/src/Chamilo/ClassificationBundle/Resources/config/doctrine/Tag.orm.xml new file mode 100644 index 000000000..d08e33b92 --- /dev/null +++ b/src/Chamilo/ClassificationBundle/Resources/config/doctrine/Tag.orm.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + diff --git a/src/Chamilo/ClassificationBundle/Resources/config/serializer/Document.Category.xml b/src/Chamilo/ClassificationBundle/Resources/config/serializer/Document.Category.xml new file mode 100644 index 000000000..cf0d80087 --- /dev/null +++ b/src/Chamilo/ClassificationBundle/Resources/config/serializer/Document.Category.xml @@ -0,0 +1,17 @@ + + + + + + + + + + diff --git a/src/Chamilo/ClassificationBundle/Resources/config/serializer/Document.Tag.xml b/src/Chamilo/ClassificationBundle/Resources/config/serializer/Document.Tag.xml new file mode 100644 index 000000000..c16b7dab5 --- /dev/null +++ b/src/Chamilo/ClassificationBundle/Resources/config/serializer/Document.Tag.xml @@ -0,0 +1,17 @@ + + + + + + + + + + diff --git a/src/Chamilo/ClassificationBundle/Resources/config/serializer/Entity.Category.xml b/src/Chamilo/ClassificationBundle/Resources/config/serializer/Entity.Category.xml new file mode 100644 index 000000000..719e5ff2c --- /dev/null +++ b/src/Chamilo/ClassificationBundle/Resources/config/serializer/Entity.Category.xml @@ -0,0 +1,17 @@ + + + + + + + + + + diff --git a/src/Chamilo/ClassificationBundle/Resources/config/serializer/Entity.Collection.xml b/src/Chamilo/ClassificationBundle/Resources/config/serializer/Entity.Collection.xml new file mode 100644 index 000000000..8ba530fa4 --- /dev/null +++ b/src/Chamilo/ClassificationBundle/Resources/config/serializer/Entity.Collection.xml @@ -0,0 +1,17 @@ + + + + + + + + + + diff --git a/src/Chamilo/ClassificationBundle/Resources/config/serializer/Entity.Context.xml b/src/Chamilo/ClassificationBundle/Resources/config/serializer/Entity.Context.xml new file mode 100644 index 000000000..eb60e1754 --- /dev/null +++ b/src/Chamilo/ClassificationBundle/Resources/config/serializer/Entity.Context.xml @@ -0,0 +1,17 @@ + + + + + + + + + + diff --git a/src/Chamilo/ClassificationBundle/Resources/config/serializer/Entity.Tag.xml b/src/Chamilo/ClassificationBundle/Resources/config/serializer/Entity.Tag.xml new file mode 100644 index 000000000..b72ac9702 --- /dev/null +++ b/src/Chamilo/ClassificationBundle/Resources/config/serializer/Entity.Tag.xml @@ -0,0 +1,17 @@ + + + + + + + + + + diff --git a/src/Chamilo/ContactBundle/Admin/CategoryAdmin.php b/src/Chamilo/ContactBundle/Admin/CategoryAdmin.php new file mode 100644 index 000000000..11409ef4f --- /dev/null +++ b/src/Chamilo/ContactBundle/Admin/CategoryAdmin.php @@ -0,0 +1,45 @@ +add('headline', null, array('identifier' => true)) + ->add('name', null, ['identifier' => true]) + ->add('email') + ; + } + + /** + * {@inheritdoc} + */ + protected function configureFormFields(FormMapper $formMapper) + { + $formMapper + ->add('name') + ->add('email') + ; + } + + protected function configureDatagridFilters(DatagridMapper $datagridMapper) + { + $datagridMapper + ->add('name') + ->add('email') + ; + } +} diff --git a/src/Chamilo/ContactBundle/ChamiloContactBundle.php b/src/Chamilo/ContactBundle/ChamiloContactBundle.php new file mode 100644 index 000000000..1a30bdb12 --- /dev/null +++ b/src/Chamilo/ContactBundle/ChamiloContactBundle.php @@ -0,0 +1,15 @@ +getUser(); + $data = []; + + if ($user) { + $data = [ + 'firstname' => $user->getFirstname(), + 'lastname' => $user->getFirstname(), + 'email' => $user->getEmail(), + ]; + } + + $form = $this->createForm($type, $data); + + if ($request->isMethod('POST')) { + $form->bind($request); + + $em = $this->getDoctrine()->getManager(); + + $category = $form->get('category')->getData(); + /** @var Category $category */ + $category = $em->getRepository('ChamiloContactBundle:Category')->find($category); + + if ($form->isValid()) { + $message = \Swift_Message::newInstance() + ->setSubject($form->get('subject')->getData()) + ->setFrom($form->get('email')->getData()) + ->setTo($category->getEmail()) + ->setBody( + $this->renderView( + '@ChamiloContact/contact.html.twig', + [ + 'ip' => $request->getClientIp(), + 'firstname' => $form->get('firstname')->getData(), + 'lastname' => $form->get('lastname')->getData(), + 'subject' => $form->get('subject')->getData(), + 'email' => $form->get('email')->getData(), + 'message' => $form->get('message')->getData(), + ] + ) + ); + + $this->get('mailer')->send($message); + $this->addFlash( + 'success', + 'Your email has been sent! Thanks!' + ); + + return $this->redirect($this->generateUrl('contact')); + } + } + + return $this->render( + '@ChamiloContact/index.html.twig', + [ + 'form' => $form->createView(), + ] + ); + } +} diff --git a/src/Chamilo/ContactBundle/DependencyInjection/ChamiloContactExtension.php b/src/Chamilo/ContactBundle/DependencyInjection/ChamiloContactExtension.php new file mode 100644 index 000000000..796e85beb --- /dev/null +++ b/src/Chamilo/ContactBundle/DependencyInjection/ChamiloContactExtension.php @@ -0,0 +1,26 @@ +load('admin.yml'); + } +} diff --git a/src/Chamilo/ContactBundle/Entity/Category.php b/src/Chamilo/ContactBundle/Entity/Category.php new file mode 100644 index 000000000..89abfd01d --- /dev/null +++ b/src/Chamilo/ContactBundle/Entity/Category.php @@ -0,0 +1,88 @@ +getName(); + } + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @param string $name + * + * @return Category + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * @return string + */ + public function getEmail() + { + return $this->email; + } + + /** + * @param string $email + * + * @return Category + */ + public function setEmail($email) + { + $this->email = $email; + + return $this; + } +} diff --git a/src/Chamilo/ContactBundle/Entity/Contact.php b/src/Chamilo/ContactBundle/Entity/Contact.php new file mode 100644 index 000000000..5542bc6c3 --- /dev/null +++ b/src/Chamilo/ContactBundle/Entity/Contact.php @@ -0,0 +1,8 @@ +add( + 'category', + EntityType::class, + ['class' => 'Chamilo\ContactBundle\Entity\Category'] + ) + ->add('firstname') + ->add('lastname') + ->add('email') + ->add('subject') + ->add('message', 'textarea') + ->add('send', SubmitType::class, ['attr' => ['class' => 'btn btn-primary']]) + ; + } + + public function setDefaultOptions(OptionsResolverInterface $resolver) + { + $collectionConstraint = new Collection([ + 'category' => [ + new NotBlank(['message' => 'Category should not be blank.']), + ], + 'firstname' => [ + new NotBlank(['message' => 'firstname should not be blank.']), + new Length(['min' => 2]), + ], + 'lastname' => [ + new NotBlank(['message' => 'lastname should not be blank.']), + new Length(['min' => 2]), + ], + 'email' => [ + new NotBlank(['message' => 'Email should not be blank.']), + new Email(['message' => 'Invalid email address.']), + ], + 'subject' => [ + new NotBlank(['message' => 'Subject should not be blank.']), + new Length(['min' => 3]), + ], + 'message' => [ + new NotBlank(['message' => 'Message should not be blank.']), + new Length(['min' => 5]), + ], + ]); + + $resolver->setDefaults([ + 'constraints' => $collectionConstraint, + ]); + } +} diff --git a/src/Chamilo/ContactBundle/Resources/config/admin.yml b/src/Chamilo/ContactBundle/Resources/config/admin.yml new file mode 100644 index 000000000..6805099bf --- /dev/null +++ b/src/Chamilo/ContactBundle/Resources/config/admin.yml @@ -0,0 +1,9 @@ +services: + sonata.admin.contact_category: + class: Chamilo\ContactBundle\Admin\CategoryAdmin + tags: + - { name: sonata.admin, manager_type: orm, group: "LMS", label: "Contact category" } + arguments: + - ~ + - Chamilo\ContactBundle\Entity\Category + - ~ diff --git a/src/Chamilo/ContactBundle/Resources/config/routing.yml b/src/Chamilo/ContactBundle/Resources/config/routing.yml new file mode 100644 index 000000000..61772dfae --- /dev/null +++ b/src/Chamilo/ContactBundle/Resources/config/routing.yml @@ -0,0 +1,3 @@ +contact: + resource: "@ChamiloContactBundle/Controller/ContactController.php" + type: annotation \ No newline at end of file diff --git a/src/Chamilo/ContactBundle/Resources/views/contact.html.twig b/src/Chamilo/ContactBundle/Resources/views/contact.html.twig new file mode 100644 index 000000000..5e099820f --- /dev/null +++ b/src/Chamilo/ContactBundle/Resources/views/contact.html.twig @@ -0,0 +1,11 @@ +{{ 'You had a new message from %url%' | trans({'%url%': url(app.request.attributes.get('_route'))} ) }} + +{{ 'Firstname' | trans }} : {{ firstname }} +{{ 'Lirstname' | trans }} : {{ lastname }} + +Email: {{ email }} +IP: {{ ip }} + +{{ 'Subject' | trans }} : {{ subject }} +{{ 'Message' | trans }} : +{{ message|raw }} \ No newline at end of file diff --git a/src/Chamilo/ContactBundle/Resources/views/index.html.twig b/src/Chamilo/ContactBundle/Resources/views/index.html.twig new file mode 100644 index 000000000..1e0438d79 --- /dev/null +++ b/src/Chamilo/ContactBundle/Resources/views/index.html.twig @@ -0,0 +1,12 @@ +{% extends '@ChamiloCore/layout_one_col.html.twig' %} + +{% block content %} + +
+ + {{ form_start(form) }} + {{ form_widget(form, {'attr': {'class': ''}}) }} + {{ form_end(form) }} +
+{% endblock %} diff --git a/src/Chamilo/CoreBundle/Admin/AccessUrlAdmin.php b/src/Chamilo/CoreBundle/Admin/AccessUrlAdmin.php new file mode 100644 index 000000000..ccbafedc3 --- /dev/null +++ b/src/Chamilo/CoreBundle/Admin/AccessUrlAdmin.php @@ -0,0 +1,57 @@ +setUsers($course->getUsers()); + } + + protected function configureFormFields(FormMapper $formMapper) + { + $formMapper + ->add('url', 'url') + ->add('description', 'ckeditor') + ->add('active') + ->add('limitCourses') + ->add('limitActiveCourses') + ->add('limitSessions') + ->add('limitUsers') + ->add('limitTeachers') + ->add('limitDiskSpace') + ->add('email', 'email') + ; + } + + protected function configureDatagridFilters(DatagridMapper $datagridMapper) + { + $datagridMapper + ->add('url') + ; + } + + protected function configureListFields(ListMapper $listMapper) + { + $listMapper + ->addIdentifier('url') + ; + } +} diff --git a/src/Chamilo/CoreBundle/Admin/AccessUrlRelCourseAdmin.php b/src/Chamilo/CoreBundle/Admin/AccessUrlRelCourseAdmin.php new file mode 100644 index 000000000..03399178a --- /dev/null +++ b/src/Chamilo/CoreBundle/Admin/AccessUrlRelCourseAdmin.php @@ -0,0 +1,47 @@ +add('id') + ; + } + + protected function configureFormFields(FormMapper $formMapper) + { + $formMapper + ->add('url') + ->end() + ; + } + + protected function configureDatagridFilters(DatagridMapper $datagridMapper) + { + $datagridMapper + ->add('url') + ; + } + + protected function configureListFields(ListMapper $listMapper) + { + $listMapper + ->addIdentifier('url') + ; + } +} diff --git a/src/Chamilo/CoreBundle/Admin/BranchAdmin.php b/src/Chamilo/CoreBundle/Admin/BranchAdmin.php new file mode 100644 index 000000000..7dd9f0fc8 --- /dev/null +++ b/src/Chamilo/CoreBundle/Admin/BranchAdmin.php @@ -0,0 +1,41 @@ +add('id') + ; + } + + // Fields to be shown on filter forms + protected function configureDatagridFilters(DatagridMapper $datagridMapper) + { + $datagridMapper + ->add('id') + ; + } + + // Fields to be shown on lists + protected function configureListFields(ListMapper $listMapper) + { + $listMapper + ->addIdentifier('id') + ; + } +} diff --git a/src/Chamilo/CoreBundle/Admin/CareerAdmin.php b/src/Chamilo/CoreBundle/Admin/CareerAdmin.php new file mode 100644 index 000000000..68b37d1bb --- /dev/null +++ b/src/Chamilo/CoreBundle/Admin/CareerAdmin.php @@ -0,0 +1,42 @@ +add('name') + ->add('description', 'ckeditor') + ->add('status', 'choice', ['choices' => Career::getStatusList()]) + ; + } + + protected function configureDatagridFilters(DatagridMapper $datagridMapper) + { + $datagridMapper + ->add('name') + ; + } + + protected function configureListFields(ListMapper $listMapper) + { + $listMapper + ->addIdentifier('id') + ->addIdentifier('name') + ; + } +} diff --git a/src/Chamilo/CoreBundle/Admin/PromotionAdmin.php b/src/Chamilo/CoreBundle/Admin/PromotionAdmin.php new file mode 100644 index 000000000..ab04ff2bf --- /dev/null +++ b/src/Chamilo/CoreBundle/Admin/PromotionAdmin.php @@ -0,0 +1,43 @@ +add('name') + ->add('description', 'ckeditor') + ->add('status', 'choice', ['choices' => Promotion::getStatusList()]) + ->add('career') + ; + } + + protected function configureDatagridFilters(DatagridMapper $datagridMapper) + { + $datagridMapper + ->add('name') + ; + } + + protected function configureListFields(ListMapper $listMapper) + { + $listMapper + ->addIdentifier('id') + ->addIdentifier('name') + ; + } +} diff --git a/src/Chamilo/CoreBundle/Admin/SessionAdmin.php b/src/Chamilo/CoreBundle/Admin/SessionAdmin.php new file mode 100644 index 000000000..828742dc7 --- /dev/null +++ b/src/Chamilo/CoreBundle/Admin/SessionAdmin.php @@ -0,0 +1,107 @@ +setCourses($session->getCourses()); + } + + protected function configureFormFields(FormMapper $formMapper) + { + $formMapper + ->add('name') //if no type is specified, SonataAdminBundle tries to guess it + ->add('generalCoach') + ->add('category') + ->add('displayStartDate', 'sonata_type_datetime_picker') + ->add( + 'visibility', + 'choice', + ['choices' => Session::getStatusList()] + ) + ->add( + 'courses', + 'sonata_type_collection', + [ + 'cascade_validation' => true, + ], + [ + 'edit' => 'inline', + 'inline' => 'table', + //'sortable' => 'position', + //'link_parameters' => array('context' => $context), + 'admin_code' => 'sonata.admin.session_rel_course', + ] + ) + /*->add('users', 'sonata_type_collection', array( + 'cascade_validation' => true, + ), array( + 'allow_delete' => true, + 'by_reference' => false, + //'edit' => 'inline', + + //'sortable' => 'position', + //'link_parameters' => array('context' => $context), + //'admin_code' => 'sonata.admin.session_rel_user' + ) + )*/ + ; + } + + protected function configureShowField(ShowMapper $showMapper) + { + $showMapper + ->add('id', 'text', ['label' => 'Session']) + ->add('name') + ->add('display_start_date', 'sonata_type_date_picker') + ; + } + + protected function configureDatagridFilters(DatagridMapper $datagridMapper) + { + $datagridMapper + ->add('name') + ->add( + 'visibility', + null, + [], + 'choice', + ['choices' => Session::getStatusList()] + ) + //->add('display_start_date', 'sonata_type_date_picker') + ; + } + + protected function configureListFields(ListMapper $listMapper) + { + $listMapper + ->addIdentifier('name') + ->add('generalCoach') + ->add('visibility', 'choice', [ + 'choices' => Session::getStatusList(), + ]) + ; + } +} diff --git a/src/Chamilo/CoreBundle/Admin/SessionCategoryAdmin.php b/src/Chamilo/CoreBundle/Admin/SessionCategoryAdmin.php new file mode 100644 index 000000000..b374d2bbc --- /dev/null +++ b/src/Chamilo/CoreBundle/Admin/SessionCategoryAdmin.php @@ -0,0 +1,50 @@ +add('name') + ->add('url') + ->add('dateStart', 'sonata_type_datetime_picker') + ->add('dateEnd', 'sonata_type_datetime_picker') + ; + } + + protected function configureShowField(ShowMapper $showMapper) + { + $showMapper + ->add('id') + ->add('name') + ; + } + + protected function configureDatagridFilters(DatagridMapper $datagridMapper) + { + $datagridMapper + ->add('name') + ; + } + + protected function configureListFields(ListMapper $listMapper) + { + $listMapper + ->addIdentifier('name') + ; + } +} diff --git a/src/Chamilo/CoreBundle/Admin/SessionRelCourseAdmin.php b/src/Chamilo/CoreBundle/Admin/SessionRelCourseAdmin.php new file mode 100644 index 000000000..84aa0bf7e --- /dev/null +++ b/src/Chamilo/CoreBundle/Admin/SessionRelCourseAdmin.php @@ -0,0 +1,59 @@ +add('id') + ; + } + + /** + * {@inheritdoc} + */ + protected function configureFormFields(FormMapper $formMapper) + { + $formMapper + ->add('course') + //->add('session') + ->end() + ; + } + + /** + * {@inheritdoc} + */ + protected function configureDatagridFilters(DatagridMapper $datagridMapper) + { + $datagridMapper + ->add('id') + ; + } + + /** + * {@inheritdoc} + */ + protected function configureListFields(ListMapper $listMapper) + { + $listMapper + ->addIdentifier('id') + ; + } +} diff --git a/src/Chamilo/CoreBundle/Admin/SessionRelUserAdmin.php b/src/Chamilo/CoreBundle/Admin/SessionRelUserAdmin.php new file mode 100644 index 000000000..c5fedf805 --- /dev/null +++ b/src/Chamilo/CoreBundle/Admin/SessionRelUserAdmin.php @@ -0,0 +1,57 @@ +add('session') //if no type is specified, SonataAdminBundle tries to guess it + ->add('user') + ->add('relation_type', 'text') + ; + + /*->add('student', 'sonata_type_model', array(), + array( + 'admin_code' => 'application.subscriber.admin.student' + ))*/ + } + + protected function configureShowField(ShowMapper $showMapper) + { + $showMapper + ->add('session') + ->add('user') + ; + } + + protected function configureDatagridFilters(DatagridMapper $datagridMapper) + { + $datagridMapper + ->add('session') + ->add('user') + //->add('display_start_date', 'sonata_type_date_picker') + ; + } + + protected function configureListFields(ListMapper $listMapper) + { + $listMapper + ->addIdentifier('session') + ->addIdentifier('user') + ; + } +} diff --git a/src/Chamilo/CoreBundle/Admin/SettingsCurrentAdmin.php b/src/Chamilo/CoreBundle/Admin/SettingsCurrentAdmin.php new file mode 100644 index 000000000..fc936b0c5 --- /dev/null +++ b/src/Chamilo/CoreBundle/Admin/SettingsCurrentAdmin.php @@ -0,0 +1,50 @@ +add('title') + ->add('variable') + ->add('subkey') + ->add('type') + ->add('category') + ->add('selectedValue') + ->add('comment', 'ckeditor') + ->add('accessUrl') + ; + } + + protected function configureDatagridFilters(DatagridMapper $datagridMapper) + { + $datagridMapper + ->add('title') + ->add('variable') + ->add('category') + ->add('accessUrl') + ; + } + + protected function configureListFields(ListMapper $listMapper) + { + $listMapper + ->addIdentifier('variable') + ->add('selected_value') + ->add('category') + ; + } +} diff --git a/src/Chamilo/CoreBundle/Admin/ToolAdmin.php b/src/Chamilo/CoreBundle/Admin/ToolAdmin.php new file mode 100644 index 000000000..f2c14276d --- /dev/null +++ b/src/Chamilo/CoreBundle/Admin/ToolAdmin.php @@ -0,0 +1,70 @@ +add('name') + ->add('description', 'ckeditor') + ->add( + 'toolResourceRights', + 'sonata_type_collection', + [ + 'cascade_validation' => true, + ], + [ + //'allow_delete' => true, + //'by_reference' => false, + 'edit' => 'inline', + 'inline' => 'table', + //'btn_add' => true, + //'multiple' => true + //'sortable' => 'position', + //'link_parameters' => array('content' => $users), + 'admin_code' => 'sonata.admin.tool_resource_rights', + ] + ) + /*->add('image', 'sonata_media_type', array( + 'provider' => 'sonata.media.provider.image', + 'context' => 'default' + ));*/ + ; + } + + /** + * {@inheritdoc} + */ + protected function configureDatagridFilters(DatagridMapper $datagridMapper) + { + $datagridMapper + ->add('name') + ; + } + + /** + * {@inheritdoc} + */ + protected function configureListFields(ListMapper $listMapper) + { + $listMapper + ->addIdentifier('name') + ; + } +} diff --git a/src/Chamilo/CoreBundle/Admin/ToolResourceRightsAdmin.php b/src/Chamilo/CoreBundle/Admin/ToolResourceRightsAdmin.php new file mode 100644 index 000000000..93ba71cad --- /dev/null +++ b/src/Chamilo/CoreBundle/Admin/ToolResourceRightsAdmin.php @@ -0,0 +1,60 @@ +add('tool') + ->add( + 'role', + 'choice', + ['choices' => ToolResourceRights::getDefaultRoles()] + ) + ->add( + 'mask', + 'choice', + ['choices' => ToolResourceRights::getMaskList()] + ) + ; + } + + /** + * {@inheritdoc} + */ + protected function configureDatagridFilters(DatagridMapper $datagridMapper) + { + $datagridMapper + ->add('role') + ; + } + + /** + * {@inheritdoc} + */ + protected function configureListFields(ListMapper $listMapper) + { + $listMapper + ->addIdentifier('id') + ->addIdentifier('role') + ->addIdentifier('mask') + ; + } +} diff --git a/src/Chamilo/CoreBundle/Admin/UserGroupAdmin.php b/src/Chamilo/CoreBundle/Admin/UserGroupAdmin.php new file mode 100644 index 000000000..20e6046fc --- /dev/null +++ b/src/Chamilo/CoreBundle/Admin/UserGroupAdmin.php @@ -0,0 +1,81 @@ +setUsers($userGroup->getUsers()); + } + + protected function configureFormFields(FormMapper $formMapper) + { + $formMapper + ->add('name') + ->add('description', 'ckeditor') + ->add( + 'users', + 'sonata_type_collection', + [ + 'cascade_validation' => true, + ], + [ + // 'allow_delete' => true, + 'by_reference' => false, + 'edit' => 'inline', + 'inline' => 'table', + //'btn_add' => true, + //'multiple' => true + //'sortable' => 'position', + //'link_parameters' => array('content' => $users), + 'admin_code' => 'sonata.admin.user_group_rel_user', + ] + ) + ; + } + + protected function configureShowField(ShowMapper $showMapper) + { + $showMapper + ->add('id', 'text', ['label' => 'Usergroup']) + ->add('name') + ; + } + + protected function configureDatagridFilters(DatagridMapper $datagridMapper) + { + $datagridMapper + ->add('id') + ->add('name') + ; + } + + protected function configureListFields(ListMapper $listMapper) + { + $listMapper + ->addIdentifier('id') + ->addIdentifier('name') + ; + } +} diff --git a/src/Chamilo/CoreBundle/Admin/UsergroupRelUser.php b/src/Chamilo/CoreBundle/Admin/UsergroupRelUser.php new file mode 100644 index 000000000..db62beb8c --- /dev/null +++ b/src/Chamilo/CoreBundle/Admin/UsergroupRelUser.php @@ -0,0 +1,50 @@ +add('user') + ->add('usergroup') + ; + } + + protected function configureShowField(ShowMapper $showMapper) + { + $showMapper + ->add('user') + ->add('usergroup') + ; + } + + protected function configureDatagridFilters(DatagridMapper $datagridMapper) + { + $datagridMapper + ->add('user') + ->add('usergroup') + ; + } + + protected function configureListFields(ListMapper $listMapper) + { + $listMapper + ->addIdentifier('user') + ->addIdentifier('usergroup') + ; + } +} diff --git a/src/Chamilo/CoreBundle/ChamiloCoreBundle.php b/src/Chamilo/CoreBundle/ChamiloCoreBundle.php new file mode 100644 index 000000000..1a16f67bd --- /dev/null +++ b/src/Chamilo/CoreBundle/ChamiloCoreBundle.php @@ -0,0 +1,28 @@ +addCompilerPass(new EntityListenerPass()); + //$container->addCompilerPass(new DoctrineEntityListenerPass()); + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/CkEditor.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/CkEditor.php new file mode 100644 index 000000000..46cab0b2c --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/CkEditor.php @@ -0,0 +1,296 @@ +template->addResource($jsFolder.'ckeditor/ckeditor.js', 'js'); + } + + /** + * Return the HTML code required to run editor. + * + * @param string $value + * + * @return string + */ + public function createHtml($value) + { + $html = ''; + $html .= $this->editorReplace(); + + return $html; + } + + /** + * Return the HTML code required to run editor. + * + * @param string $value + * + * @return string + */ + public function createHtmlStyle($value) + { + $style = ''; + + $value = trim($value); + + $defaultValues = [0 => '']; + $defaultValues[1] = ''; + $defaultValues[2] = ''.$defaultValues[1]; + $defaultValues[3] = htmlentities($defaultValues[1]); + $defaultValues[4] = htmlentities($defaultValues[2]); + + if (in_array($value, $defaultValues)) { + $style = api_get_css_asset('bootstrap/dist/css/bootstrap.min.css'); + $style .= api_get_css_asset('fontawesome/css/font-awesome.min.css'); + $style .= api_get_css(ChamiloApi::getEditorDocStylePath()); + $style .= api_get_css_asset('ckeditor/plugins/codesnippet/lib/highlight/styles/default.css'); + $style .= api_get_asset('ckeditor/plugins/codesnippet/lib/highlight/highlight.pack.js'); + $style .= ''; + } + + $html = ''; + $html .= $this->editorReplace(); + + return $html; + } + + /** + * @return string + */ + public function editorReplace() + { + $toolbar = new Toolbar\Basic( + $this->toolbarSet, + $this->config, + 'CkEditor' + ); + $toolbar->setLanguage($this->getLocale()); + $config = $toolbar->getConfig(); + $javascript = $this->toJavascript($config); + + $html = ""; + + return $html; + } + + /** + * @param array $templates + * + * @return string + */ + public function formatTemplates($templates) + { + if (empty($templates)) { + return null; + } + /** @var \Chamilo\CoreBundle\Entity\SystemTemplate $template */ + $templateList = []; + $cssTheme = api_get_path(WEB_CSS_PATH).'themes/'.api_get_visual_theme().'/'; + $search = ['{CSS_THEME}', '{IMG_DIR}', '{REL_PATH}', '{COURSE_DIR}', '{CSS}']; + $replace = [ + $cssTheme, + api_get_path(REL_CODE_PATH).'img/', + api_get_path(REL_PATH), + api_get_path(REL_DEFAULT_COURSE_DOCUMENT_PATH), + '', + ]; + + foreach ($templates as $template) { + $image = $template->getImage(); + $image = !empty($image) ? $image : 'empty.gif'; + + /*$image = $this->urlGenerator->generate( + 'get_document_template_action', + array('file' => $image), + UrlGenerator::ABSOLUTE_URL + );*/ + + $content = str_replace($search, $replace, $template->getContent()); + + $templateList[] = [ + 'title' => $this->translator->trans($template->getTitle()), + 'description' => $this->translator->trans($template->getComment()), + 'image' => $image, + 'html' => $content, + ]; + } + + return json_encode($templateList); + } + + /** + * Get the templates in JSON format. + * + * @return string| + */ + public function simpleFormatTemplates() + { + $templates = $this->getEmptyTemplate(); + // The templates are visible for all users in the course + if (api_is_allowed_to_edit(false, true) || api_is_allowed_in_course()) { + $platformTemplates = $this->getPlatformTemplates(); + $templates = array_merge($templates, $platformTemplates); + } + + $personalTemplates = $this->getPersonalTemplates(); + $templates = array_merge($templates, $personalTemplates); + + return json_encode($templates); + } + + /** + * Get the empty template. + * + * @return array + */ + private function getEmptyTemplate() + { + return [[ + 'title' => get_lang('EmptyTemplate'), + 'description' => null, + 'image' => api_get_path(WEB_HOME_PATH).'default_platform_document/template_thumb/empty.gif', + 'html' => ' + + + + + + +

+
+

+ + + + ', + ]]; + } + + /** + * Get the platform templates. + * + * @return array + */ + private function getPlatformTemplates() + { + if (true === api_get_configuration_value('template_activate_language_filter')) { + global $language_interface; + + $courseInfo = api_get_course_info(); + if (isset($courseInfo['language'])) { + $language = $courseInfo['language']; + } else { + $language = $language_interface; + } + + $entityManager = \Database::getManager(); + $systemTemplates = $entityManager->getRepository('ChamiloCoreBundle:SystemTemplate')->findBy([ + 'language' => $language, + ]); + } else { + $entityManager = \Database::getManager(); + $systemTemplates = $entityManager->getRepository('ChamiloCoreBundle:SystemTemplate')->findAll(); + } + + $cssTheme = api_get_path(WEB_CSS_PATH).'themes/'.api_get_visual_theme().'/'; + $search = ['{CSS_THEME}', '{IMG_DIR}', '{REL_PATH}', '{COURSE_DIR}', '{CSS}']; + $replace = [ + $cssTheme, + api_get_path(REL_CODE_PATH).'img/', + api_get_path(REL_PATH), + api_get_path(REL_DEFAULT_COURSE_DOCUMENT_PATH), + '', + ]; + + $templateList = []; + foreach ($systemTemplates as $template) { + $image = $template->getImage(); + $image = !empty($image) ? $image : 'empty.gif'; + $image = api_get_path(WEB_HOME_PATH).'default_platform_document/template_thumb/'.$image; + $templateContent = $template->getContent(); + $content = str_replace($search, $replace, $templateContent); + $templateList[] = [ + 'title' => get_lang($template->getTitle()), + 'description' => get_lang($template->getComment()), + 'image' => $image, + 'html' => $content, + ]; + } + + return $templateList; + } + + private function getPersonalTemplates($userId = 0) + { + if (empty($userId)) { + $userId = api_get_user_id(); + } + + $entityManager = \Database::getManager(); + $templatesRepo = $entityManager->getRepository('ChamiloCoreBundle:Templates'); + $user = api_get_user_entity($userId); + $course = $entityManager->find('ChamiloCoreBundle:Course', api_get_course_int_id()); + if (!$user || !$course) { + return []; + } + + $courseTemplates = $templatesRepo->getCourseTemplates($course, $user); + $templateList = []; + foreach ($courseTemplates as $templateData) { + $template = $templateData[0]; + $courseDirectory = $course->getDirectory(); + $templateItem = []; + $templateItem['title'] = $template->getTitle(); + $templateItem['description'] = $template->getDescription(); + $templateItem['image'] = api_get_path(WEB_HOME_PATH). + 'default_platform_document/template_thumb/noimage.gif'; + $templateItem['html'] = file_get_contents(api_get_path(SYS_COURSE_PATH) + .$courseDirectory.'/document'.$templateData['path']); + + $image = $template->getImage(); + if (!empty($image)) { + $templateItem['image'] = api_get_path(WEB_COURSE_PATH) + .$courseDirectory.'/upload/template_thumbnails/'.$template->getImage(); + } + + $templateList[] = $templateItem; + } + + return $templateList; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/AgendaStudent.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/AgendaStudent.php new file mode 100644 index 000000000..5a7a31275 --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/AgendaStudent.php @@ -0,0 +1,140 @@ +getNormalToolbar(); + } else { + $config['toolbar_minToolbar'] = $this->getMinimizedToolbar(); + + $config['toolbar_maxToolbar'] = $this->getMaximizedToolbar(); + } + + return $config; + } + + /** + * Get the toolbar configuration when CKEditor is maximized. + * + * @return array + */ + protected function getMaximizedToolbar() + { + return [ + ['Save', 'NewPage', 'Templates', '-', 'Preview', 'Print'], + ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', 'inserthtml'], + ['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'], + ['Link', 'Unlink', 'Anchor', 'Glossary'], + [ + 'Image', + 'Mapping', + 'Video', + 'Flash', + 'Youtube', + 'Oembed', + 'Audio', + 'leaflet', + 'Smiley', + 'SpecialChar', + 'Asciimath', + 'Asciisvg', + ], + '/', + ['Table', '-', 'CreateDiv'], + [ + 'BulletedList', + 'NumberedList', + 'HorizontalRule', + '-', + 'Outdent', + 'Indent', + 'Blockquote', + ], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], + [ + 'Bold', + 'Italic', + 'Underline', + 'Strike', + '-', + 'Subscript', + 'Superscript', + '-', + 'TextColor', + 'BGColor', + ], + [api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''], + ['Styles', 'Format', 'Font', 'FontSize'], + ['PageBreak', 'ShowBlocks'], + ['Toolbarswitch'], + ]; + } + + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false. + * + * @return array + */ + protected function getNormalToolbar() + { + return [ + ['Save', 'Maximize', 'PasteFromWord', '-', 'Undo', 'Redo'], + ['Link', 'Unlink', 'Anchor', 'inserthtml'], + ['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'Audio'], + ['Table', 'SpecialChar'], + '/', + ['Format', 'Font', 'FontSize'], + ['Bold', 'Italic', 'Underline'], + [ + 'JustifyLeft', + 'JustifyCenter', + 'JustifyRight', + '-', + 'NumberedList', + 'BulletedList', + '-', + 'Outdent', + 'Indent', + '-', + 'TextColor', + 'BGColor', + ], + ['ShowBlocks'], + ]; + } + + /** + * Get the toolbar configuration when CKEditor is minimized. + * + * @return array + */ + protected function getMinimizedToolbar() + { + return [ + ['Save', 'NewPage', 'Templates', '-', 'PasteFromWord', 'inserthtml'], + ['Undo', 'Redo'], + ['Link', 'Image', 'Video', 'Flash', 'Youtube', 'Audio', 'Table', 'Asciimath', 'Asciisvg'], + ['BulletedList', 'NumberedList', 'HorizontalRule'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight'], + ['Format', 'Font', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'], + ['Toolbarswitch'], + ]; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Announcements.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Announcements.php new file mode 100644 index 000000000..9fc2dd859 --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Announcements.php @@ -0,0 +1,80 @@ +getNormalToolbar(); + } else { + $config['toolbar_minToolbar'] = $this->getMinimizedToolbar(); + } + + return $config; + } + + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false. + * + * @return array + */ + protected function getNormalToolbar() + { + return [ + ['Save', 'Maximize', 'PasteFromWord', '-', 'Undo', 'Redo'], + ['Link', 'Unlink', 'Anchor', 'inserthtml'], + ['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'VimeoEmbed', 'Audio'], + ['Table', 'SpecialChar'], + [ + 'NumberedList', + 'BulletedList', + '-', + 'Outdent', + 'Indent', + '-', + 'TextColor', + 'BGColor', + 'Source', + ], + '/', + ['Styles', 'Format', 'Font', 'FontSize'], + ['Bold', 'Italic', 'Underline'], + [ + 'JustifyLeft', + 'JustifyCenter', + 'JustifyRight', + ], + ]; + } + + /** + * Get the toolbar configuration when CKEditor is minimized. + * + * @return array + */ + protected function getMinimizedToolbar() + { + return [ + $this->getNewPageBlock(), + ['Undo', 'Redo'], + ['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath', 'Asciisvg'], + ['BulletedList', 'NumberedList', 'HorizontalRule'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], + ['Styles', 'Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor', 'Source'], + ['Toolbarswitch'], + ]; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/AssessmentsIntroduction.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/AssessmentsIntroduction.php new file mode 100644 index 000000000..5a4aae954 --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/AssessmentsIntroduction.php @@ -0,0 +1,67 @@ +getNormalToolbar(); + } else { + $config['toolbar_minToolbar'] = $this->getMinimizedToolbar(); + } + + return $config; + } + + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false. + * + * @return array + */ + protected function getNormalToolbar() + { + return [ + ['Save', 'Maximize', '-', 'PasteFromWord', '-', 'Undo', 'Redo'], + ['Link', 'Unlink', 'Anchor'], + ['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'VimeoEmbed', 'Audio'], + ['Table', 'SpecialChar'], + ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'TextColor', 'BGColor'], + '/', + ['Styles', 'Format', 'Font', 'FontSize'], + ['Bold', 'Italic', 'Underline'], + ['Subscript', 'Superscript', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], + ['Source'], + ]; + } + + /** + * Get the toolbar configuration when CKEditor is minimized. + * + * @return array + */ + protected function getMinimizedToolbar() + { + return [ + $this->getNewPageBlock(), + ['Undo', 'Redo'], + ['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath', 'Asciisvg'], + ['BulletedList', 'NumberedList', 'HorizontalRule'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], + ['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'], + ['Toolbarswitch'], + ]; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Basic.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Basic.php new file mode 100644 index 000000000..dada3e891 --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Basic.php @@ -0,0 +1,332 @@ +defaultPlugins = array_unique(array_merge($this->defaultPlugins, $plugins)); + + $editorSettings = api_get_configuration_value('editor_settings'); + if (!empty($editorSettings) && isset($editorSettings['config']) && !empty($editorSettings['config'])) { + $config = array_merge($config, $editorSettings['config']); + } + + parent::__construct($toolbar, $config, $prefix); + } + + /** + * Get the toolbar config. + * + * @return array + */ + public function getConfig() + { + $config = []; + if (api_get_setting('more_buttons_maximized_mode') === 'true') { + $config['toolbar_minToolbar'] = $this->getMinimizedToolbar(); + $config['toolbar_maxToolbar'] = $this->getMaximizedToolbar(); + } + + $config['customConfig'] = api_get_path(WEB_LIBRARY_JS_PATH).'ckeditor/config_js.php?'.api_get_cidreq(); + $config['flash_flvPlayer'] = api_get_path(WEB_LIBRARY_JS_PATH).'ckeditor/plugins/flash/swf/player.swf'; + + if (api_get_configuration_value('enable_uploadimage_editor')) { + $config['imageUploadUrl'] = api_get_path(WEB_AJAX_PATH).'document.ajax.php?'.api_get_cidreq().'&a=ck_uploadimage'; + } + /*filebrowserFlashBrowseUrl + filebrowserFlashUploadUrl + filebrowserImageBrowseLinkUrl + filebrowserImageBrowseUrl + filebrowserImageUploadUrl + filebrowserUploadUrl*/ + + $config['extraPlugins'] = $this->getPluginsToString(); + + //$config['oembed_maxWidth'] = '560'; + //$config['oembed_maxHeight'] = '315'; + + /*$config['wordcount'] = array( + // Whether or not you want to show the Word Count + 'showWordCount' => true, + // Whether or not you want to show the Char Count + 'showCharCount' => true, + // Option to limit the characters in the Editor + 'charLimit' => 'unlimited', + // Option to limit the words in the Editor + 'wordLimit' => 'unlimited' + );*/ + + $config['skin'] = 'bootstrapck,'.api_get_path(WEB_LIBRARY_JS_PATH).'ckeditor/skins/bootstrapck/'; + $config['skin'] = 'moono-lisa'; + + $config['image2_chamilo_alignClasses'] = [ + 'pull-left', + 'text-center', + 'pull-right', + 'img-va-baseline', + 'img-va-top', + 'img-va-bottom', + 'img-va-middle', + 'img-va-super', + 'img-va-sub', + 'img-va-text-top', + 'img-va-text-bottom', + ]; + $config['startupOutlineBlocks'] = api_get_configuration_value('ckeditor_startup_outline_blocks') === true; + + if (isset($this->config)) { + $this->config = array_merge($config, $this->config); + } else { + $this->config = $config; + } + + //$config['width'] = '100'; + //$config['height'] = '200'; + return $this->config; + } + + /** + * @return array + */ + public function getNewPageBlock() + { + return ['NewPage', 'Templates', '-', 'PasteFromWord', 'inserthtml']; + } + + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false. + * + * @return array + */ + protected function getNormalToolbar() + { + return null; + } + + /** + * Get the toolbar configuration when CKEditor is minimized. + * + * @return array + */ + protected function getMinimizedToolbar() + { + return [ + $this->getNewPageBlock(), + ['Undo', 'Redo'], + [ + 'Link', + 'Image', + 'Video', + 'Oembed', + 'Flash', + 'Youtube', + 'VimeoEmbed', + 'Audio', + 'Table', + 'Asciimath', + 'Asciisvg', + ], + ['BulletedList', 'NumberedList', 'HorizontalRule'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], + ['Styles', 'Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'], + api_get_setting('enabled_wiris') == 'true' + ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] + : [''], + ['Toolbarswitch', 'Source'], + ]; + } + + /** + * Get the toolbar configuration when CKEditor is maximized. + * + * @return array + */ + protected function getMaximizedToolbar() + { + return [ + $this->getNewPageBlock(), + ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', 'inserthtml'], + ['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'], + ['Link', 'Unlink', 'Anchor', 'Glossary'], + [ + 'Image', + 'Mapping', + 'Video', + 'Oembed', + 'Flash', + 'Youtube', + 'VimeoEmbed', + 'Audio', + 'leaflet', + 'Smiley', + 'SpecialChar', + 'Asciimath', + 'Asciisvg', + ], + '/', + ['Table', '-', 'CreateDiv'], + ['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], + ['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'], + [api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''], + ['Styles', 'Format', 'Font', 'FontSize'], + ['PageBreak', 'ShowBlocks'], + api_get_setting('enabled_wiris') == 'true' + ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] + : [''], + ['Toolbarswitch', 'Source'], + ]; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Careers.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Careers.php new file mode 100644 index 000000000..1a5fa2bfc --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Careers.php @@ -0,0 +1,102 @@ +getNormalToolbar(); + } else { + $config['toolbar_minToolbar'] = $this->getMinimizedToolbar(); + $config['toolbar_maxToolbar'] = $this->getMaximizedToolbar(); + } + + return $config; + } + + /** + * Get the toolbar configuration when CKEditor is maximized. + * + * @return array + */ + protected function getMaximizedToolbar() + { + return [ + ['Save', 'NewPage', 'Templates', '-', 'Preview', 'Print'], + ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'], + ['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'], + ['Link', 'Unlink', 'Anchor', 'Glossary'], + [ + 'Image', + 'Mapping', + 'Video', + 'Oembed', + 'Youtube', + 'VimeoEmbed', + 'Flash', + 'Audio', + 'leaflet', + 'Smiley', + 'SpecialChar', + ], + '/', + ['Table', '-', 'CreateDiv'], + ['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], + ['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'], + [api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''], + ['Styles', 'Format', 'Font', 'FontSize'], + ['PageBreak', 'ShowBlocks', 'Source'], + ['Toolbarswitch'], + ]; + } + + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false. + * + * @return array + */ + protected function getNormalToolbar() + { + return [ + ['Save', 'NewPage', 'Templates', '-', 'PasteText'], + ['Undo', 'Redo'], + ['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table'], + ['BulletedList', 'NumberedList', 'HorizontalRule'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], + ['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor', 'Source'], + ['Maximize'], + ]; + } + + /** + * Get the toolbar configuration when CKEditor is minimized. + * + * @return array + */ + protected function getMinimizedToolbar() + { + return [ + $this->getNewPageBlock(), + ['Undo', 'Redo'], + ['Link', 'Image', 'Video', 'Flash', 'Youtube', 'VimeoEmbed', 'Audio', 'Table'], + ['BulletedList', 'NumberedList', 'HorizontalRule'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], + ['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor', 'Source'], + ['Toolbarswitch', 'ShowBlocks'], + ]; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Documents.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Documents.php new file mode 100644 index 000000000..18bcba2c0 --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Documents.php @@ -0,0 +1,190 @@ +getNormalToolbar(); + } else { + $config['toolbar_minToolbar'] = $this->getMinimizedToolbar(); + $config['toolbar_maxToolbar'] = $this->getMaximizedToolbar(); + } + + $config['extraPlugins'] = $this->getPluginsToString(); + $config['fullPage'] = true; + + return $config; + } + + /** + * @return array + */ + public function getConditionalPlugins() + { + $plugins = []; + + if (api_get_setting('show_glossary_in_documents') === 'ismanual') { + $plugins[] = 'glossary'; + } + + return $plugins; + } + + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false. + * + * @return array + */ + protected function getNormalToolbar() + { + return [ + ['Maximize', 'PasteFromWord', '-', 'Undo', 'Redo'], + ['Link', 'Unlink', 'Anchor', 'inserthtml', 'Glossary'], + [ + 'Image', + 'Video', + 'Flash', + 'Oembed', + 'Youtube', + 'VimeoEmbed', + 'Audio', + 'Asciimath', + 'Asciisvg', + 'CodeSnippet', + ], + ['Table', 'SpecialChar'], + [ + 'Outdent', + 'Indent', + '-', + 'TextColor', + 'BGColor', + '-', + 'NumberedList', + 'BulletedList', + '-', + api_get_configuration_value('translate_html') ? 'Language' : '', + api_get_setting('allow_spellcheck') === 'true' ? 'Scayt' : '', + ], + '/', + ['Styles', 'Format', 'Font', 'FontSize'], + ['Bold', 'Italic', 'Underline'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], + api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''], + ['Source'], + ]; + } + + /** + * @return array + */ + protected function getMaximizedToolbar() + { + return [ + array_merge(['Save'], $this->getNewPageBlock()), + ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', 'inserthtml'], + ['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'], + ['Link', 'Unlink', 'Anchor', 'Glossary'], + [ + 'Image', + 'Mapping', + 'Video', + 'Oembed', + 'Flash', + 'Youtube', + 'VimeoEmbed', + 'Audio', + 'leaflet', + 'Smiley', + 'SpecialChar', + 'Asciimath', + 'Asciisvg', + 'CodeSnippet', + ], + '/', + ['Table', '-', 'CreateDiv'], + ['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], + [ + 'Bold', + 'Italic', + 'Underline', + 'Strike', + '-', + 'Subscript', + 'Superscript', + '-', + 'TextColor', + 'BGColor', + api_get_configuration_value('translate_html') ? 'Language' : '', + ], + [api_get_setting('allow_spellcheck') === 'true' ? 'Scayt' : ''], + ['Styles', 'Format', 'Font', 'FontSize'], + ['PageBreak', 'ShowBlocks'], + api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''], + ['Toolbarswitch', 'Source'], + ]; + } + + /** + * Get the toolbar configuration when CKEditor is minimized. + * + * @return array + */ + protected function getMinimizedToolbar() + { + return [ + array_merge(['Save'], $this->getNewPageBlock()), + ['Undo', 'Redo'], + [ + 'Link', + 'Image', + 'Video', + 'Oembed', + 'Flash', + 'Youtube', + 'VimeoEmbed', + 'Audio', + 'Table', + 'Asciimath', + 'Asciisvg', + 'CodeSnippet', + ], + ['BulletedList', 'NumberedList', 'HorizontalRule'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight'], + ['Styles', + 'Format', + 'Font', + 'FontSize', + 'Bold', + 'Italic', + 'Underline', + 'TextColor', + 'BGColor', + ], + [ + api_get_configuration_value('translate_html') ? 'Language' : '', + 'ShowBlocks', + ], + api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''], + ['Toolbarswitch', 'Source'], + ]; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/DocumentsStudent.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/DocumentsStudent.php new file mode 100644 index 000000000..bafee11de --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/DocumentsStudent.php @@ -0,0 +1,168 @@ +getNormalToolbar(); + } else { + $config['toolbar_minToolbar'] = $this->getMinimizedToolbar(); + $config['toolbar_maxToolbar'] = $this->getMaximizedToolbar(); + } + + $config['extraPlugins'] = $this->getPluginsToString(); + $config['fullPage'] = true; + + return $config; + } + + /** + * Get the toolbar configuration when CKEditor is maximized. + * + * @return array + */ + protected function getMaximizedToolbar() + { + return [ + ['NewPage', 'Templates', '-', 'Preview', 'Print'], + ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'], + ['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'], + ['Link', 'Unlink', 'Anchor', 'Glossary'], + [ + 'Image', + 'Mapping', + 'Video', + 'Oembed', + 'Youtube', + 'VimeoEmbed', + 'Flash', + 'Audio', + 'leaflet', + 'Smiley', + 'SpecialChar', + 'Asciimath', + 'Asciisvg', + ], + '/', + ['Table', '-', 'CreateDiv'], + [ + 'BulletedList', + 'NumberedList', + 'HorizontalRule', + '-', + 'Outdent', + 'Indent', + 'Blockquote', + ], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], + [ + 'Bold', + 'Italic', + 'Underline', + 'Strike', + '-', + 'Subscript', + 'Superscript', + '-', + 'TextColor', + 'BGColor', + ], + [api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''], + ['Styles', 'Format', 'Font', 'FontSize'], + ['PageBreak', 'ShowBlocks'], + api_get_setting('enabled_wiris') == 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''], + ['Toolbarswitch'], + ]; + } + + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false. + * + * @return array + */ + protected function getNormalToolbar() + { + return [ + ['Save', 'Maximize', 'PasteFromWord', '-', 'Undo', 'Redo'], + ['Link', 'Unlink', 'Anchor'], + [ + 'Image', + 'Video', + 'Flash', + 'Oembed', + 'Youtube', + 'VimeoEmbed', + 'Audio', + 'Asciimath', + ], + ['Table', 'SpecialChar'], + [ + 'Outdent', + 'Indent', + '-', + 'TextColor', + 'BGColor', + '-', + 'OrderedList', + 'UnorderedList', + ], + '/', + ['Styles', 'Format', 'Font', 'FontSize'], + ['Bold', 'Italic', 'Underline'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight'], + api_get_setting('enabled_wiris') == 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''], + ['ShowBlocks'], + ]; + } + + /** + * Get the toolbar configuration when CKEditor is minimized. + * + * @return array + */ + protected function getMinimizedToolbar() + { + return [ + $this->getNewPageBlock(), + ['Undo', 'Redo'], + [ + 'Link', + 'Image', + 'Video', + 'Flash', + 'Audio', + 'Table', + 'Asciimath', + 'Asciisvg', + ], + ['BulletedList', 'NumberedList', 'HorizontalRule'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight'], + [ + 'Format', + 'Font', + 'FontSize', + 'Bold', + 'Italic', + 'Underline', + 'TextColor', + 'BGColor', + ], + api_get_setting('enabled_wiris') == 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''], + ['Toolbarswitch'], + ]; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/FAQ.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/FAQ.php new file mode 100644 index 000000000..8d809b8e3 --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/FAQ.php @@ -0,0 +1,97 @@ +getNormalToolbar(); + } else { + $config['toolbar_minToolbar'] = $this->getMinimizedToolbar(); + + $config['toolbar_maxToolbar'] = $this->getMaximizedToolbar(); + } + + return $config; + } + + /** + * Get the toolbar configuration when CKEditor is maximized. + * + * @return array + */ + protected function getMaximizedToolbar() + { + return [ + ['NewPage', 'Templates', '-', 'Preview', 'Print'], + ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'], + ['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'], + ['Link', 'Unlink', 'Anchor', 'Glossary'], + [ + 'Image', + 'Mapping', + 'Video', + 'Oembed', + 'Youtube', + 'VimeoEmbed', + 'Flash', + 'Audio', + 'leaflet', + 'Smiley', + 'SpecialChar', + ], + '/', + ['Table', '-', 'CreateDiv'], + ['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], + ['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'], + [api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''], + ['Styles', 'Format', 'Font', 'FontSize'], + ['PageBreak', 'ShowBlocks', 'Source'], + ['Toolbarswitch'], + ]; + } + + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false. + * + * @return array + */ + protected function getNormalToolbar() + { + return [ + ['Save', 'Preview', 'Source'], + ]; + } + + /** + * Get the toolbar configuration when CKEditor is minimized. + * + * @return array + */ + protected function getMinimizedToolbar() + { + return [ + $this->getNewPageBlock(), + ['Undo', 'Redo'], + ['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath', 'Asciisvg'], + ['BulletedList', 'NumberedList', 'HorizontalRule'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight'], + ['Format', 'Font', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'], + ['Toolbarswitch'], + ]; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Forum.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Forum.php new file mode 100644 index 000000000..037098d28 --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Forum.php @@ -0,0 +1,95 @@ +getNormalToolbar(); + } else { + $config['toolbar_minToolbar'] = $this->getMinimizedToolbar(); + } + + return $config; + } + + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false. + * + * @return array + */ + protected function getNormalToolbar() + { + return [ + ['Save', 'Maximize', 'PasteFromWord', '-', 'Undo', 'Redo'], + ['Link', 'Unlink', 'Anchor'], + ['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'VimeoEmbed', 'Audio'], + ['Table', 'SpecialChar'], + [ + 'NumberedList', + 'BulletedList', + '-', + 'Outdent', + 'Indent', + '-', + 'TextColor', + 'BGColor', + 'Source', + ], + '/', + ['Styles', 'Format', 'Font', 'FontSize'], + ['Bold', 'Italic', 'Underline'], + [ + 'JustifyLeft', + 'JustifyCenter', + 'JustifyRight', + 'JustifyBlock', + ], + api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''], + ]; + } + + /** + * Get the toolbar configuration when CKEditor is minimized. + * + * @return array + */ + protected function getMinimizedToolbar() + { + return [ + $this->getNewPageBlock(), + ['Undo', 'Redo'], + [ + 'Link', + 'Image', + 'Video', + 'Oembed', + 'Flash', + 'Youtube', + 'VimeoEmbed', + 'Audio', + 'Table', + 'Asciimath', + 'Asciisvg', + ], + ['BulletedList', 'NumberedList', 'HorizontalRule'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight'], + ['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor', 'Source'], + api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''], + ['Toolbarswitch'], + ]; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ForumStudent.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ForumStudent.php new file mode 100644 index 000000000..9d45f6658 --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ForumStudent.php @@ -0,0 +1,110 @@ +getNormalToolbar(); + } else { + $config['toolbar_minToolbar'] = $this->getMinimizedToolbar(); + + $config['toolbar_maxToolbar'] = $this->getMaximizedToolbar(); + } + + return $config; + } + + /** + * Get the toolbar configuration when CKEditor is maximized. + * + * @return array + */ + protected function getMaximizedToolbar() + { + return [ + ['Save', 'NewPage', 'Templates', '-', 'Preview', 'Print'], + ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'], + ['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'], + ['Link', 'Unlink', 'Anchor', 'Glossary'], + [ + 'Image', + 'Mapping', + 'Video', + 'Flash', + 'Youtube', + 'Oembed', + 'Audio', + 'leaflet', + 'Smiley', + 'SpecialChar', + 'Asciimath', + 'Asciisvg', + ], + '/', + ['Table', '-', 'CreateDiv'], + ['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], + ['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'], + [api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''], + ['Styles', 'Format', 'Font', 'FontSize'], + ['PageBreak', 'ShowBlocks'], + api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''], + ['Toolbarswitch'], + ]; + } + + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false. + * + * @return array + */ + protected function getNormalToolbar() + { + return [ + ['Save', 'Maximize', 'PasteFromWord', '-', 'Undo', 'Redo'], + ['Link', 'Unlink', 'Anchor'], + ['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'Audio'], + ['Table', 'SpecialChar'], + ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'TextColor', 'BGColor'], + '/', + ['Styles', 'Format', 'Font', 'FontSize'], + ['Bold', 'Italic', 'Underline'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight'], + api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''], + ['ShowBlocks'], + ]; + } + + /** + * Get the toolbar configuration when CKEditor is minimized. + * + * @return array + */ + protected function getMinimizedToolbar() + { + return [ + $this->getNewPageBlock(), + ['Undo', 'Redo'], + ['Link', 'Image', 'Video', 'Oembed', 'Flash', 'Youtube', 'Audio', 'Table', 'Asciimath', 'Asciisvg'], + ['BulletedList', 'NumberedList', 'HorizontalRule'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight'], + ['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'], + api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''], + ['Toolbarswitch'], + ]; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Glossary.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Glossary.php new file mode 100644 index 000000000..73a831390 --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Glossary.php @@ -0,0 +1,66 @@ +getNormalToolbar(); + } else { + $config['toolbar_minToolbar'] = $this->getMinimizedToolbar(); + } + + return $config; + } + + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false. + * + * @return array + */ + protected function getNormalToolbar() + { + return [ + ['Save', 'Maximize', 'PasteFromWord', '-', 'Undo', 'Redo'], + ['Link', 'Unlink', 'Anchor'], + ['Image'], + ['Table', 'SpecialChar'], + ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'TextColor', 'BGColor', '-', 'Source'], + '/', + ['Styles', 'Format', 'Font', 'FontSize'], + ['Bold', 'Italic', 'Underline'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], + ]; + } + + /** + * Get the toolbar configuration when CKEditor is minimized. + * + * @return array + */ + protected function getMinimizedToolbar() + { + return [ + $this->getNewPageBlock(), + ['Undo', 'Redo'], + ['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath', 'Asciisvg'], + ['BulletedList', 'NumberedList', 'HorizontalRule'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight'], + ['Format', 'Font', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor', 'Source'], + ['Toolbarswitch'], + ]; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/IntroductionSection.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/IntroductionSection.php new file mode 100644 index 000000000..2494a30cc --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/IntroductionSection.php @@ -0,0 +1,188 @@ +getNormalToolbar(); + } else { + $config['toolbar_minToolbar'] = $this->getMinimizedToolbar(); + $config['toolbar_maxToolbar'] = $this->getMaximizedToolbar(); + } + + $config['extraPlugins'] = $this->getPluginsToString(); + $config['fullPage'] = false; + + return $config; + } + + /** + * @return array + */ + public function getConditionalPlugins() + { + $plugins = []; + + if (api_get_setting('show_glossary_in_documents') === 'ismanual') { + $plugins[] = 'glossary'; + } + + return $plugins; + } + + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false. + * + * @return array + */ + protected function getNormalToolbar() + { + return [ + ['Maximize', 'PasteFromWord', '-', 'Undo', 'Redo'], + ['Link', 'Unlink', 'Anchor', 'inserthtml', 'Glossary'], + [ + 'Image', + 'Video', + 'Flash', + 'Oembed', + 'Youtube', + 'VimeoEmbed', + 'Audio', + 'Asciimath', + 'Asciisvg', + ], + ['Table', 'SpecialChar'], + [ + 'Outdent', + 'Indent', + '-', + 'TextColor', + 'BGColor', + '-', + 'NumberedList', + 'BulletedList', + '-', + api_get_configuration_value('translate_html') ? 'Language' : '', + api_get_setting('allow_spellcheck') === 'true' ? 'Scayt' : '', + ], + '/', + ['Styles', 'Format', 'Font', 'FontSize'], + ['Bold', 'Italic', 'Underline'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight'], + api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''], + ['Source'], + ]; + } + + /** + * Get the toolbar configuration when CKEditor is minimized. + * + * @return array + */ + protected function getMinimizedToolbar() + { + return [ + $this->getNewPageBlock(), + ['Undo', 'Redo'], + [ + 'Link', + 'Image', + 'Video', + 'Flash', + 'Youtube', + 'VimeoEmbed', + 'Audio', + 'Table', + 'Asciimath', + 'Asciisvg', + ], + ['BulletedList', 'NumberedList', 'HorizontalRule'], + ['JustifyLeft', 'JustifyCenter', 'JustifyBlock'], + [ + 'Styles', + 'Format', + 'Font', + 'FontSize', + 'Bold', + 'Italic', + 'Underline', + 'TextColor', + 'BGColor', + api_get_configuration_value('translate_html') ? 'Language' : '', + ], + [ + 'ShowBlocks', + ], + api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''], + ['Toolbarswitch', 'Source'], + ]; + } + + /** + * @return array + */ + protected function getMaximizedToolbar() + { + return [ + $this->getNewPageBlock(), + ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', 'inserthtml'], + ['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'], + ['Link', 'Unlink', 'Anchor', 'Glossary'], + [ + 'Image', + 'Mapping', + 'Video', + 'Oembed', + 'Flash', + 'Youtube', + 'VimeoEmbed', + 'Audio', + 'leaflet', + 'Smiley', + 'SpecialChar', + 'Asciimath', + 'Asciisvg', + ], + '/', + ['Table', '-', 'CreateDiv'], + ['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], + [ + 'Bold', + 'Italic', + 'Underline', + 'Strike', + '-', + 'Subscript', + 'Superscript', + '-', + 'TextColor', + 'BGColor', + api_get_configuration_value('translate_html') ? 'Language' : '', + ], + [api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''], + ['Styles', 'Format', 'Font', 'FontSize'], + ['PageBreak', 'ShowBlocks'], + api_get_setting('enabled_wiris') == 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''], + ['Toolbarswitch', 'Source'], + ]; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/LearningPathAuthor.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/LearningPathAuthor.php new file mode 100644 index 000000000..0aa5e0975 --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/LearningPathAuthor.php @@ -0,0 +1,67 @@ +getNormalToolbar(); + } else { + $config['toolbar_minToolbar'] = $this->getMinimizedToolbar(); + $config['toolbar_maxToolbar'] = $this->getMaximizedToolbar(); + } + + $config['fullPage'] = false; + + return $config; + } + + /** + * Get the toolbar configuration when CKEditor is maximized. + * + * @return array + */ + protected function getMaximizedToolbar() + { + return [ + ['PageBreak', 'ShowBlocks', 'Source'], + ]; + } + + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false. + * + * @return array + */ + protected function getNormalToolbar() + { + return [ + ['Link', 'Unlink', 'Bold', 'Italic', 'TextColor', 'BGColor', 'Source'], + ]; + } + + /** + * Get the toolbar configuration when CKEditor is minimized. + * + * @return array + */ + protected function getMinimizedToolbar() + { + return [ + ['Link', 'Unlink', 'Bold', 'Italic', 'TextColor', 'BGColor', 'Source'], + ]; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/LearningPathDocuments.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/LearningPathDocuments.php new file mode 100644 index 000000000..45282f806 --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/LearningPathDocuments.php @@ -0,0 +1,135 @@ +getNormalToolbar(); + } else { + $config['toolbar_minToolbar'] = $this->getMinimizedToolbar(); + $config['toolbar_maxToolbar'] = $this->getMaximizedToolbar(); + } + + $config['fullPage'] = true; + + return $config; + } + + /** + * Get the toolbar configuration when CKEditor is maximized. + * + * @return array + */ + protected function getMaximizedToolbar() + { + return [ + ['Save', 'NewPage', 'Templates', '-', 'Preview', 'Print'], + ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'], + ['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'], + ['Link', 'Unlink', 'Anchor', 'Glossary'], + [ + 'Image', + 'Mapping', + 'Video', + 'Oembed', + 'Youtube', + 'VimeoEmbed', + 'Flash', + 'Audio', + 'leaflet', + 'Smiley', + 'SpecialChar', + 'Asciimath', + 'Asciisvg', + 'CodeSnippet', + ], + '/', + ['Table', '-', 'CreateDiv'], + ['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], + ['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'], + [api_get_setting('allow_spellcheck') === 'true' ? 'Scayt' : ''], + ['Styles', 'Format', 'Font', 'FontSize'], + api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''], + ['PageBreak', 'ShowBlocks', 'Source'], + ['Toolbarswitch'], + ]; + } + + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false. + * + * @return array + */ + protected function getNormalToolbar() + { + return [ + ['Save', 'PasteFromWord', '-', 'Undo', 'Redo'], + ['Link', 'Unlink', 'Anchor', 'Glossary'], + [ + 'Image', + 'Video', + 'Flash', + 'Oembed', + 'Youtube', + 'VimeoEmbed', + 'Audio', + 'Asciimath', + 'Asciisvg', + 'Table', + 'SpecialChar', + 'CodeSnippet', + ], + [ + 'Outdent', + 'Indent', + 'TextColor', + 'BGColor', + '-', + 'NumberedList', + 'BulletedList', + 'JustifyLeft', + 'JustifyCenter', + 'JustifyRight', + ], + '/', + ['Styles', 'Format', 'Font', 'FontSize'], + ['Bold', 'Italic', 'Underline', '-', 'Source'], + ]; + } + + /** + * Get the toolbar configuration when CKEditor is minimized. + * + * @return array + */ + protected function getMinimizedToolbar() + { + return [ + array_merge(['Save'], $this->getNewPageBlock()), + ['Undo', 'Redo'], + ['Link', 'Image', 'Video', 'Youtube', 'VimeoEmbed', 'Flash', 'Audio', 'Table', 'Asciimath', 'Asciisvg'], + ['CodeSnippet'], + ['BulletedList', 'NumberedList', 'HorizontalRule'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], + ['Toolbarswitch'], + ['Styles', 'Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'], + api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''], + ['ShowBlocks', 'Source'], + ]; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Messages.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Messages.php new file mode 100644 index 000000000..b13278532 --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Messages.php @@ -0,0 +1,111 @@ +getNormalToolbar(); + } else { + $config['toolbar_minToolbar'] = $this->getMinimizedToolbar(); + $config['toolbar_maxToolbar'] = $this->getMaximizedToolbar(); + } + + return $config; + } + + /** + * Get the toolbar configuration when CKEditor is maximized. + * + * @return array + */ + protected function getMaximizedToolbar() + { + return [ + ['NewPage', 'Templates', '-', 'Preview', 'Print'], + ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'], + ['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'], + ['Link', 'Unlink', 'Anchor', 'Glossary'], + [ + 'Image', + 'Mapping', + 'Video', + 'Oembed', + 'Youtube', + 'VimeoEmbed', + 'Flash', + 'Audio', + 'leaflet', + 'Smiley', + 'SpecialChar', + 'Inserthtml', + 'Asciimath', + 'Asciisvg', + ], + '/', + ['Table', '-', 'CreateDiv'], + ['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], + ['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'], + [api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''], + ['Styles', 'Format', 'Font', 'FontSize'], + api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''], + ['PageBreak', 'ShowBlocks', 'Source'], + ['Toolbarswitch'], + ]; + } + + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false. + * + * @return array + */ + protected function getNormalToolbar() + { + return [ + ['Link', 'Unlink'], + ['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'VimeoEmbed', 'Audio'], + ['Table', 'Smiley'], + ['TextColor', 'BGColor'], + ['Source'], + '/', + ['Font', 'FontSize'], + ['Bold', 'Italic', 'Underline'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', '-', 'NumberedList', 'BulletedList'], + ]; + } + + /** + * Get the toolbar configuration when CKEditor is minimized. + * + * @return array + */ + protected function getMinimizedToolbar() + { + return [ + $this->getNewPageBlock(), + ['Undo', 'Redo'], + ['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath', 'Asciisvg'], + ['BulletedList', 'NumberedList', 'HorizontalRule'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight'], + ['Styles', 'Format', 'Font', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'], + api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''], + ['Toolbarswitch'], + ]; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Minimal.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Minimal.php new file mode 100644 index 000000000..25b0d3c54 --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Minimal.php @@ -0,0 +1,42 @@ + 'clipboard', + 'groups' => ['clipboard', 'undo'], + 'items' => ['Cut', 'Copy', 'Paste', '-', 'Undo', 'Redo'], + ], + [ + 'name' => 'basicstyles', + 'groups' => ['basicstyles', 'cleanup'], + 'items' => ['Bold', 'Italic', 'Underline', 'Strike', 'TextColor'], + ], + [ + 'name' => 'paragraph', + 'groups' => ['list', 'indent', 'blocks', 'align', 'bidi'], + 'items' => ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent'], + ], + [ + 'name' => 'links', + 'items' => ['Link', 'Unlink', 'Anchor', 'Source'], + ], + ]; + + return $config; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/NotebookStudent.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/NotebookStudent.php new file mode 100644 index 000000000..88620810d --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/NotebookStudent.php @@ -0,0 +1,107 @@ +getNormalToolbar(); + } else { + $config['toolbar_minToolbar'] = $this->getMinimizedToolbar(); + $config['toolbar_maxToolbar'] = $this->getMaximizedToolbar(); + } + + return $config; + } + + /** + * Get the toolbar configuration when CKEditor is maximized. + * + * @return array + */ + protected function getMaximizedToolbar() + { + return [ + ['Save', 'NewPage', 'Templates', '-', 'Preview', 'Print'], + ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'], + ['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'], + ['Link', 'Unlink', 'Anchor', 'Glossary'], + [ + 'Image', + 'Mapping', + 'Video', + 'Oembed', + 'Youtube', + 'VimeoEmbed', + 'Flash', + 'Audio', + 'leaflet', + 'Smiley', + 'SpecialChar', + 'Asciimath', + 'Asciisvg', + ], + '/', + ['Table', '-', 'CreateDiv'], + ['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], + ['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'], + [api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''], + ['Styles', 'Format', 'Font', 'FontSize'], + ['PageBreak', 'ShowBlocks'], + ['Toolbarswitch'], + ]; + } + + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false. + * + * @return array + */ + protected function getNormalToolbar() + { + return [ + ['Save', 'Maximize', 'PasteFromWord', '-', 'Undo', 'Redo'], + ['Link', 'Unlink', 'Anchor'], + ['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'VimeoEmbed', 'Audio'], + ['Table', 'SpecialChar'], + ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'TextColor', 'BGColor'], + '/', + ['Styles', 'Format', 'Font', 'FontSize'], + ['Bold', 'Italic', 'Underline'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight'], + ['ShowBlocks'], + ]; + } + + /** + * Get the toolbar configuration when CKEditor is minimized. + * + * @return array + */ + protected function getMinimizedToolbar() + { + return [ + $this->getNewPageBlock(), + ['Undo', 'Redo'], + ['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath', 'Asciisvg'], + ['BulletedList', 'NumberedList', 'HorizontalRule'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], + ['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'], + ['Toolbarswitch'], + ]; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/PortalNews.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/PortalNews.php new file mode 100644 index 000000000..3d0ea7361 --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/PortalNews.php @@ -0,0 +1,107 @@ +getNormalToolbar(); + } else { + $config['toolbar_minToolbar'] = $this->getMinimizedToolbar(); + $config['toolbar_maxToolbar'] = $this->getMaximizedToolbar(); + } + + return $config; + } + + /** + * Get the toolbar configuration when CKEditor is maximized. + * + * @return array + */ + protected function getMaximizedToolbar() + { + return [ + ['NewPage', 'Templates', '-', 'Preview', 'Print'], + ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'], + ['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'], + ['Link', 'Unlink', 'Anchor', 'Glossary'], + [ + 'Image', + 'Mapping', + 'Video', + 'Oembed', + 'Youtube', + 'VimeoEmbed', + 'Flash', + 'Audio', + 'leaflet', + 'Smiley', + 'SpecialChar', + 'Inserthtml', + 'Asciimath', + 'Asciisvg', + ], + '/', + ['Table', '-', 'CreateDiv'], + ['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], + ['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'], + [api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''], + ['Styles', 'Format', 'Font', 'FontSize'], + ['PageBreak', 'ShowBlocks', 'Source'], + ['Toolbarswitch'], + ]; + } + + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false. + * + * @return array + */ + protected function getNormalToolbar() + { + return [ + ['Save', 'Maximize', 'PasteFromWord', '-', 'Undo', 'Redo'], + ['Link', 'Unlink', 'Anchor'], + ['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'VimeoEmbed', 'Audio'], + ['Table', 'SpecialChar'], + ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'TextColor', 'BGColor', '-', 'Source'], + '/', + ['Styles', 'Format', 'Font', 'FontSize'], + ['Bold', 'Italic', 'Underline'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight'], + ]; + } + + /** + * Get the toolbar configuration when CKEditor is minimized. + * + * @return array + */ + protected function getMinimizedToolbar() + { + return [ + $this->getNewPageBlock(), + ['Undo', 'Redo'], + ['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath', 'Asciisvg'], + ['BulletedList', 'NumberedList', 'HorizontalRule'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], + ['Styles', 'Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor', 'Source'], + ['Toolbarswitch'], + ]; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Profile.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Profile.php new file mode 100644 index 000000000..2cb7470da --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Profile.php @@ -0,0 +1,104 @@ +getNormalToolbar(); + } else { + $config['toolbar_minToolbar'] = $this->getMinimizedToolbar(); + $config['toolbar_maxToolbar'] = $this->getMaximizedToolbar(); + } + + return $config; + } + + /** + * Get the toolbar configuration when CKEditor is maximized. + * + * @return array + */ + protected function getMaximizedToolbar() + { + return [ + ['NewPage', 'Templates', '-', 'Preview', 'Print'], + ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'], + ['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'], + ['Link', 'Unlink', 'Anchor', 'Glossary'], + [ + 'Image', + 'Mapping', + 'Video', + 'Oembed', + 'Youtube', + 'VimeoEmbed', + 'Flash', + 'Audio', + 'leaflet', + 'Smiley', + 'SpecialChar', + ], + '/', + ['Table', '-', 'CreateDiv'], + ['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], + ['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'], + [api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''], + ['Styles', 'Format', 'Font', 'FontSize'], + ['PageBreak', 'ShowBlocks', 'Source'], + ['Toolbarswitch'], + ]; + } + + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false. + * + * @return array + */ + protected function getNormalToolbar() + { + return [ + ['Maximize', '-', 'PasteFromWord', '-', 'Undo', 'Redo'], + ['Link', 'Unlink', 'Anchor'], + ['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'VimeoEmbed', 'Audio'], + ['Table', 'Smiley'], + '/', + ['Font', 'FontSize'], + ['Bold', 'Italic', 'Underline'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', '-', 'NumberedList', 'BulletedList', '-', 'TextColor', 'BGColor'], + ['Source'], + ]; + } + + /** + * Get the toolbar configuration when CKEditor is minimized. + * + * @return array + */ + protected function getMinimizedToolbar() + { + return [ + $this->getNewPageBlock(), + ['Undo', 'Redo'], + ['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath'], + ['BulletedList', 'NumberedList', 'HorizontalRule'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight'], + ['Format', 'Font', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'], + ['Toolbarswitch'], + ]; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Project.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Project.php new file mode 100644 index 000000000..ece2cf25e --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Project.php @@ -0,0 +1,104 @@ +getNormalToolbar(); + } else { + $config['toolbar_minToolbar'] = $this->getMinimizedToolbar(); + $config['toolbar_maxToolbar'] = $this->getMaximizedToolbar(); + } + + return $config; + } + + /** + * Get the toolbar configuration when CKEditor is maximized. + * + * @return array + */ + protected function getMaximizedToolbar() + { + return [ + ['Save', 'NewPage', 'Templates', '-', 'Preview', 'Print'], + ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'], + ['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'], + ['Link', 'Unlink', 'Anchor', 'Glossary'], + [ + 'Image', + 'Mapping', + 'Video', + 'Oembed', + 'Youtube', + 'VimeoEmbed', + 'Flash', + 'Audio', + 'leaflet', + 'Smiley', + 'SpecialChar', + 'Asciimath', + ], + '/', + ['Table', '-', 'CreateDiv'], + ['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], + ['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'], + [api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''], + ['Styles', 'Format', 'Font', 'FontSize'], + ['PageBreak', 'ShowBlocks', 'Source'], + ['Toolbarswitch'], + ]; + } + + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false. + * + * @return array + */ + protected function getNormalToolbar() + { + return [ + ['Maximize', '-', 'PasteFromWord', '-', 'Undo', 'Redo'], + ['Link', 'Unlink', 'Anchor'], + ['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'VimeoEmbed', 'Audio'], + ['Table', 'leaflet'], + ['Font', 'FontSize'], + ['Bold', 'Italic', 'Underline'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', '-', 'NumberedList', 'BulletedList', '-', 'TextColor', 'BGColor'], + ['Source'], + ]; + } + + /** + * Get the toolbar configuration when CKEditor is minimized. + * + * @return array + */ + protected function getMinimizedToolbar() + { + return [ + $this->getNewPageBlock(), + ['Undo', 'Redo'], + ['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath'], + ['BulletedList', 'NumberedList', 'HorizontalRule'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight'], + ['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'TextColor', 'BGColor', 'Source'], + ['Toolbarswitch'], + ]; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ProjectComment.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ProjectComment.php new file mode 100644 index 000000000..8d25c1359 --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ProjectComment.php @@ -0,0 +1,103 @@ +getNormalToolbar(); + } else { + $config['toolbar_minToolbar'] = $this->getMinimizedToolbar(); + $config['toolbar_maxToolbar'] = $this->getMaximizedToolbar(); + } + + return $config; + } + + /** + * Get the toolbar configuration when CKEditor is maximized. + * + * @return array + */ + protected function getMaximizedToolbar() + { + return [ + ['Save', 'NewPage', 'Templates', '-', 'Preview', 'Print'], + ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'], + ['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'], + ['Link', 'Unlink', 'Anchor', 'Glossary'], + [ + 'Image', + 'Mapping', + 'Video', + 'Oembed', + 'Youtube', + 'VimeoEmbed', + 'Flash', + 'Audio', + 'leaflet', + 'Smiley', + 'SpecialChar', + 'Asciimath', + ], + '/', + ['Table', '-', 'CreateDiv'], + ['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], + ['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'], + [api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''], + ['Styles', 'Format', 'Font', 'FontSize'], + ['PageBreak', 'ShowBlocks', 'Source'], + ['Toolbarswitch'], + ]; + } + + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false. + * + * @return array + */ + protected function getNormalToolbar() + { + return [ + ['Maximize', '-', 'PasteFromWord', '-', 'Undo', 'Redo'], + ['Link', 'Unlink'], + ['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'VimeoEmbed', 'Audio'], + ['Table', 'leaflet'], + ['Bold', 'Italic', 'Underline'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', '-', 'NumberedList', 'BulletedList', '-', 'TextColor', 'BGColor'], + ['Source'], + ]; + } + + /** + * Get the toolbar configuration when CKEditor is minimized. + * + * @return array + */ + protected function getMinimizedToolbar() + { + return [ + $this->getNewPageBlock(), + ['Undo', 'Redo'], + ['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath'], + ['BulletedList', 'NumberedList', 'HorizontalRule'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight'], + ['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'TextColor'], + ['Toolbarswitch'], + ]; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ProjectCommentStudent.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ProjectCommentStudent.php new file mode 100644 index 000000000..dfef77514 --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ProjectCommentStudent.php @@ -0,0 +1,102 @@ +getNormalToolbar(); + } else { + $config['toolbar_minToolbar'] = $this->getMinimizedToolbar(); + $config['toolbar_maxToolbar'] = $this->getMaximizedToolbar(); + } + + return $config; + } + + /** + * Get the toolbar configuration when CKEditor is maximized. + * + * @return array + */ + protected function getMaximizedToolbar() + { + return [ + ['Save', 'NewPage', 'Templates', '-', 'Preview', 'Print'], + ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'], + ['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'], + ['Link', 'Unlink', 'Anchor', 'Glossary'], + [ + 'Image', + 'Mapping', + 'Video', + 'Oembed', + 'Youtube', + 'Flash', + 'Audio', + 'leaflet', + 'Smiley', + 'SpecialChar', + 'Asciimath', + ], + '/', + ['Table', '-', 'CreateDiv'], + ['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], + ['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'], + [api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''], + ['Styles', 'Format', 'Font', 'FontSize'], + ['PageBreak', 'ShowBlocks'], + ['Toolbarswitch'], + ]; + } + + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false. + * + * @return array + */ + protected function getNormalToolbar() + { + return [ + ['Maximize', '-', 'PasteFromWord', '-', 'Undo', 'Redo'], + ['Link', 'Unlink'], + ['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'Audio'], + ['Table', 'leaflet'], + ['Bold', 'Italic', 'Underline'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', '-', 'NumberedList', 'BulletedList', '-', 'TextColor', 'BGColor'], + ['ShowBlocks'], + ]; + } + + /** + * Get the toolbar configuration when CKEditor is minimized. + * + * @return array + */ + protected function getMinimizedToolbar() + { + return [ + $this->getNewPageBlock(), + ['Undo', 'Redo'], + ['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath'], + ['BulletedList', 'NumberedList', 'HorizontalRule'], + ['JustifyLeft', 'JustifyCenter', 'JustifyBlock'], + ['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'TextColor'], + ['Toolbarswitch'], + ]; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ProjectStudent.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ProjectStudent.php new file mode 100644 index 000000000..76edb372c --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ProjectStudent.php @@ -0,0 +1,103 @@ +getNormalToolbar(); + } else { + $config['toolbar_minToolbar'] = $this->getMinimizedToolbar(); + $config['toolbar_maxToolbar'] = $this->getMaximizedToolbar(); + } + + return $config; + } + + /** + * Get the toolbar configuration when CKEditor is maximized. + * + * @return array + */ + protected function getMaximizedToolbar() + { + return [ + ['Save', 'NewPage', 'Templates', '-', 'Preview', 'Print'], + ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'], + ['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'], + ['Link', 'Unlink', 'Anchor', 'Glossary'], + [ + 'Image', + 'Mapping', + 'Video', + 'Oembed', + 'Youtube', + 'Flash', + 'Audio', + 'leaflet', + 'Smiley', + 'SpecialChar', + 'Asciimath', + ], + '/', + ['Table', '-', 'CreateDiv'], + ['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], + ['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'], + [api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''], + ['Styles', 'Format', 'Font', 'FontSize'], + ['PageBreak', 'ShowBlocks'], + ['Toolbarswitch'], + ]; + } + + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false. + * + * @return array + */ + protected function getNormalToolbar() + { + return [ + ['Maximize', '-', 'PasteFromWord', '-', 'Undo', 'Redo'], + ['Link', 'Unlink', 'Anchor'], + ['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'Audio'], + ['Table', 'leaflet'], + ['Font', 'FontSize'], + ['Bold', 'Italic', 'Underline'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', '-', 'NumberedList', 'BulletedList', '-', 'TextColor', 'BGColor'], + ['Source'], + ]; + } + + /** + * Get the toolbar configuration when CKEditor is minimized. + * + * @return array + */ + protected function getMinimizedToolbar() + { + return [ + $this->getNewPageBlock(), + ['Undo', 'Redo'], + ['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath'], + ['BulletedList', 'NumberedList', 'HorizontalRule'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight'], + ['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'TextColor'], + ['Toolbarswitch'], + ]; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Register.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Register.php new file mode 100644 index 000000000..525cf9ac6 --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Register.php @@ -0,0 +1,61 @@ +getNormalToolbar(); + } else { + $config['toolbar_minToolbar'] = $this->getMinimizedToolbar(); + $config['toolbar_maxToolbar'] = $this->getMinimizedToolbar(); + } + + return $config; + } + + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false. + * + * @return array + */ + protected function getNormalToolbar() + { + return [ + ['Maximize', '-', 'PasteFromWord', '-', 'Undo', 'Redo'], + ['Font', 'FontSize'], + ['Bold', 'Italic', 'Underline'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', '-', 'NumberedList', 'BulletedList', '-', 'TextColor', 'BGColor'], + ]; + } + + /** + * Get the toolbar configuration when CKEditor is minimized. + * + * @return array + */ + protected function getMinimizedToolbar() + { + return [ + ['Toolbarswitch', 'PasteFromWord', '-', 'Undo', 'Redo'], + ['Font', 'FontSize'], + ['Bold', 'Italic', 'Underline'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', '-', 'NumberedList', 'BulletedList', '-', 'TextColor', 'BGColor'], + ]; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Survey.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Survey.php new file mode 100644 index 000000000..b81c9c8ed --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Survey.php @@ -0,0 +1,127 @@ +getNormalToolbar(); + } else { + $config['toolbar_minToolbar'] = $this->getMinimizedToolbar(); + $config['toolbar_maxToolbar'] = $this->getMaximizedToolbar(); + } + + return $config; + } + + /** + * Get the toolbar configuration when CKEditor is maximized. + * + * @return array + */ + protected function getMaximizedToolbar() + { + return [ + ['NewPage', 'Templates', '-', 'Preview', 'Print'], + ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'], + ['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'], + ['Link', 'Unlink', 'Anchor', 'Glossary'], + [ + 'Image', + 'Mapping', + 'Video', + 'Oembed', + 'Youtube', + 'VimeoEmbed', + 'Flash', + 'Audio', + 'leaflet', + 'Smiley', + 'SpecialChar', + 'Asciimath', + 'Asciisvg', + ], + '/', + ['Table', '-', 'CreateDiv'], + ['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], + [ + 'Bold', + 'Italic', + 'Underline', + 'Strike', + '-', + 'Subscript', + 'Superscript', + '-', + 'TextColor', + 'BGColor', + api_get_configuration_value('translate_html') ? 'Language' : '', + ], + [api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''], + ['Styles', 'Format', 'Font', 'FontSize'], + ['PageBreak', 'ShowBlocks', 'Source'], + ['Toolbarswitch'], + ]; + } + + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false. + * + * @return array + */ + protected function getNormalToolbar() + { + return [ + ['Maximize'], + ['Link', 'Unlink'], + ['Image'], + ['Table'], + ['FontSize'], + ['Bold', 'Italic'], + ['NumberedList', 'BulletedList', '-', 'TextColor'], + ['Source'], + ]; + } + + /** + * Get the toolbar configuration when CKEditor is minimized. + * + * @return array + */ + protected function getMinimizedToolbar() + { + return [ + $this->getNewPageBlock(), + ['Undo', 'Redo'], + ['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath', 'Asciisvg'], + ['BulletedList', 'NumberedList', 'HorizontalRule'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight'], + [ + 'Format', + 'FontSize', + 'Bold', + 'Italic', + 'Underline', + 'TextColor', + 'BGColor', + api_get_configuration_value('translate_html') ? 'Language' : '', + 'Source', + ], + ['Toolbarswitch'], + ]; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/SurveyQuestion.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/SurveyQuestion.php new file mode 100644 index 000000000..31737bcb2 --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/SurveyQuestion.php @@ -0,0 +1,127 @@ +getNormalToolbar(); + } else { + $config['toolbar_minToolbar'] = $this->getMinimizedToolbar(); + $config['toolbar_maxToolbar'] = $this->getMaximizedToolbar(); + } + + return $config; + } + + /** + * Get the toolbar configuration when CKEditor is maximized. + * + * @return array + */ + protected function getMaximizedToolbar() + { + return [ + $this->getNewPageBlock(), + ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', 'inserthtml'], + ['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'], + ['Link', 'Unlink', 'Anchor', 'Glossary'], + [ + 'Image', + 'Mapping', + 'Video', + 'Oembed', + 'Flash', + 'Youtube', + 'VimeoEmbed', + 'Audio', + 'leaflet', + 'Smiley', + 'SpecialChar', + 'Asciimath', + 'Asciisvg', + ], + '/', + ['Table', '-', 'CreateDiv'], + ['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], + [ + 'Bold', + 'Italic', + 'Underline', + 'Strike', + '-', + 'Subscript', + 'Superscript', + '-', + 'TextColor', + 'BGColor', + api_get_configuration_value('translate_html') ? 'Language' : '', + ], + [api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''], + ['Styles', 'Format', 'Font', 'FontSize'], + ['PageBreak', 'ShowBlocks'], + api_get_setting('enabled_wiris') == 'true' + ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] + : [''], + ['Toolbarswitch', 'Source'], + ]; + } + + /** + * Get the toolbar configuration when CKEditor is minimized. + * + * @return array + */ + protected function getMinimizedToolbar() + { + return [ + $this->getNewPageBlock(), + ['Undo', 'Redo'], + [ + 'Link', + 'Image', + 'Video', + 'Oembed', + 'Flash', + 'Youtube', + 'VimeoEmbed', + 'Audio', + 'Table', + 'Asciimath', + 'Asciisvg', + ], + ['BulletedList', 'NumberedList', 'HorizontalRule'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], + [ + 'Styles', + 'Format', + 'Font', + 'FontSize', + 'Bold', + 'Italic', + 'Underline', + 'TextColor', + 'BGColor', + api_get_configuration_value('translate_html') ? 'Language' : '', + ], + api_get_setting('enabled_wiris') == 'true' + ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] + : [''], + ['Toolbarswitch', 'Source'], + ]; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TermsAndConditions.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TermsAndConditions.php new file mode 100644 index 000000000..66b509543 --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TermsAndConditions.php @@ -0,0 +1,43 @@ +getNormalToolbar(); + } else { + $config['toolbar_minToolbar'] = $this->getNormalToolbar(); + $config['toolbar_maxToolbar'] = $this->getNormalToolbar(); + } + + return $config; + } + + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false. + * + * @return array + */ + protected function getNormalToolbar() + { + return [ + ['Styles', 'Format', 'Font', 'FontSize'], + ['Bold', 'Italic', 'Underline'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight'], + ]; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestAnswerFeedback.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestAnswerFeedback.php new file mode 100644 index 000000000..b054379e9 --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestAnswerFeedback.php @@ -0,0 +1,127 @@ + 'document'], + [ + 'name' => 'clipboard', + 'groups' => ['clipboard', 'undo'], + ], + [ + 'name' => 'basicstyles', + 'groups' => ['basicstyles', 'cleanup'], + ], + [ + 'name' => 'paragraph', + 'groups' => ['list', 'indent', 'blocks', 'align'], + ], + ['name' => 'links'], + ['name' => 'insert'], + '/', + ['name' => 'styles'], + ['name' => 'colors'], + ['name' => 'mode'], + ]; + + $config['toolbarCanCollapse'] = true; + $config['toolbarStartupExpanded'] = false; + //$config['width'] = '100'; + //$config['height'] = '200'; + + if (api_get_setting('more_buttons_maximized_mode') != 'true') { + $config['toolbar'] = $this->getNormalToolbar(); + } else { + $config['toolbar_minToolbar'] = $this->getMinimizedToolbar(); + + $config['toolbar_maxToolbar'] = $this->getMaximizedToolbar(); + } + + return $config; + } + + /** + * Get the toolbar configuration when CKEditor is maximized. + * + * @return array + */ + protected function getMaximizedToolbar() + { + return [ + ['NewPage', 'Templates', '-', 'Preview', 'Print'], + ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'], + ['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'], + ['Link', 'Unlink', 'Anchor', 'Glossary'], + [ + 'Image', + 'Mapping', + 'Video', + 'Oembed', + 'Youtube', + 'VimeoEmbed', + 'Flash', + 'Audio', + 'leaflet', + 'Smiley', + 'SpecialChar', + ], + '/', + ['Table', '-', 'CreateDiv'], + ['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], + ['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'], + [api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''], + ['Styles', 'Format', 'Font', 'FontSize'], + api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''], + ['PageBreak', 'ShowBlocks', 'Source'], + ['Toolbarswitch'], + ]; + } + + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false. + * + * @return array + */ + protected function getNormalToolbar() + { + return [ + ['Link', 'Unlink', 'Bold', 'Italic', 'TextColor', 'BGColor'], + ]; + } + + /** + * Get the toolbar configuration when CKEditor is minimized. + * + * @return array + */ + protected function getMinimizedToolbar() + { + return [ + $this->getNewPageBlock(), + ['Undo', 'Redo'], + ['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table'], + ['BulletedList', 'NumberedList', 'HorizontalRule'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], + ['Asciimath', 'Asciisvg'], + ['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor', 'Source'], + api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''], + ['Toolbarswitch'], + ]; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestFreeAnswer.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestFreeAnswer.php new file mode 100644 index 000000000..c8458b0d2 --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestFreeAnswer.php @@ -0,0 +1,125 @@ +getNormalToolbar(); + } else { + $config['toolbar_minToolbar'] = $this->getMinimizedToolbar(); + $config['toolbar_maxToolbar'] = $this->getMaximizedToolbar(); + } + + $config['fullPage'] = false; + + $config['extraPlugins'] = 'wordcount'; + + $config['wordcount'] = [ + // Whether or not you want to show the Word Count + 'showWordCount' => true, + // Whether or not you want to show the Char Count + 'showCharCount' => true, + // Option to limit the characters in the Editor + 'charLimit' => 'unlimited', + // Option to limit the words in the Editor + 'wordLimit' => 'unlimited', + ]; + + //$config['height'] = '200'; + + return $config; + } + + /** + * Get the toolbar configuration when CKEditor is maximized. + * + * @return array + */ + protected function getMaximizedToolbar() + { + return [ + ['NewPage', 'Templates', '-', 'Preview', 'Print'], + ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'], + ['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'], + ['Link', 'Unlink', 'Anchor', 'Glossary'], + [ + 'Image', + 'Mapping', + 'Video', + 'Oembed', + 'Youtube', + 'VimeoEmbed', + 'Flash', + 'Audio', + 'leaflet', + 'Smiley', + 'SpecialChar', + ], + ['Asciimath', 'Asciisvg'], + '/', + ['Table', '-', 'CreateDiv'], + ['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], + ['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'], + [api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''], + ['Styles', 'Format', 'Font', 'FontSize'], + ['PageBreak', 'ShowBlocks'], + ['Toolbarswitch'], + ]; + } + + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false. + * + * @return array + */ + protected function getNormalToolbar() + { + return [ + [ + 'Maximize', + 'Bold', + 'Image', + 'Link', + 'PasteFromWord', + 'Audio', + 'Table', + 'Subscript', + 'Superscript', + 'ShowBlocks', + ], + ]; + } + + /** + * Get the toolbar configuration when CKEditor is minimized. + * + * @return array + */ + protected function getMinimizedToolbar() + { + return [ + $this->getNewPageBlock(), + ['Undo', 'Redo'], + ['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath', 'Asciisvg'], + ['BulletedList', 'NumberedList', 'HorizontalRule'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight'], + ['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'], + ['Toolbarswitch'], + ]; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestFreeAnswerStrict.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestFreeAnswerStrict.php new file mode 100644 index 000000000..71e8749d5 --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestFreeAnswerStrict.php @@ -0,0 +1,54 @@ +getNormalToolbar(); + } else { + $config['toolbar_minToolbar'] = $this->getNormalToolbar(); + $config['toolbar_maxToolbar'] = $this->getNormalToolbar(); + } + + $config['fullPage'] = false; + $config['extraPlugins'] = 'wordcount'; + $config['wordcount'] = [ + // Whether or not you want to show the Word Count + 'showWordCount' => true, + // Whether or not you want to show the Char Count + 'showCharCount' => true, + // Option to limit the characters in the Editor + 'charLimit' => 'unlimited', + // Option to limit the words in the Editor + 'wordLimit' => 'unlimited', + ]; + + $config['removePlugins'] = 'elementspath'; + //$config['height'] = '200'; + return $config; + } + + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false. + * + * @return array + */ + protected function getNormalToolbar() + { + return []; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestMatching.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestMatching.php new file mode 100644 index 000000000..6d4634215 --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestMatching.php @@ -0,0 +1,139 @@ +getNormalToolbar(); + } else { + $config['toolbar_minToolbar'] = $this->getMinimizedToolbar(); + $config['toolbar_maxToolbar'] = $this->getMaximizedToolbar(); + } + + $config['fullPage'] = false; + $config['extraPlugins'] = $this->getPluginsToString(); + $config['wordcount'] = [ + // Whether or not you want to show the Word Count + 'showWordCount' => true, + // Whether or not you want to show the Char Count + 'showCharCount' => true, + // Option to limit the characters in the Editor + 'charLimit' => 'unlimited', + // Option to limit the words in the Editor + 'wordLimit' => 'unlimited', + ]; + + return $config; + } + + /** + * Get the toolbar configuration when CKEditor is maximized. + * + * @return array + */ + protected function getMaximizedToolbar() + { + return [ + ['NewPage', 'Templates', '-', 'Preview', 'Print'], + ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', 'inserthtml'], + ['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'], + ['Link', 'Unlink', 'Anchor', 'Glossary'], + [ + 'Image', + 'Mapping', + 'Video', + 'Oembed', + 'Youtube', + 'VimeoEmbed', + 'Flash', + 'Audio', + 'leaflet', + 'Smiley', + 'SpecialChar', + ], + ['Asciimath', 'Asciisvg'], + '/', + ['Table', '-', 'CreateDiv'], + ['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], + ['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'], + [api_get_setting('allow_spellcheck') === 'true' ? 'Scayt' : ''], + ['Styles', 'Format', 'Font', 'FontSize'], + ['PageBreak', 'ShowBlocks'], + api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''], + ['Toolbarswitch'], + ]; + } + + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false. + * + * @return array + */ + protected function getNormalToolbar() + { + return [ + [ + 'Maximize', + 'Bold', + 'Image', + 'Video', + 'Flash', + 'Oembed', + 'Youtube', + 'VimeoEmbed', + 'Audio', + 'Link', + 'PasteFromWord', + 'inserthtml', + 'Table', + 'Subscript', + 'Superscript', + 'ShowBlocks', + ], + ]; + } + + /** + * Get the toolbar configuration when CKEditor is minimized. + * + * @return array + */ + protected function getMinimizedToolbar() + { + return [ + ['PasteFromWord', 'inserthtml'], + ['Undo', 'Redo'], + [ + 'Link', + 'Image', + 'Video', + 'Flash', + 'Oembed', + 'Youtube', + 'VimeoEmbed', + 'Audio', + 'Table', + 'Asciimath', + ], + ['BulletedList', 'NumberedList', 'HorizontalRule'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight'], + ['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'], + api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''], + ['Source', 'Toolbarswitch'], + ]; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestProposedAnswer.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestProposedAnswer.php new file mode 100644 index 000000000..20c38756a --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestProposedAnswer.php @@ -0,0 +1,79 @@ +getNormalToolbar(); + } else { + $config['toolbar_minToolbar'] = $this->getMinimizedToolbar(); + $config['toolbar_maxToolbar'] = $this->getMaximizedToolbar(); + } + + return $config; + } + + /** + * Get the toolbar configuration when CKEditor is maximized. + * + * @return array + */ + protected function getMaximizedToolbar() + { + return $this->getNormalToolbar(); + } + + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false. + * + * @return array + */ + protected function getNormalToolbar() + { + return [ + ['Bold', 'Subscript', 'Superscript'], + [ + 'Link', + 'Image', + 'Video', + //'Flash', + 'Oembed', + //'Youtube', + 'VimeoEmbed', + 'Audio', + 'Table', + 'PasteFromWord', + 'inserthtml', + api_get_setting('enabled_mathjax') === 'true' ? 'Mathjax' : '', + ], + ['Asciimath', 'Asciisvg'], + api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''], + ['Maximize', 'Source'], + ]; + } + + /** + * Get the toolbar configuration when CKEditor is minimized. + * + * @return array + */ + protected function getMinimizedToolbar() + { + return $this->getNormalToolbar(); + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestQuestionDescription.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestQuestionDescription.php new file mode 100644 index 000000000..faa230725 --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestQuestionDescription.php @@ -0,0 +1,187 @@ + 'document', 'groups' => ['document', 'doctools']], + ['name' => 'clipboard', 'groups' => ['clipboard', 'undo']], + ['name' => 'editing', 'groups' => ['clipboard', 'undo']], + '/', + ['name' => 'basicstyles', 'groups' => ['basicstyles', 'cleanup']], + ['name' => 'paragraph', 'groups' => ['list', 'indent', 'blocks', 'align']], + ['name' => 'links'], + ['name' => 'insert'], + '/', + ['name' => 'styles'], + ['name' => 'colors'], + ['name' => 'tools'], + ['name' => 'others'], + ['name' => 'mode'], + ]; + + $config['extraPlugins'] = $this->getPluginsToString(); + if (api_get_setting('more_buttons_maximized_mode') !== 'true') { + $config['toolbar'] = $this->getNormalToolbar(); + } else { + $config['toolbar_minToolbar'] = $this->getMinimizedToolbar(); + $config['toolbar_maxToolbar'] = $this->getMaximizedToolbar(); + } + + return $config; + } + + /** + * @return array + */ + public function getConditionalPlugins() + { + $plugins = []; + if (api_get_setting('show_glossary_in_documents') === 'ismanual') { + $plugins[] = 'glossary'; + } + + return $plugins; + } + + /** + * Get the toolbar configuration when CKEditor is maximized. + * + * @return array + */ + protected function getMaximizedToolbar() + { + return [ + ['NewPage', 'Templates', '-', 'Preview', 'Print'], + ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'], + ['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'], + ['Link', 'Unlink', 'Anchor', 'Glossary'], + [ + 'Image', + 'Mapping', + 'Video', + 'Flash', + 'Youtube', + 'VimeoEmbed', + 'Oembed', + 'Audio', + 'leaflet', + 'Smiley', + 'SpecialChar', + 'Asciimath', + 'Asciisvg', + ], + '/', + ['Table', '-', 'CreateDiv'], + ['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], + [ + 'Bold', + 'Italic', + 'Underline', + 'Strike', + '-', + 'Subscript', + 'Superscript', + '-', + 'TextColor', + 'BGColor', + api_get_configuration_value('translate_html') ? 'Language' : '', + ], + [api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''], + ['Styles', 'Format', 'Font', 'FontSize'], + ['PageBreak', 'ShowBlocks'], + api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''], + ['Toolbarswitch', 'Source'], + ]; + } + + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false. + * + * @return array + */ + protected function getNormalToolbar() + { + return [ + ['Maximize', '-', 'PasteFromWord', '-', 'Undo', 'Redo'], + ['Link', 'Unlink'], + ['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'VimeoEmbed', 'Audio'], + ['Table', 'SpecialChar'], + [ + 'NumberedList', + 'BulletedList', + '-', + 'Outdent', + 'Indent', + '-', + 'TextColor', + 'BGColor', + '-', + api_get_configuration_value('translate_html') ? 'Language' : '', + ], + '/', + ['Styles', 'Format', 'Font', 'FontSize'], + ['Bold', 'Italic', 'Underline'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight'], + api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''], + ['Source'], + ]; + } + + /** + * Get the toolbar configuration when CKEditor is minimized. + * + * @return array + */ + protected function getMinimizedToolbar() + { + return [ + $this->getNewPageBlock(), + ['Undo', 'Redo'], + [ + 'Link', + 'Unlink', + 'Image', + 'Video', + 'Flash', + 'Oembed', + 'Youtube', + 'VimeoEmbed', + 'Audio', + 'Table', + 'Asciimath', + 'Asciisvg', + ], + ['BulletedList', 'NumberedList', 'HorizontalRule'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], + [ + 'Styles', + 'Format', + 'Font', + 'FontSize', + 'Bold', + 'Italic', + 'Underline', + 'TextColor', + 'BGColor', + api_get_configuration_value('translate_html') ? 'Language' : '', + ], + api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''], + ['Toolbarswitch', 'Source'], + ]; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TitleAsHtml.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TitleAsHtml.php new file mode 100644 index 000000000..230a72f00 --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TitleAsHtml.php @@ -0,0 +1,44 @@ + 'clipboard', + 'groups' => ['clipboard', 'undo'], + 'items' => ['Cut', 'Copy', 'Paste', '-', 'Undo', 'Redo'], + ], + [ + 'name' => 'basicstyles', + 'groups' => ['basicstyles', 'cleanup'], + 'items' => ['Bold', 'Italic', 'Underline', 'Strike', 'TextColor', 'BGColor'], + ], +// [ +// 'name' => 'paragraph', +// 'groups' => ['list', 'indent', 'blocks', 'align', 'bidi'], +// 'items' => ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent'], +// ], + [ + 'name' => 'links', + 'items' => ['Link', 'Unlink', 'Source'], + ], + ]; + + $config['height'] = '100'; + + return $config; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ToolbarStartExpanded.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ToolbarStartExpanded.php new file mode 100644 index 000000000..5250486fc --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ToolbarStartExpanded.php @@ -0,0 +1,13 @@ + 'basicstyles', 'groups' => ['basicstyles', 'cleanup']], + ['name' => 'paragraph', 'groups' => ['list', 'indent', 'blocks', 'align']], + ['name' => 'links'], + ['name' => 'insert'], + '/', + ['name' => 'styles'], + ['name' => 'colors'], + ['name' => 'tools'], + ['name' => 'others'], + ['name' => 'mode'], + ]; + + $config['fullPage'] = true; + //$config['height'] = '200'; + + return $config; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Wiki.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Wiki.php new file mode 100644 index 000000000..1d7edfc62 --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Wiki.php @@ -0,0 +1,107 @@ +getNormalToolbar(); + } else { + $config['toolbar_minToolbar'] = $this->getMinimizedToolbar(); + } + + $config['forcePasteAsPlainText'] = false; + + if (api_get_setting('force_wiki_paste_as_plain_text') == 'true') { + $config['forcePasteAsPlainText'] = true; + } + + return $config; + } + + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false. + * + * @return array + */ + protected function getNormalToolbar() + { + return [ + [ + 'Maximize', + 'Save', + 'NewPage', + 'Templates', + 'PageBreak', + 'Preview', + '-', + 'PasteText', + '-', + 'Undo', + 'Redo', + '-', + 'SelectAll', + '-', + 'Find', + ], + ['Wikilink', 'Link', 'Unlink', 'Anchor'], + ['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'VimeoEmbed', 'Audio', 'Asciimath'], + ['Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'leaflet'], + ['Format', 'Font', 'FontSize'], + ['Bold', 'Italic', 'Underline'], + [ + 'Subscript', + 'Superscript', + '-', + 'JustifyLeft', + 'JustifyCenter', + 'JustifyRight', + 'JustifyFull', + '-', + 'NumberedList', + 'BulletedList', + '-', + 'Outdent', + 'Indent', + '-', + 'TextColor', + 'BGColor', + api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : '', + ], + api_get_setting('enabled_wiris') == 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''], + ['Source'], + ]; + } + + /** + * Get the toolbar configuration when CKEditor is minimized. + * + * @return array + */ + protected function getMinimizedToolbar() + { + return [ + $this->getNewPageBlock(), + ['Undo', 'Redo'], + ['Wikilink', 'Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath', 'Asciisvg'], + ['BulletedList', 'NumberedList', 'HorizontalRule'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], + ['Styles', 'Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor', 'Source'], + api_get_setting('enabled_wiris') == 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''], + ['Toolbarswitch'], + ]; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/WikiStudent.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/WikiStudent.php new file mode 100644 index 000000000..da70eac57 --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/WikiStudent.php @@ -0,0 +1,144 @@ +getNormalToolbar(); + } else { + $config['toolbar_minToolbar'] = $this->getMinimizedToolbar(); + $config['toolbar_maxToolbar'] = $this->getMaximizedToolbar(); + } + + $config['forcePasteAsPlainText'] = false; + + if (api_get_setting('force_wiki_paste_as_plain_text') == 'true') { + $config['forcePasteAsPlainText'] = true; + } + + return $config; + } + + /** + * Get the toolbar configuration when CKEditor is maximized. + * + * @return array + */ + protected function getMaximizedToolbar() + { + return [ + ['Save', 'NewPage', 'Templates', '-', 'Preview', 'Print'], + ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'], + ['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'], + ['Wikilink', 'Link', 'Unlink', 'Anchor', 'Glossary'], + [ + 'Image', + 'Mapping', + 'Video', + 'Oembed', + 'Youtube', + 'Flash', + 'Audio', + 'leaflet', + 'Smiley', + 'SpecialChar', + 'Asciimath', + 'Asciisvg', + ], + '/', + ['Table', '-', 'CreateDiv'], + ['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], + ['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'], + [api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''], + ['Styles', 'Format', 'Font', 'FontSize'], + ['PageBreak', 'ShowBlocks'], + api_get_setting('enabled_wiris') == 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''], + ['Toolbarswitch'], + ]; + } + + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false. + * + * @return array + */ + protected function getNormalToolbar() + { + return [ + [ + 'Maximize', + 'Save', + 'NewPage', + 'PageBreak', + 'Preview', + '-', + 'PasteText', + '-', + 'Undo', + 'Redo', + '-', + 'SelectAll', + '-', + 'Find', + ], + ['Wikilink', 'Link', 'Unlink', 'Anchor'], + ['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'Audio', 'Asciimath'], + ['Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'leaflet'], + ['Styles', 'Format', 'Font', 'FontSize'], + ['Bold', 'Italic', 'Underline'], + [ + 'Subscript', + 'Superscript', + '-', + 'JustifyLeft', + 'JustifyCenter', + 'JustifyRight', + '-', + 'NumberedList', + 'BulletedList', + '-', + 'Outdent', + 'Indent', + '-', + 'TextColor', + 'BGColor', + ], + api_get_setting('enabled_wiris') == 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''], + ['ShowBlocks'], + ]; + } + + /** + * Get the toolbar configuration when CKEditor is minimized. + * + * @return array + */ + protected function getMinimizedToolbar() + { + return [ + $this->getNewPageBlock(), + ['Undo', 'Redo'], + ['Wikilink', 'Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath', 'Asciisvg'], + ['BulletedList', 'NumberedList', 'HorizontalRule'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight'], + ['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'], + api_get_setting('enabled_wiris') == 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''], + ['Toolbarswitch'], + ]; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/WikiTask.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/WikiTask.php new file mode 100644 index 000000000..4b3ace5c1 --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/WikiTask.php @@ -0,0 +1,105 @@ +getNormalToolbar(); + } else { + $config['toolbar_minToolbar'] = $this->getMinimizedToolbar(); + $config['toolbar_maxToolbar'] = $this->getMaximizedToolbar(); + } + + return $config; + } + + /** + * Get the toolbar configuration when CKEditor is maximized. + * + * @return array + */ + protected function getMaximizedToolbar() + { + return [ + ['NewPage', 'Templates', '-', 'Preview', 'Print'], + ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'], + ['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'], + ['Wikilink', 'Link', 'Unlink', 'Anchor', 'Glossary'], + [ + 'Image', + 'Mapping', + 'Video', + 'Oembed', + 'Youtube', + 'VimeoEmbed', + 'Flash', + 'Audio', + 'leaflet', + 'Smiley', + 'SpecialChar', + ], + '/', + ['Table', '-', 'CreateDiv'], + ['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], + ['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'], + [api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''], + ['Styles', 'Format', 'Font', 'FontSize'], + ['PageBreak', 'ShowBlocks', 'Source'], + api_get_setting('enabled_wiris') == 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''], + ['Toolbarswitch'], + ]; + } + + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false. + * + * @return array + */ + protected function getNormalToolbar() + { + return [ + ['Maximize', '-', 'PasteFromWord', '-', 'Undo', 'Redo'], + ['Link', 'Unlink'], + ['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'VimeoEmbed', 'Audio'], + ['Table'], + ['Bold', 'Italic', 'Underline'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', '-', 'NumberedList', 'BulletedList', '-', 'TextColor', 'BGColor'], + api_get_setting('enabled_wiris') == 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''], + ['Source'], + ]; + } + + /** + * Get the toolbar configuration when CKEditor is minimized. + * + * @return array + */ + protected function getMinimizedToolbar() + { + return [ + $this->getNewPageBlock(), + ['Undo', 'Redo'], + ['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table'], + ['BulletedList', 'NumberedList', 'HorizontalRule'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight'], + ['Styles', 'Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'], + api_get_setting('enabled_wiris') == 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''], + ['Toolbarswitch'], + ]; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Work.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Work.php new file mode 100644 index 000000000..885e55ae2 --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Work.php @@ -0,0 +1,110 @@ +getNormalToolbar(); + } else { + $config['toolbar_minToolbar'] = $this->getMinimizedToolbar(); + + $config['toolbar_maxToolbar'] = $this->getMaximizedToolbar(); + } + + return $config; + } + + /** + * Get the toolbar configuration when CKEditor is maximized. + * + * @return array + */ + protected function getMaximizedToolbar() + { + return [ + ['Save', 'NewPage', 'Templates', '-', 'Preview', 'Print'], + ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'], + ['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'], + ['Link', 'Unlink', 'Anchor', 'Glossary'], + [ + 'Image', + 'Mapping', + 'Video', + 'Oembed', + 'Youtube', + 'VimeoEmbed', + 'Flash', + 'Audio', + 'leaflet', + 'Smiley', + 'SpecialChar', + 'Asciimath', + ], + '/', + ['Table', '-', 'CreateDiv'], + ['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], + ['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'], + [api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''], + ['Styles', 'Format', 'Font', 'FontSize'], + ['PageBreak', 'ShowBlocks', 'Source'], + api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''], + ['Toolbarswitch'], + ]; + } + + /** + * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false. + * + * @return array + */ + protected function getNormalToolbar() + { + return [ + ['Maxmize', '-', 'PasteFromWord', '-', 'Undo', 'Redo'], + ['Link', 'Unlink', 'Anchor'], + ['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'VimeoEmbed', 'Audio'], + ['Table', 'Smiley'], + '/', + ['Font', 'FontSize'], + ['Bold', 'Italic', 'Underline'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight', '-', 'NumberedList', 'BulletedList', '-', 'TextColor', 'BGColor'], + api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''], + ['Source'], + ]; + } + + /** + * Get the toolbar configuration when CKEditor is minimized. + * + * @return array + */ + protected function getMinimizedToolbar() + { + return [ + $this->getNewPageBlock(), + ['Undo', 'Redo'], + ['Link', 'Image', 'Video', 'Flash', 'Youtube', 'VimeoEmbed', 'Audio', 'Table', 'Asciimath'], + ['JustifyLeft', 'JustifyCenter', 'JustifyRight'], + ['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'TextColor', 'BGColor'], + api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''], + ['Toolbarswitch'], + ]; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/Connector.php b/src/Chamilo/CoreBundle/Component/Editor/Connector.php new file mode 100644 index 000000000..d6a0a5ef5 --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/Connector.php @@ -0,0 +1,402 @@ +paths = [ + 'root_sys' => api_get_path(SYS_PATH), + 'sys_root' => api_get_path(SYS_PATH), // just an alias + 'sys_course_path' => api_get_path(SYS_COURSE_PATH), + // 'sys_config_path' => $app['path.config'], + 'path.temp' => api_get_path(SYS_ARCHIVE_PATH), + //'sys_log_path' => $app['path.logs'] + ]; + /*$this->entityManager = $entityManager; + $this->paths = $paths; + $this->urlGenerator = $urlGenerator; + $this->translator = $translator; + $this->security = $security;*/ + $this->user = api_get_user_info(); + $this->course = api_get_course_info(); + $this->driverList = $this->getDefaultDriverList(); + } + + /** + * @return array + */ + public function getDriverList() + { + return $this->driverList; + } + + /** + * Available driver list. + * + * @param array + */ + public function setDriverList($list) + { + $this->driverList = $list; + } + + /** + * @param Driver $driver + */ + public function addDriver($driver) + { + if (!empty($driver)) { + $this->drivers[$driver->getName()] = $driver; + } + } + + /** + * @return array + */ + public function getDrivers() + { + return $this->drivers; + } + + /** + * @param string $driverName + * + * @return Driver $driver + */ + public function getDriver($driverName) + { + if (isset($this->drivers[$driverName])) { + return $this->drivers[$driverName]; + } + + return null; + } + + /** + * @param bool $processDefaultValues + * + * @return array + */ + public function getRoots($processDefaultValues = true) + { + $roots = []; + $drivers = $this->getDrivers(); + /** @var Driver $driver */ + foreach ($drivers as $driver) { + if ($processDefaultValues) { + $plugin = [ + 'chamilo' => [ + 'driverName' => $driver->getName(), + 'connector' => $this, + ], + ]; + $configuration = $driver->getConfiguration(); + $driver->setup(); + $configuration['plugin'] = $plugin; + $root = $this->updateWithDefaultValues($configuration); + } + $roots[] = $root; + } + + return $roots; + } + + /** + * Merges the default driver settings. + * + * @param array $driver + * + * @return array + */ + public function updateWithDefaultValues($driver) + { + if (empty($driver) || !isset($driver['driver'])) { + return []; + } + + $defaultDriver = $this->getDefaultDriverSettings(); + + if (isset($driver['attributes'])) { + $attributes = array_merge($defaultDriver['attributes'], $driver['attributes']); + } else { + $attributes = $defaultDriver['attributes']; + } + + $driverUpdated = array_merge($defaultDriver, $driver); + $driverUpdated['driver'] = 'Chamilo\CoreBundle\Component\Editor\Driver\\'.$driver['driver']; + $driverUpdated['attributes'] = $attributes; + + return $driverUpdated; + } + + /** + * Get default driver settings. + * + * @return array + */ + public function getDefaultDriverSettings() + { + // for more options: https://github.com/Studio-42/elFinder/wiki/Connector-configuration-options + return [ + 'uploadOverwrite' => false, // Replace files on upload or give them new name if the same file was uploaded + //'acceptedName' => + 'uploadAllow' => [ + 'image', + 'audio', + 'video', + 'text/html', + 'text/csv', + 'application/pdf', + 'application/postscript', + 'application/vnd.ms-word', + 'application/vnd.ms-excel', + 'application/vnd.ms-powerpoint', + 'application/pdf', + 'application/xml', + 'application/vnd.oasis.opendocument.text', + 'application/x-shockwave-flash', + 'application/vnd.adobe.flash.movie', + ], // allow files + //'uploadDeny' => array('text/x-php'), + 'uploadOrder' => ['allow'], // only executes allow + 'disabled' => [ + 'duplicate', + 'rename', + 'mkdir', + 'mkfile', + 'copy', + 'cut', + 'paste', + 'edit', + 'extract', + 'archive', + 'help', + 'resize', + ], + 'attributes' => [ + // Hiding dangerous files + [ + 'pattern' => '/\.(php|py|pl|sh|xml)$/i', + 'read' => false, + 'write' => false, + 'hidden' => true, + 'locked' => false, + ], + // Hiding _DELETED_ files + [ + 'pattern' => '/_DELETED_/', + 'read' => false, + 'write' => false, + 'hidden' => true, + 'locked' => false, + ], + // Hiding thumbnails + [ + 'pattern' => '/.tmb/', + 'read' => false, + 'write' => false, + 'hidden' => true, + 'locked' => false, + ], + [ + 'pattern' => '/.thumbs/', + 'read' => false, + 'write' => false, + 'hidden' => true, + 'locked' => false, + ], + [ + 'pattern' => '/.quarantine/', + 'read' => false, + 'write' => false, + 'hidden' => true, + 'locked' => false, + ], + ], + ]; + } + + /** + * @return array + */ + public function getOperations() + { + //https://github.com/Studio-42/elFinder/wiki/Connector-configuration-options-2.1 + $opts = [ + //'debug' => true, + 'bind' => [ + 'upload rm mkdir' => [$this, 'manageCommands'], + ], + 'sessionCloseEarlier' => false, + ]; + + $this->setDrivers(); + $opts['roots'] = $this->getRoots(); + + return $opts; + } + + /** + * Set drivers from list. + */ + public function setDrivers() + { + foreach ($this->getDriverList() as $driverName) { + $this->setDriver($driverName); + } + } + + /** + * Sets a driver. + * + * @param string $driverName + */ + public function setDriver($driverName) + { + $driverClass = $this->getDriverClass($driverName); + + /** @var Driver $driver */ + $driver = new $driverClass(); + $driver->setName($driverName); + $driver->setConnector($this); + $this->addDriver($driver); + } + + /** + * Simple function to demonstrate how to control file access using "accessControl" callback. + * This method will disable accessing files/folders starting from '.' (dot). + * + * @param string $attr attribute name (read|write|locked|hidden) + * @param string $path file path relative to volume root directory started with directory separator + * @param string $data + * @param string $volume + * + * @return bool|null + */ + public function access($attr, $path, $data, $volume) + { + return strpos(basename($path), '.') === 0 // if file/folder begins with '.' (dot) + ? !($attr == 'read' || $attr == 'write') // set read+write to false, other (locked+hidden) set to true + : null; // else elFinder decide it itself + } + + /** + * @param string $cmd + * @param array $result + * @param array $args + * @param Finder $elFinder + */ + public function manageCommands($cmd, $result, $args, $elFinder) + { + $cmd = ucfirst($cmd); + $cmd = 'after'.$cmd; + /* + if (isset($args['target'])) { + $driverName = $elFinder->getVolumeDriverNameByTarget($args['target']); + } + + if (isset($args['targets'])) { + foreach ($args['targets'] as $target) { + $driverName = $elFinder->getVolumeDriverNameByTarget($target); + break; + } + } + */ + if (empty($driverName)) { + return false; + } + + if (!empty($result['error'])) { + } + + if (!empty($result['warning'])) { + } + + if (!empty($result['removed'])) { + foreach ($result['removed'] as $file) { + /** @var Driver $driver */ +// $driver = $this->getDriver($driverName); +// $driver->$cmd($file, $args, $elFinder); + // removed file contain additional field "realpath" + //$log .= "\tREMOVED: ".$file['realpath']."\n"; + } + } + + if (!empty($result['added'])) { + foreach ($result['added'] as $file) { +// $driver = $this->getDriver($driverName); +// $driver->$cmd($file, $args, $elFinder); + } + } + + if (!empty($result['changed'])) { + foreach ($result['changed'] as $file) { + //$log .= "\tCHANGED: ".$elfinder->realpath($file['hash'])."\n"; + } + } + } + + /** + * Available driver list. + * + * @return array + */ + private function getDefaultDriverList() + { + return [ + 'CourseDriver', + 'CourseUserDriver', + 'DropBoxDriver', + 'HomeDriver', + 'PersonalDriver', + ]; + } + + /** + * @param string $driver + * + * @return string + */ + private function getDriverClass($driver) + { + return 'Chamilo\CoreBundle\Component\Editor\Driver\\'.$driver; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/Driver/CourseDriver.php b/src/Chamilo/CoreBundle/Component/Editor/Driver/CourseDriver.php new file mode 100644 index 000000000..56c4d7c1d --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/Driver/CourseDriver.php @@ -0,0 +1,482 @@ +connector->course; + + if (!empty($courseInfo)) { + $coursePath = api_get_path(SYS_COURSE_PATH); + $courseDir = $courseInfo['directory'].'/document'; + $baseDir = $coursePath.$courseDir; + $this->coursePath = $baseDir; + + // Creates shared folder + if (!file_exists($baseDir.'/shared_folder')) { + $title = get_lang('UserFolders'); + $folderName = '/shared_folder'; + //$groupId = 0; + $visibility = 0; + create_unexisting_directory( + $courseInfo, + $userId, + $sessionId, + 0, + null, + $baseDir, + $folderName, + $title, + $visibility + ); + } + + // Creates user-course folder + if (!file_exists($baseDir.'/shared_folder/sf_user_'.$userId)) { + $title = $userInfo['complete_name']; + $folderName = '/shared_folder/sf_user_'.$userId; + $visibility = 1; + create_unexisting_directory( + $courseInfo, + $userId, + $sessionId, + 0, + null, + $baseDir, + $folderName, + $title, + $visibility + ); + } + } + } + + /** + * {@inheritdoc} + */ + public function getConfiguration() + { + if ($this->allow()) { + //$translator = $this->connector->translator; + //$code = $this->connector->course->getCode(); + $courseCode = $this->connector->course['code']; + $alias = $courseCode.' '.get_lang('Documents'); + $userId = api_get_user_id(); + $config = [ + 'driver' => 'CourseDriver', + 'path' => $this->getCourseDocumentSysPath(), + 'URL' => $this->getCourseDocumentRelativeWebPath(), + 'accessControl' => [$this, 'access'], + 'alias' => $alias, + 'attributes' => [ + // Hide shared_folder + [ + 'pattern' => '/shared_folder/', + 'read' => false, + 'write' => false, + 'hidden' => true, + 'locked' => false, + ], + [ + 'pattern' => '/^\/index.html$/', + 'read' => false, + 'write' => false, + 'hidden' => true, + 'locked' => false, + ], + ], + ]; + + // admin/teachers can create dirs from ckeditor + if ($this->allowToEdit()) { + $config['attributes'][] = [ + 'pattern' => '/^\/learning_path$/', // block delete learning_path + 'read' => true, + 'write' => false, + 'hidden' => false, + 'locked' => true, + ]; + $config['attributes'][] = [ + 'pattern' => '/learning_path\/(.*)/', // allow edit/delete inside learning_path + 'read' => true, + 'write' => true, + 'hidden' => false, + 'locked' => false, + ]; + + $defaultDisabled = $this->connector->getDefaultDriverSettings()['disabled']; + $defaultDisabled = array_flip($defaultDisabled); + unset($defaultDisabled['mkdir']); + $defaultDisabled = array_flip($defaultDisabled); + $config['disabled'] = $defaultDisabled; + } else { + $protectedFolders = \DocumentManager::getProtectedFolderFromStudent(); + foreach ($protectedFolders as $folder) { + $config['attributes'][] = [ + 'pattern' => $folder.'/', + 'read' => false, + 'write' => false, + 'hidden' => true, + 'locked' => false, + ]; + } + } + + $foldersToHide = \DocumentManager::get_all_document_folders( + $this->connector->course, + null, + false, + true + ); + + // Teachers can see all files and folders see #1425 + if ($this->allowToEdit()) { + $foldersToHide = []; + } + + if (!empty($foldersToHide)) { + foreach ($foldersToHide as $folder) { + $config['attributes'][] = [ + 'pattern' => '!'.$folder.'!', + 'read' => false, + 'write' => false, + 'hidden' => true, + 'locked' => false, + ]; + } + } + + // Hide all groups folders + $config['attributes'][] = [ + 'pattern' => '!_groupdocs_!', + 'read' => false, + 'write' => false, + 'hidden' => true, + 'locked' => false, + ]; + + // Allow only the groups I have access + $allGroups = \GroupManager::getAllGroupPerUserSubscription($userId); + if (!empty($allGroups)) { + foreach ($allGroups as $groupInfo) { + $groupId = $groupInfo['iid']; + if (\GroupManager::user_has_access( + $userId, + $groupId, + \GroupManager::GROUP_TOOL_DOCUMENTS + )) { + $config['attributes'][] = [ + 'pattern' => '!'.$groupInfo['secret_directory'].'!', + 'read' => true, + 'write' => false, + 'hidden' => false, + 'locked' => false, + ]; + } + } + } + + return $config; + } + + return []; + } + + /** + * This is the absolute document course path like + * /var/www/portal/data/courses/XXX/document/. + * + * @return string + */ + public function getCourseDocumentSysPath() + { + $url = ''; + if ($this->allow()) { + $directory = $this->getCourseDirectory(); + $coursePath = $this->connector->paths['sys_course_path']; + $url = $coursePath.$directory.'/document/'; + } + + return $url; + } + + /** + * @return string + */ + public function getCourseDocumentRelativeWebPath() + { + $url = null; + if ($this->allow()) { + $directory = $this->getCourseDirectory(); + $url = api_get_path(REL_COURSE_PATH).$directory.'/document/'; + } + + return $url; + } + + /** + * @return string + */ + public function getCourseDocumentWebPath() + { + $url = null; + if ($this->allow()) { + $directory = $this->getCourseDirectory(); + $url = api_get_path(WEB_COURSE_PATH).$directory.'/document/'; + } + + return $url; + } + + /** + * @return string + */ + public function getCourseDirectory() + { + return $this->connector->course['directory']; + } + + /** + * {@inheritdoc} + */ + public function upload($fp, $dst, $name, $tmpname, $hashes = []) + { + // Needed to load course information in elfinder + $this->setConnectorFromPlugin(); + + if ($this->allowToEdit()) { + // upload file by elfinder. + $size = filesize($tmpname); + + // check the max filesize. + $maxFileSize = getIniMaxFileSizeInBytes(); + if ($maxFileSize > 0 && $size > $maxFileSize) { + $errorUploadMessage = get_lang('FileSizeIsTooBig').' '.get_lang('MaxFileSize').' : '.getIniMaxFileSizeInBytes(true); + $this->addError($errorUploadMessage); + + return false; + } + + $maxSpace = \DocumentManager::get_course_quota($this->connector->course['code']); + // Check if there is enough space to save the file. + if (!\DocumentManager::enough_space($size, $maxSpace)) { + return false; + } + + $result = parent::upload($fp, $dst, $name, $tmpname); + $name = $result['name']; + $filtered = \URLify::filter($result['name'], 80, '', true); + + if (strcmp($name, $filtered) != 0) { + $result = $this->customRename($result['hash'], $filtered); + } + + $realPath = $this->realpath($result['hash']); + if (!empty($realPath)) { + // Getting file info + //$info = $elFinder->exec('file', array('target' => $file['hash'])); + /** @var elFinderVolumeLocalFileSystem $volume */ + //$volume = $info['volume']; + //$root = $volume->root(); + //var/www/chamilogits/data/courses/NEWONE/document + $realPathRoot = $this->getCourseDocumentSysPath(); + + // Removing course path + $realPath = str_replace($realPathRoot, '/', $realPath); + add_document( + $this->connector->course, + $realPath, + 'file', + (int) $result['size'], + $result['name'] + ); + } + + return $result; + } + + return false; + } + + /** + * {@inheritdoc} + */ + public function rm($hash) + { + // elfinder does not delete the file + //parent::rm($hash); + $this->setConnectorFromPlugin(); + + if ($this->allowToEdit()) { + $path = $this->decode($hash); + $stat = $this->stat($path); + $stat['realpath'] = $path; + $this->removed[] = $stat; + + $realFilePath = $path; + $coursePath = $this->getCourseDocumentSysPath(); + $filePath = str_replace($coursePath, '/', $realFilePath); + + \DocumentManager::delete_document( + $this->connector->course, + $filePath, + $coursePath + ); + + return true; + } + + return false; + } + + /** + * @return bool + */ + public function allow() + { + //if ($this->connector->security->isGranted('ROLE_ADMIN')) { + if (api_is_anonymous()) { + return false; + } + + $isAllowedToEdit = api_is_allowed_to_edit(); + + $block = api_get_configuration_value('block_editor_file_manager_for_students'); + if ($block && !$isAllowedToEdit) { + return false; + } + + if (isset($this->connector->course) && !empty($this->connector->course)) { + $isDocumentsToolVisible = CourseHome::getToolVisibility( + TOOL_DOCUMENT, + api_get_course_int_id(), + api_get_session_id() + ); + + if (!$isDocumentsToolVisible && !$isAllowedToEdit) { + return false; + } + + return true; + } + + return false; + } + + /** + * Allow to upload/delete folder or files. + * + * @return bool + */ + public function allowToEdit() + { + $allow = $this->allow(); + + return $allow && api_is_allowed_to_edit(null, true); + } + + /** + * {@inheritdoc} + */ + public function mkdir($path, $name) + { + // Needed to load course information in elfinder + $this->setConnectorFromPlugin(); + + if ($this->allowToEdit() === false) { + return false; + } + + $name = api_replace_dangerous_char($name); + $result = parent::mkdir($path, $name); + + if ($result && isset($result['hash'])) { + $_course = $this->connector->course; + $realPathRoot = $this->getCourseDocumentSysPath(); + $realPath = $this->realpath($result['hash']); + + // Removing course path + $newPath = str_replace($realPathRoot, '/', $realPath); + $documentId = add_document( + $_course, + $newPath, + 'folder', + 0, + $name, + null, + 0, + true, + api_get_group_id(), + api_get_session_id(), + api_get_user_id() + ); + + if (empty($documentId)) { + $this->rm($result['hash']); + + return false; + } + + return $result; + } + + return false; + } + + /** + * @param string $attr + * @param string $path + * @param $data + * @param CourseDriver $volume + */ + /*public function access($attr, $path, $data, $volume) + { + error_log($path); + return true; + if ($path == $this->coursePath) { + + return true; + } + + $allowToEdit = $this->allowToEdit(); + if ($allowToEdit) { + return true; + } + + $path = str_replace($this->coursePath, '', $path); + $documentId = \DocumentManager::get_document_id($this->connector->course, $path); + + if ($documentId) { + + $result = \DocumentManager::is_visible_by_id( + $documentId, + $this->connector->course, + api_get_session_id(), + api_get_user_id() + ); + return false; + } + + return false; + }*/ +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/Driver/CourseUserDriver.php b/src/Chamilo/CoreBundle/Component/Editor/Driver/CourseUserDriver.php new file mode 100644 index 000000000..37e5e1ab5 --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/Driver/CourseUserDriver.php @@ -0,0 +1,37 @@ +connector->course)) { + $userId = api_get_user_id(); + $path = 'shared_folder/sf_user_'.$userId; + $alias = $this->connector->course['code'].' '.get_lang('CourseUserDocument'); + + if (!empty($userId)) { + return [ + 'driver' => 'CourseUserDriver', + 'alias' => $alias, + 'path' => $this->getCourseDocumentSysPath().$path, + //'alias' => $courseInfo['code'].' personal documents', + 'URL' => $this->getCourseDocumentRelativeWebPath().$path, + 'accessControl' => 'access', + ]; + } + } + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/Driver/Driver.php b/src/Chamilo/CoreBundle/Component/Editor/Driver/Driver.php new file mode 100644 index 000000000..060d7996e --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/Driver/Driver.php @@ -0,0 +1,110 @@ +name; + } + + /** + * Gets driver name. + * + * @param string $name + */ + public function setName($name) + { + $this->name = $name; + } + + /** + * Set connector. + */ + public function setConnector(Connector $connector) + { + $this->connector = $connector; + } + + /** + * @return array + */ + public function getAppPluginOptions() + { + return $this->getOptionsPlugin('chamilo'); + } + + /** + * @return Connector + */ + public function setConnectorFromPlugin() + { + $options = $this->getAppPluginOptions(); + $this->setConnector($options['connector']); + } + + /** + * This is a copy of rename function only to be used when uploading a file + * {@inheritdoc} + */ + public function customRename($hash, $name) + { + if (!$this->nameAccepted($name)) { + return $this->setError(\elFinder::ERROR_INVALID_NAME, $name); + } + + if (!($file = $this->file($hash))) { + return $this->setError(\elFinder::ERROR_FILE_NOT_FOUND); + } + + if ($name == $file['name']) { + return $file; + } + + if (!empty($file['locked'])) { + return $this->setError(\elFinder::ERROR_LOCKED, $file['name']); + } + + $path = $this->decode($hash); + $dir = $this->dirnameCE($path); + $stat = $this->stat($this->joinPathCE($dir, $name)); + + if ($stat) { + return $this->setError(\elFinder::ERROR_EXISTS, $name); + } + + if (!$this->allowCreate($dir, $name, ($file['mime'] === 'directory'))) { + return $this->setError(\elFinder::ERROR_PERM_DENIED); + } + + $this->rmTmb($file); // remove old name tmbs, we cannot do this after dir move + + if ($path = $this->convEncOut($this->_move($this->convEncIn($path), $this->convEncIn($dir), $this->convEncIn($name)))) { + $this->clearcache(); + + return $this->stat($path); + } + + return false; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/Driver/DriverInterface.php b/src/Chamilo/CoreBundle/Component/Editor/Driver/DriverInterface.php new file mode 100644 index 000000000..90c1c9d59 --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/Driver/DriverInterface.php @@ -0,0 +1,52 @@ +name; + } + + /** + * Gets driver name. + * + * @param string + */ + public function setName($name) + { + $this->name = $name; + } + + /** + * Set connector. + */ + public function setConnector(Connector $connector) + { + $this->connector = $connector; + } + + /** + * @return array + */ + public function getAppPluginOptions() + { + return $this->getOptionsPlugin('chamilo'); + } + + /** + * @return Connector + */ + public function setConnectorFromPlugin() + { + $options = $this->getAppPluginOptions(); + $this->setConnector($options['connector']); + } + + /** + * {@inheritdoc} + */ + public function getConfiguration() + { + if ($this->connector->security->isGranted('IS_AUTHENTICATED_FULLY')) { + /** @var \Chamilo\CoreBundle\Entity\Repository\UserRepository $repository */ + /*$repository = $this->connector->entityManager->getRepository('Chamilo\UserBundle\Entity\User'); + $courses = $repository->getCourses($this->connector->user);*/ + + //if (!empty($courses)) { + $userId = $this->connector->user->getUserId(); + if (!empty($userId)) { + return [ + 'driver' => 'DropBoxDriver', + 'path' => '1', + 'alias' => 'dropbox', + 'tmpPath' => $this->connector->paths['path.temp'], + //'alias' => $courseInfo['code'].' personal documents', + //'URL' => $this->getCourseDocumentRelativeWebPath().$path, + 'accessControl' => 'access', + ]; + } + //} + } + } + + /** + * Close connection. + * + * @author Dmitry (dio) Levashov + */ + public function umount() + { + return true; + } + + protected function init() + { + $this->updateCache($this->options['path'], $this->_stat($this->options['path'])); + + return true; + } + + /** + * Set tmp path. + * + * @author Dmitry (dio) Levashov + */ + protected function configure() + { + parent::configure(); + + if (($tmp = $this->options['tmpPath'])) { + if (!file_exists($tmp)) { + if (@mkdir($tmp)) { + @chmod($tmp, $this->options['tmbPathMode']); + } + } + + $this->tmpPath = is_dir($tmp) && is_writable($tmp) ? $tmp : false; + } + + if (!$this->tmpPath && $this->tmbPath && $this->tmbPathWritable) { + $this->tmpPath = $this->tmbPath; + } + + $this->mimeDetect = 'internal'; + } + + /* FS API */ + + /** + * Cache dir contents. + * + * @param string $path dir path + * + * @author Dmitry Levashov + */ + protected function cacheDir($path) + { + $this->setConnectorFromPlugin(); + $posts = $this->connector->user->getDropBoxReceivedFiles(); + $this->dirsCache[$path] = []; + + if (!empty($posts)) { + foreach ($posts as $post) { + /** @var CDropboxFile $file */ + $file = $post->getFile(); + + $data = $this->transformFileInStat($file); + $id = $data['id']; + if (($stat = $this->updateCache($id, $data)) && empty($stat['hidden'])) { + $this->dirsCache[$path][] = $id; + } + } + + return $this->dirsCache[$path]; + } + + return $this->dirsCache[$path]; + } + + /* file stat */ + + /** + * Return stat for given path. + * Stat contains following fields: + * - (int) size file size in b. required + * - (int) ts file modification time in unix time. required + * - (string) mime mimetype. required for folders, others - optionally + * - (bool) read read permissions. required + * - (bool) write write permissions. required + * - (bool) locked is object locked. optionally + * - (bool) hidden is object hidden. optionally + * - (string) alias for symlinks - link target path relative to root path. optionally + * - (string) target for symlinks - link target path. optionally. + * + * If file does not exists - returns empty array or false. + * + * @param string $path file path + * + * @return array|false + * + * @author Dmitry (dio) Levashov + */ + protected function _stat($path) + { + $this->setConnectorFromPlugin(); + + $userId = $this->connector->user->getUserId(); + $criteria = []; + $criteria['uploaderId'] = $userId; + + if ($path != 1) { + $criteria['filename'] = $path; + $criteria = ['filename' => $path]; + } else { + return $this->returnDirectory(); + } + + $file = $this->connector->entityManager->getRepository('Chamilo\CoreBundle\Entity\CDropboxFile')->findOneBy($criteria); + + if ($file) { + $stat = $this->transformFileInStat($file); + + return $stat; + } + + return []; + } + + /** + * Return array of parents paths (ids). + * + * @param int $path file path (id) + * + * @return array + * + * @author Dmitry (dio) Levashov + */ + protected function getParents($path) + { + $parents = []; + while ($path) { + if ($file = $this->stat($path)) { + array_unshift($parents, $path); + $path = isset($file['phash']) ? $this->decode($file['phash']) : false; + } + } + + if (count($parents)) { + array_pop($parents); + } + + return $parents; + } + + /** + * Return correct file path for LOAD_FILE method. + * + * @param string $path file path (id) + * + * @return string + * + * @author Troex Nevelin + */ + protected function loadFilePath($path) + { + $realPath = realpath($path); + if (DIRECTORY_SEPARATOR == '\\') { // windows + $realPath = str_replace('\\', '\\\\', $realPath); + } + + return $this->db->real_escape_string($realPath); + } + + /** + * Recursive files search. + * + * @param string $path dir path + * @param string $q search string + * @param array $mimes + * + * @return array + * + * @author Dmitry (dio) Levashov + */ + protected function doSearch($path, $q, $mimes) + { + return []; + } + + /* paths/urls */ + + /** + * Return parent directory path. + * + * @param string $path file path + * + * @return string + * + * @author Dmitry (dio) Levashov + */ + protected function _dirname($path) + { + return ($stat = $this->stat($path)) ? ($stat['phash'] ? $this->decode($stat['phash']) : $this->root) : false; + } + + /** + * Return file name. + * + * @param string $path file path + * + * @return string + * + * @author Dmitry (dio) Levashov + */ + protected function _basename($path) + { + return ($stat = $this->stat($path)) ? $stat['name'] : false; + } + + /** + * Return normalized path, this works the same as os.path.normpath() in Python. + * + * @param string $path path + * + * @return string + * + * @author Troex Nevelin + */ + protected function _normpath($path) + { + return $path; + } + + /** + * Return file path related to root dir. + * + * @param string $path file path + * + * @return string + * + * @author Dmitry (dio) Levashov + */ + protected function _relpath($path) + { + return $path; + } + + /** + * Convert path related to root dir into real path. + * + * @param string $path file path + * + * @return string + * + * @author Dmitry (dio) Levashov + */ + protected function _abspath($path) + { + return $path; + } + + /** + * Return fake path started from root dir. + * + * @param string $path file path + * + * @return string + * + * @author Dmitry (dio) Levashov + */ + protected function _path($path) + { + if (($file = $this->stat($path)) == false) { + return ''; + } + + $parentsIds = $this->getParents($path); + $path = ''; + foreach ($parentsIds as $id) { + $dir = $this->stat($id); + $path .= $dir['name'].$this->separator; + } + + return $path.$file['name']; + } + + /** + * Return true if $path is children of $parent. + * + * @param string $path path to check + * @param string $parent parent path + * + * @return bool + * + * @author Dmitry (dio) Levashov + */ + protected function _inpath($path, $parent) + { + return $path == $parent + ? true + : in_array($parent, $this->getParents($path)); + } + + /** + * Return true if path is dir and has at least one childs directory. + * + * @param string $path dir path + * + * @return bool + * + * @author Dmitry (dio) Levashov + */ + protected function _subdirs($path) + { + return ($stat = $this->stat($path)) && isset($stat['dirs']) ? $stat['dirs'] : false; + } + + /** + * Return object width and height + * Usualy used for images, but can be realize for video etc... + * + * @param string $path file path + * @param string $mime file mime type + * + * @return string + * + * @author Dmitry (dio) Levashov + */ + protected function _dimensions($path, $mime) + { + return ($stat = $this->stat($path)) && isset($stat['width']) && isset($stat['height']) ? $stat['width'].'x'.$stat['height'] : ''; + } + + /* file/dir content */ + + /** + * Return files list in directory. + * + * @param string $path dir path + * + * @return array + * + * @author Dmitry (dio) Levashov + */ + protected function _scandir($path) + { + return isset($this->dirsCache[$path]) + ? $this->dirsCache[$path] + : $this->cacheDir($path); + } + + /** + * Open file and return file pointer. + * + * @param string $path file path + * @param string $mode open file mode (ignored in this driver) + * + * @return resource|false + * + * @author Dmitry (dio) Levashov + */ + protected function _fopen($path, $mode = 'rb') + { + $fp = $this->tmbPath + ? @fopen($this->tmpname($path), 'w+') + : @tmpfile(); + + if ($fp) { + if (($res = $this->query('SELECT content FROM '.$this->tbf.' WHERE id="'.$path.'"')) + && ($r = $res->fetch_assoc())) { + fwrite($fp, $r['content']); + rewind($fp); + + return $fp; + } else { + $this->_fclose($fp, $path); + } + } + + return false; + } + + /** + * Close opened file. + * + * @param resource $fp file pointer + * + * @return bool + * + * @author Dmitry (dio) Levashov + */ + protected function _fclose($fp, $path = '') + { + @fclose($fp); + if ($path) { + @unlink($this->tmpname($path)); + } + } + + /* file/dir manipulations */ + + /** + * Create dir and return created dir path or false on failed. + * + * @param string $path parent dir path + * @param string $name new directory name + * + * @return string|bool + * + * @author Dmitry (dio) Levashov + */ + protected function _mkdir($path, $name) + { + return $this->make($path, $name, 'directory') ? $this->_joinPath($path, $name) : false; + } + + /** + * {@inheritdoc} + */ + protected function _mkfile($path, $name) + { + return false; + } + + /** + * {@inheritdoc} + */ + protected function _symlink($target, $path, $name) + { + return false; + } + + /** + * {@inheritdoc} + */ + protected function _copy($source, $targetDir, $name) + { + return false; + } + + /** + * {@inheritdoc} + */ + protected function _move($source, $targetDir, $name) + { + return false; + } + + /** + * Remove file. + * + * @param string $path file path + * + * @return bool + * + * @author Dmitry (dio) Levashov + */ + protected function _unlink($path) + { + return false; + + return $this->query(sprintf('DELETE FROM %s WHERE id=%d AND mime!="directory" LIMIT 1', $this->tbf, $path)) && $this->db->affected_rows; + } + + /** + * Remove dir. + * + * @param string $path dir path + * + * @return bool + * + * @author Dmitry (dio) Levashov + */ + protected function _rmdir($path) + { + return false; + + return $this->query(sprintf('DELETE FROM %s WHERE id=%d AND mime="directory" LIMIT 1', $this->tbf, $path)) && $this->db->affected_rows; + } + + /** + * undocumented function. + * + * @author Dmitry Levashov + */ + protected function _setContent($path, $fp) + { + rewind($fp); + $fstat = fstat($fp); + $size = $fstat['size']; + } + + /** + * {@inheritdoc} + */ + protected function _save($fp, $dir, $name, $stat) + { + return false; + } + + /** + * {@inheritdoc} + */ + protected function _getContents($path) + { + return false; + //return ($res = $this->query(sprintf('SELECT content FROM %s WHERE id=%d', $this->tbf, $path))) && ($r = $res->fetch_assoc()) ? $r['content'] : false; + } + + /** + * Write a string to a file. + * + * @param string $path file path + * @param string $content new file content + * + * @return bool + * + * @author Dmitry (dio) Levashov + */ + protected function _filePutContents($path, $content) + { + return false; + //return $this->query(sprintf('UPDATE %s SET content="%s", size=%d, mtime=%d WHERE id=%d LIMIT 1', $this->tbf, $this->db->real_escape_string($content), strlen($content), time(), $path)); + } + + /** + * {@inheritdoc} + */ + protected function _checkArchivers() + { + } + + /** + * {@inheritdoc} + */ + protected function _unpack($path, $arc) + { + } + + /** + * {@inheritdoc} + */ + protected function _findSymlinks($path) + { + return false; + } + + /** + * {@inheritdoc} + */ + protected function _extract($path, $arc) + { + return false; + } + + /** + * {@inheritdoc} + */ + protected function _archive($dir, $files, $name, $arc) + { + return false; + } + + /** + * @return array + */ + private function returnDirectory() + { + return [ + //'id' => $file->getId().$file->getCId(), + 'name' => 'Dropbox', + //'ts' => $file->getUploadDate(), + 'mime' => 'directory', + 'read' => true, + 'write' => true, + 'locked' => false, + 'hidden' => false, + 'dirs' => 0, + ]; + } + + /** + * @return array + */ + private function transformFileInStat(CDropboxFile $file) + { + $stat = [ + 'id' => $file->getId().$file->getCId(), + 'name' => $file->getFilename(), + 'ts' => $file->getUploadDate(), + 'mime' => 'directory', + 'read' => true, + 'write' => false, + 'locked' => false, + 'hidden' => false, + 'width' => 100, + 'height' => 100, + 'dirs' => 0, + ]; + + return $stat; + + /* + if ($stat['parent_id']) { + $stat['phash'] = $this->encode($stat['parent_id']); + } + if ($stat['mime'] == 'directory') { + unset($stat['width']); + unset($stat['height']); + } else { + unset($stat['dirs']); + } + unset($stat['id']); + unset($stat['parent_id']); + */ + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/Driver/HomeDriver.php b/src/Chamilo/CoreBundle/Component/Editor/Driver/HomeDriver.php new file mode 100644 index 000000000..dfd0e4fe3 --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/Driver/HomeDriver.php @@ -0,0 +1,74 @@ +allow()) { + $home = api_get_path(SYS_HOME_PATH); + + return [ + 'driver' => 'HomeDriver', + 'alias' => get_lang('Portal'), + 'path' => $home, + 'URL' => api_get_path(WEB_PATH).'home', + 'accessControl' => [$this, 'access'], + ]; + } + + return []; + } + + /** + * {@inheritdoc} + */ + public function upload($fp, $dst, $name, $tmpname) + { + $this->setConnectorFromPlugin(); + + if ($this->allow()) { + return parent::upload($fp, $dst, $name, $tmpname); + } + } + + /** + * {@inheritdoc} + */ + public function rm($hash) + { + $this->setConnectorFromPlugin(); + + if ($this->allow()) { + return parent::rm($hash); + } + } + + /** + * @return bool + */ + public function allow() + { + //if ($this->connector->security->isGranted('ROLE_ADMIN')) { + return api_is_platform_admin(); + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/Driver/PersonalDriver.php b/src/Chamilo/CoreBundle/Component/Editor/Driver/PersonalDriver.php new file mode 100644 index 000000000..7ce76a53c --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/Driver/PersonalDriver.php @@ -0,0 +1,147 @@ +allow()) { + $userId = api_get_user_id(); + + if (!empty($userId)) { + // Adding user personal files + $dir = \UserManager::getUserPathById($userId, 'system'); + $dirWeb = \UserManager::getUserPathById($userId, 'web'); + + $mimeType = [ + 'application', + 'text/html', + 'text/javascript', + 'text/ecmascript', + 'image/svg+xml', + 'image/svg', + ]; + + $driver = [ + 'driver' => 'PersonalDriver', + 'alias' => get_lang('MyFiles'), + 'path' => $dir.'my_files', + 'URL' => $dirWeb.'my_files', + 'accessControl' => [$this, 'access'], + 'uploadDeny' => $mimeType, + 'disabled' => [ + 'duplicate', + //'rename', + //'mkdir', + 'mkfile', + 'copy', + 'cut', + 'paste', + 'edit', + 'extract', + 'archive', + 'help', + 'resize', + ], + ]; + + if (api_get_configuration_value('social_myfiles_office_files_upload_allowed')) { + //Allow all office suite documents to be uploaded in the "My files" section of the social network + $driver['uploadOrder'] = ['deny', 'allow']; + $driver['uploadAllow'] = [ + 'application/pdf', + 'application/msword', + 'application/vnd.ms-excel', + 'application/vnd.ms-excel.addin.macroEnabled.12', + 'application/vnd.ms-excel.sheet.binary.macroEnabled.12', + 'application/vnd.ms-excel.sheet.macroEnabled.12', + 'application/vnd.ms-excel.template.macroEnabled.12', + 'application/vnd.ms-powerpoint', + 'application/vnd.ms-powerpoint.addin.macroEnabled.12', + 'application/vnd.ms-powerpoint.presentation.macroEnabled.12', + 'application/vnd.ms-powerpoint.slide.macroenabled.12', + 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12', + 'application/vnd.ms-powerpoint.template.macroEnabled.12', + 'application/vnd.ms-word.document.macroEnabled.12', + 'application/vnd.ms-word.template.macroEnabled.12', + 'application/vnd.openxmlformats-officedocument.presentationml.presentation', + 'application/vnd.openxmlformats-officedocument.presentationml.slide', + 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', + 'application/vnd.openxmlformats-officedocument.presentationml.template', + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', + 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', + ]; + } + + return $driver; + } + } + + return []; + } + + /** + * {@inheritdoc} + */ + public function upload($fp, $dst, $name, $tmpname, $hashes = []) + { + $this->setConnectorFromPlugin(); + if ($this->allow()) { + return parent::upload($fp, $dst, $name, $tmpname); + } + } + + /** + * {@inheritdoc} + */ + public function rm($hash) + { + $this->setConnectorFromPlugin(); + + if ($this->allow()) { + return parent::rm($hash); + } + } + + /** + * @return bool + */ + public function allow() + { + //if ($this->connector->security->isGranted('IS_AUTHENTICATED_FULLY')) { + return !api_is_anonymous(); + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/Editor.php b/src/Chamilo/CoreBundle/Component/Editor/Editor.php new file mode 100644 index 000000000..36689aed3 --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/Editor.php @@ -0,0 +1,274 @@ +toolbarSet = 'Basic'; + $this->value = ''; + $this->config = []; + $this->setConfigAttribute('width', '100%'); + $this->setConfigAttribute('height', '200'); + $this->setConfigAttribute('fullPage', false); + /*$this->translator = $translator; + $this->urlGenerator = $urlGenerator;*/ + //$this->course = $course; + } + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @param string $name + */ + public function setName($name) + { + $this->name = $name; + } + + /** + * @return string + */ + public function getTextareaId() + { + return $this->textareaId; + } + + /** + * @param string $textareaId + * + * @return Editor + */ + public function setTextareaId($textareaId) + { + $this->textareaId = $textareaId; + + return $this; + } + + /** + * Return the HTML code required to run editor. + * + * @param string $value + * + * @return string + */ + public function createHtml($value) + { + $html = ''; + + return $html; + } + + /** + * @return string + */ + public function editorReplace() + { + $toolbar = new Toolbar($this->toolbarSet, $this->config); + $toolbar->setLanguage($this->getLocale()); + $config = $toolbar->getConfig(); + $javascript = $this->toJavascript($config); + + $html = ""; + + return $html; + } + + /** + * @param string $key + * @param mixed $value + */ + public function setConfigAttribute($key, $value) + { + $this->config[$key] = $value; + } + + /** + * @param string $key + * + * @return mixed + */ + public function getConfigAttribute($key) + { + return isset($this->config[$key]) ? $this->config[$key] : null; + } + + /** + * @param array $config + */ + public function processConfig($config) + { + if (is_array($config)) { + foreach ($config as $key => $value) { + switch ($key) { + case 'ToolbarSet': + $this->toolbarSet = $value; + break; + case 'Config': + $this->processConfig($value); + break; + case 'width': + case 'Width': + $this->setConfigAttribute('width', $value); + break; + case 'height': + case 'Height': + $this->setConfigAttribute('height', $value); + break; + case 'FullPage': + case 'fullPage': + $this->setConfigAttribute('fullPage', $value); + break; + default: + $this->setConfigAttribute($key, $value); + break; + } + } + } + } + + public function getEditorTemplate() + { + return null; + } + + /** + * @return string + */ + public function getEditorStandAloneTemplate() + { + return 'javascript/editor/elfinder_standalone.tpl'; + } + + public function formatTemplates($templates) + { + return null; + } + + /** + * @return string + */ + public function getLocale() + { + return api_get_language_isocode(); + } + + /** + * Converts a PHP variable into its Javascript equivalent. + * The code of this method has been "borrowed" from the function drupal_to_js() within the Drupal CMS. + * + * @param mixed $var The variable to be converted into Javascript syntax + * + * @return string Returns a string + * Note: This function is similar to json_encode(), + * in addition it produces HTML-safe strings, i.e. with <, > and & escaped. + * + * @see http://drupal.org/ + */ + protected function toJavascript($var) + { + switch (gettype($var)) { + case 'boolean': + return $var ? 'true' : 'false'; // Lowercase necessary! + case 'integer': + case 'double': + return (string) $var; + case 'resource': + case 'string': + return '"'.str_replace( + ["\r", "\n", "<", ">", "&"], + ['\r', '\n', '\x3c', '\x3e', '\x26'], + addslashes($var) + ).'"'; + break; + case 'array': + // Arrays in JSON can't be associative. If the array is empty or if it + // has sequential whole number keys starting with 0, it's not associative + // so we can go ahead and convert it as an array. + if (empty($var) || array_keys($var) === range(0, sizeof($var) - 1)) { + $output = []; + foreach ($var as $v) { + $output[] = $this->toJavascript($v); + } + + return '[ '.implode(', ', $output).' ]'; + } + //no break + case 'object': + // Otherwise, fall through to convert the array as an object. + $output = []; + foreach ($var as $k => $v) { + $output[] = $this->toJavascript(strval($k)).': '.$this->toJavascript($v); + } + + return '{ '.implode(', ', $output).' }'; + break; + default: + return 'null'; + } + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/Finder.php b/src/Chamilo/CoreBundle/Component/Editor/Finder.php new file mode 100644 index 000000000..381276ea6 --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/Finder.php @@ -0,0 +1,286 @@ +=')) { + if (($_val = ini_get('iconv.internal_encoding')) && strtoupper($_val) !== 'UTF-8') { + ini_set('iconv.internal_encoding', ''); + } + if (($_val = ini_get('mbstring.internal_encoding')) && strtoupper($_val) !== 'UTF-8') { + ini_set('mbstring.internal_encoding', ''); + } + if (($_val = ini_get('internal_encoding')) && strtoupper($_val) !== 'UTF-8') { + ini_set('internal_encoding', ''); + } + } else { + if (function_exists('iconv_set_encoding') && strtoupper(iconv_get_encoding('internal_encoding')) !== 'UTF-8') { + iconv_set_encoding('internal_encoding', 'UTF-8'); + } + if (function_exists('mb_internal_encoding') && strtoupper(mb_internal_encoding()) !== 'UTF-8') { + mb_internal_encoding('UTF-8'); + } + } + ini_set('default_charset', 'UTF-8'); + // define accept constant of server commands path + !defined('ELFINDER_TAR_PATH') && define('ELFINDER_TAR_PATH', 'tar'); + !defined('ELFINDER_GZIP_PATH') && define('ELFINDER_GZIP_PATH', 'gzip'); + !defined('ELFINDER_BZIP2_PATH') && define('ELFINDER_BZIP2_PATH', 'bzip2'); + !defined('ELFINDER_XZ_PATH') && define('ELFINDER_XZ_PATH', 'xz'); + !defined('ELFINDER_ZIP_PATH') && define('ELFINDER_ZIP_PATH', 'zip'); + !defined('ELFINDER_UNZIP_PATH') && define('ELFINDER_UNZIP_PATH', 'unzip'); + !defined('ELFINDER_RAR_PATH') && define('ELFINDER_RAR_PATH', 'rar'); + !defined('ELFINDER_UNRAR_PATH') && define('ELFINDER_UNRAR_PATH', 'unrar'); + !defined('ELFINDER_7Z_PATH') && define('ELFINDER_7Z_PATH', (substr(PHP_OS, 0, 3) === 'WIN') ? '7z' : '7za'); + !defined('ELFINDER_CONVERT_PATH') && define('ELFINDER_CONVERT_PATH', 'convert'); + !defined('ELFINDER_IDENTIFY_PATH') && define('ELFINDER_IDENTIFY_PATH', 'identify'); + !defined('ELFINDER_EXIFTRAN_PATH') && define('ELFINDER_EXIFTRAN_PATH', 'exiftran'); + !defined('ELFINDER_JPEGTRAN_PATH') && define('ELFINDER_JPEGTRAN_PATH', 'jpegtran'); + !defined('ELFINDER_FFMPEG_PATH') && define('ELFINDER_FFMPEG_PATH', 'ffmpeg'); + + !defined('ELFINDER_DISABLE_ZIPEDITOR') && define('ELFINDER_DISABLE_ZIPEDITOR', false); + + // enable(true)/disable(false) handling postscript on ImageMagick + // Should be `false` as long as there is a Ghostscript vulnerability + // see https://artifex.com/news/ghostscript-security-resolved/ + !defined('ELFINDER_IMAGEMAGICK_PS') && define('ELFINDER_IMAGEMAGICK_PS', false); + + // for backward compat + $this->version = (string) self::$ApiVersion; + + // set error handler of WARNING, NOTICE + $errLevel = E_WARNING | E_NOTICE | E_USER_WARNING | E_USER_NOTICE | E_STRICT | E_RECOVERABLE_ERROR; + if (defined('E_DEPRECATED')) { + $errLevel |= E_DEPRECATED | E_USER_DEPRECATED; + } + set_error_handler('elFinder::phpErrorHandler', $errLevel); + + // convert PATH_INFO to GET query + if (!empty($_SERVER['PATH_INFO'])) { + $_ps = explode('/', trim($_SERVER['PATH_INFO'], '/')); + if (!isset($_GET['cmd'])) { + $_cmd = $_ps[0]; + if (isset($this->commands[$_cmd])) { + $_GET['cmd'] = $_cmd; + $_i = 1; + foreach (array_keys($this->commands[$_cmd]) as $_k) { + if (isset($_ps[$_i])) { + if (!isset($_GET[$_k])) { + $_GET[$_k] = $_ps[$_i]; + } + } else { + break; + } + } + } + } + } + + // set elFinder instance + elFinder::$instance = $this; + + // setup debug mode + $this->debug = (isset($opts['debug']) && $opts['debug'] ? true : false); + if ($this->debug) { + error_reporting(defined('ELFINDER_DEBUG_ERRORLEVEL') ? ELFINDER_DEBUG_ERRORLEVEL : -1); + ini_set('diaplay_errors', '1'); + } + + if (!interface_exists('elFinderSessionInterface')) { + include_once __DIR__.'/elFinderSessionInterface.php'; + } + + // session handler + if (!empty($opts['session']) && $opts['session'] instanceof elFinderSessionInterface) { + $this->session = $opts['session']; + } else { + $sessionOpts = [ + 'base64encode' => !empty($opts['base64encodeSessionData']), + 'keys' => [ + 'default' => !empty($opts['sessionCacheKey']) ? $opts['sessionCacheKey'] : 'elFinderCaches', + 'netvolume' => !empty($opts['netVolumesSessionKey']) ? $opts['netVolumesSessionKey'] : 'elFinderNetVolumes', + ], + ]; + if (!class_exists('elFinderSession')) { + include_once __DIR__.'/elFinderSession.php'; + } + $this->session = new elFinderSession($sessionOpts); + } + // try session start | restart + $this->session->start(); + + $sessionUseCmds = []; + if (isset($opts['sessionUseCmds']) && is_array($opts['sessionUseCmds'])) { + $sessionUseCmds = $opts['sessionUseCmds']; + } + + // set self::$volumesCnt by HTTP header "X-elFinder-VolumesCntStart" + if (isset($_SERVER['HTTP_X_ELFINDER_VOLUMESCNTSTART']) && ($volumesCntStart = intval($_SERVER['HTTP_X_ELFINDER_VOLUMESCNTSTART']))) { + self::$volumesCnt = $volumesCntStart; + } + + $this->time = $this->utime(); + $this->sessionCloseEarlier = isset($opts['sessionCloseEarlier']) ? (bool) $opts['sessionCloseEarlier'] : true; + $this->sessionUseCmds = array_flip($sessionUseCmds); + $this->timeout = (isset($opts['timeout']) ? $opts['timeout'] : 0); + $this->uploadTempPath = (isset($opts['uploadTempPath']) ? $opts['uploadTempPath'] : ''); + $this->callbackWindowURL = (isset($opts['callbackWindowURL']) ? $opts['callbackWindowURL'] : ''); + $this->maxTargets = (isset($opts['maxTargets']) ? intval($opts['maxTargets']) : $this->maxTargets); + elFinder::$commonTempPath = (isset($opts['commonTempPath']) ? $opts['commonTempPath'] : './.tmp'); + if (!is_writable(elFinder::$commonTempPath)) { + elFinder::$commonTempPath = sys_get_temp_dir(); + if (!is_writable(elFinder::$commonTempPath)) { + elFinder::$commonTempPath = ''; + } + } + $this->maxArcFilesSize = isset($opts['maxArcFilesSize']) ? intval($opts['maxArcFilesSize']) : 0; + $this->optionsNetVolumes = (isset($opts['optionsNetVolumes']) && is_array($opts['optionsNetVolumes'])) ? $opts['optionsNetVolumes'] : []; + if (isset($opts['itemLockExpire'])) { + $this->itemLockExpire = intval($opts['itemLockExpire']); + } + + // deprecated settings + $this->netVolumesSessionKey = !empty($opts['netVolumesSessionKey']) ? $opts['netVolumesSessionKey'] : 'elFinderNetVolumes'; + self::$sessionCacheKey = !empty($opts['sessionCacheKey']) ? $opts['sessionCacheKey'] : 'elFinderCaches'; + + // check session cache + $_optsMD5 = md5(json_encode($opts['roots'])); + if ($this->session->get('_optsMD5') !== $_optsMD5) { + $this->session->set('_optsMD5', $_optsMD5); + } + + // setlocale and global locale regists to elFinder::locale + self::$locale = !empty($opts['locale']) ? $opts['locale'] : 'en_US.UTF-8'; + if (false === setlocale(LC_ALL, self::$locale)) { + self::$locale = setlocale(LC_ALL, ''); + } + + // set defaultMimefile + elFinder::$defaultMimefile = (isset($opts['defaultMimefile']) ? $opts['defaultMimefile'] : ''); + + // bind events listeners + if (!empty($opts['bind']) && is_array($opts['bind'])) { + $_req = $_SERVER["REQUEST_METHOD"] == 'POST' ? $_POST : $_GET; + $_reqCmd = isset($_req['cmd']) ? $_req['cmd'] : ''; + foreach ($opts['bind'] as $cmd => $handlers) { + $doRegist = (strpos($cmd, '*') !== false); + if (!$doRegist) { + $doRegist = ($_reqCmd && in_array($_reqCmd, array_map('self::getCmdOfBind', explode(' ', $cmd)))); + } + if ($doRegist) { + // for backward compatibility + if (!is_array($handlers)) { + $handlers = [$handlers]; + } else { + if (count($handlers) === 2 && is_object($handlers[0])) { + $handlers = [$handlers]; + } + } + foreach ($handlers as $handler) { + if ($handler) { + if (is_string($handler) && strpos($handler, '.')) { + list($_domain, $_name, $_method) = array_pad(explode('.', $handler), 3, ''); + if (strcasecmp($_domain, 'plugin') === 0) { + if ($plugin = $this->getPluginInstance($_name, isset($opts['plugin'][$_name]) ? $opts['plugin'][$_name] : []) + and method_exists($plugin, $_method)) { + $this->bind($cmd, [$plugin, $_method]); + } + } + } else { + $this->bind($cmd, $handler); + } + } + } + } + } + } + + if (!isset($opts['roots']) || !is_array($opts['roots'])) { + $opts['roots'] = []; + } + + // check for net volumes stored in session + $netVolumes = $this->getNetVolumes(); + foreach ($netVolumes as $key => $root) { + if (!isset($root['id'])) { + // given fixed unique id + if (!$root['id'] = $this->getNetVolumeUniqueId($netVolumes)) { + $this->mountErrors[] = 'Netmount Driver "'.$root['driver'].'" : Could\'t given volume id.'; + continue; + } + } + $opts['roots'][$key] = $root; + } + + // "mount" volumes + foreach ($opts['roots'] as $i => $o) { + //$class = 'elFinderVolume'.(isset($o['driver']) ? $o['driver'] : ''); + // Chamilo change + $class = (isset($o['driver']) ? $o['driver'] : ''); + + if (class_exists($class)) { + $volume = new $class(); + + try { + if ($this->maxArcFilesSize && (empty($o['maxArcFilesSize']) || $this->maxArcFilesSize < $o['maxArcFilesSize'])) { + $o['maxArcFilesSize'] = $this->maxArcFilesSize; + } + // pass session handler + $volume->setSession($this->session); + if ($volume->mount($o)) { + // unique volume id (ends on "_") - used as prefix to files hash + $id = $volume->id(); + + $this->volumes[$id] = $volume; + if ((!$this->default || $volume->root() !== $volume->defaultPath()) && $volume->isReadable()) { + $this->default = $this->volumes[$id]; + } + } else { + $this->removeNetVolume($i, $volume); + $this->mountErrors[] = 'Driver "'.$class.'" : '.implode(' ', $volume->error()); + } + } catch (Exception $e) { + $this->removeNetVolume($i, $volume); + $this->mountErrors[] = 'Driver "'.$class.'" : '.$e->getMessage(); + } + } else { + $this->mountErrors[] = 'Driver "'.$class.'" does not exist'; + } + } + + // if at least one readable volume - ii desu >_< + $this->loaded = !empty($this->default); + + // restore error handler for now + restore_error_handler(); + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/TinyMce/TinyMce.php b/src/Chamilo/CoreBundle/Component/Editor/TinyMce/TinyMce.php new file mode 100644 index 000000000..f4fc159c8 --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/TinyMce/TinyMce.php @@ -0,0 +1,82 @@ +template->addResource($jsFolder.'tinymce/tinymce.min.js', 'js'); + } + + /** + * @return string + */ + public function getEditorTemplate() + { + return 'javascript/editor/tinymce/elfinder.tpl'; + } + + /** + * Return the HTML code required to run editor. + * + * @return string + */ + public function createHtml() + { + $html = ''; + $html .= $this->editorReplace(); + + return $html; + } + + /** + * @return string + */ + public function editorReplace() + { + $toolbar = new Toolbar\Basic($this->urlGenerator, $this->toolbarSet, $this->config, 'TinyMce'); + $toolbar->setLanguage($this->getLocale()); + $config = $toolbar->getConfig(); + $config['selector'] = "#".$this->name; + $javascript = $this->toJavascript($config); + $javascript = str_replace('"elFinderBrowser"', "elFinderBrowser", $javascript); + + $html = ""; + + return $html; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/TinyMce/Toolbar/Basic.php b/src/Chamilo/CoreBundle/Component/Editor/TinyMce/Toolbar/Basic.php new file mode 100644 index 000000000..b65fb8210 --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/TinyMce/Toolbar/Basic.php @@ -0,0 +1,39 @@ + "modern", + 'width' => 300, + 'height' => 300, + 'plugins' => [ + "advlist autolink link image lists charmap print preview hr anchor pagebreak spellchecker", + "searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking", + "save table contextmenu directionality emoticons template paste textcolor", + ], + 'content_css' => "css/content.css", + 'toolbar' => "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | l ink image | print preview media fullpage | forecolor backcolor emoticons", + 'file_browser_callback' => 'elFinderBrowser', + ]; + + if (isset($this->config)) { + $this->config = array_merge($config, $this->config); + } else { + $this->config = $config; + } + + return $this->config; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Editor/Toolbar.php b/src/Chamilo/CoreBundle/Component/Editor/Toolbar.php new file mode 100644 index 000000000..4c18e19e7 --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Editor/Toolbar.php @@ -0,0 +1,157 @@ +setConfig($config); + $toolbarObj = new $class(); + $config = $toolbarObj->getConfig(); + + if (api_get_configuration_value('full_ckeditor_toolbar_set')) { + $basicClass = __NAMESPACE__."\\".$prefix."\\Toolbar\\Basic"; + $basicObj = new $basicClass(); + $basicConfig = $basicObj->getConfig(); + + if (api_get_setting('more_buttons_maximized_mode') == 'true') { + if (isset($config['toolbar'])) { + unset($config['toolbar']); + } + + $config['toolbar_minToolbar'] = $basicConfig['toolbar_minToolbar']; + $config['toolbar_maxToolbar'] = $basicConfig['toolbar_maxToolbar']; + } + + $config['height'] = '85px'; + $config['toolbarCanCollapse'] = true; + $config['toolbarStartupExpanded'] = false; + } + + $this->updateConfig($config); + } + } + + if (!empty($config)) { + $this->updateConfig($config); + } + //$this->urlGenerator = $urlGenerator; + } + + /** + * @return string + */ + public function getPluginsToString() + { + $plugins = array_filter( + array_merge( + $this->getDefaultPlugins(), + $this->getPlugins(), + $this->getConditionalPlugins() + ) + ); + + return + $this->getConfigAttribute('extraPlugins'). + implode(',', $plugins); + } + + /** + * Get plugins by default in all editors in the platform. + * + * @return array + */ + public function getDefaultPlugins() + { + return $this->defaultPlugins; + } + + /** + * Get fixed plugins depending of the toolbar. + * + * @return array + */ + public function getPlugins() + { + return $this->plugins; + } + + /** + * Get dynamic/conditional plugins depending of platform/course settings. + * + * @return array + */ + public function getConditionalPlugins() + { + return []; + } + + public function setConfig(array $config) + { + $this->config = $config; + } + + public function updateConfig(array $config) + { + if (empty($this->config)) { + $this->setConfig($config); + } else { + $this->config = array_merge($this->config, $config); + } + } + + /** + * @return array + */ + public function getConfig() + { + return $this->config; + } + + /** + * @param string $variable + * + * @return array + */ + public function getConfigAttribute($variable) + { + if (isset($this->config[$variable])) { + return $this->config[$variable]; + } + + return null; + } + + /** + * @param string $language + */ + public function setLanguage($language) + { + $this->config['language'] = $language; + } +} diff --git a/src/Chamilo/CoreBundle/Component/Filesystem/Data.php b/src/Chamilo/CoreBundle/Component/Filesystem/Data.php new file mode 100644 index 000000000..5fb34aa4a --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Filesystem/Data.php @@ -0,0 +1,285 @@ +paths = $paths; + $this->fs = $filesystem; + $this->converter = $converter; + $this->connector = $connector; + $this->connector->setDriver('CourseDriver'); + } + + /** + * Gets a file from the "data" folder. + * + * @param string $file + * + * @throws \InvalidArgumentException + * + * @return SplFileInfo + */ + public function get($file) + { + $file = new SplFileInfo($this->paths['sys_data_path'].$file, null, null); + if ($this->fs->exists($file)) { + return $file; + } else { + throw new \InvalidArgumentException(sprintf('The file "%s" does not exists .', $file)); + } + } + + /** + * Gets a file from the data/courses/MATHS/document directory. + * + * @param string $courseCode + * @param string $file + * + * @return SplFileInfo + */ + public function getCourseDocument($courseCode, $file) + { + $file = 'courses/'.$courseCode.'/document/'.$file; + + return $this->get($file); + } + + /** + * Gets a file from the data/courses/MATHS/scorm directory. + * + * @param string $courseCode + * @param string $file + * + * @return SplFileInfo + */ + public function getCourseScormDocument($courseCode, $file) + { + $file = 'courses/'.$courseCode.'/scorm/'.$file; + + return $this->get($file); + } + + /** + * Gets a file from the data/courses/MATHS/document directory. + * + * @param string $courseCode + * @param string $file + * + * @return SplFileInfo + */ + public function getCourseUploadFile($courseCode, $file) + { + $file = 'courses/'.$courseCode.'/upload/'.$file; + + return $this->get($file); + } + + /** + * Create folders. + * + * @param OutputInterface $output + * @param string $folderPermissions + */ + public function createFolders( + array $folderList, + OutputInterface $output = null, + $folderPermissions = null + ) { + if (empty($folderPermissions)) { + $folderPermissions = api_get_permissions_for_new_directories(); + } + + if (!empty($folderList)) { + foreach ($folderList as $folder) { + if (!is_dir($folder)) { + $this->fs->mkdir($folder, $folderPermissions); + if ($output) { + $output->writeln("Folder '$folder' created"); + } + } + } + } + } + + /** + * @param OutputInterface $output + */ + public function copyFolders(array $folderList, OutputInterface $output = null) + { + if (!empty($folderList)) { + foreach ($folderList as $folderSource => $folderDestination) { + $this->fs->mirror($folderSource, $folderDestination); + $finder = new Finder(); + $files = $finder->files()->in($folderDestination); + $this->fs->chmod($files, api_get_permissions_for_new_directories()); + if ($output) { + $output->writeln("Contents were copied from $folderSource to $folderDestination"); + } + } + } + } + + /** + * @return Finder + */ + public function getStyleSheetFolders() + { + $finder = new Finder(); + $styleSheetFolder = $this->paths['root_sys'].'main/css'; + + return $finder->directories()->depth('== 0')->in($styleSheetFolder); + } + + /** + * Creates a empty file inside the temp folder. + * + * @param string $fileName + * @param string $extension + * + * @return string + */ + public function createTempFile($fileName = null, $extension = null) + { + if (empty($fileName)) { + $fileName = mt_rand(); + } + if (!empty($extension)) { + $extension = ".$extension"; + } + $filePath = $this->paths['path.temp'].$fileName.$extension; + $this->fs->touch($filePath); + if ($this->fs->exists($filePath)) { + return $filePath; + } + + return null; + } + + /** + * Converts ../courses/ABC/document/file.jpg to + * http://chamilo/courses/ABC/document/file.jpg. + * + * @param string $content + * + * @return string + */ + public function convertRelativeToAbsoluteUrl($content) + { + /** @var CourseDriver $courseDriver */ + $courseDriver = $this->connector->getDriver('CourseDriver'); + + $dom = HtmlDomParser::str_get_html($content); + /** @var \simple_html_dom_node $image */ + foreach ($dom->find('img') as $image) { + $image->src = str_replace( + $courseDriver->getCourseDocumentRelativeWebPath(), + $courseDriver->getCourseDocumentWebPath(), + $image->src + ); + } + + return $dom; + } + + /** + * Save string in a temp file. + * + * @param string $content + * @param string $fileName + * @param string $extension + * + * @return string file path + */ + public function putContentInTempFile($content, $fileName = null, $extension = null) + { + $file = $this->createTempFile($fileName, $extension); + if (!empty($file)) { + $this->fs->dumpFile($file, $content); + + return $file; + } + + return null; + } + + /** + * @param string $filePath + * @param string $format + * + * @return string + */ + public function transcode($filePath, $format) + { + if ($this->fs->exists($filePath)) { + $fileInfo = pathinfo($filePath); + $fileName = $fileInfo['filename']; + $newFilePath = str_replace( + $fileInfo['basename'], + $fileName.'.'.$format, + $filePath + ); + /** @var \MediaAlchemyst\DriversContainer $drivers */ + $drivers = $this->converter->getDrivers(); + $unoconv = $drivers['unoconv']; + /** @var Unoconv $unoconv */ + //$drivers = $this->converter->turnInto($filePath, $newFilePath); + $unoconv->transcode($filePath, $format, $newFilePath); + if ($this->fs->exists($newFilePath)) { + return $newFilePath; + } + } + + return false; + } + + /** + * Creates the users/upload/X/my_files folder. + */ + public function createMyFilesFolder(User $user) + { + $userId = $user->getUserId(); + $path = \UserManager::get_user_picture_path_by_id($userId, 'system'); + + if (!$this->fs->exists($path['dir'].'my_files')) { + $this->createFolders([$path['dir'].'my_files']); + } + } +} diff --git a/src/Chamilo/CoreBundle/Component/HTMLPurifier/Filter/AllowIframes.php b/src/Chamilo/CoreBundle/Component/HTMLPurifier/Filter/AllowIframes.php new file mode 100644 index 000000000..d01713d9d --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/HTMLPurifier/Filter/AllowIframes.php @@ -0,0 +1,82 @@ +#i', '', $html); + + return $html; + } + + /** + * @param string $html + * @param HTMLPurifier_Config $config + * @param HTMLPurifier_Context $context + * + * @return string + */ + public function postFilter($html, $config, $context) + { + $post_regex = '#]+?)>#'; + + return preg_replace_callback($post_regex, [$this, 'postFilterCallback'], $html); + } + + /** + * @param array $matches + * + * @return string + */ + protected function postFilterCallback($matches) + { + // Domain Whitelist + $hostName = []; + preg_match('#https?://(.*)#i', api_get_path(WEB_PATH), $hostName); + + $youTubeMatch = preg_match('#src="(https:)?//www.youtube(-nocookie)?.com/#i', $matches[1]); + $vimeoMatch = preg_match('#://player.vimeo.com/#i', $matches[1]); + $googleMapsMatch = preg_match('#src="https://maps.google.com/#i', $matches[1]); + $slideShare = preg_match('#src="(https?:)?//www.slideshare.net/#', $matches[1]); + $platformDomain = preg_match('#src="https?://(.+\.)?'.$hostName[1].'#i', $matches[1]); + + if ($youTubeMatch || $vimeoMatch || $googleMapsMatch || $slideShare || $platformDomain) { + $extra = ' frameborder="0"'; + if ($youTubeMatch) { + $extra .= ' allowfullscreen'; + } elseif ($vimeoMatch) { + $extra .= ' webkitAllowFullScreen mozallowfullscreen allowFullScreen'; + } + + return ''; + } else { + return ''; + } + } +} diff --git a/src/Chamilo/CoreBundle/Component/Utils/ChamiloApi.php b/src/Chamilo/CoreBundle/Component/Utils/ChamiloApi.php new file mode 100644 index 000000000..e675c52bc --- /dev/null +++ b/src/Chamilo/CoreBundle/Component/Utils/ChamiloApi.php @@ -0,0 +1,461 @@ + '540x405 (3/4)', + '640x480' => '640x480 (3/4)', + '720x540' => '720x540 (3/4)', + '800x600' => '800x600 (3/4)', + '1024x576' => '1024x576 (16/9)', + '1024x768' => '1000x750 (3/4)', + '1280x720' => '1280x720 (16/9)', + '1280x860' => '1280x960 (3/4)', + '1400x1050' => '1400x1050 (3/4)', + '1600x900' => '1600x900 (16/9)', + ]; + } + + /** + * Get the platform logo path. + * + * @param string $theme + * @param bool $getSysPath + * @param bool $forcedGetter + * + * @return string + */ + public static function getPlatformLogoPath($theme = '', $getSysPath = false, $forcedGetter = false) + { + static $logoPath; + + // If call from CLI it should be reload. + if ('cli' === PHP_SAPI) { + $logoPath = null; + } + + if (!isset($logoPath) || $forcedGetter) { + $theme = empty($theme) ? api_get_visual_theme() : $theme; + $accessUrlId = api_get_current_access_url_id(); + if ('cli' === PHP_SAPI) { + $accessUrl = api_get_configuration_value('access_url'); + if (!empty($accessUrl)) { + $accessUrlId = $accessUrl; + } + } + $themeDir = \Template::getThemeDir($theme); + $customLogoPath = $themeDir."images/header-logo-custom$accessUrlId.png"; + + $svgIcons = api_get_setting('icons_mode_svg'); + if ($svgIcons === 'true') { + $customLogoPathSVG = substr($customLogoPath, 0, -3).'svg'; + if (file_exists(api_get_path(SYS_PUBLIC_PATH)."css/$customLogoPathSVG")) { + if ($getSysPath) { + $logoPath = api_get_path(SYS_PUBLIC_PATH)."css/$customLogoPathSVG"; + + return $logoPath; + } + $logoPath = api_get_path(WEB_CSS_PATH).$customLogoPathSVG; + + return $logoPath; + } + } + if (file_exists(api_get_path(SYS_PUBLIC_PATH)."css/$customLogoPath")) { + if ($getSysPath) { + $logoPath = api_get_path(SYS_PUBLIC_PATH)."css/$customLogoPath"; + + return $logoPath; + } + + $logoPath = api_get_path(WEB_CSS_PATH).$customLogoPath; + + return $logoPath; + } + + $originalLogoPath = $themeDir."images/header-logo.png"; + if ($svgIcons === 'true') { + $originalLogoPathSVG = $themeDir."images/header-logo.svg"; + if (file_exists(api_get_path(SYS_CSS_PATH).$originalLogoPathSVG)) { + if ($getSysPath) { + $logoPath = api_get_path(SYS_CSS_PATH).$originalLogoPathSVG; + + return $logoPath; + } + $logoPath = api_get_path(WEB_CSS_PATH).$originalLogoPathSVG; + + return $logoPath; + } + } + + if (file_exists(api_get_path(SYS_CSS_PATH).$originalLogoPath)) { + if ($getSysPath) { + $logoPath = api_get_path(SYS_CSS_PATH).$originalLogoPath; + + return $logoPath; + } + + $logoPath = api_get_path(WEB_CSS_PATH).$originalLogoPath; + + return $logoPath; + } + $logoPath = ''; + } + + return $logoPath; + } + + /** + * Get the platform logo. + * Return a if the logo image exists. Otherwise return a

with the institution name. + * + * @param string $theme + * @param array $imageAttributes optional + * @param bool $getSysPath + * @param bool $forcedGetter + * + * @return string + */ + public static function getPlatformLogo( + $theme = '', + $imageAttributes = [], + $getSysPath = false, + $forcedGetter = false + ) { + $logoPath = self::getPlatformLogoPath($theme, $getSysPath, $forcedGetter); + $institution = api_get_setting('Institution'); + $institutionUrl = api_get_setting('InstitutionUrl'); + $siteName = api_get_setting('siteName'); + + $homeURL = api_get_path(WEB_PATH).'index.php'; + + $replaceHomeURL = api_get_configuration_value('platform_logo_url'); + if (!empty($replaceHomeURL)) { + $homeURL = $replaceHomeURL; + } + + if ($logoPath === null) { + $headerLogo = \Display::url($siteName, $homeURL); + + if (!empty($institutionUrl) && !empty($institution)) { + $headerLogo .= ' - '.\Display::url($institution, $institutionUrl); + } + + $courseInfo = api_get_course_info(); + if (isset($courseInfo['extLink']) && !empty($courseInfo['extLink']['name'])) { + $headerLogo .= ' - '; + if (!empty($courseInfo['extLink']['url'])) { + $headerLogo .= \Display::url( + $courseInfo['extLink']['name'], + $courseInfo['extLink']['url'], + ['class' => 'extLink'] + ); + } elseif (!empty($courseInfo['extLink']['url'])) { + $headerLogo .= $courseInfo['extLink']['url']; + } + } + + return \Display::tag('h2', $headerLogo, ['class' => 'text-left']); + } + + $image = \Display::img($logoPath, $institution, $imageAttributes); + + return \Display::url($image, $homeURL); + } + + /** + * Like strip_tags(), but leaves an additional space and removes only the given tags. + * + * @param string $string + * @param array $tags Tags to be removed + * + * @return string The original string without the given tags + */ + public static function stripGivenTags($string, $tags) + { + foreach ($tags as $tag) { + $string2 = preg_replace('#]*>#i', ' ', $string); + if ($string2 != $string) { + $string = preg_replace('/<\b'.$tag.'\b[^>]*>/i', ' ', $string2); + } + } + + return $string; + } + + /** + * Adds or Subtract a time in hh:mm:ss to a datetime. + * + * @param string $time Time to add or substract in hh:mm:ss format + * @param string $datetime Datetime to be modified as accepted by the Datetime class constructor + * @param bool $operation True for Add, False to Subtract + * + * @return string + */ + public static function addOrSubTimeToDateTime($time, $datetime = 'now', $operation = true) + { + $date = new \DateTime($datetime); + $hours = $minutes = $seconds = 0; + sscanf($time, "%d:%d:%d", $hours, $minutes, $seconds); + $timeSeconds = isset($seconds) ? $hours * 3600 + $minutes * 60 + $seconds : $hours * 60 + $minutes; + if ($operation) { + $date->add(new \DateInterval('PT'.$timeSeconds.'S')); + } else { + $date->sub(new \DateInterval('PT'.$timeSeconds.'S')); + } + + return $date->format('Y-m-d H:i:s'); + } + + /** + * Returns the course id (integer) for the given course directory or the current ID if no directory is defined. + * + * @param string $directory The course directory/path that appears in the URL + * + * @return int + */ + public static function getCourseIdByDirectory($directory = null) + { + if (!empty($directory)) { + $directory = \Database::escape_string($directory); + $row = \Database::select( + 'id', + \Database::get_main_table(TABLE_MAIN_COURSE), + ['where' => ['directory = ?' => [$directory]]], + 'first' + ); + + if (is_array($row) && isset($row['id'])) { + return $row['id']; + } else { + return false; + } + } + + return Session::read('_real_cid', 0); + } + + /** + * Check if the current HTTP request is by AJAX. + * + * @return bool + */ + public static function isAjaxRequest() + { + $requestedWith = $_SERVER['HTTP_X_REQUESTED_WITH'] ?? null; + + return $requestedWith === 'XMLHttpRequest'; + } + + /** + * Get a variable name for language file from a text. + * + * @param string $text + * @param string $prefix + * + * @return string + */ + public static function getLanguageVar($text, $prefix = '') + { + $text = api_replace_dangerous_char($text); + $text = str_replace(['-', ' ', '.'], '_', $text); + $text = preg_replace('/\_{1,}/', '_', $text); + //$text = str_replace('_', '', $text); + $text = api_underscore_to_camel_case($text); + + return $prefix.$text; + } + + /** + * Get the stylesheet path for HTML documents created with CKEditor. + * + * @return string + */ + public static function getEditorDocStylePath() + { + $visualTheme = api_get_visual_theme(); + + $cssFile = api_get_path(SYS_CSS_PATH)."themes/$visualTheme/document.css"; + + if (is_file($cssFile)) { + return api_get_path(WEB_CSS_PATH)."themes/$visualTheme/document.css"; + } + + return api_get_path(WEB_CSS_PATH).'document.css'; + } + + /** + * Get the stylesheet path for HTML blocks created with CKEditor. + * + * @return string + */ + public static function getEditorBlockStylePath() + { + $visualTheme = api_get_visual_theme(); + + $cssFile = api_get_path(SYS_CSS_PATH)."themes/$visualTheme/editor_content.css"; + + if (is_file($cssFile)) { + return api_get_path(WEB_CSS_PATH)."themes/$visualTheme/editor_content.css"; + } + + return api_get_path(WEB_CSS_PATH).'editor_content.css'; + } + + /** + * Get a list of colors from the palette at main/palette/pchart/default.color + * and return it as an array of strings. + * + * @param bool $decimalOpacity Whether to return the opacity as 0..100 or 0..1 + * @param bool $wrapInRGBA Whether to return it as 1,1,1,100 or rgba(1,1,1,100) + * @param int $fillUpTo If the number of colors is smaller than this number, generate more colors + * + * @return array An array of string colors + */ + public static function getColorPalette( + $decimalOpacity = false, + $wrapInRGBA = false, + $fillUpTo = 0 + ) { + // Get the common colors from the palette used for pchart + $paletteFile = api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color'; + $palette = file($paletteFile); + if ($decimalOpacity) { + // Because the pchart palette has transparency as integer values + // (0..100) and chartjs uses percentage (0.0..1.0), we need to divide + // the last value by 100, which is a bit overboard for just one chart + foreach ($palette as $index => $color) { + $components = preg_split('/,/', trim($color)); + $components[3] = round($components[3] / 100, 1); + $palette[$index] = join(',', $components); + } + } + if ($wrapInRGBA) { + foreach ($palette as $index => $color) { + $color = trim($color); + $palette[$index] = 'rgba('.$color.')'; + } + } + // If we want more colors, loop through existing colors + $count = count($palette); + if (isset($fillUpTo) && $fillUpTo > $count) { + for ($i = $count; $i < $fillUpTo; $i++) { + $palette[$i] = $palette[$i % $count]; + } + } + + return $palette; + } + + /** + * Get the local time for the midnight. + * + * @param string|null $utcTime Optional. The time to ve converted. + * See api_get_local_time. + * + * @throws \Exception + * + * @return \DateTime + */ + public static function getServerMidnightTime($utcTime = null) + { + $localTime = api_get_local_time($utcTime); + $localTimeZone = api_get_timezone(); + + $localMidnight = new \DateTime($localTime, new \DateTimeZone($localTimeZone)); + $localMidnight->modify('midnight'); + + return $localMidnight; + } + + /** + * Get JavaScript code necessary to load quiz markers-rolls in medialement's Markers Rolls plugin. + * + * @return string + */ + public static function getQuizMarkersRollsJS() + { + $webCodePath = api_get_path(WEB_CODE_PATH); + $cidReq = api_get_cidreq(true, true, 'embeddable'); + $colorPalette = self::getColorPalette(false, true); + + return " + var \$originalNode = $(originalNode), + qMarkersRolls = \$originalNode.data('q-markersrolls') || [], + qMarkersColor = \$originalNode.data('q-markersrolls-color') || '{$colorPalette[0]}'; + + if (0 == qMarkersRolls.length) { + return; + } + + instance.options.markersRollsColor = qMarkersColor; + instance.options.markersRollsWidth = 2; + instance.options.markersRolls = {}; + + qMarkersRolls.forEach(function (qMarkerRoll) { + var url = '{$webCodePath}exercise/exercise_submit.php?$cidReq&' + + $.param({ + exerciseId: qMarkerRoll[1], + learnpath_id: 0, + learnpath_item_id: 0, + learnpath_item_view_id: 0 + }); + + instance.options.markersRolls[qMarkerRoll[0]] = url; + }); + + instance.buildmarkersrolls(instance, instance.controls, instance.layers, instance.media); + "; + } +} diff --git a/src/Chamilo/CoreBundle/Composer/ScriptHandler.php b/src/Chamilo/CoreBundle/Composer/ScriptHandler.php new file mode 100644 index 000000000..699b19285 --- /dev/null +++ b/src/Chamilo/CoreBundle/Composer/ScriptHandler.php @@ -0,0 +1,361 @@ +mirror($sysAssets, $webAssets, null, ['override' => true, 'delete' => true]); + + $sysCss = __DIR__.'/../../../../app/Resources/public/css'; + $webCss = __DIR__.'/../../../../web/css'; + $fs->mirror($sysCss, $webCss, null, ['override' => true]); + + if ($fs->exists(__DIR__.'/../../../../web/build')) { + $fs->remove(__DIR__.'/../../../../web/build'); + } + + if ($fs->exists(__DIR__.'/../../../../app/cache/twig')) { + $fs->remove(__DIR__.'/../../../../app/cache/twig'); + } + + if (function_exists('opcache_reset')) { + opcache_reset(); + } + } + + /** + * Delete old Symfony folder before update (generates conflicts with composer) + * This method also applies to 1.10 folders removed for 1.11. + */ + public static function deleteOldFilesFrom19x() + { + $paths = self::getFoldersToDelete(); + + foreach ($paths as $path) { + if (is_dir($path) && is_writable($path)) { + self::rmdirr($path); + } + } + + $files = self::getFilesToDelete(); + + foreach ($files as $file) { + if (is_file($file) && is_writable($file)) { + unlink($file); + } + } + } + + /** + * @return array + */ + public static function getFoldersToDelete() + { + $paths = [ + __DIR__.'/../../../../app/Resources/public/assets/bootstrap/docs', + __DIR__.'/../../../../app/Resources/public/assets/bootstrap/nuget', + __DIR__.'/../../../../app/Resources/public/assets/bootstrap/grunt', + __DIR__.'/../../../../app/Resources/public/assets/bootstrap/test-infra', + __DIR__.'/../../../../archive/', + __DIR__.'/../../../../main/announcements/resources', + __DIR__.'/../../../../main/conference/', + __DIR__.'/../../../../main/course_notice/', + __DIR__.'/../../../../main/metadata/', + __DIR__.'/../../../../main/exercice/export/qti', + __DIR__.'/../../../../main/glossary/resources', + __DIR__.'/../../../../main/link/resources', + __DIR__.'/../../../../main/notebook/resources', + __DIR__.'/../../../../main/reservation/', + __DIR__.'/../../../../main/inc/lib/symfony/', + __DIR__.'/../../../../main/inc/entity/', + __DIR__.'/../../../../main/inc/lib/phpdocx/', + __DIR__.'/../../../../main/inc/lib/phpqrcode/', + __DIR__.'/../../../../main/inc/lib/ezpdf', + __DIR__.'/../../../../main/inc/lib/javascript/bootstrap', + __DIR__.'/../../../../main/inc/lib/javascript/bxslider', + __DIR__.'/../../../../main/inc/lib/javascript/fullcalendar', + __DIR__.'/../../../../main/inc/lib/javascript/jquery-ui', + __DIR__.'/../../../../main/inc/lib/fckeditor', + __DIR__.'/../../../../main/inc/lib/mpdf/', + __DIR__.'/../../../../main/inc/lib/phpmailer', + __DIR__.'/../../../../main/inc/lib/nanogong/', + __DIR__.'/../../../../main/inc/lib/symfony/', + __DIR__.'/../../../../main/inc/lib/system/media/renderer', + __DIR__.'/../../../../main/inc/lib/system/io', + __DIR__.'/../../../../main/inc/lib/system/net', + __DIR__.'/../../../../main/inc/lib/system/text/', + __DIR__.'/../../../../main/inc/lib/icalcreator/', + __DIR__.'/../../../../main/inc/lib/getid3/', + __DIR__.'/../../../../main/inc/lib/tools/', + __DIR__.'/../../../../main/inc/lib/pchart/', + __DIR__.'/../../../../main/inc/lib/pclzip/', + __DIR__.'/../../../../main/inc/lib/htmlpurifier', + __DIR__.'/../../../../main/pear/excelreader/', + __DIR__.'/../../../../main/resourcelinker', + __DIR__.'/../../../../main/newscorm', + __DIR__.'/../../../../main/exercice', + __DIR__.'/../../../../plugin/ticket', + __DIR__.'/../../../../plugin/skype', + __DIR__.'/../../../../vendor/pclzip', + __DIR__.'/../../../../web/assets/bootstrap/grunt', + __DIR__.'/../../../../web/assets/bootstrap/nuget', + __DIR__.'/../../../../web/assets/bootstrap/docs', + __DIR__.'/../../../../web/assets/bootstrap/test-infra', + ]; + + return $paths; + } + + /** + * @return array + */ + public static function getFilesToDelete() + { + $files = [ + __DIR__.'/../../../../main/admin/statistics/statistics.lib.php', + __DIR__.'/../../../../main/admin/add_users_to_group.php', + __DIR__.'/../../../../main/admin/group_add.php', + __DIR__.'/../../../../main/admin/group_edit.php', + __DIR__.'/../../../../main/admin/group_list.php', + __DIR__.'/../../../../main/admin/admin_page.class.php', + __DIR__.'/../../../../main/admin/system_management.php', + __DIR__.'/../../../../main/announcements/resources/announcements.inc.php', + __DIR__.'/../../../../main/announcements/resources/announcements_email.class.php', + __DIR__.'/../../../../main/auth/external_login/facebook-php-sdk/src/base_facebook.php', + __DIR__.'/../../../../main/auth/external_login/facebook-php-sdk/src/facebook.php', + __DIR__.'/../../../../main/auth/external_login/facebook-php-sdk/src/base_facebook.php', + __DIR__.'/../../../../main/course_description/ajax_controller.class.php', + __DIR__.'/../../../../main/course_description/controller.class.php', + __DIR__.'/../../../../main/course_description/course_description.class.php', + __DIR__.'/../../../../main/course_description/course_description_form.class.php', + __DIR__.'/../../../../main/course_description/course_description_repository.class.php', + __DIR__.'/../../../../main/course_description/course_description_type.class.php', + __DIR__.'/../../../../main/course_description/course_description_type_repository.class.php', + __DIR__.'/../../../../main/course_description/course_import.class.php', + __DIR__.'/../../../../main/course_description/csv_reader.class.php', + __DIR__.'/../../../../main/course_description/csv_writer.class.php', + __DIR__.'/../../../../main/course_description/request.class.php', + __DIR__.'/../../../../main/course_description/upload_file_form.class.php', + __DIR__.'/../../../../main/calendar/agenda.inc.php', + __DIR__.'/../../../../main/calendar/agenda.lib.php', + __DIR__.'/../../../../main/exercice/addlimits.php', + __DIR__.'/../../../../main/exercice/testcategory.class.php', + __DIR__.'/../../../../main/exercice/export/scorm/scorm_export.php', + __DIR__.'/../../../../main/exercice/testheaderpage.php', + __DIR__.'/../../../../main/inc/lib/main_api.lib.php', + //__DIR__.'/../../../../main/inc/lib/nusoap/class.soapclient.php', + __DIR__.'/../../../../main/inc/lib/nusoap/nusoap.php', + __DIR__.'/../../../../main/inc/lib/autoload.class.php', + __DIR__.'/../../../../main/inc/autoload.inc.php', + __DIR__.'/../../../../main/inc/lib/uri.class.php', + __DIR__.'/../../../../main/inc/lib/db.class.php', + __DIR__.'/../../../../main/inc/lib/xht.lib.php', + __DIR__.'/../../../../main/inc/lib/xmd.lib.php', + __DIR__.'/../../../../main/inc/lib/entity.class.php', + __DIR__.'/../../../../main/inc/lib/entity_repository.class.php', + __DIR__.'/../../../../main/inc/lib/javascript.class.php', + __DIR__.'/../../../../main/inc/lib/course.class.php', + __DIR__.'/../../../../main/inc/lib/document.class.php', + __DIR__.'/../../../../main/inc/lib/item_property.class.php', + __DIR__.'/../../../../main/inc/lib/chamilo.class.php', + __DIR__.'/../../../../main/inc/lib/events.lib.inc.php', + __DIR__.'/../../../../main/inc/lib/current_user.class.php', + __DIR__.'/../../../../main/inc/lib/current_course.class.php', + __DIR__.'/../../../../main/inc/lib/response.class.php', + __DIR__.'/../../../../main/inc/lib/result_set.class.php', + __DIR__.'/../../../../main/inc/lib/session_handler.class.php', + __DIR__.'/../../../../main/inc/lib/WCAG/WCAG_rendering.php', + __DIR__.'/../../../../main/inc/lib/zip.class.php', + __DIR__.'/../../../../main/inc/lib/student_publication.class.php', + __DIR__.'/../../../../main/inc/lib/ajax_controller.class.php', + __DIR__.'/../../../../main/inc/lib/system/closure_compiler.class.php', + __DIR__.'/../../../../main/inc/lib/system/code_utilities.class.php', + __DIR__.'/../../../../main/inc/lib/controller.class.php', + __DIR__.'/../../../../main/inc/lib/system/text/converter.class.php', + __DIR__.'/../../../../main/inc/lib/course_entity_repository.class.php', + __DIR__.'/../../../../main/inc/lib/course_entity.class.php', + __DIR__.'/../../../../main/inc/lib/cache.class.php', + __DIR__.'/../../../../main/inc/lib/system/web/request_server.class.php', + __DIR__.'/../../../../main/inc/lib/page.class.php', + __DIR__.'/../../../../main/inc/lib/sortabletable.class.php', + __DIR__.'/../../../../main/inc/lib/mail.lib.inc.php', + __DIR__.'/../../../../main/install/i_database.class.php', + __DIR__.'/../../../../main/install/install.class.php', + __DIR__.'/../../../../main/inc/latex.php', + __DIR__.'/../../../../main/inc/lib/formvalidator/Element/calendar_popup.php', + __DIR__.'/../../../../main/inc/lib/formvalidator/Element/datepickerdate.php', + __DIR__.'/../../../../main/inc/lib/formvalidator/Element/html_editor.php', + __DIR__.'/../../../../main/inc/lib/formvalidator/Element/select_language.php', + __DIR__.'/../../../../main/inc/lib/formvalidator/Element/select_theme.php', + __DIR__.'/../../../../main/inc/lib/formvalidator/Element/style_button.php', + __DIR__.'/../../../../main/inc/lib/formvalidator/Element/style_reset_button.php', + __DIR__.'/../../../../main/inc/lib/formvalidator/Element/style_submit_button.php', + __DIR__.'/../../../../main/inc/lib/formvalidator/Element/tbl_change.js.php', + __DIR__.'/../../../../main/inc/lib/SequenceManager.php', + __DIR__.'/../../../../main/inc/lib/SequenceResourceManager.php', + __DIR__.'/../../../../main/lp/resourcelinker.php', + __DIR__.'/../../../../main/lp/resourcelinker.inc.php', + __DIR__.'/../../../../main/lp/learnpath_functions.inc.php', + __DIR__.'/../../../../main/lp/lp_list_search.css', + __DIR__.'/../../../../main/tracking/toolaccess_details.php', + __DIR__.'/../../../../main/tracking/course_access_details.php', + __DIR__.'/../../../../src/Chamilo/CoreBundle/Entity/GroupRelGroup.php', + __DIR__.'/../../../../src/Chamilo/CoreBundle/Entity/GroupRelTag.php', + __DIR__.'/../../../../src/Chamilo/CoreBundle/Entity/GroupRelUser.php', + __DIR__.'/../../../../src/Chamilo/CoreBundle/Entity/Groups.php', + __DIR__.'/../../../../src/Chamilo/UserBundle/Entity/Repository/UserRepository.php', + __DIR__.'/../../../../src/Chamilo/CoreBundle/Entity/Manager/SequenceResourceManager.php', + __DIR__.'/../../../../app/Resources/public/assets/bootstrap/Gemfile', + __DIR__.'/../../../../app/Resources/public/assets/bootstrap/Gemfile.lock', + __DIR__.'/../../../../app/Resources/public/assets/bootstrap/Gruntfile.js', + __DIR__.'/../../../../app/Resources/public/assets/bootstrap/package.js', + __DIR__.'/../../../../app/Resources/public/assets/bootstrap/package.json', + __DIR__.'/../../../../web/assets/bootstrap/Gemfile', + __DIR__.'/../../../../web/assets/bootstrap/Gemfile.lock', + __DIR__.'/../../../../web/assets/bootstrap/Gruntfile.js', + __DIR__.'/../../../../web/assets/bootstrap/package.js', + __DIR__.'/../../../../web/assets/bootstrap/package.json', + ]; + + return $files; + } + + /** + * Update the basis css files. + * Avoid use the ScriptHandler::dumpCssFiles. + */ + public static function updateCss() + { + $appCss = __DIR__.'/../../../../app/Resources/public/css/'; + $newPath = __DIR__.'/../../../../web/css/'; + $cssFiles = [ + 'base.css', + 'chat.css', + 'document.css', + 'editor_content.css', + 'markdown.css', + 'print.css', + 'responsive.css', + 'scorm.css', + ]; + + $fs = new Filesystem(); + + foreach ($cssFiles as $file) { + $fs->copy($appCss.$file, $newPath.$file, true); + } + } + + /** + * @throws \Exception + */ + public static function generateDoctrineProxies() + { + $configurationFile = __DIR__.'/../../../../app/config/configuration.php'; + + if (!is_file($configurationFile)) { + echo 'app/config/configuration.php file does not exits.'.PHP_EOL; + + return; + } + + $helperSet = require __DIR__.'/../../../../cli-config.php'; + + $application = ConsoleRunner::createApplication( + $helperSet, + [ + new GenerateCommand(), + ] + ); + + $application->setAutoExit(false); + + $input = new ArrayInput([ + 'command' => 'orm:generate:proxies', + ]); + $output = new BufferedOutput(); + + $application->run($input, $output); + + echo $output->fetch(); + } + + /** + * Copied from chamilo rmdirr function. + * + * @param string $dirname + * @param bool|false $delete_only_content_in_folder + * @param bool|false $strict + * + * @return bool + */ + private static function rmdirr($dirname, $delete_only_content_in_folder = false, $strict = false) + { + $res = true; + + // A sanity check. + if (!file_exists($dirname)) { + return false; + } + // Simple delete for a file. + if (is_file($dirname) || is_link($dirname)) { + $res = unlink($dirname); + + return $res; + } + + // Loop through the folder. + $dir = dir($dirname); + // A sanity check. + $is_object_dir = is_object($dir); + if ($is_object_dir) { + while (false !== $entry = $dir->read()) { + // Skip pointers. + if ($entry == '.' || $entry == '..') { + continue; + } + + // Recurse. + if ($strict) { + $result = self::rmdirr("$dirname/$entry"); + if ($result == false) { + $res = false; + break; + } + } else { + self::rmdirr("$dirname/$entry"); + } + } + } + + // Clean up. + if ($is_object_dir) { + $dir->close(); + } + + if ($delete_only_content_in_folder == false) { + $res = rmdir($dirname); + } + + return $res; + } +} diff --git a/src/Chamilo/CoreBundle/Controller/LegacyController.php b/src/Chamilo/CoreBundle/Controller/LegacyController.php new file mode 100644 index 000000000..eb384dc21 --- /dev/null +++ b/src/Chamilo/CoreBundle/Controller/LegacyController.php @@ -0,0 +1,42 @@ + + */ +class LegacyController extends Controller +{ + public $section; + + /** + * @param string $name + * + * @return Response + */ + public function classicAction($name, Request $request) + { + // get. + $_GET = $request->query->all(); + // post. + $_POST = $request->request->all(); + + $rootDir = $this->get('kernel')->getRealRootDir(); + + $home = $this->generateUrl('home'); + $home = str_replace('web/app_dev.php/', '', $home); + $home .= 'main/'.$name; + + return $this->redirect($home); + } +} diff --git a/src/Chamilo/CoreBundle/Controller/RedirectingController.php b/src/Chamilo/CoreBundle/Controller/RedirectingController.php new file mode 100644 index 000000000..c31fc9446 --- /dev/null +++ b/src/Chamilo/CoreBundle/Controller/RedirectingController.php @@ -0,0 +1,32 @@ +getPathInfo(); + if ($pathInfo == '/_trans/') { + return; + } + $requestUri = $request->getRequestUri(); + + $url = str_replace($pathInfo, rtrim($pathInfo, ' /'), $requestUri); + + return $this->redirect($url, 301); + } +} diff --git a/src/Chamilo/CoreBundle/DependencyInjection/ChamiloCoreExtension.php b/src/Chamilo/CoreBundle/DependencyInjection/ChamiloCoreExtension.php new file mode 100644 index 000000000..46e8734cd --- /dev/null +++ b/src/Chamilo/CoreBundle/DependencyInjection/ChamiloCoreExtension.php @@ -0,0 +1,36 @@ +load('services.yml'); + $loader->load('admin.yml'); + } + + /** + * @return string + */ + public function getAlias() + { + return 'chamilo_core'; + } +} diff --git a/src/Chamilo/CoreBundle/DependencyInjection/Compiler/DoctrineEntityListenerPass.php b/src/Chamilo/CoreBundle/DependencyInjection/Compiler/DoctrineEntityListenerPass.php new file mode 100644 index 000000000..96435dff5 --- /dev/null +++ b/src/Chamilo/CoreBundle/DependencyInjection/Compiler/DoctrineEntityListenerPass.php @@ -0,0 +1,28 @@ +getDefinition('chamilo.doctrine.entity_listener_resolver'); + $services = $container->findTaggedServiceIds('doctrine.entity_listener'); + + foreach ($services as $service => $attributes) { + $definition->addMethodCall( + 'addMapping', + [$container->getDefinition($service)->getClass(), $service] + ); + } + } +} diff --git a/src/Chamilo/CoreBundle/Entity/AccessUrl.php b/src/Chamilo/CoreBundle/Entity/AccessUrl.php new file mode 100644 index 000000000..c8b4b3115 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/AccessUrl.php @@ -0,0 +1,252 @@ +tms = new \DateTime(); + $this->createdBy = 1; + } + + /** + * @return string + */ + public function __toString() + { + return (string) $this->getUrl(); + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set url. + * + * @param string $url + * + * @return AccessUrl + */ + public function setUrl($url) + { + $this->url = $url; + + return $this; + } + + /** + * Get url. + * + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * Set description. + * + * @param string $description + * + * @return AccessUrl + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * Get description. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Set active. + * + * @param int $active + * + * @return AccessUrl + */ + public function setActive($active) + { + $this->active = $active; + + return $this; + } + + /** + * Get active. + * + * @return int + */ + public function getActive() + { + return $this->active; + } + + /** + * Set createdBy. + * + * @param int $createdBy + * + * @return AccessUrl + */ + public function setCreatedBy($createdBy) + { + $this->createdBy = $createdBy; + + return $this; + } + + /** + * Get createdBy. + * + * @return int + */ + public function getCreatedBy() + { + return $this->createdBy; + } + + /** + * Set tms. + * + * @param \DateTime $tms + * + * @return AccessUrl + */ + public function setTms($tms) + { + $this->tms = $tms; + + return $this; + } + + /** + * Get tms. + * + * @return \DateTime + */ + public function getTms() + { + return $this->tms; + } + + /** + * Set urlType. + * + * @param bool $urlType + * + * @return AccessUrl + */ + public function setUrlType($urlType) + { + $this->urlType = $urlType; + + return $this; + } + + /** + * Get urlType. + * + * @return bool + */ + public function getUrlType() + { + return $this->urlType; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/AccessUrlRelCourse.php b/src/Chamilo/CoreBundle/Entity/AccessUrlRelCourse.php new file mode 100644 index 000000000..a3965fb18 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/AccessUrlRelCourse.php @@ -0,0 +1,92 @@ +id; + } + + /** + * Set url. + * + * @param $url + * + * @return AccessUrlRelCourse + */ + public function setUrl($url) + { + $this->url = $url; + + return $this; + } + + /** + * @return mixed + */ + public function getUrl() + { + return $this->url; + } + + /** + * @param $course + */ + public function setCourse($course) + { + $this->course = $course; + } + + /** + * @return mixed + */ + public function getCourse() + { + return $this->course; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/AccessUrlRelCourseCategory.php b/src/Chamilo/CoreBundle/Entity/AccessUrlRelCourseCategory.php new file mode 100644 index 000000000..035308109 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/AccessUrlRelCourseCategory.php @@ -0,0 +1,82 @@ +accessUrlId = $accessUrlId; + + return $this; + } + + /** + * Get accessUrlId. + * + * @return int + */ + public function getAccessUrlId() + { + return $this->accessUrlId; + } + + /** + * @return int + */ + public function getCourseCategoryId() + { + return $this->courseCategoryId; + } + + /** + * @param int $courseCategoryId + * + * @return $this + */ + public function setCourseCategoryId($courseCategoryId) + { + $this->courseCategoryId = $courseCategoryId; + + return $this; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/AccessUrlRelSession.php b/src/Chamilo/CoreBundle/Entity/AccessUrlRelSession.php new file mode 100644 index 000000000..2a81d6f4e --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/AccessUrlRelSession.php @@ -0,0 +1,81 @@ +accessUrlId = $accessUrlId; + + return $this; + } + + /** + * Get accessUrlId. + * + * @return int + */ + public function getAccessUrlId() + { + return $this->accessUrlId; + } + + /** + * Set sessionId. + * + * @param int $sessionId + * + * @return AccessUrlRelSession + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * Get sessionId. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/AccessUrlRelUser.php b/src/Chamilo/CoreBundle/Entity/AccessUrlRelUser.php new file mode 100644 index 000000000..383c63edd --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/AccessUrlRelUser.php @@ -0,0 +1,98 @@ +accessUrlId = $accessUrlId; + + return $this; + } + + /** + * Get accessUrlId. + * + * @return int + */ + public function getAccessUrlId() + { + return $this->accessUrlId; + } + + /** + * Set userId. + * + * @param int $userId + * + * @return AccessUrlRelUser + */ + public function setUserId($userId) + { + $this->userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/AccessUrlRelUserGroup.php b/src/Chamilo/CoreBundle/Entity/AccessUrlRelUserGroup.php new file mode 100644 index 000000000..e3752348e --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/AccessUrlRelUserGroup.php @@ -0,0 +1,102 @@ +accessUrlId = $accessUrlId; + + return $this; + } + + /** + * Get accessUrlId. + * + * @return int + */ + public function getAccessUrlId() + { + return $this->accessUrlId; + } + + /** + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * @param int $id + * + * @return AccessUrlRelUserGroup + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * @return int + */ + public function getUserGroupId() + { + return $this->userGroupId; + } + + /** + * @param int $userGroupId + * + * @return AccessUrlRelUserGroup + */ + public function setUserGroupId($userGroupId) + { + $this->userGroupId = $userGroupId; + + return $this; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Admin.php b/src/Chamilo/CoreBundle/Entity/Admin.php new file mode 100644 index 000000000..ab8f76ca3 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Admin.php @@ -0,0 +1,65 @@ +userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/AgendaEventInvitation.php b/src/Chamilo/CoreBundle/Entity/AgendaEventInvitation.php new file mode 100644 index 000000000..11a8a6284 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/AgendaEventInvitation.php @@ -0,0 +1,146 @@ + + * + * @ORM\OneToMany(targetEntity="AgendaEventInvitee", mappedBy="invitation", cascade={"persist", "remove"}, + * orphanRemoval=true) + */ + protected $invitees; + + /** + * @var User + * + * @ORM\ManyToOne(targetEntity="Chamilo\UserBundle\Entity\User", inversedBy="resourceNodes") + * @ORM\JoinColumn(name="creator_id", referencedColumnName="id", nullable=true, onDelete="CASCADE") + */ + protected $creator; + + public function __construct() + { + $this->invitees = new ArrayCollection(); + } + + public function getId(): int + { + return $this->id; + } + + public function getInvitees(): Collection + { + return $this->invitees; + } + + public function setInvitees(Collection $invitees): AgendaEventInvitation + { + $this->invitees = $invitees; + + return $this; + } + + public function addInvitee(AgendaEventInvitee $invitee): AgendaEventInvitation + { + $invitee->setInvitation($this); + $this->invitees->add($invitee); + + return $this; + } + + public function removeInviteeUser(User $user): AgendaEventInvitation + { + /** @var AgendaEventInvitee $invitee */ + $invitee = $this + ->invitees + ->filter(function (AgendaEventInvitee $invitee) use ($user) { + return $invitee->getUser() === $user; + }) + ->first(); + + if ($invitee) { + $this->invitees->removeElement($invitee); + $invitee->setInvitation(null); + } + + return $this; + } + + public function removeInvitees(): self + { + $this->invitees = new ArrayCollection(); + + return $this; + } + + public function getCreator(): User + { + return $this->creator; + } + + public function setCreator(User $creator): self + { + $this->creator = $creator; + + return $this; + } + + public function hasUserAsInvitee(User $user): bool + { + return $this->invitees->exists( + function (int $key, AgendaEventInvitee $invitee) use ($user) { + return $invitee->getUser() === $user; + } + ); + } + + public function removeInviteesNotInIdList(array $idList): self + { + $toRemove = []; + + /** @var AgendaEventInvitee $invitee */ + foreach ($this->invitees as $key => $invitee) { + if (!in_array($invitee->getUser()->getId(), $idList)) { + $toRemove[] = $key; + } + } + + foreach ($toRemove as $key) { + $this->invitees->remove($key); + } + + return $this; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/AgendaEventInvitee.php b/src/Chamilo/CoreBundle/Entity/AgendaEventInvitee.php new file mode 100644 index 000000000..898e991ae --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/AgendaEventInvitee.php @@ -0,0 +1,79 @@ +id; + } + + public function getInvitation(): ?AgendaEventInvitation + { + return $this->invitation; + } + + public function setInvitation(?AgendaEventInvitation $invitation): AgendaEventInvitee + { + $this->invitation = $invitation; + + return $this; + } + + public function getUser(): ?User + { + return $this->user; + } + + public function setUser(?User $user): AgendaEventInvitee + { + $this->user = $user; + + return $this; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/AgendaEventSubscriber.php b/src/Chamilo/CoreBundle/Entity/AgendaEventSubscriber.php new file mode 100644 index 000000000..4ea5e7bb2 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/AgendaEventSubscriber.php @@ -0,0 +1,14 @@ +maxAttendees; + } + + public function setMaxAttendees(int $maxAttendees): self + { + $this->maxAttendees = $maxAttendees; + + return $this; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/AgendaReminder.php b/src/Chamilo/CoreBundle/Entity/AgendaReminder.php new file mode 100644 index 000000000..539366f0c --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/AgendaReminder.php @@ -0,0 +1,113 @@ +sent = false; + } + + public function getId(): int + { + return $this->id; + } + + public function getType(): string + { + return $this->type; + } + + public function setType(string $type): AgendaReminder + { + $this->type = $type; + + return $this; + } + + public function getEventId(): int + { + return $this->eventId; + } + + public function setEventId(int $eventId): AgendaReminder + { + $this->eventId = $eventId; + + return $this; + } + + public function getDateInterval(): \DateInterval + { + return $this->dateInterval; + } + + public function setDateInterval(\DateInterval $dateInterval): AgendaReminder + { + $this->dateInterval = $dateInterval; + + return $this; + } + + public function isSent(): bool + { + return $this->sent; + } + + public function setSent(bool $sent): AgendaReminder + { + $this->sent = $sent; + + return $this; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/AnnouncementRelGroup.php b/src/Chamilo/CoreBundle/Entity/AnnouncementRelGroup.php new file mode 100644 index 000000000..15df591b9 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/AnnouncementRelGroup.php @@ -0,0 +1,81 @@ +groupId = $groupId; + + return $this; + } + + /** + * Get groupId. + * + * @return int + */ + public function getGroupId() + { + return $this->groupId; + } + + /** + * Set announcementId. + * + * @param int $announcementId + * + * @return AnnouncementRelGroup + */ + public function setAnnouncementId($announcementId) + { + $this->announcementId = $announcementId; + + return $this; + } + + /** + * Get announcementId. + * + * @return int + */ + public function getAnnouncementId() + { + return $this->announcementId; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Block.php b/src/Chamilo/CoreBundle/Entity/Block.php new file mode 100644 index 000000000..90234c31b --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Block.php @@ -0,0 +1,189 @@ +name = $name; + + return $this; + } + + /** + * Get name. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set description. + * + * @param string $description + * + * @return Block + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * Get description. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Set path. + * + * @param string $path + * + * @return Block + */ + public function setPath($path) + { + $this->path = $path; + + return $this; + } + + /** + * Get path. + * + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** + * Set controller. + * + * @param string $controller + * + * @return Block + */ + public function setController($controller) + { + $this->controller = $controller; + + return $this; + } + + /** + * Get controller. + * + * @return string + */ + public function getController() + { + return $this->controller; + } + + /** + * Set active. + * + * @param bool $active + * + * @return Block + */ + public function setActive($active) + { + $this->active = $active; + + return $this; + } + + /** + * Get active. + * + * @return bool + */ + public function getActive() + { + return $this->active; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/BranchSync.php b/src/Chamilo/CoreBundle/Entity/BranchSync.php new file mode 100644 index 000000000..56f23fb76 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/BranchSync.php @@ -0,0 +1,784 @@ +uniqueId = sha1(uniqid()); + $this->sslPubKey = sha1(uniqid()); + // $this->lastSyncTransDate = new \DateTime(); + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set accessUrlId. + * + * @param int $accessUrlId + * + * @return BranchSync + */ + public function setAccessUrlId($accessUrlId) + { + $this->accessUrlId = $accessUrlId; + + return $this; + } + + /** + * Get accessUrlId. + * + * @return int + */ + public function getAccessUrlId() + { + return $this->accessUrlId; + } + + /** + * Set branchName. + * + * @param string $branchName + * + * @return BranchSync + */ + public function setBranchName($branchName) + { + $this->branchName = $branchName; + + return $this; + } + + /** + * Get branchName. + * + * @return string + */ + public function getBranchName() + { + return $this->branchName; + } + + /** + * Set branchIp. + * + * @param string $branchIp + * + * @return BranchSync + */ + public function setBranchIp($branchIp) + { + $this->branchIp = $branchIp; + + return $this; + } + + /** + * Get branchIp. + * + * @return string + */ + public function getBranchIp() + { + return $this->branchIp; + } + + /** + * Set latitude. + * + * @param float $latitude + * + * @return BranchSync + */ + public function setLatitude($latitude) + { + $this->latitude = $latitude; + + return $this; + } + + /** + * Get latitude. + * + * @return float + */ + public function getLatitude() + { + return $this->latitude; + } + + /** + * Set longitude. + * + * @param float $longitude + * + * @return BranchSync + */ + public function setLongitude($longitude) + { + $this->longitude = $longitude; + + return $this; + } + + /** + * Get longitude. + * + * @return float + */ + public function getLongitude() + { + return $this->longitude; + } + + /** + * Set dwnSpeed. + * + * @param int $dwnSpeed + * + * @return BranchSync + */ + public function setDwnSpeed($dwnSpeed) + { + $this->dwnSpeed = $dwnSpeed; + + return $this; + } + + /** + * Get dwnSpeed. + * + * @return int + */ + public function getDwnSpeed() + { + return $this->dwnSpeed; + } + + /** + * Set upSpeed. + * + * @param int $upSpeed + * + * @return BranchSync + */ + public function setUpSpeed($upSpeed) + { + $this->upSpeed = $upSpeed; + + return $this; + } + + /** + * Get upSpeed. + * + * @return int + */ + public function getUpSpeed() + { + return $this->upSpeed; + } + + /** + * Set delay. + * + * @param int $delay + * + * @return BranchSync + */ + public function setDelay($delay) + { + $this->delay = $delay; + + return $this; + } + + /** + * Get delay. + * + * @return int + */ + public function getDelay() + { + return $this->delay; + } + + /** + * Set adminMail. + * + * @param string $adminMail + * + * @return BranchSync + */ + public function setAdminMail($adminMail) + { + $this->adminMail = $adminMail; + + return $this; + } + + /** + * Get adminMail. + * + * @return string + */ + public function getAdminMail() + { + return $this->adminMail; + } + + /** + * Set adminName. + * + * @param string $adminName + * + * @return BranchSync + */ + public function setAdminName($adminName) + { + $this->adminName = $adminName; + + return $this; + } + + /** + * Get adminName. + * + * @return string + */ + public function getAdminName() + { + return $this->adminName; + } + + /** + * Set adminPhone. + * + * @param string $adminPhone + * + * @return BranchSync + */ + public function setAdminPhone($adminPhone) + { + $this->adminPhone = $adminPhone; + + return $this; + } + + /** + * Get adminPhone. + * + * @return string + */ + public function getAdminPhone() + { + return $this->adminPhone; + } + + /** + * Set lastSyncTransId. + * + * @param int $lastSyncTransId + * + * @return BranchSync + */ + public function setLastSyncTransId($lastSyncTransId) + { + $this->lastSyncTransId = $lastSyncTransId; + + return $this; + } + + /** + * Get lastSyncTransId. + * + * @return int + */ + public function getLastSyncTransId() + { + return $this->lastSyncTransId; + } + + /** + * Set lastSyncTransDate. + * + * @param \DateTime $lastSyncTransDate + * + * @return BranchSync + */ + public function setLastSyncTransDate($lastSyncTransDate) + { + $this->lastSyncTransDate = $lastSyncTransDate; + + return $this; + } + + /** + * Set sslPubKey. + * + * @param string $sslPubKey + * + * @return BranchSync + */ + public function setSslPubKey($sslPubKey) + { + $this->sslPubKey = $sslPubKey; + + return $this; + } + + /** + * Get sslPubKey. + * + * @return string + */ + public function getSslPubKey() + { + return $this->sslPubKey; + } + + /** + * Set sslPubKey. + * + * @param string $branchType + * + * @return BranchSync + */ + public function setBranchType($branchType) + { + $this->branchType = $branchType; + + return $this; + } + + /** + * Get sslPubKey. + * + * @return string + */ + public function getBranchType() + { + return $this->branchType; + } + + /** + * Get lastSyncTransDate. + * + * @return \DateTime + */ + public function getLastSyncTransDate() + { + return $this->lastSyncTransDate; + } + + /** + * Set lastSyncType. + * + * @param string $lastSyncType + * + * @return BranchSync + */ + public function setLastSyncType($lastSyncType) + { + $this->lastSyncType = $lastSyncType; + + return $this; + } + + /** + * Get lastSyncType. + * + * @return string + */ + public function getLastSyncType() + { + return $this->lastSyncType; + } + + /** + * Set lft. + * + * @param int $lft + * + * @return BranchSync + */ + public function setLft($lft) + { + $this->lft = $lft; + + return $this; + } + + /** + * Get lft. + * + * @return int + */ + public function getLft() + { + return $this->lft; + } + + /** + * Set rgt. + * + * @param int $rgt + * + * @return BranchSync + */ + public function setRgt($rgt) + { + $this->rgt = $rgt; + + return $this; + } + + /** + * Get rgt. + * + * @return int + */ + public function getRgt() + { + return $this->rgt; + } + + /** + * Set lvl. + * + * @param int $lvl + * + * @return BranchSync + */ + public function setLvl($lvl) + { + $this->lvl = $lvl; + + return $this; + } + + /** + * Get lvl. + * + * @return int + */ + public function getLvl() + { + return $this->lvl; + } + + /** + * Set root. + * + * @param int $root + * + * @return BranchSync + */ + public function setRoot($root) + { + $this->root = $root; + + return $this; + } + + /** + * Get root. + * + * @return int + */ + public function getRoot() + { + return $this->root; + } + + /** + * Set parentId. + * + * @param int $parentId + * + * @return BranchSync + */ + public function setParentId($parentId) + { + $this->parentId = $parentId; + + return $this; + } + + /** + * Get parentId. + * + * @return int + */ + public function getParentId() + { + return $this->parentId; + } + + /** + * @param BranchSync $parent + * + * @return $this + */ + public function setParent(BranchSync $parent = null) + { + $this->parent = $parent; + + return $this; + } + + /** + * @return mixed + */ + public function getParent() + { + return $this->parent; + } + + /** + * @return string + */ + public function getUniqueId() + { + return $this->uniqueId; + } + + /** + * @param string $uniqueId + * + * @return $this + */ + public function setUniqueId($uniqueId) + { + $this->uniqueId = $uniqueId; + + return $this; + } + + /** + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * @param string $description + * + * @return BranchSync + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/BranchTransaction.php b/src/Chamilo/CoreBundle/Entity/BranchTransaction.php new file mode 100644 index 000000000..6f275b280 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/BranchTransaction.php @@ -0,0 +1,415 @@ +id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set transactionId. + * + * @param int $transactionId + * + * @return BranchTransaction + */ + public function setTransactionId($transactionId) + { + $this->transactionId = $transactionId; + + return $this; + } + + /** + * Get transactionId. + * + * @return int + */ + public function getTransactionId() + { + return $this->transactionId; + } + + /** + * Set branchId. + * + * @param int $branchId + * + * @return BranchTransaction + */ + public function setBranchId($branchId) + { + $this->branchId = $branchId; + + return $this; + } + + /** + * Get branchId. + * + * @return int + */ + public function getBranchId() + { + return $this->branchId; + } + + /** + * Set action. + * + * @param string $action + * + * @return BranchTransaction + */ + public function setAction($action) + { + $this->action = $action; + + return $this; + } + + /** + * Get action. + * + * @return string + */ + public function getAction() + { + return $this->action; + } + + /** + * Set itemId. + * + * @param string $itemId + * + * @return BranchTransaction + */ + public function setItemId($itemId) + { + $this->itemId = $itemId; + + return $this; + } + + /** + * Get itemId. + * + * @return string + */ + public function getItemId() + { + return $this->itemId; + } + + /** + * Set destId. + * + * @param string $destId + * + * @return BranchTransaction + */ + public function setDestId($destId) + { + $this->destId = $destId; + + return $this; + } + + /** + * Get destId. + * + * @return string + */ + public function getDestId() + { + return $this->destId; + } + + /** + * Set timeInsert. + * + * @param \DateTime $timeInsert + * + * @return BranchTransaction + */ + public function setTimeInsert($timeInsert) + { + $this->timeInsert = $timeInsert; + + return $this; + } + + /** + * Get timeInsert. + * + * @return \DateTime + */ + public function getTimeInsert() + { + return $this->timeInsert; + } + + /** + * Set timeUpdate. + * + * @param \DateTime $timeUpdate + * + * @return BranchTransaction + */ + public function setTimeUpdate($timeUpdate) + { + $this->timeUpdate = $timeUpdate; + + return $this; + } + + /** + * Get timeUpdate. + * + * @return \DateTime + */ + public function getTimeUpdate() + { + return $this->timeUpdate; + } + + /** + * @return string + */ + public function getOrigin() + { + return $this->origin; + } + + /** + * @param string $origin + * + * @return BranchTransaction + */ + public function setOrigin($origin) + { + $this->origin = $origin; + + return $this; + } + + /** + * @return string + */ + public function getExternalInfo() + { + return $this->externalInfo; + } + + /** + * @param string $externalInfo + * + * @return BranchTransaction + */ + public function setExternalInfo($externalInfo) + { + $this->externalInfo = $externalInfo; + + return $this; + } + + /** + * @return int + */ + public function getFailedAttempts() + { + return $this->failedAttempts; + } + + /** + * @param int $failedAttempts + * + * @return BranchTransaction + */ + public function setFailedAttempts($failedAttempts) + { + $this->failedAttempts = $failedAttempts; + + return $this; + } + + /** + * @return BranchSync + */ + public function getBranch() + { + return $this->branch; + } + + /** + * @param BranchSync $branch + * + * @return $this + */ + public function setBranch($branch) + { + $this->branch = $branch; + + return $this; + } + + /** + * @return Room + */ + public function getBranchTransactionStatus() + { + return $this->branchTransactionStatus; + } + + /** + * @param Room $branchTransactionStatus + * + * @return BranchTransaction + */ + public function setBranchTransactionStatus($branchTransactionStatus) + { + $this->branchTransactionStatus = $branchTransactionStatus; + + return $this; + } + + /** + * @return int + */ + public function getExternalTransactionId() + { + return $this->externalTransactionId; + } + + /** + * @param int $externalTransactionId + * + * @return BranchTransaction + */ + public function setExternalTransactionId($externalTransactionId) + { + $this->externalTransactionId = $externalTransactionId; + + return $this; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/BranchTransactionStatus.php b/src/Chamilo/CoreBundle/Entity/BranchTransactionStatus.php new file mode 100644 index 000000000..4b4b9b6b6 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/BranchTransactionStatus.php @@ -0,0 +1,65 @@ +id; + } + + /** + * Set title. + * + * @param string $title + * + * @return BranchTransactionStatus + */ + public function setTitle($title) + { + $this->title = $title; + + return $this; + } + + /** + * Get title. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Career.php b/src/Chamilo/CoreBundle/Entity/Career.php new file mode 100644 index 000000000..e3b340bf7 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Career.php @@ -0,0 +1,196 @@ +id; + } + + /** + * Set name. + * + * @param string $name + * + * @return Career + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * Get name. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set description. + * + * @param string $description + * + * @return Career + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * Get description. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Set status. + * + * @param int $status + * + * @return Career + */ + public function setStatus($status) + { + $this->status = $status; + + return $this; + } + + /** + * Get status. + * + * @return int + */ + public function getStatus() + { + return $this->status; + } + + /** + * Set createdAt. + * + * @param \DateTime $createdAt + * + * @return Career + */ + public function setCreatedAt($createdAt) + { + $this->createdAt = $createdAt; + + return $this; + } + + /** + * Get createdAt. + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + * Set updatedAt. + * + * @param \DateTime $updatedAt + * + * @return Career + */ + public function setUpdatedAt($updatedAt) + { + $this->updatedAt = $updatedAt; + + return $this; + } + + /** + * Get updatedAt. + * + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->updatedAt; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Chat.php b/src/Chamilo/CoreBundle/Entity/Chat.php new file mode 100644 index 000000000..6fa67c025 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Chat.php @@ -0,0 +1,192 @@ +id; + } + + /** + * Set fromUser. + * + * @param int $fromUser + * + * @return Chat + */ + public function setFromUser($fromUser) + { + $this->fromUser = $fromUser; + + return $this; + } + + /** + * Get fromUser. + * + * @return int + */ + public function getFromUser() + { + return $this->fromUser; + } + + /** + * Set toUser. + * + * @param int $toUser + * + * @return Chat + */ + public function setToUser($toUser) + { + $this->toUser = $toUser; + + return $this; + } + + /** + * Get toUser. + * + * @return int + */ + public function getToUser() + { + return $this->toUser; + } + + /** + * Set message. + * + * @param string $message + * + * @return Chat + */ + public function setMessage($message) + { + $this->message = $message; + + return $this; + } + + /** + * Get message. + * + * @return string + */ + public function getMessage() + { + return $this->message; + } + + /** + * Set sent. + * + * @param \DateTime $sent + * + * @return Chat + */ + public function setSent($sent) + { + $this->sent = $sent; + + return $this; + } + + /** + * Get sent. + * + * @return \DateTime + */ + public function getSent() + { + return $this->sent; + } + + /** + * Set recd. + * + * @param int $recd + * + * @return Chat + */ + public function setRecd($recd) + { + $this->recd = $recd; + + return $this; + } + + /** + * Get recd. + * + * @return int + */ + public function getRecd() + { + return $this->recd; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/ChatVideo.php b/src/Chamilo/CoreBundle/Entity/ChatVideo.php new file mode 100644 index 000000000..5074ba1e7 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/ChatVideo.php @@ -0,0 +1,165 @@ +fromUser = $fromUser; + + return $this; + } + + /** + * Get fromUser. + * + * @return int + */ + public function getFromUser() + { + return $this->fromUser; + } + + /** + * Set toUser. + * + * @param int $toUser + * + * @return ChatVideo + */ + public function setToUser($toUser) + { + $this->toUser = $toUser; + + return $this; + } + + /** + * Get toUser. + * + * @return int + */ + public function getToUser() + { + return $this->toUser; + } + + /** + * Set room_name. + * + * @param string $roomName + * + * @return ChatVideo + */ + public function setRoomName($roomName) + { + $this->roomName = $roomName; + + return $this; + } + + /** + * Get room_name. + * + * @return string + */ + public function getRoomName() + { + return $this->roomName; + } + + /** + * Set datetime. + * + * @param \DateTime $datetime + * + * @return ChatVideo + */ + public function setDatetime($datetime) + { + $this->datetime = $datetime; + + return $this; + } + + /** + * Get datetime. + * + * @return \DateTime + */ + public function getDatetime() + { + return $this->datetime; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/ClassItem.php b/src/Chamilo/CoreBundle/Entity/ClassItem.php new file mode 100644 index 000000000..e7cd9f4c8 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/ClassItem.php @@ -0,0 +1,96 @@ +code = $code; + + return $this; + } + + /** + * Get code. + * + * @return string + */ + public function getCode() + { + return $this->code; + } + + /** + * Set name. + * + * @param string $name + * + * @return ClassItem + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * Get name. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/ClassUser.php b/src/Chamilo/CoreBundle/Entity/ClassUser.php new file mode 100644 index 000000000..127c2d722 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/ClassUser.php @@ -0,0 +1,81 @@ +classId = $classId; + + return $this; + } + + /** + * Get classId. + * + * @return int + */ + public function getClassId() + { + return $this->classId; + } + + /** + * Set userId. + * + * @param int $userId + * + * @return ClassUser + */ + public function setUserId($userId) + { + $this->userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Course.php b/src/Chamilo/CoreBundle/Entity/Course.php new file mode 100644 index 000000000..c36c2cacc --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Course.php @@ -0,0 +1,1193 @@ +creationDate = new \DateTime(); + $this->users = new ArrayCollection(); + } + + /** + * @return string + */ + public function __toString() + { + return (string) $this->getTitle(); + } + + /** + * @return ArrayCollection + */ + public function getSessions() + { + return $this->sessions; + } + + /** + * @return ArrayCollection + */ + /*public function getNotebooks() + { + return $this->notebooks; + }*/ + + /** + * @return ArrayCollection + */ + /*public function getItems() + { + return $this->items; + }*/ + + /** + * @return ArrayCollection + */ + public function getTools() + { + return $this->tools; + } + + /** + * @param $tools + */ + public function setTools($tools) + { + foreach ($tools as $tool) { + $this->addTools($tool); + } + } + + public function setToolList($list) + { + $this->tools = $list; + } + + public function addTools(CTool $tool) + { + $tool->setCourse($this); + $this->tools[] = $tool; + } + + /** + * @return ArrayCollection + */ + public function getUrls() + { + return $this->urls; + } + + /** + * @param $urls + */ + public function setUrls($urls) + { + $this->urls = new ArrayCollection(); + + foreach ($urls as $url) { + $this->addUrls($url); + } + } + + public function addUrls(AccessUrlRelCourse $url) + { + $url->setCourse($this); + $this->urls[] = $url; + } + + /** + * @return ArrayCollection + */ + public function getUsers() + { + return $this->users; + } + + /** + * @return ArrayCollection + */ + public function getTeachers() + { + $criteria = Criteria::create(); + $criteria->where(Criteria::expr()->eq('status', User::COURSE_MANAGER)); + + return $this->users->matching($criteria); + } + + /** + * @return ArrayCollection + */ + public function getStudents() + { + $criteria = Criteria::create(); + $criteria->where(Criteria::expr()->eq('status', User::STUDENT)); + + return $this->users->matching($criteria); + } + + /** + * @param ArrayCollection $users + */ + public function setUsers($users) + { + $this->users = new ArrayCollection(); + + foreach ($users as $user) { + $this->addUsers($user); + } + } + + public function addUsers(CourseRelUser $courseRelUser) + { + $courseRelUser->setCourse($this); + + if (!$this->hasSubscription($courseRelUser)) { + $this->users[] = $courseRelUser; + } + } + + /** + * @return bool + */ + public function hasUser(User $user) + { + $criteria = Criteria::create()->where( + Criteria::expr()->eq("user", $user) + ); + + return $this->getUsers()->matching($criteria)->count() > 0; + } + + /** + * @return bool + */ + public function hasStudent(User $user) + { + $criteria = Criteria::create()->where( + Criteria::expr()->eq("user", $user) + ); + + return $this->getStudents()->matching($criteria)->count() > 0; + } + + /** + * @return bool + */ + public function hasTeacher(User $user) + { + $criteria = Criteria::create()->where( + Criteria::expr()->eq("user", $user) + ); + + return $this->getTeachers()->matching($criteria)->count() > 0; + } + + /** + * Remove $user. + */ + public function removeUsers(CourseRelUser $user) + { + foreach ($this->users as $key => $value) { + if ($value->getId() == $user->getId()) { + unset($this->users[$key]); + } + } + } + + public function addTeacher(User $user) + { + $this->addUser($user, 0, "Trainer", User::COURSE_MANAGER); + } + + public function addStudent(User $user) + { + $this->addUser($user, 0, "", User::STUDENT); + } + + /** + * Set id. + * + * @return int + */ + public function setId($id) + { + $this->id = $id; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set code. + * + * @param string $code + * + * @return Course + */ + public function setCode($code) + { + $this->code = $code; + $this->visualCode = $code; + $this->directory = $code; + + return $this; + } + + /** + * Get code. + * + * @return string + */ + public function getCode() + { + return $this->code; + } + + /** + * Set directory. + * + * @param string $directory + * + * @return Course + */ + public function setDirectory($directory) + { + $this->directory = $directory; + + return $this; + } + + /** + * Get directory. + * + * @return string + */ + public function getDirectory() + { + return $this->directory; + } + + /** + * Set courseLanguage. + * + * @param string $courseLanguage + * + * @return Course + */ + public function setCourseLanguage($courseLanguage) + { + $this->courseLanguage = $courseLanguage; + + return $this; + } + + /** + * Get courseLanguage. + * + * @return string + */ + public function getCourseLanguage() + { + return $this->courseLanguage; + } + + /** + * Set title. + * + * @param string $title + * + * @return Course + */ + public function setTitle($title) + { + $this->title = $title; + + return $this; + } + + /** + * Get title. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + public function getName() + { + return $this->getTitle(); + } + + /** + * @return string + */ + public function getTitleAndCode() + { + return $this->getTitle().' ('.$this->getCode().')'; + } + + /** + * Set description. + * + * @param string $description + * + * @return Course + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * Get description. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Set categoryCode. + * + * @param string $categoryCode + * + * @return Course + */ + public function setCategoryCode($categoryCode) + { + $this->categoryCode = $categoryCode; + + return $this; + } + + /** + * Get categoryCode. + * + * @return string + */ + public function getCategoryCode() + { + return $this->categoryCode; + } + + /** + * Set visibility. + * + * @param bool $visibility + * + * @return Course + */ + public function setVisibility($visibility) + { + $this->visibility = $visibility; + + return $this; + } + + /** + * Get visibility. + * + * @return bool + */ + public function getVisibility() + { + return $this->visibility; + } + + /** + * Set showScore. + * + * @param int $showScore + * + * @return Course + */ + public function setShowScore($showScore) + { + $this->showScore = $showScore; + + return $this; + } + + /** + * Get showScore. + * + * @return int + */ + public function getShowScore() + { + return $this->showScore; + } + + /** + * Set tutorName. + * + * @param string $tutorName + * + * @return Course + */ + public function setTutorName($tutorName) + { + $this->tutorName = $tutorName; + + return $this; + } + + /** + * Get tutorName. + * + * @return string + */ + public function getTutorName() + { + return $this->tutorName; + } + + /** + * Set visualCode. + * + * @param string $visualCode + * + * @return Course + */ + public function setVisualCode($visualCode) + { + $this->visualCode = $visualCode; + + return $this; + } + + /** + * Get visualCode. + * + * @return string + */ + public function getVisualCode() + { + return $this->visualCode; + } + + /** + * Set departmentName. + * + * @param string $departmentName + * + * @return Course + */ + public function setDepartmentName($departmentName) + { + $this->departmentName = $departmentName; + + return $this; + } + + /** + * Get departmentName. + * + * @return string + */ + public function getDepartmentName() + { + return $this->departmentName; + } + + /** + * Set departmentUrl. + * + * @param string $departmentUrl + * + * @return Course + */ + public function setDepartmentUrl($departmentUrl) + { + $this->departmentUrl = $departmentUrl; + + return $this; + } + + /** + * Get departmentUrl. + * + * @return string + */ + public function getDepartmentUrl() + { + return $this->departmentUrl; + } + + /** + * Set diskQuota. + * + * @param int $diskQuota + * + * @return Course + */ + public function setDiskQuota($diskQuota) + { + $this->diskQuota = intval($diskQuota); + + return $this; + } + + /** + * Get diskQuota. + * + * @return int + */ + public function getDiskQuota() + { + return $this->diskQuota; + } + + /** + * Set lastVisit. + * + * @param \DateTime $lastVisit + * + * @return Course + */ + public function setLastVisit($lastVisit) + { + $this->lastVisit = $lastVisit; + + return $this; + } + + /** + * Get lastVisit. + * + * @return \DateTime + */ + public function getLastVisit() + { + return $this->lastVisit; + } + + /** + * Set lastEdit. + * + * @param \DateTime $lastEdit + * + * @return Course + */ + public function setLastEdit($lastEdit) + { + $this->lastEdit = $lastEdit; + + return $this; + } + + /** + * Get lastEdit. + * + * @return \DateTime + */ + public function getLastEdit() + { + return $this->lastEdit; + } + + /** + * Set creationDate. + * + * @param \DateTime $creationDate + * + * @return Course + */ + public function setCreationDate($creationDate) + { + $this->creationDate = $creationDate; + + return $this; + } + + /** + * Get creationDate. + * + * @return \DateTime + */ + public function getCreationDate() + { + return $this->creationDate; + } + + /** + * Set expirationDate. + * + * @param \DateTime $expirationDate + * + * @return Course + */ + public function setExpirationDate($expirationDate) + { + $this->expirationDate = $expirationDate; + + return $this; + } + + /** + * Get expirationDate. + * + * @return \DateTime + */ + public function getExpirationDate() + { + return $this->expirationDate; + } + + /** + * Set subscribe. + * + * @param bool $subscribe + * + * @return Course + */ + public function setSubscribe($subscribe) + { + $this->subscribe = boolval($subscribe); + + return $this; + } + + /** + * Get subscribe. + * + * @return bool + */ + public function getSubscribe() + { + return $this->subscribe; + } + + /** + * Set unsubscribe. + * + * @param bool $unsubscribe + * + * @return Course + */ + public function setUnsubscribe($unsubscribe) + { + $this->unsubscribe = boolval($unsubscribe); + + return $this; + } + + /** + * Get unsubscribe. + * + * @return bool + */ + public function getUnsubscribe() + { + return $this->unsubscribe; + } + + /** + * Set registrationCode. + * + * @param string $registrationCode + * + * @return Course + */ + public function setRegistrationCode($registrationCode) + { + $this->registrationCode = $registrationCode; + + return $this; + } + + /** + * Get registrationCode. + * + * @return string + */ + public function getRegistrationCode() + { + return $this->registrationCode; + } + + /** + * Set legal. + * + * @param string $legal + * + * @return Course + */ + public function setLegal($legal) + { + $this->legal = $legal; + + return $this; + } + + /** + * Get legal. + * + * @return string + */ + public function getLegal() + { + return $this->legal; + } + + /** + * Set activateLegal. + * + * @param int $activateLegal + * + * @return Course + */ + public function setActivateLegal($activateLegal) + { + $this->activateLegal = $activateLegal; + + return $this; + } + + /** + * Get activateLegal. + * + * @return int + */ + public function getActivateLegal() + { + return $this->activateLegal; + } + + /** + * Set courseTypeId. + * + * @param int $courseTypeId + * + * @return Course + */ + public function setCourseTypeId($courseTypeId) + { + $this->courseTypeId = $courseTypeId; + + return $this; + } + + /** + * Get courseTypeId. + * + * @return int + */ + public function getCourseTypeId() + { + return $this->courseTypeId; + } + + /** + * @return Room + */ + public function getRoom() + { + return $this->room; + } + + /** + * @param Room $room + * + * @return Course + */ + public function setRoom($room) + { + $this->room = $room; + + return $this; + } + + /** + * @return bool + */ + public function isActive() + { + $activeVisibilityList = [ + self::REGISTERED, + self::OPEN_PLATFORM, + self::OPEN_WORLD, + ]; + + return in_array($this->visibility, $activeVisibilityList); + } + + /** + * Anybody can see this course. + * + * @return bool + */ + public function isPublic() + { + return $this->visibility == self::OPEN_WORLD; + } + + /** + * @return array + */ + public static function getStatusList() + { + return [ + self::CLOSED => 'Closed', + self::REGISTERED => 'Registered', + self::OPEN_PLATFORM => 'Open platform', + self::OPEN_WORLD => 'Open world', + self::HIDDEN => 'Hidden', + ]; + } + + /** + * @return Session + */ + public function getCurrentSession() + { + return $this->currentSession; + } + + /** + * @return $this + */ + public function setCurrentSession(Session $session) + { + // If the session is registered in the course session list. + if ($this->getSessions()->contains($session->getId())) { + $this->currentSession = $session; + } + + return $this; + } + + /** + * @return bool + */ + protected function hasSubscription(CourseRelUser $subscription) + { + if ($this->getUsers()->count()) { + $criteria = Criteria::create()->where( + Criteria::expr()->eq('user', $subscription->getUser()) + )->andWhere( + Criteria::expr()->eq('status', $subscription->getStatus()) + )->andWhere( + Criteria::expr()->eq('relationType', $subscription->getRelationType()) + ); + + $relation = $this->getUsers()->matching($criteria); + + return $relation->count() > 0; + } + + return false; + } + + /** + * @param string $relationType + * @param string $role + * @param string $status + */ + protected function addUser(User $user, $relationType, $role, $status) + { + $courseRelUser = new CourseRelUser(); + $courseRelUser->setCourse($this); + $courseRelUser->setUser($user); + $courseRelUser->setRelationType($relationType); + $courseRelUser->setRole($role); + $courseRelUser->setStatus($status); + $this->addUsers($courseRelUser); + } +} diff --git a/src/Chamilo/CoreBundle/Entity/CourseCategory.php b/src/Chamilo/CoreBundle/Entity/CourseCategory.php new file mode 100644 index 000000000..3417a0f64 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/CourseCategory.php @@ -0,0 +1,270 @@ +name); + + return "$name ({$this->code})"; + } + + /** + * Set name. + * + * @param string $name + * + * @return CourseCategory + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * Get name. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set code. + * + * @param string $code + * + * @return CourseCategory + */ + public function setCode($code) + { + $this->code = $code; + + return $this; + } + + /** + * Get code. + * + * @return string + */ + public function getCode() + { + return $this->code; + } + + /** + * Set parentId. + * + * @param string $parentId + * + * @return CourseCategory + */ + public function setParentId($parentId) + { + $this->parentId = $parentId; + + return $this; + } + + /** + * Get parentId. + * + * @return string + */ + public function getParentId() + { + return $this->parentId; + } + + /** + * Set treePos. + * + * @param int $treePos + * + * @return CourseCategory + */ + public function setTreePos($treePos) + { + $this->treePos = $treePos; + + return $this; + } + + /** + * Get treePos. + * + * @return int + */ + public function getTreePos() + { + return $this->treePos; + } + + /** + * Set childrenCount. + * + * @param int $childrenCount + * + * @return CourseCategory + */ + public function setChildrenCount($childrenCount) + { + $this->childrenCount = $childrenCount; + + return $this; + } + + /** + * Get childrenCount. + * + * @return int + */ + public function getChildrenCount() + { + return $this->childrenCount; + } + + /** + * Set authCourseChild. + * + * @param string $authCourseChild + * + * @return CourseCategory + */ + public function setAuthCourseChild($authCourseChild) + { + $this->authCourseChild = $authCourseChild; + + return $this; + } + + /** + * Get authCourseChild. + * + * @return string + */ + public function getAuthCourseChild() + { + return $this->authCourseChild; + } + + /** + * Set authCatChild. + * + * @param string $authCatChild + * + * @return CourseCategory + */ + public function setAuthCatChild($authCatChild) + { + $this->authCatChild = $authCatChild; + + return $this; + } + + /** + * Get authCatChild. + * + * @return string + */ + public function getAuthCatChild() + { + return $this->authCatChild; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/CourseModule.php b/src/Chamilo/CoreBundle/Entity/CourseModule.php new file mode 100644 index 000000000..f8fabdb86 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/CourseModule.php @@ -0,0 +1,220 @@ +name = $name; + + return $this; + } + + /** + * Get name. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set link. + * + * @param string $link + * + * @return CourseModule + */ + public function setLink($link) + { + $this->link = $link; + + return $this; + } + + /** + * Get link. + * + * @return string + */ + public function getLink() + { + return $this->link; + } + + /** + * Set image. + * + * @param string $image + * + * @return CourseModule + */ + public function setImage($image) + { + $this->image = $image; + + return $this; + } + + /** + * Get image. + * + * @return string + */ + public function getImage() + { + return $this->image; + } + + /** + * Set row. + * + * @param int $row + * + * @return CourseModule + */ + public function setRow($row) + { + $this->row = $row; + + return $this; + } + + /** + * Get row. + * + * @return int + */ + public function getRow() + { + return $this->row; + } + + /** + * Set column. + * + * @param int $column + * + * @return CourseModule + */ + public function setColumn($column) + { + $this->column = $column; + + return $this; + } + + /** + * Get column. + * + * @return int + */ + public function getColumn() + { + return $this->column; + } + + /** + * Set position. + * + * @param string $position + * + * @return CourseModule + */ + public function setPosition($position) + { + $this->position = $position; + + return $this; + } + + /** + * Get position. + * + * @return string + */ + public function getPosition() + { + return $this->position; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/CourseRelClass.php b/src/Chamilo/CoreBundle/Entity/CourseRelClass.php new file mode 100644 index 000000000..d74b7f192 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/CourseRelClass.php @@ -0,0 +1,81 @@ +courseCode = $courseCode; + + return $this; + } + + /** + * Get courseCode. + * + * @return string + */ + public function getCourseCode() + { + return $this->courseCode; + } + + /** + * Set classId. + * + * @param int $classId + * + * @return CourseRelClass + */ + public function setClassId($classId) + { + $this->classId = $classId; + + return $this; + } + + /** + * Get classId. + * + * @return int + */ + public function getClassId() + { + return $this->classId; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/CourseRelUser.php b/src/Chamilo/CoreBundle/Entity/CourseRelUser.php new file mode 100644 index 000000000..d9ad822f1 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/CourseRelUser.php @@ -0,0 +1,328 @@ +userCourseCat = 0; + } + + /** + * @return string + */ + public function __toString() + { + return (string) $this->getCourse()->getCode(); + } + + /** + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * @param int $id + */ + public function setId($id) + { + $this->id = $id; + } + + /** + * @return $this + */ + public function setCourse(Course $course) + { + $this->course = $course; + + return $this; + } + + /** + * Get Course. + * + * @return Course + */ + public function getCourse() + { + return $this->course; + } + + /** + * @param User $user + * + * @return $this + */ + public function setUser($user) + { + $this->user = $user; + + return $this; + } + + /** + * Get User. + * + * @return User + */ + public function getUser() + { + return $this->user; + } + + /** + * Set relationType. + * + * @param int $relationType + * + * @return CourseRelUser + */ + public function setRelationType($relationType) + { + $this->relationType = $relationType; + + return $this; + } + + /** + * Get relationType. + * + * @return int + */ + public function getRelationType() + { + return $this->relationType; + } + + /** + * Set status. + * + * @param bool $status + * + * @return CourseRelUser + */ + public function setStatus($status) + { + $this->status = $status; + + return $this; + } + + /** + * Get status. + * + * @return bool + */ + public function getStatus() + { + return $this->status; + } + + /** + * Set sort. + * + * @param int $sort + * + * @return CourseRelUser + */ + public function setSort($sort) + { + $this->sort = $sort; + + return $this; + } + + /** + * Get sort. + * + * @return int + */ + public function getSort() + { + return $this->sort; + } + + /** + * @return bool + */ + public function isTutor() + { + return $this->tutor; + } + + /** + * @param bool $tutor + */ + public function setTutor($tutor) + { + $this->tutor = $tutor; + } + + /** + * Set userCourseCat. + * + * @param int $userCourseCat + * + * @return CourseRelUser + */ + public function setUserCourseCat($userCourseCat) + { + $this->userCourseCat = $userCourseCat; + + return $this; + } + + /** + * Get userCourseCat. + * + * @return int + */ + public function getUserCourseCat() + { + return $this->userCourseCat; + } + + /** + * Set legalAgreement. + * + * @param int $legalAgreement + * + * @return CourseRelUser + */ + public function setLegalAgreement($legalAgreement) + { + $this->legalAgreement = $legalAgreement; + + return $this; + } + + /** + * Get legalAgreement. + * + * @return int + */ + public function getLegalAgreement() + { + return $this->legalAgreement; + } + + /** + * Get relation_type list. + * + * @deprecated + * + * @return array + */ + public static function getRelationTypeList() + { + return [ + '0' => '', + COURSE_RELATION_TYPE_RRHH => 'drh', + ]; + } + + /** + * Get status list. + * + * @return array + */ + public static function getStatusList() + { + return [ + User::COURSE_MANAGER => 'Teacher', + User::STUDENT => 'Student', + //User::DRH => 'DRH' + ]; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/CourseRelUserCatalogue.php b/src/Chamilo/CoreBundle/Entity/CourseRelUserCatalogue.php new file mode 100644 index 000000000..51864c9e0 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/CourseRelUserCatalogue.php @@ -0,0 +1,172 @@ +getCourse()->getCode(); + } + + /** + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * @param int $id + */ + public function setId($id) + { + $this->id = $id; + } + + /** + * @return $this + */ + public function setCourse(Course $course) + { + $this->course = $course; + + return $this; + } + + /** + * Get Course. + * + * @return Course + */ + public function getCourse() + { + return $this->course; + } + + /** + * @param $user + * + * @return $this + */ + public function setUser($user) + { + $this->user = $user; + + return $this; + } + + /** + * Get User. + * + * @return User + */ + public function getUser() + { + return $this->user; + } + + /** + * Set relationType. + * + * @param int $relationType + * + * @return CourseRelUserCatalogue + */ + public function setRelationType($relationType) + { + $this->relationType = $relationType; + + return $this; + } + + /** + * Get relationType. + * + * @return int + */ + public function getRelationType() + { + return $this->relationType; + } + + /** + * Set visible. + * + * @param bool $visible + * + * @return CourseRelUserCatalogue + */ + public function setVisible($visible) + { + $this->visible = $visible; + + return $this; + } + + /** + * Get visible. + * + * @return bool + */ + public function getVisible() + { + return $this->visible; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/CourseRequest.php b/src/Chamilo/CoreBundle/Entity/CourseRequest.php new file mode 100644 index 000000000..06969ab5b --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/CourseRequest.php @@ -0,0 +1,532 @@ +code = $code; + + return $this; + } + + /** + * Get code. + * + * @return string + */ + public function getCode() + { + return $this->code; + } + + /** + * Set userId. + * + * @param int $userId + * + * @return CourseRequest + */ + public function setUserId($userId) + { + $this->userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set directory. + * + * @param string $directory + * + * @return CourseRequest + */ + public function setDirectory($directory) + { + $this->directory = $directory; + + return $this; + } + + /** + * Get directory. + * + * @return string + */ + public function getDirectory() + { + return $this->directory; + } + + /** + * Set dbName. + * + * @param string $dbName + * + * @return CourseRequest + */ + public function setDbName($dbName) + { + $this->dbName = $dbName; + + return $this; + } + + /** + * Get dbName. + * + * @return string + */ + public function getDbName() + { + return $this->dbName; + } + + /** + * Set courseLanguage. + * + * @param string $courseLanguage + * + * @return CourseRequest + */ + public function setCourseLanguage($courseLanguage) + { + $this->courseLanguage = $courseLanguage; + + return $this; + } + + /** + * Get courseLanguage. + * + * @return string + */ + public function getCourseLanguage() + { + return $this->courseLanguage; + } + + /** + * Set title. + * + * @param string $title + * + * @return CourseRequest + */ + public function setTitle($title) + { + $this->title = $title; + + return $this; + } + + /** + * Get title. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set description. + * + * @param string $description + * + * @return CourseRequest + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * Get description. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Set categoryCode. + * + * @param string $categoryCode + * + * @return CourseRequest + */ + public function setCategoryCode($categoryCode) + { + $this->categoryCode = $categoryCode; + + return $this; + } + + /** + * Get categoryCode. + * + * @return string + */ + public function getCategoryCode() + { + return $this->categoryCode; + } + + /** + * Set tutorName. + * + * @param string $tutorName + * + * @return CourseRequest + */ + public function setTutorName($tutorName) + { + $this->tutorName = $tutorName; + + return $this; + } + + /** + * Get tutorName. + * + * @return string + */ + public function getTutorName() + { + return $this->tutorName; + } + + /** + * Set visualCode. + * + * @param string $visualCode + * + * @return CourseRequest + */ + public function setVisualCode($visualCode) + { + $this->visualCode = $visualCode; + + return $this; + } + + /** + * Get visualCode. + * + * @return string + */ + public function getVisualCode() + { + return $this->visualCode; + } + + /** + * Set requestDate. + * + * @param \DateTime $requestDate + * + * @return CourseRequest + */ + public function setRequestDate($requestDate) + { + $this->requestDate = $requestDate; + + return $this; + } + + /** + * Get requestDate. + * + * @return \DateTime + */ + public function getRequestDate() + { + return $this->requestDate; + } + + /** + * Set objetives. + * + * @param string $objetives + * + * @return CourseRequest + */ + public function setObjetives($objetives) + { + $this->objetives = $objetives; + + return $this; + } + + /** + * Get objetives. + * + * @return string + */ + public function getObjetives() + { + return $this->objetives; + } + + /** + * Set targetAudience. + * + * @param string $targetAudience + * + * @return CourseRequest + */ + public function setTargetAudience($targetAudience) + { + $this->targetAudience = $targetAudience; + + return $this; + } + + /** + * Get targetAudience. + * + * @return string + */ + public function getTargetAudience() + { + return $this->targetAudience; + } + + /** + * Set status. + * + * @param int $status + * + * @return CourseRequest + */ + public function setStatus($status) + { + $this->status = $status; + + return $this; + } + + /** + * Get status. + * + * @return int + */ + public function getStatus() + { + return $this->status; + } + + /** + * Set info. + * + * @param int $info + * + * @return CourseRequest + */ + public function setInfo($info) + { + $this->info = $info; + + return $this; + } + + /** + * Get info. + * + * @return int + */ + public function getInfo() + { + return $this->info; + } + + /** + * Set exemplaryContent. + * + * @param int $exemplaryContent + * + * @return CourseRequest + */ + public function setExemplaryContent($exemplaryContent) + { + $this->exemplaryContent = $exemplaryContent; + + return $this; + } + + /** + * Get exemplaryContent. + * + * @return int + */ + public function getExemplaryContent() + { + return $this->exemplaryContent; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/CourseType.php b/src/Chamilo/CoreBundle/Entity/CourseType.php new file mode 100644 index 000000000..4d6f99246 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/CourseType.php @@ -0,0 +1,158 @@ +name = $name; + + return $this; + } + + /** + * Get name. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set translationVar. + * + * @param string $translationVar + * + * @return CourseType + */ + public function setTranslationVar($translationVar) + { + $this->translationVar = $translationVar; + + return $this; + } + + /** + * Get translationVar. + * + * @return string + */ + public function getTranslationVar() + { + return $this->translationVar; + } + + /** + * Set description. + * + * @param string $description + * + * @return CourseType + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * Get description. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Set props. + * + * @param string $props + * + * @return CourseType + */ + public function setProps($props) + { + $this->props = $props; + + return $this; + } + + /** + * Get props. + * + * @return string + */ + public function getProps() + { + return $this->props; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/EventEmailTemplate.php b/src/Chamilo/CoreBundle/Entity/EventEmailTemplate.php new file mode 100644 index 000000000..03e3811bf --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/EventEmailTemplate.php @@ -0,0 +1,189 @@ +message = $message; + + return $this; + } + + /** + * Get message. + * + * @return string + */ + public function getMessage() + { + return $this->message; + } + + /** + * Set subject. + * + * @param string $subject + * + * @return EventEmailTemplate + */ + public function setSubject($subject) + { + $this->subject = $subject; + + return $this; + } + + /** + * Get subject. + * + * @return string + */ + public function getSubject() + { + return $this->subject; + } + + /** + * Set eventTypeName. + * + * @param string $eventTypeName + * + * @return EventEmailTemplate + */ + public function setEventTypeName($eventTypeName) + { + $this->eventTypeName = $eventTypeName; + + return $this; + } + + /** + * Get eventTypeName. + * + * @return string + */ + public function getEventTypeName() + { + return $this->eventTypeName; + } + + /** + * Set activated. + * + * @param bool $activated + * + * @return EventEmailTemplate + */ + public function setActivated($activated) + { + $this->activated = $activated; + + return $this; + } + + /** + * Get activated. + * + * @return bool + */ + public function getActivated() + { + return $this->activated; + } + + /** + * Set languageId. + * + * @param int $languageId + * + * @return EventEmailTemplate + */ + public function setLanguageId($languageId) + { + $this->languageId = $languageId; + + return $this; + } + + /** + * Get languageId. + * + * @return int + */ + public function getLanguageId() + { + return $this->languageId; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/EventSent.php b/src/Chamilo/CoreBundle/Entity/EventSent.php new file mode 100644 index 000000000..7e581b12f --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/EventSent.php @@ -0,0 +1,127 @@ +userFrom = $userFrom; + + return $this; + } + + /** + * Get userFrom. + * + * @return int + */ + public function getUserFrom() + { + return $this->userFrom; + } + + /** + * Set userTo. + * + * @param int $userTo + * + * @return EventSent + */ + public function setUserTo($userTo) + { + $this->userTo = $userTo; + + return $this; + } + + /** + * Get userTo. + * + * @return int + */ + public function getUserTo() + { + return $this->userTo; + } + + /** + * Set eventTypeName. + * + * @param string $eventTypeName + * + * @return EventSent + */ + public function setEventTypeName($eventTypeName) + { + $this->eventTypeName = $eventTypeName; + + return $this; + } + + /** + * Get eventTypeName. + * + * @return string + */ + public function getEventTypeName() + { + return $this->eventTypeName; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/ExtraField.php b/src/Chamilo/CoreBundle/Entity/ExtraField.php new file mode 100644 index 000000000..2305fcc6a --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/ExtraField.php @@ -0,0 +1,504 @@ +visibleToOthers = false; + $this->visibleToSelf = false; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * @return int + */ + public function getExtraFieldType() + { + return $this->extraFieldType; + } + + /** + * @param int $extraFieldType + * + * @return $this + */ + public function setExtraFieldType($extraFieldType) + { + $this->extraFieldType = $extraFieldType; + + return $this; + } + + /** + * @return int + */ + public function getFieldType() + { + return $this->fieldType; + } + + /** + * @param int $fieldType + * + * @return $this + */ + public function setFieldType($fieldType) + { + $this->fieldType = $fieldType; + + return $this; + } + + /** + * @return string + */ + public function getVariable() + { + return $this->variable; + } + + /** + * @param string $variable + * + * @return $this + */ + public function setVariable($variable) + { + $this->variable = $variable; + + return $this; + } + + /** + * @param bool $translated Optional. Whether translate the display text + * + * @return string + */ + public function getDisplayText($translated = true) + { + if ($translated) { + return \ExtraField::translateDisplayName($this->variable, $this->displayText); + } + + return $this->displayText; + } + + /** + * @param string $displayText + * + * @return $this + */ + public function setDisplayText($displayText) + { + $this->displayText = $displayText; + + return $this; + } + + /** + * @return string + */ + public function getDefaultValue() + { + return $this->defaultValue; + } + + /** + * @param string $defaultValue + * + * @return $this + */ + public function setDefaultValue($defaultValue) + { + $this->defaultValue = $defaultValue; + + return $this; + } + + /** + * @return int + */ + public function getFieldOrder() + { + return $this->fieldOrder; + } + + /** + * @param int $fieldOrder + * + * @return $this + */ + public function setFieldOrder($fieldOrder) + { + $this->fieldOrder = $fieldOrder; + + return $this; + } + + /** + * @return bool + */ + public function isChangeable() + { + return $this->changeable; + } + + /** + * @param bool $changeable + * + * @return $this + */ + public function setChangeable($changeable) + { + $this->changeable = $changeable; + + return $this; + } + + /** + * @return bool + */ + public function isFilter() + { + return $this->filter; + } + + /** + * @param bool $filter + * + * @return $this + */ + public function setFilter($filter) + { + $this->filter = $filter; + + return $this; + } + + /** + * @return bool + */ + public function isVisibleToSelf() + { + return $this->visibleToSelf; + } + + /** + * @param bool $visibleToSelf + * + * @return ExtraField + */ + public function setVisibleToSelf($visibleToSelf) + { + $this->visibleToSelf = $visibleToSelf; + + return $this; + } + + /** + * @return bool + */ + public function isVisibleToOthers() + { + return $this->visibleToOthers; + } + + /** + * @param bool $visibleToOthers + * + * @return ExtraField + */ + public function setVisibleToOthers($visibleToOthers) + { + $this->visibleToOthers = $visibleToOthers; + + return $this; + } + + /** + * @return string + */ + public function getTypeToString() + { + switch ($this->type) { + case \ExtraField::FIELD_TYPE_TEXT: + case \ExtraField::FIELD_TYPE_TEXTAREA: + return 'text'; + case \ExtraField::FIELD_TYPE_RADIO: + case \ExtraField::FIELD_TYPE_SELECT: + return 'choice'; + default: + return 'text'; + } + } + + /** + * Retreives and returns the value stored in this extra field for an item. + * + * @param $itemId string|int the item identifier + * + * @return mixed|null the value if found, null if not found + */ + public function getValueForItem($itemId) + { + $values = Database::getManager()->getRepository( + "ChamiloCoreBundle:ExtraFieldValues" + )->matching( + Criteria::create()->where( + Criteria::expr()->eq('field', $this) + )->andWhere( + Criteria::expr()->eq('itemId', $itemId) + ) + ); + + return count($values) === 1 ? $values[0] : null; + } + + /** + * Retreives and returns the value stored in this extra field for each item. + * + * @return array itemId => value + */ + public function getValueForEachItem() + { + $values = []; + /** @var ExtraFieldValues $value */ + foreach (Database::getManager()->getRepository( + "ChamiloCoreBundle:ExtraFieldValues" + )->matching( + Criteria::create()->where( + Criteria::expr()->eq('field', $this) + ) + ) as $value) { + $values[$value->getItemId()] = $value->getValue(); + } + + return $values; + } + + /** + * Retreives and returns the value stored in each extra field for each item. + * + * @param ExtraField[] $extraFields + * @param int[] $itemIds + * + * @return array itemId => [ fieldId => value ] + */ + public static function getValueForEachExtraFieldForEachItem($extraFields, $itemIds) + { + $values = []; + /** @var ExtraFieldValues $value */ + foreach (Database::getManager()->getRepository( + "ChamiloCoreBundle:ExtraFieldValues" + )->matching( + Criteria::create()->where( + Criteria::expr()->in('field', $extraFields) + )->andWhere( + Criteria::expr()->in('itemId', $itemIds) + ) + ) as $value) { + $itemId = $value->getItemId(); + if (!array_key_exists($itemId, $values)) { + $values[$itemId] = []; + } + $values[$itemId][$value->getField()->getId()] = $value->getValue(); + } + + return $values; + } + + /** + * Retreives extra fields from a list of variables. + * + * @param string[] $variables extra field variables + * @param int $extraFieldType such as self::COURSE_FIELD_TYPE + * + * @return ExtraField[] found extra fields + */ + public static function getExtraFieldsFromVariables($variables, $extraFieldType) + { + /** @var ExtraField[] $extraFields */ + $extraFields = Database::getManager()->getRepository("ChamiloCoreBundle:ExtraField")->matching( + Criteria::create()->where( + Criteria::expr()->eq('extraFieldType', $extraFieldType) + )->andWhere( + Criteria::expr()->in('variable', $variables) + ) + ); + + return $extraFields; + } + + /** + * Retreives and sorts extra fields from a list of variables. + * + * @param string[] $variables extra field variables + * @param int $extraFieldType such as self::COURSE_FIELD_TYPE + * + * @return ExtraField[] the sorted extra fields, in the same order as the variables + */ + public static function getExtraFieldsFromVariablesOrdered($variables, $extraFieldType) + { + /** @var ExtraField[] $sortedExtraFields */ + $sortedExtraFields = []; + /** @var ExtraField[] $extraFields */ + $extraFields = self::getExtraFieldsFromVariables($variables, $extraFieldType); + foreach ($variables as $variable) { + foreach ($extraFields as $extraField) { + if ($extraField->getVariable() === $variable) { + $sortedExtraFields[] = $extraField; + break; + } + } + } + + return $sortedExtraFields; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/ExtraFieldOptionRelFieldOption.php b/src/Chamilo/CoreBundle/Entity/ExtraFieldOptionRelFieldOption.php new file mode 100644 index 000000000..8f49501ac --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/ExtraFieldOptionRelFieldOption.php @@ -0,0 +1,161 @@ +id; + } + + /** + * Set fieldId. + * + * @param int $fieldId + * + * @return ExtraFieldOptionRelFieldOption + */ + public function setFieldId($fieldId) + { + $this->fieldId = $fieldId; + + return $this; + } + + /** + * Get fieldId. + * + * @return int + */ + public function getFieldId() + { + return $this->fieldId; + } + + /** + * Set fieldOptionId. + * + * @param int $fieldOptionId + * + * @return ExtraFieldOptionRelFieldOption + */ + public function setFieldOptionId($fieldOptionId) + { + $this->fieldOptionId = $fieldOptionId; + + return $this; + } + + /** + * Get fieldOptionId. + * + * @return int + */ + public function getFieldOptionId() + { + return $this->fieldOptionId; + } + + /** + * Set relatedFieldOptionId. + * + * @param int $relatedFieldOptionId + * + * @return ExtraFieldOptionRelFieldOption + */ + public function setRelatedFieldOptionId($relatedFieldOptionId) + { + $this->relatedFieldOptionId = $relatedFieldOptionId; + + return $this; + } + + /** + * Get relatedFieldOptionId. + * + * @return int + */ + public function getRelatedFieldOptionId() + { + return $this->relatedFieldOptionId; + } + + /** + * Set roleId. + * + * @param int $roleId + * + * @return ExtraFieldOptionRelFieldOption + */ + public function setRoleId($roleId) + { + $this->roleId = $roleId; + + return $this; + } + + /** + * Get roleId. + * + * @return int + */ + public function getRoleId() + { + return $this->roleId; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/ExtraFieldOptions.php b/src/Chamilo/CoreBundle/Entity/ExtraFieldOptions.php new file mode 100644 index 000000000..4ce550f9c --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/ExtraFieldOptions.php @@ -0,0 +1,201 @@ +id; + } + + /** + * @return int + */ + public function getOptionOrder() + { + return $this->optionOrder; + } + + /** + * @param int $optionOrder + * + * @return $this + */ + public function setOptionOrder($optionOrder) + { + $this->optionOrder = $optionOrder; + + return $this; + } + + /** + * @return mixed + */ + public function getField() + { + return $this->field; + } + + /** + * @param mixed $field + * + * @return $this + */ + public function setField($field) + { + $this->field = $field; + + return $this; + } + + /** + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * @param string $value + * + * @return $this + */ + public function setValue($value) + { + $this->value = $value; + + return $this; + } + + /** + * @param bool $translated Optional. Whether translate the display text + * + * @return string + */ + public function getDisplayText($translated = true) + { + if ($translated) { + return \ExtraFieldOption::translateDisplayName($this->displayText); + } + + return $this->displayText; + } + + /** + * @param string $displayText + * + * @return $this + */ + public function setDisplayText($displayText) + { + $this->displayText = $displayText; + + return $this; + } + + /** + * @return string + */ + public function getPriority() + { + return $this->priority; + } + + /** + * @param string $priority + * + * @return $this + */ + public function setPriority($priority) + { + $this->priority = $priority; + + return $this; + } + + /** + * @return string + */ + public function getPriorityMessage() + { + return $this->priorityMessage; + } + + /** + * @param string $priorityMessage + * + * @return $this + */ + public function setPriorityMessage($priorityMessage) + { + $this->priorityMessage = $priorityMessage; + + return $this; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/ExtraFieldRelTag.php b/src/Chamilo/CoreBundle/Entity/ExtraFieldRelTag.php new file mode 100644 index 000000000..5db22da50 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/ExtraFieldRelTag.php @@ -0,0 +1,135 @@ +fieldId = $fieldId; + + return $this; + } + + /** + * Set tagId. + * + * @param int $tagId + * + * @return ExtraFieldRelTag + */ + public function setTagId($tagId) + { + $this->tagId = $tagId; + + return $this; + } + + /** + * Set itemId. + * + * @param int $itemId + * + * @return ExtraFieldRelTag + */ + public function setItemId($itemId) + { + $this->itemId = $itemId; + + return $this; + } + + /** + * Get fieldId. + * + * @return int + */ + public function getFieldId() + { + return $this->fieldId; + } + + /** + * Get tagId. + * + * @return int + */ + public function getTagId() + { + return $this->tagId; + } + + /** + * Get itemId. + * + * @return int + */ + public function getItemId() + { + return $this->itemId; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/ExtraFieldSavedSearch.php b/src/Chamilo/CoreBundle/Entity/ExtraFieldSavedSearch.php new file mode 100644 index 000000000..8289920c3 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/ExtraFieldSavedSearch.php @@ -0,0 +1,174 @@ +id; + } + + /** + * @return ExtraField + */ + public function getField() + { + return $this->field; + } + + /** + * @param ExtraField $field + * + * @return ExtraFieldSavedSearch + */ + public function setField($field) + { + $this->field = $field; + + return $this; + } + + /** + * @return User + */ + public function getUser() + { + return $this->user; + } + + /** + * @param User $user + * + * @return ExtraFieldSavedSearch + */ + public function setUser($user) + { + $this->user = $user; + + return $this; + } + + /** + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * @param string $value + * + * @return ExtraFieldSavedSearch + */ + public function setValue($value) + { + $this->value = $value; + + return $this; + } + + /** + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + * @param \DateTime $createdAt + * + * @return ExtraFieldSavedSearch + */ + public function setCreatedAt($createdAt) + { + $this->createdAt = $createdAt; + + return $this; + } + + /** + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->updatedAt; + } + + /** + * @param \DateTime $updatedAt + * + * @return ExtraFieldSavedSearch + */ + public function setUpdatedAt($updatedAt) + { + $this->updatedAt = $updatedAt; + + return $this; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/ExtraFieldValues.php b/src/Chamilo/CoreBundle/Entity/ExtraFieldValues.php new file mode 100644 index 000000000..5f136e5fb --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/ExtraFieldValues.php @@ -0,0 +1,213 @@ +field; + } + + /** + * @param mixed $field + * + * @return ExtraFieldValues + */ + public function setField($field) + { + $this->field = $field; + + return $this; + } + + /** + * @return string + */ + public function getItemId() + { + return $this->itemId; + } + + /** + * @param string $itemId + * + * @return ExtraFieldValues + */ + public function setItemId($itemId) + { + $this->itemId = $itemId; + + return $this; + } + + /** + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + * @param \DateTime $createdAt + * + * @return $this + */ + public function setCreatedAt($createdAt) + { + $this->createdAt = $createdAt; + + return $this; + } + + /** + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->updatedAt; + } + + /** + * @param \DateTime $updatedAt + * + * @return $this + */ + public function setUpdatedAt($updatedAt) + { + $this->updatedAt = $updatedAt; + + return $this; + } + + /** + * Set comment. + * + * @param string $comment + * + * @return ExtraFieldValues + */ + public function setComment($comment) + { + $this->comment = $comment; + + return $this; + } + + /** + * Get comment. + * + * @return string + */ + public function getComment() + { + return $this->comment; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * @param string $value + * + * @return ExtraFieldValues + */ + public function setValue($value) + { + $this->value = $value; + + return $this; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/GradeComponents.php b/src/Chamilo/CoreBundle/Entity/GradeComponents.php new file mode 100644 index 000000000..31a352b18 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/GradeComponents.php @@ -0,0 +1,158 @@ +percentage = $percentage; + + return $this; + } + + /** + * Get percentage. + * + * @return string + */ + public function getPercentage() + { + return $this->percentage; + } + + /** + * Set title. + * + * @param string $title + * + * @return GradeComponents + */ + public function setTitle($title) + { + $this->title = $title; + + return $this; + } + + /** + * Get title. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set acronym. + * + * @param string $acronym + * + * @return GradeComponents + */ + public function setAcronym($acronym) + { + $this->acronym = $acronym; + + return $this; + } + + /** + * Get acronym. + * + * @return string + */ + public function getAcronym() + { + return $this->acronym; + } + + /** + * Set gradeModelId. + * + * @param int $gradeModelId + * + * @return GradeComponents + */ + public function setGradeModelId($gradeModelId) + { + $this->gradeModelId = $gradeModelId; + + return $this; + } + + /** + * Get gradeModelId. + * + * @return int + */ + public function getGradeModelId() + { + return $this->gradeModelId; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/GradeModel.php b/src/Chamilo/CoreBundle/Entity/GradeModel.php new file mode 100644 index 000000000..749bf23ba --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/GradeModel.php @@ -0,0 +1,189 @@ +name = $name; + + return $this; + } + + /** + * Get name. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set description. + * + * @param string $description + * + * @return GradeModel + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * Get description. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Set defaultLowestEvalExclude. + * + * @param bool $defaultLowestEvalExclude + * + * @return GradeModel + */ + public function setDefaultLowestEvalExclude($defaultLowestEvalExclude) + { + $this->defaultLowestEvalExclude = $defaultLowestEvalExclude; + + return $this; + } + + /** + * Get defaultLowestEvalExclude. + * + * @return bool + */ + public function getDefaultLowestEvalExclude() + { + return $this->defaultLowestEvalExclude; + } + + /** + * Set defaultExternalEval. + * + * @param bool $defaultExternalEval + * + * @return GradeModel + */ + public function setDefaultExternalEval($defaultExternalEval) + { + $this->defaultExternalEval = $defaultExternalEval; + + return $this; + } + + /** + * Get defaultExternalEval. + * + * @return bool + */ + public function getDefaultExternalEval() + { + return $this->defaultExternalEval; + } + + /** + * Set defaultExternalEvalPrefix. + * + * @param string $defaultExternalEvalPrefix + * + * @return GradeModel + */ + public function setDefaultExternalEvalPrefix($defaultExternalEvalPrefix) + { + $this->defaultExternalEvalPrefix = $defaultExternalEvalPrefix; + + return $this; + } + + /** + * Get defaultExternalEvalPrefix. + * + * @return string + */ + public function getDefaultExternalEvalPrefix() + { + return $this->defaultExternalEvalPrefix; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/GradebookCategory.php b/src/Chamilo/CoreBundle/Entity/GradebookCategory.php new file mode 100644 index 000000000..311c7831d --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/GradebookCategory.php @@ -0,0 +1,533 @@ +name = $name; + + return $this; + } + + /** + * Get name. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set description. + * + * @param string $description + * + * @return GradebookCategory + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * Get description. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Set userId. + * + * @param int $userId + * + * @return GradebookCategory + */ + public function setUserId($userId) + { + $this->userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set courseCode. + * + * @param string $courseCode + * + * @return GradebookCategory + */ + public function setCourseCode($courseCode) + { + $this->courseCode = $courseCode; + + return $this; + } + + /** + * Get courseCode. + * + * @return string + */ + public function getCourseCode() + { + return $this->courseCode; + } + + /** + * Set parentId. + * + * @param int $parentId + * + * @return GradebookCategory + */ + public function setParentId($parentId) + { + $this->parentId = $parentId; + + return $this; + } + + /** + * Get parentId. + * + * @return int + */ + public function getParentId() + { + return $this->parentId; + } + + /** + * Set weight. + * + * @param float $weight + * + * @return GradebookCategory + */ + public function setWeight($weight) + { + $this->weight = $weight; + + return $this; + } + + /** + * Get weight. + * + * @return float + */ + public function getWeight() + { + return $this->weight; + } + + /** + * Set visible. + * + * @param bool $visible + * + * @return GradebookCategory + */ + public function setVisible($visible) + { + $this->visible = $visible; + + return $this; + } + + /** + * Get visible. + * + * @return bool + */ + public function getVisible() + { + return $this->visible; + } + + /** + * Set certifMinScore. + * + * @param int $certifMinScore + * + * @return GradebookCategory + */ + public function setCertifMinScore($certifMinScore) + { + $this->certifMinScore = $certifMinScore; + + return $this; + } + + /** + * Get certifMinScore. + * + * @return int + */ + public function getCertifMinScore() + { + return $this->certifMinScore; + } + + /** + * Set sessionId. + * + * @param int $sessionId + * + * @return GradebookCategory + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * Get sessionId. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * Set documentId. + * + * @param int $documentId + * + * @return GradebookCategory + */ + public function setDocumentId($documentId) + { + $this->documentId = $documentId; + + return $this; + } + + /** + * Get documentId. + * + * @return int + */ + public function getDocumentId() + { + return $this->documentId; + } + + /** + * Set locked. + * + * @param int $locked + * + * @return GradebookCategory + */ + public function setLocked($locked) + { + $this->locked = $locked; + + return $this; + } + + /** + * Get locked. + * + * @return int + */ + public function getLocked() + { + return $this->locked; + } + + /** + * Set defaultLowestEvalExclude. + * + * @param bool $defaultLowestEvalExclude + * + * @return GradebookCategory + */ + public function setDefaultLowestEvalExclude($defaultLowestEvalExclude) + { + $this->defaultLowestEvalExclude = $defaultLowestEvalExclude; + + return $this; + } + + /** + * Get defaultLowestEvalExclude. + * + * @return bool + */ + public function getDefaultLowestEvalExclude() + { + return $this->defaultLowestEvalExclude; + } + + /** + * Set generateCertificates. + * + * @param bool $generateCertificates + * + * @return GradebookCategory + */ + public function setGenerateCertificates($generateCertificates) + { + $this->generateCertificates = $generateCertificates; + + return $this; + } + + /** + * Get generateCertificates. + * + * @return bool + */ + public function getGenerateCertificates() + { + return $this->generateCertificates; + } + + /** + * Set gradeModelId. + * + * @param int $gradeModelId + * + * @return GradebookCategory + */ + public function setGradeModelId($gradeModelId) + { + $this->gradeModelId = $gradeModelId; + + return $this; + } + + /** + * Get gradeModelId. + * + * @return int + */ + public function getGradeModelId() + { + return $this->gradeModelId; + } + + /** + * Set isRequirement. + * + * @param bool $isRequirement + * + * @return GradebookCategory + */ + public function setIsRequirement($isRequirement) + { + $this->isRequirement = $isRequirement; + + return $this; + } + + /** + * Get isRequirement. + * + * @return bool + */ + public function getIsRequirement() + { + return $this->isRequirement; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * @return int + */ + public function getAllowSkillsBySubcategory() + { + return $this->allowSkillsBySubcategory; + } + + /** + * @param int $allowSkillsBySubcategory + * + * @return GradebookCategory + */ + public function setAllowSkillsBySubcategory($allowSkillsBySubcategory) + { + $this->allowSkillsBySubcategory = $allowSkillsBySubcategory; + + return $this; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/GradebookCertificate.php b/src/Chamilo/CoreBundle/Entity/GradebookCertificate.php new file mode 100644 index 000000000..fbeb0b810 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/GradebookCertificate.php @@ -0,0 +1,189 @@ +catId = $catId; + + return $this; + } + + /** + * Get catId. + * + * @return int + */ + public function getCatId() + { + return $this->catId; + } + + /** + * Set userId. + * + * @param int $userId + * + * @return GradebookCertificate + */ + public function setUserId($userId) + { + $this->userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set scoreCertificate. + * + * @param float $scoreCertificate + * + * @return GradebookCertificate + */ + public function setScoreCertificate($scoreCertificate) + { + $this->scoreCertificate = $scoreCertificate; + + return $this; + } + + /** + * Get scoreCertificate. + * + * @return float + */ + public function getScoreCertificate() + { + return $this->scoreCertificate; + } + + /** + * Set createdAt. + * + * @param \DateTime $createdAt + * + * @return GradebookCertificate + */ + public function setCreatedAt($createdAt) + { + $this->createdAt = $createdAt; + + return $this; + } + + /** + * Get createdAt. + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + * Set pathCertificate. + * + * @param string $pathCertificate + * + * @return GradebookCertificate + */ + public function setPathCertificate($pathCertificate) + { + $this->pathCertificate = $pathCertificate; + + return $this; + } + + /** + * Get pathCertificate. + * + * @return string + */ + public function getPathCertificate() + { + return $this->pathCertificate; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/GradebookEvaluation.php b/src/Chamilo/CoreBundle/Entity/GradebookEvaluation.php new file mode 100644 index 000000000..73e6c295a --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/GradebookEvaluation.php @@ -0,0 +1,487 @@ +name = $name; + + return $this; + } + + /** + * Get name. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set description. + * + * @param string $description + * + * @return GradebookEvaluation + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * Get description. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Set userId. + * + * @param int $userId + * + * @return GradebookEvaluation + */ + public function setUserId($userId) + { + $this->userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set courseCode. + * + * @param string $courseCode + * + * @return GradebookEvaluation + */ + public function setCourseCode($courseCode) + { + $this->courseCode = $courseCode; + + return $this; + } + + /** + * Get courseCode. + * + * @return string + */ + public function getCourseCode() + { + return $this->courseCode; + } + + /** + * Set categoryId. + * + * @param int $categoryId + * + * @return GradebookEvaluation + */ + public function setCategoryId($categoryId) + { + $this->categoryId = $categoryId; + + return $this; + } + + /** + * Get categoryId. + * + * @return int + */ + public function getCategoryId() + { + return $this->categoryId; + } + + /** + * Set createdAt. + * + * @param \DateTime $createdAt + * + * @return GradebookEvaluation + */ + public function setCreatedAt($createdAt) + { + $this->createdAt = $createdAt; + + return $this; + } + + /** + * Get createdAt. + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + * Set weight. + * + * @param float $weight + * + * @return GradebookEvaluation + */ + public function setWeight($weight) + { + $this->weight = $weight; + + return $this; + } + + /** + * Get weight. + * + * @return float + */ + public function getWeight() + { + return $this->weight; + } + + /** + * Set max. + * + * @param float $max + * + * @return GradebookEvaluation + */ + public function setMax($max) + { + $this->max = $max; + + return $this; + } + + /** + * Get max. + * + * @return float + */ + public function getMax() + { + return $this->max; + } + + /** + * Set visible. + * + * @param int $visible + * + * @return GradebookEvaluation + */ + public function setVisible($visible) + { + $this->visible = $visible; + + return $this; + } + + /** + * Get visible. + * + * @return int + */ + public function getVisible() + { + return $this->visible; + } + + /** + * Set type. + * + * @param string $type + * + * @return GradebookEvaluation + */ + public function setType($type) + { + $this->type = $type; + + return $this; + } + + /** + * Get type. + * + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * Set locked. + * + * @param int $locked + * + * @return GradebookEvaluation + */ + public function setLocked($locked) + { + $this->locked = $locked; + + return $this; + } + + /** + * Get locked. + * + * @return int + */ + public function getLocked() + { + return $this->locked; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * @return float + */ + public function getBestScore() + { + return $this->bestScore; + } + + /** + * @param float $bestScore + * + * @return GradebookEvaluation + */ + public function setBestScore($bestScore) + { + $this->bestScore = $bestScore; + + return $this; + } + + /** + * @return float + */ + public function getAverageScore() + { + return $this->averageScore; + } + + /** + * @param float $averageScore + * + * @return GradebookEvaluation + */ + public function setAverageScore($averageScore) + { + $this->averageScore = $averageScore; + + return $this; + } + + /** + * @return array + */ + public function getUserScoreList() + { + if (empty($this->userScoreList)) { + return []; + } + + return $this->userScoreList; + } + + /** + * @param array $userScoreList + * + * @return GradebookEvaluation + */ + public function setUserScoreList($userScoreList) + { + $this->userScoreList = $userScoreList; + + return $this; + } + + /** + * @return float + */ + public function getScoreWeight() + { + return $this->scoreWeight; + } + + /** + * @param float $scoreWeight + * + * @return GradebookEvaluation + */ + public function setScoreWeight($scoreWeight) + { + $this->scoreWeight = $scoreWeight; + + return $this; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/GradebookLink.php b/src/Chamilo/CoreBundle/Entity/GradebookLink.php new file mode 100644 index 000000000..c9975b631 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/GradebookLink.php @@ -0,0 +1,425 @@ +type = $type; + + return $this; + } + + /** + * Get type. + * + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Set refId. + * + * @param int $refId + * + * @return GradebookLink + */ + public function setRefId($refId) + { + $this->refId = $refId; + + return $this; + } + + /** + * Get refId. + * + * @return int + */ + public function getRefId() + { + return $this->refId; + } + + /** + * Set userId. + * + * @param int $userId + * + * @return GradebookLink + */ + public function setUserId($userId) + { + $this->userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set courseCode. + * + * @param string $courseCode + * + * @return GradebookLink + */ + public function setCourseCode($courseCode) + { + $this->courseCode = $courseCode; + + return $this; + } + + /** + * Get courseCode. + * + * @return string + */ + public function getCourseCode() + { + return $this->courseCode; + } + + /** + * Set categoryId. + * + * @param int $categoryId + * + * @return GradebookLink + */ + public function setCategoryId($categoryId) + { + $this->categoryId = $categoryId; + + return $this; + } + + /** + * Get categoryId. + * + * @return int + */ + public function getCategoryId() + { + return $this->categoryId; + } + + /** + * Set createdAt. + * + * @param \DateTime $createdAt + * + * @return GradebookLink + */ + public function setCreatedAt($createdAt) + { + $this->createdAt = $createdAt; + + return $this; + } + + /** + * Get createdAt. + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + * Set weight. + * + * @param float $weight + * + * @return GradebookLink + */ + public function setWeight($weight) + { + $this->weight = $weight; + + return $this; + } + + /** + * Get weight. + * + * @return float + */ + public function getWeight() + { + return $this->weight; + } + + /** + * Set visible. + * + * @param int $visible + * + * @return GradebookLink + */ + public function setVisible($visible) + { + $this->visible = $visible; + + return $this; + } + + /** + * Get visible. + * + * @return int + */ + public function getVisible() + { + return $this->visible; + } + + /** + * Set locked. + * + * @param int $locked + * + * @return GradebookLink + */ + public function setLocked($locked) + { + $this->locked = $locked; + + return $this; + } + + /** + * Get locked. + * + * @return int + */ + public function getLocked() + { + return $this->locked; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * @return float + */ + public function getBestScore() + { + return $this->bestScore; + } + + /** + * @param float $bestScore + * + * @return GradebookLink + */ + public function setBestScore($bestScore) + { + $this->bestScore = $bestScore; + + return $this; + } + + /** + * @return float + */ + public function getAverageScore() + { + return $this->averageScore; + } + + /** + * @param float $averageScore + * + * @return GradebookLink + */ + public function setAverageScore($averageScore) + { + $this->averageScore = $averageScore; + + return $this; + } + + /** + * @return array + */ + public function getUserScoreList() + { + if (empty($this->userScoreList)) { + return []; + } + + return $this->userScoreList; + } + + /** + * @param array $userScoreList + * + * @return GradebookLink + */ + public function setUserScoreList($userScoreList) + { + $this->userScoreList = $userScoreList; + + return $this; + } + + /** + * @return float + */ + public function getScoreWeight() + { + return $this->scoreWeight; + } + + /** + * @param float $scoreWeight + * + * @return GradebookLink + */ + public function setScoreWeight($scoreWeight) + { + $this->scoreWeight = $scoreWeight; + + return $this; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/GradebookLinkevalLog.php b/src/Chamilo/CoreBundle/Entity/GradebookLinkevalLog.php new file mode 100644 index 000000000..f6a6a3708 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/GradebookLinkevalLog.php @@ -0,0 +1,282 @@ +idLinkevalLog = $idLinkevalLog; + + return $this; + } + + /** + * Get idLinkevalLog. + * + * @return int + */ + public function getIdLinkevalLog() + { + return $this->idLinkevalLog; + } + + /** + * Set name. + * + * @param string $name + * + * @return GradebookLinkevalLog + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * Get name. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set description. + * + * @param string $description + * + * @return GradebookLinkevalLog + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * Get description. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Set createdAt. + * + * @param \DateTime $createdAt + * + * @return GradebookLinkevalLog + */ + public function setCreatedAt($createdAt) + { + $this->createdAt = $createdAt; + + return $this; + } + + /** + * Get createdAt. + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + * Set weight. + * + * @param int $weight + * + * @return GradebookLinkevalLog + */ + public function setWeight($weight) + { + $this->weight = $weight; + + return $this; + } + + /** + * Get weight. + * + * @return int + */ + public function getWeight() + { + return $this->weight; + } + + /** + * Set visible. + * + * @param bool $visible + * + * @return GradebookLinkevalLog + */ + public function setVisible($visible) + { + $this->visible = $visible; + + return $this; + } + + /** + * Get visible. + * + * @return bool + */ + public function getVisible() + { + return $this->visible; + } + + /** + * Set type. + * + * @param string $type + * + * @return GradebookLinkevalLog + */ + public function setType($type) + { + $this->type = $type; + + return $this; + } + + /** + * Get type. + * + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * Set userIdLog. + * + * @param int $userIdLog + * + * @return GradebookLinkevalLog + */ + public function setUserIdLog($userIdLog) + { + $this->userIdLog = $userIdLog; + + return $this; + } + + /** + * Get userIdLog. + * + * @return int + */ + public function getUserIdLog() + { + return $this->userIdLog; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/GradebookResult.php b/src/Chamilo/CoreBundle/Entity/GradebookResult.php new file mode 100644 index 000000000..77d92aeec --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/GradebookResult.php @@ -0,0 +1,158 @@ +userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set evaluationId. + * + * @param int $evaluationId + * + * @return GradebookResult + */ + public function setEvaluationId($evaluationId) + { + $this->evaluationId = $evaluationId; + + return $this; + } + + /** + * Get evaluationId. + * + * @return int + */ + public function getEvaluationId() + { + return $this->evaluationId; + } + + /** + * Set createdAt. + * + * @param \DateTime $createdAt + * + * @return GradebookResult + */ + public function setCreatedAt($createdAt) + { + $this->createdAt = $createdAt; + + return $this; + } + + /** + * Get createdAt. + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + * Set score. + * + * @param float $score + * + * @return GradebookResult + */ + public function setScore($score) + { + $this->score = $score; + + return $this; + } + + /** + * Get score. + * + * @return float + */ + public function getScore() + { + return $this->score; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/GradebookResultLog.php b/src/Chamilo/CoreBundle/Entity/GradebookResultLog.php new file mode 100644 index 000000000..2ace2d159 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/GradebookResultLog.php @@ -0,0 +1,189 @@ +idResult = $idResult; + + return $this; + } + + /** + * Get idResult. + * + * @return int + */ + public function getIdResult() + { + return $this->idResult; + } + + /** + * Set userId. + * + * @param int $userId + * + * @return GradebookResultLog + */ + public function setUserId($userId) + { + $this->userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set evaluationId. + * + * @param int $evaluationId + * + * @return GradebookResultLog + */ + public function setEvaluationId($evaluationId) + { + $this->evaluationId = $evaluationId; + + return $this; + } + + /** + * Get evaluationId. + * + * @return int + */ + public function getEvaluationId() + { + return $this->evaluationId; + } + + /** + * Set createdAt. + * + * @param \DateTime $createdAt + * + * @return GradebookResultLog + */ + public function setCreatedAt($createdAt) + { + $this->createdAt = $createdAt; + + return $this; + } + + /** + * Get createdAt. + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + * Set score. + * + * @param float $score + * + * @return GradebookResultLog + */ + public function setScore($score) + { + $this->score = $score; + + return $this; + } + + /** + * Get score. + * + * @return float + */ + public function getScore() + { + return $this->score; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/GradebookScoreDisplay.php b/src/Chamilo/CoreBundle/Entity/GradebookScoreDisplay.php new file mode 100644 index 000000000..04eb9019b --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/GradebookScoreDisplay.php @@ -0,0 +1,158 @@ +score = $score; + + return $this; + } + + /** + * Get score. + * + * @return float + */ + public function getScore() + { + return $this->score; + } + + /** + * Set display. + * + * @param string $display + * + * @return GradebookScoreDisplay + */ + public function setDisplay($display) + { + $this->display = $display; + + return $this; + } + + /** + * Get display. + * + * @return string + */ + public function getDisplay() + { + return $this->display; + } + + /** + * Set categoryId. + * + * @param int $categoryId + * + * @return GradebookScoreDisplay + */ + public function setCategoryId($categoryId) + { + $this->categoryId = $categoryId; + + return $this; + } + + /** + * Get categoryId. + * + * @return int + */ + public function getCategoryId() + { + return $this->categoryId; + } + + /** + * Set scoreColorPercent. + * + * @param float $scoreColorPercent + * + * @return GradebookScoreDisplay + */ + public function setScoreColorPercent($scoreColorPercent) + { + $this->scoreColorPercent = $scoreColorPercent; + + return $this; + } + + /** + * Get scoreColorPercent. + * + * @return float + */ + public function getScoreColorPercent() + { + return $this->scoreColorPercent; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/GradebookScoreLog.php b/src/Chamilo/CoreBundle/Entity/GradebookScoreLog.php new file mode 100644 index 000000000..411f39702 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/GradebookScoreLog.php @@ -0,0 +1,175 @@ +categoryId; + } + + /** + * Get the user id. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Get the achieved score. + * + * @return float + */ + public function getScore() + { + return $this->score; + } + + /** + * Get the datetime of register. + * + * @return \DateTime + */ + public function getRegisteredAt() + { + return $this->registeredAt; + } + + /** + * Get the id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set the category id. + * + * @param int $categoryId + * + * @return $this + */ + public function setCategoryId($categoryId) + { + $this->categoryId = $categoryId; + + return $this; + } + + /** + * Set the user id. + * + * @param int $userId + * + * @return $this + */ + public function setUserId($userId) + { + $this->userId = $userId; + + return $this; + } + + /** + * Set the achieved score. + * + * @param float $score + * + * @return $this + */ + public function setScore($score) + { + $this->score = $score; + + return $this; + } + + /** + * Set the datetime of register. + * + * @return $this + */ + public function setRegisteredAt(\DateTime $registeredAt) + { + $this->registeredAt = $registeredAt; + + return $this; + } + + /** + * Set the id. + * + * @param int $id + * + * @return $this + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/HookCall.php b/src/Chamilo/CoreBundle/Entity/HookCall.php new file mode 100644 index 000000000..91771dcf3 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/HookCall.php @@ -0,0 +1,189 @@ +hookEventId = $hookEventId; + + return $this; + } + + /** + * Get hookEventId. + * + * @return int + */ + public function getHookEventId() + { + return $this->hookEventId; + } + + /** + * Set hookObserverId. + * + * @param int $hookObserverId + * + * @return HookCall + */ + public function setHookObserverId($hookObserverId) + { + $this->hookObserverId = $hookObserverId; + + return $this; + } + + /** + * Get hookObserverId. + * + * @return int + */ + public function getHookObserverId() + { + return $this->hookObserverId; + } + + /** + * Set type. + * + * @param bool $type + * + * @return HookCall + */ + public function setType($type) + { + $this->type = $type; + + return $this; + } + + /** + * Get type. + * + * @return bool + */ + public function getType() + { + return $this->type; + } + + /** + * Set hookOrder. + * + * @param int $hookOrder + * + * @return HookCall + */ + public function setHookOrder($hookOrder) + { + $this->hookOrder = $hookOrder; + + return $this; + } + + /** + * Get hookOrder. + * + * @return int + */ + public function getHookOrder() + { + return $this->hookOrder; + } + + /** + * Set enabled. + * + * @param bool $enabled + * + * @return HookCall + */ + public function setEnabled($enabled) + { + $this->enabled = $enabled; + + return $this; + } + + /** + * Get enabled. + * + * @return bool + */ + public function getEnabled() + { + return $this->enabled; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/HookEvent.php b/src/Chamilo/CoreBundle/Entity/HookEvent.php new file mode 100644 index 000000000..bda7bd053 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/HookEvent.php @@ -0,0 +1,96 @@ +className = $className; + + return $this; + } + + /** + * Get className. + * + * @return string + */ + public function getClassName() + { + return $this->className; + } + + /** + * Set description. + * + * @param string $description + * + * @return HookEvent + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * Get description. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/HookObserver.php b/src/Chamilo/CoreBundle/Entity/HookObserver.php new file mode 100644 index 000000000..5511b0849 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/HookObserver.php @@ -0,0 +1,127 @@ +className = $className; + + return $this; + } + + /** + * Get className. + * + * @return string + */ + public function getClassName() + { + return $this->className; + } + + /** + * Set path. + * + * @param string $path + * + * @return HookObserver + */ + public function setPath($path) + { + $this->path = $path; + + return $this; + } + + /** + * Get path. + * + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** + * Set pluginName. + * + * @param string $pluginName + * + * @return HookObserver + */ + public function setPluginName($pluginName) + { + $this->pluginName = $pluginName; + + return $this; + } + + /** + * Get pluginName. + * + * @return string + */ + public function getPluginName() + { + return $this->pluginName; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Language.php b/src/Chamilo/CoreBundle/Entity/Language.php new file mode 100644 index 000000000..e0662bf9e --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Language.php @@ -0,0 +1,243 @@ +children = new ArrayCollection(); + } + + /** + * Set originalName. + * + * @param string $originalName + * + * @return Language + */ + public function setOriginalName($originalName) + { + $this->originalName = $originalName; + + return $this; + } + + /** + * Get originalName. + * + * @return string + */ + public function getOriginalName() + { + return $this->originalName; + } + + /** + * Set englishName. + * + * @param string $englishName + * + * @return Language + */ + public function setEnglishName($englishName) + { + $this->englishName = $englishName; + + return $this; + } + + /** + * Get englishName. + * + * @return string + */ + public function getEnglishName() + { + return $this->englishName; + } + + /** + * Set isocode. + * + * @param string $isocode + * + * @return Language + */ + public function setIsocode($isocode) + { + $this->isocode = $isocode; + + return $this; + } + + /** + * Get isocode. + * + * @return string + */ + public function getIsocode() + { + return $this->isocode; + } + + /** + * Set dokeosFolder. + * + * @param string $dokeosFolder + * + * @return Language + */ + public function setDokeosFolder($dokeosFolder) + { + $this->dokeosFolder = $dokeosFolder; + + return $this; + } + + /** + * Get dokeosFolder. + * + * @return string + */ + public function getDokeosFolder() + { + return $this->dokeosFolder; + } + + /** + * Set available. + * + * @param bool $available + * + * @return Language + */ + public function setAvailable($available) + { + $this->available = $available; + + return $this; + } + + /** + * Get available. + * + * @return bool + */ + public function getAvailable() + { + return $this->available; + } + + /** + * Set parent. + * + * @return Language + */ + public function setParent(Language $parent) + { + $this->parent = $parent; + + return $this; + } + + /** + * Get parent. + * + * @return Language + */ + public function getParent() + { + return $this->parent; + } + + /** + * Get subLanguages. + * + * @return ArrayCollection + */ + public function getSubLanguages() + { + return $this->subLanguages; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Legal.php b/src/Chamilo/CoreBundle/Entity/Legal.php new file mode 100644 index 000000000..f5556fe69 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Legal.php @@ -0,0 +1,230 @@ +id; + } + + /** + * @param int $id + * + * @return Legal + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Set date. + * + * @param int $date + * + * @return Legal + */ + public function setDate($date) + { + $this->date = $date; + + return $this; + } + + /** + * Get date. + * + * @return int + */ + public function getDate() + { + return $this->date; + } + + /** + * Set content. + * + * @param string $content + * + * @return Legal + */ + public function setContent($content) + { + $this->content = $content; + + return $this; + } + + /** + * Get content. + * + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * Set type. + * + * @param int $type + * + * @return Legal + */ + public function setType($type) + { + $this->type = $type; + + return $this; + } + + /** + * Get type. + * + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Set changes. + * + * @param string $changes + * + * @return Legal + */ + public function setChanges($changes) + { + $this->changes = $changes; + + return $this; + } + + /** + * Get changes. + * + * @return string + */ + public function getChanges() + { + return $this->changes; + } + + /** + * Set version. + * + * @param int $version + * + * @return Legal + */ + public function setVersion($version) + { + $this->version = $version; + + return $this; + } + + /** + * Get version. + * + * @return int + */ + public function getVersion() + { + return $this->version; + } + + /** + * Set languageId. + * + * @param int $languageId + * + * @return Legal + */ + public function setLanguageId($languageId) + { + $this->languageId = $languageId; + + return $this; + } + + /** + * Get languageId. + * + * @return int + */ + public function getLanguageId() + { + return $this->languageId; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Listener/CourseListener.php b/src/Chamilo/CoreBundle/Entity/Listener/CourseListener.php new file mode 100644 index 000000000..a72e9fca1 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Listener/CourseListener.php @@ -0,0 +1,40 @@ +toolChain = $toolChain; + } + + /** + * new object : prePersist + * edited object: preUpdate. + */ + public function prePersist(Course $course, LifecycleEventArgs $args) + { + //$this->toolChain->addToolsInCourse($course); + /* + error_log('ddd'); + $course->setDescription( ' dq sdqs dqs dqs '); + + $args->getEntityManager()->persist($course); + $args->getEntityManager()->flush();*/ + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Manager/AccessUrlManager.php b/src/Chamilo/CoreBundle/Entity/Manager/AccessUrlManager.php new file mode 100644 index 000000000..9e48fc558 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Manager/AccessUrlManager.php @@ -0,0 +1,23 @@ +create(); + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Manager/CourseManager.php b/src/Chamilo/CoreBundle/Entity/Manager/CourseManager.php new file mode 100644 index 000000000..27e69ab48 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Manager/CourseManager.php @@ -0,0 +1,16 @@ +create(); + } + + /** + * @param $name + * + * @return Session + */ + public function findOneByName($name) + { + return $this->getRepository()->findOneByName($name); + } + + public function addDrh(User $user, Session $session) + { + $session->addUserInSession(Session::COACH, $user); + } + + /** + * @return bool + */ + public function hasDrh(User $user, Session $session) + { + $subscription = new SessionRelUser(); + $subscription->setUser($user); + $subscription->setSession($session); + $subscription->setRelationType(Session::DRH); + + return $session->hasUser($subscription); + } + + public function addStudentInCourse( + User $user, + Course $course, + Session $session + ) { + $this->addUserInCourse(Session::STUDENT, $user, $course, $session); + } + + /** + * @return bool + */ + public function hasStudentInCourse( + User $user, + Course $course, + Session $session + ) { + return $session->hasUserInCourse($user, $course, Session::STUDENT); + } + + public function addCoachInCourse( + User $user, + Course $course, + Session $session + ) { + $this->addUserInCourse(Session::COACH, $user, $course, $session); + } + + /** + * @return bool + */ + public function hasCoachInCourse( + User $user, + Course $course, + Session $session + ) { + return $session->hasUserInCourse($user, $course, Session::COACH); + } + + /** + * @param $status + */ + protected function addUserInCourse( + $status, + User $user, + Course $course, + Session $session + ) { + if ($session->isActive() && + $user->getIsActive() && + $course->isActive() + ) { + if ($session->hasCourse($course)) { + switch ($status) { + case Session::DRH: + if ($user->hasRole('ROLE_RRHH')) { + $session->addUserInSession(Session::DRH, $user); + } + break; + case Session::STUDENT: + $session->addUserInSession(Session::STUDENT, $user); + $session->addUserInCourse( + Session::STUDENT, + $user, + $course + ); + break; + case Session::COACH: + if ($user->hasRole('ROLE_TEACHER')) { + $session->addUserInCourse( + Session::COACH, + $user, + $course + ); + } + break; + } + } + } + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Message.php b/src/Chamilo/CoreBundle/Entity/Message.php new file mode 100644 index 000000000..a6e2d3cc8 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Message.php @@ -0,0 +1,368 @@ +likes = new ArrayCollection(); + } + + /** + * Set userSenderId. + * + * @param int $userSenderId + * + * @return Message + */ + public function setUserSenderId($userSenderId) + { + $this->userSenderId = $userSenderId; + + return $this; + } + + /** + * Get userSenderId. + * + * @return int + */ + public function getUserSenderId() + { + return $this->userSenderId; + } + + /** + * Set userReceiverId. + * + * @param int $userReceiverId + * + * @return Message + */ + public function setUserReceiverId($userReceiverId) + { + $this->userReceiverId = $userReceiverId; + + return $this; + } + + /** + * Get userReceiverId. + * + * @return int + */ + public function getUserReceiverId() + { + return $this->userReceiverId; + } + + /** + * Set msgStatus. + * + * @param bool $msgStatus + * + * @return Message + */ + public function setMsgStatus($msgStatus) + { + $this->msgStatus = $msgStatus; + + return $this; + } + + /** + * Get msgStatus. + * + * @return bool + */ + public function getMsgStatus() + { + return $this->msgStatus; + } + + /** + * Set sendDate. + * + * @param \DateTime $sendDate + * + * @return Message + */ + public function setSendDate($sendDate) + { + $this->sendDate = $sendDate; + + return $this; + } + + /** + * Get sendDate. + * + * @return \DateTime + */ + public function getSendDate() + { + return $this->sendDate; + } + + /** + * Set title. + * + * @param string $title + * + * @return Message + */ + public function setTitle($title) + { + $this->title = $title; + + return $this; + } + + /** + * Get title. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set content. + * + * @param string $content + * + * @return Message + */ + public function setContent($content) + { + $this->content = $content; + + return $this; + } + + /** + * Get content. + * + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * Set groupId. + * + * @param int $groupId + * + * @return Message + */ + public function setGroupId($groupId) + { + $this->groupId = $groupId; + + return $this; + } + + /** + * Get groupId. + * + * @return int + */ + public function getGroupId() + { + return $this->groupId; + } + + /** + * Set parentId. + * + * @param int $parentId + * + * @return Message + */ + public function setParentId($parentId) + { + $this->parentId = $parentId; + + return $this; + } + + /** + * Get parentId. + * + * @return int + */ + public function getParentId() + { + return $this->parentId; + } + + /** + * Set updateDate. + * + * @param \DateTime $updateDate + * + * @return Message + */ + public function setUpdateDate($updateDate) + { + $this->updateDate = $updateDate; + + return $this; + } + + /** + * Get updateDate. + * + * @return \DateTime + */ + public function getUpdateDate() + { + return $this->updateDate; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set votes. + * + * @param int $votes + * + * @return Message + */ + public function setVotes($votes) + { + $this->votes = $votes; + + return $this; + } + + /** + * Get votes. + * + * @return int + */ + public function getVotes() + { + return $this->votes; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/MessageAttachment.php b/src/Chamilo/CoreBundle/Entity/MessageAttachment.php new file mode 100644 index 000000000..b94ceddf5 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/MessageAttachment.php @@ -0,0 +1,189 @@ +path = $path; + + return $this; + } + + /** + * Get path. + * + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** + * Set comment. + * + * @param string $comment + * + * @return MessageAttachment + */ + public function setComment($comment) + { + $this->comment = $comment; + + return $this; + } + + /** + * Get comment. + * + * @return string + */ + public function getComment() + { + return $this->comment; + } + + /** + * Set size. + * + * @param int $size + * + * @return MessageAttachment + */ + public function setSize($size) + { + $this->size = $size; + + return $this; + } + + /** + * Get size. + * + * @return int + */ + public function getSize() + { + return $this->size; + } + + /** + * Set messageId. + * + * @param int $messageId + * + * @return MessageAttachment + */ + public function setMessageId($messageId) + { + $this->messageId = $messageId; + + return $this; + } + + /** + * Get messageId. + * + * @return int + */ + public function getMessageId() + { + return $this->messageId; + } + + /** + * Set filename. + * + * @param string $filename + * + * @return MessageAttachment + */ + public function setFilename($filename) + { + $this->filename = $filename; + + return $this; + } + + /** + * Get filename. + * + * @return string + */ + public function getFilename() + { + return $this->filename; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/MessageFeedback.php b/src/Chamilo/CoreBundle/Entity/MessageFeedback.php new file mode 100644 index 000000000..e6cffcefe --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/MessageFeedback.php @@ -0,0 +1,180 @@ +id; + } + + /** + * @param int $id + * + * @return MessageFeedback + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * @return Message + */ + public function getMessage() + { + return $this->message; + } + + /** + * @return MessageFeedback + */ + public function setMessage(Message $message) + { + $this->message = $message; + + return $this; + } + + /** + * @return User + */ + public function getUser() + { + return $this->user; + } + + /** + * @return MessageFeedback + */ + public function setUser(User $user) + { + $this->user = $user; + + return $this; + } + + /** + * @return bool + */ + public function isLiked() + { + return $this->liked; + } + + /** + * @param bool $liked + * + * @return MessageFeedback + */ + public function setLiked($liked) + { + $this->liked = $liked; + + return $this; + } + + /** + * @return bool + */ + public function isDisliked() + { + return $this->disliked; + } + + /** + * @param bool $disliked + * + * @return MessageFeedback + */ + public function setDisliked($disliked) + { + $this->disliked = $disliked; + + return $this; + } + + /** + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->updatedAt; + } + + /** + * @return MessageFeedback + */ + public function setUpdatedAt(\DateTime $updatedAt) + { + $this->updatedAt = $updatedAt; + + return $this; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Notification.php b/src/Chamilo/CoreBundle/Entity/Notification.php new file mode 100644 index 000000000..459924f68 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Notification.php @@ -0,0 +1,260 @@ +destUserId = $destUserId; + + return $this; + } + + /** + * Get destUserId. + * + * @return int + */ + public function getDestUserId() + { + return $this->destUserId; + } + + /** + * Set destMail. + * + * @param string $destMail + * + * @return Notification + */ + public function setDestMail($destMail) + { + $this->destMail = $destMail; + + return $this; + } + + /** + * Get destMail. + * + * @return string + */ + public function getDestMail() + { + return $this->destMail; + } + + /** + * Set title. + * + * @param string $title + * + * @return Notification + */ + public function setTitle($title) + { + $this->title = $title; + + return $this; + } + + /** + * Get title. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set content. + * + * @param string $content + * + * @return Notification + */ + public function setContent($content) + { + $this->content = $content; + + return $this; + } + + /** + * Get content. + * + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * Set sendFreq. + * + * @param int $sendFreq + * + * @return Notification + */ + public function setSendFreq($sendFreq) + { + $this->sendFreq = $sendFreq; + + return $this; + } + + /** + * Get sendFreq. + * + * @return int + */ + public function getSendFreq() + { + return $this->sendFreq; + } + + /** + * Set createdAt. + * + * @param \DateTime $createdAt + * + * @return Notification + */ + public function setCreatedAt($createdAt) + { + $this->createdAt = $createdAt; + + return $this; + } + + /** + * Get createdAt. + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + * Set sentAt. + * + * @param \DateTime $sentAt + * + * @return Notification + */ + public function setSentAt($sentAt) + { + $this->sentAt = $sentAt; + + return $this; + } + + /** + * Get sentAt. + * + * @return \DateTime + */ + public function getSentAt() + { + return $this->sentAt; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/OpenidAssociation.php b/src/Chamilo/CoreBundle/Entity/OpenidAssociation.php new file mode 100644 index 000000000..0de62f3df --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/OpenidAssociation.php @@ -0,0 +1,251 @@ +idpEndpointUri = $idpEndpointUri; + + return $this; + } + + /** + * Get idpEndpointUri. + * + * @return string + */ + public function getIdpEndpointUri() + { + return $this->idpEndpointUri; + } + + /** + * Set sessionType. + * + * @param string $sessionType + * + * @return OpenidAssociation + */ + public function setSessionType($sessionType) + { + $this->sessionType = $sessionType; + + return $this; + } + + /** + * Get sessionType. + * + * @return string + */ + public function getSessionType() + { + return $this->sessionType; + } + + /** + * Set assocHandle. + * + * @param string $assocHandle + * + * @return OpenidAssociation + */ + public function setAssocHandle($assocHandle) + { + $this->assocHandle = $assocHandle; + + return $this; + } + + /** + * Get assocHandle. + * + * @return string + */ + public function getAssocHandle() + { + return $this->assocHandle; + } + + /** + * Set assocType. + * + * @param string $assocType + * + * @return OpenidAssociation + */ + public function setAssocType($assocType) + { + $this->assocType = $assocType; + + return $this; + } + + /** + * Get assocType. + * + * @return string + */ + public function getAssocType() + { + return $this->assocType; + } + + /** + * Set expiresIn. + * + * @param int $expiresIn + * + * @return OpenidAssociation + */ + public function setExpiresIn($expiresIn) + { + $this->expiresIn = $expiresIn; + + return $this; + } + + /** + * Get expiresIn. + * + * @return int + */ + public function getExpiresIn() + { + return $this->expiresIn; + } + + /** + * Set macKey. + * + * @param string $macKey + * + * @return OpenidAssociation + */ + public function setMacKey($macKey) + { + $this->macKey = $macKey; + + return $this; + } + + /** + * Get macKey. + * + * @return string + */ + public function getMacKey() + { + return $this->macKey; + } + + /** + * Set created. + * + * @param int $created + * + * @return OpenidAssociation + */ + public function setCreated($created) + { + $this->created = $created; + + return $this; + } + + /** + * Get created. + * + * @return int + */ + public function getCreated() + { + return $this->created; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/PersonalAgenda.php b/src/Chamilo/CoreBundle/Entity/PersonalAgenda.php new file mode 100644 index 000000000..3413bd9a2 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/PersonalAgenda.php @@ -0,0 +1,317 @@ +user = $user; + + return $this; + } + + /** + * Get user. + * + * @return int + */ + public function getUser() + { + return $this->user; + } + + /** + * Set title. + * + * @param string $title + * + * @return PersonalAgenda + */ + public function setTitle($title) + { + $this->title = $title; + + return $this; + } + + /** + * Get title. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set text. + * + * @param string $text + * + * @return PersonalAgenda + */ + public function setText($text) + { + $this->text = $text; + + return $this; + } + + /** + * Get text. + * + * @return string + */ + public function getText() + { + return $this->text; + } + + /** + * Set date. + * + * @param \DateTime $date + * + * @return PersonalAgenda + */ + public function setDate($date) + { + $this->date = $date; + + return $this; + } + + /** + * Get date. + * + * @return \DateTime + */ + public function getDate() + { + return $this->date; + } + + /** + * Set enddate. + * + * @param \DateTime $enddate + * + * @return PersonalAgenda + */ + public function setEnddate($enddate) + { + $this->enddate = $enddate; + + return $this; + } + + /** + * Get enddate. + * + * @return \DateTime + */ + public function getEnddate() + { + return $this->enddate; + } + + /** + * Set course. + * + * @param string $course + * + * @return PersonalAgenda + */ + public function setCourse($course) + { + $this->course = $course; + + return $this; + } + + /** + * Get course. + * + * @return string + */ + public function getCourse() + { + return $this->course; + } + + /** + * Set parentEventId. + * + * @param int $parentEventId + * + * @return PersonalAgenda + */ + public function setParentEventId($parentEventId) + { + $this->parentEventId = $parentEventId; + + return $this; + } + + /** + * Get parentEventId. + * + * @return int + */ + public function getParentEventId() + { + return $this->parentEventId; + } + + /** + * Set allDay. + * + * @param int $allDay + * + * @return PersonalAgenda + */ + public function setAllDay($allDay) + { + $this->allDay = $allDay; + + return $this; + } + + /** + * Get allDay. + * + * @return int + */ + public function getAllDay() + { + return $this->allDay; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * @return string + */ + public function getColor() + { + return $this->color; + } + + /** + * @param string $color + * + * @return PersonalAgenda + */ + public function setColor($color) + { + $this->color = $color; + + return $this; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/PersonalAgendaRepeat.php b/src/Chamilo/CoreBundle/Entity/PersonalAgendaRepeat.php new file mode 100644 index 000000000..5cc2ea2d8 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/PersonalAgendaRepeat.php @@ -0,0 +1,158 @@ +calType = $calType; + + return $this; + } + + /** + * Get calType. + * + * @return string + */ + public function getCalType() + { + return $this->calType; + } + + /** + * Set calEnd. + * + * @param int $calEnd + * + * @return PersonalAgendaRepeat + */ + public function setCalEnd($calEnd) + { + $this->calEnd = $calEnd; + + return $this; + } + + /** + * Get calEnd. + * + * @return int + */ + public function getCalEnd() + { + return $this->calEnd; + } + + /** + * Set calFrequency. + * + * @param int $calFrequency + * + * @return PersonalAgendaRepeat + */ + public function setCalFrequency($calFrequency) + { + $this->calFrequency = $calFrequency; + + return $this; + } + + /** + * Get calFrequency. + * + * @return int + */ + public function getCalFrequency() + { + return $this->calFrequency; + } + + /** + * Set calDays. + * + * @param string $calDays + * + * @return PersonalAgendaRepeat + */ + public function setCalDays($calDays) + { + $this->calDays = $calDays; + + return $this; + } + + /** + * Get calDays. + * + * @return string + */ + public function getCalDays() + { + return $this->calDays; + } + + /** + * Get calId. + * + * @return int + */ + public function getCalId() + { + return $this->calId; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/PersonalAgendaRepeatNot.php b/src/Chamilo/CoreBundle/Entity/PersonalAgendaRepeatNot.php new file mode 100644 index 000000000..f3b23eb58 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/PersonalAgendaRepeatNot.php @@ -0,0 +1,81 @@ +calId = $calId; + + return $this; + } + + /** + * Get calId. + * + * @return int + */ + public function getCalId() + { + return $this->calId; + } + + /** + * Set calDate. + * + * @param int $calDate + * + * @return PersonalAgendaRepeatNot + */ + public function setCalDate($calDate) + { + $this->calDate = $calDate; + + return $this; + } + + /** + * Get calDate. + * + * @return int + */ + public function getCalDate() + { + return $this->calDate; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Portfolio.php b/src/Chamilo/CoreBundle/Entity/Portfolio.php new file mode 100644 index 000000000..bce121320 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Portfolio.php @@ -0,0 +1,463 @@ +category = null; + $this->comments = new ArrayCollection(); + } + + /** + * Set user. + * + * @return Portfolio + */ + public function setUser(User $user) + { + $this->user = $user; + + return $this; + } + + /** + * Get user. + * + * @return User + */ + public function getUser() + { + return $this->user; + } + + /** + * Set course. + * + * @return Portfolio + */ + public function setCourse(Course $course = null) + { + $this->course = $course; + + return $this; + } + + /** + * Get course. + * + * @return Course + */ + public function getCourse() + { + return $this->course; + } + + /** + * Get session. + * + * @return Session + */ + public function getSession() + { + return $this->session; + } + + /** + * Set session. + * + * @return Portfolio + */ + public function setSession(Session $session = null) + { + $this->session = $session; + + return $this; + } + + /** + * Set title. + * + * @param string $title + * + * @return Portfolio + */ + public function setTitle($title) + { + $this->title = $title; + + return $this; + } + + /** + * Get title. + */ + public function getTitle(bool $stripTags = false): string + { + if ($stripTags) { + return strip_tags($this->title); + } + + return $this->title; + } + + /** + * Set content. + * + * @param string $content + * + * @return Portfolio + */ + public function setContent($content) + { + $this->content = $content; + + return $this; + } + + /** + * Get content. + * + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * Set creationDate. + * + * @return Portfolio + */ + public function setCreationDate(\DateTime $creationDate) + { + $this->creationDate = $creationDate; + + return $this; + } + + /** + * Get creationDate. + * + * @return \DateTime + */ + public function getCreationDate() + { + return $this->creationDate; + } + + /** + * Set updateDate. + * + * @return Portfolio + */ + public function setUpdateDate(\DateTime $updateDate) + { + $this->updateDate = $updateDate; + + return $this; + } + + /** + * Get updateDate. + * + * @return \DateTime + */ + public function getUpdateDate() + { + return $this->updateDate; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set isVisible. + */ + public function setVisibility(int $visibility): Portfolio + { + $this->visibility = $visibility; + + return $this; + } + + /** + * Get isVisible. + */ + public function getVisibility(): int + { + return $this->visibility; + } + + /** + * Get category. + * + * @return PortfolioCategory + */ + public function getCategory() + { + return $this->category; + } + + /** + * Set category. + * + * @return Portfolio + */ + public function setCategory(PortfolioCategory $category = null) + { + $this->category = $category; + + return $this; + } + + public function getComments(): Collection + { + return $this->comments; + } + + public function getLastComments(int $number = 3, bool $avoidPerUserVisibility = false): Collection + { + $criteria = Criteria::create(); + $criteria + ->orderBy(['date' => 'DESC']) + ->setMaxResults($number); + + if ($avoidPerUserVisibility) { + $criteria->where( + Criteria::expr()->neq('visibility', PortfolioComment::VISIBILITY_PER_USER) + ); + } + + return $this->comments->matching($criteria); + } + + public function getOrigin(): ?int + { + return $this->origin; + } + + /** + * @return \Chamilo\CoreBundle\Entity\Portfolio + */ + public function setOrigin(?int $origin): Portfolio + { + $this->origin = $origin; + + return $this; + } + + public function getOriginType(): ?int + { + return $this->originType; + } + + /** + * @return \Chamilo\CoreBundle\Entity\Portfolio + */ + public function setOriginType(?int $originType): Portfolio + { + $this->originType = $originType; + + return $this; + } + + public function getExcerpt(int $count = 380): string + { + return api_get_short_text_from_html($this->content, $count); + } + + public function getScore(): ?float + { + return $this->score; + } + + public function setScore(?float $score): void + { + $this->score = $score; + } + + public function isHighlighted(): bool + { + return $this->isHighlighted; + } + + public function setIsHighlighted(bool $isHighlighted): Portfolio + { + $this->isHighlighted = $isHighlighted; + + return $this; + } + + public function isTemplate(): bool + { + return $this->isTemplate; + } + + public function setIsTemplate(bool $isTemplate): Portfolio + { + $this->isTemplate = $isTemplate; + + return $this; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/PortfolioAttachment.php b/src/Chamilo/CoreBundle/Entity/PortfolioAttachment.php new file mode 100644 index 000000000..2e9b63028 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/PortfolioAttachment.php @@ -0,0 +1,147 @@ +id; + } + + public function getPath(): string + { + return $this->path; + } + + public function setPath(string $path): PortfolioAttachment + { + $this->path = $path; + + return $this; + } + + public function getComment(): ?string + { + return $this->comment; + } + + public function setComment(?string $comment): PortfolioAttachment + { + $this->comment = $comment; + + return $this; + } + + public function getSize(): int + { + return $this->size; + } + + public function setSize(int $size): PortfolioAttachment + { + $this->size = $size; + + return $this; + } + + public function getFilename(): string + { + return $this->filename; + } + + public function setFilename(string $filename): PortfolioAttachment + { + $this->filename = $filename; + + return $this; + } + + public function getOrigin(): int + { + return $this->origin; + } + + public function setOrigin(int $origin): PortfolioAttachment + { + $this->origin = $origin; + + return $this; + } + + public function getOriginType(): int + { + return $this->originType; + } + + public function setOriginType(int $originType): PortfolioAttachment + { + $this->originType = $originType; + + return $this; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/PortfolioCategory.php b/src/Chamilo/CoreBundle/Entity/PortfolioCategory.php new file mode 100644 index 000000000..30f613c57 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/PortfolioCategory.php @@ -0,0 +1,276 @@ +items = new ArrayCollection(); + } + + /** + * @return string + */ + public function __toString() + { + return $this->title; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * @param int $id + * + * @return PortfolioCategory + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get title. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set title. + * + * @param string $title + * + * @return PortfolioCategory + */ + public function setTitle($title) + { + $this->title = $title; + + return $this; + } + + /** + * Get description. + * + * @return string|null + */ + public function getDescription() + { + return $this->description; + } + + /** + * Set description. + * + * @param string|null $description + * + * @return PortfolioCategory + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * Get user. + * + * @return User + */ + public function getUser() + { + return $this->user; + } + + /** + * Set user. + * + * @return PortfolioCategory + */ + public function setUser(User $user) + { + $this->user = $user; + + return $this; + } + + /** + * Get isVisible. + * + * @return bool + */ + public function isVisible() + { + return $this->isVisible; + } + + /** + * Set isVisible. + * + * @param bool $isVisible + * + * @return PortfolioCategory + */ + public function setIsVisible($isVisible) + { + $this->isVisible = $isVisible; + + return $this; + } + + /** + * @return int + */ + public function getParentId() + { + return $this->parentId; + } + + /** + * Set parent id. + * + * @return PortfolioCategory + */ + public function setParentId(int $parentId) + { + $this->parentId = $parentId; + + return $this; + } + + /** + * Get items. + * + * @param \Chamilo\CoreBundle\Entity\Course|null $course + * @param \Chamilo\CoreBundle\Entity\Session|null $session + * @param bool $onlyVisibles + * + * @return ArrayCollection + */ + public function getItems(Course $course = null, Session $session = null, $onlyVisibles = false) + { + $criteria = Criteria::create(); + + if ($onlyVisibles) { + $criteria->andWhere( + Criteria::expr()->eq('visibility', Portfolio::VISIBILITY_VISIBLE) + ); + } + + if ($course) { + $criteria + ->andWhere( + Criteria::expr()->eq('course', $course) + ) + ->andWhere( + Criteria::expr()->eq('session', $session) + ); + } + + $criteria->orderBy(['creationDate' => 'DESC']); + + return $this->items->matching($criteria); + } + + /** + * Set items. + * + * @return PortfolioCategory + */ + public function setItems(ArrayCollection $items) + { + $this->items = $items; + + return $this; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/PortfolioComment.php b/src/Chamilo/CoreBundle/Entity/PortfolioComment.php new file mode 100644 index 000000000..8ebdd7130 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/PortfolioComment.php @@ -0,0 +1,295 @@ +isImportant = false; + $this->children = new ArrayCollection(); + $this->visibility = 1; + } + + public function getId(): int + { + return $this->id; + } + + public function getAuthor(): User + { + return $this->author; + } + + public function setAuthor(User $author): PortfolioComment + { + $this->author = $author; + + return $this; + } + + /** + * @return \Chamilo\CoreBundle\Entity\Portfolio + */ + public function getItem(): Portfolio + { + return $this->item; + } + + /** + * @param \Chamilo\CoreBundle\Entity\Portfolio $item + */ + public function setItem(Portfolio $item): PortfolioComment + { + $this->item = $item; + + return $this; + } + + public function getContent(): string + { + return $this->content; + } + + public function setContent(string $content): PortfolioComment + { + $this->content = $content; + + return $this; + } + + public function getDate(): DateTime + { + return $this->date; + } + + public function setDate(DateTime $date): PortfolioComment + { + $this->date = $date; + + return $this; + } + + /** + * @return \Chamilo\CoreBundle\Entity\PortfolioComment|null + */ + public function getParent(): ?PortfolioComment + { + return $this->parent; + } + + /** + * @param \Chamilo\CoreBundle\Entity\PortfolioComment|null $parent + */ + public function setParent(?PortfolioComment $parent): PortfolioComment + { + $this->parent = $parent; + + return $this; + } + + public function getChildren(): ArrayCollection + { + return $this->children; + } + + public function setChildren(ArrayCollection $children): PortfolioComment + { + $this->children = $children; + + return $this; + } + + public function isImportant(): bool + { + return $this->isImportant; + } + + public function setIsImportant(bool $isImportant): void + { + $this->isImportant = $isImportant; + } + + public function getExcerpt(int $count = 190): string + { + return api_get_short_text_from_html($this->content, $count); + } + + public function getScore(): ?float + { + return $this->score; + } + + public function setScore(?float $score): void + { + $this->score = $score; + } + + /** + * @return \Chamilo\CoreBundle\Entity\PortfolioComment + */ + public function getRoot(): PortfolioComment + { + return $this->root; + } + + public function getLvl(): int + { + return $this->lvl; + } + + public function isTemplate(): bool + { + return $this->isTemplate; + } + + public function setIsTemplate(bool $isTemplate): PortfolioComment + { + $this->isTemplate = $isTemplate; + + return $this; + } + + public function getVisibility(): int + { + return $this->visibility; + } + + public function setVisibility(int $visibility): PortfolioComment + { + $this->visibility = $visibility; + + return $this; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/PortfolioRelTag.php b/src/Chamilo/CoreBundle/Entity/PortfolioRelTag.php new file mode 100644 index 000000000..0b0d59584 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/PortfolioRelTag.php @@ -0,0 +1,88 @@ +id; + } + + public function getTag(): Tag + { + return $this->tag; + } + + public function setTag(Tag $tag): PortfolioRelTag + { + $this->tag = $tag; + + return $this; + } + + public function getCourse(): Course + { + return $this->course; + } + + public function setCourse(Course $course): PortfolioRelTag + { + $this->course = $course; + + return $this; + } + + public function getSession(): ?Session + { + return $this->session; + } + + public function setSession(?Session $session): PortfolioRelTag + { + $this->session = $session; + + return $this; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Promotion.php b/src/Chamilo/CoreBundle/Entity/Promotion.php new file mode 100644 index 000000000..6f405b1ad --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Promotion.php @@ -0,0 +1,221 @@ +id; + } + + /** + * Set name. + * + * @param string $name + * + * @return Promotion + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * Get name. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set description. + * + * @param string $description + * + * @return Promotion + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * Get description. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Set career. + * + * @param Career $career + * + * @return Promotion + */ + public function setCareer($career) + { + $this->career = $career; + + return $this; + } + + /** + * Get career. + * + * @return Career + */ + public function getCareer() + { + return $this->career; + } + + /** + * Set status. + * + * @param int $status + * + * @return Promotion + */ + public function setStatus($status) + { + $this->status = $status; + + return $this; + } + + /** + * Get status. + * + * @return int + */ + public function getStatus() + { + return $this->status; + } + + /** + * Set createdAt. + * + * @param \DateTime $createdAt + * + * @return Promotion + */ + public function setCreatedAt($createdAt) + { + $this->createdAt = $createdAt; + + return $this; + } + + /** + * Get createdAt. + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + * Set updatedAt. + * + * @param \DateTime $updatedAt + * + * @return Promotion + */ + public function setUpdatedAt($updatedAt) + { + $this->updatedAt = $updatedAt; + + return $this; + } + + /** + * Get updatedAt. + * + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->updatedAt; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Repository/AccessUrlRepository.php b/src/Chamilo/CoreBundle/Entity/Repository/AccessUrlRepository.php new file mode 100644 index 000000000..9072d5093 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Repository/AccessUrlRepository.php @@ -0,0 +1,29 @@ +createQueryBuilder('a'); + $qb->select('MIN (a.id)'); + $q = $qb->getQuery(); + + return $q->execute(); + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Repository/BranchSyncRepository.php b/src/Chamilo/CoreBundle/Entity/Repository/BranchSyncRepository.php new file mode 100644 index 000000000..aa903031a --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Repository/BranchSyncRepository.php @@ -0,0 +1,66 @@ +createQueryBuilder('a'); + + //Selecting user info + $qb->select('DISTINCT b'); + + $qb->from('Chamilo\CoreBundle\Entity\BranchSync', 'b'); + + //Selecting courses for users + //$qb->innerJoin('u.courses', 'c'); + + //@todo check app settings + $qb->add('orderBy', 'b.branchName ASC'); + $qb->where('b.branchName LIKE :keyword'); + $qb->setParameter('keyword', "%$keyword%"); + $q = $qb->getQuery(); + + return $q->execute(); + } + + /** + * Gets the first branch with parent_id = NULL. + * + * @return mixed + */ + public function getTopBranch() + { + $qb = $this->createQueryBuilder('a'); + + //Selecting user info + $qb->select('DISTINCT b'); + + $qb->from('Chamilo\CoreBundle\Entity\BranchSync', 'b'); + $qb->where('b.parentId IS NULL'); + $qb->add('orderBy', 'b.id ASC'); + $qb->setMaxResults(1); + $q = $qb->getQuery()->getResult(); + if (empty($q)) { + return null; + } else { + foreach ($q as $result) { + return $result; + } + } + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Repository/CourseCategoryRepository.php b/src/Chamilo/CoreBundle/Entity/Repository/CourseCategoryRepository.php new file mode 100644 index 000000000..6bf8342ae --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Repository/CourseCategoryRepository.php @@ -0,0 +1,77 @@ +createQueryBuilder('c'); + $qb + ->innerJoin( + 'ChamiloCoreBundle:AccessUrlRelCourseCategory', + 'a', + Join::WITH, + 'c = a.courseCategoryId' + ) + ->where($qb->expr()->eq('a.accessUrlId', $accessUrl)) + ->orderBy('c.treePos', 'ASC') + ; + + if ($allowBaseCategories) { + $qb->orWhere($qb->expr()->eq('a.accessUrlId', 1)); + } + + $query = $qb->getQuery(); + + return $query->getResult(); + } + + /** + * Get the number of course categories in an access url. + * + * @param int $accessUrl + * @param bool $allowBaseCategories + * + * @return int + */ + public function countAllInAccessUrl($accessUrl, $allowBaseCategories = false) + { + $qb = $this->createQueryBuilder('c'); + $qb->select('COUNT(c)') + ->innerJoin( + 'ChamiloCoreBundle:AccessUrlRelCourseCategory', + 'a', + Join::WITH, + 'c = a.courseCategoryId' + ) + ->where( + $qb->expr()->eq('a.accessUrlId', $accessUrl) + ); + + if ($allowBaseCategories) { + $qb->orWhere($qb->expr()->eq('a.accessUrlId', 1)); + } + + $count = $qb->getQuery()->getSingleScalarResult(); + + return (int) $count; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Repository/CourseRepository.php b/src/Chamilo/CoreBundle/Entity/Repository/CourseRepository.php new file mode 100644 index 000000000..d8e3a275e --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Repository/CourseRepository.php @@ -0,0 +1,137 @@ +createQueryBuilder('c'); + + // Selecting user info. + $queryBuilder->select('DISTINCT user'); + + // Selecting courses for users. + $queryBuilder->innerJoin('c.users', 'subscriptions'); + $queryBuilder->innerJoin( + 'ChamiloUserBundle:User', + 'user', + Join::WITH, + 'subscriptions.user = user.id' + ); + + if (api_is_western_name_order()) { + $queryBuilder->add('orderBy', 'user.firstname ASC'); + } else { + $queryBuilder->add('orderBy', 'user.lastname ASC'); + } + + $wherePart = $queryBuilder->expr()->andx(); + + // Get only users subscribed to this course + $wherePart->add($queryBuilder->expr()->eq('c.id', $course->getId())); + $queryBuilder->where($wherePart); + + return $queryBuilder; + } + + /** + * Gets students subscribed in the course. + * + * @return QueryBuilder + */ + public function getSubscribedStudents(Course $course) + { + return self::getSubscribedUsersByStatus($course, STUDENT); + } + + /** + * Gets the students subscribed in the course. + * + * @return QueryBuilder + */ + public function getSubscribedCoaches(Course $course) + { + $queryBuilder = $this->getSubscribedUsers($course); + //@todo add criterias + return $queryBuilder; + } + + /** + * Gets the teachers subscribed in the course. + * + * @return QueryBuilder + */ + public function getSubscribedTeachers(Course $course) + { + return self::getSubscribedUsersByStatus($course, COURSEMANAGER); + } + + /** + * @param int $status use legacy chamilo constants COURSEMANAGER|STUDENT + * + * @return QueryBuilder + */ + public function getSubscribedUsersByStatus(Course $course, $status) + { + $queryBuilder = $this->getSubscribedUsers($course); + $wherePart = $queryBuilder->expr()->andx(); + $wherePart->add($queryBuilder->expr()->eq('c.status', $status)); + + return $queryBuilder; + } + + public function getCoursesWithNoSession($urlId) + { + $queryBuilder = $this->createQueryBuilder('c'); + $criteria = Criteria::create(); + $queryBuilder = $queryBuilder + ->select('c') + ->leftJoin('c.urls', 'u') + ->leftJoin('c.sessions', 's') + /*->leftJoin( + 'ChamiloCoreBundle:SessionRelCourse', + 'sc', + Join::WITH, + 'c != sc.course' + )->leftJoin( + 'ChamiloCoreBundle:AccessUrlRelCourse', + 'ac', + Join::WITH, + 'c = ac.course' + )*/ + ->where($queryBuilder->expr()->isNull('s')) + //->where($queryBuilder->expr()->eq('s', 0)) + ->where($queryBuilder->expr()->eq('u.url', $urlId)) + ->getQuery(); + + $courses = $queryBuilder->getResult(); + $courseList = []; + /** @var Course $course */ + foreach ($courses as $course) { + if (empty($course->getSessions()->count() == 0)) { + $courseList[] = $course; + } + } + + return $courseList; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Repository/ExtraFieldOptionsRepository.php b/src/Chamilo/CoreBundle/Entity/Repository/ExtraFieldOptionsRepository.php new file mode 100644 index 000000000..16856315c --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Repository/ExtraFieldOptionsRepository.php @@ -0,0 +1,37 @@ +createQueryBuilder('so'); + $qb + ->where( + $qb->expr()->eq('so.field', $option->getField()->getId()) + ) + ->andWhere( + $qb->expr()->eq('so.value', $option->getId()) + ) + ->orderBy('so.displayText', 'ASC'); + + return $qb + ->getQuery() + ->getResult(); + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Repository/ExtraFieldRelTagRepository.php b/src/Chamilo/CoreBundle/Entity/Repository/ExtraFieldRelTagRepository.php new file mode 100644 index 000000000..6cbb2ffed --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Repository/ExtraFieldRelTagRepository.php @@ -0,0 +1,83 @@ + + */ +class ExtraFieldRelTagRepository extends EntityRepository +{ + /** + * Get the tags for a item. + * + * @param ExtraField $extraField The extrafield + * @param int $itemId The item ID + * + * @return array + */ + public function getTags(ExtraField $extraField, $itemId) + { + $queryBuilder = $this->createQueryBuilder('ft'); + + $queryBuilder->select('t') + ->innerJoin( + 'ChamiloCoreBundle:Tag', + 't', + Join::WITH, + 'ft.tagId = t.id' + ) + ->where( + $queryBuilder->expr()->andX( + $queryBuilder->expr()->eq('ft.itemId', intval($itemId)), + $queryBuilder->expr()->eq('ft.fieldId', $extraField->getId()) + ) + ); + + return $queryBuilder->getQuery()->getResult(); + } + + public function getTagsByUserMessages(int $userId) + { + $qb = $this->createQueryBuilder('eft'); + $qb + ->select('t') + ->distinct(true) + ->innerJoin('ChamiloCoreBundle:Tag', 't', Join::WITH, 'eft.tagId = t.id AND eft.fieldId = t.fieldId') + ->innerJoin('ChamiloCoreBundle:ExtraField', 'ef', Join::WITH, 'eft.fieldId = ef.id') + ->innerJoin('ChamiloCoreBundle:Message', 'm', Join::WITH, 'eft.itemId = m.id') + ->where($qb->expr()->eq('ef.variable', ':variable')) + ->andWhere($qb->expr()->eq('ef.extraFieldType', ':extraFieldType')) + ->andWhere( + $qb->expr()->orX( + $qb->expr()->andX( + $qb->expr()->eq('m.userReceiverId', ':userId'), + $qb->expr()->in('m.msgStatus', [MESSAGE_STATUS_NEW, MESSAGE_STATUS_UNREAD]) + ), + $qb->expr()->andX( + $qb->expr()->eq('m.userSenderId', ':userId'), + $qb->expr()->in('m.msgStatus', [MESSAGE_STATUS_OUTBOX]) + ) + ) + ) + ->orderBy('t.tag', 'ASC') + ->setParameters( + [ + 'variable' => 'tags', + 'extraFieldType' => ExtraField::MESSAGE_TYPE, + 'userId' => $userId, + ] + ) + ; + + return $qb->getQuery()->getResult(); + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Repository/ExtraFieldValuesRepository.php b/src/Chamilo/CoreBundle/Entity/Repository/ExtraFieldValuesRepository.php new file mode 100644 index 000000000..6c168c069 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Repository/ExtraFieldValuesRepository.php @@ -0,0 +1,48 @@ + + */ +class ExtraFieldValuesRepository extends EntityRepository +{ + /** + * Get the extra field values for visible extra fields. + * + * @param int $extraFieldType The type of extra field + * @param int $itemId The item ID + * + * @return array + */ + public function getVisibleValues($extraFieldType, $itemId) + { + $queryBuilder = $this->createQueryBuilder('fv'); + + $queryBuilder + ->innerJoin( + 'ChamiloCoreBundle:ExtraField', + 'f', + Join::WITH, + 'fv.field = f.id' + ) + ->where( + $queryBuilder->expr()->andX( + $queryBuilder->expr()->eq('f.extraFieldType', intval($extraFieldType)), + $queryBuilder->expr()->eq('fv.itemId', intval($itemId)), + $queryBuilder->expr()->eq('f.visibleToSelf', true) + ) + ) + ; + + return $queryBuilder->getQuery()->getResult(); + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Repository/ItemPropertyRepository.php b/src/Chamilo/CoreBundle/Entity/Repository/ItemPropertyRepository.php new file mode 100644 index 000000000..7f171b1aa --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Repository/ItemPropertyRepository.php @@ -0,0 +1,355 @@ + $tool, + 'lasteditType' => 'LearnpathSubscription', + 'ref' => $itemId, + 'course' => $course, + 'session' => $session, + 'group' => $group, + ]; + + return $this->findBy($criteria); + } + + public function findByUserSuscribedToItem( + $tool, + $itemId, + int $userId, + int $courseId, + int $sessionId = null + ): ?CItemProperty { + $criteria = [ + 'tool' => $tool, + 'lasteditType' => 'LearnpathSubscription', + 'ref' => $itemId, + 'toUser' => $userId, + 'course' => $courseId, + 'session' => $sessionId ?: null, + 'group' => null, + ]; + + return $this->findOneBy($criteria); + } + + public function findByGroupSuscribedToLp( + $tool, + $lpId, + int $groupId, + int $courseId, + int $sessionId = 0 + ): ?CItemProperty { + $criteria = [ + 'tool' => $tool, + 'lasteditType' => 'LearnpathSubscription', + 'ref' => $lpId, + 'toUser' => null, + 'course' => $courseId, + 'session' => $sessionId ?: null, + 'group' => $groupId, + ]; + + return $this->findOneBy($criteria); + } + + /** + * Get Groups subscribed to a item: LP, Doc, etc. + * + * @param string $tool learnpath | document | etc + * @param int $itemId + * @param Session $session + * + * @return array + */ + public function getGroupsSubscribedToItem( + $tool, + $itemId, + Course $course, + Session $session = null + ) { + $criteria = [ + 'tool' => $tool, + 'lasteditType' => 'LearnpathSubscription', + 'ref' => $itemId, + 'course' => $course, + 'session' => $session, + 'toUser' => null, + ]; + + return $this->findBy($criteria); + } + + /** + * Subscribe groups to a LP, doc (itemproperty). + * + * @param User $currentUser + * @param string $tool learnpath | document | etc + * @param Session $session + * @param int $itemId + * @param array $newList + */ + public function subscribeGroupsToItem( + $currentUser, + $tool, + Course $course, + Session $session = null, + $itemId, + $newList = [] + ) { + $em = $this->getEntityManager(); + $groupsSubscribedToItem = $this->getGroupsSubscribedToItem( + $tool, + $itemId, + $course, + $session + ); + + $alreadyAdded = []; + if ($groupsSubscribedToItem) { + /** @var CItemProperty $itemProperty */ + foreach ($groupsSubscribedToItem as $itemProperty) { + $getGroup = $itemProperty->getGroup(); + if (!empty($getGroup)) { + $alreadyAdded[] = $getGroup->getId(); + } + } + } + + $toDelete = $alreadyAdded; + + if (!empty($newList)) { + $toDelete = array_diff($alreadyAdded, $newList); + } + + if ($toDelete) { + $this->unsubscribeGroupsToItem( + $tool, + $course, + $session, + $itemId, + $toDelete, + true + ); + } + + foreach ($newList as $groupId) { + if (!in_array($groupId, $alreadyAdded)) { + $item = new CItemProperty($course); + $groupObj = $em->find('ChamiloCourseBundle:CGroupInfo', $groupId); + $item->setGroup($groupObj); + $item->setTool($tool); + $item->setRef($itemId); + $item->setInsertUser($currentUser); + + if (!empty($session)) { + $item->setSession($session); + } + $item->setLasteditType('LearnpathSubscription'); + $item->setVisibility('1'); + $em->persist($item); //$em is an instance of EntityManager + } + } + + $em->flush(); + } + + /** + * Unsubscribe groups to item. + * + * @param string $tool + * @param Session $session + * @param int $itemId + * @param array $groups + * @param bool $unsubscribeUserToo + */ + public function unsubscribeGroupsToItem( + $tool, + Course $course, + Session $session = null, + $itemId, + $groups, + $unsubscribeUserToo = false + ) { + if (!empty($groups)) { + $em = $this->getEntityManager(); + + foreach ($groups as $groupId) { + $item = $this->findOneBy([ + 'tool' => $tool, + 'session' => $session, + 'ref' => $itemId, + 'group' => $groupId, + ]); + if ($item) { + $em->remove($item); + } + + if ($unsubscribeUserToo) { + //Adding users from this group to the item + $users = \GroupManager::getStudentsAndTutors($groupId); + $newUserList = []; + if (!empty($users)) { + foreach ($users as $user) { + $newUserList[] = $user['user_id']; + } + $this->unsubcribeUsersToItem( + 'learnpath', + $course, + $session, + $itemId, + $newUserList + ); + } + } + } + $em->flush(); + } + } + + /** + * Subscribe users to a LP, doc (itemproperty). + * + * @param User $currentUser + * @param string $tool + * @param Session $session + * @param int $itemId + * @param array $newUserList + * @param bool $deleteUsers + */ + public function subscribeUsersToItem( + $currentUser, + $tool, + Course $course, + Session $session = null, + $itemId, + $newUserList = [], + $deleteUsers = true + ) { + $em = $this->getEntityManager(); + $user = $em->getRepository('ChamiloUserBundle:User'); + + $usersSubscribedToItem = $this->getUsersSubscribedToItem( + $tool, + $itemId, + $course, + $session + ); + + $alreadyAddedUsers = []; + if ($usersSubscribedToItem) { + /** @var CItemProperty $itemProperty */ + foreach ($usersSubscribedToItem as $itemProperty) { + $getToUser = $itemProperty->getToUser(); + if (!empty($getToUser)) { + $alreadyAddedUsers[] = $itemProperty->getToUser()->getId(); + } + } + } + + if ($deleteUsers) { + $usersToDelete = $alreadyAddedUsers; + if (!empty($newUserList)) { + $usersToDelete = array_diff($alreadyAddedUsers, $newUserList); + } + + if ($usersToDelete) { + $this->unsubcribeUsersToItem( + $tool, + $course, + $session, + $itemId, + $usersToDelete + ); + } + } + + foreach ($newUserList as $userId) { + if (!in_array($userId, $alreadyAddedUsers)) { + $userObj = $user->find($userId); + + $item = new CItemProperty($course); + $item + ->setToUser($userObj) + ->setTool($tool) + ->setInsertUser($currentUser) + ->setRef($itemId); + + if (!empty($session)) { + $item->setSession($session); + } + $item->setLasteditType('LearnpathSubscription'); + $item->setVisibility('1'); + $em->persist($item); //$em is an instance of EntityManager + } + } + + $em->flush(); + } + + /** + * Unsubscribe users to item. + * + * @param string $tool + * @param Session $session + * @param int $itemId + * @param array $usersToDelete + */ + public function unsubcribeUsersToItem( + $tool, + Course $course, + Session $session = null, + $itemId, + $usersToDelete + ) { + $em = $this->getEntityManager(); + + if (!empty($usersToDelete)) { + foreach ($usersToDelete as $userId) { + $item = $this->findOneBy( + [ + 'tool' => $tool, + 'session' => $session, + 'ref' => $itemId, + 'toUser' => $userId, + ] + ); + if ($item) { + $em->remove($item); + } + } + $em->flush(); + } + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Repository/LanguageRepository.php b/src/Chamilo/CoreBundle/Entity/Repository/LanguageRepository.php new file mode 100644 index 000000000..2694db6f7 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Repository/LanguageRepository.php @@ -0,0 +1,33 @@ +createQueryBuilder('l'); + $qb->select('l') + ->where( + $qb->expr()->eq('l.available', true) + ) + ->andWhere( + $qb->expr()->isNotNull('l.parent') + ); + + return $qb->getQuery()->getResult(); + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Repository/LegalRepository.php b/src/Chamilo/CoreBundle/Entity/Repository/LegalRepository.php new file mode 100644 index 000000000..9eecf7e76 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Repository/LegalRepository.php @@ -0,0 +1,53 @@ +createQueryBuilder('l'); + $qb->select('l.languageId, COUNT(l.id)') + ->groupBy('l.languageId'); + + return count($qb->getQuery()->getResult()); + } + + /** + * Get the latest version of terms of the given type and language. + * + * @param int $typeId The type of terms: + * 0 for general text, + * 1 for general HTML link, + * 101 for private data collection, + * etc - see personal_data.php + * @param int $languageId The Id of the language + * + * @return array The terms for those type and language + */ + public function findOneByTypeAndLanguage($typeId, $languageId) + { + $qb = $this->createQueryBuilder('l'); + $qb->select('l.content') + ->where($qb->expr()->eq('l.type', $typeId)) + ->andWhere($qb->expr()->eq('l.languageId', $languageId)); + + return $qb->getQuery()->getResult(); + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Repository/PersonalAgendaRepository.php b/src/Chamilo/CoreBundle/Entity/Repository/PersonalAgendaRepository.php new file mode 100644 index 000000000..3fc63abb3 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Repository/PersonalAgendaRepository.php @@ -0,0 +1,85 @@ + + */ + public function getEventsForInvitee(User $user, ?\DateTime $startDate, ?\DateTime $endDate): array + { + $qb = $this->createQueryBuilder('pa'); + $qb + ->innerJoin('pa.invitation', 'i') + ->innerJoin('i.invitees', 'iu') + ->where( + $qb->expr()->eq('iu.user', ':user') + ) + ; + + if (api_get_configuration_value('agenda_event_subscriptions')) { + $qb + ->andWhere( + $qb->expr()->not( + $qb->expr()->isInstanceOf('i', AgendaEventSubscription::class) + ) + ) + ; + } + + $params = [ + 'user' => $user, + ]; + + if ($startDate) { + $qb->andWhere( + $qb->expr()->gte('pa.date', ':start_date') + ); + + $params['start_date'] = $startDate; + } + + if ($endDate) { + $qb->andWhere( + $qb->expr()->lte('pa.enddate', ':end_date') + ); + + $params['end_date'] = $endDate; + } + + $qb->setParameters($params); + + return $qb->getQuery()->getResult(); + } + + public function findOneByIdAndInvitee(int $eventId, User $user): ?PersonalAgenda + { + $qb = $this->createQueryBuilder('pa'); + $qb + ->innerJoin('pa.invitation', 'i') + ->innerJoin('i.invitees', 'iu') + ->where( + $qb->expr()->eq('pa.id', ':id') + ) + ->andWhere( + $qb->expr()->eq('iu.user', ':user') + ) + ->setParameters(['id' => $eventId, 'user' => $user]) + ; + + try { + return $qb->getQuery()->getOneOrNullResult(); + } catch (NonUniqueResultException $e) { + return null; + } + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Repository/PortfolioAttachmentRepository.php b/src/Chamilo/CoreBundle/Entity/Repository/PortfolioAttachmentRepository.php new file mode 100644 index 000000000..e48f373d2 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Repository/PortfolioAttachmentRepository.php @@ -0,0 +1,56 @@ +findBy( + [ + 'origin' => $item->getId(), + 'originType' => PortfolioAttachment::TYPE_ITEM, + ] + ); + } + + /** + * @return array + */ + public function findFromComment(PortfolioComment $comment): array + { + return $this->findBy( + [ + 'origin' => $comment->getId(), + 'originType' => PortfolioAttachment::TYPE_COMMENT, + ] + ); + } + + /** + * @throws OptimisticLockException + * @throws ORMException + */ + public function removeFromComment(PortfolioComment $comment) + { + $comments = $this->findFromComment($comment); + + foreach ($comments as $comment) { + $this->_em->remove($comment); + } + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Repository/PortfolioCommentRepository.php b/src/Chamilo/CoreBundle/Entity/Repository/PortfolioCommentRepository.php new file mode 100644 index 000000000..c9f018a65 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Repository/PortfolioCommentRepository.php @@ -0,0 +1,49 @@ +createQueryBuilder('comment'); + $qbComments + ->where('comment.author = :owner') + ->setParameter('owner', $user); + + if ($course) { + $qbComments + ->join('comment.item', 'item') + ->andWhere('item.course = :course') + ->setParameter('course', $course); + + if ($session) { + $qbComments + ->andWhere('item.session = :session') + ->setParameter('session', $session); + } else { + $qbComments->andWhere('item.session IS NULL'); + } + } + + if ($orderBy) { + foreach ($orderBy as $sort => $order) { + $qbComments->addOrderBy($sort, $order); + } + } + + return $qbComments->getQuery()->getResult(); + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Repository/PortfolioRepository.php b/src/Chamilo/CoreBundle/Entity/Repository/PortfolioRepository.php new file mode 100644 index 000000000..16216cdb5 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Repository/PortfolioRepository.php @@ -0,0 +1,35 @@ +findBy($criteria, $orderBy); + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Repository/SequenceRepository.php b/src/Chamilo/CoreBundle/Entity/Repository/SequenceRepository.php new file mode 100644 index 000000000..f06a1b699 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Repository/SequenceRepository.php @@ -0,0 +1,109 @@ +getEntityManager()->getRepository('ChamiloCoreBundle:Course'); + + break; + case SequenceResource::SESSION_TYPE: + $repo = $this->getEntityManager()->getRepository('ChamiloCoreBundle:Session'); + + break; + } + + if ($repo) { + $resource = $repo->find($itemId); + } + + return $resource; + } + + /** + * @param int $id + */ + public function removeSequence($id) + { + $sequence = $this->find($id); + $em = $this->getEntityManager(); + $em + ->createQuery('DELETE FROM ChamiloCoreBundle:SequenceResource sr WHERE sr.sequence = :seq') + ->execute(['seq' => $sequence]); + + $em->remove($sequence); + $em->flush(); + } + + /** + * @param string $type + * + * @return array + */ + public function findAllToSelect($type) + { + $qb = $this->createQueryBuilder('r'); + $qb + ->leftJoin('ChamiloCoreBundle:SequenceResource', 'sr', Join::WITH, 'sr.sequence = r'); + + $qb + ->andWhere( + $qb->expr()->orX( + $qb->expr()->isNull('r.graph'), + $qb->expr()->eq('sr.type', $type) + ) + ) + ->orderBy('r.name'); + + return $qb->getQuery()->getResult(); + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Repository/SequenceResourceRepository.php b/src/Chamilo/CoreBundle/Entity/Repository/SequenceResourceRepository.php new file mode 100644 index 000000000..50ada8ac9 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Repository/SequenceResourceRepository.php @@ -0,0 +1,463 @@ +findOneBy(['resourceId' => $resourceId, 'type' => $type]); + } + + /** + * @todo implement for all types only work for sessions + * + * @param int $resourceId + * @param int $type + */ + public function getRequirementAndDependencies($resourceId, $type): array + { + $sequence = $this->findRequirementForResource($resourceId, $type); + $result = ['requirements' => [], 'dependencies' => []]; + if ($sequence && $sequence->hasGraph()) { + $graph = $sequence->getSequence()->getUnSerializeGraph(); + $vertex = $graph->getVertex($resourceId); + $from = $vertex->getVerticesEdgeFrom(); + + foreach ($from as $subVertex) { + $vertexId = $subVertex->getId(); + $sessionInfo = api_get_session_info($vertexId); + $sessionInfo['admin_link'] = ''.$sessionInfo['name'].''; + $result['requirements'][] = $sessionInfo; + } + + $to = $vertex->getVerticesEdgeTo(); + foreach ($to as $subVertex) { + $vertexId = $subVertex->getId(); + $sessionInfo = api_get_session_info($vertexId); + $sessionInfo['admin_link'] = ''.$sessionInfo['name'].''; + $result['dependencies'][] = $sessionInfo; + } + } + + return $result; + } + + /** + * Deletes a node and check in all the dependencies if the node exists in + * order to delete. + * + * @param int $resourceId + * @param int $type + * + * @throws ORMException + * @throws OptimisticLockException + */ + public function deleteResource($resourceId, $type) + { + $sequence = $this->findRequirementForResource($resourceId, $type); + if ($sequence && $sequence->hasGraph()) { + $em = $this->getEntityManager(); + $graph = $sequence->getSequence()->getUnSerializeGraph(); + $mainVertex = $graph->getVertex($resourceId); + $vertices = $graph->getVertices(); + + /** @var Vertex $vertex */ + foreach ($vertices as $vertex) { + $subResourceId = $vertex->getId(); + $subSequence = $this->findRequirementForResource($subResourceId, $type); + if ($sequence && $subSequence->hasGraph()) { + $graph = $subSequence->getSequence()->getUnSerializeGraph(); + $subMainVertex = $graph->getVertex($resourceId); + $subMainVertex->destroy(); + $subSequence->getSequence()->setGraphAndSerialize($graph); + $em->persist($subSequence); + } + } + + $mainVertex->destroy(); + $em->remove($sequence); + $em->flush(); + } + } + + /** + * Get the requirements for a resource only. + * + * @param int $resourceId The resource ID + * @param int $type The type of sequence resource + */ + public function getRequirements($resourceId, $type): array + { + return $this->getRequirementsOrDependents($resourceId, $type, self::VERTICES_TYPE_REQ); + } + + /** + * Get the requirements for a resource only. + */ + public function getDependents(int $resourceId, int $type): array + { + return $this->getRequirementsOrDependents($resourceId, $type, self::VERTICES_TYPE_DEP); + } + + /** + * Get the requirements and dependencies within a sequence for a resource. + */ + public function getRequirementsAndDependenciesWithinSequences(int $resourceId, int $type): array + { + $sequencesResource = $this->findBy([ + 'resourceId' => $resourceId, + 'type' => $type, + ]); + + $result = []; + + /** @var SequenceResource $sequenceResource */ + foreach ($sequencesResource as $sequenceResource) { + if (!$sequenceResource->hasGraph()) { + continue; + } + + $sequence = $sequenceResource->getSequence(); + $graph = $sequence->getUnSerializeGraph(); + $vertex = $graph->getVertex($resourceId); + $from = $vertex->getVerticesEdgeFrom(); + $to = $vertex->getVerticesEdgeTo(); + + $requirements = $this->findVerticesEdges($from, $type); + $dependencies = $this->findVerticesEdges($to, $type); + + $result[$sequence->getId()] = [ + 'name' => $sequence->getName(), + 'requirements' => $requirements, + 'dependencies' => $dependencies, + ]; + } + + return $result; + } + + /** + * Check if the ser has completed the requirements for the sequences. + * + * @param array $sequences The sequences + * @param int $type The type of sequence resource + * @param int $userId + * @param int $sessionId + */ + public function checkRequirementsForUser(array $sequences, int $type, $userId, $sessionId = 0): array + { + return $this->checkRequirementsOrDependentsForUser( + $sequences, + $type, + self::VERTICES_TYPE_REQ, + $userId, + $sessionId + ); + } + + /** + * Check if the ser has completed the requirements for the sequences. + * + * @param array $sequences The sequences + * @param int $type The type of sequence resource + * @param int $userId + * @param int $sessionId + */ + public function checkDependentsForUser(array $sequences, int $type, $userId, $sessionId = 0): array + { + return $this->checkRequirementsOrDependentsForUser( + $sequences, + $type, + self::VERTICES_TYPE_DEP, + $userId, + $sessionId + ); + } + + public function checkCourseRequirements($userId, Course $course, $sessionId): bool + { + $em = $this->getEntityManager(); + $sessionId = (int) $sessionId; + + $gradebookCategoryRepo = $em->getRepository('ChamiloCoreBundle:GradebookCategory'); + $gradebooks = $gradebookCategoryRepo->findBy( + [ + 'courseCode' => $course->getCode(), + 'sessionId' => $sessionId, + 'isRequirement' => true, + ] + ); + + if (empty($gradebooks)) { + return false; + } + + $status = true; + foreach ($gradebooks as $gradebook) { + $category = Category::createCategoryObjectFromEntity($gradebook); + $userFinishedCourse = Category::userFinishedCourse( + $userId, + $category, + true + ); + if (0 === $sessionId) { + if (false === $userFinishedCourse) { + $status = false; + break; + } + } else { + if (false === $userFinishedCourse) { + $status = false; + break; + } + } + } + + return $status; + } + + /** + * Check if at least one sequence are completed. + */ + public function checkSequenceAreCompleted(array $sequences, $itemType = self::VERTICES_TYPE_REQ): bool + { + foreach ($sequences as $sequence) { + $status = true; + + foreach ($sequence[$itemType] as $item) { + $status = $status && $item['status']; + } + + if ($status) { + return true; + } + } + + return false; + } + + /** + * Get sessions from vertices. + */ + protected function findVerticesEdges(Vertices $verticesEdges, int $type): array + { + $sessionVertices = []; + $em = $this->getEntityManager(); + + foreach ($verticesEdges as $supVertex) { + $vertexId = $supVertex->getId(); + switch ($type) { + case SequenceResource::SESSION_TYPE: + $resource = $em->getRepository('ChamiloCoreBundle:Session')->find($vertexId); + break; + case SequenceResource::COURSE_TYPE: + $resource = $em->getRepository('ChamiloCoreBundle:Course')->find($vertexId); + break; + } + + if (empty($resource)) { + continue; + } + + $sessionVertices[$vertexId] = $resource; + } + + return $sessionVertices; + } + + private function checkRequirementsOrDependentsForUser( + array $sequences, + int $resourceType, + string $itemType, + int $userId, + int $sessionId = 0 + ): array { + $sequenceList = []; + $em = $this->getEntityManager(); + $gradebookCategoryRepo = $em->getRepository(GradebookCategory::class); + + $sessionUserList = []; + $checkOnlySameSession = api_get_configuration_value('course_sequence_valid_only_in_same_session'); + if (SequenceResource::COURSE_TYPE === $resourceType) { + if ($checkOnlySameSession) { + $sessionUserList = [$sessionId]; + } else { + $criteria = ['user' => $userId]; + $sessions = $em->getRepository('ChamiloCoreBundle:SessionRelUser')->findBy($criteria); + if ($sessions) { + /** @var SessionRelUser $sessionRelUser */ + foreach ($sessions as $sessionRelUser) { + $sessionUserList[] = $sessionRelUser->getSession()->getId(); + } + } + } + } + + foreach ($sequences as $sequenceId => $sequence) { + $item = [ + 'name' => $sequence['name'], + $itemType => [], + ]; + $resourceItem = null; + + foreach ($sequence[$itemType] as $resource) { + switch ($resourceType) { + case SequenceResource::SESSION_TYPE: + /** @var Session $resource */ + $id = $resource->getId(); + $resourceItem = [ + 'name' => $resource->getName(), + 'status' => true, + ]; + + $sessionsCourses = $resource->getCourses(); + foreach ($sessionsCourses as $sessionCourse) { + $course = $sessionCourse->getCourse(); + $gradebooks = $gradebookCategoryRepo->findBy( + [ + 'courseCode' => $course->getCode(), + 'sessionId' => $resource->getId(), + 'isRequirement' => true, + ] + ); + + foreach ($gradebooks as $gradebook) { + $category = Category::createCategoryObjectFromEntity($gradebook); + if (!empty($userId)) { + $resourceItem['status'] = $resourceItem['status'] && Category::userFinishedCourse( + $userId, + $category + ); + } + } + } + break; + case SequenceResource::COURSE_TYPE: + $id = $resource->getId(); + $checkSessionId = 0; + if ($checkOnlySameSession) { + $checkSessionId = $sessionId; + } + $status = $this->checkCourseRequirements($userId, $resource, $checkSessionId); + + if (false === $status) { + $sessionsInCourse = SessionManager::get_session_by_course($id); + foreach ($sessionsInCourse as $session) { + if (in_array($session['id'], $sessionUserList)) { + $status = $this->checkCourseRequirements($userId, $resource, $session['id']); + if (true === $status) { + break; + } + } + } + } + + $resourceItem = [ + 'name' => $resource->getTitle(), + 'code' => $resource->getCode(), + 'status' => $status, + ]; + + break; + } + + if (empty($id)) { + continue; + } + + $item[$itemType][$id] = $resourceItem; + } + $sequenceList[$sequenceId] = $item; + } + + return $sequenceList; + } + + /** + * Get the requirements or dependants for a resource only. + */ + private function getRequirementsOrDependents($resourceId, int $resourceType, string $itemType): array + { + $em = $this->getEntityManager(); + + $sequencesResource = $this->findBy(['resourceId' => $resourceId, 'type' => $resourceType]); + $result = []; + + /** @var SequenceResource $sequenceResource */ + foreach ($sequencesResource as $sequenceResource) { + if (!$sequenceResource->hasGraph()) { + continue; + } + + $sequence = $sequenceResource->getSequence(); + $graph = $sequence->getUnSerializeGraph(); + $vertex = $graph->getVertex($resourceId); + + if (self::VERTICES_TYPE_REQ === $itemType) { + $edges = $vertex->getVerticesEdgeFrom(); + } else { + $edges = $vertex->getVerticesEdgeTo(); + } + + $sequenceInfo = [ + 'name' => $sequence->getName(), + $itemType => [], + ]; + + foreach ($edges as $edge) { + $vertexId = $edge->getId(); + $resource = null; + switch ($resourceType) { + case SequenceResource::SESSION_TYPE: + $repo = $em->getRepository(Session::class); + $resource = $repo->find($vertexId); + + break; + case SequenceResource::COURSE_TYPE: + $repo = $em->getRepository(Course::class); + $resource = $repo->find($vertexId); + + break; + } + + if (null === $resource) { + continue; + } + + $sequenceInfo[$itemType][$vertexId] = $resource; + } + + $result[$sequence->getId()] = $sequenceInfo; + } + + return $result; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Repository/SessionRepository.php b/src/Chamilo/CoreBundle/Entity/Repository/SessionRepository.php new file mode 100644 index 000000000..effe3b299 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Repository/SessionRepository.php @@ -0,0 +1,47 @@ + + * @author Julio Montoya + */ +class SessionRepository extends EntityRepository +{ + /** + * Get session's courses ordered by position in session_rel_course. + * + * @param Session $session The session + * + * @return Course[] + */ + public function getCoursesOrderedByPosition(Session $session) + { + $queryBuilder = $this->createQueryBuilder('s'); + + $queryBuilder->select('DISTINCT c ') + ->innerJoin('s.courses', 'src') + ->innerJoin( + 'ChamiloCoreBundle:Course', + 'c', + Join::WITH, + 'src.course = c.id' + ) + ->where( + $queryBuilder->expr()->eq('s.id', $session->getId()) + ) + ->orderBy('src.position'); + + return $queryBuilder->getQuery()->getResult(); + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Repository/SkillRepository.php b/src/Chamilo/CoreBundle/Entity/Repository/SkillRepository.php new file mode 100644 index 000000000..244614759 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Repository/SkillRepository.php @@ -0,0 +1,62 @@ + + */ +class SkillRepository extends EntityRepository +{ + /** + * Get the last acquired skill by a user on course and/or session. + * + * @param User $user The user + * @param Course $course The course + * @param Session $session The session + * + * @return Skill + */ + public function getLastByUser(User $user, Course $course = null, Session $session = null) + { + $qb = $this->createQueryBuilder('s'); + + $qb + ->innerJoin( + 'ChamiloCoreBundle:SkillRelUser', + 'su', + Join::WITH, + 's.id = su.skill' + ) + ->where( + $qb->expr()->eq('su.user', $user->getId()) + ); + + if ($course) { + $qb->andWhere( + $qb->expr()->eq('su.course', $course->getId()) + ); + } + + if ($session) { + $qb->andWhere( + $qb->expr()->eq('su.session', $session->getId()) + ); + } + + $qb + ->setMaxResults(1) + ->orderBy('su.id', 'DESC'); + + return $qb->getQuery()->getOneOrNullResult(); + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Repository/TagRepository.php b/src/Chamilo/CoreBundle/Entity/Repository/TagRepository.php new file mode 100644 index 000000000..550b7faa9 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Repository/TagRepository.php @@ -0,0 +1,57 @@ +createQueryBuilder('t') + ->where("t.tag LIKE :text") + ->andWhere('t.fieldId = :field'); + + if ($limit > 0) { + $qb->setMaxResults($limit); + } + + return $qb + ->setParameter('field', $field) + ->setParameter('text', "$text%") + ->getQuery() + ->getResult(); + } + + public function findForPortfolioInCourseQuery(Course $course, ?Session $session = null): QueryBuilder + { + $qb = $this + ->createQueryBuilder('t') + ->innerJoin(PortfolioRelTag::class, 'prt', Join::WITH, 't = prt.tag') + ->where('prt.course = :course') + ->setParameter('course', $course) + ; + + if ($session) { + $qb + ->andWhere('prt.session = :session') + ->setParameter('session', $session) + ; + } else { + $qb->andWhere('prt.session IS NULL'); + } + + return $qb; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Repository/TemplatesRepository.php b/src/Chamilo/CoreBundle/Entity/Repository/TemplatesRepository.php new file mode 100644 index 000000000..e97848aef --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Repository/TemplatesRepository.php @@ -0,0 +1,50 @@ +createQueryBuilder('t'); + + $qb->select('t', 'd.path') + ->innerJoin( + 'ChamiloCoreBundle:Course', + 'c', + Join::WITH, + $qb->expr()->eq('t.courseCode', 'c.code') + ) + ->innerJoin( + 'ChamiloCourseBundle:CDocument', + 'd', + Join::WITH, + $qb->expr()->eq('c.id', 'd.cId') + ) + ->where( + $qb->expr()->eq('d.iid', 't.refDoc') + ) + ->andWhere( + $qb->expr()->eq('c.id', $course->getId()) + ) + ->andWhere( + $qb->expr()->eq('t.userId', $user->getId()) + ); + + return $qb->getQuery()->getResult(); + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Repository/TrackECourseAccessRepository.php b/src/Chamilo/CoreBundle/Entity/Repository/TrackECourseAccessRepository.php new file mode 100644 index 000000000..c1e0a30a7 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Repository/TrackECourseAccessRepository.php @@ -0,0 +1,45 @@ + + */ +class TrackECourseAccessRepository extends EntityRepository +{ + /** + * Get the last registered access by an user. + * + * @param User $user The user + * + * @return TrackECourseAccess The access if exists. + * Otherwise return null + */ + public function getLastAccessByUser(User $user) + { + if (empty($user)) { + return null; + } + + $lastAccess = $this->findBy( + ['userId' => $user->getId()], + ['courseAccessId' => 'DESC'], + 1 + ); + + if (!empty($lastAccess)) { + return $lastAccess[0]; + } + + return null; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Room.php b/src/Chamilo/CoreBundle/Entity/Room.php new file mode 100644 index 000000000..a6912c1c3 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Room.php @@ -0,0 +1,201 @@ +id; + } + + /** + * Set title. + * + * @param string $title + * + * @return $this + */ + public function setTitle($title) + { + $this->title = $title; + + return $this; + } + + /** + * Get title. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * @param string $description + * + * @return Room + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * @return string + */ + public function getGeolocation() + { + return $this->geolocation; + } + + /** + * @param string $geolocation + * + * @return Room + */ + public function setGeolocation($geolocation) + { + $this->geolocation = $geolocation; + + return $this; + } + + /** + * @return string + */ + public function getIp() + { + return $this->ip; + } + + /** + * @param string $ip + * + * @return Room + */ + public function setIp($ip) + { + $this->ip = $ip; + + return $this; + } + + /** + * @return string + */ + public function getIpMask() + { + return $this->ipMask; + } + + /** + * @param string $ipMask + * + * @return Room + */ + public function setIpMask($ipMask) + { + $this->ipMask = $ipMask; + + return $this; + } + + /** + * @return BranchSync + */ + public function getBranch() + { + return $this->branch; + } + + /** + * @param BranchSync $branch + * + * @return $this + */ + public function setBranch($branch) + { + $this->branch = $branch; + + return $this; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/SearchEngineRef.php b/src/Chamilo/CoreBundle/Entity/SearchEngineRef.php new file mode 100644 index 000000000..bd7b43edd --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/SearchEngineRef.php @@ -0,0 +1,189 @@ +courseCode = $courseCode; + + return $this; + } + + /** + * Get courseCode. + * + * @return string + */ + public function getCourseCode() + { + return $this->courseCode; + } + + /** + * Set toolId. + * + * @param string $toolId + * + * @return SearchEngineRef + */ + public function setToolId($toolId) + { + $this->toolId = $toolId; + + return $this; + } + + /** + * Get toolId. + * + * @return string + */ + public function getToolId() + { + return $this->toolId; + } + + /** + * Set refIdHighLevel. + * + * @param int $refIdHighLevel + * + * @return SearchEngineRef + */ + public function setRefIdHighLevel($refIdHighLevel) + { + $this->refIdHighLevel = $refIdHighLevel; + + return $this; + } + + /** + * Get refIdHighLevel. + * + * @return int + */ + public function getRefIdHighLevel() + { + return $this->refIdHighLevel; + } + + /** + * Set refIdSecondLevel. + * + * @param int $refIdSecondLevel + * + * @return SearchEngineRef + */ + public function setRefIdSecondLevel($refIdSecondLevel) + { + $this->refIdSecondLevel = $refIdSecondLevel; + + return $this; + } + + /** + * Get refIdSecondLevel. + * + * @return int + */ + public function getRefIdSecondLevel() + { + return $this->refIdSecondLevel; + } + + /** + * Set searchDid. + * + * @param int $searchDid + * + * @return SearchEngineRef + */ + public function setSearchDid($searchDid) + { + $this->searchDid = $searchDid; + + return $this; + } + + /** + * Get searchDid. + * + * @return int + */ + public function getSearchDid() + { + return $this->searchDid; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Sequence.php b/src/Chamilo/CoreBundle/Entity/Sequence.php new file mode 100644 index 000000000..57658fd48 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Sequence.php @@ -0,0 +1,120 @@ +name; + } + + public function getId(): int + { + return $this->id; + } + + public function setId(int $id): Sequence + { + $this->id = $id; + + return $this; + } + + public function getName(): string + { + return $this->name; + } + + public function setName(string $name): Sequence + { + $this->name = $name; + + return $this; + } + + public function getGraph(): string + { + return $this->graph; + } + + public function setGraph(string $graph): Sequence + { + $this->graph = $graph; + + return $this; + } + + public function hasGraph(): bool + { + return !empty($this->graph); + } + + public function getUnSerializeGraph(): Graph + { + return UnserializeApi::unserialize('sequence_graph', $this->graph); + } + + public function setGraphAndSerialize(Graph $graph): Sequence + { + $this->setGraph(serialize($graph)); + + return $this; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/SequenceCondition.php b/src/Chamilo/CoreBundle/Entity/SequenceCondition.php new file mode 100644 index 000000000..9deef7223 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/SequenceCondition.php @@ -0,0 +1,169 @@ +id; + } + + /** + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * @param string $description + * + * @return SequenceCondition + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * @return string + */ + public function getMathOperation() + { + return $this->mathOperation; + } + + /** + * @param string $mathOperation + * + * @return SequenceCondition + */ + public function setMathOperation($mathOperation) + { + $this->mathOperation = $mathOperation; + + return $this; + } + + /** + * @return string + */ + public function getParam() + { + return $this->param; + } + + /** + * @param string $param + * + * @return SequenceCondition + */ + public function setParam($param) + { + $this->param = $param; + + return $this; + } + + /** + * @return string + */ + public function getActTrue() + { + return $this->actTrue; + } + + /** + * @param string $actTrue + * + * @return SequenceCondition + */ + public function setActTrue($actTrue) + { + $this->actTrue = $actTrue; + + return $this; + } + + /** + * @return string + */ + public function getActFalse() + { + return $this->actFalse; + } + + /** + * @param string $actFalse + * + * @return SequenceCondition + */ + public function setActFalse($actFalse) + { + $this->actFalse = $actFalse; + + return $this; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/SequenceFormula.php b/src/Chamilo/CoreBundle/Entity/SequenceFormula.php new file mode 100644 index 000000000..64f7c63af --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/SequenceFormula.php @@ -0,0 +1,86 @@ +id; + } + + /** + * @return mixed + */ + public function getMethod() + { + return $this->method; + } + + /** + * @param mixed $method + * + * @return SequenceFormula + */ + public function setMethod($method) + { + $this->method = $method; + + return $this; + } + + /** + * @return mixed + */ + public function getVariable() + { + return $this->variable; + } + + /** + * @param mixed $variable + * + * @return SequenceFormula + */ + public function setVariable($variable) + { + $this->variable = $variable; + + return $this; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/SequenceMethod.php b/src/Chamilo/CoreBundle/Entity/SequenceMethod.php new file mode 100644 index 000000000..f1cd7d6af --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/SequenceMethod.php @@ -0,0 +1,169 @@ +id; + } + + /** + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * @param string $description + * + * @return SequenceMethod + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * @return string + */ + public function getFormula() + { + return $this->formula; + } + + /** + * @param string $formula + * + * @return SequenceMethod + */ + public function setFormula($formula) + { + $this->formula = $formula; + + return $this; + } + + /** + * @return string + */ + public function getAssign() + { + return $this->assign; + } + + /** + * @param string $assign + * + * @return SequenceMethod + */ + public function setAssign($assign) + { + $this->assign = $assign; + + return $this; + } + + /** + * @return string + */ + public function getMetType() + { + return $this->metType; + } + + /** + * @param string $metType + * + * @return SequenceMethod + */ + public function setMetType($metType) + { + $this->metType = $metType; + + return $this; + } + + /** + * @return string + */ + public function getActFalse() + { + return $this->actFalse; + } + + /** + * @param string $actFalse + * + * @return SequenceMethod + */ + public function setActFalse($actFalse) + { + $this->actFalse = $actFalse; + + return $this; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/SequenceResource.php b/src/Chamilo/CoreBundle/Entity/SequenceResource.php new file mode 100644 index 000000000..01e603715 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/SequenceResource.php @@ -0,0 +1,137 @@ +id; + } + + /** + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Set the integer type. + * + * @param int $type + * + * @return SequenceResource + */ + public function setType($type) + { + $this->type = $type; + + return $this; + } + + /** + * @return string + */ + public function getGraph() + { + return $this->getSequence()->getGraph(); + } + + /** + * @return bool + */ + public function hasGraph() + { + $graph = $this->getSequence()->getGraph(); + + return !empty($graph) ? true : false; + } + + /** + * @return int + */ + public function getResourceId() + { + return $this->resourceId; + } + + /** + * @param int $resourceId + * + * @return $this + */ + public function setResourceId($resourceId) + { + $this->resourceId = $resourceId; + + return $this; + } + + /** + * @return Sequence + */ + public function getSequence() + { + return $this->sequence; + } + + /** + * @return $this + */ + public function setSequence(Sequence $sequence) + { + $this->sequence = $sequence; + + return $this; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/SequenceRowEntity.php b/src/Chamilo/CoreBundle/Entity/SequenceRowEntity.php new file mode 100644 index 000000000..8efa32021 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/SequenceRowEntity.php @@ -0,0 +1,168 @@ +id; + } + + /** + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * @param int $cId + * + * @return SequenceRowEntity + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * @param int $sessionId + * + * @return SequenceRowEntity + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * @return int + */ + public function getRowId() + { + return $this->rowId; + } + + /** + * @param int $rowId + * + * @return SequenceRowEntity + */ + public function setRowId($rowId) + { + $this->rowId = $rowId; + + return $this; + } + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @param string $name + * + * @return SequenceRowEntity + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * @return mixed + */ + public function getType() + { + return $this->type; + } + + /** + * @param mixed $type + * + * @return SequenceRowEntity + */ + public function setType($type) + { + $this->type = $type; + + return $this; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/SequenceRule.php b/src/Chamilo/CoreBundle/Entity/SequenceRule.php new file mode 100644 index 000000000..209ada826 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/SequenceRule.php @@ -0,0 +1,61 @@ +id; + } + + /** + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * @param string $description + * + * @return SequenceRule + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/SequenceRuleCondition.php b/src/Chamilo/CoreBundle/Entity/SequenceRuleCondition.php new file mode 100644 index 000000000..5984b7bc7 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/SequenceRuleCondition.php @@ -0,0 +1,86 @@ +id; + } + + /** + * @return mixed + */ + public function getRule() + { + return $this->rule; + } + + /** + * @param mixed $rule + * + * @return SequenceRuleCondition + */ + public function setRule($rule) + { + $this->rule = $rule; + + return $this; + } + + /** + * @return mixed + */ + public function getCondition() + { + return $this->condition; + } + + /** + * @param mixed $condition + * + * @return SequenceRuleCondition + */ + public function setCondition($condition) + { + $this->condition = $condition; + + return $this; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/SequenceRuleMethod.php b/src/Chamilo/CoreBundle/Entity/SequenceRuleMethod.php new file mode 100644 index 000000000..41dfb0a1b --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/SequenceRuleMethod.php @@ -0,0 +1,101 @@ +id; + } + + /** + * @return string + */ + public function getMethodOrder() + { + return $this->methodOrder; + } + + /** + * @param string $methodOrder + */ + public function setMethodOrder($methodOrder) + { + $this->methodOrder = $methodOrder; + } + + /** + * @return mixed + */ + public function getRule() + { + return $this->rule; + } + + /** + * @param mixed $rule + */ + public function setRule($rule) + { + $this->rule = $rule; + } + + /** + * @return mixed + */ + public function getMethod() + { + return $this->method; + } + + /** + * @param mixed $method + */ + public function setMethod($method) + { + $this->method = $method; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/SequenceTypeEntity.php b/src/Chamilo/CoreBundle/Entity/SequenceTypeEntity.php new file mode 100644 index 000000000..8d14a3069 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/SequenceTypeEntity.php @@ -0,0 +1,115 @@ +id; + } + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @param string $name + * + * @return SequenceTypeEntity + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * @param string $description + * + * @return SequenceTypeEntity + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * @return string + */ + public function getEntityTable() + { + return $this->entityTable; + } + + /** + * @param string $entityTable + * + * @return SequenceTypeEntity + */ + public function setEntityTable($entityTable) + { + $this->entityTable = $entityTable; + + return $this; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/SequenceValid.php b/src/Chamilo/CoreBundle/Entity/SequenceValid.php new file mode 100644 index 000000000..7171b808a --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/SequenceValid.php @@ -0,0 +1,86 @@ +id; + } + + /** + * @return mixed + */ + public function getVariable() + { + return $this->variable; + } + + /** + * @param mixed $variable + * + * @return SequenceValid + */ + public function setVariable($variable) + { + $this->variable = $variable; + + return $this; + } + + /** + * @return mixed + */ + public function getCondition() + { + return $this->condition; + } + + /** + * @param mixed $condition + * + * @return SequenceValid + */ + public function setCondition($condition) + { + $this->condition = $condition; + + return $this; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/SequenceValue.php b/src/Chamilo/CoreBundle/Entity/SequenceValue.php new file mode 100644 index 000000000..d92080a21 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/SequenceValue.php @@ -0,0 +1,303 @@ +id; + } + + /** + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * @param int $userId + * + * @return SequenceValue + */ + public function setUserId($userId) + { + $this->userId = $userId; + + return $this; + } + + /** + * @return mixed + */ + public function getEntity() + { + return $this->entity; + } + + /** + * @param mixed $entity + * + * @return SequenceValue + */ + public function setEntity($entity) + { + $this->entity = $entity; + + return $this; + } + + /** + * @return int + */ + public function getAdvance() + { + return $this->advance; + } + + /** + * @param int $advance + * + * @return SequenceValue + */ + public function setAdvance($advance) + { + $this->advance = $advance; + + return $this; + } + + /** + * @return int + */ + public function getCompleteItems() + { + return $this->completeItems; + } + + /** + * @param int $completeItems + * + * @return SequenceValue + */ + public function setCompleteItems($completeItems) + { + $this->completeItems = $completeItems; + + return $this; + } + + /** + * @return int + */ + public function getTotalItems() + { + return $this->totalItems; + } + + /** + * @param int $totalItems + * + * @return SequenceValue + */ + public function setTotalItems($totalItems) + { + $this->totalItems = $totalItems; + + return $this; + } + + /** + * @return int + */ + public function getSuccess() + { + return $this->success; + } + + /** + * @param int $success + * + * @return SequenceValue + */ + public function setSuccess($success) + { + $this->success = $success; + + return $this; + } + + /** + * @return \DateTime + */ + public function getSuccessDate() + { + return $this->successDate; + } + + /** + * @param \DateTime $successDate + * + * @return SequenceValue + */ + public function setSuccessDate($successDate) + { + $this->successDate = $successDate; + + return $this; + } + + /** + * @return int + */ + public function getAvailable() + { + return $this->available; + } + + /** + * @param int $available + * + * @return SequenceValue + */ + public function setAvailable($available) + { + $this->available = $available; + + return $this; + } + + /** + * @return \DateTime + */ + public function getAvailableStartDate() + { + return $this->availableStartDate; + } + + /** + * @param \DateTime $availableStartDate + * + * @return SequenceValue + */ + public function setAvailableStartDate($availableStartDate) + { + $this->availableStartDate = $availableStartDate; + + return $this; + } + + /** + * @return \DateTime + */ + public function getAvailableEndDate() + { + return $this->availableEndDate; + } + + /** + * @param \DateTime $availableEndDate + * + * @return SequenceValue + */ + public function setAvailableEndDate($availableEndDate) + { + $this->availableEndDate = $availableEndDate; + + return $this; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/SequenceVariable.php b/src/Chamilo/CoreBundle/Entity/SequenceVariable.php new file mode 100644 index 000000000..d1e73d430 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/SequenceVariable.php @@ -0,0 +1,115 @@ +id; + } + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @param string $name + * + * @return SequenceVariable + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * @return string + */ + public function getDefaultValue() + { + return $this->defaultValue; + } + + /** + * @param string $defaultValue + * + * @return SequenceVariable + */ + public function setDefaultValue($defaultValue) + { + $this->defaultValue = $defaultValue; + + return $this; + } + + /** + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * @param string $description + * + * @return SequenceVariable + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Session.php b/src/Chamilo/CoreBundle/Entity/Session.php new file mode 100644 index 000000000..751044672 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Session.php @@ -0,0 +1,1185 @@ +items = new ArrayCollection(); + + $this->nbrClasses = 0; + $this->nbrUsers = 0; + + $this->displayStartDate = new \DateTime(); + $this->displayEndDate = new \DateTime(); + $this->accessStartDate = new \DateTime(); + $this->accessEndDate = new \DateTime(); + $this->coachAccessStartDate = new \DateTime(); + $this->coachAccessEndDate = new \DateTime(); + $this->visibility = 1; + + $this->courses = new ArrayCollection(); + $this->users = new ArrayCollection(); + $this->userCourseSubscriptions = new ArrayCollection(); + $this->showDescription = false; + $this->category = null; + $this->studentPublications = new ArrayCollection(); + } + + /** + * @return string + */ + public function __toString() + { + return (string) $this->getName(); + } + + /** + * @return int + */ + public function getDuration() + { + return $this->duration; + } + + /** + * @param int $duration + */ + public function setDuration($duration) + { + $this->duration = $duration; + } + + /** + * @return string + */ + public function getShowDescription() + { + return $this->showDescription; + } + + /** + * @param string $showDescription + */ + public function setShowDescription($showDescription) + { + $this->showDescription = $showDescription; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * @param int $id + */ + public function setId($id) + { + $this->id = $id; + } + + /** + * @return ArrayCollection + */ + public function getUsers() + { + return $this->users; + } + + /** + * @param $users + */ + public function setUsers($users) + { + $this->users = new ArrayCollection(); + + foreach ($users as $user) { + $this->addUser($user); + } + } + + public function addUser(SessionRelUser $user) + { + $user->setSession($this); + + if (!$this->hasUser($user)) { + $this->users[] = $user; + $this->setNbrUsers(count($this->users)); + } + } + + /** + * @param int $status + */ + public function addUserInSession($status, User $user) + { + $sessionRelUser = new SessionRelUser(); + $sessionRelUser->setSession($this); + $sessionRelUser->setUser($user); + $sessionRelUser->setRelationType($status); + + $this->addUser($sessionRelUser); + } + + /** + * @return bool + */ + public function hasUser(SessionRelUser $subscription) + { + if ($this->getUsers()->count()) { + $criteria = Criteria::create()->where( + Criteria::expr()->eq('user', $subscription->getUser()) + )->andWhere( + Criteria::expr()->eq('session', $subscription->getSession()) + )->andWhere( + Criteria::expr()->eq('relationType', $subscription->getRelationType()) + ); + + $relation = $this->getUsers()->matching($criteria); + + return $relation->count() > 0; + } + + return false; + } + + /** + * @return ArrayCollection + */ + public function getCourses() + { + return $this->courses; + } + + /** + * @param $courses + */ + public function setCourses($courses) + { + $this->courses = new ArrayCollection(); + + foreach ($courses as $course) { + $this->addCourses($course); + } + } + + public function addCourses(SessionRelCourse $course) + { + $course->setSession($this); + $this->courses[] = $course; + } + + /** + * @return bool + */ + public function hasCourse(Course $course) + { + if ($this->getCourses()->count()) { + $criteria = Criteria::create()->where( + Criteria::expr()->eq('course', $course) + ); + $relation = $this->getCourses()->matching($criteria); + + return $relation->count() > 0; + } + + return false; + } + + /** + * Check for existence of a relation (SessionRelCourse) between a course and this session. + * + * @return bool whether the course is related to this session + */ + public function isRelatedToCourse(Course $course) + { + return !is_null( + \Database::getManager()->getRepository('ChamiloCoreBundle:SessionRelCourse')->findOneBy([ + 'session' => $this, + 'course' => $course, + ]) + ); + } + + /** + * Remove $course. + * + * @param SessionRelCourse $course + */ + public function removeCourses($course) + { + foreach ($this->courses as $key => $value) { + if ($value->getId() == $course->getId()) { + unset($this->courses[$key]); + } + } + } + + /** + * Remove course subscription for a user. + * If user status in session is student, then decrease number of course users. + */ + public function removeUserCourseSubscription(User $user, Course $course) + { + /** @var SessionRelCourseRelUser $courseSubscription */ + foreach ($this->userCourseSubscriptions as $i => $courseSubscription) { + if ($courseSubscription->getCourse()->getId() === $course->getId() && + $courseSubscription->getUser()->getId() === $user->getId()) { + if ($this->userCourseSubscriptions[$i]->getStatus() === self::STUDENT) { + $sessionCourse = $this->getCourseSubscription($course); + + $sessionCourse->setNbrUsers( + $sessionCourse->getNbrUsers() - 1 + ); + } + + unset($this->userCourseSubscriptions[$i]); + } + } + } + + /** + * @param int $status if not set it will check if the user is registered + * with any status + * + * @return bool + */ + public function hasUserInCourse(User $user, Course $course, $status = null) + { + $relation = $this->getUserInCourse($user, $course, $status); + + return $relation->count() > 0; + } + + /** + * @return bool + */ + public function hasStudentInCourse(User $user, Course $course) + { + return $this->hasUserInCourse($user, $course, self::STUDENT); + } + + /** + * @return bool + */ + public function hasCoachInCourseWithStatus(User $user, Course $course) + { + return $this->hasUserInCourse($user, $course, self::COACH); + } + + /** + * @param string $status + * + * @return \Doctrine\Common\Collections\Collection|static + */ + public function getUserInCourse(User $user, Course $course, $status = null) + { + $criteria = Criteria::create()->where( + Criteria::expr()->eq('course', $course) + )->andWhere( + Criteria::expr()->eq('user', $user) + ); + + if (!is_null($status)) { + $criteria->andWhere( + Criteria::expr()->eq('status', $status) + ); + } + + return $this->getUserCourseSubscriptions()->matching($criteria); + } + + /** + * Set name. + * + * @param string $name + * + * @return $this + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * Get name. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set description. + * + * @param string $description + * + * @return $this + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * Get description. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Set nbrCourses. + * + * @param int $nbrCourses + * + * @return Session + */ + public function setNbrCourses($nbrCourses) + { + $this->nbrCourses = $nbrCourses; + + return $this; + } + + /** + * Get nbrCourses. + * + * @return int + */ + public function getNbrCourses() + { + return (int) $this->nbrCourses; + } + + /** + * Set nbrUsers. + * + * @param int $nbrUsers + * + * @return Session + */ + public function setNbrUsers($nbrUsers) + { + $this->nbrUsers = $nbrUsers; + + return $this; + } + + /** + * Get nbrUsers. + * + * @return int + */ + public function getNbrUsers() + { + return $this->nbrUsers; + } + + /** + * Set nbrClasses. + * + * @param int $nbrClasses + * + * @return Session + */ + public function setNbrClasses($nbrClasses) + { + $this->nbrClasses = $nbrClasses; + + return $this; + } + + /** + * Get nbrClasses. + * + * @return int + */ + public function getNbrClasses() + { + return $this->nbrClasses; + } + + /** + * Set sessionAdminId. + * + * @param int $sessionAdminId + * + * @return Session + */ + public function setSessionAdminId($sessionAdminId) + { + $this->sessionAdminId = $sessionAdminId; + + return $this; + } + + /** + * Get sessionAdminId. + * + * @return int + */ + public function getSessionAdminId() + { + return $this->sessionAdminId; + } + + /** + * Set visibility. + * + * @param int $visibility + * + * @return Session + */ + public function setVisibility($visibility) + { + $this->visibility = $visibility; + + return $this; + } + + /** + * Get visibility. + * + * @return int + */ + public function getVisibility() + { + return $this->visibility; + } + + /** + * Set promotionId. + * + * @param int $promotionId + * + * @return Session + */ + public function setPromotionId($promotionId) + { + $this->promotionId = $promotionId; + + return $this; + } + + /** + * Get promotionId. + * + * @return int + */ + public function getPromotionId() + { + return $this->promotionId; + } + + /** + * Set displayStartDate. + * + * @param \DateTime $displayStartDate + * + * @return Session + */ + public function setDisplayStartDate($displayStartDate) + { + $this->displayStartDate = $displayStartDate; + + return $this; + } + + /** + * Get displayStartDate. + * + * @return \DateTime + */ + public function getDisplayStartDate() + { + return $this->displayStartDate; + } + + /** + * Set displayEndDate. + * + * @param \DateTime $displayEndDate + * + * @return Session + */ + public function setDisplayEndDate($displayEndDate) + { + $this->displayEndDate = $displayEndDate; + + return $this; + } + + /** + * Get displayEndDate. + * + * @return \DateTime + */ + public function getDisplayEndDate() + { + return $this->displayEndDate; + } + + /** + * Set accessStartDate. + * + * @param \DateTime $accessStartDate + * + * @return Session + */ + public function setAccessStartDate($accessStartDate) + { + $this->accessStartDate = $accessStartDate; + + return $this; + } + + /** + * Get accessStartDate. + * + * @return \DateTime + */ + public function getAccessStartDate() + { + return $this->accessStartDate; + } + + /** + * Set accessEndDate. + * + * @param \DateTime $accessEndDate + * + * @return Session + */ + public function setAccessEndDate($accessEndDate) + { + $this->accessEndDate = $accessEndDate; + + return $this; + } + + /** + * Get accessEndDate. + * + * @return \DateTime + */ + public function getAccessEndDate() + { + return $this->accessEndDate; + } + + /** + * Set coachAccessStartDate. + * + * @param \DateTime $coachAccessStartDate + * + * @return Session + */ + public function setCoachAccessStartDate($coachAccessStartDate) + { + $this->coachAccessStartDate = $coachAccessStartDate; + + return $this; + } + + /** + * Get coachAccessStartDate. + * + * @return \DateTime + */ + public function getCoachAccessStartDate() + { + return $this->coachAccessStartDate; + } + + /** + * Set coachAccessEndDate. + * + * @param \DateTime $coachAccessEndDate + * + * @return Session + */ + public function setCoachAccessEndDate($coachAccessEndDate) + { + $this->coachAccessEndDate = $coachAccessEndDate; + + return $this; + } + + /** + * Get coachAccessEndDate. + * + * @return \DateTime + */ + public function getCoachAccessEndDate() + { + return $this->coachAccessEndDate; + } + + /** + * Get id. + * + * @return User + */ + public function getGeneralCoach() + { + return $this->generalCoach; + } + + /** + * @param $coach + */ + public function setGeneralCoach($coach) + { + $this->generalCoach = $coach; + } + + /** + * @return mixed + * @return SessionCategory + */ + public function getCategory() + { + return $this->category; + } + + /** + * @param $category + * + * @return $this + */ + public function setCategory($category) + { + $this->category = $category; + + return $this; + } + + /** + * @return array + */ + public static function getStatusList() + { + return [ + self::VISIBLE => 'status_visible', + self::READ_ONLY => 'status_read_only', + self::INVISIBLE => 'status_invisible', + self::AVAILABLE => 'status_available', + ]; + } + + /** + * Check if session is visible. + * + * @return bool + */ + public function isActive() + { + $now = new \Datetime('now'); + + return $now > $this->getAccessStartDate(); + } + + /** + * Compare the current date with start and end access dates. + * Either missing date is interpreted as no limit. + * + * @return bool whether now is between the session access start and end dates + */ + public function isCurrentlyAccessible() + { + try { + $now = new \Datetime(); + } catch (\Exception $exception) { + return false; + } + + return (is_null($this->accessStartDate) || $this->accessStartDate < $now) + && (is_null($this->accessEndDate) || $now < $this->accessEndDate); + } + + public function addCourse(Course $course) + { + $entity = new SessionRelCourse(); + $entity->setCourse($course); + $entity->setPosition(0); + $this->addCourses($entity); + $this->setNbrCourses(count($this->courses)); + } + + /** + * Removes a course from this session. + * + * @param Course $course the course to remove from this session + * + * @return bool whether the course was actually found in this session and removed from it + */ + public function removeCourse(Course $course) + { + $relCourse = $this->getCourseSubscription($course); + if ($relCourse) { + $this->courses->removeElement($relCourse); + $this->setNbrCourses(count($this->courses)); + + return true; + } + + return false; + } + + /** + * @return ArrayCollection + */ + public function getUserCourseSubscriptions() + { + return $this->userCourseSubscriptions; + } + + /** + * @param ArrayCollection $userCourseSubscriptions + */ + public function setUserCourseSubscriptions($userCourseSubscriptions) + { + $this->userCourseSubscriptions = new ArrayCollection(); + + foreach ($userCourseSubscriptions as $item) { + $this->addUserCourseSubscription($item); + } + } + + public function addUserCourseSubscription(SessionRelCourseRelUser $subscription) + { + $subscription->setSession($this); + if (!$this->hasUserCourseSubscription($subscription)) { + $this->userCourseSubscriptions[] = $subscription; + } + } + + /** + * @return SessionRelCourse + */ + public function getCourseSubscription(Course $course) + { + $criteria = Criteria::create()->where( + Criteria::expr()->eq('course', $course) + ); + + /** @var SessionRelCourse $sessionCourse */ + $sessionCourse = $this->courses + ->matching($criteria) + ->current(); + + return $sessionCourse; + } + + /** + * Add a user course subscription. + * If user status in session is student, then increase number of course users. + * + * @param int $status + */ + public function addUserInCourse($status, User $user, Course $course) + { + $userRelCourseRelSession = new SessionRelCourseRelUser(); + $userRelCourseRelSession->setCourse($course); + $userRelCourseRelSession->setUser($user); + $userRelCourseRelSession->setSession($this); + $userRelCourseRelSession->setStatus($status); + $this->addUserCourseSubscription($userRelCourseRelSession); + + if ($status === self::STUDENT) { + $sessionCourse = $this->getCourseSubscription($course); + + $sessionCourse->setNbrUsers( + $sessionCourse->getNbrUsers() + 1 + ); + } + } + + /** + * @return bool + */ + public function hasUserCourseSubscription(SessionRelCourseRelUser $subscription) + { + if ($this->getUserCourseSubscriptions()->count()) { + $criteria = Criteria::create()->where( + Criteria::expr()->eq('user', $subscription->getUser()) + )->andWhere( + Criteria::expr()->eq('course', $subscription->getCourse()) + )->andWhere( + Criteria::expr()->eq('session', $subscription->getSession()) + ); + $relation = $this->getUserCourseSubscriptions()->matching($criteria); + + return $relation->count() > 0; + } + + return false; + } + + /** + * @return Course + */ + public function getCurrentCourse() + { + return $this->currentCourse; + } + + /** + * @return $this + */ + public function setCurrentCourse(Course $course) + { + // If the session is registered in the course session list. + if ($this->getCourses()->contains($course->getId())) { + $this->currentCourse = $course; + } + + return $this; + } + + /** + * Set $sendSubscriptionNotification. + * + * @param bool $sendNotification + * + * @return \Chamilo\CoreBundle\Entity\Session + */ + public function setSendSubscriptionNotification($sendNotification) + { + $this->sendSubscriptionNotification = $sendNotification; + + return $this; + } + + /** + * Get $sendSubscriptionNotification. + * + * @return bool + */ + public function getSendSubscriptionNotification() + { + return $this->sendSubscriptionNotification; + } + + /** + * Get user from course by status. + * + * @param int $status + * + * @return \Doctrine\Common\Collections\ArrayCollection|\Doctrine\Common\Collections\Collection + */ + public function getUserCourseSubscriptionsByStatus(Course $course, $status) + { + $criteria = Criteria::create() + ->where( + Criteria::expr()->eq('course', $course) + ) + ->andWhere( + Criteria::expr()->eq('status', $status) + ); + + return $this->userCourseSubscriptions->matching($criteria); + } + + /** + * @return Session + */ + public function setStudentPublications(ArrayCollection $studentPublications) + { + $this->studentPublications = new ArrayCollection(); + + foreach ($studentPublications as $studentPublication) { + $this->addStudentPublication($studentPublication); + } + + return $this; + } + + /** + * @return Session + */ + public function addStudentPublication(CStudentPublication $studentPublication) + { + $this->studentPublications[] = $studentPublication; + + return $this; + } + + /** + * Get studentPublications. + * + * @return ArrayCollection + */ + public function getStudentPublications() + { + return $this->studentPublications; + } + + /** + * @return ArrayCollection + */ + public function getUsersSubscriptionsInCourse(Course $course) + { + $criteria = Criteria::create() + ->where( + Criteria::expr()->eq('course', $course) + ); + + return $this->userCourseSubscriptions->matching($criteria); + } + + /** + * @return int + */ + /*public function getPosition() + { + return $this->position; + }*/ + + /** + * @param int $position + * + * @return Session + */ + /*public function setPosition($position) + { + $this->position = $position; + + return $this; + }*/ +} diff --git a/src/Chamilo/CoreBundle/Entity/SessionCategory.php b/src/Chamilo/CoreBundle/Entity/SessionCategory.php new file mode 100644 index 000000000..3ded300f9 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/SessionCategory.php @@ -0,0 +1,194 @@ +name; + } + + /** + * Set url. + * + * @param $url + * + * @return SessionCategory + */ + public function setUrl($url) + { + $this->url = $url; + + return $this; + } + + /** + * @return mixed + */ + public function getUrl() + { + return $this->url; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set name. + * + * @param string $name + * + * @return SessionCategory + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * Get name. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set dateStart. + * + * @param \DateTime $dateStart + * + * @return SessionCategory + */ + public function setDateStart($dateStart) + { + $this->dateStart = $dateStart; + + return $this; + } + + /** + * Get dateStart. + * + * @return \DateTime + */ + public function getDateStart() + { + return $this->dateStart; + } + + /** + * Set dateEnd. + * + * @param \DateTime $dateEnd + * + * @return SessionCategory + */ + public function setDateEnd($dateEnd) + { + $this->dateEnd = $dateEnd; + + return $this; + } + + /** + * Get dateEnd. + * + * @return \DateTime + */ + public function getDateEnd() + { + return $this->dateEnd; + } + + /** + * Set accessUrlId. + * + * @param int $accessUrlId + * + * @return SessionCategory + */ + public function setAccessUrlId($accessUrlId) + { + $this->accessUrlId = $accessUrlId; + + return $this; + } + + /** + * Get accessUrlId. + * + * @return int + */ + public function getAccessUrlId() + { + return $this->accessUrlId; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/SessionRelCourse.php b/src/Chamilo/CoreBundle/Entity/SessionRelCourse.php new file mode 100644 index 000000000..942574421 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/SessionRelCourse.php @@ -0,0 +1,152 @@ +nbrUsers = 0; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * @param $session + * + * @return $this + */ + public function setSession($session) + { + $this->session = $session; + + return $this; + } + + /** + * Get course. + * + * @return Course + */ + public function getCourse() + { + return $this->course; + } + + /** + * @param Course $course + * + * @return $this + */ + public function setCourse($course) + { + $this->course = $course; + + return $this; + } + + /** + * Get Session. + * + * @return Session + */ + public function getSession() + { + return $this->session; + } + + /** + * Set nbrUsers. + * + * @param int $nbrUsers + * + * @return SessionRelCourse + */ + public function setNbrUsers($nbrUsers) + { + $this->nbrUsers = $nbrUsers; + + return $this; + } + + /** + * Get nbrUsers. + * + * @return int + */ + public function getNbrUsers() + { + return $this->nbrUsers; + } + + /** + * @return int + */ + public function getPosition() + { + return $this->position; + } + + /** + * @param int $position + */ + public function setPosition($position) + { + $this->position = $position; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/SessionRelCourseRelUser.php b/src/Chamilo/CoreBundle/Entity/SessionRelCourseRelUser.php new file mode 100644 index 000000000..b23ce0b66 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/SessionRelCourseRelUser.php @@ -0,0 +1,219 @@ + 'student', + 2 => 'course_coach', + ]; + + /** + * @var int + * + * @ORM\Column(name="id", type="integer", nullable=false, unique=false) + * @ORM\Id + * @ORM\GeneratedValue + */ + protected $id; + + /** + * @var User + * @ORM\ManyToOne(targetEntity="Chamilo\UserBundle\Entity\User", inversedBy="sessionCourseSubscriptions", cascade={"persist"}) + * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false) + */ + protected $user; + + /** + * @var Session + * @ORM\ManyToOne(targetEntity="Session", inversedBy="userCourseSubscriptions", cascade={"persist"}) + * @ORM\JoinColumn(name="session_id", referencedColumnName="id", nullable=false) + */ + protected $session; + + /** + * @var Course + * @ORM\ManyToOne(targetEntity="Course", inversedBy="sessionUserSubscriptions", cascade={"persist"}) + * @ORM\JoinColumn(name="c_id", referencedColumnName="id", nullable=false) + */ + protected $course; + + /** + * @var int + * + * @ORM\Column(name="visibility", type="integer", nullable=false, unique=false) + */ + protected $visibility; + + /** + * @var int + * + * @ORM\Column(name="status", type="integer", nullable=false, unique=false) + */ + protected $status; + + /** + * @var int + * + * @ORM\Column(name="legal_agreement", type="integer", nullable=true, unique=false) + */ + protected $legalAgreement; + + /** + * Constructor. + */ + public function __construct() + { + $this->visibility = 1; + } + + /** + * @return \Chamilo\UserBundle\Entity\User + */ + public function getUser() + { + return $this->user; + } + + /** + * @param mixed $user + */ + public function setUser($user) + { + $this->user = $user; + } + + /** + * @return Session + */ + public function getSession() + { + return $this->session; + } + + /** + * @param Session $session + */ + public function setSession($session) + { + $this->session = $session; + } + + /** + * @return Course + */ + public function getCourse() + { + return $this->course; + } + + /** + * @param Course $course + */ + public function setCourse($course) + { + $this->course = $course; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set visibility. + * + * @param int $visibility + * + * @return SessionRelCourseRelUser + */ + public function setVisibility($visibility) + { + $this->visibility = $visibility; + + return $this; + } + + /** + * Get visibility. + * + * @return int + */ + public function getVisibility() + { + return $this->visibility; + } + + /** + * Set status. + * + * @param int $status + * + * @return SessionRelCourseRelUser + */ + public function setStatus($status) + { + $this->status = $status; + + return $this; + } + + /** + * Get status. + * + * @return int + */ + public function getStatus() + { + return $this->status; + } + + /** + * Set legalAgreement. + * + * @param int $legalAgreement + * + * @return SessionRelCourseRelUser + */ + public function setLegalAgreement($legalAgreement) + { + $this->legalAgreement = $legalAgreement; + + return $this; + } + + /** + * Get legalAgreement. + * + * @return int + */ + public function getLegalAgreement() + { + return $this->legalAgreement; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/SessionRelUser.php b/src/Chamilo/CoreBundle/Entity/SessionRelUser.php new file mode 100644 index 000000000..3e80fdb69 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/SessionRelUser.php @@ -0,0 +1,301 @@ + 'student', + 1 => 'drh', + ]; + + /** + * @var int + * + * @ORM\Column(name="id", type="integer") + * @ORM\Id + * @ORM\GeneratedValue + */ + protected $id; + + /** + * @ORM\ManyToOne(targetEntity="Session", inversedBy="users", cascade={"persist"}) + * @ORM\JoinColumn(name="session_id", referencedColumnName="id") + */ + protected $session; + + /** + * @ORM\ManyToOne(targetEntity="Chamilo\UserBundle\Entity\User", inversedBy="users", cascade={"persist"}) + * @ORM\JoinColumn(name="user_id", referencedColumnName="id") + */ + protected $user; + + /** + * @var int + * + * @ORM\Column(name="relation_type", type="integer", nullable=false, unique=false) + */ + protected $relationType; + + /** + * @var int + * + * @ORM\Column(name="duration", type="integer", nullable=true) + */ + protected $duration; + + /** + * @var int + * + * @ORM\Column(name="moved_to", type="integer", nullable=true, unique=false) + */ + protected $movedTo; + + /** + * @var int + * + * @ORM\Column(name="moved_status", type="integer", nullable=true, unique=false) + */ + protected $movedStatus; + + /** + * @var \DateTime + * + * @ORM\Column(name="moved_at", type="datetime", nullable=true, unique=false) + */ + protected $movedAt; + + /** + * @var \DateTime + * @ORM\Column(name="registered_at", type="datetime", nullable=false, unique=false) + */ + protected $registeredAt; + + /** + * Constructor. + */ + public function __construct() + { + $this->movedTo = null; + $this->movedStatus = null; + $this->movedAt = null; + $this->registeredAt = new \DateTime('now', new \DateTimeZone('UTC')); + } + + /** + * Set Session. + * + * @param Session $session + * + * @return SessionRelUser + */ + public function setSession($session) + { + $this->session = $session; + + return $this; + } + + /** + * Get Session. + * + * @return Session + */ + public function getSession() + { + return $this->session; + } + + /** + * Set User. + * + * @param User $user + * + * @return SessionRelUser + */ + public function setUser($user) + { + $this->user = $user; + + return $this; + } + + /** + * Get idUser. + * + * @return User + */ + public function getUser() + { + return $this->user; + } + + /** + * Set relationType. + * + * @param int $relationType + * + * @return SessionRelUser + */ + public function setRelationType($relationType) + { + $this->relationType = $relationType; + + return $this; + } + + /** + * Set relationTypeByName. + * + * @param string $relationType + * + * @return SessionRelUser + */ + public function setRelationTypeByName($relationType) + { + if (isset($this->relationTypeList[$relationType])) { + $this->setRelationType($this->relationTypeList[$relationType]); + } + + return $this; + } + + /** + * Get relationType. + * + * @return int + */ + public function getRelationType() + { + return $this->relationType; + } + + /** + * Set movedTo. + * + * @param int $movedTo + * + * @return SessionRelUser + */ + public function setMovedTo($movedTo) + { + $this->movedTo = $movedTo; + + return $this; + } + + /** + * Get movedTo. + * + * @return int + */ + public function getMovedTo() + { + return $this->movedTo; + } + + /** + * Set movedStatus. + * + * @param int $movedStatus + * + * @return SessionRelUser + */ + public function setMovedStatus($movedStatus) + { + $this->movedStatus = $movedStatus; + + return $this; + } + + /** + * Get movedStatus. + * + * @return int + */ + public function getMovedStatus() + { + return $this->movedStatus; + } + + /** + * Set movedAt. + * + * @param \DateTime $movedAt + * + * @return SessionRelUser + */ + public function setMovedAt($movedAt) + { + $this->movedAt = $movedAt; + + return $this; + } + + /** + * Get movedAt. + * + * @return \DateTime + */ + public function getMovedAt() + { + return $this->movedAt; + } + + /** + * Set registeredAt. + * + * @return $this + */ + public function setRegisteredAt(\DateTime $registeredAt) + { + $this->registeredAt = $registeredAt; + + return $this; + } + + /** + * Get registeredAt. + * + * @return \DateTime + */ + public function getRegisteredAt() + { + return $this->registeredAt; + } + + /** + * @return int + */ + public function getDuration() + { + return $this->duration; + } + + /** + * @param int $duration + * + * @return SessionRelUser + */ + public function setDuration($duration) + { + $this->duration = $duration; + + return $this; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/SettingsCurrent.php b/src/Chamilo/CoreBundle/Entity/SettingsCurrent.php new file mode 100644 index 000000000..05c8d93b2 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/SettingsCurrent.php @@ -0,0 +1,409 @@ +variable = $variable; + + return $this; + } + + /** + * Get variable. + * + * @return string + */ + public function getVariable() + { + return $this->variable; + } + + /** + * Set subkey. + * + * @param string $subkey + * + * @return SettingsCurrent + */ + public function setSubkey($subkey) + { + $this->subkey = $subkey; + + return $this; + } + + /** + * Get subkey. + * + * @return string + */ + public function getSubkey() + { + return $this->subkey; + } + + /** + * Set type. + * + * @param string $type + * + * @return SettingsCurrent + */ + public function setType($type) + { + $this->type = $type; + + return $this; + } + + /** + * Get type. + * + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * Set category. + * + * @param string $category + * + * @return SettingsCurrent + */ + public function setCategory($category) + { + $this->category = $category; + + return $this; + } + + /** + * Get category. + * + * @return string + */ + public function getCategory() + { + return $this->category; + } + + /** + * Set selectedValue. + * + * @param string $selectedValue + * + * @return SettingsCurrent + */ + public function setSelectedValue($selectedValue) + { + $this->selectedValue = $selectedValue; + + return $this; + } + + /** + * Get selectedValue. + * + * @return string + */ + public function getSelectedValue() + { + return $this->selectedValue; + } + + /** + * Set title. + * + * @param string $title + * + * @return SettingsCurrent + */ + public function setTitle($title) + { + $this->title = $title; + + return $this; + } + + /** + * Get title. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set comment. + * + * @param string $comment + * + * @return SettingsCurrent + */ + public function setComment($comment) + { + $this->comment = $comment; + + return $this; + } + + /** + * Get comment. + * + * @return string + */ + public function getComment() + { + return $this->comment; + } + + /** + * Set scope. + * + * @param string $scope + * + * @return SettingsCurrent + */ + public function setScope($scope) + { + $this->scope = $scope; + + return $this; + } + + /** + * Get scope. + * + * @return string + */ + public function getScope() + { + return $this->scope; + } + + /** + * Set subkeytext. + * + * @param string $subkeytext + * + * @return SettingsCurrent + */ + public function setSubkeytext($subkeytext) + { + $this->subkeytext = $subkeytext; + + return $this; + } + + /** + * Get subkeytext. + * + * @return string + */ + public function getSubkeytext() + { + return $this->subkeytext; + } + + /** + * Set accessUrl. + * + * @param int $accessUrl + * + * @return SettingsCurrent + */ + public function setAccessUrl($accessUrl) + { + $this->accessUrl = $accessUrl; + + return $this; + } + + /** + * Get accessUrl. + * + * @return int + */ + public function getAccessUrl() + { + return $this->accessUrl; + } + + /** + * Set accessUrlChangeable. + * + * @param int $accessUrlChangeable + * + * @return SettingsCurrent + */ + public function setAccessUrlChangeable($accessUrlChangeable) + { + $this->accessUrlChangeable = $accessUrlChangeable; + + return $this; + } + + /** + * Get accessUrlChangeable. + * + * @return int + */ + public function getAccessUrlChangeable() + { + return $this->accessUrlChangeable; + } + + /** + * Set accessUrlLocked. + * + * @param int $accessUrlLocked + * + * @return SettingsCurrent + */ + public function setAccessUrlLocked($accessUrlLocked) + { + $this->accessUrlLocked = intval($accessUrlLocked); + + return $this; + } + + /** + * Get accessUrlLocked. + * + * @return int + */ + public function getAccessUrlLocked() + { + return $this->accessUrlLocked; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/SettingsOptions.php b/src/Chamilo/CoreBundle/Entity/SettingsOptions.php new file mode 100644 index 000000000..e04263b06 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/SettingsOptions.php @@ -0,0 +1,127 @@ +variable = $variable; + + return $this; + } + + /** + * Get variable. + * + * @return string + */ + public function getVariable() + { + return $this->variable; + } + + /** + * Set value. + * + * @param string $value + * + * @return SettingsOptions + */ + public function setValue($value) + { + $this->value = $value; + + return $this; + } + + /** + * Get value. + * + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * Set displayText. + * + * @param string $displayText + * + * @return SettingsOptions + */ + public function setDisplayText($displayText) + { + $this->displayText = $displayText; + + return $this; + } + + /** + * Get displayText. + * + * @return string + */ + public function getDisplayText() + { + return $this->displayText; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/SharedSurvey.php b/src/Chamilo/CoreBundle/Entity/SharedSurvey.php new file mode 100644 index 000000000..9d403cfda --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/SharedSurvey.php @@ -0,0 +1,344 @@ +code = $code; + + return $this; + } + + /** + * Get code. + * + * @return string + */ + public function getCode() + { + return $this->code; + } + + /** + * Set title. + * + * @param string $title + * + * @return SharedSurvey + */ + public function setTitle($title) + { + $this->title = $title; + + return $this; + } + + /** + * Get title. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set subtitle. + * + * @param string $subtitle + * + * @return SharedSurvey + */ + public function setSubtitle($subtitle) + { + $this->subtitle = $subtitle; + + return $this; + } + + /** + * Get subtitle. + * + * @return string + */ + public function getSubtitle() + { + return $this->subtitle; + } + + /** + * Set author. + * + * @param string $author + * + * @return SharedSurvey + */ + public function setAuthor($author) + { + $this->author = $author; + + return $this; + } + + /** + * Get author. + * + * @return string + */ + public function getAuthor() + { + return $this->author; + } + + /** + * Set lang. + * + * @param string $lang + * + * @return SharedSurvey + */ + public function setLang($lang) + { + $this->lang = $lang; + + return $this; + } + + /** + * Get lang. + * + * @return string + */ + public function getLang() + { + return $this->lang; + } + + /** + * Set template. + * + * @param string $template + * + * @return SharedSurvey + */ + public function setTemplate($template) + { + $this->template = $template; + + return $this; + } + + /** + * Get template. + * + * @return string + */ + public function getTemplate() + { + return $this->template; + } + + /** + * Set intro. + * + * @param string $intro + * + * @return SharedSurvey + */ + public function setIntro($intro) + { + $this->intro = $intro; + + return $this; + } + + /** + * Get intro. + * + * @return string + */ + public function getIntro() + { + return $this->intro; + } + + /** + * Set surveythanks. + * + * @param string $surveythanks + * + * @return SharedSurvey + */ + public function setSurveythanks($surveythanks) + { + $this->surveythanks = $surveythanks; + + return $this; + } + + /** + * Get surveythanks. + * + * @return string + */ + public function getSurveythanks() + { + return $this->surveythanks; + } + + /** + * Set creationDate. + * + * @param \DateTime $creationDate + * + * @return SharedSurvey + */ + public function setCreationDate($creationDate) + { + $this->creationDate = $creationDate; + + return $this; + } + + /** + * Get creationDate. + * + * @return \DateTime + */ + public function getCreationDate() + { + return $this->creationDate; + } + + /** + * Set courseCode. + * + * @param string $courseCode + * + * @return SharedSurvey + */ + public function setCourseCode($courseCode) + { + $this->courseCode = $courseCode; + + return $this; + } + + /** + * Get courseCode. + * + * @return string + */ + public function getCourseCode() + { + return $this->courseCode; + } + + /** + * Get surveyId. + * + * @return int + */ + public function getSurveyId() + { + return $this->surveyId; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/SharedSurveyQuestion.php b/src/Chamilo/CoreBundle/Entity/SharedSurveyQuestion.php new file mode 100644 index 000000000..bbedef30f --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/SharedSurveyQuestion.php @@ -0,0 +1,282 @@ +surveyId = $surveyId; + + return $this; + } + + /** + * Get surveyId. + * + * @return int + */ + public function getSurveyId() + { + return $this->surveyId; + } + + /** + * Set surveyQuestion. + * + * @param string $surveyQuestion + * + * @return SharedSurveyQuestion + */ + public function setSurveyQuestion($surveyQuestion) + { + $this->surveyQuestion = $surveyQuestion; + + return $this; + } + + /** + * Get surveyQuestion. + * + * @return string + */ + public function getSurveyQuestion() + { + return $this->surveyQuestion; + } + + /** + * Set surveyQuestionComment. + * + * @param string $surveyQuestionComment + * + * @return SharedSurveyQuestion + */ + public function setSurveyQuestionComment($surveyQuestionComment) + { + $this->surveyQuestionComment = $surveyQuestionComment; + + return $this; + } + + /** + * Get surveyQuestionComment. + * + * @return string + */ + public function getSurveyQuestionComment() + { + return $this->surveyQuestionComment; + } + + /** + * Set type. + * + * @param string $type + * + * @return SharedSurveyQuestion + */ + public function setType($type) + { + $this->type = $type; + + return $this; + } + + /** + * Get type. + * + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * Set display. + * + * @param string $display + * + * @return SharedSurveyQuestion + */ + public function setDisplay($display) + { + $this->display = $display; + + return $this; + } + + /** + * Get display. + * + * @return string + */ + public function getDisplay() + { + return $this->display; + } + + /** + * Set sort. + * + * @param int $sort + * + * @return SharedSurveyQuestion + */ + public function setSort($sort) + { + $this->sort = $sort; + + return $this; + } + + /** + * Get sort. + * + * @return int + */ + public function getSort() + { + return $this->sort; + } + + /** + * Set code. + * + * @param string $code + * + * @return SharedSurveyQuestion + */ + public function setCode($code) + { + $this->code = $code; + + return $this; + } + + /** + * Get code. + * + * @return string + */ + public function getCode() + { + return $this->code; + } + + /** + * Set maxValue. + * + * @param int $maxValue + * + * @return SharedSurveyQuestion + */ + public function setMaxValue($maxValue) + { + $this->maxValue = $maxValue; + + return $this; + } + + /** + * Get maxValue. + * + * @return int + */ + public function getMaxValue() + { + return $this->maxValue; + } + + /** + * Get questionId. + * + * @return int + */ + public function getQuestionId() + { + return $this->questionId; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/SharedSurveyQuestionOption.php b/src/Chamilo/CoreBundle/Entity/SharedSurveyQuestionOption.php new file mode 100644 index 000000000..d0a300c33 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/SharedSurveyQuestionOption.php @@ -0,0 +1,158 @@ +questionId = $questionId; + + return $this; + } + + /** + * Get questionId. + * + * @return int + */ + public function getQuestionId() + { + return $this->questionId; + } + + /** + * Set surveyId. + * + * @param int $surveyId + * + * @return SharedSurveyQuestionOption + */ + public function setSurveyId($surveyId) + { + $this->surveyId = $surveyId; + + return $this; + } + + /** + * Get surveyId. + * + * @return int + */ + public function getSurveyId() + { + return $this->surveyId; + } + + /** + * Set optionText. + * + * @param string $optionText + * + * @return SharedSurveyQuestionOption + */ + public function setOptionText($optionText) + { + $this->optionText = $optionText; + + return $this; + } + + /** + * Get optionText. + * + * @return string + */ + public function getOptionText() + { + return $this->optionText; + } + + /** + * Set sort. + * + * @param int $sort + * + * @return SharedSurveyQuestionOption + */ + public function setSort($sort) + { + $this->sort = $sort; + + return $this; + } + + /** + * Get sort. + * + * @return int + */ + public function getSort() + { + return $this->sort; + } + + /** + * Get questionOptionId. + * + * @return int + */ + public function getQuestionOptionId() + { + return $this->questionOptionId; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Skill.php b/src/Chamilo/CoreBundle/Entity/Skill.php new file mode 100644 index 000000000..51c22b057 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Skill.php @@ -0,0 +1,486 @@ +courses = new ArrayCollection(); + } + + /** + * @return string + */ + public function __toString() + { + return (string) $this->getName(); + } + + /** + * Set name. + * + * @param string $name + * + * @return Skill + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * Get name. + * + * @param bool $translated Optional. Get the name translated when is it exists in a sub-language. By default is true + * + * @return string + */ + public function getName($translated = true) + { + if ($translated) { + $variable = ChamiloApi::getLanguageVar($this->name, 'Skill'); + + return isset($GLOBALS[$variable]) ? $GLOBALS[$variable] : $this->name; + } + + return $this->name; + } + + /** + * Set shortCode. + * + * @param string $shortCode + * + * @return Skill + */ + public function setShortCode($shortCode) + { + $this->shortCode = $shortCode; + + return $this; + } + + /** + * Get shortCode. + * + * @param bool $translated Optional. Get the code translated when is it exists in a sub-language. By default is true + * + * @return string + */ + public function getShortCode($translated = true) + { + if ($translated && !empty($this->shortCode)) { + $variable = ChamiloApi::getLanguageVar($this->shortCode, 'SkillCode'); + + return isset($GLOBALS[$variable]) ? $GLOBALS[$variable] : $this->shortCode; + } + + return $this->shortCode; + } + + /** + * Set description. + * + * @param string $description + * + * @return Skill + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * Get description. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Set accessUrlId. + * + * @param int $accessUrlId + * + * @return Skill + */ + public function setAccessUrlId($accessUrlId) + { + $this->accessUrlId = $accessUrlId; + + return $this; + } + + /** + * Get accessUrlId. + * + * @return int + */ + public function getAccessUrlId() + { + return $this->accessUrlId; + } + + /** + * Set icon. + * + * @param string $icon + * + * @return Skill + */ + public function setIcon($icon) + { + $this->icon = $icon; + + return $this; + } + + /** + * Get icon. + * + * @return string + */ + public function getIcon() + { + return $this->icon; + } + + /** + * Set criteria. + * + * @param string $criteria + * + * @return Skill + */ + public function setCriteria($criteria) + { + $this->criteria = $criteria; + + return $this; + } + + /** + * Get criteria. + * + * @return string + */ + public function getCriteria() + { + return $this->criteria; + } + + /** + * Set status. + * + * @param int $status + * + * @return Skill + */ + public function setStatus($status) + { + $this->status = $status; + + return $this; + } + + /** + * Get status. + * + * @return int + */ + public function getStatus() + { + return $this->status; + } + + /** + * Set updatedAt. + * + * @param \DateTime $updatedAt The update datetime + * + * @return Skill + */ + public function setUpdatedAt(\DateTime $updatedAt) + { + $this->updatedAt = $updatedAt; + + return $this; + } + + /** + * Get updatedAt. + * + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->updatedAt; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * @return Profile + */ + public function getProfile() + { + return $this->profile; + } + + /** + * @param Profile $profile + * + * @return Skill + */ + public function setProfile($profile) + { + $this->profile = $profile; + + return $this; + } + + /** + * Get issuedSkills. + * + * @return ArrayCollection + */ + public function getIssuedSkills() + { + return $this->issuedSkills; + } + + /** + * @return ArrayCollection + */ + public function getItems() + { + return $this->items; + } + + /** + * @param ArrayCollection $items + * + * @return Skill + */ + public function setItems($items) + { + $this->items = $items; + + return $this; + } + + /** + * @param int $itemId + * + * @return bool + */ + public function hasItem($typeId, $itemId) + { + if (null !== $this->getItems()) { + if ($this->getItems()->count()) { + $found = false; + /** @var SkillRelItem $item */ + foreach ($this->getItems() as $item) { + if ($item->getItemId() == $itemId && $item->getItemType() == $typeId) { + $found = true; + break; + } + } + + return $found; + } + } + + return false; + } + + public function addItem(SkillRelItem $skillRelItem) + { + $skillRelItem->setSkill($this); + $this->items[] = $skillRelItem; + } + + public function hasCourses() + { + return null !== $this->courses; + } + + /** + * @return ArrayCollection + */ + public function getCourses() + { + return $this->courses; + } + + /** + * @param ArrayCollection $courses + * + * @return Skill + */ + public function setCourses($courses) + { + $this->courses = $courses; + + return $this; + } + + /** + * @return bool + */ + public function hasCourseAndSession(SkillRelCourse $searchItem) + { + if ($this->getCourses()->count()) { + $found = false; + /** @var SkillRelCourse $item */ + foreach ($this->getCourses() as $item) { + $sessionPassFilter = false; + $session = $item->getSession(); + $sessionId = !empty($session) ? $session->getId() : 0; + $searchSessionId = !empty($searchItem->getSession()) ? $searchItem->getSession()->getId() : 0; + + if ($sessionId === $searchSessionId) { + $sessionPassFilter = true; + } + if ($item->getCourse()->getId() == $searchItem->getCourse()->getId() && + $sessionPassFilter + ) { + $found = true; + break; + } + } + + return $found; + } + + return false; + } + + public function addToCourse(SkillRelCourse $item) + { + $item->setSkill($this); + $this->courses[] = $item; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/SkillProfile.php b/src/Chamilo/CoreBundle/Entity/SkillProfile.php new file mode 100644 index 000000000..6efa2d8f1 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/SkillProfile.php @@ -0,0 +1,96 @@ +name = $name; + + return $this; + } + + /** + * Get name. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set description. + * + * @param string $description + * + * @return SkillProfile + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * Get description. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/SkillRelGradebook.php b/src/Chamilo/CoreBundle/Entity/SkillRelGradebook.php new file mode 100644 index 000000000..cf2fff8da --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/SkillRelGradebook.php @@ -0,0 +1,127 @@ +gradebookId = $gradebookId; + + return $this; + } + + /** + * Get gradebookId. + * + * @return int + */ + public function getGradebookId() + { + return $this->gradebookId; + } + + /** + * Set skillId. + * + * @param int $skillId + * + * @return SkillRelGradebook + */ + public function setSkillId($skillId) + { + $this->skillId = $skillId; + + return $this; + } + + /** + * Get skillId. + * + * @return int + */ + public function getSkillId() + { + return $this->skillId; + } + + /** + * Set type. + * + * @param string $type + * + * @return SkillRelGradebook + */ + public function setType($type) + { + $this->type = $type; + + return $this; + } + + /** + * Get type. + * + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/SkillRelProfile.php b/src/Chamilo/CoreBundle/Entity/SkillRelProfile.php new file mode 100644 index 000000000..9f2e586fb --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/SkillRelProfile.php @@ -0,0 +1,96 @@ +skillId = $skillId; + + return $this; + } + + /** + * Get skillId. + * + * @return int + */ + public function getSkillId() + { + return $this->skillId; + } + + /** + * Set profileId. + * + * @param int $profileId + * + * @return SkillRelProfile + */ + public function setProfileId($profileId) + { + $this->profileId = $profileId; + + return $this; + } + + /** + * Get profileId. + * + * @return int + */ + public function getProfileId() + { + return $this->profileId; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/SkillRelSkill.php b/src/Chamilo/CoreBundle/Entity/SkillRelSkill.php new file mode 100644 index 000000000..8aed99e36 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/SkillRelSkill.php @@ -0,0 +1,158 @@ +skillId = $skillId; + + return $this; + } + + /** + * Get skillId. + * + * @return int + */ + public function getSkillId() + { + return $this->skillId; + } + + /** + * Set parentId. + * + * @param int $parentId + * + * @return SkillRelSkill + */ + public function setParentId($parentId) + { + $this->parentId = $parentId; + + return $this; + } + + /** + * Get parentId. + * + * @return int + */ + public function getParentId() + { + return $this->parentId; + } + + /** + * Set relationType. + * + * @param int $relationType + * + * @return SkillRelSkill + */ + public function setRelationType($relationType) + { + $this->relationType = $relationType; + + return $this; + } + + /** + * Get relationType. + * + * @return int + */ + public function getRelationType() + { + return $this->relationType; + } + + /** + * Set level. + * + * @param int $level + * + * @return SkillRelSkill + */ + public function setLevel($level) + { + $this->level = $level; + + return $this; + } + + /** + * Get level. + * + * @return int + */ + public function getLevel() + { + return $this->level; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/SkillRelUser.php b/src/Chamilo/CoreBundle/Entity/SkillRelUser.php new file mode 100644 index 000000000..226bd57c0 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/SkillRelUser.php @@ -0,0 +1,393 @@ +comments = new ArrayCollection(); + } + + /** + * Set user. + * + * @return SkillRelUser + */ + public function setUser(User $user) + { + $this->user = $user; + + return $this; + } + + /** + * Get user. + * + * @return User + */ + public function getUser() + { + return $this->user; + } + + /** + * Set skill. + * + * @return SkillRelUser + */ + public function setSkill(Skill $skill) + { + $this->skill = $skill; + + return $this; + } + + /** + * Get skill. + * + * @return Skill + */ + public function getSkill() + { + return $this->skill; + } + + /** + * Set course. + * + * @return SkillRelUser + */ + public function setCourse(Course $course) + { + $this->course = $course; + + return $this; + } + + /** + * Get course. + * + * @return Course + */ + public function getCourse() + { + return $this->course; + } + + /** + * Set session. + * + * @return SkillRelUser + */ + public function setSession(Session $session) + { + $this->session = $session; + + return $this; + } + + /** + * Get session. + * + * @return Session + */ + public function getSession() + { + return $this->session; + } + + /** + * Set acquiredSkillAt. + * + * @param \DateTime $acquiredSkillAt + * + * @return SkillRelUser + */ + public function setAcquiredSkillAt($acquiredSkillAt) + { + $this->acquiredSkillAt = $acquiredSkillAt; + + return $this; + } + + /** + * Get acquiredSkillAt. + * + * @return \DateTime + */ + public function getAcquiredSkillAt() + { + return $this->acquiredSkillAt; + } + + /** + * Set assignedBy. + * + * @param int $assignedBy + * + * @return SkillRelUser + */ + public function setAssignedBy($assignedBy) + { + $this->assignedBy = $assignedBy; + + return $this; + } + + /** + * Get assignedBy. + * + * @return int + */ + public function getAssignedBy() + { + return $this->assignedBy; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set acquiredLevel. + * + * @param Level $acquiredLevel + * + * @return SkillRelUser + */ + public function setAcquiredLevel($acquiredLevel) + { + $this->acquiredLevel = $acquiredLevel; + + return $this; + } + + /** + * Get acquiredLevel. + * + * @return Level + */ + public function getAcquiredLevel() + { + return $this->acquiredLevel; + } + + /** + * Set argumentationAuthorId. + * + * @param int $argumentationAuthorId + * + * @return SkillRelUser + */ + public function setArgumentationAuthorId($argumentationAuthorId) + { + $this->argumentationAuthorId = $argumentationAuthorId; + + return $this; + } + + /** + * Get argumentationAuthorId. + * + * @return int + */ + public function getArgumentationAuthorId() + { + return $this->argumentationAuthorId; + } + + /** + * Set argumentation. + * + * @param string $argumentation + * + * @return SkillRelUser + */ + public function setArgumentation($argumentation) + { + $this->argumentation = $argumentation; + + return $this; + } + + /** + * Get argumentation. + * + * @return string + */ + public function getArgumentation() + { + return $this->argumentation; + } + + /** + * Get the source which the skill was obtained. + * + * @return string + */ + public function getSourceName() + { + $source = ''; + + if ($this->session && $this->getSession()->getId() != 0) { + $source .= "[{$this->getSession()->getName()}] "; + } + + if ($this->course) { + $source .= $this->getCourse()->getTitle(); + } + + return $source; + } + + /** + * Get comments. + * + * @param bool $sortDescByDateTime + * + * @return ArrayCollection + */ + public function getComments($sortDescByDateTime = false) + { + if ($sortDescByDateTime) { + $criteria = Criteria::create(); + $criteria->orderBy([ + 'feedbackDateTime' => Criteria::DESC, + ]); + + return $this->comments->matching($criteria); + } + + return $this->comments; + } + + /** + * Calculate the average value from the feedback comments. + * + * @return string + */ + public function getAverage() + { + $sum = 0; + $countValues = 0; + + foreach ($this->comments as $comment) { + if (!$comment->getFeedbackValue()) { + continue; + } + + $sum += $comment->getFeedbackValue(); + $countValues++; + } + + $average = $countValues > 0 ? $sum / $countValues : 0; + + return number_format($average, 2); + } +} diff --git a/src/Chamilo/CoreBundle/Entity/SkillRelUserComment.php b/src/Chamilo/CoreBundle/Entity/SkillRelUserComment.php new file mode 100644 index 000000000..5274f08bd --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/SkillRelUserComment.php @@ -0,0 +1,187 @@ +id; + } + + /** + * Get skillRelUser. + * + * @return SkillRelUser + */ + public function getSkillRelUser() + { + return $this->skillRelUser; + } + + /** + * Get feedbackGiver. + * + * @return User + */ + public function getFeedbackGiver() + { + return $this->feedbackGiver; + } + + /** + * Get feedbackText. + * + * @return string + */ + public function getFeedbackText() + { + return $this->feedbackText; + } + + /** + * Get feedbackValue. + * + * @return int + */ + public function getFeedbackValue() + { + return $this->feedbackValue; + } + + /** + * Get feedbackDateTime. + * + * @return \DateTime + */ + public function getFeedbackDateTime() + { + return $this->feedbackDateTime; + } + + /** + * Set skillRelUser. + * + * @return SkillRelUserComment + */ + public function setSkillRelUser(SkillRelUser $skillRelUser) + { + $this->skillRelUser = $skillRelUser; + + return $this; + } + + /** + * Set feedbackGiver. + * + * @return SkillRelUserComment + */ + public function setFeedbackGiver(User $feedbackGiver) + { + $this->feedbackGiver = $feedbackGiver; + + return $this; + } + + /** + * Set feedbackText. + * + * @param string $feedbackText + * + * @return SkillRelUserComment + */ + public function setFeedbackText($feedbackText) + { + $this->feedbackText = $feedbackText; + + return $this; + } + + /** + * Set feebackValue. + * + * @param int $feedbackValue + * + * @return SkillRelUserComment + */ + public function setFeedbackValue($feedbackValue) + { + $this->feedbackValue = $feedbackValue; + + return $this; + } + + /** + * Set feedbackDateTime. + * + * @return SkillRelUserComment + */ + public function setFeedbackDateTime(\DateTime $feedbackDateTime) + { + $this->feedbackDateTime = $feedbackDateTime; + + return $this; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/SpecificField.php b/src/Chamilo/CoreBundle/Entity/SpecificField.php new file mode 100644 index 000000000..ff31010bc --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/SpecificField.php @@ -0,0 +1,98 @@ +code = $code; + + return $this; + } + + /** + * Get code. + * + * @return string + */ + public function getCode() + { + return $this->code; + } + + /** + * Set name. + * + * @param string $name + * + * @return SpecificField + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * Get name. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/SpecificFieldValues.php b/src/Chamilo/CoreBundle/Entity/SpecificFieldValues.php new file mode 100644 index 000000000..8305eab44 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/SpecificFieldValues.php @@ -0,0 +1,189 @@ +courseCode = $courseCode; + + return $this; + } + + /** + * Get courseCode. + * + * @return string + */ + public function getCourseCode() + { + return $this->courseCode; + } + + /** + * Set toolId. + * + * @param string $toolId + * + * @return SpecificFieldValues + */ + public function setToolId($toolId) + { + $this->toolId = $toolId; + + return $this; + } + + /** + * Get toolId. + * + * @return string + */ + public function getToolId() + { + return $this->toolId; + } + + /** + * Set refId. + * + * @param int $refId + * + * @return SpecificFieldValues + */ + public function setRefId($refId) + { + $this->refId = $refId; + + return $this; + } + + /** + * Get refId. + * + * @return int + */ + public function getRefId() + { + return $this->refId; + } + + /** + * Set fieldId. + * + * @param int $fieldId + * + * @return SpecificFieldValues + */ + public function setFieldId($fieldId) + { + $this->fieldId = $fieldId; + + return $this; + } + + /** + * Get fieldId. + * + * @return int + */ + public function getFieldId() + { + return $this->fieldId; + } + + /** + * Set value. + * + * @param string $value + * + * @return SpecificFieldValues + */ + public function setValue($value) + { + $this->value = $value; + + return $this; + } + + /** + * Get value. + * + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/SysAnnouncement.php b/src/Chamilo/CoreBundle/Entity/SysAnnouncement.php new file mode 100644 index 000000000..e8d1e5b70 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/SysAnnouncement.php @@ -0,0 +1,313 @@ +dateStart = $dateStart; + + return $this; + } + + /** + * Get dateStart. + * + * @return \DateTime + */ + public function getDateStart() + { + return $this->dateStart; + } + + /** + * Set dateEnd. + * + * @param \DateTime $dateEnd + * + * @return SysAnnouncement + */ + public function setDateEnd($dateEnd) + { + $this->dateEnd = $dateEnd; + + return $this; + } + + /** + * Get dateEnd. + * + * @return \DateTime + */ + public function getDateEnd() + { + return $this->dateEnd; + } + + /** + * Set visibleTeacher. + * + * @param bool $visibleTeacher + * + * @return SysAnnouncement + */ + public function setVisibleTeacher($visibleTeacher) + { + $this->visibleTeacher = $visibleTeacher; + + return $this; + } + + /** + * Get visibleTeacher. + * + * @return bool + */ + public function getVisibleTeacher() + { + return $this->visibleTeacher; + } + + /** + * Set visibleStudent. + * + * @param bool $visibleStudent + * + * @return SysAnnouncement + */ + public function setVisibleStudent($visibleStudent) + { + $this->visibleStudent = $visibleStudent; + + return $this; + } + + /** + * Get visibleStudent. + * + * @return bool + */ + public function getVisibleStudent() + { + return $this->visibleStudent; + } + + /** + * Set visibleGuest. + * + * @param bool $visibleGuest + * + * @return SysAnnouncement + */ + public function setVisibleGuest($visibleGuest) + { + $this->visibleGuest = $visibleGuest; + + return $this; + } + + /** + * Get visibleGuest. + * + * @return bool + */ + public function getVisibleGuest() + { + return $this->visibleGuest; + } + + /** + * Set title. + * + * @param string $title + * + * @return SysAnnouncement + */ + public function setTitle($title) + { + $this->title = $title; + + return $this; + } + + /** + * Get title. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set content. + * + * @param string $content + * + * @return SysAnnouncement + */ + public function setContent($content) + { + $this->content = $content; + + return $this; + } + + /** + * Get content. + * + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * Set lang. + * + * @param string $lang + * + * @return SysAnnouncement + */ + public function setLang($lang) + { + $this->lang = $lang; + + return $this; + } + + /** + * Get lang. + * + * @return string + */ + public function getLang() + { + return $this->lang; + } + + /** + * Set accessUrlId. + * + * @param int $accessUrlId + * + * @return SysAnnouncement + */ + public function setAccessUrlId($accessUrlId) + { + $this->accessUrlId = $accessUrlId; + + return $this; + } + + /** + * Get accessUrlId. + * + * @return int + */ + public function getAccessUrlId() + { + return $this->accessUrlId; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/SysCalendar.php b/src/Chamilo/CoreBundle/Entity/SysCalendar.php new file mode 100644 index 000000000..6c8cfb0a4 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/SysCalendar.php @@ -0,0 +1,220 @@ +title = $title; + + return $this; + } + + /** + * Get title. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set content. + * + * @param string $content + * + * @return SysCalendar + */ + public function setContent($content) + { + $this->content = $content; + + return $this; + } + + /** + * Get content. + * + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * Set startDate. + * + * @param \DateTime $startDate + * + * @return SysCalendar + */ + public function setStartDate($startDate) + { + $this->startDate = $startDate; + + return $this; + } + + /** + * Get startDate. + * + * @return \DateTime + */ + public function getStartDate() + { + return $this->startDate; + } + + /** + * Set endDate. + * + * @param \DateTime $endDate + * + * @return SysCalendar + */ + public function setEndDate($endDate) + { + $this->endDate = $endDate; + + return $this; + } + + /** + * Get endDate. + * + * @return \DateTime + */ + public function getEndDate() + { + return $this->endDate; + } + + /** + * Set accessUrlId. + * + * @param int $accessUrlId + * + * @return SysCalendar + */ + public function setAccessUrlId($accessUrlId) + { + $this->accessUrlId = $accessUrlId; + + return $this; + } + + /** + * Get accessUrlId. + * + * @return int + */ + public function getAccessUrlId() + { + return $this->accessUrlId; + } + + /** + * Set allDay. + * + * @param int $allDay + * + * @return SysCalendar + */ + public function setAllDay($allDay) + { + $this->allDay = $allDay; + + return $this; + } + + /** + * Get allDay. + * + * @return int + */ + public function getAllDay() + { + return $this->allDay; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/SystemTemplate.php b/src/Chamilo/CoreBundle/Entity/SystemTemplate.php new file mode 100644 index 000000000..31e289e19 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/SystemTemplate.php @@ -0,0 +1,194 @@ +comment = ''; + } + + /** + * Set title. + * + * @param string $title + * + * @return SystemTemplate + */ + public function setTitle($title) + { + $this->title = $title; + + return $this; + } + + /** + * Get title. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set comment. + * + * @param string $comment + * + * @return SystemTemplate + */ + public function setComment($comment) + { + $this->comment = $comment; + + return $this; + } + + /** + * Get comment. + * + * @return string + */ + public function getComment() + { + return $this->comment; + } + + /** + * Set image. + * + * @param string $image + * + * @return SystemTemplate + */ + public function setImage($image) + { + $this->image = $image; + + return $this; + } + + /** + * Get image. + * + * @return string + */ + public function getImage() + { + return $this->image; + } + + /** + * Set content. + * + * @param string $content + * + * @return SystemTemplate + */ + public function setContent($content) + { + $this->content = $content; + + return $this; + } + + /** + * Get content. + * + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * Set language. + * + * @param string $language + * + * @return SystemTemplate + */ + public function setLanguage($language) + { + $this->language = $language; + + return $this; + } + + /** + * Get language. + * + * @return string + */ + public function getLanguage() + { + return $this->language; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Tag.php b/src/Chamilo/CoreBundle/Entity/Tag.php new file mode 100644 index 000000000..910f5e550 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Tag.php @@ -0,0 +1,127 @@ +tag = $tag; + + return $this; + } + + /** + * Get tag. + * + * @return string + */ + public function getTag() + { + return $this->tag; + } + + /** + * Set fieldId. + * + * @param int $fieldId + * + * @return Tag + */ + public function setFieldId($fieldId) + { + $this->fieldId = $fieldId; + + return $this; + } + + /** + * Get fieldId. + * + * @return int + */ + public function getFieldId() + { + return $this->fieldId; + } + + /** + * Set count. + * + * @param int $count + * + * @return Tag + */ + public function setCount($count) + { + $this->count = $count; + + return $this; + } + + /** + * Get count. + * + * @return int + */ + public function getCount() + { + return $this->count; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Templates.php b/src/Chamilo/CoreBundle/Entity/Templates.php new file mode 100644 index 000000000..bfa145210 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Templates.php @@ -0,0 +1,220 @@ +title = $title; + + return $this; + } + + /** + * Get title. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set description. + * + * @param string $description + * + * @return Templates + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * Get description. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Set courseCode. + * + * @param string $courseCode + * + * @return Templates + */ + public function setCourseCode($courseCode) + { + $this->courseCode = $courseCode; + + return $this; + } + + /** + * Get courseCode. + * + * @return string + */ + public function getCourseCode() + { + return $this->courseCode; + } + + /** + * Set userId. + * + * @param int $userId + * + * @return Templates + */ + public function setUserId($userId) + { + $this->userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set refDoc. + * + * @param int $refDoc + * + * @return Templates + */ + public function setRefDoc($refDoc) + { + $this->refDoc = $refDoc; + + return $this; + } + + /** + * Get refDoc. + * + * @return int + */ + public function getRefDoc() + { + return $this->refDoc; + } + + /** + * Set image. + * + * @param string $image + * + * @return Templates + */ + public function setImage($image) + { + $this->image = $image; + + return $this; + } + + /** + * Get image. + * + * @return string + */ + public function getImage() + { + return $this->image; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/TrackCourseRanking.php b/src/Chamilo/CoreBundle/Entity/TrackCourseRanking.php new file mode 100644 index 000000000..0f5e7fb02 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/TrackCourseRanking.php @@ -0,0 +1,256 @@ +cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Set sessionId. + * + * @param int $sessionId + * + * @return TrackCourseRanking + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * Get sessionId. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * Set urlId. + * + * @param int $urlId + * + * @return TrackCourseRanking + */ + public function setUrlId($urlId) + { + $this->urlId = $urlId; + + return $this; + } + + /** + * Get urlId. + * + * @return int + */ + public function getUrlId() + { + return $this->urlId; + } + + /** + * Set accesses. + * + * @param int $accesses + * + * @return TrackCourseRanking + */ + public function setAccesses($accesses) + { + $this->accesses = $accesses; + + return $this; + } + + /** + * Get accesses. + * + * @return int + */ + public function getAccesses() + { + return $this->accesses; + } + + /** + * Set totalScore. + * + * @param int $totalScore + * + * @return TrackCourseRanking + */ + public function setTotalScore($totalScore) + { + $this->totalScore = $totalScore; + + return $this; + } + + /** + * Get totalScore. + * + * @return int + */ + public function getTotalScore() + { + return $this->totalScore; + } + + /** + * Set users. + * + * @param int $users + * + * @return TrackCourseRanking + */ + public function setUsers($users) + { + $this->users = $users; + + return $this; + } + + /** + * Get users. + * + * @return int + */ + public function getUsers() + { + return $this->users; + } + + /** + * Set creationDate. + * + * @param \DateTime $creationDate + * + * @return TrackCourseRanking + */ + public function setCreationDate($creationDate) + { + $this->creationDate = $creationDate; + + return $this; + } + + /** + * Get creationDate. + * + * @return \DateTime + */ + public function getCreationDate() + { + return $this->creationDate; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/TrackEAccess.php b/src/Chamilo/CoreBundle/Entity/TrackEAccess.php new file mode 100644 index 000000000..42e78a455 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/TrackEAccess.php @@ -0,0 +1,224 @@ +accessUserId = $accessUserId; + + return $this; + } + + /** + * Get accessUserId. + * + * @return int + */ + public function getAccessUserId() + { + return $this->accessUserId; + } + + /** + * Set accessDate. + * + * @param \DateTime $accessDate + * + * @return TrackEAccess + */ + public function setAccessDate($accessDate) + { + $this->accessDate = $accessDate; + + return $this; + } + + /** + * Get accessDate. + * + * @return \DateTime + */ + public function getAccessDate() + { + return $this->accessDate; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return TrackEAccess + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Set accessTool. + * + * @param string $accessTool + * + * @return TrackEAccess + */ + public function setAccessTool($accessTool) + { + $this->accessTool = $accessTool; + + return $this; + } + + /** + * Get accessTool. + * + * @return string + */ + public function getAccessTool() + { + return $this->accessTool; + } + + /** + * Set accessSessionId. + * + * @param int $accessSessionId + * + * @return TrackEAccess + */ + public function setAccessSessionId($accessSessionId) + { + $this->accessSessionId = $accessSessionId; + + return $this; + } + + /** + * Get accessSessionId. + * + * @return int + */ + public function getAccessSessionId() + { + return $this->accessSessionId; + } + + /** + * Set userIp. + * + * @param string $userIp + * + * @return TrackEAccess + */ + public function setUserIp($userIp) + { + $this->userIp = $userIp; + + return $this; + } + + /** + * Get userIp. + * + * @return string + */ + public function getUserIp() + { + return $this->userIp; + } + + /** + * Get accessId. + * + * @return int + */ + public function getAccessId() + { + return $this->accessId; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/TrackEAttempt.php b/src/Chamilo/CoreBundle/Entity/TrackEAttempt.php new file mode 100644 index 000000000..2191cc707 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/TrackEAttempt.php @@ -0,0 +1,384 @@ +exeId = $exeId; + + return $this; + } + + /** + * Get exeId. + * + * @return int + */ + public function getExeId() + { + return $this->exeId; + } + + /** + * Set userId. + * + * @param int $userId + * + * @return TrackEAttempt + */ + public function setUserId($userId) + { + $this->userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set questionId. + * + * @param int $questionId + * + * @return TrackEAttempt + */ + public function setQuestionId($questionId) + { + $this->questionId = $questionId; + + return $this; + } + + /** + * Get questionId. + * + * @return int + */ + public function getQuestionId() + { + return $this->questionId; + } + + /** + * Set answer. + * + * @param string $answer + * + * @return TrackEAttempt + */ + public function setAnswer($answer) + { + $this->answer = $answer; + + return $this; + } + + /** + * Get answer. + * + * @return string + */ + public function getAnswer() + { + return $this->answer; + } + + /** + * Set teacherComment. + * + * @param string $teacherComment + * + * @return TrackEAttempt + */ + public function setTeacherComment($teacherComment) + { + $this->teacherComment = $teacherComment; + + return $this; + } + + /** + * Get teacherComment. + * + * @return string + */ + public function getTeacherComment() + { + return $this->teacherComment; + } + + /** + * Set marks. + * + * @param float $marks + * + * @return TrackEAttempt + */ + public function setMarks($marks) + { + $this->marks = $marks; + + return $this; + } + + /** + * Get marks. + * + * @return float + */ + public function getMarks() + { + return $this->marks; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return TrackEAttempt + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Set position. + * + * @param int $position + * + * @return TrackEAttempt + */ + public function setPosition($position) + { + $this->position = $position; + + return $this; + } + + /** + * Get position. + * + * @return int + */ + public function getPosition() + { + return $this->position; + } + + /** + * Set tms. + * + * @param \DateTime $tms + * + * @return TrackEAttempt + */ + public function setTms($tms) + { + $this->tms = $tms; + + return $this; + } + + /** + * Get tms. + * + * @return \DateTime + */ + public function getTms() + { + return $this->tms; + } + + /** + * Set sessionId. + * + * @param int $sessionId + * + * @return TrackEAttempt + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * Get sessionId. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * Set filename. + * + * @param string $filename + * + * @return TrackEAttempt + */ + public function setFilename($filename) + { + $this->filename = $filename; + + return $this; + } + + /** + * Get filename. + * + * @return string + */ + public function getFilename() + { + return $this->filename; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/TrackEAttemptCoeff.php b/src/Chamilo/CoreBundle/Entity/TrackEAttemptCoeff.php new file mode 100644 index 000000000..a5133280d --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/TrackEAttemptCoeff.php @@ -0,0 +1,96 @@ +attemptId = $attemptId; + + return $this; + } + + /** + * Get attemptId. + * + * @return int + */ + public function getAttemptId() + { + return $this->attemptId; + } + + /** + * Set marksCoeff. + * + * @param float $marksCoeff + * + * @return TrackEAttemptCoeff + */ + public function setMarksCoeff($marksCoeff) + { + $this->marksCoeff = $marksCoeff; + + return $this; + } + + /** + * Get marksCoeff. + * + * @return float + */ + public function getMarksCoeff() + { + return $this->marksCoeff; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/TrackEAttemptRecording.php b/src/Chamilo/CoreBundle/Entity/TrackEAttemptRecording.php new file mode 100644 index 000000000..6f03852c4 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/TrackEAttemptRecording.php @@ -0,0 +1,256 @@ +exeId = $exeId; + + return $this; + } + + /** + * Get exeId. + * + * @return int + */ + public function getExeId() + { + return $this->exeId; + } + + /** + * Set questionId. + * + * @param int $questionId + * + * @return TrackEAttemptRecording + */ + public function setQuestionId($questionId) + { + $this->questionId = $questionId; + + return $this; + } + + /** + * Get questionId. + * + * @return int + */ + public function getQuestionId() + { + return $this->questionId; + } + + /** + * Set marks. + * + * @param int $marks + * + * @return TrackEAttemptRecording + */ + public function setMarks($marks) + { + $this->marks = $marks; + + return $this; + } + + /** + * Get marks. + * + * @return int + */ + public function getMarks() + { + return $this->marks; + } + + /** + * Set insertDate. + * + * @param \DateTime $insertDate + * + * @return TrackEAttemptRecording + */ + public function setInsertDate($insertDate) + { + $this->insertDate = $insertDate; + + return $this; + } + + /** + * Get insertDate. + * + * @return \DateTime + */ + public function getInsertDate() + { + return $this->insertDate; + } + + /** + * Set author. + * + * @param int $author + * + * @return TrackEAttemptRecording + */ + public function setAuthor($author) + { + $this->author = $author; + + return $this; + } + + /** + * Get author. + * + * @return int + */ + public function getAuthor() + { + return $this->author; + } + + /** + * Set teacherComment. + * + * @param string $teacherComment + * + * @return TrackEAttemptRecording + */ + public function setTeacherComment($teacherComment) + { + $this->teacherComment = $teacherComment; + + return $this; + } + + /** + * Get teacherComment. + * + * @return string + */ + public function getTeacherComment() + { + return $this->teacherComment; + } + + /** + * Set sessionId. + * + * @param int $sessionId + * + * @return TrackEAttemptRecording + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * Get sessionId. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/TrackECourseAccess.php b/src/Chamilo/CoreBundle/Entity/TrackECourseAccess.php new file mode 100644 index 000000000..0dac97489 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/TrackECourseAccess.php @@ -0,0 +1,259 @@ +cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Set userId. + * + * @param int $userId + * + * @return TrackECourseAccess + */ + public function setUserId($userId) + { + $this->userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set loginCourseDate. + * + * @param \DateTime $loginCourseDate + * + * @return TrackECourseAccess + */ + public function setLoginCourseDate($loginCourseDate) + { + $this->loginCourseDate = $loginCourseDate; + + return $this; + } + + /** + * Get loginCourseDate. + * + * @return \DateTime + */ + public function getLoginCourseDate() + { + return $this->loginCourseDate; + } + + /** + * Set logoutCourseDate. + * + * @param \DateTime $logoutCourseDate + * + * @return TrackECourseAccess + */ + public function setLogoutCourseDate($logoutCourseDate) + { + $this->logoutCourseDate = $logoutCourseDate; + + return $this; + } + + /** + * Get logoutCourseDate. + * + * @return \DateTime + */ + public function getLogoutCourseDate() + { + return $this->logoutCourseDate; + } + + /** + * Set counter. + * + * @param int $counter + * + * @return TrackECourseAccess + */ + public function setCounter($counter) + { + $this->counter = $counter; + + return $this; + } + + /** + * Get counter. + * + * @return int + */ + public function getCounter() + { + return $this->counter; + } + + /** + * Set sessionId. + * + * @param int $sessionId + * + * @return TrackECourseAccess + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * Get sessionId. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * Set userIp. + * + * @param string $userIp + * + * @return TrackECourseAccess + */ + public function setUserIp($userIp) + { + $this->userIp = $userIp; + + return $this; + } + + /** + * Get userIp. + * + * @return string + */ + public function getUserIp() + { + return $this->userIp; + } + + /** + * Get courseAccessId. + * + * @return int + */ + public function getCourseAccessId() + { + return $this->courseAccessId; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/TrackEDefault.php b/src/Chamilo/CoreBundle/Entity/TrackEDefault.php new file mode 100644 index 000000000..26e365521 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/TrackEDefault.php @@ -0,0 +1,257 @@ +defaultUserId = $defaultUserId; + + return $this; + } + + /** + * Get defaultUserId. + * + * @return int + */ + public function getDefaultUserId() + { + return $this->defaultUserId; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return TrackEDefault + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Set defaultDate. + * + * @param \DateTime $defaultDate + * + * @return TrackEDefault + */ + public function setDefaultDate($defaultDate) + { + $this->defaultDate = $defaultDate; + + return $this; + } + + /** + * Get defaultDate. + * + * @return \DateTime + */ + public function getDefaultDate() + { + return $this->defaultDate; + } + + /** + * Set defaultEventType. + * + * @param string $defaultEventType + * + * @return TrackEDefault + */ + public function setDefaultEventType($defaultEventType) + { + $this->defaultEventType = $defaultEventType; + + return $this; + } + + /** + * Get defaultEventType. + * + * @return string + */ + public function getDefaultEventType() + { + return $this->defaultEventType; + } + + /** + * Set defaultValueType. + * + * @param string $defaultValueType + * + * @return TrackEDefault + */ + public function setDefaultValueType($defaultValueType) + { + $this->defaultValueType = $defaultValueType; + + return $this; + } + + /** + * Get defaultValueType. + * + * @return string + */ + public function getDefaultValueType() + { + return $this->defaultValueType; + } + + /** + * Set defaultValue. + * + * @param string $defaultValue + * + * @return TrackEDefault + */ + public function setDefaultValue($defaultValue) + { + $this->defaultValue = $defaultValue; + + return $this; + } + + /** + * Get defaultValue. + * + * @return string + */ + public function getDefaultValue() + { + return $this->defaultValue; + } + + /** + * Set sessionId. + * + * @param int $sessionId + * + * @return TrackEDefault + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * Get sessionId. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * Get defaultId. + * + * @return int + */ + public function getDefaultId() + { + return $this->defaultId; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/TrackEDownloads.php b/src/Chamilo/CoreBundle/Entity/TrackEDownloads.php new file mode 100644 index 000000000..3c42378bc --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/TrackEDownloads.php @@ -0,0 +1,193 @@ +downUserId = $downUserId; + + return $this; + } + + /** + * Get downUserId. + * + * @return int + */ + public function getDownUserId() + { + return $this->downUserId; + } + + /** + * Set downDate. + * + * @param \DateTime $downDate + * + * @return TrackEDownloads + */ + public function setDownDate($downDate) + { + $this->downDate = $downDate; + + return $this; + } + + /** + * Get downDate. + * + * @return \DateTime + */ + public function getDownDate() + { + return $this->downDate; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return TrackEDownloads + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Set downDocPath. + * + * @param string $downDocPath + * + * @return TrackEDownloads + */ + public function setDownDocPath($downDocPath) + { + $this->downDocPath = $downDocPath; + + return $this; + } + + /** + * Get downDocPath. + * + * @return string + */ + public function getDownDocPath() + { + return $this->downDocPath; + } + + /** + * Set downSessionId. + * + * @param int $downSessionId + * + * @return TrackEDownloads + */ + public function setDownSessionId($downSessionId) + { + $this->downSessionId = $downSessionId; + + return $this; + } + + /** + * Get downSessionId. + * + * @return int + */ + public function getDownSessionId() + { + return $this->downSessionId; + } + + /** + * Get downId. + * + * @return int + */ + public function getDownId() + { + return $this->downId; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/TrackEExerciseConfirmation.php b/src/Chamilo/CoreBundle/Entity/TrackEExerciseConfirmation.php new file mode 100644 index 000000000..d22952783 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/TrackEExerciseConfirmation.php @@ -0,0 +1,301 @@ +confirmed = false; + } + + /** + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * @param int $userId + * + * @return TrackEExerciseConfirmation + */ + public function setUserId($userId) + { + $this->userId = $userId; + + return $this; + } + + /** + * @return int + */ + public function getCourseId() + { + return $this->courseId; + } + + /** + * @param int $courseId + * + * @return TrackEExerciseConfirmation + */ + public function setCourseId($courseId) + { + $this->courseId = $courseId; + + return $this; + } + + /** + * @return int + */ + public function getAttemptId() + { + return $this->attemptId; + } + + /** + * @param int $attemptId + * + * @return TrackEExerciseConfirmation + */ + public function setAttemptId($attemptId) + { + $this->attemptId = $attemptId; + + return $this; + } + + /** + * @return int + */ + public function getQuizId() + { + return $this->quizId; + } + + /** + * @param int $quizId + * + * @return TrackEExerciseConfirmation + */ + public function setQuizId($quizId) + { + $this->quizId = $quizId; + + return $this; + } + + /** + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * @param int $sessionId + * + * @return TrackEExerciseConfirmation + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * @return bool + */ + public function isConfirmed() + { + return $this->confirmed; + } + + /** + * @param bool $confirmed + * + * @return TrackEExerciseConfirmation + */ + public function setConfirmed($confirmed) + { + $this->confirmed = $confirmed; + + return $this; + } + + /** + * @return int + */ + public function getQuestionsCount() + { + return $this->questionsCount; + } + + /** + * @param int $questionsCount + * + * @return TrackEExerciseConfirmation + */ + public function setQuestionsCount($questionsCount) + { + $this->questionsCount = $questionsCount; + + return $this; + } + + /** + * @return int + */ + public function getSavedAnswersCount() + { + return $this->savedAnswersCount; + } + + /** + * @param int $savedAnswersCount + * + * @return TrackEExerciseConfirmation + */ + public function setSavedAnswersCount($savedAnswersCount) + { + $this->savedAnswersCount = $savedAnswersCount; + + return $this; + } + + /** + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + * @param \DateTime $createdAt + * + * @return TrackEExerciseConfirmation + */ + public function setCreatedAt($createdAt) + { + $this->createdAt = $createdAt; + + return $this; + } + + /** + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->updatedAt; + } + + /** + * @param \DateTime $updatedAt + * + * @return TrackEExerciseConfirmation + */ + public function setUpdatedAt($updatedAt) + { + $this->updatedAt = $updatedAt; + + return $this; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/TrackEExercises.php b/src/Chamilo/CoreBundle/Entity/TrackEExercises.php new file mode 100644 index 000000000..1dca552c3 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/TrackEExercises.php @@ -0,0 +1,596 @@ +exeUserId = $exeUserId; + + return $this; + } + + /** + * Get exeUserId. + * + * @return int + */ + public function getExeUserId() + { + return $this->exeUserId; + } + + /** + * Set exeDate. + * + * @param \DateTime $exeDate + * + * @return TrackEExercises + */ + public function setExeDate($exeDate) + { + $this->exeDate = $exeDate; + + return $this; + } + + /** + * Get exeDate. + * + * @return \DateTime + */ + public function getExeDate() + { + return $this->exeDate; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return TrackEExercises + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Set exeExoId. + * + * @param int $exeExoId + * + * @return TrackEExercises + */ + public function setExeExoId($exeExoId) + { + $this->exeExoId = $exeExoId; + + return $this; + } + + /** + * Get exeExoId. + * + * @return int + */ + public function getExeExoId() + { + return $this->exeExoId; + } + + /** + * Set exeResult. + * + * @param float $exeResult + * + * @return TrackEExercises + */ + public function setExeResult($exeResult) + { + $this->exeResult = $exeResult; + + return $this; + } + + /** + * Get exeResult. + * + * @return float + */ + public function getExeResult() + { + return $this->exeResult; + } + + /** + * Set exeWeighting. + * + * @param float $exeWeighting + * + * @return TrackEExercises + */ + public function setExeWeighting($exeWeighting) + { + $this->exeWeighting = $exeWeighting; + + return $this; + } + + /** + * Get exeWeighting. + * + * @return float + */ + public function getExeWeighting() + { + return $this->exeWeighting; + } + + /** + * Set userIp. + * + * @param string $userIp + * + * @return TrackEExercises + */ + public function setUserIp($userIp) + { + $this->userIp = $userIp; + + return $this; + } + + /** + * Get userIp. + * + * @return string + */ + public function getUserIp() + { + return $this->userIp; + } + + /** + * Set status. + * + * @param string $status + * + * @return TrackEExercises + */ + public function setStatus($status) + { + $this->status = $status; + + return $this; + } + + /** + * Get status. + * + * @return string + */ + public function getStatus() + { + return $this->status; + } + + /** + * Set dataTracking. + * + * @param string $dataTracking + * + * @return TrackEExercises + */ + public function setDataTracking($dataTracking) + { + $this->dataTracking = $dataTracking; + + return $this; + } + + /** + * Get dataTracking. + * + * @return string + */ + public function getDataTracking() + { + return $this->dataTracking; + } + + /** + * Set startDate. + * + * @param \DateTime $startDate + * + * @return TrackEExercises + */ + public function setStartDate($startDate) + { + $this->startDate = $startDate; + + return $this; + } + + /** + * Get startDate. + * + * @return \DateTime + */ + public function getStartDate() + { + return $this->startDate; + } + + /** + * Set stepsCounter. + * + * @param int $stepsCounter + * + * @return TrackEExercises + */ + public function setStepsCounter($stepsCounter) + { + $this->stepsCounter = $stepsCounter; + + return $this; + } + + /** + * Get stepsCounter. + * + * @return int + */ + public function getStepsCounter() + { + return $this->stepsCounter; + } + + /** + * Set sessionId. + * + * @param int $sessionId + * + * @return TrackEExercises + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * Get sessionId. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * Set origLpId. + * + * @param int $origLpId + * + * @return TrackEExercises + */ + public function setOrigLpId($origLpId) + { + $this->origLpId = $origLpId; + + return $this; + } + + /** + * Get origLpId. + * + * @return int + */ + public function getOrigLpId() + { + return $this->origLpId; + } + + /** + * Set origLpItemId. + * + * @param int $origLpItemId + * + * @return TrackEExercises + */ + public function setOrigLpItemId($origLpItemId) + { + $this->origLpItemId = $origLpItemId; + + return $this; + } + + /** + * Get origLpItemId. + * + * @return int + */ + public function getOrigLpItemId() + { + return $this->origLpItemId; + } + + /** + * Set exeDuration. + * + * @param int $exeDuration + * + * @return TrackEExercises + */ + public function setExeDuration($exeDuration) + { + $this->exeDuration = $exeDuration; + + return $this; + } + + /** + * Get exeDuration. + * + * @return int + */ + public function getExeDuration() + { + return $this->exeDuration; + } + + /** + * Set expiredTimeControl. + * + * @param \DateTime $expiredTimeControl + * + * @return TrackEExercises + */ + public function setExpiredTimeControl($expiredTimeControl) + { + $this->expiredTimeControl = $expiredTimeControl; + + return $this; + } + + /** + * Get expiredTimeControl. + * + * @return \DateTime + */ + public function getExpiredTimeControl() + { + return $this->expiredTimeControl; + } + + /** + * Set origLpItemViewId. + * + * @param int $origLpItemViewId + * + * @return TrackEExercises + */ + public function setOrigLpItemViewId($origLpItemViewId) + { + $this->origLpItemViewId = $origLpItemViewId; + + return $this; + } + + /** + * Get origLpItemViewId. + * + * @return int + */ + public function getOrigLpItemViewId() + { + return $this->origLpItemViewId; + } + + /** + * Set questionsToCheck. + * + * @param string $questionsToCheck + * + * @return TrackEExercises + */ + public function setQuestionsToCheck($questionsToCheck) + { + $this->questionsToCheck = $questionsToCheck; + + return $this; + } + + /** + * Get questionsToCheck. + * + * @return string + */ + public function getQuestionsToCheck() + { + return $this->questionsToCheck; + } + + /** + * Get exeId. + * + * @return int + */ + public function getExeId() + { + return $this->exeId; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/TrackEHotpotatoes.php b/src/Chamilo/CoreBundle/Entity/TrackEHotpotatoes.php new file mode 100644 index 000000000..c128ed933 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/TrackEHotpotatoes.php @@ -0,0 +1,223 @@ +exeName = $exeName; + + return $this; + } + + /** + * Get exeName. + * + * @return string + */ + public function getExeName() + { + return $this->exeName; + } + + /** + * Set exeUserId. + * + * @param int $exeUserId + * + * @return TrackEHotpotatoes + */ + public function setExeUserId($exeUserId) + { + $this->exeUserId = $exeUserId; + + return $this; + } + + /** + * Get exeUserId. + * + * @return int + */ + public function getExeUserId() + { + return $this->exeUserId; + } + + /** + * Set exeDate. + * + * @param \DateTime $exeDate + * + * @return TrackEHotpotatoes + */ + public function setExeDate($exeDate) + { + $this->exeDate = $exeDate; + + return $this; + } + + /** + * Get exeDate. + * + * @return \DateTime + */ + public function getExeDate() + { + return $this->exeDate; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return TrackEHotpotatoes + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Set exeResult. + * + * @param int $exeResult + * + * @return TrackEHotpotatoes + */ + public function setExeResult($exeResult) + { + $this->exeResult = $exeResult; + + return $this; + } + + /** + * Get exeResult. + * + * @return int + */ + public function getExeResult() + { + return $this->exeResult; + } + + /** + * Set exeWeighting. + * + * @param int $exeWeighting + * + * @return TrackEHotpotatoes + */ + public function setExeWeighting($exeWeighting) + { + $this->exeWeighting = $exeWeighting; + + return $this; + } + + /** + * Get exeWeighting. + * + * @return int + */ + public function getExeWeighting() + { + return $this->exeWeighting; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/TrackEHotspot.php b/src/Chamilo/CoreBundle/Entity/TrackEHotspot.php new file mode 100644 index 000000000..8066dc2e5 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/TrackEHotspot.php @@ -0,0 +1,287 @@ +hotspotUserId = $hotspotUserId; + + return $this; + } + + /** + * Get hotspotUserId. + * + * @return int + */ + public function getHotspotUserId() + { + return $this->hotspotUserId; + } + + /** + * Set hotspotCourseCode. + * + * @param string $hotspotCourseCode + * + * @return TrackEHotspot + */ + public function setHotspotCourseCode($hotspotCourseCode) + { + $this->hotspotCourseCode = $hotspotCourseCode; + + return $this; + } + + /** + * Get hotspotCourseCode. + * + * @return string + */ + public function getHotspotCourseCode() + { + return $this->hotspotCourseCode; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return TrackEHotspot + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Set hotspotExeId. + * + * @param int $hotspotExeId + * + * @return TrackEHotspot + */ + public function setHotspotExeId($hotspotExeId) + { + $this->hotspotExeId = $hotspotExeId; + + return $this; + } + + /** + * Get hotspotExeId. + * + * @return int + */ + public function getHotspotExeId() + { + return $this->hotspotExeId; + } + + /** + * Set hotspotQuestionId. + * + * @param int $hotspotQuestionId + * + * @return TrackEHotspot + */ + public function setHotspotQuestionId($hotspotQuestionId) + { + $this->hotspotQuestionId = $hotspotQuestionId; + + return $this; + } + + /** + * Get hotspotQuestionId. + * + * @return int + */ + public function getHotspotQuestionId() + { + return $this->hotspotQuestionId; + } + + /** + * Set hotspotAnswerId. + * + * @param int $hotspotAnswerId + * + * @return TrackEHotspot + */ + public function setHotspotAnswerId($hotspotAnswerId) + { + $this->hotspotAnswerId = $hotspotAnswerId; + + return $this; + } + + /** + * Get hotspotAnswerId. + * + * @return int + */ + public function getHotspotAnswerId() + { + return $this->hotspotAnswerId; + } + + /** + * Set hotspotCorrect. + * + * @param bool $hotspotCorrect + * + * @return TrackEHotspot + */ + public function setHotspotCorrect($hotspotCorrect) + { + $this->hotspotCorrect = $hotspotCorrect; + + return $this; + } + + /** + * Get hotspotCorrect. + * + * @return bool + */ + public function getHotspotCorrect() + { + return $this->hotspotCorrect; + } + + /** + * Set hotspotCoordinate. + * + * @param string $hotspotCoordinate + * + * @return TrackEHotspot + */ + public function setHotspotCoordinate($hotspotCoordinate) + { + $this->hotspotCoordinate = $hotspotCoordinate; + + return $this; + } + + /** + * Get hotspotCoordinate. + * + * @return string + */ + public function getHotspotCoordinate() + { + return $this->hotspotCoordinate; + } + + /** + * Get hotspotId. + * + * @return int + */ + public function getHotspotId() + { + return $this->hotspotId; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/TrackEItemProperty.php b/src/Chamilo/CoreBundle/Entity/TrackEItemProperty.php new file mode 100644 index 000000000..e947fd877 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/TrackEItemProperty.php @@ -0,0 +1,284 @@ +courseId = $courseId; + + return $this; + } + + /** + * Get courseId. + * + * @return int + */ + public function getCourseId() + { + return $this->courseId; + } + + /** + * Set itemPropertyId. + * + * @param int $itemPropertyId + * + * @return TrackEItemProperty + */ + public function setItemPropertyId($itemPropertyId) + { + $this->itemPropertyId = $itemPropertyId; + + return $this; + } + + /** + * Get itemPropertyId. + * + * @return int + */ + public function getItemPropertyId() + { + return $this->itemPropertyId; + } + + /** + * Set title. + * + * @param string $title + * + * @return TrackEItemProperty + */ + public function setTitle($title) + { + $this->title = $title; + + return $this; + } + + /** + * Get title. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set content. + * + * @param string $content + * + * @return TrackEItemProperty + */ + public function setContent($content) + { + $this->content = $content; + + return $this; + } + + /** + * Get content. + * + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * Set progress. + * + * @param int $progress + * + * @return TrackEItemProperty + */ + public function setProgress($progress) + { + $this->progress = $progress; + + return $this; + } + + /** + * Get progress. + * + * @return int + */ + public function getProgress() + { + return $this->progress; + } + + /** + * Set lasteditDate. + * + * @param \DateTime $lasteditDate + * + * @return TrackEItemProperty + */ + public function setLasteditDate($lasteditDate) + { + $this->lasteditDate = $lasteditDate; + + return $this; + } + + /** + * Get lasteditDate. + * + * @return \DateTime + */ + public function getLasteditDate() + { + return $this->lasteditDate; + } + + /** + * Set lasteditUserId. + * + * @param int $lasteditUserId + * + * @return TrackEItemProperty + */ + public function setLasteditUserId($lasteditUserId) + { + $this->lasteditUserId = $lasteditUserId; + + return $this; + } + + /** + * Get lasteditUserId. + * + * @return int + */ + public function getLasteditUserId() + { + return $this->lasteditUserId; + } + + /** + * Set sessionId. + * + * @param int $sessionId + * + * @return TrackEItemProperty + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * Get sessionId. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/TrackELastaccess.php b/src/Chamilo/CoreBundle/Entity/TrackELastaccess.php new file mode 100644 index 000000000..fdf0b79e6 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/TrackELastaccess.php @@ -0,0 +1,193 @@ +accessUserId = $accessUserId; + + return $this; + } + + /** + * Get accessUserId. + * + * @return int + */ + public function getAccessUserId() + { + return $this->accessUserId; + } + + /** + * Set accessDate. + * + * @param \DateTime $accessDate + * + * @return TrackELastaccess + */ + public function setAccessDate($accessDate) + { + $this->accessDate = $accessDate; + + return $this; + } + + /** + * Get accessDate. + * + * @return \DateTime + */ + public function getAccessDate() + { + return $this->accessDate; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return TrackELastaccess + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Set accessTool. + * + * @param string $accessTool + * + * @return TrackELastaccess + */ + public function setAccessTool($accessTool) + { + $this->accessTool = $accessTool; + + return $this; + } + + /** + * Get accessTool. + * + * @return string + */ + public function getAccessTool() + { + return $this->accessTool; + } + + /** + * Set accessSessionId. + * + * @param int $accessSessionId + * + * @return TrackELastaccess + */ + public function setAccessSessionId($accessSessionId) + { + $this->accessSessionId = $accessSessionId; + + return $this; + } + + /** + * Get accessSessionId. + * + * @return int + */ + public function getAccessSessionId() + { + return $this->accessSessionId; + } + + /** + * Get accessId. + * + * @return int + */ + public function getAccessId() + { + return $this->accessId; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/TrackELinks.php b/src/Chamilo/CoreBundle/Entity/TrackELinks.php new file mode 100644 index 000000000..bf395f506 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/TrackELinks.php @@ -0,0 +1,193 @@ +linksUserId = $linksUserId; + + return $this; + } + + /** + * Get linksUserId. + * + * @return int + */ + public function getLinksUserId() + { + return $this->linksUserId; + } + + /** + * Set linksDate. + * + * @param \DateTime $linksDate + * + * @return TrackELinks + */ + public function setLinksDate($linksDate) + { + $this->linksDate = $linksDate; + + return $this; + } + + /** + * Get linksDate. + * + * @return \DateTime + */ + public function getLinksDate() + { + return $this->linksDate; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return TrackELinks + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Set linksLinkId. + * + * @param int $linksLinkId + * + * @return TrackELinks + */ + public function setLinksLinkId($linksLinkId) + { + $this->linksLinkId = $linksLinkId; + + return $this; + } + + /** + * Get linksLinkId. + * + * @return int + */ + public function getLinksLinkId() + { + return $this->linksLinkId; + } + + /** + * Set linksSessionId. + * + * @param int $linksSessionId + * + * @return TrackELinks + */ + public function setLinksSessionId($linksSessionId) + { + $this->linksSessionId = $linksSessionId; + + return $this; + } + + /** + * Get linksSessionId. + * + * @return int + */ + public function getLinksSessionId() + { + return $this->linksSessionId; + } + + /** + * Get linksId. + * + * @return int + */ + public function getLinksId() + { + return $this->linksId; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/TrackELogin.php b/src/Chamilo/CoreBundle/Entity/TrackELogin.php new file mode 100644 index 000000000..fd5726896 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/TrackELogin.php @@ -0,0 +1,160 @@ +loginUserId = $loginUserId; + + return $this; + } + + /** + * Get loginUserId. + * + * @return int + */ + public function getLoginUserId() + { + return $this->loginUserId; + } + + /** + * Set loginDate. + * + * @param \DateTime $loginDate + * + * @return TrackELogin + */ + public function setLoginDate($loginDate) + { + $this->loginDate = $loginDate; + + return $this; + } + + /** + * Get loginDate. + * + * @return \DateTime + */ + public function getLoginDate() + { + return $this->loginDate; + } + + /** + * Set userIp. + * + * @param string $userIp + * + * @return TrackELogin + */ + public function setUserIp($userIp) + { + $this->userIp = $userIp; + + return $this; + } + + /** + * Get userIp. + * + * @return string + */ + public function getUserIp() + { + return $this->userIp; + } + + /** + * Set logoutDate. + * + * @param \DateTime $logoutDate + * + * @return TrackELogin + */ + public function setLogoutDate($logoutDate) + { + $this->logoutDate = $logoutDate; + + return $this; + } + + /** + * Get logoutDate. + * + * @return \DateTime + */ + public function getLogoutDate() + { + return $this->logoutDate; + } + + /** + * Get loginId. + * + * @return int + */ + public function getLoginId() + { + return $this->loginId; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/TrackELoginAttempt.php b/src/Chamilo/CoreBundle/Entity/TrackELoginAttempt.php new file mode 100644 index 000000000..0a55e5cbf --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/TrackELoginAttempt.php @@ -0,0 +1,115 @@ +success = false; + } + + public function getId(): int + { + return $this->id; + } + + public function getUsername(): string + { + return $this->username; + } + + public function setUsername(string $username): TrackELoginAttempt + { + $this->username = $username; + + return $this; + } + + public function getLoginDate(): \DateTime + { + return $this->loginDate; + } + + public function setLoginDate(\DateTime $loginDate): TrackELoginAttempt + { + $this->loginDate = $loginDate; + + return $this; + } + + public function getUserIp(): string + { + return $this->userIp; + } + + public function setUserIp(string $userIp): TrackELoginAttempt + { + $this->userIp = $userIp; + + return $this; + } + + public function isSuccess(): bool + { + return $this->success; + } + + public function setSuccess(bool $success): TrackELoginAttempt + { + $this->success = $success; + + return $this; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/TrackEOnline.php b/src/Chamilo/CoreBundle/Entity/TrackEOnline.php new file mode 100644 index 000000000..e08d6139c --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/TrackEOnline.php @@ -0,0 +1,227 @@ +loginUserId = $loginUserId; + + return $this; + } + + /** + * Get loginUserId. + * + * @return int + */ + public function getLoginUserId() + { + return $this->loginUserId; + } + + /** + * Set loginDate. + * + * @param \DateTime $loginDate + * + * @return TrackEOnline + */ + public function setLoginDate($loginDate) + { + $this->loginDate = $loginDate; + + return $this; + } + + /** + * Get loginDate. + * + * @return \DateTime + */ + public function getLoginDate() + { + return $this->loginDate; + } + + /** + * Set userIp. + * + * @param string $userIp + * + * @return TrackEOnline + */ + public function setUserIp($userIp) + { + $this->userIp = $userIp; + + return $this; + } + + /** + * Get userIp. + * + * @return string + */ + public function getUserIp() + { + return $this->userIp; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return TrackEOnline + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Set sessionId. + * + * @param int $sessionId + * + * @return TrackEOnline + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * Get sessionId. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * Set accessUrlId. + * + * @param int $accessUrlId + * + * @return TrackEOnline + */ + public function setAccessUrlId($accessUrlId) + { + $this->accessUrlId = $accessUrlId; + + return $this; + } + + /** + * Get accessUrlId. + * + * @return int + */ + public function getAccessUrlId() + { + return $this->accessUrlId; + } + + /** + * Get loginId. + * + * @return int + */ + public function getLoginId() + { + return $this->loginId; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/TrackEOpen.php b/src/Chamilo/CoreBundle/Entity/TrackEOpen.php new file mode 100644 index 000000000..a4290e026 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/TrackEOpen.php @@ -0,0 +1,158 @@ +openRemoteHost = $openRemoteHost; + + return $this; + } + + /** + * Get openRemoteHost. + * + * @return string + */ + public function getOpenRemoteHost() + { + return $this->openRemoteHost; + } + + /** + * Set openAgent. + * + * @param string $openAgent + * + * @return TrackEOpen + */ + public function setOpenAgent($openAgent) + { + $this->openAgent = $openAgent; + + return $this; + } + + /** + * Get openAgent. + * + * @return string + */ + public function getOpenAgent() + { + return $this->openAgent; + } + + /** + * Set openReferer. + * + * @param string $openReferer + * + * @return TrackEOpen + */ + public function setOpenReferer($openReferer) + { + $this->openReferer = $openReferer; + + return $this; + } + + /** + * Get openReferer. + * + * @return string + */ + public function getOpenReferer() + { + return $this->openReferer; + } + + /** + * Set openDate. + * + * @param \DateTime $openDate + * + * @return TrackEOpen + */ + public function setOpenDate($openDate) + { + $this->openDate = $openDate; + + return $this; + } + + /** + * Get openDate. + * + * @return \DateTime + */ + public function getOpenDate() + { + return $this->openDate; + } + + /** + * Get openId. + * + * @return int + */ + public function getOpenId() + { + return $this->openId; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/TrackEUploads.php b/src/Chamilo/CoreBundle/Entity/TrackEUploads.php new file mode 100644 index 000000000..381851cc6 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/TrackEUploads.php @@ -0,0 +1,228 @@ +uploadUserId = $uploadUserId; + + return $this; + } + + /** + * Get uploadUserId. + * + * @return int + */ + public function getUploadUserId() + { + return $this->uploadUserId; + } + + /** + * Set uploadDate. + * + * @param \DateTime $uploadDate + * + * @return TrackEUploads + */ + public function setUploadDate($uploadDate) + { + $this->uploadDate = $uploadDate; + + return $this; + } + + /** + * Get uploadDate. + * + * @return \DateTime + */ + public function getUploadDate() + { + return $this->uploadDate; + } + + /** + * Set uploadCoursId. + * + * @param string $uploadCoursId + * + * @return TrackEUploads + */ + public function setUploadCoursId($uploadCoursId) + { + $this->uploadCoursId = $uploadCoursId; + + return $this; + } + + /** + * Get uploadCoursId. + * + * @return string + */ + public function getUploadCoursId() + { + return $this->uploadCoursId; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return TrackEUploads + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Set uploadWorkId. + * + * @param int $uploadWorkId + * + * @return TrackEUploads + */ + public function setUploadWorkId($uploadWorkId) + { + $this->uploadWorkId = $uploadWorkId; + + return $this; + } + + /** + * Get uploadWorkId. + * + * @return int + */ + public function getUploadWorkId() + { + return $this->uploadWorkId; + } + + /** + * Set uploadSessionId. + * + * @param int $uploadSessionId + * + * @return TrackEUploads + */ + public function setUploadSessionId($uploadSessionId) + { + $this->uploadSessionId = $uploadSessionId; + + return $this; + } + + /** + * Get uploadSessionId. + * + * @return int + */ + public function getUploadSessionId() + { + return $this->uploadSessionId; + } + + /** + * Get uploadId. + * + * @return int + */ + public function getUploadId() + { + return $this->uploadId; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/TrackStoredValues.php b/src/Chamilo/CoreBundle/Entity/TrackStoredValues.php new file mode 100644 index 000000000..825aa407f --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/TrackStoredValues.php @@ -0,0 +1,197 @@ +userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set scoId. + * + * @param int $scoId + * + * @return TrackStoredValues + */ + public function setScoId($scoId) + { + $this->scoId = $scoId; + + return $this; + } + + /** + * Get scoId. + * + * @return int + */ + public function getScoId() + { + return $this->scoId; + } + + /** + * Set courseId. + * + * @param string $courseId + * + * @return TrackStoredValues + */ + public function setCourseId($courseId) + { + $this->courseId = $courseId; + + return $this; + } + + /** + * Get courseId. + * + * @return string + */ + public function getCourseId() + { + return $this->courseId; + } + + /** + * Set svKey. + * + * @param string $svKey + * + * @return TrackStoredValues + */ + public function setSvKey($svKey) + { + $this->svKey = $svKey; + + return $this; + } + + /** + * Get svKey. + * + * @return string + */ + public function getSvKey() + { + return $this->svKey; + } + + /** + * Set svValue. + * + * @param string $svValue + * + * @return TrackStoredValues + */ + public function setSvValue($svValue) + { + $this->svValue = $svValue; + + return $this; + } + + /** + * Get svValue. + * + * @return string + */ + public function getSvValue() + { + return $this->svValue; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/TrackStoredValuesStack.php b/src/Chamilo/CoreBundle/Entity/TrackStoredValuesStack.php new file mode 100644 index 000000000..c78fadf79 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/TrackStoredValuesStack.php @@ -0,0 +1,228 @@ +userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set scoId. + * + * @param int $scoId + * + * @return TrackStoredValuesStack + */ + public function setScoId($scoId) + { + $this->scoId = $scoId; + + return $this; + } + + /** + * Get scoId. + * + * @return int + */ + public function getScoId() + { + return $this->scoId; + } + + /** + * Set stackOrder. + * + * @param int $stackOrder + * + * @return TrackStoredValuesStack + */ + public function setStackOrder($stackOrder) + { + $this->stackOrder = $stackOrder; + + return $this; + } + + /** + * Get stackOrder. + * + * @return int + */ + public function getStackOrder() + { + return $this->stackOrder; + } + + /** + * Set courseId. + * + * @param string $courseId + * + * @return TrackStoredValuesStack + */ + public function setCourseId($courseId) + { + $this->courseId = $courseId; + + return $this; + } + + /** + * Get courseId. + * + * @return string + */ + public function getCourseId() + { + return $this->courseId; + } + + /** + * Set svKey. + * + * @param string $svKey + * + * @return TrackStoredValuesStack + */ + public function setSvKey($svKey) + { + $this->svKey = $svKey; + + return $this; + } + + /** + * Get svKey. + * + * @return string + */ + public function getSvKey() + { + return $this->svKey; + } + + /** + * Set svValue. + * + * @param string $svValue + * + * @return TrackStoredValuesStack + */ + public function setSvValue($svValue) + { + $this->svValue = $svValue; + + return $this; + } + + /** + * Get svValue. + * + * @return string + */ + public function getSvValue() + { + return $this->svValue; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/UserApiKey.php b/src/Chamilo/CoreBundle/Entity/UserApiKey.php new file mode 100644 index 000000000..0bc2f27e1 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/UserApiKey.php @@ -0,0 +1,282 @@ +userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set apiKey. + * + * @param string $apiKey + * + * @return UserApiKey + */ + public function setApiKey($apiKey) + { + $this->apiKey = $apiKey; + + return $this; + } + + /** + * Get apiKey. + * + * @return string + */ + public function getApiKey() + { + return $this->apiKey; + } + + /** + * Set apiService. + * + * @param string $apiService + * + * @return UserApiKey + */ + public function setApiService($apiService) + { + $this->apiService = $apiService; + + return $this; + } + + /** + * Get apiService. + * + * @return string + */ + public function getApiService() + { + return $this->apiService; + } + + /** + * Set apiEndPoint. + * + * @param string $apiEndPoint + * + * @return UserApiKey + */ + public function setApiEndPoint($apiEndPoint) + { + $this->apiEndPoint = $apiEndPoint; + + return $this; + } + + /** + * Get apiEndPoint. + * + * @return string + */ + public function getApiEndPoint() + { + return $this->apiEndPoint; + } + + /** + * Set createdDate. + * + * @param \DateTime $createdDate + * + * @return UserApiKey + */ + public function setCreatedDate($createdDate) + { + $this->createdDate = $createdDate; + + return $this; + } + + /** + * Get createdDate. + * + * @return \DateTime + */ + public function getCreatedDate() + { + return $this->createdDate; + } + + /** + * Set validityStartDate. + * + * @param \DateTime $validityStartDate + * + * @return UserApiKey + */ + public function setValidityStartDate($validityStartDate) + { + $this->validityStartDate = $validityStartDate; + + return $this; + } + + /** + * Get validityStartDate. + * + * @return \DateTime + */ + public function getValidityStartDate() + { + return $this->validityStartDate; + } + + /** + * Set validityEndDate. + * + * @param \DateTime $validityEndDate + * + * @return UserApiKey + */ + public function setValidityEndDate($validityEndDate) + { + $this->validityEndDate = $validityEndDate; + + return $this; + } + + /** + * Get validityEndDate. + * + * @return \DateTime + */ + public function getValidityEndDate() + { + return $this->validityEndDate; + } + + /** + * Set description. + * + * @param string $description + * + * @return UserApiKey + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * Get description. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/UserCourseCategory.php b/src/Chamilo/CoreBundle/Entity/UserCourseCategory.php new file mode 100644 index 000000000..7ba359a9b --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/UserCourseCategory.php @@ -0,0 +1,127 @@ +userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set title. + * + * @param string $title + * + * @return UserCourseCategory + */ + public function setTitle($title) + { + $this->title = $title; + + return $this; + } + + /** + * Get title. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set sort. + * + * @param int $sort + * + * @return UserCourseCategory + */ + public function setSort($sort) + { + $this->sort = $sort; + + return $this; + } + + /** + * Get sort. + * + * @return int + */ + public function getSort() + { + return $this->sort; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/UserFriendRelationType.php b/src/Chamilo/CoreBundle/Entity/UserFriendRelationType.php new file mode 100644 index 000000000..f1f7adf6f --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/UserFriendRelationType.php @@ -0,0 +1,65 @@ +title = $title; + + return $this; + } + + /** + * Get title. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/UserGroupRelUserGroup.php b/src/Chamilo/CoreBundle/Entity/UserGroupRelUserGroup.php new file mode 100644 index 000000000..d861b8a77 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/UserGroupRelUserGroup.php @@ -0,0 +1,127 @@ +groupId = $groupId; + + return $this; + } + + /** + * Get groupId. + * + * @return int + */ + public function getGroupId() + { + return $this->groupId; + } + + /** + * Set subgroupId. + * + * @param int $subgroupId + * + * @return $this + */ + public function setSubgroupId($subgroupId) + { + $this->subgroupId = $subgroupId; + + return $this; + } + + /** + * Get subgroupId. + * + * @return int + */ + public function getSubgroupId() + { + return $this->subgroupId; + } + + /** + * Set relationType. + * + * @param int $relationType + * + * @return $this + */ + public function setRelationType($relationType) + { + $this->relationType = $relationType; + + return $this; + } + + /** + * Get relationType. + * + * @return int + */ + public function getRelationType() + { + return $this->relationType; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/UserRelCourseVote.php b/src/Chamilo/CoreBundle/Entity/UserRelCourseVote.php new file mode 100644 index 000000000..cc8c66934 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/UserRelCourseVote.php @@ -0,0 +1,193 @@ +cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Set userId. + * + * @param int $userId + * + * @return UserRelCourseVote + */ + public function setUserId($userId) + { + $this->userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set sessionId. + * + * @param int $sessionId + * + * @return UserRelCourseVote + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * Get sessionId. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * Set urlId. + * + * @param int $urlId + * + * @return UserRelCourseVote + */ + public function setUrlId($urlId) + { + $this->urlId = $urlId; + + return $this; + } + + /** + * Get urlId. + * + * @return int + */ + public function getUrlId() + { + return $this->urlId; + } + + /** + * Set vote. + * + * @param int $vote + * + * @return UserRelCourseVote + */ + public function setVote($vote) + { + $this->vote = $vote; + + return $this; + } + + /** + * Get vote. + * + * @return int + */ + public function getVote() + { + return $this->vote; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/UserRelEventType.php b/src/Chamilo/CoreBundle/Entity/UserRelEventType.php new file mode 100644 index 000000000..c4ef2df9e --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/UserRelEventType.php @@ -0,0 +1,98 @@ +userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set eventTypeName. + * + * @param string $eventTypeName + * + * @return UserRelEventType + */ + public function setEventTypeName($eventTypeName) + { + $this->eventTypeName = $eventTypeName; + + return $this; + } + + /** + * Get eventTypeName. + * + * @return string + */ + public function getEventTypeName() + { + return $this->eventTypeName; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/UserRelTag.php b/src/Chamilo/CoreBundle/Entity/UserRelTag.php new file mode 100644 index 000000000..962ab9177 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/UserRelTag.php @@ -0,0 +1,102 @@ +userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set tagId. + * + * @param int $tagId + * + * @return UserRelTag + */ + public function setTagId($tagId) + { + $this->tagId = $tagId; + + return $this; + } + + /** + * Get tagId. + * + * @return int + */ + public function getTagId() + { + return $this->tagId; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/UserRelUser.php b/src/Chamilo/CoreBundle/Entity/UserRelUser.php new file mode 100644 index 000000000..3aa9f8943 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/UserRelUser.php @@ -0,0 +1,162 @@ +userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set friendUserId. + * + * @param int $friendUserId + * + * @return UserRelUser + */ + public function setFriendUserId($friendUserId) + { + $this->friendUserId = $friendUserId; + + return $this; + } + + /** + * Get friendUserId. + * + * @return int + */ + public function getFriendUserId() + { + return $this->friendUserId; + } + + /** + * Set relationType. + * + * @param int $relationType + * + * @return UserRelUser + */ + public function setRelationType($relationType) + { + $this->relationType = $relationType; + + return $this; + } + + /** + * Get relationType. + * + * @return int + */ + public function getRelationType() + { + return $this->relationType; + } + + /** + * Set lastEdit. + * + * @param \DateTime $lastEdit + * + * @return UserRelUser + */ + public function setLastEdit($lastEdit) + { + $this->lastEdit = $lastEdit; + + return $this; + } + + /** + * Get lastEdit. + * + * @return \DateTime + */ + public function getLastEdit() + { + return $this->lastEdit; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/Usergroup.php b/src/Chamilo/CoreBundle/Entity/Usergroup.php new file mode 100644 index 000000000..159af32bb --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/Usergroup.php @@ -0,0 +1,235 @@ +users = new ArrayCollection(); + } + + /** + * @return string + */ + public function __toString() + { + return (string) $this->getName(); + } + + /** + * @return ArrayCollection + */ + public function getUsers() + { + return $this->users; + } + + /** + * @param $users + */ + public function setUsers($users) + { + $this->users = new ArrayCollection(); + + foreach ($users as $user) { + $this->addUsers($user); + } + } + + public function addUsers(UsergroupRelUser $user) + { + $user->setUsergroup($this); + $this->users[] = $user; + } + + /** + * Remove $user. + */ + public function removeUsers(UsergroupRelUser $user) + { + foreach ($this->users as $key => $value) { + if ($value->getId() == $user->getId()) { + unset($this->users[$key]); + } + } + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set name. + * + * @param string $name + * + * @return Usergroup + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * Get name. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set description. + * + * @param string $description + * + * @return Usergroup + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * Get description. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * @return int + */ + public function getGroupType() + { + return $this->groupType; + } + + /** + * @param int $groupType + * + * @return Usergroup + */ + public function setGroupType($groupType) + { + $this->groupType = $groupType; + + return $this; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/UsergroupRelCourse.php b/src/Chamilo/CoreBundle/Entity/UsergroupRelCourse.php new file mode 100644 index 000000000..80b553495 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/UsergroupRelCourse.php @@ -0,0 +1,96 @@ +usergroupId = $usergroupId; + + return $this; + } + + /** + * Get usergroupId. + * + * @return int + */ + public function getUsergroupId() + { + return $this->usergroupId; + } + + /** + * Set courseId. + * + * @param int $courseId + * + * @return UsergroupRelCourse + */ + public function setCourseId($courseId) + { + $this->courseId = $courseId; + + return $this; + } + + /** + * Get courseId. + * + * @return int + */ + public function getCourseId() + { + return $this->courseId; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/UsergroupRelQuestion.php b/src/Chamilo/CoreBundle/Entity/UsergroupRelQuestion.php new file mode 100644 index 000000000..b72bef5a8 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/UsergroupRelQuestion.php @@ -0,0 +1,158 @@ +cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Set questionId. + * + * @param int $questionId + * + * @return UsergroupRelQuestion + */ + public function setQuestionId($questionId) + { + $this->questionId = $questionId; + + return $this; + } + + /** + * Get questionId. + * + * @return int + */ + public function getQuestionId() + { + return $this->questionId; + } + + /** + * Set usergroupId. + * + * @param int $usergroupId + * + * @return UsergroupRelQuestion + */ + public function setUsergroupId($usergroupId) + { + $this->usergroupId = $usergroupId; + + return $this; + } + + /** + * Get usergroupId. + * + * @return int + */ + public function getUsergroupId() + { + return $this->usergroupId; + } + + /** + * Set coefficient. + * + * @param float $coefficient + * + * @return UsergroupRelQuestion + */ + public function setCoefficient($coefficient) + { + $this->coefficient = $coefficient; + + return $this; + } + + /** + * Get coefficient. + * + * @return float + */ + public function getCoefficient() + { + return $this->coefficient; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/UsergroupRelSession.php b/src/Chamilo/CoreBundle/Entity/UsergroupRelSession.php new file mode 100644 index 000000000..782026b95 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/UsergroupRelSession.php @@ -0,0 +1,96 @@ +usergroupId = $usergroupId; + + return $this; + } + + /** + * Get usergroupId. + * + * @return int + */ + public function getUsergroupId() + { + return $this->usergroupId; + } + + /** + * Set sessionId. + * + * @param int $sessionId + * + * @return UsergroupRelSession + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * Get sessionId. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CoreBundle/Entity/UsergroupRelUser.php b/src/Chamilo/CoreBundle/Entity/UsergroupRelUser.php new file mode 100644 index 000000000..c36674ce7 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/UsergroupRelUser.php @@ -0,0 +1,132 @@ +id; + } + + /** + * Set user. + * + * @return UsergroupRelUser + */ + public function setUser(User $user) + { + $this->user = $user; + + return $this; + } + + /** + * Get user. + * + * @return User + */ + public function getUser() + { + return $this->user; + } + + /** + * Set usergroup. + * + * @return UsergroupRelUser + */ + public function setUsergroup(Usergroup $usergroup) + { + $this->usergroup = $usergroup; + + return $this; + } + + /** + * Get usergroup. + * + * @return Usergroup + */ + public function getUsergroup() + { + return $this->usergroup; + } + + /** + * Set relationType. + * + * @param int $relationType + * + * @return $this + */ + public function setRelationType($relationType) + { + $this->relationType = $relationType; + + return $this; + } + + /** + * Get relationType. + * + * @return int + */ + public function getRelationType() + { + return $this->relationType; + } +} diff --git a/src/Chamilo/CoreBundle/EventListener/LegacyLoginListener.php b/src/Chamilo/CoreBundle/EventListener/LegacyLoginListener.php new file mode 100644 index 000000000..15536b1d1 --- /dev/null +++ b/src/Chamilo/CoreBundle/EventListener/LegacyLoginListener.php @@ -0,0 +1,119 @@ +container = $container; + $this->tokenStorage = $tokenStorage; + } + + public function onKernelRequest(GetResponseEvent $event) + { + $request = $event->getRequest(); + + if (!$request->hasPreviousSession()) { + return; + } + + $token = $this->tokenStorage->getToken(); + if ($token) { + $isGranted = $this->container->get('security.authorization_checker')->isGranted('IS_AUTHENTICATED_FULLY'); + if (!$isGranted) { + if (isset($_SESSION) && isset($_SESSION['_user'])) { + if ($_SESSION['_user']['active'] == 1) { + $username = $_SESSION['_user']['username']; + $criteria = ['username' => $username]; + /** @var User $user */ + $user = $this->container->get('sonata.user.user_manager')->findOneBy($criteria); + if ($user) { + $em = $this->container->get('doctrine'); + /** @var User $completeUser */ + $completeUser = $em->getRepository('ChamiloUserBundle:User')->findOneBy($criteria); + $user->setLanguage($completeUser->getLanguage()); + + $isAdminUser = $em->getRepository('ChamiloCoreBundle:Admin')->findOneBy(['userId' => $user->getId()]); + if ($isAdminUser) { + $user->setSuperAdmin(true); + } + + $languages = ['german' => 'de', 'english' => 'en', 'spanish' => 'es', 'french' => 'fr']; + $locale = isset($languages[$user->getLanguage()]) ? $languages[$user->getLanguage()] : ''; + if ($user && !empty($locale)) { + error_log('legacyloginlistener'); + error_log($locale); + $user->setLocale($locale); + + //$request->getSession()->set('_locale_user', $locale); + + // if no explicit locale has been set on this request, use one from the session + $request->getSession()->set('_locale', $locale); + $request->setLocale($locale); + } + + $token = new UsernamePasswordToken($user, null, "main", $user->getRoles()); + + $this->tokenStorage->setToken($token); //now the user is logged in + + //now dispatch the login event + $event = new InteractiveLoginEvent($request, $token); + $this->container->get('event_dispatcher')->dispatch("security.interactive_login", $event); + $this->container->get('event_dispatcher')->addListener( + KernelEvents::RESPONSE, + [$this, 'redirectUser'] + ); + } + } + } + } + } + } + + /** + * @return array + */ + public static function getSubscribedEvents() + { + return [ + // must be registered before the default Locale listener + KernelEvents::REQUEST => [['onKernelRequest', 15]], + ]; + } + + public function redirectUser(FilterResponseEvent $event) + { + $uri = $event->getRequest()->getUri(); + // on effectue la redirection + $response = new RedirectResponse($uri); + $event->setResponse($response); + } +} diff --git a/src/Chamilo/CoreBundle/EventListener/LocaleListener.php b/src/Chamilo/CoreBundle/EventListener/LocaleListener.php new file mode 100644 index 000000000..95fb0780d --- /dev/null +++ b/src/Chamilo/CoreBundle/EventListener/LocaleListener.php @@ -0,0 +1,70 @@ +defaultLocale = $defaultLocale; + $this->container = $container; + } + + public function onKernelRequest(GetResponseEvent $event) + { + $request = $event->getRequest(); + if (!$request->hasPreviousSession()) { + return; + } + + // try to see if the locale has been set as a _locale routing parameter + if ($locale = $request->attributes->get('_locale')) { + $request->getSession()->set('_locale', $locale); + } else { + $locale = $this->defaultLocale; + + // 2. Check user locale + // _locale_user is set when user logins the system check UserLocaleListener + $userLocale = $request->getSession()->get('_locale'); + if (!empty($userLocale)) { + $locale = $userLocale; + } + + // if no explicit locale has been set on this request, use one from the session + $request->setLocale($locale); + $request->getSession()->set('_locale', $locale); + } + } + + /** + * @return array + */ + public static function getSubscribedEvents() + { + return [ + // must be registered before the default Locale listener + KernelEvents::REQUEST => [['onKernelRequest', 15]], + ]; + } +} diff --git a/src/Chamilo/CoreBundle/EventListener/UserLocaleListener.php b/src/Chamilo/CoreBundle/EventListener/UserLocaleListener.php new file mode 100644 index 000000000..a063cb9ab --- /dev/null +++ b/src/Chamilo/CoreBundle/EventListener/UserLocaleListener.php @@ -0,0 +1,55 @@ + user + * Priority order: platform -> user -> course + * + * @package Chamilo\CoreBundle\EventListener + */ +class UserLocaleListener +{ + /** + * @var Session + */ + private $session; + + /** + * UserLocaleListener constructor. + */ + public function __construct(Session $session) + { + $this->session = $session; + } + + /** + * Set locale when user enters the platform. + */ + public function onInteractiveLogin(InteractiveLoginEvent $event) + { + $languages = ['german' => 'de', 'english' => 'en', 'spanish' => 'es', 'french' => 'fr']; + + /** @var User $user */ + $token = $event->getAuthenticationToken(); + + if ($token) { + $user = $token->getUser(); + $locale = isset($languages[$user->getLanguage()]) ? $languages[$user->getLanguage()] : ''; + if ($user && !empty($locale)) { + $this->session->set('_locale', $locale); + } + } + } +} diff --git a/src/Chamilo/CoreBundle/Menu/NavBuilder.php b/src/Chamilo/CoreBundle/Menu/NavBuilder.php new file mode 100644 index 000000000..fcad17c8b --- /dev/null +++ b/src/Chamilo/CoreBundle/Menu/NavBuilder.php @@ -0,0 +1,288 @@ +container->get('knp_menu.factory'); + $menu = $factory->createItem('categories', $itemOptions); + $this->buildCategoryMenu($menu, $itemOptions, $currentUri); + + return $menu; + } + + /** + * @param \Knp\Menu\ItemInterface $menu The item to fill with $routes + * @param array $options The item options + * @param string $currentUri The current URI + */ + public function buildCategoryMenu(ItemInterface $menu, array $options = [], $currentUri = null) + { + //$categories = $this->categoryManager->getCategoryTree(); + + //$this->fillMenu($menu, $categories, $options, $currentUri); + $menu->addChild('home', ['route' => 'home']); + } + + /** + * Top menu left. + * + * @return \Knp\Menu\ItemInterface + */ + public function leftMenu(FactoryInterface $factory, array $options) + { + $checker = $this->container->get('security.authorization_checker'); + $translator = $this->container->get('translator'); + + $menu = $factory->createItem('root'); + $menu->setChildrenAttribute('class', 'nav navbar-nav'); + + $menu->addChild( + $translator->trans('Home'), + ['route' => 'home'] + ); + + if ($checker->isGranted('IS_AUTHENTICATED_FULLY')) { + $menu->addChild( + $translator->trans('My courses'), + ['route' => 'userportal'] + ); + + $menu->addChild( + $translator->trans('Personal agenda'), + [ + 'route' => 'main', + 'routeParameters' => [ + 'name' => 'calendar/agenda_js.php', + ], + ] + ); + + $menu->addChild( + $translator->trans('Reporting'), + [ + 'route' => 'main', + 'routeParameters' => [ + 'name' => 'mySpace/index.php', + ], + ] + ); + + $menu->addChild( + $translator->trans('Social network'), + [ + 'route' => 'main', + 'routeParameters' => [ + 'name' => 'social/home.php', + ], + ] + ); + + if ($checker->isGranted('ROLE_ADMIN')) { + $menu->addChild( + $translator->trans('Dashboard'), + [ + 'route' => 'main', + 'routeParameters' => [ + 'name' => 'dashboard/index.php', + ], + ] + ); + + $menu->addChild( + $translator->trans('Administration'), + [ + 'route' => 'main', + 'routeParameters' => [ + 'name' => 'social/home.php', + ], + ] + ); + } + } + + $categories = $this->container->get('faq.entity.category_repository')->retrieveActive(); + if ($categories) { + $faq = $menu->addChild( + 'FAQ', + [ + 'route' => 'faq_index', + ] + ); + /** @var Category $category */ + foreach ($categories as $category) { + $faq->addChild( + $category->getHeadline(), + [ + 'route' => 'faq', + 'routeParameters' => [ + 'categorySlug' => $category->getSlug(), + 'questionSlug' => '', + ], + ] + )->setAttribute('divider_append', true); + } + } + + // Getting site information + + $site = $this->container->get('sonata.page.site.selector'); + $host = $site->getRequestContext()->getHost(); + $siteManager = $this->container->get('sonata.page.manager.site'); + /** @var Site $site */ + $site = $siteManager->findOneBy([ + 'host' => [$host, 'localhost'], + 'enabled' => true, + ]); + + if ($site) { + $pageManager = $this->container->get('sonata.page.manager.page'); + + // Parents only of homepage + $criteria = ['site' => $site, 'enabled' => true, 'parent' => 1]; + $pages = $pageManager->findBy($criteria); + + //$pages = $pageManager->loadPages($site); + /** @var Page $page */ + foreach ($pages as $page) { + /*if ($page->getRouteName() !== 'page_slug') { + continue; + }*/ + + // Avoid home + if ($page->getUrl() === '/') { + continue; + } + + if (!$page->isCms()) { + continue; + } + + $subMenu = $menu->addChild( + $page->getName(), + [ + 'route' => $page->getRouteName(), + 'routeParameters' => [ + 'path' => $page->getUrl(), + ], + ] + ); + + /** @var Page $child */ + foreach ($page->getChildren() as $child) { + $subMenu->addChild( + $child->getName(), + [ + 'route' => $page->getRouteName(), + 'routeParameters' => [ + 'path' => $child->getUrl(), + ], + ] + )->setAttribute('divider_append', true); + } + } + } + + return $menu; + } + + /** + * Top menu right. + * + * @return \Knp\Menu\ItemInterface + */ + public function rightMenu(FactoryInterface $factory, array $options) + { + $checker = $this->container->get('security.authorization_checker'); + + $translator = $this->container->get('translator'); + $menu = $factory->createItem('root'); + + //

'; + } + + echo ''; + echo '
'; + echo '
'; + echo ''; + + if (!empty($hidden_fields['destination_course']) && + !empty($hidden_fields['origin_course']) && + !empty($hidden_fields['destination_session']) && + !empty($hidden_fields['origin_session']) + ) { + echo ''; + echo ''; + echo ''; + echo ''; + } + + $forum_categories = []; + $forums = []; + $forum_topics = []; + + echo '

'; + echo get_lang('SelectResources'); + echo '

'; + echo Display::return_message(get_lang('DontForgetToSelectTheMediaFilesIfYourResourceNeedIt')); + + $resource_titles = self::getResourceTitleList(); + $element_count = self::parseResources($resource_titles, $course->resources, $forum_categories, $forums, $forum_topics, true, true); + + // Fixes forum order + if (!empty($element_count)) { + $type = RESOURCE_FORUMCATEGORY; + echo '
'; + echo ''; + echo ''.$resource_titles[RESOURCE_FORUM].'
'; + echo '
'; + echo '
    '; + foreach ($forum_categories as $forum_category_id => $forum_category) { + echo '
  • '; + echo ''; + echo '
  • '; + + if (isset($forums[$forum_category_id])) { + $my_forums = $forums[$forum_category_id]; + echo '
      '; + foreach ($my_forums as $forum_id => $forum) { + echo '
    • '; + echo ''; + echo '
    • '; + if (isset($forum_topics[$forum_id])) { + $my_forum_topics = $forum_topics[$forum_id]; + if (!empty($my_forum_topics)) { + echo '
        '; + foreach ($my_forum_topics as $topic_id => $topic) { + echo '
      • '; + echo ''; + echo '
      • '; + } + echo '
      '; + } + } + } + echo '
    '; + } + echo '
    '; + } + echo '
'; + echo '
'; + echo ''; + } + + if ($avoidSerialize) { + /*Documents are avoided due the huge amount of memory that the serialize php function "eats" + (when there are directories with hundred/thousand of files) */ + // this is a known issue of serialize + $course->resources['document'] = null; + } + + if ($avoidCourseInForm === false) { + /** @var Course $course */ + $courseSerialized = base64_encode(Course::serialize($course)); + echo ''; + } + + if (is_array($hidden_fields)) { + foreach ($hidden_fields as $key => $value) { + echo ''; + } + } + + $recycleOption = isset($_POST['recycle_option']) ? true : false; + if (empty($element_count)) { + echo Display::return_message(get_lang('NoDataAvailable'), 'warning'); + } else { + if (!empty($hidden_fields['destination_session'])) { + echo '
+ '; + } else { + if ($recycleOption) { + echo '
'; + } else { + echo '
+ '; + } + } + } + + self::display_hidden_quiz_questions($course); + self::display_hidden_scorm_directories($course); + echo '
'; + echo '
'; + echo '
'; + } + + /** + * @param array $resource_titles + * @param array $resourceList + * @param bool $showHeader + * @param bool $showItems + * + * @return int + */ + public static function parseResources( + $resource_titles, + $resourceList, + &$forum_categories, + &$forums, + &$forum_topics, + $showHeader = true, + $showItems = true + ) { + $element_count = 0; + foreach ($resourceList as $type => $resources) { + if (count($resources) > 0) { + switch ($type) { + // Resources to avoid + case RESOURCE_FORUMCATEGORY: + foreach ($resources as $id => $resource) { + $forum_categories[$id] = $resource; + } + $element_count++; + break; + case RESOURCE_FORUM: + foreach ($resources as $id => $resource) { + $forums[$resource->obj->forum_category][$id] = $resource; + } + $element_count++; + break; + case RESOURCE_FORUMTOPIC: + foreach ($resources as $id => $resource) { + $forum_topics[$resource->obj->forum_id][$id] = $resource; + } + $element_count++; + break; + case RESOURCE_LINKCATEGORY: + case RESOURCE_FORUMPOST: + case RESOURCE_QUIZQUESTION: + case RESOURCE_SURVEYQUESTION: + case RESOURCE_SURVEYINVITATION: + break; + default: + $enableScormSelection = api_get_configuration_value('course_backup_allow_scorm_selection_in_select_form'); + if (($type == RESOURCE_SCORM) && !$enableScormSelection) { + break; + } + if ($showHeader) { + echo '
'; + echo ''; + echo ''.$resource_titles[$type].''; + echo '
'; + echo '
'; + } + + if ($type == RESOURCE_LEARNPATH) { + echo Display::return_message( + get_lang( + 'ToExportLearnpathWithQuizYouHaveToSelectQuiz' + ), + 'warning' + ); + echo Display::return_message( + get_lang( + 'IfYourLPsHaveAudioFilesIncludedYouShouldSelectThemFromTheDocuments' + ), + 'warning' + ); + if ($enableScormSelection) { + echo Display::return_message( + get_lang( + 'IfYourLPsAreScormsYouShouldSelectThemFromTheScorms' + ), + 'warning' + ); + } + } + + if ($type == RESOURCE_DOCUMENT) { + if (api_get_setting('show_glossary_in_documents') != 'none') { + echo Display::return_message( + get_lang( + 'ToExportDocumentsWithGlossaryYouHaveToSelectGlossary' + ), + 'warning' + ); + } + } + + if ($type == RESOURCE_QUIZ) { + echo Display::return_message( + get_lang( + 'IfYourQuizHaveHotspotQuestionsIncludedYouShouldSelectTheImagesFromTheDocuments' + ), + 'warning' + ); + } + + if ($showItems) { + echo '
'; + echo '
'; + echo "".get_lang('All').""; + echo "".get_lang('None').""; + echo '
'; + echo '
    '; + foreach ($resources as $id => $resource) { + if ($resource) { + echo '
  • '; + // Event obj in 1.9.x in 1.10.x the class is CalendarEvent + Resource::setClassType($resource); + echo ''; + echo '
  • '; + } + } + echo '
'; + echo '
'; + } + + if ($showHeader) { + echo '
'; + echo ''; + } + $element_count++; + } + } + } + + return $element_count; + } + + /** + * @param $course + */ + public static function display_hidden_quiz_questions($course) + { + if (is_array($course->resources)) { + foreach ($course->resources as $type => $resources) { + if (!empty($resources) && count($resources) > 0) { + switch ($type) { + case RESOURCE_QUIZQUESTION: + foreach ($resources as $id => $resource) { + echo ''; + } + break; + } + } + } + } + } + + /** + * @param $course + */ + public static function display_hidden_scorm_directories($course) + { + if (!api_get_configuration_value('course_backup_allow_scorm_selection_in_select_form')) { + if (is_array($course->resources)) { + foreach ($course->resources as $type => $resources) { + if (!empty($resources) && count($resources) > 0) { + switch ($type) { + case RESOURCE_SCORM: + foreach ($resources as $id => $resource) { + echo ''; + } + break; + } + } + } + } + } + } + + /** + * Get the posted course with all its selected resources. + * + * @param string $from who calls the function? + * It can be copy_course, create_backup, import_backup or recycle_course + * @param int $session_id + * @param string $course_code + * @param Course $postedCourse Course object as defined in the CourseCopy/Course.php script + * + * @return Course The course-object with all resources selected by the user + * in the form given by display_form(...) + */ + public static function get_posted_course($from = '', $session_id = 0, $course_code = '', $postedCourse = null) + { + $course = $postedCourse; + if (empty($postedCourse)) { + $cb = new CourseBuilder(); + $postResource = $_POST['resource'] ?? []; + $course = $cb->build(0, null, false, array_keys($postResource), $postResource); + } + + if (empty($course)) { + return false; + } + + // Create the resource DOCUMENT objects + // Loading the results from the checkboxes of the javascript + $resource = $_POST['resource'][RESOURCE_DOCUMENT] ?? null; + + $course_info = api_get_course_info($course_code); + $table_doc = Database::get_course_table(TABLE_DOCUMENT); + $table_prop = Database::get_course_table(TABLE_ITEM_PROPERTY); + $course_id = $course_info['real_id']; + + // Searching the documents resource that have been set to null because + // $avoidSerialize is true in the display_form() function + if ($from === 'copy_course') { + if (is_array($resource)) { + $resource = array_keys($resource); + foreach ($resource as $resource_item) { + $conditionSession = ''; + if (!empty($session_id)) { + $session_id = (int) $session_id; + $conditionSession = ' AND d.session_id ='.$session_id; + } + + $sql = 'SELECT d.id, d.path, d.comment, d.title, d.filetype, d.size + FROM '.$table_doc.' d + INNER JOIN '.$table_prop.' p + ON (d.c_id = p.c_id) + WHERE + d.c_id = '.$course_id.' AND + p.c_id = '.$course_id.' AND + tool = \''.TOOL_DOCUMENT.'\' AND + p.ref = d.id AND p.visibility != 2 AND + d.id = '.$resource_item.$conditionSession.' + ORDER BY path'; + $db_result = Database::query($sql); + while ($obj = Database::fetch_object($db_result)) { + $doc = new Document( + $obj->id, + $obj->path, + $obj->comment, + $obj->title, + $obj->filetype, + $obj->size + ); + if ($doc) { + $course->add_resource($doc); + // adding item property + $sql = "SELECT * FROM $table_prop + WHERE + c_id = $course_id AND + tool = '".RESOURCE_DOCUMENT."' AND + ref = $resource_item "; + $res = Database::query($sql); + $all_properties = []; + while ($item_property = Database::fetch_array($res, 'ASSOC')) { + $all_properties[] = $item_property; + } + $course->resources[RESOURCE_DOCUMENT][$resource_item]->item_properties = $all_properties; + } + } + } + } + } + + if (is_array($course->resources)) { + foreach ($course->resources as $type => $resources) { + switch ($type) { + case RESOURCE_SURVEYQUESTION: + foreach ($resources as $id => $obj) { + if (isset($_POST['resource'][RESOURCE_SURVEY]) && + is_array($_POST['resource'][RESOURCE_SURVEY]) && + !in_array($obj->survey_id, array_keys($_POST['resource'][RESOURCE_SURVEY])) + ) { + unset($course->resources[$type][$id]); + } + } + break; + case RESOURCE_FORUMTOPIC: + case RESOURCE_FORUMPOST: + //Add post from topic + if ($type == RESOURCE_FORUMTOPIC) { + $posts_to_save = []; + $posts = $course->resources[RESOURCE_FORUMPOST]; + foreach ($resources as $thread_id => $obj) { + if (!isset($_POST['resource'][RESOURCE_FORUMTOPIC][$thread_id])) { + unset($course->resources[RESOURCE_FORUMTOPIC][$thread_id]); + continue; + } + $forum_id = $obj->obj->forum_id; + $title = $obj->obj->thread_title; + foreach ($posts as $post_id => $post) { + if ($post->obj->thread_id == $thread_id && + $forum_id == $post->obj->forum_id && + $title == $post->obj->post_title + ) { + $posts_to_save[] = $post_id; + } + } + } + if (!empty($posts)) { + foreach ($posts as $post_id => $post) { + if (!in_array($post_id, $posts_to_save)) { + unset($course->resources[RESOURCE_FORUMPOST][$post_id]); + } + } + } + } + break; + case RESOURCE_LEARNPATH: + $lps = $_POST['resource'][RESOURCE_LEARNPATH] ?? null; + + if (!empty($lps)) { + foreach ($lps as $id => $obj) { + $lp_resource = $course->resources[RESOURCE_LEARNPATH][$id]; + + if (!empty($lp_resource) && isset($lp_resource->items)) { + foreach ($lp_resource->items as $item) { + switch ($item['item_type']) { + //Add links added in a LP see #5760 + case 'link': + $_POST['resource'][RESOURCE_LINK][$item['path']] = 1; + break; + } + } + } + } + } + // no break + case RESOURCE_LINKCATEGORY: + case RESOURCE_FORUMCATEGORY: + case RESOURCE_QUIZQUESTION: + case RESOURCE_DOCUMENT: + // Mark folders to import which are not selected by the user to import, + // but in which a document was selected. + $documents = $_POST['resource'][RESOURCE_DOCUMENT] ?? null; + if (!empty($resources) && is_array($resources)) { + foreach ($resources as $id => $obj) { + if (isset($obj->file_type) && $obj->file_type === 'folder' && + !isset($_POST['resource'][RESOURCE_DOCUMENT][$id]) && + is_array($documents) + ) { + foreach ($documents as $id_to_check => $post_value) { + if (isset($resources[$id_to_check])) { + $obj_to_check = $resources[$id_to_check]; + $shared_path_part = substr( + $obj_to_check->path, + 0, + strlen($obj->path) + ); + if ($id_to_check != $id && $obj->path == $shared_path_part) { + $_POST['resource'][RESOURCE_DOCUMENT][$id] = 1; + break; + } + } + } + } + } + } + // no break + default: + if (!empty($resources) && is_array($resources)) { + foreach ($resources as $id => $obj) { + $resource_is_used_elsewhere = $course->is_linked_resource($obj); + // check if document is in a quiz (audio/video) + if ($type == RESOURCE_DOCUMENT && $course->has_resources(RESOURCE_QUIZ)) { + foreach ($course->resources[RESOURCE_QUIZ] as $quiz) { + $quiz = $quiz->obj; + if (isset($quiz->media) && $quiz->media == $id) { + $resource_is_used_elsewhere = true; + } + } + } + // quiz question can be, not attached to an exercise + if ($type != RESOURCE_QUIZQUESTION) { + if (!isset($_POST['resource'][$type][$id]) && !$resource_is_used_elsewhere) { + unset($course->resources[$type][$id]); + } + } + } + } + } + } + } + + return $course; + } + + /** + * Display the form session export. + * + * @param array $list_course + * @param array $hidden_fields hidden fields to add to the form + * @param bool $avoidSerialize the document array will be serialize. This is used in the course_copy.php file + */ + public static function display_form_session_export( + $list_course, + $hidden_fields = null, + $avoidSerialize = false + ) { + ?> + + '; + echo get_lang('DestinationCourse').' : '.$courseInfo['title'].$sessionTitle; + echo ''; + } + + echo ''; + $icon = Display::returnIconPath('progress_bar.gif'); + echo '
'; + echo '
'; + echo ''; + foreach ($list_course as $course) { + foreach ($course->resources as $type => $resources) { + if (count($resources) > 0) { + echo '
code'".');">'; + echo ''; + echo ' '.$course->code.'
'; + echo '
'; + echo '
'; + + echo ''; + + foreach ($resources as $id => $resource) { + echo ''; + } + echo '
'; + echo '
'; + echo ''; + } + } + } + if ($avoidSerialize) { + // Documents are avoided due the huge amount of memory that the serialize php + // function "eats" (when there are directories with hundred/thousand of files) + // this is a known issue of serialize + $course->resources['document'] = null; + } + echo ''; + if (is_array($hidden_fields)) { + foreach ($hidden_fields as $key => $value) { + echo "\n"; + echo ''; + } + } + echo '
'; + self::display_hidden_quiz_questions($course); + self::display_hidden_scorm_directories($course); + echo '
'; + echo '
'; + echo '
'; + } +} diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Announcement.php b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Announcement.php new file mode 100644 index 000000000..f99cb35ed --- /dev/null +++ b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Announcement.php @@ -0,0 +1,86 @@ + + * + * @package chamilo.backup + */ +class Announcement extends Resource +{ + /** + * The title of the announcement. + */ + public $title; + /** + * The content of the announcement. + */ + public $content; + /** + * The date on which this announcement was made. + */ + public $date; + /** + * The display order of this announcement. + */ + public $display_order; + /** + * Has the e-mail been sent? + */ + public $email_sent; + + public $attachment_path; + + public $attachment_filename; + + public $attachment_size; + + public $attachment_comment; + + /** + * Create a new announcement. + * + * @param int $id + * @param string $title + * @param string $content + * @param string $date + * @param int display_order + */ + public function __construct( + $id, + $title, + $content, + $date, + $display_order, + $email_sent, + $path, + $filename, + $size, + $comment + ) { + parent::__construct($id, RESOURCE_ANNOUNCEMENT); + + $this->content = $content; + $this->title = $title; + $this->date = $date; + $this->display_order = $display_order; + $this->email_sent = $email_sent; + $this->attachment_path = $path; + $this->attachment_filename = $filename; + $this->attachment_size = $size; + $this->attachment_comment = $comment; + } + + /** + * Show this announcement. + */ + public function show() + { + parent::show(); + echo $this->date.': '.$this->title; + } +} diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Asset.php b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Asset.php new file mode 100644 index 000000000..b2d85f38c --- /dev/null +++ b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Asset.php @@ -0,0 +1,39 @@ +path = $path; + $this->title = $title; + } + + /** + * Show this document. + */ + public function show() + { + parent::show(); + echo $this->title; + } +} diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Attendance.php b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Attendance.php new file mode 100644 index 000000000..f12962d61 --- /dev/null +++ b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Attendance.php @@ -0,0 +1,40 @@ +params = $params; + } + + /** + * {@inheritdoc} + */ + public function show() + { + parent::show(); + echo $this->params['name']; + } + + public function add_attendance_calendar($data) + { + $this->attendance_calendar[] = $data; + } +} diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/CalendarEvent.php b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/CalendarEvent.php new file mode 100644 index 000000000..b7b902db6 --- /dev/null +++ b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/CalendarEvent.php @@ -0,0 +1,90 @@ + + * + * @package chamilo.backup + */ +class CalendarEvent extends Resource +{ + /** + * The title. + */ + public $title; + /** + * The content. + */ + public $content; + /** + * The start date. + */ + public $start_date; + /** + * The end date. + */ + public $end_date; + /** + * The attachment path. + */ + public $attachment_path; + + /** + * The attachment filename. + */ + public $attachment_filename; + /** + * The attachment size. + */ + public $attachment_size; + + /** + * The attachment comment. + */ + public $attachment_comment; + + /** + * Create a new Event. + * + * @param int $id + * @param string $title + * @param string $content + */ + public function __construct( + $id, + $title, + $content, + $start_date, + $end_date, + $attachment_path = null, + $attachment_filename = null, + $attachment_size = null, + $attachment_comment = null, + $all_day = 0 + ) { + parent::__construct($id, RESOURCE_EVENT); + + $this->title = $title; + $this->content = $content; + $this->start_date = $start_date; + $this->end_date = $end_date; + $this->all_day = $all_day; + $this->attachment_path = $attachment_path; + $this->attachment_filename = $attachment_filename; + $this->attachment_size = $attachment_size; + $this->attachment_comment = $attachment_comment; + } + + /** + * Show this Event. + */ + public function show() + { + parent::show(); + echo $this->title.' ('.$this->start_date.' -> '.$this->end_date.')'; + } +} diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/CourseCopyLearnpath.php b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/CourseCopyLearnpath.php new file mode 100644 index 000000000..6cc208636 --- /dev/null +++ b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/CourseCopyLearnpath.php @@ -0,0 +1,227 @@ + + */ +class CourseCopyLearnpath extends Resource +{ + /** + * Type of learnpath (can be dokeos (1), scorm (2), aicc (3)). + */ + public $lp_type; + /** + * The name. + */ + public $name; + /** + * The reference. + */ + public $ref; + /** + * The description. + */ + public $description; + /** + * Path to the learning path files. + */ + public $path; + /** + * Whether additional commits should be forced or not. + */ + public $force_commit; + /** + * View mode by default ('embedded' or 'fullscreen'). + */ + public $default_view_mod; + /** + * Default character encoding. + */ + public $default_encoding; + /** + * Display order. + */ + public $display_order; + /** + * Content editor/publisher. + */ + public $content_maker; + /** + * Location of the content (local or remote). + */ + public $content_local; + /** + * License of the content. + */ + public $content_license; + /** + * Whether to prevent reinitialisation or not. + */ + public $prevent_reinit; + /** + * JavaScript library used. + */ + public $js_lib; + /** + * Debug level for this lp. + */ + public $debug; + /** + * The items. + */ + public $items; + /** + * The learnpath visibility on the homepage. + */ + public $visibility; + + /** + * Author info. + */ + public $author; + + /** + * Lp previous requisite. + */ + public $prerequisite; + + /** + * Author's image. + */ + public $preview_image; + + public $subscribeUsers; + public $hideTableOfContents; + public $accumulateWorkTime; + + /** + * Create a new learnpath. + * + * @param int ID + * @param int Type (1,2,3,...) + * @param string $name + * @param string $path + * @param string $ref + * @param string $description + * @param string $content_local + * @param string $default_encoding + * @param string $default_view_mode + * @param bool $prevent_reinit + * @param bool $force_commit + * @param string $content_maker + * @param int $display_order + * @param string $js_lib + * @param string $content_license + * @param int $debug + * @param string $visibility + * @param int $categoryId + * @param array $items + * @param int $accumulateWorkTime + * @param int $prerequisite + */ + public function __construct( + $id, + $type, + $name, + $path, + $ref, + $description, + $content_local, + $default_encoding, + $default_view_mode, + $prevent_reinit, + $force_commit, + $content_maker, + $display_order, + $js_lib, + $content_license, + $debug, + $visibility, + $author, + $preview_image, + $use_max_score, + $autolaunch, + $created_on, + $modified_on, + $publicated_on, + $expired_on, + $session_id, + $categoryId, + $subscribeUsers, + $hideTableOfContents, + $items, + $accumulateWorkTime, + $prerequisite + ) { + parent::__construct($id, RESOURCE_LEARNPATH); + $this->lp_type = $type; + $this->name = $name; + $this->path = $path; + $this->ref = $ref; + $this->description = $description; + $this->content_local = $content_local; + $this->default_encoding = $default_encoding; + $this->default_view_mod = $default_view_mode; + $this->prevent_reinit = $prevent_reinit; + $this->force_commit = $force_commit; + $this->content_maker = $content_maker; + $this->display_order = $display_order; + $this->js_lib = $js_lib; + $this->content_license = $content_license; + $this->debug = $debug; + $this->visibility = $visibility; + $this->use_max_score = $use_max_score; + $this->autolaunch = $autolaunch; + $this->created_on = $created_on; + $this->modified_on = $modified_on; + $this->publicated_on = $publicated_on; + $this->expired_on = $expired_on; + $this->session_id = $session_id; + $this->author = $author; + $this->preview_image = $preview_image; + $this->categoryId = $categoryId; + $this->subscribeUsers = $subscribeUsers; + $this->hideTableOfContents = $hideTableOfContents; + $this->items = $items; + $this->accumulateWorkTime = $accumulateWorkTime; + $this->prerequisite = $prerequisite; + } + + /** + * Get the items. + */ + public function get_items() + { + return $this->items; + } + + /** + * Check if a given resource is used as an item in this chapter. + */ + public function has_item($resource) + { + foreach ($this->items as $item) { + if ($item['id'] == $resource->get_id() && + isset($item['type']) && $item['type'] == $resource->get_type() + ) { + return true; + } + } + + return false; + } + + /** + * Show this learnpath. + */ + public function show() + { + parent::show(); + echo $this->name; + } +} diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/CourseCopyTestCategory.php b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/CourseCopyTestCategory.php new file mode 100644 index 000000000..2bd90e289 --- /dev/null +++ b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/CourseCopyTestCategory.php @@ -0,0 +1,47 @@ + + * + * @package chamilo.backup + */ +class CourseCopyTestCategory extends Resource +{ + /** + * The title. + */ + public $title; + + /** + * The description. + */ + public $description; + + /** + * Create a new TestCategory. + * + * @param int $id + * @param string $title + * @param string $description + */ + public function __construct($id, $title, $description) + { + parent::__construct($id, RESOURCE_TEST_CATEGORY); + $this->title = $title; + $this->description = $description; + } + + /** + * Show the test_category title, used in the partial recycle_course.php form. + */ + public function show() + { + parent::show(); + echo $this->title; + } +} diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/CourseDescription.php b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/CourseDescription.php new file mode 100644 index 000000000..051538606 --- /dev/null +++ b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/CourseDescription.php @@ -0,0 +1,54 @@ + + * + * @package chamilo.backup + */ +class CourseDescription extends Resource +{ + /** + * The title. + */ + public $title; + + /** + * The content. + */ + public $content; + + /** + * The description type. + */ + public $description_type; + + /** + * Create a new course description. + * + * @param int $id + * @param string $title + * @param string $content + * @param string $descriptionType + */ + public function __construct($id, $title, $content, $descriptionType) + { + parent::__construct($id, RESOURCE_COURSEDESCRIPTION); + $this->title = $title; + $this->content = $content; + $this->description_type = $descriptionType; + } + + /** + * Show this Event. + */ + public function show() + { + parent::show(); + echo $this->title; + } +} diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/CourseSession.php b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/CourseSession.php new file mode 100644 index 000000000..c6e75ad79 --- /dev/null +++ b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/CourseSession.php @@ -0,0 +1,38 @@ + + * + * @package chamilo.backup + */ +class CourseSession extends Resource +{ + // The title session + public $title; + + /** + * Create a new Session. + * + * @param int $id + * @param string $title + */ + public function __construct($id, $title) + { + parent::__construct($id, RESOURCE_SESSION_COURSE); + $this->title = $title; + } + + /** + * Show this Event. + */ + public function show() + { + parent::show(); + echo $this->title; + } +} diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Document.php b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Document.php new file mode 100644 index 000000000..1a2db9b69 --- /dev/null +++ b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Document.php @@ -0,0 +1,54 @@ + + * + * @package chamilo.backup + */ +class Document extends Resource +{ + public $path; + public $comment; + public $file_type; + public $size; + public $title; + + /** + * Create a new Document. + * + * @param int $id + * @param string $path + * @param string $comment + * @param string $title + * @param string $file_type (DOCUMENT or FOLDER); + * @param int $size + */ + public function __construct($id, $path, $comment, $title, $file_type, $size) + { + parent::__construct($id, RESOURCE_DOCUMENT); + $this->path = 'document'.$path; + $this->comment = $comment; + $this->title = $title; + $this->file_type = $file_type; + $this->size = $size; + } + + /** + * Show this document. + */ + public function show() + { + parent::show(); + echo preg_replace('@^document@', '', $this->path); + if (!empty($this->title)) { + if (strpos($this->path, $this->title) === false) { + echo " - ".$this->title; + } + } + } +} diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Forum.php b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Forum.php new file mode 100644 index 000000000..9497e2f14 --- /dev/null +++ b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Forum.php @@ -0,0 +1,122 @@ + + * + * @package chamilo.backup + */ +class Forum extends Resource +{ + /** + * The title. + */ + public $title; + + /** + * The description. + */ + public $description; + + /** + * Category-id. + */ + public $category_id; + + /** + * Last post. + */ + public $last_post; + + /** + * Number of threads. + */ + public $topics; + + /** + * Number of posts. + */ + public $posts; + + /** + * Allow anonimous. + */ + public $allow_anonymous; + + /** + * Allow edit. + */ + public $allow_edit; + + /** + * Approval direct post. + */ + public $approval_direct_post; + + /** + * Allow attachments. + */ + public $allow_attachements; + + /** + * Allow new threads. + */ + public $allow_new_topics; + + /** + * Default view. + */ + public $default_view; + + /** + * Group forum. + */ + public $of_group; + + /** + * Public/private group forum. + */ + public $group_public_private; + + /** + * Order. + */ + public $order; + + /** + * Locked or not. + */ + public $locked; + + /** + * Session id. + */ + public $session_id; + + /** + * Image. + */ + public $image; + + /** + * Create a new Forum. + */ + public function __construct($obj) + { + parent::__construct($obj->forum_id, RESOURCE_FORUM); + $this->obj = $obj; + } + + /** + * Show this resource. + */ + public function show() + { + parent::show(); + echo $this->obj->forum_title; + } +} diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/ForumCategory.php b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/ForumCategory.php new file mode 100644 index 000000000..1ad1cfb4d --- /dev/null +++ b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/ForumCategory.php @@ -0,0 +1,32 @@ + + * + * @package chamilo.backup + */ +class ForumCategory extends Resource +{ + /** + * Create a new ForumCategory. + */ + public function __construct($obj) + { + parent::__construct($obj->cat_id, RESOURCE_FORUMCATEGORY); + $this->obj = $obj; + } + + /** + * Show this resource. + */ + public function show() + { + parent::show(); + echo $this->obj->cat_title; + } +} diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/ForumPost.php b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/ForumPost.php new file mode 100644 index 000000000..78abc5faa --- /dev/null +++ b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/ForumPost.php @@ -0,0 +1,32 @@ + + * + * @package chamilo.backup + */ +class ForumPost extends Resource +{ + /** + * Create a new ForumPost. + */ + public function __construct($obj) + { + parent::__construct($obj->post_id, RESOURCE_FORUMPOST); + $this->obj = $obj; + } + + /** + * Show this resource. + */ + public function show() + { + parent::show(); + echo $this->obj->title.' ('.$this->obj->poster_name.', '.$this->obj->post_date.')'; + } +} diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/ForumTopic.php b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/ForumTopic.php new file mode 100644 index 000000000..b67c679f9 --- /dev/null +++ b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/ForumTopic.php @@ -0,0 +1,54 @@ + + * + * @package chamilo.backup + */ +class ForumTopic extends Resource +{ + /** + * Create a new ForumTopic. + */ + /* function ForumTopic($id, $title, $time, $topic_poster_id, $topic_poster_name, $forum_id, $last_post, $replies, $views = 0, $sticky = 0, $locked = 0, + $time_closed = null, $weight = 0, $title_qualify = null, $qualify_max = 0) */ + public function __construct($obj) + { + parent::__construct($obj->thread_id, RESOURCE_FORUMTOPIC); + $this->obj = $obj; + /* + $this->title = $title; + $this->time = $time; + $this->topic_poster_id = $topic_poster_id; + $this->topic_poster_name = $topic_poster_name; + $this->forum_id = $forum_id; + $this->last_post = $last_post; + $this->replies = $replies; + $this->views = $views; + $this->sticky = $sticky; + $this->locked = $locked; + $this->time_closed = $time_closed; + $this->weight = $weight; + $this->title_qualify = $title_qualify; + $this->qualify_max = $qualify_max; */ + } + + /** + * Show this resource. + */ + public function show() + { + parent::show(); + $extra = api_convert_and_format_date($this->obj->thread_date); + if ($this->obj->thread_poster_id) { + $user_info = api_get_user_info($this->obj->thread_poster_id); + $extra = $user_info['complete_name'].', '.$extra; + } + echo $this->obj->thread_title.' ('.$extra.')'; + } +} diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Glossary.php b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Glossary.php new file mode 100644 index 000000000..13bf3e624 --- /dev/null +++ b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Glossary.php @@ -0,0 +1,45 @@ +glossary_id = $id; + $this->name = $name; + $this->description = $description; + $this->display_order = $display_order; + } + + /** + * Show this glossary. + */ + public function show() + { + parent::show(); + echo $this->name; + } +} diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/GradeBookBackup.php b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/GradeBookBackup.php new file mode 100644 index 000000000..ef14192e5 --- /dev/null +++ b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/GradeBookBackup.php @@ -0,0 +1,32 @@ +categories = $categories; + } + + /** + * @return string + */ + public function show() + { + parent::show(); + echo get_lang('All'); + } +} diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/H5pTool.php b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/H5pTool.php new file mode 100644 index 000000000..52719979a --- /dev/null +++ b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/H5pTool.php @@ -0,0 +1,31 @@ +params = $params; + } + + public function show() + { + parent::show(); + echo $this->params['name']; + } +} diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/LearnPathCategory.php b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/LearnPathCategory.php new file mode 100644 index 000000000..36088b073 --- /dev/null +++ b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/LearnPathCategory.php @@ -0,0 +1,38 @@ +object = $object; + } + + /** + * Show this resource. + */ + public function show() + { + parent::show(); + echo $this->object->getName(); + } +} diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Link.php b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Link.php new file mode 100644 index 000000000..33d4b1c1e --- /dev/null +++ b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Link.php @@ -0,0 +1,73 @@ + + * + * @package chamilo.backup + */ +class Link extends Resource +{ + /** + * The title. + */ + public $title; + /** + * The URL. + */ + public $url; + /** + * The description. + */ + public $description; + /** + * Id of this links category. + */ + public $category_id; + /** + * Display link on course homepage. + */ + public $on_homepage; + /** + * @var string The link target + */ + public $target; + + /** + * Create a new Link. + * + * @param int $id The id of this link in the Chamilo-course + * @param string $title + * @param string $url + * @param string $description + */ + public function __construct( + $id, + $title, + $url, + $description, + $category_id, + $on_homepage + ) { + parent::__construct($id, RESOURCE_LINK); + $this->title = $title; + $this->url = $url; + $this->description = $description; + $this->category_id = $category_id; + $this->on_homepage = $on_homepage; + } + + /** + * Show this resource. + */ + public function show() + { + parent::show(); + echo $this->title.' ('.$this->url.')'; + } +} diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/LinkCategory.php b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/LinkCategory.php new file mode 100644 index 000000000..b68359f4c --- /dev/null +++ b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/LinkCategory.php @@ -0,0 +1,51 @@ + + * + * @package chamilo.backup + */ +class LinkCategory extends Resource +{ + /** + * The title. + */ + public $title; + /** + * The description. + */ + public $description; + /** + * The display order. + */ + public $display_order; + + /** + * Create a new LinkCategory. + * + * @param int $id + * @param string $title + * @param string $description + */ + public function __construct($id, $title, $description, $display_order) + { + parent::__construct($id, RESOURCE_LINKCATEGORY); + $this->title = $title; + $this->description = $description; + $this->display_order = $display_order; + } + + /** + * Show this LinkCategory. + */ + public function show() + { + parent::show(); + echo $this->title.' '.$this->description.'
'; + } +} diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Quiz.php b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Quiz.php new file mode 100644 index 000000000..3a4140e58 --- /dev/null +++ b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Quiz.php @@ -0,0 +1,59 @@ + + * + * @package chamilo.backup + */ +class Quiz extends Resource +{ + /** + * Create a new Quiz. + * + * @param string $title + * @param string $description + * @param int $random + * @param int $type + * @param int $active + */ + public $obj; //question + + /** + * Quiz constructor. + * + * @param int $obj + */ + public function __construct($obj) + { + $this->obj = $obj; + $this->obj->quiz_type = $this->obj->type; + parent::__construct($obj->iid, RESOURCE_QUIZ); + } + + /** + * Add a question to this Quiz. + * + * @param int $id + * @param int $questionOrder + */ + public function add_question($id, $questionOrder) + { + $this->obj->question_ids[] = $id; + $this->obj->question_orders[] = $questionOrder; + } + + /** + * Show this question. + */ + public function show() + { + parent::show(); + echo $this->obj->title; + } +} diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/QuizQuestion.php b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/QuizQuestion.php new file mode 100644 index 000000000..8104dbfd8 --- /dev/null +++ b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/QuizQuestion.php @@ -0,0 +1,181 @@ + + * + * @package chamilo.backup + */ +class QuizQuestion extends Resource +{ + /** + * The question. + */ + public $question; + + /** + * The description. + */ + public $description; + + /** + * Ponderation. + */ + public $ponderation; + + /** + * Type. + */ + public $quiz_type; + + /** + * Position. + */ + public $position; + + /** + * Level. + */ + public $level; + + /** + * Answers. + */ + public $answers; + + /** + * Picture. + */ + public $picture; + public $extra; + + /** + * @var int the question category if any, 0 by default + */ + public $question_category; + + /** + * QuizQuestion constructor. + * + * @param int $id + * @param string $question + * @param string $description + * @param int $ponderation + * @param $type + * @param $position + * @param string $picture + * @param $level + * @param $extra + * @param int $question_category + */ + public function __construct( + $id, + $question, + $description, + $ponderation, + $type, + $position, + $picture, + $level, + $extra, + $question_category = 0 + ) { + parent::__construct($id, RESOURCE_QUIZQUESTION); + $this->question = $question; + $this->description = $description; + $this->ponderation = $ponderation; + $this->quiz_type = $type; + $this->position = $position; + $this->level = $level; + $this->answers = []; + $this->extra = $extra; + $this->question_category = $question_category; + $this->picture = $picture; + } + + public function addPicture(CourseBuilder $courseBuilder) + { + if (!empty($this->picture)) { + $courseInfo = $courseBuilder->course->info; + $courseId = $courseInfo['real_id']; + $courseCode = $courseInfo['code']; + $questionId = $this->source_id; + $question = \Question::read($questionId, $courseInfo); + $pictureId = $question->getPictureId(); + // Add the picture document in the builder + if (!empty($pictureId)) { + $itemsToAdd[] = $pictureId; + // Add the "images" folder needed for correct restore + $documentData = \DocumentManager::get_document_data_by_id($pictureId, $courseCode, true); + if ($documentData) { + if (isset($documentData['parents'])) { + foreach ($documentData['parents'] as $parent) { + $itemsToAdd[] = $parent['id']; + } + } + } + + // Add the picture + $courseBuilder->build_documents(api_get_session_id(), $courseId, false, $itemsToAdd); + } + } + } + + /** + * Add an answer to this QuizQuestion. + * + * @param int $answer_id + * @param string $answer_text + * @param string $correct + * @param string $comment + * @param string $ponderation + * @param string $position + * @param string $hotspot_coordinates + * @param string $hotspot_type + */ + public function add_answer( + $answer_id, + $answer_text, + $correct, + $comment, + $ponderation, + $position, + $hotspot_coordinates, + $hotspot_type + ) { + $answer = []; + $answer['id'] = $answer_id; + $answer['answer'] = $answer_text; + $answer['correct'] = $correct; + $answer['comment'] = $comment; + $answer['ponderation'] = $ponderation; + $answer['position'] = $position; + $answer['hotspot_coordinates'] = $hotspot_coordinates; + $answer['hotspot_type'] = $hotspot_type; + $this->answers[] = $answer; + } + + /** + * @param QuizQuestionOption $option + */ + public function add_option($option) + { + $this->question_options[$option->obj->id] = $option; + } + + /** + * Show this question. + */ + public function show() + { + parent::show(); + echo $this->question; + } +} diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/QuizQuestionOption.php b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/QuizQuestionOption.php new file mode 100644 index 000000000..dacb32a65 --- /dev/null +++ b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/QuizQuestionOption.php @@ -0,0 +1,27 @@ + + * + * @package chamilo.backup + */ +class QuizQuestionOption extends Resource +{ + public $obj; //question_option + + /** + * QuizQuestionOption constructor. + * + * @param mixed $obj + */ + public function __construct($obj) + { + parent::__construct($obj->iid, RESOURCE_QUIZQUESTION); + $this->obj = $obj; + } +} diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Resource.php b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Resource.php new file mode 100644 index 000000000..4addd7c03 --- /dev/null +++ b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Resource.php @@ -0,0 +1,269 @@ +s + * + * @todo Use the globally defined constants voor tools and remove the RESOURCE_* + * constants + */ +class Resource +{ + /** + * The id from this resource in the source course. + */ + public $source_id; + + /** + * The id from this resource in the destination course. + */ + public $destination_id; + + /** + * The type of this resource. + */ + public $type; + + /** + * Linked resources. + */ + public $linked_resources; + + /** + * The properties of this resource. + */ + public $item_properties; + public $obj; + public $extraFields; + + /** + * Create a new Resource. + * + * @param int $id the id of this resource in the source course + * @param int $type the type of this resource + */ + public function __construct($id, $type) + { + $this->source_id = $id; + $this->type = $type; + $this->destination_id = -1; + $this->linked_resources = []; + $this->item_properties = []; + $this->extraFields = []; + } + + /** + * Add linked resource. + */ + public function add_linked_resource($type, $id) + { + $this->linked_resources[$type][] = $id; + } + + /** + * Get linked resources. + */ + public function get_linked_resources() + { + return $this->linked_resources; + } + + /** + * Checks if this resource links to a given resource. + */ + public function links_to(&$resource) + { + self::setClassType($resource); + $type = $resource->get_type(); + if (isset($this->linked_resources[$type]) && + is_array($this->linked_resources[$type]) + ) { + return in_array( + $resource->get_id(), + $this->linked_resources[$type] + ); + } + + return false; + } + + /** + * Returns the id of this resource. + * + * @return int the id of this resource in the source course + */ + public function get_id() + { + return $this->source_id; + } + + /** + * Resturns the type of this resource. + * + * @return int the type + */ + public function get_type() + { + return $this->type; + } + + /** + * Get the constant which defines the tool of this resource. This is + * used in the item_properties table. + * + * @param bool $for_item_property_table (optional) Added by Ivan, + * 29-AUG-2009: A parameter for resolving differencies between defined TOOL_* + * constants and hardcoded strings that are stored in the database. + * Example: The constant TOOL_THREAD is defined in the main_api.lib.php + * with the value 'thread', but the "Forums" tool records in the field 'tool' + * in the item property table the hardcoded value 'forum_thread'. + * + * @todo once the RESOURCE_* constants are replaced by the globally + * defined TOOL_* constants, this function will be replaced by get_type() + */ + public function get_tool($for_item_property_table = true) + { + switch ($this->get_type()) { + case RESOURCE_DOCUMENT: + return TOOL_DOCUMENT; + case RESOURCE_LINK: + return TOOL_LINK; + case RESOURCE_EVENT: + return TOOL_CALENDAR_EVENT; + case RESOURCE_COURSEDESCRIPTION: + return TOOL_COURSE_DESCRIPTION; + case RESOURCE_LEARNPATH: + return TOOL_LEARNPATH; + case RESOURCE_ANNOUNCEMENT: + return TOOL_ANNOUNCEMENT; + case RESOURCE_FORUMCATEGORY: + // Ivan, 29-AUG-2009: A constant like TOOL_FORUM_CATEGORY is missing in main_api.lib.php. + // Such a constant has been defined in the forum tool for local needs. + return 'forum_category'; + case RESOURCE_FORUM: + return TOOL_FORUM; + case RESOURCE_FORUMTOPIC: + if ($for_item_property_table) { + // Ivan, 29-AUG-2009: A hardcoded value that the "Forums" tool stores in the item property table. + return 'forum_thread'; + } + + return TOOL_THREAD; + case RESOURCE_FORUMPOST: + return TOOL_POST; + case RESOURCE_QUIZ: + return TOOL_QUIZ; + case RESOURCE_TEST_CATEGORY: + return TOOL_TEST_CATEGORY; + //case RESOURCE_QUIZQUESTION: //no corresponding global constant + // return TOOL_QUIZ_QUESTION; + //case RESOURCE_TOOL_INTRO: + // return TOOL_INTRO; + //case RESOURCE_LINKCATEGORY: + // return TOOL_LINK_CATEGORY; + //case RESOURCE_SCORM: + // return TOOL_SCORM_DOCUMENT; + case RESOURCE_SURVEY: + return TOOL_SURVEY; + //case RESOURCE_SURVEYQUESTION: + // return TOOL_SURVEY_QUESTION; + //case RESOURCE_SURVEYINVITATION: + // return TOOL_SURVEY_INVITATION; + case RESOURCE_GLOSSARY: + return TOOL_GLOSSARY; + case RESOURCE_WIKI: + return TOOL_WIKI; + case RESOURCE_THEMATIC: + return TOOL_COURSE_PROGRESS; + case RESOURCE_ATTENDANCE: + return TOOL_ATTENDANCE; + case RESOURCE_WORK: + return TOOL_STUDENTPUBLICATION; + default: + return null; + } + } + + /** + * Set the destination id. + * + * @param int $id the id of this resource in the destination course + */ + public function set_new_id($id) + { + $this->destination_id = $id; + } + + /** + * Check if this resource is already restored in the destination course. + * + * @return bool true if already restored (i.e. destination_id is set). + */ + public function is_restored() + { + return $this->destination_id > -1; + } + + /** + * Show this resource. + */ + public function show() + { + //echo 'RESOURCE: '.$this->get_id().' '.$type[$this->get_type()].' '; + } + + /** + * Fix objects coming from 1.9.x to 1.10.x + * Example class Event to CalendarEvent. + * + * @param resource $resource + */ + public static function setClassType(&$resource) + { + $class = get_class($resource); + switch ($class) { + case 'Event': + /** @var $resource CalendarEvent */ + $newResource = new CalendarEvent( + $resource->source_id, + $resource->title, + $resource->content, + $resource->start_date, + $resource->end_date, + $resource->attachment_path, + $resource->attachment_filename, + $resource->attachment_size, + $resource->attachment_comment, + $resource->all_day + ); + $resource = $newResource; + break; + case 'CourseDescription': + if (!method_exists($resource, 'show')) { + $resource = (array) $resource; + $newResource = new CourseDescription( + isset($resource['id']) ? $resource['id'] : '', + $resource['title'], + $resource['content'], + $resource['description_type'] + ); + $newResource->source_id = $resource['source_id']; + $newResource->destination_id = $resource['source_id']; + $newResource->linked_resources = $resource['source_id']; + $newResource->item_properties = $resource['source_id']; + $newResource->obj = $resource['obj']; + $resource = $newResource; + } + + break; + } + } +} diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/ScormDocument.php b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/ScormDocument.php new file mode 100644 index 000000000..b0ce6c838 --- /dev/null +++ b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/ScormDocument.php @@ -0,0 +1,46 @@ + + * + * @package chamilo.backup + */ +class ScormDocument extends Resource +{ + public $path; + public $title; + + /** + * Create a new Scorm Document. + * + * @param int $id + * @param string $path + * @param string $title + */ + public function __construct($id, $path, $title) + { + parent::__construct($id, RESOURCE_SCORM); + $this->path = 'scorm'.$path; + $this->title = $title; + } + + /** + * Show this document. + */ + public function show() + { + parent::show(); + $path = preg_replace('@^scorm/@', '', $this->path); + echo $path; + if (!empty($this->title)) { + if (strpos($path, $this->title) === false) { + echo " - ".$this->title; + } + } + } +} diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Survey.php b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Survey.php new file mode 100644 index 000000000..12702c1e0 --- /dev/null +++ b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Survey.php @@ -0,0 +1,166 @@ + + * + * @package chamilo.backup + */ +class Survey extends Resource +{ + /** + * The survey code. + */ + public $code; + /** + * The title and subtitle. + */ + public $title; + public $subtitle; + /** + * The author's name. + */ + public $author; + /** + * The survey's language. + */ + public $lang; + /** + * The availability period. + */ + public $avail_from; + public $avail_till; + /** + * Flag for shared status. + */ + public $is_shared; + /** + * Template used. + */ + public $template; + /** + * Introduction text. + */ + public $intro; + /** + * Thanks text. + */ + public $surveythanks; + /** + * Creation date. + */ + public $creation_date; + /** + * Invitation status. + */ + public $invited; + /** + * Answer status. + */ + public $answered; + /** + * Invitation and reminder mail contents. + */ + public $invite_mail; + public $reminder_mail; + /** + * Questions and invitations lists. + */ + public $question_ids; + public $invitation_ids; + + /** + * Create a new Survey. + * + * @param string $code + * @param string $title + * @param string $subtitle + * @param string $author + * @param string $lang + * @param string $avail_from + * @param string $avail_till + * @param string $is_shared + * @param string $template + * @param string $intro + * @param string $surveythanks + * @param string $creation_date + * @param int $invited + * @param int $answered + * @param string $invite_mail + * @param string $reminder_mail + * @param int $oneQuestionPerPage + * @param int $shuffle + */ + public function __construct( + $id, + $code, + $title, + $subtitle, + $author, + $lang, + $avail_from, + $avail_till, + $is_shared, + $template, + $intro, + $surveythanks, + $creation_date, + $invited, + $answered, + $invite_mail, + $reminder_mail, + $oneQuestionPerPage, + $shuffle + ) { + parent::__construct($id, RESOURCE_SURVEY); + $this->code = $code; + $this->title = $title; + $this->subtitle = $subtitle; + $this->author = $author; + $this->lang = $lang; + $this->avail_from = $avail_from; + $this->avail_till = $avail_till; + $this->is_shared = $is_shared; + $this->template = $template; + $this->intro = $intro; + $this->surveythanks = $surveythanks; + $this->creation_date = $creation_date; + $this->invited = $invited; + $this->answered = $answered; + $this->invite_mail = $invite_mail; + $this->reminder_mail = $reminder_mail; + $this->question_ids = []; + $this->invitation_ids = []; + $this->one_question_per_page = $oneQuestionPerPage; + $this->shuffle = $shuffle; + } + + /** + * Add a question to this survey. + */ + public function add_question($id) + { + $this->question_ids[] = $id; + } + + /** + * Add an invitation to this survey. + */ + public function add_invitation($id) + { + $this->invitation_ids[] = $id; + } + + /** + * Show this survey. + */ + public function show() + { + parent::show(); + echo $this->code.' - '.$this->title; + } +} diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/SurveyInvitation.php b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/SurveyInvitation.php new file mode 100644 index 000000000..812cd345b --- /dev/null +++ b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/SurveyInvitation.php @@ -0,0 +1,64 @@ + + * + * @package chamilo.backup + */ +class SurveyInvitation extends Resource +{ + /** + * Survey code. + */ + public $code; + /** + * User info. + */ + public $user; + /** + * Invitation code. + */ + public $invitation_code; + /** + * Invitation date. + */ + public $invitation_date; + /** + * Reminder date. + */ + public $reminder_date; + + /** + * Create a new SurveyInvitation. + * + * @param int $id + * @param string $code + * @param string $user + * @param string $invitation_code + * @param string $invitation_date + * @param string $reminder_date + */ + public function __construct($id, $code, $user, $invitation_code, $invitation_date, $reminder_date) + { + parent::__construct($id, RESOURCE_SURVEYINVITATION); + $this->code = $code; + $this->user = $user; + $this->invitation_code = $invitation_code; + $this->invitation_date = $invitation_date; + $this->reminder_date = $reminder_date; + } + + /** + * Show this invitation. + */ + public function show() + { + parent::show(); + echo $this->invitation_code; + } +} diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/SurveyQuestion.php b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/SurveyQuestion.php new file mode 100644 index 000000000..f689e37e9 --- /dev/null +++ b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/SurveyQuestion.php @@ -0,0 +1,121 @@ + + * + * @package chamilo.backup + */ +class SurveyQuestion extends Resource +{ + /** + * Survey ID. + */ + public $survey_id; + /** + * Question and question comment. + */ + public $survey_question; + public $survey_question_comment; + /** + * Question type. + */ + public $survey_question_type; + /** + * Display ? + */ + public $display; + /** + * Sorting order. + */ + public $sort; + /** + * Shared question ID. + */ + public $shared_question_id; + /** + * Maximum value for the vote. + */ + public $max_value; + + /** + * Question's options. + */ + public $options; + + /** + * Is this question required (0: no, 1: yes). + */ + public $is_required; + + public $id; + + /** + * Create a new SurveyQuestion. + * + * @param int $id + * @param int $survey_id + * @param string $survey_question + * @param string $survey_question_comment + * @param string $type + * @param string $display + * @param int $sort + * @param int $shared_question_id + * @param int $max_value + * @param bool $is_required + */ + public function __construct( + $id, + $survey_id, + $survey_question, + $survey_question_comment, + $type, + $display, + $sort, + $shared_question_id, + $max_value, + $is_required = false + ) { + parent::__construct($id, RESOURCE_SURVEYQUESTION); + $this->id = $id; + $this->survey_id = $survey_id; + $this->survey_question = $survey_question; + $this->survey_question_comment = $survey_question_comment; + $this->survey_question_type = $type; + $this->display = $display; + $this->sort = $sort; + $this->shared_question_id = $shared_question_id; + $this->max_value = $max_value; + $this->answers = []; + if (api_get_configuration_value('allow_required_survey_questions')) { + $this->is_required = $is_required; + } + } + + /** + * Add an answer option to this SurveyQuestion. + * + * @param string $option_text + * @param int $sort + */ + public function add_answer($option_text, $sort) + { + $answer = []; + $answer['option_text'] = $option_text; + $answer['sort'] = $sort; + $this->answers[] = $answer; + } + + /** + * Show this question. + */ + public function show() + { + parent::show(); + echo $this->survey_question; + } +} diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Thematic.php b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Thematic.php new file mode 100644 index 000000000..6e85296eb --- /dev/null +++ b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Thematic.php @@ -0,0 +1,49 @@ +params = $params; + } + + public function show() + { + parent::show(); + echo $this->params['title']; + } + + /** + * @param array $data + */ + public function addThematicAdvance($data) + { + $this->thematic_advance_list[] = $data; + } + + /** + * @param array $data + */ + public function addThematicPlan($data) + { + $this->thematic_plan_list[] = $data; + } +} diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/ToolIntro.php b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/ToolIntro.php new file mode 100644 index 000000000..f6bd66280 --- /dev/null +++ b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/ToolIntro.php @@ -0,0 +1,93 @@ + + * + * @package chamilo.backup + */ +class ToolIntro extends Resource +{ + public $id; + + /** + * intro text. + */ + public $intro_text; + + /** + * Create a new text introduction. + * + * @param int $id The id of this tool introduction in the Chamilo-course + * @param string $intro_text + */ + public function __construct($id, $intro_text) + { + parent::__construct($id, RESOURCE_TOOL_INTRO); + $this->id = $id; + $this->intro_text = $intro_text; + } + + /** + * Show this resource. + */ + public function show() + { + parent::show(); + switch ($this->id) { + case TOOL_DOCUMENT: + $lang_id = 'Documents'; + break; + case TOOL_CALENDAR_EVENT: + $lang_id = 'Agenda'; + break; + case TOOL_LINK: + $lang_id = 'Links'; + break; + case TOOL_LEARNPATH: + $lang_id = 'LearningPath'; + break; + case TOOL_ANNOUNCEMENT: + $lang_id = 'Announcements'; + break; + case TOOL_FORUM: + $lang_id = 'Forums'; + break; + case TOOL_DROPBOX: + $lang_id = 'Dropbox'; + break; + case TOOL_QUIZ: + $lang_id = 'Exercises'; + break; + case TOOL_USER: + $lang_id = 'Users'; + break; + case TOOL_GROUP: + $lang_id = 'Group'; + break; + case TOOL_WIKI: + $lang_id = 'Wiki'; + break; + case TOOL_STUDENTPUBLICATION: + $lang_id = 'StudentPublications'; + break; + case TOOL_COURSE_HOMEPAGE: + $lang_id = 'CourseHomepageLink'; + break; + case TOOL_GLOSSARY: + $lang_id = 'Glossary'; + break; + case TOOL_NOTEBOOK: + $lang_id = 'Notebook'; + break; + default: + $lang_id = ucfirst($this->id); // This is a wild guess. + } + echo ''.get_lang($lang_id, '').':
'; + echo $this->intro_text; + } +} diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Wiki.php b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Wiki.php new file mode 100644 index 000000000..e8cf27dc2 --- /dev/null +++ b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Wiki.php @@ -0,0 +1,71 @@ +, Ghent University + */ +class Wiki extends Resource +{ + public $id; + public $page_id; + public $reflink; + public $title; + public $content; + public $user_id; + public $group_id; + public $timestamp; + public $progress; + public $version; + + /** + * Wiki constructor. + * + * @param int $id + * @param int $page_id + * @param $reflink + * @param $title + * @param $content + * @param $user_id + * @param $group_id + * @param $timestamp + * @param $progress + * @param $version + */ + public function __construct( + $id, + $page_id, + $reflink, + $title, + $content, + $user_id, + $group_id, + $timestamp, + $progress, + $version + ) { + parent::__construct($id, RESOURCE_WIKI); + $this->id = $id; + $this->page_id = $page_id; + $this->reflink = $reflink; + $this->title = $title; + $this->content = $content; + $this->user_id = $user_id; + $this->group_id = $group_id; + $this->dtime = $timestamp; + $this->progress = $progress; + $this->version = $version; + } + + public function show() + { + parent::show(); + echo $this->reflink.' ('.(empty($this->group_id) ? get_lang('Everyone') : get_lang('Group').' '.$this->group_id).') '.'('.$this->dtime.')'; + } +} diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Work.php b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Work.php new file mode 100644 index 000000000..6445d3fa7 --- /dev/null +++ b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Work.php @@ -0,0 +1,33 @@ + + * + * @package chamilo.backup + */ +class Work extends Resource +{ + public $params = []; + + /** + * Create a new Work. + * + * @param array $params + */ + public function __construct($params) + { + parent::__construct($params['id'], RESOURCE_WORK); + $this->params = $params; + } + + public function show() + { + parent::show(); + echo $this->params['title']; + } +} diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/XapiTool.php b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/XapiTool.php new file mode 100644 index 000000000..d66eaddb6 --- /dev/null +++ b/src/Chamilo/CourseBundle/Component/CourseCopy/Resources/XapiTool.php @@ -0,0 +1,31 @@ +params = $params; + } + + public function show() + { + parent::show(); + echo $this->params['title']; + } +} diff --git a/src/Chamilo/CourseBundle/DependencyInjection/ChamiloCourseExtension.php b/src/Chamilo/CourseBundle/DependencyInjection/ChamiloCourseExtension.php new file mode 100644 index 000000000..201c45d02 --- /dev/null +++ b/src/Chamilo/CourseBundle/DependencyInjection/ChamiloCourseExtension.php @@ -0,0 +1,49 @@ +load('services.yml'); + $loader->load('admin.yml'); + + //self::CONFIGURE_VALIDATORS + + /*$this->configure( + $config, + new Configuration(), + $container, + self::CONFIGURE_LOADER | self::CONFIGURE_DATABASE | self::CONFIGURE_PARAMETERS | self::CONFIGURE_FORMS + );*/ + } +} diff --git a/src/Chamilo/CourseBundle/DependencyInjection/Compiler/RegisterSchemasPass.php b/src/Chamilo/CourseBundle/DependencyInjection/Compiler/RegisterSchemasPass.php new file mode 100644 index 000000000..6d45ccf90 --- /dev/null +++ b/src/Chamilo/CourseBundle/DependencyInjection/Compiler/RegisterSchemasPass.php @@ -0,0 +1,37 @@ +hasDefinition('chamilo_course.settings.schema_registry')) { + return; + } + + $schemaRegistry = $container->getDefinition('chamilo_course.settings.schema_registry'); + + foreach ($container->findTaggedServiceIds('chamilo_course.settings_schema') as $id => $attributes) { + if (!array_key_exists('namespace', $attributes[0])) { + throw new \InvalidArgumentException(sprintf('Service "%s" must define the "namespace" attribute on "chamilo_course.settings_schema" tags.', $id)); + } + + $namespace = $attributes[0]['namespace']; + + $schemaRegistry->addMethodCall('registerSchema', [$namespace, new Reference($id)]); + } + } +} diff --git a/src/Chamilo/CourseBundle/DependencyInjection/Compiler/ToolCompilerClass.php b/src/Chamilo/CourseBundle/DependencyInjection/Compiler/ToolCompilerClass.php new file mode 100644 index 000000000..8cc7d6f00 --- /dev/null +++ b/src/Chamilo/CourseBundle/DependencyInjection/Compiler/ToolCompilerClass.php @@ -0,0 +1,37 @@ +hasDefinition('chamilo_course.tool_chain')) { + return; + } + + $definition = $container->getDefinition( + 'chamilo_course.tool_chain' + ); + + $taggedServices = $container->findTaggedServiceIds( + 'chamilo_course.tool' + ); + + foreach ($taggedServices as $id => $attributes) { + $definition->addMethodCall('addTool', [new Reference($id)]); + } + } +} diff --git a/src/Chamilo/CourseBundle/DependencyInjection/Configuration.php b/src/Chamilo/CourseBundle/DependencyInjection/Configuration.php new file mode 100644 index 000000000..806600ca8 --- /dev/null +++ b/src/Chamilo/CourseBundle/DependencyInjection/Configuration.php @@ -0,0 +1,64 @@ +root('chamilo_course'); + + $rootNode + ->addDefaultsIfNotSet() + ->children() + ->scalarNode('driver')->defaultValue('doctrine/orm')->cannotBeEmpty()->end() + ->end() + ; + + $this->addClassesSection($rootNode); + + return $treeBuilder; + } + + /** + * Adds `classes` section. + */ + private function addClassesSection(ArrayNodeDefinition $node) + { + $node + ->children() + ->arrayNode('classes') + ->addDefaultsIfNotSet() + ->children() + ->arrayNode('parameter') + ->addDefaultsIfNotSet() + ->children() + ->scalarNode('model')->defaultValue('Sylius\Bundle\SettingsBundle\Model\Parameter')->cannotBeEmpty()->end() + ->scalarNode('controller')->defaultValue('Sylius\Bundle\ResourceBundle\Controller\ResourceController')->end() + ->scalarNode('repository')->cannotBeEmpty()->end() + ->scalarNode('form')->defaultValue( + 'MyApp\MyCustomBundle\Form\Type\MyformType' + )->end() + ->end() + ->end() + ->end() + ->end() + ->end() + ; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CAnnouncement.php b/src/Chamilo/CourseBundle/Entity/CAnnouncement.php new file mode 100644 index 000000000..89d628c9d --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CAnnouncement.php @@ -0,0 +1,288 @@ +title = $title; + + return $this; + } + + /** + * Get title. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set content. + * + * @param string $content + * + * @return CAnnouncement + */ + public function setContent($content) + { + $this->content = $content; + + return $this; + } + + /** + * Get content. + * + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * Set endDate. + * + * @param \DateTime $endDate + * + * @return CAnnouncement + */ + public function setEndDate($endDate) + { + $this->endDate = $endDate; + + return $this; + } + + /** + * Get endDate. + * + * @return \DateTime + */ + public function getEndDate() + { + return $this->endDate; + } + + /** + * Set displayOrder. + * + * @param int $displayOrder + * + * @return CAnnouncement + */ + public function setDisplayOrder($displayOrder) + { + $this->displayOrder = $displayOrder; + + return $this; + } + + /** + * Get displayOrder. + * + * @return int + */ + public function getDisplayOrder() + { + return $this->displayOrder; + } + + /** + * Set emailSent. + * + * @param bool $emailSent + * + * @return CAnnouncement + */ + public function setEmailSent($emailSent) + { + $this->emailSent = $emailSent; + + return $this; + } + + /** + * Get emailSent. + * + * @return bool + */ + public function getEmailSent() + { + return $this->emailSent; + } + + /** + * Set sessionId. + * + * @param int $sessionId + * + * @return CAnnouncement + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * Get sessionId. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * Set id. + * + * @param int $id + * + * @return CAnnouncement + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CAnnouncement + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Get iid. + * + * @return int + */ + public function getIid() + { + return $this->iid; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CAnnouncementAttachment.php b/src/Chamilo/CourseBundle/Entity/CAnnouncementAttachment.php new file mode 100644 index 000000000..d6f1670be --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CAnnouncementAttachment.php @@ -0,0 +1,246 @@ +path = $path; + + return $this; + } + + /** + * Get path. + * + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** + * Set comment. + * + * @param string $comment + * + * @return CAnnouncementAttachment + */ + public function setComment($comment) + { + $this->comment = $comment; + + return $this; + } + + /** + * Get comment. + * + * @return string + */ + public function getComment() + { + return $this->comment; + } + + /** + * Set size. + * + * @param int $size + * + * @return CAnnouncementAttachment + */ + public function setSize($size) + { + $this->size = $size; + + return $this; + } + + /** + * Get size. + * + * @return int + */ + public function getSize() + { + return $this->size; + } + + /** + * Set announcementId. + * + * @param int $announcementId + * + * @return CAnnouncementAttachment + */ + public function setAnnouncementId($announcementId) + { + $this->announcementId = $announcementId; + + return $this; + } + + /** + * Get announcementId. + * + * @return int + */ + public function getAnnouncementId() + { + return $this->announcementId; + } + + /** + * Set filename. + * + * @param string $filename + * + * @return CAnnouncementAttachment + */ + public function setFilename($filename) + { + $this->filename = $filename; + + return $this; + } + + /** + * Get filename. + * + * @return string + */ + public function getFilename() + { + return $this->filename; + } + + /** + * Set id. + * + * @param int $id + * + * @return CAnnouncementAttachment + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CAnnouncementAttachment + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CAttendance.php b/src/Chamilo/CourseBundle/Entity/CAttendance.php new file mode 100644 index 000000000..6477e8c96 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CAttendance.php @@ -0,0 +1,341 @@ +name = $name; + + return $this; + } + + /** + * Get name. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set description. + * + * @param string $description + * + * @return CAttendance + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * Get description. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Set active. + * + * @param bool $active + * + * @return CAttendance + */ + public function setActive($active) + { + $this->active = $active; + + return $this; + } + + /** + * Get active. + * + * @return bool + */ + public function getActive() + { + return $this->active; + } + + /** + * Set attendanceQualifyTitle. + * + * @param string $attendanceQualifyTitle + * + * @return CAttendance + */ + public function setAttendanceQualifyTitle($attendanceQualifyTitle) + { + $this->attendanceQualifyTitle = $attendanceQualifyTitle; + + return $this; + } + + /** + * Get attendanceQualifyTitle. + * + * @return string + */ + public function getAttendanceQualifyTitle() + { + return $this->attendanceQualifyTitle; + } + + /** + * Set attendanceQualifyMax. + * + * @param int $attendanceQualifyMax + * + * @return CAttendance + */ + public function setAttendanceQualifyMax($attendanceQualifyMax) + { + $this->attendanceQualifyMax = $attendanceQualifyMax; + + return $this; + } + + /** + * Get attendanceQualifyMax. + * + * @return int + */ + public function getAttendanceQualifyMax() + { + return $this->attendanceQualifyMax; + } + + /** + * Set attendanceWeight. + * + * @param float $attendanceWeight + * + * @return CAttendance + */ + public function setAttendanceWeight($attendanceWeight) + { + $this->attendanceWeight = $attendanceWeight; + + return $this; + } + + /** + * Get attendanceWeight. + * + * @return float + */ + public function getAttendanceWeight() + { + return $this->attendanceWeight; + } + + /** + * Set sessionId. + * + * @param int $sessionId + * + * @return CAttendance + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * Get sessionId. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * Set locked. + * + * @param int $locked + * + * @return CAttendance + */ + public function setLocked($locked) + { + $this->locked = $locked; + + return $this; + } + + /** + * Get locked. + * + * @return int + */ + public function getLocked() + { + return $this->locked; + } + + /** + * Set id. + * + * @param int $id + * + * @return CAttendance + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CAttendance + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CAttendanceCalendar.php b/src/Chamilo/CourseBundle/Entity/CAttendanceCalendar.php new file mode 100644 index 000000000..d1cbab6d2 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CAttendanceCalendar.php @@ -0,0 +1,217 @@ +attendanceId = $attendanceId; + + return $this; + } + + /** + * Get attendanceId. + * + * @return int + */ + public function getAttendanceId() + { + return $this->attendanceId; + } + + /** + * Set dateTime. + * + * @param \DateTime $dateTime + * + * @return CAttendanceCalendar + */ + public function setDateTime($dateTime) + { + $this->dateTime = $dateTime; + + return $this; + } + + /** + * Get dateTime. + * + * @return \DateTime + */ + public function getDateTime() + { + return $this->dateTime; + } + + /** + * Set doneAttendance. + * + * @param bool $doneAttendance + * + * @return CAttendanceCalendar + */ + public function setDoneAttendance($doneAttendance) + { + $this->doneAttendance = $doneAttendance; + + return $this; + } + + /** + * Get doneAttendance. + * + * @return bool + */ + public function getDoneAttendance() + { + return $this->doneAttendance; + } + + /** + * Set id. + * + * @param int $id + * + * @return CAttendanceCalendar + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CAttendanceCalendar + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Set blocked. + * + * @param bool $blocked + * + * @return CAttendanceCalendar + */ + public function setBlocked($blocked) + { + $this->blocked = $blocked; + + return $this; + } + + /** + * Get blocked. + * + * @return bool + */ + public function getBlocked() + { + return $this->blocked; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CAttendanceCalendarRelGroup.php b/src/Chamilo/CourseBundle/Entity/CAttendanceCalendarRelGroup.php new file mode 100644 index 000000000..89bb6dba9 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CAttendanceCalendarRelGroup.php @@ -0,0 +1,140 @@ +cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Set groupId. + * + * @param int $groupId + * + * @return CAttendanceCalendarRelGroup + */ + public function setGroupId($groupId) + { + $this->groupId = $groupId; + + return $this; + } + + /** + * Get groupId. + * + * @return int + */ + public function getGroupId() + { + return $this->groupId; + } + + /** + * Set calendarId. + * + * @param int $calendarId + * + * @return CAttendanceCalendarRelGroup + */ + public function setCalendarId($calendarId) + { + $this->calendarId = $calendarId; + + return $this; + } + + /** + * Get calendarId. + * + * @return int + */ + public function getCalendarId() + { + return $this->calendarId; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CAttendanceResult.php b/src/Chamilo/CourseBundle/Entity/CAttendanceResult.php new file mode 100644 index 000000000..2c2bedb77 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CAttendanceResult.php @@ -0,0 +1,186 @@ +userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set attendanceId. + * + * @param int $attendanceId + * + * @return CAttendanceResult + */ + public function setAttendanceId($attendanceId) + { + $this->attendanceId = $attendanceId; + + return $this; + } + + /** + * Get attendanceId. + * + * @return int + */ + public function getAttendanceId() + { + return $this->attendanceId; + } + + /** + * Set score. + * + * @param int $score + * + * @return CAttendanceResult + */ + public function setScore($score) + { + $this->score = $score; + + return $this; + } + + /** + * Get score. + * + * @return int + */ + public function getScore() + { + return $this->score; + } + + /** + * Set id. + * + * @param int $id + * + * @return CAttendanceResult + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CAttendanceResult + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CAttendanceResultComment.php b/src/Chamilo/CourseBundle/Entity/CAttendanceResultComment.php new file mode 100644 index 000000000..6a20ac11f --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CAttendanceResultComment.php @@ -0,0 +1,213 @@ +createdAt = new \DateTime(); + $this->updatedAt = new \DateTime(); + } + + /** + * Get attendanceSheetId. + */ + public function getAttendanceSheetId(): int + { + return $this->attendanceSheetId; + } + + /** + * Set attendanceSheetId. + * + * @return CAttendanceResultComment + */ + public function setAttendanceSheetId(int $attendanceSheetId) + { + $this->attendanceSheetId = $attendanceSheetId; + + return $this; + } + + /** + * Set userId. + * + * @param int $userId + * + * @return CAttendanceResultComment + */ + public function setUserId($userId) + { + $this->userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * @param \DateTime $createdAt + * + * @return CAttendanceResultComment + */ + public function setCreatedAt($createdAt) + { + $this->createdAt = $createdAt; + + return $this; + } + + /** + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + * @param \DateTime $updatedAt + * + * @return CAttendanceResultComment + */ + public function setUpdatedAt($updatedAt) + { + $this->updatedAt = $updatedAt; + + return $this; + } + + /** + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->updatedAt; + } + + /** + * Set comment. + * + * @param string $comment + * + * @return CAttendanceResultComment + */ + public function setComment($comment) + { + $this->comment = $comment; + + return $this; + } + + /** + * Get comment. + * + * @return string + */ + public function getComment() + { + return $this->comment; + } + + /** + * Set authorUserId. + * + * @param int $authorUserId + * + * @return CAttendanceResultComment + */ + public function setAuthorUserId($authorUserId) + { + $this->authorUserId = $authorUserId; + + return $this; + } + + /** + * Get authorUserId. + * + * @return int + */ + public function getAuthorUserId() + { + return $this->authorUserId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CAttendanceSheet.php b/src/Chamilo/CourseBundle/Entity/CAttendanceSheet.php new file mode 100644 index 000000000..79a11d537 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CAttendanceSheet.php @@ -0,0 +1,192 @@ +presence = $presence; + + return $this; + } + + /** + * Get presence. + * + * @return bool + */ + public function getPresence() + { + return $this->presence; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CAttendanceSheet + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Set userId. + * + * @param int $userId + * + * @return CAttendanceSheet + */ + public function setUserId($userId) + { + $this->userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set attendanceCalendarId. + * + * @param int $attendanceCalendarId + * + * @return CAttendanceSheet + */ + public function setAttendanceCalendarId($attendanceCalendarId) + { + $this->attendanceCalendarId = $attendanceCalendarId; + + return $this; + } + + /** + * Get attendanceCalendarId. + * + * @return int + */ + public function getAttendanceCalendarId() + { + return $this->attendanceCalendarId; + } + + /** + * @return int + */ + public function getIid() + { + return $this->iid; + } + + /** + * Set signature. + * + * @return CAttendanceSheet + */ + public function setSignature(string $signature) + { + $this->signature = $signature; + + return $this; + } + + /** + * Get signature. + * + * @return string + */ + public function getSignature() + { + return $this->signature; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CAttendanceSheetLog.php b/src/Chamilo/CourseBundle/Entity/CAttendanceSheetLog.php new file mode 100644 index 000000000..1e56f62f6 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CAttendanceSheetLog.php @@ -0,0 +1,246 @@ +attendanceId = $attendanceId; + + return $this; + } + + /** + * Get attendanceId. + * + * @return int + */ + public function getAttendanceId() + { + return $this->attendanceId; + } + + /** + * Set lasteditDate. + * + * @param \DateTime $lasteditDate + * + * @return CAttendanceSheetLog + */ + public function setLasteditDate($lasteditDate) + { + $this->lasteditDate = $lasteditDate; + + return $this; + } + + /** + * Get lasteditDate. + * + * @return \DateTime + */ + public function getLasteditDate() + { + return $this->lasteditDate; + } + + /** + * Set lasteditType. + * + * @param string $lasteditType + * + * @return CAttendanceSheetLog + */ + public function setLasteditType($lasteditType) + { + $this->lasteditType = $lasteditType; + + return $this; + } + + /** + * Get lasteditType. + * + * @return string + */ + public function getLasteditType() + { + return $this->lasteditType; + } + + /** + * Set lasteditUserId. + * + * @param int $lasteditUserId + * + * @return CAttendanceSheetLog + */ + public function setLasteditUserId($lasteditUserId) + { + $this->lasteditUserId = $lasteditUserId; + + return $this; + } + + /** + * Get lasteditUserId. + * + * @return int + */ + public function getLasteditUserId() + { + return $this->lasteditUserId; + } + + /** + * Set calendarDateValue. + * + * @param \DateTime $calendarDateValue + * + * @return CAttendanceSheetLog + */ + public function setCalendarDateValue($calendarDateValue) + { + $this->calendarDateValue = $calendarDateValue; + + return $this; + } + + /** + * Get calendarDateValue. + * + * @return \DateTime + */ + public function getCalendarDateValue() + { + return $this->calendarDateValue; + } + + /** + * Set id. + * + * @param int $id + * + * @return CAttendanceSheetLog + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CAttendanceSheetLog + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CBlog.php b/src/Chamilo/CourseBundle/Entity/CBlog.php new file mode 100644 index 000000000..fbe2433b8 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CBlog.php @@ -0,0 +1,247 @@ +blogName = $blogName; + + return $this; + } + + /** + * Get blogName. + * + * @return string + */ + public function getBlogName() + { + return $this->blogName; + } + + /** + * Set blogSubtitle. + * + * @param string $blogSubtitle + * + * @return CBlog + */ + public function setBlogSubtitle($blogSubtitle) + { + $this->blogSubtitle = $blogSubtitle; + + return $this; + } + + /** + * Get blogSubtitle. + * + * @return string + */ + public function getBlogSubtitle() + { + return $this->blogSubtitle; + } + + /** + * Set dateCreation. + * + * @param \DateTime $dateCreation + * + * @return CBlog + */ + public function setDateCreation($dateCreation) + { + $this->dateCreation = $dateCreation; + + return $this; + } + + /** + * Get dateCreation. + * + * @return \DateTime + */ + public function getDateCreation() + { + return $this->dateCreation; + } + + /** + * Set visibility. + * + * @param bool $visibility + * + * @return CBlog + */ + public function setVisibility($visibility) + { + $this->visibility = $visibility; + + return $this; + } + + /** + * Get visibility. + * + * @return bool + */ + public function getVisibility() + { + return $this->visibility; + } + + /** + * Set sessionId. + * + * @param int $sessionId + * + * @return CBlog + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * Get sessionId. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * Set blogId. + * + * @param int $blogId + * + * @return CBlog + */ + public function setBlogId($blogId) + { + $this->blogId = $blogId; + + return $this; + } + + /** + * Get blogId. + * + * @return int + */ + public function getBlogId() + { + return $this->blogId; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CBlog + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CBlogAttachment.php b/src/Chamilo/CourseBundle/Entity/CBlogAttachment.php new file mode 100644 index 000000000..dfd2e2d4a --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CBlogAttachment.php @@ -0,0 +1,308 @@ +path = $path; + + return $this; + } + + /** + * Get path. + * + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** + * Set comment. + * + * @param string $comment + * + * @return CBlogAttachment + */ + public function setComment($comment) + { + $this->comment = $comment; + + return $this; + } + + /** + * Get comment. + * + * @return string + */ + public function getComment() + { + return $this->comment; + } + + /** + * Set size. + * + * @param int $size + * + * @return CBlogAttachment + */ + public function setSize($size) + { + $this->size = $size; + + return $this; + } + + /** + * Get size. + * + * @return int + */ + public function getSize() + { + return $this->size; + } + + /** + * Set postId. + * + * @param int $postId + * + * @return CBlogAttachment + */ + public function setPostId($postId) + { + $this->postId = $postId; + + return $this; + } + + /** + * Get postId. + * + * @return int + */ + public function getPostId() + { + return $this->postId; + } + + /** + * Set filename. + * + * @param string $filename + * + * @return CBlogAttachment + */ + public function setFilename($filename) + { + $this->filename = $filename; + + return $this; + } + + /** + * Get filename. + * + * @return string + */ + public function getFilename() + { + return $this->filename; + } + + /** + * Set blogId. + * + * @param int $blogId + * + * @return CBlogAttachment + */ + public function setBlogId($blogId) + { + $this->blogId = $blogId; + + return $this; + } + + /** + * Get blogId. + * + * @return int + */ + public function getBlogId() + { + return $this->blogId; + } + + /** + * Set commentId. + * + * @param int $commentId + * + * @return CBlogAttachment + */ + public function setCommentId($commentId) + { + $this->commentId = $commentId; + + return $this; + } + + /** + * Get commentId. + * + * @return int + */ + public function getCommentId() + { + return $this->commentId; + } + + /** + * Set id. + * + * @param int $id + * + * @return CBlogAttachment + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CBlogAttachment + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CBlogComment.php b/src/Chamilo/CourseBundle/Entity/CBlogComment.php new file mode 100644 index 000000000..99e401d8b --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CBlogComment.php @@ -0,0 +1,339 @@ +title = $title; + + return $this; + } + + /** + * Get title. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set comment. + * + * @param string $comment + * + * @return CBlogComment + */ + public function setComment($comment) + { + $this->comment = $comment; + + return $this; + } + + /** + * Get comment. + * + * @return string + */ + public function getComment() + { + return $this->comment; + } + + /** + * Set authorId. + * + * @param int $authorId + * + * @return CBlogComment + */ + public function setAuthorId($authorId) + { + $this->authorId = $authorId; + + return $this; + } + + /** + * Get authorId. + * + * @return int + */ + public function getAuthorId() + { + return $this->authorId; + } + + /** + * Set dateCreation. + * + * @param \DateTime $dateCreation + * + * @return CBlogComment + */ + public function setDateCreation($dateCreation) + { + $this->dateCreation = $dateCreation; + + return $this; + } + + /** + * Get dateCreation. + * + * @return \DateTime + */ + public function getDateCreation() + { + return $this->dateCreation; + } + + /** + * Set blogId. + * + * @param int $blogId + * + * @return CBlogComment + */ + public function setBlogId($blogId) + { + $this->blogId = $blogId; + + return $this; + } + + /** + * Get blogId. + * + * @return int + */ + public function getBlogId() + { + return $this->blogId; + } + + /** + * Set postId. + * + * @param int $postId + * + * @return CBlogComment + */ + public function setPostId($postId) + { + $this->postId = $postId; + + return $this; + } + + /** + * Get postId. + * + * @return int + */ + public function getPostId() + { + return $this->postId; + } + + /** + * Set taskId. + * + * @param int $taskId + * + * @return CBlogComment + */ + public function setTaskId($taskId) + { + $this->taskId = $taskId; + + return $this; + } + + /** + * Get taskId. + * + * @return int + */ + public function getTaskId() + { + return $this->taskId; + } + + /** + * Set parentCommentId. + * + * @param int $parentCommentId + * + * @return CBlogComment + */ + public function setParentCommentId($parentCommentId) + { + $this->parentCommentId = $parentCommentId; + + return $this; + } + + /** + * Get parentCommentId. + * + * @return int + */ + public function getParentCommentId() + { + return $this->parentCommentId; + } + + /** + * Set commentId. + * + * @param int $commentId + * + * @return CBlogComment + */ + public function setCommentId($commentId) + { + $this->commentId = $commentId; + + return $this; + } + + /** + * Get commentId. + * + * @return int + */ + public function getCommentId() + { + return $this->commentId; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CBlogComment + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CBlogPost.php b/src/Chamilo/CourseBundle/Entity/CBlogPost.php new file mode 100644 index 000000000..9ac2e0ad7 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CBlogPost.php @@ -0,0 +1,245 @@ +title = $title; + + return $this; + } + + /** + * Get title. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set fullText. + * + * @param string $fullText + * + * @return CBlogPost + */ + public function setFullText($fullText) + { + $this->fullText = $fullText; + + return $this; + } + + /** + * Get fullText. + * + * @return string + */ + public function getFullText() + { + return $this->fullText; + } + + /** + * Set dateCreation. + * + * @param \DateTime $dateCreation + * + * @return CBlogPost + */ + public function setDateCreation($dateCreation) + { + $this->dateCreation = $dateCreation; + + return $this; + } + + /** + * Get dateCreation. + * + * @return \DateTime + */ + public function getDateCreation() + { + return $this->dateCreation; + } + + /** + * Set blogId. + * + * @param int $blogId + * + * @return CBlogPost + */ + public function setBlogId($blogId) + { + $this->blogId = $blogId; + + return $this; + } + + /** + * Get blogId. + * + * @return int + */ + public function getBlogId() + { + return $this->blogId; + } + + /** + * Set authorId. + * + * @param int $authorId + * + * @return CBlogPost + */ + public function setAuthorId($authorId) + { + $this->authorId = $authorId; + + return $this; + } + + /** + * Get authorId. + * + * @return int + */ + public function getAuthorId() + { + return $this->authorId; + } + + /** + * Set postId. + * + * @param int $postId + * + * @return CBlogPost + */ + public function setPostId($postId) + { + $this->postId = $postId; + + return $this; + } + + /** + * Get postId. + * + * @return int + */ + public function getPostId() + { + return $this->postId; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CBlogPost + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CBlogRating.php b/src/Chamilo/CourseBundle/Entity/CBlogRating.php new file mode 100644 index 000000000..9cecac029 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CBlogRating.php @@ -0,0 +1,246 @@ +blogId = $blogId; + + return $this; + } + + /** + * Get blogId. + * + * @return int + */ + public function getBlogId() + { + return $this->blogId; + } + + /** + * Set ratingType. + * + * @param string $ratingType + * + * @return CBlogRating + */ + public function setRatingType($ratingType) + { + $this->ratingType = $ratingType; + + return $this; + } + + /** + * Get ratingType. + * + * @return string + */ + public function getRatingType() + { + return $this->ratingType; + } + + /** + * Set itemId. + * + * @param int $itemId + * + * @return CBlogRating + */ + public function setItemId($itemId) + { + $this->itemId = $itemId; + + return $this; + } + + /** + * Get itemId. + * + * @return int + */ + public function getItemId() + { + return $this->itemId; + } + + /** + * Set userId. + * + * @param int $userId + * + * @return CBlogRating + */ + public function setUserId($userId) + { + $this->userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set rating. + * + * @param int $rating + * + * @return CBlogRating + */ + public function setRating($rating) + { + $this->rating = $rating; + + return $this; + } + + /** + * Get rating. + * + * @return int + */ + public function getRating() + { + return $this->rating; + } + + /** + * Set ratingId. + * + * @param int $ratingId + * + * @return CBlogRating + */ + public function setRatingId($ratingId) + { + $this->ratingId = $ratingId; + + return $this; + } + + /** + * Get ratingId. + * + * @return int + */ + public function getRatingId() + { + return $this->ratingId; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CBlogRating + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CBlogRelUser.php b/src/Chamilo/CourseBundle/Entity/CBlogRelUser.php new file mode 100644 index 000000000..339cde667 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CBlogRelUser.php @@ -0,0 +1,122 @@ +cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Set blogId. + * + * @param int $blogId + * + * @return CBlogRelUser + */ + public function setBlogId($blogId) + { + $this->blogId = $blogId; + + return $this; + } + + /** + * Get blogId. + * + * @return int + */ + public function getBlogId() + { + return $this->blogId; + } + + /** + * Set userId. + * + * @param int $userId + * + * @return CBlogRelUser + */ + public function setUserId($userId) + { + $this->userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CBlogTask.php b/src/Chamilo/CourseBundle/Entity/CBlogTask.php new file mode 100644 index 000000000..e034ee73b --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CBlogTask.php @@ -0,0 +1,246 @@ +blogId = $blogId; + + return $this; + } + + /** + * Get blogId. + * + * @return int + */ + public function getBlogId() + { + return $this->blogId; + } + + /** + * Set title. + * + * @param string $title + * + * @return CBlogTask + */ + public function setTitle($title) + { + $this->title = $title; + + return $this; + } + + /** + * Get title. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set description. + * + * @param string $description + * + * @return CBlogTask + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * Get description. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Set color. + * + * @param string $color + * + * @return CBlogTask + */ + public function setColor($color) + { + $this->color = $color; + + return $this; + } + + /** + * Get color. + * + * @return string + */ + public function getColor() + { + return $this->color; + } + + /** + * Set systemTask. + * + * @param bool $systemTask + * + * @return CBlogTask + */ + public function setSystemTask($systemTask) + { + $this->systemTask = $systemTask; + + return $this; + } + + /** + * Get systemTask. + * + * @return bool + */ + public function getSystemTask() + { + return $this->systemTask; + } + + /** + * Set taskId. + * + * @param int $taskId + * + * @return CBlogTask + */ + public function setTaskId($taskId) + { + $this->taskId = $taskId; + + return $this; + } + + /** + * Get taskId. + * + * @return int + */ + public function getTaskId() + { + return $this->taskId; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CBlogTask + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CBlogTaskRelUser.php b/src/Chamilo/CourseBundle/Entity/CBlogTaskRelUser.php new file mode 100644 index 000000000..8477422f5 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CBlogTaskRelUser.php @@ -0,0 +1,186 @@ +targetDate = $targetDate; + + return $this; + } + + /** + * Get targetDate. + * + * @return \DateTime + */ + public function getTargetDate() + { + return $this->targetDate; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CBlogTaskRelUser + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Set blogId. + * + * @param int $blogId + * + * @return CBlogTaskRelUser + */ + public function setBlogId($blogId) + { + $this->blogId = $blogId; + + return $this; + } + + /** + * Get blogId. + * + * @return int + */ + public function getBlogId() + { + return $this->blogId; + } + + /** + * Set userId. + * + * @param int $userId + * + * @return CBlogTaskRelUser + */ + public function setUserId($userId) + { + $this->userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set taskId. + * + * @param int $taskId + * + * @return CBlogTaskRelUser + */ + public function setTaskId($taskId) + { + $this->taskId = $taskId; + + return $this; + } + + /** + * Get taskId. + * + * @return int + */ + public function getTaskId() + { + return $this->taskId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CCalendarEvent.php b/src/Chamilo/CourseBundle/Entity/CCalendarEvent.php new file mode 100644 index 000000000..35fde5e98 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CCalendarEvent.php @@ -0,0 +1,411 @@ +title = $title; + + return $this; + } + + /** + * Get title. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set content. + * + * @param string $content + * + * @return CCalendarEvent + */ + public function setContent($content) + { + $this->content = $content; + + return $this; + } + + /** + * Get content. + * + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * Set startDate. + * + * @param \DateTime $startDate + * + * @return CCalendarEvent + */ + public function setStartDate($startDate) + { + $this->startDate = $startDate; + + return $this; + } + + /** + * Get startDate. + * + * @return \DateTime + */ + public function getStartDate() + { + return $this->startDate; + } + + /** + * Set endDate. + * + * @param \DateTime $endDate + * + * @return CCalendarEvent + */ + public function setEndDate($endDate) + { + $this->endDate = $endDate; + + return $this; + } + + /** + * Get endDate. + * + * @return \DateTime + */ + public function getEndDate() + { + return $this->endDate; + } + + /** + * Set parentEventId. + * + * @param int $parentEventId + * + * @return CCalendarEvent + */ + public function setParentEventId($parentEventId) + { + $this->parentEventId = $parentEventId; + + return $this; + } + + /** + * Get parentEventId. + * + * @return int + */ + public function getParentEventId() + { + return $this->parentEventId; + } + + /** + * Set sessionId. + * + * @param int $sessionId + * + * @return CCalendarEvent + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * Get sessionId. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * Set allDay. + * + * @param int $allDay + * + * @return CCalendarEvent + */ + public function setAllDay($allDay) + { + $this->allDay = $allDay; + + return $this; + } + + /** + * Get allDay. + * + * @return int + */ + public function getAllDay() + { + return $this->allDay; + } + + /** + * Set id. + * + * @param int $id + * + * @return CCalendarEvent + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CCalendarEvent + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * @return string + */ + public function getComment() + { + return $this->comment; + } + + /** + * @param string $comment + * + * @return CCalendarEvent + */ + public function setComment($comment) + { + $this->comment = $comment; + + return $this; + } + + /** + * @return Room + */ + public function getRoom() + { + return $this->room; + } + + /** + * @param Room $room + * + * @return $this + */ + public function setRoom($room) + { + $this->room = $room; + + return $this; + } + + /** + * @return string + */ + public function getColor() + { + return $this->color; + } + + /** + * @param string $color + * + * @return $this + */ + public function setColor($color) + { + $this->color = $color; + + return $this; + } + + /** + * @return int + */ + public function getIid() + { + return $this->iid; + } + + /** + * @param int $iid + * + * @return CCalendarEvent + */ + public function setIid($iid) + { + $this->iid = $iid; + + return $this; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CCalendarEventAttachment.php b/src/Chamilo/CourseBundle/Entity/CCalendarEventAttachment.php new file mode 100644 index 000000000..709184d5c --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CCalendarEventAttachment.php @@ -0,0 +1,246 @@ +path = $path; + + return $this; + } + + /** + * Get path. + * + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** + * Set comment. + * + * @param string $comment + * + * @return CCalendarEventAttachment + */ + public function setComment($comment) + { + $this->comment = $comment; + + return $this; + } + + /** + * Get comment. + * + * @return string + */ + public function getComment() + { + return $this->comment; + } + + /** + * Set size. + * + * @param int $size + * + * @return CCalendarEventAttachment + */ + public function setSize($size) + { + $this->size = $size; + + return $this; + } + + /** + * Get size. + * + * @return int + */ + public function getSize() + { + return $this->size; + } + + /** + * Set agendaId. + * + * @param int $agendaId + * + * @return CCalendarEventAttachment + */ + public function setAgendaId($agendaId) + { + $this->agendaId = $agendaId; + + return $this; + } + + /** + * Get agendaId. + * + * @return int + */ + public function getAgendaId() + { + return $this->agendaId; + } + + /** + * Set filename. + * + * @param string $filename + * + * @return CCalendarEventAttachment + */ + public function setFilename($filename) + { + $this->filename = $filename; + + return $this; + } + + /** + * Get filename. + * + * @return string + */ + public function getFilename() + { + return $this->filename; + } + + /** + * Set id. + * + * @param int $id + * + * @return CCalendarEventAttachment + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CCalendarEventAttachment + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CCalendarEventRepeat.php b/src/Chamilo/CourseBundle/Entity/CCalendarEventRepeat.php new file mode 100644 index 000000000..b09da02e6 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CCalendarEventRepeat.php @@ -0,0 +1,215 @@ +calType = $calType; + + return $this; + } + + /** + * Get calType. + * + * @return string + */ + public function getCalType() + { + return $this->calType; + } + + /** + * Set calEnd. + * + * @param int $calEnd + * + * @return CCalendarEventRepeat + */ + public function setCalEnd($calEnd) + { + $this->calEnd = $calEnd; + + return $this; + } + + /** + * Get calEnd. + * + * @return int + */ + public function getCalEnd() + { + return $this->calEnd; + } + + /** + * Set calFrequency. + * + * @param int $calFrequency + * + * @return CCalendarEventRepeat + */ + public function setCalFrequency($calFrequency) + { + $this->calFrequency = $calFrequency; + + return $this; + } + + /** + * Get calFrequency. + * + * @return int + */ + public function getCalFrequency() + { + return $this->calFrequency; + } + + /** + * Set calDays. + * + * @param string $calDays + * + * @return CCalendarEventRepeat + */ + public function setCalDays($calDays) + { + $this->calDays = $calDays; + + return $this; + } + + /** + * Get calDays. + * + * @return string + */ + public function getCalDays() + { + return $this->calDays; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CCalendarEventRepeat + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Set calId. + * + * @param int $calId + * + * @return CCalendarEventRepeat + */ + public function setCalId($calId) + { + $this->calId = $calId; + + return $this; + } + + /** + * Get calId. + * + * @return int + */ + public function getCalId() + { + return $this->calId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CCalendarEventRepeatNot.php b/src/Chamilo/CourseBundle/Entity/CCalendarEventRepeatNot.php new file mode 100644 index 000000000..ec942d252 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CCalendarEventRepeatNot.php @@ -0,0 +1,122 @@ +cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Set calId. + * + * @param int $calId + * + * @return CCalendarEventRepeatNot + */ + public function setCalId($calId) + { + $this->calId = $calId; + + return $this; + } + + /** + * Get calId. + * + * @return int + */ + public function getCalId() + { + return $this->calId; + } + + /** + * Set calDate. + * + * @param int $calDate + * + * @return CCalendarEventRepeatNot + */ + public function setCalDate($calDate) + { + $this->calDate = $calDate; + + return $this; + } + + /** + * Get calDate. + * + * @return int + */ + public function getCalDate() + { + return $this->calDate; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CChatConnected.php b/src/Chamilo/CourseBundle/Entity/CChatConnected.php new file mode 100644 index 000000000..6ecefa60e --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CChatConnected.php @@ -0,0 +1,217 @@ +sessionId = $sessionId; + + return $this; + } + + /** + * Get sessionId. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * Set toGroupId. + * + * @param int $toGroupId + * + * @return CChatConnected + */ + public function setToGroupId($toGroupId) + { + $this->toGroupId = $toGroupId; + + return $this; + } + + /** + * Get toGroupId. + * + * @return int + */ + public function getToGroupId() + { + return $this->toGroupId; + } + + /** + * Set id. + * + * @param int $id + * + * @return CChatConnected + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CChatConnected + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Set userId. + * + * @param int $userId + * + * @return CChatConnected + */ + public function setUserId($userId) + { + $this->userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set lastConnection. + * + * @param \DateTime $lastConnection + * + * @return CChatConnected + */ + public function setLastConnection($lastConnection) + { + $this->lastConnection = $lastConnection; + + return $this; + } + + /** + * Get lastConnection. + * + * @return \DateTime + */ + public function getLastConnection() + { + return $this->lastConnection; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CCourseDescription.php b/src/Chamilo/CourseBundle/Entity/CCourseDescription.php new file mode 100644 index 000000000..299830c8d --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CCourseDescription.php @@ -0,0 +1,270 @@ +title = $title; + + return $this; + } + + /** + * Get title. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set content. + * + * @param string $content + * + * @return CCourseDescription + */ + public function setContent($content) + { + $this->content = $content; + + return $this; + } + + /** + * Get content. + * + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * Set sessionId. + * + * @param int $sessionId + * + * @return CCourseDescription + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * Get sessionId. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * Set descriptionType. + * + * @param int $descriptionType + * + * @return CCourseDescription + */ + public function setDescriptionType($descriptionType) + { + $this->descriptionType = $descriptionType; + + return $this; + } + + /** + * Get descriptionType. + * + * @return int + */ + public function getDescriptionType() + { + return $this->descriptionType; + } + + /** + * Set progress. + * + * @param int $progress + * + * @return CCourseDescription + */ + public function setProgress($progress) + { + $this->progress = $progress; + + return $this; + } + + /** + * Get progress. + * + * @return int + */ + public function getProgress() + { + return $this->progress; + } + + /** + * Set id. + * + * @param int $id + * + * @return CCourseDescription + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CCourseDescription + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * @return int + */ + public function getIid() + { + return $this->iid; + } + + /** + * @param int $iid + * + * @return CCourseDescription + */ + public function setIid($iid) + { + $this->iid = $iid; + + return $this; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CCourseSetting.php b/src/Chamilo/CourseBundle/Entity/CCourseSetting.php new file mode 100644 index 000000000..50577716c --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CCourseSetting.php @@ -0,0 +1,339 @@ +variable = $variable; + + return $this; + } + + /** + * Get variable. + * + * @return string + */ + public function getVariable() + { + return $this->variable; + } + + /** + * Set subkey. + * + * @param string $subkey + * + * @return CCourseSetting + */ + public function setSubkey($subkey) + { + $this->subkey = $subkey; + + return $this; + } + + /** + * Get subkey. + * + * @return string + */ + public function getSubkey() + { + return $this->subkey; + } + + /** + * Set type. + * + * @param string $type + * + * @return CCourseSetting + */ + public function setType($type) + { + $this->type = $type; + + return $this; + } + + /** + * Get type. + * + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * Set category. + * + * @param string $category + * + * @return CCourseSetting + */ + public function setCategory($category) + { + $this->category = $category; + + return $this; + } + + /** + * Get category. + * + * @return string + */ + public function getCategory() + { + return $this->category; + } + + /** + * Set value. + * + * @param string $value + * + * @return CCourseSetting + */ + public function setValue($value) + { + $this->value = $value; + + return $this; + } + + /** + * Get value. + * + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * Set title. + * + * @param string $title + * + * @return CCourseSetting + */ + public function setTitle($title) + { + $this->title = $title; + + return $this; + } + + /** + * Get title. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set comment. + * + * @param string $comment + * + * @return CCourseSetting + */ + public function setComment($comment) + { + $this->comment = $comment; + + return $this; + } + + /** + * Get comment. + * + * @return string + */ + public function getComment() + { + return $this->comment; + } + + /** + * Set subkeytext. + * + * @param string $subkeytext + * + * @return CCourseSetting + */ + public function setSubkeytext($subkeytext) + { + $this->subkeytext = $subkeytext; + + return $this; + } + + /** + * Get subkeytext. + * + * @return string + */ + public function getSubkeytext() + { + return $this->subkeytext; + } + + /** + * Set id. + * + * @param int $id + * + * @return CCourseSetting + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CCourseSetting + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CDocument.php b/src/Chamilo/CourseBundle/Entity/CDocument.php new file mode 100644 index 000000000..f65081b38 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CDocument.php @@ -0,0 +1,328 @@ +path = $path; + + return $this; + } + + /** + * Get path. + * + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** + * Set comment. + * + * @param string $comment + * + * @return CDocument + */ + public function setComment($comment) + { + $this->comment = $comment; + + return $this; + } + + /** + * Get comment. + * + * @return string + */ + public function getComment() + { + return $this->comment; + } + + /** + * Set title. + * + * @param string $title + * + * @return CDocument + */ + public function setTitle($title) + { + $this->title = $title; + + return $this; + } + + /** + * Get title. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set filetype. + * + * @param string $filetype + * + * @return CDocument + */ + public function setFiletype($filetype) + { + $this->filetype = $filetype; + + return $this; + } + + /** + * Get filetype. + * + * @return string + */ + public function getFiletype() + { + return $this->filetype; + } + + /** + * Set size. + * + * @param int $size + * + * @return CDocument + */ + public function setSize($size) + { + $this->size = $size; + + return $this; + } + + /** + * Get size. + * + * @return int + */ + public function getSize() + { + return $this->size; + } + + /** + * Set readonly. + * + * @param bool $readonly + * + * @return CDocument + */ + public function setReadonly($readonly) + { + $this->readonly = $readonly; + + return $this; + } + + /** + * Get readonly. + * + * @return bool + */ + public function getReadonly() + { + return $this->readonly; + } + + /** + * Set sessionId. + * + * @param int $sessionId + * + * @return CDocument + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * Get sessionId. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * Set id. + * + * @param int $id + * + * @return CDocument + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CDocument + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * @return int + */ + public function getIid() + { + return $this->iid; + } + + /** + * @param int $iid + * + * @return CDocument + */ + public function setIid($iid) + { + $this->iid = $iid; + + return $this; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CDropboxCategory.php b/src/Chamilo/CourseBundle/Entity/CDropboxCategory.php new file mode 100644 index 000000000..20559dfef --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CDropboxCategory.php @@ -0,0 +1,247 @@ +catName = $catName; + + return $this; + } + + /** + * Get catName. + * + * @return string + */ + public function getCatName() + { + return $this->catName; + } + + /** + * Set received. + * + * @param bool $received + * + * @return CDropboxCategory + */ + public function setReceived($received) + { + $this->received = $received; + + return $this; + } + + /** + * Get received. + * + * @return bool + */ + public function getReceived() + { + return $this->received; + } + + /** + * Set sent. + * + * @param bool $sent + * + * @return CDropboxCategory + */ + public function setSent($sent) + { + $this->sent = $sent; + + return $this; + } + + /** + * Get sent. + * + * @return bool + */ + public function getSent() + { + return $this->sent; + } + + /** + * Set userId. + * + * @param int $userId + * + * @return CDropboxCategory + */ + public function setUserId($userId) + { + $this->userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set sessionId. + * + * @param int $sessionId + * + * @return CDropboxCategory + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * Get sessionId. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * Set catId. + * + * @param int $catId + * + * @return CDropboxCategory + */ + public function setCatId($catId) + { + $this->catId = $catId; + + return $this; + } + + /** + * Get catId. + * + * @return int + */ + public function getCatId() + { + return $this->catId; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CDropboxCategory + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CDropboxFeedback.php b/src/Chamilo/CourseBundle/Entity/CDropboxFeedback.php new file mode 100644 index 000000000..75ffa2780 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CDropboxFeedback.php @@ -0,0 +1,217 @@ +fileId = $fileId; + + return $this; + } + + /** + * Get fileId. + * + * @return int + */ + public function getFileId() + { + return $this->fileId; + } + + /** + * Set authorUserId. + * + * @param int $authorUserId + * + * @return CDropboxFeedback + */ + public function setAuthorUserId($authorUserId) + { + $this->authorUserId = $authorUserId; + + return $this; + } + + /** + * Get authorUserId. + * + * @return int + */ + public function getAuthorUserId() + { + return $this->authorUserId; + } + + /** + * Set feedback. + * + * @param string $feedback + * + * @return CDropboxFeedback + */ + public function setFeedback($feedback) + { + $this->feedback = $feedback; + + return $this; + } + + /** + * Get feedback. + * + * @return string + */ + public function getFeedback() + { + return $this->feedback; + } + + /** + * Set feedbackDate. + * + * @param \DateTime $feedbackDate + * + * @return CDropboxFeedback + */ + public function setFeedbackDate($feedbackDate) + { + $this->feedbackDate = $feedbackDate; + + return $this; + } + + /** + * Get feedbackDate. + * + * @return \DateTime + */ + public function getFeedbackDate() + { + return $this->feedbackDate; + } + + /** + * Set feedbackId. + * + * @param int $feedbackId + * + * @return CDropboxFeedback + */ + public function setFeedbackId($feedbackId) + { + $this->feedbackId = $feedbackId; + + return $this; + } + + /** + * Get feedbackId. + * + * @return int + */ + public function getFeedbackId() + { + return $this->feedbackId; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CDropboxFeedback + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CDropboxFile.php b/src/Chamilo/CourseBundle/Entity/CDropboxFile.php new file mode 100644 index 000000000..98bae21f8 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CDropboxFile.php @@ -0,0 +1,425 @@ +uploaderId = $uploaderId; + + return $this; + } + + /** + * Get uploaderId. + * + * @return int + */ + public function getUploaderId() + { + return $this->uploaderId; + } + + /** + * Set filename. + * + * @param string $filename + * + * @return CDropboxFile + */ + public function setFilename($filename) + { + $this->filename = $filename; + + return $this; + } + + /** + * Get filename. + * + * @return string + */ + public function getFilename() + { + return $this->filename; + } + + /** + * Set filesize. + * + * @param int $filesize + * + * @return CDropboxFile + */ + public function setFilesize($filesize) + { + $this->filesize = $filesize; + + return $this; + } + + /** + * Get filesize. + * + * @return int + */ + public function getFilesize() + { + return $this->filesize; + } + + /** + * Set title. + * + * @param string $title + * + * @return CDropboxFile + */ + public function setTitle($title) + { + $this->title = $title; + + return $this; + } + + /** + * Get title. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set description. + * + * @param string $description + * + * @return CDropboxFile + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * Get description. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Set author. + * + * @param string $author + * + * @return CDropboxFile + */ + public function setAuthor($author) + { + $this->author = $author; + + return $this; + } + + /** + * Get author. + * + * @return string + */ + public function getAuthor() + { + return $this->author; + } + + /** + * Set uploadDate. + * + * @param \DateTime $uploadDate + * + * @return CDropboxFile + */ + public function setUploadDate($uploadDate) + { + $this->uploadDate = $uploadDate; + + return $this; + } + + /** + * Get uploadDate. + * + * @return \DateTime + */ + public function getUploadDate() + { + return $this->uploadDate; + } + + /** + * Set lastUploadDate. + * + * @param \DateTime $lastUploadDate + * + * @return CDropboxFile + */ + public function setLastUploadDate($lastUploadDate) + { + $this->lastUploadDate = $lastUploadDate; + + return $this; + } + + /** + * Get lastUploadDate. + * + * @return \DateTime + */ + public function getLastUploadDate() + { + return $this->lastUploadDate; + } + + /** + * Set catId. + * + * @param int $catId + * + * @return CDropboxFile + */ + public function setCatId($catId) + { + $this->catId = $catId; + + return $this; + } + + /** + * Get catId. + * + * @return int + */ + public function getCatId() + { + return $this->catId; + } + + /** + * Set sessionId. + * + * @param int $sessionId + * + * @return CDropboxFile + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * Get sessionId. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * Set id. + * + * @param int $id + * + * @return CDropboxFile + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CDropboxFile + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * @return int + */ + public function getIid() + { + return $this->iid; + } + + /** + * @param int $iid + * + * @return CDropboxFile + */ + public function setIid($iid) + { + $this->iid = $iid; + + return $this; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CDropboxPerson.php b/src/Chamilo/CourseBundle/Entity/CDropboxPerson.php new file mode 100644 index 000000000..1766db5ce --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CDropboxPerson.php @@ -0,0 +1,123 @@ +cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Set fileId. + * + * @param int $fileId + * + * @return CDropboxPerson + */ + public function setFileId($fileId) + { + $this->fileId = $fileId; + + return $this; + } + + /** + * Get fileId. + * + * @return int + */ + public function getFileId() + { + return $this->fileId; + } + + /** + * Set userId. + * + * @param int $userId + * + * @return CDropboxPerson + */ + public function setUserId($userId) + { + $this->userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CDropboxPost.php b/src/Chamilo/CourseBundle/Entity/CDropboxPost.php new file mode 100644 index 000000000..0a860d24c --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CDropboxPost.php @@ -0,0 +1,248 @@ +feedbackDate = $feedbackDate; + + return $this; + } + + /** + * Get feedbackDate. + * + * @return \DateTime + */ + public function getFeedbackDate() + { + return $this->feedbackDate; + } + + /** + * Set feedback. + * + * @param string $feedback + * + * @return CDropboxPost + */ + public function setFeedback($feedback) + { + $this->feedback = $feedback; + + return $this; + } + + /** + * Get feedback. + * + * @return string + */ + public function getFeedback() + { + return $this->feedback; + } + + /** + * Set catId. + * + * @param int $catId + * + * @return CDropboxPost + */ + public function setCatId($catId) + { + $this->catId = $catId; + + return $this; + } + + /** + * Get catId. + * + * @return int + */ + public function getCatId() + { + return $this->catId; + } + + /** + * Set sessionId. + * + * @param int $sessionId + * + * @return CDropboxPost + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * Get sessionId. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CDropboxPost + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Set fileId. + * + * @param int $fileId + * + * @return CDropboxPost + */ + public function setFileId($fileId) + { + $this->fileId = $fileId; + + return $this; + } + + /** + * Get fileId. + * + * @return int + */ + public function getFileId() + { + return $this->fileId; + } + + /** + * Set destUserId. + * + * @param int $destUserId + * + * @return CDropboxPost + */ + public function setDestUserId($destUserId) + { + $this->destUserId = $destUserId; + + return $this; + } + + /** + * Get destUserId. + * + * @return int + */ + public function getDestUserId() + { + return $this->destUserId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CExerciseCategory.php b/src/Chamilo/CourseBundle/Entity/CExerciseCategory.php new file mode 100644 index 000000000..733bc3561 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CExerciseCategory.php @@ -0,0 +1,219 @@ +createdAt = new \DateTime(); + $this->updatedAt = new \DateTime(); + } + + /** + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * @param int $id + * + * @return CExerciseCategory + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * @param int $cId + * + * @return CExerciseCategory + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @param string $name + * + * @return CExerciseCategory + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * @param string $description + * + * @return CExerciseCategory + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + * @param \DateTime $createdAt + * + * @return CExerciseCategory + */ + public function setCreatedAt($createdAt) + { + $this->createdAt = $createdAt; + + return $this; + } + + /** + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->updatedAt; + } + + /** + * @param \DateTime $updatedAt + * + * @return CExerciseCategory + */ + public function setUpdatedAt($updatedAt) + { + $this->updatedAt = $updatedAt; + + return $this; + } + + /** + * @return mixed + */ + public function getPosition() + { + return $this->position; + } + + /** + * @param mixed $position + * + * @return CExerciseCategory + */ + public function setPosition($position) + { + $this->position = $position; + + return $this; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CForumAttachment.php b/src/Chamilo/CourseBundle/Entity/CForumAttachment.php new file mode 100644 index 000000000..bd965895d --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CForumAttachment.php @@ -0,0 +1,246 @@ +path = $path; + + return $this; + } + + /** + * Get path. + * + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** + * Set comment. + * + * @param string $comment + * + * @return CForumAttachment + */ + public function setComment($comment) + { + $this->comment = $comment; + + return $this; + } + + /** + * Get comment. + * + * @return string + */ + public function getComment() + { + return $this->comment; + } + + /** + * Set size. + * + * @param int $size + * + * @return CForumAttachment + */ + public function setSize($size) + { + $this->size = $size; + + return $this; + } + + /** + * Get size. + * + * @return int + */ + public function getSize() + { + return $this->size; + } + + /** + * Set postId. + * + * @param int $postId + * + * @return CForumAttachment + */ + public function setPostId($postId) + { + $this->postId = $postId; + + return $this; + } + + /** + * Get postId. + * + * @return int + */ + public function getPostId() + { + return $this->postId; + } + + /** + * Set filename. + * + * @param string $filename + * + * @return CForumAttachment + */ + public function setFilename($filename) + { + $this->filename = $filename; + + return $this; + } + + /** + * Get filename. + * + * @return string + */ + public function getFilename() + { + return $this->filename; + } + + /** + * Set id. + * + * @param int $id + * + * @return CForumAttachment + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CForumAttachment + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CForumCategory.php b/src/Chamilo/CourseBundle/Entity/CForumCategory.php new file mode 100644 index 000000000..deef3937b --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CForumCategory.php @@ -0,0 +1,247 @@ +catTitle = $catTitle; + + return $this; + } + + /** + * Get catTitle. + * + * @return string + */ + public function getCatTitle() + { + return $this->catTitle; + } + + /** + * Set catComment. + * + * @param string $catComment + * + * @return CForumCategory + */ + public function setCatComment($catComment) + { + $this->catComment = $catComment; + + return $this; + } + + /** + * Get catComment. + * + * @return string + */ + public function getCatComment() + { + return $this->catComment; + } + + /** + * Set catOrder. + * + * @param int $catOrder + * + * @return CForumCategory + */ + public function setCatOrder($catOrder) + { + $this->catOrder = $catOrder; + + return $this; + } + + /** + * Get catOrder. + * + * @return int + */ + public function getCatOrder() + { + return $this->catOrder; + } + + /** + * Set locked. + * + * @param int $locked + * + * @return CForumCategory + */ + public function setLocked($locked) + { + $this->locked = $locked; + + return $this; + } + + /** + * Get locked. + * + * @return int + */ + public function getLocked() + { + return $this->locked; + } + + /** + * Set sessionId. + * + * @param int $sessionId + * + * @return CForumCategory + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * Get sessionId. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * Set catId. + * + * @param int $catId + * + * @return CForumCategory + */ + public function setCatId($catId) + { + $this->catId = $catId; + + return $this; + } + + /** + * Get catId. + * + * @return int + */ + public function getCatId() + { + return $this->catId; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CForumCategory + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CForumForum.php b/src/Chamilo/CourseBundle/Entity/CForumForum.php new file mode 100644 index 000000000..fd95842cb --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CForumForum.php @@ -0,0 +1,765 @@ +forumTitle = $forumTitle; + + return $this; + } + + /** + * Get forumTitle. + * + * @return string + */ + public function getForumTitle() + { + return $this->forumTitle; + } + + /** + * Set forumComment. + * + * @param string $forumComment + * + * @return CForumForum + */ + public function setForumComment($forumComment) + { + $this->forumComment = $forumComment; + + return $this; + } + + /** + * Get forumComment. + * + * @return string + */ + public function getForumComment() + { + return $this->forumComment; + } + + /** + * Set forumThreads. + * + * @param int $forumThreads + * + * @return CForumForum + */ + public function setForumThreads($forumThreads) + { + $this->forumThreads = $forumThreads; + + return $this; + } + + /** + * Get forumThreads. + * + * @return int + */ + public function getForumThreads() + { + return $this->forumThreads; + } + + /** + * Set forumPosts. + * + * @param int $forumPosts + * + * @return CForumForum + */ + public function setForumPosts($forumPosts) + { + $this->forumPosts = $forumPosts; + + return $this; + } + + /** + * Get forumPosts. + * + * @return int + */ + public function getForumPosts() + { + return $this->forumPosts; + } + + /** + * Set forumLastPost. + * + * @param int $forumLastPost + * + * @return CForumForum + */ + public function setForumLastPost($forumLastPost) + { + $this->forumLastPost = $forumLastPost; + + return $this; + } + + /** + * Get forumLastPost. + * + * @return int + */ + public function getForumLastPost() + { + return $this->forumLastPost; + } + + /** + * Set forumCategory. + * + * @param int $forumCategory + * + * @return CForumForum + */ + public function setForumCategory($forumCategory) + { + $this->forumCategory = $forumCategory; + + return $this; + } + + /** + * Get forumCategory. + * + * @return int + */ + public function getForumCategory() + { + return $this->forumCategory; + } + + /** + * Set allowAnonymous. + * + * @param int $allowAnonymous + * + * @return CForumForum + */ + public function setAllowAnonymous($allowAnonymous) + { + $this->allowAnonymous = $allowAnonymous; + + return $this; + } + + /** + * Get allowAnonymous. + * + * @return int + */ + public function getAllowAnonymous() + { + return $this->allowAnonymous; + } + + /** + * Set allowEdit. + * + * @param int $allowEdit + * + * @return CForumForum + */ + public function setAllowEdit($allowEdit) + { + $this->allowEdit = $allowEdit; + + return $this; + } + + /** + * Get allowEdit. + * + * @return int + */ + public function getAllowEdit() + { + return $this->allowEdit; + } + + /** + * Set approvalDirectPost. + * + * @param string $approvalDirectPost + * + * @return CForumForum + */ + public function setApprovalDirectPost($approvalDirectPost) + { + $this->approvalDirectPost = $approvalDirectPost; + + return $this; + } + + /** + * Get approvalDirectPost. + * + * @return string + */ + public function getApprovalDirectPost() + { + return $this->approvalDirectPost; + } + + /** + * Set allowAttachments. + * + * @param int $allowAttachments + * + * @return CForumForum + */ + public function setAllowAttachments($allowAttachments) + { + $this->allowAttachments = $allowAttachments; + + return $this; + } + + /** + * Get allowAttachments. + * + * @return int + */ + public function getAllowAttachments() + { + return $this->allowAttachments; + } + + /** + * Set allowNewThreads. + * + * @param int $allowNewThreads + * + * @return CForumForum + */ + public function setAllowNewThreads($allowNewThreads) + { + $this->allowNewThreads = $allowNewThreads; + + return $this; + } + + /** + * Get allowNewThreads. + * + * @return int + */ + public function getAllowNewThreads() + { + return $this->allowNewThreads; + } + + /** + * Set defaultView. + * + * @param string $defaultView + * + * @return CForumForum + */ + public function setDefaultView($defaultView) + { + $this->defaultView = $defaultView; + + return $this; + } + + /** + * Get defaultView. + * + * @return string + */ + public function getDefaultView() + { + return $this->defaultView; + } + + /** + * Set forumOfGroup. + * + * @param string $forumOfGroup + * + * @return CForumForum + */ + public function setForumOfGroup($forumOfGroup) + { + $this->forumOfGroup = $forumOfGroup; + + return $this; + } + + /** + * Get forumOfGroup. + * + * @return string + */ + public function getForumOfGroup() + { + return $this->forumOfGroup; + } + + /** + * @return string + */ + public function getForumGroupPublicPrivate() + { + return $this->forumGroupPublicPrivate; + } + + /** + * @param string $forumGroupPublicPrivate + * + * @return CForumForum + */ + public function setForumGroupPublicPrivate($forumGroupPublicPrivate) + { + $this->forumGroupPublicPrivate = $forumGroupPublicPrivate; + + return $this; + } + + /** + * Set forumOrder. + * + * @param int $forumOrder + * + * @return CForumForum + */ + public function setForumOrder($forumOrder) + { + $this->forumOrder = $forumOrder; + + return $this; + } + + /** + * Get forumOrder. + * + * @return int + */ + public function getForumOrder() + { + return $this->forumOrder; + } + + /** + * Set locked. + * + * @param int $locked + * + * @return CForumForum + */ + public function setLocked($locked) + { + $this->locked = $locked; + + return $this; + } + + /** + * Get locked. + * + * @return int + */ + public function getLocked() + { + return $this->locked; + } + + /** + * Set sessionId. + * + * @param int $sessionId + * + * @return CForumForum + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * Get sessionId. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * Set forumImage. + * + * @param string $forumImage + * + * @return CForumForum + */ + public function setForumImage($forumImage) + { + $this->forumImage = $forumImage; + + return $this; + } + + /** + * Get forumImage. + * + * @return string + */ + public function getForumImage() + { + return $this->forumImage; + } + + /** + * Set startTime. + * + * @param \DateTime $startTime + * + * @return CForumForum + */ + public function setStartTime($startTime) + { + $this->startTime = $startTime; + + return $this; + } + + /** + * Get startTime. + * + * @return \DateTime + */ + public function getStartTime() + { + return $this->startTime; + } + + /** + * Set endTime. + * + * @param \DateTime $endTime + * + * @return CForumForum + */ + public function setEndTime($endTime) + { + $this->endTime = $endTime; + + return $this; + } + + /** + * Get endTime. + * + * @return \DateTime + */ + public function getEndTime() + { + return $this->endTime; + } + + /** + * Set forumId. + * + * @param int $forumId + * + * @return CForumForum + */ + public function setForumId($forumId) + { + $this->forumId = $forumId; + + return $this; + } + + /** + * Get forumId. + * + * @return int + */ + public function getForumId() + { + return $this->forumId; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CForumForum + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Set lpId. + * + * @param int $lpId + * + * @return CForumForum + */ + public function setLpId($lpId) + { + $this->lpId = $lpId; + + return $this; + } + + /** + * Get lpId. + * + * @return int + */ + public function getLpId() + { + return $this->lpId; + } + + /** + * @return bool + */ + public function isModerated() + { + return $this->moderated; + } + + /** + * @param $moderated + * + * @return $this + */ + public function setModerated($moderated) + { + $this->moderated = $moderated; + + return $this; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CForumMailcue.php b/src/Chamilo/CourseBundle/Entity/CForumMailcue.php new file mode 100644 index 000000000..b773537c5 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CForumMailcue.php @@ -0,0 +1,187 @@ +id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CForumMailcue + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Set threadId. + * + * @param int $threadId + * + * @return CForumMailcue + */ + public function setThreadId($threadId) + { + $this->threadId = $threadId; + + return $this; + } + + /** + * Get threadId. + * + * @return int + */ + public function getThreadId() + { + return $this->threadId; + } + + /** + * Set userId. + * + * @param int $userId + * + * @return CForumMailcue + */ + public function setUserId($userId) + { + $this->userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set postId. + * + * @param int $postId + * + * @return CForumMailcue + */ + public function setPostId($postId) + { + $this->postId = $postId; + + return $this; + } + + /** + * Get postId. + * + * @return int + */ + public function getPostId() + { + return $this->postId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CForumNotification.php b/src/Chamilo/CourseBundle/Entity/CForumNotification.php new file mode 100644 index 000000000..41c1bd20f --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CForumNotification.php @@ -0,0 +1,219 @@ +id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CForumNotification + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Set userId. + * + * @param int $userId + * + * @return CForumNotification + */ + public function setUserId($userId) + { + $this->userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set forumId. + * + * @param int $forumId + * + * @return CForumNotification + */ + public function setForumId($forumId) + { + $this->forumId = $forumId; + + return $this; + } + + /** + * Get forumId. + * + * @return int + */ + public function getForumId() + { + return $this->forumId; + } + + /** + * Set threadId. + * + * @param int $threadId + * + * @return CForumNotification + */ + public function setThreadId($threadId) + { + $this->threadId = $threadId; + + return $this; + } + + /** + * Get threadId. + * + * @return int + */ + public function getThreadId() + { + return $this->threadId; + } + + /** + * Set postId. + * + * @param int $postId + * + * @return CForumNotification + */ + public function setPostId($postId) + { + $this->postId = $postId; + + return $this; + } + + /** + * Get postId. + * + * @return int + */ + public function getPostId() + { + return $this->postId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CForumPost.php b/src/Chamilo/CourseBundle/Entity/CForumPost.php new file mode 100644 index 000000000..6a71cc947 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CForumPost.php @@ -0,0 +1,446 @@ +postTitle = $postTitle; + + return $this; + } + + /** + * Get postTitle. + * + * @return string + */ + public function getPostTitle() + { + return $this->postTitle; + } + + /** + * Set postText. + * + * @param string $postText + * + * @return CForumPost + */ + public function setPostText($postText) + { + $this->postText = $postText; + + return $this; + } + + /** + * Get postText. + * + * @return string + */ + public function getPostText() + { + return $this->postText; + } + + /** + * Set threadId. + * + * @param int $threadId + * + * @return CForumPost + */ + public function setThreadId($threadId) + { + $this->threadId = $threadId; + + return $this; + } + + /** + * Get threadId. + * + * @return int + */ + public function getThreadId() + { + return $this->threadId; + } + + /** + * Set forumId. + * + * @param int $forumId + * + * @return CForumPost + */ + public function setForumId($forumId) + { + $this->forumId = $forumId; + + return $this; + } + + /** + * Get forumId. + * + * @return int + */ + public function getForumId() + { + return $this->forumId; + } + + /** + * Set posterId. + * + * @param int $posterId + * + * @return CForumPost + */ + public function setPosterId($posterId) + { + $this->posterId = $posterId; + + return $this; + } + + /** + * Get posterId. + * + * @return int + */ + public function getPosterId() + { + return $this->posterId; + } + + /** + * Set posterName. + * + * @param string $posterName + * + * @return CForumPost + */ + public function setPosterName($posterName) + { + $this->posterName = $posterName; + + return $this; + } + + /** + * Get posterName. + * + * @return string + */ + public function getPosterName() + { + return $this->posterName; + } + + /** + * Set postDate. + * + * @param \DateTime $postDate + * + * @return CForumPost + */ + public function setPostDate($postDate) + { + $this->postDate = $postDate; + + return $this; + } + + /** + * Get postDate. + * + * @return \DateTime + */ + public function getPostDate() + { + return $this->postDate; + } + + /** + * Set postNotification. + * + * @param bool $postNotification + * + * @return CForumPost + */ + public function setPostNotification($postNotification) + { + $this->postNotification = $postNotification; + + return $this; + } + + /** + * Get postNotification. + * + * @return bool + */ + public function getPostNotification() + { + return $this->postNotification; + } + + /** + * Set postParentId. + * + * @param int $postParentId + * + * @return CForumPost + */ + public function setPostParentId($postParentId) + { + $this->postParentId = $postParentId; + + return $this; + } + + /** + * Get postParentId. + * + * @return int + */ + public function getPostParentId() + { + return $this->postParentId; + } + + /** + * Set visible. + * + * @param bool $visible + * + * @return CForumPost + */ + public function setVisible($visible) + { + $this->visible = $visible; + + return $this; + } + + /** + * Get visible. + * + * @return bool + */ + public function getVisible() + { + return $this->visible; + } + + /** + * Set postId. + * + * @param int $postId + * + * @return CForumPost + */ + public function setPostId($postId) + { + $this->postId = $postId; + + return $this; + } + + /** + * Get postId. + * + * @return int + */ + public function getPostId() + { + return $this->postId; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CForumPost + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * @return int + */ + public function getStatus() + { + return $this->status; + } + + /** + * @param int $status + * + * @return CForumPost + */ + public function setStatus($status) + { + $this->status = $status; + + return $this; + } + + /** + * Get iid. + * + * @return int + */ + public function getIid() + { + return $this->iid; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CForumThread.php b/src/Chamilo/CourseBundle/Entity/CForumThread.php new file mode 100644 index 000000000..4b5448317 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CForumThread.php @@ -0,0 +1,637 @@ +threadPeerQualify = false; + $this->threadReplies = 0; + $this->threadViews = 0; + } + + /** + * @return bool + */ + public function isThreadPeerQualify() + { + return $this->threadPeerQualify; + } + + /** + * set threadPeerQualify. + * + * @param bool $threadPeerQualify + * + * @return $this + */ + public function setThreadPeerQualify($threadPeerQualify) + { + $this->threadPeerQualify = $threadPeerQualify; + + return $this; + } + + /** + * Set threadTitle. + * + * @param string $threadTitle + * + * @return CForumThread + */ + public function setThreadTitle($threadTitle) + { + $this->threadTitle = $threadTitle; + + return $this; + } + + /** + * Get threadTitle. + * + * @return string + */ + public function getThreadTitle() + { + return $this->threadTitle; + } + + /** + * Set forumId. + * + * @param int $forumId + * + * @return CForumThread + */ + public function setForumId($forumId) + { + $this->forumId = $forumId; + + return $this; + } + + /** + * Get forumId. + * + * @return int + */ + public function getForumId() + { + return $this->forumId; + } + + /** + * Set threadReplies. + * + * @param int $threadReplies + * + * @return CForumThread + */ + public function setThreadReplies($threadReplies) + { + $this->threadReplies = $threadReplies; + + return $this; + } + + /** + * Get threadReplies. + * + * @return int + */ + public function getThreadReplies() + { + return $this->threadReplies; + } + + /** + * Set threadPosterId. + * + * @param int $threadPosterId + * + * @return CForumThread + */ + public function setThreadPosterId($threadPosterId) + { + $this->threadPosterId = $threadPosterId; + + return $this; + } + + /** + * Get threadPosterId. + * + * @return int + */ + public function getThreadPosterId() + { + return $this->threadPosterId; + } + + /** + * Set threadPosterName. + * + * @param string $threadPosterName + * + * @return CForumThread + */ + public function setThreadPosterName($threadPosterName) + { + $this->threadPosterName = $threadPosterName; + + return $this; + } + + /** + * Get threadPosterName. + * + * @return string + */ + public function getThreadPosterName() + { + return $this->threadPosterName; + } + + /** + * Set threadViews. + * + * @param int $threadViews + * + * @return CForumThread + */ + public function setThreadViews($threadViews) + { + $this->threadViews = $threadViews; + + return $this; + } + + /** + * Get threadViews. + * + * @return int + */ + public function getThreadViews() + { + return $this->threadViews; + } + + /** + * Set threadLastPost. + * + * @param int $threadLastPost + * + * @return CForumThread + */ + public function setThreadLastPost($threadLastPost) + { + $this->threadLastPost = $threadLastPost; + + return $this; + } + + /** + * Get threadLastPost. + * + * @return int + */ + public function getThreadLastPost() + { + return $this->threadLastPost; + } + + /** + * Set threadDate. + * + * @param \DateTime $threadDate + * + * @return CForumThread + */ + public function setThreadDate($threadDate) + { + $this->threadDate = $threadDate; + + return $this; + } + + /** + * Get threadDate. + * + * @return \DateTime + */ + public function getThreadDate() + { + return $this->threadDate; + } + + /** + * Set threadSticky. + * + * @param bool $threadSticky + * + * @return CForumThread + */ + public function setThreadSticky($threadSticky) + { + $this->threadSticky = $threadSticky; + + return $this; + } + + /** + * Get threadSticky. + * + * @return bool + */ + public function getThreadSticky() + { + return $this->threadSticky; + } + + /** + * Set locked. + * + * @param int $locked + * + * @return CForumThread + */ + public function setLocked($locked) + { + $this->locked = $locked; + + return $this; + } + + /** + * Get locked. + * + * @return int + */ + public function getLocked() + { + return $this->locked; + } + + /** + * Set sessionId. + * + * @param int $sessionId + * + * @return CForumThread + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * Get sessionId. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * Set threadTitleQualify. + * + * @param string $threadTitleQualify + * + * @return CForumThread + */ + public function setThreadTitleQualify($threadTitleQualify) + { + $this->threadTitleQualify = $threadTitleQualify; + + return $this; + } + + /** + * Get threadTitleQualify. + * + * @return string + */ + public function getThreadTitleQualify() + { + return $this->threadTitleQualify; + } + + /** + * Set threadQualifyMax. + * + * @param float $threadQualifyMax + * + * @return CForumThread + */ + public function setThreadQualifyMax($threadQualifyMax) + { + $this->threadQualifyMax = $threadQualifyMax; + + return $this; + } + + /** + * Get threadQualifyMax. + * + * @return float + */ + public function getThreadQualifyMax() + { + return $this->threadQualifyMax; + } + + /** + * Set threadCloseDate. + * + * @param \DateTime $threadCloseDate + * + * @return CForumThread + */ + public function setThreadCloseDate($threadCloseDate) + { + $this->threadCloseDate = $threadCloseDate; + + return $this; + } + + /** + * Get threadCloseDate. + * + * @return \DateTime + */ + public function getThreadCloseDate() + { + return $this->threadCloseDate; + } + + /** + * Set threadWeight. + * + * @param float $threadWeight + * + * @return CForumThread + */ + public function setThreadWeight($threadWeight) + { + $this->threadWeight = $threadWeight; + + return $this; + } + + /** + * Get threadWeight. + * + * @return float + */ + public function getThreadWeight() + { + return $this->threadWeight; + } + + /** + * Set threadId. + * + * @param int $threadId + * + * @return CForumThread + */ + public function setThreadId($threadId) + { + $this->threadId = $threadId; + + return $this; + } + + /** + * Get threadId. + * + * @return int + */ + public function getThreadId() + { + return $this->threadId; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CForumThread + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Set lpItemId. + * + * @param int $lpItemId + * + * @return $this + */ + public function setLpItemId($lpItemId) + { + $this->lpItemId = $lpItemId; + + return $this; + } + + /** + * Get lpId. + * + * @return int + */ + public function getLpItemId() + { + return $this->lpItemId; + } + + /** + * Get iid. + * + * @return int + */ + public function getIid() + { + return $this->iid; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CForumThreadQualify.php b/src/Chamilo/CourseBundle/Entity/CForumThreadQualify.php new file mode 100644 index 000000000..441b6e88c --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CForumThreadQualify.php @@ -0,0 +1,278 @@ +userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set threadId. + * + * @param int $threadId + * + * @return CForumThreadQualify + */ + public function setThreadId($threadId) + { + $this->threadId = $threadId; + + return $this; + } + + /** + * Get threadId. + * + * @return int + */ + public function getThreadId() + { + return $this->threadId; + } + + /** + * Set qualify. + * + * @param float $qualify + * + * @return CForumThreadQualify + */ + public function setQualify($qualify) + { + $this->qualify = $qualify; + + return $this; + } + + /** + * Get qualify. + * + * @return float + */ + public function getQualify() + { + return $this->qualify; + } + + /** + * Set qualifyUserId. + * + * @param int $qualifyUserId + * + * @return CForumThreadQualify + */ + public function setQualifyUserId($qualifyUserId) + { + $this->qualifyUserId = $qualifyUserId; + + return $this; + } + + /** + * Get qualifyUserId. + * + * @return int + */ + public function getQualifyUserId() + { + return $this->qualifyUserId; + } + + /** + * Set qualifyTime. + * + * @param \DateTime $qualifyTime + * + * @return CForumThreadQualify + */ + public function setQualifyTime($qualifyTime) + { + $this->qualifyTime = $qualifyTime; + + return $this; + } + + /** + * Get qualifyTime. + * + * @return \DateTime + */ + public function getQualifyTime() + { + return $this->qualifyTime; + } + + /** + * Set sessionId. + * + * @param int $sessionId + * + * @return CForumThreadQualify + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * Get sessionId. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * Set id. + * + * @param int $id + * + * @return CForumThreadQualify + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CForumThreadQualify + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CForumThreadQualifyLog.php b/src/Chamilo/CourseBundle/Entity/CForumThreadQualifyLog.php new file mode 100644 index 000000000..4961a2872 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CForumThreadQualifyLog.php @@ -0,0 +1,278 @@ +userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set threadId. + * + * @param int $threadId + * + * @return CForumThreadQualifyLog + */ + public function setThreadId($threadId) + { + $this->threadId = $threadId; + + return $this; + } + + /** + * Get threadId. + * + * @return int + */ + public function getThreadId() + { + return $this->threadId; + } + + /** + * Set qualify. + * + * @param float $qualify + * + * @return CForumThreadQualifyLog + */ + public function setQualify($qualify) + { + $this->qualify = $qualify; + + return $this; + } + + /** + * Get qualify. + * + * @return float + */ + public function getQualify() + { + return $this->qualify; + } + + /** + * Set qualifyUserId. + * + * @param int $qualifyUserId + * + * @return CForumThreadQualifyLog + */ + public function setQualifyUserId($qualifyUserId) + { + $this->qualifyUserId = $qualifyUserId; + + return $this; + } + + /** + * Get qualifyUserId. + * + * @return int + */ + public function getQualifyUserId() + { + return $this->qualifyUserId; + } + + /** + * Set qualifyTime. + * + * @param \DateTime $qualifyTime + * + * @return CForumThreadQualifyLog + */ + public function setQualifyTime($qualifyTime) + { + $this->qualifyTime = $qualifyTime; + + return $this; + } + + /** + * Get qualifyTime. + * + * @return \DateTime + */ + public function getQualifyTime() + { + return $this->qualifyTime; + } + + /** + * Set sessionId. + * + * @param int $sessionId + * + * @return CForumThreadQualifyLog + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * Get sessionId. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * Set id. + * + * @param int $id + * + * @return CForumThreadQualifyLog + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CForumThreadQualifyLog + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CGlossary.php b/src/Chamilo/CourseBundle/Entity/CGlossary.php new file mode 100644 index 000000000..df54db8d8 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CGlossary.php @@ -0,0 +1,216 @@ +name = $name; + + return $this; + } + + /** + * Get name. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set description. + * + * @param string $description + * + * @return CGlossary + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * Get description. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Set displayOrder. + * + * @param int $displayOrder + * + * @return CGlossary + */ + public function setDisplayOrder($displayOrder) + { + $this->displayOrder = $displayOrder; + + return $this; + } + + /** + * Get displayOrder. + * + * @return int + */ + public function getDisplayOrder() + { + return $this->displayOrder; + } + + /** + * Set sessionId. + * + * @param int $sessionId + * + * @return CGlossary + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * Get sessionId. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * Set glossaryId. + * + * @param int $glossaryId + * + * @return CGlossary + */ + public function setGlossaryId($glossaryId) + { + $this->glossaryId = $glossaryId; + + return $this; + } + + /** + * Get glossaryId. + * + * @return int + */ + public function getGlossaryId() + { + return $this->glossaryId; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CGlossary + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CGroupCategory.php b/src/Chamilo/CourseBundle/Entity/CGroupCategory.php new file mode 100644 index 000000000..05bd027df --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CGroupCategory.php @@ -0,0 +1,525 @@ +title = $title; + + return $this; + } + + /** + * Get title. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set description. + * + * @param string $description + * + * @return CGroupCategory + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * Get description. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Set docState. + * + * @param bool $docState + * + * @return CGroupCategory + */ + public function setDocState($docState) + { + $this->docState = $docState; + + return $this; + } + + /** + * Get docState. + * + * @return bool + */ + public function getDocState() + { + return $this->docState; + } + + /** + * Set calendarState. + * + * @param bool $calendarState + * + * @return CGroupCategory + */ + public function setCalendarState($calendarState) + { + $this->calendarState = $calendarState; + + return $this; + } + + /** + * Get calendarState. + * + * @return bool + */ + public function getCalendarState() + { + return $this->calendarState; + } + + /** + * Set workState. + * + * @param bool $workState + * + * @return CGroupCategory + */ + public function setWorkState($workState) + { + $this->workState = $workState; + + return $this; + } + + /** + * Get workState. + * + * @return bool + */ + public function getWorkState() + { + return $this->workState; + } + + /** + * Set announcementsState. + * + * @param bool $announcementsState + * + * @return CGroupCategory + */ + public function setAnnouncementsState($announcementsState) + { + $this->announcementsState = $announcementsState; + + return $this; + } + + /** + * Get announcementsState. + * + * @return bool + */ + public function getAnnouncementsState() + { + return $this->announcementsState; + } + + /** + * Set forumState. + * + * @param bool $forumState + * + * @return CGroupCategory + */ + public function setForumState($forumState) + { + $this->forumState = $forumState; + + return $this; + } + + /** + * Get forumState. + * + * @return bool + */ + public function getForumState() + { + return $this->forumState; + } + + /** + * Set wikiState. + * + * @param bool $wikiState + * + * @return CGroupCategory + */ + public function setWikiState($wikiState) + { + $this->wikiState = $wikiState; + + return $this; + } + + /** + * Get wikiState. + * + * @return bool + */ + public function getWikiState() + { + return $this->wikiState; + } + + /** + * Set chatState. + * + * @param bool $chatState + * + * @return CGroupCategory + */ + public function setChatState($chatState) + { + $this->chatState = $chatState; + + return $this; + } + + /** + * Get chatState. + * + * @return bool + */ + public function getChatState() + { + return $this->chatState; + } + + /** + * Set maxStudent. + * + * @param int $maxStudent + * + * @return CGroupCategory + */ + public function setMaxStudent($maxStudent) + { + $this->maxStudent = $maxStudent; + + return $this; + } + + /** + * Get maxStudent. + * + * @return int + */ + public function getMaxStudent() + { + return $this->maxStudent; + } + + /** + * Set selfRegAllowed. + * + * @param bool $selfRegAllowed + * + * @return CGroupCategory + */ + public function setSelfRegAllowed($selfRegAllowed) + { + $this->selfRegAllowed = $selfRegAllowed; + + return $this; + } + + /** + * Get selfRegAllowed. + * + * @return bool + */ + public function getSelfRegAllowed() + { + return $this->selfRegAllowed; + } + + /** + * Set selfUnregAllowed. + * + * @param bool $selfUnregAllowed + * + * @return CGroupCategory + */ + public function setSelfUnregAllowed($selfUnregAllowed) + { + $this->selfUnregAllowed = $selfUnregAllowed; + + return $this; + } + + /** + * Get selfUnregAllowed. + * + * @return bool + */ + public function getSelfUnregAllowed() + { + return $this->selfUnregAllowed; + } + + /** + * Set groupsPerUser. + * + * @param int $groupsPerUser + * + * @return CGroupCategory + */ + public function setGroupsPerUser($groupsPerUser) + { + $this->groupsPerUser = $groupsPerUser; + + return $this; + } + + /** + * Get groupsPerUser. + * + * @return int + */ + public function getGroupsPerUser() + { + return $this->groupsPerUser; + } + + /** + * Set displayOrder. + * + * @param int $displayOrder + * + * @return CGroupCategory + */ + public function setDisplayOrder($displayOrder) + { + $this->displayOrder = $displayOrder; + + return $this; + } + + /** + * Get displayOrder. + * + * @return int + */ + public function getDisplayOrder() + { + return $this->displayOrder; + } + + /** + * Set id. + * + * @param int $id + * + * @return CGroupCategory + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CGroupCategory + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CGroupInfo.php b/src/Chamilo/CourseBundle/Entity/CGroupInfo.php new file mode 100644 index 000000000..2d6bfe948 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CGroupInfo.php @@ -0,0 +1,603 @@ +iid; + } + + /** + * Set name. + * + * @param string $name + * + * @return CGroupInfo + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * Get name. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set status. + * + * @param bool $status + * + * @return CGroupInfo + */ + public function setStatus($status) + { + $this->status = $status; + + return $this; + } + + /** + * Get status. + * + * @return bool + */ + public function getStatus() + { + return $this->status; + } + + /** + * Set categoryId. + * + * @param int $categoryId + * + * @return CGroupInfo + */ + public function setCategoryId($categoryId) + { + $this->categoryId = $categoryId; + + return $this; + } + + /** + * Get categoryId. + * + * @return int + */ + public function getCategoryId() + { + return $this->categoryId; + } + + /** + * Set description. + * + * @param string $description + * + * @return CGroupInfo + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * Get description. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Set maxStudent. + * + * @param int $maxStudent + * + * @return CGroupInfo + */ + public function setMaxStudent($maxStudent) + { + $this->maxStudent = $maxStudent; + + return $this; + } + + /** + * Get maxStudent. + * + * @return int + */ + public function getMaxStudent() + { + return $this->maxStudent; + } + + /** + * Set docState. + * + * @param bool $docState + * + * @return CGroupInfo + */ + public function setDocState($docState) + { + $this->docState = $docState; + + return $this; + } + + /** + * Get docState. + * + * @return bool + */ + public function getDocState() + { + return $this->docState; + } + + /** + * Set calendarState. + * + * @param bool $calendarState + * + * @return CGroupInfo + */ + public function setCalendarState($calendarState) + { + $this->calendarState = $calendarState; + + return $this; + } + + /** + * Get calendarState. + * + * @return bool + */ + public function getCalendarState() + { + return $this->calendarState; + } + + /** + * Set workState. + * + * @param bool $workState + * + * @return CGroupInfo + */ + public function setWorkState($workState) + { + $this->workState = $workState; + + return $this; + } + + /** + * Get workState. + * + * @return bool + */ + public function getWorkState() + { + return $this->workState; + } + + /** + * Set announcementsState. + * + * @param bool $announcementsState + * + * @return CGroupInfo + */ + public function setAnnouncementsState($announcementsState) + { + $this->announcementsState = $announcementsState; + + return $this; + } + + /** + * Get announcementsState. + * + * @return bool + */ + public function getAnnouncementsState() + { + return $this->announcementsState; + } + + /** + * Set forumState. + * + * @param bool $forumState + * + * @return CGroupInfo + */ + public function setForumState($forumState) + { + $this->forumState = $forumState; + + return $this; + } + + /** + * Get forumState. + * + * @return bool + */ + public function getForumState() + { + return $this->forumState; + } + + /** + * Set wikiState. + * + * @param bool $wikiState + * + * @return CGroupInfo + */ + public function setWikiState($wikiState) + { + $this->wikiState = $wikiState; + + return $this; + } + + /** + * Get wikiState. + * + * @return bool + */ + public function getWikiState() + { + return $this->wikiState; + } + + /** + * Set chatState. + * + * @param bool $chatState + * + * @return CGroupInfo + */ + public function setChatState($chatState) + { + $this->chatState = $chatState; + + return $this; + } + + /** + * Get chatState. + * + * @return bool + */ + public function getChatState() + { + return $this->chatState; + } + + /** + * Set secretDirectory. + * + * @param string $secretDirectory + * + * @return CGroupInfo + */ + public function setSecretDirectory($secretDirectory) + { + $this->secretDirectory = $secretDirectory; + + return $this; + } + + /** + * Get secretDirectory. + * + * @return string + */ + public function getSecretDirectory() + { + return $this->secretDirectory; + } + + /** + * Set selfRegistrationAllowed. + * + * @param bool $selfRegistrationAllowed + * + * @return CGroupInfo + */ + public function setSelfRegistrationAllowed($selfRegistrationAllowed) + { + $this->selfRegistrationAllowed = $selfRegistrationAllowed; + + return $this; + } + + /** + * Get selfRegistrationAllowed. + * + * @return bool + */ + public function getSelfRegistrationAllowed() + { + return $this->selfRegistrationAllowed; + } + + /** + * Set selfUnregistrationAllowed. + * + * @param bool $selfUnregistrationAllowed + * + * @return CGroupInfo + */ + public function setSelfUnregistrationAllowed($selfUnregistrationAllowed) + { + $this->selfUnregistrationAllowed = $selfUnregistrationAllowed; + + return $this; + } + + /** + * Get selfUnregistrationAllowed. + * + * @return bool + */ + public function getSelfUnregistrationAllowed() + { + return $this->selfUnregistrationAllowed; + } + + /** + * Set sessionId. + * + * @param int $sessionId + * + * @return CGroupInfo + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * Get sessionId. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * Set id. + * + * @param int $id + * + * @return CGroupInfo + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CGroupInfo + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CGroupRelTutor.php b/src/Chamilo/CourseBundle/Entity/CGroupRelTutor.php new file mode 100644 index 000000000..ae71a80b9 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CGroupRelTutor.php @@ -0,0 +1,153 @@ +userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set groupId. + * + * @param int $groupId + * + * @return CGroupRelTutor + */ + public function setGroupId($groupId) + { + $this->groupId = $groupId; + + return $this; + } + + /** + * Get groupId. + * + * @return int + */ + public function getGroupId() + { + return $this->groupId; + } + + /** + * Set id. + * + * @param int $id + * + * @return CGroupRelTutor + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CGroupRelTutor + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CGroupRelUser.php b/src/Chamilo/CourseBundle/Entity/CGroupRelUser.php new file mode 100644 index 000000000..2953ddc01 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CGroupRelUser.php @@ -0,0 +1,215 @@ +userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set groupId. + * + * @param int $groupId + * + * @return CGroupRelUser + */ + public function setGroupId($groupId) + { + $this->groupId = $groupId; + + return $this; + } + + /** + * Get groupId. + * + * @return int + */ + public function getGroupId() + { + return $this->groupId; + } + + /** + * Set status. + * + * @param int $status + * + * @return CGroupRelUser + */ + public function setStatus($status) + { + $this->status = $status; + + return $this; + } + + /** + * Get status. + * + * @return int + */ + public function getStatus() + { + return $this->status; + } + + /** + * Set role. + * + * @param string $role + * + * @return CGroupRelUser + */ + public function setRole($role) + { + $this->role = $role; + + return $this; + } + + /** + * Get role. + * + * @return string + */ + public function getRole() + { + return $this->role; + } + + /** + * Set id. + * + * @param int $id + * + * @return CGroupRelUser + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CGroupRelUser + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CItemProperty.php b/src/Chamilo/CourseBundle/Entity/CItemProperty.php new file mode 100644 index 000000000..f66ddf81e --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CItemProperty.php @@ -0,0 +1,484 @@ +visibility = 1; + $this->course = $course; + $this->insertDate = new \DateTime('now', new \DateTimeZone('UTC')); + $this->lasteditDate = new \DateTime('now', new \DateTimeZone('UTC')); + } + + /** + * Set tool. + * + * @param string $tool + * + * @return CItemProperty + */ + public function setTool($tool) + { + $this->tool = $tool; + + return $this; + } + + /** + * Get tool. + * + * @return string + */ + public function getTool() + { + return $this->tool; + } + + /** + * Set insertDate. + * + * @param \DateTime $insertDate + * + * @return CItemProperty + */ + public function setInsertDate($insertDate) + { + $this->insertDate = $insertDate; + + return $this; + } + + /** + * Get insertDate. + * + * @return \DateTime + */ + public function getInsertDate() + { + return $this->insertDate; + } + + /** + * Set lasteditDate. + * + * @return CItemProperty + */ + public function setLasteditDate(\DateTime $lasteditDate) + { + $this->lasteditDate = $lasteditDate; + + return $this; + } + + /** + * Get lasteditDate. + * + * @return \DateTime + */ + public function getLasteditDate() + { + return $this->lasteditDate; + } + + /** + * Set ref. + * + * @param int $ref + * + * @return CItemProperty + */ + public function setRef($ref) + { + $this->ref = $ref; + + return $this; + } + + /** + * Get ref. + * + * @return int + */ + public function getRef() + { + return $this->ref; + } + + /** + * Set lasteditType. + * + * @param string $lasteditType + * + * @return CItemProperty + */ + public function setLasteditType($lasteditType) + { + $this->lasteditType = $lasteditType; + + return $this; + } + + /** + * Get lasteditType. + * + * @return string + */ + public function getLasteditType() + { + return $this->lasteditType; + } + + /** + * Set lasteditUserId. + * + * @param int $lasteditUserId + * + * @return CItemProperty + */ + public function setLasteditUserId($lasteditUserId) + { + $this->lasteditUserId = $lasteditUserId; + + return $this; + } + + /** + * Get lasteditUserId. + * + * @return int + */ + public function getLasteditUserId() + { + return $this->lasteditUserId; + } + + /** + * Set visibility. + * + * @param int $visibility + * + * @return CItemProperty + */ + public function setVisibility($visibility) + { + $this->visibility = $visibility; + + return $this; + } + + /** + * Get visibility. + * + * @return int + */ + public function getVisibility() + { + return $this->visibility; + } + + /** + * Set startVisible. + * + * @param \DateTime $startVisible + * + * @return CItemProperty + */ + public function setStartVisible(\DateTime $startVisible = null) + { + $this->startVisible = $startVisible; + + return $this; + } + + /** + * Get startVisible. + * + * @return \DateTime + */ + public function getStartVisible() + { + return $this->startVisible; + } + + /** + * Set endVisible. + * + * @param \DateTime $endVisible + * + * @return CItemProperty + */ + public function setEndVisible(\DateTime $endVisible = null) + { + $this->endVisible = $endVisible; + + return $this; + } + + /** + * Get endVisible. + * + * @return \DateTime + */ + public function getEndVisible() + { + return $this->endVisible; + } + + /** + * Set id. + * + * @param int $id + * + * @return CItemProperty + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * @return Session + */ + public function getSession() + { + return $this->session; + } + + /** + * @param Session $session + * + * @return CItemProperty + */ + public function setSession($session) + { + $this->session = $session; + + return $this; + } + + /** + * @return Course + */ + public function getCourse() + { + return $this->course; + } + + /** + * @param Course $course + * + * @return CItemProperty + */ + public function setCourse($course) + { + $this->course = $course; + + return $this; + } + + /** + * @return CgroupInfo + */ + public function getGroup() + { + return $this->group; + } + + /** + * @param CgroupInfo $group + * + * @return CItemProperty + */ + public function setGroup($group) + { + $this->group = $group; + + return $this; + } + + /** + * @return User + */ + public function getToUser() + { + return $this->toUser; + } + + /** + * @param User $toUser + * + * @return $this + */ + public function setToUser($toUser) + { + $this->toUser = $toUser; + + return $this; + } + + /** + * @return User + */ + public function getInsertUser() + { + return $this->insertUser; + } + + /** + * @return $this + */ + public function setInsertUser(User $insertUser) + { + $this->insertUser = $insertUser; + $this->lasteditUserId = $insertUser->getId(); + + return $this; + } + + /** + * Get iid. + * + * @return int + */ + public function getIid() + { + return $this->iid; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CLink.php b/src/Chamilo/CourseBundle/Entity/CLink.php new file mode 100644 index 000000000..646958742 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CLink.php @@ -0,0 +1,340 @@ +url = $url; + + return $this; + } + + /** + * Get url. + * + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * Set title. + * + * @param string $title + * + * @return CLink + */ + public function setTitle($title) + { + $this->title = $title; + + return $this; + } + + /** + * Get title. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set description. + * + * @param string $description + * + * @return CLink + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * Get description. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Set categoryId. + * + * @param int $categoryId + * + * @return CLink + */ + public function setCategoryId($categoryId) + { + $this->categoryId = $categoryId; + + return $this; + } + + /** + * Get categoryId. + * + * @return int + */ + public function getCategoryId() + { + return $this->categoryId; + } + + /** + * Set displayOrder. + * + * @param int $displayOrder + * + * @return CLink + */ + public function setDisplayOrder($displayOrder) + { + $this->displayOrder = $displayOrder; + + return $this; + } + + /** + * Get displayOrder. + * + * @return int + */ + public function getDisplayOrder() + { + return $this->displayOrder; + } + + /** + * Set onHomepage. + * + * @param string $onHomepage + * + * @return CLink + */ + public function setOnHomepage($onHomepage) + { + $this->onHomepage = $onHomepage; + + return $this; + } + + /** + * Get onHomepage. + * + * @return string + */ + public function getOnHomepage() + { + return $this->onHomepage; + } + + /** + * Set target. + * + * @param string $target + * + * @return CLink + */ + public function setTarget($target) + { + $this->target = $target; + + return $this; + } + + /** + * Get target. + * + * @return string + */ + public function getTarget() + { + return $this->target; + } + + /** + * Set sessionId. + * + * @param int $sessionId + * + * @return CLink + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * Get sessionId. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * Set id. + * + * @param int $id + * + * @return CLink + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CLink + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CLinkCategory.php b/src/Chamilo/CourseBundle/Entity/CLinkCategory.php new file mode 100644 index 000000000..4dcdc5684 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CLinkCategory.php @@ -0,0 +1,216 @@ +categoryTitle = $categoryTitle; + + return $this; + } + + /** + * Get categoryTitle. + * + * @return string + */ + public function getCategoryTitle() + { + return $this->categoryTitle; + } + + /** + * Set description. + * + * @param string $description + * + * @return CLinkCategory + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * Get description. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Set displayOrder. + * + * @param int $displayOrder + * + * @return CLinkCategory + */ + public function setDisplayOrder($displayOrder) + { + $this->displayOrder = $displayOrder; + + return $this; + } + + /** + * Get displayOrder. + * + * @return int + */ + public function getDisplayOrder() + { + return $this->displayOrder; + } + + /** + * Set sessionId. + * + * @param int $sessionId + * + * @return CLinkCategory + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * Get sessionId. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * Set id. + * + * @param int $id + * + * @return CLinkCategory + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CLinkCategory + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CLp.php b/src/Chamilo/CourseBundle/Entity/CLp.php new file mode 100644 index 000000000..74142893d --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CLp.php @@ -0,0 +1,1073 @@ +defaultViewMod = 'embedded'; + $this->defaultEncoding = 'UTF-8'; + $this->displayOrder = 0; + $this->contentLocal = 'local'; + $this->preventReinit = true; + $this->useMaxScore = 1; + $this->createdOn = new \DateTime(); + } + + /** + * Set lpType. + * + * @param int $lpType + * + * @return CLp + */ + public function setLpType($lpType) + { + $this->lpType = $lpType; + + return $this; + } + + /** + * Get lpType. + * + * @return int + */ + public function getLpType() + { + return $this->lpType; + } + + /** + * Set name. + * + * @param string $name + * + * @return CLp + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * Get name. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set ref. + * + * @param string $ref + * + * @return CLp + */ + public function setRef($ref) + { + $this->ref = $ref; + + return $this; + } + + /** + * Get ref. + * + * @return string + */ + public function getRef() + { + return $this->ref; + } + + /** + * Set description. + * + * @param string $description + * + * @return CLp + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * Get description. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Set path. + * + * @param string $path + * + * @return CLp + */ + public function setPath($path) + { + $this->path = $path; + + return $this; + } + + /** + * Get path. + * + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** + * Set forceCommit. + * + * @param bool $forceCommit + * + * @return CLp + */ + public function setForceCommit($forceCommit) + { + $this->forceCommit = $forceCommit; + + return $this; + } + + /** + * Get forceCommit. + * + * @return bool + */ + public function getForceCommit() + { + return $this->forceCommit; + } + + /** + * Set defaultViewMod. + * + * @param string $defaultViewMod + * + * @return CLp + */ + public function setDefaultViewMod($defaultViewMod) + { + $this->defaultViewMod = $defaultViewMod; + + return $this; + } + + /** + * Get defaultViewMod. + * + * @return string + */ + public function getDefaultViewMod() + { + return $this->defaultViewMod; + } + + /** + * Set defaultEncoding. + * + * @param string $defaultEncoding + * + * @return CLp + */ + public function setDefaultEncoding($defaultEncoding) + { + $this->defaultEncoding = $defaultEncoding; + + return $this; + } + + /** + * Get defaultEncoding. + * + * @return string + */ + public function getDefaultEncoding() + { + return $this->defaultEncoding; + } + + /** + * Set displayOrder. + * + * @param int $displayOrder + * + * @return CLp + */ + public function setDisplayOrder($displayOrder) + { + $this->displayOrder = $displayOrder; + + return $this; + } + + /** + * Get displayOrder. + * + * @return int + */ + public function getDisplayOrder() + { + return $this->displayOrder; + } + + /** + * Set contentMaker. + * + * @param string $contentMaker + * + * @return CLp + */ + public function setContentMaker($contentMaker) + { + $this->contentMaker = $contentMaker; + + return $this; + } + + /** + * Get contentMaker. + * + * @return string + */ + public function getContentMaker() + { + return $this->contentMaker; + } + + /** + * Set contentLocal. + * + * @param string $contentLocal + * + * @return CLp + */ + public function setContentLocal($contentLocal) + { + $this->contentLocal = $contentLocal; + + return $this; + } + + /** + * Get contentLocal. + * + * @return string + */ + public function getContentLocal() + { + return $this->contentLocal; + } + + /** + * Set contentLicense. + * + * @param string $contentLicense + * + * @return CLp + */ + public function setContentLicense($contentLicense) + { + $this->contentLicense = $contentLicense; + + return $this; + } + + /** + * Get contentLicense. + * + * @return string + */ + public function getContentLicense() + { + return $this->contentLicense; + } + + /** + * Set preventReinit. + * + * @param bool $preventReinit + * + * @return CLp + */ + public function setPreventReinit($preventReinit) + { + $this->preventReinit = $preventReinit; + + return $this; + } + + /** + * Get preventReinit. + * + * @return bool + */ + public function getPreventReinit() + { + return $this->preventReinit; + } + + /** + * Set jsLib. + * + * @param string $jsLib + * + * @return CLp + */ + public function setJsLib($jsLib) + { + $this->jsLib = $jsLib; + + return $this; + } + + /** + * Get jsLib. + * + * @return string + */ + public function getJsLib() + { + return $this->jsLib; + } + + /** + * Set debug. + * + * @param bool $debug + * + * @return CLp + */ + public function setDebug($debug) + { + $this->debug = $debug; + + return $this; + } + + /** + * Get debug. + * + * @return bool + */ + public function getDebug() + { + return $this->debug; + } + + /** + * Set theme. + * + * @param string $theme + * + * @return CLp + */ + public function setTheme($theme) + { + $this->theme = $theme; + + return $this; + } + + /** + * Get theme. + * + * @return string + */ + public function getTheme() + { + return $this->theme; + } + + /** + * Set previewImage. + * + * @param string $previewImage + * + * @return CLp + */ + public function setPreviewImage($previewImage) + { + $this->previewImage = $previewImage; + + return $this; + } + + /** + * Get previewImage. + * + * @return string + */ + public function getPreviewImage() + { + return $this->previewImage; + } + + /** + * Set author. + * + * @param string $author + * + * @return CLp + */ + public function setAuthor($author) + { + $this->author = $author; + + return $this; + } + + /** + * Get author. + * + * @return string + */ + public function getAuthor() + { + return $this->author; + } + + /** + * Set sessionId. + * + * @param int $sessionId + * + * @return CLp + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * Get sessionId. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * Set prerequisite. + * + * @param int $prerequisite + * + * @return CLp + */ + public function setPrerequisite($prerequisite) + { + $this->prerequisite = $prerequisite; + + return $this; + } + + /** + * Get prerequisite. + * + * @return int + */ + public function getPrerequisite() + { + return $this->prerequisite; + } + + /** + * Set hideTocFrame. + * + * @param bool $hideTocFrame + * + * @return CLp + */ + public function setHideTocFrame($hideTocFrame) + { + $this->hideTocFrame = $hideTocFrame; + + return $this; + } + + /** + * Get hideTocFrame. + * + * @return bool + */ + public function getHideTocFrame() + { + return $this->hideTocFrame; + } + + /** + * Set seriousgameMode. + * + * @param bool $seriousgameMode + * + * @return CLp + */ + public function setSeriousgameMode($seriousgameMode) + { + $this->seriousgameMode = $seriousgameMode; + + return $this; + } + + /** + * Get seriousgameMode. + * + * @return bool + */ + public function getSeriousgameMode() + { + return $this->seriousgameMode; + } + + /** + * Set useMaxScore. + * + * @param int $useMaxScore + * + * @return CLp + */ + public function setUseMaxScore($useMaxScore) + { + $this->useMaxScore = $useMaxScore; + + return $this; + } + + /** + * Get useMaxScore. + * + * @return int + */ + public function getUseMaxScore() + { + return $this->useMaxScore; + } + + /** + * Set autolaunch. + * + * @param int $autolaunch + * + * @return CLp + */ + public function setAutolaunch($autolaunch) + { + $this->autolaunch = $autolaunch; + + return $this; + } + + /** + * Get autolaunch. + * + * @return int + */ + public function getAutolaunch() + { + return $this->autolaunch; + } + + /** + * Set createdOn. + * + * @param \DateTime $createdOn + * + * @return CLp + */ + public function setCreatedOn($createdOn) + { + $this->createdOn = $createdOn; + + return $this; + } + + /** + * Get createdOn. + * + * @return \DateTime + */ + public function getCreatedOn() + { + return $this->createdOn; + } + + /** + * Set modifiedOn. + * + * @param \DateTime $modifiedOn + * + * @return CLp + */ + public function setModifiedOn($modifiedOn) + { + $this->modifiedOn = $modifiedOn; + + return $this; + } + + /** + * Get modifiedOn. + * + * @return \DateTime + */ + public function getModifiedOn() + { + return $this->modifiedOn; + } + + /** + * Set publicatedOn. + * + * @param \DateTime $publicatedOn + * + * @return CLp + */ + public function setPublicatedOn($publicatedOn) + { + $this->publicatedOn = $publicatedOn; + + return $this; + } + + /** + * Get publicatedOn. + * + * @return \DateTime + */ + public function getPublicatedOn() + { + return $this->publicatedOn; + } + + /** + * Set expiredOn. + * + * @param \DateTime $expiredOn + * + * @return CLp + */ + public function setExpiredOn($expiredOn) + { + $this->expiredOn = $expiredOn; + + return $this; + } + + /** + * Get expiredOn. + * + * @return \DateTime + */ + public function getExpiredOn() + { + return $this->expiredOn; + } + + /** + * Set id. + * + * @param int $id + * + * @return CLp + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CLp + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * @return int + */ + public function getCategoryId() + { + return $this->categoryId; + } + + /** + * @param int $categoryId + * + * @return CLp + */ + public function setCategoryId($categoryId) + { + $this->categoryId = $categoryId; + + return $this; + } + + public function getAccumulateScormTime(): int + { + return $this->accumulateScormTime; + } + + public function setAccumulateScormTime(int $accumulateScormTime): CLp + { + $this->accumulateScormTime = $accumulateScormTime; + + return $this; + } + + /** + * Get iid. + * + * @return int + */ + public function getIid() + { + return $this->iid; + } + + /** + * Get subscribeUsers. + * + * @return int + */ + public function getSubscribeUsers() + { + return $this->subscribeUsers; + } + + public function setSubscribeUsers(int $subscribeUsers): CLp + { + $this->subscribeUsers = $subscribeUsers; + + return $this; + } + + public function getMaxAttempts(): int + { + return $this->maxAttempts; + } + + public function setMaxAttempts(int $maxAttempts): CLp + { + $this->maxAttempts = $maxAttempts; + + return $this; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CLpCategory.php b/src/Chamilo/CourseBundle/Entity/CLpCategory.php new file mode 100644 index 000000000..6b0d3c363 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CLpCategory.php @@ -0,0 +1,260 @@ +users = new ArrayCollection(); + $this->sessionId = 0; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CLpCategory + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Set id. + * + * @param int $id + * + * @return CLpCategory + */ + public function setId($id) + { + $this->iid = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->iid; + } + + /** + * @param $name + * + * @return $this + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * Get category name. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @param $position + * + * @return $this + */ + public function setPosition($position) + { + $this->position = $position; + + return $this; + } + + /** + * @return int + */ + public function getPosition() + { + return $this->position; + } + + /** + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * @param int $sessionId + * + * @return CLpCategory + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * @return ArrayCollection|CLpCategoryUser[] + */ + public function getUsers() + { + return $this->users; + } + + /** + * @param $users + */ + public function setUsers($users) + { + $this->users = new ArrayCollection(); + + foreach ($users as $user) { + $this->addUser($user); + } + } + + public function addUser(CLpCategoryUser $categoryUser) + { + $categoryUser->setCategory($this); + + if (!$this->hasUser($categoryUser)) { + $this->users->add($categoryUser); + } + } + + /** + * @return bool + */ + public function hasUser(CLpCategoryUser $categoryUser) + { + if ($this->getUsers()->count()) { + $criteria = Criteria::create()->where( + Criteria::expr()->eq("user", $categoryUser->getUser()) + )->andWhere( + Criteria::expr()->eq("category", $categoryUser->getCategory()) + ); + + $relation = $this->getUsers()->matching($criteria); + + return $relation->count() > 0; + } + + return false; + } + + /** + * @param User $user + * + * @return bool + */ + public function hasUserAdded($user) + { + if ($this->getUsers()->count()) { + $categoryUser = new CLpCategoryUser(); + $categoryUser->setCategory($this); + $categoryUser->setUser($user); + + return $this->hasUser($categoryUser); + } + + return false; + } + + /** + * @return $this + */ + public function removeUsers(CLpCategoryUser $user) + { + $this->users->removeElement($user); + + return $this; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CLpCategoryUser.php b/src/Chamilo/CourseBundle/Entity/CLpCategoryUser.php new file mode 100644 index 000000000..e49179318 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CLpCategoryUser.php @@ -0,0 +1,107 @@ +getId(); + } + + /** + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * @param int $id + * + * @return CLpCategoryUser + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * @return CLpCategory + */ + public function getCategory() + { + return $this->category; + } + + /** + * @param CLpCategory $category + * + * @return CLpCategoryUser + */ + public function setCategory($category) + { + $this->category = $category; + + return $this; + } + + /** + * @return User + */ + public function getUser() + { + return $this->user; + } + + /** + * @param User $user + * + * @return CLpCategoryUser + */ + public function setUser($user) + { + $this->user = $user; + + return $this; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CLpItem.php b/src/Chamilo/CourseBundle/Entity/CLpItem.php new file mode 100644 index 000000000..9515cf042 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CLpItem.php @@ -0,0 +1,783 @@ +maxScore = 100.0; + } + + /** + * Set lpId. + * + * @param int $lpId + * + * @return CLpItem + */ + public function setLpId($lpId) + { + $this->lpId = $lpId; + + return $this; + } + + /** + * Get lpId. + * + * @return int + */ + public function getLpId() + { + return $this->lpId; + } + + /** + * Set itemType. + * + * @param string $itemType + * + * @return CLpItem + */ + public function setItemType($itemType) + { + $this->itemType = $itemType; + + return $this; + } + + /** + * Get itemType. + * + * @return string + */ + public function getItemType() + { + return $this->itemType; + } + + /** + * Set ref. + * + * @param string $ref + * + * @return CLpItem + */ + public function setRef($ref) + { + $this->ref = $ref; + + return $this; + } + + /** + * Get ref. + * + * @return string + */ + public function getRef() + { + return $this->ref; + } + + /** + * Set title. + * + * @param string $title + * + * @return CLpItem + */ + public function setTitle($title) + { + $this->title = $title; + + return $this; + } + + /** + * Get title. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set description. + * + * @param string $description + * + * @return CLpItem + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * Get description. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Set path. + * + * @param string $path + * + * @return CLpItem + */ + public function setPath($path) + { + $this->path = $path; + + return $this; + } + + /** + * Get path. + * + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** + * Set minScore. + * + * @param float $minScore + * + * @return CLpItem + */ + public function setMinScore($minScore) + { + $this->minScore = $minScore; + + return $this; + } + + /** + * Get minScore. + * + * @return float + */ + public function getMinScore() + { + return $this->minScore; + } + + /** + * Set maxScore. + * + * @param float $maxScore + * + * @return CLpItem + */ + public function setMaxScore($maxScore) + { + $this->maxScore = $maxScore; + + return $this; + } + + /** + * Get maxScore. + * + * @return float + */ + public function getMaxScore() + { + return $this->maxScore; + } + + /** + * Set masteryScore. + * + * @param float $masteryScore + * + * @return CLpItem + */ + public function setMasteryScore($masteryScore) + { + $this->masteryScore = $masteryScore; + + return $this; + } + + /** + * Get masteryScore. + * + * @return float + */ + public function getMasteryScore() + { + return $this->masteryScore; + } + + /** + * Set parentItemId. + * + * @param int $parentItemId + * + * @return CLpItem + */ + public function setParentItemId($parentItemId) + { + $this->parentItemId = $parentItemId; + + return $this; + } + + /** + * Get parentItemId. + * + * @return int + */ + public function getParentItemId() + { + return $this->parentItemId; + } + + /** + * Set previousItemId. + * + * @param int $previousItemId + * + * @return CLpItem + */ + public function setPreviousItemId($previousItemId) + { + $this->previousItemId = $previousItemId; + + return $this; + } + + /** + * Get previousItemId. + * + * @return int + */ + public function getPreviousItemId() + { + return $this->previousItemId; + } + + /** + * Set nextItemId. + * + * @param int $nextItemId + * + * @return CLpItem + */ + public function setNextItemId($nextItemId) + { + $this->nextItemId = $nextItemId; + + return $this; + } + + /** + * Get nextItemId. + * + * @return int + */ + public function getNextItemId() + { + return $this->nextItemId; + } + + /** + * Set displayOrder. + * + * @param int $displayOrder + * + * @return CLpItem + */ + public function setDisplayOrder($displayOrder) + { + $this->displayOrder = $displayOrder; + + return $this; + } + + /** + * Get displayOrder. + * + * @return int + */ + public function getDisplayOrder() + { + return $this->displayOrder; + } + + /** + * Set prerequisite. + * + * @param string $prerequisite + * + * @return CLpItem + */ + public function setPrerequisite($prerequisite) + { + $this->prerequisite = $prerequisite; + + return $this; + } + + /** + * Get prerequisite. + * + * @return string + */ + public function getPrerequisite() + { + return $this->prerequisite; + } + + /** + * Set parameters. + * + * @param string $parameters + * + * @return CLpItem + */ + public function setParameters($parameters) + { + $this->parameters = $parameters; + + return $this; + } + + /** + * Get parameters. + * + * @return string + */ + public function getParameters() + { + return $this->parameters; + } + + /** + * Set launchData. + * + * @param string $launchData + * + * @return CLpItem + */ + public function setLaunchData($launchData) + { + $this->launchData = $launchData; + + return $this; + } + + /** + * Get launchData. + * + * @return string + */ + public function getLaunchData() + { + return $this->launchData; + } + + /** + * Set maxTimeAllowed. + * + * @param string $maxTimeAllowed + * + * @return CLpItem + */ + public function setMaxTimeAllowed($maxTimeAllowed) + { + $this->maxTimeAllowed = $maxTimeAllowed; + + return $this; + } + + /** + * Get maxTimeAllowed. + * + * @return string + */ + public function getMaxTimeAllowed() + { + return $this->maxTimeAllowed; + } + + /** + * Set terms. + * + * @param string $terms + * + * @return CLpItem + */ + public function setTerms($terms) + { + $this->terms = $terms; + + return $this; + } + + /** + * Get terms. + * + * @return string + */ + public function getTerms() + { + return $this->terms; + } + + /** + * Set searchDid. + * + * @param int $searchDid + * + * @return CLpItem + */ + public function setSearchDid($searchDid) + { + $this->searchDid = $searchDid; + + return $this; + } + + /** + * Get searchDid. + * + * @return int + */ + public function getSearchDid() + { + return $this->searchDid; + } + + /** + * Set audio. + * + * @param string $audio + * + * @return CLpItem + */ + public function setAudio($audio) + { + $this->audio = $audio; + + return $this; + } + + /** + * Get audio. + * + * @return string + */ + public function getAudio() + { + return $this->audio; + } + + /** + * Set prerequisiteMinScore. + * + * @param float $prerequisiteMinScore + * + * @return CLpItem + */ + public function setPrerequisiteMinScore($prerequisiteMinScore) + { + $this->prerequisiteMinScore = $prerequisiteMinScore; + + return $this; + } + + /** + * Get prerequisiteMinScore. + * + * @return float + */ + public function getPrerequisiteMinScore() + { + return $this->prerequisiteMinScore; + } + + /** + * Set prerequisiteMaxScore. + * + * @param float $prerequisiteMaxScore + * + * @return CLpItem + */ + public function setPrerequisiteMaxScore($prerequisiteMaxScore) + { + $this->prerequisiteMaxScore = $prerequisiteMaxScore; + + return $this; + } + + /** + * Get prerequisiteMaxScore. + * + * @return float + */ + public function getPrerequisiteMaxScore() + { + return $this->prerequisiteMaxScore; + } + + /** + * Set id. + * + * @param int $id + * + * @return CLpItem + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CLpItem + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CLpItemView.php b/src/Chamilo/CourseBundle/Entity/CLpItemView.php new file mode 100644 index 000000000..6dd5d57a5 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CLpItemView.php @@ -0,0 +1,444 @@ +status = 'not attempted'; + $this->coreExit = 'none'; + } + + /** + * Set lpItemId. + * + * @param int $lpItemId + * + * @return CLpItemView + */ + public function setLpItemId($lpItemId) + { + $this->lpItemId = $lpItemId; + + return $this; + } + + /** + * Get lpItemId. + * + * @return int + */ + public function getLpItemId() + { + return $this->lpItemId; + } + + /** + * Set lpViewId. + * + * @param int $lpViewId + * + * @return CLpItemView + */ + public function setLpViewId($lpViewId) + { + $this->lpViewId = $lpViewId; + + return $this; + } + + /** + * Get lpViewId. + * + * @return int + */ + public function getLpViewId() + { + return $this->lpViewId; + } + + /** + * Set viewCount. + * + * @param int $viewCount + * + * @return CLpItemView + */ + public function setViewCount($viewCount) + { + $this->viewCount = $viewCount; + + return $this; + } + + /** + * Get viewCount. + * + * @return int + */ + public function getViewCount() + { + return $this->viewCount; + } + + /** + * Set startTime. + * + * @param int $startTime + * + * @return CLpItemView + */ + public function setStartTime($startTime) + { + $this->startTime = $startTime; + + return $this; + } + + /** + * Get startTime. + * + * @return int + */ + public function getStartTime() + { + return $this->startTime; + } + + /** + * Set totalTime. + * + * @param int $totalTime + * + * @return CLpItemView + */ + public function setTotalTime($totalTime) + { + $this->totalTime = $totalTime; + + return $this; + } + + /** + * Get totalTime. + * + * @return int + */ + public function getTotalTime() + { + return $this->totalTime; + } + + /** + * Set score. + * + * @param float $score + * + * @return CLpItemView + */ + public function setScore($score) + { + $this->score = $score; + + return $this; + } + + /** + * Get score. + * + * @return float + */ + public function getScore() + { + return $this->score; + } + + /** + * Set status. + * + * @param string $status + * + * @return CLpItemView + */ + public function setStatus($status) + { + $this->status = $status; + + return $this; + } + + /** + * Get status. + * + * @return string + */ + public function getStatus() + { + return $this->status; + } + + /** + * Set suspendData. + * + * @param string $suspendData + * + * @return CLpItemView + */ + public function setSuspendData($suspendData) + { + $this->suspendData = $suspendData; + + return $this; + } + + /** + * Get suspendData. + * + * @return string + */ + public function getSuspendData() + { + return $this->suspendData; + } + + /** + * Set lessonLocation. + * + * @param string $lessonLocation + * + * @return CLpItemView + */ + public function setLessonLocation($lessonLocation) + { + $this->lessonLocation = $lessonLocation; + + return $this; + } + + /** + * Get lessonLocation. + * + * @return string + */ + public function getLessonLocation() + { + return $this->lessonLocation; + } + + /** + * Set coreExit. + * + * @param string $coreExit + * + * @return CLpItemView + */ + public function setCoreExit($coreExit) + { + $this->coreExit = $coreExit; + + return $this; + } + + /** + * Get coreExit. + * + * @return string + */ + public function getCoreExit() + { + return $this->coreExit; + } + + /** + * Set maxScore. + * + * @param string $maxScore + * + * @return CLpItemView + */ + public function setMaxScore($maxScore) + { + $this->maxScore = $maxScore; + + return $this; + } + + /** + * Get maxScore. + * + * @return string + */ + public function getMaxScore() + { + return $this->maxScore; + } + + /** + * Set id. + * + * @param int $id + * + * @return CLpItemView + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CLpItemView + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CLpIvInteraction.php b/src/Chamilo/CourseBundle/Entity/CLpIvInteraction.php new file mode 100644 index 000000000..0a2549839 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CLpIvInteraction.php @@ -0,0 +1,402 @@ +orderId = $orderId; + + return $this; + } + + /** + * Get orderId. + * + * @return int + */ + public function getOrderId() + { + return $this->orderId; + } + + /** + * Set lpIvId. + * + * @param int $lpIvId + * + * @return CLpIvInteraction + */ + public function setLpIvId($lpIvId) + { + $this->lpIvId = $lpIvId; + + return $this; + } + + /** + * Get lpIvId. + * + * @return int + */ + public function getLpIvId() + { + return $this->lpIvId; + } + + /** + * Set interactionId. + * + * @param string $interactionId + * + * @return CLpIvInteraction + */ + public function setInteractionId($interactionId) + { + $this->interactionId = $interactionId; + + return $this; + } + + /** + * Get interactionId. + * + * @return string + */ + public function getInteractionId() + { + return $this->interactionId; + } + + /** + * Set interactionType. + * + * @param string $interactionType + * + * @return CLpIvInteraction + */ + public function setInteractionType($interactionType) + { + $this->interactionType = $interactionType; + + return $this; + } + + /** + * Get interactionType. + * + * @return string + */ + public function getInteractionType() + { + return $this->interactionType; + } + + /** + * Set weighting. + * + * @param float $weighting + * + * @return CLpIvInteraction + */ + public function setWeighting($weighting) + { + $this->weighting = $weighting; + + return $this; + } + + /** + * Get weighting. + * + * @return float + */ + public function getWeighting() + { + return $this->weighting; + } + + /** + * Set completionTime. + * + * @param string $completionTime + * + * @return CLpIvInteraction + */ + public function setCompletionTime($completionTime) + { + $this->completionTime = $completionTime; + + return $this; + } + + /** + * Get completionTime. + * + * @return string + */ + public function getCompletionTime() + { + return $this->completionTime; + } + + /** + * Set correctResponses. + * + * @param string $correctResponses + * + * @return CLpIvInteraction + */ + public function setCorrectResponses($correctResponses) + { + $this->correctResponses = $correctResponses; + + return $this; + } + + /** + * Get correctResponses. + * + * @return string + */ + public function getCorrectResponses() + { + return $this->correctResponses; + } + + /** + * Set studentResponse. + * + * @param string $studentResponse + * + * @return CLpIvInteraction + */ + public function setStudentResponse($studentResponse) + { + $this->studentResponse = $studentResponse; + + return $this; + } + + /** + * Get studentResponse. + * + * @return string + */ + public function getStudentResponse() + { + return $this->studentResponse; + } + + /** + * Set result. + * + * @param string $result + * + * @return CLpIvInteraction + */ + public function setResult($result) + { + $this->result = $result; + + return $this; + } + + /** + * Get result. + * + * @return string + */ + public function getResult() + { + return $this->result; + } + + /** + * Set latency. + * + * @param string $latency + * + * @return CLpIvInteraction + */ + public function setLatency($latency) + { + $this->latency = $latency; + + return $this; + } + + /** + * Get latency. + * + * @return string + */ + public function getLatency() + { + return $this->latency; + } + + /** + * Set id. + * + * @param int $id + * + * @return CLpIvInteraction + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CLpIvInteraction + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CLpIvObjective.php b/src/Chamilo/CourseBundle/Entity/CLpIvObjective.php new file mode 100644 index 000000000..a86cf6dd8 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CLpIvObjective.php @@ -0,0 +1,309 @@ +lpIvId = $lpIvId; + + return $this; + } + + /** + * Get lpIvId. + * + * @return int + */ + public function getLpIvId() + { + return $this->lpIvId; + } + + /** + * Set orderId. + * + * @param int $orderId + * + * @return CLpIvObjective + */ + public function setOrderId($orderId) + { + $this->orderId = $orderId; + + return $this; + } + + /** + * Get orderId. + * + * @return int + */ + public function getOrderId() + { + return $this->orderId; + } + + /** + * Set objectiveId. + * + * @param string $objectiveId + * + * @return CLpIvObjective + */ + public function setObjectiveId($objectiveId) + { + $this->objectiveId = $objectiveId; + + return $this; + } + + /** + * Get objectiveId. + * + * @return string + */ + public function getObjectiveId() + { + return $this->objectiveId; + } + + /** + * Set scoreRaw. + * + * @param float $scoreRaw + * + * @return CLpIvObjective + */ + public function setScoreRaw($scoreRaw) + { + $this->scoreRaw = $scoreRaw; + + return $this; + } + + /** + * Get scoreRaw. + * + * @return float + */ + public function getScoreRaw() + { + return $this->scoreRaw; + } + + /** + * Set scoreMax. + * + * @param float $scoreMax + * + * @return CLpIvObjective + */ + public function setScoreMax($scoreMax) + { + $this->scoreMax = $scoreMax; + + return $this; + } + + /** + * Get scoreMax. + * + * @return float + */ + public function getScoreMax() + { + return $this->scoreMax; + } + + /** + * Set scoreMin. + * + * @param float $scoreMin + * + * @return CLpIvObjective + */ + public function setScoreMin($scoreMin) + { + $this->scoreMin = $scoreMin; + + return $this; + } + + /** + * Get scoreMin. + * + * @return float + */ + public function getScoreMin() + { + return $this->scoreMin; + } + + /** + * Set status. + * + * @param string $status + * + * @return CLpIvObjective + */ + public function setStatus($status) + { + $this->status = $status; + + return $this; + } + + /** + * Get status. + * + * @return string + */ + public function getStatus() + { + return $this->status; + } + + /** + * Set id. + * + * @param int $id + * + * @return CLpIvObjective + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CLpIvObjective + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CLpView.php b/src/Chamilo/CourseBundle/Entity/CLpView.php new file mode 100644 index 000000000..a8b6fbfdf --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CLpView.php @@ -0,0 +1,280 @@ +lpId = $lpId; + + return $this; + } + + /** + * Get lpId. + * + * @return int + */ + public function getLpId() + { + return $this->lpId; + } + + /** + * Set userId. + * + * @param int $userId + * + * @return CLpView + */ + public function setUserId($userId) + { + $this->userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set viewCount. + * + * @param int $viewCount + * + * @return CLpView + */ + public function setViewCount($viewCount) + { + $this->viewCount = $viewCount; + + return $this; + } + + /** + * Get viewCount. + * + * @return int + */ + public function getViewCount() + { + return $this->viewCount; + } + + /** + * Set lastItem. + * + * @param int $lastItem + * + * @return CLpView + */ + public function setLastItem($lastItem) + { + $this->lastItem = $lastItem; + + return $this; + } + + /** + * Get lastItem. + * + * @return int + */ + public function getLastItem() + { + return $this->lastItem; + } + + /** + * Set progress. + * + * @param int $progress + * + * @return CLpView + */ + public function setProgress($progress) + { + $this->progress = $progress; + + return $this; + } + + /** + * Get progress. + * + * @return int + */ + public function getProgress() + { + return $this->progress; + } + + /** + * Set sessionId. + * + * @param int $sessionId + * + * @return CLpView + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * Get sessionId. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * Set id. + * + * @param int $id + * + * @return CLpView + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CLpView + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CNotebook.php b/src/Chamilo/CourseBundle/Entity/CNotebook.php new file mode 100644 index 000000000..66e84224b --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CNotebook.php @@ -0,0 +1,349 @@ +userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set course. + * + * @param string $course + * + * @return CNotebook + */ + public function setCourse($course) + { + $this->course = $course; + + return $this; + } + + /** + * Get course. + * + * @return string + */ + public function getCourse() + { + return $this->course; + } + + /** + * Set sessionId. + * + * @param int $sessionId + * + * @return CNotebook + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * Get sessionId. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * Set title. + * + * @param string $title + * + * @return CNotebook + */ + public function setTitle($title) + { + $this->title = $title; + + return $this; + } + + /** + * Get title. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set description. + * + * @param string $description + * + * @return CNotebook + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * Get description. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Set creationDate. + * + * @param \DateTime $creationDate + * + * @return CNotebook + */ + public function setCreationDate($creationDate) + { + $this->creationDate = $creationDate; + + return $this; + } + + /** + * Get creationDate. + * + * @return \DateTime + */ + public function getCreationDate() + { + return $this->creationDate; + } + + /** + * Set updateDate. + * + * @param \DateTime $updateDate + * + * @return CNotebook + */ + public function setUpdateDate($updateDate) + { + $this->updateDate = $updateDate; + + return $this; + } + + /** + * Get updateDate. + * + * @return \DateTime + */ + public function getUpdateDate() + { + return $this->updateDate; + } + + /** + * Set status. + * + * @param int $status + * + * @return CNotebook + */ + public function setStatus($status) + { + $this->status = $status; + + return $this; + } + + /** + * Get status. + * + * @return int + */ + public function getStatus() + { + return $this->status; + } + + /** + * Set notebookId. + * + * @param int $notebookId + * + * @return CNotebook + */ + public function setNotebookId($notebookId) + { + $this->notebookId = $notebookId; + + return $this; + } + + /** + * Get notebookId. + * + * @return int + */ + public function getNotebookId() + { + return $this->notebookId; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CNotebook + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Get iid. + * + * @return int + */ + public function getIid() + { + return $this->iid; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/COnlineConnected.php b/src/Chamilo/CourseBundle/Entity/COnlineConnected.php new file mode 100644 index 000000000..d896a29a9 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/COnlineConnected.php @@ -0,0 +1,122 @@ +lastConnection = $lastConnection; + + return $this; + } + + /** + * Get lastConnection. + * + * @return \DateTime + */ + public function getLastConnection() + { + return $this->lastConnection; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return COnlineConnected + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Set userId. + * + * @param int $userId + * + * @return COnlineConnected + */ + public function setUserId($userId) + { + $this->userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/COnlineLink.php b/src/Chamilo/CourseBundle/Entity/COnlineLink.php new file mode 100644 index 000000000..d927a1617 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/COnlineLink.php @@ -0,0 +1,153 @@ +name = $name; + + return $this; + } + + /** + * Get name. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set url. + * + * @param string $url + * + * @return COnlineLink + */ + public function setUrl($url) + { + $this->url = $url; + + return $this; + } + + /** + * Get url. + * + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * Set id. + * + * @param int $id + * + * @return COnlineLink + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return COnlineLink + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CPermissionGroup.php b/src/Chamilo/CourseBundle/Entity/CPermissionGroup.php new file mode 100644 index 000000000..08bb0246a --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CPermissionGroup.php @@ -0,0 +1,183 @@ +groupId = $groupId; + + return $this; + } + + /** + * Get groupId. + * + * @return int + */ + public function getGroupId() + { + return $this->groupId; + } + + /** + * Set tool. + * + * @param string $tool + * + * @return CPermissionGroup + */ + public function setTool($tool) + { + $this->tool = $tool; + + return $this; + } + + /** + * Get tool. + * + * @return string + */ + public function getTool() + { + return $this->tool; + } + + /** + * Set action. + * + * @param string $action + * + * @return CPermissionGroup + */ + public function setAction($action) + { + $this->action = $action; + + return $this; + } + + /** + * Get action. + * + * @return string + */ + public function getAction() + { + return $this->action; + } + + /** + * Set id. + * + * @param int $id + * + * @return CPermissionGroup + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CPermissionGroup + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CPermissionTask.php b/src/Chamilo/CourseBundle/Entity/CPermissionTask.php new file mode 100644 index 000000000..cd9d30c1f --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CPermissionTask.php @@ -0,0 +1,184 @@ +taskId = $taskId; + + return $this; + } + + /** + * Get taskId. + * + * @return int + */ + public function getTaskId() + { + return $this->taskId; + } + + /** + * Set tool. + * + * @param string $tool + * + * @return CPermissionTask + */ + public function setTool($tool) + { + $this->tool = $tool; + + return $this; + } + + /** + * Get tool. + * + * @return string + */ + public function getTool() + { + return $this->tool; + } + + /** + * Set action. + * + * @param string $action + * + * @return CPermissionTask + */ + public function setAction($action) + { + $this->action = $action; + + return $this; + } + + /** + * Get action. + * + * @return string + */ + public function getAction() + { + return $this->action; + } + + /** + * Set id. + * + * @param int $id + * + * @return CPermissionTask + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CPermissionTask + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CPermissionUser.php b/src/Chamilo/CourseBundle/Entity/CPermissionUser.php new file mode 100644 index 000000000..37a3666c4 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CPermissionUser.php @@ -0,0 +1,184 @@ +userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set tool. + * + * @param string $tool + * + * @return CPermissionUser + */ + public function setTool($tool) + { + $this->tool = $tool; + + return $this; + } + + /** + * Get tool. + * + * @return string + */ + public function getTool() + { + return $this->tool; + } + + /** + * Set action. + * + * @param string $action + * + * @return CPermissionUser + */ + public function setAction($action) + { + $this->action = $action; + + return $this; + } + + /** + * Get action. + * + * @return string + */ + public function getAction() + { + return $this->action; + } + + /** + * Set id. + * + * @param int $id + * + * @return CPermissionUser + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CPermissionUser + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CQuiz.php b/src/Chamilo/CourseBundle/Entity/CQuiz.php new file mode 100644 index 000000000..38d4aacb1 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CQuiz.php @@ -0,0 +1,840 @@ +hideQuestionTitle = false; + } + + /** + * Set title. + * + * @param string $title + * + * @return CQuiz + */ + public function setTitle($title) + { + $this->title = $title; + + return $this; + } + + /** + * Get title. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set description. + * + * @param string $description + * + * @return CQuiz + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * Get description. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Set sound. + * + * @param string $sound + * + * @return CQuiz + */ + public function setSound($sound) + { + $this->sound = $sound; + + return $this; + } + + /** + * Get sound. + * + * @return string + */ + public function getSound() + { + return $this->sound; + } + + /** + * Set type. + * + * @param bool $type + * + * @return CQuiz + */ + public function setType($type) + { + $this->type = $type; + + return $this; + } + + /** + * Get type. + * + * @return bool + */ + public function getType() + { + return $this->type; + } + + /** + * Set random. + * + * @param int $random + * + * @return CQuiz + */ + public function setRandom($random) + { + $this->random = $random; + + return $this; + } + + /** + * Get random. + * + * @return int + */ + public function getRandom() + { + return $this->random; + } + + /** + * Set randomAnswers. + * + * @param bool $randomAnswers + * + * @return CQuiz + */ + public function setRandomAnswers($randomAnswers) + { + $this->randomAnswers = $randomAnswers; + + return $this; + } + + /** + * Get randomAnswers. + * + * @return bool + */ + public function getRandomAnswers() + { + return $this->randomAnswers; + } + + /** + * Set active. + * + * @param bool $active + * + * @return CQuiz + */ + public function setActive($active) + { + $this->active = $active; + + return $this; + } + + /** + * Get active. + * + * @return bool + */ + public function getActive() + { + return $this->active; + } + + /** + * Set resultsDisabled. + * + * @param int $resultsDisabled + * + * @return CQuiz + */ + public function setResultsDisabled($resultsDisabled) + { + $this->resultsDisabled = $resultsDisabled; + + return $this; + } + + /** + * Get resultsDisabled. + * + * @return int + */ + public function getResultsDisabled() + { + return $this->resultsDisabled; + } + + /** + * Set accessCondition. + * + * @param string $accessCondition + * + * @return CQuiz + */ + public function setAccessCondition($accessCondition) + { + $this->accessCondition = $accessCondition; + + return $this; + } + + /** + * Get accessCondition. + * + * @return string + */ + public function getAccessCondition() + { + return $this->accessCondition; + } + + /** + * Set maxAttempt. + * + * @param int $maxAttempt + * + * @return CQuiz + */ + public function setMaxAttempt($maxAttempt) + { + $this->maxAttempt = $maxAttempt; + + return $this; + } + + /** + * Get maxAttempt. + * + * @return int + */ + public function getMaxAttempt() + { + return $this->maxAttempt; + } + + /** + * Set startTime. + * + * @param \DateTime $startTime + * + * @return CQuiz + */ + public function setStartTime($startTime) + { + $this->startTime = $startTime; + + return $this; + } + + /** + * Get startTime. + * + * @return \DateTime + */ + public function getStartTime() + { + return $this->startTime; + } + + /** + * Set endTime. + * + * @param \DateTime $endTime + * + * @return CQuiz + */ + public function setEndTime($endTime) + { + $this->endTime = $endTime; + + return $this; + } + + /** + * Get endTime. + * + * @return \DateTime + */ + public function getEndTime() + { + return $this->endTime; + } + + /** + * Set feedbackType. + * + * @param int $feedbackType + * + * @return CQuiz + */ + public function setFeedbackType($feedbackType) + { + $this->feedbackType = $feedbackType; + + return $this; + } + + /** + * Get feedbackType. + * + * @return int + */ + public function getFeedbackType() + { + return $this->feedbackType; + } + + /** + * Set expiredTime. + * + * @param int $expiredTime + * + * @return CQuiz + */ + public function setExpiredTime($expiredTime) + { + $this->expiredTime = $expiredTime; + + return $this; + } + + /** + * Get expiredTime. + * + * @return int + */ + public function getExpiredTime() + { + return $this->expiredTime; + } + + /** + * Set sessionId. + * + * @param int $sessionId + * + * @return CQuiz + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * Get sessionId. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * Set propagateNeg. + * + * @param int $propagateNeg + * + * @return CQuiz + */ + public function setPropagateNeg($propagateNeg) + { + $this->propagateNeg = $propagateNeg; + + return $this; + } + + /** + * Get propagateNeg. + * + * @return int + */ + public function getPropagateNeg() + { + return $this->propagateNeg; + } + + /** + * @param $saveCorrectAnswers boolean + * + * @return CQuiz + */ + public function setSaveCorrectAnswers($saveCorrectAnswers) + { + $this->saveCorrectAnswers = $saveCorrectAnswers; + + return $this; + } + + /** + * @return bool + */ + public function getSaveCorrectAnswers() + { + return $this->saveCorrectAnswers; + } + + /** + * Set reviewAnswers. + * + * @param int $reviewAnswers + * + * @return CQuiz + */ + public function setReviewAnswers($reviewAnswers) + { + $this->reviewAnswers = $reviewAnswers; + + return $this; + } + + /** + * Get reviewAnswers. + * + * @return int + */ + public function getReviewAnswers() + { + return $this->reviewAnswers; + } + + /** + * Set randomByCategory. + * + * @param int $randomByCategory + * + * @return CQuiz + */ + public function setRandomByCategory($randomByCategory) + { + $this->randomByCategory = $randomByCategory; + + return $this; + } + + /** + * Get randomByCategory. + * + * @return int + */ + public function getRandomByCategory() + { + return $this->randomByCategory; + } + + /** + * Set textWhenFinished. + * + * @param string $textWhenFinished + * + * @return CQuiz + */ + public function setTextWhenFinished($textWhenFinished) + { + $this->textWhenFinished = $textWhenFinished; + + return $this; + } + + /** + * Get textWhenFinished. + * + * @return string + */ + public function getTextWhenFinished() + { + return $this->textWhenFinished; + } + + /** + * Set displayCategoryName. + * + * @param int $displayCategoryName + * + * @return CQuiz + */ + public function setDisplayCategoryName($displayCategoryName) + { + $this->displayCategoryName = $displayCategoryName; + + return $this; + } + + /** + * Get displayCategoryName. + * + * @return int + */ + public function getDisplayCategoryName() + { + return $this->displayCategoryName; + } + + /** + * Set passPercentage. + * + * @param int $passPercentage + * + * @return CQuiz + */ + public function setPassPercentage($passPercentage) + { + $this->passPercentage = $passPercentage; + + return $this; + } + + /** + * Get passPercentage. + * + * @return int + */ + public function getPassPercentage() + { + return $this->passPercentage; + } + + /** + * Set id. + * + * @param int $iid + * + * @return CQuiz + */ + public function setId($iid) + { + $this->iid = $iid; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->iid; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CQuiz + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * @return int + */ + public function getQuestionSelectionType() + { + return $this->questionSelectionType; + } + + /** + * @param int $questionSelectionType + * + * @return CQuiz + */ + public function setQuestionSelectionType($questionSelectionType) + { + $this->questionSelectionType = $questionSelectionType; + + return $this; + } + + /** + * @return bool + */ + public function isHideQuestionTitle() + { + return $this->hideQuestionTitle; + } + + /** + * @param bool $hideQuestionTitle + * + * @return CQuiz + */ + public function setHideQuestionTitle($hideQuestionTitle) + { + $this->hideQuestionTitle = $hideQuestionTitle; + + return $this; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CQuizAnswer.php b/src/Chamilo/CourseBundle/Entity/CQuizAnswer.php new file mode 100644 index 000000000..b968aeb90 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CQuizAnswer.php @@ -0,0 +1,449 @@ +iid = null; + $this->idAuto = 0; + $this->correct = null; + $this->comment = null; + $this->ponderation = 0.0; + $this->hotspotCoordinates = null; + $this->hotspotType = null; + $this->destination = null; + $this->answerCode = null; + } + + /** + * Set iid. + * + * @param int $iid + * + * @return CQuizAnswer + */ + public function setId($iid) + { + $this->iid = $iid; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->iid; + } + + /** + * Set questionId. + * + * @param int $questionId + * + * @return CQuizAnswer + */ + public function setQuestionId($questionId) + { + $this->questionId = $questionId; + + return $this; + } + + /** + * Get questionId. + * + * @return int + */ + public function getQuestionId() + { + return $this->questionId; + } + + /** + * Set answer. + * + * @param string $answer + * + * @return CQuizAnswer + */ + public function setAnswer($answer) + { + $this->answer = $answer; + + return $this; + } + + /** + * Get answer. + * + * @return string + */ + public function getAnswer() + { + return $this->answer; + } + + /** + * Set correct. + * + * @param int $correct + * + * @return CQuizAnswer + */ + public function setCorrect($correct) + { + $this->correct = $correct; + + return $this; + } + + /** + * Get correct. + * + * @return int + */ + public function getCorrect() + { + return $this->correct; + } + + /** + * Set comment. + * + * @param string $comment + * + * @return CQuizAnswer + */ + public function setComment($comment) + { + $this->comment = $comment; + + return $this; + } + + /** + * Get comment. + * + * @return string + */ + public function getComment() + { + return $this->comment; + } + + /** + * Set weight. + * + * @param float $weight + * + * @return CQuizAnswer + */ + public function setPonderation($weight) + { + $this->ponderation = empty($weight) ? 0.0 : $weight; + + return $this; + } + + /** + * Get weight. + * + * @return float + */ + public function getPonderation() + { + return $this->ponderation; + } + + /** + * Set position. + * + * @param int $position + * + * @return CQuizAnswer + */ + public function setPosition($position) + { + $this->position = $position; + + return $this; + } + + /** + * Get position. + * + * @return int + */ + public function getPosition() + { + return $this->position; + } + + /** + * Set hotspotCoordinates. + * + * @param string $hotspotCoordinates + * + * @return CQuizAnswer + */ + public function setHotspotCoordinates($hotspotCoordinates) + { + $this->hotspotCoordinates = $hotspotCoordinates; + + return $this; + } + + /** + * Get hotspotCoordinates. + * + * @return string + */ + public function getHotspotCoordinates() + { + return $this->hotspotCoordinates; + } + + /** + * Set hotspotType. + * + * @param string $hotspotType + * + * @return CQuizAnswer + */ + public function setHotspotType($hotspotType) + { + $this->hotspotType = $hotspotType; + + return $this; + } + + /** + * Get hotspotType. + * + * @return string + */ + public function getHotspotType() + { + return $this->hotspotType; + } + + /** + * Set destination. + * + * @param string $destination + * + * @return CQuizAnswer + */ + public function setDestination($destination) + { + $this->destination = empty($destination) ? null : $destination; + + return $this; + } + + /** + * Get destination. + * + * @return string + */ + public function getDestination() + { + return $this->destination; + } + + /** + * Set answerCode. + * + * @param string $answerCode + * + * @return CQuizAnswer + */ + public function setAnswerCode($answerCode) + { + $this->answerCode = $answerCode; + + return $this; + } + + /** + * Get answerCode. + * + * @return string + */ + public function getAnswerCode() + { + return $this->answerCode; + } + + /** + * Set idAuto. + * + * @param int $idAuto + * + * @return CQuizAnswer + */ + public function setIdAuto($idAuto) + { + $this->idAuto = $idAuto; + + return $this; + } + + /** + * Get idAuto. + * + * @return int + */ + public function getIdAuto() + { + return $this->idAuto; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CQuizAnswer + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CQuizCategory.php b/src/Chamilo/CourseBundle/Entity/CQuizCategory.php new file mode 100644 index 000000000..d6cd12edd --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CQuizCategory.php @@ -0,0 +1,154 @@ +iid; + } + + /** + * @param int $iid + * + * @return CQuizCategory + */ + public function setIid($iid) + { + $this->iid = $iid; + + return $this; + } + + /** + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * @param int $cId + * + * @return CQuizCategory + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * @return int + */ + public function getCategoryId() + { + return $this->categoryId; + } + + /** + * @param int $categoryId + * + * @return CQuizCategory + */ + public function setCategoryId($categoryId) + { + $this->categoryId = $categoryId; + + return $this; + } + + /** + * @return int + */ + public function getExerciseId() + { + return $this->exerciseId; + } + + /** + * @param int $exerciseId + * + * @return CQuizCategory + */ + public function setExerciseId($exerciseId) + { + $this->exerciseId = $exerciseId; + + return $this; + } + + /** + * @return int + */ + public function getCountQuestions() + { + return $this->countQuestions; + } + + /** + * @param int $countQuestions + * + * @return CQuizCategory + */ + public function setCountQuestions($countQuestions) + { + $this->countQuestions = $countQuestions; + + return $this; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CQuizQuestion.php b/src/Chamilo/CourseBundle/Entity/CQuizQuestion.php new file mode 100644 index 000000000..34d6fdadc --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CQuizQuestion.php @@ -0,0 +1,409 @@ +ponderation = 0.0; + } + + /** + * Set question. + * + * @param string $question + * + * @return CQuizQuestion + */ + public function setQuestion($question) + { + $this->question = $question; + + return $this; + } + + /** + * Get question. + * + * @return string + */ + public function getQuestion() + { + return $this->question; + } + + /** + * Set description. + * + * @param string $description + * + * @return CQuizQuestion + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * Get description. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Set ponderation. + * + * @param float $ponderation + * + * @return CQuizQuestion + */ + public function setPonderation($ponderation) + { + $this->ponderation = $ponderation; + + return $this; + } + + /** + * Get ponderation. + * + * @return float + */ + public function getPonderation() + { + return $this->ponderation; + } + + /** + * Set position. + * + * @param int $position + * + * @return CQuizQuestion + */ + public function setPosition($position) + { + $this->position = $position; + + return $this; + } + + /** + * Get position. + * + * @return int + */ + public function getPosition() + { + return $this->position; + } + + /** + * Set type. + * + * @param int $type + * + * @return CQuizQuestion + */ + public function setType($type) + { + $this->type = $type; + + return $this; + } + + /** + * Get type. + * + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Set picture. + * + * @param string $picture + * + * @return CQuizQuestion + */ + public function setPicture($picture) + { + $this->picture = $picture; + + return $this; + } + + /** + * Get picture. + * + * @return string + */ + public function getPicture() + { + return $this->picture; + } + + /** + * Set level. + * + * @param int $level + * + * @return CQuizQuestion + */ + public function setLevel($level) + { + $this->level = $level; + + return $this; + } + + /** + * Get level. + * + * @return int + */ + public function getLevel() + { + return $this->level; + } + + /** + * Set extra. + * + * @param string $extra + * + * @return CQuizQuestion + */ + public function setExtra($extra) + { + $this->extra = $extra; + + return $this; + } + + /** + * Get extra. + * + * @return string + */ + public function getExtra() + { + return $this->extra; + } + + /** + * Set questionCode. + * + * @param string $questionCode + * + * @return CQuizQuestion + */ + public function setQuestionCode($questionCode) + { + $this->questionCode = $questionCode; + + return $this; + } + + /** + * Get questionCode. + * + * @return string + */ + public function getQuestionCode() + { + return $this->questionCode; + } + + /** + * Set id. + * + * @param int $iid + * + * @return CQuizQuestion + * + * @deprecated Use setIid() + */ + public function setId($iid) + { + $this->iid = $iid; + + return $this; + } + + /** + * Get id. + * + * @return int + * + * @deprecated Use getIid() + */ + public function getId() + { + return $this->iid; + } + + /** + * Set id. + * + * @param int $iid + * + * @return CQuizQuestion + */ + public function setIid($iid) + { + $this->iid = $iid; + + return $this; + } + + /** + * Get id. + * This method is also used by Twig to get the iid property. + * + * @return int + */ + public function getIid() + { + return $this->iid; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CQuizQuestion + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CQuizQuestionCategory.php b/src/Chamilo/CourseBundle/Entity/CQuizQuestionCategory.php new file mode 100644 index 000000000..f56a8f4b0 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CQuizQuestionCategory.php @@ -0,0 +1,154 @@ +title = $title; + + return $this; + } + + /** + * Get title. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set description. + * + * @param string $description + * + * @return CQuizQuestionCategory + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * Get description. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Set id. + * + * @param int $iid + * + * @return CQuizQuestionCategory + */ + public function setId($iid) + { + $this->iid = $iid; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->iid; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CQuizQuestionCategory + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CQuizQuestionOption.php b/src/Chamilo/CourseBundle/Entity/CQuizQuestionOption.php new file mode 100644 index 000000000..93009d290 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CQuizQuestionOption.php @@ -0,0 +1,185 @@ +questionId = $questionId; + + return $this; + } + + /** + * Get questionId. + * + * @return int + */ + public function getQuestionId() + { + return $this->questionId; + } + + /** + * Set name. + * + * @param string $name + * + * @return CQuizQuestionOption + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * Get name. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set position. + * + * @param int $position + * + * @return CQuizQuestionOption + */ + public function setPosition($position) + { + $this->position = $position; + + return $this; + } + + /** + * Get position. + * + * @return int + */ + public function getPosition() + { + return $this->position; + } + + /** + * Set id. + * + * @param int $iid + * + * @return CQuizQuestionOption + */ + public function setId($iid) + { + $this->iid = $iid; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->iid; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CQuizQuestionOption + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CQuizQuestionRelCategory.php b/src/Chamilo/CourseBundle/Entity/CQuizQuestionRelCategory.php new file mode 100644 index 000000000..54a4025c3 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CQuizQuestionRelCategory.php @@ -0,0 +1,123 @@ +categoryId = $categoryId; + + return $this; + } + + /** + * Get categoryId. + * + * @return int + */ + public function getCategoryId() + { + return $this->categoryId; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CQuizQuestionRelCategory + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Set questionId. + * + * @param int $questionId + * + * @return CQuizQuestionRelCategory + */ + public function setQuestionId($questionId) + { + $this->questionId = $questionId; + + return $this; + } + + /** + * Get questionId. + * + * @return int + */ + public function getQuestionId() + { + return $this->questionId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CQuizRelQuestion.php b/src/Chamilo/CourseBundle/Entity/CQuizRelQuestion.php new file mode 100644 index 000000000..49fec1427 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CQuizRelQuestion.php @@ -0,0 +1,155 @@ +questionOrder = $questionOrder; + + return $this; + } + + /** + * Get questionOrder. + * + * @return int + */ + public function getQuestionOrder() + { + return $this->questionOrder; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CQuizRelQuestion + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Set questionId. + * + * @param int $questionId + * + * @return CQuizRelQuestion + */ + public function setQuestionId($questionId) + { + $this->questionId = $questionId; + + return $this; + } + + /** + * Get questionId. + * + * @return int + */ + public function getQuestionId() + { + return $this->questionId; + } + + /** + * Set exerciceId. + * + * @param int $exerciceId + * + * @return CQuizRelQuestion + */ + public function setExerciceId($exerciceId) + { + $this->exerciceId = $exerciceId; + + return $this; + } + + /** + * Get exerciceId. + * + * @return int + */ + public function getExerciceId() + { + return $this->exerciceId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CResource.php b/src/Chamilo/CourseBundle/Entity/CResource.php new file mode 100644 index 000000000..6f51c891d --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CResource.php @@ -0,0 +1,215 @@ +sourceType = $sourceType; + + return $this; + } + + /** + * Get sourceType. + * + * @return string + */ + public function getSourceType() + { + return $this->sourceType; + } + + /** + * Set sourceId. + * + * @param int $sourceId + * + * @return CResource + */ + public function setSourceId($sourceId) + { + $this->sourceId = $sourceId; + + return $this; + } + + /** + * Get sourceId. + * + * @return int + */ + public function getSourceId() + { + return $this->sourceId; + } + + /** + * Set resourceType. + * + * @param string $resourceType + * + * @return CResource + */ + public function setResourceType($resourceType) + { + $this->resourceType = $resourceType; + + return $this; + } + + /** + * Get resourceType. + * + * @return string + */ + public function getResourceType() + { + return $this->resourceType; + } + + /** + * Set resourceId. + * + * @param int $resourceId + * + * @return CResource + */ + public function setResourceId($resourceId) + { + $this->resourceId = $resourceId; + + return $this; + } + + /** + * Get resourceId. + * + * @return int + */ + public function getResourceId() + { + return $this->resourceId; + } + + /** + * Set id. + * + * @param int $id + * + * @return CResource + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CResource + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CRole.php b/src/Chamilo/CourseBundle/Entity/CRole.php new file mode 100644 index 000000000..5f4b9f08e --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CRole.php @@ -0,0 +1,184 @@ +roleName = $roleName; + + return $this; + } + + /** + * Get roleName. + * + * @return string + */ + public function getRoleName() + { + return $this->roleName; + } + + /** + * Set roleComment. + * + * @param string $roleComment + * + * @return CRole + */ + public function setRoleComment($roleComment) + { + $this->roleComment = $roleComment; + + return $this; + } + + /** + * Get roleComment. + * + * @return string + */ + public function getRoleComment() + { + return $this->roleComment; + } + + /** + * Set defaultRole. + * + * @param bool $defaultRole + * + * @return CRole + */ + public function setDefaultRole($defaultRole) + { + $this->defaultRole = $defaultRole; + + return $this; + } + + /** + * Get defaultRole. + * + * @return bool + */ + public function getDefaultRole() + { + return $this->defaultRole; + } + + /** + * Set roleId. + * + * @param int $roleId + * + * @return CRole + */ + public function setRoleId($roleId) + { + $this->roleId = $roleId; + + return $this; + } + + /** + * Get roleId. + * + * @return int + */ + public function getRoleId() + { + return $this->roleId; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CRole + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CRoleGroup.php b/src/Chamilo/CourseBundle/Entity/CRoleGroup.php new file mode 100644 index 000000000..e78bcf780 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CRoleGroup.php @@ -0,0 +1,185 @@ +roleId = $roleId; + + return $this; + } + + /** + * Get roleId. + * + * @return int + */ + public function getRoleId() + { + return $this->roleId; + } + + /** + * Set scope. + * + * @param string $scope + * + * @return CRoleGroup + */ + public function setScope($scope) + { + $this->scope = $scope; + + return $this; + } + + /** + * Get scope. + * + * @return string + */ + public function getScope() + { + return $this->scope; + } + + /** + * Set id. + * + * @param int $id + * + * @return CRoleGroup + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CRoleGroup + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Set groupId. + * + * @param int $groupId + * + * @return CRoleGroup + */ + public function setGroupId($groupId) + { + $this->groupId = $groupId; + + return $this; + } + + /** + * Get groupId. + * + * @return int + */ + public function getGroupId() + { + return $this->groupId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CRolePermissions.php b/src/Chamilo/CourseBundle/Entity/CRolePermissions.php new file mode 100644 index 000000000..d44d35ef2 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CRolePermissions.php @@ -0,0 +1,216 @@ +defaultPerm = $defaultPerm; + + return $this; + } + + /** + * Get defaultPerm. + * + * @return bool + */ + public function getDefaultPerm() + { + return $this->defaultPerm; + } + + /** + * Set id. + * + * @param int $id + * + * @return CRolePermissions + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CRolePermissions + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Set roleId. + * + * @param int $roleId + * + * @return CRolePermissions + */ + public function setRoleId($roleId) + { + $this->roleId = $roleId; + + return $this; + } + + /** + * Get roleId. + * + * @return int + */ + public function getRoleId() + { + return $this->roleId; + } + + /** + * Set tool. + * + * @param string $tool + * + * @return CRolePermissions + */ + public function setTool($tool) + { + $this->tool = $tool; + + return $this; + } + + /** + * Get tool. + * + * @return string + */ + public function getTool() + { + return $this->tool; + } + + /** + * Set action. + * + * @param string $action + * + * @return CRolePermissions + */ + public function setAction($action) + { + $this->action = $action; + + return $this; + } + + /** + * Get action. + * + * @return string + */ + public function getAction() + { + return $this->action; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CRoleUser.php b/src/Chamilo/CourseBundle/Entity/CRoleUser.php new file mode 100644 index 000000000..78e6c5445 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CRoleUser.php @@ -0,0 +1,154 @@ +scope = $scope; + + return $this; + } + + /** + * Get scope. + * + * @return string + */ + public function getScope() + { + return $this->scope; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CRoleUser + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Set roleId. + * + * @param int $roleId + * + * @return CRoleUser + */ + public function setRoleId($roleId) + { + $this->roleId = $roleId; + + return $this; + } + + /** + * Get roleId. + * + * @return int + */ + public function getRoleId() + { + return $this->roleId; + } + + /** + * Set userId. + * + * @param int $userId + * + * @return CRoleUser + */ + public function setUserId($userId) + { + $this->userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CStudentPublication.php b/src/Chamilo/CourseBundle/Entity/CStudentPublication.php new file mode 100644 index 000000000..d48d09afb --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CStudentPublication.php @@ -0,0 +1,796 @@ +url = $url; + + return $this; + } + + /** + * Get url. + * + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * Set title. + * + * @param string $title + * + * @return CStudentPublication + */ + public function setTitle($title) + { + $this->title = $title; + + return $this; + } + + /** + * Get title. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set description. + * + * @param string $description + * + * @return CStudentPublication + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * Get description. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Set author. + * + * @param string $author + * + * @return CStudentPublication + */ + public function setAuthor($author) + { + $this->author = $author; + + return $this; + } + + /** + * Get author. + * + * @return string + */ + public function getAuthor() + { + return $this->author; + } + + /** + * Set active. + * + * @param bool $active + * + * @return CStudentPublication + */ + public function setActive($active) + { + $this->active = $active; + + return $this; + } + + /** + * Get active. + * + * @return bool + */ + public function getActive() + { + return $this->active; + } + + /** + * Set accepted. + * + * @param bool $accepted + * + * @return CStudentPublication + */ + public function setAccepted($accepted) + { + $this->accepted = $accepted; + + return $this; + } + + /** + * Get accepted. + * + * @return bool + */ + public function getAccepted() + { + return $this->accepted; + } + + /** + * Set postGroupId. + * + * @param int $postGroupId + * + * @return CStudentPublication + */ + public function setPostGroupId($postGroupId) + { + $this->postGroupId = $postGroupId; + + return $this; + } + + /** + * Get postGroupId. + * + * @return int + */ + public function getPostGroupId() + { + return $this->postGroupId; + } + + /** + * Set sentDate. + * + * @param \DateTime $sentDate + * + * @return CStudentPublication + */ + public function setSentDate($sentDate) + { + $this->sentDate = $sentDate; + + return $this; + } + + /** + * Get sentDate. + * + * @return \DateTime + */ + public function getSentDate() + { + return $this->sentDate; + } + + /** + * Set filetype. + * + * @param string $filetype + * + * @return CStudentPublication + */ + public function setFiletype($filetype) + { + $this->filetype = $filetype; + + return $this; + } + + /** + * Get filetype. + * + * @return string + */ + public function getFiletype() + { + return $this->filetype; + } + + /** + * Set hasProperties. + * + * @param int $hasProperties + * + * @return CStudentPublication + */ + public function setHasProperties($hasProperties) + { + $this->hasProperties = $hasProperties; + + return $this; + } + + /** + * Get hasProperties. + * + * @return int + */ + public function getHasProperties() + { + return $this->hasProperties; + } + + /** + * Set viewProperties. + * + * @param bool $viewProperties + * + * @return CStudentPublication + */ + public function setViewProperties($viewProperties) + { + $this->viewProperties = $viewProperties; + + return $this; + } + + /** + * Get viewProperties. + * + * @return bool + */ + public function getViewProperties() + { + return $this->viewProperties; + } + + /** + * Set qualification. + * + * @param float $qualification + * + * @return CStudentPublication + */ + public function setQualification($qualification) + { + $this->qualification = $qualification; + + return $this; + } + + /** + * Get qualification. + * + * @return float + */ + public function getQualification() + { + return $this->qualification; + } + + /** + * Set dateOfQualification. + * + * @param \DateTime $dateOfQualification + * + * @return CStudentPublication + */ + public function setDateOfQualification($dateOfQualification) + { + $this->dateOfQualification = $dateOfQualification; + + return $this; + } + + /** + * Get dateOfQualification. + * + * @return \DateTime + */ + public function getDateOfQualification() + { + return $this->dateOfQualification; + } + + /** + * Set parentId. + * + * @param int $parentId + * + * @return CStudentPublication + */ + public function setParentId($parentId) + { + $this->parentId = $parentId; + + return $this; + } + + /** + * Get parentId. + * + * @return int + */ + public function getParentId() + { + return $this->parentId; + } + + /** + * Set qualificatorId. + * + * @param int $qualificatorId + * + * @return CStudentPublication + */ + public function setQualificatorId($qualificatorId) + { + $this->qualificatorId = $qualificatorId; + + return $this; + } + + /** + * Get qualificatorId. + * + * @return int + */ + public function getQualificatorId() + { + return $this->qualificatorId; + } + + /** + * Set weight. + * + * @param float $weight + * + * @return CStudentPublication + */ + public function setWeight($weight) + { + $this->weight = $weight; + + return $this; + } + + /** + * Get weight. + * + * @return float + */ + public function getWeight() + { + return $this->weight; + } + + /** + * Set session. + * + * @param Session $session + * + * @return CStudentPublication + */ + public function setSession(Session $session = null) + { + $this->session = $session; + + return $this; + } + + /** + * Get session. + * + * @return Session + */ + public function getSession() + { + return $this->session; + } + + /** + * Set userId. + * + * @param int $userId + * + * @return CStudentPublication + */ + public function setUserId($userId) + { + $this->userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set allowTextAssignment. + * + * @param int $allowTextAssignment + * + * @return CStudentPublication + */ + public function setAllowTextAssignment($allowTextAssignment) + { + $this->allowTextAssignment = $allowTextAssignment; + + return $this; + } + + /** + * Get allowTextAssignment. + * + * @return int + */ + public function getAllowTextAssignment() + { + return $this->allowTextAssignment; + } + + /** + * Set containsFile. + * + * @param int $containsFile + * + * @return CStudentPublication + */ + public function setContainsFile($containsFile) + { + $this->containsFile = $containsFile; + + return $this; + } + + /** + * Get containsFile. + * + * @return int + */ + public function getContainsFile() + { + return $this->containsFile; + } + + /** + * Set id. + * + * @param int $id + * + * @return CStudentPublication + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CStudentPublication + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * @return string + */ + public function getUrlCorrection() + { + return $this->urlCorrection; + } + + /** + * @param string $urlCorrection + */ + public function setUrlCorrection($urlCorrection) + { + $this->urlCorrection = $urlCorrection; + } + + /** + * @return string + */ + public function getTitleCorrection() + { + return $this->titleCorrection; + } + + /** + * @param string $titleCorrection + */ + public function setTitleCorrection($titleCorrection) + { + $this->titleCorrection = $titleCorrection; + } + + /** + * @return int + */ + public function getDocumentId() + { + return $this->documentId; + } + + /** + * @param int $documentId + */ + public function setDocumentId($documentId) + { + $this->documentId = $documentId; + } + + /** + * Get iid. + * + * @return int + */ + public function getIid() + { + return $this->iid; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CStudentPublicationAssignment.php b/src/Chamilo/CourseBundle/Entity/CStudentPublicationAssignment.php new file mode 100644 index 000000000..0ded9c43b --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CStudentPublicationAssignment.php @@ -0,0 +1,246 @@ +expiresOn = $expiresOn; + + return $this; + } + + /** + * Get expiresOn. + * + * @return \DateTime + */ + public function getExpiresOn() + { + return $this->expiresOn; + } + + /** + * Set endsOn. + * + * @param \DateTime $endsOn + * + * @return CStudentPublicationAssignment + */ + public function setEndsOn($endsOn) + { + $this->endsOn = $endsOn; + + return $this; + } + + /** + * Get endsOn. + * + * @return \DateTime + */ + public function getEndsOn() + { + return $this->endsOn; + } + + /** + * Set addToCalendar. + * + * @param bool $addToCalendar + * + * @return CStudentPublicationAssignment + */ + public function setAddToCalendar($addToCalendar) + { + $this->addToCalendar = $addToCalendar; + + return $this; + } + + /** + * Get addToCalendar. + * + * @return bool + */ + public function getAddToCalendar() + { + return $this->addToCalendar; + } + + /** + * Set enableQualification. + * + * @param bool $enableQualification + * + * @return CStudentPublicationAssignment + */ + public function setEnableQualification($enableQualification) + { + $this->enableQualification = $enableQualification; + + return $this; + } + + /** + * Get enableQualification. + * + * @return bool + */ + public function getEnableQualification() + { + return $this->enableQualification; + } + + /** + * Set publicationId. + * + * @param int $publicationId + * + * @return CStudentPublicationAssignment + */ + public function setPublicationId($publicationId) + { + $this->publicationId = $publicationId; + + return $this; + } + + /** + * Get publicationId. + * + * @return int + */ + public function getPublicationId() + { + return $this->publicationId; + } + + /** + * Set id. + * + * @param int $id + * + * @return CStudentPublicationAssignment + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CStudentPublicationAssignment + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CStudentPublicationComment.php b/src/Chamilo/CourseBundle/Entity/CStudentPublicationComment.php new file mode 100644 index 000000000..6c0680853 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CStudentPublicationComment.php @@ -0,0 +1,234 @@ +workId = $workId; + + return $this; + } + + /** + * Get workId. + * + * @return int + */ + public function getWorkId() + { + return $this->workId; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CStudentPublicationComment + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Set comment. + * + * @param string $comment + * + * @return CStudentPublicationComment + */ + public function setComment($comment) + { + $this->comment = $comment; + + return $this; + } + + /** + * Get comment. + * + * @return string + */ + public function getComment() + { + return $this->comment; + } + + /** + * Set file. + * + * @param string $file + * + * @return CStudentPublicationComment + */ + public function setFile($file) + { + $this->file = $file; + + return $this; + } + + /** + * Get file. + * + * @return string + */ + public function getFile() + { + return $this->file; + } + + /** + * Set userId. + * + * @param int $userId + * + * @return CStudentPublicationComment + */ + public function setUserId($userId) + { + $this->userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set sentAt. + * + * @param \DateTime $sentAt + * + * @return CStudentPublicationComment + */ + public function setSentAt($sentAt) + { + $this->sentAt = $sentAt; + + return $this; + } + + /** + * Get sentAt. + * + * @return \DateTime + */ + public function getSentAt() + { + return $this->sentAt; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CStudentPublicationRelDocument.php b/src/Chamilo/CourseBundle/Entity/CStudentPublicationRelDocument.php new file mode 100644 index 000000000..f29d6ef1d --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CStudentPublicationRelDocument.php @@ -0,0 +1,161 @@ +workId = $workId; + + return $this; + } + + /** + * Get workId. + * + * @return int + */ + public function getWorkId() + { + return $this->workId; + } + + /** + * Set documentId. + * + * @param int $documentId + * + * @return CStudentPublicationRelDocument + */ + public function setDocumentId($documentId) + { + $this->documentId = $documentId; + + return $this; + } + + /** + * Get documentId. + * + * @return int + */ + public function getDocumentId() + { + return $this->documentId; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CStudentPublicationRelDocument + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * @return int + */ + public function getIid() + { + return $this->iid; + } + + /** + * @param int $iid + * + * @return CStudentPublicationRelDocument + */ + public function setIid($iid) + { + $this->iid = $iid; + + return $this; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CStudentPublicationRelUser.php b/src/Chamilo/CourseBundle/Entity/CStudentPublicationRelUser.php new file mode 100644 index 000000000..ddf26227c --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CStudentPublicationRelUser.php @@ -0,0 +1,141 @@ +workId = $workId; + + return $this; + } + + /** + * Get workId. + * + * @return int + */ + public function getWorkId() + { + return $this->workId; + } + + /** + * Set userId. + * + * @param int $userId + * + * @return CStudentPublicationRelUser + */ + public function setUserId($userId) + { + $this->userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CStudentPublicationRelUser + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CSurvey.php b/src/Chamilo/CourseBundle/Entity/CSurvey.php new file mode 100644 index 000000000..c7349b52a --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CSurvey.php @@ -0,0 +1,960 @@ +code = $code; + + return $this; + } + + /** + * Get code. + * + * @return string + */ + public function getCode() + { + return $this->code; + } + + /** + * Set title. + * + * @param string $title + * + * @return CSurvey + */ + public function setTitle($title) + { + $this->title = $title; + + return $this; + } + + /** + * Get title. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set subtitle. + * + * @param string $subtitle + * + * @return CSurvey + */ + public function setSubtitle($subtitle) + { + $this->subtitle = $subtitle; + + return $this; + } + + /** + * Get subtitle. + * + * @return string + */ + public function getSubtitle() + { + return $this->subtitle; + } + + /** + * Set author. + * + * @param string $author + * + * @return CSurvey + */ + public function setAuthor($author) + { + $this->author = $author; + + return $this; + } + + /** + * Get author. + * + * @return string + */ + public function getAuthor() + { + return $this->author; + } + + /** + * Set lang. + * + * @param string $lang + * + * @return CSurvey + */ + public function setLang($lang) + { + $this->lang = $lang; + + return $this; + } + + /** + * Get lang. + * + * @return string + */ + public function getLang() + { + return $this->lang; + } + + /** + * Set availFrom. + * + * @param \DateTime $availFrom + * + * @return CSurvey + */ + public function setAvailFrom($availFrom) + { + $this->availFrom = $availFrom; + + return $this; + } + + /** + * Get availFrom. + * + * @return \DateTime + */ + public function getAvailFrom() + { + return $this->availFrom; + } + + /** + * Set availTill. + * + * @param \DateTime $availTill + * + * @return CSurvey + */ + public function setAvailTill($availTill) + { + $this->availTill = $availTill; + + return $this; + } + + /** + * Get availTill. + * + * @return \DateTime + */ + public function getAvailTill() + { + return $this->availTill; + } + + /** + * Set isShared. + * + * @param string $isShared + * + * @return CSurvey + */ + public function setIsShared($isShared) + { + $this->isShared = $isShared; + + return $this; + } + + /** + * Get isShared. + * + * @return string + */ + public function getIsShared() + { + return $this->isShared; + } + + /** + * Set template. + * + * @param string $template + * + * @return CSurvey + */ + public function setTemplate($template) + { + $this->template = $template; + + return $this; + } + + /** + * Get template. + * + * @return string + */ + public function getTemplate() + { + return $this->template; + } + + /** + * Set intro. + * + * @param string $intro + * + * @return CSurvey + */ + public function setIntro($intro) + { + $this->intro = $intro; + + return $this; + } + + /** + * Get intro. + * + * @return string + */ + public function getIntro() + { + return $this->intro; + } + + /** + * Set surveythanks. + * + * @param string $surveythanks + * + * @return CSurvey + */ + public function setSurveythanks($surveythanks) + { + $this->surveythanks = $surveythanks; + + return $this; + } + + /** + * Get surveythanks. + * + * @return string + */ + public function getSurveythanks() + { + return $this->surveythanks; + } + + /** + * Set creationDate. + * + * @param \DateTime $creationDate + * + * @return CSurvey + */ + public function setCreationDate($creationDate) + { + $this->creationDate = $creationDate; + + return $this; + } + + /** + * Get creationDate. + * + * @return \DateTime + */ + public function getCreationDate() + { + return $this->creationDate; + } + + /** + * Set invited. + * + * @param int $invited + * + * @return CSurvey + */ + public function setInvited($invited) + { + $this->invited = $invited; + + return $this; + } + + /** + * Get invited. + * + * @return int + */ + public function getInvited() + { + return $this->invited; + } + + /** + * Set answered. + * + * @param int $answered + * + * @return CSurvey + */ + public function setAnswered($answered) + { + $this->answered = $answered; + + return $this; + } + + /** + * Get answered. + * + * @return int + */ + public function getAnswered() + { + return $this->answered; + } + + /** + * Set inviteMail. + * + * @param string $inviteMail + * + * @return CSurvey + */ + public function setInviteMail($inviteMail) + { + $this->inviteMail = $inviteMail; + + return $this; + } + + /** + * Get inviteMail. + * + * @return string + */ + public function getInviteMail() + { + return $this->inviteMail; + } + + /** + * Set reminderMail. + * + * @param string $reminderMail + * + * @return CSurvey + */ + public function setReminderMail($reminderMail) + { + $this->reminderMail = $reminderMail; + + return $this; + } + + /** + * Get reminderMail. + * + * @return string + */ + public function getReminderMail() + { + return $this->reminderMail; + } + + /** + * Set mailSubject. + * + * @param string $mailSubject + * + * @return CSurvey + */ + public function setMailSubject($mailSubject) + { + $this->mailSubject = $mailSubject; + + return $this; + } + + /** + * Get mailSubject. + * + * @return string + */ + public function getMailSubject() + { + return $this->mailSubject; + } + + /** + * Set anonymous. + * + * @param string $anonymous + * + * @return CSurvey + */ + public function setAnonymous($anonymous) + { + $this->anonymous = $anonymous; + + return $this; + } + + /** + * Get anonymous. + * + * @return string + */ + public function getAnonymous() + { + return $this->anonymous; + } + + /** + * Set accessCondition. + * + * @param string $accessCondition + * + * @return CSurvey + */ + public function setAccessCondition($accessCondition) + { + $this->accessCondition = $accessCondition; + + return $this; + } + + /** + * Get accessCondition. + * + * @return string + */ + public function getAccessCondition() + { + return $this->accessCondition; + } + + /** + * Set shuffle. + * + * @param bool $shuffle + * + * @return CSurvey + */ + public function setShuffle($shuffle) + { + $this->shuffle = $shuffle; + + return $this; + } + + /** + * Get shuffle. + * + * @return bool + */ + public function getShuffle() + { + return $this->shuffle; + } + + /** + * Set oneQuestionPerPage. + * + * @param bool $oneQuestionPerPage + * + * @return CSurvey + */ + public function setOneQuestionPerPage($oneQuestionPerPage) + { + $this->oneQuestionPerPage = $oneQuestionPerPage; + + return $this; + } + + /** + * Get oneQuestionPerPage. + * + * @return bool + */ + public function getOneQuestionPerPage() + { + return $this->oneQuestionPerPage; + } + + /** + * Set surveyVersion. + * + * @param string $surveyVersion + * + * @return CSurvey + */ + public function setSurveyVersion($surveyVersion) + { + $this->surveyVersion = $surveyVersion; + + return $this; + } + + /** + * Get surveyVersion. + * + * @return string + */ + public function getSurveyVersion() + { + return $this->surveyVersion; + } + + /** + * Set parentId. + * + * @param int $parentId + * + * @return CSurvey + */ + public function setParentId($parentId) + { + $this->parentId = $parentId; + + return $this; + } + + /** + * Get parentId. + * + * @return int + */ + public function getParentId() + { + return $this->parentId; + } + + /** + * Set surveyType. + * + * @param int $surveyType + * + * @return CSurvey + */ + public function setSurveyType($surveyType) + { + $this->surveyType = $surveyType; + + return $this; + } + + /** + * Get surveyType. + * + * @return int + */ + public function getSurveyType() + { + return $this->surveyType; + } + + /** + * Set showFormProfile. + * + * @param int $showFormProfile + * + * @return CSurvey + */ + public function setShowFormProfile($showFormProfile) + { + $this->showFormProfile = $showFormProfile; + + return $this; + } + + /** + * Get showFormProfile. + * + * @return int + */ + public function getShowFormProfile() + { + return $this->showFormProfile; + } + + /** + * Set formFields. + * + * @param string $formFields + * + * @return CSurvey + */ + public function setFormFields($formFields) + { + $this->formFields = $formFields; + + return $this; + } + + /** + * Get formFields. + * + * @return string + */ + public function getFormFields() + { + return $this->formFields; + } + + /** + * Set sessionId. + * + * @param int $sessionId + * + * @return CSurvey + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * Get sessionId. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * Set visibleResults. + * + * @param int $visibleResults + * + * @return CSurvey + */ + public function setVisibleResults($visibleResults) + { + $this->visibleResults = $visibleResults; + + return $this; + } + + /** + * Get visibleResults. + * + * @return int + */ + public function getVisibleResults() + { + return $this->visibleResults; + } + + /** + * Set surveyId. + * + * @param int $surveyId + * + * @return CSurvey + */ + public function setSurveyId($surveyId) + { + $this->surveyId = $surveyId; + + return $this; + } + + /** + * Get surveyId. + * + * @return int + */ + public function getSurveyId() + { + return $this->surveyId; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CSurvey + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CSurveyAnswer.php b/src/Chamilo/CourseBundle/Entity/CSurveyAnswer.php new file mode 100644 index 000000000..096781fcf --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CSurveyAnswer.php @@ -0,0 +1,306 @@ +surveyId = $surveyId; + + return $this; + } + + /** + * Get surveyId. + * + * @return int + */ + public function getSurveyId() + { + return $this->surveyId; + } + + /** + * Set questionId. + * + * @param int $questionId + * + * @return CSurveyAnswer + */ + public function setQuestionId($questionId) + { + $this->questionId = $questionId; + + return $this; + } + + /** + * Get questionId. + * + * @return int + */ + public function getQuestionId() + { + return $this->questionId; + } + + /** + * Set optionId. + * + * @param string $optionId + * + * @return CSurveyAnswer + */ + public function setOptionId($optionId) + { + $this->optionId = $optionId; + + return $this; + } + + /** + * Get optionId. + * + * @return string + */ + public function getOptionId() + { + return $this->optionId; + } + + /** + * Set value. + * + * @param int $value + * + * @return CSurveyAnswer + */ + public function setValue($value) + { + $this->value = $value; + + return $this; + } + + /** + * Get value. + * + * @return int + */ + public function getValue() + { + return $this->value; + } + + /** + * Set user. + * + * @param string $user + * + * @return CSurveyAnswer + */ + public function setUser($user) + { + $this->user = $user; + + return $this; + } + + /** + * Get user. + * + * @return string + */ + public function getUser() + { + return $this->user; + } + + /** + * Set answerId. + * + * @param int $answerId + * + * @return CSurveyAnswer + */ + public function setAnswerId($answerId) + { + $this->answerId = $answerId; + + return $this; + } + + /** + * Get answerId. + * + * @return int + */ + public function getAnswerId() + { + return $this->answerId; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CSurveyAnswer + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Get session Id. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * Set session Id. + * + * @param int $sessionId + * + * @return CSurveyAnswer + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * Get the lp item Id. + * + * @return int + */ + public function getLpItemId() + { + return $this->lpItemId; + } + + /** + * Set lp item Id. + * + * @return CSurveyAnswer + */ + public function setLpItemId(int $lpItemId) + { + $this->lpItemId = $lpItemId; + + return $this; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CSurveyGroup.php b/src/Chamilo/CourseBundle/Entity/CSurveyGroup.php new file mode 100644 index 000000000..2732a0d4b --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CSurveyGroup.php @@ -0,0 +1,184 @@ +name = $name; + + return $this; + } + + /** + * Get name. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set description. + * + * @param string $description + * + * @return CSurveyGroup + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * Get description. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Set surveyId. + * + * @param int $surveyId + * + * @return CSurveyGroup + */ + public function setSurveyId($surveyId) + { + $this->surveyId = $surveyId; + + return $this; + } + + /** + * Get surveyId. + * + * @return int + */ + public function getSurveyId() + { + return $this->surveyId; + } + + /** + * Set id. + * + * @param int $id + * + * @return CSurveyGroup + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CSurveyGroup + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CSurveyInvitation.php b/src/Chamilo/CourseBundle/Entity/CSurveyInvitation.php new file mode 100644 index 000000000..77a28f20c --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CSurveyInvitation.php @@ -0,0 +1,370 @@ +surveyCode = $surveyCode; + + return $this; + } + + /** + * Get surveyCode. + * + * @return string + */ + public function getSurveyCode() + { + return $this->surveyCode; + } + + /** + * Set user. + * + * @param string $user + * + * @return CSurveyInvitation + */ + public function setUser($user) + { + $this->user = $user; + + return $this; + } + + /** + * Get user. + * + * @return string + */ + public function getUser() + { + return $this->user; + } + + /** + * Set invitationCode. + * + * @param string $invitationCode + * + * @return CSurveyInvitation + */ + public function setInvitationCode($invitationCode) + { + $this->invitationCode = $invitationCode; + + return $this; + } + + /** + * Get invitationCode. + * + * @return string + */ + public function getInvitationCode() + { + return $this->invitationCode; + } + + /** + * Set invitationDate. + * + * @param \DateTime $invitationDate + * + * @return CSurveyInvitation + */ + public function setInvitationDate($invitationDate) + { + $this->invitationDate = $invitationDate; + + return $this; + } + + /** + * Get invitationDate. + * + * @return \DateTime + */ + public function getInvitationDate() + { + return $this->invitationDate; + } + + /** + * Set reminderDate. + * + * @param \DateTime $reminderDate + * + * @return CSurveyInvitation + */ + public function setReminderDate($reminderDate) + { + $this->reminderDate = $reminderDate; + + return $this; + } + + /** + * Get reminderDate. + * + * @return \DateTime + */ + public function getReminderDate() + { + return $this->reminderDate; + } + + /** + * Set answered. + * + * @param int $answered + * + * @return CSurveyInvitation + */ + public function setAnswered($answered) + { + $this->answered = $answered; + + return $this; + } + + /** + * Get answered. + * + * @return int + */ + public function getAnswered() + { + return $this->answered; + } + + /** + * Set sessionId. + * + * @param int $sessionId + * + * @return CSurveyInvitation + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * Get sessionId. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * Set groupId. + * + * @param int $groupId + * + * @return CSurveyInvitation + */ + public function setGroupId($groupId) + { + $this->groupId = $groupId; + + return $this; + } + + /** + * Get groupId. + * + * @return int + */ + public function getGroupId() + { + return $this->groupId; + } + + /** + * Set LpItemId. + * + * @param int $lpItemId + * + * @return CSurveyInvitation + */ + public function setLpItemId($lpItemId) + { + $this->lpItemId = $lpItemId; + + return $this; + } + + /** + * Get LpItemId. + * + * @return int + */ + public function getLpItemId() + { + return $this->lpItemId; + } + + /** + * Set surveyInvitationId. + * + * @param int $surveyInvitationId + * + * @return CSurveyInvitation + */ + public function setSurveyInvitationId($surveyInvitationId) + { + $this->surveyInvitationId = $surveyInvitationId; + + return $this; + } + + /** + * Get surveyInvitationId. + * + * @return int + */ + public function getSurveyInvitationId() + { + return $this->surveyInvitationId; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CSurveyInvitation + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CSurveyQuestion.php b/src/Chamilo/CourseBundle/Entity/CSurveyQuestion.php new file mode 100644 index 000000000..eb6f3f6c6 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CSurveyQuestion.php @@ -0,0 +1,432 @@ +surveyId = $surveyId; + + return $this; + } + + /** + * Get surveyId. + * + * @return int + */ + public function getSurveyId() + { + return $this->surveyId; + } + + /** + * Set surveyQuestion. + * + * @param string $surveyQuestion + * + * @return CSurveyQuestion + */ + public function setSurveyQuestion($surveyQuestion) + { + $this->surveyQuestion = $surveyQuestion; + + return $this; + } + + /** + * Get surveyQuestion. + * + * @return string + */ + public function getSurveyQuestion() + { + return $this->surveyQuestion; + } + + /** + * Set surveyQuestionComment. + * + * @param string $surveyQuestionComment + * + * @return CSurveyQuestion + */ + public function setSurveyQuestionComment($surveyQuestionComment) + { + $this->surveyQuestionComment = $surveyQuestionComment; + + return $this; + } + + /** + * Get surveyQuestionComment. + * + * @return string + */ + public function getSurveyQuestionComment() + { + return $this->surveyQuestionComment; + } + + /** + * Set type. + * + * @param string $type + * + * @return CSurveyQuestion + */ + public function setType($type) + { + $this->type = $type; + + return $this; + } + + /** + * Get type. + * + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * Set display. + * + * @param string $display + * + * @return CSurveyQuestion + */ + public function setDisplay($display) + { + $this->display = $display; + + return $this; + } + + /** + * Get display. + * + * @return string + */ + public function getDisplay() + { + return $this->display; + } + + /** + * Set sort. + * + * @param int $sort + * + * @return CSurveyQuestion + */ + public function setSort($sort) + { + $this->sort = $sort; + + return $this; + } + + /** + * Get sort. + * + * @return int + */ + public function getSort() + { + return $this->sort; + } + + /** + * Set sharedQuestionId. + * + * @param int $sharedQuestionId + * + * @return CSurveyQuestion + */ + public function setSharedQuestionId($sharedQuestionId) + { + $this->sharedQuestionId = $sharedQuestionId; + + return $this; + } + + /** + * Get sharedQuestionId. + * + * @return int + */ + public function getSharedQuestionId() + { + return $this->sharedQuestionId; + } + + /** + * Set maxValue. + * + * @param int $maxValue + * + * @return CSurveyQuestion + */ + public function setMaxValue($maxValue) + { + $this->maxValue = $maxValue; + + return $this; + } + + /** + * Get maxValue. + * + * @return int + */ + public function getMaxValue() + { + return $this->maxValue; + } + + /** + * Set surveyGroupPri. + * + * @param int $surveyGroupPri + * + * @return CSurveyQuestion + */ + public function setSurveyGroupPri($surveyGroupPri) + { + $this->surveyGroupPri = $surveyGroupPri; + + return $this; + } + + /** + * Get surveyGroupPri. + * + * @return int + */ + public function getSurveyGroupPri() + { + return $this->surveyGroupPri; + } + + /** + * Set surveyGroupSec1. + * + * @param int $surveyGroupSec1 + * + * @return CSurveyQuestion + */ + public function setSurveyGroupSec1($surveyGroupSec1) + { + $this->surveyGroupSec1 = $surveyGroupSec1; + + return $this; + } + + /** + * Get surveyGroupSec1. + * + * @return int + */ + public function getSurveyGroupSec1() + { + return $this->surveyGroupSec1; + } + + /** + * Set surveyGroupSec2. + * + * @param int $surveyGroupSec2 + * + * @return CSurveyQuestion + */ + public function setSurveyGroupSec2($surveyGroupSec2) + { + $this->surveyGroupSec2 = $surveyGroupSec2; + + return $this; + } + + /** + * Get surveyGroupSec2. + * + * @return int + */ + public function getSurveyGroupSec2() + { + return $this->surveyGroupSec2; + } + + /** + * Set questionId. + * + * @param int $questionId + * + * @return CSurveyQuestion + */ + public function setQuestionId($questionId) + { + $this->questionId = $questionId; + + return $this; + } + + /** + * Get questionId. + * + * @return int + */ + public function getQuestionId() + { + return $this->questionId; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CSurveyQuestion + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CSurveyQuestionOption.php b/src/Chamilo/CourseBundle/Entity/CSurveyQuestionOption.php new file mode 100644 index 000000000..6e99b5326 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CSurveyQuestionOption.php @@ -0,0 +1,246 @@ +questionId = $questionId; + + return $this; + } + + /** + * Get questionId. + * + * @return int + */ + public function getQuestionId() + { + return $this->questionId; + } + + /** + * Set surveyId. + * + * @param int $surveyId + * + * @return CSurveyQuestionOption + */ + public function setSurveyId($surveyId) + { + $this->surveyId = $surveyId; + + return $this; + } + + /** + * Get surveyId. + * + * @return int + */ + public function getSurveyId() + { + return $this->surveyId; + } + + /** + * Set optionText. + * + * @param string $optionText + * + * @return CSurveyQuestionOption + */ + public function setOptionText($optionText) + { + $this->optionText = $optionText; + + return $this; + } + + /** + * Get optionText. + * + * @return string + */ + public function getOptionText() + { + return $this->optionText; + } + + /** + * Set sort. + * + * @param int $sort + * + * @return CSurveyQuestionOption + */ + public function setSort($sort) + { + $this->sort = $sort; + + return $this; + } + + /** + * Get sort. + * + * @return int + */ + public function getSort() + { + return $this->sort; + } + + /** + * Set value. + * + * @param int $value + * + * @return CSurveyQuestionOption + */ + public function setValue($value) + { + $this->value = $value; + + return $this; + } + + /** + * Get value. + * + * @return int + */ + public function getValue() + { + return $this->value; + } + + /** + * Set questionOptionId. + * + * @param int $questionOptionId + * + * @return CSurveyQuestionOption + */ + public function setQuestionOptionId($questionOptionId) + { + $this->questionOptionId = $questionOptionId; + + return $this; + } + + /** + * Get questionOptionId. + * + * @return int + */ + public function getQuestionOptionId() + { + return $this->questionOptionId; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CSurveyQuestionOption + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CThematic.php b/src/Chamilo/CourseBundle/Entity/CThematic.php new file mode 100644 index 000000000..bed137c11 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CThematic.php @@ -0,0 +1,247 @@ +title = $title; + + return $this; + } + + /** + * Get title. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set content. + * + * @param string $content + * + * @return CThematic + */ + public function setContent($content) + { + $this->content = $content; + + return $this; + } + + /** + * Get content. + * + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * Set displayOrder. + * + * @param int $displayOrder + * + * @return CThematic + */ + public function setDisplayOrder($displayOrder) + { + $this->displayOrder = $displayOrder; + + return $this; + } + + /** + * Get displayOrder. + * + * @return int + */ + public function getDisplayOrder() + { + return $this->displayOrder; + } + + /** + * Set active. + * + * @param bool $active + * + * @return CThematic + */ + public function setActive($active) + { + $this->active = $active; + + return $this; + } + + /** + * Get active. + * + * @return bool + */ + public function getActive() + { + return $this->active; + } + + /** + * Set sessionId. + * + * @param int $sessionId + * + * @return CThematic + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * Get sessionId. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * Set id. + * + * @param int $id + * + * @return CThematic + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CThematic + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CThematicAdvance.php b/src/Chamilo/CourseBundle/Entity/CThematicAdvance.php new file mode 100644 index 000000000..50afe94d8 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CThematicAdvance.php @@ -0,0 +1,325 @@ +thematicId = $thematicId; + + return $this; + } + + /** + * Get thematicId. + * + * @return int + */ + public function getThematicId() + { + return $this->thematicId; + } + + /** + * Set attendanceId. + * + * @param int $attendanceId + * + * @return CThematicAdvance + */ + public function setAttendanceId($attendanceId) + { + $this->attendanceId = $attendanceId; + + return $this; + } + + /** + * Get attendanceId. + * + * @return int + */ + public function getAttendanceId() + { + return $this->attendanceId; + } + + /** + * Set content. + * + * @param string $content + * + * @return CThematicAdvance + */ + public function setContent($content) + { + $this->content = $content; + + return $this; + } + + /** + * Get content. + * + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * Set startDate. + * + * @param \DateTime $startDate + * + * @return CThematicAdvance + */ + public function setStartDate($startDate) + { + $this->startDate = $startDate; + + return $this; + } + + /** + * Get startDate. + * + * @return \DateTime + */ + public function getStartDate() + { + return $this->startDate; + } + + /** + * Set duration. + * + * @param int $duration + * + * @return CThematicAdvance + */ + public function setDuration($duration) + { + $this->duration = $duration; + + return $this; + } + + /** + * Get duration. + * + * @return int + */ + public function getDuration() + { + return $this->duration; + } + + /** + * Set doneAdvance. + * + * @param bool $doneAdvance + * + * @return CThematicAdvance + */ + public function setDoneAdvance($doneAdvance) + { + $this->doneAdvance = $doneAdvance; + + return $this; + } + + /** + * Get doneAdvance. + * + * @return bool + */ + public function getDoneAdvance() + { + return $this->doneAdvance; + } + + /** + * Set id. + * + * @param int $id + * + * @return CThematicAdvance + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CThematicAdvance + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * @return Room + */ + public function getRoom() + { + return $this->room; + } + + /** + * @return $this + */ + public function setRoom(Room $room) + { + $this->room = $room; + + return $this; + } + + /** + * @return int + */ + public function getIid() + { + return $this->iid; + } + + /** + * @param int $iid + * + * @return CThematicAdvance + */ + public function setIid($iid) + { + $this->iid = $iid; + + return $this; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CThematicPlan.php b/src/Chamilo/CourseBundle/Entity/CThematicPlan.php new file mode 100644 index 000000000..9e44c3485 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CThematicPlan.php @@ -0,0 +1,216 @@ +thematicId = $thematicId; + + return $this; + } + + /** + * Get thematicId. + * + * @return int + */ + public function getThematicId() + { + return $this->thematicId; + } + + /** + * Set title. + * + * @param string $title + * + * @return CThematicPlan + */ + public function setTitle($title) + { + $this->title = $title; + + return $this; + } + + /** + * Get title. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set description. + * + * @param string $description + * + * @return CThematicPlan + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * Get description. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Set descriptionType. + * + * @param int $descriptionType + * + * @return CThematicPlan + */ + public function setDescriptionType($descriptionType) + { + $this->descriptionType = $descriptionType; + + return $this; + } + + /** + * Get descriptionType. + * + * @return int + */ + public function getDescriptionType() + { + return $this->descriptionType; + } + + /** + * Set id. + * + * @param int $id + * + * @return CThematicPlan + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CThematicPlan + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CTool.php b/src/Chamilo/CourseBundle/Entity/CTool.php new file mode 100644 index 000000000..82b5a9886 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CTool.php @@ -0,0 +1,476 @@ +iid; + } + + /** + * @param int $iid + * + * @return CTool + */ + public function setIid($iid) + { + $this->iid = $iid; + + return $this; + } + + /** + * Set name. + * + * @param string $name + * + * @return CTool + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * Get name. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set link. + * + * @param string $link + * + * @return CTool + */ + public function setLink($link) + { + $this->link = $link; + + return $this; + } + + /** + * Get link. + * + * @return string + */ + public function getLink() + { + return $this->link; + } + + /** + * Set image. + * + * @param string $image + * + * @return CTool + */ + public function setImage($image) + { + $this->image = $image; + + return $this; + } + + /** + * Get image. + * + * @return string + */ + public function getImage() + { + return $this->image; + } + + /** + * Set visibility. + * + * @param bool $visibility + * + * @return CTool + */ + public function setVisibility($visibility) + { + $this->visibility = $visibility; + + return $this; + } + + /** + * Get visibility. + * + * @return bool + */ + public function getVisibility() + { + return $this->visibility; + } + + /** + * Set admin. + * + * @param string $admin + * + * @return CTool + */ + public function setAdmin($admin) + { + $this->admin = $admin; + + return $this; + } + + /** + * Get admin. + * + * @return string + */ + public function getAdmin() + { + return $this->admin; + } + + /** + * Set address. + * + * @param string $address + * + * @return CTool + */ + public function setAddress($address) + { + $this->address = $address; + + return $this; + } + + /** + * Get address. + * + * @return string + */ + public function getAddress() + { + return $this->address; + } + + /** + * Set addedTool. + * + * @param bool $addedTool + * + * @return CTool + */ + public function setAddedTool($addedTool) + { + $this->addedTool = $addedTool; + + return $this; + } + + /** + * Get addedTool. + * + * @return bool + */ + public function getAddedTool() + { + return $this->addedTool; + } + + /** + * Set target. + * + * @param string $target + * + * @return CTool + */ + public function setTarget($target) + { + $this->target = $target; + + return $this; + } + + /** + * Get target. + * + * @return string + */ + public function getTarget() + { + return $this->target; + } + + /** + * Set category. + * + * @param string $category + * + * @return CTool + */ + public function setCategory($category) + { + $this->category = $category; + + return $this; + } + + /** + * Get category. + * + * @return string + */ + public function getCategory() + { + return $this->category; + } + + /** + * Set sessionId. + * + * @param int $sessionId + * + * @return CTool + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * Get sessionId. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * Set id. + * + * @param int $id + * + * @return CTool + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CTool + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * @param string $description + * + * @return CTool + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * @return string + */ + public function getCustomIcon() + { + return $this->customIcon; + } + + /** + * @param string $customIcon + * + * @return CTool + */ + public function setCustomIcon($customIcon) + { + $this->customIcon = $customIcon; + + return $this; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CToolIntro.php b/src/Chamilo/CourseBundle/Entity/CToolIntro.php new file mode 100644 index 000000000..834344847 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CToolIntro.php @@ -0,0 +1,163 @@ +introText = $introText; + + return $this; + } + + /** + * Get introText. + * + * @return string + */ + public function getIntroText() + { + return $this->introText; + } + + /** + * Set id. + * + * @param int $id + * + * @return CToolIntro + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CToolIntro + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Set sessionId. + * + * @param int $sessionId + * + * @return CToolIntro + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * Get sessionId. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * Get iid. + * + * @return int + */ + public function getIid() + { + return $this->iid; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CUserinfoContent.php b/src/Chamilo/CourseBundle/Entity/CUserinfoContent.php new file mode 100644 index 000000000..684e1c8c8 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CUserinfoContent.php @@ -0,0 +1,247 @@ +userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set definitionId. + * + * @param int $definitionId + * + * @return CUserinfoContent + */ + public function setDefinitionId($definitionId) + { + $this->definitionId = $definitionId; + + return $this; + } + + /** + * Get definitionId. + * + * @return int + */ + public function getDefinitionId() + { + return $this->definitionId; + } + + /** + * Set editorIp. + * + * @param string $editorIp + * + * @return CUserinfoContent + */ + public function setEditorIp($editorIp) + { + $this->editorIp = $editorIp; + + return $this; + } + + /** + * Get editorIp. + * + * @return string + */ + public function getEditorIp() + { + return $this->editorIp; + } + + /** + * Set editionTime. + * + * @param \DateTime $editionTime + * + * @return CUserinfoContent + */ + public function setEditionTime($editionTime) + { + $this->editionTime = $editionTime; + + return $this; + } + + /** + * Get editionTime. + * + * @return \DateTime + */ + public function getEditionTime() + { + return $this->editionTime; + } + + /** + * Set content. + * + * @param string $content + * + * @return CUserinfoContent + */ + public function setContent($content) + { + $this->content = $content; + + return $this; + } + + /** + * Get content. + * + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * Set id. + * + * @param int $id + * + * @return CUserinfoContent + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CUserinfoContent + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CUserinfoDef.php b/src/Chamilo/CourseBundle/Entity/CUserinfoDef.php new file mode 100644 index 000000000..c38f67e63 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CUserinfoDef.php @@ -0,0 +1,215 @@ +title = $title; + + return $this; + } + + /** + * Get title. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set comment. + * + * @param string $comment + * + * @return CUserinfoDef + */ + public function setComment($comment) + { + $this->comment = $comment; + + return $this; + } + + /** + * Get comment. + * + * @return string + */ + public function getComment() + { + return $this->comment; + } + + /** + * Set lineCount. + * + * @param bool $lineCount + * + * @return CUserinfoDef + */ + public function setLineCount($lineCount) + { + $this->lineCount = $lineCount; + + return $this; + } + + /** + * Get lineCount. + * + * @return bool + */ + public function getLineCount() + { + return $this->lineCount; + } + + /** + * Set rank. + * + * @param bool $rank + * + * @return CUserinfoDef + */ + public function setRank($rank) + { + $this->rank = $rank; + + return $this; + } + + /** + * Get rank. + * + * @return bool + */ + public function getRank() + { + return $this->rank; + } + + /** + * Set id. + * + * @param int $id + * + * @return CUserinfoDef + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CUserinfoDef + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CWiki.php b/src/Chamilo/CourseBundle/Entity/CWiki.php new file mode 100644 index 000000000..eb3fc3fef --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CWiki.php @@ -0,0 +1,907 @@ + + * + * Add @ to the next lines if api_get_configuration_value('wiki_categories_enabled') is true + * ORM\ManyToMany(targetEntity="Chamilo\CourseBundle\Entity\CWikiCategory", inversedBy="wikiPages") + * ORM\JoinTable( + * name="c_wiki_rel_category", + * joinColumns={@ORM\JoinColumn(name="wiki_id", referencedColumnName="iid", onDelete="CASCADE")}, + * inverseJoinColumns={@ORM\JoinColumn(name="category_id", referencedColumnName="id", onDelete="CASCADE")} + * ) + */ + private $categories; + + public function __construct() + { + $this->categories = new ArrayCollection(); + } + + /** + * Set pageId. + * + * @param int $pageId + * + * @return CWiki + */ + public function setPageId($pageId) + { + $this->pageId = $pageId; + + return $this; + } + + /** + * Get pageId. + * + * @return int + */ + public function getPageId() + { + return $this->pageId; + } + + /** + * Set reflink. + * + * @param string $reflink + * + * @return CWiki + */ + public function setReflink($reflink) + { + $this->reflink = $reflink; + + return $this; + } + + /** + * Get reflink. + * + * @return string + */ + public function getReflink() + { + return $this->reflink; + } + + /** + * Set title. + * + * @param string $title + * + * @return CWiki + */ + public function setTitle($title) + { + $this->title = $title; + + return $this; + } + + /** + * Get title. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set content. + * + * @param string $content + * + * @return CWiki + */ + public function setContent($content) + { + $this->content = $content; + + return $this; + } + + /** + * Get content. + * + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * Set userId. + * + * @param int $userId + * + * @return CWiki + */ + public function setUserId($userId) + { + $this->userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set groupId. + * + * @param int $groupId + * + * @return CWiki + */ + public function setGroupId($groupId) + { + $this->groupId = $groupId; + + return $this; + } + + /** + * Get groupId. + * + * @return int + */ + public function getGroupId() + { + return $this->groupId; + } + + /** + * Set dtime. + * + * @param \DateTime $dtime + * + * @return CWiki + */ + public function setDtime($dtime) + { + $this->dtime = $dtime; + + return $this; + } + + /** + * Get dtime. + * + * @return \DateTime + */ + public function getDtime() + { + return $this->dtime; + } + + /** + * Set addlock. + * + * @param int $addlock + * + * @return CWiki + */ + public function setAddlock($addlock) + { + $this->addlock = $addlock; + + return $this; + } + + /** + * Get addlock. + * + * @return int + */ + public function getAddlock() + { + return $this->addlock; + } + + /** + * Set editlock. + * + * @param int $editlock + * + * @return CWiki + */ + public function setEditlock($editlock) + { + $this->editlock = $editlock; + + return $this; + } + + /** + * Get editlock. + * + * @return int + */ + public function getEditlock() + { + return $this->editlock; + } + + /** + * Set visibility. + * + * @param int $visibility + * + * @return CWiki + */ + public function setVisibility($visibility) + { + $this->visibility = $visibility; + + return $this; + } + + /** + * Get visibility. + * + * @return int + */ + public function getVisibility() + { + return $this->visibility; + } + + /** + * Set addlockDisc. + * + * @param int $addlockDisc + * + * @return CWiki + */ + public function setAddlockDisc($addlockDisc) + { + $this->addlockDisc = $addlockDisc; + + return $this; + } + + /** + * Get addlockDisc. + * + * @return int + */ + public function getAddlockDisc() + { + return $this->addlockDisc; + } + + /** + * Set visibilityDisc. + * + * @param int $visibilityDisc + * + * @return CWiki + */ + public function setVisibilityDisc($visibilityDisc) + { + $this->visibilityDisc = $visibilityDisc; + + return $this; + } + + /** + * Get visibilityDisc. + * + * @return int + */ + public function getVisibilityDisc() + { + return $this->visibilityDisc; + } + + /** + * Set ratinglockDisc. + * + * @param int $ratinglockDisc + * + * @return CWiki + */ + public function setRatinglockDisc($ratinglockDisc) + { + $this->ratinglockDisc = $ratinglockDisc; + + return $this; + } + + /** + * Get ratinglockDisc. + * + * @return int + */ + public function getRatinglockDisc() + { + return $this->ratinglockDisc; + } + + /** + * Set assignment. + * + * @param int $assignment + * + * @return CWiki + */ + public function setAssignment($assignment) + { + $this->assignment = $assignment; + + return $this; + } + + /** + * Get assignment. + * + * @return int + */ + public function getAssignment() + { + return $this->assignment; + } + + /** + * Set comment. + * + * @param string $comment + * + * @return CWiki + */ + public function setComment($comment) + { + $this->comment = $comment; + + return $this; + } + + /** + * Get comment. + * + * @return string + */ + public function getComment() + { + return $this->comment; + } + + /** + * Set progress. + * + * @param string $progress + * + * @return CWiki + */ + public function setProgress($progress) + { + $this->progress = $progress; + + return $this; + } + + /** + * Get progress. + * + * @return string + */ + public function getProgress() + { + return $this->progress; + } + + /** + * Set score. + * + * @param int $score + * + * @return CWiki + */ + public function setScore($score) + { + $this->score = $score; + + return $this; + } + + /** + * Get score. + * + * @return int + */ + public function getScore() + { + return $this->score; + } + + /** + * Set version. + * + * @param int $version + * + * @return CWiki + */ + public function setVersion($version) + { + $this->version = $version; + + return $this; + } + + /** + * Get version. + * + * @return int + */ + public function getVersion() + { + return $this->version; + } + + /** + * Set isEditing. + * + * @param int $isEditing + * + * @return CWiki + */ + public function setIsEditing($isEditing) + { + $this->isEditing = $isEditing; + + return $this; + } + + /** + * Get isEditing. + * + * @return int + */ + public function getIsEditing() + { + return $this->isEditing; + } + + /** + * Set timeEdit. + * + * @param \DateTime $timeEdit + * + * @return CWiki + */ + public function setTimeEdit($timeEdit) + { + $this->timeEdit = $timeEdit; + + return $this; + } + + /** + * Get timeEdit. + * + * @return \DateTime + */ + public function getTimeEdit() + { + return $this->timeEdit; + } + + /** + * Set hits. + * + * @param int $hits + * + * @return CWiki + */ + public function setHits($hits) + { + $this->hits = $hits; + + return $this; + } + + /** + * Get hits. + * + * @return int + */ + public function getHits() + { + return $this->hits; + } + + /** + * Set linksto. + * + * @param string $linksto + * + * @return CWiki + */ + public function setLinksto($linksto) + { + $this->linksto = $linksto; + + return $this; + } + + /** + * Get linksto. + * + * @return string + */ + public function getLinksto() + { + return $this->linksto; + } + + /** + * Set tag. + * + * @param string $tag + * + * @return CWiki + */ + public function setTag($tag) + { + $this->tag = $tag; + + return $this; + } + + /** + * Get tag. + * + * @return string + */ + public function getTag() + { + return $this->tag; + } + + /** + * Set userIp. + * + * @param string $userIp + * + * @return CWiki + */ + public function setUserIp($userIp) + { + $this->userIp = $userIp; + + return $this; + } + + /** + * Get userIp. + * + * @return string + */ + public function getUserIp() + { + return $this->userIp; + } + + /** + * Set sessionId. + * + * @param int $sessionId + * + * @return CWiki + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * Get sessionId. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * Set id. + * + * @param int $id + * + * @return CWiki + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + public function getIid(): int + { + return $this->iid; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CWiki + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + public function getCategories() + { + return $this->categories; + } + + public function addCategory(CWikiCategory $category): CWiki + { + $category->addWikiPage($this); + $this->categories->add($category); + + return $this; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CWikiCategory.php b/src/Chamilo/CourseBundle/Entity/CWikiCategory.php new file mode 100644 index 000000000..ae640e315 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CWikiCategory.php @@ -0,0 +1,192 @@ + + * @ORM\ManyToMany(targetEntity="Chamilo\CourseBundle\Entity\CWiki", mappedBy="categories") + */ + private $wikiPages; + /** + * @var Course + * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course") + * @ORM\JoinColumn(name="c_id", referencedColumnName="id", nullable=false, onDelete="CASCADE") + */ + private $course; + /** + * @var Session|null + * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Session") + * @ORM\JoinColumn(name="session_id", referencedColumnName="id", onDelete="CASCADE") + */ + private $session; + /** + * @var int|null + * @Gedmo\TreeLeft() + * @ORM\Column(name="lft", type="integer") + */ + private $lft; + /** + * @var int|null + * @Gedmo\TreeLevel() + * @ORM\Column(name="lvl", type="integer") + */ + private $lvl; + /** + * @var int|null + * @Gedmo\TreeRight() + * @ORM\Column(name="rgt", type="integer") + */ + private $rgt; + /** + * @var CWikiCategory|null + * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CWikiCategory") + * @ORM\JoinColumn(name="tree_root", referencedColumnName="id", onDelete="CASCADE") + */ + private $root; + /** + * @var CWikiCategory|null + * @Gedmo\TreeParent() + * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CWikiCategory", inversedBy="children") + * @ORM\JoinColumn(name="parent_id", referencedColumnName="id", onDelete="CASCADE") + */ + private $parent; + /** + * @var Collection + * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CWikiCategory", mappedBy="parent") + * @ORM\OrderBy({"lft"="ASC"}) + */ + private $children; + + public function __construct() + { + $this->parent = null; + $this->children = new ArrayCollection(); + $this->wikiPages = new ArrayCollection(); + } + + public function __toString() + { + return $this->name; + } + + public function getId(): int + { + return $this->id; + } + + public function getName(): string + { + return $this->name; + } + + public function getNodeName(): string + { + return str_repeat('    ', $this->lvl).$this->name; + } + + public function setName(string $name): CWikiCategory + { + $this->name = $name; + + return $this; + } + + public function getCourse(): Course + { + return $this->course; + } + + public function setCourse(Course $course): CWikiCategory + { + $this->course = $course; + + return $this; + } + + public function getSession(): ?Session + { + return $this->session; + } + + public function setSession(?Session $session): CWikiCategory + { + $this->session = $session; + + return $this; + } + + public function getRoot(): ?CWikiCategory + { + return $this->root; + } + + public function getParent(): ?CWikiCategory + { + return $this->parent; + } + + public function setParent(?CWikiCategory $parent): CWikiCategory + { + $this->parent = $parent; + + return $this; + } + + public function getChildren(): Collection + { + return $this->children; + } + + public function setChildren(Collection $children): CWikiCategory + { + $this->children = $children; + + return $this; + } + + public function addWikiPage(CWiki $page): CWikiCategory + { + $this->wikiPages->add($page); + + return $this; + } + + public function getWikiPages(): Collection + { + return $this->wikiPages; + } + + public function getLvl(): ?int + { + return $this->lvl; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CWikiConf.php b/src/Chamilo/CourseBundle/Entity/CWikiConf.php new file mode 100644 index 000000000..95ef200cd --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CWikiConf.php @@ -0,0 +1,495 @@ +task = $task; + + return $this; + } + + /** + * Get task. + * + * @return string + */ + public function getTask() + { + return $this->task; + } + + /** + * Set feedback1. + * + * @param string $feedback1 + * + * @return CWikiConf + */ + public function setFeedback1($feedback1) + { + $this->feedback1 = $feedback1; + + return $this; + } + + /** + * Get feedback1. + * + * @return string + */ + public function getFeedback1() + { + return $this->feedback1; + } + + /** + * Set feedback2. + * + * @param string $feedback2 + * + * @return CWikiConf + */ + public function setFeedback2($feedback2) + { + $this->feedback2 = $feedback2; + + return $this; + } + + /** + * Get feedback2. + * + * @return string + */ + public function getFeedback2() + { + return $this->feedback2; + } + + /** + * Set feedback3. + * + * @param string $feedback3 + * + * @return CWikiConf + */ + public function setFeedback3($feedback3) + { + $this->feedback3 = $feedback3; + + return $this; + } + + /** + * Get feedback3. + * + * @return string + */ + public function getFeedback3() + { + return $this->feedback3; + } + + /** + * Set fprogress1. + * + * @param string $fprogress1 + * + * @return CWikiConf + */ + public function setFprogress1($fprogress1) + { + $this->fprogress1 = $fprogress1; + + return $this; + } + + /** + * Get fprogress1. + * + * @return string + */ + public function getFprogress1() + { + return $this->fprogress1; + } + + /** + * Set fprogress2. + * + * @param string $fprogress2 + * + * @return CWikiConf + */ + public function setFprogress2($fprogress2) + { + $this->fprogress2 = $fprogress2; + + return $this; + } + + /** + * Get fprogress2. + * + * @return string + */ + public function getFprogress2() + { + return $this->fprogress2; + } + + /** + * Set fprogress3. + * + * @param string $fprogress3 + * + * @return CWikiConf + */ + public function setFprogress3($fprogress3) + { + $this->fprogress3 = $fprogress3; + + return $this; + } + + /** + * Get fprogress3. + * + * @return string + */ + public function getFprogress3() + { + return $this->fprogress3; + } + + /** + * Set maxSize. + * + * @param int $maxSize + * + * @return CWikiConf + */ + public function setMaxSize($maxSize) + { + $this->maxSize = $maxSize; + + return $this; + } + + /** + * Get maxSize. + * + * @return int + */ + public function getMaxSize() + { + return $this->maxSize; + } + + /** + * Set maxText. + * + * @param int $maxText + * + * @return CWikiConf + */ + public function setMaxText($maxText) + { + $this->maxText = $maxText; + + return $this; + } + + /** + * Get maxText. + * + * @return int + */ + public function getMaxText() + { + return $this->maxText; + } + + /** + * Set maxVersion. + * + * @param int $maxVersion + * + * @return CWikiConf + */ + public function setMaxVersion($maxVersion) + { + $this->maxVersion = $maxVersion; + + return $this; + } + + /** + * Get maxVersion. + * + * @return int + */ + public function getMaxVersion() + { + return $this->maxVersion; + } + + /** + * Set startdateAssig. + * + * @param \DateTime $startdateAssig + * + * @return CWikiConf + */ + public function setStartdateAssig($startdateAssig) + { + $this->startdateAssig = $startdateAssig; + + return $this; + } + + /** + * Get startdateAssig. + * + * @return \DateTime + */ + public function getStartdateAssig() + { + return $this->startdateAssig; + } + + /** + * Set enddateAssig. + * + * @param \DateTime $enddateAssig + * + * @return CWikiConf + */ + public function setEnddateAssig($enddateAssig) + { + $this->enddateAssig = $enddateAssig; + + return $this; + } + + /** + * Get enddateAssig. + * + * @return \DateTime + */ + public function getEnddateAssig() + { + return $this->enddateAssig; + } + + /** + * Set delayedsubmit. + * + * @param int $delayedsubmit + * + * @return CWikiConf + */ + public function setDelayedsubmit($delayedsubmit) + { + $this->delayedsubmit = $delayedsubmit; + + return $this; + } + + /** + * Get delayedsubmit. + * + * @return int + */ + public function getDelayedsubmit() + { + return $this->delayedsubmit; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CWikiConf + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Set pageId. + * + * @param int $pageId + * + * @return CWikiConf + */ + public function setPageId($pageId) + { + $this->pageId = $pageId; + + return $this; + } + + /** + * Get pageId. + * + * @return int + */ + public function getPageId() + { + return $this->pageId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CWikiDiscuss.php b/src/Chamilo/CourseBundle/Entity/CWikiDiscuss.php new file mode 100644 index 000000000..a7a740c4c --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CWikiDiscuss.php @@ -0,0 +1,246 @@ +publicationId = $publicationId; + + return $this; + } + + /** + * Get publicationId. + * + * @return int + */ + public function getPublicationId() + { + return $this->publicationId; + } + + /** + * Set usercId. + * + * @param int $usercId + * + * @return CWikiDiscuss + */ + public function setUsercId($usercId) + { + $this->usercId = $usercId; + + return $this; + } + + /** + * Get usercId. + * + * @return int + */ + public function getUsercId() + { + return $this->usercId; + } + + /** + * Set comment. + * + * @param string $comment + * + * @return CWikiDiscuss + */ + public function setComment($comment) + { + $this->comment = $comment; + + return $this; + } + + /** + * Get comment. + * + * @return string + */ + public function getComment() + { + return $this->comment; + } + + /** + * Set pScore. + * + * @param string $pScore + * + * @return CWikiDiscuss + */ + public function setPScore($pScore) + { + $this->pScore = $pScore; + + return $this; + } + + /** + * Get pScore. + * + * @return string + */ + public function getPScore() + { + return $this->pScore; + } + + /** + * Set dtime. + * + * @param \DateTime $dtime + * + * @return CWikiDiscuss + */ + public function setDtime($dtime) + { + $this->dtime = $dtime; + + return $this; + } + + /** + * Get dtime. + * + * @return \DateTime + */ + public function getDtime() + { + return $this->dtime; + } + + /** + * Set id. + * + * @param int $id + * + * @return CWikiDiscuss + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CWikiDiscuss + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/CWikiMailcue.php b/src/Chamilo/CourseBundle/Entity/CWikiMailcue.php new file mode 100644 index 000000000..8b495c0c4 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/CWikiMailcue.php @@ -0,0 +1,237 @@ +type = $type; + + return $this; + } + + /** + * Get type. + * + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * Set groupId. + * + * @param int $groupId + * + * @return CWikiMailcue + */ + public function setGroupId($groupId) + { + $this->groupId = $groupId; + + return $this; + } + + /** + * Get groupId. + * + * @return int + */ + public function getGroupId() + { + return $this->groupId; + } + + /** + * Set sessionId. + * + * @param int $sessionId + * + * @return CWikiMailcue + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * Get sessionId. + * + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * Set cId. + * + * @param int $cId + * + * @return CWikiMailcue + */ + public function setCId($cId) + { + $this->cId = $cId; + + return $this; + } + + /** + * Get cId. + * + * @return int + */ + public function getCId() + { + return $this->cId; + } + + /** + * Set id. + * + * @param int $id + * + * @return CWikiMailcue + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set userId. + * + * @param int $userId + * + * @return CWikiMailcue + */ + public function setUserId($userId) + { + $this->userId = $userId; + + return $this; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * @return int + */ + public function getIid() + { + return $this->iid; + } + + /** + * @param int $iid + * + * @return CWikiMailcue + */ + public function setIid($iid) + { + $this->iid = $iid; + + return $this; + } +} diff --git a/src/Chamilo/CourseBundle/Entity/Repository/CNotebookRepository.php b/src/Chamilo/CourseBundle/Entity/Repository/CNotebookRepository.php new file mode 100644 index 000000000..ac54ba6cd --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/Repository/CNotebookRepository.php @@ -0,0 +1,80 @@ +createQueryBuilder('N'); + $qb + ->where( + $qb->expr()->andX( + $qb->expr()->eq('N.userId', $user->getId()), + $qb->expr()->eq('N.cId', $course->getId()) + ) + ); + + if ($session) { + $qb->andWhere( + $qb->expr()->eq('N.sessionId', $session->getId()) + ); + } else { + $qb->andWhere( + $qb->expr()->orX( + $qb->expr()->eq('N.sessionId', 0), + $qb->expr()->isNull('N.sessionId') + ) + ); + } + + if ($orderField === 'N.updateDate') { + $qb->andWhere( + $qb->expr()->orX( + $qb->expr()->neq('N.updateDate', ''), + $qb->expr()->isNotNull('N.updateDate') + ) + ); + } + + $qb->orderBy($orderField, $orderDirection); + + return $qb->getQuery()->getResult(); + } +} diff --git a/src/Chamilo/CourseBundle/Entity/Repository/CQuizQuestionRepository.php b/src/Chamilo/CourseBundle/Entity/Repository/CQuizQuestionRepository.php new file mode 100644 index 000000000..ebeb8ff4a --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/Repository/CQuizQuestionRepository.php @@ -0,0 +1,53 @@ +createQueryBuilder('qq') + ->select('COUNT(qq)') + ->innerJoin(CQuizRelQuestion::class, 'qrq', Join::WITH, 'qq.iid = qrq.questionId') + ->where('qrq.exerciceId = :id') + ->setParameters(['id' => $exerciseId]) + ->getQuery() + ; + + return (int) $query->getSingleScalarResult(); + } + + /** + * @throws NonUniqueResultException + * @throws NoResultException + */ + public function countEmbeddableQuestionsInExercise(int $exerciseId): int + { + $query = $this->createQueryBuilder('qq') + ->select('COUNT(qq)') + ->innerJoin(CQuizRelQuestion::class, 'qrq', Join::WITH, 'qq.iid = qrq.questionId') + ->where('qrq.exerciceId = :id AND qq.type IN (:types)') + ->setParameters( + [ + 'id' => $exerciseId, + 'types' => \ExerciseLib::getEmbeddableTypes(), + ] + ) + ->getQuery() + ; + + return (int) $query->getSingleScalarResult(); + } +} diff --git a/src/Chamilo/CourseBundle/Entity/Repository/CStudentPublicationRepository.php b/src/Chamilo/CourseBundle/Entity/Repository/CStudentPublicationRepository.php new file mode 100644 index 000000000..630cdaa91 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/Repository/CStudentPublicationRepository.php @@ -0,0 +1,58 @@ +createQueryBuilder('w'); + + return $qb + ->leftJoin( + 'ChamiloCourseBundle:CStudentPublicationAssignment', + 'a', + Join::WITH, + 'a.publicationId = w.iid AND a.cId = w.cId' + ) + ->where( + $qb->expr()->andX( + $qb->expr()->eq('w.cId', ':course'), + $qb->expr()->eq('w.session', ':session'), + $qb->expr()->in('w.active', [0, 1]), + $qb->expr()->eq('w.parentId', 0), + $qb->expr()->eq('w.postGroupId', ':group'), + $qb->expr()->eq('w.userId', ':user') + ) + ) + ->orderBy('w.sentDate', 'ASC') + ->setParameters([ + 'course' => intval($course->getId()), + 'session' => $session, + 'group' => intval($groupId), + 'user' => $user->getId(), + ]) + ->getQuery() + ->getResult(); + } +} diff --git a/src/Chamilo/CourseBundle/Entity/Repository/CWikiCategoryRepository.php b/src/Chamilo/CourseBundle/Entity/Repository/CWikiCategoryRepository.php new file mode 100644 index 000000000..15a9e4b04 --- /dev/null +++ b/src/Chamilo/CourseBundle/Entity/Repository/CWikiCategoryRepository.php @@ -0,0 +1,44 @@ +findBy(['course' => $course, 'session' => $session], ['lft' => 'ASC']); + } + + public function countByCourse(Course $course, ?Session $session): int + { + return $this->count(['course' => $course, 'session' => $session]); + } + + /** + * @return array|string + */ + public function buildCourseTree(Course $course, ?Session $session, array $options = []) + { + $whereParams = ['course' => $course]; + + if ($session) { + $whereParams['session'] = $session; + } + + $qb = $this->createQueryBuilder('c') + ->where('c.course = :course') + ->andWhere($session ? 'c.session = :session' : 'c.session IS NULL') + ->orderBy('c.lft', 'ASC') + ->setParameters($whereParams) + ->getQuery() + ; + + return $this->buildTree($qb->getArrayResult(), $options); + } +} diff --git a/src/Chamilo/CourseBundle/Resources/config/admin.yml b/src/Chamilo/CourseBundle/Resources/config/admin.yml new file mode 100644 index 000000000..04833edc3 --- /dev/null +++ b/src/Chamilo/CourseBundle/Resources/config/admin.yml @@ -0,0 +1,56 @@ +services: +# sonata.admin.course: +# class: Chamilo\CourseBundle\Admin\CourseAdmin +# tags: +# - { name: sonata.admin, manager_type: orm, audit: true, group: "LMS", label: "Course" } +# arguments: +# - ~ +# - Chamilo\CoreBundle\Entity\Course +# - ~ +# calls: +# - [ setTranslationDomain, [ChamiloCoreBundle]] +# - [ setToolChain, [@chamilo_course.tool_chain]] + + sonata.admin.course_rel_user: + class: Chamilo\CourseBundle\Admin\CourseRelUserAdmin + tags: + - { name: sonata.admin, manager_type: orm, group: "LMS", label: "CourseRelUser" } + arguments: + - ~ + - Chamilo\CoreBundle\Entity\CourseRelUser + - ~ + calls: + - [ setTranslationDomain, [ChamiloCoreBundle]] + + sonata.admin.course_category: + class: Chamilo\CourseBundle\Admin\CourseCategoryAdmin + tags: + - { name: sonata.admin, manager_type: orm, group: "LMS", label: "CourseCategoryAdmin" } + arguments: + - ~ + - Chamilo\CoreBundle\Entity\CourseCategory + - ~ + calls: + - [ setTranslationDomain, [ChamiloCoreBundle]] + + sonata.admin.course_request: + class: Chamilo\CourseBundle\Admin\CourseRequestAdmin + tags: + - { name: sonata.admin, manager_type: orm, group: "LMS", label: "CourseRequestAdmin" } + arguments: + - ~ + - Chamilo\CoreBundle\Entity\CourseRequest + - ~ + calls: + - [ setTranslationDomain, [ChamiloCoreBundle]] + + sonata.admin.c_group_info: + class: Chamilo\CourseBundle\Admin\CGroupInfoAdmin + tags: + - { name: sonata.admin, manager_type: orm, audit: true, group: "LMS", label: "CGroupInfo" } + arguments: + - ~ + - Chamilo\CourseBundle\Entity\CGroupInfo + - ~ + calls: + - [ setTranslationDomain, [ChamiloCoreBundle]] \ No newline at end of file diff --git a/src/Chamilo/FaqBundle/Admin/CategoryAdmin.php b/src/Chamilo/FaqBundle/Admin/CategoryAdmin.php new file mode 100644 index 000000000..cb4933341 --- /dev/null +++ b/src/Chamilo/FaqBundle/Admin/CategoryAdmin.php @@ -0,0 +1,65 @@ + 1, + '_sort_by' => 'created_at', + '_sort_order' => 'Desc', + ]; + + protected function configureDatagridFilters(DatagridMapper $datagridMapper) + { + $datagridMapper + //->add('headline') + //->add('body') + ->add('rank') + ->add('isActive') + ; + } + + protected function configureListFields(ListMapper $listMapper) + { + $listMapper + //->add('headline', null, array('identifier' => true)) + ->add('translations', null, ['identifier' => true]) + ->add('rank') + ->add( + '_action', + 'actions', + [ + 'actions' => [ + //'show' => array(), + 'preview' => ['template' => 'ChamiloFaqBundle:Faq:preview_category_partial.html.twig'], + 'edit' => [], + 'delete' => [], + ], + ] + ) + ; + } + + protected function configureFormFields(FormMapper $formMapper) + { + $formMapper + ->add('translations', 'a2lix_translations', []) + ->add('rank', null, ['required' => false]) +// ->add('slug') + ->add('isActive') + ->end() + ; + } +} diff --git a/src/Chamilo/FaqBundle/Admin/QuestionAdmin.php b/src/Chamilo/FaqBundle/Admin/QuestionAdmin.php new file mode 100644 index 000000000..13cfd5ef6 --- /dev/null +++ b/src/Chamilo/FaqBundle/Admin/QuestionAdmin.php @@ -0,0 +1,71 @@ + 1, + '_sort_by' => 'issueDate', + '_sort_order' => 'Desc', + ]; + + protected function configureDatagridFilters(DatagridMapper $datagridMapper) + { + $datagridMapper + ->add('id') + ->add('isActive') + ; + } + + protected function configureListFields(ListMapper $listMapper) + { + $listMapper + ->addIdentifier('id') + ->add('translations', null, ['identifier' => true]) + ->add('Category') + ->add('rank') + ->add( + '_action', + 'actions', + [ + 'actions' => [ + //'show' => array(), + 'preview' => ['template' => 'ChamiloFaqBundle:Faq:preview_question_partial.html.twig'], + 'edit' => [], + 'delete' => [], + ], + ] + ); + } + + protected function configureFormFields(FormMapper $formMapper) + { + $formMapper + ->add('translations', 'a2lix_translations', []) + ->add( + 'category', + null, + [ + 'expanded' => true, + 'required' => true, + 'attr' => ['class' => 'radio-list vertical'], + ] + ) + ->add('rank', null, ['required' => false]) + ->add('onlyAuthUsers') + ->add('isActive') + ->end(); + } +} diff --git a/src/Chamilo/FaqBundle/ChamiloFaqBundle.php b/src/Chamilo/FaqBundle/ChamiloFaqBundle.php new file mode 100644 index 000000000..bfec05b42 --- /dev/null +++ b/src/Chamilo/FaqBundle/ChamiloFaqBundle.php @@ -0,0 +1,17 @@ +generateRedirectToDefaultSelection($categorySlug, $questionSlug); + if ($redirect) { + return $redirect; + } + } + + // Otherwise get the selected category and/or question as usual + $questions = []; + $categories = $this->getCategoryRepository()->retrieveActive(); + $selectedCategory = $this->getSelectedCategory($categorySlug); + $selectedQuestion = $this->getSelectedQuestion($questionSlug); + + if ($selectedCategory) { + $questions = $selectedCategory->getQuestions(); + } + + // Throw 404 if there is no category in the database + if (!$categories) { + throw $this->createNotFoundException('You need at least 1 active faq category in the database'); + } + + return $this->render( + '@ChamiloFaq/Faq/index.html.twig', + [ + 'categories' => $categories, + 'questions' => $questions, + 'selectedCategory' => $selectedCategory, + 'selectedQuestion' => $selectedQuestion, + ] + ); + } + + /** + * Index without any collapsing. Will just show all categories and questions at once. + * + * @param string $categorySlug + * + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException + * + * @return \Symfony\Component\HttpFoundation\Response + */ + public function indexWithoutCollapseAction($categorySlug) + { + if ($categorySlug) { + $categories = $this->getCategoryRepository()->retrieveActiveBySlug($categorySlug); + } else { + $categories = $this->getCategoryRepository()->retrieveActive(); + } + + if (!$categories) { + throw $this->createNotFoundException('Faq category not found'); + } + + return $this->render( + '@ChamiloFaq/Faq/index_without_collapse.html.twig', + [ + 'categories' => $categories, + 'categorySlug' => $categorySlug, + ] + ); + } + + /** + * Open first category or question if none was selected so far. + * + * @param string $categorySlug + * @param string $questionSlug + * + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException + * + * @return \Symfony\Component\HttpFoundation\RedirectResponse + */ + protected function generateRedirectToDefaultSelection($categorySlug, $questionSlug) + { + $doRedirect = false; + //$config = $this->container->getParameter('faq'); + $config = []; + $config['select_first_category_by_default'] = false; + $config['select_first_question_by_default'] = false; + + if (!$categorySlug && $config['select_first_category_by_default']) { + $firstCategory = $this->getCategoryRepository()->retrieveFirst(); + if ($firstCategory instanceof Category) { + $categorySlug = $firstCategory->getSlug(); + $doRedirect = true; + } else { + throw $this->createNotFoundException('Tried to open the first faq category by default, but there was none.'); + } + } + + if (!$questionSlug && $config['select_first_question_by_default']) { + $firstQuestion = $this->getQuestionRepository()->retrieveFirstByCategorySlug($categorySlug); + if ($firstQuestion instanceof Question) { + $questionSlug = $firstQuestion->getSlug(); + $doRedirect = true; + } else { + throw $this->createNotFoundException('Tried to open the first faq question by default, but there was none.'); + } + } + + if ($doRedirect) { + return $this->redirect( + $this->generateUrl('faq', ['categorySlug' => $categorySlug, 'questionSlug' => $questionSlug], true) + ); + } + + return false; + } + + /** + * @param string $questionSlug + * + * @return Question + */ + protected function getSelectedQuestion($questionSlug = null) + { + $selectedQuestion = null; + + if ($questionSlug !== null) { + $selectedQuestion = $this->getQuestionRepository()->getQuestionBySlug($questionSlug); + } + + return $selectedQuestion; + } + + /** + * @param string $categorySlug + * + * @return Category + */ + protected function getSelectedCategory($categorySlug = null) + { + $selectedCategory = null; + + if ($categorySlug !== null) { + $selectedCategory = $this->getCategoryRepository()->getCategoryActiveBySlug($categorySlug); + } + + return $selectedCategory; + } + + /** + * @return QuestionRepository + */ + protected function getQuestionRepository() + { + return $this->container->get('faq.entity.question_repository'); + } + + /** + * @return CategoryRepository + */ + protected function getCategoryRepository() + { + return $this->container->get('faq.entity.category_repository'); + } +} diff --git a/src/Chamilo/FaqBundle/DependencyInjection/ChamiloFaqExtension.php b/src/Chamilo/FaqBundle/DependencyInjection/ChamiloFaqExtension.php new file mode 100644 index 000000000..d923660a4 --- /dev/null +++ b/src/Chamilo/FaqBundle/DependencyInjection/ChamiloFaqExtension.php @@ -0,0 +1,27 @@ +load('admin.yml'); + $loader->load('services.yml'); + } +} diff --git a/src/Chamilo/FaqBundle/Entity/Category.php b/src/Chamilo/FaqBundle/Entity/Category.php new file mode 100644 index 000000000..390cd0c61 --- /dev/null +++ b/src/Chamilo/FaqBundle/Entity/Category.php @@ -0,0 +1,234 @@ +proxyCurrentLocaleTranslation($method, $arguments); + } + + /** + * Returns a string representation of this object. + * + * @return string + */ + public function __toString() + { + return $this->getHeadline(); + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get rank. + * + * @return string + */ + public function getRank() + { + return $this->rank; + } + + /** + * Set rank. + * + * @param string $rank + * + * @return Question + */ + public function setRank($rank) + { + $this->rank = $rank; + + return $this; + } + + /** + * Set is_active. + * + * @param bool $isActive + * + * @return Category + */ + public function setIsActive($isActive) + { + $this->isActive = $isActive; + + return $this; + } + + /** + * Get isActive. + * + * @return bool + */ + public function getIsActive() + { + return $this->isActive; + } + + /** + * Set createdAt. + * + * @return Category + */ + public function setCreatedAt(\DateTime $createdAt) + { + $this->createdAt = $createdAt; + + return $this; + } + + /** + * Get createdAt. + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + * Set updatedAt. + * + * @return Category + */ + public function setUpdatedAt(\DateTime $updatedAt) + { + $this->updatedAt = $updatedAt; + + return $this; + } + + /** + * Get updatedAt. + * + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->updatedAt; + } + + /** + * Add question. + * + * @return Category + */ + public function addQuestion(Question $question) + { + $this->questions[] = $question; + + return $this; + } + + /** + * Remove question. + */ + public function removeQuestion(Question $question) + { + $this->questions->removeElement($question); + } + + /** + * Get questions. + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getQuestions() + { + return $this->questions; + } + + /** + * Returns the route name for url generation. + * + * @return string + */ + public function getRouteName() + { + return 'faq'; + } + + /** + * Returns the route parameters for url generation. + * + * @return array + */ + public function getRouteParameters() + { + return [ + 'categorySlug' => $this->getSlug(), + ]; + } +} diff --git a/src/Chamilo/FaqBundle/Entity/CategoryRepository.php b/src/Chamilo/FaqBundle/Entity/CategoryRepository.php new file mode 100644 index 000000000..ad8a4f2a7 --- /dev/null +++ b/src/Chamilo/FaqBundle/Entity/CategoryRepository.php @@ -0,0 +1,83 @@ +createQueryBuilder('c') + ->where('c.isActive = :isActive') + ->orderBy('c.rank', 'ASC') + ->getQuery(); + + $query->setParameter('isActive', true); + + return $query->execute(); + } + + /** + * @param string $slug + * + * @return mixed + */ + public function retrieveActiveBySlug($slug) + { + $query = $this->createQueryBuilder('c') + ->where('c.isActive = :isActive') + ->andWhere('c.slug = :slug') + ->orderBy('c.rank', 'ASC') + ->getQuery(); + + $query->setParameter('isActive', true); + $query->setParameter('slug', $slug); + + return $query->execute(); + } + + /** + * @param string $slug + * + * @return mixed + */ + public function getCategoryActiveBySlug($slug) + { + $query = $this->createQueryBuilder('c') + ->join('c.translations', 't') + ->where('c.isActive = :isActive') + ->andWhere('t.slug = :slug') + ->getQuery(); + + $query->setParameter('isActive', true); + $query->setParameter('slug', $slug); + + return $query->getOneOrNullResult(); + } + + /** + * @return Category|null + */ + public function retrieveFirst() + { + $query = $this->createQueryBuilder('c') + ->where('c.isActive = :isActive') + ->orderBy('c.rank', 'ASC') + ->setMaxResults(1) + ->getQuery(); + + $query->setParameter('isActive', true); + + return $query->getOneOrNullResult(); + } +} diff --git a/src/Chamilo/FaqBundle/Entity/CategoryTranslation.php b/src/Chamilo/FaqBundle/Entity/CategoryTranslation.php new file mode 100644 index 000000000..72bf018d2 --- /dev/null +++ b/src/Chamilo/FaqBundle/Entity/CategoryTranslation.php @@ -0,0 +1,103 @@ +headline; + } + + /** + * @return mixed + */ + public function getHeadline() + { + return $this->headline; + } + + /** + * @param mixed $headline + * + * @return CategoryTranslation + */ + public function setHeadline($headline) + { + $this->headline = $headline; + + return $this; + } + + /** + * @return mixed + */ + public function getBody() + { + return $this->body; + } + + /** + * @param mixed $body + * + * @return CategoryTranslation + */ + public function setBody($body) + { + $this->body = $body; + + return $this; + } + + /** + * @return mixed + */ + public function getSlug() + { + return $this->slug; + } + + /** + * @param mixed $slug + * + * @return CategoryTranslation + */ + public function setSlug($slug) + { + $this->slug = $slug; + + return $this; + } +} diff --git a/src/Chamilo/FaqBundle/Entity/Question.php b/src/Chamilo/FaqBundle/Entity/Question.php new file mode 100644 index 000000000..560488630 --- /dev/null +++ b/src/Chamilo/FaqBundle/Entity/Question.php @@ -0,0 +1,267 @@ +proxyCurrentLocaleTranslation($method, $arguments); + } + + /** + * Returns a string representation of this object. + * + * @return string + */ + public function __toString() + { + return $this->getHeadline(); + } + + /** + * Get id. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get rank. + * + * @return string + */ + public function getRank() + { + return $this->rank; + } + + /** + * Set rank. + * + * @param string $rank + * + * @return Question + */ + public function setRank($rank) + { + $this->rank = $rank; + + return $this; + } + + /** + * Set createdAt. + * + * @param \DateTime $createdAt + * + * @return Question + */ + public function setCreatedAt($createdAt) + { + $this->createdAt = $createdAt; + + return $this; + } + + /** + * Get createdAt. + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + * Set updatedAt. + * + * @param \DateTime $updatedAt + * + * @return Question + */ + public function setUpdatedAt($updatedAt) + { + $this->updatedAt = $updatedAt; + + return $this; + } + + /** + * Get updatedAt. + * + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->updatedAt; + } + + /** + * Set category. + * + * @param Category $category + * + * @return Question + */ + public function setCategory(Category $category = null) + { + $this->category = $category; + + return $this; + } + + /** + * Get category. + * + * @return Category + */ + public function getCategory() + { + return $this->category; + } + + /** + * Returns the route name for url generation. + * + * @return string + */ + public function getRouteName() + { + return 'faq'; + } + + /** + * Returns the route parameters for url generation. + * + * @return array + */ + public function getRouteParameters() + { + return [ + 'categorySlug' => $this->getCategory()->getSlug(), + 'questionSlug' => $this->getSlug(), + ]; + } + + /** + * Returns a string representation of the entity build out of BundleName + EntityName + EntityId. + * + * @return string + */ + public function getEntityIdentifier() + { + return 'GenjFaqBundle:Question:'.$this->getId(); + } + + /** + * @return bool + */ + public function isOnlyAuthUsers() + { + return $this->onlyAuthUsers; + } + + /** + * @param bool $onlyAuthUsers + * + * @return Question + */ + public function setOnlyAuthUsers($onlyAuthUsers) + { + $this->onlyAuthUsers = $onlyAuthUsers; + + return $this; + } + + /** + * Set is_active. + * + * @param bool $isActive + * + * @return Question + */ + public function setIsActive($isActive) + { + $this->isActive = $isActive; + + return $this; + } + + /** + * Get isActive. + * + * @return bool + */ + public function getIsActive() + { + return $this->isActive; + } +} diff --git a/src/Chamilo/FaqBundle/Entity/QuestionRepository.php b/src/Chamilo/FaqBundle/Entity/QuestionRepository.php new file mode 100644 index 000000000..0acfe645d --- /dev/null +++ b/src/Chamilo/FaqBundle/Entity/QuestionRepository.php @@ -0,0 +1,53 @@ +createQueryBuilder('q') + ->join('q.category', 'c') + ->join('c.translations', 't') + ->where('t.slug = :categorySlug') + ->orderBy('q.rank', 'ASC') + ->setMaxResults(1) + ->getQuery(); + + $query->setParameter('categorySlug', $categorySlug); + + return $query->getOneOrNullResult(); + } + + /** + * @param string $slug + * + * @return Question|null + */ + public function getQuestionBySlug($slug) + { + $query = $this->createQueryBuilder('q') + ->join('q.translations', 't') + ->where('t.slug = :slug') + ->orderBy('q.rank', 'ASC') + ->setMaxResults(1) + ->getQuery(); + + $query->setParameter('slug', $slug); + + return $query->getOneOrNullResult(); + } +} diff --git a/src/Chamilo/FaqBundle/Entity/QuestionTranslation.php b/src/Chamilo/FaqBundle/Entity/QuestionTranslation.php new file mode 100644 index 000000000..e61272cd6 --- /dev/null +++ b/src/Chamilo/FaqBundle/Entity/QuestionTranslation.php @@ -0,0 +1,106 @@ +headline; + } + + /** + * @return string + */ + public function getHeadline() + { + return $this->headline; + } + + /** + * @param string $headline + * + * @return QuestionTranslation + */ + public function setHeadline($headline) + { + $this->headline = $headline; + + return $this; + } + + /** + * @return string + */ + public function getBody() + { + return $this->body; + } + + /** + * @param string $body + * + * @return QuestionTranslation + */ + public function setBody($body) + { + $this->body = $body; + + return $this; + } + + /** + * @return string + */ + public function getSlug() + { + return $this->slug; + } + + /** + * @param string $slug + * + * @return QuestionTranslation + */ + public function setSlug($slug) + { + $this->slug = $slug; + + return $this; + } +} diff --git a/src/Chamilo/FaqBundle/Resources/config/admin.yml b/src/Chamilo/FaqBundle/Resources/config/admin.yml new file mode 100644 index 000000000..aac99ae85 --- /dev/null +++ b/src/Chamilo/FaqBundle/Resources/config/admin.yml @@ -0,0 +1,19 @@ +services: + + sonata.admin.faq_question: + class: Chamilo\FaqBundle\Admin\QuestionAdmin + tags: + - { name: sonata.admin, manager_type: orm, group: "Content", label: "Question" } + arguments: + - ~ + - Chamilo\FaqBundle\Entity\Question + - ~ + + sonata.admin.faq_category: + class: Chamilo\FaqBundle\Admin\CategoryAdmin + tags: + - { name: sonata.admin, manager_type: orm, group: "Content", label: "Category" } + arguments: + - ~ + - Chamilo\FaqBundle\Entity\Category + - ~ diff --git a/src/Chamilo/FaqBundle/Resources/config/routing.yml b/src/Chamilo/FaqBundle/Resources/config/routing.yml new file mode 100644 index 000000000..db4f8aec6 --- /dev/null +++ b/src/Chamilo/FaqBundle/Resources/config/routing.yml @@ -0,0 +1,12 @@ +faq_index: + pattern: /faq + defaults: { _controller: ChamiloFaqBundle:Faq:index, categorySlug: null, questionSlug: null } + +faq: + pattern: /faq/{categorySlug}/{questionSlug} + defaults: { _controller: ChamiloFaqBundle:Faq:index, categorySlug: null, questionSlug: null } + +# Shows the entire FAQ at once, without collapsing any categories or questions. Useful if your FAQ is not that big. +faq_without_collapse: + pattern: /faq-without-collapse/{categorySlug} + defaults: { _controller: ChamiloFaqBundle:Faq:indexWithoutCollapse, categorySlug: null } \ No newline at end of file diff --git a/src/Chamilo/FaqBundle/Resources/config/services.yml b/src/Chamilo/FaqBundle/Resources/config/services.yml new file mode 100644 index 000000000..90148c580 --- /dev/null +++ b/src/Chamilo/FaqBundle/Resources/config/services.yml @@ -0,0 +1,18 @@ +parameters: + faq.entity.question.class: Chamilo\FaqBundle\Entity\Question + faq.entity.category.class: Chamilo\FaqBundle\Entity\Category + faq.entity.question_repository.class: Chamilo\FaqBundle\Entity\QuestionRepository + faq.entity.category_repository.class: Chamilo\FaqBundle\Entity\CategoryRepository + +services: + faq.entity.question_repository: + factory_service: doctrine + factory_method: getRepository + class: '%faq.entity.question_repository.class%' + arguments: ['%faq.entity.question.class%'] + + faq.entity.category_repository: + factory_service: doctrine + factory_method: getRepository + class: '%faq.entity.category_repository.class%' + arguments: ['%faq.entity.category.class%'] \ No newline at end of file diff --git a/src/Chamilo/FaqBundle/Resources/views/Faq/index.html.twig b/src/Chamilo/FaqBundle/Resources/views/Faq/index.html.twig new file mode 100644 index 000000000..661eac866 --- /dev/null +++ b/src/Chamilo/FaqBundle/Resources/views/Faq/index.html.twig @@ -0,0 +1,60 @@ +{% extends '@ChamiloCore/layout_cms.html.twig' %} + +{% block sonata_page_container %} +

FAQ

+ +
+
+
    +{% for category in categories %} +
  • +

    {{ category.getHeadline|e }}

    +
  • +
      + {% set list = [false] %} + {% if is_granted('IS_AUTHENTICATED_FULLY') %} + {% set list = [false, true] %} + {% endif %} + + {% for question in category.questions if question.onlyAuthUsers in list %} + {% if question.isActive %} +
    • + + {{ question.getHeadline|e }} + +
    • + {% endif %} + {% endfor %} +
    +{% endfor %} +
+
+
+ +
    +{% for category in categories %} +
  • +

    {{ category.getHeadline|e }}

    +
  • +
      + {% set list = [false] %} + {% if is_granted('IS_AUTHENTICATED_FULLY') %} + {% set list = [false, true] %} + {% endif %} + + {% for question in category.questions if question.onlyAuthUsers in list %} + {% if question.isActive %} +
    • +

      + {{ question.getHeadline|e }} +

      + +

      {{ question.getBody }}

      +
    • + {% endif %} + {% endfor %} +
    +{% endfor %} +
+ +{% endblock %} \ No newline at end of file diff --git a/src/Chamilo/FaqBundle/Resources/views/Faq/index_without_collapse.html.twig b/src/Chamilo/FaqBundle/Resources/views/Faq/index_without_collapse.html.twig new file mode 100644 index 000000000..fc951ceb7 --- /dev/null +++ b/src/Chamilo/FaqBundle/Resources/views/Faq/index_without_collapse.html.twig @@ -0,0 +1,10 @@ +

FAQ

+ +{% for category in categories %} +

{{ category.headline|e }}

+ {% for question in category.questions %} + {{ question.isAuth |var_dump }} +

{{ question.headline|e }}

+

{{ question.body }}

+ {% endfor %} +{% endfor %} \ No newline at end of file diff --git a/src/Chamilo/FaqBundle/Resources/views/Faq/preview_category_partial.html.twig b/src/Chamilo/FaqBundle/Resources/views/Faq/preview_category_partial.html.twig new file mode 100644 index 000000000..cff12569d --- /dev/null +++ b/src/Chamilo/FaqBundle/Resources/views/Faq/preview_category_partial.html.twig @@ -0,0 +1,9 @@ + + + {{ 'Preview'|trans({}, 'SonataAdminBundle') }} + + diff --git a/src/Chamilo/FaqBundle/Resources/views/Faq/preview_question_partial.html.twig b/src/Chamilo/FaqBundle/Resources/views/Faq/preview_question_partial.html.twig new file mode 100644 index 000000000..5966c3df7 --- /dev/null +++ b/src/Chamilo/FaqBundle/Resources/views/Faq/preview_question_partial.html.twig @@ -0,0 +1,11 @@ +{% if object.category %} + + + {{ 'Preview'|trans({}, 'SonataAdminBundle') }} + +{% endif %} + diff --git a/src/Chamilo/MediaBundle/ChamiloMediaBundle.php b/src/Chamilo/MediaBundle/ChamiloMediaBundle.php new file mode 100644 index 000000000..0da0c258c --- /dev/null +++ b/src/Chamilo/MediaBundle/ChamiloMediaBundle.php @@ -0,0 +1,32 @@ + project. + * + * (c) + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Chamilo\MediaBundle; + +use Symfony\Component\HttpKernel\Bundle\Bundle; + +/** + * This file has been generated by the EasyExtends bundle ( http://sonata-project.org/easy-extends ). + * + * References : + * bundles : http://symfony.com/doc/current/book/bundles.html + * + * @author + */ +class ChamiloMediaBundle extends Bundle +{ + /** + * {@inheritdoc} + */ + public function getParent() + { + return 'SonataMediaBundle'; + } +} diff --git a/src/Chamilo/MediaBundle/Document/Gallery.php b/src/Chamilo/MediaBundle/Document/Gallery.php new file mode 100644 index 000000000..c69f4b222 --- /dev/null +++ b/src/Chamilo/MediaBundle/Document/Gallery.php @@ -0,0 +1,40 @@ + project. + * + * (c) + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Chamilo\MediaBundle\Document; + +use Sonata\MediaBundle\Document\BaseGallery as BaseGallery; + +/** + * This file has been generated by the EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends ). + * + * References : + * working with object : http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/working-with-objects.html + * + * @author + */ +class Gallery extends BaseGallery +{ + /** + * @var int + */ + protected $id; + + /** + * Get id. + * + * @return int $id + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/MediaBundle/Document/Media.php b/src/Chamilo/MediaBundle/Document/Media.php new file mode 100644 index 000000000..8d1667ce0 --- /dev/null +++ b/src/Chamilo/MediaBundle/Document/Media.php @@ -0,0 +1,40 @@ + project. + * + * (c) + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Chamilo\MediaBundle\Document; + +use Sonata\MediaBundle\Document\BaseMedia as BaseMedia; + +/** + * This file has been generated by the EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends ). + * + * References : + * working with object : http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/working-with-objects.html + * + * @author + */ +class Media extends BaseMedia +{ + /** + * @var int + */ + protected $id; + + /** + * Get id. + * + * @return int $id + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/MediaBundle/Entity/Gallery.php b/src/Chamilo/MediaBundle/Entity/Gallery.php new file mode 100644 index 000000000..2cd80d795 --- /dev/null +++ b/src/Chamilo/MediaBundle/Entity/Gallery.php @@ -0,0 +1,40 @@ + project. + * + * (c) + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Chamilo\MediaBundle\Entity; + +use Sonata\MediaBundle\Entity\BaseGallery as BaseGallery; + +/** + * This file has been generated by the Sonata EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends ). + * + * References : + * working with object : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en + * + * @author + */ +class Gallery extends BaseGallery +{ + /** + * @var int + */ + protected $id; + + /** + * Get id. + * + * @return int $id + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/MediaBundle/Entity/GalleryHasMedia.php b/src/Chamilo/MediaBundle/Entity/GalleryHasMedia.php new file mode 100644 index 000000000..ed0dfcb8e --- /dev/null +++ b/src/Chamilo/MediaBundle/Entity/GalleryHasMedia.php @@ -0,0 +1,40 @@ + project. + * + * (c) + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Chamilo\MediaBundle\Entity; + +use Sonata\MediaBundle\Entity\BaseGalleryHasMedia as BaseGalleryHasMedia; + +/** + * This file has been generated by the Sonata EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends ). + * + * References : + * working with object : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en + * + * @author + */ +class GalleryHasMedia extends BaseGalleryHasMedia +{ + /** + * @var int + */ + protected $id; + + /** + * Get id. + * + * @return int $id + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/MediaBundle/Entity/Media.php b/src/Chamilo/MediaBundle/Entity/Media.php new file mode 100644 index 000000000..1a03a9bb0 --- /dev/null +++ b/src/Chamilo/MediaBundle/Entity/Media.php @@ -0,0 +1,38 @@ + project. + * + * (c) + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Chamilo\MediaBundle\Entity; + +use Sonata\MediaBundle\Entity\BaseMedia as BaseMedia; + +/** + * References : + * working with object : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en. + * + * @author + */ +class Media extends BaseMedia +{ + /** + * @var int + */ + protected $id; + + /** + * Get id. + * + * @return int $id + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/MediaBundle/PHPCR/Gallery.php b/src/Chamilo/MediaBundle/PHPCR/Gallery.php new file mode 100644 index 000000000..9a6b86537 --- /dev/null +++ b/src/Chamilo/MediaBundle/PHPCR/Gallery.php @@ -0,0 +1,40 @@ + project. + * + * (c) + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Chamilo\MediaBundle\PHPCR; + +use Sonata\MediaBundle\PHPCR\BaseGallery as BaseGallery; + +/** + * This file has been generated by the EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends ). + * + * References : + * working with object : http://docs.doctrine-project.org/projects/doctrine-phpcr-odm/en/latest/index.html + * + * @author + */ +class Gallery extends BaseGallery +{ + /** + * @var int + */ + protected $id; + + /** + * Get id. + * + * @return int $id + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/MediaBundle/PHPCR/GalleryHasMedia.php b/src/Chamilo/MediaBundle/PHPCR/GalleryHasMedia.php new file mode 100644 index 000000000..6b4d5d45e --- /dev/null +++ b/src/Chamilo/MediaBundle/PHPCR/GalleryHasMedia.php @@ -0,0 +1,40 @@ + project. + * + * (c) + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Chamilo\MediaBundle\PHPCR; + +use Sonata\MediaBundle\PHPCR\BaseGalleryHasMedia as BaseGalleryHasMedia; + +/** + * This file has been generated by the EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends ). + * + * References : + * working with object : http://docs.doctrine-project.org/projects/doctrine-phpcr-odm/en/latest/index.html + * + * @author + */ +class GalleryHasMedia extends BaseGalleryHasMedia +{ + /** + * @var int + */ + protected $id; + + /** + * Get id. + * + * @return int $id + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/MediaBundle/PHPCR/GalleryHasMediaRepository.php b/src/Chamilo/MediaBundle/PHPCR/GalleryHasMediaRepository.php new file mode 100644 index 000000000..37a9abf47 --- /dev/null +++ b/src/Chamilo/MediaBundle/PHPCR/GalleryHasMediaRepository.php @@ -0,0 +1,26 @@ + project. + * + * (c) + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Chamilo\MediaBundle\PHPCR; + +use Sonata\MediaBundle\PHPCR\BaseGalleryHasMediaRepository; + +/** + * This file has been generated by the EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends ). + * + * References : + * query builder : http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/query-builder-api.html + * + * @author + */ +class GalleryHasMediaRepository extends BaseGalleryHasMediaRepository +{ +} diff --git a/src/Chamilo/MediaBundle/PHPCR/GalleryRepository.php b/src/Chamilo/MediaBundle/PHPCR/GalleryRepository.php new file mode 100644 index 000000000..d4c200171 --- /dev/null +++ b/src/Chamilo/MediaBundle/PHPCR/GalleryRepository.php @@ -0,0 +1,26 @@ + project. + * + * (c) + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Chamilo\MediaBundle\PHPCR; + +use Sonata\MediaBundle\PHPCR\BaseGalleryRepository; + +/** + * This file has been generated by the EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends ). + * + * References : + * query builder : http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/query-builder-api.html + * + * @author + */ +class GalleryRepository extends BaseGalleryRepository +{ +} diff --git a/src/Chamilo/MediaBundle/PHPCR/Media.php b/src/Chamilo/MediaBundle/PHPCR/Media.php new file mode 100644 index 000000000..7e9faf9a1 --- /dev/null +++ b/src/Chamilo/MediaBundle/PHPCR/Media.php @@ -0,0 +1,40 @@ + project. + * + * (c) + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Chamilo\MediaBundle\PHPCR; + +use Sonata\MediaBundle\PHPCR\BaseMedia as BaseMedia; + +/** + * This file has been generated by the EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends ). + * + * References : + * working with object : http://docs.doctrine-project.org/projects/doctrine-phpcr-odm/en/latest/index.html + * + * @author + */ +class Media extends BaseMedia +{ + /** + * @var int + */ + protected $id; + + /** + * Get id. + * + * @return int $id + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/MediaBundle/PHPCR/MediaRepository.php b/src/Chamilo/MediaBundle/PHPCR/MediaRepository.php new file mode 100644 index 000000000..a785ca653 --- /dev/null +++ b/src/Chamilo/MediaBundle/PHPCR/MediaRepository.php @@ -0,0 +1,26 @@ + project. + * + * (c) + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Chamilo\MediaBundle\PHPCR; + +use Sonata\MediaBundle\PHPCR\BaseMediaRepository; + +/** + * This file has been generated by the EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends ). + * + * References : + * query builder : http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/query-builder-api.html + * + * @author + */ +class MediaRepository extends BaseMediaRepository +{ +} diff --git a/src/Chamilo/MediaBundle/Resources/config/doctrine/Gallery.mongodb.xml b/src/Chamilo/MediaBundle/Resources/config/doctrine/Gallery.mongodb.xml new file mode 100644 index 000000000..abafe817e --- /dev/null +++ b/src/Chamilo/MediaBundle/Resources/config/doctrine/Gallery.mongodb.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/src/Chamilo/MediaBundle/Resources/config/doctrine/Gallery.orm.xml b/src/Chamilo/MediaBundle/Resources/config/doctrine/Gallery.orm.xml new file mode 100644 index 000000000..347de9db7 --- /dev/null +++ b/src/Chamilo/MediaBundle/Resources/config/doctrine/Gallery.orm.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + diff --git a/src/Chamilo/MediaBundle/Resources/config/doctrine/Gallery.phpcr.xml b/src/Chamilo/MediaBundle/Resources/config/doctrine/Gallery.phpcr.xml new file mode 100644 index 000000000..507a6f721 --- /dev/null +++ b/src/Chamilo/MediaBundle/Resources/config/doctrine/Gallery.phpcr.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + diff --git a/src/Chamilo/MediaBundle/Resources/config/doctrine/GalleryHasMedia.orm.xml b/src/Chamilo/MediaBundle/Resources/config/doctrine/GalleryHasMedia.orm.xml new file mode 100644 index 000000000..b07c27f23 --- /dev/null +++ b/src/Chamilo/MediaBundle/Resources/config/doctrine/GalleryHasMedia.orm.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + diff --git a/src/Chamilo/MediaBundle/Resources/config/doctrine/GalleryHasMedia.phpcr.xml b/src/Chamilo/MediaBundle/Resources/config/doctrine/GalleryHasMedia.phpcr.xml new file mode 100644 index 000000000..573a5325b --- /dev/null +++ b/src/Chamilo/MediaBundle/Resources/config/doctrine/GalleryHasMedia.phpcr.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + diff --git a/src/Chamilo/MediaBundle/Resources/config/doctrine/Media.mongodb.xml b/src/Chamilo/MediaBundle/Resources/config/doctrine/Media.mongodb.xml new file mode 100644 index 000000000..31dd96e47 --- /dev/null +++ b/src/Chamilo/MediaBundle/Resources/config/doctrine/Media.mongodb.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/src/Chamilo/MediaBundle/Resources/config/doctrine/Media.orm.xml b/src/Chamilo/MediaBundle/Resources/config/doctrine/Media.orm.xml new file mode 100644 index 000000000..de6b3632d --- /dev/null +++ b/src/Chamilo/MediaBundle/Resources/config/doctrine/Media.orm.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + diff --git a/src/Chamilo/MediaBundle/Resources/config/doctrine/Media.phpcr.xml b/src/Chamilo/MediaBundle/Resources/config/doctrine/Media.phpcr.xml new file mode 100644 index 000000000..bb0d86c1a --- /dev/null +++ b/src/Chamilo/MediaBundle/Resources/config/doctrine/Media.phpcr.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + diff --git a/src/Chamilo/MediaBundle/Resources/config/serializer/Document.Gallery.xml b/src/Chamilo/MediaBundle/Resources/config/serializer/Document.Gallery.xml new file mode 100644 index 000000000..fc8cc332a --- /dev/null +++ b/src/Chamilo/MediaBundle/Resources/config/serializer/Document.Gallery.xml @@ -0,0 +1,17 @@ + + + + + + + + + + diff --git a/src/Chamilo/MediaBundle/Resources/config/serializer/Document.GalleryHasMedia.xml b/src/Chamilo/MediaBundle/Resources/config/serializer/Document.GalleryHasMedia.xml new file mode 100644 index 000000000..0516bf52e --- /dev/null +++ b/src/Chamilo/MediaBundle/Resources/config/serializer/Document.GalleryHasMedia.xml @@ -0,0 +1,17 @@ + + + + + + + + + + diff --git a/src/Chamilo/MediaBundle/Resources/config/serializer/Document.Media.xml b/src/Chamilo/MediaBundle/Resources/config/serializer/Document.Media.xml new file mode 100644 index 000000000..c6e9b0f85 --- /dev/null +++ b/src/Chamilo/MediaBundle/Resources/config/serializer/Document.Media.xml @@ -0,0 +1,17 @@ + + + + + + + + + + diff --git a/src/Chamilo/MediaBundle/Resources/config/serializer/Entity.Gallery.xml b/src/Chamilo/MediaBundle/Resources/config/serializer/Entity.Gallery.xml new file mode 100644 index 000000000..71a40eb94 --- /dev/null +++ b/src/Chamilo/MediaBundle/Resources/config/serializer/Entity.Gallery.xml @@ -0,0 +1,17 @@ + + + + + + + + + + diff --git a/src/Chamilo/MediaBundle/Resources/config/serializer/Entity.GalleryHasMedia.xml b/src/Chamilo/MediaBundle/Resources/config/serializer/Entity.GalleryHasMedia.xml new file mode 100644 index 000000000..08028a71f --- /dev/null +++ b/src/Chamilo/MediaBundle/Resources/config/serializer/Entity.GalleryHasMedia.xml @@ -0,0 +1,17 @@ + + + + + + + + + + diff --git a/src/Chamilo/MediaBundle/Resources/config/serializer/Entity.Media.xml b/src/Chamilo/MediaBundle/Resources/config/serializer/Entity.Media.xml new file mode 100644 index 000000000..cd3bbdd7f --- /dev/null +++ b/src/Chamilo/MediaBundle/Resources/config/serializer/Entity.Media.xml @@ -0,0 +1,17 @@ + + + + + + + + + + diff --git a/src/Chamilo/PageBundle/ChamiloPageBundle.php b/src/Chamilo/PageBundle/ChamiloPageBundle.php new file mode 100644 index 000000000..855701534 --- /dev/null +++ b/src/Chamilo/PageBundle/ChamiloPageBundle.php @@ -0,0 +1,22 @@ +container->get('sonata.page.site.selector')->retrieve(); + + $criteria = ['enabled' => 1, 'site' => $site, 'decorate' => 1, 'routeName' => 'page_slug']; + $order = ['createdAt' => 'desc']; + // Get latest pages + $pages = $this->container->get('sonata.page.manager.page')->findBy($criteria, $order, $number); + $pagesToShow = []; + /** @var Page $page */ + foreach ($pages as $page) { + // Skip homepage + if ($page->getUrl() === '/') { + continue; + } + $criteria = ['pageId' => $page]; + /** @var Snapshot $snapshot */ + // Check if page has a valid snapshot + $snapshot = $this->container->get('sonata.page.manager.snapshot')->findEnableSnapshot($criteria); + if ($snapshot) { + $pagesToShow[] = $page; + } + } + + return $this->render( + '@ChamiloPage/latest.html.twig', + ['pages' => $pagesToShow] + ); + } +} diff --git a/src/Chamilo/PageBundle/Entity/Block.php b/src/Chamilo/PageBundle/Entity/Block.php new file mode 100644 index 000000000..980b0bd02 --- /dev/null +++ b/src/Chamilo/PageBundle/Entity/Block.php @@ -0,0 +1,40 @@ + project. + * + * (c) + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Chamilo\PageBundle\Entity; + +use Sonata\PageBundle\Entity\BaseBlock as BaseBlock; + +/** + * This file has been generated by the Sonata EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends ). + * + * References : + * working with object : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en + * + * @author + */ +class Block extends BaseBlock +{ + /** + * @var int + */ + protected $id; + + /** + * Get id. + * + * @return int $id + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/PageBundle/Entity/Page.php b/src/Chamilo/PageBundle/Entity/Page.php new file mode 100644 index 000000000..350a0901a --- /dev/null +++ b/src/Chamilo/PageBundle/Entity/Page.php @@ -0,0 +1,40 @@ + project. + * + * (c) + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Chamilo\PageBundle\Entity; + +use Sonata\PageBundle\Entity\BasePage as BasePage; + +/** + * This file has been generated by the Sonata EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends ). + * + * References : + * working with object : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en + * + * @author + */ +class Page extends BasePage +{ + /** + * @var int + */ + protected $id; + + /** + * Get id. + * + * @return int $id + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/PageBundle/Entity/Site.php b/src/Chamilo/PageBundle/Entity/Site.php new file mode 100644 index 000000000..8d6e5ed27 --- /dev/null +++ b/src/Chamilo/PageBundle/Entity/Site.php @@ -0,0 +1,40 @@ + project. + * + * (c) + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Chamilo\PageBundle\Entity; + +use Sonata\PageBundle\Entity\BaseSite as BaseSite; + +/** + * This file has been generated by the Sonata EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends ). + * + * References : + * working with object : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en + * + * @author + */ +class Site extends BaseSite +{ + /** + * @var int + */ + protected $id; + + /** + * Get id. + * + * @return int $id + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/PageBundle/Entity/Snapshot.php b/src/Chamilo/PageBundle/Entity/Snapshot.php new file mode 100644 index 000000000..717701119 --- /dev/null +++ b/src/Chamilo/PageBundle/Entity/Snapshot.php @@ -0,0 +1,40 @@ + project. + * + * (c) + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Chamilo\PageBundle\Entity; + +use Sonata\PageBundle\Entity\BaseSnapshot as BaseSnapshot; + +/** + * This file has been generated by the Sonata EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends ). + * + * References : + * working with object : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en + * + * @author + */ +class Snapshot extends BaseSnapshot +{ + /** + * @var int + */ + protected $id; + + /** + * Get id. + * + * @return int $id + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/PageBundle/Entity/User.php b/src/Chamilo/PageBundle/Entity/User.php new file mode 100644 index 000000000..7d707057b --- /dev/null +++ b/src/Chamilo/PageBundle/Entity/User.php @@ -0,0 +1,2291 @@ +status = self::STUDENT; + + $this->salt = sha1(uniqid(null, true)); + $this->isActive = true; + $this->active = 1; + $this->registrationDate = new \DateTime(); + $this->authSource = 'platform'; + $this->courses = new ArrayCollection(); + $this->items = new ArrayCollection(); + $this->classes = new ArrayCollection(); + $this->curriculumItems = new ArrayCollection(); + $this->portals = new ArrayCollection(); + $this->dropBoxSentFiles = new ArrayCollection(); + $this->dropBoxReceivedFiles = new ArrayCollection(); + //$this->extraFields = new ArrayCollection(); + //$this->userId = 0; + //$this->createdAt = new \DateTime(); + //$this->updatedAt = new \DateTime(); + + $this->enabled = false; + $this->locked = false; + $this->expired = false; + $this->roles = []; + $this->credentialsExpired = false; + } + + /** + * @return string + */ + public function __toString() + { + return $this->getUsername(); + } + + /** + * Updates the id with the user_id. + * + * @ORM\PostPersist() + */ + public function postPersist(LifecycleEventArgs $args) + { + //parent::postPersist(); + // Updates the user_id field + $user = $args->getEntity(); + $this->setUserId($user->getId()); + /*$em = $args->getEntityManager(); + $em->persist($user); + $em->flush();*/ + } + + /** + * @param int $userId + */ + public function setId($userId) + { + $this->id = $userId; + } + + /** + * @param int $userId + */ + public function setUserId($userId) + { + if (!empty($userId)) { + $this->userId = $userId; + } + } + + /** + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * @return string + */ + public function getEncoderName() + { + return "legacy_encoder"; + } + + /** + * @return ArrayCollection + */ + public function getDropBoxSentFiles() + { + return $this->dropBoxSentFiles; + } + + /** + * @return ArrayCollection + */ + public function getDropBoxReceivedFiles() + { + return $this->dropBoxReceivedFiles; + } + + /** + * @return ArrayCollection + */ + public function getCourses() + { + return $this->courses; + } + + /** + * @return array + */ + public static function getPasswordConstraints() + { + return + [ + new Assert\Length(['min' => 5]), + // Alpha numeric + "_" or "-" + new Assert\Regex( + [ + 'pattern' => '/^[a-z\-_0-9]+$/i', + 'htmlPattern' => '/^[a-z\-_0-9]+$/i', ] + ), + // Min 3 letters - not needed + /*new Assert\Regex(array( + 'pattern' => '/[a-z]{3}/i', + 'htmlPattern' => '/[a-z]{3}/i') + ),*/ + // Min 2 numbers + new Assert\Regex( + [ + 'pattern' => '/[0-9]{2}/', + 'htmlPattern' => '/[0-9]{2}/', ] + ), + ] + ; + } + + public static function loadValidatorMetadata(ClassMetadata $metadata) + { + //$metadata->addPropertyConstraint('firstname', new Assert\NotBlank()); + //$metadata->addPropertyConstraint('lastname', new Assert\NotBlank()); + //$metadata->addPropertyConstraint('email', new Assert\Email()); + /* + $metadata->addPropertyConstraint('password', + new Assert\Collection(self::getPasswordConstraints()) + );*/ + + /*$metadata->addConstraint(new UniqueEntity(array( + 'fields' => 'username', + 'message' => 'This value is already used.', + )));*/ + + /*$metadata->addPropertyConstraint( + 'username', + new Assert\Length(array( + 'min' => 2, + 'max' => 50, + 'minMessage' => 'This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more.', + 'maxMessage' => 'This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less.', + )) + );*/ + } + + /** + * {@inheritdoc} + */ + public function isEqualTo(UserInterface $user) + { + if (!$user instanceof User) { + return false; + } + + /*if ($this->password !== $user->getPassword()) { + return false; + }*/ + + /*if ($this->getSalt() !== $user->getSalt()) { + return false; + }*/ + + /*if ($this->username !== $user->getUsername()) { + return false; + }*/ + + return true; + } + + /** + * @return ArrayCollection + */ + public function getPortals() + { + return $this->portals; + } + + /** + * @param $portal + */ + public function setPortal($portal) + { + $this->portals->add($portal); + } + + /** + * @return ArrayCollection + */ + public function getCurriculumItems() + { + return $this->curriculumItems; + } + + /** + * @param $items + */ + public function setCurriculumItems($items) + { + $this->curriculumItems = $items; + } + + /** + * @return bool + */ + public function getIsActive() + { + return $this->active == 1; + } + + /** + * @return bool + */ + public function isActive() + { + return $this->getIsActive(); + } + + /** + * {@inheritdoc} + */ + public function isEnabled() + { + return $this->enabled; + } + + /** + * @return ArrayCollection + */ + /*public function getRolesObj() + { + return $this->roles; + }*/ + + /** + * Set salt. + * + * @param string $salt + * + * @return User + */ + public function setSalt($salt) + { + $this->salt = $salt; + + return $this; + } + + /** + * Get salt. + * + * @return string + */ + public function getSalt() + { + return $this->salt; + } + + /** + * @return ArrayCollection + */ + public function getClasses() + { + return $this->classes; + } + + public function getLps() + { + //return $this->lps; + /*$criteria = Criteria::create() + ->where(Criteria::expr()->eq("id", "666")) + //->orderBy(array("username" => "ASC")) + //->setFirstResult(0) + //->setMaxResults(20) + ; + $lps = $this->lps->matching($criteria);*/ + /*return $this->lps->filter( + function($entry) use ($idsToFilter) { + return $entry->getId() == 1; + });*/ + } + + /** + * @todo don't use api_get_person_name + * + * @return string + */ + public function getCompleteName() + { + return api_get_person_name($this->firstname, $this->lastname); + } + + /** + * Returns the list of classes for the user. + * + * @return string + */ + public function getCompleteNameWithClasses() + { + $classSubscription = $this->getClasses(); + $classList = []; + /** @var UsergroupRelUser $subscription */ + foreach ($classSubscription as $subscription) { + $class = $subscription->getUsergroup(); + $classList[] = $class->getName(); + } + $classString = !empty($classList) ? ' ['.implode(', ', $classList).']' : null; + + return $this->getCompleteName().$classString; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set lastname. + * + * @param string $lastname + * + * @return User + */ + public function setLastname($lastname) + { + $this->lastname = $lastname; + + return $this; + } + + /** + * Set firstname. + * + * @param string $firstname + * + * @return User + */ + public function setFirstname($firstname) + { + $this->firstname = $firstname; + + return $this; + } + + /** + * Set password. + * + * @param string $password + * + * @return User + */ + public function setPassword($password) + { + $this->password = $password; + + return $this; + } + + /** + * Get password. + * + * @return string + */ + public function getPassword() + { + return $this->password; + } + + /** + * Set authSource. + * + * @param string $authSource + * + * @return User + */ + public function setAuthSource($authSource) + { + $this->authSource = $authSource; + + return $this; + } + + /** + * Get authSource. + * + * @return string + */ + public function getAuthSource() + { + return $this->authSource; + } + + /** + * Set email. + * + * @param string $email + * + * @return User + */ + public function setEmail($email) + { + $this->email = $email; + + return $this; + } + + /** + * Get email. + * + * @return string + */ + public function getEmail() + { + return $this->email; + } + + /** + * Set status. + * + * @param int $status + * + * @return User + */ + public function setStatus($status) + { + $this->status = $status; + + return $this; + } + + /** + * Get status. + * + * @return bool + */ + public function getStatus() + { + return $this->status; + } + + /** + * Set officialCode. + * + * @param string $officialCode + * + * @return User + */ + public function setOfficialCode($officialCode) + { + $this->officialCode = $officialCode; + + return $this; + } + + /** + * Get officialCode. + * + * @return string + */ + public function getOfficialCode() + { + return $this->officialCode; + } + + /** + * Set phone. + * + * @param string $phone + * + * @return User + */ + public function setPhone($phone) + { + $this->phone = $phone; + + return $this; + } + + /** + * Get phone. + * + * @return string + */ + public function getPhone() + { + return $this->phone; + } + + /** + * Set pictureUri. + * + * @param string $pictureUri + * + * @return User + */ + public function setPictureUri($pictureUri) + { + $this->pictureUri = $pictureUri; + + return $this; + } + + /** + * Get pictureUri. + * + * @return Media + */ + public function getPictureUri() + { + return $this->pictureUri; + } + + /** + * Set creatorId. + * + * @param int $creatorId + * + * @return User + */ + public function setCreatorId($creatorId) + { + $this->creatorId = $creatorId; + + return $this; + } + + /** + * Get creatorId. + * + * @return int + */ + public function getCreatorId() + { + return $this->creatorId; + } + + /** + * Set competences. + * + * @param string $competences + * + * @return User + */ + public function setCompetences($competences) + { + $this->competences = $competences; + + return $this; + } + + /** + * Get competences. + * + * @return string + */ + public function getCompetences() + { + return $this->competences; + } + + /** + * Set diplomas. + * + * @param string $diplomas + * + * @return User + */ + public function setDiplomas($diplomas) + { + $this->diplomas = $diplomas; + + return $this; + } + + /** + * Get diplomas. + * + * @return string + */ + public function getDiplomas() + { + return $this->diplomas; + } + + /** + * Set openarea. + * + * @param string $openarea + * + * @return User + */ + public function setOpenarea($openarea) + { + $this->openarea = $openarea; + + return $this; + } + + /** + * Get openarea. + * + * @return string + */ + public function getOpenarea() + { + return $this->openarea; + } + + /** + * Set teach. + * + * @param string $teach + * + * @return User + */ + public function setTeach($teach) + { + $this->teach = $teach; + + return $this; + } + + /** + * Get teach. + * + * @return string + */ + public function getTeach() + { + return $this->teach; + } + + /** + * Set productions. + * + * @param string $productions + * + * @return User + */ + public function setProductions($productions) + { + $this->productions = $productions; + + return $this; + } + + /** + * Get productions. + * + * @return string + */ + public function getProductions() + { + return $this->productions; + } + + /** + * Set language. + * + * @param string $language + * + * @return User + */ + public function setLanguage($language) + { + $this->language = $language; + + return $this; + } + + /** + * Get language. + * + * @return string + */ + public function getLanguage() + { + return $this->language; + } + + /** + * Set registrationDate. + * + * @param \DateTime $registrationDate + * + * @return User + */ + public function setRegistrationDate($registrationDate) + { + $this->registrationDate = $registrationDate; + + return $this; + } + + /** + * Get registrationDate. + * + * @return \DateTime + */ + public function getRegistrationDate() + { + return $this->registrationDate; + } + + /** + * Set expirationDate. + * + * @param \DateTime $expirationDate + * + * @return User + */ + public function setExpirationDate($expirationDate) + { + $this->expirationDate = $expirationDate; + + return $this; + } + + /** + * Get expirationDate. + * + * @return \DateTime + */ + public function getExpirationDate() + { + return $this->expirationDate; + } + + /** + * Set active. + * + * @param bool $active + * + * @return User + */ + public function setActive($active) + { + $this->active = $active; + + return $this; + } + + /** + * Get active. + * + * @return bool + */ + public function getActive() + { + return $this->active; + } + + /** + * Set openid. + * + * @param string $openid + * + * @return User + */ + public function setOpenid($openid) + { + $this->openid = $openid; + + return $this; + } + + /** + * Get openid. + * + * @return string + */ + public function getOpenid() + { + return $this->openid; + } + + /** + * Set theme. + * + * @param string $theme + * + * @return User + */ + public function setTheme($theme) + { + $this->theme = $theme; + + return $this; + } + + /** + * Get theme. + * + * @return string + */ + public function getTheme() + { + return $this->theme; + } + + /** + * Set hrDeptId. + * + * @param int $hrDeptId + * + * @return User + */ + public function setHrDeptId($hrDeptId) + { + $this->hrDeptId = $hrDeptId; + + return $this; + } + + /** + * Get hrDeptId. + * + * @return int + */ + public function getHrDeptId() + { + return $this->hrDeptId; + } + + /** + * @return Media + */ + public function getAvatar() + { + return $this->getPictureUri(); + } + + /** + * @return \DateTime + */ + public function getMemberSince() + { + return $this->registrationDate; + } + + /** + * @return bool + */ + public function isOnline() + { + return false; + } + + /** + * @return int + */ + public function getIdentifier() + { + return $this->getId(); + } + + /** + * If manually uploading a file (i.e. not using Symfony Form) ensure an instance + * of 'UploadedFile' is injected into this setter to trigger the update. If this + * bundle's configuration parameter 'inject_on_load' is set to 'true' this setter + * must be able to accept an instance of 'File' as the bundle will inject one here + * during Doctrine hydration. + * + * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile $image + */ + public function setImageFile(File $image) + { + $this->imageFile = $image; + + if ($image) { + // It is required that at least one field changes if you are using doctrine + // otherwise the event listeners won't be called and the file is lost + $this->updatedAt = new \DateTime('now'); + } + } + + /** + * @return File + */ + public function getImageFile() + { + return $this->imageFile; + } + + /** + * @param string $imageName + */ + public function setImageName($imageName) + { + $this->imageName = $imageName; + } + + /** + * @return string + */ + public function getImageName() + { + return $this->imageName; + } + + /** + * @return string + */ + public function getSlug() + { + return $this->getUsername(); + } + + /** + * @param $slug + * + * @return User + */ + public function setSlug($slug) + { + return $this->setUsername($slug); + } + + /** + * Set lastLogin. + * + * @return User + */ + public function setLastLogin(\DateTime $lastLogin) + { + $this->lastLogin = $lastLogin; + + return $this; + } + + /** + * Get lastLogin. + * + * @return \DateTime + */ + public function getLastLogin() + { + return $this->lastLogin; + } + + /** + * {@inheritdoc} + */ + public function getExtraFields() + { + return $this->extraFields; + } + + /** + * {@inheritdoc} + */ + public function setExtraFields($extraFields) + { + $this->extraFields = new ArrayCollection(); + foreach ($extraFields as $extraField) { + $this->addExtraFields($extraField); + } + + return $this; + } + + /** + * {@inheritdoc} + */ + /*public function addExtraFields(ExtraFieldValues $extraFieldValue) + { + $extraFieldValue->setUser($this); + $this->extraFields[] = $extraFieldValue; + + return $this; + }*/ + + /** + * {@inheritdoc} + */ + public function addExtraFields(ExtraFieldValues $extraFieldValue) + { + //if (!$this->hasExtraField($attribute)) { + $extraFieldValue->setUser($this); + $this->extraFields[] = $extraFieldValue; + //} + + return $this; + } + + /** + * {@inheritdoc} + */ + public function removeExtraField(ExtraFieldValues $attribute) + { + //if ($this->hasExtraField($attribute)) { + //$this->extraFields->removeElement($attribute); + //$attribute->setUser($this); + //} + + return $this; + } + + /** + * {@inheritdoc} + */ + /*public function hasExtraField($attribute) + { + if (!$this->extraFields) { + return false; + } + return $this->extraFields->contains($attribute); + }*/ + + /** + * {@inheritdoc} + */ + public function hasExtraFieldByName($attributeName) + { + foreach ($this->extraFields as $attribute) { + if ($attribute->getName() === $attributeName) { + return true; + } + } + + return false; + } + + /** + * {@inheritdoc} + */ + public function getExtraFieldByName($attributeName) + { + foreach ($this->extraFields as $attribute) { + if ($attribute->getName() === $attributeName) { + return $attribute; + } + } + + return null; + } + + /** + * Get sessionCourseSubscription. + * + * @return ArrayCollection + */ + public function getSessionCourseSubscriptions() + { + return $this->sessionCourseSubscriptions; + } + + /** + * @return string + */ + public function getConfirmationToken() + { + return $this->confirmationToken; + } + + /** + * @param string $confirmationToken + * + * @return User + */ + public function setConfirmationToken($confirmationToken) + { + $this->confirmationToken = $confirmationToken; + + return $this; + } + + /** + * @return \DateTime + */ + public function getPasswordRequestedAt() + { + return $this->passwordRequestedAt; + } + + /** + * @param int $ttl + * + * @return bool + */ + public function isPasswordRequestNonExpired($ttl) + { + return $this->getPasswordRequestedAt() instanceof \DateTime && + $this->getPasswordRequestedAt()->getTimestamp() + $ttl > time(); + } + + public function getUsername() + { + return $this->username; + } + + /** + * Returns the creation date. + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + * Sets the last update date. + * + * @return User + */ + public function setUpdatedAt(\DateTime $updatedAt = null) + { + $this->updatedAt = $updatedAt; + + return $this; + } + + /** + * Returns the last update date. + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->updatedAt; + } + + /** + * Returns the expiration date. + * + * @return \DateTime|null + */ + public function getExpiresAt() + { + return $this->expiresAt; + } + + /** + * Returns the credentials expiration date. + * + * @return \DateTime + */ + public function getCredentialsExpireAt() + { + return $this->credentialsExpireAt; + } + + /** + * Sets the credentials expiration date. + * + * @return User + */ + public function setCredentialsExpireAt(\DateTime $date = null) + { + $this->credentialsExpireAt = $date; + + return $this; + } + + /** + * Sets the user groups. + * + * @param array $groups + * + * @return User + */ + public function setGroups($groups) + { + foreach ($groups as $group) { + $this->addGroup($group); + } + + return $this; + } + + /** + * Sets the two-step verification code. + * + * @param string $twoStepVerificationCode + * + * @return User + */ + public function setTwoStepVerificationCode($twoStepVerificationCode) + { + $this->twoStepVerificationCode = $twoStepVerificationCode; + + return $this; + } + + /** + * Returns the two-step verification code. + * + * @return string + */ + public function getTwoStepVerificationCode() + { + return $this->twoStepVerificationCode; + } + + /** + * @param string $biography + * + * @return User + */ + public function setBiography($biography) + { + $this->biography = $biography; + + return $this; + } + + /** + * @return string + */ + public function getBiography() + { + return $this->biography; + } + + /** + * @param \DateTime $dateOfBirth + * + * @return User + */ + public function setDateOfBirth($dateOfBirth) + { + $this->dateOfBirth = $dateOfBirth; + + return $this; + } + + /** + * @return \DateTime + */ + public function getDateOfBirth() + { + return $this->dateOfBirth; + } + + /** + * @param string $facebookData + * + * @return User + */ + public function setFacebookData($facebookData) + { + $this->facebookData = $facebookData; + + return $this; + } + + /** + * @return string + */ + public function getFacebookData() + { + return $this->facebookData; + } + + /** + * @param string $facebookName + * + * @return User + */ + public function setFacebookName($facebookName) + { + $this->facebookName = $facebookName; + + return $this; + } + + /** + * @return string + */ + public function getFacebookName() + { + return $this->facebookName; + } + + /** + * @param string $facebookUid + * + * @return User + */ + public function setFacebookUid($facebookUid) + { + $this->facebookUid = $facebookUid; + + return $this; + } + + /** + * @return string + */ + public function getFacebookUid() + { + return $this->facebookUid; + } + + /** + * @return string + */ + public function getFirstname() + { + return $this->firstname; + } + + /** + * @param string $gender + * + * @return User + */ + public function setGender($gender) + { + $this->gender = $gender; + + return $this; + } + + /** + * @return string + */ + public function getGender() + { + return $this->gender; + } + + /** + * @param string $gplusData + * + * @return User + */ + public function setGplusData($gplusData) + { + $this->gplusData = $gplusData; + + return $this; + } + + /** + * @return string + */ + public function getGplusData() + { + return $this->gplusData; + } + + /** + * @param string $gplusName + * + * @return User + */ + public function setGplusName($gplusName) + { + $this->gplusName = $gplusName; + + return $this; + } + + /** + * @return string + */ + public function getGplusName() + { + return $this->gplusName; + } + + /** + * @param string $gplusUid + * + * @return User + */ + public function setGplusUid($gplusUid) + { + $this->gplusUid = $gplusUid; + + return $this; + } + + /** + * @return string + */ + public function getGplusUid() + { + return $this->gplusUid; + } + + /** + * @return string + */ + public function getLastname() + { + return $this->lastname; + } + + /** + * @param string $locale + * + * @return User + */ + public function setLocale($locale) + { + $this->locale = $locale; + + return $this; + } + + /** + * @return string + */ + public function getLocale() + { + return $this->locale; + } + + /** + * @param string $timezone + * + * @return User + */ + public function setTimezone($timezone) + { + $this->timezone = $timezone; + + return $this; + } + + /** + * @return string + */ + public function getTimezone() + { + return $this->timezone; + } + + /** + * @param string $twitterData + * + * @return User + */ + public function setTwitterData($twitterData) + { + $this->twitterData = $twitterData; + + return $this; + } + + /** + * @return string + */ + public function getTwitterData() + { + return $this->twitterData; + } + + /** + * @param string $twitterName + * + * @return User + */ + public function setTwitterName($twitterName) + { + $this->twitterName = $twitterName; + + return $this; + } + + /** + * @return string + */ + public function getTwitterName() + { + return $this->twitterName; + } + + /** + * @param string $twitterUid + * + * @return User + */ + public function setTwitterUid($twitterUid) + { + $this->twitterUid = $twitterUid; + + return $this; + } + + /** + * @return string + */ + public function getTwitterUid() + { + return $this->twitterUid; + } + + /** + * @param string $website + * + * @return User + */ + public function setWebsite($website) + { + $this->website = $website; + + return $this; + } + + /** + * @return string + */ + public function getWebsite() + { + return $this->website; + } + + /** + * @param string $token + * + * @return User + */ + public function setToken($token) + { + $this->token = $token; + + return $this; + } + + /** + * @return string + */ + public function getToken() + { + return $this->token; + } + + /** + * @return string + */ + public function getFullname() + { + return sprintf('%s %s', $this->getFirstname(), $this->getLastname()); + } + + /** + * @return array + */ + public function getRealRoles() + { + return $this->roles; + } + + /** + * @return User + */ + public function setRealRoles(array $roles) + { + $this->setRoles($roles); + + return $this; + } + + /** + * Removes sensitive data from the user. + */ + public function eraseCredentials() + { + $this->plainPassword = null; + } + + public function getUsernameCanonical() + { + return $this->usernameCanonical; + } + + public function getEmailCanonical() + { + return $this->emailCanonical; + } + + public function getPlainPassword() + { + return $this->plainPassword; + } + + /** + * Returns the user roles. + * + * @return array The roles + */ + public function getRoles() + { + $roles = $this->roles; + + foreach ($this->getGroups() as $group) { + $roles = array_merge($roles, $group->getRoles()); + } + + // we need to make sure to have at least one role + $roles[] = static::ROLE_DEFAULT; + + return array_unique($roles); + } + + /** + * Never use this to check if this user has access to anything! + * + * Use the SecurityContext, or an implementation of AccessDecisionManager + * instead, e.g. + * + * $securityContext->isGranted('ROLE_USER'); + * + * @param string $role + * + * @return bool + */ + public function hasRole($role) + { + return in_array(strtoupper($role), $this->getRoles(), true); + } + + public function isAccountNonExpired() + { + if (true === $this->expired) { + return false; + } + + if (null !== $this->expiresAt && $this->expiresAt->getTimestamp() < time()) { + return false; + } + + return true; + } + + public function isAccountNonLocked() + { + return !$this->locked; + } + + public function isCredentialsNonExpired() + { + if (true === $this->credentialsExpired) { + return false; + } + + if (null !== $this->credentialsExpireAt && $this->credentialsExpireAt->getTimestamp() < time()) { + return false; + } + + return true; + } + + public function isCredentialsExpired() + { + return !$this->isCredentialsNonExpired(); + } + + public function isExpired() + { + return !$this->isAccountNonExpired(); + } + + public function isLocked() + { + return !$this->isAccountNonLocked(); + } + + public function isSuperAdmin() + { + return $this->hasRole(static::ROLE_SUPER_ADMIN); + } + + public function isUser(UserInterface $user = null) + { + return null !== $user && $this->getId() === $user->getId(); + } + + public function removeRole($role) + { + if (false !== $key = array_search(strtoupper($role), $this->roles, true)) { + unset($this->roles[$key]); + $this->roles = array_values($this->roles); + } + + return $this; + } + + public function setUsername($username) + { + $this->username = $username; + + return $this; + } + + public function setUsernameCanonical($usernameCanonical) + { + $this->usernameCanonical = $usernameCanonical; + + return $this; + } + + /** + * @param bool $boolean + * + * @return User + */ + public function setCredentialsExpired($boolean) + { + $this->credentialsExpired = $boolean; + + return $this; + } + + public function setEmailCanonical($emailCanonical) + { + $this->emailCanonical = $emailCanonical; + + return $this; + } + + public function setEnabled($boolean) + { + $this->enabled = (bool) $boolean; + + return $this; + } + + /** + * Sets this user to expired. + * + * @param bool $boolean + * + * @return User + */ + public function setExpired($boolean) + { + $this->expired = (bool) $boolean; + + return $this; + } + + /** + * @param \DateTime $date + * + * @return User + */ + public function setExpiresAt(\DateTime $date = null) + { + $this->expiresAt = $date; + + return $this; + } + + public function setSuperAdmin($boolean) + { + if (true === $boolean) { + $this->addRole(static::ROLE_SUPER_ADMIN); + } else { + $this->removeRole(static::ROLE_SUPER_ADMIN); + } + + return $this; + } + + public function setPlainPassword($password) + { + $this->plainPassword = $password; + + return $this; + } + + public function setLocked($boolean) + { + $this->locked = $boolean; + + return $this; + } + + public function setPasswordRequestedAt(\DateTime $date = null) + { + $this->passwordRequestedAt = $date; + + return $this; + } + + public function setRoles(array $roles) + { + $this->roles = []; + + foreach ($roles as $role) { + $this->addRole($role); + } + + return $this; + } + + /** + * Gets the groups granted to the user. + * + * @return Collection + */ + public function getGroups() + { + return $this->groups ?: $this->groups = new ArrayCollection(); + } + + public function getGroupNames() + { + $names = []; + foreach ($this->getGroups() as $group) { + $names[] = $group->getName(); + } + + return $names; + } + + public function hasGroup($name) + { + return in_array($name, $this->getGroupNames()); + } + + public function addGroup(GroupInterface $group) + { + if (!$this->getGroups()->contains($group)) { + $this->getGroups()->add($group); + } + + return $this; + } + + public function removeGroup(GroupInterface $group) + { + if ($this->getGroups()->contains($group)) { + $this->getGroups()->removeElement($group); + } + + return $this; + } + + public function addRole($role) + { + $role = strtoupper($role); + if ($role === static::ROLE_DEFAULT) { + return $this; + } + + if (!in_array($role, $this->roles, true)) { + $this->roles[] = $role; + } + + return $this; + } + + /** + * Serializes the user. + * + * The serialized data have to contain the fields used by the equals method and the username. + * + * @return string + */ + public function serialize() + { + return serialize([ + $this->password, + $this->salt, + $this->usernameCanonical, + $this->username, + $this->expired, + $this->locked, + $this->credentialsExpired, + $this->enabled, + $this->id, + ]); + } + + /** + * Unserializes the user. + * + * @param string $serialized + */ + public function unserialize($serialized) + { + $data = \UnserializeApi::unserialize('not_allowed_classes', $serialized); + // add a few extra elements in the array to ensure that we have enough keys when unserializing + // older data which does not include all properties. + $data = array_merge($data, array_fill(0, 2, null)); + + list( + $this->password, + $this->salt, + $this->usernameCanonical, + $this->username, + $this->expired, + $this->locked, + $this->credentialsExpired, + $this->enabled, + $this->id + ) = $data; + } +} diff --git a/src/Chamilo/PageBundle/Resources/config/doctrine/Block.orm.xml b/src/Chamilo/PageBundle/Resources/config/doctrine/Block.orm.xml new file mode 100644 index 000000000..89688d005 --- /dev/null +++ b/src/Chamilo/PageBundle/Resources/config/doctrine/Block.orm.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + diff --git a/src/Chamilo/PageBundle/Resources/config/doctrine/Page.orm.xml b/src/Chamilo/PageBundle/Resources/config/doctrine/Page.orm.xml new file mode 100644 index 000000000..3af84e846 --- /dev/null +++ b/src/Chamilo/PageBundle/Resources/config/doctrine/Page.orm.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + diff --git a/src/Chamilo/PageBundle/Resources/config/doctrine/Site.orm.xml b/src/Chamilo/PageBundle/Resources/config/doctrine/Site.orm.xml new file mode 100644 index 000000000..11628fca8 --- /dev/null +++ b/src/Chamilo/PageBundle/Resources/config/doctrine/Site.orm.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + diff --git a/src/Chamilo/PageBundle/Resources/config/doctrine/Snapshot.orm.xml b/src/Chamilo/PageBundle/Resources/config/doctrine/Snapshot.orm.xml new file mode 100644 index 000000000..1db04a6c5 --- /dev/null +++ b/src/Chamilo/PageBundle/Resources/config/doctrine/Snapshot.orm.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + diff --git a/src/Chamilo/PageBundle/Resources/config/doctrine/User.orm.xml b/src/Chamilo/PageBundle/Resources/config/doctrine/User.orm.xml new file mode 100644 index 000000000..cfac01e79 --- /dev/null +++ b/src/Chamilo/PageBundle/Resources/config/doctrine/User.orm.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + diff --git a/src/Chamilo/PageBundle/Resources/config/routing.yml b/src/Chamilo/PageBundle/Resources/config/routing.yml new file mode 100644 index 000000000..af3c44e19 --- /dev/null +++ b/src/Chamilo/PageBundle/Resources/config/routing.yml @@ -0,0 +1,3 @@ +page: + resource: '@ChamiloPageBundle/Controller/PageController.php' + type: annotation diff --git a/src/Chamilo/PageBundle/Resources/config/serializer/Entity.Block.xml b/src/Chamilo/PageBundle/Resources/config/serializer/Entity.Block.xml new file mode 100644 index 000000000..c865e027e --- /dev/null +++ b/src/Chamilo/PageBundle/Resources/config/serializer/Entity.Block.xml @@ -0,0 +1,11 @@ + + + + + + + + diff --git a/src/Chamilo/PageBundle/Resources/config/serializer/Entity.Page.xml b/src/Chamilo/PageBundle/Resources/config/serializer/Entity.Page.xml new file mode 100644 index 000000000..8c3c55292 --- /dev/null +++ b/src/Chamilo/PageBundle/Resources/config/serializer/Entity.Page.xml @@ -0,0 +1,11 @@ + + + + + + + + diff --git a/src/Chamilo/PageBundle/Resources/config/serializer/Entity.Site.xml b/src/Chamilo/PageBundle/Resources/config/serializer/Entity.Site.xml new file mode 100644 index 000000000..dcd6b34dd --- /dev/null +++ b/src/Chamilo/PageBundle/Resources/config/serializer/Entity.Site.xml @@ -0,0 +1,11 @@ + + + + + + + + diff --git a/src/Chamilo/PageBundle/Resources/config/serializer/Entity.Snapshot.xml b/src/Chamilo/PageBundle/Resources/config/serializer/Entity.Snapshot.xml new file mode 100644 index 000000000..8e19431b4 --- /dev/null +++ b/src/Chamilo/PageBundle/Resources/config/serializer/Entity.Snapshot.xml @@ -0,0 +1,11 @@ + + + + + + + + diff --git a/src/Chamilo/PageBundle/Resources/views/Block/breadcrumb.html.twig b/src/Chamilo/PageBundle/Resources/views/Block/breadcrumb.html.twig new file mode 100644 index 000000000..7c4bc5642 --- /dev/null +++ b/src/Chamilo/PageBundle/Resources/views/Block/breadcrumb.html.twig @@ -0,0 +1,21 @@ +{# + +This file is part of the Sonata package. + +(c) Thomas Rabaix + +For the full copyright and license information, please view the LICENSE +file that was distributed with this source code. + +#} + +{% extends 'knp_menu_ordered.html.twig' %} +{% block label %}{{ item.label|trans(item.getExtra('translation_params', {}), item.getExtra('translation_domain', 'SonataSeoBundle')) }}{% endblock %} + +{% block list %} + {% spaceless %} +
+ {{ parent() }} +
+ {% endspaceless %} +{% endblock %} diff --git a/src/Chamilo/PageBundle/Resources/views/Security/login.html.twig b/src/Chamilo/PageBundle/Resources/views/Security/login.html.twig new file mode 100644 index 000000000..2373c8645 --- /dev/null +++ b/src/Chamilo/PageBundle/Resources/views/Security/login.html.twig @@ -0,0 +1,20 @@ +{# + +This file is part of the Sonata package. + +(c) Thomas Rabaix + +For the full copyright and license information, please view the LICENSE +file that was distributed with this source code. + +#} + +{% extends "SonataUserBundle:Security:base_login.html.twig" %} + +{% block fos_user_content %} + {% if app.request.session.get('sonata_basket_delivery_redirect') %} + {% include 'SonataBasketBundle:Basket:stepper.html.twig' with {step: 'identification'} %} + {% endif %} + + {{ parent() }} +{% endblock fos_user_content %} diff --git a/src/Chamilo/PageBundle/Resources/views/demo_2columns_layout.html.twig b/src/Chamilo/PageBundle/Resources/views/demo_2columns_layout.html.twig new file mode 100644 index 000000000..f91c64c1e --- /dev/null +++ b/src/Chamilo/PageBundle/Resources/views/demo_2columns_layout.html.twig @@ -0,0 +1,38 @@ +{# + +This file is part of the Sonata package. + +(c) Thomas Rabaix + +For the full copyright and license information, please view the LICENSE +file that was distributed with this source code. + +#} +{% extends 'SonataPageBundle::2columns_layout.html.twig' %} + +{% block sonata_page_body_tag %} + {{ parent() }} + + {% include "SonataSeoBundle:Block:_facebook_sdk.html.twig" %} + {% include "SonataSeoBundle:Block:_twitter_sdk.html.twig" %} + {% include "SonataSeoBundle:Block:_pinterest_sdk.html.twig" %} + +{% endblock %} + +{% block sonata_page_javascripts %} + + + +{% endblock %} + +{% block sonata_page_container %} +
{{ 'sonata.demo.demonstration.message'|trans({}, 'SonataDemoBundle') }}
+ + Fork me on GitHub + + {{ parent() }} +{% endblock %} + +{% block sonata_page_breadcrumb %}{% endblock %} diff --git a/src/Chamilo/PageBundle/Resources/views/demo_layout.html.twig b/src/Chamilo/PageBundle/Resources/views/demo_layout.html.twig new file mode 100644 index 000000000..5355626c1 --- /dev/null +++ b/src/Chamilo/PageBundle/Resources/views/demo_layout.html.twig @@ -0,0 +1,76 @@ +{% extends '@ChamiloCore/layout_cms.html.twig' %} + +{% block sonata_page_body_tag %} + {{ parent() }} + + {#{% include "SonataSeoBundle:Block:_facebook_sdk.html.twig" %}#} + {#{% include "SonataSeoBundle:Block:_twitter_sdk.html.twig" %}#} + {#{% include "SonataSeoBundle:Block:_pinterest_sdk.html.twig" %}#} + +{% endblock %} + +{% block sonata_page_javascripts %} + + + +{% endblock %} + +{% block sonata_page_container %} +
+
+ + + {% block sonata_page_breadcrumb %} +
+ {% if sonata_seo_context is not defined %} + {% set sonata_seo_context = 'homepage' %} + {% endif %} + {{ sonata_block_render_event('breadcrumb', { 'context': sonata_seo_context, 'current_uri': app.request.requestUri }) }} +
+ {% endblock %} + + {% if page is defined %} +
+ {% if page.name != 'global'%} + {{ sonata_page_render_container('content_top', 'global') }} + {% endif %} + {{ sonata_page_render_container('content_top', page) }} +
+ {% endif %} + +
+ {% block page_content %} + {% if content is defined %} + {{ content|raw }} + {% else %} + {% set content = block('content') %} + {% if content|length > 0 %} + {{ content|raw }} + {% elseif page is defined %} + {{ sonata_page_render_container('content', page) }} + {% endif %} + {% endif %} + {% endblock %} +
+ + {% if page is defined %} +
+ {{ sonata_page_render_container('content_bottom', page) }} + + {% if page.name != 'global'%} + {{ sonata_page_render_container('content_bottom', 'global') }} + {% endif %} +
+ {% endif %} +
+ + {#
#} + {#{{ sonata_page_render_container('footer', 'global') }}#} + {#
#} +
+{% endblock %} diff --git a/src/Chamilo/PageBundle/Resources/views/latest.html.twig b/src/Chamilo/PageBundle/Resources/views/latest.html.twig new file mode 100644 index 000000000..c81480237 --- /dev/null +++ b/src/Chamilo/PageBundle/Resources/views/latest.html.twig @@ -0,0 +1,4 @@ +{% for page in pages %} +

{{ page.name }}

+

{{ sonata_page_render_container('content', page) }}

+{% endfor %} \ No newline at end of file diff --git a/src/Chamilo/PluginBundle/Entity/.gitkeep b/src/Chamilo/PluginBundle/Entity/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/src/Chamilo/SkillBundle/Entity/Level.php b/src/Chamilo/SkillBundle/Entity/Level.php new file mode 100644 index 000000000..012de5f99 --- /dev/null +++ b/src/Chamilo/SkillBundle/Entity/Level.php @@ -0,0 +1,160 @@ +getName(); + } + + /** + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * @param int $id + * + * @return Level + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @param string $name + * + * @return Level + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * @return mixed + */ + public function getPosition() + { + return $this->position; + } + + /** + * @param mixed $position + * + * @return Level + */ + public function setPosition($position) + { + $this->position = $position; + + return $this; + } + + /** + * @return mixed + */ + public function getShortName() + { + return $this->shortName; + } + + /** + * @param mixed $shortName + * + * @return Level + */ + public function setShortName($shortName) + { + $this->shortName = $shortName; + + return $this; + } + + /** + * @return Profile + */ + public function getProfile() + { + return $this->profile; + } + + /** + * @param mixed $profile + * + * @return Level + */ + public function setProfile($profile) + { + $this->profile = $profile; + + return $this; + } +} diff --git a/src/Chamilo/SkillBundle/Entity/Profile.php b/src/Chamilo/SkillBundle/Entity/Profile.php new file mode 100644 index 000000000..b8d6d99ee --- /dev/null +++ b/src/Chamilo/SkillBundle/Entity/Profile.php @@ -0,0 +1,132 @@ +getName(); + } + + /** + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * @param int $id + * + * @return Profile + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @param string $name + * + * @return Profile + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * @return mixed + */ + public function getSkills() + { + return $this->skills; + } + + /** + * @param mixed $skills + * + * @return Profile + */ + public function setSkills($skills) + { + $this->skills = $skills; + + return $this; + } + + /** + * @return mixed + */ + public function getLevels() + { + return $this->levels; + } + + /** + * @param mixed $levels + * + * @return Profile + */ + public function setLevels($levels) + { + $this->levels = $levels; + + return $this; + } +} diff --git a/src/Chamilo/SkillBundle/Entity/SkillRelCourse.php b/src/Chamilo/SkillBundle/Entity/SkillRelCourse.php new file mode 100644 index 000000000..dadeecb1c --- /dev/null +++ b/src/Chamilo/SkillBundle/Entity/SkillRelCourse.php @@ -0,0 +1,192 @@ +createdAt = new \DateTime('now'); + $this->updatedAt = new \DateTime('now'); + } + + /** + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * @param int $id + * + * @return SkillRelCourse + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * @return Skill + */ + public function getSkill() + { + return $this->skill; + } + + /** + * @param Skill $skill + * + * @return SkillRelCourse + */ + public function setSkill($skill) + { + $this->skill = $skill; + + return $this; + } + + /** + * @return Course + */ + public function getCourse() + { + return $this->course; + } + + /** + * @param Course $course + * + * @return SkillRelCourse + */ + public function setCourse($course) + { + $this->course = $course; + + return $this; + } + + /** + * @return Session + */ + public function getSession() + { + return $this->session; + } + + /** + * @param Session $session + * + * @return SkillRelCourse + */ + public function setSession($session) + { + $this->session = $session; + + return $this; + } + + /** + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + * @param \DateTime $createdAt + * + * @return SkillRelCourse + */ + public function setCreatedAt($createdAt) + { + $this->createdAt = $createdAt; + + return $this; + } + + /** + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->updatedAt; + } + + /** + * @param \DateTime $updatedAt + * + * @return SkillRelCourse + */ + public function setUpdatedAt($updatedAt) + { + $this->updatedAt = $updatedAt; + + return $this; + } +} diff --git a/src/Chamilo/SkillBundle/Entity/SkillRelItem.php b/src/Chamilo/SkillBundle/Entity/SkillRelItem.php new file mode 100644 index 000000000..e5033d327 --- /dev/null +++ b/src/Chamilo/SkillBundle/Entity/SkillRelItem.php @@ -0,0 +1,434 @@ +createdAt = new \DateTime('now'); + $this->updatedAt = new \DateTime('now'); + $this->isReal = false; + $this->requiresValidation = false; + } + + /** + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * @param int $id + * + * @return SkillRelItem + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * @return Skill + */ + public function getSkill() + { + return $this->skill; + } + + /** + * @param mixed $skill + * + * @return SkillRelItem + */ + public function setSkill($skill) + { + $this->skill = $skill; + + return $this; + } + + /** + * @return int + */ + public function getItemId() + { + return $this->itemId; + } + + /** + * @param int $itemId + * + * @return SkillRelItem + */ + public function setItemId($itemId) + { + $this->itemId = $itemId; + + return $this; + } + + /** + * @return string + */ + public function getObtainConditions() + { + return $this->obtainConditions; + } + + /** + * @param string $obtainConditions + * + * @return SkillRelItem + */ + public function setObtainConditions($obtainConditions) + { + $this->obtainConditions = $obtainConditions; + + return $this; + } + + /** + * @return bool + */ + public function isRequiresValidation() + { + return $this->requiresValidation; + } + + /** + * @param bool $requiresValidation + * + * @return SkillRelItem + */ + public function setRequiresValidation($requiresValidation) + { + $this->requiresValidation = $requiresValidation; + + return $this; + } + + /** + * @return bool + */ + public function isReal() + { + return $this->isReal; + } + + /** + * @param bool $isReal + * + * @return SkillRelItem + */ + public function setIsReal($isReal) + { + $this->isReal = $isReal; + + return $this; + } + + /** + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + * @param \DateTime $createdAt + * + * @return SkillRelItem + */ + public function setCreatedAt($createdAt) + { + $this->createdAt = $createdAt; + + return $this; + } + + /** + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->updatedAt; + } + + /** + * @param \DateTime $updatedAt + * + * @return SkillRelItem + */ + public function setUpdatedAt($updatedAt) + { + $this->updatedAt = $updatedAt; + + return $this; + } + + /** + * @return int + */ + public function getCreatedBy() + { + return $this->createdBy; + } + + /** + * @param int $createdBy + * + * @return SkillRelItem + */ + public function setCreatedBy($createdBy) + { + $this->createdBy = $createdBy; + + return $this; + } + + /** + * @return int + */ + public function getUpdatedBy() + { + return $this->updatedBy; + } + + /** + * @param int $updatedBy + * + * @return SkillRelItem + */ + public function setUpdatedBy($updatedBy) + { + $this->updatedBy = $updatedBy; + + return $this; + } + + /** + * @return int + */ + public function getItemType() + { + return $this->itemType; + } + + /** + * @param int $itemType + * + * @return SkillRelItem + */ + public function setItemType($itemType) + { + $this->itemType = $itemType; + + return $this; + } + + /** + * @return int + */ + public function getCourseId() + { + return $this->courseId; + } + + /** + * @param int $courseId + * + * @return SkillRelItem + */ + public function setCourseId($courseId) + { + $this->courseId = $courseId; + + return $this; + } + + /** + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * @param int $sessionId + * + * @return SkillRelItem + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + + return $this; + } + + /** + * @param string $cidReq + * + * @return string + */ + public function getItemResultUrl($cidReq) + { + $url = ''; + switch ($this->getItemType()) { + case ITEM_TYPE_EXERCISE: + $url = 'exercise/exercise_show.php?action=qualify&'.$cidReq; + break; + case ITEM_TYPE_STUDENT_PUBLICATION: + $url = 'work/view.php?'.$cidReq; + break; + } + + return $url; + } + + /** + * @param string $cidReq + * + * @return string + */ + public function getItemResultList($cidReq) + { + $url = ''; + switch ($this->getItemType()) { + case ITEM_TYPE_EXERCISE: + $url = 'exercise/exercise_report.php?'.$cidReq.'&exerciseId='.$this->getItemId(); + break; + case ITEM_TYPE_STUDENT_PUBLICATION: + $url = 'work/work_list_all.php?'.$cidReq.'&id='.$this->getItemId(); + break; + } + + return $url; + } +} diff --git a/src/Chamilo/SkillBundle/Entity/SkillRelItemRelUser.php b/src/Chamilo/SkillBundle/Entity/SkillRelItemRelUser.php new file mode 100644 index 000000000..7e0d837dd --- /dev/null +++ b/src/Chamilo/SkillBundle/Entity/SkillRelItemRelUser.php @@ -0,0 +1,219 @@ +createdAt = new \DateTime('now'); + $this->updatedAt = new \DateTime('now'); + } + + /** + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * @param int $id + * + * @return SkillRelItemRelUser + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * @return SkillRelItem + */ + public function getSkillRelItem() + { + return $this->skillRelItem; + } + + /** + * @param SkillRelItem $skillRelItem + * + * @return SkillRelItemRelUser + */ + public function setSkillRelItem($skillRelItem) + { + $this->skillRelItem = $skillRelItem; + + return $this; + } + + /** + * @return User + */ + public function getUser() + { + return $this->user; + } + + /** + * @param User $user + * + * @return SkillRelItemRelUser + */ + public function setUser($user) + { + $this->user = $user; + + return $this; + } + + /** + * @return int + */ + public function getCreatedBy() + { + return $this->createdBy; + } + + /** + * @param int $createdBy + * + * @return SkillRelItemRelUser + */ + public function setCreatedBy($createdBy) + { + $this->createdBy = $createdBy; + + return $this; + } + + /** + * @return int + */ + public function getUpdatedBy() + { + return $this->updatedBy; + } + + /** + * @param int $updatedBy + * + * @return SkillRelItemRelUser + */ + public function setUpdatedBy($updatedBy) + { + $this->updatedBy = $updatedBy; + + return $this; + } + + /** + * @return int + */ + public function getResultId() + { + return $this->resultId; + } + + /** + * @param int $resultId + * + * @return SkillRelItemRelUser + */ + public function setResultId($resultId) + { + $this->resultId = $resultId; + + return $this; + } + + /** + * @param string $cidReq + * + * @return string + */ + public function getUserItemResultUrl($cidReq) + { + $resultId = $this->getResultId(); + $url = $this->getSkillRelItem()->getItemResultUrl($cidReq).'&id='.$resultId; + + return $url; + } +} diff --git a/src/Chamilo/ThemeBundle/.gitignore b/src/Chamilo/ThemeBundle/.gitignore new file mode 100644 index 000000000..0b7766143 --- /dev/null +++ b/src/Chamilo/ThemeBundle/.gitignore @@ -0,0 +1,3 @@ +nbproject/* +Resources/public/vendor/* +Resources/docs/apidoc diff --git a/src/Chamilo/ThemeBundle/ChamiloThemeBundle.php b/src/Chamilo/ThemeBundle/ChamiloThemeBundle.php new file mode 100644 index 000000000..bd42dbd84 --- /dev/null +++ b/src/Chamilo/ThemeBundle/ChamiloThemeBundle.php @@ -0,0 +1,15 @@ +getDispatcher()->hasListeners(ThemeEvents::THEME_BREADCRUMB)) { + return new Response(); + } + + $active = $this->getDispatcher()->dispatch( + ThemeEvents::THEME_BREADCRUMB, + new SidebarMenuKnpEvent($request) + )->getActive(); + + /** @var $active MenuItemInterface */ + //var_dump($request->get('course')); exit; + //$active->addChild() + + /*$active->addChild( + 'Courses', + array( + 'route' => 'admin_chamilo_core_course_list', + 'routeParameters' => array(), + array("attributes" => array("id" => 'nav')) + ) + );*/ + + $list = []; + if ($active) { + $list[] = $active; + while (null !== ($item = $active->getActiveChild())) { + $list[] = $item; + $active = $item; + } + } + + return $this->render('ChamiloThemeBundle:Breadcrumb:breadcrumb.html.twig', [ + 'active' => $list, + 'title' => $title, + ]); + } + + /** + * @return EventDispatcher + */ + protected function getDispatcher() + { + return $this->get('event_dispatcher'); + } +} diff --git a/src/Chamilo/ThemeBundle/Controller/DefaultController.php b/src/Chamilo/ThemeBundle/Controller/DefaultController.php new file mode 100644 index 000000000..59067b372 --- /dev/null +++ b/src/Chamilo/ThemeBundle/Controller/DefaultController.php @@ -0,0 +1,57 @@ +render('ChamiloThemeBundle:Default:index.html.twig'); + } + + /** + * @return \Symfony\Component\HttpFoundation\Response + */ + public function uiGeneralAction() + { + return $this->render('ChamiloThemeBundle:Default:index.html.twig'); + } + + public function uiIconsAction() + { + return $this->render('ChamiloThemeBundle:Default:index.html.twig'); + } + + public function formAction() + { + $form = $this->createForm(new FormDemoModelType()); + + return $this->render( + 'ChamiloThemeBundle:Default:form.html.twig', + [ + 'form' => $form->createView(), + ] + ); + } +} diff --git a/src/Chamilo/ThemeBundle/Controller/ExceptionController.php b/src/Chamilo/ThemeBundle/Controller/ExceptionController.php new file mode 100644 index 000000000..5180e01de --- /dev/null +++ b/src/Chamilo/ThemeBundle/Controller/ExceptionController.php @@ -0,0 +1,57 @@ +getPathInfo(), '/admin') !== 0) { + return parent::findTemplate($request, $format, $code, $debug); + } + + $name = $debug ? 'exception' : 'error'; + if ($debug && 'html' == $format) { + $name = 'exception_full'; + } + + // when not in debug, try to find a template for the specific HTTP status code and format + if (!$debug) { + $template = new TemplateReference('ChamiloThemeBundle', 'Exception', $name.$code, $format, 'twig'); + if ($this->templateExists($template)) { + return $template; + } + } + + // try to find a template for the given format + $template = new TemplateReference('ChamiloThemeBundle', 'Exception', $name, $format, 'twig'); + if ($this->templateExists($template)) { + return $template; + } + + // default to a generic HTML exception + $request->setRequestFormat('html'); + + $template = new TemplateReference('ChamiloThemeBundle', 'Exception', $name, 'html', 'twig'); + if ($this->templateExists($template)) { + return $template; + } + + return parent::findTemplate($request, $format, $code, $debug); + } +} diff --git a/src/Chamilo/ThemeBundle/Controller/NavbarController.php b/src/Chamilo/ThemeBundle/Controller/NavbarController.php new file mode 100644 index 000000000..97d2262e4 --- /dev/null +++ b/src/Chamilo/ThemeBundle/Controller/NavbarController.php @@ -0,0 +1,94 @@ +getDispatcher()->hasListeners(ThemeEvents::THEME_NOTIFICATIONS)) { + return new Response(); + } + + $listEvent = $this->getDispatcher()->dispatch(ThemeEvents::THEME_NOTIFICATIONS, new NotificationListEvent()); + + return $this->render( + 'ChamiloThemeBundle:Navbar:notifications.html.twig', + [ + 'notifications' => $listEvent->getNotifications(), + 'total' => $listEvent->getTotal(), + ] + ); + } + + public function messagesAction($max = 5) + { + if (!$this->getDispatcher()->hasListeners(ThemeEvents::THEME_MESSAGES)) { + return new Response(); + } + + $listEvent = $this->getDispatcher()->dispatch(ThemeEvents::THEME_MESSAGES, new MessageListEvent()); + + return $this->render( + 'ChamiloThemeBundle:Navbar:messages.html.twig', + [ + 'messages' => $listEvent->getMessages(), + 'total' => $listEvent->getTotal(), + ] + ); + } + + public function tasksAction($max = 5) + { + if (!$this->getDispatcher()->hasListeners(ThemeEvents::THEME_TASKS)) { + return new Response(); + } + $listEvent = $this->getDispatcher()->dispatch(ThemeEvents::THEME_TASKS, new TaskListEvent()); + + return $this->render( + 'ChamiloThemeBundle:Navbar:tasks.html.twig', + [ + 'tasks' => $listEvent->getTasks(), + 'total' => $listEvent->getTotal(), + ] + ); + } + + public function userAction() + { + if (!$this->getDispatcher()->hasListeners(ThemeEvents::THEME_NAVBAR_USER)) { + return new Response(); + } + $userEvent = $this->getDispatcher()->dispatch(ThemeEvents::THEME_NAVBAR_USER, new ShowUserEvent()); + + return $this->render( + 'ChamiloThemeBundle:Navbar:user.html.twig', + [ + 'user' => $userEvent->getUser(), + ] + ); + } + + /** + * @return EventDispatcher + */ + protected function getDispatcher() + { + return $this->get('event_dispatcher'); + } +} diff --git a/src/Chamilo/ThemeBundle/Controller/SecurityController.php b/src/Chamilo/ThemeBundle/Controller/SecurityController.php new file mode 100644 index 000000000..d66097abc --- /dev/null +++ b/src/Chamilo/ThemeBundle/Controller/SecurityController.php @@ -0,0 +1,42 @@ +getSession(); + + // get the login error if there is one + if ($request->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) { + $error = $request->attributes->get(SecurityContext::AUTHENTICATION_ERROR); + } else { + $error = $session->get(SecurityContext::AUTHENTICATION_ERROR); + $session->remove(SecurityContext::AUTHENTICATION_ERROR); + } + + return $this->render( + 'ChamiloThemeBundle:Security:login.html.twig', + [ + 'last_username' => $session->get( + SecurityContext::LAST_USERNAME + ), + 'error' => $error, + ] + ); + } +} diff --git a/src/Chamilo/ThemeBundle/Controller/SidebarController.php b/src/Chamilo/ThemeBundle/Controller/SidebarController.php new file mode 100644 index 000000000..39c7d3eec --- /dev/null +++ b/src/Chamilo/ThemeBundle/Controller/SidebarController.php @@ -0,0 +1,104 @@ +getDispatcher()->hasListeners(ThemeEvents::THEME_SIDEBAR_USER)) { + return new Response(); + } + + $userEvent = $this->getDispatcher()->dispatch(ThemeEvents::THEME_SIDEBAR_USER, new ShowUserEvent()); + + return $this->render( + 'ChamiloThemeBundle:Sidebar:user-panel.html.twig', + [ + 'user' => $userEvent->getUser(), + ] + ); + } + + /** + * Search bar. + * + * @return Response + */ + public function searchFormAction() + { + return $this->render('ChamiloThemeBundle:Sidebar:search-form.html.twig', []); + } + + /** + * @return Response + */ + public function menuAction(Request $request) + { + if (!$this->getDispatcher()->hasListeners(ThemeEvents::THEME_SIDEBAR_SETUP_MENU)) { + return new Response(); + } + + $event = $this->getDispatcher()->dispatch( + ThemeEvents::THEME_SIDEBAR_SETUP_MENU, + new SidebarMenuEvent($request) + ); + + return $this->render( + 'ChamiloThemeBundle:Sidebar:menu.html.twig', + [ + 'menu' => $event->getItems(), + ] + ); + } + + /** + * @return Response + */ + public function menuKnpAction(Request $request) + { + if (!$this->getDispatcher()->hasListeners(ThemeEvents::THEME_SIDEBAR_SETUP_MENU_KNP)) { + return new Response(); + } + + /** @var SidebarMenuKnpEvent $event */ + $event = $this->getDispatcher()->dispatch( + ThemeEvents::THEME_SIDEBAR_SETUP_MENU_KNP, + new SidebarMenuKnpEvent($request) + ); + + return $this->render( + 'ChamiloThemeBundle:Sidebar:menu_knp.html.twig', + [ + 'menu' => $event->getMenu(), + ] + ); + } + + /** + * @return EventDispatcher + */ + protected function getDispatcher() + { + return $this->get('event_dispatcher'); + } +} diff --git a/src/Chamilo/ThemeBundle/Controller/WidgetController.php b/src/Chamilo/ThemeBundle/Controller/WidgetController.php new file mode 100644 index 000000000..62a128fcb --- /dev/null +++ b/src/Chamilo/ThemeBundle/Controller/WidgetController.php @@ -0,0 +1,30 @@ +processConfiguration($configuration, $configs); + + //$container->setParameter('avanzu_admin_theme.bower_bin', $config['bower_bin']); + + $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); + $loader->load('services.xml'); + } + + /** + * Allow an extension to prepend the extension configurations. + */ + public function prepend(ContainerBuilder $container) + { + $bundles = $container->getParameter('kernel.bundles'); + + if (isset($bundles['TwigBundle'])) { + $container->prependExtensionConfig('twig', [ + 'form' => [ + 'resources' => [ + 'ChamiloThemeBundle:Layout:form-theme.html.twig', + ], + ], + 'globals' => [ + 'admin_theme' => 'chamilo_admin_theme.theme_manager', + ], + ]); + } + + return; + + $jsAssets = '@ChamiloThemeBundle/Resources/'; + $lteJs = $jsAssets.'public/vendor/adminlte/js/'; + $cssAssets = 'bundles/avanzuadmintheme/'; + $lteCss = $cssAssets.'vendor/adminlte/css/'; + $lteFont = $cssAssets.'vendor/adminlte/fonts/'; + + if (isset($bundles['AsseticBundle']) && 0) { + $container->prependExtensionConfig( + 'assetic', + [ + 'bundles' => [ + 'ChamiloThemeBundle', + ], + 'assets' => [ + 'common_js' => [ + 'inputs' => [ + $jsAssets.'public/vendor/jquery/dist/jquery.js', + $jsAssets.'public/vendor/jquery-ui/jquery-ui.js', + $jsAssets.'public/vendor/underscore/underscore.js', + $jsAssets.'public/vendor/backbone/backbone.js', + $jsAssets.'public/vendor/marionette/lib/backbone.marionette.js', + $jsAssets.'public/vendor/bootstrap/dist/js/bootstrap.min.js', + $jsAssets.'public/vendor/bootbox/bootbox.js', + $jsAssets.'public/js/dialogs.js', + $jsAssets.'public/js/namespace.js', + ], + ], + 'tools_js' => [ + 'inputs' => [ + '@common_js', + $jsAssets.'public/vendor/momentjs/moment.js', + $jsAssets.'public/vendor/holderjs/holder.js', + $jsAssets.'public/vendor/spinjs/spin.js', + ], + ], + 'admin_lte_js' => [ + 'inputs' => [ + $lteJs.'plugins/bootstrap-slider/bootstrap-slider.js', + $lteJs.'plugins/datatables/jquery.dataTables.js', + $lteJs.'plugins/datatables/dataTables.bootstrap.js', + $lteJs.'plugins/slimScroll/jquery.slimscroll.js', + $jsAssets.'public/js/adminLTE.js', + ], + ], + 'admin_lte_css' => [ + 'inputs' => [ + // $lteCss . 'jQueryUI/jquery-ui-1.10.3.custom.css', + $cssAssets.'vendor/bootstrap/dist/css/bootstrap.min.css', + $lteCss.'bootstrap-slider/slider.css', + $lteCss.'datatables/dataTables.bootstrap.css', + $cssAssets.'vendor/fontawesome/css/font-awesome.min.css', + $cssAssets.'vendor/ionicons/css/ionicons.min.css', + $lteCss.'AdminLTE.css', + //$lteFont . 'fontawesome-webfont.eot', + // $lteFont . 'ionicons.eot', + ], + ], + 'admin_lte_forms_js' => [ + 'inputs' => [ + $lteJs.'plugins/colorpicker/bootstrap-colorpicker.js', + $lteJs.'plugins/daterangepicker/daterangepicker.js', + $lteJs.'plugins/timepicker/bootstrap-timepicker.js', + $lteJs.'plugins/input-mask/jquery.inputmask.js', + // $lteJs.'plugins/input-mask/*', + ], + ], + 'admin_lte_forms_css' => [ + 'inputs' => [ + $lteCss.'colorpicker/bootstrap-colorpicker.css', + $lteCss.'daterangepicker/daterangepicker-bs3.css', + $lteCss.'timepicker/bootstrap-timepicker.css', + ], + ], + 'admin_lte_wysiwyg' => [ + 'inputs' => [ + $lteJs.'plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.js', + ], + ], + 'admin_lte_wysiwyg_css' => [ + 'inputs' => [ + $lteCss.'bootstrap-wysihtml5/bootstrap3-wysihtml5.css', + ], + ], + 'admin_lte_morris' => [ + 'inputs' => [ + $lteJs.'plugins/morris/morris.js', + ], + ], + 'admin_lte_morris_css' => [ + 'inputs' => [ + $lteCss.'morris/morris.css', + ], + ], + 'admin_lte_flot' => [ + 'inputs' => [ + $lteJs.'plugins/flot/*', + ], + ], + 'admin_lte_calendar' => [ + 'inputs' => [ + $jsAssets.'public/vendor/fullcalendar/dist/fullcalendar.min.js', + ], + ], + 'admin_lte_calendar_css' => [ + 'inputs' => [ + $lteCss.'fullcalendar/fullcalendar.css', + ], + ], + 'avatar_img' => [ + 'inputs' => [ + '@ChamiloThemeBundle/Resources/public/img/avatar.png', + ], + ], + 'admin_lte_all' => [ + 'inputs' => [ + '@tools_js', + '@admin_lte_forms_js', + '@admin_lte_wysiwyg', + '@admin_lte_morris', + '@admin_lte_calendar', + '@admin_lte_js', + // '@admin_lte_flot', + ], + ], + 'admin_lte_all_css' => [ + 'inputs' => [ + '@admin_lte_calendar_css', + '@admin_lte_morris_css', + '@admin_lte_wysiwyg_css', + '@admin_lte_forms_css', + '@admin_lte_css', + ], + ], + ], + ] + ); + } + } +} diff --git a/src/Chamilo/ThemeBundle/DependencyInjection/Configuration.php b/src/Chamilo/ThemeBundle/DependencyInjection/Configuration.php new file mode 100644 index 000000000..fcbe13313 --- /dev/null +++ b/src/Chamilo/ThemeBundle/DependencyInjection/Configuration.php @@ -0,0 +1,27 @@ +messages; + } + + /** + * Pushes the given message to the list of messages. + * + * @return $this + */ + public function addMessage(MessageInterface $messageInterface) + { + $this->messages[] = $messageInterface; + + return $this; + } + + /** + * Returns the message count. + * + * @return int + */ + public function getTotal() + { + return $this->totalMessages == 0 ? sizeof($this->messages) : $this->totalMessages; + } +} diff --git a/src/Chamilo/ThemeBundle/Event/NotificationListEvent.php b/src/Chamilo/ThemeBundle/Event/NotificationListEvent.php new file mode 100644 index 000000000..570b36f77 --- /dev/null +++ b/src/Chamilo/ThemeBundle/Event/NotificationListEvent.php @@ -0,0 +1,55 @@ +notifications; + } + + /** + * @return $this + */ + public function addNotification(NotificationInterface $notificationInterface) + { + $this->notifications[] = $notificationInterface; + + return $this; + } + + /** + * @param int $total + */ + public function setTotal($total) + { + $this->total = $total; + } + + /** + * @return int + */ + public function getTotal() + { + return $this->total == 0 ? sizeof($this->notifications) : $this->total; + } +} diff --git a/src/Chamilo/ThemeBundle/Event/ShowUserEvent.php b/src/Chamilo/ThemeBundle/Event/ShowUserEvent.php new file mode 100644 index 000000000..3d945dbfa --- /dev/null +++ b/src/Chamilo/ThemeBundle/Event/ShowUserEvent.php @@ -0,0 +1,39 @@ +user = $user; + + return $this; + } + + /** + * @return \Chamilo\ThemeBundle\Model\UserInterface + */ + public function getUser() + { + return $this->user; + } +} diff --git a/src/Chamilo/ThemeBundle/Event/SidebarMenuEvent.php b/src/Chamilo/ThemeBundle/Event/SidebarMenuEvent.php new file mode 100644 index 000000000..7750da617 --- /dev/null +++ b/src/Chamilo/ThemeBundle/Event/SidebarMenuEvent.php @@ -0,0 +1,77 @@ +request = $request; + } + + /** + * @return \Symfony\Component\HttpFoundation\Request + */ + public function getRequest() + { + return $this->request; + } + + /** + * @return array + */ + public function getItems() + { + return $this->menuRootItems; + } + + /** + * @param MenuItemInterface $item + */ + public function addItem($item) + { + $this->menuRootItems[$item->getIdentifier()] = $item; + } + + /** + * @param $id + */ + public function getRootItem($id) + { + return isset($this->menuRootItems[$id]) ? $this->menuRootItems[$id] : null; + } + + /** + * @return MenuItemInterface|null + */ + public function getActive() + { + foreach ($this->getItems() as $item) { + /** @var $item MenuItemInterface */ + if ($item->isActive()) { + return $item; + } + } + + return null; + } +} diff --git a/src/Chamilo/ThemeBundle/Event/SidebarMenuKnpEvent.php b/src/Chamilo/ThemeBundle/Event/SidebarMenuKnpEvent.php new file mode 100644 index 000000000..3f195addc --- /dev/null +++ b/src/Chamilo/ThemeBundle/Event/SidebarMenuKnpEvent.php @@ -0,0 +1,89 @@ +request = $request; + } + + /** + * @return \Symfony\Component\HttpFoundation\Request + */ + public function getRequest() + { + return $this->request; + } + + /** + * @return MenuItem + */ + public function getMenu() + { + return $this->menu; + } + + public function setMenu(MenuItem $menu) + { + $this->menu = $menu; + } + + /** + * @return array + */ + public function getItems() + { + return $this->menuRootItems; + } + + public function addItem(MenuItem $item) + { + $this->menuRootItems[$item->getUri()] = $item; + } + + /** + * @param $id + */ + public function getRootItem($id) + { + return isset($this->menuRootItems[$id]) ? $this->menuRootItems[$id] : null; + } + + /** + * @return MenuItemInterface|null + */ + public function getActive() + { + foreach ($this->getMenu() as $child) { + if ($child->isCurrent()) { + return $child; + } + } + + return null; + } +} diff --git a/src/Chamilo/ThemeBundle/Event/TaskListEvent.php b/src/Chamilo/ThemeBundle/Event/TaskListEvent.php new file mode 100644 index 000000000..9b753e2a7 --- /dev/null +++ b/src/Chamilo/ThemeBundle/Event/TaskListEvent.php @@ -0,0 +1,55 @@ +tasks; + } + + /** + * @return $this + */ + public function addTask(TaskInterface $taskInterface) + { + $this->tasks[] = $taskInterface; + + return $this; + } + + /** + * @param int $total + * + * @return $this + */ + public function setTotal($total) + { + $this->total = $total; + + return $this; + } + + /** + * @return int + */ + public function getTotal() + { + return $this->total == 0 ? sizeof($this->tasks) : $this->total; + } +} diff --git a/src/Chamilo/ThemeBundle/Event/ThemeEvent.php b/src/Chamilo/ThemeBundle/Event/ThemeEvent.php new file mode 100644 index 000000000..778a7f3f5 --- /dev/null +++ b/src/Chamilo/ThemeBundle/Event/ThemeEvent.php @@ -0,0 +1,13 @@ +container = $container; + } + + public function onRequest(GetResponseEvent $event) + { + $request = $event->getRequest(); + $uri = $request->getPathInfo(); + if (!preg_match('!'.$this->indicator.'!', $uri)) { + return; + } + + if (false == ($user = $this->getUser())) { + return; + } + } + + public function getUser() + { + if (!$this->container->has('security.context')) { + return false; + } + + if (null === $token = $this->container->get('security.context')->getToken()) { + return false; + } + + if (!is_object($user = $token->getUser())) { + return false; + } + + return $user; + } + + public function onController(FilterControllerEvent $event) + { + } +} diff --git a/src/Chamilo/ThemeBundle/EventListener/NavbarMessageListDemoListener.php b/src/Chamilo/ThemeBundle/EventListener/NavbarMessageListDemoListener.php new file mode 100644 index 000000000..ca3f206a4 --- /dev/null +++ b/src/Chamilo/ThemeBundle/EventListener/NavbarMessageListDemoListener.php @@ -0,0 +1,31 @@ +getMessages() as $msg) { + $event->addMessage($msg); + } + } + + protected function getMessages() + { + return [ + new MessageModel(new UserModel('Karl kettenkit'), 'Dude! do something!', new \DateTime('-3 days')), + new MessageModel(new UserModel('Jack Trockendoc'), 'This is some subject', new \DateTime('-10 month')), + ]; + } +} diff --git a/src/Chamilo/ThemeBundle/EventListener/NavbarNotificationListDemoListener.php b/src/Chamilo/ThemeBundle/EventListener/NavbarNotificationListDemoListener.php new file mode 100644 index 000000000..19b95b5c1 --- /dev/null +++ b/src/Chamilo/ThemeBundle/EventListener/NavbarNotificationListDemoListener.php @@ -0,0 +1,30 @@ +getNotifications() as $notify) { + $event->addNotification($notify); + } + } + + protected function getNotifications() + { + return [ + new NotificationModel('some notification'), + new NotificationModel('some more notices', 'success'), + ]; + } +} diff --git a/src/Chamilo/ThemeBundle/EventListener/NavbarShowUserDemoListener.php b/src/Chamilo/ThemeBundle/EventListener/NavbarShowUserDemoListener.php new file mode 100644 index 000000000..16fdc6a25 --- /dev/null +++ b/src/Chamilo/ThemeBundle/EventListener/NavbarShowUserDemoListener.php @@ -0,0 +1,22 @@ +setAvatar('')->setIsOnline(true)->setMemberSince(new \DateTime())->setUsername('Demo User'); + $event->setUser($user); + } +} diff --git a/src/Chamilo/ThemeBundle/EventListener/NavbarTaskListDemoListener.php b/src/Chamilo/ThemeBundle/EventListener/NavbarTaskListDemoListener.php new file mode 100644 index 000000000..2de6258e6 --- /dev/null +++ b/src/Chamilo/ThemeBundle/EventListener/NavbarTaskListDemoListener.php @@ -0,0 +1,31 @@ +getTasks() as $task) { + $event->addTask($task); + } + } + + protected function getTasks() + { + return [ + new TaskModel('make stuff', 30, TaskModel::COLOR_GREEN), + new TaskModel('make more stuff', 60), + new TaskModel('some more tasks to do', 10, TaskModel::COLOR_RED), + ]; + } +} diff --git a/src/Chamilo/ThemeBundle/EventListener/SetupThemeListener.php b/src/Chamilo/ThemeBundle/EventListener/SetupThemeListener.php new file mode 100644 index 000000000..faa2d0725 --- /dev/null +++ b/src/Chamilo/ThemeBundle/EventListener/SetupThemeListener.php @@ -0,0 +1,48 @@ +cssBase = $cssBase ?: 'bundles/avanzuadmintheme/'; + $this->lteAdmin = $lteAdmin ?: 'vendor/AdminLTE/css/'; + $this->manager = $manager; + } + + public function onKernelController(FilterControllerEvent $event) + { + $css = rtrim($this->cssBase, '/').'/'.trim($this->lteAdmin, '/'); + $mng = $this->manager; + $mng->registerStyle('jquery-ui', $css.'/jQueryUI/jquery-ui-1.10.3.custom.css'); + $mng->registerStyle('bootstrap', $css.'/bootstrap.css', ['jquery-ui']); + $mng->registerStyle('bootstrap-slider', $css.'/bootstrap-slider/slider.css', ['bootstrap']); + $mng->registerStyle('datatables', $css.'/datatables/dataTables.bootstrap.css', ['bootstrap']); + $mng->registerStyle('fontawesome', $css.'/font-awesome.css'); + $mng->registerStyle('ionicons', $css.'/ionicons.css'); + $mng->registerStyle('admin-lte', $css.'/AdminLTE.css', ['bootstrap-slider', 'fontawesome', 'ionicons', 'datatables']); + $mng->registerStyle('bs-colorpicker', $css.'/colorpicker/bootstrap-colorpicker.css', ['admin-lte']); + $mng->registerStyle('daterangepicker', $css.'/daterangepicker/daterangepicker-bs3.css', ['admin-lte']); + $mng->registerStyle('timepicker', $css.'/timepicker/bootstrap-timepicker.css', ['admin-lte']); + $mng->registerStyle('wysiwyg', $css.'/bootstrap-wysihtml5/bootstrap3-wysihtml5.css', ['admin-lte']); + } +} diff --git a/src/Chamilo/ThemeBundle/EventListener/SidebarSetupMenuDemoListener.php b/src/Chamilo/ThemeBundle/EventListener/SidebarSetupMenuDemoListener.php new file mode 100644 index 000000000..7d0214d3a --- /dev/null +++ b/src/Chamilo/ThemeBundle/EventListener/SidebarSetupMenuDemoListener.php @@ -0,0 +1,56 @@ +getRequest(); + + foreach ($this->getMenu($request) as $item) { + $event->addItem($item); + } + } + + protected function getMenu(Request $request) + { + $earg = []; + $rootItems = [ + $dash = new MenuItemModel('dashboard', 'Dashboard', 'avanzu_admin_dash_demo', $earg, 'fa fa-dashboard'), + $form = new MenuItemModel('forms', 'Forms', 'avanzu_admin_form_demo', $earg, 'fa fa-edit'), + $widgets = new MenuItemModel('widgets', 'Widgets', 'avanzu_admin_demo', $earg, 'fa fa-th', 'new'), + $ui = new MenuItemModel('ui-elements', 'UI Elements', '', $earg, 'fa fa-laptop'), + ]; + + $ui->addChild(new MenuItemModel('ui-elements-general', 'General', 'avanzu_admin_ui_gen_demo', $earg)) + ->addChild($icons = new MenuItemModel('ui-elements-icons', 'Icons', 'avanzu_admin_ui_icon_demo', $earg)); + + return $this->activateByRoute($request->get('_route'), $rootItems); + } + + protected function activateByRoute($route, $items) + { + foreach ($items as $item) { /** @var $item MenuItemModel */ + if ($item->hasChildren()) { + $this->activateByRoute($route, $item->getChildren()); + } else { + if ($item->getRoute() == $route) { + $item->setIsActive(true); + } + } + } + + return $items; + } +} diff --git a/src/Chamilo/ThemeBundle/Form/FormDemoModelType.php b/src/Chamilo/ThemeBundle/Form/FormDemoModelType.php new file mode 100644 index 000000000..2330b2d02 --- /dev/null +++ b/src/Chamilo/ThemeBundle/Form/FormDemoModelType.php @@ -0,0 +1,61 @@ + 'This is option 1', + 'opt2' => 'This is option 2', + 'opt3' => 'This is option 3', + ]; + + $choices = [ + 'choice1' => 'This is choice 1', + 'choice2' => 'This is choice 2', + 'choice3' => 'This is choice 3', + ]; + + $builder->add('name', 'text') + ->add('gender', 'choice', ['choices' => ['m' => 'male', 'f' => 'female']]) + ->add('someOption', 'choice', ['choices' => $options, 'expanded' => true]) + ->add('someChoices', 'choice', ['choices' => $choices, 'expanded' => true, 'multiple' => true]) + ->add('username') + ->add('email') + ->add('termsAccepted', 'checkbox') + ->add('message', 'textarea') + ->add('price') + ->add('date', 'date', ['widget' => 'single_text']) + ->add('time', 'time', ['widget' => 'single_text']) + ; + } + + public function setDefaultOptions(OptionsResolverInterface $resolver) + { + $resolver->setDefaults([ + 'data_class' => 'Chamilo\ThemeBundle\Model\FormDemoModel', + ]); + } + + /** + * Returns the name of this type. + * + * @return string The name of this type + */ + public function getName() + { + return 'form_demo'; + } +} diff --git a/src/Chamilo/ThemeBundle/Helper/WidgetHelper.php b/src/Chamilo/ThemeBundle/Helper/WidgetHelper.php new file mode 100644 index 000000000..9406fa0e1 --- /dev/null +++ b/src/Chamilo/ThemeBundle/Helper/WidgetHelper.php @@ -0,0 +1,22 @@ +badge = $badge; + $this->icon = $icon; + $this->identifier = $id; + $this->label = $label; + $this->route = $route; + $this->routeArgs = $routeArgs; + $this->badgeColor = $badgeColor; + } + + /** + * @return mixed + */ + public function getBadge() + { + return $this->badge; + } + + /** + * @param mixed $badge + * + * @return $this + */ + public function setBadge($badge) + { + $this->badge = $badge; + + return $this; + } + + /** + * @return array + */ + public function getChildren() + { + return $this->children; + } + + /** + * @param array $children + */ + public function setChildren($children) + { + $this->children = $children; + } + + /** + * @return mixed + */ + public function getIcon() + { + return $this->icon; + } + + /** + * @param mixed $icon + * + * @return $this + */ + public function setIcon($icon) + { + $this->icon = $icon; + + return $this; + } + + /** + * @return mixed + */ + public function getIdentifier() + { + return $this->identifier; + } + + /** + * @param mixed $identifier + * + * @return $this + */ + public function setIdentifier($identifier) + { + $this->identifier = $identifier; + + return $this; + } + + /** + * @return bool + */ + public function getIsActive() + { + return $this->isActive; + } + + /** + * @param bool $isActive + * + * @return $this + */ + public function setIsActive($isActive) + { + if ($this->hasParent()) { + $this->getParent()->setIsActive($isActive); + } + + $this->isActive = $isActive; + + return $this; + } + + /** + * @return bool + */ + public function hasParent() + { + return $this->parent instanceof MenuItemInterface; + } + + /** + * @return \Chamilo\ThemeBundle\Model\MenuItemInterface + */ + public function getParent() + { + return $this->parent; + } + + /** + * @param \Chamilo\ThemeBundle\Model\MenuItemInterface $parent + * + * @return $this + */ + public function setParent(MenuItemInterface $parent = null) + { + $this->parent = $parent; + + return $this; + } + + /** + * @return string + */ + public function getLabel() + { + return $this->label; + } + + /** + * @param string $label + * + * @return $this + */ + public function setLabel($label) + { + $this->label = $label; + + return $this; + } + + /** + * @return string + */ + public function getRoute() + { + return $this->route; + } + + /** + * @param string $route + * + * @return $this + */ + public function setRoute($route) + { + $this->route = $route; + + return $this; + } + + /** + * @return array + */ + public function getRouteArgs() + { + return $this->routeArgs; + } + + /** + * @param array $routeArgs + * + * @return $this + */ + public function setRouteArgs($routeArgs) + { + $this->routeArgs = $routeArgs; + + return $this; + } + + /** + * @return bool + */ + public function hasChildren() + { + return sizeof($this->children) > 0; + } + + /** + * @return $this + */ + public function addChild(MenuItemInterface $child) + { + $child->setParent($this); + $this->children[] = $child; + + return $this; + } + + /** + * @return $this + */ + public function removeChild(MenuItemInterface $child) + { + if (false !== ($key = array_search($child, $this->children))) { + unset($this->children[$key]); + } + + return $this; + } + + /** + * @return string + */ + public function getBadgeColor() + { + return $this->badgeColor; + } + + /** + * @param string $badgeColor + * + * @return $this + */ + public function setBadgeColor($badgeColor) + { + $this->badgeColor = $badgeColor; + + return $this; + } + + /** + * @return MenuItemInterface|null + */ + public function getActiveChild() + { + foreach ($this->children as $child) { + if ($child->isActive()) { + return $child; + } + } + + return null; + } + + /** + * @return bool + */ + public function isActive() + { + return $this->isActive; + } +} diff --git a/src/Chamilo/ThemeBundle/Model/MessageInterface.php b/src/Chamilo/ThemeBundle/Model/MessageInterface.php new file mode 100644 index 000000000..7c27a4f7a --- /dev/null +++ b/src/Chamilo/ThemeBundle/Model/MessageInterface.php @@ -0,0 +1,42 @@ +to = $to; + $this->subject = $subject; + $this->sentAt = $sentAt ?: new \DateTime(); + $this->from = $from; + } + + /** + * Set the sender. + * + * @param \Chamilo\ThemeBundle\Model\UserInterface $from + * + * @return $this + */ + public function setFrom(UserInterface $from) + { + $this->from = $from; + + return $this; + } + + /** + * Get the Sender. + * + * @return \Chamilo\ThemeBundle\Model\UserInterface + */ + public function getFrom() + { + return $this->from; + } + + /** + * Set the date sent. + * + * @return $this + */ + public function setSentAt(\DateTime $sentAt) + { + $this->sentAt = $sentAt; + + return $this; + } + + /** + * Get the date sent. + * + * @return \DateTime + */ + public function getSentAt() + { + return $this->sentAt; + } + + /** + * Set the subject. + * + * @param string $subject + * + * @return $this + */ + public function setSubject($subject) + { + $this->subject = $subject; + + return $this; + } + + /** + * Get the subject. + * + * @return string + */ + public function getSubject() + { + return $this->subject; + } + + /** + * Set the recipient. + * + * @param \Chamilo\ThemeBundle\Model\UserInterface $to + * + * @return $this + */ + public function setTo(UserInterface $to) + { + $this->to = $to; + + return $this; + } + + /** + * Get the recipient. + * + * @return \Chamilo\ThemeBundle\Model\UserInterface + */ + public function getTo() + { + return $this->to; + } + + /** + * Get the identifier. + * + * @return string + */ + public function getIdentifier() + { + return $this->getSubject(); + } +} diff --git a/src/Chamilo/ThemeBundle/Model/NotificationInterface.php b/src/Chamilo/ThemeBundle/Model/NotificationInterface.php new file mode 100644 index 000000000..2d013455e --- /dev/null +++ b/src/Chamilo/ThemeBundle/Model/NotificationInterface.php @@ -0,0 +1,19 @@ +message = $message; + $this->type = $type; + $this->icon = $icon; + } + + /** + * @param mixed $message + * + * @return $this + */ + public function setMessage($message) + { + $this->message = $message; + + return $this; + } + + /** + * @return mixed + */ + public function getMessage() + { + return $this->message; + } + + /** + * @param mixed $type + * + * @return $this + */ + public function setType($type) + { + $this->type = $type; + + return $this; + } + + /** + * @return mixed + */ + public function getType() + { + return $this->type; + } + + /** + * @param string $icon + * + * @return $this + */ + public function setIcon($icon) + { + $this->icon = $icon; + + return $this; + } + + /** + * @return string + */ + public function getIcon() + { + return $this->icon; + } + + public function getIdentifier() + { + return $this->message; + } +} diff --git a/src/Chamilo/ThemeBundle/Model/TaskInterface.php b/src/Chamilo/ThemeBundle/Model/TaskInterface.php new file mode 100644 index 000000000..6752f3485 --- /dev/null +++ b/src/Chamilo/ThemeBundle/Model/TaskInterface.php @@ -0,0 +1,19 @@ +color = $color; + $this->progress = $progress; + $this->title = $title; + } + + /** + * @param string $color + * + * @return $this + */ + public function setColor($color) + { + $this->color = $color; + + return $this; + } + + /** + * @return string + */ + public function getColor() + { + return $this->color; + } + + /** + * @param mixed $progress + * + * @return $this + */ + public function setProgress($progress) + { + $this->progress = $progress; + + return $this; + } + + /** + * @return mixed + */ + public function getProgress() + { + return $this->progress; + } + + /** + * @param mixed $title + * + * @return $this + */ + public function setTitle($title) + { + $this->title = $title; + + return $this; + } + + /** + * @return mixed + */ + public function getTitle() + { + return $this->title; + } + + public function getIdentifier() + { + return $this->title; + } +} diff --git a/src/Chamilo/ThemeBundle/Model/UserInterface.php b/src/Chamilo/ThemeBundle/Model/UserInterface.php new file mode 100644 index 000000000..ca1df3839 --- /dev/null +++ b/src/Chamilo/ThemeBundle/Model/UserInterface.php @@ -0,0 +1,22 @@ +avatar = $avatar; + $this->isOnline = $isOnline; + $this->memberSince = $memberSince ?: new \DateTime(); + $this->username = $username; + } + + /** + * @param string $avatar + * + * @return $this + */ + public function setAvatar($avatar) + { + $this->avatar = $avatar; + + return $this; + } + + /** + * @return string + */ + public function getAvatar() + { + return $this->avatar; + } + + /** + * @param bool $isOnline + * + * @return $this + */ + public function setIsOnline($isOnline) + { + $this->isOnline = $isOnline; + + return $this; + } + + /** + * @return bool + */ + public function getIsOnline() + { + return $this->isOnline; + } + + /** + * @return $this + */ + public function setMemberSince(\DateTime $memberSince) + { + $this->memberSince = $memberSince; + + return $this; + } + + /** + * @return \DateTime + */ + public function getMemberSince() + { + return $this->memberSince; + } + + /** + * @param string $username + * + * @return $this + */ + public function setUsername($username) + { + $this->username = $username; + + return $this; + } + + /** + * @return string + */ + public function getUsername() + { + return $this->username; + } + + /** + * @return bool + */ + public function isOnline() + { + return $this->getIsOnline(); + } + + public function getIdentifier() + { + return str_replace(' ', '-', $this->getUsername()); + } +} diff --git a/src/Chamilo/ThemeBundle/README.md b/src/Chamilo/ThemeBundle/README.md new file mode 100644 index 000000000..bfeebf077 --- /dev/null +++ b/src/Chamilo/ThemeBundle/README.md @@ -0,0 +1,15 @@ +ThemeBundle +================ +Based in AvanzuAdminThemeBundle + +Admin Theme based on the AdminLTE Template for easy integration into symfony. +This bundle integrates several commonly used javascripts and the awesome [AdminLTE Template](https://github.com/almasaeed2010/AdminLTE). + + + + + + + + + diff --git a/src/Chamilo/ThemeBundle/Resources/config/security.yml b/src/Chamilo/ThemeBundle/Resources/config/security.yml new file mode 100644 index 000000000..7acbab49d --- /dev/null +++ b/src/Chamilo/ThemeBundle/Resources/config/security.yml @@ -0,0 +1,5 @@ +login: + path: /login + defaults: { _controller: ChamiloThemeBundle:Security:login } +login_check: + path: /login_check diff --git a/src/Chamilo/ThemeBundle/Resources/config/services.xml b/src/Chamilo/ThemeBundle/Resources/config/services.xml new file mode 100644 index 000000000..4e2c8e220 --- /dev/null +++ b/src/Chamilo/ThemeBundle/Resources/config/services.xml @@ -0,0 +1,51 @@ + + + + + Chamilo\ThemeBundle\EventListener\NavbarShowUserDemoListener + Chamilo\ThemeBundle\EventListener\NavbarTaskListDemoListener + Chamilo\ThemeBundle\EventListener\NavbarNotificationListDemoListener + Chamilo\ThemeBundle\EventListener\NavbarMessageListDemoListener + Chamilo\ThemeBundle\EventListener\SidebarSetupMenuDemoListener + Chamilo\ThemeBundle\Controller\ExceptionController + Chamilo\ThemeBundle\Controller\ExceptionController + Chamilo\ThemeBundle\Twig\WidgetExtension + Chamilo\ThemeBundle\Theme\ThemeManager + Chamilo\ThemeBundle\EventListener\SetupThemeListener + + + + + + + + + + %kernel.debug% + + + + + + + + + %chamilo_admin_theme.dependency_resolver.class% + + + + + %chamilo_admin_theme.css_base% + %chamilo_admin_theme.lte_admin% + + + + + + + + + + diff --git a/src/Chamilo/ThemeBundle/Resources/scss/admin.scss b/src/Chamilo/ThemeBundle/Resources/scss/admin.scss new file mode 100644 index 000000000..d9d1092f9 --- /dev/null +++ b/src/Chamilo/ThemeBundle/Resources/scss/admin.scss @@ -0,0 +1,5 @@ +body { + + margin-top: 70px; + +} \ No newline at end of file diff --git a/src/Chamilo/ThemeBundle/Resources/views/Breadcrumb/breadcrumb.html.twig b/src/Chamilo/ThemeBundle/Resources/views/Breadcrumb/breadcrumb.html.twig new file mode 100644 index 000000000..72ab1620b --- /dev/null +++ b/src/Chamilo/ThemeBundle/Resources/views/Breadcrumb/breadcrumb.html.twig @@ -0,0 +1,37 @@ + diff --git a/src/Chamilo/ThemeBundle/Resources/views/Default/form.html.twig b/src/Chamilo/ThemeBundle/Resources/views/Default/form.html.twig new file mode 100644 index 000000000..63223b7fb --- /dev/null +++ b/src/Chamilo/ThemeBundle/Resources/views/Default/form.html.twig @@ -0,0 +1,52 @@ +{% extends '@ChamiloTheme/Layout/base-layout.html.twig' %} + +{% block page_content %} + +
+
+ + +
+
+ +
+
+ +
+
+ +
+
+ +
+
+

Form Theme

+
+
+ {{ form(form) }} +
+ +
+ +
+
+
+ {{ macro.box_header('built from macro', true, false, 'primary') }} +
+ some content... +
+
+
+
+ + +{% endblock %} + +{% block page_title %} Forms {% endblock %} +{% block page_subtitle %} demonstration {% endblock %} diff --git a/src/Chamilo/ThemeBundle/Resources/views/Default/index.html.twig b/src/Chamilo/ThemeBundle/Resources/views/Default/index.html.twig new file mode 100644 index 000000000..5b77d0d65 --- /dev/null +++ b/src/Chamilo/ThemeBundle/Resources/views/Default/index.html.twig @@ -0,0 +1 @@ +{% extends '@ChamiloTheme/Layout/base-layout.html.twig' %} diff --git a/src/Chamilo/ThemeBundle/Resources/views/Exception/exception_full.html.twig b/src/Chamilo/ThemeBundle/Resources/views/Exception/exception_full.html.twig new file mode 100644 index 000000000..d3238945c --- /dev/null +++ b/src/Chamilo/ThemeBundle/Resources/views/Exception/exception_full.html.twig @@ -0,0 +1,94 @@ +{% extends '@ChamiloTheme/Layout/base-layout.html.twig' %} +{% block page_title %} Error {% endblock %} +{% block page_subtitle %} {{ status_code }} {% endblock %} + +{% block page_content %} +
+

{{ status_code }}

+ +
+

{{ 'Something seems to have gone wrong'|trans() }}

+ +

{{ exception.message }}

+
+
+ +
+ + {% for n, position in exception.toarray %} + +
+
+ + +

{{ position.class|abbr_class }}

+
+
+ +
+ {{ position.message|nl2br|format_file_from_text }} +
+ +
+ + + +
+ +
+
+
+
    + {% for i, trace in position.trace %} +
  • + + Stack #{{ i }} + +
  • +
  • + + +
    +

    + {{ trace.file }} +

    + +
    + {% if trace.function %} + at + + {{ trace.short_class }} + {{ trace.type ~ trace.function }} + + ({{ trace.args|format_args }}) + {% endif %} + + {% if trace.file is defined and trace.file and trace.line is defined and trace.line %} + {{ trace.function ? '
    ' : '' }} + in {{ trace.file|format_file(trace.line) }}  + {{ trace.file|file_excerpt(trace.line) }} + + {% endif %} +
    +
    +
  • + {% endfor %} +
+
+
+
+
+
+
+
+
+ {% endfor %} + +{% endblock %} diff --git a/src/Chamilo/ThemeBundle/Resources/views/Layout/base-layout.html.twig b/src/Chamilo/ThemeBundle/Resources/views/Layout/base-layout.html.twig new file mode 100644 index 000000000..09cb7845a --- /dev/null +++ b/src/Chamilo/ThemeBundle/Resources/views/Layout/base-layout.html.twig @@ -0,0 +1,269 @@ +{% import "ChamiloThemeBundle:Macros:box.html.twig" as macro_box %} +{% import "ChamiloThemeBundle:Macros:actions.html.twig" as macro_actions %} +{% import "ChamiloThemeBundle:Macros:buttons.html.twig" as macro_buttons %} +{% import "ChamiloThemeBundle:Macros:image.html.twig" as macro_image %} +{% import 'ChamiloThemeBundle:Macros:headers.html.twig' as macro_headers %} + + + + + + + + + + + {# Check settings in app/config/sonata/sonata_seo.yml #} + {{ sonata_seo_metadatas() }} + + + + + + + + + {% block title %} + {#{{ chamilo_settings_get('platform.institution') }} - {{ chamilo_settings_get('platform.site_name') }}#} + {% endblock %} + + + {# Check chamilo_css key in assetic.yml #} + {#{%- stylesheets '@chamilo_css' -%}#} + {##} + {#{% endstylesheets %}#} + + {#{% stylesheets#} + {#'@MopaBootstrapBundle/Resources/public/less/mopabootstrapbundle.less'#} + {#'@MopaBootstrapBundle/Resources/public/less/eyecon-datepicker.less'#} + {#%}#} + + {##} + {#{% endstylesheets %}#} + + {# Chamilo theme #} + {% set theme = 'chamilo' %} + + {% set bug_notification_link = '' %} + {% set help_content = '' %} + {% set header_extra_content = '' %} + + {% set template = 'default' %} + {% set notification_menu = '' %} + {% set accessibility = '' %} + {% set containerClass = '' %} + {% set breadcrumb = '' %} + {% set user_notifications = '' %} + {% set message_url = '' %} + {% set profile_link = '' %} + {% set message_link = '' %} + + + + + + + + + + + + + + + + {# Check chamilo_js key in assetic.yml #} + {% block javascripts %} + {#{%- javascripts '@chamilo_js' -%}#} + {##} + {#{% endjavascripts %}#} + + + + + + + + + {% block chamilo_header_js %} + {% include '@ChamiloTheme/Layout/header.js.twig' %} + {% endblock %} + + {#'@MopaBootstrapBundle/Resources/public/js/eyecon-bootstrap-datepicker.js'#} + + {#{% javascripts#} + {#'bundles/mopabootstrap/js/mopabootstrap-collection.js'#} + {#'bundles/mopabootstrap/js/mopabootstrap-subnav.js'#} + {#%}#} + {##} + {#{% endjavascripts %}#} + +{##} + + + +{#{% if show_header == true %}#} +{% block chamilo_wrap %} +
+ +
+
+ {{ header_extra_content }} +
+ +
+ {% if plugin_header_main %} +
+
+ {{ plugin_header_main }} +
+
+ {% endif %} +
+
+ +
+
+
+ {% if plugin_header_left is not null %} +
+ {{ plugin_header_left }} +
+ {% endif %} +
+
+ {% if plugin_header_center is not null %} +
+ {{ plugin_header_center }} +
+ {% endif %} +
+
+ {% if plugin_header_right is not null %} +
+ {{ plugin_header_right }} +
+ {% endif %} +
+ +
+ {{ accessibility }} +
+
+
+
+ + + {##} +
+ +
+ {#{{ locale_switcher() }}#} + +{# course navigation links/shortcuts need to be activated by the admin #} + {#{% include "@template_style/layout/course_navigation.html.twig" %}#} +{#{% endif %}#} + +{% block chamilo_header %} + {#
#} + {#{% block chamilo_logo %}#} + {##} + {#{% endblock %}#} + {#{% block chamilo_main_navbar %}#} + {##} + {#{% endblock %}#} + {#
#} +{% endblock %} + + {% include 'SonataCoreBundle:FlashMessage:render.html.twig' %} + +{% block chamilo_content %} + {#Check sonata_block.yml settings#} + {#{% include 'SonataSeoBundle:Block:_facebook_sdk.html.twig' %}#} + {#{% include 'SonataSeoBundle:Block:_twitter_sdk.html.twig' %}#} + {#{% include 'SonataSeoBundle:Block:_pinterest_sdk.html.twig' %}#} + +{% endblock %} + +{% block page_content %} +{% endblock %} + + +{% block sonata_page_container %} +{% endblock %} + +{##} +{#
#} + {##} + {#{% block content_header %}#} + {#
#} + {#{% block content_header_title %}#} + {#

#} + {#{% block page_title %}{% endblock %}#} + {#{% block page_subtitle %}{% endblock %}#} + {#

#} + {#{% endblock %}#} + + {#{% block chamilo_breadcrumb %}#} + {#{{ render(controller('ChamiloThemeBundle:Breadcrumb:breadcrumb', {'request':app.request, 'title' : block('page_title')})) }}#} + {#{% endblock %}#} + {#
#} + {#{% endblock %}#} + + {##} + {#
#} + {#{% block page_content %}{% endblock %}#} + {#
#} + {##} +{#
#} +{##} + +{% endblock %} +
+
+{# End wrapper div #} + +{% block chamilo_footer %} + {% include "@ChamiloCore/default/layout/footer.html.twig" %} +{% endblock %} + +{% block chamilo_footer_js %} + {% include '@ChamiloTheme/Layout/footer.js.twig' %} +{% endblock %} + +{% endblock %} {# End wrapper block#} + + diff --git a/src/Chamilo/ThemeBundle/Resources/views/Layout/footer.js.twig b/src/Chamilo/ThemeBundle/Resources/views/Layout/footer.js.twig new file mode 100644 index 000000000..7727e3389 --- /dev/null +++ b/src/Chamilo/ThemeBundle/Resources/views/Layout/footer.js.twig @@ -0,0 +1,96 @@ + diff --git a/src/Chamilo/ThemeBundle/Resources/views/Layout/form-theme.html.twig b/src/Chamilo/ThemeBundle/Resources/views/Layout/form-theme.html.twig new file mode 100644 index 000000000..86a5c0462 --- /dev/null +++ b/src/Chamilo/ThemeBundle/Resources/views/Layout/form-theme.html.twig @@ -0,0 +1,164 @@ +{% extends 'form_div_layout.html.twig' %} + +{% block widget_attributes %} + {% if attr.class is defined %} + {% set class = attr.class ~ ' form-control' %} + {% else %} + {% set class = 'form-control' %} + {% endif %} + {% set attr = attr|merge({'class' : class}) %} + {{ parent () }} +{% endblock widget_attributes %} + +{% block choice_widget_expanded %} + {% spaceless %} +
+ {% for child in form %} + {{ form_widget(child) }} + {% endfor %} +
+ {% endspaceless %} +{% endblock choice_widget_expanded %} + +{% block choice_widget_collapsed %} + {% set attr = attr|merge({'class' : 'form-control'}) %} + {{ parent() }} +{% endblock %} + +{% block checkbox_widget %} +
+ {% 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|default('') ~ ' required')|trim}) %} + {% endif %} + {% if label is empty %} + {% set label = name|humanize %} + {% endif %} + + + {% if label is not sameas(false) %} + {{ label|trans({}, translation_domain) }} + {% endif %} + + {% endspaceless %} +
+{% endblock checkbox_widget %} + +{% block radio_widget %} +
+ {% 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|default('') ~ ' required')|trim}) %} + {% endif %} + {% if label is empty %} + {% set label = name|humanize %} + {% endif %} + + + {% if label is not sameas(false) %} + {{ label|trans({}, translation_domain) }} + {% endif %} + + {% endspaceless %} +
+{% endblock radio_widget %} + +{% block date_widget %} + {% if widget == 'single_text' %} +
+
+ +
+ + {% if attr.class is defined %} + {% set class = attr.class ~ ' timepicker' %} + {% else %} + {% set class = ' timepicker' %} + {% endif %} + {% set attr = attr|merge({'class' : class, 'data-datepicker':'on'}) %} + + {{ block('form_widget_simple') }} +
+ {% else %} + {% set date_pattern = '
' ~ date_pattern ~ '
'|raw %} + {{ date_pattern|replace({ + '{{ year }}' : '
{{ year }}
', + '{{ month }}' : '
{{ month }}
', + '{{ day }}' : '
{{ day }}
', + })|raw|replace({ + '{{ year }}': form_widget(form.year), + '{{ month }}': form_widget(form.month), + '{{ day }}': form_widget(form.day), + })|raw }} + + {% endif %} +{% endblock %} + +{% block time_widget %} + {% if widget == 'single_text' %} +
+
+ {% if attr.class is defined %} + {% set class = attr.class ~ ' timepicker' %} + {% else %} + {% set class = ' timepicker' %} + {% endif %} + {% set attr = attr|merge({'class' : class, 'data-timepicker':'on'}) %} + {{ block('form_widget_simple') }} +
+ +
+
+
+ {% else %} + {{ parent() }} + {% endif %} +{% endblock %} + +{% block form_row %} + {% set types = form.vars.block_prefixes %} + {% if 'checkbox' in types or 'radio' in types %} +
+ {{ form_widget(form) }} + {{ form_errors(form) }} +
+ {% else %} +
+ {{ form_label(form) }} + {{ form_widget(form) }} + {{ form_errors(form) }} +
+ {% endif %} +{% endblock %} + +{% block form_label %} + + {% if help is defined %} +   + {% endif %} + + {{ parent() }} + {% if required %} + * + {% endif %} + +{% endblock form_label %} + +{% block form_errors %} + {% spaceless %} + {% if errors|length > 0 %} +
    + {% for error in errors %} +
  • {{ error.message }}
  • + {% endfor %} +
+ {% endif %} + {% endspaceless %} +{% endblock form_errors %} + diff --git a/src/Chamilo/ThemeBundle/Resources/views/Layout/header.js.twig b/src/Chamilo/ThemeBundle/Resources/views/Layout/header.js.twig new file mode 100644 index 000000000..dd344e021 --- /dev/null +++ b/src/Chamilo/ThemeBundle/Resources/views/Layout/header.js.twig @@ -0,0 +1,453 @@ + diff --git a/src/Chamilo/ThemeBundle/Resources/views/Layout/login-layout.html.twig b/src/Chamilo/ThemeBundle/Resources/views/Layout/login-layout.html.twig new file mode 100644 index 000000000..3ebfc4914 --- /dev/null +++ b/src/Chamilo/ThemeBundle/Resources/views/Layout/login-layout.html.twig @@ -0,0 +1,48 @@ +{% import "ChamiloThemeBundle:Macros:box.html.twig" as macro %} + + + + + + + + + + + + + {% block title %} + {#{{ chamilo_settings_get('platform.institution') }} - {{ chamilo_settings_get('platform.site_name') }}#} + Chamilo + {% endblock %} + + + {# Check chamilo_css key in assetic.yml #} + {#{%- stylesheets '@chamilo_css' -%}#} + {##} + {#{% endstylesheets %}#} + + {#{% block javascripts %}#} + {#{%- javascripts '@chamilo_js' -%}#} + {##} + {#{% endjavascripts %}#} + {#{% endblock %}#} + + {% block stylesheets %} + {% for stylesheet in sonata_admin.adminPool.getOption('stylesheets', []) %} + + {% endfor %} + {% endblock %} + + + + + + + + diff --git a/src/Chamilo/ThemeBundle/Resources/views/Macros/actions.html.twig b/src/Chamilo/ThemeBundle/Resources/views/Macros/actions.html.twig new file mode 100644 index 000000000..808475556 --- /dev/null +++ b/src/Chamilo/ThemeBundle/Resources/views/Macros/actions.html.twig @@ -0,0 +1,13 @@ +{% macro create(url) %} +
+ + {{ 'chamilo.cancel'|trans }} +
+{% endmacro %} + +{% macro update(url) %} +
+ + {{ 'chamilo.cancel'|trans }} +
+{% endmacro %} diff --git a/src/Chamilo/ThemeBundle/Resources/views/Macros/box.html.twig b/src/Chamilo/ThemeBundle/Resources/views/Macros/box.html.twig new file mode 100644 index 000000000..9d28b9336 --- /dev/null +++ b/src/Chamilo/ThemeBundle/Resources/views/Macros/box.html.twig @@ -0,0 +1,67 @@ +{% block box_collapse %} + +{% endblock %} +{% block box_remove %} + +{% endblock %} + +{% block box_header_buttons %} + {% if collapse or remove %} +
+ {% if collapse %} + {{ block('box_collapse') }} + {% endif %} + {% if remove %} + {{ block('box_remove') }} + {% endif %} +
+ {% endif %} +{% endblock %} + +{% macro box_header(title, collapse, remove, type) %} +
+

{{ title }}

+ {{ block('box_header_buttons') }} +
+{% endmacro %} + +{% macro menu_item(item) %} +
  • + + {% if item.icon %} {% endif %} + {{ item.label }} + {% if item.badge %} + {{ item.badge }} + {% endif %} + + + {% if item.hasChildren %} + + {% endif %} +
  • +{% endmacro %} + + +{% macro panel(title, content) %} + {% autoescape false %} +
    +
    +
    +

    {{ title }}

    +
    +
    +
    + {{ content }} +
    +
    + {% endautoescape %} +{% endmacro %} diff --git a/src/Chamilo/ThemeBundle/Resources/views/Macros/buttons.html.twig b/src/Chamilo/ThemeBundle/Resources/views/Macros/buttons.html.twig new file mode 100644 index 000000000..128858b93 --- /dev/null +++ b/src/Chamilo/ThemeBundle/Resources/views/Macros/buttons.html.twig @@ -0,0 +1,62 @@ +{% macro show(url, message) %} + + {{ message is empty ? 'sylius.show'|trans : message }} + +{% endmacro %} + +{% macro generic(url, message, icon) %} + + {% if icon is not empty %}{% endif %}{{ message }} + +{% endmacro %} + +{% macro create(url, message) %} + + {{ message is empty ? 'sylius.create'|trans : message }} + +{% endmacro %} + +{% macro edit(url, message) %} + + {{ message is empty ? 'sylius.edit'|trans : message }} + +{% endmacro %} + +{% macro delete(url, message, disabled=false, modal=true) %} +{% if disabled %} + + {{ message is empty ? 'sylius.delete'|trans : message }} + +{% else %} +
    + + +
    +{% endif %} +{% endmacro %} + +{% macro manage(url, message) %} + + {{ message is empty ? 'sylius.manage'|trans : message }} + +{% endmacro %} + +{% macro move(url, direction, first=false, last=false, message='') %} +
    + + +
    +{% endmacro %} + +{% macro patch(url, message, icon, button) %} +
    + + +
    +{% endmacro %} diff --git a/src/Chamilo/ThemeBundle/Resources/views/Macros/headers.html.twig b/src/Chamilo/ThemeBundle/Resources/views/Macros/headers.html.twig new file mode 100644 index 000000000..88fc4cd1d --- /dev/null +++ b/src/Chamilo/ThemeBundle/Resources/views/Macros/headers.html.twig @@ -0,0 +1,7 @@ +{% macro header(title) %} +

    {{ title }}

    +{% endmacro %} + +{% macro sub_header(title) %} +

    {{ title }}

    +{% endmacro %} diff --git a/src/Chamilo/ThemeBundle/Resources/views/Macros/image.html.twig b/src/Chamilo/ThemeBundle/Resources/views/Macros/image.html.twig new file mode 100644 index 000000000..86ac0406a --- /dev/null +++ b/src/Chamilo/ThemeBundle/Resources/views/Macros/image.html.twig @@ -0,0 +1,15 @@ +{% macro avatar(image, alt, class) %} + {% if image %} + {{ alt }} + {% else %} + {#{% image '@avatar_img' %}#} + {#{{alt}}#} + {#{% endimage %}#} + {% endif %} +{% endmacro %} + +{% macro avatar_from_media(media, alt, class) %} + {% if media %} + {% thumbnail media, 'small' with {'class': 'img-circle'} %} + {% endif %} +{% endmacro %} diff --git a/src/Chamilo/ThemeBundle/Resources/views/Navbar/messages.html.twig b/src/Chamilo/ThemeBundle/Resources/views/Navbar/messages.html.twig new file mode 100644 index 000000000..652197720 --- /dev/null +++ b/src/Chamilo/ThemeBundle/Resources/views/Navbar/messages.html.twig @@ -0,0 +1,37 @@ +{% import "ChamiloThemeBundle:Macros:image.html.twig" as macro_image %} + + diff --git a/src/Chamilo/ThemeBundle/Resources/views/Navbar/notifications.html.twig b/src/Chamilo/ThemeBundle/Resources/views/Navbar/notifications.html.twig new file mode 100644 index 000000000..60f47a38d --- /dev/null +++ b/src/Chamilo/ThemeBundle/Resources/views/Navbar/notifications.html.twig @@ -0,0 +1,24 @@ + + diff --git a/src/Chamilo/ThemeBundle/Resources/views/Navbar/tasks.html.twig b/src/Chamilo/ThemeBundle/Resources/views/Navbar/tasks.html.twig new file mode 100644 index 000000000..7a7bea67b --- /dev/null +++ b/src/Chamilo/ThemeBundle/Resources/views/Navbar/tasks.html.twig @@ -0,0 +1,37 @@ + + diff --git a/src/Chamilo/ThemeBundle/Resources/views/Navbar/user.html.twig b/src/Chamilo/ThemeBundle/Resources/views/Navbar/user.html.twig new file mode 100644 index 000000000..b4ed9e1f9 --- /dev/null +++ b/src/Chamilo/ThemeBundle/Resources/views/Navbar/user.html.twig @@ -0,0 +1,47 @@ + +{% import "ChamiloThemeBundle:Macros:image.html.twig" as macro_image %} + diff --git a/src/Chamilo/ThemeBundle/Resources/views/Security/login.html.twig b/src/Chamilo/ThemeBundle/Resources/views/Security/login.html.twig new file mode 100644 index 000000000..00f60fca7 --- /dev/null +++ b/src/Chamilo/ThemeBundle/Resources/views/Security/login.html.twig @@ -0,0 +1,62 @@ + + + + + {% block title %} Log in {% endblock %} + + + {#{% stylesheets '@admin_lte_css' %}#} + {##} + {#{% endstylesheets %}#} + + + + + + + +
    +
    Sign In
    +
    +
    +
    + +
    +
    + +
    + {# +
    + Remember me +
    + #} +
    + +
    + +
    + Sign in using social networks +
    + + + + +
    +
    + + + + + + + + + diff --git a/src/Chamilo/ThemeBundle/Resources/views/Sidebar/menu_knp.html.twig b/src/Chamilo/ThemeBundle/Resources/views/Sidebar/menu_knp.html.twig new file mode 100644 index 000000000..ed77a729d --- /dev/null +++ b/src/Chamilo/ThemeBundle/Resources/views/Sidebar/menu_knp.html.twig @@ -0,0 +1,38 @@ + +{% import "ChamiloThemeBundle:Macros:box.html.twig" as macro %} +{% autoescape false %} + +{% if is_granted('IS_AUTHENTICATED_FULLY') %} + {#{{ macro.panel(#} + {#'Profile' | trans,#} + {#mopa_bootstrap_menu('ChamiloCoreBundle:SimpleMenuBuilder:mainMenu', {'automenu': 'pills', 'stacked':true})) }}#} + + {{ macro.panel( + 'Courses' | trans, + mopa_bootstrap_menu('ChamiloCoreBundle:CourseMenuBuilder:courseMenu', {'automenu': 'pills', 'stacked':true})) }} + + {{ macro.panel( + 'Skills' | trans, + mopa_bootstrap_menu('ChamiloCoreBundle:CourseMenuBuilder:skillsMenu', {'automenu': 'pills', 'stacked':true})) }} + +{% else %} + {{ locale_switcher(null, null, 'ChamiloCoreBundle:Admin:switcher_links.html.twig') }} +
    + +
    + + {{ mopa_bootstrap_menu('ChamiloCoreBundle:SimpleMenuBuilder:notLoginMenu', {'automenu': 'pills', 'stacked':true}) }} +{% endif %} + +{% endautoescape %} diff --git a/src/Chamilo/ThemeBundle/Resources/views/Sidebar/search-form.html.twig b/src/Chamilo/ThemeBundle/Resources/views/Sidebar/search-form.html.twig new file mode 100644 index 000000000..f669b99a8 --- /dev/null +++ b/src/Chamilo/ThemeBundle/Resources/views/Sidebar/search-form.html.twig @@ -0,0 +1,12 @@ + + + diff --git a/src/Chamilo/ThemeBundle/Resources/views/Sidebar/user-panel.html.twig b/src/Chamilo/ThemeBundle/Resources/views/Sidebar/user-panel.html.twig new file mode 100644 index 000000000..46d6ebcee --- /dev/null +++ b/src/Chamilo/ThemeBundle/Resources/views/Sidebar/user-panel.html.twig @@ -0,0 +1,24 @@ +{% import "ChamiloThemeBundle:Macros:image.html.twig" as macro_image %} + +
    +
    + {% if user.avatar %} + {{ macro_image.avatar_from_media(user.avatar, user.username) }} + {% else %} + {{ macro_image.avatar('bundles/chamilocore/img/unknown.jpg', user.username) }} + {% endif %} +
    + +
    +

    {{ 'Hello, %user%'| trans( {'%user%': user.username }, 'ChamiloThemeBundle') }}

    + + {{ 'Online' | trans }} + +
    + + {% if is_granted('ROLE_PREVIOUS_ADMIN') %} + + {{ 'Exit impersonation' | trans }} + + {% endif %} +
    diff --git a/src/Chamilo/ThemeBundle/Resources/views/Widget/default-box.html.twig b/src/Chamilo/ThemeBundle/Resources/views/Widget/default-box.html.twig new file mode 100644 index 000000000..e69de29bb diff --git a/src/Chamilo/ThemeBundle/Routing/MenuLoader.php b/src/Chamilo/ThemeBundle/Routing/MenuLoader.php new file mode 100644 index 000000000..75a448616 --- /dev/null +++ b/src/Chamilo/ThemeBundle/Routing/MenuLoader.php @@ -0,0 +1,36 @@ +container = $container; + $this->resolverClass = $resolverClass ?: 'Chamilo\ThemeBundle\Util\DependencyResolver'; + } + + public function registerScript($id, $src, $deps = [], $location = "bottom") + { + if (!isset($this->javascripts[$id])) { + $this->javascripts[$id] = [ + 'src' => $src, + 'deps' => $deps, + 'location' => $location, + ]; + } + } + + public function registerStyle($id, $src, $deps = []) + { + if (!isset($this->stylesheets[$id])) { + $this->stylesheets[$id] = [ + 'src' => $src, + 'deps' => $deps, + ]; + } + } + + public function getScripts($location = 'bottom') + { + $unsorted = []; + $srcList = []; + $assetList = []; + foreach ($this->javascripts as $id => $scriptDefinition) { + if ($scriptDefinition['location'] == $location) { + $unsorted[$id] = $scriptDefinition; + } + } + + $queue = $this->getResolver()->register($unsorted)->resolveAll(); + foreach ($queue as $def) { + $srcList[] = $def['src']; + } + + return $srcList; + } + + public function getStyles() + { + $srcList = []; + $queue = $this->getResolver()->register($this->stylesheets)->resolveAll(); + foreach ($queue as $def) { + $srcList[] = $def['src']; + } + + return $srcList; + } + + /** + * @return DependencyResolverInterface + */ + protected function getResolver() + { + $class = $this->resolverClass; + + return new $class(); + } + + /** + * @return FileLocator + */ + protected function getLocator() + { + return $this->container->get('file_locator'); + } +} diff --git a/src/Chamilo/ThemeBundle/Twig/WidgetExtension.php b/src/Chamilo/ThemeBundle/Twig/WidgetExtension.php new file mode 100644 index 000000000..1f44b79fa --- /dev/null +++ b/src/Chamilo/ThemeBundle/Twig/WidgetExtension.php @@ -0,0 +1,43 @@ + new \Twig_SimpleFunction( + 'widget_box', + [$this, 'renderWidget'], + ['is_safe' => ['html']] + ), + ]; + } + + public function initRuntime(Twig_Environment $environment) + { + $this->env = $environment; + } + + public function getName() + { + return 'chamilo_widget'; + } +} diff --git a/src/Chamilo/ThemeBundle/Util/DependencyResolver.php b/src/Chamilo/ThemeBundle/Util/DependencyResolver.php new file mode 100644 index 000000000..0d704e210 --- /dev/null +++ b/src/Chamilo/ThemeBundle/Util/DependencyResolver.php @@ -0,0 +1,164 @@ +registered = $items; + + return $this; + } + + /** + * @return array + */ + public function resolveAll() + { + $this->failOnCircularDependencies(); + $this->resolve(array_keys($this->registered)); + + return $this->queued; + } + + /** + * @param $ids + */ + protected function resolve($ids) + { + foreach ($ids as $id) { + if (isset($this->resolved[$id])) { + continue; + } // already done + if (!isset($this->registered[$id])) { + continue; + } // unregistered + if (!$this->hasDependencies($id)) { // standalone + $this->queued[] = $this->registered[$id]; + $this->resolved[$id] = true; + + continue; + } + + $deps = $this->unresolved($this->getDependencies($id)); + + $this->resolve($deps); + + $deps = $this->unresolved($this->getDependencies($id)); + + if (empty($deps)) { + $this->queued[] = $this->registered[$id]; + $this->resolved[$id] = true; + + continue; + } + } + } + + /** + * @param $deps + * + * @return array + */ + protected function unresolved($deps) + { + return array_diff($deps, array_keys($this->resolved)); + } + + /** + * @param $id + * + * @return bool + */ + protected function hasDependencies($id) + { + if (!isset($this->registered[$id])) { + return false; + } + + return !empty($this->registered[$id]['deps']); + } + + /** + * @param $id + */ + protected function getDependencies($id) + { + if (!$this->hasDependencies($id)) { + return null; + } + + return $this->registered[$id]['deps']; + } + + /** + * @param $needle + * @param $haystackId + * + * @return bool + */ + protected function contains($needle, $haystackId) + { + $deps = $this->getDependencies($haystackId); + if (!is_array($deps)) { + return false; + } + + return in_array($needle, $deps); + } + + /** + * @throws \RuntimeException + */ + protected function failOnCircularDependencies() + { + $ids = array_keys($this->registered); + + foreach ($ids as $id) { + if (!$this->hasDependencies($id)) { + continue; + } + + $dependencies = $this->getDependencies($id); + + foreach ($dependencies as $dep) { + if ($this->contains($id, $dep)) { + throw new \RuntimeException(sprintf('Circular dependency [%s] depends on [%s] which itself depends on [%s]', $id, $dep, $id)); + } + } + } + } +} diff --git a/src/Chamilo/ThemeBundle/Util/DependencyResolverInterface.php b/src/Chamilo/ThemeBundle/Util/DependencyResolverInterface.php new file mode 100644 index 000000000..a014511d7 --- /dev/null +++ b/src/Chamilo/ThemeBundle/Util/DependencyResolverInterface.php @@ -0,0 +1,24 @@ +totalTickets = 0; + $this->insertDateTime = new \DateTime(); + } + + /** + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * @param int $id + * + * @return Category + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @param string $name + * + * @return Category + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * @param string $description + * + * @return Category + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * @return int + */ + public function getTotalTickets() + { + return $this->totalTickets; + } + + /** + * @param int $totalTickets + * + * @return Category + */ + public function setTotalTickets($totalTickets) + { + $this->totalTickets = $totalTickets; + + return $this; + } + + /** + * @return bool + */ + public function isCourseRequired() + { + return $this->courseRequired; + } + + /** + * @param bool $courseRequired + * + * @return Category + */ + public function setCourseRequired($courseRequired) + { + $this->courseRequired = $courseRequired; + + return $this; + } + + /** + * @return Project + */ + public function getProject() + { + return $this->project; + } + + /** + * @param Project $project + * + * @return Category + */ + public function setProject($project) + { + $this->project = $project; + + return $this; + } + + /** + * @return int + */ + public function getInsertUserId() + { + return $this->insertUserId; + } + + /** + * @param int $insertUserId + * + * @return Category + */ + public function setInsertUserId($insertUserId) + { + $this->insertUserId = $insertUserId; + + return $this; + } + + /** + * @return \DateTime + */ + public function getInsertDateTime() + { + return $this->insertDateTime; + } + + /** + * @param \DateTime $insertDateTime + * + * @return Category + */ + public function setInsertDateTime($insertDateTime) + { + $this->insertDateTime = $insertDateTime; + + return $this; + } + + /** + * @return int + */ + public function getLastEditUserId() + { + return $this->lastEditUserId; + } + + /** + * @param int $lastEditUserId + * + * @return Category + */ + public function setLastEditUserId($lastEditUserId) + { + $this->lastEditUserId = $lastEditUserId; + + return $this; + } + + /** + * @return \DateTime + */ + public function getLastEditDateTime() + { + return $this->lastEditDateTime; + } + + /** + * @param \DateTime $lastEditDateTime + * + * @return Category + */ + public function setLastEditDateTime($lastEditDateTime) + { + $this->lastEditDateTime = $lastEditDateTime; + + return $this; + } +} diff --git a/src/Chamilo/TicketBundle/Entity/CategoryRelUser.php b/src/Chamilo/TicketBundle/Entity/CategoryRelUser.php new file mode 100644 index 000000000..c40fd2afd --- /dev/null +++ b/src/Chamilo/TicketBundle/Entity/CategoryRelUser.php @@ -0,0 +1,40 @@ +id; + } + + /** + * @param int $id + * + * @return Message + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * @return string + */ + public function getSubject() + { + return $this->subject; + } + + /** + * @param string $subject + * + * @return Message + */ + public function setSubject($subject) + { + $this->subject = $subject; + + return $this; + } + + /** + * @return string + */ + public function getMessage() + { + return $this->message; + } + + /** + * @param string $message + * + * @return Message + */ + public function setMessage($message) + { + $this->message = $message; + + return $this; + } + + /** + * @return string + */ + public function getStatus() + { + return $this->status; + } + + /** + * @param string $status + * + * @return Message + */ + public function setStatus($status) + { + $this->status = $status; + + return $this; + } + + /** + * @return string + */ + public function getIpAddress() + { + return $this->ipAddress; + } + + /** + * @param string $ipAddress + * + * @return Message + */ + public function setIpAddress($ipAddress) + { + $this->ipAddress = $ipAddress; + + return $this; + } + + /** + * @return Ticket + */ + public function getTicket() + { + return $this->ticket; + } + + /** + * @param Ticket $ticket + * + * @return Message + */ + public function setTicket($ticket) + { + $this->ticket = $ticket; + + return $this; + } + + /** + * @return int + */ + public function getInsertUserId() + { + return $this->insertUserId; + } + + /** + * @param int $insertUserId + * + * @return Message + */ + public function setInsertUserId($insertUserId) + { + $this->insertUserId = $insertUserId; + + return $this; + } + + /** + * @return \DateTime + */ + public function getInsertDateTime() + { + return $this->insertDateTime; + } + + /** + * @param \DateTime $insertDateTime + * + * @return Message + */ + public function setInsertDateTime($insertDateTime) + { + $this->insertDateTime = $insertDateTime; + + return $this; + } + + /** + * @return int + */ + public function getLastEditUserId() + { + return $this->lastEditUserId; + } + + /** + * @param int $lastEditUserId + * + * @return Message + */ + public function setLastEditUserId($lastEditUserId) + { + $this->lastEditUserId = $lastEditUserId; + + return $this; + } + + /** + * @return \DateTime + */ + public function getLastEditDateTime() + { + return $this->lastEditDateTime; + } + + /** + * @param \DateTime $lastEditDateTime + * + * @return Message + */ + public function setLastEditDateTime($lastEditDateTime) + { + $this->lastEditDateTime = $lastEditDateTime; + + return $this; + } +} diff --git a/src/Chamilo/TicketBundle/Entity/MessageAttachment.php b/src/Chamilo/TicketBundle/Entity/MessageAttachment.php new file mode 100644 index 000000000..e2bbcb4bc --- /dev/null +++ b/src/Chamilo/TicketBundle/Entity/MessageAttachment.php @@ -0,0 +1,189 @@ +id; + } + + /** + * @param int $id + * + * @return MessageAttachment + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * @return Message + */ + public function getMessage() + { + return $this->message; + } + + /** + * @param Message $message + * + * @return MessageAttachment + */ + public function setMessage($message) + { + $this->message = $message; + + return $this; + } + + /** + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** + * @param string $path + * + * @return MessageAttachment + */ + public function setPath($path) + { + $this->path = $path; + + return $this; + } + + /** + * @return string + */ + public function getFilename() + { + return $this->filename; + } + + /** + * @param string $filename + * + * @return MessageAttachment + */ + public function setFilename($filename) + { + $this->filename = $filename; + + return $this; + } + + /** + * @return int + */ + public function getSize() + { + return $this->size; + } + + /** + * @param int $size + * + * @return MessageAttachment + */ + public function setSize($size) + { + $this->size = $size; + + return $this; + } +} diff --git a/src/Chamilo/TicketBundle/Entity/Priority.php b/src/Chamilo/TicketBundle/Entity/Priority.php new file mode 100644 index 000000000..71729e270 --- /dev/null +++ b/src/Chamilo/TicketBundle/Entity/Priority.php @@ -0,0 +1,297 @@ +insertDateTime = new \DateTime(); + $this->color = ''; + $this->urgency = ''; + } + + /** + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * @param int $id + * + * @return Priority + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @param string $name + * + * @return Priority + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * @return string + */ + public function getCode() + { + return $this->code; + } + + /** + * @param string $code + * + * @return Priority + */ + public function setCode($code) + { + $this->code = $code; + + return $this; + } + + /** + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * @param string $description + * + * @return Priority + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * @return string + */ + public function getColor() + { + return $this->color; + } + + /** + * @param string $color + * + * @return Priority + */ + public function setColor($color) + { + $this->color = $color; + + return $this; + } + + /** + * @return string + */ + public function getUrgency() + { + return $this->urgency; + } + + /** + * @param string $urgency + * + * @return Priority + */ + public function setUrgency($urgency) + { + $this->urgency = $urgency; + + return $this; + } + + /** + * @return int + */ + public function getInsertUserId() + { + return $this->insertUserId; + } + + /** + * @param int $insertUserId + * + * @return Priority + */ + public function setInsertUserId($insertUserId) + { + $this->insertUserId = $insertUserId; + + return $this; + } + + /** + * @return \DateTime + */ + public function getInsertDateTime() + { + return $this->insertDateTime; + } + + /** + * @param \DateTime $insertDateTime + * + * @return Priority + */ + public function setInsertDateTime($insertDateTime) + { + $this->insertDateTime = $insertDateTime; + + return $this; + } + + /** + * @return int + */ + public function getLastEditUserId() + { + return $this->lastEditUserId; + } + + /** + * @param int $lastEditUserId + * + * @return Priority + */ + public function setLastEditUserId($lastEditUserId) + { + $this->lastEditUserId = $lastEditUserId; + + return $this; + } + + /** + * @return \DateTime + */ + public function getLastEditDateTime() + { + return $this->lastEditDateTime; + } + + /** + * @param \DateTime $lastEditDateTime + * + * @return Priority + */ + public function setLastEditDateTime($lastEditDateTime) + { + $this->lastEditDateTime = $lastEditDateTime; + + return $this; + } +} diff --git a/src/Chamilo/TicketBundle/Entity/Project.php b/src/Chamilo/TicketBundle/Entity/Project.php new file mode 100644 index 000000000..25529b919 --- /dev/null +++ b/src/Chamilo/TicketBundle/Entity/Project.php @@ -0,0 +1,268 @@ +insertDateTime = new \DateTime(); + } + + /** + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * @param int $id + * + * @return Project + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @param string $name + * + * @return Project + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * @param string $description + * + * @return Project + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * @return string + */ + public function getEmail() + { + return $this->email; + } + + /** + * @param string $email + * + * @return Project + */ + public function setEmail($email) + { + $this->email = $email; + + return $this; + } + + /** + * @return string + */ + public function getOtherArea() + { + return $this->otherArea; + } + + /** + * @param string $otherArea + * + * @return Project + */ + public function setOtherArea($otherArea) + { + $this->otherArea = $otherArea; + + return $this; + } + + /** + * @return int + */ + public function getInsertUserId() + { + return $this->insertUserId; + } + + /** + * @param int $insertUserId + * + * @return Project + */ + public function setInsertUserId($insertUserId) + { + $this->insertUserId = $insertUserId; + + return $this; + } + + /** + * @return \DateTime + */ + public function getInsertDateTime() + { + return $this->insertDateTime; + } + + /** + * @param \DateTime $insertDateTime + * + * @return Project + */ + public function setInsertDateTime($insertDateTime) + { + $this->insertDateTime = $insertDateTime; + + return $this; + } + + /** + * @return int + */ + public function getLastEditUserId() + { + return $this->lastEditUserId; + } + + /** + * @param int $lastEditUserId + * + * @return Project + */ + public function setLastEditUserId($lastEditUserId) + { + $this->lastEditUserId = $lastEditUserId; + + return $this; + } + + /** + * @return \DateTime + */ + public function getLastEditDateTime() + { + return $this->lastEditDateTime; + } + + /** + * @param \DateTime $lastEditDateTime + * + * @return Project + */ + public function setLastEditDateTime($lastEditDateTime) + { + $this->lastEditDateTime = $lastEditDateTime; + + return $this; + } +} diff --git a/src/Chamilo/TicketBundle/Entity/Status.php b/src/Chamilo/TicketBundle/Entity/Status.php new file mode 100644 index 000000000..5c809e763 --- /dev/null +++ b/src/Chamilo/TicketBundle/Entity/Status.php @@ -0,0 +1,125 @@ +id; + } + + /** + * @param int $id + * + * @return Status + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * @return string + */ + public function getCode() + { + return $this->code; + } + + /** + * @param string $code + * + * @return Status + */ + public function setCode($code) + { + $this->code = $code; + + return $this; + } + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @param string $name + * + * @return Status + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * @param string $description + * + * @return Status + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } +} diff --git a/src/Chamilo/TicketBundle/Entity/Ticket.php b/src/Chamilo/TicketBundle/Entity/Ticket.php new file mode 100644 index 000000000..9c4018368 --- /dev/null +++ b/src/Chamilo/TicketBundle/Entity/Ticket.php @@ -0,0 +1,252 @@ +id; + } + + /** + * @param int $id + * + * @return Ticket + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * @return string + */ + public function getCode() + { + return $this->code; + } + + /** + * @param string $code + * + * @return Ticket + */ + public function setCode($code) + { + $this->code = $code; + + return $this; + } + + /** + * @return string + */ + public function getSubject() + { + return $this->subject; + } + + /** + * @param string $subject + * + * @return Ticket + */ + public function setSubject($subject) + { + $this->subject = $subject; + + return $this; + } + + /** + * @return string + */ + public function getMessage() + { + return $this->message; + } + + /** + * @param string $message + * + * @return Ticket + */ + public function setMessage($message) + { + $this->message = $message; + + return $this; + } +} diff --git a/src/Chamilo/TimelineBundle/ChamiloTimelineBundle.php b/src/Chamilo/TimelineBundle/ChamiloTimelineBundle.php new file mode 100644 index 000000000..7261bc8d9 --- /dev/null +++ b/src/Chamilo/TimelineBundle/ChamiloTimelineBundle.php @@ -0,0 +1,32 @@ + project. + * + * (c) + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Chamilo\TimelineBundle; + +use Symfony\Component\HttpKernel\Bundle\Bundle; + +/** + * This file has been generated by the EasyExtends bundle ( https://sonata-project.org/easy-extends ). + * + * References : + * bundles : http://symfony.com/doc/current/book/bundles.html + * + * @author + */ +class ChamiloTimelineBundle extends Bundle +{ + /** + * {@inheritdoc} + */ + public function getParent() + { + return 'SonataTimelineBundle'; + } +} diff --git a/src/Chamilo/TimelineBundle/Entity/Action.php b/src/Chamilo/TimelineBundle/Entity/Action.php new file mode 100644 index 000000000..80812e2aa --- /dev/null +++ b/src/Chamilo/TimelineBundle/Entity/Action.php @@ -0,0 +1,42 @@ + project. + * + * (c) + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Chamilo\TimelineBundle\Entity; + +use Sonata\TimelineBundle\Entity\Action as BaseAction; + +/** + * This file has been generated by the Sonata EasyExtends bundle. + * + * @see https://sonata-project.org/bundles/easy-extends + * + * References : + * working with object : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en + * + * @author + */ +class Action extends BaseAction +{ + /** + * @var int + */ + protected $id; + + /** + * Get id. + * + * @return int $id + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/TimelineBundle/Entity/ActionComponent.php b/src/Chamilo/TimelineBundle/Entity/ActionComponent.php new file mode 100644 index 000000000..c9b107dc0 --- /dev/null +++ b/src/Chamilo/TimelineBundle/Entity/ActionComponent.php @@ -0,0 +1,42 @@ + project. + * + * (c) + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Chamilo\TimelineBundle\Entity; + +use Sonata\TimelineBundle\Entity\ActionComponent as BaseActionComponent; + +/** + * This file has been generated by the Sonata EasyExtends bundle. + * + * @see https://sonata-project.org/bundles/easy-extends + * + * References : + * working with object : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en + * + * @author + */ +class ActionComponent extends BaseActionComponent +{ + /** + * @var int + */ + protected $id; + + /** + * Get id. + * + * @return int $id + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/TimelineBundle/Entity/Component.php b/src/Chamilo/TimelineBundle/Entity/Component.php new file mode 100644 index 000000000..addd9d729 --- /dev/null +++ b/src/Chamilo/TimelineBundle/Entity/Component.php @@ -0,0 +1,42 @@ + project. + * + * (c) + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Chamilo\TimelineBundle\Entity; + +use Sonata\TimelineBundle\Entity\Component as BaseComponent; + +/** + * This file has been generated by the Sonata EasyExtends bundle. + * + * @see https://sonata-project.org/bundles/easy-extends + * + * References : + * working with object : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en + * + * @author + */ +class Component extends BaseComponent +{ + /** + * @var int + */ + protected $id; + + /** + * Get id. + * + * @return int $id + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/TimelineBundle/Entity/Timeline.php b/src/Chamilo/TimelineBundle/Entity/Timeline.php new file mode 100644 index 000000000..be9221c5f --- /dev/null +++ b/src/Chamilo/TimelineBundle/Entity/Timeline.php @@ -0,0 +1,42 @@ + project. + * + * (c) + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Chamilo\TimelineBundle\Entity; + +use Sonata\TimelineBundle\Entity\Timeline as BaseTimeline; + +/** + * This file has been generated by the Sonata EasyExtends bundle. + * + * @see https://sonata-project.org/bundles/easy-extends + * + * References : + * working with object : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en + * + * @author + */ +class Timeline extends BaseTimeline +{ + /** + * @var int + */ + protected $id; + + /** + * Get id. + * + * @return int $id + */ + public function getId() + { + return $this->id; + } +} diff --git a/src/Chamilo/TimelineBundle/Resources/config/doctrine/Action.orm.xml b/src/Chamilo/TimelineBundle/Resources/config/doctrine/Action.orm.xml new file mode 100644 index 000000000..0f0131275 --- /dev/null +++ b/src/Chamilo/TimelineBundle/Resources/config/doctrine/Action.orm.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/Chamilo/TimelineBundle/Resources/config/doctrine/ActionComponent.orm.xml b/src/Chamilo/TimelineBundle/Resources/config/doctrine/ActionComponent.orm.xml new file mode 100644 index 000000000..83b037433 --- /dev/null +++ b/src/Chamilo/TimelineBundle/Resources/config/doctrine/ActionComponent.orm.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/Chamilo/TimelineBundle/Resources/config/doctrine/Component.orm.xml b/src/Chamilo/TimelineBundle/Resources/config/doctrine/Component.orm.xml new file mode 100644 index 000000000..6fc621554 --- /dev/null +++ b/src/Chamilo/TimelineBundle/Resources/config/doctrine/Component.orm.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/Chamilo/TimelineBundle/Resources/config/doctrine/Timeline.orm.xml b/src/Chamilo/TimelineBundle/Resources/config/doctrine/Timeline.orm.xml new file mode 100644 index 000000000..7df15977c --- /dev/null +++ b/src/Chamilo/TimelineBundle/Resources/config/doctrine/Timeline.orm.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/Chamilo/TimelineBundle/Resources/config/serializer/Entity.Action.xml b/src/Chamilo/TimelineBundle/Resources/config/serializer/Entity.Action.xml new file mode 100644 index 000000000..7702ffa55 --- /dev/null +++ b/src/Chamilo/TimelineBundle/Resources/config/serializer/Entity.Action.xml @@ -0,0 +1,14 @@ + + + + + + + + + + diff --git a/src/Chamilo/TimelineBundle/Resources/config/serializer/Entity.ActionComponent.xml b/src/Chamilo/TimelineBundle/Resources/config/serializer/Entity.ActionComponent.xml new file mode 100644 index 000000000..001a4b175 --- /dev/null +++ b/src/Chamilo/TimelineBundle/Resources/config/serializer/Entity.ActionComponent.xml @@ -0,0 +1,14 @@ + + + + + + + + + + diff --git a/src/Chamilo/TimelineBundle/Resources/config/serializer/Entity.Component.xml b/src/Chamilo/TimelineBundle/Resources/config/serializer/Entity.Component.xml new file mode 100644 index 000000000..9d9100831 --- /dev/null +++ b/src/Chamilo/TimelineBundle/Resources/config/serializer/Entity.Component.xml @@ -0,0 +1,14 @@ + + + + + + + + + + diff --git a/src/Chamilo/TimelineBundle/Resources/config/serializer/Entity.Timeline.xml b/src/Chamilo/TimelineBundle/Resources/config/serializer/Entity.Timeline.xml new file mode 100644 index 000000000..fa803730f --- /dev/null +++ b/src/Chamilo/TimelineBundle/Resources/config/serializer/Entity.Timeline.xml @@ -0,0 +1,14 @@ + + + + + + + + + + diff --git a/src/Chamilo/TimelineBundle/Resources/views/Block/timeline.html.twig b/src/Chamilo/TimelineBundle/Resources/views/Block/timeline.html.twig new file mode 100644 index 000000000..9f84c69ad --- /dev/null +++ b/src/Chamilo/TimelineBundle/Resources/views/Block/timeline.html.twig @@ -0,0 +1,62 @@ +{% extends sonata_block.templates.block_base %} + +{% block block %} +
    + {% if settings.title is not empty %} +
    +

    + {{ settings.title }} +

    +
    + {% endif %} + +
    +
    +
    +
      + {% for entry in entries %} + + {% if currentDay is not defined or currentDay != entry.createdAt|format_date %} + {% set currentDay = entry.createdAt|format_date %} +
    • + {{ currentDay }} +
    • + {% endif %} + + {% set subject = entry.getComponent('subject') %} + {% set target = entry.getComponent('target') %} + {% set target_text_component = entry.getComponent('target_text') %} + + {% if subject.data %} + {% set subject_text = sonata_timeline_generate_link(subject, entry) %} + {% else %} + {% set subject_text = '' ~ 'element_deleted'|trans({}, "SonataTimelineBundle") ~ '' %} + {% endif %} + + {% if target.data is defined and target.data is not empty %} + {% set target_text = sonata_timeline_generate_link(target, entry) %} + {% elseif target_text_component %} + {% set target_text = ''~target_text_component~'' %} + {% else %} + {% set target_text = '' ~ 'element_deleted'|trans({}, "SonataTimelineBundle") ~ '' %} + {% endif %} + + {% set verb = "actions."~entry.verb %} + {% set icon = "actions.icon."~entry.verb %} + +
    • + +
      + {{ entry.createdAt|format_time }} +
      {{ verb|trans({'%subject%': subject_text, '%target%': target_text}, "SonataTimelineBundle")|raw }}
      +
      +
    • + {% else %} + {{ 'no_action'|trans({}, "SonataTimelineBundle") }} + {% endfor %} +
    +
    +
    +
    +
    +{% endblock %} diff --git a/src/Chamilo/UserBundle/Admin/GroupAdmin.php b/src/Chamilo/UserBundle/Admin/GroupAdmin.php new file mode 100644 index 000000000..38e7175f5 --- /dev/null +++ b/src/Chamilo/UserBundle/Admin/GroupAdmin.php @@ -0,0 +1,21 @@ +addIdentifier('name') + ->add('code') + ->add('roles') + ; + } +} diff --git a/src/Chamilo/UserBundle/Admin/UserAdmin.php b/src/Chamilo/UserBundle/Admin/UserAdmin.php new file mode 100644 index 000000000..56121d378 --- /dev/null +++ b/src/Chamilo/UserBundle/Admin/UserAdmin.php @@ -0,0 +1,190 @@ +tab('User') + ->with('Profile', ['class' => 'col-md-6'])->end() + ->with('General', ['class' => 'col-md-6'])->end() + //->with('Social', array('class' => 'col-md-6'))->end() + ->end() + ->tab('Security') + ->with('Status', ['class' => 'col-md-4'])->end() + ->with('Groups', ['class' => 'col-md-4'])->end() + ->with('Keys', ['class' => 'col-md-4'])->end() + ->with('Roles', ['class' => 'col-md-12'])->end() + ->end() + ->tab('ExtraFields') + ->with('ExtraFields', ['class' => 'col-md-4'])->end() + ->end(); + + $now = new \DateTime(); + + $formMapper + ->tab('User') + ->with('General') + ->add('username') + ->add('email') + /*->add( + 'plainPassword', + 'text', + array( + 'required' => (!$this->getSubject() || is_null( + $this->getSubject()->getId() + )), + ) + )*/ + ->end() + ->with('Profile') + /*->add( + 'dateOfBirth', + 'sonata_type_date_picker', + array( + 'years' => range(1900, $now->format('Y')), + 'dp_min_date' => '1-1-1900', + 'dp_max_date' => $now->format('c'), + 'required' => false, + ) + )*/ + ->add('firstname', null, ['required' => false]) + ->add('lastname', null, ['required' => false]) + //->add('website', 'url', array('required' => false)) + //->add('biography', 'text', array('required' => false)) + /*->add( + 'gender', + 'sonata_user_gender', + array( + 'required' => true, + 'translation_domain' => $this->getTranslationDomain(), + ) + )*/ + //->add('locale', 'locale', array('required' => false)) + //->add('timezone', 'timezone', array('required' => false)) + //->add('phone', null, array('required' => false)) + ->end() + /*->with('Social') + ->add('facebookUid', null, array('required' => false)) + ->add('facebookName', null, array('required' => false)) + ->add('twitterUid', null, array('required' => false)) + ->add('twitterName', null, array('required' => false)) + ->add('gplusUid', null, array('required' => false)) + ->add('gplusName', null, array('required' => false)) + ->end()*/ + ->end(); + + if ($this->getSubject() && !$this->getSubject()->hasRole( + 'ROLE_SUPER_ADMIN' + ) + ) { + $formMapper + ->tab('Security') + ->with('Status') + ->add('locked', null, ['required' => false]) + ->add('expired', null, ['required' => false]) + ->add('enabled', null, ['required' => false]) + ->add('credentialsExpired', null, ['required' => false]) + ->end() + ->with('Groups') + ->add( + 'groups', + 'sonata_type_model', + [ + 'required' => false, + 'expanded' => true, + 'multiple' => true, + ] + ) + ->end() + ->with('Roles') + ->add( + 'realRoles', + 'sonata_security_roles', + [ + 'label' => 'form.label_roles', + 'expanded' => true, + 'multiple' => true, + 'required' => false, + ] + ) + ->end() + ->end(); + } + + /*$formMapper + ->tab('Security') + ->with('Keys') + ->add('token', null, array('required' => false)) + ->add('twoStepVerificationCode', null, array('required' => false)) + ->end() + ->end();*/ +// +// $formMapper +// ->tab('ExtraFields') +// ->with('ExtraFields') +// ->add( +// 'extraFields', +// 'sonata_type_collection', +// array( +// 'cascade_validation' => true, +// /*'type_options' => array( +// // Prevents the "Delete" option from being displayed +// 'delete' => false, +// 'delete_options' => array( +// // You may otherwise choose to put the field but hide it +// 'type' => 'hidden', +// // In that case, you need to fill in the options as well +// 'type_options' => array( +// 'mapped' => false, +// 'required' => false, +// ) +// ) +// )*/ +// ), +// array( +// 'allow_delete' => true, +// 'by_reference' => false, +// 'edit' => 'inline', +// 'inline' => 'table', +// 'admin_code' => 'sonata.admin.user_field_values' +// /* 'edit' => 'inline', +// 'inline' => 'table', +// 'sortable' => 'position',*/ +// ) +// ) +// ->end() +// ->end(); + } + + protected function configureDatagridFilters(DatagridMapper $datagridMapper) + { + $datagridMapper + ->add('username') + ->add('firstname') + ->add('lastname') + ->add('email') + ->add('officialCode') + ->add('groups') + ->add( + 'active' + )//->add('registrationDate', 'sonata_type_filter_datetime', array('input_type' => 'timestamp')) + ; + } +} diff --git a/src/Chamilo/UserBundle/Admin/UserField.php b/src/Chamilo/UserBundle/Admin/UserField.php new file mode 100644 index 000000000..dba03e593 --- /dev/null +++ b/src/Chamilo/UserBundle/Admin/UserField.php @@ -0,0 +1,55 @@ +add('field_type', 'text') + ->add('field_variable', 'text') + ->add('field_display_text', 'text') + ->add('field_default_value', 'text') + ->add('field_order', 'text') + ->add('field_visible', 'text') + ->add('field_changeable', 'text') + ->add('field_filter', 'text') + ->add('field_loggeable', 'text') + ->add('configuration'); + } + + protected function configureShowField(ShowMapper $showMapper) + { + $showMapper + ->add('id', 'text') + ->add('field_type', 'text') + ->add('field_variable', 'text'); + } + + protected function configureDatagridFilters(DatagridMapper $datagridMapper) + { + /*$datagridMapper + ->add('field_type') + ;*/ + } + + protected function configureListFields(ListMapper $listMapper) + { + $listMapper + ->addIdentifier('id') + ->add('field_variable', 'text') + ->add('field_type', 'text'); + } +} diff --git a/src/Chamilo/UserBundle/Admin/UserFieldValuesAdmin.php b/src/Chamilo/UserBundle/Admin/UserFieldValuesAdmin.php new file mode 100644 index 000000000..745b903cc --- /dev/null +++ b/src/Chamilo/UserBundle/Admin/UserFieldValuesAdmin.php @@ -0,0 +1,48 @@ +add('field') + ->add('user') + ->add('field_value', 'text') + ->add('comment', 'textarea') + ->add('author'); + } + + protected function configureShowField(ShowMapper $showMapper) + { + $showMapper + ->add('id', 'text'); + } + + protected function configureDatagridFilters(DatagridMapper $datagridMapper) + { + $datagridMapper + ->add('id') + ->add('field'); + } + + protected function configureListFields(ListMapper $listMapper) + { + $listMapper + ->addIdentifier('id') + ->addIdentifier('field') + ->addIdentifier('user'); + } +} diff --git a/src/Chamilo/UserBundle/ChamiloUserBundle.php b/src/Chamilo/UserBundle/ChamiloUserBundle.php new file mode 100644 index 000000000..79aa2014d --- /dev/null +++ b/src/Chamilo/UserBundle/ChamiloUserBundle.php @@ -0,0 +1,22 @@ +load('admin.yml'); + } +} diff --git a/src/Chamilo/UserBundle/Entity/Group.php b/src/Chamilo/UserBundle/Entity/Group.php new file mode 100644 index 000000000..21465e9fb --- /dev/null +++ b/src/Chamilo/UserBundle/Entity/Group.php @@ -0,0 +1,72 @@ +id; + } + + /** + * @return mixed + */ + public function getUsers() + { + return $this->users; + } + + /** + * @return string + */ + public function getCode() + { + return $this->code; + } + + /** + * @param string $code + * + * @return Group + */ + public function setCode($code) + { + $this->code = $code; + + return $this; + } +} diff --git a/src/Chamilo/UserBundle/Entity/Manager/UserManager.php b/src/Chamilo/UserBundle/Entity/Manager/UserManager.php new file mode 100644 index 000000000..c27620b2b --- /dev/null +++ b/src/Chamilo/UserBundle/Entity/Manager/UserManager.php @@ -0,0 +1,26 @@ +findUserBy(['confirmationToken' => $token]); + } +} diff --git a/src/Chamilo/UserBundle/Entity/User.php b/src/Chamilo/UserBundle/Entity/User.php new file mode 100644 index 000000000..f040d84fa --- /dev/null +++ b/src/Chamilo/UserBundle/Entity/User.php @@ -0,0 +1,2654 @@ +status = self::STUDENT; + $this->salt = sha1(uniqid(null, true)); + $this->active = true; + $this->registrationDate = new \DateTime(); + $this->authSource = 'platform'; + $this->courses = new ArrayCollection(); + //$this->items = new ArrayCollection(); + $this->classes = new ArrayCollection(); + $this->curriculumItems = new ArrayCollection(); + $this->portals = new ArrayCollection(); + $this->dropBoxSentFiles = new ArrayCollection(); + $this->dropBoxReceivedFiles = new ArrayCollection(); + //$this->extraFields = new ArrayCollection(); + //$this->userId = 0; + //$this->createdAt = new \DateTime(); + //$this->updatedAt = new \DateTime(); + + $this->enabled = false; + $this->locked = false; + $this->expired = false; + $this->roles = []; + $this->credentialsExpired = false; + } + + /** + * @return string + */ + public function __toString() + { + return $this->getUsername(); + } + + /** + * Updates the id with the user_id. + * + * @ORM\PostPersist() + */ + public function postPersist(LifecycleEventArgs $args) + { + //parent::postPersist(); + // Updates the user_id field + $user = $args->getEntity(); + $this->setUserId($user->getId()); + /*$em = $args->getEntityManager(); + $em->persist($user); + $em->flush();*/ + } + + /** + * @param int $userId + */ + public function setId($userId) + { + $this->id = $userId; + } + + /** + * @param int $userId + */ + public function setUserId($userId) + { + if (!empty($userId)) { + $this->userId = $userId; + } + } + + /** + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * @return string + */ + public function getEncoderName() + { + return 'legacy_encoder'; + } + + /** + * @return ArrayCollection + */ + public function getDropBoxSentFiles() + { + return $this->dropBoxSentFiles; + } + + /** + * @return ArrayCollection + */ + public function getDropBoxReceivedFiles() + { + return $this->dropBoxReceivedFiles; + } + + /** + * @param ArrayCollection $value + */ + public function setDropBoxSentFiles($value) + { + $this->dropBoxSentFiles = $value; + + return $this; + } + + /** + * @param ArrayCollection $value + */ + public function setDropBoxReceivedFiles($value) + { + $this->dropBoxReceivedFiles = $value; + + return $this; + } + + /** + * @param ArrayCollection $courses + */ + public function setCourses($courses) + { + $this->courses = $courses; + + return $this; + } + + /** + * @return ArrayCollection|CourseRelUser[] + */ + public function getCourses() + { + return $this->courses; + } + + /** + * @return array + */ + public static function getPasswordConstraints() + { + return + [ + new Assert\Length(['min' => 5]), + // Alpha numeric + "_" or "-" + new Assert\Regex( + [ + 'pattern' => '/^[a-z\-_0-9]+$/i', + 'htmlPattern' => '/^[a-z\-_0-9]+$/i', ] + ), + // Min 3 letters - not needed + /*new Assert\Regex(array( + 'pattern' => '/[a-z]{3}/i', + 'htmlPattern' => '/[a-z]{3}/i') + ),*/ + // Min 2 numbers + new Assert\Regex( + [ + 'pattern' => '/[0-9]{2}/', + 'htmlPattern' => '/[0-9]{2}/', ] + ), + ] + ; + } + + public static function loadValidatorMetadata(ClassMetadata $metadata) + { + //$metadata->addPropertyConstraint('firstname', new Assert\NotBlank()); + //$metadata->addPropertyConstraint('lastname', new Assert\NotBlank()); + //$metadata->addPropertyConstraint('email', new Assert\Email()); + /* + $metadata->addPropertyConstraint('password', + new Assert\Collection(self::getPasswordConstraints()) + );*/ + + /*$metadata->addConstraint(new UniqueEntity(array( + 'fields' => 'username', + 'message' => 'This value is already used.', + )));*/ + + /*$metadata->addPropertyConstraint( + 'username', + new Assert\Length(array( + 'min' => 2, + 'max' => 50, + 'minMessage' => 'This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more.', + 'maxMessage' => 'This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less.', + )) + );*/ + } + + /** + * {@inheritdoc} + */ + public function isEqualTo(UserInterface $user) + { + if (!$user instanceof User) { + return false; + } + + /*if ($this->password !== $user->getPassword()) { + return false; + }*/ + + /*if ($this->getSalt() !== $user->getSalt()) { + return false; + }*/ + + /*if ($this->username !== $user->getUsername()) { + return false; + }*/ + + return true; + } + + /** + * @return ArrayCollection + */ + public function getPortals() + { + return $this->portals; + } + + /** + * @param $portal + */ + public function setPortal($portal) + { + $this->portals->add($portal); + } + + /** + * @param $value + */ + public function setPortals($value) + { + $this->portals = $value; + + return $this; + } + + /** + * @return ArrayCollection + */ + public function getCurriculumItems() + { + return $this->curriculumItems; + } + + /** + * @param $items + * + * @return $this + */ + public function setCurriculumItems($items) + { + $this->curriculumItems = $items; + + return $this; + } + + /** + * @return bool + */ + public function getIsActive() + { + return $this->active == 1; + } + + /** + * @return bool + */ + public function isActive() + { + return $this->getIsActive(); + } + + /** + * {@inheritdoc} + */ + public function isEnabled() + { + return $this->getActive() == 1; + } + + /** + * @return ArrayCollection + */ + /*public function getRolesObj() + { + return $this->roles; + }*/ + + /** + * Set salt. + * + * @param string $salt + * + * @return User + */ + public function setSalt($salt) + { + $this->salt = $salt; + + return $this; + } + + /** + * Get salt. + * + * @return string + */ + public function getSalt() + { + return $this->salt; + } + + /** + * @param ArrayCollection $classes + * + * @return $this + */ + public function setClasses($classes) + { + $this->classes = $classes; + + return $this; + } + + /** + * @return ArrayCollection|UsergroupRelUser[] + */ + public function getClasses() + { + return $this->classes; + } + + public function getLps() + { + //return $this->lps; + /*$criteria = Criteria::create() + ->where(Criteria::expr()->eq("id", "666")) + //->orderBy(array("username" => "ASC")) + //->setFirstResult(0) + //->setMaxResults(20) + ; + $lps = $this->lps->matching($criteria);*/ + /*return $this->lps->filter( + function($entry) use ($idsToFilter) { + return $entry->getId() == 1; + });*/ + } + + /** + * Return Complete Name with the Username. + * + * @return string + */ + public function getCompleteNameWithUsername() + { + if (api_get_configuration_value('hide_username_with_complete_name')) { + return $this->getCompleteName(); + } + + return api_get_person_name($this->firstname, $this->lastname).' ('.$this->username.')'; + } + + /** + * @todo don't use api_get_person_name + * + * @return string + */ + public function getCompleteName() + { + return api_get_person_name($this->firstname, $this->lastname); + } + + /** + * Returns the list of classes for the user. + * + * @return string + */ + public function getCompleteNameWithClasses() + { + $classSubscription = $this->getClasses(); + $classList = []; + /** @var UsergroupRelUser $subscription */ + foreach ($classSubscription as $subscription) { + $class = $subscription->getUsergroup(); + $classList[] = $class->getName(); + } + $classString = !empty($classList) ? ' ['.implode(', ', $classList).']' : null; + + return $this->getCompleteName().$classString; + } + + /** + * Get userId. + * + * @return int + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set lastname. + * + * @param string $lastname + * + * @return User + */ + public function setLastname($lastname) + { + $this->lastname = $lastname; + + return $this; + } + + /** + * Set firstname. + * + * @param string $firstname + * + * @return User + */ + public function setFirstname($firstname) + { + $this->firstname = $firstname; + + return $this; + } + + /** + * Set password. + * + * @param string $password + * + * @return User + */ + public function setPassword($password) + { + $this->password = $password; + + return $this; + } + + /** + * Get password. + * + * @return string + */ + public function getPassword() + { + return $this->password; + } + + /** + * Set authSource. + * + * @param string $authSource + * + * @return User + */ + public function setAuthSource($authSource) + { + $this->authSource = $authSource; + + return $this; + } + + /** + * Get authSource. + * + * @return string + */ + public function getAuthSource() + { + return $this->authSource; + } + + /** + * Set email. + * + * @param string $email + * + * @return User + */ + public function setEmail($email) + { + $this->email = $email; + + return $this; + } + + /** + * Get email. + * + * @return string + */ + public function getEmail() + { + return $this->email; + } + + /** + * Set status. + * + * @param int $status + * + * @return User + */ + public function setStatus($status) + { + $this->status = $status; + + return $this; + } + + /** + * Get status. + * + * @return int + */ + public function getStatus() + { + return $this->status; + } + + /** + * Set officialCode. + * + * @param string $officialCode + * + * @return User + */ + public function setOfficialCode($officialCode) + { + $this->officialCode = $officialCode; + + return $this; + } + + /** + * Get officialCode. + * + * @return string + */ + public function getOfficialCode() + { + return $this->officialCode; + } + + /** + * Set phone. + * + * @param string $phone + * + * @return User + */ + public function setPhone($phone) + { + $this->phone = $phone; + + return $this; + } + + /** + * Get phone. + * + * @return string + */ + public function getPhone() + { + return $this->phone; + } + + /** + * Set address. + * + * @param string $address + * + * @return User + */ + public function setAddress($address) + { + $this->address = $address; + + return $this; + } + + /** + * Get address. + * + * @return string + */ + public function getAddress() + { + return $this->address; + } + + /** + * Set pictureUri. + * + * @param string $pictureUri + * + * @return User + */ + public function setPictureUri($pictureUri) + { + $this->pictureUri = $pictureUri; + + return $this; + } + + /** + * Get pictureUri. + * + * @return Media + */ + public function getPictureUri() + { + return $this->pictureUri; + } + + /** + * Set creatorId. + * + * @param int $creatorId + * + * @return User + */ + public function setCreatorId($creatorId) + { + $this->creatorId = $creatorId; + + return $this; + } + + /** + * Get creatorId. + * + * @return int + */ + public function getCreatorId() + { + return $this->creatorId; + } + + /** + * Set competences. + * + * @param string $competences + * + * @return User + */ + public function setCompetences($competences) + { + $this->competences = $competences; + + return $this; + } + + /** + * Get competences. + * + * @return string + */ + public function getCompetences() + { + return $this->competences; + } + + /** + * Set diplomas. + * + * @param string $diplomas + * + * @return User + */ + public function setDiplomas($diplomas) + { + $this->diplomas = $diplomas; + + return $this; + } + + /** + * Get diplomas. + * + * @return string + */ + public function getDiplomas() + { + return $this->diplomas; + } + + /** + * Set openarea. + * + * @param string $openarea + * + * @return User + */ + public function setOpenarea($openarea) + { + $this->openarea = $openarea; + + return $this; + } + + /** + * Get openarea. + * + * @return string + */ + public function getOpenarea() + { + return $this->openarea; + } + + /** + * Set teach. + * + * @param string $teach + * + * @return User + */ + public function setTeach($teach) + { + $this->teach = $teach; + + return $this; + } + + /** + * Get teach. + * + * @return string + */ + public function getTeach() + { + return $this->teach; + } + + /** + * Set productions. + * + * @param string $productions + * + * @return User + */ + public function setProductions($productions) + { + $this->productions = $productions; + + return $this; + } + + /** + * Get productions. + * + * @return string + */ + public function getProductions() + { + return $this->productions; + } + + /** + * Set language. + * + * @param string $language + * + * @return User + */ + public function setLanguage($language) + { + $this->language = $language; + + return $this; + } + + /** + * Get language. + * + * @return string + */ + public function getLanguage() + { + return $this->language; + } + + /** + * Set registrationDate. + * + * @param \DateTime $registrationDate + * + * @return User + */ + public function setRegistrationDate($registrationDate) + { + $this->registrationDate = $registrationDate; + + return $this; + } + + /** + * Get registrationDate. + * + * @return \DateTime + */ + public function getRegistrationDate() + { + return $this->registrationDate; + } + + /** + * Set expirationDate. + * + * @param \DateTime $expirationDate + * + * @return User + */ + public function setExpirationDate($expirationDate) + { + $this->expirationDate = $expirationDate; + + return $this; + } + + /** + * Get expirationDate. + * + * @return \DateTime + */ + public function getExpirationDate() + { + return $this->expirationDate; + } + + /** + * Set active. + * + * @param bool $active + * + * @return User + */ + public function setActive($active) + { + $this->active = $active; + + return $this; + } + + /** + * Get active. + * + * @return bool + */ + public function getActive() + { + return $this->active; + } + + /** + * Set openid. + * + * @param string $openid + * + * @return User + */ + public function setOpenid($openid) + { + $this->openid = $openid; + + return $this; + } + + /** + * Get openid. + * + * @return string + */ + public function getOpenid() + { + return $this->openid; + } + + /** + * Set theme. + * + * @param string $theme + * + * @return User + */ + public function setTheme($theme) + { + $this->theme = $theme; + + return $this; + } + + /** + * Get theme. + * + * @return string + */ + public function getTheme() + { + return $this->theme; + } + + /** + * Set hrDeptId. + * + * @param int $hrDeptId + * + * @return User + */ + public function setHrDeptId($hrDeptId) + { + $this->hrDeptId = $hrDeptId; + + return $this; + } + + /** + * Get hrDeptId. + * + * @return int + */ + public function getHrDeptId() + { + return $this->hrDeptId; + } + + /** + * @return Media + */ + public function getAvatar() + { + return $this->getPictureUri(); + } + + /** + * @return \DateTime + */ + public function getMemberSince() + { + return $this->registrationDate; + } + + /** + * @return bool + */ + public function isOnline() + { + return false; + } + + /** + * @return int + */ + public function getIdentifier() + { + return $this->getId(); + } + + /** + * If manually uploading a file (i.e. not using Symfony Form) ensure an instance + * of 'UploadedFile' is injected into this setter to trigger the update. If this + * bundle's configuration parameter 'inject_on_load' is set to 'true' this setter + * must be able to accept an instance of 'File' as the bundle will inject one here + * during Doctrine hydration. + * + * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile $image + */ + public function setImageFile(File $image) + { + $this->imageFile = $image; + + if ($image) { + // It is required that at least one field changes if you are using doctrine + // otherwise the event listeners won't be called and the file is lost + $this->updatedAt = new \DateTime('now'); + } + } + + /** + * @return File + */ + public function getImageFile() + { + return $this->imageFile; + } + + /** + * @return string + */ + public function getSlug() + { + return $this->getUsername(); + } + + /** + * @param $slug + * + * @return User + */ + public function setSlug($slug) + { + return $this->setUsername($slug); + } + + /** + * Set lastLogin. + * + * @return User + */ + public function setLastLogin(\DateTime $lastLogin = null) + { + $this->lastLogin = $lastLogin; + + return $this; + } + + /** + * Get lastLogin. + * + * @return \DateTime + */ + public function getLastLogin() + { + // If not last_login has been registered in the user table + // (for users without login after version 1.10), get the last login + // from the track_e_login table + /*if (empty($this->lastLogin)) { + return $this->getExtendedLastLogin(); + }*/ + + return $this->lastLogin; + } + + /** + * {@inheritdoc} + */ + public function getExtraFields() + { + return $this->extraFields; + } + + /** + * {@inheritdoc} + */ + public function setExtraFieldList($extraFields) + { + $this->extraFields = new ArrayCollection(); + foreach ($extraFields as $extraField) { + $this->addExtraFields($extraField); + } + + return $this; + } + + public function setExtraFields($extraFields) + { + $this->extraFields = $extraFields; + + return $this; + } + + /** + * {@inheritdoc} + */ + /*public function addExtraFields(ExtraFieldValues $extraFieldValue) + { + $extraFieldValue->setUser($this); + $this->extraFields[] = $extraFieldValue; + + return $this; + }*/ + + /** + * {@inheritdoc} + */ + public function addExtraFields(ExtraFieldValues $extraFieldValue) + { + //if (!$this->hasExtraField($attribute)) { + $extraFieldValue->setUser($this); + $this->extraFields[] = $extraFieldValue; + //} + + return $this; + } + + /** + * {@inheritdoc} + */ + public function removeExtraField(ExtraFieldValues $attribute) + { + //if ($this->hasExtraField($attribute)) { + //$this->extraFields->removeElement($attribute); + //$attribute->setUser($this); + //} + + return $this; + } + + /** + * {@inheritdoc} + */ + /*public function hasExtraField($attribute) + { + if (!$this->extraFields) { + return false; + } + return $this->extraFields->contains($attribute); + }*/ + + /** + * {@inheritdoc} + */ + public function hasExtraFieldByName($attributeName) + { + foreach ($this->extraFields as $attribute) { + if ($attribute->getName() === $attributeName) { + return true; + } + } + + return false; + } + + /** + * {@inheritdoc} + */ + public function getExtraFieldByName($attributeName) + { + foreach ($this->extraFields as $attribute) { + if ($attribute->getName() === $attributeName) { + return $attribute; + } + } + + return null; + } + + /** + * Get sessionCourseSubscription. + * + * @return ArrayCollection|SessionRelCourseRelUser[] + */ + public function getSessionCourseSubscriptions() + { + return $this->sessionCourseSubscriptions; + } + + public function setSessionCourseSubscriptions($value) + { + $this->sessionCourseSubscriptions = $value; + + return $this; + } + + /** + * @return string + */ + public function getConfirmationToken() + { + return $this->confirmationToken; + } + + /** + * @param string $confirmationToken + * + * @return User + */ + public function setConfirmationToken($confirmationToken) + { + $this->confirmationToken = $confirmationToken; + + return $this; + } + + /** + * @return \DateTime + */ + public function getPasswordRequestedAt() + { + return $this->passwordRequestedAt; + } + + /** + * @param int $ttl + * + * @return bool + */ + public function isPasswordRequestNonExpired($ttl) + { + return $this->getPasswordRequestedAt() instanceof \DateTime && + $this->getPasswordRequestedAt()->getTimestamp() + $ttl > time(); + } + + public function getUsername() + { + return $this->username; + } + + /** + * Returns the creation date. + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + * Sets the last update date. + * + * @return User + */ + public function setUpdatedAt(\DateTime $updatedAt = null) + { + $this->updatedAt = $updatedAt; + + return $this; + } + + /** + * Returns the last update date. + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->updatedAt; + } + + /** + * Returns the expiration date. + * + * @return \DateTime|null + */ + public function getExpiresAt() + { + return $this->expiresAt; + } + + /** + * Returns the credentials expiration date. + * + * @return \DateTime + */ + public function getCredentialsExpireAt() + { + return $this->credentialsExpireAt; + } + + /** + * Sets the credentials expiration date. + * + * @return User + */ + public function setCredentialsExpireAt(\DateTime $date = null) + { + $this->credentialsExpireAt = $date; + + return $this; + } + + /** + * Sets the user groups. + * + * @param array $groups + * + * @return User + */ + public function setGroups($groups) + { + foreach ($groups as $group) { + $this->addGroup($group); + } + + return $this; + } + + /** + * Sets the two-step verification code. + * + * @param string $twoStepVerificationCode + * + * @return User + */ + public function setTwoStepVerificationCode($twoStepVerificationCode) + { + $this->twoStepVerificationCode = $twoStepVerificationCode; + + return $this; + } + + /** + * Returns the two-step verification code. + * + * @return string + */ + public function getTwoStepVerificationCode() + { + return $this->twoStepVerificationCode; + } + + /** + * @param string $biography + * + * @return User + */ + public function setBiography($biography) + { + $this->biography = $biography; + + return $this; + } + + /** + * @return string + */ + public function getBiography() + { + return $this->biography; + } + + /** + * @param \DateTime $dateOfBirth + * + * @return User + */ + public function setDateOfBirth($dateOfBirth) + { + $this->dateOfBirth = $dateOfBirth; + + return $this; + } + + /** + * @return \DateTime + */ + public function getDateOfBirth() + { + return $this->dateOfBirth; + } + + /** + * @param string $facebookData + * + * @return User + */ + public function setFacebookData($facebookData) + { + $this->facebookData = $facebookData; + + return $this; + } + + /** + * @return string + */ + public function getFacebookData() + { + return $this->facebookData; + } + + /** + * @param string $facebookName + * + * @return User + */ + public function setFacebookName($facebookName) + { + $this->facebookName = $facebookName; + + return $this; + } + + /** + * @return string + */ + public function getFacebookName() + { + return $this->facebookName; + } + + /** + * @param string $facebookUid + * + * @return User + */ + public function setFacebookUid($facebookUid) + { + $this->facebookUid = $facebookUid; + + return $this; + } + + /** + * @return string + */ + public function getFacebookUid() + { + return $this->facebookUid; + } + + /** + * @return string + */ + public function getFirstname() + { + return $this->firstname; + } + + /** + * @param string $gender + * + * @return User + */ + public function setGender($gender) + { + $this->gender = $gender; + + return $this; + } + + /** + * @return string + */ + public function getGender() + { + return $this->gender; + } + + /** + * @param string $gplusData + * + * @return User + */ + public function setGplusData($gplusData) + { + $this->gplusData = $gplusData; + + return $this; + } + + /** + * @return string + */ + public function getGplusData() + { + return $this->gplusData; + } + + /** + * @param string $gplusName + * + * @return User + */ + public function setGplusName($gplusName) + { + $this->gplusName = $gplusName; + + return $this; + } + + /** + * @return string + */ + public function getGplusName() + { + return $this->gplusName; + } + + /** + * @param string $gplusUid + * + * @return User + */ + public function setGplusUid($gplusUid) + { + $this->gplusUid = $gplusUid; + + return $this; + } + + /** + * @return string + */ + public function getGplusUid() + { + return $this->gplusUid; + } + + /** + * @return string + */ + public function getLastname() + { + return $this->lastname; + } + + /** + * @param string $locale + * + * @return User + */ + public function setLocale($locale) + { + $this->locale = $locale; + + return $this; + } + + /** + * @return string + */ + public function getLocale() + { + return $this->locale; + } + + /** + * @param string $timezone + * + * @return User + */ + public function setTimezone($timezone) + { + $this->timezone = $timezone; + + return $this; + } + + /** + * @return string + */ + public function getTimezone() + { + return $this->timezone; + } + + /** + * @param string $twitterData + * + * @return User + */ + public function setTwitterData($twitterData) + { + $this->twitterData = $twitterData; + + return $this; + } + + /** + * @return string + */ + public function getTwitterData() + { + return $this->twitterData; + } + + /** + * @param string $twitterName + * + * @return User + */ + public function setTwitterName($twitterName) + { + $this->twitterName = $twitterName; + + return $this; + } + + /** + * @return string + */ + public function getTwitterName() + { + return $this->twitterName; + } + + /** + * @param string $twitterUid + * + * @return User + */ + public function setTwitterUid($twitterUid) + { + $this->twitterUid = $twitterUid; + + return $this; + } + + /** + * @return string + */ + public function getTwitterUid() + { + return $this->twitterUid; + } + + /** + * @param string $website + * + * @return User + */ + public function setWebsite($website) + { + $this->website = $website; + + return $this; + } + + /** + * @return string + */ + public function getWebsite() + { + return $this->website; + } + + /** + * @param string $token + * + * @return User + */ + public function setToken($token) + { + $this->token = $token; + + return $this; + } + + /** + * @return string + */ + public function getToken() + { + return $this->token; + } + + /** + * @return string + */ + public function getFullname() + { + return sprintf('%s %s', $this->getFirstname(), $this->getLastname()); + } + + /** + * @return array + */ + public function getRealRoles() + { + return $this->roles; + } + + /** + * @return User + */ + public function setRealRoles(array $roles) + { + $this->setRoles($roles); + + return $this; + } + + /** + * Removes sensitive data from the user. + */ + public function eraseCredentials() + { + $this->plainPassword = null; + } + + /** + * @return string + */ + public function getUsernameCanonical() + { + return $this->usernameCanonical; + } + + /** + * @return string + */ + public function getEmailCanonical() + { + return $this->emailCanonical; + } + + /** + * @return mixed + */ + public function getPlainPassword() + { + if (isset($this->plainPassword)) { + return $this->plainPassword; + } + } + + /** + * Returns the user roles. + * + * @return array The roles + */ + public function getRoles() + { + $roles = $this->roles; + + foreach ($this->getGroups() as $group) { + $roles = array_merge($roles, $group->getRoles()); + } + + // we need to make sure to have at least one role + $roles[] = static::ROLE_DEFAULT; + + return array_unique($roles); + } + + /** + * Never use this to check if this user has access to anything! + * + * Use the SecurityContext, or an implementation of AccessDecisionManager + * instead, e.g. + * + * $securityContext->isGranted('ROLE_USER'); + * + * @param string $role + * + * @return bool + */ + public function hasRole($role) + { + return in_array(strtoupper($role), $this->getRoles(), true); + } + + public function isAccountNonExpired() + { + if (true === $this->expired) { + return false; + } + + if (null !== $this->expiresAt && $this->expiresAt->getTimestamp() < time()) { + return false; + } + + return true; + } + + public function isAccountNonLocked() + { + return !$this->locked; + } + + public function isCredentialsNonExpired() + { + if (true === $this->credentialsExpired) { + return false; + } + + if (null !== $this->credentialsExpireAt && $this->credentialsExpireAt->getTimestamp() < time()) { + return false; + } + + return true; + } + + public function isCredentialsExpired() + { + return !$this->isCredentialsNonExpired(); + } + + public function isExpired() + { + return !$this->isAccountNonExpired(); + } + + public function isLocked() + { + return !$this->isAccountNonLocked(); + } + + public function isSuperAdmin() + { + return $this->hasRole(static::ROLE_SUPER_ADMIN); + } + + public function isUser(UserInterface $user = null) + { + return null !== $user && $this->getId() === $user->getId(); + } + + public function removeRole($role) + { + if (false !== $key = array_search(strtoupper($role), $this->roles, true)) { + unset($this->roles[$key]); + $this->roles = array_values($this->roles); + } + + return $this; + } + + public function setUsername($username) + { + $this->username = $username; + + return $this; + } + + public function setUsernameCanonical($usernameCanonical) + { + $this->usernameCanonical = $usernameCanonical; + + return $this; + } + + /** + * @param bool $boolean + * + * @return User + */ + public function setCredentialsExpired($boolean) + { + $this->credentialsExpired = $boolean; + + return $this; + } + + public function setEmailCanonical($emailCanonical) + { + $this->emailCanonical = $emailCanonical; + + return $this; + } + + public function setEnabled($boolean) + { + $this->enabled = (bool) $boolean; + + return $this; + } + + /** + * Sets this user to expired. + * + * @param bool $boolean + * + * @return User + */ + public function setExpired($boolean) + { + $this->expired = (bool) $boolean; + + return $this; + } + + /** + * @return User + */ + public function setExpiresAt(\DateTime $date) + { + $this->expiresAt = $date; + + return $this; + } + + /** + * @param bool $boolean + * + * @return $this|UserInterface + */ + public function setSuperAdmin($boolean) + { + if (true === $boolean) { + $this->addRole(static::ROLE_SUPER_ADMIN); + } else { + $this->removeRole(static::ROLE_SUPER_ADMIN); + } + + return $this; + } + + public function setPlainPassword($password) + { + $this->plainPassword = $password; + + return $this; + } + + public function getLocked() + { + return $this->locked; + } + + public function setLocked($boolean) + { + $this->locked = $boolean; + + return $this; + } + + public function setPasswordRequestedAt(\DateTime $date = null) + { + $this->passwordRequestedAt = $date; + + return $this; + } + + public function setRoles(array $roles) + { + $this->roles = []; + + foreach ($roles as $role) { + $this->addRole($role); + } + + return $this; + } + + /** + * Gets the groups granted to the user. + * + * @return Collection + */ + public function getGroups() + { + return $this->groups ?: $this->groups = new ArrayCollection(); + } + + /** + * @return array + */ + public function getGroupNames() + { + $names = []; + foreach ($this->getGroups() as $group) { + $names[] = $group->getName(); + } + + return $names; + } + + /** + * @param string $name + * + * @return bool + */ + public function hasGroup($name) + { + return in_array($name, $this->getGroupNames()); + } + + /** + * @return $this + */ + public function addGroup(GroupInterface $group) + { + if (!$this->getGroups()->contains($group)) { + $this->getGroups()->add($group); + } + + return $this; + } + + public function removeGroup(GroupInterface $group) + { + if ($this->getGroups()->contains($group)) { + $this->getGroups()->removeElement($group); + } + + return $this; + } + + /** + * @param string $role + * + * @return $this|UserInterface + */ + public function addRole($role) + { + $role = strtoupper($role); + if ($role === static::ROLE_DEFAULT) { + return $this; + } + + if (!in_array($role, $this->roles, true)) { + $this->roles[] = $role; + } + + return $this; + } + + /** + * Serializes the user. + * + * The serialized data have to contain the fields used by the equals method and the username. + * + * @return string + */ + public function serialize() + { + return serialize([ + $this->password, + $this->salt, + $this->usernameCanonical, + $this->username, + $this->expired, + $this->locked, + $this->credentialsExpired, + $this->enabled, + $this->id, + ]); + } + + /** + * Unserializes the user. + * + * @param string $serialized + */ + public function unserialize($serialized) + { + $data = unserialize($serialized); + // add a few extra elements in the array to ensure that we have enough keys when unserializing + // older data which does not include all properties. + $data = array_merge($data, array_fill(0, 2, null)); + + list( + $this->password, + $this->salt, + $this->usernameCanonical, + $this->username, + $this->expired, + $this->locked, + $this->credentialsExpired, + $this->enabled, + $this->id + ) = $data; + } + + /** + * Get achievedSkills. + * + * @return ArrayCollection + */ + public function getAchievedSkills() + { + return $this->achievedSkills; + } + + /** + * @param $value + * + * @return $this + */ + public function setAchievedSkills($value) + { + $this->achievedSkills = $value; + + return $this; + } + + /** + * Check if the user has the skill. + * + * @param Skill $skill The skill + * + * @return bool + */ + public function hasSkill(Skill $skill) + { + $achievedSkills = $this->getAchievedSkills(); + + foreach ($achievedSkills as $userSkill) { + if ($userSkill->getSkill()->getId() !== $skill->getId()) { + continue; + } + + return true; + } + } + + /** + * @return bool + */ + public function isProfileCompleted() + { + return $this->profileCompleted; + } + + /** + * @param mixed $profileCompleted + * + * @return User + */ + public function setProfileCompleted($profileCompleted) + { + $this->profileCompleted = $profileCompleted; + + return $this; + } + + /** + * Get sessionAsGeneralCoach. + * + * @return ArrayCollection + */ + public function getSessionAsGeneralCoach() + { + return $this->sessionAsGeneralCoach; + } + + /** + * Get sessionAsGeneralCoach. + * + * @param ArrayCollection $value + * + * @return $this + */ + public function setSessionAsGeneralCoach($value) + { + $this->sessionAsGeneralCoach = $value; + + return $this; + } + + /** + * @return mixed + */ + public function getCommentedUserSkills() + { + return $this->commentedUserSkills; + } + + /** + * @param mixed $commentedUserSkills + * + * @return User + */ + public function setCommentedUserSkills($commentedUserSkills) + { + $this->commentedUserSkills = $commentedUserSkills; + + return $this; + } + + /** + * @return string + */ + public function getPictureLegacy() + { + $id = $this->id; + + return 'users/'.substr((string) $id, 0, 1).'/'.$id.'/'.'small_'.$this->getPictureUri(); + } + + /** + * Retreives this user's related sessions. + * + * @param int $relationType \Chamilo\CoreBundle\Entity\SessionRelUser::relationTypeList key + * + * @return \Chamilo\CoreBundle\Entity\Session[] + */ + public function getSessions($relationType) + { + $sessions = []; + foreach (\Database::getManager()->getRepository('ChamiloCoreBundle:SessionRelUser')->findBy([ + 'user' => $this, + ]) as $sessionRelUser) { + if ($sessionRelUser->getRelationType() == $relationType) { + $sessions[] = $sessionRelUser->getSession(); + } + } + + return $sessions; + } + + /** + * Retreives this user's related student sessions. + * + * @return \Chamilo\CoreBundle\Entity\Session[] + */ + public function getStudentSessions() + { + return $this->getSessions(0); + } + + /** + * Retreives this user's related DRH sessions. + * + * @return \Chamilo\CoreBundle\Entity\Session[] + */ + public function getDRHSessions() + { + return $this->getSessions(1); + } + + /** + * Retreives this user's related accessible sessions of a type, student by default. + * + * @param int $relationType \Chamilo\CoreBundle\Entity\SessionRelUser::relationTypeList key + * + * @return \Chamilo\CoreBundle\Entity\Session[] + */ + public function getCurrentlyAccessibleSessions($relationType = 0) + { + $sessions = []; + foreach ($this->getSessions($relationType) as $session) { + if ($session->isCurrentlyAccessible()) { + $sessions[] = $session; + } + } + + return $sessions; + } +} diff --git a/src/Chamilo/UserBundle/Repository/GroupRepository.php b/src/Chamilo/UserBundle/Repository/GroupRepository.php new file mode 100644 index 000000000..d11efbb52 --- /dev/null +++ b/src/Chamilo/UserBundle/Repository/GroupRepository.php @@ -0,0 +1,25 @@ + 'admins']; + $group = $this->findOneBy($criteria); + + return $group->getUsers(); + } +} diff --git a/src/Chamilo/UserBundle/Repository/UserRepository.php b/src/Chamilo/UserBundle/Repository/UserRepository.php new file mode 100644 index 000000000..dae382a02 --- /dev/null +++ b/src/Chamilo/UserBundle/Repository/UserRepository.php @@ -0,0 +1,1390 @@ +createQueryBuilder('a'); + + // Selecting user info + $qb->select('DISTINCT b'); + + $qb->from('Chamilo\UserBundle\Entity\User', 'b'); + + // Selecting courses for users + //$qb->innerJoin('u.courses', 'c'); + + //@todo check app settings + $qb->add('orderBy', 'b.firstname ASC'); + $qb->where('b.firstname LIKE :keyword OR b.lastname LIKE :keyword '); + $qb->setParameter('keyword', "%$keyword%"); + $query = $qb->getQuery(); + + return $query->execute(); + } + + /** + * @param string $role + * + * @return array + */ + public function findByRole($role) + { + $em = $this->getEntityManager(); + $qb = $em->createQueryBuilder(); + + $qb->select('u') + ->from($this->_entityName, 'u') + ->where('u.roles LIKE :roles') + ->setParameter('roles', '%"'.$role.'"%'); + + return $qb->getQuery()->getResult(); + } + + /** + * Get course user relationship based in the course_rel_user table. + * + * @return array + */ + /*public function getCourses(User $user) + { + $queryBuilder = $this->createQueryBuilder('user'); + + // Selecting course info. + $queryBuilder->select('c'); + + // Loading User. + //$qb->from('Chamilo\UserBundle\Entity\User', 'u'); + + // Selecting course + $queryBuilder->innerJoin('Chamilo\CoreBundle\Entity\Course', 'c'); + + //@todo check app settings + //$qb->add('orderBy', 'u.lastname ASC'); + + $wherePart = $queryBuilder->expr()->andx(); + + // Get only users subscribed to this course + $wherePart->add($queryBuilder->expr()->eq('user.userId', $user->getUserId())); + + $queryBuilder->where($wherePart); + $query = $queryBuilder->getQuery(); + + return $query->execute(); + } + + public function getTeachers() + { + $queryBuilder = $this->createQueryBuilder('u'); + + // Selecting course info. + $queryBuilder + ->select('u') + ->where('u.groups.id = :groupId') + ->setParameter('groupId', 1); + + $query = $queryBuilder->getQuery(); + + return $query->execute(); + }*/ + + /*public function getUsers($group) + { + $queryBuilder = $this->createQueryBuilder('u'); + + // Selecting course info. + $queryBuilder + ->select('u') + ->where('u.groups = :groupId') + ->setParameter('groupId', $group); + + $query = $queryBuilder->getQuery(); + + return $query->execute(); + }*/ + + /** + * Get a filtered list of user by status and (optionally) access url. + * + * @param string $query The query to filter + * @param int $status The status + * @param int $accessUrlId The access URL ID + * + * @return array + */ + public function searchUsersByStatus($query, $status, $accessUrlId = 0) + { + $accessUrlId = (int) $accessUrlId; + $queryBuilder = $this->createQueryBuilder('u'); + + if ($accessUrlId > 0) { + $queryBuilder->innerJoin( + 'ChamiloCoreBundle:AccessUrlRelUser', + 'auru', + Join::WITH, + 'u.id = auru.userId' + ); + } + + $queryBuilder + ->where('u.status = :status') + ->andWhere('u.username LIKE :query OR u.firstname LIKE :query OR u.lastname LIKE :query') + ->setParameter('status', $status) + ->setParameter('query', "$query%"); + + if ($accessUrlId > 0) { + $queryBuilder + ->andWhere('auru.accessUrlId = :url') + ->setParameter(':url', $accessUrlId); + } + + return $queryBuilder->getQuery()->getResult(); + } + + /** + * Get the coaches for a course within a session. + * + * @param Session $session The session + * @param Course $course The course + * + * @return array + */ + public function getCoachesForSessionCourse(Session $session, Course $course) + { + $queryBuilder = $this->createQueryBuilder('u'); + + $queryBuilder + ->select('u') + ->innerJoin( + 'ChamiloCoreBundle:SessionRelCourseRelUser', + 'scu', + Join::WITH, + 'scu.user = u' + ) + ->where( + $queryBuilder->expr()->andX( + $queryBuilder->expr()->eq('scu.session', $session->getId()), + $queryBuilder->expr()->eq('scu.course', $course->getId()), + $queryBuilder->expr()->eq('scu.status', SessionRelCourseRelUser::STATUS_COURSE_COACH) + ) + ); + + return $queryBuilder->getQuery()->getResult(); + } + + /** + * Get course user relationship based in the course_rel_user table. + * + * @return array + */ + /*public function getCourses(User $user) + { + $queryBuilder = $this->createQueryBuilder('user'); + + // Selecting course info. + $queryBuilder->select('c'); + + // Loading User. + //$qb->from('Chamilo\UserBundle\Entity\User', 'u'); + + // Selecting course + $queryBuilder->innerJoin('Chamilo\CoreBundle\Entity\Course', 'c'); + + //@todo check app settings + //$qb->add('orderBy', 'u.lastname ASC'); + + $wherePart = $queryBuilder->expr()->andx(); + + // Get only users subscribed to this course + $wherePart->add($queryBuilder->expr()->eq('user.userId', $user->getUserId())); + + $queryBuilder->where($wherePart); + $query = $queryBuilder->getQuery(); + + return $query->execute(); + } + + public function getTeachers() + { + $queryBuilder = $this->createQueryBuilder('u'); + + // Selecting course info. + $queryBuilder + ->select('u') + ->where('u.groups.id = :groupId') + ->setParameter('groupId', 1); + + $query = $queryBuilder->getQuery(); + + return $query->execute(); + }*/ + + /*public function getUsers($group) + { + $queryBuilder = $this->createQueryBuilder('u'); + + // Selecting course info. + $queryBuilder + ->select('u') + ->where('u.groups = :groupId') + ->setParameter('groupId', $group); + + $query = $queryBuilder->getQuery(); + + return $query->execute(); + }*/ + + /** + * Get the sessions admins for a user. + * + * @return array + */ + public function getSessionAdmins(User $user) + { + $queryBuilder = $this->createQueryBuilder('u'); + $queryBuilder + ->distinct() + ->innerJoin( + 'ChamiloCoreBundle:SessionRelUser', + 'su', + Join::WITH, + $queryBuilder->expr()->eq('u', 'su.user') + ) + ->innerJoin( + 'ChamiloCoreBundle:SessionRelCourseRelUser', + 'scu', + Join::WITH, + $queryBuilder->expr()->eq('su.session', 'scu.session') + ) + ->where( + $queryBuilder->expr()->eq('scu.user', $user->getId()) + ) + ->andWhere( + $queryBuilder->expr()->eq('su.relationType', SESSION_RELATION_TYPE_RRHH) + ); + + return $queryBuilder->getQuery()->getResult(); + } + + /** + * Get the student bosses for a user. + * + * @return array + */ + public function getStudentBosses(User $user) + { + $queryBuilder = $this->createQueryBuilder('u'); + $queryBuilder + ->distinct() + ->innerJoin( + 'ChamiloCoreBundle:UserRelUser', + 'uu', + Join::WITH, + $queryBuilder->expr()->eq('u.id', 'uu.friendUserId') + ) + ->where( + $queryBuilder->expr()->eq('uu.relationType', USER_RELATION_TYPE_BOSS) + ) + ->andWhere( + $queryBuilder->expr()->eq('uu.userId', $user->getId()) + ); + + return $queryBuilder->getQuery()->getResult(); + } + + /** + * Find potential users to send a message. + * + * @param int $currentUserId The current user ID + * @param string $search The search text to filter the user list + * @param int $limit Optional. Sets the maximum number of results to retrieve + * + * @return mixed + */ + public function findUsersToSendMessage($currentUserId, $search, $limit = 10) + { + $allowSendMessageToAllUsers = api_get_setting('allow_send_message_to_all_platform_users'); + $accessUrlId = api_get_multiple_access_url() ? api_get_current_access_url_id() : 1; + + if (api_get_setting('allow_social_tool') === 'true' && + api_get_setting('allow_message_tool') === 'true' + ) { + // All users + if ($allowSendMessageToAllUsers === 'true' || api_is_platform_admin()) { + $dql = "SELECT DISTINCT U + FROM ChamiloUserBundle:User U + LEFT JOIN ChamiloCoreBundle:AccessUrlRelUser R + WITH U = R.user + WHERE + U.active = 1 AND + U.status != 6 AND + U.id != $currentUserId AND + R.portal = $accessUrlId"; + } else { + $dql = "SELECT DISTINCT U + FROM ChamiloCoreBundle:AccessUrlRelUser R, ChamiloCoreBundle:UserRelUser UF + INNER JOIN ChamiloUserBundle:User AS U + WITH UF.friendUserId = U + WHERE + U.active = 1 AND + U.status != 6 AND + UF.relationType NOT IN(".USER_RELATION_TYPE_DELETED.", ".USER_RELATION_TYPE_RRHH.") AND + UF.userId = $currentUserId AND + UF.friendUserId != $currentUserId AND + U = R.user AND + R.portal = $accessUrlId"; + } + } elseif ( + api_get_setting('allow_social_tool') === 'false' && + api_get_setting('allow_message_tool') === 'true' + ) { + if ($allowSendMessageToAllUsers === 'true') { + $dql = "SELECT DISTINCT U + FROM ChamiloUserBundle:User U + LEFT JOIN ChamiloCoreBundle:AccessUrlRelUser R + WITH U = R.user + WHERE + U.active = 1 AND + U.status != 6 AND + U.id != $currentUserId AND + R.portal = $accessUrlId"; + } else { + $time_limit = api_get_setting('time_limit_whosonline'); + $online_time = time() - $time_limit * 60; + $limit_date = api_get_utc_datetime($online_time); + $dql = "SELECT DISTINCT U + FROM ChamiloUserBundle:User U + LEFT JOIN ChamiloCoreBundle:AccessUrlRelUser R + WITH U = R.user + INNER JOIN ChamiloCoreBundle:TrackEOnline T + WITH U.id = T.loginUserId + WHERE + R.portal = $accessUrlId AND + U.active = 1 AND + T.loginDate >= '".$limit_date."'"; + } + } + + $dql .= ' AND (U.firstname LIKE :search OR U.lastname LIKE :search OR U.email LIKE :search OR U.username LIKE :search)'; + + return $this->getEntityManager() + ->createQuery($dql) + ->setMaxResults($limit) + ->setParameters(['search' => "%$search%"]) + ->getResult(); + } + + /** + * Get the list of HRM who have assigned this user. + * + * @param int $userId + * @param int $urlId + * + * @return array + */ + public function getAssignedHrmUserList($userId, $urlId) + { + $qb = $this->createQueryBuilder('user'); + + $hrmList = $qb + ->select('uru') + ->innerJoin('ChamiloCoreBundle:UserRelUser', 'uru', Join::WITH, 'uru.userId = user.id') + ->innerJoin('ChamiloCoreBundle:AccessUrlRelUser', 'auru', Join::WITH, 'auru.userId = uru.friendUserId') + ->where( + $qb->expr()->eq('auru.accessUrlId', $urlId) + ) + ->andWhere( + $qb->expr()->eq('uru.userId', $userId) + ) + ->andWhere( + $qb->expr()->eq('uru.relationType', USER_RELATION_TYPE_RRHH) + ) + ->getQuery() + ->getResult(); + + return $hrmList; + } + + /** + * Serialize the whole entity to an array. + * + * @param int $userId + * @param array $substitutionTerms Substitute terms for some elements + * + * @return string + */ + public function getPersonalDataToJson($userId, array $substitutionTerms) + { + $em = $this->getEntityManager(); + $dateFormat = \Datetime::ATOM; + + /** @var User $user */ + $dbUser = $this->find($userId); + + $user = new User(); + $user->setUserId($userId); + $user->setPassword($substitutionTerms['password']); + $user->setSalt($substitutionTerms['salt']); + $noDataLabel = $substitutionTerms['empty']; + + // Dummy content + $user->setDateOfBirth(null); + //$user->setBiography($noDataLabel); + $user->setFacebookData($noDataLabel); + $user->setFacebookName($noDataLabel); + $user->setFacebookUid($noDataLabel); + //$user->setImageName($noDataLabel); + //$user->setTwoStepVerificationCode($noDataLabel); + $user->setGender($noDataLabel); + $user->setGplusData($noDataLabel); + $user->setGplusName($noDataLabel); + $user->setGplusUid($noDataLabel); + $user->setLocale($noDataLabel); + $user->setTimezone($noDataLabel); + $user->setTwitterData($noDataLabel); + $user->setTwitterName($noDataLabel); + $user->setTwitterUid($noDataLabel); + $user->setWebsite($noDataLabel); + $user->setToken($noDataLabel); + + $user->setFirstname($dbUser->getFirstname()); + $user->setLastname($dbUser->getLastname()); + $user->setAuthSource($dbUser->getAuthSource()); + $user->setEmail($dbUser->getEmail()); + $user->setStatus($dbUser->getStatus()); + $user->setOfficialCode($dbUser->getOfficialCode()); + $user->setPhone($dbUser->getPhone()); + $user->setAddress($dbUser->getAddress()); + $user->setPictureUri($dbUser->getPictureUri()); + $user->setCreatorId($dbUser->getCreatorId()); + $user->setCompetences($dbUser->getCompetences()); + $user->setDiplomas($dbUser->getDiplomas()); + $user->setOpenarea($dbUser->getOpenarea()); + $user->setTeach($dbUser->getTeach()); + $user->setProductions($dbUser->getProductions()); + $user->setLanguage($dbUser->getLanguage()); + $user->setRegistrationDate($dbUser->getRegistrationDate()); + $user->setExpirationDate($dbUser->getExpirationDate()); + $user->setActive($dbUser->getActive()); + $user->setOpenid($dbUser->getOpenid()); + $user->setTheme($dbUser->getTheme()); + $user->setHrDeptId($dbUser->getHrDeptId()); + $user->setSlug($dbUser->getSlug()); + $user->setLastLogin($dbUser->getLastLogin()); + //$user->setExtraFieldList($dbUser->getExtraFields()); + $user->setUsername($dbUser->getUsername()); + $user->setPasswordRequestedAt($dbUser->getPasswordRequestedAt()); + $user->setCreatorId($dbUser->getCreatorId()); + $user->setUpdatedAt($dbUser->getUpdatedAt()); + + if ($dbUser->getExpiresAt()) { + $user->setExpiresAt($dbUser->getExpiresAt()); + } + + $user->setExpirationDate($dbUser->getExpirationDate()); + $user->setCredentialsExpireAt($dbUser->getCredentialsExpireAt()); + //$user->setBiography($dbUser->getBiography()); + //$user->setDateOfBirth($dbUser->getDateOfBirth()); + //$user->setGender($dbUser->getGender()); + //$user->setLocale($dbUser->getLocale()); + //$user->setTimezone($dbUser->getTimezone()); + //$user->setWebsite($dbUser->getWebsite()); + $user->setUsernameCanonical($dbUser->getUsernameCanonical()); + $user->setEmailCanonical($dbUser->getEmailCanonical()); + $user->setRoles($dbUser->getRoles()); + $user->setLocked($dbUser->getLocked()); + $user->setProfileCompleted($dbUser->isProfileCompleted()); + + $courses = $dbUser->getCourses(); + $list = []; + $chatFiles = []; + foreach ($courses as $course) { + $list[] = $course->getCourse()->getCode(); + $course->getCourse()->setToolList(null); + $courseDir = api_get_path(SYS_COURSE_PATH).$course->getCourse()->getDirectory(); + $documentDir = $courseDir.'/document/chat_files/'; + if (is_dir($documentDir)) { + $fs = new Finder(); + $fs->files()->in($documentDir); + foreach ($fs as $file) { + $chatFiles[] = + $course->getCourse()->getDirectory().'/document/chat_files/'.$file->getFilename().' - '. + get_lang('ContentNotAccessibleRequestFromDataPrivacyOfficer'); + } + } + } + + $user->setCourses($list); + + $classes = $dbUser->getClasses(); + $list = []; + foreach ($classes as $class) { + $name = $class->getUsergroup()->getName(); + $list[$class->getUsergroup()->getGroupType()][] = $name.' - Status: '.$class->getRelationType(); + } + $user->setClasses($list); + + $collection = $dbUser->getSessionCourseSubscriptions(); + $list = []; + foreach ($collection as $item) { + $list[$item->getSession()->getName()][] = $item->getCourse()->getCode(); + } + $user->setSessionCourseSubscriptions($list); + + $documents = \DocumentManager::getAllDocumentsCreatedByUser($userId); + $friends = \SocialManager::get_friends($userId); + $friendList = []; + if (!empty($friends)) { + foreach ($friends as $friend) { + $friendList[] = $friend['user_info']['complete_name']; + } + } + + $agenda = new \Agenda('personal'); + $events = $agenda->getEvents('', '', null, null, $userId, 'array'); + $eventList = []; + if (!empty($events)) { + foreach ($events as $event) { + $eventList[] = $event['title'].' '.$event['start_date_localtime'].' / '.$event['end_date_localtime']; + } + } + + // GradebookCertificate + $criteria = [ + 'userId' => $userId, + ]; + $result = $em->getRepository('ChamiloCoreBundle:GradebookCertificate')->findBy($criteria); + $gradebookCertificate = []; + /** @var GradebookCertificate $item */ + foreach ($result as $item) { + $createdAt = $item->getCreatedAt() ? $item->getCreatedAt()->format($dateFormat) : ''; + $list = [ + 'Score: '.$item->getScoreCertificate(), + 'Path: '.$item->getPathCertificate(), + 'Created at: '.$createdAt, + ]; + $gradebookCertificate[] = implode(', ', $list); + } + + // TrackEExercises + $criteria = [ + 'exeUserId' => $userId, + ]; + $result = $em->getRepository('ChamiloCoreBundle:TrackEExercises')->findBy($criteria); + $trackEExercises = []; + /** @var TrackEExercises $item */ + foreach ($result as $item) { + $date = $item->getExeDate() ? $item->getExeDate()->format($dateFormat) : ''; + $list = [ + 'IP: '.$item->getUserIp(), + 'Start: '.$date, + 'Status: '.$item->getStatus(), + // 'Result: '.$item->getExeResult(), + // 'Weighting: '.$item->getExeWeighting(), + ]; + $trackEExercises[] = implode(', ', $list); + } + + // TrackEAttempt + $criteria = [ + 'userId' => $userId, + ]; + $result = $em->getRepository('ChamiloCoreBundle:TrackEAttempt')->findBy($criteria); + $trackEAttempt = []; + /** @var TrackEAttempt $item */ + foreach ($result as $item) { + $date = $item->getTms() ? $item->getTms()->format($dateFormat) : ''; + $list = [ + 'Attempt #'.$item->getExeId(), + 'Course # '.$item->getCId(), + //'Answer: '.$item->getAnswer(), + 'Session #'.$item->getSessionId(), + //'Marks: '.$item->getMarks(), + 'Position: '.$item->getPosition(), + 'Date: '.$date, + ]; + $trackEAttempt[] = implode(', ', $list); + } + + // TrackECourseAccess + $criteria = [ + 'userId' => $userId, + ]; + $result = $em->getRepository('ChamiloCoreBundle:TrackECourseAccess')->findBy($criteria); + $trackECourseAccessList = []; + /** @var TrackECourseAccess $item */ + foreach ($result as $item) { + $startDate = $item->getLoginCourseDate() ? $item->getLoginCourseDate()->format($dateFormat) : ''; + $endDate = $item->getLogoutCourseDate() ? $item->getLogoutCourseDate()->format($dateFormat) : ''; + $list = [ + 'IP: '.$item->getUserIp(), + 'Start: '.$startDate, + 'End: '.$endDate, + ]; + $trackECourseAccessList[] = implode(', ', $list); + } + + $checkEntities = [ + 'ChamiloCoreBundle:TrackELogin' => 'loginUserId', + 'ChamiloCoreBundle:TrackEAccess' => 'accessUserId', + 'ChamiloCoreBundle:TrackEOnline' => 'loginUserId', + 'ChamiloCoreBundle:TrackEDefault' => 'defaultUserId', + 'ChamiloCoreBundle:TrackELastaccess' => 'accessUserId', + 'ChamiloCoreBundle:TrackEUploads' => 'uploadUserId', + 'ChamiloCoreBundle:GradebookResult' => 'userId', + 'ChamiloCoreBundle:TrackEDownloads' => 'downUserId', + ]; + + $maxResults = 1000; + $trackResults = []; + foreach ($checkEntities as $entity => $field) { + $qb = $em->createQueryBuilder(); + $qb->select($qb->expr()->count('l')) + ->from($entity, 'l') + ->where("l.$field = :login") + ->setParameter('login', $userId); + $query = $qb->getQuery(); + $count = $query->getSingleScalarResult(); + + if ($count > $maxResults) { + $qb = $em->getRepository($entity)->createQueryBuilder('l'); + $qb + ->select('l') + ->where("l.$field = :login") + ->setParameter('login', $userId); + $qb + ->setFirstResult(0) + ->setMaxResults($maxResults) + ; + $result = $qb->getQuery()->getResult(); + } else { + $criteria = [ + $field => $userId, + ]; + $result = $em->getRepository($entity)->findBy($criteria); + } + $trackResults[$entity] = $result; + } + + $trackELoginList = []; + /** @var TrackELogin $item */ + foreach ($trackResults['ChamiloCoreBundle:TrackELogin'] as $item) { + $startDate = $item->getLoginDate() ? $item->getLoginDate()->format($dateFormat) : ''; + $endDate = $item->getLogoutDate() ? $item->getLogoutDate()->format($dateFormat) : ''; + $list = [ + 'IP: '.$item->getUserIp(), + 'Start: '.$startDate, + 'End: '.$endDate, + ]; + $trackELoginList[] = implode(', ', $list); + } + + // TrackEAccess + $trackEAccessList = []; + /** @var TrackEAccess $item */ + foreach ($trackResults['ChamiloCoreBundle:TrackEAccess'] as $item) { + $date = $item->getAccessDate() ? $item->getAccessDate()->format($dateFormat) : ''; + $list = [ + 'IP: '.$item->getUserIp(), + 'Tool: '.$item->getAccessTool(), + 'End: '.$date, + ]; + $trackEAccessList[] = implode(', ', $list); + } + + // TrackEOnline + $trackEOnlineList = []; + /** @var TrackEOnline $item */ + foreach ($trackResults['ChamiloCoreBundle:TrackEOnline'] as $item) { + $date = $item->getLoginDate() ? $item->getLoginDate()->format($dateFormat) : ''; + $list = [ + 'IP: '.$item->getUserIp(), + 'Login date: '.$date, + 'Course # '.$item->getCId(), + 'Session # '.$item->getSessionId(), + ]; + $trackEOnlineList[] = implode(', ', $list); + } + + // TrackEDefault + $trackEDefault = []; + /** @var TrackEDefault $item */ + foreach ($trackResults['ChamiloCoreBundle:TrackEDefault'] as $item) { + $date = $item->getDefaultDate() ? $item->getDefaultDate()->format($dateFormat) : ''; + $list = [ + 'Type: '.$item->getDefaultEventType(), + 'Value: '.$item->getDefaultValue(), + 'Value type: '.$item->getDefaultValueType(), + 'Date: '.$date, + 'Course #'.$item->getCId(), + 'Session # '.$item->getSessionId(), + ]; + $trackEDefault[] = implode(', ', $list); + } + + // TrackELastaccess + $trackELastaccess = []; + /** @var TrackELastaccess $item */ + foreach ($trackResults['ChamiloCoreBundle:TrackELastaccess'] as $item) { + $date = $item->getAccessDate() ? $item->getAccessDate()->format($dateFormat) : ''; + $list = [ + 'Course #'.$item->getCId(), + 'Session # '.$item->getAccessSessionId(), + 'Tool: '.$item->getAccessTool(), + 'Access date: '.$date, + ]; + $trackELastaccess[] = implode(', ', $list); + } + + // TrackEUploads + $trackEUploads = []; + /** @var TrackEUploads $item */ + foreach ($trackResults['ChamiloCoreBundle:TrackEUploads'] as $item) { + $date = $item->getUploadDate() ? $item->getUploadDate()->format($dateFormat) : ''; + $list = [ + 'Course #'.$item->getCId(), + 'Uploaded at: '.$date, + 'Upload id # '.$item->getUploadId(), + ]; + $trackEUploads[] = implode(', ', $list); + } + + $gradebookResult = []; + /** @var GradebookResult $item */ + foreach ($trackResults['ChamiloCoreBundle:GradebookResult'] as $item) { + $date = $item->getCreatedAt() ? $item->getCreatedAt()->format($dateFormat) : ''; + $list = [ + 'Evaluation id# '.$item->getEvaluationId(), + //'Score: '.$item->getScore(), + 'Creation date: '.$date, + ]; + $gradebookResult[] = implode(', ', $list); + } + + $trackEDownloads = []; + /** @var TrackEDownloads $item */ + foreach ($trackResults['ChamiloCoreBundle:TrackEDownloads'] as $item) { + $date = $item->getDownDate() ? $item->getDownDate()->format($dateFormat) : ''; + $list = [ + 'File: '.$item->getDownDocPath(), + 'Download at: '.$date, + ]; + $trackEDownloads[] = implode(', ', $list); + } + + // UserCourseCategory + $criteria = [ + 'userId' => $userId, + ]; + $result = $em->getRepository('ChamiloCoreBundle:UserCourseCategory')->findBy($criteria); + $userCourseCategory = []; + /** @var UserCourseCategory $item */ + foreach ($result as $item) { + $list = [ + 'Title: '.$item->getTitle(), + ]; + $userCourseCategory[] = implode(', ', $list); + } + + // Forum + $criteria = [ + 'posterId' => $userId, + ]; + $result = $em->getRepository('ChamiloCourseBundle:CForumPost')->findBy($criteria); + $cForumPostList = []; + /** @var CForumPost $item */ + foreach ($result as $item) { + $date = $item->getPostDate() ? $item->getPostDate()->format($dateFormat) : ''; + $list = [ + 'Title: '.$item->getPostTitle(), + 'Creation date: '.$date, + ]; + $cForumPostList[] = implode(', ', $list); + } + + // CForumThread + $criteria = [ + 'threadPosterId' => $userId, + ]; + $result = $em->getRepository('ChamiloCourseBundle:CForumThread')->findBy($criteria); + $cForumThreadList = []; + /** @var CForumThread $item */ + foreach ($result as $item) { + $date = $item->getThreadDate() ? $item->getThreadDate()->format($dateFormat) : ''; + $list = [ + 'Title: '.$item->getThreadTitle(), + 'Creation date: '.$date, + ]; + $cForumThreadList[] = implode(', ', $list); + } + + // CForumAttachment + /*$criteria = [ + 'threadPosterId' => $userId, + ]; + $result = $em->getRepository('ChamiloCourseBundle:CForumAttachment')->findBy($criteria); + $cForumThreadList = []; + * @var CForumThread $item + foreach ($result as $item) { + $list = [ + 'Title: '.$item->getThreadTitle(), + 'Creation date: '.$item->getThreadDate()->format($dateFormat), + ]; + $cForumThreadList[] = implode(', ', $list); + }*/ + + // cGroupRelUser + $criteria = [ + 'userId' => $userId, + ]; + $result = $em->getRepository('ChamiloCourseBundle:CGroupRelUser')->findBy($criteria); + $cGroupRelUser = []; + /** @var CGroupRelUser $item */ + foreach ($result as $item) { + $list = [ + 'Course # '.$item->getCId(), + 'Group #'.$item->getGroupId(), + 'Role: '.$item->getStatus(), + ]; + $cGroupRelUser[] = implode(', ', $list); + } + + // CAttendanceSheet + $criteria = [ + 'userId' => $userId, + ]; + $result = $em->getRepository('ChamiloCourseBundle:CAttendanceSheet')->findBy($criteria); + $cAttendanceSheetList = []; + /** @var CAttendanceSheet $item */ + foreach ($result as $item) { + $list = [ + 'Presence: '.$item->getPresence(), + 'Calendar id: '.$item->getAttendanceCalendarId(), + ]; + $cAttendanceSheetList[] = implode(', ', $list); + } + + // CBlogPost + $criteria = [ + 'authorId' => $userId, + ]; + $result = $em->getRepository('ChamiloCourseBundle:CBlogPost')->findBy($criteria); + $cBlog = []; + /** @var CBlogPost $item */ + foreach ($result as $item) { + $date = $item->getDateCreation() ? $item->getDateCreation()->format($dateFormat) : ''; + $list = [ + 'Title: '.$item->getTitle(), + 'Date: '.$date, + ]; + $cBlog[] = implode(', ', $list); + } + + // CAttendanceResult + $criteria = [ + 'userId' => $userId, + ]; + $result = $em->getRepository('ChamiloCourseBundle:CAttendanceResult')->findBy($criteria); + $cAttendanceResult = []; + /** @var CAttendanceResult $item */ + foreach ($result as $item) { + $list = [ + 'Score : '.$item->getScore(), + 'Calendar id: '.$item->getAttendanceId(), + ]; + $cAttendanceResult[] = implode(', ', $list); + } + + // Message + $criteria = [ + 'userSenderId' => $userId, + ]; + $result = $em->getRepository('ChamiloCoreBundle:Message')->findBy($criteria); + $messageList = []; + /** @var Message $item */ + foreach ($result as $item) { + $date = $item->getSendDate() ? $item->getSendDate()->format($dateFormat) : ''; + $list = [ + 'Title: '.$item->getTitle(), + 'Sent date: '.$date, + 'To user # '.$item->getUserReceiverId(), + 'Status'.$item->getMsgStatus(), + ]; + $messageList[] = implode(', ', $list); + } + + // CSurveyAnswer + $criteria = [ + 'user' => $userId, + ]; + $result = $em->getRepository('ChamiloCourseBundle:CSurveyAnswer')->findBy($criteria); + $cSurveyAnswer = []; + /** @var CSurveyAnswer $item */ + foreach ($result as $item) { + $list = [ + 'Answer # '.$item->getAnswerId(), + 'Value: '.$item->getValue(), + ]; + $cSurveyAnswer[] = implode(', ', $list); + } + + // CDropboxFile + $criteria = [ + 'uploaderId' => $userId, + ]; + $result = $em->getRepository('ChamiloCourseBundle:CDropboxFile')->findBy($criteria); + $cDropboxFile = []; + /** @var CDropboxFile $item */ + foreach ($result as $item) { + $date = $item->getUploadDate() ? $item->getUploadDate()->format($dateFormat) : ''; + $list = [ + 'Title: '.$item->getTitle(), + 'Uploaded date: '.$date, + 'File: '.$item->getFilename(), + ]; + $cDropboxFile[] = implode(', ', $list); + } + + // CDropboxPerson + $criteria = [ + 'userId' => $userId, + ]; + $result = $em->getRepository('ChamiloCourseBundle:CDropboxPerson')->findBy($criteria); + $cDropboxPerson = []; + /** @var CDropboxPerson $item */ + foreach ($result as $item) { + $list = [ + 'File #'.$item->getFileId(), + 'Course #'.$item->getCId(), + ]; + $cDropboxPerson[] = implode(', ', $list); + } + + // CDropboxPerson + $criteria = [ + 'authorUserId' => $userId, + ]; + $result = $em->getRepository('ChamiloCourseBundle:CDropboxFeedback')->findBy($criteria); + $cDropboxFeedback = []; + /** @var CDropboxFeedback $item */ + foreach ($result as $item) { + $date = $item->getFeedbackDate() ? $item->getFeedbackDate()->format($dateFormat) : ''; + $list = [ + 'File #'.$item->getFileId(), + 'Feedback: '.$item->getFeedback(), + 'Date: '.$date, + ]; + $cDropboxFeedback[] = implode(', ', $list); + } + + // CNotebook + $criteria = [ + 'userId' => $userId, + ]; + $result = $em->getRepository('ChamiloCourseBundle:CNotebook')->findBy($criteria); + $cNotebook = []; + /** @var CNotebook $item */ + foreach ($result as $item) { + $date = $item->getUpdateDate() ? $item->getUpdateDate()->format($dateFormat) : ''; + $list = [ + 'Title: '.$item->getTitle(), + 'Date: '.$date, + ]; + $cNotebook[] = implode(', ', $list); + } + + // CLpView + $criteria = [ + 'userId' => $userId, + ]; + $result = $em->getRepository('ChamiloCourseBundle:CLpView')->findBy($criteria); + $cLpView = []; + /** @var CLpView $item */ + foreach ($result as $item) { + $list = [ + //'Id #'.$item->getId(), + 'LP #'.$item->getLpId(), + 'Progress: '.$item->getProgress(), + 'Course #'.$item->getCId(), + 'Session #'.$item->getSessionId(), + ]; + $cLpView[] = implode(', ', $list); + } + + // CStudentPublication + $criteria = [ + 'userId' => $userId, + ]; + $result = $em->getRepository('ChamiloCourseBundle:CStudentPublication')->findBy($criteria); + $cStudentPublication = []; + /** @var CStudentPublication $item */ + foreach ($result as $item) { + $list = [ + 'Title: '.$item->getTitle(), + 'URL: '.$item->getUrl(), + ]; + $cStudentPublication[] = implode(', ', $list); + } + + // CStudentPublicationComment + $criteria = [ + 'userId' => $userId, + ]; + $result = $em->getRepository('ChamiloCourseBundle:CStudentPublicationComment')->findBy($criteria); + $cStudentPublicationComment = []; + /** @var CStudentPublicationComment $item */ + foreach ($result as $item) { + $date = $item->getSentAt() ? $item->getSentAt()->format($dateFormat) : ''; + $list = [ + 'Commment: '.$item->getComment(), + 'File '.$item->getFile(), + 'Course # '.$item->getCId(), + 'Date: '.$date, + ]; + $cStudentPublicationComment[] = implode(', ', $list); + } + + // CWiki + $criteria = [ + 'userId' => $userId, + ]; + $result = $em->getRepository('ChamiloCourseBundle:CWiki')->findBy($criteria); + $cWiki = []; + /** @var CWiki $item */ + foreach ($result as $item) { + $list = [ + 'Title: '.$item->getTitle(), + 'Progress: '.$item->getProgress(), + 'IP: '.$item->getUserIp(), + ]; + $cWiki[] = implode(', ', $list); + } + + // Ticket + $criteria = [ + 'insertUserId' => $userId, + ]; + $result = $em->getRepository('ChamiloTicketBundle:Ticket')->findBy($criteria); + $ticket = []; + /** @var Ticket $item */ + foreach ($result as $item) { + $list = [ + 'Code: '.$item->getCode(), + 'Subject: '.$item->getSubject(), + ]; + $ticket[] = implode(', ', $list); + } + + // Message + $criteria = [ + 'insertUserId' => $userId, + ]; + $result = $em->getRepository('ChamiloTicketBundle:Message')->findBy($criteria); + $ticketMessage = []; + /** @var \Chamilo\TicketBundle\Entity\Message $item */ + foreach ($result as $item) { + $date = $item->getInsertDateTime() ? $item->getInsertDateTime()->format($dateFormat) : ''; + $list = [ + 'Subject: '.$item->getSubject(), + 'IP: '.$item->getIpAddress(), + 'Status: '.$item->getStatus(), + 'Creation date: '.$date, + ]; + $ticketMessage[] = implode(', ', $list); + } + + // SkillRelUserComment + $criteria = [ + 'feedbackGiver' => $userId, + ]; + $result = $em->getRepository('ChamiloCoreBundle:SkillRelUserComment')->findBy($criteria); + $skillRelUserComment = []; + /** @var SkillRelUserComment $item */ + foreach ($result as $item) { + $date = $item->getFeedbackDateTime() ? $item->getFeedbackDateTime()->format($dateFormat) : ''; + $list = [ + 'Feedback: '.$item->getFeedbackText(), + 'Value: '.$item->getFeedbackValue(), + 'Created at: '.$date, + ]; + $skillRelUserComment[] = implode(', ', $list); + } + + // UserRelCourseVote + $criteria = [ + 'userId' => $userId, + ]; + $result = $em->getRepository('ChamiloCoreBundle:UserRelCourseVote')->findBy($criteria); + $userRelCourseVote = []; + /** @var UserRelCourseVote $item */ + foreach ($result as $item) { + $list = [ + 'Course #'.$item->getCId(), + 'Session #'.$item->getSessionId(), + 'Vote: '.$item->getVote(), + ]; + $userRelCourseVote[] = implode(', ', $list); + } + + // UserApiKey + $criteria = [ + 'userId' => $userId, + ]; + $result = $em->getRepository('ChamiloCoreBundle:UserApiKey')->findBy($criteria); + $userApiKey = []; + /** @var UserApiKey $item */ + foreach ($result as $item) { + $validityStart = $item->getValidityStartDate() ? $item->getValidityStartDate()->format($dateFormat) : ''; + $validityEnd = $item->getValidityEndDate() ? $item->getValidityEndDate()->format($dateFormat) : ''; + $created = $item->getCreatedDate() ? $item->getCreatedDate()->format($dateFormat) : ''; + + $list = [ + 'ApiKey #'.$item->getApiKey(), + 'Service: '.$item->getApiService(), + 'EndPoint: '.$item->getApiEndPoint(), + 'Validity start date: '.$validityStart, + 'Validity enddate: '.$validityEnd, + 'Created at: '.$created, + ]; + $userApiKey[] = implode(', ', $list); + } + + $user->setDropBoxSentFiles( + [ + 'Friends' => $friendList, + 'Events' => $eventList, + 'GradebookCertificate' => $gradebookCertificate, + 'TrackECourseAccess' => $trackECourseAccessList, + 'TrackELogin' => $trackELoginList, + 'TrackEAccess' => $trackEAccessList, + 'TrackEDefault' => $trackEDefault, + 'TrackEOnline' => $trackEOnlineList, + 'TrackEUploads' => $trackEUploads, + 'TrackELastaccess' => $trackELastaccess, + 'GradebookResult' => $gradebookResult, + 'Downloads' => $trackEDownloads, + 'UserCourseCategory' => $userCourseCategory, + 'SkillRelUserComment' => $skillRelUserComment, + 'UserRelCourseVote' => $userRelCourseVote, + 'UserApiKey' => $userApiKey, + + // courses + 'AttendanceResult' => $cAttendanceResult, + 'Blog' => $cBlog, + 'DocumentsAdded' => $documents, + 'Chat' => $chatFiles, + 'ForumPost' => $cForumPostList, + 'ForumThread' => $cForumThreadList, + 'TrackEExercises' => $trackEExercises, + 'TrackEAttempt' => $trackEAttempt, + + 'GroupRelUser' => $cGroupRelUser, + 'Message' => $messageList, + 'Survey' => $cSurveyAnswer, + 'StudentPublication' => $cStudentPublication, + 'StudentPublicationComment' => $cStudentPublicationComment, + 'DropboxFile' => $cDropboxFile, + 'DropboxPerson' => $cDropboxPerson, + 'DropboxFeedback' => $cDropboxFeedback, + + 'LpView' => $cLpView, + 'Notebook' => $cNotebook, + + 'Wiki' => $cWiki, + // Tickets + 'Ticket' => $ticket, + 'TicketMessage' => $ticketMessage, + ] + ); + + $user->setDropBoxReceivedFiles([]); + $user->setCurriculumItems([]); + + $portals = $dbUser->getPortals(); + if (!empty($portals)) { + $list = []; + /** @var AccessUrlRelUser $portal */ + foreach ($portals as $portal) { + $portalInfo = \UrlManager::get_url_data_from_id($portal->getAccessUrlId()); + $list[] = $portalInfo['url']; + } + } + $user->setPortals($list); + + $coachList = $dbUser->getSessionAsGeneralCoach(); + $list = []; + /** @var Session $session */ + foreach ($coachList as $session) { + $list[] = $session->getName(); + } + $user->setSessionAsGeneralCoach($list); + + $skillRelUserList = $dbUser->getAchievedSkills(); + $list = []; + /** @var SkillRelUser $skillRelUser */ + foreach ($skillRelUserList as $skillRelUser) { + $list[] = $skillRelUser->getSkill()->getName(); + } + $user->setAchievedSkills($list); + $user->setCommentedUserSkills([]); + + $extraFieldValues = new \ExtraFieldValue('user'); + $items = $extraFieldValues->getAllValuesByItem($userId); + $user->setExtraFields($items); + + $lastLogin = $dbUser->getLastLogin(); + if (empty($lastLogin)) { + $login = $this->getLastLogin($dbUser); + if ($login) { + $lastLogin = $login->getLoginDate(); + } + } + + if (!empty($lastLogin)) { + $user->setLastLogin($lastLogin); + } + + $dateNormalizer = new GetSetMethodNormalizer(); + $dateNormalizer->setCircularReferenceHandler(function ($object) { + return get_class($object); + }); + + $ignore = [ + 'id', + 'twoStepVerificationCode', + 'biography', + 'dateOfBirth', + 'gender', + 'facebookData', + 'facebookName', + 'facebookUid', + 'gplusData', + 'gplusName', + 'gplusUid', + 'locale', + 'timezone', + 'twitterData', + 'twitterName', + 'twitterUid', + 'gplusUid', + 'token', + 'website', + 'plainPassword', + 'completeNameWithUsername', + 'completeName', + 'completeNameWithClasses', + 'salt', + ]; + + $dateNormalizer->setIgnoredAttributes($ignore); + + $callback = function ($dateTime) { + return $dateTime instanceof \DateTime ? $dateTime->format(\DateTime::ISO8601) : ''; + }; + + $dateNormalizer->setCallbacks( + [ + 'createdAt' => $callback, + 'lastLogin' => $callback, + 'registrationDate' => $callback, + 'memberSince' => $callback, + ] + ); + + $serializer = new Serializer([$dateNormalizer], [new JsonEncoder()]); + + return $serializer->serialize($user, 'json'); + } + + /** + * Get the last login from the track_e_login table. + * This might be different from user.last_login in the case of legacy users + * as user.last_login was only implemented in 1.10 version with a default + * value of NULL (not the last record from track_e_login). + * + * @throws \Exception + * + * @return TrackELogin|null + */ + public function getLastLogin(User $user) + { + $repo = $this->getEntityManager()->getRepository('ChamiloCoreBundle:TrackELogin'); + $qb = $repo->createQueryBuilder('l'); + + return $qb + ->select('l') + ->where( + $qb->expr()->eq('l.loginUserId', $user->getId()) + ) + ->setMaxResults(1) + ->orderBy('l.loginDate', 'DESC') + ->getQuery() + ->getOneOrNullResult(); + } + + public function findByAuthSource(string $authSource): array + { + return $this->findBy(['authSource' => $authSource]); + } +} diff --git a/src/Chamilo/UserBundle/Resources/config/admin.yml b/src/Chamilo/UserBundle/Resources/config/admin.yml new file mode 100644 index 000000000..4387e7d83 --- /dev/null +++ b/src/Chamilo/UserBundle/Resources/config/admin.yml @@ -0,0 +1,15 @@ +parameters: + sonata.user.admin.groupname: sonata_user + sonata.user.admin.label_catalogue: ChamiloUserBundle + sonata.user.admin.groupicon: '' + +services: + sonata.user.admin.user: + class: Chamilo\UserBundle\Admin\UserAdmin + tags: + - { name: sonata.admin, manager_type: orm, audit:true, group: 'LMS', label: users, label_catalogue: '%sonata.user.admin.label_catalogue%', label_translator_strategy: sonata.admin.label.strategy.underscore, icon: '%sonata.user.admin.groupicon%' } + + arguments: ['', Chamilo\UserBundle\Entity\User, '%sonata.user.admin.user.controller%'] + calls: + - [setUserManager, ['@fos_user.user_manager']] + - [setTranslationDomain, ['%sonata.user.admin.user.translation_domain%']] diff --git a/src/Chamilo/UserBundle/Resources/views/ChangePassword/changePassword.html.twig b/src/Chamilo/UserBundle/Resources/views/ChangePassword/changePassword.html.twig new file mode 100644 index 000000000..31d7186cc --- /dev/null +++ b/src/Chamilo/UserBundle/Resources/views/ChangePassword/changePassword.html.twig @@ -0,0 +1,4 @@ +{#{% extends "FOSUserBundle::layout.html.twig" %}#} +{% block fos_user_content %} + {% include "SonataUserBundle:ChangePassword:changePassword_content.html.twig" %} +{% endblock fos_user_content %} diff --git a/src/Chamilo/UserBundle/Resources/views/ChangePassword/changePassword_content.html.twig b/src/Chamilo/UserBundle/Resources/views/ChangePassword/changePassword_content.html.twig new file mode 100644 index 000000000..12f6a87ca --- /dev/null +++ b/src/Chamilo/UserBundle/Resources/views/ChangePassword/changePassword_content.html.twig @@ -0,0 +1,8 @@ +
    + + {{ form_widget(form) }} + +
    diff --git a/src/Chamilo/UserBundle/Resources/views/Profile/action.html.twig b/src/Chamilo/UserBundle/Resources/views/Profile/action.html.twig new file mode 100644 index 000000000..393d11061 --- /dev/null +++ b/src/Chamilo/UserBundle/Resources/views/Profile/action.html.twig @@ -0,0 +1,37 @@ +{# + +This file is part of the Sonata package. + +(c) Thomas Rabaix + +For the full copyright and license information, please view the LICENSE +file that was distributed with this source code. + +#} + +{% block sonata_page_breadcrumb %} + {% if breadcrumb_context is not defined %} + {% set breadcrumb_context = 'user_index' %} + {% endif %} +
    + {{ sonata_block_render_event('breadcrumb', { 'context': breadcrumb_context, 'current_uri': app.request.requestUri }) }} +
    +{% endblock %} + +

    {% block sonata_profile_title %}{% trans from 'SonataUserBundle' %}sonata_profile_title{% endtrans %}{% endblock %}

    + +
    + +
    + {% block sonata_profile_menu %} + {{ sonata_block_render({'type': 'sonata.user.block.menu'}, {'current_uri': app.request.requestUri}) }} + {% endblock %} +
    + +
    + {% include 'SonataCoreBundle:FlashMessage:render.html.twig' %} + + {% block sonata_profile_content '' %} +
    + +
    diff --git a/src/Chamilo/UserBundle/Resources/views/Profile/edit_authentication.html.twig b/src/Chamilo/UserBundle/Resources/views/Profile/edit_authentication.html.twig new file mode 100644 index 000000000..96e5de863 --- /dev/null +++ b/src/Chamilo/UserBundle/Resources/views/Profile/edit_authentication.html.twig @@ -0,0 +1,26 @@ +
    +
    +
    +
    +

    {{ 'title_user_edit_authentication'|trans({}, 'SonataUserBundle') }}

    +
    +
    +
    + {{ form_widget(form) }} + + +
    +
    +
    +
    +
    +
    +
    +

    {{ 'sonata_change_password_link'|trans({}, 'SonataUserBundle') }}

    +
    +
    + {% render url("sonata_user_change_password") %} +
    +
    +
    +
    diff --git a/src/Chamilo/UserBundle/Resources/views/Profile/edit_profile.html.twig b/src/Chamilo/UserBundle/Resources/views/Profile/edit_profile.html.twig new file mode 100644 index 000000000..aeac1ad96 --- /dev/null +++ b/src/Chamilo/UserBundle/Resources/views/Profile/edit_profile.html.twig @@ -0,0 +1,72 @@ +{% extends "ChamiloUserBundle:Profile:action.html.twig" %} + +{% block sonata_profile_title %} + {{ "title_user_account" | trans({}, 'SonataUserBundle')}} - {{ "title_user_edit_profile" | trans({}, 'SonataUserBundle')}} +{% endblock %} + +{% block sonata_profile_content %} + {{ form_errors(form) }} + + + + {% form_theme form _self %} + + {##} + +
    +
    +

    {{ "title_user_account" | trans({}, 'SonataUserBundle')}}

    +
    +
    +
    + + {{ form_widget(form) }} + + {#
      #} + {#{% for field in form.extraFieldValues %}#} + {#
    • #} + {#{{ form_errors(field) }}#} + {#{{ form_widget(field) }}#} + {#
    • #} + {#{% endfor %}#} + {#
    #} + {#Add#} + + +
    + +
    +
    +
    +
    + + {% render url("sonata_user_profile_edit_authentication") %} + +{% endblock %} diff --git a/src/Chamilo/UserBundle/Resources/views/Profile/show.html.twig b/src/Chamilo/UserBundle/Resources/views/Profile/show.html.twig new file mode 100644 index 000000000..e94c796f9 --- /dev/null +++ b/src/Chamilo/UserBundle/Resources/views/Profile/show.html.twig @@ -0,0 +1,39 @@ +{% extends "SonataUserBundle:Profile:action.html.twig" %} + +{% block sonata_profile_content %} + +
    + {% set has_center = false %} + {% for block in blocks %} + {% if block.position == 'center' %} + {% set has_center = true %} + {% endif %} + {% endfor %} + +
    + {% for block in blocks %} + {% if block.position == 'left' %} + {{ sonata_block_render({ 'type': block.type, 'settings': block.settings}) }} + {% endif %} + {% endfor %} +
    + + {% if has_center %} +
    + {% for block in blocks %} + {% if block.position == 'center' %} + {{ sonata_block_render({ 'type': block.type, 'settings': block.settings}) }} + {% endif %} + {% endfor %} +
    + {% endif %} + +
    + {% for block in blocks %} + {% if block.position == 'right' %} + {{ sonata_block_render({ 'type': block.type, 'settings': block.settings}) }} + {% endif %} + {% endfor %} +
    +
    +{% endblock %} diff --git a/src/Chamilo/UserBundle/Resources/views/Registration/register_content.html.twig b/src/Chamilo/UserBundle/Resources/views/Registration/register_content.html.twig new file mode 100644 index 000000000..0f051fbbd --- /dev/null +++ b/src/Chamilo/UserBundle/Resources/views/Registration/register_content.html.twig @@ -0,0 +1,19 @@ +
    +
    +

    {{ 'title_user_registration'|trans({}, 'SonataUserBundle') }}

    +
    +
    +
    + + {{ form_widget(form) }} + +
    + +
    +
    +
    +
    diff --git a/src/Chamilo/UserBundle/Resources/views/Resetting/checkEmail.html.twig b/src/Chamilo/UserBundle/Resources/views/Resetting/checkEmail.html.twig new file mode 100644 index 000000000..86898b9f7 --- /dev/null +++ b/src/Chamilo/UserBundle/Resources/views/Resetting/checkEmail.html.twig @@ -0,0 +1,10 @@ +{% extends "FOSUserBundle::layout.html.twig" %} + +{% block fos_user_content %} +
    + {{ 'resetting.request.submit'|trans({}, 'FOSUserBundle') }} +
    +
    + {{ 'resetting.check_email'|trans({'%email%': email}, 'FOSUserBundle') }} +
    +{% endblock %} diff --git a/src/Chamilo/UserBundle/Resources/views/Resetting/email.txt.twig b/src/Chamilo/UserBundle/Resources/views/Resetting/email.txt.twig new file mode 100644 index 000000000..63918e2cc --- /dev/null +++ b/src/Chamilo/UserBundle/Resources/views/Resetting/email.txt.twig @@ -0,0 +1,11 @@ +{% block subject %} +{% autoescape false %} +{{ 'resetting.email.subject'|trans({'%username%': user.username, '%confirmationUrl%': confirmationUrl}, 'FOSUserBundle') }} +{% endautoescape %} +{% endblock %} +{% block body_text %} +{% autoescape false %} +{{ 'resetting.email.message'|trans({'%username%': user.username, '%confirmationUrl%': confirmationUrl}, 'FOSUserBundle') }} +{% endautoescape %} +{% endblock %} +{% block body_html %}{% endblock %} diff --git a/src/Chamilo/UserBundle/Resources/views/Resetting/passwordAlreadyRequested.html.twig b/src/Chamilo/UserBundle/Resources/views/Resetting/passwordAlreadyRequested.html.twig new file mode 100644 index 000000000..dd0e87499 --- /dev/null +++ b/src/Chamilo/UserBundle/Resources/views/Resetting/passwordAlreadyRequested.html.twig @@ -0,0 +1,10 @@ +{% extends "FOSUserBundle::layout.html.twig" %} + +{% block fos_user_content %} +
    + {{ 'resetting.request.submit'|trans({}, 'FOSUserBundle') }} +
    +
    +

    {{ 'resetting.password_already_requested'|trans({}, 'FOSUserBundle') }}

    +
    +{% endblock fos_user_content %} diff --git a/src/Chamilo/UserBundle/Resources/views/Resetting/request.html.twig b/src/Chamilo/UserBundle/Resources/views/Resetting/request.html.twig new file mode 100644 index 000000000..982632d5e --- /dev/null +++ b/src/Chamilo/UserBundle/Resources/views/Resetting/request.html.twig @@ -0,0 +1,5 @@ +{% extends "FOSUserBundle::layout.html.twig" %} + +{% block fos_user_content %} + {% include "FOSUserBundle:Resetting:request_content.html.twig" %} +{% endblock fos_user_content %} diff --git a/src/Chamilo/UserBundle/Resources/views/Resetting/request_content.html.twig b/src/Chamilo/UserBundle/Resources/views/Resetting/request_content.html.twig new file mode 100644 index 000000000..097592ced --- /dev/null +++ b/src/Chamilo/UserBundle/Resources/views/Resetting/request_content.html.twig @@ -0,0 +1,23 @@ +
    + {{ 'resetting.request.submit'|trans({}, 'FOSUserBundle') }} +
    + +
    +
    +
    + {% if invalid_username is defined %} +

    {{ 'resetting.request.invalid_username'|trans({'%username%': invalid_username}, 'FOSUserBundle') }}

    + {% endif %} + + +
    + +
    + +
    +
    +
    + diff --git a/src/Chamilo/UserBundle/Resources/views/Resetting/reset.html.twig b/src/Chamilo/UserBundle/Resources/views/Resetting/reset.html.twig new file mode 100644 index 000000000..266f8b875 --- /dev/null +++ b/src/Chamilo/UserBundle/Resources/views/Resetting/reset.html.twig @@ -0,0 +1,5 @@ +{% extends "FOSUserBundle::layout.html.twig" %} + +{% block fos_user_content %} + {% include "FOSUserBundle:Resetting:reset_content.html.twig" %} +{% endblock fos_user_content %} diff --git a/src/Chamilo/UserBundle/Resources/views/Resetting/reset_content.html.twig b/src/Chamilo/UserBundle/Resources/views/Resetting/reset_content.html.twig new file mode 100644 index 000000000..9d0abed7c --- /dev/null +++ b/src/Chamilo/UserBundle/Resources/views/Resetting/reset_content.html.twig @@ -0,0 +1,8 @@ +
    + {{ form_widget(form) }} +
    + +
    +
    diff --git a/src/Chamilo/UserBundle/Resources/views/Security/base_login.html.twig b/src/Chamilo/UserBundle/Resources/views/Security/base_login.html.twig new file mode 100644 index 000000000..9545c5d58 --- /dev/null +++ b/src/Chamilo/UserBundle/Resources/views/Security/base_login.html.twig @@ -0,0 +1,95 @@ +{% extends "@ChamiloUser/layout.html.twig" %} + +{% block fos_user_content %} +
    +
    + {% block sonata_user_login %} + + {% endblock %} +
    +
    + {% block sonata_user_registration %} + {% render controller("SonataUserBundle:RegistrationFOSUser1:register") %} + {% endblock %} +
    +
    +{% endblock fos_user_content %} diff --git a/src/Chamilo/UserBundle/Resources/views/Security/login.html.twig b/src/Chamilo/UserBundle/Resources/views/Security/login.html.twig new file mode 100644 index 000000000..d9a9da969 --- /dev/null +++ b/src/Chamilo/UserBundle/Resources/views/Security/login.html.twig @@ -0,0 +1,61 @@ +{% extends "@ChamiloUser/layout.html.twig" %} + +{% block fos_user_content %} + {% block sonata_user_login %} + {% block sonata_user_login_error %} + {% if error %} +
    {{ error|trans({}, 'FOSUserBundle') }}
    + {% endif %} + {% endblock %} + + {% endblock %} + +{% endblock fos_user_content %} diff --git a/src/Chamilo/UserBundle/Resources/views/layout.html.twig b/src/Chamilo/UserBundle/Resources/views/layout.html.twig new file mode 100644 index 000000000..83e43586c --- /dev/null +++ b/src/Chamilo/UserBundle/Resources/views/layout.html.twig @@ -0,0 +1,6 @@ +{% extends '@ChamiloTheme/Layout/login-layout.html.twig' %} + +{% block page_content %} + {% block fos_user_content %} + {% endblock %} +{% endblock %} diff --git a/src/Chamilo/UserBundle/Security/Encoder.php b/src/Chamilo/UserBundle/Security/Encoder.php new file mode 100644 index 000000000..fe4409e20 --- /dev/null +++ b/src/Chamilo/UserBundle/Security/Encoder.php @@ -0,0 +1,72 @@ +method = $method; + switch ($this->method) { + case 'none': + $defaultEncoder = new PlaintextPasswordEncoder(); + break; + case 'bcrypt': + $defaultEncoder = new BCryptPasswordEncoder(4); + break; + case 'sha1': + case 'md5': + $defaultEncoder = new MessageDigestPasswordEncoder($this->method, false, 1); + break; + } + $this->defaultEncoder = $defaultEncoder; + } + + /** + * @param string $raw + * @param string $salt + * + * @return string + */ + public function encodePassword($raw, $salt) + { + if ($this->method === 'bcrypt') { + $salt = null; + } + + return $this->defaultEncoder->encodePassword($raw, $salt); + } + + /** + * @param string $encoded + * @param string $raw + * @param string $salt + * + * @return bool + */ + public function isPasswordValid($encoded, $raw, $salt) + { + if ($this->method === 'bcrypt') { + $salt = null; + } + + return $this->defaultEncoder->isPasswordValid($encoded, $raw, $salt); + } +}