diff --git a/src/RwthMoodleApiLib/Config.php b/src/RwthMoodleApiLib/Config.php new file mode 100644 index 0000000000000000000000000000000000000000..27b12a11ac10f928eda9dab444786ccafd34f274 --- /dev/null +++ b/src/RwthMoodleApiLib/Config.php @@ -0,0 +1,49 @@ +<?php +/** + * The Moodle Webservice API Wrapper of the Rwth Aachen University + * + * PHP Version 7.0 + * + * RwthMoodleApiLib + * Copyright (C) 2017 Marco Schlicht PIT RWTH Aachen + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * @category RwthMoodleApiLib + * @package RwthMoodleApiLib + * @author Marco Schlicht <marcoschlicht@onlinehome.de> + * @copyright 2017 Marco Schlicht PIT RWTH Aachen + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @link https://git.rwth-aachen.de/moodle/rwth_moodle_api + **/ + +namespace RwthMoodleApiLib; + +/** + * Config File + * + * @category Config + * @package RwthMoodleApiLib + * @author Marco Schlicht <marcoschlicht@onlinehome.de> + * @copyright 2017 Marco Schlicht PIT RWTH Aachen + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @link https://git.rwth-aachen.de/moodle/rwth_moodle_api + **/ +namespace RwthMoodleApiLib; + +class Config +{ + public static $moodle_url = "https://d-mo01.devlef.campus.rwth-aachen.de/moodlems/"; +} +?> diff --git a/src/RwthMoodleApiLib/Injector/Injector.php b/src/RwthMoodleApiLib/Injector/Injector.php index e5e8e253a417dc18152d77bf38c57e34ebfaa4d5..0eb86542c582c755736d79ac9bfd9d5e2e44b1db 100644 --- a/src/RwthMoodleApiLib/Injector/Injector.php +++ b/src/RwthMoodleApiLib/Injector/Injector.php @@ -56,7 +56,7 @@ class Injector implements InjectorInterface /** * Constructor **/ - public function __construct() + public function __construct($url=Null) { //observers $informationalObserver = new Logging\ConsoleLogger(6); @@ -75,7 +75,10 @@ class Injector implements InjectorInterface //http client //needs an / at the end //TODO throw error if not or rebuild the uri - $this->httpClient = new Http\Client($this->loggingManager, ["base_uri" => "http://localhost/moodle/"]); + if (is_null($url)) { + $url = RwthMoodleApiLib\Config::$moodle_url; + } + $this->httpClient = new Http\Client($this->loggingManager, ["base_uri" => $url]); //rwth moodle api $this->rwthMoodleApiLib = new RwthMoodleApiLib\RwthMoodleApiLib($this->loggingManager, $this->httpClient); }