소스 검색

2018-04-22

Visman 7 년 전
부모
커밋
bc04fc1640
3개의 변경된 파일97개의 추가작업 그리고 2개의 파일을 삭제
  1. 87 1
      app/Models/Pages/Admin/Users.php
  2. 1 1
      app/lang/Russian/admin_users.po
  3. 9 0
      app/templates/admin/users_result.forkbb.php

+ 87 - 1
app/Models/Pages/Admin/Users.php

@@ -98,8 +98,16 @@ class Users extends Admin
             return $this->c->Message->message('Bad request');
             return $this->c->Message->message('Bad request');
         }
         }
 
 
+        $startNum = ($page - 1) * $this->c->config->o_disp_users;
+        $ids      = \array_slice($ids, $this->startNum, $this->c->config->o_disp_users);
+        $userList = $this->c->users->load($ids);
 
 
-        exit(var_dump($ids, $order, $filters));
+        $this->nameTpl    = 'admin/users_result';
+        $this->aIndex     = 'users';
+        $this->titles     = \ForkBB\__('Users');
+        $this->formResult = $this->formUsers($userList, $startNum);
+
+        return $this;
     }
     }
 
 
     /**
     /**
@@ -469,4 +477,82 @@ class Users extends Admin
 
 
         return $form;
         return $form;
     }
     }
+
+    /**
+     * Создает массив данных для формы найденных по фильтру пользователей
+     *
+     * @param array $users
+     * @param int $number
+     *
+     * @return array
+     */
+    protected function formUsers(array $users, $number)
+    {
+        $form = [
+            'action' => $this->c->Router->link(''),
+            'hidden' => [
+                'token' => $this->c->Csrf->create(''),
+            ],
+            'sets'   => [],
+            'btns'   => [
+                'find1' => [
+                    'type'      => 'submit',
+                    'value'     => \ForkBB\__('???'),
+                    'accesskey' => 's',
+                ],
+            ],
+        ];
+
+        foreach ($users as $user) {
+            ++$number;
+            $fields = [];
+
+            $fields["l{$number}-username"] = [
+#                'class'   => 'pline',
+                'type'    => 'link',
+                'caption' => \ForkBB\__('Results username head'),
+                'value'   => $user->username,
+                'href'    => $user->link,
+#                'title'   => \ForkBB\__('Show posts'),
+            ];
+            $fields["l{$number}-email"] = [
+#                'class'   => 'pline',
+                'type'    => 'link',
+                'caption' => \ForkBB\__('Results e-mail head'),
+                'value'   => $user->email,
+                'href'    => 'mailto:' . $user->email,
+#                'title'   => \ForkBB\__('Show posts'),
+            ];
+            $fields["l{$number}-title"] = [
+#                'class'   => 'pline',
+                'type'    => 'str',
+                'caption' => \ForkBB\__('Results title head'),
+                'value'   => $user->title(),
+            ];
+            $fields["l{$number}-posts"] = [
+#                'class'   => 'pline',
+                'type'    => $user->num_posts ? 'link' : 'str',
+                'caption' => \ForkBB\__('Results posts head'),
+                'value'   => \ForkBB\num($user->num_posts),
+                'href'    => $this->c->Router->link('SearchAction', ['action' => 'posts', 'uid' => $user->id]),
+                'title'   => \ForkBB\__('Results show posts link'),
+            ];
+            $fields["l{$number}-note"] = [
+#                'class'   => 'pline',
+                'type'    => 'str',
+                'caption' => \ForkBB\__('Примечание админа'),
+                'value'   => $user->admin_note,
+            ];
+
+
+
+
+            $form['sets']["l{$number}"] = [
+                'legend' => $number,
+                'fields' => $fields,
+            ];
+        }
+
+        return $form;
+    }
 }
 }

+ 1 - 1
app/lang/Russian/admin_users.po

@@ -316,7 +316,7 @@ msgid "Results view IP link"
 msgstr "IP статистика"
 msgstr "IP статистика"
 
 
 msgid "Results show posts link"
 msgid "Results show posts link"
-msgstr "Сообщения"
+msgstr "Показать сообщения"
 
 
 msgid "Results guest"
 msgid "Results guest"
 msgstr "Гость"
 msgstr "Гость"

+ 9 - 0
app/templates/admin/users_result.forkbb.php

@@ -0,0 +1,9 @@
+@extends ('layouts/admin')
+      <section class="f-admin f-search-user-form">
+        <h2>{!! __('User search head') !!}</h2>
+        <div class="f-fdiv">
+@if ($form = $p->formResult)
+  @include ('layouts/form')
+@endif
+        </div>
+      </section>