avoo / qcm-core-bundle
适用于 Symfony2 的 QCM 核心包
1.0.3
2016-09-07 16:09 UTC
Requires
- php: >=5.3.3
- avoo/qcm-components: ~1.0
- beberlei/doctrineextensions: *@dev
- sylius/resource-bundle: 0.11.*@dev
Requires (Dev)
This package is not auto-updated.
Last update: 2024-09-14 16:43:48 UTC
README
该核心包包含基于 SyliusResourceBundle
概念的 qcm 基本功能,并实现了 QcmComponent
安装
将 avoo/qcm-core-bundle
添加到您的 composer.json
文件中
{ "require": { "avoo/qcm-core-bundle": "@dev-master" } }
在 app/AppKernel.php
中注册该包
// app/AppKernel.php public function registerBundles() { return array( // ... new FOS\RestBundle\FOSRestBundle(), new JMS\SerializerBundle\JMSSerializerBundle($this), new Sylius\Bundle\ResourceBundle\SyliusResourceBundle(), new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(), new Qcm\Bundle\CoreBundle\QcmCoreBundle(), ); }
在 app/config.yml
imports: - { resource: parameters.yml } - { resource: security.yml } - { resource: @QcmCoreBundle/Resources/config/core.yml }
安全默认配置
您可以使用默认的注册/登录过程
在 app/config/routing.yml
qcm_core: prefix: / resource: "@QcmCoreBundle/Resources/config/routing.yml"
在 app/config/security.yml
中添加默认用户提供者、防火墙和访问控制
security: encoders: Qcm\Component\User\Model\UserInterface: sha512 providers: qcm_corebundle: id: qcm_core.user_provider.username firewalls: login_firewall: pattern: ^/security/login$ anonymous: ~ secured_area: pattern: ^/ anonymous: ~ form_login: provider: qcm_corebundle login_path: qcm_core_security_login check_path: qcm_core_security_login_check remember_me: true default_target_path: you_homepage_route logout: path: qcm_core_security_logout access_control: - { path: "^/security/login", roles: IS_AUTHENTICATED_ANONYMOUSLY } - { path: "^/", roles: ROLE_USER }
QCM 配置
您可以在 app/config/config.yml
中覆盖默认问卷调查配置
qcm_core: website_name: Qcm Demo // The website name configuration: max_questions: 40 //Questions number max by questionnaire question_level: ["beginner", "senior", "jedi"] //Determine the level for each question answers_max: 5 //Number of answers max by question timeout: 2400 //Total time of the questionnaire (in seconds) time_per_question: 60 //Time per question, if you choose this value, the timeout will be disabled
覆盖服务
对于统计类
qcm_core: service: statistics: class: MyBundle\Statistics\Class // For better compatibility extends the Model\QuestionnaireStatistics template: MyBundle\Answers\Template\Class // You need to implements the qcm TemplateInterface
致谢
- Jérémy Jégou jejeavo@gmail.com
许可证
本包在 MIT 许可证下发布。请参阅包中的完整许可证