Remove unnecesary code - refs #7768

1.10.x
Angel Fernando Quiroz Campos 9 years ago
parent 289477d904
commit 1a0a797b37
  1. 65
      plugin/buycourses/js/buycourses.js
  2. 1
      plugin/buycourses/src/BuyCoursesUtils.php
  3. 317
      plugin/buycourses/src/buy_course.lib.php
  4. 1
      plugin/buycourses/src/configuration.php
  5. 1
      plugin/buycourses/src/course_catalog.php
  6. 325
      plugin/buycourses/src/function.php
  7. 1
      plugin/buycourses/src/paymentsetup.php
  8. 1
      plugin/buycourses/src/process.php
  9. 4
      plugin/buycourses/src/process_confirm.php
  10. 1
      plugin/buycourses/src/sales_report.php
  11. 1
      plugin/buycourses/src/success.php

@ -33,69 +33,4 @@ $(document).ready(function () {
"json"
);
});
$(".filter").click(function (e) {
var target = "#"+($(this).closest(".row").children().last()).attr("id");
var filterFields = $(this).siblings("input");
var filterFieldsData = { tab: $(this).attr("id") };
$.each(filterFields, function() {
// Get only the first class
var className = $(this).attr("class").split(" ")[0];
filterFieldsData[className] = $(this).val();
});
$.post("function.php", filterFieldsData,
function (data) {
if (data.status == "false") {
alert(data.content);
$(target).html('');
} else {
$(target).html(data.content);
}
$(document).ready(acciones_ajax);
}, "json");
e.preventDefault();
e.stopPropagation();
});
});
function acciones_ajax() {
$('.ajax').on('click', function () {
var url = this.href;
var dialog = $("#dialog");
if ($("#dialog").length == 0) {
dialog = $('<div id="dialog" style="display:none"></div>').appendTo('body');
}
width_value = 580;
height_value = 450;
resizable_value = true;
new_param = get_url_params(url, 'width');
if (new_param) {
width_value = new_param;
}
new_param = get_url_params(url, 'height')
if (new_param) {
height_value = new_param;
}
new_param = get_url_params(url, 'resizable');
if (new_param) {
resizable_value = new_param;
}
// load remote content
dialog.load(
url,
{},
function (responseText, textStatus, XMLHttpRequest) {
dialog.dialog({
modal: true,
width: width_value,
height: height_value,
resizable: resizable_value
});
});
//prevent the browser to follow the link
return false;
});
}

@ -1,6 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
use \Doctrine\DBAL\Types\Type;
/**
* BuyCoursesUtils
*

@ -1,317 +0,0 @@
<?php
/* For license terms, see /license.txt */
/**
* Functions
* @package chamilo.plugin.buycourses
*/
/**
* Init
*/
require_once '../../../main/inc/global.inc.php';
require_once '../config.php';
require_once api_get_path(LIBRARY_PATH) . 'plugin.class.php';
/**
* Checks if a session or a course is already bought
* @param string Session id or course code
* @param int User id
* @param string What has to be checked
* @todo fix this function because TABLE_MAIN_COURSE_USER needs a c_id not a course_code
* @return boolean True if it is already bought, and false otherwise
*/
function checkUserBuy($parameter, $user, $type = 'COURSE')
{
$sql = "SELECT 1 FROM %s WHERE %s ='" . Database::escape_string($parameter) . "' AND %s ='" . intval($user) . "';";
$sql = $type === 'SESSION' ?
sprintf($sql, Database::get_main_table(TABLE_MAIN_SESSION_USER), 'session_id', 'user_id') :
sprintf($sql, Database::get_main_table(TABLE_MAIN_COURSE_USER), 'c_id', 'user_id');
$result = Database::query($sql);
if (Database::affected_rows($result) > 0) {
return true;
} else {
return false;
}
}
/**
* Checks if a session or a course has already a transfer
* @param string Session id or course code
* @param int User id
* @param string What has to be checked
* @return boolean True if it has already a transfer, and false otherwise
*/
function checkUserBuyTransfer($parameter, $user, $type = 'COURSE')
{
$sql = "SELECT 1 FROM %s WHERE %s ='" . Database::escape_string($parameter) . "' AND user_id ='" . intval($user) . "';";
$sql = $type === 'SESSION' ?
sprintf($sql, Database::get_main_table(TABLE_BUY_SESSION_TEMPORARY), 'session_id') :
sprintf($sql, Database::get_main_table(TABLE_BUY_COURSE_TEMPORAL), 'course_code');
$result = Database::query($sql);
if (Database::affected_rows($result) > 0) {
return true;
} else {
return false;
}
}
/**
* Returns an array with all the categories
* @return array All the categories
*/
function buyCourseListCategories()
{
$tblCourseCategory = Database::get_main_table(TABLE_MAIN_CATEGORY);
$sql = "SELECT code, name FROM $tblCourseCategory";
$res = Database::query($sql);
$aux = array();
while ($row = Database::fetch_assoc($res)) {
$aux[] = $row;
}
return $aux;
}
/**
* Gets the list of accounts from the buy_course_transfer table
* @return array The list of accounts
*/
function listAccounts()
{
$tableBuyCourseTransfer = Database::get_main_table(TABLE_BUY_COURSE_TRANSFER);
$sql = "SELECT * FROM $tableBuyCourseTransfer";
$res = Database::query($sql);
$aux = array();
while ($row = Database::fetch_assoc($res)) {
$aux[] = $row;
}
return $aux;
}
/**
* Find the first enabled currency (there should be only one)
* @result string The code of the active currency
*/
function findCurrency()
{
$tableBuyCourseCountry = Database::get_main_table(TABLE_BUY_COURSE_COUNTRY);
$sql = "SELECT * FROM $tableBuyCourseCountry WHERE status='1';";
$res = Database::query($sql);
$row = Database::fetch_assoc($res);
return $row['currency_code'];
}
/**
* Extended information about the session (from the session table as well as
* the buy_session table)
* @param string $code The session code
* @return array Info about the session
*/
function sessionInfo($code)
{
$tableBuySession = Database::get_main_table(TABLE_BUY_SESSION);
$tableSession = Database::get_main_table(TABLE_MAIN_SESSION);
$tableBuySessionRelCourse = Database::get_main_table(TABLE_BUY_SESSION_COURSE);
$tableSessionRelCourse = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
$tableBuyCourse = Database::get_main_table(TABLE_BUY_COURSE);
$tableCourse = Database::get_main_table(TABLE_MAIN_COURSE);
$tableSessionRelUser = Database::get_main_table(TABLE_MAIN_SESSION_USER);
$tableBuySessionTemporal = Database::get_main_table(TABLE_BUY_SESSION_TEMPORARY);
$currentUserId = api_get_user_id();
$code = Database::escape_string($code);
$sql = "SELECT a.session_id, a.visible, a.price, b.*
FROM $tableBuySession a, $tableSession b
WHERE a.session_id=b.id
AND a.visible = 1
AND b.id = '".$code."';";
$res = Database::query($sql);
$rowSession = Database::fetch_assoc($res);
$sqlSessionCourse = "SELECT DISTINCT a.session_id, a.course_code, a.nbr_users
FROM $tableBuySessionRelCourse a, $tableSessionRelCourse b
WHERE a.session_id = b.session_id AND a.session_id = " . $rowSession['session_id'] . ";";
$resSessionCourse = Database::query($sqlSessionCourse);
$aux = array();
// loop through courses of current session
while ($rowSessionCourse = Database::fetch_assoc($resSessionCourse)) {
// get course of current session
$sql = "SELECT a.course_id, a.session_id, a.visible, a.price, b.*
FROM $tableBuyCourse a, $tableCourse b
WHERE a.code = b.code AND a.code = '".$rowSessionCourse['course_code']."' AND a.visible = 1;";
$res = Database::query($sql);
// loop inside a course of current session
while ($row = Database::fetch_assoc($res)) {
//check teacher
$sql = "SELECT lastname, firstname
FROM course_rel_user a, user b
WHERE a.c_id='".$row['id']."'
AND a.status <> 6
AND a.user_id=b.id;";
$tmp = Database::query($sql);
$rowTmp = Database::fetch_assoc($tmp);
$row['teacher'] = $rowTmp['firstname'].' '.$rowTmp['lastname'];
//check images
if (file_exists(api_get_path(SYS_COURSE_PATH).$row['directory']."/course-pic.png")) {
$row['course_img'] = "courses/".$row['directory']."/course-pic.png";
} else {
$row['course_img'] = "main/img/session_default.png";
}
$row['price'] = number_format($row['price'], 2, '.', ' ');
$aux[] = $row;
}
}
//check if the user is enrolled in the current session
if ($currentUserId > 0) {
$sql = "SELECT 1 FROM $tableSessionRelUser
WHERE user_id = $currentUserId";
$result = Database::query($sql);
if (Database::affected_rows($result) > 0) {
$rowSession['enrolled'] = "YES";
} else {
$sql = "SELECT 1 FROM $tableBuySessionTemporal
WHERE user_id='".$currentUserId."';";
$result = Database::query($sql);
if (Database::affected_rows($result) > 0) {
$rowSession['enrolled'] = "TMP";
} else {
$rowSession['enrolled'] = "NO";
}
}
} else {
$sql = "SELECT 1 FROM $tableBuySessionTemporal
WHERE user_id='".$currentUserId."';";
$result = Database::query($sql);
if (Database::affected_rows($result) > 0) {
$rowSession['enrolled'] = "TMP";
} else {
$rowSession['enrolled'] = "NO";
}
}
// add courses to current session
$rowSession['courses'] = $aux;
return $rowSession;
}
/**
* Extended information about the course (from the course table as well as
* the buy_course table)
* @param string $code The course code
* @return array Info about the course
*/
function courseInfo($code)
{
$tableBuyCourse = Database::get_main_table(TABLE_BUY_COURSE);
$tableCourseRelUser = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$tableUser = Database::get_main_table(TABLE_MAIN_USER);
$currentUserId = api_get_user_id();
$code = Database::escape_string($code);
$sql = "SELECT a.course_id, a.visible, a.price, b.*
FROM $tableBuyCourse a, course b
WHERE
a.course_id=b.id AND
a.visible = 1 AND
b.id = '" . $code . "'";
$res = Database::query($sql);
$row = Database::fetch_assoc($res);
// Check teacher
$sql = "SELECT lastname, firstname
FROM $tableCourseRelUser a, $tableUser b
WHERE
a.c_id = '" . $row['id'] . "' AND
a.status <> 6 AND
a.user_id = b.user_id;";
$tmp = Database::query($sql);
$rowTmp = Database::fetch_assoc($tmp);
$row['teacher'] = $rowTmp['firstname'] . ' ' . $rowTmp['lastname'];
//Check if student is enrolled
if ($currentUserId > 0) {
$sql = "SELECT 1 FROM $tableCourseRelUser
WHERE
c_id ='" . $row['id'] . "' AND
user_id='" . $currentUserId . "';";
$result = Database::query($sql);
if (Database::affected_rows($result) > 0) {
$row['enrolled'] = "YES";
} else {
$row['enrolled'] = "NO";
}
} else {
$row['enrolled'] = "NO";
}
//check img
if (file_exists(api_get_path(SYS_COURSE_PATH) . $row['code'] . "/course-pic.png")) {
$row['course_img'] = "courses/" . $row['code'] . "/course-pic.png";
} else {
$row['course_img'] = "main/img/session_default.png";
}
$row['price'] = number_format($row['price'], 2, '.', ' ');
return $row;
}
/**
* Generates a random text (used for order references)
* @param int $long
* @param bool $minWords
* @param bool $maxWords
* @param bool $number
* @return string A random text
*/
function randomText($long = 6, $minWords = true, $maxWords = true, $number = true)
{
$salt = $minWords ? 'abchefghknpqrstuvwxyz' : '';
$salt .= $maxWords ? 'ACDEFHKNPRSTUVWXYZ' : '';
$salt .= $number ? (strlen($salt) ? '2345679' : '0123456789') : '';
if (strlen($salt) == 0) {
return '';
}
$i = 0;
$str = '';
srand((double)microtime() * 1000000);
while ($i < $long) {
$number = rand(0, strlen($salt) - 1);
$str .= substr($salt, $number, 1);
$i++;
}
return $str;
}
/**
* Generates an order reference
* @result string A reference number
*/
function calculateReference($bcCodetext)
{
$tableBuyTemporal = $bcCodetext === 'THIS_IS_A_SESSION' ?
Database::get_main_table(TABLE_BUY_SESSION_TEMPORARY) :
Database::get_main_table(TABLE_BUY_COURSE_TEMPORAL);
$sql = "SELECT MAX(cod) as cod FROM $tableBuyTemporal";
$res = Database::query($sql);
$row = Database::fetch_assoc($res);
$reference = ($row['cod'] != '') ? $row['cod'] : '1';
$randomText = randomText();
$reference .= $randomText;
return $reference;
}
/**
* Gets a list of pending orders
* @result array List of orders
* @todo Enable pagination
*/
function pendingList($bcCodetext)
{
$tableBuyTemporal = $bcCodetext === 'THIS_IS_A_SESSION' ?
Database::get_main_table(TABLE_BUY_SESSION_TEMPORARY) :
Database::get_main_table(TABLE_BUY_COURSE_TEMPORAL);
$sql = "SELECT * FROM $tableBuyTemporal;";
$res = Database::query($sql);
$aux = array();
while ($row = Database::fetch_assoc($res)) {
$aux[] = $row;
}
return $aux;
}

@ -9,7 +9,6 @@
*/
$cidReset = true;
require_once dirname(__FILE__) . '/buy_course.lib.php';
require_once '../../../main/inc/global.inc.php';
$plugin = BuyCoursesPlugin::create();

@ -9,7 +9,6 @@
$cidReset = true;
require_once '../../../main/inc/global.inc.php';
require_once 'buy_course.lib.php';
$plugin = BuyCoursesPlugin::create();
$includeSessions = $plugin->get('include_sessions') === 'true';

@ -8,337 +8,12 @@
* Init
*/
require_once '../config.php';
require_once 'buy_course.lib.php';
$tableBuySession = Database::get_main_table(TABLE_BUY_SESSION);
$tableBuySessionTemporal = Database::get_main_table(TABLE_BUY_SESSION_TEMPORARY);
$tableBuySessionRelCourse = Database::get_main_table(TABLE_BUY_SESSION_COURSE);
$tableSessionRelCourse = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
$tableBuyCourse = Database::get_main_table(TABLE_BUY_COURSE);
$tableSession = Database::get_main_table(TABLE_MAIN_SESSION);
$tableCourse = Database::get_main_table(TABLE_MAIN_COURSE);
$tableSessionRelUser = Database::get_main_table(TABLE_MAIN_SESSION_USER);
$tableCourseRelUser = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$tableUser = Database::get_main_table(TABLE_MAIN_USER);
$itemTable = Database::get_main_table(BuyCoursesUtils::TABLE_ITEM);
$plugin = BuyCoursesPlugin::create();
$buy_name = $plugin->get_lang('Buy');
$currency = $plugin->getSelectedCurrency();
if ($_REQUEST['tab'] == 'sessions_filter') {
$session = isset($_REQUEST['name']) ? Database::escape_string($_REQUEST['name']) : '';
$priceMin = isset($_REQUEST['pricemin']) ? floatval($_REQUEST['pricemin']) : 0;
$priceMax = isset($_REQUEST['pricemax']) ? floatval($_REQUEST['pricemax']) : 0;
//$category = isset($_REQUEST['category']) ? Database::escape_string($_REQUEST['category']) : '';
$server = api_get_path(WEB_PATH);
$sql = "SELECT a.session_id, a.visible, a.price, b.*
FROM $tableBuySession a, $tableSession b
WHERE a.session_id = b.id AND a.visible = 1;";
$filter = "";
if (!empty($session)) {
$filter .= " AND b.name LIKE '%".$session."%'";
}
if ($priceMin > 0) {
$filter .= " AND a.price >= ".$priceMin;
}
if ($priceMax > 0) {
$filter .= " AND a.price <= ".$priceMax;
}
/*if (!empty($category)) {
$filter .= " AND b.category_code = '".$category."'";
}*/
if (!empty($filter)) {
$sql = substr_replace($sql, $filter.";", -1);
}
$resSessions = Database::query($sql);
$auxSessions = array();
// loop through all sessions
while ($rowSession = Database::fetch_assoc($resSessions)) {
// get courses of current session
$sqlSessionCourse = "SELECT DISTINCT a.session_id, a.course_code, a.nbr_users
FROM $tableBuySessionRelCourse a, $tableSessionRelCourse b
WHERE a.session_id = b.session_id AND a.session_id = " . $rowSession['session_id'] . ";";
$resSessionCourse = Database::query($sqlSessionCourse);
$aux = array();
// loop through courses of current session
while ($rowSessionCourse = Database::fetch_assoc($resSessionCourse)) {
// get course of current session
$sql = "SELECT a.course_id, a.session_id, a.visible, a.price, b.*
FROM $tableBuyCourse a, $tableCourse b
WHERE a.code = b.code AND a.code = '" . $rowSessionCourse['course_code'] . "';";
$res = Database::query($sql);
// loop inside a course of current session
while ($row = Database::fetch_assoc($res)) {
//check teacher
$sql = "SELECT lastname, firstname
FROM course_rel_user a, user b
WHERE a.c_id=" . $row['id'] . "
AND a.status <> 6
AND a.user_id=b.id;";
$tmp = Database::query($sql);
$rowTmp = Database::fetch_assoc($tmp);
$row['teacher'] = $rowTmp['firstname'] . ' ' . $rowTmp['lastname'];
//check images
if (file_exists(api_get_path(SYS_COURSE_PATH) . $row['code'] . "/course-pic.png")) {
$row['course_img'] = "courses/" . $row['code'] . "/course-pic.png";
} else {
$row['course_img'] = "main/img/session_default.png";
}
$row['price'] = number_format($row['price'], 2, '.', ' ');
$aux[] = $row;
}
}
//check if the user is enrolled in the current session
if (isset($_SESSION['_user']) || $_SESSION['_user']['user_id'] != '') {
$sql = "SELECT 1 FROM $tableSessionRelUser
WHERE session_id ='".$rowSession['session_id']."' AND
user_id ='" . api_get_user_id() . "'";
$result = Database::query($sql);
if (Database::affected_rows($result) > 0) {
$rowSession['enrolled'] = "YES";
} else {
$sql = "SELECT 1 FROM $tableBuySessionTemporal
WHERE session_id ='".$rowSession['session_id']."' AND
user_id='" . api_get_user_id() . "'";
$result = Database::query($sql);
if (Database::affected_rows($result) > 0) {
$rowSession['enrolled'] = "TMP";
} else {
$rowSession['enrolled'] = "NO";
}
}
} else {
$sql = "SELECT 1 FROM $tableBuySessionTemporal
WHERE session_id ='".$rowSession['session_id']."' AND
user_id='" . api_get_user_id() . "'";
$result = Database::query($sql);
if (Database::affected_rows($result) > 0) {
$rowSession['enrolled'] = "TMP";
} else {
$rowSession['enrolled'] = "NO";
}
}
// add courses to current session
$rowSession['courses'] = $aux;
// add the current whole session
$auxSessions[] = $rowSession;
}
$currencyType = findCurrency();
$content = '';
foreach ($auxSessions as $session) {
$content .= '<div class="span8 well-course">
<div class="row">
<div class="span4 ">
<div class="categories-course-description">
<h3>'.$session['name'].'</h3>
<h5>'.get_lang('From').' '.$session['access_start_date'].
' '.get_lang('Until').' '.$session['access_end_date'].'</h5>';
if ($session['enrolled'] == "YES") {
$content .= '<span class="label label-info">'.$plugin->get_lang('TheUserIsAlreadyRegisteredInTheSession').'</span>';
}
if ($session['enrolled'] == "TMP") {
$content .= '<span class="label label-warning">'.$plugin->get_lang('WaitingToReceiveThePayment').'</span>';
}
$content .= '</div>
</div>
<div class="span right">
<div class="sprice right">'.
$session['price'].' '.$currencyType.'
</div>
<div class="cleared">
</div>
<div class="btn-group right">';
if ($session['enrolled'] == "NO") {
$content .= '<a class="btn btn-success" title="" href="'.$server.
'plugin/buycourses/src/process.php?scode='.$session['session_id'].'">'.
$buy_name.
'</a>';
}
$content .= '</div>
</div>
</div>';
$courses = $session['courses'];
foreach ($courses as $course) {
$content .= '<div class="row">
<div class="span">
<div class="thumbnail">
<a class="ajax" rel="gb_page_center[778]" title=""
href="'.$server.'plugin/buycourses/src/ajax.php?
a=show_course_information&code='.$course['code'].'">
<img alt="" src="' . $server . $course['course_img'] . '">
</a>
</div>
</div>
<div class="span4">
<div class="categories-course-description">
<h3>'.$course['title'].'</h3>
<h5>'.get_lang('Teacher').': '.$course['teacher'].'</h5>
</div>
</div>
<div class="span right">
<div class="cleared">
</div>
<div class="btn-group right">
<a class="ajax btn btn-primary" title=""
href="'.$server.'plugin/buycourses/src/ajax.php?
a=show_course_information&code='.$course['code'].'">'.get_lang('Description').'</a>
</div>
</div>
</div>';
}
$content .= '</div>';
}
echo json_encode(array("status" => "true", "content" => $content));
}
if ($_REQUEST['tab'] == 'courses_filter') {
$course = isset($_REQUEST['name']) ? Database::escape_string($_REQUEST['name']) : '';
$priceMin = isset($_REQUEST['pricemin']) ? floatval($_REQUEST['pricemin']) : 0;
$priceMax = isset($_REQUEST['pricemax']) ? floatval($_REQUEST['pricemax']) : 0;
/**
* Deprecated since 2014-10-14
*/
//$show = Database::escape_string($_REQUEST['show']);
//$category = Database::escape_string($_REQUEST['category']);
$server = api_get_path(WEB_PATH);
$sql = "SELECT a.course_id, a.visible, a.price, b.*
FROM $tableBuyCourse a, $tableCourse b
WHERE a.course_id = b.id AND a.session_id = 0
AND a.visible = 1;";
$filter = "";
if (!empty($course)) {
$filter .= " AND b.title LIKE '%".$course."%'";
}
if ($priceMin > 0) {
$filter .= " AND a.price >= ".$priceMin;
}
if ($priceMax > 0) {
$filter .= " AND a.price <= ".$priceMax;
}
/*if (!empty($category)) {
$filter .= " AND b.category_code = '".$category."'";
}*/
if (!empty($filter)) {
$sql = substr_replace($sql, $filter.";", -1);
}
$res = Database::query($sql);
$aux = array();
while ($row = Database::fetch_assoc($res)) {
//Check teacher
$sql = "SELECT lastname, firstname
FROM $tableCourseRelUser a, $tableUser b
WHERE a.c_id = " . $row['id'] . "
AND a.status <> 6
AND a.user_id = b.id;";
$tmp = Database::query($sql);
$rowTmp = Database::fetch_assoc($tmp);
$row['teacher'] = $rowTmp['firstname'] . ' ' . $rowTmp['lastname'];
//Check if the student is enrolled
if (isset($_SESSION['_user']) || $_SESSION['_user']['user_id'] != '') {
$sql = "SELECT 1 FROM $tableCourseRelUser
WHERE c_id = " . $row['id'] . "
AND user_id = " . intval($_SESSION['_user']['user_id']) . ";";
$tmp = Database::query($sql);
if (Database::affected_rows($tmp) > 0) {
$row['enrolled'] = "YES";
} else {
$row['enrolled'] = "NO";
}
} else {
$row['enrolled'] = "NO";
}
// Check img
if (file_exists(api_get_path(SYS_COURSE_PATH) . $row['directory'] . "/course-pic.png")) {
$row['course_img'] = "courses/" . $row['directory'] . "/course-pic.png";
} else {
$row['course_img'] = "main/img/session_default.png";
}
$aux[] = $row;
/**
* Deprecated since 2014-10-14
*/
/*if ($show == "YES" && $row['enrolled'] == "YES") {
;
} else {
$aux[] = $row;
}*/
}
$currencyType = findCurrency();
$content = '';
foreach ($aux as $course) {
$content .= '
<div class="span8">
<div class="row well-course">
<div class="span1 icon-course">
<div class="thumbnail">
<a class="ajax" rel="gb_page_center[778]" title=""
href="'.$server.'plugin/buycourses/src/ajax.php?
a=show_course_information&code='.$course['code'].'">
<img alt="" src="'.$server.$course['course_img'].'">
</a>
</div>
</div>
<div class="span3">
<div class="categories-course-description">
<h3>'.$course['title'].'</h3>
<h5>'.get_lang('Teacher').': '.$course['teacher'].'</h5>
</div>';
if ($course['enrolled'] == "YES") {
$content .= '<span class="label label-info">'.$plugin->get_lang('TheUserIsAlreadyRegisteredInTheCourse').'</span>';
}
if ($course['enrolled'] == "TMP") {
$content .= '<span class="label label-warning">'.$plugin->get_lang('WaitingToReceiveThePayment').'</span>';
}
$content .= '</div>
<div class="span3 right">
<div class="sprice right">'.
$course['price'].' '.$currencyType.'
</div>
<div class="cleared">
</div>
<div class="btn-group right">
<a class="ajax btn btn-primary" title=""
href="'.$server.'plugin/buycourses/src/ajax.php?
a=show_course_information&code='.$course['code'].'">'.
get_lang('Description').
'</a>';
if ($course['enrolled'] != "YES") {
$content .= '<a class="btn btn-success" title=""
href="'.$server.'plugin/buycourses/src/process.php?code='.$course['id'].'">'.
$buy_name.
'</a>';
}
$content .= '</div>
</div>
</div>
</div>';
}
echo json_encode(array("status" => "true", "content" => $content));
}
if ($_REQUEST['tab'] == 'save_mod') {
if (isset($_REQUEST['course_id'])) {
$productId = $_REQUEST['course_id'];

@ -9,7 +9,6 @@
*/
$cidReset = true;
require_once dirname(__FILE__) . '/buy_course.lib.php';
require_once '../../../main/inc/global.inc.php';
api_protect_admin_script(true);

@ -8,7 +8,6 @@
* Initialization
*/
require_once '../config.php';
require_once dirname(__FILE__) . '/buy_course.lib.php';
$currentUserId = api_get_user_id();

@ -8,7 +8,6 @@
* Init
*/
require_once '../config.php';
require_once dirname(__FILE__) . '/buy_course.lib.php';
$plugin = BuyCoursesPlugin::create();
@ -107,9 +106,6 @@ switch ($sale['payment_type']) {
'reference' => $sale['reference']
]
);
$messageTemplate->assign('sale_product', $sale['product_name']);
$messageTemplate->assign('sale_currency', $currency['iso_code']);
$messageTemplate->assign('sale_price', $sale['price']);
$messageTemplate->assign('transfer_accounts', $transferAccounts);
api_mail_html(

@ -8,7 +8,6 @@
$cidReset = true;
require_once '../config.php';
require_once dirname(__FILE__) . '/buy_course.lib.php';
api_protect_admin_script();

@ -8,7 +8,6 @@
* Init
*/
require_once '../config.php';
require_once dirname(__FILE__) . '/buy_course.lib.php';
$plugin = BuyCoursesPlugin::create();
$paypalEnabled = $plugin->get('paypal_enable') === 'true';

Loading…
Cancel
Save