コード例 #1
0
<?php

// Test the user's level of access
$role = $_SESSION['user']->getRole()->getName();
if ($role === 'Professor') {
    $_SESSION['data']['users'] = UserDAL::findAllStudents();
    require_once 'view/menu/menu_student.phtml';
    require_once 'view/student/student_all.phtml';
} else {
    header('Location: ../home');
}
コード例 #2
0
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . '/WebBristol/model/DAL/UserDAL.php';
$students = UserDAL::findAllStudents();
$result = array();
foreach ($students as $student) {
    $avatar = '<img src="/WebBristol/images/avatar/' . (!empty($student->getAvatar()) ? $student->getAvatar() : 'avatar-dafault.png') . '" alt="Avatar" class="img-rounded img-responsive small">';
    $see = '<a class="btn btn-default" href="see/' . $student->getId() . '" role="button"><span class="glyphicon glyphicon-eye-open"></span></a>';
    $edit = '<a class="btn btn-default" href="edit/' . $student->getId() . '" role="button"><span class="glyphicon glyphicon-pencil"></span></a>';
    $row = array("avatar" => $avatar, "first_name" => $student->getFirstName(), "last_name" => $student->getLastName(), "birth_date" => $student->getBirthDate(), "email" => $student->getMail(), "address" => $student->getAddress(), "phone" => $student->getPhoneNumber(), "inscription_date" => $student->getInscriptionDate(), "action" => $see . $edit);
    $result[] = $row;
}
echo json_encode($result);