Skip to content
Snippets Groups Projects
Commit a7fa059d authored by Marco Schlicht's avatar Marco Schlicht
Browse files

trying to get the posts from update id

parent f9533e79
No related branches found
No related tags found
No related merge requests found
...@@ -3,3 +3,5 @@ types_*.taghl ...@@ -3,3 +3,5 @@ types_*.taghl
vendor vendor
composer.lock composer.lock
*.dia.autosave *.dia.autosave
reports/*
autoload.inc.php
This diff is collapsed.
...@@ -3,4 +3,4 @@ ...@@ -3,4 +3,4 @@
# run one test # run one test
# phpunit --verbose --colors=always --bootstrap src/autoload.inc.php tests/RwthMoodleApi/RwthMoodleApiTest # phpunit --verbose --colors=always --bootstrap src/autoload.inc.php tests/RwthMoodleApi/RwthMoodleApiTest
# phpunit --colors=always --bootstrap src/autoload.inc.php tests/RwthMoodleApi/RwthMoodleApiTest # phpunit --colors=always --bootstrap src/autoload.inc.php tests/RwthMoodleApi/RwthMoodleApiTest
phpunit --verbose --strict-coverage --strict-global-state --colors=always --bootstrap src/autoload.inc.php tests/ phpunit --verbose --strict-global-state --colors=always --bootstrap src/autoload.inc.php tests/
...@@ -93,7 +93,7 @@ class WhatsNew extends CourseRoom implements WhatsNewInterface ...@@ -93,7 +93,7 @@ class WhatsNew extends CourseRoom implements WhatsNewInterface
$sharedDocuments = array(); $sharedDocuments = array();
$wikis = array(); $wikis = array();
foreach ($updates->instances as $update) { foreach ($updates->instances as $update) {
/* print_r($update); */ print_r($update);
/* $params_mod = array("cmid"=>$update->id); */ /* $params_mod = array("cmid"=>$update->id); */
/* print_r($params_mod); */ /* print_r($params_mod); */
/* $module_raw = $this->getApi()->restCall('core_course_get_course_module', $params_mod); */ /* $module_raw = $this->getApi()->restCall('core_course_get_course_module', $params_mod); */
...@@ -111,18 +111,18 @@ class WhatsNew extends CourseRoom implements WhatsNewInterface ...@@ -111,18 +111,18 @@ class WhatsNew extends CourseRoom implements WhatsNewInterface
"wikis"=> $wikis, "wikis"=> $wikis,
"Status"=> $Status // true "Status"=> $Status // true
); );
$module_raw = $this->getApi()->restCall('mod_forum_get_forum_discussions_paginated', array("forumid"=>18)); /* $module_raw = $this->getApi()->restCall('mod_forum_get_forum_discussions_paginated', array("forumid"=>18)); */
/* $module_raw = $this->getApi()->restCall('core_course_get_course_module_by_instance', array("module"=>"module", "instance"=>18)); */ /* $module_raw = $this->getApi()->restCall('core_course_get_course_module_by_instance', array("module"=>"module", "instance"=>18)); */
/* $module_raw = $this->getApi()->restCall('core_course_get_course_module', array("cmid"=>18)); */ /* $module_raw = $this->getApi()->restCall('core_course_get_course_module', array("cmid"=>18)); */
/* print_r(json_decode($module_raw->getBody())); */ /* print_r(json_decode($module_raw->getBody())); */
/* echo "----------"; */ /* echo "----------"; */
$module_raw = $this->getApi()->restCall('core_course_get_course_module', array("cmid"=>333)); /* $module_raw = $this->getApi()->restCall('core_course_get_course_module', array("cmid"=>333)); */
/* print_r($module_raw); */ /* print_r($module_raw); */
$module_raw = $this->getApi()->restCall('core_course_get_course_module', array("cmid"=>334)); /* $module_raw = $this->getApi()->restCall('core_course_get_course_module', array("cmid"=>334)); */
/* print_r($module_raw); */ /* print_r($module_raw); */
} catch (\RwthMoodleApi\Exceptions\MoodleException $m){ } catch (\RwthMoodleApi\Exceptions\MoodleException $m){
/* echo "FEHHHLER"; */ echo "FEHHHLER";
/* echo (string)$m; */ echo (string)$m;
} }
return $out; return $out;
} }
......
<?php
// @codingStandardsIgnoreFile
// @codeCoverageIgnoreStart
// this is an autogenerated file - do not edit
spl_autoload_register(
function($class) {
static $classes = null;
if ($classes === null) {
$classes = array(
'rwthmoodleapi\\controller\\announcement' => '/RwthMoodleApi/Controller/Announcement.php',
'rwthmoodleapi\\controller\\announcementinterface' => '/Interfaces/Controller/AnnouncementInterface.php',
'rwthmoodleapi\\controller\\apicontroller' => '/RwthMoodleApi/Controller/ApiController.php',
'rwthmoodleapi\\controller\\apicontrollerinterface' => '/Interfaces/Controller/ApiControllerInterface.php',
'rwthmoodleapi\\controller\\assignment' => '/RwthMoodleApi/Controller/Assignment.php',
'rwthmoodleapi\\controller\\assignmentinterface' => '/Interfaces/Controller/AssignmentInterface.php',
'rwthmoodleapi\\controller\\courseroom' => '/RwthMoodleApi/Controller/CourseRoom.php',
'rwthmoodleapi\\controller\\courseroominterface' => '/Interfaces/Controller/CourseRoomInterface.php',
'rwthmoodleapi\\controller\\download' => '/RwthMoodleApi/Controller/Download.php',
'rwthmoodleapi\\controller\\downloadinterface' => '/Interfaces/Controller/DownloadInterface.php',
'rwthmoodleapi\\controller\\email' => '/RwthMoodleApi/Controller/Email.php',
'rwthmoodleapi\\controller\\emailinterface' => '/Interfaces/Controller/EmailInterface.php',
'rwthmoodleapi\\controller\\exam' => '/RwthMoodleApi/Controller/ExamResult.php',
'rwthmoodleapi\\controller\\examresultinterface' => '/Interfaces/Controller/ExamResultInterface.php',
'rwthmoodleapi\\controller\\hyperlink' => '/RwthMoodleApi/Controller/Hyperlink.php',
'rwthmoodleapi\\controller\\hyperlinkinterface' => '/Interfaces/Controller/HyperlinkInterface.php',
'rwthmoodleapi\\controller\\learningmaterial' => '/RwthMoodleApi/Controller/LearningMaterial.php',
'rwthmoodleapi\\controller\\learningmaterialinterface' => '/Interfaces/Controller/LearningMaterialInterface.php',
'rwthmoodleapi\\controller\\literatur' => '/RwthMoodleApi/Controller/Literatur.php',
'rwthmoodleapi\\controller\\literaturinterface' => '/Interfaces/Controller/LiteraturInterface.php',
'rwthmoodleapi\\controller\\shareddocument' => '/RwthMoodleApi/Controller/SharedDocument.php',
'rwthmoodleapi\\controller\\shareddocumentinterface' => '/Interfaces/Controller/SharedDocumentInterface.php',
'rwthmoodleapi\\controller\\special' => '/RwthMoodleApi/Controller/Special.php',
'rwthmoodleapi\\controller\\specialinterface' => '/Interfaces/Controller/SpecialInterface.php',
'rwthmoodleapi\\controller\\whatsnew' => '/RwthMoodleApi/Controller/WhatsNew.php',
'rwthmoodleapi\\controller\\whatsnewinterface' => '/Interfaces/Controller/WhatsNewInterface.php',
'rwthmoodleapi\\exceptions\\badresponseexception' => '/Exceptions/Http/BadResponseException.php',
'rwthmoodleapi\\exceptions\\badresponseexceptioninterface' => '/Interfaces/Exception/Http/BadResponseExceptionInterface.php',
'rwthmoodleapi\\exceptions\\clientexception' => '/Exceptions/Http/ClientException.php',
'rwthmoodleapi\\exceptions\\clientexceptioninterface' => '/Interfaces/Exception/Http/ClientExceptionInterface.php',
'rwthmoodleapi\\exceptions\\httpexception' => '/Exceptions/Http/HttpException.php',
'rwthmoodleapi\\exceptions\\httpexceptioninterface' => '/Interfaces/Exception/Http/HttpExceptionInterface.php',
'rwthmoodleapi\\exceptions\\moodleerror' => '/Exceptions/Moodle/MoodleError.php',
'rwthmoodleapi\\exceptions\\moodleerrorinterface' => '/Interfaces/Exception/Moodle/MoodleErrorInterface.php',
'rwthmoodleapi\\exceptions\\moodleexception' => '/Exceptions/Moodle/MoodleException.php',
'rwthmoodleapi\\exceptions\\moodleexceptioninterface' => '/Interfaces/Exception/Moodle/MoodleExceptionInterface.php',
'rwthmoodleapi\\exceptions\\moodleresponseexception' => '/Exceptions/Moodle/MoodleResponseException.php',
'rwthmoodleapi\\exceptions\\moodleresponseexceptioninterface' => '/Interfaces/Exception/Moodle/MoodleResponseExceptionInterface.php',
'rwthmoodleapi\\exceptions\\notloggedinexception' => '/Exceptions/NotLoggedInException.php',
'rwthmoodleapi\\exceptions\\requestexception' => '/Exceptions/Http/RequestException.php',
'rwthmoodleapi\\exceptions\\requestexceptioninterface' => '/Interfaces/Exception/Http/RequestExceptionInterface.php',
'rwthmoodleapi\\exceptions\\rwthmoodleapiexception' => '/Exceptions/RwthMoodleApiException.php',
'rwthmoodleapi\\exceptions\\rwthmoodleapiexceptioninterface' => '/Interfaces/Exception/RwthMoodleApiExceptionInterface.php',
'rwthmoodleapi\\exceptions\\serverexception' => '/Exceptions/Http/ServerException.php',
'rwthmoodleapi\\exceptions\\serverexceptioninterface' => '/Interfaces/Exception/Http/ServerExceptionInterface.php',
'rwthmoodleapi\\http\\client' => '/RwthMoodleApi/Http/Client.php',
'rwthmoodleapi\\http\\clientinterface' => '/Interfaces/Http/ClientInterface.php',
'rwthmoodleapi\\http\\message' => '/RwthMoodleApi/Http/Message.php',
'rwthmoodleapi\\http\\messageinterface' => '/Interfaces/Http/MessageInterface.php',
'rwthmoodleapi\\http\\request' => '/RwthMoodleApi/Http/Request.php',
'rwthmoodleapi\\http\\requestinterface' => '/Interfaces/Http/RequestInterface.php',
'rwthmoodleapi\\http\\response' => '/RwthMoodleApi/Http/Response.php',
'rwthmoodleapi\\http\\responseinterface' => '/Interfaces/Http/ResponseInterface.php',
'rwthmoodleapi\\injector\\injector' => '/RwthMoodleApi/Injector/Injector.php',
'rwthmoodleapi\\injector\\injectorinterface' => '/Interfaces/Injector/InjectorInterface.php',
'rwthmoodleapi\\logging\\consolelogger' => '/RwthMoodleApi/Logging/ConsoleLogger.php',
'rwthmoodleapi\\logging\\loggingmanager' => '/RwthMoodleApi/Logging/LoggingManager.php',
'rwthmoodleapi\\logging\\loggingmanagerinterface' => '/Interfaces/Logging/LoggingManagerInterface.php',
'rwthmoodleapi\\logging\\observer' => '/RwthMoodleApi/Logging/Observer.php',
'rwthmoodleapi\\logging\\observerinterface' => '/Interfaces/Logging/ObserverInterface.php',
'rwthmoodleapi\\rwthmoodleapi' => '/RwthMoodleApi/RwthMoodleApi.php',
'rwthmoodleapi\\rwthmoodleapiinterface' => '/Interfaces/RwthMoodleApiInterface.php'
);
}
$cn = strtolower($class);
if (isset($classes[$cn])) {
require __DIR__ . $classes[$cn];
}
},
true,
false
);
// @codeCoverageIgnoreEnd
<?php <?php
xdebug_start_code_coverage();
function a($a) { include("src/autoload.inc.php");
echo $a * 2.5;
}
function b($count) { use RwthMoodleApi\Http as Http;
for ($i = 0; $i < $count; $i++) { use RwthMoodleApi\Exceptions as Exceptions;
a($i + 0.17); use RwthMoodleApi\Logging as Logging;
} use RwthMoodleApi\Injector as Injector;
} use RwthMoodleApi\Controller as Controller;
b(6);
b(10);
var_dump(xdebug_get_code_coverage());
$injector = new Injector\Injector();
$api = $injector->getRwthMoodleApi();
$api->extTokenLogin("webtoken", "ext_token_login_user", "webservice");
$cid = 3;
$since = 99999;
$params = array('courseid'=>$cid, 'since'=>$since, 'filter'=>array());
$out_raw = $api->restCall('core_course_get_updates_since', $params);
$out = json_decode($out_raw->getBody());
print_r($out);
$updates = $out->instances[0]->updates[1];
print_r($updates);
foreach ($updates->itemids as $instance_id) {
/* $forum = $api->restCall('core_course_get_course_module', array("cmid"=>$instance_id)); */
/* $forum = $api->restCall('core_course_get_course_module_by_instance', array("module"=>"forum", "instance"=>$instance_id)); */
/* $forum = $api->restCall('mod_forum_get_forum_discussions_paginated', array("forumid"=>$instance_id)); */
/* print_r($forum); */
}
$announcement = $api->restCall('core_course_get_course_module', array("cmid"=>18));
print_r(json_decode($announcement->getBody()));
$lol = $api->restCall('mod_forum_get_forum_discussions_paginated', array("forumid"=>2));
print_r(json_decode($lol->getBody()));
$lol = $api->restCall('mod_forum_get_forum_discussion_posts', array("discussionid"=>107));
print_r(json_decode($lol->getBody()));
?> ?>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment