Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 25 |
SearchController | |
0.00% |
0 / 1 |
|
0.00% |
0 / 4 |
20 | |
0.00% |
0 / 25 |
getAccessRules | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 5 |
|||
actionIndex | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 7 |
|||
actionFilterTasks | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 8 |
|||
actionJson | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 5 |
<?php | |
/** | |
* @link https://www.humhub.org/ | |
* @copyright Copyright (c) 2018 HumHub GmbH & Co. KG | |
* @license https://www.humhub.com/licences | |
* | |
*/ | |
namespace humhub\modules\tasks\controllers; | |
use humhub\modules\content\components\ContentContainerController; | |
use humhub\modules\content\components\ContentContainerControllerAccess; | |
use humhub\modules\space\models\Space; | |
use humhub\modules\tasks\models\forms\TaskFilter; | |
use humhub\modules\tasks\permissions\ManageTasks; | |
use humhub\modules\tasks\widgets\search\TaskSearchList; | |
use humhub\modules\tasks\widgets\TaskPicker; | |
use Yii; | |
use yii\web\Controller; | |
/** | |
* todo. | |
* Search Controller provides action for searching tasks. | |
* | |
* @author davidborn | |
*/ | |
class SearchController extends AbstractTaskController | |
{ | |
public function getAccessRules() | |
{ | |
return [ | |
[ContentContainerControllerAccess::RULE_USER_GROUP_ONLY => [Space::USERGROUP_MEMBER]] | |
]; | |
} | |
public function actionIndex() | |
{ | |
return $this->render("index", [ | |
'canEdit' =>$this->canManageTasks(), | |
'contentContainer' => $this->contentContainer, | |
'filter' => new TaskFilter(['contentContainer' => $this->contentContainer, 'filters' => [TaskFilter::FILTER_ASSIGNED]]) | |
]); | |
} | |
public function actionFilterTasks() | |
{ | |
$filter = new TaskFilter(['contentContainer' => $this->contentContainer]); | |
$filter->load(Yii::$app->request->post()); | |
return $this->asJson([ | |
'success' => true, | |
'output' => TaskSearchList::widget(['filter' => $filter, 'canEdit' => $this->canManageTasks()]) | |
]); | |
} | |
/** | |
* JSON Search for Users | |
* | |
* Returns an array of users with fields: | |
* - guid | |
* - displayName | |
* - image | |
* - profile link | |
*/ | |
public function actionJson() | |
{ | |
return $this->asJson(TaskPicker::filter([ | |
'keyword' => Yii::$app->request->get('keyword'), | |
])); | |
} | |
} | |