kijho-technologies/kijho-help-desk

dev-master 2016-06-14 14:38 UTC

This package is not auto-updated.

Last update: 2024-09-12 01:40:12 UTC


README

kijho-help-desk

用于Symfony >= 2.8的Bundle,用于管理客户支持票据

演示应用

下载演示应用

安装

要求

    "sensio/distribution-bundle": "~4.0",
    "symfony/swiftmailer-bundle": "~2.3",

在项目控制台中执行

    composer require kijho-technologies/kijho-help-desk dev-master

在AppKernel.php文件中注册此bundle

    $bundles = array(
        ...
        new Kijho\HelpDeskBundle\HelpDeskBundle(),
    );

在项目控制台中执行

    php app/console d:s:u --force
    php app/console assets:install

在config.yml文件中编辑票据bundle的用户提供者

    # app/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,或者返回实体中的布尔变量,以便选择哪些管理员可以处理支持票据。

在config.yml文件的全局变量中启用"ticket_provider"服务

    # app/config.yml
    # Twig Configuration
    twig:
        globals:
            ticket_provider: @ticket_provider

请确保已经配置了语言

    # app/config.yml
    parameters:
        locale: es

    framework:
        #esi:             ~
        translator:      { fallbacks: ["%locale%"] }

在routing.yml文件中配置支持bundle的路由

    # app/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')}}

支持票据类别和邮件通知:为了客户能够创建支持票据,数据库中至少需要存在一个票据类别。这些类别由操作员在其相应模块中管理,因此一旦你完成所有配置,请确保创建你的票据类别并将电子邮件地址设置为接收电子邮件通知。