-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #60 from oat-sa/release-2.0.0
Release 2.0.0
- Loading branch information
Showing
14 changed files
with
271 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
/** | ||
* 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; under version 2 | ||
* of the License (non-upgradable). | ||
* | ||
* 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, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
* | ||
* Copyright (c) 2017 (original work) Open Assessment Technologies SA | ||
* | ||
*/ | ||
|
||
namespace oat\taoLti\models\classes; | ||
|
||
use oat\tao\model\mvc\error\ExceptionInterpretor; | ||
|
||
/** | ||
* Class ExceptionInterpreter | ||
* @package oat\taoLti\models\classes | ||
* @author Aleh Hutnikau, <hutnikau@1pt.com> | ||
*/ | ||
class ExceptionInterpreter extends ExceptionInterpretor | ||
{ | ||
/** | ||
* @var \taoLti_models_classes_LtiException | ||
*/ | ||
protected $exception; | ||
|
||
/** | ||
* set exception to interpet | ||
* @param \Exception $exception | ||
* @return ExceptionInterpretor | ||
*/ | ||
public function setException(\Exception $exception){ | ||
parent::setException($exception); | ||
\common_Logger::e($exception->__toString()); | ||
return $this; | ||
} | ||
|
||
/** | ||
* return an instance of ResponseInterface | ||
* @return \oat\tao\model\mvc\error\class | ||
*/ | ||
public function getResponse() | ||
{ | ||
$response = new LtiReturnResponse; | ||
$response->setServiceLocator($this->getServiceLocator()); | ||
$response->setException($this->exception); | ||
return $response; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
/** | ||
* 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; under version 2 | ||
* of the License (non-upgradable). | ||
* | ||
* 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, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
* | ||
* Copyright (c) 2017 (original work) Open Assessment Technologies SA | ||
* | ||
*/ | ||
namespace oat\taoLti\models\classes; | ||
|
||
use oat\tao\model\mvc\error\ResponseAbstract; | ||
use oat\tao\helpers\Template; | ||
|
||
/** | ||
* Class LtiReturnResponse | ||
* | ||
* Redirect to lti return url | ||
* | ||
* @package oat\taoLti\models\classes | ||
* @author Aleh Hutnikau, <hutnikau@1pt.com> | ||
* @property \taoLti_models_classes_LtiException $exception | ||
*/ | ||
class LtiReturnResponse extends ResponseAbstract | ||
{ | ||
|
||
public function setHttpCode($code) { | ||
$this->httpCode = 302; | ||
return $this; | ||
} | ||
|
||
public function send() | ||
{ | ||
/** @var \taoLti_models_classes_TaoLtiSession $session */ | ||
$session = \common_session_SessionManager::getSession(); | ||
if ($session instanceof \taoLti_models_classes_TaoLtiSession) { | ||
$launchData = $session->getLaunchData(); | ||
$baseUrl = $launchData->getReturnUrl(); | ||
} else { | ||
$request = \common_http_Request::currentRequest(); | ||
$params = $request->getParams(); | ||
isset($params[\taoLti_models_classes_LtiLaunchData::LAUNCH_PRESENTATION_RETURN_URL]) ? | ||
$baseUrl = $params[\taoLti_models_classes_LtiLaunchData::LAUNCH_PRESENTATION_RETURN_URL] : null; | ||
} | ||
|
||
if ($baseUrl !== null) { | ||
$params = $this->exception->getLtiMessage()->getUrlParams(); | ||
$url = $baseUrl . (parse_url($baseUrl, PHP_URL_QUERY) ? '&' : '?') . http_build_query($params); | ||
header(\HTTPToolkit::locationHeader($url)); | ||
} else { | ||
require Template::getTemplate('error/error500.tpl', 'tao'); | ||
} | ||
return; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.