kijho / kijho-help-desk
1.0.1
2017-07-12 19:27 UTC
Requires
- php: >=5.3.9
- doctrine/doctrine-bundle: ~1.4
- doctrine/orm: ^2.4.8
- symfony/swiftmailer-bundle: ~2.3
- symfony/symfony: 2.8.*|^3.0
This package is auto-updated.
Last update: 2024-08-29 05:07:24 UTC
README
kijho-help-desk
为 Symfony 2.8 和 3.x 开发的 Bundle,用于管理客户支持票务
演示应用
安装
在项目控制台中执行
composer require kijho/kijho-help-desk 1.0.0
在 AppKernel.php 文件中注册 bundle
$bundles = array( ... new Kijho\HelpDeskBundle\HelpDeskBundle(), );
在项目控制台中执行
php bin/console d:s:u --force
php bin/console assets:install
在 config.yml 文件中编辑 ticket bundle 的用户提供商
# bin/config.yml help_desk: client_provider: 'Acme\DemoBundle\Entity\YourClient' operator_provider: 'Acme\DemoBundle\Entity\YourOperator'
在你的用户提供商实体中,必须实现以下接口
use Kijho\HelpDeskBundle\Model\UserInterface as HelpDeskUserInterface; /** * @ORM\Table() * @ORM\Entity */ class YourClient implements HelpDeskUserInterface { }
use Kijho\HelpDeskBundle\Model\UserInterface as HelpDeskUserInterface; /** * @ORM\Table() * @ORM\Entity */ class YourOperator implements HelpDeskUserInterface { }
实现上述接口时,需要实现以下函数
/** * Returns client or operator identifier * @return string */ public function getId(); /** * Returns client or operator name * @return string */ public function getName(); /** * Return client or operator email * @return string */ public function getEmail(); /** * Return boolean if the user is an allowed Ticket Operator * @return boolean */ public function getIsTicketOperator();
注意: 可以使用同一个实体作为客户和操作员的用户提供商。
操作员是负责处理客户发送的支持票务的人员,为此 getIsTicketOperator() 函数必须返回 true,或者返回实体中的布尔变量,以确定哪些管理员可以处理支持票务。
在 twig 的全局变量中启用 "ticket_provider" 服务,在 config.yml 文件中
# bin/config.yml # Twig Configuration twig: globals: ticket_provider: @ticket_provider
请确保已配置语言
# bin/config.yml parameters: locale: es framework: #esi: ~ translator: { fallbacks: ["%locale%"] }
在 routing.yml 文件中配置支持 bundle 的路由
# bin/routing.yml help_desk_clients: resource: "@HelpDeskBundle/Resources/config/routing/client.yml" prefix: /help-desk-client help_desk_operator: resource: "@HelpDeskBundle/Resources/config/routing/operator.yml" prefix: /help-desk-operator
在 security.yml 文件中配置你的访问控制规则
access_control: - { path: '^/help-desk-client/*', roles: YOUR_CLIENT_ROLE } - { path: '^/help-desk-operator/*', roles: YOUR_ADMIN_ROLE }
要访问客户菜单,在任何模板中创建以下路径的链接
href="{{path('help_desk_client_tickets',{'status':'all'})}}"
要访问操作员菜单,在任何模板中创建以下路径的链接
href="{{path('help_desk_operator_tickets',{'status':'all'})}}"
注意: 你可以修改链接以在 iframe、新窗口或你希望的方式中打开模块。
从你的 Twig 模板中,你可以访问不同的函数来获取有关支持票务的信息
对于客户
{# Número total de tickets del cliente #} {{ ticket_provider.getCountClientTickets(app.user.id) }} {# Número de tickets activos del cliente #} {{ticket_provider.getCountClientTickets(app.user.id, 'active')}} {# Número de tickets cerrados del cliente #} {{ticket_provider.getCountClientTickets(app.user.id, 'closed')}}
对于管理员
{# Número total de tickets #} {{ticket_provider.getCountTickets()}} {# Número de tickets activos #} {{ticket_provider.getCountTickets('active')}} {# Número de tickets cerrados #} {{ticket_provider.getCountTickets('closed')}}
支持票务类别和邮件通知: 为了让客户能够创建支持票务,数据库中至少需要存在一个票务类别。这些类别由操作员在其各自的模块中管理,因此一旦配置完成,请确保创建你的票务类别,并放置邮件通知的目的邮箱。