Code Duplication    Length = 49-67 lines in 4 locations

examples/Metrica/Management/accounts.php 1 location

@@ 57-105 (lines=49) @@
54
        <li class="active">Accounts</li>
55
    </ol>
56
    <?php
57
    if (!isset($_COOKIE['yaAccessToken']) || !isset($_COOKIE['yaClientId'])) {
58
        ?>
59
        <div class="alert alert-info">
60
            Для просмотра этой страницы вам необходимо авторизироваться.
61
            <a id="goToAuth" href="/examples/OAuth" class="alert-link">Перейти на страницу авторизации</a>.
62
        </div>
63
    <?php
64
    } else {
65
        if ($errorMessage) {
66
            ?>
67
            <div class="alert alert-danger"><?= $errorMessage ?></div>
68
        <?php
69
        } else {
70
            ?>
71
            <div>
72
                <h3>Аккаунты:</h3>
73
                <table id="accountTable" class="table table-striped table-bordered table-hover">
74
                    <thead>
75
                    <tr>
76
                        <td>Пользователь</td>
77
                        <td>Дата создания</td>
78
                    </tr>
79
                    </thead>
80
                    <tbody>
81
                    <?php
82
                    if ($accounts instanceof Traversable) {
83
                        foreach ($accounts as $account) {
84
                            ?>
85
                            <tr data-user-login="<?= $account->getUserLogin() ?>">
86
                                <td><?= $account->getUserLogin() ?></td>
87
                                <td><?= $account->getCreatedAt() ?></td>
88
                                <td style="text-align: center">
89
                                    <button type="button" class="btn btn-danger deleteAccount">
90
                                                <span title="Удалить"
91
                                                      class="glyphicon glyphicon-trash"></span>
92
                                    </button>
93
                                </td>
94
                            </tr>
95
96
                        <?php
97
                        }
98
                    }
99
                    ?>
100
                    </tbody>
101
                </table>
102
            </div>
103
        <?php
104
        }
105
    }
106
    ?>
107
</div>
108

examples/Metrica/Management/delegates.php 1 location

@@ 56-110 (lines=55) @@
53
        <li class="active">Delegates</li>
54
    </ol>
55
    <?php
56
    if (!isset($_COOKIE['yaAccessToken']) || !isset($_COOKIE['yaClientId'])) {
57
        ?>
58
        <div class="alert alert-info">
59
            Для просмотра этой страницы вам необходимо авторизироваться.
60
            <a id="goToAuth" href="/examples/OAuth" class="alert-link">Перейти на страницу авторизации</a>.
61
        </div>
62
    <?php
63
    } else {
64
        if ($errorMessage) {
65
            ?>
66
            <div class="alert alert-danger"><?= $errorMessage ?></div>
67
        <?php
68
        } else {
69
            ?>
70
            <div>
71
                <h3>Представители:</h3>
72
                <table id="delegatesTable" class="table table-striped table-bordered table-hover">
73
                    <thead>
74
                    <tr>
75
                        <td>Пользователь</td>
76
                        <td>Дата создания</td>
77
                        <td>Комментарий</td>
78
                    </tr>
79
                    </thead>
80
                    <tbody>
81
                    <?php
82
                    if ($delegates instanceof Traversable) {
83
                        foreach ($delegates as $delegate) {
84
                            ?>
85
                            <tr data-user-login="<?= $delegate->getUserLogin() ?>">
86
                                <td><?= $delegate->getUserLogin() ?></td>
87
                                <td><?= $delegate->getCreatedAt() ?></td>
88
                                <td><?= $delegate->getComment() ?></td>
89
                                <td style="text-align: center">
90
                                    <button type="button" class="btn btn-danger deleteDelegate">
91
                                            <span title="Удалить"
92
                                                  class="glyphicon glyphicon-trash"></span>
93
                                    </button>
94
                                </td>
95
                            </tr>
96
97
                        <?php
98
                        }
99
                    }
100
                    ?>
101
                    </tbody>
102
                </table>
103
                <button id="openAddDelegateModal" type="button" class="btn btn-success">
104
                        <span title="Добавить представителя"
105
                              class="glyphicon glyphicon-plus"> Добавить представителя</span>
106
                </button>
107
            </div>
108
        <?php
109
        }
110
    }
111
    ?>
112
</div>
113

examples/Metrica/Management/goals.php 1 location

@@ 59-107 (lines=49) @@
56
        <li class="active">Цели</li>
57
    </ol>
58
    <?php
59
    if (!isset($_COOKIE['yaAccessToken']) || !isset($_COOKIE['yaClientId'])) {
60
        ?>
61
        <div class="alert alert-info">
62
            Для просмотра этой страницы вам необходимо авторизироваться.
63
            <a id="goToAuth" href="/examples/OAuth" class="alert-link">Перейти на страницу авторизации</a>.
64
        </div>
65
    <?php
66
    } else {
67
        if ($errorMessage) {
68
            ?>
69
            <div class="alert alert-danger"><?= $errorMessage ?></div>
70
        <?php
71
        } else {
72
            ?>
73
            <div>
74
                <h3>Цели:</h3>
75
                <table id="countersTable" class="table table-striped table-bordered table-hover">
76
                    <thead>
77
                    <tr>
78
                        <td>ID</td>
79
                        <td>Название</td>
80
                        <td>Тип</td>
81
                        <td>Класс</td>
82
                        <td>Тип цели для клиентов Яндекс.Маркета</td>
83
                    </tr>
84
                    </thead>
85
                    <tbody>
86
                    <?php
87
                    if ($goals instanceof Traversable) {
88
                        foreach ($goals as $goal) {
89
                            ?>
90
                            <tr>
91
                                <td><?= $goal->getId() ?></td>
92
                                <td><?= $goal->getName() ?></td>
93
                                <td><?= $goal->getType() ?></td>
94
                                <td><?= $goal->getClass() ?></td>
95
                                <td><?= $goal->getFlag() ?></td>
96
                            </tr>
97
98
                        <?php
99
                        }
100
                    }
101
                    ?>
102
                    </tbody>
103
                </table>
104
            </div>
105
        <?php
106
        }
107
    }
108
    ?>
109
</div>
110
</body>

examples/Metrica/Management/grants.php 1 location

@@ 63-129 (lines=67) @@
60
        <li class="active">Разрешения</li>
61
    </ol>
62
    <?php
63
    if (!isset($_COOKIE['yaAccessToken']) || !isset($_COOKIE['yaClientId'])) {
64
        ?>
65
        <div class="alert alert-info">
66
            Для просмотра этой страницы вам необходимо авторизироваться.
67
            <a id="goToAuth" href="/examples/OAuth" class="alert-link">Перейти на страницу авторизации</a>.
68
        </div>
69
    <?php
70
    } else {
71
        if ($errorMessage) {
72
            ?>
73
            <div class="alert alert-danger"><?= $errorMessage ?></div>
74
        <?php
75
        } else {
76
            ?>
77
            <div>
78
                <h3>Разрешения:</h3>
79
                <table id="grantTable" class="table table-striped table-bordered table-hover">
80
                    <thead>
81
                    <tr>
82
                        <td>Логин пользователя</td>
83
                        <td>Уровень доступа</td>
84
                        <td>Дата предоставления доступа</td>
85
                        <td>Комментарий</td>
86
                    </tr>
87
                    </thead>
88
                    <tbody>
89
                    <?php
90
                    if ($grants instanceof Traversable) {
91
                        foreach ($grants as $grant) {
92
                            ?>
93
                            <tr data-user-login="<?= $grant->getUserLogin() ?>">
94
                                <td><?= $grant->getUserLogin() ?></td>
95
                                <td><?= $grant->getPerm() ?></td>
96
                                <td><?= $grant->getCreatedAt() ?></td>
97
                                <td><?= $grant->getComment() ?></td>
98
                                <td style="text-align: center">
99
100
                                    <button type="button"
101
                                            class="btn btn-info showGrant">
102
                                        <span title="Открыть" class="glyphicon glyphicon-eye-open"></span>
103
                                    </button>
104
105
                                    <button type="button"
106
                                            class="btn btn-warning updateGrant">
107
                                        <span title="Изменить"
108
                                              class="glyphicon glyphicon-edit"></span>
109
                                    </button>
110
                                    <button type="button" class="btn btn-danger deleteGrant">
111
                                            <span title="Удалить"
112
                                                  class="glyphicon glyphicon-trash"></span>
113
                                    </button>
114
                                </td>
115
                            </tr>
116
                        <?php
117
                        }
118
                    }
119
                    ?>
120
                    </tbody>
121
                </table>
122
                <button id="openAddGrantModal" type="button" class="btn btn-success">
123
                        <span title="Создать счетчик"
124
                              class="glyphicon glyphicon-plus"> Создать разрешение</span>
125
                </button>
126
            </div>
127
        <?php
128
        }
129
    }
130
    ?>
131
</div>
132