Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 19 |
ChecklistController | |
0.00% |
0 / 1 |
|
0.00% |
0 / 2 |
30 | |
0.00% |
0 / 19 |
getAccessRules | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 5 |
|||
actionCheckItem | |
0.00% |
0 / 1 |
20 | |
0.00% |
0 / 14 |
<?php | |
namespace humhub\modules\tasks\controllers; | |
use humhub\modules\content\components\ContentContainerControllerAccess; | |
use humhub\modules\space\models\Space; | |
use humhub\modules\tasks\models\checklist\CheckForm; | |
use humhub\modules\tasks\permissions\ManageTasks; | |
use Yii; | |
class ChecklistController extends AbstractTaskController | |
{ | |
public function getAccessRules() | |
{ | |
return [ | |
[ContentContainerControllerAccess::RULE_USER_GROUP_ONLY => [Space::USERGROUP_MEMBER]] | |
]; | |
} | |
public function actionCheckItem($id, $taskId) | |
{ | |
$model = new CheckForm(['itemId' => $id, 'taskId' => $taskId]); | |
if($model->load(Yii::$app->request->post()) && $model->save()) { | |
return $this->asJson([ | |
'success' => true, | |
'item' => [ | |
'checked' => $model->checked, | |
'statusChanged' => $model->statusChanged, | |
'sortOrder' => $model->item->sort_order | |
] | |
]); | |
} | |
return $this->asJson(['success' => false, 'message' => ($model->hasErrors()) ? $model->getFirstErrors() : '']); | |
} | |
} |