Exemple #1
0
session_start();
header('Content-Type: text/html; charset= utf-8');
$clientData = json_decode(trim(file_get_contents('php://input')), true);
$userData = $clientData['data'];
//echo json_encode($_SESSION[0]);
switch ($clientData["target"]) {
    case 'menu':
        include_once 'data/get/getMenu.php';
        echo json_encode(getMenu::getDataMenu());
        break;
    case 'news':
        include_once 'data/get/getArticle.php';
        echo json_encode(getArticle::getDataArticle());
        break;
    case 'comment':
        include_once 'data/get/getComment.php';
        echo json_encode(getComment::getDataComment($userData));
        break;
    case 'addComment':
        include_once 'data/set/addComment.php';
        echo json_encode(addComment::addDataComment($userData));
        break;
    case 'authorization':
        include_once 'core/data/session/openSession.php';
        echo json_encode(openSession::openSession1($userData));
        break;
    case 'getSession':
        include_once 'core/data/session/getSession.php';
        echo json_encode(userInfo::sessionInfo());
}
Exemple #2
0
    $table = tables::getCourseStudents($courseid);
    echo html_writer::table($table);
}
//start page that lets the user continue or start a session
if ($action == 'startpage') {
    $title = get_string('checkattendance', 'local_attendance');
    $PAGE->set_title($title);
    $PAGE->set_heading($title);
    echo $OUTPUT->header();
    echo $OUTPUT->heading($title);
    echo '<h3>' . $courseName->fullname . '</h3>';
    if (isset($message)) {
        echo $message;
    }
    $session = $DB->get_record('local_attendance_session', array('courseid' => $courseid, 'open' => 1));
    if (empty($session)) {
        echo '<div class="alert alert-info">' . get_string('nosessions', 'local_attendance') . '</div>';
        $openSessionForm = new openSession();
        $openSessionForm->display();
    } else {
        $course = $DB->get_record('course', array('id' => $session->courseid));
        echo '<h3>' . get_string('alreadyopen', 'local_attendance') . ' ' . $course->fullname . '</h3><br>';
        echo $OUTPUT->single_button(new moodle_url('/local/attendance/attendance.php', array('courseid' => $courseid, 'action' => 'continue_session')), get_string('staysession', 'local_attendance'));
        echo $OUTPUT->single_button(new moodle_url('/local/attendance/attendance.php', array('courseid' => $courseid, 'action' => 'close_session')), get_string('closesession', 'local_attendance'));
    }
}
$back = new moodle_url('/course/view.php?id=' . $courseid);
echo $OUTPUT->single_button($back, get_string('back', 'local_attendance'));
echo $OUTPUT->footer();
?>
<link rel="stylesheet" type="text/css"  href="scripts/style.css" />