idci / simple-schedule-bundle
Symfony SimpleScheduleBundle
Requires
- php: >=5.3.2
- doctrine/doctrine-bundle: *
- pagerfanta/pagerfanta: dev-master
- symfony/framework-bundle: 2.1.*
- twig/twig: *
- white-october/pagerfanta-bundle: dev-master
Suggests
- idci/exporter-bundle: dev-master
This package is auto-updated.
Last update: 2024-09-24 20:13:04 UTC
README
一个简单的Symfony2调度组件
安装
要安装此组件,请按照以下步骤操作
首先,将依赖项添加到您的composer.json
文件中
"require": { ... "pagerfanta/pagerfanta": "dev-master", "white-october/pagerfanta-bundle": "dev-master", "idci/exporter-bundle": "dev-master", "idci/simple-schedule-bundle": "dev-master" },
然后,使用以下命令安装组件
php composer update
在您的应用程序内核中启用组件
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(), new IDCI\Bundle\ExporterBundle\IDCIExporterBundle(), new IDCI\Bundle\SimpleScheduleBundle\IDCISimpleScheduleBundle(), ); }
现在组件已安装。
在app/config/parameters.yml
中配置您的数据库参数,然后运行
php app/console doctrine:schema:update --force
在routing.yml
中添加以下行
idci_simple_schedule: resource: "../../vendor/idci/simple-schedule-bundle/IDCI/Bundle/SimpleScheduleBundle/Controller" type: annotation prefix: /admin
在config.yml
中添加以下行
twig: form: resources: - 'IDCISimpleScheduleBundle:Form:duration_widget.html.twig'
管理区域
此组件提供了一个管理区域,以便快速使用。如果您想使用它,只需将浏览器指向/admin/schedule
。为了分页元素列表,此组件使用知名的WhiteOctoberPagerfantaBundle。您需要按照以下方式在您的app/config/parameter.yml
文件中配置max_per_page
参数
parameters: ... # Pager Fanta max_per_page: 20
为了保护此区域,您需要按照Symfony2文档中描述的方式编辑app/config/security.yml
。虽然这不是测试所必需的,但作为生产环境设置,强烈推荐。
以下是一个简单的但有效的配置示例,它使用基本内存用户安全模型
security: encoders: Symfony\Component\Security\Core\User\User: plaintext role_hierarchy: ROLE_ADMIN: ROLE_USER ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH] providers: in_memory: memory: users: admin: { password: userpass, roles: [ 'ROLE_ADMIN' ] } firewalls: dev: pattern: ^/(_(profiler|wdt)|css|images|js)/ security: false secured_area: pattern: ^/admin/ anonymous: ~ http_basic: realm: "Secured Admin Area" access_control: - { path: ^/admin, roles: ROLE_ADMIN }
Web服务(REST)
此组件可以通过Web API使用。
为此,您需要安装IDCIExporterBundle并在config.yml
中添加以下行
imports: ... - { resource: @IDCISimpleScheduleBundle/Resources/config/config.yml }
要查询此API,请使用以下URL /api/query?[params]
主要参数包括
- format: xml(默认),json,jsonp,csv,ics(用于事件实体)
- entity: Event(默认),Location,Category
示例
要以JSON格式查询所有位置:/api/query?entity=Location&format=json
要以ics格式查询所有事件:/api/query?entity=Event&format=ics
要以xml格式查询所有分类:/api/query?entity=Category&format=xml
或/api/query?entity=Category
您还可以为每个实体使用更具体的查询参数,如下所示
位置
- id => id=x
- ids => ids[]=x&ids[]=y
分类
- id => id=x
- ids => ids[]=x&ids[]=y
- level => level=0
- parent_category_id
- parent_category_ids
- ancestor_category_id
- ancestor_category_ids
- location_id
- all_in_location_id
事件
- id => id=x
- ids => ids[]=x&ids[]=y
- category_id
- category_ids
- parent_category_id
- parent_category_ids
- ancestor_category_id
- ancestor_category_ids
- location_id
- location_ids
待办 ~ TER ;)
- xproperty_namespace
- xproperty_key
- xproperty_value
待办事项
- 如何覆盖此组件