kitpages/activity-bundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

kitpages/activity-bundle

Composer 安装命令:

composer require kitpages/activity-bundle

包简介

Manages activities

README 文档

README

Build Status

SensioLabsInsight

Records activity of a website and display notifications on some pages.

Mostly used for rapid prototyping.

Quick Start

Create an activity

$this->get("kitpages_activity.activity_manager")->createActivity(
    "my_category",
    "my title",
    "my message content",
    "my url", //optionnal
    "my reference", //optionnal
    array("key1" => "val1", ), //optionnal
);

Display a list of activities in a twig template

{{ render(controller('KitpagesActivityBundle:Activity:list', {
    'request': app.request, // mandatory
    'filterList': { "category": "my_category" }, // optionnal
} ) ) }}

get activities in PHP

$activityManager = $this->get("kitpages_activity.activity_manager");
$activityList = $activityManager->getActivityList( array(
    "category" => "my category"
) );

Features :

  • record activities
  • attach activities to an object using reference
  • attach activities to categories
  • easy to display activities with a paginator and a full text filter
  • filter activities by category, title, message, reference
  • you can sort activities

Installation

Using Composer, just $ composer require kitpages/activity-bundle package or:

{
  "require": {
    "kitpages/activity-bundle": "~1.0"
  }
}

Then add the bundle in AppKernel :

    public function registerBundles()
    {
        $bundles = array(
            // ...
            new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
            new Kitpages\ActivityBundle\KitpagesActivityBundle(),
            new Kitpages\DataGridBundle\KitpagesDataGridBundle(),
        );
    }

Display a list of activities in a twig template

{{ render(controller('KitpagesActivityBundle:Activity:list', {
    'request': app.request, // mandatory
    'filterList': { "category": "my_category" }, // optionnal
    'orderBy': 'id ASC' // optionnal, default to "createdAt DESC"
} ) ) }}

get activity list in PHP

get all activities

$activityManager = $this->get("kitpages_activity.activity_manager");
$activityList = $activityManager->getActivityList();

get activities for a given category

$activityManager = $this->get("kitpages_activity.activity_manager");
$activityList = $activityManager->getActivityList( array(
    "category" => "my category"
) );

get activities for all categories beginning by "payments."

$activityManager = $this->get("kitpages_activity.activity_manager");
$activityList = $activityManager->getActivityList( array(
    "category" => "payment*"
) );

principle of filter

  • You can filter the fields category, title, message, url or reference.
  • You can use "*" at the beginning or the end of your filter as a wildcard (everything with category beginning by "xxx" or ending by "xxx").
  • You can escape the wildcard by using '*'

ordering results

By default activity list is ordered by createdAt DESC. You can specify the order :

$activityManager = $this->get("kitpages_activity.activity_manager");
$activityList = $activityManager->getActivityList(
    array("category" => "payment.*"),
    "id DESC", // sort field : id, reference, category, createdAt
);

Best practices

  • the category field is used for filtering activities by category
  • the reference field is used to represent the object linked to this activity (if there is an object). I imagine references like "company.15.user.23". We can then retrieve activities for the company or this user using wildcard in filters.
  • The data field is used to add every information you would need linked to this activity

note : category is not mandatory in filter list.

Versions

2013-12-18 : v1.0.0

  • first version

2014-11-07 : v2.0.0

  • upgrade to KitpagesDataGrid 2.x
  • filters on activities
  • added reference, and custom data
  • ordering of activity list
  • better unit tests

统计信息

  • 总下载量: 2.59k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 4
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-12-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固