Revize ad5ad0be
Přidáno uživatelem Tomáš Pašek před více než 3 roky(ů)
application/view/contents/userContent.php | ||
---|---|---|
1 | 1 |
<?php |
2 | 2 |
if (isset($_SESSION['role']) && $_SESSION['role'] == "admin") { |
3 |
$loggedUserId = $_SESSION['id']; |
|
3 | 4 |
echo "<script> |
4 | 5 |
//what to do when page renders |
5 | 6 |
window.onload = function() { |
... | ... | |
42 | 43 |
result += \"<tr>\"; |
43 | 44 |
result += \"<td>\" + item.username + \"</td>\"; |
44 | 45 |
result += \"<td>\" + item.role + \"</td>\"; |
45 |
(item.role !== \"admin\") ? (result += \"<td class='action-td'>\" + |
|
46 |
|
|
47 |
if (item['id'] != \"$loggedUserId\") { |
|
48 |
result += \"<td class='action-td'>\" + |
|
46 | 49 |
\"<button class='btn ml-1' title='Upravit' data-toggle='modal' data-target='#edit-modal' data-pseudo-id='\" + id + \"' data-title='Upravit uživatele'><i class='fa fa-pencil'></i></button>\" + |
47 | 50 |
\"<button class='btn ml-1' title='Odstranit' data-toggle='modal' data-target='#remove-modal' data-pseudo-id='\" + id + \"'><i class='fa fa-trash'></i></button>\" + |
48 |
\"</td>\") : result += \"<td class='action-td'/>\"; |
|
51 |
\"</td>\"} else {result += \"<td></td>\"} |
|
52 |
|
|
53 |
|
|
49 | 54 |
result += \"</tr>\"; |
50 | 55 |
}); |
51 | 56 |
document.getElementById(\"search-table\").innerHTML = result; |
Také k dispozici: Unified diff
Enhancement #8757 Refactoring, server-side