@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | return false; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - require_once api_get_path(SYS_PLUGIN_PATH) . 'buycourses/database.php'; |
|
| 113 | + require_once api_get_path(SYS_PLUGIN_PATH).'buycourses/database.php'; |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | /** |
@@ -158,10 +158,10 @@ discard block |
||
| 158 | 158 | $item = $this->getItemByProduct(intval($productId), $productType); |
| 159 | 159 | $return['html'] = '<div class="buycourses-price">'; |
| 160 | 160 | if ($item) {
|
| 161 | - $return['html'] .= '<span class="label label-primary"><b>'. $item['iso_code'] .' ' . $item['price'] . '</b></span>'; |
|
| 161 | + $return['html'] .= '<span class="label label-primary"><b>'.$item['iso_code'].' '.$item['price'].'</b></span>'; |
|
| 162 | 162 | $return['verificator'] = true; |
| 163 | 163 | } else {
|
| 164 | - $return['html'] .= '<span class="label label-primary"><b>'. $this->get_lang('Free'). '</b></span>';
|
|
| 164 | + $return['html'] .= '<span class="label label-primary"><b>'.$this->get_lang('Free').'</b></span>';
|
|
| 165 | 165 | $return['verificator'] = false; |
| 166 | 166 | } |
| 167 | 167 | $return['html'] .= '</div>'; |
@@ -179,15 +179,15 @@ discard block |
||
| 179 | 179 | * @return string $html |
| 180 | 180 | */ |
| 181 | 181 | public function returnBuyCourseButton($productId, $productType) {
|
| 182 | - $url = api_get_path(WEB_PLUGIN_PATH) . |
|
| 183 | - 'buycourses/src/process.php?i=' . |
|
| 184 | - intval($productId) . |
|
| 185 | - '&t=' . |
|
| 182 | + $url = api_get_path(WEB_PLUGIN_PATH). |
|
| 183 | + 'buycourses/src/process.php?i='. |
|
| 184 | + intval($productId). |
|
| 185 | + '&t='. |
|
| 186 | 186 | $productType |
| 187 | 187 | ; |
| 188 | 188 | |
| 189 | - $html = ' <a class="btn btn-success btn-sm" title="' . $this->get_lang('Buy') . '" href="' . $url . '">' .
|
|
| 190 | - Display::returnFontAwesomeIcon('fa fa-shopping-cart') . '</a>';
|
|
| 189 | + $html = ' <a class="btn btn-success btn-sm" title="'.$this->get_lang('Buy').'" href="'.$url.'">'.
|
|
| 190 | + Display::returnFontAwesomeIcon('fa fa-shopping-cart').'</a>';
|
|
| 191 | 191 | |
| 192 | 192 | return $html; |
| 193 | 193 | } |
@@ -733,7 +733,7 @@ discard block |
||
| 733 | 733 | ); |
| 734 | 734 | |
| 735 | 735 | if (!empty($sessionImage)) {
|
| 736 | - $sessionInfo['image'] = api_get_path(WEB_UPLOAD_PATH) . $sessionImage['value']; |
|
| 736 | + $sessionInfo['image'] = api_get_path(WEB_UPLOAD_PATH).$sessionImage['value']; |
|
| 737 | 737 | } |
| 738 | 738 | |
| 739 | 739 | $sessionCourses = $session->getCourses(); |
@@ -1189,7 +1189,7 @@ discard block |
||
| 1189 | 1189 | |
| 1190 | 1190 | $str = ''; |
| 1191 | 1191 | |
| 1192 | - srand((double)microtime() * 1000000); |
|
| 1192 | + srand((double) microtime() * 1000000); |
|
| 1193 | 1193 | |
| 1194 | 1194 | for ($i = 0; $i < $length; $i++) {
|
| 1195 | 1195 | $numbers = rand(0, strlen($salt) - 1); |
@@ -1536,8 +1536,8 @@ discard block |
||
| 1536 | 1536 | */ |
| 1537 | 1537 | public function getPayouts($status = self::PAYOUT_STATUS_PENDING, $payoutId = false, $userId = false) |
| 1538 | 1538 | {
|
| 1539 | - $condition = ($payoutId) ? 'AND p.id = '. intval($payoutId) : ''; |
|
| 1540 | - $condition2 = ($userId) ? ' AND p.user_id = ' . intval($userId) : ''; |
|
| 1539 | + $condition = ($payoutId) ? 'AND p.id = '.intval($payoutId) : ''; |
|
| 1540 | + $condition2 = ($userId) ? ' AND p.user_id = '.intval($userId) : ''; |
|
| 1541 | 1541 | $typeResult = ($condition) ? 'first' : 'all'; |
| 1542 | 1542 | $payoutsTable = Database::get_main_table(BuyCoursesPlugin::TABLE_PAYPAL_PAYOUTS); |
| 1543 | 1543 | $saleTable = Database::get_main_table(BuyCoursesPlugin::TABLE_SALE); |
@@ -1564,14 +1564,14 @@ discard block |
||
| 1564 | 1564 | INNER JOIN $saleTable s ON s.id = p.sale_id |
| 1565 | 1565 | INNER JOIN $currencyTable c ON s.currency_id = c.id |
| 1566 | 1566 | LEFT JOIN $extraFieldValues efv ON p.user_id = efv.item_id |
| 1567 | - AND field_id = " . intval($paypalExtraField['id']) . " |
|
| 1567 | + AND field_id = ".intval($paypalExtraField['id'])." |
|
| 1568 | 1568 | "; |
| 1569 | 1569 | |
| 1570 | 1570 | $payouts = Database::select( |
| 1571 | 1571 | "p.* , u.firstname, u.lastname, efv.value as paypal_account, s.reference as sale_reference, s.price as item_price, c.iso_code", |
| 1572 | 1572 | "$payoutsTable p $innerJoins", |
| 1573 | 1573 | [ |
| 1574 | - 'where' => ['p.status = ? '.$condition . ' ' .$condition2 => $status] |
|
| 1574 | + 'where' => ['p.status = ? '.$condition.' '.$condition2 => $status] |
|
| 1575 | 1575 | ], |
| 1576 | 1576 | $typeResult |
| 1577 | 1577 | ); |
@@ -1635,7 +1635,7 @@ discard block |
||
| 1635 | 1635 | $platformCommission = $this->getPlatformCommission(); |
| 1636 | 1636 | |
| 1637 | 1637 | $sale = $this->getSale($saleId); |
| 1638 | - $teachersCommission = number_format((floatval($sale['price']) * intval($platformCommission['commission']))/100, 2); |
|
| 1638 | + $teachersCommission = number_format((floatval($sale['price']) * intval($platformCommission['commission'])) / 100, 2); |
|
| 1639 | 1639 | |
| 1640 | 1640 | |
| 1641 | 1641 | $beneficiaries = $this->getBeneficiariesBySale($saleId); |
@@ -1647,7 +1647,7 @@ discard block |
||
| 1647 | 1647 | 'payout_date' => getdate(), |
| 1648 | 1648 | 'sale_id' => intval($saleId), |
| 1649 | 1649 | 'user_id' => $beneficiary['user_id'], |
| 1650 | - 'commission' => number_format((floatval($teachersCommission) * intval($beneficiary['commissions']))/100, 2), |
|
| 1650 | + 'commission' => number_format((floatval($teachersCommission) * intval($beneficiary['commissions'])) / 100, 2), |
|
| 1651 | 1651 | 'status' => self::PAYOUT_STATUS_PENDING |
| 1652 | 1652 | ] |
| 1653 | 1653 | ); |
@@ -2229,17 +2229,17 @@ discard block |
||
| 2229 | 2229 | */ |
| 2230 | 2230 | public function getPath($var) |
| 2231 | 2231 | {
|
| 2232 | - $pluginPath = api_get_path(WEB_PLUGIN_PATH) . 'buycourses/'; |
|
| 2232 | + $pluginPath = api_get_path(WEB_PLUGIN_PATH).'buycourses/'; |
|
| 2233 | 2233 | $paths = [ |
| 2234 | - 'SERVICE_IMAGES' => $pluginPath . 'uploads/services/images/', |
|
| 2235 | - 'SRC' => $pluginPath . 'src/', |
|
| 2236 | - 'VIEW' => $pluginPath . 'view/', |
|
| 2237 | - 'UPLOADS' => $pluginPath . 'uploads/', |
|
| 2238 | - 'LANGUAGES' => $pluginPath . 'lang/', |
|
| 2239 | - 'RESOURCES' => $pluginPath . 'resources/', |
|
| 2240 | - 'RESOURCES_IMG' => $pluginPath . 'resources/img/', |
|
| 2241 | - 'RESOURCES_CSS' => $pluginPath . 'resources/css/', |
|
| 2242 | - 'RESOURCES_JS' => $pluginPath . 'resources/js/', |
|
| 2234 | + 'SERVICE_IMAGES' => $pluginPath.'uploads/services/images/', |
|
| 2235 | + 'SRC' => $pluginPath.'src/', |
|
| 2236 | + 'VIEW' => $pluginPath.'view/', |
|
| 2237 | + 'UPLOADS' => $pluginPath.'uploads/', |
|
| 2238 | + 'LANGUAGES' => $pluginPath.'lang/', |
|
| 2239 | + 'RESOURCES' => $pluginPath.'resources/', |
|
| 2240 | + 'RESOURCES_IMG' => $pluginPath.'resources/img/', |
|
| 2241 | + 'RESOURCES_CSS' => $pluginPath.'resources/css/', |
|
| 2242 | + 'RESOURCES_JS' => $pluginPath.'resources/js/', |
|
| 2243 | 2243 | ]; |
| 2244 | 2244 | |
| 2245 | 2245 | return $paths[$var]; |
@@ -58,20 +58,20 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | $userInfo = api_get_user_info($sale['user_id']); |
| 60 | 60 | |
| 61 | - $html = '<h2>' . $sale['product_name'] .'</h2>'; |
|
| 61 | + $html = '<h2>'.$sale['product_name'].'</h2>'; |
|
| 62 | 62 | $html .= '<div class="row">'; |
| 63 | 63 | $html .= '<div class="col-sm-6 col-md-6">'; |
| 64 | 64 | $html .= '<ul>'; |
| 65 | - $html .= '<li><b>'. $plugin->get_lang('OrderPrice') . ':</b> '. $sale['price'] . '</li>'; |
|
| 66 | - $html .= '<li><b>'. $plugin->get_lang('CurrencyType') . ':</b> '. $currency['iso_code'] . '</li>'; |
|
| 67 | - $html .= '<li><b>'. $plugin->get_lang('ProductType') . ':</b> '. $productType . '</li>'; |
|
| 68 | - $html .= '<li><b>'. $plugin->get_lang('OrderDate') . ':</b> '. api_format_date($sale['date'], DATE_TIME_FORMAT_LONG_24H) . '</li>'; |
|
| 69 | - $html .= '<li><b>'. $plugin->get_lang('Buyer') . ':</b> '. $userInfo['complete_name'] . '</li>'; |
|
| 70 | - $html .= '<li><b>'. $plugin->get_lang('PaymentMethods') . ':</b> '. $paymentType . '</li>'; |
|
| 65 | + $html .= '<li><b>'.$plugin->get_lang('OrderPrice').':</b> '.$sale['price'].'</li>'; |
|
| 66 | + $html .= '<li><b>'.$plugin->get_lang('CurrencyType').':</b> '.$currency['iso_code'].'</li>'; |
|
| 67 | + $html .= '<li><b>'.$plugin->get_lang('ProductType').':</b> '.$productType.'</li>'; |
|
| 68 | + $html .= '<li><b>'.$plugin->get_lang('OrderDate').':</b> '.api_format_date($sale['date'], DATE_TIME_FORMAT_LONG_24H).'</li>'; |
|
| 69 | + $html .= '<li><b>'.$plugin->get_lang('Buyer').':</b> '.$userInfo['complete_name'].'</li>'; |
|
| 70 | + $html .= '<li><b>'.$plugin->get_lang('PaymentMethods').':</b> '.$paymentType.'</li>'; |
|
| 71 | 71 | $html .= '</ul>'; |
| 72 | 72 | $html .= '</div>'; |
| 73 | 73 | $html .= '<div class="col-sm-6 col-md-6">'; |
| 74 | - $html .= '<img class="thumbnail" src="'. $productImage .'" >'; |
|
| 74 | + $html .= '<img class="thumbnail" src="'.$productImage.'" >'; |
|
| 75 | 75 | $html .= '</div>'; |
| 76 | 76 | $html .= '</div>'; |
| 77 | 77 | |
@@ -119,9 +119,9 @@ discard block |
||
| 119 | 119 | $html = '<div class="row">' |
| 120 | 120 | . '<p>' |
| 121 | 121 | . '<ul>' |
| 122 | - . '<li>'. get_plugin_lang("PayoutsTotalCompleted", "BuyCoursesPlugin") .' <b>'. $stats['completed_count'] .'</b> - '. get_plugin_lang("TotalAmount", "BuyCoursesPlugin") .' <b>'. $stats['completed_total_amount'] .' '. $currency['iso_code'] . '</b></li>' |
|
| 123 | - . '<li>'. get_plugin_lang("PayoutsTotalPending", "BuyCoursesPlugin") .' <b>'. $stats['pending_count'] .'</b> - '. get_plugin_lang("TotalAmount", "BuyCoursesPlugin") .' <b>'. $stats['pending_total_amount'] .' '. $currency['iso_code'] . '</b></li>' |
|
| 124 | - . '<li>'. get_plugin_lang("PayoutsTotalCanceled", "BuyCoursesPlugin") .' <b>'. $stats['canceled_count'] .'</b> - '. get_plugin_lang("TotalAmount", "BuyCoursesPlugin") .' <b>'. $stats['canceled_total_amount'] .' '. $currency['iso_code'] . '</b></li>' |
|
| 122 | + . '<li>'.get_plugin_lang("PayoutsTotalCompleted", "BuyCoursesPlugin").' <b>'.$stats['completed_count'].'</b> - '.get_plugin_lang("TotalAmount", "BuyCoursesPlugin").' <b>'.$stats['completed_total_amount'].' '.$currency['iso_code'].'</b></li>' |
|
| 123 | + . '<li>'.get_plugin_lang("PayoutsTotalPending", "BuyCoursesPlugin").' <b>'.$stats['pending_count'].'</b> - '.get_plugin_lang("TotalAmount", "BuyCoursesPlugin").' <b>'.$stats['pending_total_amount'].' '.$currency['iso_code'].'</b></li>' |
|
| 124 | + . '<li>'.get_plugin_lang("PayoutsTotalCanceled", "BuyCoursesPlugin").' <b>'.$stats['canceled_count'].'</b> - '.get_plugin_lang("TotalAmount", "BuyCoursesPlugin").' <b>'.$stats['canceled_total_amount'].' '.$currency['iso_code'].'</b></li>' |
|
| 125 | 125 | . '</ul>' |
| 126 | 126 | . '</p>'; |
| 127 | 127 | $html .= '</div>'; |
@@ -161,15 +161,15 @@ discard block |
||
| 161 | 161 | |
| 162 | 162 | $isoCode = $currentCurrency['iso_code']; |
| 163 | 163 | |
| 164 | - $html .= '<p>'. get_plugin_lang("VerifyTotalAmountToProceedPayout", "BuyCoursesPlugin") .'</p>'; |
|
| 164 | + $html .= '<p>'.get_plugin_lang("VerifyTotalAmountToProceedPayout", "BuyCoursesPlugin").'</p>'; |
|
| 165 | 165 | $html .= '' |
| 166 | 166 | . '<p>' |
| 167 | 167 | . '<ul>' |
| 168 | - . '<li>'. get_plugin_lang("TotalAcounts", "BuyCoursesPlugin") .' <b>'. $totalAccounts .'</b></li>' |
|
| 169 | - . '<li>'. get_plugin_lang("TotalPayout", "BuyCoursesPlugin") .' <b>'. $isoCode .' '. $totalPayout .'</b></li>' |
|
| 168 | + . '<li>'.get_plugin_lang("TotalAcounts", "BuyCoursesPlugin").' <b>'.$totalAccounts.'</b></li>' |
|
| 169 | + . '<li>'.get_plugin_lang("TotalPayout", "BuyCoursesPlugin").' <b>'.$isoCode.' '.$totalPayout.'</b></li>' |
|
| 170 | 170 | . '</ul>' |
| 171 | 171 | . '</p>'; |
| 172 | - $html .= '<p>'. get_plugin_lang("CautionThisProcessCantBeCanceled", "BuyCoursesPlugin") .'</p>'; |
|
| 172 | + $html .= '<p>'.get_plugin_lang("CautionThisProcessCantBeCanceled", "BuyCoursesPlugin").'</p>'; |
|
| 173 | 173 | $html .= '<br /><br />'; |
| 174 | 174 | $html .= '<div id="spinner" class="text-center"></div>'; |
| 175 | 175 | |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | |
| 224 | 224 | } else { |
| 225 | 225 | |
| 226 | - 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); |
|
| 226 | + 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); |
|
| 227 | 227 | |
| 228 | 228 | } |
| 229 | 229 | |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | |
| 313 | 313 | echo json_encode($cargo); |
| 314 | 314 | |
| 315 | - } catch(Exception $e) { |
|
| 315 | + } catch (Exception $e) { |
|
| 316 | 316 | |
| 317 | 317 | $cargo = json_decode($e->getMessage(), true); |
| 318 | 318 | |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | |
| 412 | 412 | echo json_encode($cargo); |
| 413 | 413 | |
| 414 | - } catch(Exception $e) { |
|
| 414 | + } catch (Exception $e) { |
|
| 415 | 415 | |
| 416 | 416 | $cargo = json_decode($e->getMessage(), true); |
| 417 | 417 | |
@@ -451,9 +451,9 @@ discard block |
||
| 451 | 451 | break; |
| 452 | 452 | } |
| 453 | 453 | |
| 454 | - $ajaxCallFile = $plugin->getPath('SRC') . 'buycourses.ajax.php'; |
|
| 454 | + $ajaxCallFile = $plugin->getPath('SRC').'buycourses.ajax.php'; |
|
| 455 | 455 | |
| 456 | - $serviceImg = $plugin->getPath('SERVICE_IMAGES') . $serviceSale['service']['image']; |
|
| 456 | + $serviceImg = $plugin->getPath('SERVICE_IMAGES').$serviceSale['service']['image']; |
|
| 457 | 457 | $html = "<img class='img-responsive text-center' src='$serviceImg'>"; |
| 458 | 458 | $html .= "<br />"; |
| 459 | 459 | $html .= "<legend>{$plugin->get_lang('ServiceInformation')}</legend>"; |
@@ -473,7 +473,7 @@ discard block |
||
| 473 | 473 | } |
| 474 | 474 | $html .= "<li><b>{$plugin->get_lang('AppliesTo')}:</b> $nodeType</li> "; |
| 475 | 475 | $html .= "<li><b>{$plugin->get_lang('Price')}:</b> {$serviceSale['service']['price']} {$serviceSale['currency']}</li> "; |
| 476 | - $duration = $serviceSale['service']['duration_days'] . ' ' . $plugin->get_lang('Days'); |
|
| 476 | + $duration = $serviceSale['service']['duration_days'].' '.$plugin->get_lang('Days'); |
|
| 477 | 477 | $html .= "</ul>"; |
| 478 | 478 | $html .= "<legend>{$plugin->get_lang('SaleInfo')}</legend>"; |
| 479 | 479 | $html .= "<ul>"; |
@@ -555,10 +555,10 @@ discard block |
||
| 555 | 555 | 'success' |
| 556 | 556 | ); |
| 557 | 557 | } else { |
| 558 | - $html .= Display::return_message('Error - ' . $plugin->get_lang('ErrorContactPlatformAdmin'), 'error'); |
|
| 558 | + $html .= Display::return_message('Error - '.$plugin->get_lang('ErrorContactPlatformAdmin'), 'error'); |
|
| 559 | 559 | } |
| 560 | 560 | |
| 561 | - $html .= "<a id='finish-button' class='btn btn-primary'>" . $plugin->get_lang('ClickHereToFinish') . "</a>"; |
|
| 561 | + $html .= "<a id='finish-button' class='btn btn-primary'>".$plugin->get_lang('ClickHereToFinish')."</a>"; |
|
| 562 | 562 | $html .= "</div>"; |
| 563 | 563 | $html .= "<script>"; |
| 564 | 564 | $html .= "$('#finish-button').click(function() {"; |
@@ -584,10 +584,10 @@ discard block |
||
| 584 | 584 | 'warning' |
| 585 | 585 | ); |
| 586 | 586 | } else { |
| 587 | - $html .= Display::return_message('Error - ' . $plugin->get_lang('ErrorContactPlatformAdmin'), 'error'); |
|
| 587 | + $html .= Display::return_message('Error - '.$plugin->get_lang('ErrorContactPlatformAdmin'), 'error'); |
|
| 588 | 588 | } |
| 589 | 589 | |
| 590 | - $html .= "<a id='finish-button' class='btn btn-primary'>" . $plugin->get_lang('ClickHereToFinish') . "</a>"; |
|
| 590 | + $html .= "<a id='finish-button' class='btn btn-primary'>".$plugin->get_lang('ClickHereToFinish')."</a>"; |
|
| 591 | 591 | $html .= "</div>"; |
| 592 | 592 | $html .= "<script>"; |
| 593 | 593 | $html .= "$('#finish-button').click(function() {"; |