|
|
|
@ -31,7 +31,7 @@ try { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
switch ($action) { |
|
|
|
|
case Rest::ACTION_AUTH: |
|
|
|
|
case Rest::GET_AUTH: |
|
|
|
|
Rest::init(); |
|
|
|
|
|
|
|
|
|
$password = isset($_POST['password']) ? $_POST['password'] : null; |
|
|
|
@ -49,7 +49,7 @@ try { |
|
|
|
|
]); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case Rest::ACTION_GCM_ID: |
|
|
|
|
case Rest::SAVE_GCM_ID: |
|
|
|
|
$gcmId = isset($_POST['registration_id']) ? Security::remove_XSS($_POST['registration_id']) : null; |
|
|
|
|
|
|
|
|
|
$restApi->setGcmId($gcmId); |
|
|
|
@ -57,7 +57,7 @@ try { |
|
|
|
|
$restResponse->setData(['status' => true]); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case Rest::ACTION_USER_MESSAGES: |
|
|
|
|
case Rest::GET_USER_MESSAGES: |
|
|
|
|
$lastMessageId = isset($_POST['last']) ? intval($_POST['last']) : 0; |
|
|
|
|
|
|
|
|
|
$messages = $restApi->getUserMessages($lastMessageId); |
|
|
|
@ -65,25 +65,25 @@ try { |
|
|
|
|
$restResponse->setData($messages); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case Rest::ACTION_USER_COURSES: |
|
|
|
|
case Rest::GET_USER_COURSES: |
|
|
|
|
$courses = $restApi->getUserCourses(); |
|
|
|
|
|
|
|
|
|
$restResponse->setData($courses); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case Rest::ACTION_COURSE_INFO: |
|
|
|
|
case Rest::GET_COURSE_INFO: |
|
|
|
|
$courseInfo = $restApi->getCourseInfo(); |
|
|
|
|
|
|
|
|
|
$restResponse->setData($courseInfo); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case Rest::ACTION_COURSE_DESCRIPTIONS: |
|
|
|
|
case Rest::GET_COURSE_DESCRIPTIONS: |
|
|
|
|
$descriptions = $restApi->getCourseDescriptions(); |
|
|
|
|
|
|
|
|
|
$restResponse->setData($descriptions); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case Rest::ACTION_COURSE_DOCUMENTS: |
|
|
|
|
case Rest::GET_COURSE_DOCUMENTS: |
|
|
|
|
$directoryId = isset($_POST['dir_id']) ? Security::remove_XSS($_POST['dir_id']) : null; |
|
|
|
|
|
|
|
|
|
$documents = $restApi->getCourseDocuments($directoryId); |
|
|
|
@ -91,13 +91,13 @@ try { |
|
|
|
|
$restResponse->setData($documents); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case Rest::ACTION_COURSE_ANNOUNCEMENTS: |
|
|
|
|
case Rest::GET_COURSE_ANNOUNCEMENTS: |
|
|
|
|
$announcements = $restApi->getCourseAnnouncements(); |
|
|
|
|
|
|
|
|
|
$restResponse->setData($announcements); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case Rest::ACTION_COURSE_ANNOUNCEMENT: |
|
|
|
|
case Rest::GET_COURSE_ANNOUNCEMENT: |
|
|
|
|
$announcementId = isset($_POST['announcement']) ? Security::remove_XSS($_POST['announcement']) : 0; |
|
|
|
|
|
|
|
|
|
$announcement = $restApi->getCourseAnnouncement($announcementId); |
|
|
|
@ -105,25 +105,25 @@ try { |
|
|
|
|
$restResponse->setData($announcement); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case Rest::ACTION_COURSE_AGENDA: |
|
|
|
|
case Rest::GET_COURSE_AGENDA: |
|
|
|
|
$agenda = $restApi->getCourseAgenda(); |
|
|
|
|
|
|
|
|
|
$restResponse->setData($agenda); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case Rest::ACTION_COURSE_NOTEBOOKS: |
|
|
|
|
case Rest::GET_COURSE_NOTEBOOKS: |
|
|
|
|
$notebooks = $restApi->getCourseNotebooks(); |
|
|
|
|
|
|
|
|
|
$restResponse->setData($notebooks); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case Rest::ACTION_COURSE_FORUM_CATEGORIES: |
|
|
|
|
case Rest::GET_COURSE_FORUM_CATEGORIES: |
|
|
|
|
$forums = $restApi->getCourseForumCategories(); |
|
|
|
|
|
|
|
|
|
$restResponse->setData($forums); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case Rest::ACTION_COURSE_FORUM: |
|
|
|
|
case Rest::GET_COURSE_FORUM: |
|
|
|
|
$forumId = isset($_POST['forum']) ? Security::remove_XSS($_POST['forum']) : 0; |
|
|
|
|
|
|
|
|
|
$forum = $restApi->getCourseForum($forumId); |
|
|
|
@ -131,7 +131,7 @@ try { |
|
|
|
|
$restResponse->setData($forum); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case Rest::ACTION_COURSE_FORUM_THREAD: |
|
|
|
|
case Rest::GET_COURSE_FORUM_THREAD: |
|
|
|
|
$threadId = isset($_POST['thread']) ? Security::remove_XSS($_POST['thread']) : 0; |
|
|
|
|
|
|
|
|
|
$thread = $restApi->getCourseForumThread($threadId); |
|
|
|
@ -139,25 +139,25 @@ try { |
|
|
|
|
$restResponse->setData($thread); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case Rest::ACTION_PROFILE: |
|
|
|
|
case Rest::GET_PROFILE: |
|
|
|
|
$userInfo = $restApi->getUserProfile(); |
|
|
|
|
|
|
|
|
|
$restResponse->setData($userInfo); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case Rest::ACTION_COURSE_LEARNPATHS: |
|
|
|
|
case Rest::GET_COURSE_LEARNPATHS: |
|
|
|
|
$data = $restApi->getCourseLearnPaths(); |
|
|
|
|
|
|
|
|
|
$restResponse->setData($data); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case Rest::ACTION_COURSE_LEARNPATH: |
|
|
|
|
case Rest::GET_COURSE_LEARNPATH: |
|
|
|
|
$lpId = isset($_REQUEST['lp_id']) ? intval($_REQUEST['lp_id']) : 0; |
|
|
|
|
|
|
|
|
|
$restApi->showLearningPath($lpId); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case Rest::ACTION_SAVE_FORUM_POST: |
|
|
|
|
case Rest::SAVE_FORUM_POST: |
|
|
|
|
if ( |
|
|
|
|
empty($_POST['title']) || empty($_POST['text']) || empty($_POST['thread']) || empty($_POST['forum']) |
|
|
|
|
) { |
|
|
|
@ -181,7 +181,7 @@ try { |
|
|
|
|
$restResponse->setData($data); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case Rest::ACTION_USER_SESSIONS: |
|
|
|
|
case Rest::GET_USER_SESSIONS: |
|
|
|
|
$courses = $restApi->getUserSessions(); |
|
|
|
|
|
|
|
|
|
$restResponse->setData($courses); |
|
|
|
|