suhaboncukcu / assign-task
此包的最新版本(v1.0.0)没有可用的许可证信息。
CakePHP的AssignTask插件
v1.0.0
2016-11-03 15:50 UTC
Requires
- php: >=5.5.9
- cakephp/cakephp: >=3.3.2 <4.0.0
Requires (Dev)
This package is not auto-updated.
Last update: 2024-09-23 13:16:22 UTC
README
安装
需要插件;
composer require suhaboncukcu/assign-task:dev-master
加载插件;
Plugin::load('AssignTask', ['bootstrap' => true, 'routes' => true]);
在配置文件夹中创建missions.php文件;
//you can find an example in vendor/AssignTask/config/missions.sample.config //in your bootstrap.php: Configure::write('Missions.config', ['missions']);
注意 检查迁移文件,看from_id和to_id类型是否适合您。如果您的用户表使用非整数值作为id,您应该检查它们的类型。
bin/cake migrations migrate -p AssignTask
示例
$this->loadModel('AssignTask.Missions'); //create new mission $mission = $this->Missions->newEntity(); $data = [ 'to_id' => 1, 'from_id'=> 2, 'mission' => 'please send mail to customers', 'schedule' => '2016-12-12 10:00' ]; $this->Missions->patchEntity($mission, $data); $this->Missions->save($mission); //assign existing mission to someone else $mission = $this->Missions->get(1); $mission->to_id = 3; //can change from id too. If somebody else this that assignment. //for example, in this assignment user with id 3 assigns this mission to //himself/herself $mission->from_id = 3; $this->Missions->assignTo($mission); //complete an existing issue $mission = $this->Missions->get(5); $this->Missions->complete($mission); // list all uncompleted tasks including reassigned ones $missions = $this->Missions->find('Uncompleted'); // list all completed tasks including reassigned ones $missions = $this->Missions->find('Completed'); // list all uncompleted tasks including reassigned ones // passed the due date $missions = $this->Missions->find('UncompletedPassed'); // list all tasks without reassigned ones // so this is what you need to show current uncompleted tasks $missions = $this->Missions->find('WOReassigned'); // list all tasks // while getting their parent tasks. So you can check // which task this was. $missions = $this->Missions ->find('Parents'); // list all tasks // while getting their child tasks. So you can check // which task reassigned again. $missions = $this->Missions ->find('Children'); // of course, you can use different finders together $missions = $this->Missions ->find('Uncompleted') ->find('WOReassigned') ->find('Parents') ->find('Children');