diff --git a/portlets/up-activities-portlet/docroot/WEB-INF/src/de/unipotsdam/elis/activities/extservice/moodle/rest/MoodleRestClient.java b/portlets/up-activities-portlet/docroot/WEB-INF/src/de/unipotsdam/elis/activities/extservice/moodle/rest/MoodleRestClient.java index 5de951625901..c4b4fa938845 100644 --- a/portlets/up-activities-portlet/docroot/WEB-INF/src/de/unipotsdam/elis/activities/extservice/moodle/rest/MoodleRestClient.java +++ b/portlets/up-activities-portlet/docroot/WEB-INF/src/de/unipotsdam/elis/activities/extservice/moodle/rest/MoodleRestClient.java @@ -12,22 +12,19 @@ import com.liferay.portal.kernel.json.JSONFactoryUtil; import com.liferay.portal.kernel.json.JSONObject; -public class MoodleRestClient { +import de.unipotsdam.elis.activities.ActivitiesAdminPortlet; - /** - * http://localhost/moodle/webservice/rest/server.php? - * wstoken=eaf10af21b98618e8bf0ea473a5e8e24 - * &wsfunction=webservice_get_recent_course_activities - * &moodlewsrestformat=json - */ +public class MoodleRestClient { - private final static String TARGET = "http://localhost"; - - private static String getToken(String username, String password) throws JSONException, ClientErrorException { + private static String getToken(String serviceName) throws JSONException, ClientErrorException { + String _target = ActivitiesAdminPortlet.getMoodleServiceEndpoint(); // set in admin portlet + String username = ActivitiesAdminPortlet.getMoodleServiceUsername(); + String password = ActivitiesAdminPortlet.getMoodleServicePassword(); + Client client = ClientBuilder.newClient(); - WebTarget target = client.target(TARGET).path("moodle/login/token.php").queryParam("username", username) - .queryParam("password", password).queryParam("service", "webservice_recent_course_activities"); + WebTarget target = client.target(_target).path("/login/token.php").queryParam("username", username) + .queryParam("password", password).queryParam("service", serviceName); Response response = target.request(MediaType.APPLICATION_JSON_TYPE).get(); @@ -44,13 +41,15 @@ private static String getToken(String username, String password) throws JSONExce return token; } - public static JSONArray getLatestCourseNews(String username, String password, int startIndex, int endIndex) + public static JSONArray getLatestCourseNews(int startIndex, int endIndex) throws JSONException, ClientErrorException { - String token = getToken(username, password); + String _target = ActivitiesAdminPortlet.getMoodleServiceEndpoint(); // set in admin portlet + + String token = getToken("webservice_recent_course_activities"); Client client = ClientBuilder.newClient(); - WebTarget target = client.target(TARGET).path("moodle/webservice/rest/server.php") + WebTarget target = client.target(_target).path("/webservice/rest/server.php") .queryParam("wsfunction", "webservice_get_recent_course_activities") .queryParam("startindex", startIndex).queryParam("count", endIndex - startIndex) .queryParam("wstoken", token).queryParam("moodlewsrestformat", "json"); @@ -63,13 +62,15 @@ public static JSONArray getLatestCourseNews(String username, String password, in return JSONFactoryUtil.createJSONArray(response.readEntity(String.class)); } - public static JSONArray getLatestCourseNews(String username, String password, long startTime, long endTime, + public static JSONArray getLatestCourseNews(long startTime, long endTime, int startIndex, int endIndex) throws JSONException, ClientErrorException { - String token = getToken(username, password); + String _target = ActivitiesAdminPortlet.getMoodleServiceEndpoint(); // set in admin portlet + + String token = getToken("webservice_recent_course_activities"); Client client = ClientBuilder.newClient(); - WebTarget target = client.target(TARGET).path("moodle/webservice/rest/server.php") + WebTarget target = client.target(_target).path("/webservice/rest/server.php") .queryParam("wsfunction", "webservice_get_recent_course_activities").queryParam("starttime", startTime) .queryParam("endtime", endTime).queryParam("startindex", startIndex) .queryParam("count", endIndex - startIndex).queryParam("wstoken", token) @@ -82,4 +83,30 @@ public static JSONArray getLatestCourseNews(String username, String password, lo // TODO: fix crash, if webservice_access_exception occurs return JSONFactoryUtil.createJSONArray(response.readEntity(String.class)); } + + /** + * add user of campus.UP to moodle, too receive activities. + * @param screenName + * @throws ClientErrorException + * @throws JSONException + */ + public static boolean addCampusUpUser(String screenName) throws JSONException, ClientErrorException { + String _target = ActivitiesAdminPortlet.getMoodleServiceEndpoint(); // set in admin portlet + + String token = getToken("webservice_add_campus_up_user"); + + Client client = ClientBuilder.newClient(); + WebTarget target = client.target(_target).path("/webservice/rest/server.php") + .queryParam("wsfunction", "webservice_add_user") + .queryParam("userid", screenName) + .queryParam("wstoken", token) + .queryParam("moodlewsrestformat", "json"); + + Response response = target.request(MediaType.APPLICATION_JSON_TYPE).get(); + + if (response.getStatus() != 200) + throw new ClientErrorException(response); + + return true;//JSONFactoryUtil.createJSONArray(response.readEntity(String.class)); + } } diff --git a/portlets/up-activities-portlet/docroot/WEB-INF/src/de/unipotsdam/elis/activities/extservice/util/ExtSocialActivityUtil.java b/portlets/up-activities-portlet/docroot/WEB-INF/src/de/unipotsdam/elis/activities/extservice/util/ExtSocialActivityUtil.java index 7c449ed0db31..77bb506018cc 100644 --- a/portlets/up-activities-portlet/docroot/WEB-INF/src/de/unipotsdam/elis/activities/extservice/util/ExtSocialActivityUtil.java +++ b/portlets/up-activities-portlet/docroot/WEB-INF/src/de/unipotsdam/elis/activities/extservice/util/ExtSocialActivityUtil.java @@ -1,4 +1,5 @@ package de.unipotsdam.elis.activities.extservice.util; +import java.util.Calendar; import java.util.Date; import javax.ws.rs.ClientErrorException; @@ -9,62 +10,67 @@ import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.json.JSONArray; import com.liferay.portal.kernel.json.JSONException; -import com.liferay.portal.kernel.json.JSONFactoryUtil; import com.liferay.portal.kernel.json.JSONObject; +import com.liferay.portal.kernel.log.Log; +import com.liferay.portal.kernel.log.LogFactoryUtil; import com.liferay.portal.kernel.util.HtmlUtil; +import com.liferay.portal.model.User; +import com.liferay.portal.service.UserLocalServiceUtil; +import com.liferay.portal.util.PortalUtil; import com.liferay.portlet.social.service.SocialActivityLocalServiceUtil; import de.unipotsdam.elis.activities.ExtendedSocialActivityKeyConstants; +import de.unipotsdam.elis.activities.extservice.moodle.rest.MoodleRestClient; import de.unipotsdam.elis.activities.model.MoodleSocialActivity; import de.unipotsdam.elis.activities.service.MoodleSocialActivityLocalServiceUtil; public class ExtSocialActivityUtil { - - private static String SAMPLE_DATA = "[{\"id\":1179,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
Das ist die zweite Umfrage<\\/p>\",\"name\":\"Die Umfrage 2\",\"type\":[\"survey\",\"ma:survey\"],\"url\":\"http://localhost/moodle/mod/survey/view.php?id=33\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-11-23T12:25:19+01:00\",\"type\":\"Submitt\"},{\"id\":1176,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
Das ist die zweite Umfrage<\\/p>\",\"name\":\"Die Umfrage 2\",\"type\":[\"survey\",\"ma:survey\"],\"url\":\"http://localhost/moodle/mod/survey/view.php?id=33\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-11-23T12:24:59+01:00\",\"type\":\"Add\"},{\"id\":1160,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
Das ist der zweite Test<\\/p>\",\"name\":\"Test 2\",\"type\":[\"quiz\",\"ma:quiz\"],\"url\":\"http://localhost/moodle/mod/quiz/view.php?id=32\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-11-23T12:11:08+01:00\",\"type\":\"Add\"},{\"id\":1154,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"target\":{\"name\":\"OU WIKI\",\"type\":\"Collection\",\"url\":\"http://localhost/moodle/mod/ouwiki/view.php?id=3\"},\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
Seite 1 des OU WIKI<\\/p>\\n\\n\",\"name\":\"\",\"type\":[\"wiki\",\"ma:page\"],\"url\":\"http://localhost/moodle/mod/ouwiki/view.php?pageid=1\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-11-23T12:06:28+01:00\",\"type\":\"Updated\"},{\"id\":1150,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
Das ist das ouwiki<\\/p>\",\"name\":\"OU WIKI\",\"type\":[\"ouwiki\",\"ma:ouwiki\"],\"url\":\"http://localhost/moodle/mod/ouwiki/view.php?id=31\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-11-23T12:05:52+01:00\",\"type\":\"Add\"},{\"id\":1145,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
Das ist eine einfache Mindmap<\\/p>\",\"name\":\"Mindmap\",\"type\":[\"mindmap\",\"ma:mindmap\"],\"url\":\"http://localhost/moodle/mod/mindmap/view.php?id=30\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-11-23T11:24:01+01:00\",\"type\":\"Add\"},{\"id\":1138,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"target\":{\"name\":\"TestLektion2\",\"type\":\"Collection\",\"url\":\"http://localhost/moodle/mod/lesson/view.php?id=29\"},\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
Frage 1<\\/p>\",\"name\":\"Fragen\",\"type\":[\"lesson\",\"ma:lesson_page\"],\"url\":\"http://localhost/moodle/mod/lesson/view.php?id=29pageid=3\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-11-23T11:21:22+01:00\",\"type\":\"Add\"},{\"id\":1124,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"target\":{\"name\":\"TestLektion2\",\"type\":\"Collection\",\"url\":\"http://localhost/moodle/mod/lesson/view.php?id=29\"},\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
Das ist der Inhalt von Lektion 2<\\/p>\",\"name\":\"Inhaltsseite f\u00FCr Lektion 2\",\"type\":[\"lesson\",\"ma:lesson_page\"],\"url\":\"http://localhost/moodle/mod/lesson/view.php?id=29pageid=2\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-11-23T11:13:21+01:00\",\"type\":\"Add\"},{\"id\":1122,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
Das ist die zweite Lektion<\\/p>\",\"name\":\"TestLektion2\",\"type\":[\"lesson\",\"ma:lesson\"],\"url\":\"http://localhost/moodle/mod/lesson/view.php?id=29\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-11-23T11:12:26+01:00\",\"type\":\"Add\"},{\"id\":1112,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
Das ist das tolle test journal.<\\/p>\",\"name\":\"Testjournal\",\"type\":[\"journal\",\"ma:journal\"],\"url\":\"http://localhost/moodle/mod/journal/view.php?id=28\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-11-23T11:07:23+01:00\",\"type\":\"Add\"},{\"id\":1108,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"\",\"name\":\"HotPot\",\"type\":[\"hotpot\",\"ma:hotpot\"],\"url\":\"http://localhost/moodle/mod/hotpot/view.php?id=27\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-11-23T10:59:01+01:00\",\"type\":\"Submitt\"},{\"id\":1099,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"\",\"name\":\"HotPot\",\"type\":[\"hotpot\",\"ma:hotpot\"],\"url\":\"http://localhost/moodle/mod/hotpot/view.php?id=27\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-11-23T10:47:37+01:00\",\"type\":\"Add\"},{\"id\":1092,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
Runde 2<\\/p>\",\"name\":\"Gruppeneinteilung 2\",\"type\":[\"groupselect\",\"ma:groupselect\"],\"url\":\"http://localhost/moodle/mod/groupselect/view.php?id=26\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-11-23T10:33:09+01:00\",\"type\":\"Add\"},{\"id\":1088,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"krasser als alles andere\",\"name\":\"ULTRAGRUPPE\",\"type\":[\"group\",\"ma:group_member\"],\"url\":\"http://localhost/moodle/mod/groupselect/view.php?id=Array\"},\"actor\":{\"id\":\"test\",\"name\":\"Testor Testelsson\",\"type\":\"Person\"},\"published\":\"2016-11-23T10:30:12+01:00\",\"type\":\"Add\"},{\"id\":1079,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"Eine Gruppe f\u00FCr krasse Typen.\",\"name\":\"MEGAGRUPPE\",\"type\":[\"group\",\"ma:group_member\"],\"url\":\"http://localhost/moodle/mod/groupselect/view.php?id=Array\"},\"actor\":{\"id\":\"test\",\"name\":\"Testor Testelsson\",\"type\":\"Person\"},\"published\":\"2016-11-23T10:27:21+01:00\",\"type\":\"Add\"},{\"id\":1073,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"Eine Gruppe f\u00FCr krasse Typen.\",\"name\":\"MEGAGRUPPE\",\"type\":[\"group\",\"ma:group_member\"],\"url\":\"http://localhost/moodle/mod/groupselect/view.php?id=Array\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-11-23T09:59:33+01:00\",\"type\":\"Add\"},{\"id\":1067,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
Das ist eine freie Gruppeneinteilung<\\/p>\",\"name\":\"Testgruppeneinteilung\",\"type\":[\"groupselect\",\"ma:groupselect\"],\"url\":\"http://localhost/moodle/mod/groupselect/view.php?id=25\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-11-23T09:59:05+01:00\",\"type\":\"Add\"},{\"id\":1060,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
Was war zuerst da?<\\/p>\",\"name\":\"Henne oder Ei?\",\"type\":[\"assign\",\"ma:assign_submission\"],\"url\":\"http://localhost/moodle/mod/assign/view.php?id=24\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-11-23T09:15:10+01:00\",\"type\":\"Submitt\"},{\"id\":1049,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
Was war zuerst da?<\\/p>\",\"name\":\"Henne oder Ei?\",\"type\":[\"assign\",\"ma:assign\"],\"url\":\"http://localhost/moodle/mod/assign/view.php?id=24\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-11-23T09:10:17+01:00\",\"type\":\"Add\"},{\"id\":1038,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
Willst du mit mir gehen?<\\/p>\",\"name\":\"Blabstimmung\",\"type\":[\"choice\",\"ma:choice_answers\"],\"url\":\"http://localhost/moodle/mod/choice/view.php?id=23\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-11-23T08:21:58+01:00\",\"type\":\"Add\"},{\"id\":1035,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
Willst du mit mir gehen?<\\/p>\",\"name\":\"Blabstimmung\",\"type\":[\"choice\",\"ma:choice\"],\"url\":\"http://localhost/moodle/mod/choice/view.php?id=23\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-11-23T08:20:12+01:00\",\"type\":\"Add\"},{\"id\":981,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"target\":{\"name\":\"What's going on?\",\"context\":{\"name\":\"Das Forum\",\"type\":\"Collection\",\"url\":\"http://localhost/moodle/mod/forum/view.php?id=21\"},\"type\":\"OrderedCollection\",\"url\":\"http://localhost/moodle/mod/forum/discuss.php?d=6\"},\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
Ahoi!<\\/p>\",\"name\":\"Re: What's going on?\",\"type\":[\"forum\",\"ma:post\"],\"url\":\"http://localhost/moodle/mod/forum/discuss.php?d=6#p7\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-11-22T14:05:42+01:00\",\"type\":\"Add\"},{\"id\":929,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"target\":{\"name\":\"Das Forum\",\"type\":\"OrderedCollection\",\"url\":\"http://localhost/moodle/mod/forum/view.php?id=21\"},\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
Hi!<\\/p>\",\"name\":\"What's going on?\",\"type\":[\"forum\",\"ma:discussion\"],\"url\":\"http://localhost/moodle/mod/forum/discuss.php?d=6\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-11-22T09:09:47+01:00\",\"type\":\"Add\"},{\"id\":924,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
Das ist ein forum<\\/p>\",\"name\":\"Das Forum\",\"type\":[\"forum\",\"ma:forum\"],\"url\":\"http://localhost/moodle/mod/forum/view.php?id=22\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-11-22T09:02:31+01:00\",\"type\":\"Add\"},{\"id\":922,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
ein link<\\/p>\",\"name\":\"Link2\",\"type\":[\"url\",\"ma:url\"],\"url\":\"http://localhost/moodle/mod/url/view.php?id=21\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-11-22T08:48:41+01:00\",\"type\":\"Add\"},{\"id\":920,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
google und so<\\/p>\",\"name\":\"DER LINK\",\"type\":[\"url\",\"ma:url\"],\"url\":\"http://localhost/moodle/mod/url/view.php?id=20\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-11-22T08:43:22+01:00\",\"type\":\"Add\"},{\"id\":908,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
TestChat
<\\/p>\",\"name\":\"TestChat\",\"type\":[\"chat\",\"ma:chat\"],\"url\":\"http://localhost/moodle/mod/chat/view.php?id=19\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-11-17T09:13:57+01:00\",\"type\":\"Add\"},{\"id\":905,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
Inhalt<\\/p>\",\"name\":\"seite 1\",\"type\":[\"lesson\",\"ma:lesson_page\"],\"url\":\"http://localhost/moodle/mod/lesson/view.php?id=17pageid=1\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-11-17T09:01:51+01:00\",\"type\":\"Add\"},{\"id\":885,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
testlektion<\\/p>\",\"name\":\"Testlektion\",\"type\":[\"lesson\",\"ma:lesson\"],\"url\":\"http://localhost/moodle/mod/lesson/view.php?id=17\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-11-17T09:00:48+01:00\",\"type\":\"Add\"},{\"id\":883,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
testfeedback<\\/p>\",\"name\":\"testfeedback\",\"type\":[\"feedback\",\"ma:feedback_completed\"],\"url\":\"http://localhost/moodle/mod/feedback/view.php?id=16\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-11-17T08:59:45+01:00\",\"type\":\"Submitt\"},{\"id\":879,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
testfeedback<\\/p>\",\"name\":\"testfeedback\",\"type\":[\"feedback\",\"ma:feedback\"],\"url\":\"http://localhost/moodle/mod/feedback/view.php?id=16\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-11-17T08:58:30+01:00\",\"type\":\"Add\"},{\"id\":856,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
Dies ist ein Testquiz.<\\/p>\",\"name\":\"Testquiz\",\"type\":[\"quiz\",\"ma:quiz\"],\"url\":\"http://localhost/moodle/mod/quiz/view.php?id=15\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-11-17T08:51:44+01:00\",\"type\":\"Add\"},{\"id\":853,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
Dies ist das Testforum!<\\/p>\",\"name\":\"Testforum\",\"type\":[\"forum\",\"ma:forum\"],\"url\":\"http://localhost/moodle/mod/forum/view.php?id=14\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-11-17T08:49:26+01:00\",\"type\":\"Add\"},{\"id\":850,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
Das ist die Testabstimmung.<\\/p>\",\"name\":\"Testabstimmung\",\"type\":[\"choice\",\"ma:choice_answers\"],\"url\":\"http://localhost/moodle/mod/choice/view.php?id=13\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-11-17T08:42:27+01:00\",\"type\":\"Add\"},{\"id\":847,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
Das ist die Testabstimmung.<\\/p>\",\"name\":\"Testabstimmung\",\"type\":[\"choice\",\"ma:choice\"],\"url\":\"http://localhost/moodle/mod/choice/view.php?id=13\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-11-17T08:42:12+01:00\",\"type\":\"Add\"},{\"id\":842,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
Fragen und so<\\/p>\",\"name\":\"Testumfrage\",\"type\":[\"survey\",\"ma:survey\"],\"url\":\"http://localhost/moodle/mod/survey/view.php?id=5\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-11-17T08:36:07+01:00\",\"type\":\"Submitt\"},{\"id\":757,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"target\":{\"name\":\"WIKIZWEI\",\"type\":\"Collection\",\"url\":\"http://localhost/moodle/mod/wiki/view.php?id=12\"},\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
Das ist Wiki ist doof.<\\/p>\",\"name\":\"Kommentar\",\"type\":[\"comment\",\"ma:comment\"],\"url\":\"http://localhost/moodle/mod/comments.php?pageid=2\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-10-24T16:12:35+02:00\",\"type\":\"Add\"},{\"id\":753,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"target\":{\"name\":\"Angek\u00FCndigte Ank\u00FCndigung\",\"type\":\"Collection\",\"url\":\"http://localhost/moodle/mod/wiki/view.php?id=2\"},\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
tgrghergreg<\\/p>\",\"name\":\"Start\",\"type\":[\"wiki\",\"ma:page\"],\"url\":\"http://localhost/moodle/mod/wiki/view.php?pageid=2\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-10-24T16:12:10+02:00\",\"type\":\"Updated\"},{\"id\":752,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"target\":{\"name\":\"Angek\u00FCndigte Ank\u00FCndigung\",\"type\":\"Collection\",\"url\":\"http://localhost/moodle/mod/wiki/view.php?id=2\"},\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
tgrghergreg<\\/p>\\n\",\"name\":\"Start\",\"type\":[\"wiki\",\"ma:page\"],\"url\":\"http://localhost/moodle/mod/wiki/view.php?pageid=2\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-10-24T16:12:02+02:00\",\"type\":\"Add\"},{\"id\":750,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
Das ist wikizwei. Der zweite Versuch.<\\/p>\",\"name\":\"WIKIZWEI\",\"type\":[\"wiki\",\"ma:wiki\"],\"url\":\"http://localhost/moodle/mod/wiki/view.php?id=12\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-10-24T16:11:52+02:00\",\"type\":\"Add\"},{\"id\":742,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"target\":{\"name\":\"TESTWIKI\",\"type\":\"Collection\",\"url\":\"http://localhost/moodle/mod/wiki/view.php?id=3\"},\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
Ein wundervolles wiki!<\\/p>\",\"name\":\"Kommentar\",\"type\":[\"comment\",\"ma:comment\"],\"url\":\"http://localhost/moodle/mod/comments.php?pageid=1\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-10-24T16:08:13+02:00\",\"type\":\"Add\"},{\"id\":733,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
Das ist yahoo. Yahoo ist viel cooler als Google.<\\/p>\",\"name\":\"Yahoo-Link\",\"type\":[\"url\",\"ma:url\"],\"url\":\"http://localhost/moodle/mod/url/view.php?id=11\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-10-24T15:41:24+02:00\",\"type\":\"Add\"},{\"id\":617,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"context\":{\"name\":\"Der Beste Kurs der Welt\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=2\"},\"object\":{\"content\":\"
Das ist die beste Datei der Welt. Sie ist so gut, dass sich niemand traut sie zu \u00F6ffnen.<\\/p>\",\"name\":\"Bestedatei\",\"type\":[\"resource\",\"ma:resource\"],\"url\":\"http://localhost/moodle/mod/resource/view.php?id=10\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-10-18T16:06:08+02:00\",\"type\":\"Add\"},{\"id\":569,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"target\":{\"name\":\"Testdatenbank\",\"type\":\"OrderedCollection\",\"url\":\"http://localhost/moodle/mod/data/view.php?id=9\"},\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"21\",\"name\":\"Testzahl\",\"type\":[\"database\",\"ma:record\"],\"url\":\"http://localhost/moodle/mod/data/view.php?d=2&rid=2\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-10-18T10:38:52+02:00\",\"type\":\"Add\"},{\"id\":546,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"target\":{\"name\":\"Testdatenbank\",\"type\":\"OrderedCollection\",\"url\":\"http://localhost/moodle/mod/data/view.php?id=9\"},\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"42\",\"name\":\"Testzahl\",\"type\":[\"database\",\"ma:record\"],\"url\":\"http://localhost/moodle/mod/data/view.php?d=1&rid=1\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-10-18T09:22:55+02:00\",\"type\":\"Add\"},{\"id\":543,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
Dies ist ein Testdatenbank.<\\/p>\",\"name\":\"Testdatenbank\",\"type\":[\"data\",\"ma:data\"],\"url\":\"http://localhost/moodle/mod/data/view.php?id=9\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-10-18T09:19:40+02:00\",\"type\":\"Add\"},{\"id\":540,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"target\":{\"name\":\"Testglossar\",\"type\":\"OrderedCollection\",\"url\":\"http://localhost/moodle/mod/glossary/view.php?id=8\"},\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
Testdefinition<\\/p>\",\"name\":\"Testbegriff\",\"type\":[\"glossary\",\"ma:entry\"],\"url\":\"http://localhost/moodle/mod/glossary/view.php?id=1\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-10-18T09:08:06+02:00\",\"type\":\"Add\"},{\"id\":537,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
Das ist ein Glossar.<\\/p>\",\"name\":\"Testglossar\",\"type\":[\"glossary\",\"ma:glossary\"],\"url\":\"http://localhost/moodle/mod/glossary/view.php?id=8\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-10-18T09:03:46+02:00\",\"type\":\"Add\"},{\"id\":491,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
Das ist google!<\\/p>\",\"name\":\"Link\",\"type\":[\"url\",\"ma:url\"],\"url\":\"http://localhost/moodle/mod/url/view.php?id=7\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-10-17T12:41:32+02:00\",\"type\":\"Add\"},{\"id\":489,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
Der zweite Versuch der Testdatei.<\\/p>\",\"name\":\"Testdatei 2\",\"type\":[\"resource\",\"ma:resource\"],\"url\":\"http://localhost/moodle/mod/resource/view.php?id=6\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-10-17T12:36:49+02:00\",\"type\":\"Add\"},{\"id\":485,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
Fragen und so<\\/p>\",\"name\":\"Testumfrage\",\"type\":[\"survey\",\"ma:survey\"],\"url\":\"http://localhost/moodle/mod/survey/view.php?id=5\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-10-17T12:33:56+02:00\",\"type\":\"Add\"},{\"id\":483,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
Dies ist die Testdatei.<\\/p>\",\"name\":\"Testdatei\",\"type\":[\"resource\",\"ma:resource\"],\"url\":\"http://localhost/moodle/mod/resource/view.php?id=4\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-10-17T12:27:46+02:00\",\"type\":\"Add\"},{\"id\":479,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"target\":{\"name\":\"TESTWIKI\",\"type\":\"Collection\",\"url\":\"http://localhost/moodle/mod/wiki/view.php?id=3\"},\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
Das ist ein tolles Wiki!<\\/p>\",\"name\":\"Kommentar\",\"type\":[\"comment\",\"ma:comment\"],\"url\":\"http://localhost/moodle/mod/comments.php?pageid=1\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-10-17T11:17:09+02:00\",\"type\":\"Add\"},{\"id\":475,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"target\":{\"name\":\"Test Ank\u00FCndigung\",\"type\":\"Collection\",\"url\":\"http://localhost/moodle/mod/wiki/view.php?id=3\"},\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"googhowhtowehzowh\",\"name\":\"TestWiki\",\"type\":[\"wiki\",\"ma:page\"],\"url\":\"http://localhost/moodle/mod/wiki/view.php?pageid=1\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-10-17T11:12:08+02:00\",\"type\":\"Updated\"},{\"id\":474,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"target\":{\"name\":\"Test Ank\u00FCndigung\",\"type\":\"Collection\",\"url\":\"http://localhost/moodle/mod/wiki/view.php?id=3\"},\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
googhowhtowehzowh<\\/p>\\n\",\"name\":\"TestWiki\",\"type\":[\"wiki\",\"ma:page\"],\"url\":\"http://localhost/moodle/mod/wiki/view.php?pageid=1\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-10-17T11:11:59+02:00\",\"type\":\"Add\"},{\"id\":472,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
Das ist das Test-Wiki.<\\/p>\",\"name\":\"TESTWIKI\",\"type\":[\"wiki\",\"ma:wiki\"],\"url\":\"http://localhost/moodle/mod/wiki/view.php?id=3\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-10-17T11:11:36+02:00\",\"type\":\"Add\"},{\"id\":382,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"target\":{\"name\":\"Ank\u00FCndigungen\",\"type\":\"OrderedCollection\",\"url\":\"http://localhost/moodle/mod/forum/view.php?id=1\"},\"context\":{\"name\":\"Der Beste Kurs der Welt\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=2\"},\"object\":{\"content\":\"
tztrzu678<\\/p>\",\"name\":\"ewrtwer\",\"type\":[\"forum\",\"ma:discussion\"],\"url\":\"http://localhost/moodle/mod/forum/discuss.php?d=5\"},\"actor\":{\"id\":\"test\",\"name\":\"Testor Testelsson\",\"type\":\"Person\"},\"published\":\"2016-10-14T13:58:41+02:00\",\"type\":\"Add\"},{\"id\":373,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"target\":{\"name\":\"Ank\u00FCndigungen\",\"type\":\"OrderedCollection\",\"url\":\"http://localhost/moodle/mod/forum/view.php?id=1\"},\"context\":{\"name\":\"Der Beste Kurs der Welt\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=2\"},\"object\":{\"content\":\"
gtrhtzzui<\\/p>\",\"name\":\"erzez\",\"type\":[\"forum\",\"ma:discussion\"],\"url\":\"http://localhost/moodle/mod/forum/discuss.php?d=4\"},\"actor\":{\"id\":\"test\",\"name\":\"Testor Testelsson\",\"type\":\"Person\"},\"published\":\"2016-10-14T13:53:18+02:00\",\"type\":\"Add\"},{\"id\":366,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"target\":{\"name\":\"Ank\u00FCndigungen\",\"type\":\"OrderedCollection\",\"url\":\"http://localhost/moodle/mod/forum/view.php?id=1\"},\"context\":{\"name\":\"Der Beste Kurs der Welt\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=2\"},\"object\":{\"content\":\"
sdfilgnsdilgbsdilb<\\/p>\",\"name\":\"Test2\",\"type\":[\"forum\",\"ma:discussion\"],\"url\":\"http://localhost/moodle/mod/forum/discuss.php?d=3\"},\"actor\":{\"id\":\"test\",\"name\":\"Testor Testelsson\",\"type\":\"Person\"},\"published\":\"2016-10-14T13:34:00+02:00\",\"type\":\"Add\"},{\"id\":191,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"target\":{\"name\":\"Ank\u00FCndigungen\",\"type\":\"OrderedCollection\",\"url\":\"http://localhost/moodle/mod/forum/view.php?id=2\"},\"context\":{\"name\":\"Testkurs 1\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=3\"},\"object\":{\"content\":\"
Dies ist eine angek\u00FCndigte Ank\u00FCndigung.
<\\/p>\",\"name\":\"Angek\u00FCndigte Ank\u00FCndigung\",\"type\":[\"forum\",\"ma:discussion\"],\"url\":\"http://localhost/moodle/mod/forum/discuss.php?d=2\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-10-13T12:16:03+02:00\",\"type\":\"Add\"},{\"id\":83,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"target\":{\"name\":\"Angek\u00FCndigte Ank\u00FCndigung\",\"context\":{\"name\":\"Ank\u00FCndigungen\",\"type\":\"Collection\",\"url\":\"http://localhost/moodle/mod/forum/view.php?id=\"},\"type\":\"OrderedCollection\",\"url\":\"http://localhost/moodle/mod/forum/discuss.php?d=2\"},\"context\":{\"name\":\"Der Beste Kurs der Welt\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=2\"},\"object\":{\"content\":\"
Dies ist eine angek\u00FCndigte Ank\u00FCndigung.
<\\/p>\",\"name\":\"Angek\u00FCndigte Ank\u00FCndigung\",\"type\":[\"forum\",\"ma:post\"],\"url\":\"http://localhost/moodle/mod/forum/discuss.php?d=2#p2\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-10-11T14:25:06+02:00\",\"type\":\"Add\"},{\"id\":74,\"@context\":\"http://www.w3.org/ns/activitystreams\",\"target\":{\"name\":\"Ank\u00FCndigungen\",\"type\":\"OrderedCollection\",\"url\":\"http://localhost/moodle/mod/forum/view.php?id=1\"},\"context\":{\"name\":\"Der Beste Kurs der Welt\",\"type\":\"Group\",\"url\":\"http://localhost/moodle/course/view.php?id=2\"},\"object\":{\"content\":\"
Dies ist ein Test!<\\/p>\",\"name\":\"Test Ank\u00FCndigung\",\"type\":[\"forum\",\"ma:discussion\"],\"url\":\"http://localhost/moodle/mod/forum/discuss.php?d=1\"},\"actor\":{\"id\":\"admin\",\"name\":\"Admin Nutzer\",\"type\":\"Person\"},\"published\":\"2016-10-11T14:11:25+02:00\",\"type\":\"Add\"}]";
-
- private static JSONArray createSampleData(long starttime) throws JSONException {
- if (starttime < 1479900319)
- return JSONFactoryUtil.createJSONArray(SAMPLE_DATA);
- else
- return JSONFactoryUtil.createJSONArray("[]");
- }
- public static void requestNewMoodleActivities(long userId, String username, String password)
+ public static void requestNewMoodleActivities(/*long userId, String username, String password*/)
throws ClientErrorException, PortalException, SystemException, DatatypeConfigurationException {
+
MoodleSocialActivity mostRecentMoodleActivity = MoodleSocialActivityLocalServiceUtil
- .getMostRecentMoodleSocialActivity(userId);
-
+ .getMostRecentMoodleSocialActivity();
+
long currentTime = System.currentTimeMillis() / 1000;
- // TODO: könnte eine fette abfrage werden wenn wirklich alle aktivitäten
- // geholt werden soll -> vielleicht doch immer auf 10 reduzieren oder so
- long starttime = (mostRecentMoodleActivity != null) ? mostRecentMoodleActivity.getPublished() + 1 : 0;
+
+ // TODO remove this block if time can be set via adminPortlet
+ Calendar c = Calendar.getInstance();
+ c.setTime(new Date());
+ c.add(Calendar.MONTH, -1);
+ Date date = c.getTime();
+
+ // TODO load from adminPortlet
+ long earliestStarttime = date.getTime() / 1000;
+
+ // defined earliest starttime, which is used if no most recent activity was found
+ long starttime = (mostRecentMoodleActivity != null) ? mostRecentMoodleActivity.getPublished() + 1 : earliestStarttime;
// System.out.println("starttime "+ starttime);
// System.out.println("currenttime "+ currentTime);
+
+ JSONArray mostRecentMoodleActivities = null;
+
try {
- // TODO: remove sample Data if rest service is deployed
- JSONArray mostRecentMoodleActivities = createSampleData(starttime);
-// JSONArray mostRecentMoodleActivities = MoodleRestClient.getLatestCourseNews(username, password, starttime,
-// currentTime, 0, 0);
-// System.out.println("mostRecentMoodleActivities: "+mostRecentMoodleActivities);
- /*
- * Alle mostRecentMoodleActivities zur DB hinzufügen fürht zu doppelten Einträgen. Daher maximale starttime
- * in DB raussuchen und nur neuere Einträge hinzufügen!
- */
- addMoodleSocialActivitiesToDB(userId, mostRecentMoodleActivities);
- } catch (Exception e) {
- // TODO: handle exception
+ mostRecentMoodleActivities = MoodleRestClient.getLatestCourseNews(starttime,
+ currentTime, 0, 0);
+ } catch (JSONException | ClientErrorException e) {
+ _log.error(e); // log error to inform admins
}
+
+ // if there are no new activities mostRecentMoodleActivities is [], which results in length of 0
+ if (mostRecentMoodleActivities != null)
+ addMoodleSocialActivitiesToDB(mostRecentMoodleActivities);
}
- public static void addMoodleSocialActivitiesToDB(long userId, JSONArray extActivities) throws PortalException,
+ public static void addMoodleSocialActivitiesToDB(JSONArray extActivities) throws PortalException,
SystemException, DatatypeConfigurationException {
for (int i = 0; i < extActivities.length(); i++) {
- addMoodleSocialActivityToDB(userId, extActivities.getJSONObject(i));
+ addMoodleSocialActivityToDB(extActivities.getJSONObject(i));
}
}
- private static MoodleSocialActivity addMoodleSocialActivityToDB(long userId, JSONObject data)
+ private static MoodleSocialActivity addMoodleSocialActivityToDB(JSONObject data)
throws PortalException, SystemException, DatatypeConfigurationException {
JSONObject context = data.getJSONObject("context");
@@ -84,7 +90,13 @@ else if (extActivityType.equals("ma:page"))
long published = DatatypeFactory.newInstance().newXMLGregorianCalendar(data.getString("published"))
.toGregorianCalendar().getTimeInMillis() / 1000;
- // TODO Nutzer der Webservice abruft muss nicht zwingend auch die Activität erzeugt haben!
+ // Audience contains the user (by screenName), that this activity will be displayed to.
+ // That means, the same Activity is stored for each user separately.
+ JSONObject audience = data.getJSONObject("audience");
+ String screenName = audience.getString("name");
+ User user = UserLocalServiceUtil.getUserByScreenName(PortalUtil.getDefaultCompanyId(), screenName);
+
+ long userId = user.getUserId();
MoodleSocialActivity result = MoodleSocialActivityLocalServiceUtil.addMoodleSocialActivity(userId,
activityType, extActivityType, extServiceContext, data.toString(), published);
@@ -102,4 +114,6 @@ else if (extActivityType.equals("ma:page"))
return result; // wozu?
}
+
+ private static Log _log = LogFactoryUtil.getLog(ExtSocialActivityUtil.class);
}
diff --git a/portlets/up-activities-portlet/docroot/WEB-INF/src/de/unipotsdam/elis/activities/service/impl/MoodleSocialActivityLocalServiceImpl.java b/portlets/up-activities-portlet/docroot/WEB-INF/src/de/unipotsdam/elis/activities/service/impl/MoodleSocialActivityLocalServiceImpl.java
index 3cb39249512a..78231dd3e21d 100644
--- a/portlets/up-activities-portlet/docroot/WEB-INF/src/de/unipotsdam/elis/activities/service/impl/MoodleSocialActivityLocalServiceImpl.java
+++ b/portlets/up-activities-portlet/docroot/WEB-INF/src/de/unipotsdam/elis/activities/service/impl/MoodleSocialActivityLocalServiceImpl.java
@@ -19,6 +19,7 @@
import com.liferay.portal.kernel.dao.orm.DynamicQuery;
import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil;
import com.liferay.portal.kernel.dao.orm.OrderFactoryUtil;
+import com.liferay.portal.kernel.dao.orm.ProjectionFactoryUtil;
import com.liferay.portal.kernel.dao.orm.PropertyFactoryUtil;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
@@ -56,6 +57,22 @@ public class MoodleSocialActivityLocalServiceImpl extends MoodleSocialActivityLo
* moodle social activity local service.
*/
+ public MoodleSocialActivity getMostRecentMoodleSocialActivity() throws SystemException {
+
+ // select max published value
+ DynamicQuery subQuery = DynamicQueryFactoryUtil.forClass(MoodleSocialActivity.class)
+ .setProjection(ProjectionFactoryUtil.max("published"));
+
+ // select MoodleSocialActivity where published = max(published)
+ DynamicQuery query = DynamicQueryFactoryUtil.forClass(MoodleSocialActivity.class)
+ .add(PropertyFactoryUtil.forName("published").eq(subQuery));
+
+ List> result = MoodleSocialActivityLocalServiceUtil.dynamicQuery(query, 0, 1);
+ if (result.size() > 0)
+ return (MoodleSocialActivity) result.get(0);
+ return null;
+ }
+
public MoodleSocialActivity getMostRecentMoodleSocialActivity(long userId) throws SystemException {
DynamicQuery query = DynamicQueryFactoryUtil.forClass(MoodleSocialActivity.class)
.add(PropertyFactoryUtil.forName("userId").eq(new Long(userId)))
diff --git a/portlets/up-activities-portlet/docroot/html/view_activity_sets.jsp b/portlets/up-activities-portlet/docroot/html/view_activity_sets.jsp
index e3344ee79e62..1c83267192ec 100644
--- a/portlets/up-activities-portlet/docroot/html/view_activity_sets.jsp
+++ b/portlets/up-activities-portlet/docroot/html/view_activity_sets.jsp
@@ -26,7 +26,7 @@
<%
List