1.10.x
jmontoya 9 years ago
parent b39cecc9b6
commit 0c4a683e80
  1. 18
      main/admin/languages.php
  2. 4
      main/announcements/announcements.php
  3. 4
      main/inc/lib/course.lib.php
  4. 6
      main/reports/templates/exercicesMultiCourses.reports.php
  5. 106
      plugin/buycourses/src/buycourses.ajax.php
  6. 100
      plugin/buycourses/src/panel.ajax.php
  7. 30
      plugin/buycourses/view/paypal_payout.tpl

@ -57,9 +57,9 @@ $htmlHeadXtra[] = '<script>
var disabledLang = "'.$disabledLang.'"
if (msgLang == 1) {
$("#id_content_message").html("<div class=\"warning-message alert alert-warning\">' . get_lang('ThereAreUsersUsingThisLanguagesDisableItManually') . ' </br> " + disabledLang + "</div");
$("#id_content_message").html("<div class=\"warning-message alert alert-warning\">' . get_lang('ThereAreUsersUsingThisLanguagesDisableItManually') . ' <br /> " + disabledLang + "</div");
}
$("#disable_all_except_default").click(function () {
if(confirm("'. get_lang('ConfirmYourChoice') .'")) {
$.ajax({
@ -75,8 +75,8 @@ $htmlHeadXtra[] = '<script>
}
});
}
return false;
return false;
});
//$(window).load(function () {
@ -137,7 +137,7 @@ $htmlHeadXtra[] = '<script>
var action = datos.split(":")[0];
if (action && action == "confirm") {
var id = datos.split(":")[1];
var sure = "<div class=\"warning-message alert alert-warning\">'.get_lang('ThereAreUsersUsingThisLanguageYouWantToDisableThisLanguageAndSetUsersWithTheDefaultPortalLanguage').'</br></br><a href=\"languages.php?action=make_unavailable_confirmed&id="+id+"\" class=\"btn btn-default\"><em class=\"fa fa-eye\"></em> ' . get_lang('MakeUnavailable') . '</a></div>";
var sure = "<div class=\"warning-message alert alert-warning\">'.get_lang('ThereAreUsersUsingThisLanguageYouWantToDisableThisLanguageAndSetUsersWithTheDefaultPortalLanguage').'<br /><br /><a href=\"languages.php?action=make_unavailable_confirmed&id="+id+"\" class=\"btn btn-default\"><em class=\"fa fa-eye\"></em> ' . get_lang('MakeUnavailable') . '</a></div>";
$("#id_content_message").html(sure);
$("html, body").animate({ scrollTop: 0 }, 200);
}
@ -182,16 +182,16 @@ if ($action == 'disable_all_except_default') {
SubLanguageManager::make_unavailable_language($language['id']);
} else {
if (intval(SubLanguageManager::get_platform_language_id()) !== intval($language['id'])) {
$failedDisabledLanguages .= ' - ' .$language['english_name'] . '</br>';
$failedDisabledLanguages .= ' - ' .$language['english_name'] . '<br />';
$checkFailed = true;
}
}
}
if ($checkFailed) {
$_SESSION['disabled_languages'] = $failedDisabledLanguages;
}
}
if (isset($_POST['Submit']) && $_POST['Submit']) {
@ -252,7 +252,7 @@ if (isset($_GET['action']) && $_GET['action'] == 'make_unavailable_confirmed') {
// displaying the explanation for this tool
Display::display_normal_message(get_lang('PlatformLanguagesExplanation'));
echo '<a id="disable_all_except_default" href="javascript:void(0)" class="btn btn-primary"><em class="fa fa-eye"></em> ' . get_lang('LanguagesDisableAllExceptDefault') . '</a></br></br>';
echo '<a id="disable_all_except_default" href="javascript:void(0)" class="btn btn-primary"><em class="fa fa-eye"></em> ' . get_lang('LanguagesDisableAllExceptDefault') . '</a><br /><br />';
// selecting all the languages
$sql_select = "SELECT * FROM $tbl_admin_languages";

@ -451,11 +451,11 @@ switch ($action) {
$form->addElement('text', 'title', get_lang('EmailTitle'));
$form->addElement('hidden', 'id');
$htmlTags = "<b>".get_lang('Tags')."</b></br></br>";
$htmlTags = "<b>".get_lang('Tags')."</b><br /><br />";
$tags = AnnouncementManager::get_tags();
foreach ($tags as $tag) {
$htmlTags .= "<b>".$tag."</b></br>";
$htmlTags .= "<b>".$tag."</b><br />";
}
$form->addHtml(

@ -5389,9 +5389,7 @@ class CourseManager
}
/**
* this function shows the form for sending a message to a specific group or user.
*/
/**
* Shows the form for sending a message to a specific group or user.
* @param FormValidator $form
* @param int $group_id
* @param array $to

@ -3,7 +3,7 @@
$reports_template['exercicesMultiCourses'] = array(
'description' => 'Result of each test per student',
'getSQL' => 'reports_template_exercicesMultiCourses_getSQL',
'wizard' =>
'wizard' =>
'
<span id="exercicesMultiCourses" class="step">
<span class="font_normal_07em_black">Result of each test per student</span><br />
@ -26,7 +26,7 @@ $reports_template['exercicesMultiCourses'] = array(
<option value="average">group and take the average value</option>
<option value="min">group and take the minimum value</option>
<option value="max">group and take the maximum value</option>
</select></br>
</select><br />
--> <input type="hidden" class="link" value="format" />
</span>
');
@ -52,7 +52,7 @@ function reports_template_exercicesMultiCourses_getSQL() {
foreach ($columns as $key => $column)
$query .= ', '.$function.'(k'.$key.'.score) as `'.
$column['course'].' - '.
$column['test'].'` ';
$column['test'].'` ';
$query .= ' from '.Database::get_main_table(TABLE_MAIN_USER).' u ';
foreach ($columns as $key => $column) // fixme sessions
$query .= 'left outer join '.

@ -24,23 +24,23 @@ switch ($action) {
if (api_is_anonymous()) {
break;
}
$userId = isset($_POST['id']) ? intval($_POST['id']) : '';
$isUserHavePaypalAccount = $plugin->verifyPaypalAccountByBeneficiary($userId);
if ($isUserHavePaypalAccount) {
echo '';
} else {
echo '<b style="color: red; font-size: 70%;">* '.$plugin->get_lang('NoPayPalAccountDetected').'</b>';
}
break;
case 'saleInfo':
if (api_is_anonymous()) {
break;
}
$saleId = isset($_POST['id']) ? intval($_POST['id']) : '';
$sale = $plugin->getSale($saleId);
$productType = ($sale['product_type'] == 1) ? get_lang('Course') : get_lang('Session');
@ -52,9 +52,9 @@ switch ($action) {
} else {
$productImage = ($productInfo['image']) ? $productInfo['image'] : Template::get_icon_path('session_default.png');
}
$userInfo = api_get_user_info($sale['user_id']);
$html = '<h2>' . $sale['product_name'] .'</h2>';
$html .= '<div class="row">';
$html .= '<div class="col-sm-6 col-md-6">';
@ -73,14 +73,14 @@ switch ($action) {
$html .= '</div>';
echo $html;
break;
case 'stats':
if (api_is_anonymous()) {
break;
}
$stats = [];
$stats['completed_count'] = 0;
$stats['completed_total_amount'] = 0;
@ -88,31 +88,31 @@ switch ($action) {
$stats['pending_total_amount'] = 0;
$stats['canceled_count'] = 0;
$stats['canceled_total_amount'] = 0;
$completedPayouts = $plugin->getPayouts(BuyCoursesPlugin::PAYOUT_STATUS_COMPLETED);
$pendingPayouts = $plugin->getPayouts(BuyCoursesPlugin::PAYOUT_STATUS_PENDING);
$canceledPayouts = $plugin->getPayouts(BuyCoursesPlugin::PAYOUT_STATUS_CANCELED);
$currency = $plugin->getSelectedCurrency();
foreach ($completedPayouts as $completed) {
$stats['completed_count'] = count($completedPayouts);
$stats['completed_total_amount'] += $completed['commission'];
$stats['completed_total_amount'] = number_format($stats['completed_total_amount'], 2);
}
foreach ($pendingPayouts as $pending) {
$stats['pending_count'] = count($pendingPayouts);
$stats['pending_total_amount'] += $pending['commission'];
$stats['pending_total_amount'] = number_format($stats['pending_total_amount'], 2);
}
foreach ($canceledPayouts as $canceled) {
$stats['canceled_count'] = count($canceledPayouts);
$stats['canceled_total_amount'] += $canceled['commission'];
$stats['canceled_total_amount'] = number_format($stats['canceled_total_amount'], 2);
}
$html = '<div class="row">'
. '<p>'
. '<ul>'
@ -123,41 +123,41 @@ switch ($action) {
. '</p>';
$html .= '</div>';
echo $html;
break;
case 'processPayout':
if (api_is_anonymous()) {
break;
}
$html = '';
$allPays = [];
$totalAccounts = 0;
$totalPayout = 0;
$payouts = isset($_POST['payouts']) ? $_POST['payouts'] : '';
if (!$payouts) {
echo Display::return_message(get_plugin_lang("SelectOptionToProceed", "BuyCoursesPlugin"), 'error', false);
break;
}
foreach ($payouts as $index => $id) {
$allPays[] = $plugin->getPayouts(BuyCoursesPlugin::PAYOUT_STATUS_PENDING, $id);
}
foreach ($allPays as $payout) {
$totalPayout += number_format($payout['commission'], 2);
$totalAccounts++;
}
$currentCurrency = $plugin->getSelectedCurrency();
$isoCode = $currentCurrency['iso_code'];
$html .= '<p>'. get_plugin_lang("VerifyTotalAmountToProceedPayout", "BuyCoursesPlugin") .'</p>';
$html .= ''
. '<p>'
@ -167,65 +167,65 @@ switch ($action) {
. '</ul>'
. '</p>';
$html .= '<p>'. get_plugin_lang("CautionThisProcessCantBeCanceled", "BuyCoursesPlugin") .'</p>';
$html .= '</br></br>';
$html .= '<br /><br />';
$html .= '<div id="spinner" class="text-center"></div>';
echo $html;
break;
case 'proceedPayout':
if (api_is_anonymous()) {
break;
}
$paypalParams = $plugin->getPaypalParams();
$pruebas = $paypalParams['sandbox'] == 1;
$paypalUsername = $paypalParams['username'];
$paypalPassword = $paypalParams['password'];
$paypalSignature = $paypalParams['signature'];
require_once("paypalfunctions.php");
$allPayouts = [];
$totalAccounts = 0;
$totalPayout = 0;
$payouts = isset($_POST['payouts']) ? $_POST['payouts'] : '';
if (!$payouts) {
echo Display::return_message(get_plugin_lang("SelectOptionToProceed", "BuyCoursesPlugin"), 'error', false);
break;
}
foreach ($payouts as $index => $id) {
$allPayouts[] = $plugin->getPayouts(BuyCoursesPlugin::PAYOUT_STATUS_PENDING, $id);
}
$currentCurrency = $plugin->getSelectedCurrency();
$isoCode = $currentCurrency['iso_code'];
$result = MassPayment($allPayouts, $isoCode);
if ($result['ACK'] === 'Success') {
foreach ($allPayouts as $payout) {
$plugin->setStatusPayouts($payout['id'], BuyCoursesPlugin::PAYOUT_STATUS_COMPLETED);
}
echo Display::return_message(get_plugin_lang("PayoutSuccess", "BuyCoursesPlugin"), 'success', false);
} else {
echo Display::return_message('<b>'.$result['L_SEVERITYCODE0'].' '.$result['L_ERRORCODE0'].'</b> - '.$result['L_SHORTMESSAGE0'].'</br><ul><li>'. $result['L_LONGMESSAGE0'].'</li></ul>', 'error', false);
echo Display::return_message('<b>'.$result['L_SEVERITYCODE0'].' '.$result['L_ERRORCODE0'].'</b> - '.$result['L_SHORTMESSAGE0'].'<br /><ul><li>'. $result['L_LONGMESSAGE0'].'</li></ul>', 'error', false);
}
break;
case 'cancelPayout':
if (api_is_anonymous()) {
break;
@ -234,9 +234,9 @@ switch ($action) {
// $payoutId only gets used in setStatusPayout(), where it is filtered
$payoutId = isset($_POST['id']) ? $_POST['id'] : '';
$plugin->setStatusPayouts($payoutId, BuyCoursesPlugin::PAYOUT_STATUS_CANCELED);
echo '';
break;
}
exit;

@ -34,9 +34,9 @@ switch ($action) {
} else {
$productImage = ($productInfo['image']) ? $productInfo['image'] : Template::get_icon_path('session_default.png');
}
$userInfo = api_get_user_info($sale['user_id']);
$html = '<h2>' . $sale['product_name'] .'</h2>';
$html .= '<div class="row">';
$html .= '<div class="col-sm-6 col-md-6">';
@ -55,11 +55,11 @@ switch ($action) {
$html .= '</div>';
echo $html;
break;
case 'stats':
$stats = [];
$stats['completed_count'] = 0;
$stats['completed_total_amount'] = 0;
@ -67,31 +67,31 @@ switch ($action) {
$stats['pending_total_amount'] = 0;
$stats['canceled_count'] = 0;
$stats['canceled_total_amount'] = 0;
$completedPayouts = $plugin->getPayouts(BuyCoursesPlugin::PAYOUT_STATUS_COMPLETED);
$pendingPayouts = $plugin->getPayouts(BuyCoursesPlugin::PAYOUT_STATUS_PENDING);
$canceledPayouts = $plugin->getPayouts(BuyCoursesPlugin::PAYOUT_STATUS_CANCELED);
$currency = $plugin->getSelectedCurrency();
foreach ($completedPayouts as $completed) {
$stats['completed_count'] = count($completedPayouts);
$stats['completed_total_amount'] += $completed['commission'];
$stats['completed_total_amount'] = number_format($stats['completed_total_amount'], 2);
}
foreach ($pendingPayouts as $pending) {
$stats['pending_count'] = count($pendingPayouts);
$stats['pending_total_amount'] += $pending['commission'];
$stats['pending_total_amount'] = number_format($stats['pending_total_amount'], 2);
}
foreach ($canceledPayouts as $canceled) {
$stats['canceled_count'] = count($canceledPayouts);
$stats['canceled_total_amount'] += $canceled['commission'];
$stats['canceled_total_amount'] = number_format($stats['canceled_total_amount'], 2);
}
$html = '<div class="row">'
. '<p>'
. '<ul>'
@ -102,41 +102,41 @@ switch ($action) {
. '</p>';
$html .= '</div>';
echo $html;
break;
case 'processPayout':
if (api_is_anonymous()) {
break;
}
$html = '';
$allPays = [];
$totalAccounts = 0;
$totalPayout = 0;
$payouts = isset($_POST['payouts']) ? $_POST['payouts'] : '';
if (!$payouts) {
echo Display::return_message(get_plugin_lang("SelectOptionToProceed", "BuyCoursesPlugin"), 'error', false);
break;
}
foreach ($payouts as $index => $id) {
$allPays[] = $plugin->getPayouts(BuyCoursesPlugin::PAYOUT_STATUS_PENDING, $id);
}
foreach ($allPays as $payout) {
$totalPayout += number_format($payout['commission'], 2);
$totalAccounts++;
}
$currentCurrency = $plugin->getSelectedCurrency();
$isoCode = $currentCurrency['iso_code'];
$html .= '<p>'. get_plugin_lang("VerifyTotalAmountToProceedPayout", "BuyCoursesPlugin") .'</p>';
$html .= ''
. '<p>'
@ -146,76 +146,76 @@ switch ($action) {
. '</ul>'
. '</p>';
$html .= '<p>'. get_plugin_lang("CautionThisProcessCantBeCanceled", "BuyCoursesPlugin") .'</p>';
$html .= '</br></br>';
$html .= '<br /><br />';
$html .= '<div id="spinner" class="text-center"></div>';
echo $html;
break;
case 'proceedPayout':
if (api_is_anonymous()) {
break;
}
$paypalParams = $plugin->getPaypalParams();
$pruebas = $paypalParams['sandbox'] == 1;
$paypalUsername = $paypalParams['username'];
$paypalPassword = $paypalParams['password'];
$paypalSignature = $paypalParams['signature'];
require_once("paypalfunctions.php");
$allPayouts = [];
$totalAccounts = 0;
$totalPayout = 0;
$payouts = isset($_POST['payouts']) ? $_POST['payouts'] : '';
if (!$payouts) {
echo Display::return_message(get_plugin_lang("SelectOptionToProceed", "BuyCoursesPlugin"), 'error', false);
break;
}
foreach ($payouts as $index => $id) {
$allPayouts[] = $plugin->getPayouts(BuyCoursesPlugin::PAYOUT_STATUS_PENDING, $id);
}
$currentCurrency = $plugin->getSelectedCurrency();
$isoCode = $currentCurrency['iso_code'];
$result = MassPayment($allPayouts, $isoCode);
if ($result['ACK'] === 'Success') {
foreach ($allPayouts as $payout) {
$plugin->setStatusPayouts($payout['id'], BuyCoursesPlugin::PAYOUT_STATUS_COMPLETED);
}
echo Display::return_message(get_plugin_lang("PayoutSuccess", "BuyCoursesPlugin"), 'success', false);
} else {
echo Display::return_message('<b>'.$result['L_SEVERITYCODE0'].' '.$result['L_ERRORCODE0'].'</b> - '.$result['L_SHORTMESSAGE0'].'</br><ul><li>'. $result['L_LONGMESSAGE0'].'</li></ul>', 'error', false);
echo Display::return_message('<b>'.$result['L_SEVERITYCODE0'].' '.$result['L_ERRORCODE0'].'</b> - '.$result['L_SHORTMESSAGE0'].'<br /><ul><li>'. $result['L_LONGMESSAGE0'].'</li></ul>', 'error', false);
}
break;
case 'cancelPayout':
if (api_is_anonymous()) {
break;
}
$payoutId = isset($_POST['id']) ? $_POST['id'] : '';
$plugin->setStatusPayouts($payoutId, BuyCoursesPlugin::PAYOUT_STATUS_CANCELED);
echo '';
break;
}
exit;

@ -27,7 +27,7 @@
{% endfor %}
</tbody>
</table>
<div id="startPayout" class="modal fade" role="dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
@ -35,7 +35,7 @@
<h4 class="modal-title">{{ 'PaypalPayoutCommissions'|get_plugin_lang('BuyCoursesPlugin') }}</h4>
</div>
<div class="modal-body" id="content">
</div>
<div class="modal-footer">
<button id="proceedPayout" type="button" class="btn btn-success fa fa-paypal"> {{ 'ProceedPayout' | get_plugin_lang('BuyCoursesPlugin') }}</button>
@ -52,21 +52,21 @@
<script>
$(document).ready(function() {
$("#responseButton").hide();
$("#checkAll").click(function() {
$(':checkbox').prop('checked', this.checked);
});
$('#continuePayout').click(function() {
var val = [];
$(':checkbox:checked').not('#checkAll').each(function(i) {
val[i] = $(this).attr("id");
});
$.ajax({
data: { payouts : val },
url: '{{ _p.web_plugin ~ 'buycourses/src/buycourses.ajax.php?' ~ { 'a': 'processPayout' } | url_encode() }}',
@ -77,15 +77,15 @@
}
});
});
$('#proceedPayout').click(function() {
var val = [];
$(':checkbox:checked').not('#checkAll').each(function(i) {
val[i] = $(this).attr("id");
});
$.ajax({
data: { payouts : val },
url: '{{ _p.web_plugin ~ 'buycourses/src/buycourses.ajax.php?' ~ { 'a': 'proceedPayout' } | url_encode() }}',
@ -93,7 +93,7 @@
beforeSend: function() {
$("#proceedPayout").hide();
$("#cancelPayout").hide();
$("#spinner").html('</br></br><div class="wobblebar-loader"></div><p> {{ 'ProcessingPayoutsDontCloseThisWindow' | get_plugin_lang('BuyCoursesPlugin') }} </p>');
$("#spinner").html('<br /><br /><div class="wobblebar-loader"></div><p> {{ 'ProcessingPayoutsDontCloseThisWindow' | get_plugin_lang('BuyCoursesPlugin') }} </p>');
},
success: function(response) {
$("#content").html(response);
@ -101,7 +101,7 @@
}
});
});
$(".cancelPayout").click(function() {
var id = this.id;
$.ajax({
@ -113,7 +113,7 @@
}
});
});
$('#responseButton').click(function() {
window.location.reload();
});

Loading…
Cancel
Save