Esempio n. 1
0
<?php

require_once __DIR__ . '/../model/admin_roles_db.php';
$action = strtolower(filter_input(INPUT_POST, 'action'));
if ($action == NULL) {
    $action = strtolower(filter_input(INPUT_GET, 'action'));
    if ($action == NULL) {
        $action = 'list_roles';
    }
}
verify_admin();
switch ($action) {
    case 'list_roles':
        $assigned_roles = get_assigned_roles();
        $users = get_users();
        $roles = get_roles();
        $teacherList = get_teacher_list();
        include __DIR__ . "/view.php";
        break;
    case 'modify_admin':
        $choice = filter_input(INPUT_POST, 'choice');
        if ($choice == "Back") {
            header("Location: ..");
        }
        if ($choice == "Add Admin") {
            $usr_id = filter_input(INPUT_POST, 'user_drop');
            $usr_role_cde = filter_input(INPUT_POST, 'role_drop');
            add_admin($usr_id, $app_cde, $usr_role_cde);
        }
        $assigned_roles = get_assigned_roles();
        $users = get_users();
Esempio n. 2
0
    case 'add_customer':
        include_once __DIR__ . '/customers/add_customer.php';
        $responseArray['response'] = add_customer($values);
        $responseArray['message'] = 'Customer successfully added';
        break;
    case 'update_customer':
        include_once __DIR__ . '/customers/update_customer.php';
        $responseArray['response'] = update_customer($values);
        $responseArray['message'] = 'Customer updated.';
        break;
    case 'get_customers':
        include_once __DIR__ . '/customers/get_customers.php';
        $responseArray['response'] = get_customers($values);
        $responseArray['message'] = 'Customers successfully read';
        break;
    case 'verify_user':
        include_once __DIR__ . '/customers/verify_user.php';
        $responseArray['response'] = verify_user($values);
        $responseArray['message'] = 'User verified';
        break;
    case "verify_admin":
        include_once __DIR__ . '/customers/verify_admin.php';
        $responseArray['response'] = verify_admin($values);
        $responseArray['message'] = 'Admin verified';
        break;
    default:
        throw new Exception("Unknown function: {$function}");
}
$responseArray['status'] = 'success';
echo json_encode($responseArray);
exit;