Skip to content

Commit

Permalink
Add "hide_free_text" option, increase size of information icon BT#13816
Browse files Browse the repository at this point in the history
  • Loading branch information
jmontoyaa committed Dec 27, 2017
1 parent 05121f1 commit 8ed3049
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 49 deletions.
29 changes: 1 addition & 28 deletions main/auth/courses_categories.php
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
42 changes: 29 additions & 13 deletions main/inc/lib/course.lib.php
Expand Up @@ -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(
Expand Down Expand Up @@ -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;
}
}
4 changes: 2 additions & 2 deletions plugin/buycourses/lang/english.php
Expand Up @@ -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";
Expand Down Expand Up @@ -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.';
$strings['XIsOnlyPaymentMethodAvailable'] = '%s is the only payment method available for this purchase.';
$strings['hide_free_text'] = "Hide 'Free' text";
17 changes: 11 additions & 6 deletions plugin/buycourses/src/buy_course_plugin.class.php
Expand Up @@ -86,6 +86,7 @@ public function __construct()
'culqi_enable' => 'boolean',
'commissions_enable' => 'boolean',
'unregistered_users_enable' => 'boolean',
'hide_free_text' => 'boolean',
)
);
}
Expand Down Expand Up @@ -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'] = '<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;
}

Expand Down

0 comments on commit 8ed3049

Please sign in to comment.