Skip to content
Snippets Groups Projects
Commit 04f6eaf2 authored by PavelBegunkov's avatar PavelBegunkov
Browse files

Log page fixes (see below)

fix `loadAll` function case
fix incorrect html tags
add missing css
eliminate unused & dead code
correct codestyle
parent ae6dd9ee
Branches
Tags
No related merge requests found
table.equal-width-cols td {
padding: 5px;
}
......@@ -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
}
......@@ -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
}
......@@ -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 %}
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