From 2a0f50f6e08d97dfd64f55470a936690802c7f45 Mon Sep 17 00:00:00 2001 From: Julio Date: Fri, 21 Sep 2018 11:37:01 +0200 Subject: [PATCH] Minor - flint fixes --- .../src/buy_course_plugin.class.php | 62 +++++++++---------- user_portal.php | 1 - 2 files changed, 31 insertions(+), 32 deletions(-) diff --git a/plugin/buycourses/src/buy_course_plugin.class.php b/plugin/buycourses/src/buy_course_plugin.class.php index 265d646cc4..b0c72bb51f 100644 --- a/plugin/buycourses/src/buy_course_plugin.class.php +++ b/plugin/buycourses/src/buy_course_plugin.class.php @@ -2216,6 +2216,37 @@ class BuyCoursesPlugin extends Plugin return $return; } + /** + * @param array $saleInfo + * + * @return string + */ + public function getSubscriptionSuccessMessage(array $saleInfo) + { + switch ($saleInfo['product_type']) { + case self::PRODUCT_TYPE_COURSE: + $courseInfo = api_get_course_info_by_id($saleInfo['product_id']); + $url = api_get_course_url($courseInfo['code']); + break; + case self::PRODUCT_TYPE_SESSION: + $sessionId = (int) $saleInfo['product_id']; + $url = api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.$sessionId; + break; + default: + $url = '#'; + } + + return Display::return_message( + sprintf( + $this->get_lang('SubscriptionToCourseXSuccessful'), + $url, + $saleInfo['product_name'] + ), + 'success', + false + ); + } + /** * Filter the registered courses for show in plugin catalog. * @@ -2542,35 +2573,4 @@ class BuyCoursesPlugin extends Plugin ['id = ?' => (int) $serviceSaleId] ); } - - /** - * @param array $saleInfo - * - * @return string - */ - public function getSubscriptionSuccessMessage(array $saleInfo) - { - switch ($saleInfo['product_type']) { - case self::PRODUCT_TYPE_COURSE: - $courseInfo = api_get_course_info_by_id($saleInfo['product_id']); - $url = api_get_course_url($courseInfo['code']); - break; - case self::PRODUCT_TYPE_SESSION: - $sessionId = (int) $saleInfo['product_id']; - $url = api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.$sessionId; - break; - default: - $url = '#'; - } - - return Display::return_message( - sprintf( - $this->get_lang('SubscriptionToCourseXSuccessful'), - $url, - $saleInfo['product_name'] - ), - 'success', - false - ); - } } diff --git a/user_portal.php b/user_portal.php index 8bae242335..f97d359e66 100755 --- a/user_portal.php +++ b/user_portal.php @@ -303,4 +303,3 @@ Session::erase('session_id'); Session::erase('id_session'); Session::erase('studentview'); api_remove_in_gradebook(); -