Fix redmine search

parent 2d5f1eca
...@@ -52,9 +52,20 @@ class SupportController extends Controller ...@@ -52,9 +52,20 @@ class SupportController extends Controller
$user = $client->user->getCurrentUser(); $user = $client->user->getCurrentUser();
$models = $client->issue->all([ $params = [
'author_id' => $user['user']['id'], 'author_id' => $user['user']['id'],
]); ];
if(Yii::$app->request->get('s'))
{
$params = ArrayHelper::merge($params, [
'f[]' => 'subject',
'op[subject]' => '~',
'v[subject][]' => Yii::$app->request->get('s'),
]);
}
$models = $client->issue->all($params);
return $this->render('index', [ return $this->render('index', [
'models' => $models, 'models' => $models,
......
...@@ -6,46 +6,50 @@ use common\models\Settings; ...@@ -6,46 +6,50 @@ use common\models\Settings;
class IssueHelper class IssueHelper
{ {
public static function sort($issues) public static function sort($issues = null)
{ {
if($issues)
$settings = [
[
'statuses' => explode(',', Settings::getValue('support-status-work')),
'title' => 'Задачи в работе',
],
[
'statuses' => explode(',', Settings::getValue('support-status-new')),
'title' => 'Задачи на оценке',
],
[
'statuses' => explode(',', Settings::getValue('support-status-test')),
'title' => 'Задачи на тестировании',
],
[
'statuses' => explode(',', Settings::getValue('support-status-approve')),
'title' => 'Задачи ожидающие проверки',
],
[
'statuses' => explode(',', Settings::getValue('support-status-accepted')),
'title' => 'Закрытые задачи',
'close' => true
],
];
foreach ($issues as $issue)
{ {
foreach ($settings as &$setting) $settings = [
[
'statuses' => explode(',', Settings::getValue('support-status-work')),
'title' => 'Задачи в работе',
],
[
'statuses' => explode(',', Settings::getValue('support-status-new')),
'title' => 'Задачи на оценке',
],
[
'statuses' => explode(',', Settings::getValue('support-status-test')),
'title' => 'Задачи на тестировании',
],
[
'statuses' => explode(',', Settings::getValue('support-status-approve')),
'title' => 'Задачи ожидающие проверки',
],
[
'statuses' => explode(',', Settings::getValue('support-status-accepted')),
'title' => 'Закрытые задачи',
'close' => true
],
];
foreach ($issues as $issue)
{ {
if(in_array($issue['status']['id'], $setting['statuses'])) foreach ($settings as &$setting)
{ {
$setting['models'][] = $issue; if(in_array($issue['status']['id'], $setting['statuses']))
{
$setting['models'][] = $issue;
}
} }
} }
}
unset($setting); unset($setting);
return $settings;
}
return $settings; return null;
} }
} }
\ No newline at end of file
...@@ -64,17 +64,18 @@ use common\modules\support\models\redmine\IssueHelper; ...@@ -64,17 +64,18 @@ use common\modules\support\models\redmine\IssueHelper;
<td class="no_pad"> <td class="no_pad">
<?php <?php
$issues = IssueHelper::sort($models['issues']); if($issues = IssueHelper::sort($models['issues']))
foreach ($issues as $issue)
{ {
if(!isset($issue['close'])) foreach ($issues as $issue)
{
echo $this->render('_loop', ['output' => $issue['models'], 'title' => $issue['title']]);
}
else
{ {
$accepteds = $issue['models']; if(!isset($issue['close']))
{
echo $this->render('_loop', ['output' => $issue['models'], 'title' => $issue['title']]);
}
else
{
$accepteds = $issue['models'];
}
} }
} }
?> ?>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment