From 04f6eaf2f043d16b73c43e6fc74140635bf3bdd2 Mon Sep 17 00:00:00 2001 From: PavelBegunkov <asml.silence@gmail.com> Date: Wed, 13 Jul 2016 19:16:32 +0300 Subject: [PATCH] Log page fixes (see below) fix `loadAll` function case fix incorrect html tags add missing css eliminate unused & dead code correct codestyle --- media/css/logs.css | 3 ++ .../classes/Controller/Office/Logs.php | 15 ++----- .../application/classes/Model/Logs.php | 44 +++++-------------- .../application/views/office/logs.twig | 37 +++++++--------- 4 files changed, 33 insertions(+), 66 deletions(-) create mode 100644 media/css/logs.css diff --git a/media/css/logs.css b/media/css/logs.css new file mode 100644 index 000000000..088e14f20 --- /dev/null +++ b/media/css/logs.css @@ -0,0 +1,3 @@ +table.equal-width-cols td { + padding: 5px; +} diff --git a/~dev_rating/application/classes/Controller/Office/Logs.php b/~dev_rating/application/classes/Controller/Office/Logs.php index 1f686e57f..5d1594428 100644 --- a/~dev_rating/application/classes/Controller/Office/Logs.php +++ b/~dev_rating/application/classes/Controller/Office/Logs.php @@ -2,17 +2,10 @@ class Controller_Office_Logs extends Controller_Environment_Office { - public function action_index() { - Cookie::set('fD', 'true'); - + public function action_index() + { $this->twig->set([ - // 'Faculties' => $this->user->isAdmin() ? Model_Faculties::load() : [], - // 'GradesList' => Model_Grades::loadAll(), - - 'Logs' =>Model_Logs::LoadAll(), + 'Logs' => Model_Logs::loadAll(), ])->set_filename(static::OFFICE . 'logs'); } - - - -} \ No newline at end of file +} diff --git a/~dev_rating/application/classes/Model/Logs.php b/~dev_rating/application/classes/Model/Logs.php index b44864795..9efdb42f0 100644 --- a/~dev_rating/application/classes/Model/Logs.php +++ b/~dev_rating/application/classes/Model/Logs.php @@ -3,51 +3,27 @@ /** * Class Model_Semesters * - * @property int ID - * @property int Num - * @property int Year + * @property int ID + * @property int Num + * @property int Year * @property string Season */ class Model_Logs extends Model { -public static function loadAll() { - $res = DB::query(Database::SELECT, " + public static function loadAll() + { + return DB::query(Database::SELECT, " SELECT logs_signin.ID, logs_signin.AccountID, logs_signin.Date, teachers.LastName, teachers.FirstName, teachers.SecondName - - FROM `logs_signin` JOIN `teachers` ON logs_signin.AccountID = teachers.AccountID - - - ORDER BY logs_signin.Date DESC LIMIT 50")->execute()->as_array(); - - $list = []; - $i=0; - foreach ($res as $log) - { - // $list[$log['ID']] = new self($log); - $list[$i] = new self($log); - - $i++; - - } - return $res; + FROM `logs_signin` JOIN `teachers` ON logs_signin.AccountID = teachers.AccountID + ORDER BY logs_signin.Date DESC LIMIT 50" + )->execute()->as_array(); } - - - - - - - - - - - -} \ No newline at end of file +} diff --git a/~dev_rating/application/views/office/logs.twig b/~dev_rating/application/views/office/logs.twig index 4d8745ec1..c40aa5e03 100644 --- a/~dev_rating/application/views/office/logs.twig +++ b/~dev_rating/application/views/office/logs.twig @@ -5,30 +5,25 @@ {% block office_content %} - {{ HTML.style('static/css/logs.css')|raw }} + {{ HTML.style('static/css/logs.css')|raw }} <h2 class="Margin10 Bottom">Рстория авторизаций</h2> -<table class="equal-width-cols"> -<tbody> + <table class="equal-width-cols" cellpadding="20"> -<tr class="TableHead"> - <td>Дата Рё время</td> - <td>Фамилия РРјСЏ Отчество</td> - <td>AccoundID</td> -</tr> + <tr class="TableHead"> + <td>Дата Рё время</td> + <td>Р¤РРћ</td> + <td>AccoundID</td> + </tr> - {% for Log in Logs %} - <tr> - - <td>{{ Log.Date }}</td> - <td>{{ Log.LastName }} {{Log.FirstName}} {{Log.SecondName}}</td> - <td>{{ Log.AccountID}}</td> + {% for Log in Logs %} + <tr> + <td>{{ Log.Date }}</td> + <td>{{ Log.LastName }} {{ Log.FirstName }} {{ Log.SecondName }}</td> + <td>{{ Log.AccountID }}</td> + </tr> + {% endfor %} - </tr> - - {% endfor %} - -</table> -</tbody> - {% endblock %} \ No newline at end of file + </table> +{% endblock %} -- GitLab