@ -1,11 +1,13 @@ |
||||
Courses purchase plugin for Chamilo LMS |
||||
Buy Courses plugin for Chamilo LMS |
||||
======================================= |
||||
Users can access the purchases catalog to buy courses (or sessions, since v2 of |
||||
this plugin) enabled for purchase. |
||||
If the user is not registered or logged in, he/she will be requested to |
||||
register/login before he/she can resume buying items. |
||||
Once the course is chosen, Chamilo shows available payment types (currently only |
||||
PayPal works) and lets the user proceed with the purchase. |
||||
Finally, the user receives an e-mail confirming the purchase and his account is |
||||
automatically modified to give him/her access to the course/session. |
||||
Users can access the purchases catalog to buy courses or sessions (since v2 of this plugin) |
||||
enabled for sale. |
||||
|
||||
If the user is not registered or logged in, he/she will be requested to register/login |
||||
before he/she can resume buying items. |
||||
|
||||
Once the course or session is chosen, shows available payment types (currently only PayPal works) |
||||
and lets the user proceed with the purchase. |
||||
|
||||
Finally, the user receives an e-mail confirming the purchase and him/her is can access to the |
||||
course/session. |
||||
|
||||
@ -1,5 +1,11 @@ |
||||
Courses purchase plugin<br/><br/> |
||||
Users can access the courses purchase catalog to buy available courses.<br/> |
||||
If the user is unregistered he/she will be requested to register.<br/> |
||||
Once the course is chosen, Chamilo shows the different payment types available (currently only PayPal works). <br/> |
||||
Finally, the user receives user and password by e-mail, to access the chosen course. <br/> |
||||
<p>Users can access the purchases catalog to buy courses or sessions (since v2 of this plugin) |
||||
enabled for sale.</p> |
||||
|
||||
<p>If the user is not registered or logged in, he/she will be requested to register/login |
||||
before he/she can resume buying items.</p> |
||||
|
||||
<p>Once the course or session is chosen, shows available payment types (currently only PayPal works) |
||||
and lets the user proceed with the purchase.</p> |
||||
|
||||
<p>Finally, the user receives an e-mail confirming the purchase and him/her is can access to the |
||||
course/session.</p> |
||||
|
||||
|
Before Width: | Height: | Size: 1.2 KiB |
@ -1,105 +0,0 @@ |
||||
body { |
||||
background-color: #FFFFFF; |
||||
font-family: Verdana, Arial, Helvetica, sans-serif; |
||||
font-size: 10px; |
||||
scrollbar-3dlight-color: #F0F0EE; |
||||
scrollbar-arrow-color: #676662; |
||||
scrollbar-base-color: #F0F0EE; |
||||
scrollbar-darkshadow-color: #DDDDDD; |
||||
scrollbar-face-color: #E0E0DD; |
||||
scrollbar-highlight-color: #F0F0EE; |
||||
scrollbar-shadow-color: #F0F0EE; |
||||
scrollbar-track-color: #F5F5F5; |
||||
} |
||||
|
||||
td { |
||||
font-family: Verdana, Arial, Helvetica, sans-serif; |
||||
font-size: 10px; |
||||
} |
||||
|
||||
pre { |
||||
font-family: Verdana, Arial, Helvetica, sans-serif; |
||||
font-size: 10px; |
||||
} |
||||
|
||||
.example1 { |
||||
font-weight: bold; |
||||
font-size: 14px |
||||
} |
||||
|
||||
.example2 { |
||||
font-weight: bold; |
||||
font-size: 12px; |
||||
color: #FF0000 |
||||
} |
||||
|
||||
.tablerow1 { |
||||
background-color: #BBBBBB; |
||||
} |
||||
|
||||
thead { |
||||
background-color: #FFBBBB; |
||||
} |
||||
|
||||
tfoot { |
||||
background-color: #BBBBFF; |
||||
} |
||||
|
||||
th { |
||||
font-family: Verdana, Arial, Helvetica, sans-serif; |
||||
font-size: 13px; |
||||
} |
||||
|
||||
/* Basic formats */ |
||||
|
||||
.bold { |
||||
font-weight: bold; |
||||
} |
||||
|
||||
.italic { |
||||
font-style: italic; |
||||
} |
||||
|
||||
.underline { |
||||
text-decoration: underline; |
||||
} |
||||
|
||||
/* Global align classes */ |
||||
|
||||
.left { |
||||
text-align: inherit; |
||||
} |
||||
|
||||
.center { |
||||
text-align: center; |
||||
} |
||||
|
||||
.right { |
||||
text-align: right; |
||||
} |
||||
|
||||
.full { |
||||
text-align: justify |
||||
} |
||||
|
||||
/* Image and table specific aligns */ |
||||
|
||||
img.left, table.left { |
||||
float: left; |
||||
text-align: inherit; |
||||
} |
||||
|
||||
img.center, table.center { |
||||
margin-left: auto; |
||||
margin-right: auto; |
||||
text-align: inherit; |
||||
} |
||||
|
||||
img.center { |
||||
display: block; |
||||
} |
||||
|
||||
img.right, table.right { |
||||
float: right; |
||||
text-align: inherit; |
||||
} |
||||
@ -1,117 +1,3 @@ |
||||
.thumbnail .caption{ |
||||
text-align: center; |
||||
} |
||||
.cleared { |
||||
content: "."; |
||||
display: block; |
||||
height: 0; |
||||
clear: both; |
||||
visibility: hidden; |
||||
line-height: 0; |
||||
} |
||||
table .bg-color{ |
||||
background-color: #E5EDF9; |
||||
color: #333; |
||||
} |
||||
table td.ta-center, table th.ta-center { |
||||
text-align: center; |
||||
} |
||||
|
||||
#courses_table td, #transfer_table td, #order_table td { |
||||
vertical-align: middle; |
||||
} |
||||
|
||||
#courses_table td input.price, #transfer_table td input, #currency_type { |
||||
margin: 0; |
||||
} |
||||
|
||||
#courses_table td.btop { |
||||
border-top: 1px solid #C5DEEB; |
||||
border-bottom: 1px solid #C5DEEB; |
||||
} |
||||
|
||||
#courses_table tr.fmod { |
||||
border: 1px solid #C5DEEB; |
||||
background: #C5DEEB; |
||||
} |
||||
|
||||
.sprice { |
||||
color: #4D984E; |
||||
font-size: 18px; |
||||
font-weight: bold; |
||||
margin: 15px 0; |
||||
} |
||||
|
||||
.dinline { |
||||
display: inline; |
||||
} |
||||
|
||||
.fright { |
||||
float: right; |
||||
} |
||||
|
||||
.cursor { |
||||
cursor: pointer; |
||||
} |
||||
|
||||
.ta-center { |
||||
text-align: center; |
||||
} |
||||
|
||||
textarea#message { |
||||
width: 50%; |
||||
} |
||||
|
||||
.send_result { |
||||
font-weight: bold; |
||||
} |
||||
|
||||
select#lsessions, select#lcourses, select#lexercises, select#status { |
||||
margin-bottom: 0px; |
||||
} |
||||
|
||||
.column_field_filter { |
||||
padding: 6px 10px 1px 1px; |
||||
text-align: right; |
||||
} |
||||
|
||||
.height5 { |
||||
height: 5px; |
||||
} |
||||
|
||||
.margin-left-fifty{ |
||||
margin-left: 50px !important; |
||||
} |
||||
.category_well h4{ |
||||
padding-left: 0; |
||||
} |
||||
.category_well .form-content{ |
||||
padding-left: 1em; |
||||
padding-right: 1em; |
||||
} |
||||
.category_well .btn{ |
||||
width: 100%; |
||||
line-height: 30px; |
||||
font-size: 16px; |
||||
} |
||||
.icon-course .thumbnail{ |
||||
border: none; |
||||
box-shadow: none; |
||||
} |
||||
.well-course{ |
||||
padding-top: 1em; |
||||
padding-bottom: 1em; |
||||
border-bottom: 1px solid #D3E6F0; |
||||
} |
||||
.ui-widget-content .well-course a, .ui-widget-content .well-course a:hover{ |
||||
color: #fff; |
||||
} |
||||
.label-info, .badge-info { |
||||
background-color: #53a0c6; |
||||
font-weight: normal; |
||||
} |
||||
.categories-course-description h3 { |
||||
color: #666; |
||||
font-weight: bold; |
||||
font-family: Arial; |
||||
.buy-courses-tabs { |
||||
margin-bottom: 15px; |
||||
} |
||||
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 6.9 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 831 B |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 983 B |
|
Before Width: | Height: | Size: 2.1 KiB |
@ -1,79 +0,0 @@ |
||||
.cleared { |
||||
content: "."; |
||||
display: block; |
||||
height: 0; |
||||
clear: both; |
||||
visibility: hidden; |
||||
line-height: 0; |
||||
} |
||||
|
||||
table td.ta-center, table th.ta-center { |
||||
text-align: center; |
||||
} |
||||
|
||||
#courses_table td, #transfer_table td, #order_table td { |
||||
vertical-align: middle; |
||||
} |
||||
|
||||
#courses_table td input.price, #transfer_table td input, #currency_type { |
||||
margin: 0; |
||||
} |
||||
|
||||
#courses_table td.btop { |
||||
border-top: 1px solid red; |
||||
border-bottom: 1px solid red; |
||||
} |
||||
|
||||
#courses_table tr.fmod { |
||||
border: 1px solid red; |
||||
background: #FFE0E0; |
||||
} |
||||
|
||||
.sprice { |
||||
color: #FF5555; |
||||
font-size: 26px; |
||||
font-weight: 500; |
||||
margin: 15px 0; |
||||
text-shadow: 2px 1px 0 #222222; |
||||
} |
||||
|
||||
.dinline { |
||||
display: inline; |
||||
} |
||||
|
||||
.fright { |
||||
float: right; |
||||
} |
||||
|
||||
.cursor { |
||||
cursor: pointer; |
||||
} |
||||
|
||||
.ta-center { |
||||
text-align: center; |
||||
} |
||||
|
||||
textarea#message { |
||||
width: 50%; |
||||
} |
||||
|
||||
.send_result { |
||||
font-weight: bold; |
||||
} |
||||
|
||||
select#lsessions, select#lcourses, select#lexercises, select#status { |
||||
margin-bottom: 0px; |
||||
} |
||||
|
||||
.column_field_filter { |
||||
padding: 6px 10px 1px 1px; |
||||
text-align: right; |
||||
} |
||||
|
||||
.height5 { |
||||
height: 5px; |
||||
} |
||||
|
||||
.margin-left-fifty{ |
||||
margin-left: 50px !important; |
||||
} |
||||
|
Before Width: | Height: | Size: 898 B |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
@ -1,31 +0,0 @@ |
||||
<?php |
||||
/* For license terms, see /license.txt */ |
||||
/** |
||||
* AJAX script to get courses descriptions |
||||
* @package chamilo.plugin.buycourses |
||||
*/ |
||||
|
||||
require_once '../config.php'; |
||||
|
||||
// Get the name of the database course. |
||||
$tbl_course_description = Database::get_course_table(TABLE_COURSE_DESCRIPTION); |
||||
|
||||
$code = Database::escape_string($_GET['code']); |
||||
$course_info = api_get_course_info($code); |
||||
echo Display::tag('h2', $course_info['name']); |
||||
echo '<br />'; |
||||
|
||||
$sql = "SELECT * FROM $tbl_course_description |
||||
WHERE c_id = " . intval($course_info['real_id']) . " |
||||
AND session_id = 0 ORDER BY id"; |
||||
|
||||
$result = Database::query($sql); |
||||
if (Database::num_rows($result) > 0) { |
||||
while ($description = Database::fetch_object($result)) { |
||||
$descriptions[$description->id] = $description; |
||||
} |
||||
// Function that displays the details of the course description in html. |
||||
echo CourseManager::get_details_course_description_html($descriptions, api_get_system_encoding(), false); |
||||
} else { |
||||
echo get_lang('NoDescription'); |
||||
} |
||||
@ -1,676 +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'; |
||||
|
||||
/** |
||||
* |
||||
*/ |
||||
function sync() |
||||
{ |
||||
$tableBuySessionRelCourse = Database::get_main_table(TABLE_BUY_SESSION_COURSE); |
||||
$tableSessionRelCourse = Database::get_main_table(TABLE_MAIN_SESSION_COURSE); |
||||
|
||||
$sql = "UPDATE $tableBuySessionRelCourse SET sync = 0"; |
||||
Database::query($sql); |
||||
|
||||
$sql = "SELECT session_id, c_id, nbr_users FROM $tableSessionRelCourse"; |
||||
$res = Database::query($sql); |
||||
while ($row = Database::fetch_assoc($res)) { |
||||
$sql = "SELECT 1 FROM $tableBuySessionRelCourse WHERE session_id=" . $row['session_id']; |
||||
$result = Database::query($sql); |
||||
if (Database::affected_rows($result) > 0) { |
||||
$sql = "UPDATE $tableBuySessionRelCourse SET sync = 1 WHERE session_id=" . $row['session_id']; |
||||
Database::query($sql); |
||||
} else { |
||||
$courseCode = api_get_course_info_by_id($row['c_id'])['code']; |
||||
$sql = "INSERT INTO $tableBuySessionRelCourse (session_id, course_code, nbr_users, sync) |
||||
VALUES (" . $row['session_id'] . ", '" . $courseCode . "', " . $row['nbr_users'] . ", 1);"; |
||||
Database::query($sql); |
||||
} |
||||
} |
||||
$sql = "DELETE FROM $tableBuySessionRelCourse WHERE sync = 0;"; |
||||
Database::query($sql); |
||||
|
||||
$tableBuyCourse = Database::get_main_table(TABLE_BUY_COURSE); |
||||
$tableCourse = Database::get_main_table(TABLE_MAIN_COURSE); |
||||
|
||||
$sql = "UPDATE $tableBuyCourse SET sync = 0"; |
||||
Database::query($sql); |
||||
|
||||
$sql = "SELECT id, code, title FROM $tableCourse"; |
||||
$res = Database::query($sql); |
||||
while ($row = Database::fetch_assoc($res)) { |
||||
$sql = "SELECT session_id FROM $tableBuySessionRelCourse |
||||
WHERE course_code = '" . $row['code'] . "' LIMIT 1"; |
||||
$courseIdSession = Database::fetch_assoc(Database::query($sql))['session_id']; |
||||
if (!is_numeric($courseIdSession)) { |
||||
$courseIdSession = 0; |
||||
} |
||||
|
||||
$sql = "SELECT 1 FROM $tableBuyCourse WHERE course_id='" . $row['id'] . "';"; |
||||
$result = Database::query($sql); |
||||
if (Database::affected_rows($result) > 0) { |
||||
$sql = "UPDATE $tableBuyCourse SET sync = 1, session_id = $courseIdSession WHERE course_id='" . $row['id'] . "';"; |
||||
Database::query($sql); |
||||
} else { |
||||
$sql = "INSERT INTO $tableBuyCourse (session_id, course_id, code, title, visible, sync) |
||||
VALUES ('" . $courseIdSession . "', '" . $row['id'] . "', '" . |
||||
$row['code'] . "', '" . $row['title'] . "', 0, 1);"; |
||||
Database::query($sql); |
||||
} |
||||
} |
||||
$sql = "DELETE FROM $tableBuyCourse WHERE sync = 0;"; |
||||
Database::query($sql); |
||||
|
||||
$tableBuySession = Database::get_main_table(TABLE_BUY_SESSION); |
||||
$tableSession = Database::get_main_table(TABLE_MAIN_SESSION); |
||||
|
||||
$sql = "UPDATE $tableBuySession SET sync = 0"; |
||||
Database::query($sql); |
||||
|
||||
$sql = "SELECT id, name, access_start_date, access_end_date FROM $tableSession"; |
||||
$res = Database::query($sql); |
||||
while ($row = Database::fetch_assoc($res)) { |
||||
$sql = "SELECT 1 FROM $tableBuySession WHERE session_id='" . $row['id'] . "';"; |
||||
$result = Database::query($sql); |
||||
if (Database::affected_rows($result) > 0) { |
||||
$sql = "UPDATE $tableBuySession SET sync = 1 WHERE session_id='" . $row['id'] . "';"; |
||||
Database::query($sql); |
||||
} else { |
||||
$sql = "INSERT INTO $tableBuySession (session_id, name, date_start, date_end, visible, sync) |
||||
VALUES ('" . $row['id'] . "', '" . $row['name'] . "', '" . |
||||
$row['access_start_date'] . "', '" . $row['access_end_date'] . "', 0, 1);"; |
||||
Database::query($sql); |
||||
} |
||||
} |
||||
$sql = "DELETE FROM $tableBuySession WHERE sync = 0;"; |
||||
Database::query($sql); |
||||
} |
||||
|
||||
/** |
||||
* List sessions details from the buy-session table and the session table |
||||
* @return array Results (list of session details) |
||||
*/ |
||||
function listSessions() |
||||
{ |
||||
$tableBuySession = Database::get_main_table(TABLE_BUY_SESSION); |
||||
$tableSession = Database::get_main_table(TABLE_MAIN_SESSION); |
||||
$sql = "SELECT a.session_id, a.visible, a.price, b.* |
||||
FROM $tableBuySession a, $tableSession b |
||||
WHERE a.session_id = b.id;"; |
||||
|
||||
$res = Database::query($sql); |
||||
$aux = array(); |
||||
while ($row = Database::fetch_assoc($res)) { |
||||
$aux[] = $row; |
||||
} |
||||
|
||||
return $aux; |
||||
} |
||||
|
||||
/** |
||||
* List courses details from the buy-course table and the course table |
||||
* @return array Results (list of courses details) |
||||
*/ |
||||
function listCourses() |
||||
{ |
||||
$tableBuyCourse = Database::get_main_table(TABLE_BUY_COURSE); |
||||
$tableCourse = Database::get_main_table(TABLE_MAIN_COURSE); |
||||
$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;"; |
||||
$res = Database::query($sql); |
||||
$aux = array(); |
||||
while ($row = Database::fetch_assoc($res)) { |
||||
$aux[] = $row; |
||||
} |
||||
return $aux; |
||||
} |
||||
|
||||
/** |
||||
* Lists current user session details, including each session course details |
||||
* @return array Sessions details list |
||||
*/ |
||||
function userSessionList() |
||||
{ |
||||
$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(); |
||||
|
||||
// get existing sessions |
||||
$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;"; |
||||
$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['directory'] . "/course-pic85x85.png")) { |
||||
$row['course_img'] = "courses/" . $row['directory'] . "/course-pic85x85.png"; |
||||
} else { |
||||
$row['course_img'] = "main/img/without_picture.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 session_id ='".$rowSession['session_id']."' AND |
||||
user_id = $currentUserId"; |
||||
$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='" . $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 session_id ='".$rowSession['session_id']."' AND |
||||
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; |
||||
// add the current whole session |
||||
$auxSessions[] = $rowSession; |
||||
} |
||||
return $auxSessions; |
||||
} |
||||
|
||||
/** |
||||
* Lists current user course details |
||||
* @return array Course details list |
||||
*/ |
||||
function userCourseList() |
||||
{ |
||||
$tableBuyCourse = Database::get_main_table(TABLE_BUY_COURSE); |
||||
$tableCourse = Database::get_main_table(TABLE_MAIN_COURSE); |
||||
$tableCourseRelUser = Database::get_main_table(TABLE_MAIN_COURSE_USER); |
||||
$tableBuyCourseTemporal = Database::get_main_table(TABLE_BUY_COURSE_TEMPORAL); |
||||
$currentUserId = api_get_user_id(); |
||||
|
||||
$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;"; |
||||
$res = Database::query($sql); |
||||
$aux = array(); |
||||
while ($row = Database::fetch_assoc($res)) { |
||||
//check teacher |
||||
$sql = "SELECT lastname, firstname |
||||
FROM $tableCourseRelUser a, user 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 the user 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 { |
||||
$sql = "SELECT 1 FROM $tableBuyCourseTemporal |
||||
WHERE course_code='" . $row['code'] . "' |
||||
AND user_id='" . $currentUserId . "';"; |
||||
$result = Database::query($sql); |
||||
if (Database::affected_rows($result) > 0) { |
||||
$row['enrolled'] = "TMP"; |
||||
} else { |
||||
$row['enrolled'] = "NO"; |
||||
} |
||||
} |
||||
} else { |
||||
$sql = "SELECT 1 FROM $tableBuyCourseTemporal |
||||
WHERE course_code='" . $row['code'] . "' |
||||
AND user_id='" . $currentUserId . "';"; |
||||
$result = Database::query($sql); |
||||
if (Database::affected_rows($result) > 0) { |
||||
$row['enrolled'] = "TMP"; |
||||
} else { |
||||
$row['enrolled'] = "NO"; |
||||
} |
||||
} |
||||
//check images |
||||
if (file_exists("../../courses/" . $row['code'] . "/course-pic85x85.png")) { |
||||
$row['course_img'] = "courses/" . $row['code'] . "/course-pic85x85.png"; |
||||
} else { |
||||
$row['course_img'] = "main/img/without_picture.png"; |
||||
} |
||||
$row['price'] = number_format($row['price'], 2, '.', ' '); |
||||
$aux[] = $row; |
||||
} |
||||
return $aux; |
||||
} |
||||
|
||||
/** |
||||
* 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; |
||||
} |
||||
|
||||
/** |
||||
* Return an icon representing the visibility of the course |
||||
* @param int $option The course visibility |
||||
* @return string HTML string of the visibility icon |
||||
*/ |
||||
function getCourseVisibilityIcon($option) |
||||
{ |
||||
$style = 'margin-bottom:-5px;margin-right:5px;'; |
||||
switch ($option) { |
||||
case 0: |
||||
return Display::return_icon('bullet_red.gif', get_plugin_lang('CourseVisibilityClosed', 'BuyCoursesPlugin'), array('style' => $style)); |
||||
break; |
||||
case 1: |
||||
return Display::return_icon('bullet_orange.gif', get_plugin_lang('Private', 'BuyCoursesPlugin'), array('style' => $style)); |
||||
break; |
||||
case 2: |
||||
return Display::return_icon('bullet_green.gif', get_plugin_lang('OpenToThePlatform', 'BuyCoursesPlugin'), array('style' => $style)); |
||||
break; |
||||
case 3: |
||||
return Display::return_icon('bullet_blue.gif', get_plugin_lang('OpenToTheWorld', 'BuyCoursesPlugin'), array('style' => $style)); |
||||
break; |
||||
default: |
||||
return Display::return_icon('bullet_grey.gif', get_plugin_lang('CourseVisibilityHidden', 'BuyCoursesPlugin'), array('style' => $style)); |
||||
} |
||||
} |
||||
/** |
||||
* List the available currencies |
||||
* @result array The list of currencies |
||||
*/ |
||||
function listCurrency() |
||||
{ |
||||
$tableBuyCourseCountry = Database::get_main_table(TABLE_BUY_COURSE_COUNTRY); |
||||
$sql = "SELECT * FROM $tableBuyCourseCountry |
||||
ORDER BY country_name ASC"; |
||||
$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; |
||||
} |
||||
/** |
||||
* Gets the stored PayPal params |
||||
* @return array The stored PayPal params |
||||
*/ |
||||
function paypalParameters() |
||||
{ |
||||
$tableBuyCoursePaypal = Database::get_main_table(TABLE_BUY_COURSE_PAYPAL); |
||||
$sql = "SELECT * FROM $tableBuyCoursePaypal"; |
||||
$res = Database::query($sql); |
||||
$row = Database::fetch_assoc($res); |
||||
|
||||
return $row; |
||||
} |
||||
/** |
||||
* Gets the parameters for the bank transfers payment method |
||||
* @result array Bank transfer payment parameters stored |
||||
*/ |
||||
function transferParameters() |
||||
{ |
||||
$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-pic85x85.png")) { |
||||
$row['course_img'] = "courses/".$row['directory']."/course-pic85x85.png"; |
||||
} else { |
||||
$row['course_img'] = "main/img/without_picture.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("../../courses/" . $row['code'] . "/course-pic85x85.png")) { |
||||
$row['course_img'] = "courses/" . $row['code'] . "/course-pic85x85.png"; |
||||
} else { |
||||
$row['course_img'] = "main/img/without_picture.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; |
||||
} |
||||
@ -0,0 +1,71 @@ |
||||
<?php |
||||
/** |
||||
* List of courses |
||||
* @package chamilo.plugin.buycourses |
||||
*/ |
||||
/** |
||||
* Initialization |
||||
*/ |
||||
$cidReset = true; |
||||
|
||||
require_once '../../../main/inc/global.inc.php'; |
||||
|
||||
$plugin = BuyCoursesPlugin::create(); |
||||
$includeSessions = $plugin->get('include_sessions') === 'true'; |
||||
|
||||
$nameFilter = null; |
||||
$minFilter = 0; |
||||
$maxFilter = 0; |
||||
|
||||
$form = new FormValidator('search_filter_form', 'get', null, null, [], FormValidator::LAYOUT_INLINE); |
||||
|
||||
if ($form->validate()) { |
||||
$formValues = $form->getSubmitValues(); |
||||
$nameFilter = isset($formValues['name']) ? $formValues['name'] : null; |
||||
$minFilter = isset($formValues['min']) ? $formValues['min'] : 0; |
||||
$maxFilter = isset($formValues['max']) ? $formValues['max'] : 0; |
||||
} |
||||
|
||||
$form->addHeader($plugin->get_lang('SearchFilter')); |
||||
$form->addText('name', get_lang('SessionName'), false); |
||||
$form->addElement( |
||||
'number', |
||||
'min', |
||||
$plugin->get_lang('MinimumPrice'), |
||||
['step' => '0.01', 'min' => '0'] |
||||
); |
||||
$form->addElement( |
||||
'number', |
||||
'max', |
||||
$plugin->get_lang('MaximumPrice'), |
||||
['step' => '0.01', 'min' => '0'] |
||||
); |
||||
$form->addHtml('<hr>'); |
||||
$form->addButtonFilter(get_lang('Search')); |
||||
|
||||
$courseList = $plugin->getCatalogCourseList($nameFilter, $minFilter, $maxFilter); |
||||
|
||||
//View |
||||
if (api_is_platform_admin()) { |
||||
$interbreadcrumb[] = [ |
||||
'url' => 'configuration.php', |
||||
'name' => $plugin->get_lang('AvailableCoursesConfiguration') |
||||
]; |
||||
$interbreadcrumb[] = [ |
||||
'url' => 'paymentsetup.php', |
||||
'name' => $plugin->get_lang('PaymentsConfiguration') |
||||
]; |
||||
} |
||||
|
||||
$templateName = $plugin->get_lang('CourseListOnSale'); |
||||
$tpl = new Template($templateName); |
||||
$tpl->assign('search_filter_form', $form->returnForm()); |
||||
$tpl->assign('showing_courses', true); |
||||
$tpl->assign('courses', $courseList); |
||||
$tpl->assign('sessions_are_included', $includeSessions); |
||||
|
||||
$content = $tpl->fetch('buycourses/view/catalog.tpl'); |
||||
|
||||
$tpl->assign('header', $templateName); |
||||
$tpl->assign('content', $content); |
||||
$tpl->display_one_col_template(); |
||||
@ -1,26 +1,12 @@ |
||||
<?php |
||||
/* For license terms, see /license.txt */ |
||||
/** |
||||
* Errors management for the Buy Courses plugin - Redirects to list.php |
||||
* Errors management for the Buy Courses plugin - Redirects to course_catalog.php |
||||
* @package chamilo.plugin.buycourses |
||||
*/ |
||||
/** |
||||
* Config |
||||
*/ |
||||
$course_plugin = 'buycourses'; |
||||
require_once 'buy_course.lib.php'; |
||||
require_once 'buy_course_plugin.class.php'; |
||||
unset($_SESSION['bc_sale_id']); |
||||
|
||||
unset($_SESSION['bc_user_id']); |
||||
unset($_SESSION['bc_registered']); |
||||
unset($_SESSION['bc_code']); |
||||
unset($_SESSION['bc_title']); |
||||
unset($_SESSION['Payment_Amount']); |
||||
unset($_SESSION['currencyCodeType']); |
||||
unset($_SESSION['PaymentType']); |
||||
unset($_SESSION['nvpReqArray']); |
||||
unset($_SESSION['TOKEN']); |
||||
$_SESSION['bc_success'] = false; |
||||
$_SESSION['bc_message'] = 'CancelOrder'; |
||||
|
||||
header('Location:list.php'); |
||||
header('Location: course_catalog.php'); |
||||
|
||||
@ -1,333 +0,0 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
/** |
||||
* This script displays a form for registering new users to a course directly |
||||
* @package chamilo.plugin.buycourses |
||||
*/ |
||||
/** |
||||
* Init |
||||
*/ |
||||
use ChamiloSession as Session; |
||||
|
||||
if (!empty($_POST['language'])) { //quick hack to adapt the registration form result to the selected registration language |
||||
$_GET['language'] = $_POST['language']; |
||||
} |
||||
require_once '../config.php'; |
||||
|
||||
if (!empty($_SESSION['user_language_choice'])) { |
||||
$user_selected_language = $_SESSION['user_language_choice']; |
||||
} elseif (!empty($_SESSION['_user']['language'])) { |
||||
$user_selected_language = $_SESSION['_user']['language']; |
||||
} else { |
||||
$user_selected_language = api_get_setting('platformLanguage'); |
||||
} |
||||
|
||||
$form = new FormValidator('registration'); |
||||
|
||||
if (api_get_setting('allow_terms_conditions') == 'true') { |
||||
$user_already_registered_show_terms = isset($_SESSION['term_and_condition']['user_id']); |
||||
} else { |
||||
$user_already_registered_show_terms = false; |
||||
} |
||||
|
||||
//Direct Link Subscription feature #5299 |
||||
$course_code_redirect = isset($_REQUEST['c']) && !empty($_REQUEST['c']) ? $_REQUEST['c'] : null; |
||||
$exercise_redirect = isset($_REQUEST['e']) && !empty($_REQUEST['e']) ? $_REQUEST['e'] : null; |
||||
|
||||
if (!empty($course_code_redirect)) { |
||||
Session::write('course_redirect', $course_code_redirect); |
||||
Session::write('exercise_redirect', $exercise_redirect); |
||||
} |
||||
|
||||
if ($user_already_registered_show_terms == false) { |
||||
|
||||
if (api_is_western_name_order()) { |
||||
// FIRST NAME and LAST NAME |
||||
$form->addElement('text', 'firstname', get_lang('FirstName'), array('size' => 40)); |
||||
$form->addElement('text', 'lastname', get_lang('LastName'), array('size' => 40)); |
||||
} else { |
||||
// LAST NAME and FIRST NAME |
||||
$form->addElement('text', 'lastname', get_lang('LastName'), array('size' => 40)); |
||||
$form->addElement('text', 'firstname', get_lang('FirstName'), array('size' => 40)); |
||||
} |
||||
$form->applyFilter(array('lastname', 'firstname'), 'trim'); |
||||
$form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required'); |
||||
$form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required'); |
||||
|
||||
// EMAIL |
||||
$form->addElement('text', 'email', get_lang('Email'), array('size' => 40)); |
||||
if (api_get_setting('registration', 'email') == 'true') { |
||||
$form->addRule('email', get_lang('ThisFieldIsRequired'), 'required'); |
||||
} |
||||
|
||||
if (api_get_setting('login_is_email') == 'true') { |
||||
$form->applyFilter('email', 'trim'); |
||||
if (api_get_setting('registration', 'email') != 'true') { |
||||
$form->addRule('email', get_lang('ThisFieldIsRequired'), 'required'); |
||||
} |
||||
$form->addRule('email', sprintf(get_lang('UsernameMaxXCharacters'), (string)USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH); |
||||
$form->addRule('email', get_lang('UserTaken'), 'username_available'); |
||||
} |
||||
|
||||
$form->addRule('email', get_lang('EmailWrong'), 'email'); |
||||
if (api_get_setting('openid_authentication') == 'true') { |
||||
$form->addElement('text', 'openid', get_lang('OpenIDURL'), array('size' => 40)); |
||||
} |
||||
|
||||
// USERNAME |
||||
if (api_get_setting('login_is_email') != 'true') { |
||||
$form->addElement('text', 'username', get_lang('UserName'), array('size' => USERNAME_MAX_LENGTH)); |
||||
$form->applyFilter('username', 'trim'); |
||||
$form->addRule('username', get_lang('ThisFieldIsRequired'), 'required'); |
||||
$form->addRule('username', sprintf(get_lang('UsernameMaxXCharacters'), (string)USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH); |
||||
$form->addRule('username', get_lang('UsernameWrong'), 'username'); |
||||
$form->addRule('username', get_lang('UserTaken'), 'username_available'); |
||||
} |
||||
|
||||
// PASSWORD |
||||
$form->addElement('password', 'pass1', get_lang('Pass'), array('size' => 20, 'autocomplete' => 'off')); |
||||
$form->addElement('password', 'pass2', get_lang('Confirmation'), array('size' => 20, 'autocomplete' => 'off')); |
||||
$form->addRule('pass1', get_lang('ThisFieldIsRequired'), 'required'); |
||||
$form->addRule('pass2', get_lang('ThisFieldIsRequired'), 'required'); |
||||
$form->addRule(array('pass1', 'pass2'), get_lang('PassTwo'), 'compare'); |
||||
|
||||
if (CHECK_PASS_EASY_TO_FIND) { |
||||
$form->addRule('password1', get_lang('PassTooEasy') . ': ' . api_generate_password(), 'callback', 'api_check_password'); |
||||
} |
||||
|
||||
// PHONE |
||||
$form->addElement('text', 'phone', get_lang('Phone'), array('size' => 20)); |
||||
if (api_get_setting('registration', 'phone') == 'true') { |
||||
$form->addRule('phone', get_lang('ThisFieldIsRequired'), 'required'); |
||||
} |
||||
|
||||
// LANGUAGE |
||||
if (api_get_setting('registration', 'language') == 'true') { |
||||
$form->addElement('select_language', 'language', get_lang('Language')); |
||||
} |
||||
|
||||
} |
||||
|
||||
if (isset($_SESSION['user_language_choice']) && $_SESSION['user_language_choice'] != '') { |
||||
$defaults['language'] = $_SESSION['user_language_choice']; |
||||
} else { |
||||
$defaults['language'] = api_get_setting('platformLanguage'); |
||||
} |
||||
if (!empty($_GET['username'])) { |
||||
$defaults['username'] = Security::remove_XSS($_GET['username']); |
||||
} |
||||
if (!empty($_GET['email'])) { |
||||
$defaults['email'] = Security::remove_XSS($_GET['email']); |
||||
} |
||||
|
||||
if (!empty($_GET['phone'])) { |
||||
$defaults['phone'] = Security::remove_XSS($_GET['phone']); |
||||
} |
||||
|
||||
if (api_get_setting('openid_authentication') == 'true' && !empty($_GET['openid'])) { |
||||
$defaults['openid'] = Security::remove_XSS($_GET['openid']); |
||||
} |
||||
$defaults['status'] = STUDENT; |
||||
|
||||
if (is_array($extra_data)) { |
||||
$defaults = array_merge($defaults, $extra_data); |
||||
} |
||||
|
||||
$form->setDefaults($defaults); |
||||
|
||||
$content = null; |
||||
|
||||
if (api_get_setting('allow_terms_conditions') == 'true') { |
||||
$get = array_keys($_GET); |
||||
if (isset($get)) { |
||||
if ($get[0] == 'legal') { |
||||
$language = api_get_interface_language(); |
||||
$language = api_get_language_id($language); |
||||
$term_preview = LegalManager::get_last_condition($language); |
||||
if (!$term_preview) { |
||||
//look for the default language |
||||
$language = api_get_setting('platformLanguage'); |
||||
$language = api_get_language_id($language); |
||||
$term_preview = LegalManager::get_last_condition($language); |
||||
} |
||||
$tool_name = get_lang('TermsAndConditions'); |
||||
Display :: display_header($tool_name); |
||||
|
||||
if (!empty($term_preview['content'])) { |
||||
echo $term_preview['content']; |
||||
} else { |
||||
echo get_lang('ComingSoon'); |
||||
} |
||||
Display :: display_footer(); |
||||
exit; |
||||
} |
||||
} |
||||
} |
||||
|
||||
$tool_name = get_lang('Registration', null, (!empty($_POST['language']) ? $_POST['language'] : $_user['language'])); |
||||
|
||||
if (api_get_setting('allow_terms_conditions') == 'true' && $user_already_registered_show_terms) { |
||||
$tool_name = get_lang('TermsAndConditions'); |
||||
} |
||||
|
||||
$home = api_get_path(SYS_PATH) . 'home/'; |
||||
if (api_is_multiple_url_enabled()) { |
||||
$access_url_id = api_get_current_access_url_id(); |
||||
if ($access_url_id != -1) { |
||||
$url_info = api_get_access_url($access_url_id); |
||||
$url = api_remove_trailing_slash(preg_replace('/https?:\/\//i', '', $url_info['url'])); |
||||
$clean_url = api_replace_dangerous_char($url); |
||||
$clean_url = str_replace('/', '-', $clean_url); |
||||
$clean_url .= '/'; |
||||
$home_old = api_get_path(SYS_PATH) . 'home/'; |
||||
$home = api_get_path(SYS_PATH) . 'home/' . $clean_url; |
||||
} |
||||
} |
||||
|
||||
if (file_exists($home . 'register_top_' . $user_selected_language . '.html')) { |
||||
$home_top_temp = @(string)file_get_contents($home . 'register_top_' . $user_selected_language . '.html'); |
||||
$open = str_replace('{rel_path}', api_get_path(REL_PATH), $home_top_temp); |
||||
$open = api_to_system_encoding($open, api_detect_encoding(strip_tags($open))); |
||||
if (!empty($open)) { |
||||
$content = '<div class="well_border">' . $open . '</div>'; |
||||
} |
||||
} |
||||
|
||||
$content .= Display::return_message(get_lang('YourAccountHasToBeApproved')); |
||||
|
||||
// Terms and conditions |
||||
if (api_get_setting('allow_terms_conditions') == 'true') { |
||||
$language = api_get_interface_language(); |
||||
$language = api_get_language_id($language); |
||||
$term_preview = LegalManager::get_last_condition($language); |
||||
|
||||
if (!$term_preview) { |
||||
//we load from the platform |
||||
$language = api_get_setting('platformLanguage'); |
||||
$language = api_get_language_id($language); |
||||
$term_preview = LegalManager::get_last_condition($language); |
||||
|
||||
//if is false we load from english |
||||
if (!$term_preview) { |
||||
$language = api_get_language_id('english'); //this must work |
||||
$term_preview = LegalManager::get_last_condition($language); |
||||
} |
||||
} |
||||
|
||||
// Version and language |
||||
$form->addElement('hidden', 'legal_accept_type', $term_preview['version'] . ':' . $term_preview['language_id']); |
||||
$form->addElement('hidden', 'legal_info', $term_preview['legal_id'] . ':' . $term_preview['language_id']); |
||||
|
||||
if ($term_preview['type'] == 1) { |
||||
$form->addElement('checkbox', 'legal_accept', null, get_lang('IHaveReadAndAgree') . ' <a href="inscription.php?legal" target="_blank">' . get_lang('TermsAndConditions') . '</a>'); |
||||
$form->addRule('legal_accept', get_lang('ThisFieldIsRequired'), 'required'); |
||||
} else { |
||||
$preview = LegalManager::show_last_condition($term_preview); |
||||
$form->addElement('label', null, $preview); |
||||
} |
||||
} |
||||
|
||||
$form->addElement('button', 'submit', get_lang('RegisterUser'), array('class' => 'btn btn-primary btn-large')); |
||||
|
||||
if ($form->validate()) { |
||||
$values = $form->exportValues(); |
||||
$values['username'] = api_substr($values['username'], 0, USERNAME_MAX_LENGTH); //make *sure* the login isn't too long |
||||
$values['status'] = STUDENT; |
||||
$values['official_code'] = api_strtoupper($values['username']); |
||||
|
||||
if (api_get_setting('login_is_email') == 'true') { |
||||
$values['username'] = $values['email']; |
||||
} |
||||
|
||||
// Creates a new user |
||||
$user_id = UserManager::create_user($values['firstname'], $values['lastname'], $values['status'], $values['email'], $values['username'], $values['pass1'], $values['official_code'], $values['language'], $values['phone'], $picture_uri, PLATFORM_AUTH_SOURCE, null, 1, 0, null, null, true); |
||||
|
||||
// Register extra fields |
||||
$extras = array(); |
||||
foreach ($values as $key => $value) { |
||||
if (substr($key, 0, 6) == 'extra_') { //an extra field |
||||
$extras[substr($key, 6)] = $value; |
||||
} |
||||
} |
||||
|
||||
//update the extra fields |
||||
$count_extra_field = count($extras); |
||||
if ($count_extra_field > 0) { |
||||
foreach ($extras as $key => $value) { |
||||
UserManager::update_extra_field_value($user_id, $key, $value); |
||||
} |
||||
} |
||||
|
||||
if ($user_id) { |
||||
// storing the extended profile |
||||
$store_extended = false; |
||||
$sql = "UPDATE " . Database::get_main_table(TABLE_MAIN_USER) . " SET "; |
||||
if (api_get_setting('extended_profile') == 'true' && api_get_setting('extendedprofile_registration', 'mycomptetences') == 'true') { |
||||
$sql_set[] = "competences = '" . Database::escape_string($values['competences']) . "'"; |
||||
$store_extended = true; |
||||
} |
||||
if (api_get_setting('extended_profile') == 'true' && api_get_setting('extendedprofile_registration', 'mydiplomas') == 'true') { |
||||
$sql_set[] = "diplomas = '" . Database::escape_string($values['diplomas']) . "'"; |
||||
$store_extended = true; |
||||
} |
||||
if (api_get_setting('extended_profile') == 'true' && api_get_setting('extendedprofile_registration', 'myteach') == 'true') { |
||||
$sql_set[] = "teach = '" . Database::escape_string($values['teach']) . "'"; |
||||
$store_extended = true; |
||||
} |
||||
if (api_get_setting('extended_profile') == 'true' && api_get_setting('extendedprofile_registration', 'mypersonalopenarea') == 'true') { |
||||
$sql_set[] = "openarea = '" . Database::escape_string($values['openarea']) . "'"; |
||||
$store_extended = true; |
||||
} |
||||
if ($store_extended) { |
||||
$sql .= implode(',', $sql_set); |
||||
$sql .= " WHERE user_id = '" . intval($user_id) . "'"; |
||||
Database::query($sql); |
||||
} |
||||
|
||||
// if there is a default duration of a valid account then we have to change the expiration_date accordingly |
||||
if (api_get_setting('account_valid_duration') != '') { |
||||
$sql = "UPDATE " . Database::get_main_table(TABLE_MAIN_USER) . " SET expiration_date='registration_date+1' WHERE user_id='" . $user_id . "'"; |
||||
Database::query($sql); |
||||
} |
||||
|
||||
// if the account has to be approved then we set the account to inactive, sent a mail to the platform admin and exit the page. |
||||
|
||||
$TABLE_USER = Database::get_main_table(TABLE_MAIN_USER); |
||||
// 1. set account inactive |
||||
$sql = "UPDATE " . $TABLE_USER . " SET active='0' WHERE user_id='" . $user_id . "'"; |
||||
Database::query($sql); |
||||
} |
||||
|
||||
|
||||
// Terms & Conditions |
||||
if (api_get_setting('allow_terms_conditions') == 'true') { |
||||
// update the terms & conditions |
||||
|
||||
if (isset($values['legal_accept_type'])) { |
||||
$cond_array = explode(':', $values['legal_accept_type']); |
||||
if (!empty($cond_array[0]) && !empty($cond_array[1])) { |
||||
$time = time(); |
||||
$condition_to_save = intval($cond_array[0]) . ':' . intval($cond_array[1]) . ':' . $time; |
||||
UserManager::update_extra_field_value($user_id, 'legal_accept', $condition_to_save); |
||||
} |
||||
} |
||||
$values = api_get_user_info($user_id); |
||||
} |
||||
|
||||
/* SESSION REGISTERING */ |
||||
/* @todo move this in a function */ |
||||
$_user['firstName'] = stripslashes($values['firstname']); |
||||
$_user['lastName'] = stripslashes($values['lastname']); |
||||
$_user['mail'] = $values['email']; |
||||
$_user['language'] = $values['language']; |
||||
$_user['user_id'] = $user_id; |
||||
$_user['username'] = $values['username']; |
||||
Session::write('bc_user', $_user); |
||||
header('Location:process.php'); |
||||
} else { |
||||
Display :: display_header($tool_name); |
||||
echo Display::page_header($tool_name); |
||||
echo $content; |
||||
$form->display(); |
||||
Display :: display_footer(); |
||||
} |
||||
@ -1,68 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* List of courses |
||||
* @package chamilo.plugin.buycourses |
||||
*/ |
||||
/** |
||||
* Initialization |
||||
*/ |
||||
|
||||
require_once '../../../main/inc/global.inc.php'; |
||||
require_once api_get_path(LIBRARY_PATH) . 'plugin.class.php'; |
||||
require_once 'buy_course_plugin.class.php'; |
||||
require_once 'buy_course.lib.php'; |
||||
|
||||
$course_plugin = 'buycourses'; |
||||
$plugin = BuyCoursesPlugin::create(); |
||||
$_cid = 0; |
||||
|
||||
if (api_is_platform_admin()) { |
||||
$interbreadcrumb[] = array("url" => "configuration.php", "name" => $plugin->get_lang('AvailableCoursesConfiguration')); |
||||
$interbreadcrumb[] = array("url" => "paymentsetup.php", "name" => $plugin->get_lang('PaymentsConfiguration')); |
||||
} |
||||
|
||||
$templateName = $plugin->get_lang('CourseListOnSale'); |
||||
$tpl = new Template($templateName); |
||||
if (isset($_SESSION['bc_success'])) { |
||||
$tpl->assign('rmessage', 'YES'); |
||||
if ($_SESSION['bc_success'] == true) { |
||||
$message = sprintf($plugin->get_lang($_SESSION['bc_message']), $_SESSION['bc_url']); |
||||
unset($_SESSION['bc_url']); |
||||
$tpl->assign('class', 'confirmation-message'); |
||||
} else { |
||||
$message = $plugin->get_lang($_SESSION['bc_message']); |
||||
$tpl->assign('class', 'warning-message'); |
||||
} |
||||
$tpl->assign('responseMessage', $message); |
||||
unset($_SESSION['bc_success']); |
||||
unset($_SESSION['bc_message']); |
||||
|
||||
} else { |
||||
$tpl->assign('rmessage', 'NO'); |
||||
} |
||||
|
||||
$courseList = userCourseList(); |
||||
$categoryList = buyCourseListCategories(); |
||||
$currencyType = findCurrency(); |
||||
|
||||
$tpl->assign('server', $_configuration['root_web']); |
||||
$tpl->assign('courses', $courseList); |
||||
$tpl->assign('category', $categoryList); |
||||
$tpl->assign('currency', $currencyType); |
||||
|
||||
$selectedValue = Database::select( |
||||
'selected_value', |
||||
Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT), |
||||
array('where'=> array('variable = ?' => array('buycourses_include_sessions'))) |
||||
); |
||||
$result = array_shift($selectedValue); |
||||
|
||||
if ($result['selected_value'] === 'true') { |
||||
$tpl->assign('sessionsAreIncluded', 'YES'); |
||||
$tpl->assign('sessions', userSessionList()); |
||||
} |
||||
|
||||
$listing_tpl = 'buycourses/view/list.tpl'; |
||||
$content = $tpl->fetch($listing_tpl); |
||||
$tpl->assign('content', $content); |
||||
$tpl->display_one_col_template(); |
||||
@ -1,40 +0,0 @@ |
||||
<?php |
||||
/* For license terms, see /license.txt */ |
||||
/** |
||||
* List of pending payments of the Buy Courses plugin |
||||
* @package chamilo.plugin.buycourses |
||||
*/ |
||||
/** |
||||
* Initialization |
||||
*/ |
||||
require_once '../config.php'; |
||||
require_once dirname(__FILE__) . '/buy_course.lib.php'; |
||||
|
||||
$plugin = BuyCoursesPlugin::create(); |
||||
$_cid = 0; |
||||
$tableName = $plugin->get_lang('AvailableCoursesConfiguration'); |
||||
$interbreadcrumb[] = array("url" => "list.php", "name" => $plugin->get_lang('CourseListOnSale')); |
||||
$interbreadcrumb[] = array("url" => "paymentsetup.php", "name" => $plugin->get_lang('PaymentsConfiguration')); |
||||
|
||||
$tpl = new Template($tableName); |
||||
|
||||
$teacher = api_is_platform_admin(); |
||||
api_protect_admin_script(true); |
||||
|
||||
if ($teacher) { |
||||
$pendingList = pendingList($_SESSION['bc_codetext']); |
||||
$confirmationImg = api_get_path(WEB_PLUGIN_PATH) . 'buycourses/resources/message_confirmation.png'; |
||||
$deleteImg = api_get_path(WEB_PLUGIN_PATH) . 'buycourses/resources/delete.png'; |
||||
$currencyType = findCurrency(); |
||||
|
||||
$tpl->assign('server', $_configuration['root_web']); |
||||
$tpl->assign('pending', $pendingList); |
||||
$tpl->assign('confirmation_img', $confirmationImg); |
||||
$tpl->assign('delete_img', $deleteImg); |
||||
$tpl->assign('currency', $currencyType); |
||||
|
||||
$listing_tpl = 'buycourses/view/pending_orders.tpl'; |
||||
$content = $tpl->fetch($listing_tpl); |
||||
$tpl->assign('content', $content); |
||||
$tpl->display_one_col_template(); |
||||
} |
||||
@ -0,0 +1,116 @@ |
||||
<?php |
||||
/* For license terms, see /license.txt */ |
||||
/** |
||||
* List of pending payments of the Buy Courses plugin |
||||
* @package chamilo.plugin.buycourses |
||||
*/ |
||||
//Initialization |
||||
$cidReset = true; |
||||
|
||||
require_once '../config.php'; |
||||
|
||||
api_protect_admin_script(); |
||||
|
||||
$plugin = BuyCoursesPlugin::create(); |
||||
|
||||
if (isset($_GET['order'])) { |
||||
$sale = $plugin->getSale($_GET['order']); |
||||
|
||||
if (empty($sale)) { |
||||
api_not_allowed(true); |
||||
} |
||||
|
||||
$urlToRedirect = api_get_self() . '?'; |
||||
|
||||
switch ($_GET['action']) { |
||||
case 'confirm': |
||||
$plugin->completeSale($sale['id']); |
||||
|
||||
Display::addFlash( |
||||
Display::return_message( |
||||
sprintf($plugin->get_lang('SubscriptionToCourseXSuccessful'), $sale['product_name']), |
||||
'success' |
||||
) |
||||
); |
||||
|
||||
$urlToRedirect .= http_build_query([ |
||||
'status' => BuyCoursesPlugin::SALE_STATUS_COMPLETED, |
||||
'sale' => $sale['id'] |
||||
]); |
||||
break; |
||||
case 'cancel': |
||||
$plugin->cancelSale($sale['id']); |
||||
|
||||
Display::addFlash( |
||||
Display::return_message( |
||||
$plugin->get_lang('OrderCanceled'), |
||||
'warning' |
||||
) |
||||
); |
||||
|
||||
$urlToRedirect .= http_build_query([ |
||||
'status' => BuyCoursesPlugin::SALE_STATUS_CANCELED, |
||||
'sale' => $sale['id'] |
||||
]); |
||||
break; |
||||
} |
||||
|
||||
header("Location: $urlToRedirect"); |
||||
exit; |
||||
} |
||||
|
||||
$productTypes = $plugin->getProductTypes(); |
||||
$saleStatuses = $plugin->getSaleStatuses(); |
||||
$selectedStatus = isset($_GET['status']) ? $_GET['status'] : BuyCoursesPlugin::SALE_STATUS_PENDING; |
||||
$selectedSale = isset($_GET['sale']) ? intval($_GET['sale']) : 0; |
||||
|
||||
$form = new FormValidator('search', 'get'); |
||||
|
||||
if ($form->validate()) { |
||||
$selectedStatus = $form->getSubmitValue('status'); |
||||
|
||||
if ($selectedStatus === false) { |
||||
$selectedStatus = BuyCoursesPlugin::SALE_STATUS_PENDING; |
||||
} |
||||
} |
||||
|
||||
$form->addSelect('status', $plugin->get_lang('OrderStatus'), $saleStatuses); |
||||
$form->addButtonFilter($plugin->get_lang('SearchByStatus')); |
||||
$form->setDefaults(['status' => $selectedStatus]); |
||||
|
||||
$sales = $plugin->getSaleListByStatus($selectedStatus); |
||||
$saleList = []; |
||||
|
||||
foreach ($sales as $sale) { |
||||
$saleList[] = [ |
||||
'id' => $sale['id'], |
||||
'reference' => $sale['reference'], |
||||
'status' => $sale['status'], |
||||
'date' => api_format_date($sale['date'], DATE_FORMAT_LONG_NO_DAY), |
||||
'currency' => $sale['iso_code'], |
||||
'price' => $sale['price'], |
||||
'product_name' => $sale['product_name'], |
||||
'product_type' => $productTypes[$sale['product_type']], |
||||
'complete_user_name' => api_get_person_name($sale['firstname'], $sale['lastname']) |
||||
]; |
||||
} |
||||
|
||||
//View |
||||
$interbreadcrumb[] = ['url' => '../index.php', 'name' => $plugin->get_lang('plugin_title')]; |
||||
|
||||
$templateName = $plugin->get_lang('SalesReport'); |
||||
|
||||
$template = new Template($templateName); |
||||
$template->assign('form', $form->returnForm()); |
||||
$template->assign('selected_sale', $selectedSale); |
||||
$template->assign('selected_status', $selectedStatus); |
||||
$template->assign('sale_list', $saleList); |
||||
$template->assign('sale_status_canceled', BuyCoursesPlugin::SALE_STATUS_CANCELED); |
||||
$template->assign('sale_status_pending', BuyCoursesPlugin::SALE_STATUS_PENDING); |
||||
$template->assign('sale_status_completed', BuyCoursesPlugin::SALE_STATUS_COMPLETED); |
||||
|
||||
$content = $template->fetch('buycourses/view/sales_report.tpl'); |
||||
|
||||
$template->assign('header', $templateName); |
||||
$template->assign('content', $content); |
||||
$template->display_one_col_template(); |
||||
@ -0,0 +1,76 @@ |
||||
<?php |
||||
/** |
||||
* List of courses |
||||
* @package chamilo.plugin.buycourses |
||||
*/ |
||||
/** |
||||
* Initialization |
||||
*/ |
||||
$cidReset = true; |
||||
|
||||
require_once '../../../main/inc/global.inc.php'; |
||||
|
||||
$plugin = BuyCoursesPlugin::create(); |
||||
$includeSessions = $plugin->get('include_sessions') === 'true'; |
||||
|
||||
if (!$includeSessions) { |
||||
api_not_allowed(true); |
||||
} |
||||
|
||||
$nameFilter = null; |
||||
$minFilter = 0; |
||||
$maxFilter = 0; |
||||
|
||||
$form = new FormValidator('search_filter_form', 'get', null, null, [], FormValidator::LAYOUT_INLINE); |
||||
|
||||
if ($form->validate()) { |
||||
$formValues = $form->getSubmitValues(); |
||||
$nameFilter = isset($formValues['name']) ? $formValues['name'] : null; |
||||
$minFilter = isset($formValues['min']) ? $formValues['min'] : 0; |
||||
$maxFilter = isset($formValues['max']) ? $formValues['max'] : 0; |
||||
} |
||||
|
||||
$form->addHeader($plugin->get_lang('SearchFilter')); |
||||
$form->addText('name', get_lang('SessionName'), false); |
||||
$form->addElement( |
||||
'number', |
||||
'min', |
||||
$plugin->get_lang('MinimumPrice'), |
||||
['step' => '0.01', 'min' => '0'] |
||||
); |
||||
$form->addElement( |
||||
'number', |
||||
'max', |
||||
$plugin->get_lang('MaximumPrice'), |
||||
['step' => '0.01', 'min' => '0'] |
||||
); |
||||
$form->addHtml('<hr>'); |
||||
$form->addButtonFilter(get_lang('Search')); |
||||
|
||||
$sessionList = $plugin->getCatalogSessionList($nameFilter, $minFilter, $maxFilter); |
||||
|
||||
//View |
||||
if (api_is_platform_admin()) { |
||||
$interbreadcrumb[] = [ |
||||
'url' => 'configuration.php', |
||||
'name' => $plugin->get_lang('AvailableCoursesConfiguration') |
||||
]; |
||||
$interbreadcrumb[] = [ |
||||
'url' => 'paymentsetup.php', |
||||
'name' => $plugin->get_lang('PaymentsConfiguration') |
||||
]; |
||||
} |
||||
|
||||
$templateName = $plugin->get_lang('CourseListOnSale'); |
||||
|
||||
$template = new Template($templateName); |
||||
$template->assign('search_filter_form', $form->returnForm()); |
||||
$template->assign('sessions_are_included', $includeSessions); |
||||
$template->assign('showing_sessions', true); |
||||
$template->assign('sessions', $sessionList); |
||||
|
||||
$content = $template->fetch('buycourses/view/catalog.tpl'); |
||||
|
||||
$template->assign('header', $templateName); |
||||
$template->assign('content', $content); |
||||
$template->display_one_col_template(); |
||||
@ -0,0 +1,112 @@ |
||||
<link rel="stylesheet" type="text/css" href="../resources/css/style.css"/> |
||||
|
||||
<div id="buy-courses-tabs"> |
||||
{% if sessions_are_included %} |
||||
<ul class="nav nav-tabs buy-courses-tabs" role="tablist"> |
||||
<li id="buy-courses-tab" class="{{ showing_courses ? 'active' : '' }}" role="presentation"> |
||||
<a href="course_catalog.php" aria-controls="buy-courses" role="tab">{{ 'Courses'|get_lang }}</a> |
||||
</li> |
||||
<li id="buy-sessions-tab" class="{{ showing_sessions ? 'active' : '' }}" role="presentation"> |
||||
<a href="session_catalog.php" aria-controls="buy-sessions" role="tab">{{ 'Sessions'|get_lang }}</a> |
||||
</li> |
||||
</ul> |
||||
{% endif %} |
||||
|
||||
<div class="tab-content"> |
||||
<div class="tab-pane active" aria-labelledby="buy-sessions-tab" role="tabpanel"> |
||||
<div class="row"> |
||||
<div class="col-md-3"> |
||||
{{ search_filter_form }} |
||||
</div> |
||||
<div class="col-md-9"> |
||||
<div class="row"> |
||||
{% if showing_courses %} |
||||
{% for course in courses %} |
||||
<div class="col-md-4 col-sm-6"> |
||||
<div class="thumbnail"> |
||||
<img alt="{{ course.title }}" class="img-responsive" src="{{ course.course_img ? course.course_img : 'session_default.png'|icon() }}"> |
||||
<div class="caption"> |
||||
{% set course_description_url = _p.web_ajax ~ 'course_home.ajax.php?' ~ {'code': course.code, 'a': 'show_course_information'}|url_encode() %} |
||||
<h3> |
||||
<a class="ajax" href="{{ course_description_url }}" data-title="{{ course.title }}">{{ course.title }}</a> |
||||
</h3> |
||||
<ul class="list-unstyled"> |
||||
{% for teacher in course.teachers %} |
||||
<li><i class="fa fa-user"></i> {{ teacher }}</li> |
||||
{% endfor %} |
||||
</ul> |
||||
<p class="lead text-right">{{ course.currency }} {{ course.price }}</p> |
||||
{% if course.enrolled == "YES" %} |
||||
<div class="alert alert-success"> |
||||
<i class="fa fa-check-square-o fa-fw"></i> {{ 'TheUserIsAlreadyRegisteredInTheCourse'|get_plugin_lang('BuyCoursesPlugin') }} |
||||
</div> |
||||
{% elseif course.enrolled == "NO" %} |
||||
<div class="text-center"> |
||||
<a class="ajax btn btn-primary" title="" href="{{ course_description_url }}" data-title="{{ course.title }}"> |
||||
<i class="fa fa-file-text"></i> {{ 'SeeDescription'|get_plugin_lang('BuyCoursesPlugin') }} |
||||
</a> |
||||
<a class="btn btn-success" title="" href="{{ _p.web_plugin ~ 'buycourses/src/process.php?' ~ {'i': course.id, 't': 1}|url_encode() }}"> |
||||
<i class="fa fa-shopping-cart"></i> {{ 'Buy'|get_plugin_lang('BuyCoursesPlugin') }} |
||||
</a> |
||||
</div> |
||||
{% elseif course.enrolled == "TMP" %} |
||||
<div class="alert alert-info">{{ 'WaitingToReceiveThePayment'|get_plugin_lang('BuyCoursesPlugin') }}</div> |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endfor %} |
||||
{% endif %} |
||||
|
||||
{% if showing_sessions %} |
||||
{% for session in sessions %} |
||||
<div class="col-md-4 col-sm-6"> |
||||
<div class="thumbnail"> |
||||
<img alt="{{ session.name }}" class="img-responsive" src="{{ session.image ? session.image : 'session_default.png'|icon() }}"> |
||||
<div class="caption"> |
||||
<h3> |
||||
<a href="{{ _p.web ~ 'session/' ~ session.id ~ '/about/' }}">{{ session.name }}</a> |
||||
</h3> |
||||
{% if 'show_session_coach'|get_setting == 'true' %} |
||||
<p><i class="fa fa-user fa-fw"></i> {{ session.coach }}</p> |
||||
{% endif %} |
||||
<p><i class="fa fa-calendar fa-fw"></i> {{ session.dates.display }}</p> |
||||
<p class="lead text-right">{{ session.currency }} {{ session.price }}</p> |
||||
<ul class="list-unstyled"> |
||||
{% for course in session.courses %} |
||||
<li> |
||||
<i class="fa fa-book fa-fw"></i> {{ course.title }} |
||||
{% if course.coaches|length %} |
||||
<ul> |
||||
{% for coach in course.coaches %} |
||||
<li>{{ coach }}</li> |
||||
{% endfor %} |
||||
</ul> |
||||
{% endif %} |
||||
</li> |
||||
{% endfor %} |
||||
</ul> |
||||
{% if session.enrolled == "YES" %} |
||||
<div class="alert alert-success"> |
||||
<i class="fa fa-check-square-o fa-fw"></i> {{ 'TheUserIsAlreadyRegisteredInTheSession'|get_plugin_lang('BuyCoursesPlugin') }} |
||||
</div> |
||||
{% elseif session.enrolled == "NO" %} |
||||
<div class="text-center"> |
||||
<a class="btn btn-success" href="{{ _p.web_plugin ~ 'buycourses/src/process.php?' ~ {'i': session.id, 't': 2}|url_encode() }}"> |
||||
<i class="fa fa-shopping-cart"></i> {{ 'Buy'|get_plugin_lang('BuyCoursesPlugin') }} |
||||
</a> |
||||
</div> |
||||
{% elseif session.enrolled == "TMP" %} |
||||
<div class="alert alert-info">{{ 'WaitingToReceiveThePayment'|get_plugin_lang('BuyCoursesPlugin') }}</div> |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endfor %} |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
@ -1,190 +0,0 @@ |
||||
<script type='text/javascript' src="../js/buycourses.js"></script> |
||||
|
||||
<link rel="stylesheet" type="text/css" href="../resources/css/style.css"/> |
||||
|
||||
<script> |
||||
$(function() { |
||||
/* Binds a tab id in the url */ |
||||
$("#tabs").bind('tabsselect', function(event, ui) { |
||||
window.location.href=ui.tab; |
||||
}); |
||||
// Generate tabs with jquery-ui |
||||
$('#tabs').tabs(); |
||||
$( "#sub_tab" ).tabs(); |
||||
}); |
||||
</script> |
||||
|
||||
{% if sessionsAreIncluded == "YES" %} |
||||
<div class="ui-tabs ui-widget ui-widget-content ui-corner-all" id="tabs"> <ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"> <li class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active"> <a href="#tabs-1">{{ 'Courses'|get_lang }}</a></li><li class="ui-state-default ui-corner-top"> <a href="#tabs-2">{{ 'Sessions'|get_lang }}</a></li></ul> |
||||
{% endif %} |
||||
|
||||
<div id="tabs-1"> |
||||
<div class="row"> |
||||
<div class="span3"> |
||||
<div class="category_well well"> |
||||
<div class="form-content"> |
||||
<h4>{{ 'SearchFilter'|get_plugin_lang('BuyCoursesPlugin') }}:</h4> |
||||
<label class="control-label">{{ 'CourseName'|get_lang }}:</label> |
||||
<input type="text" class="name" /> |
||||
<label class="control-label">{{ 'MinimumPrice'|get_plugin_lang('BuyCoursesPlugin') }}:</label> |
||||
<input type="text" class="pricemin span1"/> |
||||
<label class="control-label">{{ 'MaximumPrice'|get_plugin_lang('BuyCoursesPlugin') }}:</label> |
||||
<input type="text" class="pricemax span1"/> |
||||
{% for category in categories %} |
||||
<label class="control-label">{{ 'Categories'|get_lang }}:</label> |
||||
<select id="courses_category"> |
||||
<option value="" selected="selected"></option> |
||||
<option value="{{ category.code }}">{{ category.name }}</option> |
||||
</select> |
||||
{% endfor %} |
||||
<br> |
||||
<input type="button" class="filter btn btn-primary" value="{{ 'Search'|get_lang }}" id="courses_filter" /> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="span8" id="course_results"> |
||||
{% if rmessage == "YES" %} |
||||
<div class="{{ class }}"> |
||||
{{ responseMessage }} |
||||
</div> |
||||
{% endif %} |
||||
{% for course in courses %} |
||||
<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?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>{{ 'Teacher'|get_lang }}: {{ course.teacher }}</h5> |
||||
</div> |
||||
{% if course.enrolled == "YES" %} |
||||
<span class="label label-info">{{ 'TheUserIsAlreadyRegisteredInTheCourse'|get_plugin_lang('BuyCoursesPlugin') }}</span> |
||||
{% endif %} |
||||
{% if course.enrolled == "TMP" %} |
||||
<span class="label label-warning">{{ 'WaitingToReceiveThePayment'|get_plugin_lang('BuyCoursesPlugin') }}</span> |
||||
{% endif %} |
||||
</div> |
||||
<div class="span3 right"> |
||||
<div class="sprice right"> |
||||
{{ course.price }} {{ currency }} |
||||
</div> |
||||
<div class="cleared"></div> |
||||
<div class="btn-group right"> |
||||
<a class="ajax btn btn-primary" title="" href="{{ server }}plugin/buycourses/src/ajax.php?code={{ course.code }}"> |
||||
{{ 'Description'|get_lang }} |
||||
</a> |
||||
{% if course.enrolled == "NO" %} |
||||
<a class="btn btn-success" title="" href="{{ server }}plugin/buycourses/src/process.php?code={{ course.id }}"> |
||||
{{ 'Buy'|get_plugin_lang('BuyCoursesPlugin') }} |
||||
</a> |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endfor %} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% if sessionsAreIncluded == "YES" %} |
||||
<div id="tabs-2" class="row"> |
||||
<div class="span3"> |
||||
<div class="category_well well"> |
||||
<div class="form-content"> |
||||
<h4>{{ 'SearchFilter'|get_plugin_lang('BuyCoursesPlugin') }}:</h4> |
||||
<label class="control-label">{{ 'SessionName'|get_lang }}:</label> |
||||
<input type="text" class="name" /> |
||||
<label class="control-label">{{ 'MinimumPrice'|get_plugin_lang('BuyCoursesPlugin') }}:</label> |
||||
<input type="text" class="pricemin span1"/> |
||||
<label class="control-label">{{ 'MaximumPrice'|get_plugin_lang('BuyCoursesPlugin') }}:</label> |
||||
<input type="text" class="pricemax span1"/> |
||||
{% for category in categories %} |
||||
<label class="control-label">{{ 'Categories'|get_lang }}:</label> |
||||
<select id="sessions_category"> |
||||
<option value="" selected="selected"></option> |
||||
<option value="{{ category.code }}">{{ category.name }}</option> |
||||
</select> |
||||
{% endfor %} |
||||
<br> |
||||
<input type="button" class="filter btn btn-primary" value="{{ 'Search'|get_lang }}" id="sessions_filter" /> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="span8" id="session_results"> |
||||
{% if rmessage == "YES" %} |
||||
<div class="{{ class }}"> |
||||
{{ responseMessage }} |
||||
</div> |
||||
{% endif %} |
||||
{% for session in sessions %} |
||||
<div class="span8 well-course"> |
||||
<div class="row"> |
||||
<div class="span4 "> |
||||
<div class="categories-course-description"> |
||||
<h3>{{ session.name }}</h3> |
||||
<h5>{{ 'From'|get_lang }} {{ session.access_start_date }} {{ 'Until'|get_lang }} {{ session.access_end_date }}</h5> |
||||
{% if session.enrolled == "YES" %} |
||||
<span class="label label-info">{{ 'TheUserIsAlreadyRegisteredInTheSession'|get_plugin_lang('BuyCoursesPlugin') }}</span> |
||||
{% endif %} |
||||
{% if session.enrolled == "TMP" %} |
||||
<span class="label label-warning">{{ 'WaitingToReceiveThePayment'|get_plugin_lang('BuyCoursesPlugin') }}</span> |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
<div class="span right"> |
||||
<div class="sprice right"> |
||||
{{ session.price }} {{ currency }} |
||||
</div> |
||||
<div class="cleared"></div> |
||||
<div class="btn-group right"> |
||||
{% if session.enrolled == "NO" %} |
||||
<a class="btn btn-success" title="" href="{{ server }}plugin/buycourses/src/process.php?scode={{ session.session_id }}"> |
||||
{{ 'Buy'|get_plugin_lang('BuyCoursesPlugin') }} |
||||
</a> |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% for course in session.courses %} |
||||
<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?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>{{ 'Teacher'|get_lang }}: {{ course.teacher }}</h5> |
||||
</div> |
||||
{% if course.enrolled == "YES" %} |
||||
<span class="label label-info">{{ 'TheUserIsAlreadyRegisteredInTheCourse'|get_plugin_lang('BuyCoursesPlugin') }}</span> |
||||
{% endif %} |
||||
{% if course.enrolled == "TMP" %} |
||||
<span class="label label-warning">{{ 'WaitingToReceiveThePayment'|get_plugin_lang('BuyCoursesPlugin') }}</span> |
||||
{% endif %} |
||||
</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?code={{ course.code }}"> |
||||
{{ 'Description'|get_lang }} |
||||
</a> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endfor %} |
||||
</div> |
||||
{% endfor %} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
@ -0,0 +1,36 @@ |
||||
<div> |
||||
<p>{{ 'DearUser'|get_lang }}</p> |
||||
<p>{{ 'PurchaseDetailsIntro'|get_plugin_lang('BuyCoursesPlugin') }}</p> |
||||
<dl> |
||||
<dt>{{ 'OrderDate'|get_plugin_lang('BuyCoursesPlugin') }}</dt> |
||||
<dd>{{ sale.date }}</dd> |
||||
<dt>{{ 'OrderReference'|get_plugin_lang('BuyCoursesPlugin') }}</dt> |
||||
<dd>sale.reference</dd> |
||||
<dt>{{ 'UserName'|get_lang }}</dt> |
||||
<dd>{{ user.complete_name }}</dd> |
||||
<dt>{{ 'Course'|get_lang }}</dt> |
||||
<dd>{{ sale.product }}</dd> |
||||
<dt>{{ 'ProductName'|get_plugin_lang('BuyCoursesPlugin') }}</dt> |
||||
<dd>{{ sale.currency ~ ' ' ~ sale.price }}</dd> |
||||
</dl> |
||||
<p>{{ 'BankAccountIntro'|get_plugin_lang('BuyCoursesPlugin')|format(sale.product) }}</p> |
||||
<table> |
||||
<thead> |
||||
<tr> |
||||
<th>{{ 'Name'|get_lang }}</th> |
||||
<th>{{ 'BankAccount'|get_plugin_lang('BuyCoursesPlugin') }}</th> |
||||
<th>{{ 'SWIFT'|get_lang }}</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
{% for account in transfer_accounts %} |
||||
<tr> |
||||
<td>{{ account.name }}</td> |
||||
<td>{{ account.account }}</td> |
||||
<td>{{ account.swift }}</td> |
||||
</tr> |
||||
{% endfor %} |
||||
</tbody> |
||||
</table> |
||||
<p>{{ 'PurchaseDetailsEnd'|get_plugin_lang('BuyCoursesPlugin') }}</p> |
||||
</div> |
||||
@ -1,110 +1,76 @@ |
||||
<script type='text/javascript' src="../js/buycourses.js"></script> |
||||
|
||||
<link rel="stylesheet" type="text/css" href="../resources/css/style.css"/> |
||||
<div class="row"> |
||||
<div class="span12"> |
||||
<p class="normal-message">{{ 'PluginInstruction'|get_plugin_lang('BuyCoursesPlugin') }}<a href="{{ server }}main/admin/configure_plugin.php?name=buycourses">{{ 'ClickHere'|get_plugin_lang('BuyCoursesPlugin') }}</a></p> |
||||
</div> |
||||
</div> |
||||
<div class="row"> |
||||
<div class="span6"> |
||||
<div class="info"> |
||||
|
||||
{{ curency_form }} |
||||
|
||||
<h3>{{ 'CurrencyType'|get_plugin_lang('BuyCoursesPlugin') }}</h3> |
||||
<p>{{ 'InfoCurrency'|get_plugin_lang('BuyCoursesPlugin') }}</p> |
||||
<p class="alert alert-info"> |
||||
{{ 'PluginInstruction'|get_plugin_lang('BuyCoursesPlugin') }} |
||||
<a href="{{ _p.web_main }}admin/configure_plugin.php?name=buycourses">{{ 'ClickHere'|get_plugin_lang('BuyCoursesPlugin') }}</a> |
||||
</p> |
||||
|
||||
{% if paypal_enable == "true" %} |
||||
<div class="panel panel-default"> |
||||
<div class="panel-heading"> |
||||
<h3 class="panel-title">{{ 'PayPalConfig'|get_plugin_lang('BuyCoursesPlugin') }}</h3> |
||||
</div> |
||||
<div class="input-content"> |
||||
<select id="currency_type"> |
||||
<option value="" selected="selected">{{ 'SelectACurrency'|get_plugin_lang('BuyCoursesPlugin') }}</option> |
||||
{% for currency in currencies %} |
||||
{% if currency.status == 1 %} |
||||
<option value="{{ currency.country_id }}" selected="selected">{{ currency.country_name }} => {{ currency.currency_code }} |
||||
</option> |
||||
{% else %} |
||||
<option value="{{ currency.country_id }}">{{ currency.country_name }} => {{ currency.currency_code }}</option> |
||||
{% endif %} |
||||
{% endfor %} |
||||
</select> |
||||
<input type="button" id="save_currency" class="btn btn-primary" value="{{ 'Save'|get_lang }}" /> |
||||
<div class="panel-body"> |
||||
<div class="row"> |
||||
<div class="col-md-5"> |
||||
<p>{{ 'InfoApiCredentials'|get_plugin_lang('BuyCoursesPlugin') }}</p> |
||||
<ul> |
||||
<li>{{ 'InfoApiStepOne'|get_plugin_lang('BuyCoursesPlugin') }}</li> |
||||
<li>{{ 'InfoApiStepTwo'|get_plugin_lang('BuyCoursesPlugin') }}</li> |
||||
<li>{{ 'InfoApiStepThree'|get_plugin_lang('BuyCoursesPlugin') }}</li> |
||||
</ul> |
||||
</div> |
||||
<div class="col-md-7"> |
||||
{{ paypal_form }} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% if paypal_enable == "true" %} |
||||
<div class="span6"> |
||||
<div class="info"> |
||||
<h3>{{ 'PayPalConfig'|get_plugin_lang('BuyCoursesPlugin') }}</h3> |
||||
</div> |
||||
<div class="input-content"> |
||||
|
||||
<p>{{ 'InfoApiCredentials'|get_plugin_lang('BuyCoursesPlugin') }}</p> |
||||
<ul> |
||||
<li>{{ 'InfoApiStepOne'|get_plugin_lang('BuyCoursesPlugin') }}</li> |
||||
<li>{{ 'InfoApiStepTwo'|get_plugin_lang('BuyCoursesPlugin') }}</li> |
||||
<li>{{ 'InfoApiStepThree'|get_plugin_lang('BuyCoursesPlugin') }}</li> |
||||
</ul> |
||||
<label class="control-label">API_UserName: </label><input type="text" id="username" value="{{ paypal.username | e}}" /> |
||||
<label class="control-label">API_Password: </label><input type="text" id="password" value="{{ paypal.password | e }}"/> |
||||
<label class="control-label">API_Signature: </label> <input type="text" id="signature" value="{{ paypal.signature | e }}"/> |
||||
|
||||
{% if paypal.sandbox == "YES" %} |
||||
<label class="checkbox"> |
||||
<input type="checkbox" id="sandbox" value="YES" checked="checked"> {{ 'Sandbox'|get_plugin_lang('BuyCoursesPlugin') }} |
||||
</label> |
||||
{% else %} |
||||
<label class="checkbox"> |
||||
<input type="checkbox" id="sandbox" value="YES" />{{ 'Sandbox'|get_plugin_lang('BuyCoursesPlugin') }} |
||||
</label> |
||||
|
||||
{% endif %} |
||||
{% endif %} |
||||
|
||||
<input type="button" id="save_paypal" class="btn btn-primary" value="{{ 'Save'|get_lang }}"/> |
||||
</div> |
||||
{% if transfer_enable == "true" %} |
||||
<div class="panel panel-default"> |
||||
<div class="panel-heading"> |
||||
<h3 class="panel-title">{{ 'TransfersConfig'|get_plugin_lang('BuyCoursesPlugin') }}</h3> |
||||
</div> |
||||
<div class="panel-body"> |
||||
<div class="row"> |
||||
<div class="col-md-5"> |
||||
{{ transfer_form }} |
||||
</div> |
||||
<div class="col-md-7"> |
||||
<div class="table-responsive"> |
||||
<table class="table table-striped table-hover"> |
||||
<thead> |
||||
<tr> |
||||
<th>{{ 'Name'|get_lang }}</th> |
||||
<th>{{ 'BankAccount'|get_plugin_lang('BuyCoursesPlugin') }}</th> |
||||
<th>{{ 'SWIFT'|get_lang }}</th> |
||||
<th>{{ 'Actions'|get_lang }}</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
{% for account in transfer_accounts %} |
||||
<tr> |
||||
<td>{{ account.name }}</td> |
||||
<td>{{ account.account }}</td> |
||||
<td>{{ account.swift }}</td> |
||||
<td> |
||||
<a href="{{ _p.web_self ~ '?' ~ {'action':'delete_taccount', 'id': account.id}|url_encode() }}" class="btn btn-danger btn-sm"> |
||||
<i class="fa fa-remove"></i> {{ 'Delete'|get_lang }} |
||||
</a> |
||||
</td> |
||||
</tr> |
||||
{% endfor %} |
||||
</tbody> |
||||
</table> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
|
||||
<div class="row"> |
||||
<div class="span12"> |
||||
|
||||
{% if transfer_enable == "true" %} |
||||
<hr /> |
||||
<h3>{{ 'TransfersConfig'|get_plugin_lang('BuyCoursesPlugin') }}</h3> |
||||
<table id="transfer_table" class="data_table"> |
||||
<tr class="row_odd"> |
||||
<th class="bg-color">{{ 'Name'|get_lang }}</th> |
||||
<th class="bg-color">{{ 'BankAccount'|get_plugin_lang('BuyCoursesPlugin') }}</th> |
||||
<th class="bg-color">{{ 'SWIFT'|get_lang }}</th> |
||||
<th class="span1 ta-center bg-color">{{ 'Option'|get_lang }}</th> |
||||
</tr> |
||||
{% set i = 0 %} |
||||
|
||||
{% for transf in transfer %} |
||||
{{ i%2==0 ? ' |
||||
<tr class="row_even">' : ' |
||||
<tr class="row_odd">' }} |
||||
{% set i = i + 1 %} |
||||
<td>{{ transf.name | e }}</td> |
||||
<td>{{ transf.account | e }}</td> |
||||
<td>{{ transf.swift | e }}</td> |
||||
<td class="ta-center" id="account{{ transf.id }}"> |
||||
<img src="{{ delete_img }}" class="cursor delete_account" alt="ok"/> |
||||
<input type="hidden" id="id_account{{ transf.id }}" name="id_account{{ transf.id }}" value="{{ transf.id }}" /> |
||||
</td> |
||||
</tr> |
||||
{% endfor %} |
||||
{{ i%2==0 ? ' |
||||
<tr class="row_even">' : ' |
||||
<tr class="row_odd">' }} |
||||
<td><input class="span4" type="text" id="tname"/></td> |
||||
<td><input type="text" id="taccount"/></td> |
||||
<td><input class="span2" type="text" id="tswift"</td> |
||||
<td class="ta-center"> |
||||
<img class="cursor" id="add_account" src="{{ more_img }}" alt="add account"/> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
{% endif %} |
||||
</div> |
||||
<div class="cleared"></div> |
||||
</div> |
||||
{% endif %} |
||||
|
||||
@ -1,39 +0,0 @@ |
||||
<script type='text/javascript' src="../js/buycourses.js"></script> |
||||
|
||||
<link rel="stylesheet" type="text/css" href="../resources/plugin.css"/> |
||||
|
||||
<div class="row"> |
||||
<div class="span12"> |
||||
<table id="orders_table" class="data_table"> |
||||
<tr class="row_odd"> |
||||
<th class="ta-center">{{ 'ReferenceOrder'|get_plugin_lang('BuyCoursesPlugin') }}</th> |
||||
<th>{{ 'Name'|get_lang }}</th> |
||||
<th>{{ 'Title'|get_lang }}</th> |
||||
<th class="span2">{{ 'Price'|get_lang }}</th> |
||||
<th class="ta-center">{{ 'Date'|get_lang }}</th> |
||||
<th class="span2 ta-center">{{ 'Options'|get_lang }}</th> |
||||
</tr> |
||||
{% set i = 0 %} |
||||
|
||||
{% for order in pending %} |
||||
{{ i%2==0 ? '<tr class="row_even">' : '<tr class="row_odd">' }} |
||||
{% set i = i + 1 %} |
||||
<td class="ta-center">{{ order.reference }}</td> |
||||
<td>{{ order.name }}</td> |
||||
<td>{{ order.title }}</td> |
||||
<td>{{ order.price }} {{ currency }}</td> |
||||
<td class="ta-center">{{ order.date }}</td> |
||||
<td class="ta-center" id="order{{ order.cod }}"> |
||||
<img src="{{ confirmation_img }}" alt="ok" class="cursor confirm_order" |
||||
title="{{ 'SubscribeUser'|get_plugin_lang('BuyCoursesPlugin') }}"/> |
||||
|
||||
<img src="{{ delete_img }}" alt="delete" class="cursor clear_order" |
||||
title="{{ 'DeleteTheOrder'|get_plugin_lang('BuyCoursesPlugin') }}"/> |
||||
</td> |
||||
</tr> |
||||
{% endfor %} |
||||
|
||||
</table> |
||||
</div> |
||||
<div class="cleared"></div> |
||||
</div> |
||||
@ -1,122 +1,52 @@ |
||||
<script type='text/javascript' src="../js/buycourses.js"></script> |
||||
|
||||
<link rel="stylesheet" type="text/css" href="../resources/plugin.css"/> |
||||
|
||||
<div class="row"> |
||||
<div class="span12"> |
||||
<div id="course_category_well" class="well span3"> |
||||
<ul class="nav nav-list"> |
||||
<li class="nav-header"><h4>{{ 'UserInformation'|get_plugin_lang('BuyCoursesPlugin') }}:</h4></li> |
||||
<li class="nav-header">{{ 'Name'|get_lang }}:</li> |
||||
<li><h5>{{ name }}</h5></li> |
||||
<li class="nav-header">{{ 'User'|get_lang }}:</li> |
||||
<li><h5>{{ user }}</h5></li> |
||||
<li class="nav-header">{{ 'Email'|get_lang }}:</li> |
||||
<li><h5>{{ email }}</h5></li> |
||||
<br/> |
||||
</ul> |
||||
</div> |
||||
|
||||
<br/><br/> |
||||
<div class="well_border span8"> |
||||
{% if isSession == "YES" %} |
||||
<div class="row"> |
||||
<div class="span4"> |
||||
<div class="categories-course-description"> |
||||
<h3>{{ title }}</h3> |
||||
<h5>{{ 'From'|get_lang }} {{ session.access_start_date }} {{ 'To'|get_lang }} {{ session.access_end_date }}</h5> |
||||
</div> |
||||
</div> |
||||
<div class="span right"> |
||||
<div class="sprice right"> |
||||
{{ session.price }} {{ currency }} |
||||
</div> |
||||
<div class="cleared"></div> |
||||
<div class="col-md-7"> |
||||
<h3 class="page-header">{{ 'PurchaseData'|get_plugin_lang('BuyCoursesPlugin') }}</h3> |
||||
<div class="row"> |
||||
{% if buying_course %} |
||||
<div class="col-sm-6 col-md-5"> |
||||
<p> |
||||
<img alt="{{ course.title }}" class="img-responsive" src="{{ course.course_img ? course.course_img : 'session_default.png'|icon() }}"> |
||||
</p> |
||||
<p class="lead text-right">{{ course.currency }} {{ course.price }}</p> |
||||
</div> |
||||
</div> |
||||
{% for course in session.courses %} |
||||
<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?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>{{ 'Teacher'|get_lang }}: {{ course.teacher }}</h5> |
||||
</div> |
||||
{% if course.enrolled == "YES" %} |
||||
<span class="label label-info">{{ 'TheUserIsAlreadyRegisteredInTheCourse'|get_plugin_lang('BuyCoursesPlugin') }}</span> |
||||
{% endif %} |
||||
{% if course.enrolled == "TMP" %} |
||||
<span class="label label-warning">{{ 'WaitingToReceiveThePayment'|get_plugin_lang('BuyCoursesPlugin') }}</span> |
||||
{% endif %} |
||||
</div> |
||||
<div class="span right"> |
||||
<div class="cleared"></div> |
||||
<div class="btn-toolbar right"> |
||||
<a class="ajax btn btn-primary" title="" href="{{ server }}plugin/buycourses/src/ajax.php?code={{ course.code }}"> |
||||
{{ 'Description'|get_lang }} |
||||
</a> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endfor %} |
||||
{% else %} |
||||
<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?code={{ course.code }}"> |
||||
<img alt="" src="{{ server }}{{ course.course_img }}"> |
||||
<div class="col-sm-6 col-md-7"> |
||||
<h3 class="page-header">{{ course.title }}</h3> |
||||
<ul class="items-teacher list-unstyled"> |
||||
{% for teacher in course.teachers %} |
||||
<li><i class="fa fa-user"></i> {{ teacher }}</li> |
||||
{% endfor %} |
||||
</ul> |
||||
<p> |
||||
<a class="ajax btn btn-primary btn-sm" data-title="{{ course.title }}" href="{{ _p.web_ajax ~ 'course_home.ajax.php?' ~ {'a': 'show_course_information', 'code': course.code}|url_encode() }}"> |
||||
{{'Description'|get_lang }} |
||||
</a> |
||||
</div> |
||||
</p> |
||||
</div> |
||||
<div class="span4"> |
||||
<div class="categories-course-description"> |
||||
<h3>{{ course.title }}</h3> |
||||
<h5>{{ 'Teacher'|get_lang }}: {{ course.teacher }}</h5> |
||||
</div> |
||||
{% elseif buying_session %} |
||||
<div class="col-sm-6 col-md-5"> |
||||
<p> |
||||
<img alt="{{ session.name }}" class="img-responsive" src="{{ session.image ? session.image : 'session_default.png'|icon() }}"> |
||||
</p> |
||||
<p class="lead text-right">{{ session.currency }} {{ session.price }}</p> |
||||
</div> |
||||
<div class="span right"> |
||||
<div class="sprice right">{{ course.price }} {{ currency }}</div> |
||||
<div class="cleared"></div> |
||||
<div class="btn-toolbar right"> |
||||
<a class="ajax btn btn-primary" title="" |
||||
href="{{ server }}plugin/buycourses/src/ajax.php?code={{ course.code }}">{{'Description'|get_lang }} |
||||
</a> |
||||
</div> |
||||
<div class="col-sm-6 col-md-7"> |
||||
<h3 class="page-header">{{ session.name }}</h3> |
||||
<p>{{ session.dates.display }}</p> |
||||
<dl> |
||||
{% for course in session.courses %} |
||||
<dt>{{ course.title }}</dt> |
||||
{% for coach in course.coaches %} |
||||
<dd><i class="fa fa-user fa-fw"></i> {{ coach }}</dd> |
||||
{% endfor %} |
||||
{% endfor %} |
||||
</dl> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
<div class="cleared"></div> |
||||
<form class="form-horizontal span3 offset4" action="../src/process_confirm.php" method="post"> |
||||
<fieldset> |
||||
<legend align="center">{{ 'PaymentMethods'|get_plugin_lang('BuyCoursesPlugin') }}</legend> |
||||
<div align="center" class="control-group"> |
||||
<div class="controls margin-left-fifty"> |
||||
{% if paypal_enable == "true" %} |
||||
<label class="radio"> |
||||
<input type="radio" id="payment_type-p" name="payment_type" value="PayPal" > Paypal |
||||
</label> |
||||
{% endif %} |
||||
{% if transfer_enable == "true" %} |
||||
<label class="radio"> |
||||
<input type="radio" id="payment_type-tra" name="payment_type" value="Transfer" > {{ 'BankTransfer'|get_plugin_lang('BuyCoursesPlugin') }} |
||||
</label> |
||||
{% endif %} |
||||
</div> |
||||
</br> |
||||
<input type="hidden" name="currency_type" value="{{ currency }}" /> |
||||
<input type="hidden" name="server" value="{{ server }}"/> |
||||
<input align="center" type="submit" class="btn btn-success" value="{{ 'ConfirmOrder'|get_plugin_lang('BuyCoursesPlugin') }}"/> |
||||
</div> |
||||
</fieldset> |
||||
</form> |
||||
<div class="cleared"></div> |
||||
<div class="col-md-5"> |
||||
{{ form }} |
||||
</div> |
||||
</div> |
||||
|
||||
@ -1,88 +1,87 @@ |
||||
<script type='text/javascript' src="../js/buycourses.js"></script> |
||||
|
||||
<link rel="stylesheet" type="text/css" href="../resources/plugin.css"/> |
||||
|
||||
<div class="row"> |
||||
<div class="span12"> |
||||
<div id="course_category_well" class="well span3"> |
||||
<ul class="nav nav-list"> |
||||
<li class="nav-header"><h4>{{ 'UserInformation'|get_plugin_lang('BuyCoursesPlugin') }}:</h4></li> |
||||
<li class="nav-header">{{ 'Name'|get_lang }}:</li> |
||||
<li><h5>{{ name | e }}</h5></li> |
||||
<li class="nav-header">{{ 'User'|get_lang }}:</li> |
||||
<li><h5>{{ user | e }}</h5></li> |
||||
<li class="nav-header">{{ 'Email'|get_lang }}:</li> |
||||
<li><h5>{{ email | e}}</h5></li> |
||||
<br/> |
||||
</ul> |
||||
</div> |
||||
|
||||
<br/><br/> |
||||
|
||||
<div class="well_border span8"> |
||||
<div class="col-sm-6 col-md-5"> |
||||
<h3 class="page-header">{{ 'UserInformation'|get_plugin_lang('BuyCoursesPlugin') }}</h3> |
||||
<dl class="dl-horizontal"> |
||||
<dt>{{ 'Name'|get_lang }}<dt> |
||||
<dd>{{ user.complete_name }}</dd> |
||||
<dt>{{ 'Username'|get_lang }}<dt> |
||||
<dd>{{ user.username }}</dd> |
||||
<dt>{{ 'EmailAddress'|get_lang }}<dt> |
||||
<dd>{{ user.email }}</dd> |
||||
</dl> |
||||
</div> |
||||
<div class="col-sm-6 col-md-7"> |
||||
{% if buying_course %} |
||||
<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?code={{ course.code }}"> |
||||
<img src="{{ server }}{{ course.course_img }}"> |
||||
<div class="col-sm-6 col-md-5"> |
||||
<p> |
||||
<img alt="{{ course.title }}" class="img-responsive" src="{{ course.course_img ? course.course_img : 'session_default.png'|icon() }}"> |
||||
</p> |
||||
<p class="lead text-right">{{ course.currency }} {{ course.price }}</p> |
||||
</div> |
||||
<div class="col-sm-6 col-md-7"> |
||||
<h3 class="page-header">{{ course.title }}</h3> |
||||
<ul class="items-teacher list-unstyled"> |
||||
{% for teacher in course.teachers %} |
||||
<li><i class="fa fa-user"></i> {{ teacher }}</li> |
||||
{% endfor %} |
||||
</ul> |
||||
<p> |
||||
<a class="ajax btn btn-primary btn-sm" data-title="{{ course.title }}" href="{{ _p.web_ajax ~ 'course_home.ajax.php?' ~ {'a': 'show_course_information', 'code': course.code}|url_encode() }}"> |
||||
{{'Description'|get_lang }} |
||||
</a> |
||||
</div> |
||||
</p> |
||||
</div> |
||||
<div class="span4"> |
||||
<div class="categories-course-description"> |
||||
<h3>{{ course.title }}</h3> |
||||
<h5>{{ 'Teacher'|get_lang }}: {{ course.teacher }}</h5> |
||||
</div> |
||||
</div> |
||||
{% elseif buying_session %} |
||||
<h3 class="page-header">{{ session.name }}</h3> |
||||
<div class="row"> |
||||
<div class="col-sm-12 col-md-5"> |
||||
<p> |
||||
<img alt="{{ session.name }}" class="img-responsive" src="{{ session.image ? session.image : 'session_default.png'|icon() }}"> |
||||
</p> |
||||
<p class="lead text-right">{{ session.currency }} {{ session.price }}</p> |
||||
</div> |
||||
<div class="span right"> |
||||
<div class="sprice right">{{ course.price }} {{ currency }}</div> |
||||
<div class="cleared"></div> |
||||
<div class="btn-toolbar right"> |
||||
<a class="ajax btn btn-primary" title="" |
||||
href="{{ server }}plugin/buycourses/src/ajax.php?code={{ course.code }}">{{'Description'|get_lang }} |
||||
</a> |
||||
</div> |
||||
<div class="col-sm-12 col-md-7"> |
||||
<p>{{ session.dates.display }}</p> |
||||
<dl> |
||||
{% for course in session.courses %} |
||||
<dt>{{ course.title }}</dt> |
||||
{% for coach in course.coaches %} |
||||
<dd><i class="fa fa-user fa-fw"></i> {{ coach }}</dd> |
||||
{% endfor %} |
||||
{% endfor %} |
||||
</dl> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
<div class="cleared"></div> |
||||
<hr/> |
||||
<div align="center"> |
||||
<table class="data_table" style="width:70%"> |
||||
<tr> |
||||
<th class="ta-center">{{ 'BankAccountInformation'|get_plugin_lang('BuyCoursesPlugin') }}</th> |
||||
</tr> |
||||
{% set i = 0 %} |
||||
{% for account in accounts %} |
||||
{{ i%2==0 ? '<tr class="row_even">' : '<tr class="row_odd">' }} |
||||
{% set i = i + 1 %} |
||||
<td class="ta-center"> |
||||
<font color="#0000FF">{{ account.name | e }}</font><br/> |
||||
{% if account.swift != '' %} |
||||
SWIFT: <strong>{{ account.swift | e }}</strong><br/> |
||||
{% endif %} |
||||
{{ 'BankAccount'|get_plugin_lang('BuyCoursesPlugin') }}: <strong>{{ account.account | e }}</strong><br/> |
||||
</td></tr> |
||||
{% endfor %} |
||||
</div> |
||||
<div class="row"> |
||||
<div class="col-xs-12"> |
||||
<h3 class="page-header">{{ 'BankAccountInformation'|get_plugin_lang('BuyCoursesPlugin') }}</h3> |
||||
<div class="table-responsive"> |
||||
<table class="table table-striped table-hover"> |
||||
<thead> |
||||
<tr> |
||||
<th>{{ 'Name'|get_lang }}</th> |
||||
<th class="text-center">{{ 'BankAccount'|get_plugin_lang('BuyCoursesPlugin') }}</th> |
||||
<th class="text-center">{{ 'SWIFT'|get_lang }}</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
{% for account in transfer_accounts %} |
||||
<tr> |
||||
<td>{{ account.name }}</td> |
||||
<td class="text-center">{{ account.account }}</td> |
||||
<td class="text-center">{{ account.swift }}</td> |
||||
</tr> |
||||
{% endfor %} |
||||
</tbody> |
||||
</table> |
||||
<br /> |
||||
<div class="normal-message">{{ 'OnceItIsConfirmed,YouWillReceiveAnEmailWithTheBankInformationAndAnOrderReference'|get_plugin_lang('BuyCoursesPlugin') | e}} |
||||
</div> |
||||
<br/> |
||||
|
||||
<form method="post" name="frmConfirm" action="../src/process_confirm.php"> |
||||
<input type="hidden" name="payment_type" value="Transfer"/> |
||||
<input type="hidden" name="name" value="{{ name | e }}"/> |
||||
<input type="hidden" name="price" value="{{ course.price }}"/> |
||||
<input type="hidden" name="title" value="{{ course.title | e }}"/> |
||||
|
||||
<div class="btn_next"> |
||||
<input class="btn btn-success" type="submit" name="Confirm" value="{{ 'ConfirmOrder'|get_plugin_lang('BuyCoursesPlugin') }}"/> |
||||
<input class="btn btn-danger" type="button" name="Cancel" value="{{ 'CancelOrder'|get_plugin_lang('BuyCoursesPlugin') }}" id="CancelOrder"/> |
||||
</div> |
||||
</form> |
||||
</div> |
||||
<div class="cleared"></div> |
||||
<p>{{ 'OnceItIsConfirmedYouWillReceiveAnEmailWithTheBankInformationAndAnOrderReference'|get_plugin_lang('BuyCoursesPlugin') }}</p> |
||||
</div> |
||||
</div> |
||||
|
||||
{{ form }} |
||||
|
||||
@ -0,0 +1,53 @@ |
||||
{{ form }} |
||||
|
||||
<div class="table-responsive"> |
||||
<table class="table table-striped table-hover"> |
||||
<thead> |
||||
<tr> |
||||
<th class="text-center">{{ 'OrderReference'|get_plugin_lang('BuyCoursesPlugin') }}</th> |
||||
<th class="text-center">{{ 'OrderStatus'|get_plugin_lang('BuyCoursesPlugin') }}</th> |
||||
<th class="text-center">{{ 'OrderDate'|get_plugin_lang('BuyCoursesPlugin') }}</th> |
||||
<th class="text-center">{{ 'Price'|get_plugin_lang('BuyCoursesPlugin') }}</th> |
||||
<th class="text-center">{{ 'ProductType'|get_plugin_lang('BuyCoursesPlugin') }}</th> |
||||
<th>{{ 'Name'|get_lang }}</th> |
||||
<th>{{ 'UserName'|get_lang }}</th> |
||||
{% if selected_status == sale_status_pending %} |
||||
<th class="text-center">{{ 'Options'|get_lang }}</th> |
||||
{% endif %} |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
{% for sale in sale_list %} |
||||
<tr {{ sale.id == selected_sale ? 'class="warning"' : '' }}> |
||||
<td class="text-center">{{ sale.reference }}</td> |
||||
<td class="text-center"> |
||||
{% if sale.status == sale_status_canceled %} |
||||
{{ 'SaleStatusCanceled'|get_plugin_lang('BuyCoursesPlugin') }} |
||||
{% elseif sale.status == sale_status_pending %} |
||||
{{ 'SaleStatusPending'|get_plugin_lang('BuyCoursesPlugin') }} |
||||
{% elseif sale.status == sale_status_completed %} |
||||
{{ 'SaleStatusCompleted'|get_plugin_lang('BuyCoursesPlugin') }} |
||||
{% endif %} |
||||
</td> |
||||
<td class="text-center">{{ sale.date }}</td> |
||||
<td class="text-right">{{ sale.currency ~ ' ' ~ sale.price }}</td> |
||||
<td class="text-center">{{ sale.product_type }}</td> |
||||
<td>{{ sale.product_name }}</td> |
||||
<td>{{ sale.complete_user_name }}</td> |
||||
{% if selected_status == sale_status_pending %} |
||||
<td class="text-center"> |
||||
{% if sale.status == sale_status_pending %} |
||||
<a href="{{ _p.web_self ~ '?' ~ {'order': sale.id, 'action': 'confirm'}|url_encode() }}" class="btn btn-success btn-sm"> |
||||
<i class="fa fa-user-plus fa-fw"></i> {{ 'SubscribeUser'|get_plugin_lang('BuyCoursesPlugin') }} |
||||
</a> |
||||
<a href="{{ _p.web_self ~ '?' ~ {'order': sale.id, 'action': 'cancel'}|url_encode() }}" class="btn btn-danger btn-sm"> |
||||
<i class="fa fa-times fa-fw"></i> {{ 'DeleteOrder'|get_plugin_lang('BuyCoursesPlugin') }} |
||||
</a> |
||||
{% endif %} |
||||
</td> |
||||
{% endif %} |
||||
</tr> |
||||
{% endfor %} |
||||
</tbody> |
||||
</table> |
||||
</div> |
||||
@ -1,106 +1,64 @@ |
||||
<script type='text/javascript' src="../js/buycourses.js"></script> |
||||
|
||||
<link rel="stylesheet" type="text/css" href="../resources/plugin.css"/> |
||||
|
||||
<div class="alert alert-info"> |
||||
{{ 'PayPalPaymentOKPleaseConfirm'|get_plugin_lang('BuyCoursesPlugin') }} |
||||
</div> |
||||
<div class="row"> |
||||
<div class="span12"> |
||||
<div id="course_category_well" class="well span3"> |
||||
<ul class="nav nav-list"> |
||||
<li class="nav-header"><h4>{{ 'UserInformation'|get_plugin_lang('BuyCoursesPlugin') }}:</h4></li> |
||||
<li class="nav-header">{{ 'Name'|get_lang }}:</li> |
||||
<li><h5>{{ name }}</h5></li> |
||||
<li class="nav-header">{{ 'User'|get_lang }}:</li> |
||||
<li><h5>{{ user }}</h5></li> |
||||
<li class="nav-header">{{ 'Email'|get_lang }}:</li> |
||||
<li><h5>{{ email }}</h5></li> |
||||
<br/> |
||||
</ul> |
||||
</div> |
||||
|
||||
<br/><br/> |
||||
|
||||
<div class="well_border span8"> |
||||
{% if isSession == "YES" %} |
||||
<div class="col-sm-6 col-md-5"> |
||||
<h3 class="page-header">{{ 'UserInformation'|get_plugin_lang('BuyCoursesPlugin') }}</h3> |
||||
<dl class="dl-horizontal"> |
||||
<dt>{{ 'Name'|get_lang }}<dt> |
||||
<dd>{{ user.complete_name }}</dd> |
||||
<dt>{{ 'Username'|get_lang }}<dt> |
||||
<dd>{{ user.username }}</dd> |
||||
<dt>{{ 'EmailAddress'|get_lang }}<dt> |
||||
<dd>{{ user.email }}</dd> |
||||
</dl> |
||||
</div> |
||||
<div class="col-sm-6 col-md-7"> |
||||
{% if buying_course %} |
||||
<div class="row"> |
||||
<div class="span4"> |
||||
<div class="categories-course-description"> |
||||
<h3>{{ session.name }}</h3> |
||||
<h5>{{ 'From'|get_lang }} {{ session.access_start_date }} {{ 'To'|get_lang }} {{ session.access_end_date }}</h5> |
||||
</div> |
||||
<div class="col-sm-6 col-md-5"> |
||||
<p> |
||||
<img alt="{{ course.title }}" class="img-responsive" src="{{ course.course_img ? course.course_img : 'session_default.png'|icon() }}"> |
||||
</p> |
||||
<p class="lead text-right">{{ course.currency }} {{ course.price }}</p> |
||||
</div> |
||||
<div class="span right"> |
||||
<div class="sprice right"> |
||||
{{ session.price }} {{ currency }} |
||||
</div> |
||||
<div class="cleared"></div> |
||||
<div class="col-sm-6 col-md-7"> |
||||
<h3 class="page-header">{{ course.title }}</h3> |
||||
<ul class="items-teacher list-unstyled"> |
||||
{% for teacher in course.teachers %} |
||||
<li><i class="fa fa-user"></i> {{ teacher }}</li> |
||||
{% endfor %} |
||||
</ul> |
||||
<p> |
||||
<a class="ajax btn btn-primary btn-sm" data-title="{{ course.title }}" href="{{ _p.web_ajax ~ 'course_home.ajax.php?' ~ {'a': 'show_course_information', 'code': course.code}|url_encode() }}"> |
||||
{{'Description'|get_lang }} |
||||
</a> |
||||
</p> |
||||
</div> |
||||
</div> |
||||
{% for course in session.courses %} |
||||
<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?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>{{ 'Teacher'|get_lang }}: {{ course.teacher }}</h5> |
||||
</div> |
||||
</div> |
||||
<div class="span right"> |
||||
<div class="cleared"></div> |
||||
<div class="btn-toolbar right"> |
||||
<a class="ajax btn btn-primary" title="" href="{{ server }}plugin/buycourses/src/ajax.php?code={{ course.code }}"> |
||||
{{ 'Description'|get_lang }} |
||||
</a> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endfor %} |
||||
{% else %} |
||||
{% elseif buying_session %} |
||||
<h3 class="page-header">{{ session.name }}</h3> |
||||
<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?code={{ course.code }}"> |
||||
<img alt="" src="{{ server }}{{ course.course_img }}"> |
||||
</a> |
||||
</div> |
||||
<div class="col-sm-12 col-md-5"> |
||||
<p> |
||||
<img alt="{{ session.name }}" class="img-responsive" src="{{ session.image ? session.image : 'session_default.png'|icon() }}"> |
||||
</p> |
||||
<p class="lead text-right">{{ session.currency }} {{ session.price }}</p> |
||||
</div> |
||||
<div class="span4"> |
||||
<div class="categories-course-description"> |
||||
<h3>{{ course.title }}</h3> |
||||
<h5>{{ 'Teacher'|get_lang }}: {{ course.teacher }}</h5> |
||||
</div> |
||||
</div> |
||||
<div class="span right"> |
||||
<div class="sprice right">{{ course.price }} {{ currency }}</div> |
||||
<div class="cleared"></div> |
||||
<div class="btn-toolbar right"> |
||||
<a class="ajax btn btn-primary" title="" |
||||
href="{{ server }}plugin/buycourses/src/ajax.php?code={{ course.code }}">{{'Description'|get_lang }}</a> |
||||
|
||||
</div> |
||||
<div class="col-sm-12 col-md-7"> |
||||
<p>{{ session.dates.display }}</p> |
||||
<dl> |
||||
{% for course in session.courses %} |
||||
<dt>{{ course.title }}</dt> |
||||
{% for coach in course.coaches %} |
||||
<dd><i class="fa fa-user fa-fw"></i> {{ coach }}</dd> |
||||
{% endfor %} |
||||
{% endfor %} |
||||
</dl> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
<div class="cleared"></div> |
||||
<hr/> |
||||
<div align="center"> |
||||
<div class="confirmation-message">{{ 'PayPalPaymentOKPleaseConfirm'|get_plugin_lang('BuyCoursesPlugin') }}</div> |
||||
<br /> |
||||
<form method="post" name="frmConfirm" action="../src/success.php"> |
||||
<input type="hidden" name="paymentOption" value="PayPal"/> |
||||
<div class="btn_next"> |
||||
<input class="btn btn-success" type="submit" name="Confirm" value="{{ 'ConfirmOrder'|get_plugin_lang('BuyCoursesPlugin') }}"/> |
||||
<input class="btn btn-danger" type="button" name="Cancel" value="{{ 'CancelOrder'|get_plugin_lang('BuyCoursesPlugin') }}" id="cancel_order"/> |
||||
</div> |
||||
</form> |
||||
</div> |
||||
<div class="cleared"></div> |
||||
</div> |
||||
|
||||
{{ form }} |
||||
|
||||