Add "hide_free_text" option, increase size of information icon BT#13816

pull/2487/head
jmontoyaa 8 years ago
parent 05121f1705
commit 8ed3049a9e
  1. 29
      main/auth/courses_categories.php
  2. 40
      main/inc/lib/course.lib.php
  3. 2
      plugin/buycourses/lang/english.php
  4. 17
      plugin/buycourses/src/buy_course_plugin.class.php

@ -323,7 +323,7 @@ function returnThumbnail($course, $registeredUser)
} }
$html .= '<div class="user-actions">'; $html .= '<div class="user-actions">';
$html .= return_description_button($course); $html .= CourseManager::returnDescriptionButton($course);
$html .= '</div></div>'; $html .= '</div></div>';
return $html; return $html;
@ -421,33 +421,6 @@ function return_title($course, $registeredUser)
return $html; 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 * Display the goto course button of a course in the course catalog
* @param $course * @param $course

@ -5049,20 +5049,9 @@ class CourseManager
// end buycourse validation // end buycourse validation
// Description // Description
$my_course['description_button'] = ''; $my_course['description_button'] = self::returnDescriptionButton($course_info);
$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')
]
);
$my_course['teachers'] = self::getTeachersFromCourse($course_info['real_id'], true); $my_course['teachers'] = self::getTeachersFromCourse($course_info['real_id'], true);
$point_info = self::get_course_ranking($course_info['real_id'], 0); $point_info = self::get_course_ranking($course_info['real_id'], 0);
$my_course['rating_html'] = ''; $my_course['rating_html'] = '';
if (api_get_configuration_value('hide_course_rating') === false) { if (api_get_configuration_value('hide_course_rating') === false) {
$my_course['rating_html'] = Display::return_rating_system( $my_course['rating_html'] = Display::return_rating_system(
@ -6559,4 +6548,31 @@ class CourseManager
return $categories; 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;
}
} }

@ -10,7 +10,6 @@ $strings['commissions_enable'] = "Enable Commissions";
$strings['transfer_enable'] = "Enable bank transfer"; $strings['transfer_enable'] = "Enable bank transfer";
$strings['unregistered_users_enable'] = "Allow anonymous users"; $strings['unregistered_users_enable'] = "Allow anonymous users";
$strings['Free'] = "FREE"; $strings['Free'] = "FREE";
$strings['PaypalPayoutCommissions'] = "Paypal Payout Commissions"; $strings['PaypalPayoutCommissions'] = "Paypal Payout Commissions";
$strings['MyPayouts'] = "My payments"; $strings['MyPayouts'] = "My payments";
$strings['Commission'] = "Commission"; $strings['Commission'] = "Commission";
@ -137,3 +136,4 @@ $strings['SWIFT_help'] = "Standard format of Bank Identifier Codes (BIC) and ser
$strings['PleaseSelectThePaymentMethodBeforeConfirmYourOrder'] = "Please select your favorite payment method before confirming your order"; $strings['PleaseSelectThePaymentMethodBeforeConfirmYourOrder'] = "Please select your favorite payment method before confirming your order";
$strings['NoPaymentOptionAvailable'] = 'No payment option available. Please report to the administrator.'; $strings['NoPaymentOptionAvailable'] = 'No payment option available. Please report to the administrator.';
$strings['XIsOnlyPaymentMethodAvailable'] = '%s is the only payment method available for this purchase.'; $strings['XIsOnlyPaymentMethodAvailable'] = '%s is the only payment method available for this purchase.';
$strings['hide_free_text'] = "Hide 'Free' text";

@ -86,6 +86,7 @@ class BuyCoursesPlugin extends Plugin
'culqi_enable' => 'boolean', 'culqi_enable' => 'boolean',
'commissions_enable' => 'boolean', 'commissions_enable' => 'boolean',
'unregistered_users_enable' => 'boolean', 'unregistered_users_enable' => 'boolean',
'hide_free_text' => 'boolean',
) )
); );
} }
@ -171,24 +172,28 @@ class BuyCoursesPlugin extends Plugin
$return = []; $return = [];
$paypal = $this->get('paypal_enable') === 'true'; $paypal = $this->get('paypal_enable') === 'true';
$transfer = $this->get('transfer_enable') === 'true'; $transfer = $this->get('transfer_enable') === 'true';
$hideFree = $this->get('hide_free_text') === 'true';
if ($paypal || $transfer) { if ($paypal || $transfer) {
$item = $this->getItemByProduct($productId, $productType); $item = $this->getItemByProduct($productId, $productType);
$return['html'] = '<div class="buycourses-price">'; $html = '<div class="buycourses-price">';
if ($item) { if ($item) {
$return['html'] .= '<span class="label label-primary"><strong>'.$item['iso_code'].' '.$item['price'] $html .= '<span class="label label-primary"><strong>'.$item['iso_code'].' '.$item['price'].'</strong></span>';
.'</strong></span>';
$return['verificator'] = true; $return['verificator'] = true;
} else { } else {
$return['html'] .= '<span class="label label-primary"><strong>'.$this->get_lang('Free') if ($hideFree == false) {
.'</strong></span>'; $html .= '<span class="label label-primary"><strong>'.$this->get_lang('Free').'</strong></span>';
}
$return['verificator'] = false; $return['verificator'] = false;
} }
$return['html'] .= '</div>'; $html .= '</div>';
$return['html'] = $html;
} else { } else {
return false; return false;
} }
return $return; return $return;
} }

Loading…
Cancel
Save