public function main() { ?> <div id="main"> <table class="ui table segment square-corners celled"> <thead> <tr class="header"> <th class="numeric">#</th> <th class="numeric middle">Год</th> <th class="numeric middle">Срок</th> <th class="middle">Номер</th> <th class="middle">Факультет</th> <th class="middle">Специальность</th> <th class="middle">Специализация</th> <th class="middle">Квалификация</th> <th></th> <th></th> </tr> </thead> <tbody> <?php $reports = reports::get(); if ($reports) { foreach ($reports as $report) { ?> <tr id="report-<?php echo $report->id; ?> "> <td class="middle monospace numeric"><?php echo $report->id; ?> </td> <td class="middle monospace numeric"><?php echo $report->year; ?> </td> <td class="middle monospace numeric"><?php echo $report->duration; ?> </td> <td class="middle monospace numeric"><?php echo $report->registration_number; ?> </td> <td class="middle"><?php echo $report->faculty_shortname; ?> </td> <td class="small-font justify text-break"><?php echo $report->specialty_name; ?> </td> <td class="small-font justify text-break"><?php echo $report->specialization_name; ?> </td> <td class="small-font justify text-break"><?php echo $report->qualification_name; ?> </td> <td class="icon first no-border"> <a href="/?page=reports-edit&report_id=<?php echo $report->id; ?> "> <i class="icon edit" title="Редактировать"></i> </a> </td> <td class="icon last no-border"> <a href="#" onclick="$.post('<?php echo template_url::ajax('reports', 'remove', $report->id); ?> ').done(function(answer) { answer_removed(answer, <?php echo $report->id; ?> ); }); return false;"> <i class="icon remove circle" title="Удалить"></i> </a> </td> </tr> <?php } } ?> </tbody> </table> </div> <script> function answer_removed(answer, id) { console.log(answer); switch(answer) { case '<?php echo RUDE_AJAX_ERROR; ?> ': break; case '<?php echo RUDE_AJAX_OK; ?> ': console.log(this); $('#report-' + id).fadeOut('slow'); break; case '<?php echo RUDE_AJAX_ACCESS_VIOLATION; ?> ': $('#access-violation').modal('show'); break; default: break; } return false; } </script> <?php }