diff --git a/main/auth/courses_categories.php b/main/auth/courses_categories.php
index b86a7a71936..670af9c598b 100755
--- a/main/auth/courses_categories.php
+++ b/main/auth/courses_categories.php
@@ -323,7 +323,7 @@ function returnThumbnail($course, $registeredUser)
}
$html .= '
';
- $html .= return_description_button($course);
+ $html .= CourseManager::returnDescriptionButton($course);
$html .= '
';
return $html;
@@ -421,33 +421,6 @@ function return_title($course, $registeredUser)
return $html;
}
-/**
- * Display the description button of a course in the course catalog
- * @param array $course
- *
- * @return string HTML string
- */
-function return_description_button($course)
-{
- $title = $course['title'];
- $html = '';
- if (api_get_setting('show_courses_descriptions_in_catalog') == 'true') {
- $html = Display::url(
- Display::returnFontAwesomeIcon('info-circle'),
- api_get_path(WEB_CODE_PATH).'inc/ajax/course_home.ajax.php?a=show_course_information&code='.$course['code'],
- array(
- 'class' => 'ajax btn btn-default btn-sm',
- 'data-title' => $title,
- 'title' => get_lang('Description'),
- 'aria-label' => get_lang('Description'),
- 'data-size' => 'lg'
- )
- );
- }
-
- return $html;
-}
-
/**
* Display the goto course button of a course in the course catalog
* @param $course
diff --git a/main/inc/lib/course.lib.php b/main/inc/lib/course.lib.php
index 677101c2df9..c9e94a7c4ca 100755
--- a/main/inc/lib/course.lib.php
+++ b/main/inc/lib/course.lib.php
@@ -5048,21 +5048,10 @@ public static function processHotCourseItem($courses, $my_course_code_list = arr
}
// end buycourse validation
- //Description
- $my_course['description_button'] = '';
- $my_course['description_button'] = Display::url(
- Display::returnFontAwesomeIcon('info-circle'),
- api_get_path(WEB_AJAX_PATH).'course_home.ajax.php?a=show_course_information&code='.$course_info['code'],
- [
- 'class' => 'btn btn-default btn-sm ajax',
- 'data-title' => get_lang('Description'),
- 'title' => get_lang('Description'),
- 'aria-label' => get_lang('Description')
- ]
- );
+ // Description
+ $my_course['description_button'] = self::returnDescriptionButton($course_info);
$my_course['teachers'] = self::getTeachersFromCourse($course_info['real_id'], true);
$point_info = self::get_course_ranking($course_info['real_id'], 0);
-
$my_course['rating_html'] = '';
if (api_get_configuration_value('hide_course_rating') === false) {
$my_course['rating_html'] = Display::return_rating_system(
@@ -6559,4 +6548,31 @@ public static function getCourseCategoriesFromCourseList(array $courseList)
return $categories;
}
+
+ /**
+ * Display the description button of a course in the course catalog
+ * @param array $course
+ *
+ * @return string HTML string
+ */
+ public static function returnDescriptionButton($course)
+ {
+ $title = $course['title'];
+ $html = '';
+ if (api_get_setting('show_courses_descriptions_in_catalog') == 'true') {
+ $html = Display::url(
+ Display::returnFontAwesomeIcon('info-circle', 2),
+ api_get_path(WEB_CODE_PATH).'inc/ajax/course_home.ajax.php?a=show_course_information&code='.$course['code'],
+ array(
+ 'class' => 'ajax btn btn-default btn-sm',
+ 'data-title' => $title,
+ 'title' => get_lang('Description'),
+ 'aria-label' => get_lang('Description'),
+ 'data-size' => 'lg'
+ )
+ );
+ }
+
+ return $html;
+ }
}
diff --git a/plugin/buycourses/lang/english.php b/plugin/buycourses/lang/english.php
index 00003d50266..33cc86dad77 100644
--- a/plugin/buycourses/lang/english.php
+++ b/plugin/buycourses/lang/english.php
@@ -10,7 +10,6 @@
$strings['transfer_enable'] = "Enable bank transfer";
$strings['unregistered_users_enable'] = "Allow anonymous users";
$strings['Free'] = "FREE";
-
$strings['PaypalPayoutCommissions'] = "Paypal Payout Commissions";
$strings['MyPayouts'] = "My payments";
$strings['Commission'] = "Commission";
@@ -136,4 +135,5 @@
$strings['SWIFT_help'] = "Standard format of Bank Identifier Codes (BIC) and serves as a unique identifier for a bank or financial institution";
$strings['PleaseSelectThePaymentMethodBeforeConfirmYourOrder'] = "Please select your favorite payment method before confirming your order";
$strings['NoPaymentOptionAvailable'] = 'No payment option available. Please report to the administrator.';
-$strings['XIsOnlyPaymentMethodAvailable'] = '%s is the only payment method available for this purchase.';
\ No newline at end of file
+$strings['XIsOnlyPaymentMethodAvailable'] = '%s is the only payment method available for this purchase.';
+$strings['hide_free_text'] = "Hide 'Free' text";
diff --git a/plugin/buycourses/src/buy_course_plugin.class.php b/plugin/buycourses/src/buy_course_plugin.class.php
index 2546a942f17..f58f7a3a9b5 100644
--- a/plugin/buycourses/src/buy_course_plugin.class.php
+++ b/plugin/buycourses/src/buy_course_plugin.class.php
@@ -86,6 +86,7 @@ public function __construct()
'culqi_enable' => 'boolean',
'commissions_enable' => 'boolean',
'unregistered_users_enable' => 'boolean',
+ 'hide_free_text' => 'boolean',
)
);
}
@@ -171,24 +172,28 @@ public function buyCoursesForGridCatalogValidator($productId, $productType)
$return = [];
$paypal = $this->get('paypal_enable') === 'true';
$transfer = $this->get('transfer_enable') === 'true';
+ $hideFree = $this->get('hide_free_text') === 'true';
if ($paypal || $transfer) {
$item = $this->getItemByProduct($productId, $productType);
- $return['html'] = '';
+ $html = '
';
if ($item) {
- $return['html'] .= ''.$item['iso_code'].' '.$item['price']
- .'';
+ $html .= ''.$item['iso_code'].' '.$item['price'].'';
$return['verificator'] = true;
} else {
- $return['html'] .= ''.$this->get_lang('Free')
- .'';
+ if ($hideFree == false) {
+ $html .= ''.$this->get_lang('Free').'';
+ }
$return['verificator'] = false;
}
- $return['html'] .= '
';
+ $html .= '
';
+ $return['html'] = $html;
} else {
return false;
}
+
+
return $return;
}