$quotaSummary = null;
                 if (isset($_POST['userId']) && isset($_POST['creditTypeId'])) {
                     $quotaSummary = rm_getHistoricQuotaSummaryByUserAndCreditType($_POST['userId'], $_POST['creditTypeId'], $timeZoneId);
                 } else {
                     $quotaSummary = rm_getHistoricQuotaSummaryByUserAndCreditType($_POST['userId'], $_POST['creditTypeId'], $timeZoneId);
                 }
                 echo json_encode($quotaSummary);
             } else {
                 if ($action == "getAllCourses") {
                     $courses = db_getAllCourses();
                     $response = array("courses" => $courses);
                     echo json_encode($response);
                 } else {
                     if ($action == "getCoursesByUser") {
                         if (isset($_POST['userId'])) {
                             $courses = db_getCoursesByUser($_POST['userId']);
                             $response = array("courses" => $courses);
                             echo json_encode($response);
                         }
                     } else {
                         if ($action == "getAllUsers") {
                             $users = db_getAllUsers();
                             $response = array("users" => $users);
                             echo json_encode($response);
                         }
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
function getAvailCourses($userid)
{
    $courses = array();
    $courses = db_getCoursesByUser($userid);
    return $courses;
}