Visual improvements in plugin buycourses - refs BT#11338

pull/2495/head
Alex Aragón 8 years ago
parent cee24a39bc
commit 065fde43ce
  1. 50
      plugin/buycourses/resources/css/style.css
  2. 27
      plugin/buycourses/src/buy_course_plugin.class.php
  3. 5
      plugin/buycourses/src/process.php
  4. 172
      plugin/buycourses/view/process.tpl

@ -30,7 +30,42 @@
font-size: 18px;
line-height: 1.42857;
}
/* PROCESS BUY */
.buy-info .price{
font-size: 24px;
line-height: 32px;
font-weight: bold;
padding-bottom: 10px;
padding-top: 10px;
letter-spacing: -0.020em;
}
.buy-info .buy-item .title{
margin-top: 5px;
font-weight: bold;
line-height: 24px;
font-size: 18px;
}
.buy-info .buy-item .description, .buy-info .buy-item .coaches{
margin-bottom: 20px;
color: #666666;
}
.buy-info .buy-item .date{
margin-bottom: 10px;
color: #666666;
}
.buy-summary{
margin-top: 10px;
border-top: 1px solid #CCCCCC;
}
.panel-box-buy{
box-shadow: 0 15px 30px rgba(0,0,0,.1);
padding: 20px;
}
.buy-summary .alert-info {
color: #31708f;
background-color: #e8f2f8;
border-color: #bce8f1;
}
@-moz-keyframes wobblebar-loader {
0% {
left: 4px;
@ -271,6 +306,18 @@
left: 204px;
}
}
/* Landscape phones and down */
@media (max-width: 480px) {
.panel-box-buy{
padding: 0;
}
.buy-summary .pull-right{
float: left !important;
}
.buy-summary .btn-success{
width: 100%;
}
}
/* :not(:required) hides this rule from IE9 and below */
.wobblebar-loader:not(:required) {
background: #2E6DA4;
@ -300,3 +347,4 @@
width: 21.33333px;
height: 14.22222px;
}

@ -580,10 +580,21 @@ class BuyCoursesPlugin extends Plugin
return [];
}
$courseDescription = $entityManager->getRepository('ChamiloCourseBundle:CCourseDescription')
->findOneBy(
[
'cId' => $course->getId(),
'sessionId' => 0,
],
[
'descriptionType' => 'ASC',
]
);
$courseInfo = [
'id' => $course->getId(),
'title' => $course->getTitle(),
'description' => $course->getDescription(),
'description' => $courseDescription->getContent(),
'code' => $course->getCode(),
'visual_code' => $course->getVisualCode(),
'teachers' => [],
@ -594,8 +605,11 @@ class BuyCoursesPlugin extends Plugin
$courseTeachers = $course->getTeachers();
foreach ($courseTeachers as $teacher) {
$courseInfo['teachers'][] = $teacher->getUser()->getCompleteName();
foreach ($courseTeachers as $teachers) {
$user = $teachers->getUser();
$teacher['id'] = $user->getId();
$teacher['name'] = $user->getCompleteName();
$courseInfo['teachers'][] = $teacher;
}
$possiblePath = api_get_path(SYS_COURSE_PATH);
@ -646,11 +660,14 @@ class BuyCoursesPlugin extends Plugin
$sessionInfo = [
'id' => $session->getId(),
'name' => $session->getName(),
'description' => $session->getDescription(),
'dates' => $sessionDates,
'courses' => [],
'price' => $item['price'],
'currency' => $item['iso_code'],
'image' => null,
'nbrCourses' => $session->getNbrCourses(),
'nbrUsers' => $session->getNbrUsers()
];
$fieldValue = new ExtraFieldValue('session');
@ -680,7 +697,9 @@ class BuyCoursesPlugin extends Plugin
foreach ($userCourseSubscriptions as $userCourseSubscription) {
$user = $userCourseSubscription->getUser();
$sessionCourseData['coaches'][] = $user->getCompleteName();
$coaches['id'] = $user->getUserId();
$coaches['name'] = $user->getCompleteName();
$sessionCourseData['coaches'][] = $coaches;
}
$sessionInfo['courses'][] = $sessionCourseData;

@ -11,13 +11,12 @@ use ChamiloSession as Session;
require_once '../config.php';
$currentUserId = api_get_user_id();
if (empty($currentUserId)) {
Session::write('buy_course_redirect', Security::remove_XSS($_SERVER['REQUEST_URI']));
header('Location: '.api_get_path(WEB_CODE_PATH).'auth/inscription.php');
exit;
}
$htmlHeadXtra[] = '<link rel="stylesheet" type="text/css" href="../resources/css/style.css"/>';
$plugin = BuyCoursesPlugin::create();
$includeSession = $plugin->get('include_sessions') === 'true';
$paypalEnabled = $plugin->get('paypal_enable') === 'true';
@ -109,7 +108,7 @@ if ($count === 0) {
$form->addHidden('t', intval($_GET['t']));
$form->addHidden('i', intval($_GET['i']));
$form->addButton('submit', $plugin->get_lang('ConfirmOrder'), 'check', 'success');
$form->addButton('submit', $plugin->get_lang('ConfirmOrder'), 'check', 'success', 'btn-lg pull-right');
// View
$templateName = $plugin->get_lang('PaymentMethods');

@ -1,58 +1,117 @@
<h2 class="page-header">{{ 'PurchaseData'|get_plugin_lang('BuyCoursesPlugin') }}</h2>
<div class="actions">
<a href="{{ _p.web }}main/auth/courses.php" title="{{ "Back"|get_lang }}">
<img src="{{ "back.png"|icon(32) }}" width="32" height="32" alt="{{ "Back"|get_lang }}"
title="{{ "Back"|get_lang }}"/>
</a>
</div>
<div class="page-header">
<h3>{{ 'PurchaseData'|get_plugin_lang('BuyCoursesPlugin') }}</h3>
</div>
<div class="row">
<div class="col-md-5">
<div class="thumbnail">
{% if buying_course %}
<a class="ajax" data-title="{{ course.title }}"
href="{{ _p.web_ajax ~ 'course_home.ajax.php?' ~ {'a': 'show_course_information', 'code': course.code}|url_encode() }}">
<img alt="{{ course.title }}" class="img-responsive" style="width: 100%;"
src="{{ course.course_img ? course.course_img : 'session_default.png'|icon() }}">
</a>
<div class="caption">
<h3>
<a class="ajax" data-title="{{ course.title }}"
href="{{ _p.web_ajax ~ 'course_home.ajax.php?' ~ {'a': 'show_course_information', 'code': course.code}|url_encode() }}">{{ course.title }}</a>
</h3>
<ul class="fa-ul">
{% for teacher in course.teachers %}
<li><em class="fa-li fa fa-user" aria-hidden="true"></em>{{ teacher }}</li>
{% endfor %}
</ul>
<p id="n-price" class="lead text-right" style="color: white;">
<span class="label label-primary">{{ course.currency == 'BRL' ? 'R$' : course.currency }} {{ course.price }}</span>
</p>
<p id="s-price" class="lead text-right"></p>
</div>
{% elseif buying_session %}
<img alt="{{ session.name }}" class="img-ressponsive" style="width: 100%;"
src="{{ session.image ? session.image : 'session_default.png'|icon() }}">
<div class="caption">
<h3>{{ session.name }}</h3>
<ul class="fa-ul">
<li>
<em class="fa-li fa fa-calendar" aria-hidden="true"></em>{{ session.dates.display }}
</li>
</ul>
<ul class="fa-ul">
{% for course in session.courses %}
<li>
<em class="fa-li fa fa-book" aria-hidden="true"></em>
{{ course.title }}
{% if course.coaches|length %}
<ul class="fa-ul">
{% for coach in course.coaches %}
<li><em class="fa-li fa fa-user" aria-hidden="true"></em>{{ coach }}</li>
<div class="col-md-12">
<div class="panel panel-default panel-box-buy">
<div class="panel-body">
<div class="buy-info">
{% if buying_course %}
<div class="row">
<div class="col-md-3">
<a class="ajax" data-title="{{ course.title }}"
href="{{ _p.web_ajax ~ 'course_home.ajax.php?' ~ {'a': 'show_course_information', 'code': course.code}|url_encode() }}">
<img alt="{{ course.title }}" class="img-rounded img-responsive"
src="{{ course.course_img ? course.course_img : 'session_default.png'|icon() }}">
</a>
<div class="price">
{{ 'Total'|get_plugin_lang('BuyCoursesPlugin')}} :
{{ course.currency == 'BRL' ? 'R$' : course.currency }} {{ course.price }}
</div>
</div>
<div class="col-md-9">
<div class="buy-item">
<h3 class="title">
<a class="ajax" data-title="{{ course.title }}"
href="{{ _p.web_ajax ~ 'course_home.ajax.php?' ~ {'a': 'show_course_information', 'code': course.code}|url_encode() }}">
{{ course.title }}
</a>
</h3>
{% if course.description %}
<div class="description">
{{ course.description }}
</div>
{% endif %}
<div class="coaches">
<p>
{{ 'Teachers'|get_plugin_lang('BuyCoursesPlugin')}} :
{% for teacher in course.teachers %}
<em class="fa fa-user" aria-hidden="true"></em>
<a href="{{ _p.web }}main/social/profile.php?u={{ teacher.id }}" class="teacher-item"> {{ teacher.name }}</a>,
{% endfor %}
</ul>
</p>
</div>
</div>
</div>
</div>
{% elseif buying_session %}
<div class="row">
<div class="col-md-3">
<img alt="{{ session.name }}" class="img-rounded img-responsive""
src="{{ session.image ? session.image : 'session_default.png'|icon() }}">
<div class="price">
{{ 'Total'|get_plugin_lang('BuyCoursesPlugin')}} :
{{ session.currency == 'BRL' ? 'R$' : session.currency }} {{ session.price }}
</div>
</div>
<div class="col-md-9">
<div class="buy-item">
<h3 class="title">{{ session.name }}</h3>
{% if session.description %}
<div class="description">
{{ session.description }}
</div>
{% endif %}
</li>
{% endfor %}
</ul>
<p id="n-price" class="lead text-right" style="color: white;">
<span class="label label-primary">{{ session.currency == 'BRL' ? 'R$' : session.currency }} {{ session.price }}</span>
</p>
<p id="s-price" class="lead text-right"></p>
<div class="date">
<em class="fa fa-calendar" aria-hidden="true"></em> {{ session.dates.display }}
</div>
<div class="coaches">
{% for course in session.courses %}
<p class="course"><em class="fa fa-book" aria-hidden="true"></em> {{ course.title }}</p>
<p>
{{ 'Teachers'|get_plugin_lang('BuyCoursesPlugin')}} :
{% if course.coaches|length %}
{% for coach in course.coaches %}
<em class="fa fa-user" aria-hidden="true"></em>
<a href="{{ _p.web }}main/social/profile.php?u={{ coach.id }}" class="teacher-item"> {{ coach.name }}</a>,
{% endfor %}
{% endif %}
</p>
{% endfor %}
</div>
</div>
</div>
</div>
{% elseif buying_service %}
{% endif %}
</div>
<div class="buy-summary">
<h3>{{ 'PaymentMethods'|get_plugin_lang('BuyCoursesPlugin') }}</h3>
{{ form }}
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="thumbnail">
{% if buying_course %}
{% elseif buying_session %}
{% elseif buying_service %}
<a href='{{ _p.web }}service/{{ service.id }}'>
<img alt="{{ service.name }}" class="img-responsive"
@ -96,16 +155,7 @@
{% endif %}
</div>
</div>
<div class="col-md-6 col-md-offset-1">
<div class="panel panel-default buycourse-panel-default">
<div class="panel-heading">
<h3 class="panel-title">{{ 'PaymentMethods'|get_plugin_lang('BuyCoursesPlugin') }}</h3>
</div>
<div class="panel-body">
{{ form }}
</div>
</div>
</div>
</div>
<script>
$(document).ready(function () {

Loading…
Cancel
Save