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. 42
      main/inc/lib/course.lib.php
  3. 4
      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 .= return_description_button($course);
$html .= CourseManager::returnDescriptionButton($course);
$html .= '</div></div>';
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

@ -5048,21 +5048,10 @@ class CourseManager
}
// 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 @@ class CourseManager
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['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'] = "SWIFT code";
$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.';
$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',
'commissions_enable' => 'boolean',
'unregistered_users_enable' => 'boolean',
'hide_free_text' => 'boolean',
)
);
}
@ -171,24 +172,28 @@ class BuyCoursesPlugin extends Plugin
$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'] = '<div class="buycourses-price">';
$html = '<div class="buycourses-price">';
if ($item) {
$return['html'] .= '<span class="label label-primary"><strong>'.$item['iso_code'].' '.$item['price']
.'</strong></span>';
$html .= '<span class="label label-primary"><strong>'.$item['iso_code'].' '.$item['price'].'</strong></span>';
$return['verificator'] = true;
} else {
$return['html'] .= '<span class="label label-primary"><strong>'.$this->get_lang('Free')
.'</strong></span>';
if ($hideFree == false) {
$html .= '<span class="label label-primary"><strong>'.$this->get_lang('Free').'</strong></span>';
}
$return['verificator'] = false;
}
$return['html'] .= '</div>';
$html .= '</div>';
$return['html'] = $html;
} else {
return false;
}
return $return;
}

Loading…
Cancel
Save