kemcake-wanted33/cakephp-gamification

CakePHP 插件,用于轻松添加游戏化功能

dev-master 2014-05-15 12:16 UTC

This package is not auto-updated.

Last update: 2020-01-06 08:47:24 UTC


README

CakePHP 插件,用于轻松添加游戏化功能

要求

  • PHP5
  • CakePHP >= 2.2.5
  • 最低PHP技能水平

安装

此存储库应与其他插件一样安装。

cd somefolder/app/Plugin
git clone git://github.com/kemcake/cakephp-gamification.git Gamification

您需要在您的 app/Config/bootstrap.php 文件中启用插件

CakePlugin::load('Gamification');

如果您已经使用了 CakePlugin::loadAll();,则此步骤不是必需的。

您还可以在 Packagist 上找到此插件: https://packagist.org.cn/packages/kemcake-wanted33/cakephp-gamification

数据库

我们正在努力改进,但截至目前,您需要自己创建插件表。

请遵循以下模型

如果您使用迁移插件,可以在 Gamification/Migrations 中找到文件

使用

只需将其添加到您希望具有 gamificable 功能的每个模型中。

目前支持 添加 / 编辑 / 删除 操作

// app/Model/SampleModel.php
  class SampleModel extends AppModel {
  
	public $actsAs = array(
	    'Gamification.Gamificable' => array(
            'rules' => array(
            	array(
            		'action' => 'Add',
            		'points' => 20,
            		'occurence' => 1
            	),
            	array(
            		'action' => 'Edit',
            		'points' => 10,
            		'occurence' => 1
            	),
            	array(
            		'action' => 'Delete',
            		'points' => 5,
            		'occurence' => 1
            	)
            )
	    )
    );
    
    // Whatever your class do
  }

作者

Rémi Santos (KemCake)

Quentin Rubini (Wanted33)