Minor - update from 1.11.x

pull/2528/head
jmontoyaa 7 years ago
parent a6bd78ab8a
commit 0ffec357ed
  1. 11
      plugin/bbb/lib/bbb.lib.php
  2. 613
      plugin/buycourses/resources/css/style.css
  3. 48
      plugin/buycourses/src/buy_course_plugin.class.php
  4. 7
      plugin/buycourses/src/process.php
  5. 4
      plugin/buycourses/src/service_information.php
  6. 4
      plugin/buycourses/src/service_process.php
  7. 2
      plugin/buycourses/src/services_add.php
  8. 2
      plugin/buycourses/src/services_edit.php
  9. 300
      plugin/buycourses/view/process.tpl
  10. 160
      plugin/buycourses/view/service_information.tpl
  11. 83
      plugin/buycourses/view/service_process.tpl
  12. 55
      plugin/dictionary/DictionaryPlugin.php
  13. 2
      plugin/dictionary/index.php
  14. 7
      plugin/dictionary/install.php
  15. 7
      plugin/dictionary/lang/english.php
  16. 4
      plugin/dictionary/plugin.php
  17. 85
      plugin/dictionary/terms.php
  18. 34
      plugin/dictionary/view/terms.html.twig
  19. 48
      plugin/ims_lti/ImsLtiPlugin.php
  20. 12
      plugin/ims_lti/README.md
  21. 2
      plugin/ims_lti/install.php
  22. 3
      plugin/ims_lti/uninstall.php
  23. 20
      plugin/notebookteacher/README.md
  24. 10
      plugin/notebookteacher/config.php
  25. 46
      plugin/notebookteacher/database.php
  26. 3
      plugin/notebookteacher/index.php
  27. 14
      plugin/notebookteacher/install.php
  28. 14
      plugin/notebookteacher/lang/english.php
  29. 14
      plugin/notebookteacher/lang/spanish.php
  30. 16
      plugin/notebookteacher/plugin.php
  31. BIN
      plugin/notebookteacher/resources/img/22/notebookteacher.png
  32. BIN
      plugin/notebookteacher/resources/img/32/notebookteacher.png
  33. BIN
      plugin/notebookteacher/resources/img/64/notebookteacher.png
  34. BIN
      plugin/notebookteacher/resources/img/64/notebookteacher_na.png
  35. 520
      plugin/notebookteacher/src/NotebookTeacher.php
  36. 118
      plugin/notebookteacher/src/NotebookTeacherPlugin.php
  37. 394
      plugin/notebookteacher/src/index.php
  38. 33
      plugin/notebookteacher/start.php
  39. 12
      plugin/notebookteacher/uninstall.php
  40. 14
      plugin/notebookteacher/update.php
  41. 4
      plugin/redirection/RedirectionPlugin.php
  42. 5
      plugin/resubscription/src/HookResubscription.php
  43. 26
      plugin/sepe/CHANGELOG.md
  44. 4
      plugin/sepe/database.php
  45. 391
      plugin/sepe/src/sepe_plugin.class.php
  46. 23
      plugin/vchamilo/ajax/service.php
  47. 4
      plugin/vchamilo/plugin.php
  48. 190
      plugin/vchamilo/views/syncparams.controller.php
  49. 16
      plugin/vchamilo/views/syncparams.php

@ -74,11 +74,10 @@ class bbb
$this->userSupport = isset($columns['user_id']) ? true : false;
$this->accessUrl = api_get_current_access_url_id();
$this->enableGlobalConferencePerUser = false;
if ($this->userSupport && !empty($isGlobalPerUser)) {
$this->enableGlobalConferencePerUser = $this->plugin->get('enable_global_conference_per_user') === 'true' ? true : false;
$this->userId = $isGlobalPerUser;
} else {
$this->enableGlobalConferencePerUser = false;
}
if ($this->groupSupport) {
@ -111,7 +110,6 @@ class bbb
$this->userCompleteName = $userInfo['complete_name'];
}
$this->salt = $bbb_salt;
$info = parse_url($bbb_host);
$this->url = $bbb_host.'/bigbluebutton/';
@ -307,11 +305,8 @@ class bbb
$params['group_id'] = api_get_group_id();
}
if ($this->isGlobalConferencePerUserEnabled()) {
$currentUserId = api_get_user_id();
if ($this->userId === $currentUserId) {
$params['user_id'] = $this->userId;
}
if ($this->isGlobalConferencePerUserEnabled() && !empty($this->userId)) {
$params['user_id'] = (int) $this->userId;
}
$params['attendee_pw'] = isset($params['attendee_pw']) ? $params['attendee_pw'] : $this->getUserMeetingPassword();

@ -1,302 +1,369 @@
.buy-courses-tabs {
margin-bottom: 15px;
margin-bottom: 15px;
}
.buy-courses-page-header {
padding-bottom: 9px;
margin: 40px 0 20px;
border-bottom: 1px solid #eee;
padding-bottom: 9px;
margin: 40px 0 20px;
border-bottom: 1px solid #eee;
}
.buy-courses-block-button {
display: block;
width: 100%;
height: 50px;
line-height: 35px;
font-size: 16px;
display: block;
width: 100%;
height: 50px;
line-height: 35px;
font-size: 16px;
}
.buy-courses-cross-out {
text-decoration:line-through;
text-decoration: line-through;
}
.buy-courses-title-color {
color: #5DC3E1;
padding-bottom: 10px;
color: #5DC3E1;
padding-bottom: 10px;
}
.buy-courses-description-service {
text-align: justify;
font-size: 18px;
line-height: 1.42857;
text-align: justify;
font-size: 18px;
line-height: 1.42857;
}
/* PROCESS BUY */
.buy-info .price, .service-buy .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 .list-description {
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;
}
3% {
left: 204px;
}
6% {
left: 4px;
}
9% {
left: 204px;
}
12% {
left: 4px;
}
15% {
left: 204px;
}
18% {
left: 32px;
}
27% {
left: 32px;
}
30% {
left: 204px;
}
33% {
left: 4px;
}
36% {
left: 204px;
}
39% {
left: 4px;
}
42% {
left: 204px;
}
45% {
left: 4px;
}
48% {
left: 204px;
}
51% {
left: 152px;
}
63% {
left: 152px;
}
66% {
left: 4px;
}
69% {
left: 204px;
}
72% {
left: 4px;
}
75% {
left: 204px;
}
78% {
left: 4px;
}
81% {
left: 204px;
}
84% {
left: 72px;
}
94% {
left: 72px;
}
97% {
left: 204px;
}
0% {
left: 4px;
}
3% {
left: 204px;
}
6% {
left: 4px;
}
9% {
left: 204px;
}
12% {
left: 4px;
}
15% {
left: 204px;
}
18% {
left: 32px;
}
27% {
left: 32px;
}
30% {
left: 204px;
}
33% {
left: 4px;
}
36% {
left: 204px;
}
39% {
left: 4px;
}
42% {
left: 204px;
}
45% {
left: 4px;
}
48% {
left: 204px;
}
51% {
left: 152px;
}
63% {
left: 152px;
}
66% {
left: 4px;
}
69% {
left: 204px;
}
72% {
left: 4px;
}
75% {
left: 204px;
}
78% {
left: 4px;
}
81% {
left: 204px;
}
84% {
left: 72px;
}
94% {
left: 72px;
}
97% {
left: 204px;
}
}
@-webkit-keyframes wobblebar-loader {
0% {
left: 4px;
}
3% {
left: 204px;
}
6% {
left: 4px;
}
9% {
left: 204px;
}
12% {
left: 4px;
}
15% {
left: 204px;
}
18% {
left: 32px;
}
27% {
left: 32px;
}
30% {
left: 204px;
}
33% {
left: 4px;
}
36% {
left: 204px;
}
39% {
left: 4px;
}
42% {
left: 204px;
}
45% {
left: 4px;
}
48% {
left: 204px;
}
51% {
left: 152px;
}
63% {
left: 152px;
}
66% {
left: 4px;
}
69% {
left: 204px;
}
72% {
left: 4px;
}
75% {
left: 204px;
}
78% {
left: 4px;
}
81% {
left: 204px;
}
84% {
left: 72px;
}
94% {
left: 72px;
}
97% {
left: 204px;
}
0% {
left: 4px;
}
3% {
left: 204px;
}
6% {
left: 4px;
}
9% {
left: 204px;
}
12% {
left: 4px;
}
15% {
left: 204px;
}
18% {
left: 32px;
}
27% {
left: 32px;
}
30% {
left: 204px;
}
33% {
left: 4px;
}
36% {
left: 204px;
}
39% {
left: 4px;
}
42% {
left: 204px;
}
45% {
left: 4px;
}
48% {
left: 204px;
}
51% {
left: 152px;
}
63% {
left: 152px;
}
66% {
left: 4px;
}
69% {
left: 204px;
}
72% {
left: 4px;
}
75% {
left: 204px;
}
78% {
left: 4px;
}
81% {
left: 204px;
}
84% {
left: 72px;
}
94% {
left: 72px;
}
97% {
left: 204px;
}
}
@keyframes wobblebar-loader {
0% {
left: 4px;
}
3% {
left: 204px;
}
6% {
left: 4px;
}
9% {
left: 204px;
}
12% {
left: 4px;
}
15% {
left: 204px;
}
18% {
left: 32px;
}
27% {
left: 32px;
}
30% {
left: 204px;
}
33% {
left: 4px;
}
36% {
left: 204px;
}
39% {
left: 4px;
}
42% {
left: 204px;
}
45% {
left: 4px;
}
48% {
left: 204px;
}
51% {
left: 152px;
}
63% {
left: 152px;
}
66% {
left: 4px;
}
69% {
left: 204px;
}
72% {
left: 4px;
}
75% {
left: 204px;
}
78% {
left: 4px;
}
81% {
left: 204px;
}
84% {
left: 72px;
}
94% {
left: 72px;
}
97% {
left: 204px;
}
0% {
left: 4px;
}
3% {
left: 204px;
}
6% {
left: 4px;
}
9% {
left: 204px;
}
12% {
left: 4px;
}
15% {
left: 204px;
}
18% {
left: 32px;
}
27% {
left: 32px;
}
30% {
left: 204px;
}
33% {
left: 4px;
}
36% {
left: 204px;
}
39% {
left: 4px;
}
42% {
left: 204px;
}
45% {
left: 4px;
}
48% {
left: 204px;
}
51% {
left: 152px;
}
63% {
left: 152px;
}
66% {
left: 4px;
}
69% {
left: 204px;
}
72% {
left: 4px;
}
75% {
left: 204px;
}
78% {
left: 4px;
}
81% {
left: 204px;
}
84% {
left: 72px;
}
94% {
left: 72px;
}
97% {
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;
-moz-border-radius: 10.66667px;
-webkit-border-radius: 10.66667px;
border-radius: 10.66667px;
display: inline-block;
overflow: hidden;
text-indent: -9999px;
width: 228px;
height: 21.33333px;
position: relative;
background: #2E6DA4;
-moz-border-radius: 10.66667px;
-webkit-border-radius: 10.66667px;
border-radius: 10.66667px;
display: inline-block;
overflow: hidden;
text-indent: -9999px;
width: 228px;
height: 21.33333px;
position: relative;
}
.wobblebar-loader:not(:required)::after {
-moz-animation: wobblebar-loader 15000ms infinite ease;
-webkit-animation: wobblebar-loader 15000ms infinite ease;
animation: wobblebar-loader 15000ms infinite ease;
background: white;
display: block;
-moz-border-radius: 7.11111px;
-webkit-border-radius: 7.11111px;
border-radius: 7.11111px;
content: '';
position: absolute;
top: 3.55556px;
left: 4px;
width: 21.33333px;
height: 14.22222px;
-moz-animation: wobblebar-loader 15000ms infinite ease;
-webkit-animation: wobblebar-loader 15000ms infinite ease;
animation: wobblebar-loader 15000ms infinite ease;
background: white;
display: block;
-moz-border-radius: 7.11111px;
-webkit-border-radius: 7.11111px;
border-radius: 7.11111px;
content: '';
position: absolute;
top: 3.55556px;
left: 4px;
width: 21.33333px;
height: 14.22222px;
}

@ -183,11 +183,11 @@ class BuyCoursesPlugin extends Plugin
$item = $this->getItemByProduct($productId, $productType);
$html = '<div class="buycourses-price">';
if ($item) {
$html .= '<span class="label label-primary"><strong>'.$item['iso_code'].' '.$item['price'].'</strong></span>';
$html .= '<span class="label label-primary label-price"><strong>'.$item['iso_code'].' '.$item['price'].'</strong></span>';
$return['verificator'] = true;
} else {
if ($hideFree == false) {
$html .= '<span class="label label-primary"><strong>'.$this->get_lang('Free').'</strong></span>';
$html .= '<span class="label label-primary label-free"><strong>'.$this->get_lang('Free').'</strong></span>';
}
$return['verificator'] = false;
}
@ -212,7 +212,7 @@ class BuyCoursesPlugin extends Plugin
{
$url = api_get_path(WEB_PLUGIN_PATH).'buycourses/src/process.php?i='.intval($productId).'&t='.$productType;
$html = '<a class="btn btn-success btn-sm" title="'.$this->get_lang('Buy').'" href="'.$url.'">'.
Display::returnFontAwesomeIcon('fa fa-shopping-cart').'</a>';
Display::returnFontAwesomeIcon('shopping-cart').'</a>';
return $html;
}
@ -419,8 +419,7 @@ class BuyCoursesPlugin extends Plugin
*/
public function getSessionsForConfiguration()
{
$auth = new Auth();
$sessions = $auth->browseSessions();
$sessions = CoursesAndSessionsCatalog::browseSessions();
$currency = $this->getSelectedCurrency();
$items = [];
foreach ($sessions as $session) {
@ -580,10 +579,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 +604,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 +659,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 +696,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;
@ -1713,7 +1731,9 @@ class BuyCoursesPlugin extends Plugin
$services['owner_id'] = $return['owner_id'];
$services['owner_name'] = api_get_person_name($return['firstname'], $return['lastname']);
$services['visibility'] = $return['visibility'];
$services['image'] = $return['image'];
$services['image'] = !empty($return['image']) ? api_get_path(
WEB_PLUGIN_PATH
).'buycourses/uploads/services/images/'.$return['image'] : null;
$services['video_url'] = $return['video_url'];
$services['service_information'] = $return['service_information'];
@ -1731,7 +1751,9 @@ class BuyCoursesPlugin extends Plugin
$services[$index]['owner_id'] = $service['owner_id'];
$services[$index]['owner_name'] = api_get_person_name($service['firstname'], $service['lastname']);
$services[$index]['visibility'] = $service['visibility'];
$services[$index]['image'] = $service['image'];
$services[$index]['image'] = !empty($service['image']) ? api_get_path(
WEB_PLUGIN_PATH
).'buycourses/uploads/services/images/'.$service['image'] : null;
$services[$index]['video_url'] = $service['video_url'];
$services[$index]['service_information'] = $service['service_information'];
}
@ -2360,9 +2382,7 @@ class BuyCoursesPlugin extends Plugin
private function filterSessionList($name = null, $min = 0, $max = 0)
{
if (empty($name) && empty($min) && empty($max)) {
$auth = new Auth();
return $auth->browseSessions();
return CoursesAndSessionsCatalog::browseSessions();
}
$itemTable = Database::get_main_table(self::TABLE_ITEM);

@ -11,13 +11,14 @@ 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="'.api_get_path(
WEB_PLUGIN_PATH
).'buycourses/resources/css/style.css"/>';
$plugin = BuyCoursesPlugin::create();
$includeSession = $plugin->get('include_sessions') === 'true';
$paypalEnabled = $plugin->get('paypal_enable') === 'true';
@ -109,7 +110,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');

@ -14,7 +14,9 @@ $cidReset = true;
require_once '../../../main/inc/global.inc.php';
$serviceId = isset($_GET['service_id']) ? intval($_GET['service_id']) : false;
$htmlHeadXtra[] = '<link rel="stylesheet" type="text/css" href="'.api_get_path(
WEB_PLUGIN_PATH
).'buycourses/resources/css/style.css"/>';
$plugin = BuyCoursesPlugin::create();
$includeServices = $plugin->get('include_services') === 'true';

@ -24,7 +24,9 @@ $serviceId = intval($_REQUEST['i']);
if (empty($currentUserId)) {
api_not_allowed(true);
}
$htmlHeadXtra[] = '<link rel="stylesheet" type="text/css" href="'.api_get_path(
WEB_PLUGIN_PATH
).'buycourses/resources/css/style.css"/>';
$em = Database::getManager();
$plugin = BuyCoursesPlugin::create();
$includeServices = $plugin->get('include_services');

@ -40,7 +40,7 @@ $formDefaultValues = [
$form = new FormValidator('Services');
$form->addText('name', $plugin->get_lang('ServiceName'));
$form->addTextarea('description', $plugin->get_lang('Description'));
$form->addHtmlEditor('description', $plugin->get_lang('Description'));
$form->addElement(
'number',
'price',

@ -56,7 +56,7 @@ $formDefaultValues = [
$form = new FormValidator('Services');
$form->addText('name', $plugin->get_lang('ServiceName'));
$form->addTextarea('description', $plugin->get_lang('Description'));
$form->addHtmlEditor('description', $plugin->get_lang('Description'));
$form->addElement(
'number',
'price',

@ -1,119 +1,221 @@
<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>
{% endif %}
</div>
{% elseif buying_service %}
<a href='{{ _p.web }}service/{{ service.id }}'>
<img alt="{{ service.name }}" class="img-responsive"
src="{{ service.image ? _p.web ~ 'plugin/buycourses/uploads/services/images/' ~ service.image : 'session_default.png'|icon() }}">
</a>
<div class="caption">
<h3>
<a href='{{ _p.web }}service/{{ service.id }}'>{{ service.name }}</a>
</h3>
<ul class="fa-ul">
{% if service.applies_to %}
<li>
<em class="fa-li fa fa-hand-o-right" aria-hidden="true"></em>
{% if service.applies_to == 0 %}
{{ 'AppliesTo'|get_plugin_lang('BuyCoursesPlugin') ~ ' ' ~ 'None'|get_lang }}
{% elseif service.applies_to == 1 %}
{{ 'AppliesTo'|get_plugin_lang('BuyCoursesPlugin') ~ ' ' ~ 'User'|get_lang }}
{% elseif service.applies_to == 2 %}
{{ 'AppliesTo'|get_plugin_lang('BuyCoursesPlugin') ~ ' ' ~ 'Course'|get_lang }}
{% elseif service.applies_to == 3 %}
{{ 'AppliesTo'|get_plugin_lang('BuyCoursesPlugin') ~ ' ' ~ 'Session'|get_lang }}
{% elseif service.applies_to == 4 %}
{{ 'AppliesTo'|get_plugin_lang('BuyCoursesPlugin') ~ ' ' ~ 'TemplateTitleCertificate'|get_lang }}
{% endif %}
</li>
{% endif %}
<li>
<em class="fa-li fa fa-money" aria-hidden="true"></em>
{{ 'Price'|get_plugin_lang('BuyCoursesPlugin') }}
: {{ service.currency == 'BRL' ? 'R$' : service.currency }} {{ service.price }}
/ {{ service.duration_days == 0 ? 'NoLimit'|get_lang : service.duration_days ~ ' ' ~ 'Days'|get_lang }}
</li>
<li><em class="fa-li fa fa-user" aria-hidden="true"></em> {{ service.owner_name }}</li>
<li><em class="fa-li fa fa-align-justify" aria-hidden="true"></em> {{ service.description }}</li>
</ul>
<p id="n-price" class="lead text-right" style="color: white;">
<span class="label label-primary">{{ service.currency == 'BRL' ? 'R$' : service.currency }} {{ service.price }}</span>
</p>
<p id="s-price" class="lead text-right"></p>
<div class="buy-summary">
<h3>{{ 'PaymentMethods'|get_plugin_lang('BuyCoursesPlugin') }}</h3>
{{ form }}
</div>
{% endif %}
</div>
</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>
<script>
$(document).ready(function () {
$("label").removeClass('control-label');
$('.form_required').remove();
$("small").remove();
$("label[for=submit]").remove();
});
</script><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-12">
<div class="panel panel-default panel-box-buy">
<div class="panel-body">
{{ form }}
<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 %}
</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 %}
<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>
{% endif %}
</div>
<div class="buy-summary">
<h3>{{ 'PaymentMethods'|get_plugin_lang('BuyCoursesPlugin') }}</h3>
{{ form }}
</div>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function () {
$("label").removeClass('control-label');
$('.form_required').remove();
$("small").remove();
$("label[for=submit]").remove();
});
</script>

@ -1,85 +1,105 @@
<link rel="stylesheet" type="text/css" href="{{ _p.web_plugin ~ 'buycourses/resources/css/style.css' }}"/>
<div id="service-information">
<div class="row">
<div class="col-xs-12">
<h3 class="text-uppercase buy-courses-title-color">{{ service.name }}</h3>
</div>
{% if service.video_url %}
<div class="col-sm-6 col-md-7 col-xs-12">
<div class="embed-responsive embed-responsive-16by9">
{{ essence.replace(service.video_url) }}
</div>
</div>
{% endif %}
<div class="{{ service.video_url ? 'col-sm-6 col-md-5 col-xs-12' : 'col-sm-12 col-xs-12' }}">
<div class="block">
<div class="panel panel-default">
<div class="panel-heading">
<h4>{{ "Description"|get_lang }}</h4>
<div id="service" class="service">
<div class="page-header">
<h2>{{ service.name }}</h2>
</div>
<section id="service-info">
<div class="panel panel-default">
<div class="panel-body">
<div class="row">
<div class="col-md-6">
<div class="service-media">
{% if service.video_url %}
<div class="service-video">
<div class="embed-responsive embed-responsive-16by9">
{{ essence.replace(service.video_url) }}
</div>
</div>
{% elseif service.image %}
<div class="service-image">
<a href="{{ _p.web }}service/{{ service.id }}">
<img alt="{{ service.name }}" class="img-rounded img-responsive"
src="{{ service.image ? service.image : 'session_default.png'|icon() }}">
</a>
</div>
{% endif %}
</div>
<div class="share-social-media">
<ul class="sharing-buttons">
<li>
{{ "ShareWithYourFriends"|get_lang }}
</li>
<li>
<a href="https://www.facebook.com/sharer/sharer.php?{{ {'u': pageUrl}|url_encode }}"
target="_blank" class="btn btn-facebook btn-inverse btn-xs">
<em class="fa fa-facebook"></em> Facebook
</a>
</li>
<li>
<a href="https://twitter.com/home?{{ {'status': session.getName() ~ ' ' ~ pageUrl}|url_encode }}"
target="_blank" class="btn btn-twitter btn-inverse btn-xs">
<em class="fa fa-twitter"></em> Twitter
</a>
</li>
<li>
<a href="https://www.linkedin.com/shareArticle?{{ {'mini': 'true', 'url': pageUrl, 'title': session.getName() }|url_encode }}"
target="_blank" class="btn btn-linkedin btn-inverse btn-xs">
<em class="fa fa-linkedin"></em> Linkedin
</a>
</li>
</ul>
</div>
</div>
<div class="panel-body">
<p><em class="fa fa-flag-o"></em> <b>{{ 'AppliesTo'|get_plugin_lang('BuyCoursesPlugin') }}</b> :
{% if service.applies_to == 1 %}
<div class="col-md-6">
{% if service.description %}
<div class="description">
{{ service.description }}
</div>
{% endif %}
<div class="service-details">
<p><em class="fa fa-flag-o"></em> <b>{{ 'AppliesTo'|get_plugin_lang('BuyCoursesPlugin') }}</b> :
{% if service.applies_to == 1 %}
{{ 'User'|get_lang }}
{% elseif service.applies_to == 2 %}
{% elseif service.applies_to == 2 %}
{{ 'Course'|get_lang }}
{% elseif service.applies_to == 3 %}
{% elseif service.applies_to == 3 %}
{{ 'Session'|get_lang }}
{% elseif service.applies_to == 4 %}
{% elseif service.applies_to == 4 %}
{{ 'TemplateTitleCertificate'|get_lang }}
{% endif %}
</p>
<p><em class="fa fa-money"></em> <b>{{ 'Price'|get_plugin_lang('BuyCoursesPlugin') }}</b>
: {{ service.currency == 'BRL' ? 'R$' : service.currency }} {{ service.price }}</p>
<p><em class="fa fa-align-justify"></em> <b>{{ 'Details'|get_lang }}</b>
: {{ service.description }}</p>
<div class="text-right" style="padding-bottom: 20px;">
<a href="{{ _p.web_plugin ~ 'buycourses/src/service_process.php?t=4&i=' ~ service.id }}"
class="btn btn-success btn-lg">
<em class="fa fa-shopping-cart"></em> {{ 'Buy'|get_plugin_lang('BuyCoursesPlugin') }}
</a>
{% endif %}
</p>
<p><em class="fa fa-money"></em> <b>{{ 'Price'|get_plugin_lang('BuyCoursesPlugin') }}</b>
: {{ service.currency == 'BRL' ? 'R$' : service.currency }} {{ service.price }}</p>
</div>
<div class="service-buy">
<div class="row">
<div class="col-sm-6">
<div class="price">
{{ 'Total'|get_lang }}
: {{ service.currency == 'BRL' ? 'R$' : service.currency }} {{ service.price }}
</div>
</div>
<div class="col-sm-6">
<a href="{{ _p.web_plugin ~ 'buycourses/src/service_process.php?t=4&i=' ~ service.id }}"
class="btn btn-success btn-lg btn-block">
<em class="fa fa-shopping-cart"></em> {{ 'Buy'|get_plugin_lang('BuyCoursesPlugin') }}
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</br>
</br>
<div class="row info-course">
<div class="col-xs-12 col-md-7">
</section>
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">
<h4>{{ 'ServiceInformation'|get_plugin_lang('BuyCoursesPlugin') }}</h4>
</div>
<div class="panel-body">
{{ service.service_information }}
</div>
</div>
</div>
<div class="col-xs-12 col-md-5">
<div class="panel panel-default social-share">
<div class="panel-heading">
<h4>{{ "ShareWithYourFriends"|get_lang }}</h4>
</div>
<div class="panel-body">
<div class="icons-social text-center">
<a href="https://www.facebook.com/sharer/sharer.php?{{ {'u': pageUrl}|url_encode }}"
target="_blank" class="btn bnt-link btn-lg">
<em class="fa fa-facebook fa-2x"></em>
</a>
<a href="https://twitter.com/home?{{ {'status': session.getName() ~ ' ' ~ pageUrl}|url_encode }}"
target="_blank" class="btn bnt-link btn-lg">
<em class="fa fa-twitter fa-2x"></em>
</a>
<a href="https://www.linkedin.com/shareArticle?{{ {'mini': 'true', 'url': pageUrl, 'title': session.getName() }|url_encode }}"
target="_blank" class="btn bnt-link btn-lg">
<em class="fa fa-linkedin fa-2x"></em>
</a>
<div class="page-header">
<h3>{{ 'ServiceInformation'|get_plugin_lang('BuyCoursesPlugin') }}</h3>
</div>
<div class="service-information">
{{ service.service_information }}
</div>
</div>
</div>

@ -0,0 +1,83 @@
<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-12">
<div class="panel panel-default panel-box-buy">
<div class="panel-body">
<div class="buy-info">
{% if buying_service %}
<div class="row">
<div class="col-md-3">
<a href='{{ _p.web }}service/{{ service.id }}'>
<img alt="{{ service.name }}" class="img-rounded img-responsive"
src="{{ service.image ? service.image : 'session_default.png'|icon() }}">
</a>
<div class="price">
{{ 'Total'|get_plugin_lang('BuyCoursesPlugin')}} :
{{ service.currency == 'BRL' ? 'R$' : service.currency }} {{ service.price }}
</div>
</div>
<div class="col-md-9">
<div class="buy-item">
<h3 class="title">
<a href='{{ _p.web }}service/{{ service.id }}'>{{ service.name }}</a>
</h3>
{% if service.description %}
<div class="description">
{{ service.description }}
</div>
{% endif %}
<ul class="fa-ul list-description">
{% if service.applies_to %}
<li>
<em class="fa-li fa fa-hand-o-right" aria-hidden="true"></em>
{% if service.applies_to == 0 %}
{{ 'AppliesTo'|get_plugin_lang('BuyCoursesPlugin') ~ ' ' ~ 'None'|get_lang }}
{% elseif service.applies_to == 1 %}
{{ 'AppliesTo'|get_plugin_lang('BuyCoursesPlugin') ~ ' ' ~ 'User'|get_lang }}
{% elseif service.applies_to == 2 %}
{{ 'AppliesTo'|get_plugin_lang('BuyCoursesPlugin') ~ ' ' ~ 'Course'|get_lang }}
{% elseif service.applies_to == 3 %}
{{ 'AppliesTo'|get_plugin_lang('BuyCoursesPlugin') ~ ' ' ~ 'Session'|get_lang }}
{% elseif service.applies_to == 4 %}
{{ 'AppliesTo'|get_plugin_lang('BuyCoursesPlugin') ~ ' ' ~ 'TemplateTitleCertificate'|get_lang }}
{% endif %}
</li>
{% endif %}
<li>
<em class="fa-li fa fa-money" aria-hidden="true"></em>
{{ 'Price'|get_plugin_lang('BuyCoursesPlugin') }}
: {{ service.currency == 'BRL' ? 'R$' : service.currency }} {{ service.price }}
/ {{ service.duration_days == 0 ? 'NoLimit'|get_lang : service.duration_days ~ ' ' ~ 'Days'|get_lang }}
</li>
<li><em class="fa-li fa fa-user" aria-hidden="true"></em> {{ service.owner_name }}</li>
</ul>
</div>
</div>
</div>
{% endif %}
</div>
<div class="buy-summary">
<h3>{{ 'PaymentMethods'|get_plugin_lang('BuyCoursesPlugin') }}</h3>
{{ form }}
</div>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function () {
$("label").removeClass('control-label');
$('.form_required').remove();
$("small").remove();
$("label[for=submit]").remove();
});
</script>

@ -0,0 +1,55 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Class DictionaryPlugin.
*/
class DictionaryPlugin extends Plugin
{
/**
* DictionaryPlugin constructor.
*/
protected function __construct()
{
parent::__construct(
'1.0',
'Julio Montoya',
[
'enable_plugin_dictionary' => 'boolean',
]
);
}
/**
* @return DictionaryPlugin|null
*/
public static function create()
{
static $result = null;
return $result ? $result : $result = new self();
}
/**
* Installation process.
*/
public function install()
{
$sql = "CREATE TABLE IF NOT EXISTS plugin_dictionary (
id INT NOT NULL AUTO_INCREMENT,
term VARCHAR(255) NOT NULL,
definition LONGTEXT NOT NULL,
PRIMARY KEY (id));
";
Database::query($sql);
}
/**
* Uninstall process.
*/
public function uninstall()
{
$sql = "DROP TABLE IF EXISTS plugin_dictionary";
Database::query($sql);
}
}

@ -0,0 +1,2 @@
<?php
/* For license terms, see /license.txt */

@ -0,0 +1,7 @@
<?php
/* For license terms, see /license.txt */
if (!api_is_platform_admin()) {
die('You must have admin permissions to install plugins');
}
DictionaryPlugin::create()->install();

@ -0,0 +1,7 @@
<?php
$strings['plugin_title'] = "Extensible Dictionary";
$strings['plugin_comment'] = "This plugin allows the admins to add terms and definitions.";
$strings['enable_plugin_dictionary'] = "Enable plugin";
$strings['Term'] = "Term";
$strings['Definition'] = "Definition";

@ -0,0 +1,4 @@
<?php
/* For license terms, see /license.txt */
$plugin_info = DictionaryPlugin::create()->get_info();

@ -0,0 +1,85 @@
<?php
/* For licensing terms, see /license.txt */
require_once __DIR__.'/../../main/inc/global.inc.php';
api_protect_admin_script();
$plugin = DictionaryPlugin::create();
$table = 'plugin_dictionary';
$sql = "SELECT * FROM $table ORDER BY TERM";
$result = Database::query($sql);
$terms = Database::store_result($result, 'ASSOC');
$action = isset($_GET['action']) ? Security::remove_XSS($_GET['action']) : 'add';
$id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
$term = null;
if (!empty($id)) {
$sql = "SELECT * FROM $table WHERE id = $id";
$result = Database::query($sql);
$term = Database::fetch_array($result, 'ASSOC');
if (empty($term)) {
api_not_allowed(true);
}
}
$form = new FormValidator('dictionary', 'post', api_get_self().'?action='.$action.'&id='.$id);
$form->addText('term', $plugin->get_lang('Term'), true);
$form->addTextarea('definition', $plugin->get_lang('Definition'), [], true);
//$form->addHtmlEditor('definition', get_lang('Definition'), true);
$form->addButtonSave(get_lang('Save'));
switch ($action) {
case 'add':
if ($form->validate()) {
$values = $form->getSubmitValues();
$params = [
'term' => $values['term'],
'definition' => $values['definition'],
];
$result = Database::insert($table, $params);
if ($result) {
Display::addFlash(Display::return_message(get_lang('Added')));
}
header('Location: '.api_get_self());
exit;
}
break;
case 'edit':
$form->setDefaults($term);
if ($form->validate()) {
$values = $form->getSubmitValues();
$params = [
'term' => $values['term'],
'definition' => $values['definition'],
];
Database::update($table, $params, ['id = ?' => $id]);
Display::addFlash(Display::return_message(get_lang('Updated')));
header('Location: '.api_get_self());
exit;
}
break;
case 'delete':
if (!empty($term)) {
Database::delete($table, ['id = ?' => $id]);
Display::addFlash(Display::return_message(get_lang('Deleted')));
header('Location: '.api_get_self());
exit;
}
break;
}
$tpl = new Template($plugin->get_lang('plugin_title'));
$tpl->assign('terms', $terms);
$tpl->assign('form', $form->returnForm());
//$url = api_get_path(WEB_PLUGIN_PATH).'studentfollowup/posts.php?';
//$tpl->assign('post_url', $url);
$content = $tpl->fetch('/'.$plugin->get_name().'/view/terms.html.twig');
// Assign into content
$tpl->assign('content', $content);
// Display
$tpl->display_one_col_template();

@ -0,0 +1,34 @@
{{ form }}
<table class="data_table">
<tr>
<th>
{{ 'Term' | get_plugin_lang('DictionaryPlugin') }}
</th>
<th>
{{ 'Definition' | get_plugin_lang('DictionaryPlugin') }}
</th>
<th>
{{ 'Actions' | get_lang }}
</th>
</tr>
{% for term in terms %}
<tr>
<td>
{{ term.term }}
</td>
<td>
{{ term.definition }}
</td>
<td>
<a href="{{ _p.web_plugin }}dictionary/terms.php?action=edit&{{ {'id': term.id}|url_encode() }}" class="btn btn-success">
<span class="fa fa-edit fa-fw" aria-hidden="true"></span> {{ 'Edit'|get_lang }}
</a>
<a href="{{ _p.web_plugin }}dictionary/terms.php?action=delete&{{ {'id': term.id}|url_encode() }}" class="btn btn-danger">
<span class="fa fa-times fa-fw" aria-hidden="true"></span> {{ 'Delete'|get_lang }}
</a>
</td>
</tr>
{% endfor %}
</table>

@ -99,8 +99,8 @@ class ImsLtiPlugin extends Plugin
/**
* Creates the plugin tables on database
*
* @return boolean
* @throws \Doctrine\DBAL\DBALException
*/
private function createPluginTables()
{
@ -108,35 +108,37 @@ class ImsLtiPlugin extends Plugin
$connection = $entityManager->getConnection();
$pluginSchema = new Schema();
$platform = $connection->getDatabasePlatform();
$toolTable = $pluginSchema->createTable(self::TABLE_TOOL);
$toolTable->addColumn(
'id',
\Doctrine\DBAL\Types\Type::INTEGER,
['autoincrement' => true, 'unsigned' => true]
);
$toolTable->addColumn('name', Type::STRING);
$toolTable->addColumn('description', Type::TEXT)->setNotnull(false);
$toolTable->addColumn('launch_url', Type::TEXT);
$toolTable->addColumn('consumer_key', Type::STRING);
$toolTable->addColumn('shared_secret', Type::STRING);
$toolTable->addColumn('custom_params', Type::TEXT)->setNotnull(false);
$toolTable->addColumn('is_global', Type::BOOLEAN);
$toolTable->setPrimaryKey(['id']);
$queries = $pluginSchema->toSql($platform);
foreach ($queries as $query) {
Database::query($query);
if (!$connection->getSchemaManager()->tablesExist(self::TABLE_TOOL)) {
$toolTable = $pluginSchema->createTable(self::TABLE_TOOL);
$toolTable->addColumn(
'id',
\Doctrine\DBAL\Types\Type::INTEGER,
['autoincrement' => true, 'unsigned' => true]
);
$toolTable->addColumn('name', Type::STRING);
$toolTable->addColumn('description', Type::TEXT)->setNotnull(false);
$toolTable->addColumn('launch_url', Type::TEXT);
$toolTable->addColumn('consumer_key', Type::STRING);
$toolTable->addColumn('shared_secret', Type::STRING);
$toolTable->addColumn('custom_params', Type::TEXT)->setNotnull(false);
$toolTable->addColumn('is_global', Type::BOOLEAN);
$toolTable->setPrimaryKey(['id']);
$queries = $pluginSchema->toSql($platform);
foreach ($queries as $query) {
Database::query($query);
}
}
return true;
}
/**
* Drops the plugin tables on database
*
* @return boolean
* @throws \Doctrine\DBAL\DBALException
*/
private function dropPluginTables()
{
@ -155,7 +157,7 @@ class ImsLtiPlugin extends Plugin
}
/**
* @throws \Doctrine\DBAL\DBALException
*
*/
private function removeTools()
{

@ -7,10 +7,18 @@ Installation
------------
1. Install the plugin from Plugin page
2. Enable the plugin from Plugin Settings page
3. Assign to the Administrator region.
3. Assign to the Administrator region
As platform admin you can register external tools available for all courses.
You need set the tools settings in the IMS/LTI administration page.
Then the registered tools should be add in each course individually.
As teacher you can register external tools available only for the current course.
You need follow the link in the IMS/LTI block located in the Course Settings tool.
Then select a previously tool registered or register a new external tool.
This plugin is meant to be later integrated into Chamilo (in a major version release).
IMS/LTI defines the possibility to integrate tools or content into Chamilo.
This plugin allows the integration of a new tool into courses, without (for now) obtaining any data back from those tools.
It will gradually be developed to support IMS/LTI content items.
It will gradually be developed to support IMS/LTI content items.

@ -6,7 +6,7 @@
*/
if (!api_is_platform_admin()) {
die ('You must have admin permissions to install plugins');
die('You must have admin permissions to install plugins');
}
ImsLtiPlugin::create()->install();

@ -1,12 +1,13 @@
<?php
/* For license terms, see /license.txt */
/**
* Uninstall the MSI/LTI Plugin
* @package chamilo.plugin.ims_lti
*/
if (!api_is_platform_admin()) {
die ('You must have admin permissions to uninstall plugins');
die('You must have admin permissions to uninstall plugins');
}
ImsLtiPlugin::create()->uninstall();

@ -0,0 +1,20 @@
Este plugin da la posibilidad a los profesores de un curso escribir en un bloc de notas compartido.
Los estudiantes no tienen acceso a las notas compartidas de los profesores.
**Instrucciones de puesta en funcionamiento**
- Subir la carpeta **notebookteacher** a la carpeta plugin de chamilo.
- Habilitar el plugin en la administraci&oacute;n de Chamilo.
- El icono de la herramienta aparecer&aacute; en pantalla de los cursos con el resto de herramientas
- Si no se visualiza el icono en el cursos correctamente y sale el icono de plugin gen&eacute;rico:
- Copiar los iconos de la carpeta resources/img/64 dentro de /main/img/icons/64
- Copiar el icono de la carpeta resources/img/22 dentro de /main/img
**Solo si ya tiene instalado el plugin previamente:**
Para actualizar la base de datos del plugin con los &uacute;ltimos cambios de la estructura deber&aacute; poner en su
navegador la siguiente direcci&oacute;n cambiando el nombre del dominio con el que proceda en su caso.
http://*sudominio.com*/**plugin/notebookteacher/update.php**

@ -0,0 +1,10 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Config the plugin.
*
* @package chamilo.plugin.notebookteacher
*
* @author Jose Angel Ruiz <desarrollo@nosolored.com>
*/
require_once __DIR__.'/../../main/inc/global.inc.php';

@ -0,0 +1,46 @@
<?php
/* For license terms, see /license.txt */
/**
* Plugin database installation script. Can only be executed if included
* inside another script loading global.inc.php.
*
* @package chamilo.plugin.notebookteacher
*/
/**
* Check if script can be called.
*/
if (!function_exists('api_get_path')) {
die('This script must be loaded through the Chamilo plugin installer sequence');
}
$entityManager = Database::getManager();
$pluginSchema = new \Doctrine\DBAL\Schema\Schema();
$connection = $entityManager->getConnection();
$platform = $connection->getDatabasePlatform();
if ($pluginSchema->hasTable(NotebookTeacherPlugin::TABLE_NOTEBOOKTEACHER)) {
return;
}
//Create tables
$notebookTable = $pluginSchema->createTable(NotebookTeacherPlugin::TABLE_NOTEBOOKTEACHER);
$notebookTable->addColumn('id', \Doctrine\DBAL\Types\Type::INTEGER, ['autoincrement' => true, 'unsigned' => true]);
$notebookTable->addColumn('c_id', \Doctrine\DBAL\Types\Type::INTEGER, ['unsigned' => true]);
$notebookTable->addColumn('session_id', \Doctrine\DBAL\Types\Type::INTEGER, ['unsigned' => true]);
$notebookTable->addColumn('user_id', \Doctrine\DBAL\Types\Type::INTEGER, ['unsigned' => true]);
$notebookTable->addColumn('student_id', \Doctrine\DBAL\Types\Type::INTEGER, ['unsigned' => true]);
$notebookTable->addColumn('course', \Doctrine\DBAL\Types\Type::STRING);
$notebookTable->addColumn('title', \Doctrine\DBAL\Types\Type::STRING);
$notebookTable->addColumn('description', \Doctrine\DBAL\Types\Type::TEXT);
$notebookTable->addColumn('creation_date', \Doctrine\DBAL\Types\Type::DATETIME);
$notebookTable->addColumn('update_date', \Doctrine\DBAL\Types\Type::DATETIME);
$notebookTable->addColumn('status', \Doctrine\DBAL\Types\Type::INTEGER, ['unsigned' => true]);
$notebookTable->addIndex(['c_id']);
$notebookTable->setPrimaryKey(['id']);
$queries = $pluginSchema->toSql($platform);
foreach ($queries as $query) {
Database::query($query);
}

@ -0,0 +1,3 @@
<?php
/* For license terms, see /license.txt */
require_once 'config.php';

@ -0,0 +1,14 @@
<?php
/* For license terms, see /license.txt */
/**
* This script is included by main/admin/settings.lib.php and generally
* includes things to execute in the main database (settings_current table).
*
* @package chamilo.plugin.notebookteacher
*/
require_once __DIR__.'/config.php';
if (!api_is_platform_admin()) {
die('You must have admin permissions to install plugins');
}
NotebookTeacherPlugin::create()->install();

@ -0,0 +1,14 @@
<?php
$strings['plugin_title'] = "Teacher notes";
$strings['plugin_comment'] = "This plugin allows the teachers of a course to have a shared notebook.
Students do not have access.";
$strings['NotebookTeacher'] = "Teacher notes";
$strings['enable_plugin_notebookteacher'] = "Enable plugin";
$strings['ToolDisabled'] = "The tool is disabled from the administration";
$strings['ToolForTeacher'] = "Exclusive tool for teachers";
$strings['AllStudent'] = "All students";
$strings['StudentFilter'] = "Student filter";
$strings['NoNotebookFilter'] = "No notes created with the current filter";
$strings['NoNotebook'] = "No notes created in the system";
$strings['NoNotebookUser'] = "No notes for this student";
$strings['NotebookNoStudentAssigned'] = "Notes without assigned students";

@ -0,0 +1,14 @@
<?php
$strings['plugin_title'] = "Notas profesores";
$strings['plugin_comment'] = "Este plugin permite a los profesores de un curso tener un bloc de notas compartido.
Alumnos no tienen acceso.";
$strings['NotebookTeacher'] = "Notas profesores";
$strings['enable_plugin_notebookteacher'] = "Activar plugin";
$strings['ToolDisabled'] = "La herramienta está deshabilitada desde la administración";
$strings['ToolForTeacher'] = "Herramienta exclusiva para profesores";
$strings['AllStudent'] = "Todos los estudiantes";
$strings['StudentFilter'] = "Filtro estudiantes";
$strings['NoNotebookFilter'] = "No hay notas creadas con el filtro actual";
$strings['NoNotebook'] = "No hay notas creadas en el sistema";
$strings['NoNotebookUser'] = "No hay notas para este alumno";
$strings['NotebookNoStudentAssigned'] = "Notas sin estudiantes asignados";

@ -0,0 +1,16 @@
<?php
/* For license terms, see /license.txt */
/**
* This script is a configuration file for the date plugin.
* You can use it as a master for other platform plugins (course plugins are slightly different).
* These settings will be used in the administration interface for plugins (Chamilo configuration settings->Plugins).
*
* @package chamilo.plugin.notebookteacher
*/
/**
* Plugin details (must be present).
*/
require_once __DIR__.'/config.php';
$plugin_info = NotebookTeacherPlugin::create()->get_info();

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

@ -0,0 +1,520 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
require_once __DIR__.'/../config.php';
/**
* This class provides methods for the notebook management.
* Include/require it in your code to use its features.
*
* @author Carlos Vargas <litox84@gmail.com>, move code of main/notebook up here
* @author Jose Angel Ruiz <desarrollo@nosolored.com>, adaptation for the plugin
*
* @package chamilo.library
*/
class NotebookTeacher
{
/**
* Constructor.
*/
public function __construct()
{
}
/**
* a little bit of javascript to display a prettier warning when deleting a note.
*
* @author Patrick Cool <patrick.cool@ugent.be>, Ghent University, Belgium
*
* @version januari 2009, dokeos 1.8.6
*
* @return string
*/
public static function javascriptNotebook()
{
return "<script>
function confirmation (name)
{
if (confirm(\" ".get_lang("NoteConfirmDelete")." \"+ name + \" ?\"))
{return true;}
else
{return false;}
}
</script>";
}
/**
* This functions stores the note in the database.
*
* @param array $values
* @param int $userId Optional. The user ID
* @param int $courseId Optional. The course ID
* @param int $sessionId Optional. The session ID
*
* @return bool
*/
public static function saveNote($values, $userId = 0, $courseId = 0, $sessionId = 0)
{
if (!is_array($values) || empty($values['note_title'])) {
return false;
}
// Database table definition
$table = Database::get_main_table(NotebookTeacherPlugin::TABLE_NOTEBOOKTEACHER);
$userId = $userId ?: api_get_user_id();
$courseId = $courseId ?: api_get_course_int_id();
$courseInfo = api_get_course_info_by_id($courseId);
$courseCode = $courseInfo['code'];
$sessionId = $sessionId ?: api_get_session_id();
$now = api_get_utc_datetime();
$params = [
'c_id' => $courseId,
'session_id' => $sessionId,
'user_id' => $userId,
'student_id' => intval($values['student_id']),
'course' => $courseCode,
'title' => $values['note_title'],
'description' => $values['note_comment'],
'creation_date' => $now,
'update_date' => $now,
'status' => 0,
];
$id = Database::insert($table, $params);
if ($id > 0) {
return $id;
}
}
/**
* @param int $notebookId
*
* @return array|mixed
*/
public static function getNoteInformation($notebookId)
{
if (empty($notebookId)) {
return [];
}
// Database table definition
$tableNotebook = Database::get_main_table(NotebookTeacherPlugin::TABLE_NOTEBOOKTEACHER);
$courseId = api_get_course_int_id();
$sql = "SELECT
id AS notebook_id,
title AS note_title,
description AS note_comment,
session_id AS session_id,
student_id AS student_id
FROM $tableNotebook
WHERE c_id = $courseId AND id = '".intval($notebookId)."' ";
$result = Database::query($sql);
if (Database::num_rows($result) != 1) {
return [];
}
return Database::fetch_array($result);
}
/**
* This functions updates the note in the database.
*
* @param array $values
*
* @return bool
*/
public static function updateNote($values)
{
if (!is_array($values) or empty($values['note_title'])) {
return false;
}
// Database table definition
$table = Database::get_main_table(NotebookTeacherPlugin::TABLE_NOTEBOOKTEACHER);
$courseId = api_get_course_int_id();
$sessionId = api_get_session_id();
$params = [
'user_id' => api_get_user_id(),
'student_id' => intval($values['student_id']),
'course' => api_get_course_id(),
'session_id' => $sessionId,
'title' => $values['note_title'],
'description' => $values['note_comment'],
'update_date' => api_get_utc_datetime(),
];
Database::update(
$table,
$params,
[
'c_id = ? AND id = ?' => [
$courseId,
$values['notebook_id'],
],
]
);
return true;
}
/**
* @param int $notebookId
*
* @return bool
*/
public static function deleteNote($notebookId)
{
if (empty($notebookId) || $notebookId != strval(intval($notebookId))) {
return false;
}
// Database table definition
$tableNotebook = Database::get_main_table(NotebookTeacherPlugin::TABLE_NOTEBOOKTEACHER);
$courseId = api_get_course_int_id();
$sql = "DELETE FROM $tableNotebook
WHERE
c_id = $courseId AND
id = '".intval($notebookId)."' AND
user_id = '".api_get_user_id()."'";
$result = Database::query($sql);
if (Database::affected_rows($result) != 1) {
return false;
}
return true;
}
/**
* Display notes.
*/
public static function displayNotes()
{
$plugin = NotebookTeacherPlugin::create();
$userInfo = api_get_user_info();
if (!isset($_GET['direction'])) {
$sortDirection = 'ASC';
$linkSortDirection = 'DESC';
} elseif ($_GET['direction'] == 'ASC') {
$sortDirection = 'ASC';
$linkSortDirection = 'DESC';
} else {
$sortDirection = 'DESC';
$linkSortDirection = 'ASC';
}
$studentId = isset($_GET['student_id']) ? $_GET['student_id'] : null;
$sessionId = api_get_session_id();
$courseCode = api_get_course_id();
$active = isset($_GET['active']) ? $_GET['active'] : null;
$status = STUDENT;
$courseInfo = api_get_course_info();
$courseId = $courseInfo['real_id'];
$currentAccessUrlId = api_get_current_access_url_id();
$sortByfirstName = api_sort_by_first_name();
$type = isset($_REQUEST['type']) ? intval($_REQUEST['type']) : STUDENT;
if (!empty($sessionId)) {
$tableSessionCourseUser = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tableUsers = Database::get_main_table(TABLE_MAIN_USER);
$isWesternNameOrder = api_is_western_name_order();
$sql = "SELECT DISTINCT
user.user_id, ".($isWesternNameOrder
? "user.firstname, user.lastname"
: "user.lastname, user.firstname")."
FROM $tableSessionCourseUser as session_course_user,
$tableUsers as user ";
if (api_is_multiple_url_enabled()) {
$sql .= ' , '.Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER).' au ';
}
$sql .= " WHERE c_id = '$courseId' AND session_course_user.user_id = user.user_id ";
$sql .= ' AND session_id = '.$sessionId;
if (api_is_multiple_url_enabled()) {
$sql .= " AND user.user_id = au.user_id AND access_url_id = $currentAccessUrlId ";
}
// only users no coaches/teachers
if ($type == COURSEMANAGER) {
$sql .= " AND session_course_user.status = 2 ";
} else {
$sql .= " AND session_course_user.status = 0 ";
}
$sql .= $sortByfirstName
? ' ORDER BY user.firstname, user.lastname'
: ' ORDER BY user.lastname, user.firstname';
$rs = Database::query($sql);
$courseUsersList = [];
while ($row = Database::fetch_assoc($rs)) {
$courseUsersList[$row['user_id']] = $row;
}
} else {
$courseUsersList = CourseManager::get_user_list_from_course_code(
$courseCode,
0,
null,
null,
$status,
null,
false,
false,
null,
null,
null,
$active
);
}
$form = new FormValidator('search_student');
// Status
$students = [];
$students[] = $plugin->get_lang('AllStudent');
foreach ($courseUsersList as $key => $userItem) {
$students[$key] = $userItem['firstname'].' '.$userItem['lastname'];
}
$form->addElement(
'select',
'student_filter',
$plugin->get_lang('StudentFilter'),
$students,
[
'id' => 'student_filter',
'onchange' => 'javascript: filter_student();',
]
);
$user_data = ['student_filter' => $studentId];
$form->setDefaults($user_data);
$selectStudent = $form->returnForm();
// action links
echo '<div class="actions">';
if (!api_is_drh()) {
if (!api_is_anonymous()) {
if (api_get_session_id() == 0) {
echo '<a href="index.php?'.api_get_cidreq().'&action=addnote">'.
Display::return_icon(
'new_note.png',
get_lang('NoteAddNew'),
'',
'32'
).'</a>';
} elseif (api_is_allowed_to_session_edit(false, true)) {
echo '<a href="index.php?'.api_get_cidreq().'&action=addnote">'.
Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32').'</a>';
}
} else {
echo '<a href="javascript:void(0)">'.
Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32').'</a>';
}
}
echo '<a href="index.php?'.
api_get_cidreq().
'&action=changeview&view=creation_date&direction='.$linkSortDirection.'&student_id='.$studentId.'">'.
Display::return_icon('notes_order_by_date_new.png', get_lang('OrderByCreationDate'), '', '32').'</a>';
echo '<a href="index.php?'.
api_get_cidreq().
'&action=changeview&view=update_date&direction='.$linkSortDirection.'&student_id='.$studentId.'">'.
Display::return_icon('notes_order_by_date_mod.png', get_lang('OrderByModificationDate'), '', '32').'</a>';
echo '<a href="index.php?'.
api_get_cidreq().
'&action=changeview&view=title&direction='.$linkSortDirection.'&student_id='.$studentId.'">'.
Display::return_icon('notes_order_by_title.png', get_lang('OrderByTitle'), '', '32').'</a>';
echo '</div>';
echo '<div class="row">'.$selectStudent.'</div>';
$view = Session::read('notebook_view');
if (!isset($view) ||
!in_array($view, ['creation_date', 'update_date', 'title'])
) {
Session::write('notebook_view', 'creation_date');
}
$view = Session::read('notebook_view');
// Database table definition
$tableNotebook = Database::get_main_table(NotebookTeacherPlugin::TABLE_NOTEBOOKTEACHER);
if ($view == 'creation_date' || $view == 'update_date') {
$orderBy = " ORDER BY $view $sortDirection ";
} else {
$orderBy = " ORDER BY $view $sortDirection ";
}
//condition for the session
$session_id = api_get_session_id();
$conditionSession = api_get_session_condition($session_id);
$condExtra = $view == 'update_date' ? " AND update_date <> ''" : " ";
$courseId = api_get_course_int_id();
if ($studentId > 0) {
// Only one student
$conditionStudent = " AND student_id = $studentId";
$sql = "SELECT * FROM $tableNotebook
WHERE
c_id = $courseId
$conditionSession
$conditionStudent
$condExtra $orderBy
";
$first = true;
$result = Database::query($sql);
if (Database::num_rows($result) > 0) {
while ($row = Database::fetch_array($result)) {
if ($first) {
$studentText = '';
if ($row['student_id'] > 0) {
$studentInfo = api_get_user_info($row['student_id']);
$studentText = $studentInfo['complete_name'];
}
echo Display::page_subheader($studentText);
$first = false;
}
// Validation when belongs to a session
$sessionImg = api_get_session_image($row['session_id'], $userInfo['status']);
$updateValue = '';
if ($row['update_date'] != $row['creation_date']) {
$updateValue = ', '.get_lang('UpdateDate').': '.
Display::dateToStringAgoAndLongDate($row['update_date']);
}
$userInfo = api_get_user_info($row['user_id']);
$author = ', '.get_lang('Teacher').': '.$userInfo['complete_name'];
$actions = '';
if (intval($row['user_id']) == api_get_user_id()) {
$actions = '<a href="'.
api_get_self().'?'.
api_get_cidreq().'action=editnote&notebook_id='.$row['id'].'">'.
Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>';
$actions .= '<a href="'.
api_get_self().
'?action=deletenote&notebook_id='.$row['id'].
'" onclick="return confirmation(\''.$row['title'].'\');">'.
Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
}
echo Display::panel(
$row['description'],
$row['title'].$sessionImg.' <div class="pull-right">'.$actions.'</div>',
get_lang('CreationDate').': '.
Display::dateToStringAgoAndLongDate($row['creation_date']).$updateValue.$author
);
}
} else {
echo Display::return_message($plugin->get_lang('NoNotebookUser'), 'warning');
}
} else {
// All students
foreach ($courseUsersList as $key => $userItem) {
$studentId = $key;
$studentText = $userItem['firstname'].' '.$userItem['lastname'];
$conditionStudent = " AND student_id = $studentId";
$sql = "SELECT * FROM $tableNotebook
WHERE
c_id = $courseId
$conditionSession
$conditionStudent
$condExtra $orderBy
";
$result = Database::query($sql);
if (Database::num_rows($result) > 0) {
echo Display::page_subheader($studentText);
while ($row = Database::fetch_array($result)) {
// Validation when belongs to a session
$sessionImg = api_get_session_image($row['session_id'], $userInfo['status']);
$updateValue = '';
if ($row['update_date'] != $row['creation_date']) {
$updateValue = ', '.get_lang('UpdateDate').': '.
Display::dateToStringAgoAndLongDate($row['update_date']);
}
$userInfo = api_get_user_info($row['user_id']);
$author = ', '.get_lang('Teacher').': '.$userInfo['complete_name'];
if (intval($row['user_id']) == api_get_user_id()) {
$actions = '<a href="'.api_get_self().
'?action=editnote&notebook_id='.$row['id'].'&'.api_get_cidreq().'">'.
Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>';
$actions .= '<a href="'.api_get_self().
'?action=deletenote&notebook_id='.$row['id'].
'" onclick="return confirmation(\''.$row['title'].'\');">'.
Display::return_icon(
'delete.png',
get_lang('Delete'),
'',
ICON_SIZE_SMALL
).'</a>';
} else {
$actions = '';
}
echo Display::panel(
$row['description'],
$row['title'].$sessionImg.' <div class="pull-right">'.$actions.'</div>',
get_lang('CreationDate').': '.
Display::dateToStringAgoAndLongDate($row['creation_date']).$updateValue.$author
);
}
}
}
$conditionStudent = " AND student_id = 0";
$sql = "SELECT * FROM $tableNotebook
WHERE
c_id = $courseId
$conditionSession
$conditionStudent
$condExtra $orderBy
";
$result = Database::query($sql);
if (Database::num_rows($result) > 0) {
echo Display::page_subheader($plugin->get_lang('NotebookNoStudentAssigned'));
while ($row = Database::fetch_array($result)) {
// Validation when belongs to a session
$sessionImg = api_get_session_image($row['session_id'], $userInfo['status']);
$updateValue = '';
if ($row['update_date'] != $row['creation_date']) {
$updateValue = ', '.get_lang('UpdateDate').': '.
Display::dateToStringAgoAndLongDate($row['update_date']);
}
$userInfo = api_get_user_info($row['user_id']);
$author = ', '.get_lang('Teacher').': '.$userInfo['complete_name'];
$actions = '';
if (intval($row['user_id']) == api_get_user_id()) {
$actions = '<a href="'.api_get_self().
'?action=editnote&notebook_id='.$row['id'].'&'.api_get_cidreq().'">'.
Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>';
$actions .= '<a href="'.api_get_self().
'?action=deletenote&notebook_id='.$row['id'].
'" onclick="return confirmation(\''.$row['title'].'\');">'.
Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
}
echo Display::panel(
$row['description'],
$row['title'].$sessionImg.' <div class="pull-right">'.$actions.'</div>',
get_lang('CreationDate').': '.
Display::dateToStringAgoAndLongDate($row['creation_date']).$updateValue.$author
);
}
}
}
}
}

@ -0,0 +1,118 @@
<?php
/* For license terms, see /license.txt */
/**
* Plugin class for the NotebookTeacher plugin.
*
* @package chamilo.plugin.notebookteacher
*
* @author Jose Angel Ruiz <desarrollo@nosolored.com>
*/
class NotebookTeacherPlugin extends Plugin
{
const TABLE_NOTEBOOKTEACHER = 'plugin_notebook_teacher';
public $isCoursePlugin = true;
protected function __construct()
{
parent::__construct(
'1.1',
'Jose Angel Ruiz - NoSoloRed (original author), Julio Montoya',
[
'enable_plugin_notebookteacher' => 'boolean',
]
);
$this->isAdminPlugin = true;
}
/**
* @return NotebookTeacherPlugin
*/
public static function create()
{
static $result = null;
return $result ? $result : $result = new self();
}
/**
* This method creates the tables required to this plugin.
*/
public function install()
{
//Installing course settings
$this->install_course_fields_in_all_courses();
$tablesToBeCompared = [self::TABLE_NOTEBOOKTEACHER];
$em = Database::getManager();
$cn = $em->getConnection();
$sm = $cn->getSchemaManager();
$tables = $sm->tablesExist($tablesToBeCompared);
if ($tables) {
return false;
}
$srcfile1 = __DIR__.'/../resources/img/64/notebookteacher.png';
$srcfile2 = __DIR__.'/../resources/img/64/notebookteacher_na.png';
$srcfile3 = __DIR__.'/../resources/img/32/notebookteacher.png';
$srcfile4 = __DIR__.'/../resources/img/22/notebookteacher.png';
$dstfile1 = __DIR__.'/../../../main/img/icons/64/notebookteacher.png';
$dstfile2 = __DIR__.'/../../../main/img/icons/64/notebookteacher_na.png';
$dstfile3 = __DIR__.'/../../../main/img/icons/32/notebookteacher.png';
$dstfile4 = __DIR__.'/../../../main/img/notebookteacher.png';
copy($srcfile1, $dstfile1);
copy($srcfile2, $dstfile2);
copy($srcfile3, $dstfile3);
copy($srcfile4, $dstfile4);
require_once api_get_path(SYS_PLUGIN_PATH).'notebookteacher/database.php';
}
/**
* This method drops the plugin tables.
*/
public function uninstall()
{
// Deleting course settings.
$this->uninstall_course_fields_in_all_courses($this->course_settings);
$tablesToBeDeleted = [self::TABLE_NOTEBOOKTEACHER];
foreach ($tablesToBeDeleted as $tableToBeDeleted) {
$table = Database::get_main_table($tableToBeDeleted);
$sql = "DROP TABLE IF EXISTS $table";
Database::query($sql);
}
$this->manageTab(false);
}
public function update()
{
$tableNotebookTeacher = self::TABLE_NOTEBOOKTEACHER;
$sql = 'SHOW COLUMNS FROM '.$tableNotebookTeacher.' WHERE Field = "student_id"';
$rs = Database::query($sql);
if (Database::num_rows($rs) === 0) {
$sql = "ALTER TABLE ".$tableNotebookTeacher." ADD student_id INT( 10 ) UNSIGNED NOT NULL AFTER user_id";
Database::query($sql);
}
$srcfile1 = __DIR__.'/../resources/img/64/notebookteacher.png';
$srcfile2 = __DIR__.'/../resources/img/64/notebookteacher_na.png';
$srcfile3 = __DIR__.'/../resources/img/32/notebookteacher.png';
$srcfile4 = __DIR__.'/../resources/img/22/notebookteacher.png';
$dstfile1 = __DIR__.'/../../../main/img/icons/64/notebookteacher.png';
$dstfile2 = __DIR__.'/../../../main/img/icons/64/notebookteacher_na.png';
$dstfile3 = __DIR__.'/../../../main/img/icons/32/notebookteacher.png';
$dstfile4 = __DIR__.'/../../../main/img/notebookteacher.png';
copy($srcfile1, $dstfile1);
copy($srcfile2, $dstfile2);
copy($srcfile3, $dstfile3);
copy($srcfile4, $dstfile4);
Display::display_header(get_lang(ucfirst(self::TABLE_NOTEBOOKTEACHER)));
echo 'Plugin actualizado';
Display::display_footer();
}
}

@ -0,0 +1,394 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
$course_plugin = 'notebookteacher';
require_once __DIR__.'/../config.php';
$_setting['student_view_enabled'] = 'false';
$plugin = NotebookTeacherPlugin::create();
$current_course_tool = $plugin->get_lang('NotebookTeacher');
$enable = $plugin->get('enable_plugin_notebookteacher') == 'true';
if ($enable) {
if (api_is_teacher() || api_is_drh()) {
// The section (tabs)
$this_section = SECTION_COURSES;
// Notice for unauthorized people.
api_protect_course_script(true);
$location = 'index.php?'.api_get_cidreq();
// Additional javascript
$htmlHeadXtra[] = NotebookTeacher::javascriptNotebook();
$htmlHeadXtra[] = '<script>
function setFocus(){
$("#note_title").focus();
}
$(document).ready(function () {
setFocus();
});
function filter_student() {
var student_id = $("#student_filter").val();
location.href ="'.$location.'&student_id="+student_id;
}
</script>';
// Setting the tool constants
$tool = $plugin->get_lang('NotebookTeacher');
// Tracking
Event::event_access_tool('notebookteacher');
$action = isset($_GET['action']) ? $_GET['action'] : '';
// Tool name
if ($action === 'addnote') {
$tool = 'NoteAddNew';
$interbreadcrumb[] = [
'url' => 'index.php?'.api_get_cidreq(),
'name' => $plugin->get_lang('NotebookTeacher'),
];
}
if ($action === 'editnote') {
$tool = 'ModifyNote';
$interbreadcrumb[] = [
'url' => 'index.php?'.api_get_cidreq(),
'name' => $plugin->get_lang('NotebookTeacher'),
];
}
// Displaying the header
Display::display_header(get_lang(ucfirst($tool)));
// Tool introduction
Display::display_introduction_section($plugin->get_lang('NotebookTeacher'));
// Action handling: Adding a note
if ($action === 'addnote') {
if ((api_get_session_id() != 0 &&
!api_is_allowed_to_session_edit(false, true) || api_is_drh())) {
api_not_allowed();
}
Session::write('notebook_view', 'creation_date');
$form = new FormValidator(
'note',
'post',
api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&'.api_get_cidreq()
);
// Setting the form elements
$form->addElement('header', '', get_lang('NoteAddNew'));
$form->addElement('text', 'note_title', get_lang('NoteTitle'), ['id' => 'note_title']);
$student_id = isset($_GET['student_id']) ? $_GET['student_id'] : null;
$sessionId = api_get_session_id();
$courseCode = api_get_course_id();
$active = isset($_GET['active']) ? $_GET['active'] : null;
$status = STUDENT;
$course_info = api_get_course_info();
$courseId = $course_info['real_id'];
$current_access_url_id = api_get_current_access_url_id();
$sort_by_first_name = api_sort_by_first_name();
if (!empty($sessionId)) {
$table_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$table_users = Database::get_main_table(TABLE_MAIN_USER);
$sql = "SELECT DISTINCT
user.user_id, ".($is_western_name_order
? "user.firstname, user.lastname"
: "user.lastname, user.firstname")."
FROM $table_session_course_user as session_course_user,
$table_users as user ";
if (api_is_multiple_url_enabled()) {
$sql .= ' , '.Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER).' au ';
}
$sql .= " WHERE c_id = '$courseId' AND session_course_user.user_id = user.user_id ";
$sql .= ' AND session_id = '.$sessionId;
if (api_is_multiple_url_enabled()) {
$sql .= " AND user.user_id = au.user_id AND access_url_id = $current_access_url_id ";
}
// only users no coaches/teachers
if ($type == COURSEMANAGER) {
$sql .= " AND session_course_user.status = 2 ";
} else {
$sql .= " AND session_course_user.status = 0 ";
}
$sql .= $sort_by_first_name
? ' ORDER BY user.firstname, user.lastname'
: ' ORDER BY user.lastname, user.firstname';
$rs = Database::query($sql);
$a_course_users = [];
while ($row = Database::fetch_assoc($rs)) {
$a_course_users[$row['user_id']] = $row;
}
} else {
$a_course_users = CourseManager::get_user_list_from_course_code(
$courseCode,
0,
null,
null,
$status,
null,
false,
false,
null,
null,
null,
$active
);
}
$studentList = [];
$studentList[0] = '';
foreach ($a_course_users as $key => $user_item) {
$studentList[$key] = $user_item['firstname'].' '.$user_item['lastname'];
}
$form->addElement(
'select',
'student_id',
get_lang('Student'),
$studentList,
[
'id' => 'student_id',
]
);
$form->addElement(
'html_editor',
'note_comment',
get_lang('NoteComment'),
null,
api_is_allowed_to_edit()
? ['ToolbarSet' => 'Notebook', 'Width' => '100%', 'Height' => '300']
: ['ToolbarSet' => 'NotebookStudent', 'Width' => '100%', 'Height' => '300', 'UserStatus' => 'student']
);
$form->addButtonCreate(get_lang('AddNote'), 'SubmitNote');
// Setting the rules
$form->addRule('note_title', get_lang('ThisFieldIsRequired'), 'required');
// The validation or display
if ($form->validate()) {
$check = Security::check_token('post');
if ($check) {
$values = $form->exportValues();
$res = NotebookTeacher::saveNote($values);
if ($res) {
echo Display::return_message(get_lang('NoteAdded'), 'confirmation');
}
}
Security::clear_token();
NotebookTeacher::displayNotes();
} else {
echo '<div class="actions">';
echo '<a href="index.php">'.
Display::return_icon('back.png', get_lang('BackToNotesList'), '', ICON_SIZE_MEDIUM).
'</a>';
echo '</div>';
$token = Security::get_token();
$form->addElement('hidden', 'sec_token');
$form->setConstants(['sec_token' => $token]);
$form->display();
}
} elseif ($action === 'editnote' && is_numeric($_GET['notebook_id'])) {
// Action handling: Editing a note
if (!empty($_GET['isStudentView']) || api_is_drh()) {
NotebookTeacher::displayNotes();
exit;
}
// Initialize the object
$form = new FormValidator(
'note',
'post',
api_get_self().'?action='.Security::remove_XSS($_GET['action']).
'&notebook_id='.intval($_GET['notebook_id']).'&'.api_get_cidreq()
);
// Setting the form elements
$form->addElement('header', '', get_lang('ModifyNote'));
$form->addElement('hidden', 'notebook_id');
$form->addElement('text', 'note_title', get_lang('NoteTitle'), ['size' => '100']);
$sessionId = api_get_session_id();
$courseCode = api_get_course_id();
$active = isset($_GET['active']) ? $_GET['active'] : null;
$status = STUDENT;
$student_id = isset($_GET['student_id']) ? $_GET['student_id'] : null;
$course_info = api_get_course_info();
$courseId = $course_info['real_id'];
$current_access_url_id = api_get_current_access_url_id();
$sort_by_first_name = api_sort_by_first_name();
if (!empty($sessionId)) {
$table_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$table_users = Database::get_main_table(TABLE_MAIN_USER);
$sql = "SELECT DISTINCT
user.user_id, ".($is_western_name_order
? "user.firstname, user.lastname"
: "user.lastname, user.firstname")."
FROM $table_session_course_user as session_course_user,
$table_users as user ";
if (api_is_multiple_url_enabled()) {
$sql .= ' , '.Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER).' au ';
}
$sql .= " WHERE c_id = '$courseId' AND session_course_user.user_id = user.user_id ";
$sql .= ' AND session_id = '.$sessionId;
if (api_is_multiple_url_enabled()) {
$sql .= " AND user.user_id = au.user_id AND access_url_id = $current_access_url_id ";
}
// only users no coaches/teachers
if ($type == COURSEMANAGER) {
$sql .= " AND session_course_user.status = 2 ";
} else {
$sql .= " AND session_course_user.status = 0 ";
}
$sql .= $sort_by_first_name
? ' ORDER BY user.firstname, user.lastname'
: ' ORDER BY user.lastname, user.firstname';
$rs = Database::query($sql);
$a_course_users = [];
while ($row = Database::fetch_assoc($rs)) {
$a_course_users[$row['user_id']] = $row;
}
} else {
$a_course_users = CourseManager::get_user_list_from_course_code(
$courseCode,
0,
null,
null,
$status,
null,
false,
false,
null,
null,
null,
$active
);
}
$studentList = [];
$studentList[0] = '';
foreach ($a_course_users as $key => $user_item) {
$studentList[$key] = $user_item['firstname'].' '.$user_item['lastname'];
}
$form->addElement(
'select',
'student_id',
get_lang('Student'),
$studentList,
[
'id' => 'student_id',
]
);
$form->addElement(
'html_editor',
'note_comment',
get_lang('NoteComment'),
null,
api_is_allowed_to_edit()
? ['ToolbarSet' => 'Notebook', 'Width' => '100%', 'Height' => '300']
: ['ToolbarSet' => 'NotebookStudent', 'Width' => '100%', 'Height' => '300', 'UserStatus' => 'student']
);
$form->addButtonUpdate(get_lang('ModifyNote'), 'SubmitNote');
// Setting the defaults
$defaults = NotebookTeacher::getNoteInformation(Security::remove_XSS($_GET['notebook_id']));
$form->setDefaults($defaults);
// Setting the rules
$form->addRule('note_title', get_lang('ThisFieldIsRequired'), 'required');
// The validation or display
if ($form->validate()) {
$check = Security::check_token('post');
if ($check) {
$values = $form->exportValues();
$res = NotebookTeacher::updateNote($values);
if ($res) {
echo Display::return_message(get_lang('NoteUpdated'), 'confirmation');
}
}
Security::clear_token();
NotebookTeacher::displayNotes();
} else {
echo '<div class="actions">';
echo '<a href="index.php">'.
Display::return_icon('back.png', get_lang('BackToNotesList'), '', ICON_SIZE_MEDIUM).'</a>';
echo '</div>';
$token = Security::get_token();
$form->addElement('hidden', 'sec_token');
$form->setConstants(['sec_token' => $token]);
$form->display();
}
} elseif ($action === 'deletenote' && is_numeric($_GET['notebook_id'])) {
// Action handling: deleting a note
$res = NotebookTeacher::deleteNote($_GET['notebook_id']);
if ($res) {
echo Display::return_message(get_lang('NoteDeleted'), 'confirmation');
}
NotebookTeacher::displayNotes();
} elseif ($action === 'changeview' && in_array($_GET['view'], ['creation_date', 'update_date', 'title'])) {
// Action handling: changing the view (sorting order)
switch ($_GET['view']) {
case 'creation_date':
if (!$_GET['direction'] || $_GET['direction'] == 'ASC') {
echo Display::return_message(get_lang('NotesSortedByCreationDateAsc'), 'confirmation');
} else {
echo Display::return_message(get_lang('NotesSortedByCreationDateDESC'), 'confirmation');
}
break;
case 'update_date':
if (!$_GET['direction'] || $_GET['direction'] == 'ASC') {
echo Display::return_message(get_lang('NotesSortedByUpdateDateAsc'), 'confirmation');
} else {
echo Display::return_message(get_lang('NotesSortedByUpdateDateDESC'), 'confirmation');
}
break;
case 'title':
if (!$_GET['direction'] || $_GET['direction'] == 'ASC') {
echo Display::return_message(get_lang('NotesSortedByTitleAsc'), 'confirmation');
} else {
echo Display::return_message(get_lang('NotesSortedByTitleDESC'), 'confirmation');
}
break;
}
Session::write('notebook_view', Security::remove_XSS($_GET['view']));
NotebookTeacher::displayNotes();
} else {
NotebookTeacher::displayNotes();
}
Display::display_footer();
} else {
$session = api_get_session_entity(api_get_session_id());
$_course = api_get_course_info();
$web_course_path = api_get_path(WEB_COURSE_PATH);
$url = $web_course_path.$_course['path'].'/index.php'.($session ? '?id_session='.$session->getId() : '');
Display::addFlash(
Display::return_message($plugin->get_lang('ToolForTeacher'))
);
header('Location: '.$url);
exit;
}
} else {
echo $plugin->get_lang('ToolDisabled');
}

@ -0,0 +1,33 @@
<?php
/**
* This script initiates a notebookteacher plugin.
*
* @package chamilo.plugin.notebookteacher
*/
$course_plugin = 'notebookteacher';
require_once __DIR__.'/config.php';
$plugin = NotebookTeacherPlugin::create();
$enable = $plugin->get('enable_plugin_notebookteacher') == 'true';
if ($enable) {
if (api_is_teacher() || api_is_drh()) {
$url = 'src/index.php?'.api_get_cidreq();
header('Location: '.$url);
exit;
} else {
$session = api_get_session_entity(api_get_session_id());
$_course = api_get_course_info();
$webCoursePath = api_get_path(WEB_COURSE_PATH);
$url = $webCoursePath.$_course['path'].'/index.php'.($session ? '?id_session='.$session->getId() : '');
Display::addFlash(
Display::return_message($plugin->get_lang('ToolForTeacher'))
);
header('Location: '.$url);
exit;
}
} else {
api_not_allowed(true, $plugin->get_lang('ToolDisabled'));
}

@ -0,0 +1,12 @@
<?php
/* For license terms, see /license.txt */
/**
* This script is included by main/admin/settings.lib.php when unselecting a plugin
* and is meant to remove things installed by the install.php script in both
* the global database and the courses tables.
*
* @package chamilo.plugin.notebookteacher
*/
require_once __DIR__.'/config.php';
NotebookTeacherPlugin::create()->uninstall();

@ -0,0 +1,14 @@
<?php
/* For license terms, see /license.txt */
/**
* This script is included by main/admin/settings.lib.php and generally
* includes things to execute in the main database (settings_current table).
*
* @package chamilo.plugin.notebookteacher
*/
require_once __DIR__.'/config.php';
if (!api_is_platform_admin()) {
die('You must have admin permissions to install plugins');
}
NotebookTeacherPlugin::create()->update();

@ -70,9 +70,7 @@ class RedirectionPlugin extends Plugin
/**
* Get the current redirection for a given user (if any).
*
* @param $userId
*
* @throws \Doctrine\DBAL\DBALException
* @param int $userId
*
* @return array
*/

@ -100,7 +100,10 @@ class HookResubscription extends HookObserver implements HookResubscribeObserver
$endDate = $userSessionCourses[$currentSessionCourse['c_id']];
$resubscriptionDate = gmdate($limitDateFormat, strtotime($endDate." +$resubscriptionOffset"));
$icon = Display::return_icon('students.gif', get_lang('Student'));
$canResubscribeFrom = sprintf(get_plugin_lang('CanResubscribeFromX', 'resubscription'), $resubscriptionDate);
$canResubscribeFrom = sprintf(
get_plugin_lang('CanResubscribeFromX', 'resubscription'),
$resubscriptionDate
);
throw new Exception(Display::label($icon.' '.$canResubscribeFrom, "info"));
}
}

@ -0,0 +1,26 @@
v2.1 - 2018-04-05
=================
- Fix: SEPE plugin foreign key constraint fails [#2461](https://github.com/chamilo/chamilo-lms/issues/2461)
##### Database changes
You need execute these SQL queries in your database.
```sql
ALTER TABLE plugin_sepe_participants MODIFY company_tutor_id INT( 10 ) UNSIGNED NULL;
ALTER TABLE plugin_sepe_participants MODIFY training_tutor_id INT( 10 ) UNSIGNED NULL;
```
v2.0 - 2017-05-23
=================
This version has been fixed and improved for Chamilo LMS 1.11.x.
Upgrade procedure
-----------------
If you are working with this plugin since earlier versions, you will have to
look at the installer to *fix* your plugin tables (add a few fields).
http://*yourdominio.com*/**plugin/sepe/update.php**
v1.0 - 2016-11-14
=================
This is the first release of the plugin, valid for Chamilo LMS 1.10.x

@ -470,12 +470,12 @@ $sepeParticipantsTable->addColumn(
$sepeParticipantsTable->addColumn(
'company_tutor_id',
\Doctrine\DBAL\Types\Type::INTEGER,
['unsigned' => true]
['unsigned' => true, 'notnull' => false]
);
$sepeParticipantsTable->addColumn(
'training_tutor_id',
\Doctrine\DBAL\Types\Type::INTEGER,
['unsigned' => true]
['unsigned' => true, 'notnull' => false]
);
$sepeParticipantsTable->setPrimaryKey(['id']);
$sepeParticipantsTable->addForeignKeyConstraint(

@ -33,10 +33,10 @@ class SepePlugin extends Plugin
protected function __construct()
{
parent::__construct(
'2.0',
'
Jose Angel Ruiz - NoSoloRed (original author) <br>
Julio Montoya (SOAP integration)
'2.1',
'
Jose Angel Ruiz - NoSoloRed (original author) <br>
Julio Montoya (SOAP integration)
',
['sepe_enable' => 'boolean']
);
@ -120,7 +120,7 @@ class SepePlugin extends Plugin
}
/**
* @throws \Doctrine\DBAL\DBALException
* Update.
*/
public function update()
{
@ -134,225 +134,326 @@ class SepePlugin extends Plugin
Database::query($sql);
$sepeCourseActionsTable = self::TABLE_SEPE_COURSE_ACTIONS;
$sql = "ALTER TABLE ".$sepeCourseActionsTable." CHANGE `cod` `id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT";
$sql = "ALTER TABLE ".$sepeCourseActionsTable."
CHANGE `cod` `id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeCourseActionsTable." CHANGE `cod_action` `action_id` INT( 10 ) UNSIGNED NOT NULL";
$sql = "ALTER TABLE ".$sepeCourseActionsTable."
CHANGE `cod_action` `action_id` INT( 10 ) UNSIGNED NOT NULL";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeCourseActionsTable." CHANGE `id_course` `course_id` INT( 10 ) UNSIGNED NOT NULL";
$sql = "ALTER TABLE ".$sepeCourseActionsTable."
CHANGE `id_course` `course_id` INT( 10 ) UNSIGNED NOT NULL";
Database::query($sql);
$sepeActionsTable = self::TABLE_SEPE_ACTIONS;
$sql = "ALTER TABLE ".$sepeActionsTable." CHANGE `cod` `id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT";
$sql = "ALTER TABLE ".$sepeActionsTable."
CHANGE `cod` `id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeActionsTable." CHANGE `ORIGEN_ACCION` `action_origin` VARCHAR(2)";
$sql = "ALTER TABLE ".$sepeActionsTable."
CHANGE `ORIGEN_ACCION` `action_origin` VARCHAR(2)";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeActionsTable." CHANGE `CODIGO_ACCION` `action_code` VARCHAR(30)";
$sql = "ALTER TABLE ".$sepeActionsTable."
CHANGE `CODIGO_ACCION` `action_code` VARCHAR(30)";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeActionsTable." CHANGE `SITUACION` `situation` VARCHAR(2)";
$sql = "ALTER TABLE ".$sepeActionsTable."
CHANGE `SITUACION` `situation` VARCHAR(2)";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeActionsTable." CHANGE `ORIGEN_ESPECIALIDAD` `specialty_origin` VARCHAR(2)";
$sql = "ALTER TABLE ".$sepeActionsTable."
CHANGE `ORIGEN_ESPECIALIDAD` `specialty_origin` VARCHAR(2)";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeActionsTable." CHANGE `AREA_PROFESIONAL` `professional_area` VARCHAR(4)";
$sql = "ALTER TABLE ".$sepeActionsTable."
CHANGE `AREA_PROFESIONAL` `professional_area` VARCHAR(4)";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeActionsTable." CHANGE `CODIGO_ESPECIALIDAD` `specialty_code` VARCHAR(14)";
$sql = "ALTER TABLE ".$sepeActionsTable."
CHANGE `CODIGO_ESPECIALIDAD` `specialty_code` VARCHAR(14)";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeActionsTable." CHANGE `DURACION` `duration` INT( 10 ) UNSIGNED";
$sql = "ALTER TABLE ".$sepeActionsTable."
CHANGE `DURACION` `duration` INT( 10 ) UNSIGNED";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeActionsTable." CHANGE `FECHA_INICIO` `start_date` DATE NULL";
$sql = "ALTER TABLE ".$sepeActionsTable."
CHANGE `FECHA_INICIO` `start_date` DATE NULL";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeActionsTable." CHANGE `FECHA_FIN` `end_date` DATE";
$sql = "ALTER TABLE ".$sepeActionsTable."
CHANGE `FECHA_FIN` `end_date` DATE";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeActionsTable." CHANGE `IND_ITINERARIO_COMPLETO` `full_itinerary_indicator` VARCHAR(2)";
$sql = "ALTER TABLE ".$sepeActionsTable."
CHANGE `IND_ITINERARIO_COMPLETO` `full_itinerary_indicator` VARCHAR(2)";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeActionsTable." CHANGE `TIPO_FINANCIACION` `financing_type` VARCHAR(2)";
$sql = "ALTER TABLE ".$sepeActionsTable."
CHANGE `TIPO_FINANCIACION` `financing_type` VARCHAR(2)";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeActionsTable." CHANGE `NUMERO_ASISTENTES` `attendees_count` INT( 10 ) UNSIGNED";
$sql = "ALTER TABLE ".$sepeActionsTable."
CHANGE `NUMERO_ASISTENTES` `attendees_count` INT( 10 ) UNSIGNED";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeActionsTable." CHANGE `DENOMINACION_ACCION` `action_name` VARCHAR(50)";
$sql = "ALTER TABLE ".$sepeActionsTable."
CHANGE `DENOMINACION_ACCION` `action_name` VARCHAR(50)";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeActionsTable." CHANGE `INFORMACION_GENERAL` `global_info` LONGTEXT";
$sql = "ALTER TABLE ".$sepeActionsTable."
CHANGE `INFORMACION_GENERAL` `global_info` LONGTEXT";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeActionsTable." CHANGE `HORARIOS` `schedule` LONGTEXT";
$sql = "ALTER TABLE ".$sepeActionsTable."
CHANGE `HORARIOS` `schedule` LONGTEXT";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeActionsTable." CHANGE `REQUISITOS` `requirements` LONGTEXT";
$sql = "ALTER TABLE ".$sepeActionsTable."
CHANGE `REQUISITOS` `requirements` LONGTEXT";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeActionsTable." CHANGE `CONTACTO_ACCION` `contact_action` LONGTEXT";
$sql = "ALTER TABLE ".$sepeActionsTable."
CHANGE `CONTACTO_ACCION` `contact_action` LONGTEXT";
Database::query($sql);
$sepeSpecialtyTable = self::TABLE_SEPE_SPECIALTY;
$sql = "ALTER TABLE ".$sepeSpecialtyTable." CHANGE `cod` `id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT";
$sql = "ALTER TABLE ".$sepeSpecialtyTable."
CHANGE `cod` `id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeSpecialtyTable." CHANGE `cod_action` `action_id` INT( 10 ) UNSIGNED NOT NULL";
$sql = "ALTER TABLE ".$sepeSpecialtyTable."
CHANGE `cod_action` `action_id` INT( 10 ) UNSIGNED NOT NULL";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeSpecialtyTable." CHANGE `ORIGEN_ESPECIALIDAD` `specialty_origin` VARCHAR(2)";
$sql = "ALTER TABLE ".$sepeSpecialtyTable."
CHANGE `ORIGEN_ESPECIALIDAD` `specialty_origin` VARCHAR(2)";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeSpecialtyTable." CHANGE `AREA_PROFESIONAL` `professional_area` VARCHAR(4)";
$sql = "ALTER TABLE ".$sepeSpecialtyTable."
CHANGE `AREA_PROFESIONAL` `professional_area` VARCHAR(4)";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeSpecialtyTable." CHANGE `CODIGO_ESPECIALIDAD` `specialty_code` VARCHAR(14)";
$sql = "ALTER TABLE ".$sepeSpecialtyTable."
CHANGE `CODIGO_ESPECIALIDAD` `specialty_code` VARCHAR(14)";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeSpecialtyTable." CHANGE `ORIGEN_CENTRO` `center_origin` VARCHAR(2)";
$sql = "ALTER TABLE ".$sepeSpecialtyTable."
CHANGE `ORIGEN_CENTRO` `center_origin` VARCHAR(2)";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeSpecialtyTable." CHANGE `CODIGO_CENTRO` `center_code` VARCHAR(16)";
$sql = "ALTER TABLE ".$sepeSpecialtyTable."
CHANGE `CODIGO_CENTRO` `center_code` VARCHAR(16)";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeSpecialtyTable." CHANGE `FECHA_INICIO` `start_date` DATE";
$sql = "ALTER TABLE ".$sepeSpecialtyTable."
CHANGE `FECHA_INICIO` `start_date` DATE";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeSpecialtyTable." CHANGE `FECHA_FIN` `end_date` DATE";
$sql = "ALTER TABLE ".$sepeSpecialtyTable."
CHANGE `FECHA_FIN` `end_date` DATE";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeSpecialtyTable." CHANGE `MODALIDAD_IMPARTICION` `modality_impartition` VARCHAR(2)";
$sql = "ALTER TABLE ".$sepeSpecialtyTable."
CHANGE `MODALIDAD_IMPARTICION` `modality_impartition` VARCHAR(2)";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeSpecialtyTable." CHANGE `HORAS_PRESENCIAL` `classroom_hours` INT( 10 ) UNSIGNED";
$sql = "ALTER TABLE ".$sepeSpecialtyTable."
CHANGE `HORAS_PRESENCIAL` `classroom_hours` INT( 10 ) UNSIGNED";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeSpecialtyTable." CHANGE `HORAS_TELEFORMACION` `distance_hours` INT( 10 ) UNSIGNED";
$sql = "ALTER TABLE ".$sepeSpecialtyTable."
CHANGE `HORAS_TELEFORMACION` `distance_hours` INT( 10 ) UNSIGNED";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeSpecialtyTable." CHANGE `HM_NUM_PARTICIPANTES` `mornings_participants_number` INT( 10 ) UNSIGNED";
$sql = "ALTER TABLE ".$sepeSpecialtyTable."
CHANGE `HM_NUM_PARTICIPANTES` `mornings_participants_number` INT( 10 ) UNSIGNED";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeSpecialtyTable." CHANGE `HM_NUMERO_ACCESOS` `mornings_access_number` INT( 10 ) UNSIGNED";
$sql = "ALTER TABLE ".$sepeSpecialtyTable."
CHANGE `HM_NUMERO_ACCESOS` `mornings_access_number` INT( 10 ) UNSIGNED";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeSpecialtyTable." CHANGE `HM_DURACION_TOTAL` `morning_total_duration` INT( 10 ) UNSIGNED";
$sql = "ALTER TABLE ".$sepeSpecialtyTable."
CHANGE `HM_DURACION_TOTAL` `morning_total_duration` INT( 10 ) UNSIGNED";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeSpecialtyTable." CHANGE `HT_NUM_PARTICIPANTES` `afternoon_participants_number` INT( 10 ) UNSIGNED";
$sql = "ALTER TABLE ".$sepeSpecialtyTable."
CHANGE `HT_NUM_PARTICIPANTES` `afternoon_participants_number` INT( 10 ) UNSIGNED";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeSpecialtyTable." CHANGE `HT_NUMERO_ACCESOS` `afternoon_access_number` INT( 10 ) UNSIGNED";
$sql = "ALTER TABLE ".$sepeSpecialtyTable."
CHANGE `HT_NUMERO_ACCESOS` `afternoon_access_number` INT( 10 ) UNSIGNED";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeSpecialtyTable." CHANGE `HT_DURACION_TOTAL` `afternoon_total_duration` INT( 10 ) UNSIGNED";
$sql = "ALTER TABLE ".$sepeSpecialtyTable."
CHANGE `HT_DURACION_TOTAL` `afternoon_total_duration` INT( 10 ) UNSIGNED";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeSpecialtyTable." CHANGE `HN_NUM_PARTICIPANTES` `night_participants_number` INT( 10 ) UNSIGNED";
$sql = "ALTER TABLE ".$sepeSpecialtyTable."
CHANGE `HN_NUM_PARTICIPANTES` `night_participants_number` INT( 10 ) UNSIGNED";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeSpecialtyTable." CHANGE `HN_NUMERO_ACCESOS` `night_access_number` INT( 10 ) UNSIGNED";
$sql = "ALTER TABLE ".$sepeSpecialtyTable."
CHANGE `HN_NUMERO_ACCESOS` `night_access_number` INT( 10 ) UNSIGNED";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeSpecialtyTable." CHANGE `HN_DURACION_TOTAL` `night_total_duration` INT( 10 ) UNSIGNED";
$sql = "ALTER TABLE ".$sepeSpecialtyTable."
CHANGE `HN_DURACION_TOTAL` `night_total_duration` INT( 10 ) UNSIGNED";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeSpecialtyTable." CHANGE `NUM_PARTICIPANTES` `attendees_count` INT( 10 ) UNSIGNED";
$sql = "ALTER TABLE ".$sepeSpecialtyTable."
CHANGE `NUM_PARTICIPANTES` `attendees_count` INT( 10 ) UNSIGNED";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeSpecialtyTable." CHANGE `NUMERO_ACTIVIDADES_APRENDIZAJE` `learning_activity_count` INT( 10 ) UNSIGNED";
$sql = "ALTER TABLE ".$sepeSpecialtyTable."
CHANGE `NUMERO_ACTIVIDADES_APRENDIZAJE` `learning_activity_count` INT( 10 ) UNSIGNED";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeSpecialtyTable." CHANGE `NUMERO_INTENTOS` `attempt_count` INT( 10 ) UNSIGNED";
$sql = "ALTER TABLE ".$sepeSpecialtyTable."
CHANGE `NUMERO_INTENTOS` `attempt_count` INT( 10 ) UNSIGNED";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeSpecialtyTable." CHANGE `NUMERO_ACTIVIDADES_EVALUACION` `evaluation_activity_count` INT( 10 ) UNSIGNED";
$sql = "ALTER TABLE ".$sepeSpecialtyTable."
CHANGE `NUMERO_ACTIVIDADES_EVALUACION` `evaluation_activity_count` INT( 10 ) UNSIGNED";
Database::query($sql);
$sepeParticipantTable = self::TABLE_SEPE_PARTICIPANTS;
$sql = "ALTER TABLE ".$sepeParticipantTable." CHANGE `cod` `id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT";
$sql = "ALTER TABLE ".$sepeParticipantTable."
CHANGE `cod` `id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeParticipantTable." CHANGE `cod_action` `action_id` INT( 10 ) UNSIGNED NOT NULL";
$sql = "ALTER TABLE ".$sepeParticipantTable."
CHANGE `cod_action` `action_id` INT( 10 ) UNSIGNED NOT NULL";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeParticipantTable." CHANGE `cod_tutor_empresa` `company_tutor_id` INT( 10 ) UNSIGNED";
$sql = "ALTER TABLE ".$sepeParticipantTable."
CHANGE `cod_tutor_empresa` `company_tutor_id` INT( 10 ) UNSIGNED NULL";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeParticipantTable." CHANGE `cod_tutor_formacion` `training_tutor_id` INT( 10 ) UNSIGNED";
$sql = "ALTER TABLE ".$sepeParticipantTable."
CHANGE `cod_tutor_formacion` `training_tutor_id` INT( 10 ) UNSIGNED NULL";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeParticipantTable." CHANGE `cod_user_chamilo` `platform_user_id` INT( 10 ) UNSIGNED";
$sql = "ALTER TABLE ".$sepeParticipantTable."
CHANGE `cod_user_chamilo` `platform_user_id` INT( 10 ) UNSIGNED";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeParticipantTable." CHANGE `TIPO_DOCUMENTO` `document_type` VARCHAR( 1 )";
$sql = "ALTER TABLE ".$sepeParticipantTable."
CHANGE `TIPO_DOCUMENTO` `document_type` VARCHAR( 1 )";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeParticipantTable." CHANGE `NUM_DOCUMENTO` `document_number` VARCHAR( 10 )";
$sql = "ALTER TABLE ".$sepeParticipantTable."
CHANGE `NUM_DOCUMENTO` `document_number` VARCHAR( 10 )";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeParticipantTable." CHANGE `LETRA_NIF` `document_letter` VARCHAR( 1 )";
$sql = "ALTER TABLE ".$sepeParticipantTable."
CHANGE `LETRA_NIF` `document_letter` VARCHAR( 1 )";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeParticipantTable." CHANGE `INDICADOR_COMPETENCIAS_CLAVE` `key_competence` VARCHAR( 2 )";
$sql = "ALTER TABLE ".$sepeParticipantTable."
CHANGE `INDICADOR_COMPETENCIAS_CLAVE` `key_competence` VARCHAR( 2 )";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeParticipantTable." CHANGE `ID_CONTRATO_CFA` `contract_id` VARCHAR( 14 )";
$sql = "ALTER TABLE ".$sepeParticipantTable."
CHANGE `ID_CONTRATO_CFA` `contract_id` VARCHAR( 14 )";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeParticipantTable." CHANGE `CIF_EMPRESA` `company_fiscal_number` VARCHAR( 9 )";
$sql = "ALTER TABLE ".$sepeParticipantTable."
CHANGE `CIF_EMPRESA` `company_fiscal_number` VARCHAR( 9 )";
Database::query($sql);
$sepeCenterTable = self::TABLE_SEPE_CENTERS;
$sql = "ALTER TABLE ".$sepeCenterTable." CHANGE `cod` `id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT";
$sql = "ALTER TABLE ".$sepeCenterTable."
CHANGE `cod` `id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeCenterTable." CHANGE `ORIGEN_CENTRO` `center_origin` VARCHAR(2)";
$sql = "ALTER TABLE ".$sepeCenterTable."
CHANGE `ORIGEN_CENTRO` `center_origin` VARCHAR(2)";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeCenterTable." CHANGE `CODIGO_CENTRO` `center_code` VARCHAR(16)";
$sql = "ALTER TABLE ".$sepeCenterTable."
CHANGE `CODIGO_CENTRO` `center_code` VARCHAR(16)";
Database::query($sql);
$sepeSpecialtyClassroomTable = self::TABLE_SEPE_SPECIALTY_CLASSROOM;
$sql = "ALTER TABLE ".$sepeSpecialtyClassroomTable." CHANGE `cod` `id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT";
$sql = "ALTER TABLE ".$sepeSpecialtyClassroomTable."
CHANGE `cod` `id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeSpecialtyClassroomTable." CHANGE `cod_specialty` `specialty_id` INT( 10 ) UNSIGNED NOT NULL";
$sql = "ALTER TABLE ".$sepeSpecialtyClassroomTable."
CHANGE `cod_specialty` `specialty_id` INT( 10 ) UNSIGNED NOT NULL";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeSpecialtyClassroomTable." CHANGE `cod_centro` `center_id` INT( 10 ) UNSIGNED NOT NULL";
$sql = "ALTER TABLE ".$sepeSpecialtyClassroomTable."
CHANGE `cod_centro` `center_id` INT( 10 ) UNSIGNED NOT NULL";
Database::query($sql);
$sepeSpecialtyTutorsTable = self::TABLE_SEPE_SPECIALTY_TUTORS;
$sql = "ALTER TABLE ".$sepeSpecialtyTutorsTable." CHANGE `cod` `id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT";
$sql = "ALTER TABLE ".$sepeSpecialtyTutorsTable."
CHANGE `cod` `id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeSpecialtyTutorsTable." CHANGE `cod_specialty` `specialty_id` INT( 10 ) UNSIGNED NOT NULL";
$sql = "ALTER TABLE ".$sepeSpecialtyTutorsTable."
CHANGE `cod_specialty` `specialty_id` INT( 10 ) UNSIGNED NOT NULL";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeSpecialtyTutorsTable." CHANGE `cod_tutor` `tutor_id` INT( 10 ) UNSIGNED NOT NULL";
$sql = "ALTER TABLE ".$sepeSpecialtyTutorsTable."
CHANGE `cod_tutor` `tutor_id` INT( 10 ) UNSIGNED NOT NULL";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeSpecialtyTutorsTable." CHANGE `ACREDITACION_TUTOR` `tutor_accreditation` VARCHAR(200)";
$sql = "ALTER TABLE ".$sepeSpecialtyTutorsTable."
CHANGE `ACREDITACION_TUTOR` `tutor_accreditation` VARCHAR(200)";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeSpecialtyTutorsTable." CHANGE `EXPERIENCIA_PROFESIONAL` `professional_experience` INT( 10 ) UNSIGNED";
$sql = "ALTER TABLE ".$sepeSpecialtyTutorsTable."
CHANGE `EXPERIENCIA_PROFESIONAL` `professional_experience` INT( 10 ) UNSIGNED";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeSpecialtyTutorsTable." CHANGE `COMPETENCIA_DOCENTE` `teaching_competence` VARCHAR(2)";
$sql = "ALTER TABLE ".$sepeSpecialtyTutorsTable."
CHANGE `COMPETENCIA_DOCENTE` `teaching_competence` VARCHAR(2)";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeSpecialtyTutorsTable." CHANGE `EXPERIENCIA_MODALIDAD_TELEFORMACION` `experience_teleforming` INT( 10 ) UNSIGNED";
$sql = "ALTER TABLE ".$sepeSpecialtyTutorsTable."
CHANGE `EXPERIENCIA_MODALIDAD_TELEFORMACION` `experience_teleforming` INT( 10 ) UNSIGNED";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeSpecialtyTutorsTable." CHANGE `FORMACION_MODALIDAD_TELEFORMACION` `training_teleforming` VARCHAR(2)";
$sql = "ALTER TABLE ".$sepeSpecialtyTutorsTable."
CHANGE `FORMACION_MODALIDAD_TELEFORMACION` `training_teleforming` VARCHAR(2)";
Database::query($sql);
$sepeTutorsTable = self::TABLE_SEPE_TUTORS;
$sql = "ALTER TABLE ".$sepeTutorsTable." CHANGE `cod` `id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT";
$sql = "ALTER TABLE ".$sepeTutorsTable."
CHANGE `cod` `id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeTutorsTable." CHANGE `cod_user_chamilo` `platform_user_id` INT( 10 ) UNSIGNED NOT NULL";
$sql = "ALTER TABLE ".$sepeTutorsTable."
CHANGE `cod_user_chamilo` `platform_user_id` INT( 10 ) UNSIGNED NOT NULL";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeTutorsTable." CHANGE `TIPO_DOCUMENTO` `document_type` VARCHAR( 1 )";
$sql = "ALTER TABLE ".$sepeTutorsTable."
CHANGE `TIPO_DOCUMENTO` `document_type` VARCHAR( 1 )";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeTutorsTable." CHANGE `NUM_DOCUMENTO` `document_number` VARCHAR( 10 )";
$sql = "ALTER TABLE ".$sepeTutorsTable."
CHANGE `NUM_DOCUMENTO` `document_number` VARCHAR( 10 )";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeTutorsTable." CHANGE `LETRA_NIF` `document_letter` VARCHAR( 1 )";
$sql = "ALTER TABLE ".$sepeTutorsTable."
CHANGE `LETRA_NIF` `document_letter` VARCHAR( 1 )";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeTutorsTable." CHANGE `ACREDITACION_TUTOR` `tutor_accreditation` VARCHAR(200)";
$sql = "ALTER TABLE ".$sepeTutorsTable."
CHANGE `ACREDITACION_TUTOR` `tutor_accreditation` VARCHAR(200)";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeTutorsTable." CHANGE `EXPERIENCIA_PROFESIONAL` `professional_experience` INT( 10 ) UNSIGNED";
$sql = "ALTER TABLE ".$sepeTutorsTable."
CHANGE `EXPERIENCIA_PROFESIONAL` `professional_experience` INT( 10 ) UNSIGNED";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeTutorsTable." CHANGE `COMPETENCIA_DOCENTE` `teaching_competence` VARCHAR(2)";
$sql = "ALTER TABLE ".$sepeTutorsTable."
CHANGE `COMPETENCIA_DOCENTE` `teaching_competence` VARCHAR(2)";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeTutorsTable." CHANGE `EXPERIENCIA_MODALIDAD_TELEFORMACION` `experience_teleforming` INT( 10 ) UNSIGNED";
$sql = "ALTER TABLE ".$sepeTutorsTable."
CHANGE `EXPERIENCIA_MODALIDAD_TELEFORMACION` `experience_teleforming` INT( 10 ) UNSIGNED";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeTutorsTable." CHANGE `FORMACION_MODALIDAD_TELEFORMACION` `training_teleforming` VARCHAR(2)";
$sql = "ALTER TABLE ".$sepeTutorsTable."
CHANGE `FORMACION_MODALIDAD_TELEFORMACION` `training_teleforming` VARCHAR(2)";
Database::query($sql);
$sepeParticipantSpecialtyTable = self::TABLE_SEPE_PARTICIPANTS_SPECIALTY;
$sql = "ALTER TABLE ".$sepeParticipantSpecialtyTable." CHANGE `cod` `id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT";
$sql = "ALTER TABLE ".$sepeParticipantSpecialtyTable."
CHANGE `cod` `id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeParticipantSpecialtyTable." CHANGE `cod_participant` `participant_id` INT( 10 ) UNSIGNED NOT NULL";
$sql = "ALTER TABLE ".$sepeParticipantSpecialtyTable."
CHANGE `cod_participant` `participant_id` INT( 10 ) UNSIGNED NOT NULL";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeParticipantSpecialtyTable." CHANGE `ORIGEN_ESPECIALIDAD` `specialty_origin` VARCHAR(2)";
$sql = "ALTER TABLE ".$sepeParticipantSpecialtyTable."
CHANGE `ORIGEN_ESPECIALIDAD` `specialty_origin` VARCHAR(2)";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeParticipantSpecialtyTable." CHANGE `AREA_PROFESIONAL` `professional_area` VARCHAR(4)";
$sql = "ALTER TABLE ".$sepeParticipantSpecialtyTable."
CHANGE `AREA_PROFESIONAL` `professional_area` VARCHAR(4)";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeParticipantSpecialtyTable." CHANGE `CODIGO_ESPECIALIDAD` `specialty_code` VARCHAR(14)";
$sql = "ALTER TABLE ".$sepeParticipantSpecialtyTable."
CHANGE `CODIGO_ESPECIALIDAD` `specialty_code` VARCHAR(14)";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeParticipantSpecialtyTable." CHANGE `FECHA_ALTA` `registration_date` DATE";
$sql = "ALTER TABLE ".$sepeParticipantSpecialtyTable."
CHANGE `FECHA_ALTA` `registration_date` DATE";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeParticipantSpecialtyTable." CHANGE `FECHA_BAJA` `leaving_date` DATE";
$sql = "ALTER TABLE ".$sepeParticipantSpecialtyTable."
CHANGE `FECHA_BAJA` `leaving_date` DATE";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeParticipantSpecialtyTable." CHANGE `ORIGEN_CENTRO` `center_origin` VARCHAR(2)";
$sql = "ALTER TABLE ".$sepeParticipantSpecialtyTable."
CHANGE `ORIGEN_CENTRO` `center_origin` VARCHAR(2)";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeParticipantSpecialtyTable." CHANGE `CODIGO_CENTRO` `center_code` VARCHAR(16)";
$sql = "ALTER TABLE ".$sepeParticipantSpecialtyTable."
CHANGE `CODIGO_CENTRO` `center_code` VARCHAR(16)";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeParticipantSpecialtyTable." CHANGE `FECHA_INICIO` `start_date` DATE";
$sql = "ALTER TABLE ".$sepeParticipantSpecialtyTable."
CHANGE `FECHA_INICIO` `start_date` DATE";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeParticipantSpecialtyTable." CHANGE `FECHA_FIN` `end_date` DATE";
$sql = "ALTER TABLE ".$sepeParticipantSpecialtyTable."
CHANGE `FECHA_FIN` `end_date` DATE";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeParticipantSpecialtyTable." CHANGE `RESULTADO_FINAL` `final_result` VARCHAR(1)";
$sql = "ALTER TABLE ".$sepeParticipantSpecialtyTable."
CHANGE `RESULTADO_FINAL` `final_result` VARCHAR(1)";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeParticipantSpecialtyTable." CHANGE `CALIFICACION_FINAL` `final_qualification` VARCHAR(4)";
$sql = "ALTER TABLE ".$sepeParticipantSpecialtyTable."
CHANGE `CALIFICACION_FINAL` `final_qualification` VARCHAR(4)";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeParticipantSpecialtyTable." CHANGE `PUNTUACION_FINAL` `final_score` VARCHAR(4)";
$sql = "ALTER TABLE ".$sepeParticipantSpecialtyTable."
CHANGE `PUNTUACION_FINAL` `final_score` VARCHAR(4)";
Database::query($sql);
$sepeParticipantSpecialtyTutorialsTable = self::TABLE_SEPE_PARTICIPANTS_SPECIALTY_TUTORIALS;
$sql = "ALTER TABLE ".$sepeParticipantSpecialtyTutorialsTable." CHANGE `cod` `id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT";
$sql = "ALTER TABLE ".$sepeParticipantSpecialtyTutorialsTable."
CHANGE `cod` `id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeParticipantSpecialtyTutorialsTable." CHANGE `cod_participant_specialty` `participant_specialty_id` INT( 10 ) UNSIGNED NOT NULL";
$sql = "ALTER TABLE ".$sepeParticipantSpecialtyTutorialsTable."
CHANGE `cod_participant_specialty` `participant_specialty_id` INT( 10 ) UNSIGNED NOT NULL";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeParticipantSpecialtyTutorialsTable." CHANGE `ORIGEN_CENTRO` `center_origin` VARCHAR(2)";
$sql = "ALTER TABLE ".$sepeParticipantSpecialtyTutorialsTable."
CHANGE `ORIGEN_CENTRO` `center_origin` VARCHAR(2)";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeParticipantSpecialtyTutorialsTable." CHANGE `CODIGO_CENTRO` `center_code` VARCHAR(16)";
$sql = "ALTER TABLE ".$sepeParticipantSpecialtyTutorialsTable."
CHANGE `CODIGO_CENTRO` `center_code` VARCHAR(16)";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeParticipantSpecialtyTutorialsTable." CHANGE `FECHA_INICIO` `start_date` DATE";
$sql = "ALTER TABLE ".$sepeParticipantSpecialtyTutorialsTable."
CHANGE `FECHA_INICIO` `start_date` DATE";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeParticipantSpecialtyTutorialsTable." CHANGE `FECHA_FIN` `end_date` DATE";
$sql = "ALTER TABLE ".$sepeParticipantSpecialtyTutorialsTable."
CHANGE `FECHA_FIN` `end_date` DATE";
Database::query($sql);
$sepeTutorsCompanyTable = self::TABLE_SEPE_TUTORS_COMPANY;
@ -366,65 +467,91 @@ class SepePlugin extends Plugin
$sql = "UPDATE ".$sepeTutorsCompanyTable." SET formacion='0' WHERE formacion='NO'";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeTutorsCompanyTable." CHANGE `cod` `id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT";
$sql = "ALTER TABLE ".$sepeTutorsCompanyTable."
CHANGE `cod` `id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeTutorsCompanyTable." CHANGE `alias` `alias` VARCHAR(255)";
$sql = "ALTER TABLE ".$sepeTutorsCompanyTable."
CHANGE `alias` `alias` VARCHAR(255)";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeTutorsCompanyTable." CHANGE `TIPO_DOCUMENTO` `document_type` VARCHAR( 1 )";
$sql = "ALTER TABLE ".$sepeTutorsCompanyTable."
CHANGE `TIPO_DOCUMENTO` `document_type` VARCHAR( 1 )";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeTutorsCompanyTable." CHANGE `NUM_DOCUMENTO` `document_number` VARCHAR( 10 )";
$sql = "ALTER TABLE ".$sepeTutorsCompanyTable."
CHANGE `NUM_DOCUMENTO` `document_number` VARCHAR( 10 )";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeTutorsCompanyTable." CHANGE `LETRA_NIF` `document_letter` VARCHAR( 1 )";
$sql = "ALTER TABLE ".$sepeTutorsCompanyTable."
CHANGE `LETRA_NIF` `document_letter` VARCHAR( 1 )";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeTutorsCompanyTable." CHANGE `empresa` `company` VARCHAR(1)";
$sql = "ALTER TABLE ".$sepeTutorsCompanyTable."
CHANGE `empresa` `company` VARCHAR(1)";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeTutorsCompanyTable." CHANGE `formacion` `training` VARCHAR(1)";
$sql = "ALTER TABLE ".$sepeTutorsCompanyTable."
CHANGE `formacion` `training` VARCHAR(1)";
Database::query($sql);
$sepeCompetenceTable = self::TABLE_SEPE_TEACHING_COMPETENCE;
$sql = "ALTER TABLE ".$sepeCompetenceTable." CHANGE `cod` `id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT";
$sql = "ALTER TABLE ".$sepeCompetenceTable."
CHANGE `cod` `id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeCompetenceTable." CHANGE `valor` `value` LONGTEXT";
$sql = "ALTER TABLE ".$sepeCompetenceTable."
CHANGE `valor` `value` LONGTEXT";
Database::query($sql);
$sepeLogParticipantTable = self::TABLE_SEPE_LOG_PARTICIPANT;
$sql = "ALTER TABLE ".$sepeLogParticipantTable." CHANGE `cod` `id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT";
$sql = "ALTER TABLE ".$sepeLogParticipantTable."
CHANGE `cod` `id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeLogParticipantTable." CHANGE `cod_user_chamilo` `platform_user_id` INT( 10 ) UNSIGNED";
$sql = "ALTER TABLE ".$sepeLogParticipantTable."
CHANGE `cod_user_chamilo` `platform_user_id` INT( 10 ) UNSIGNED";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeLogParticipantTable." CHANGE `cod_action` `action_id` INT( 10 ) UNSIGNED";
$sql = "ALTER TABLE ".$sepeLogParticipantTable."
CHANGE `cod_action` `action_id` INT( 10 ) UNSIGNED";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeLogParticipantTable." CHANGE `fecha_alta` `registration_date` DATE";
$sql = "ALTER TABLE ".$sepeLogParticipantTable."
CHANGE `fecha_alta` `registration_date` DATE";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeLogParticipantTable." CHANGE `fecha_baja` `leaving_date` DATE";
$sql = "ALTER TABLE ".$sepeLogParticipantTable."
CHANGE `fecha_baja` `leaving_date` DATE";
Database::query($sql);
$sepeLogModParticipantTable = self::TABLE_SEPE_LOG_MOD_PARTICIPANT;
$sql = "ALTER TABLE ".$sepeLogModParticipantTable." CHANGE `cod` `id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT";
$sql = "ALTER TABLE ".$sepeLogModParticipantTable."
CHANGE `cod` `id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeLogModParticipantTable." CHANGE `cod_user_chamilo` `platform_user_id` INT( 10 ) UNSIGNED NOT NULL";
$sql = "ALTER TABLE ".$sepeLogModParticipantTable."
CHANGE `cod_user_chamilo` `platform_user_id` INT( 10 ) UNSIGNED NOT NULL";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeLogModParticipantTable." CHANGE `cod_action` `action_id` INT( 10 ) UNSIGNED NOT NULL";
$sql = "ALTER TABLE ".$sepeLogModParticipantTable."
CHANGE `cod_action` `action_id` INT( 10 ) UNSIGNED NOT NULL";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeLogModParticipantTable." CHANGE `fecha_mod` `change_date` DATE";
$sql = "ALTER TABLE ".$sepeLogModParticipantTable."
CHANGE `fecha_mod` `change_date` DATE";
Database::query($sql);
$sepeCenterTable = self::TABLE_SEPE_CENTER;
$sql = "ALTER TABLE ".$sepeCenterTable." CHANGE `cod` `id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT";
$sql = "ALTER TABLE ".$sepeCenterTable."
CHANGE `cod` `id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeCenterTable." CHANGE `origen_centro` `center_origin` VARCHAR( 255 )";
$sql = "ALTER TABLE ".$sepeCenterTable."
CHANGE `origen_centro` `center_origin` VARCHAR( 255 )";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeCenterTable." CHANGE `codigo_centro` `center_code` VARCHAR( 255 )";
$sql = "ALTER TABLE ".$sepeCenterTable."
CHANGE `codigo_centro` `center_code` VARCHAR( 255 )";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeCenterTable." CHANGE `nombre_centro` `center_name` VARCHAR( 255 )";
$sql = "ALTER TABLE ".$sepeCenterTable."
CHANGE `nombre_centro` `center_name` VARCHAR( 255 )";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeCenterTable." CHANGE `url` `url` VARCHAR( 255 )";
$sql = "ALTER TABLE ".$sepeCenterTable."
CHANGE `url` `url` VARCHAR( 255 )";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeCenterTable." CHANGE `url_seguimiento` `tracking_url` VARCHAR( 255 )";
$sql = "ALTER TABLE ".$sepeCenterTable."
CHANGE `url_seguimiento` `tracking_url` VARCHAR( 255 )";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeCenterTable." CHANGE `telefono` `phone` VARCHAR( 255 )";
$sql = "ALTER TABLE ".$sepeCenterTable."
CHANGE `telefono` `phone` VARCHAR( 255 )";
Database::query($sql);
$sql = "ALTER TABLE ".$sepeCenterTable." CHANGE `email` `mail` VARCHAR( 255 )";
$sql = "ALTER TABLE ".$sepeCenterTable."
CHANGE `email` `mail` VARCHAR( 255 )";
Database::query($sql);
}
}

@ -1,20 +1,25 @@
<?php
/* For licensing terms, see /license.txt */
require_once __DIR__.'/../../../main/inc/global.inc.php';
api_protect_admin_script();
$action = isset($_GET['what']) ? $_GET['what'] : '';
define('CHAMILO_INTERNAL', true);
$plugin = VChamiloPlugin::create();
$thisurl = api_get_path(WEB_PLUGIN_PATH).'vchamilo/views/manage.php';
api_protect_admin_script();
if ($action === 'syncthis') {
$res = include_once api_get_path(SYS_PLUGIN_PATH).'vchamilo/views/syncparams.controller.php';
if (!$res) {
echo '<span class="label label-success">Success</span>';
} else {
echo '<span class="label label-danger">Failure<br/>'.$errors.'</span>';
}
switch ($action) {
case 'syncthis':
$res = include_once api_get_path(SYS_PLUGIN_PATH).'vchamilo/views/syncparams.controller.php';
if (!$res) {
echo '<span class="label label-success">Success</span>';
} else {
echo '<span class="label label-danger">Failure<br/>'.$errors.'</span>';
}
break;
}
exit;

@ -100,5 +100,7 @@ $form->addButtonSave($plugin->get_lang('Save'));
$plugin_info['settings_form'] = $form;
//set the templates that are going to be used
// Set the templates that are going to be used
$plugin_info['templates'] = ['template.tpl'];
$plugin_info['plugin_class'] = get_class($plugin);

@ -8,116 +8,130 @@ $result = Database::query($sql);
$vchamilos = Database::store_result($result, 'ASSOC');
// propagate in all known vchamilos a setting
if ($action == 'syncall') {
exit;
$keys = array_keys($_REQUEST);
$selection = preg_grep('/sel_.*/', $keys);
switch ($action) {
case 'syncall':
exit;
$keys = array_keys($_REQUEST);
$selection = preg_grep('/sel_.*/', $keys);
foreach ($selection as $selkey) {
$settingId = str_replace('sel_', '', $selkey);
foreach ($selection as $selkey) {
$settingId = str_replace('sel_', '', $selkey);
if (!is_numeric($settingId)) {
continue;
}
$value = $_REQUEST[$selkey];
if (!is_numeric($settingId)) {
continue;
}
$setting = api_get_settings_params_simple(['id' => $settingId]);
$value = $_REQUEST[$selkey];
$setting = api_get_settings_params_simple(['id = ?' => $settingId]);
$params = [
'title' => $setting['title'],
'variable' => $setting['variable'],
'subkey' => $setting['subkey'],
'category' => $setting['category'],
'access_url' => $setting['access_url'],
];
$params = [
'title' => $setting['title'],
'variable' => $setting['variable'],
'subkey' => $setting['subkey'],
'category' => $setting['category'],
'access_url' => $setting['access_url'],
];
foreach ($vchamilos as $vcid => $chm) {
$table = $chm['main_database'].".settings_current ";
$sql = " SELECT * FROM $table
foreach ($vchamilos as $chm) {
$table = $chm['main_database'].".settings_current ";
$sql = " SELECT * FROM $table
WHERE
variable = '{{$setting['variable']}}' AND
access_url = '{$setting['access_url']}'
";
$result = Database::query($sql);
$result = Database::query($sql);
if (Database::num_rows($result)) {
$sql = "UPDATE $table SET
if (Database::num_rows($result)) {
$sql = "UPDATE $table SET
selected_value = '$value'
WHERE id = $settingId";
Database::query($sql);
Database::query($sql);
}
}
//$DB->set_field('settings_current', 'selected_value', $value, $params, 'id', $chm->main_database);
}
}
}
break;
case 'syncthis':
$settingId = isset($_GET['settingid']) ? (int) $_GET['settingid'] : '';
if (!empty($settingId) && is_numeric($settingId)) {
$deleteIfEmpty = isset($_REQUEST['del']) ? $_REQUEST['del'] : '';
$value = $_REQUEST['value'];
// Getting the local setting record.
$setting = api_get_settings_params_simple(['id = ?' => $settingId]);
if (empty($setting)) {
return 0;
}
if ($action == 'syncthis') {
$settingId = isset($_GET['settingid']) ? $_GET['settingid'] : '';
if (is_numeric($settingId)) {
$delifempty = isset($_REQUEST['del']) ? $_REQUEST['del'] : '';
$value = $_REQUEST['value'];
// Getting the local setting record.
$setting = api_get_settings_params_simple(['id' => $settingId]);
$params = [
'access_url_changeable' => $setting['access_url_changeable'],
'title' => $setting['title'],
'variable' => $setting['variable'],
'subkey' => $setting['subkey'],
'category' => $setting['category'],
'type' => $setting['type'],
'comment' => $setting['comment'],
'access_url' => $setting['access_url'],
];
$errors = '';
foreach ($vchamilos as $vcid => $chm) {
$table = "settings_current";
$config = new \Doctrine\DBAL\Configuration();
$connectionParams = [
'dbname' => $chm['main_database'],
'user' => $chm['db_user'],
'password' => $chm['db_password'],
'host' => $chm['db_host'],
'driver' => 'pdo_mysql',
$params = [
'access_url_changeable' => $setting['access_url_changeable'],
'title' => $setting['title'],
'variable' => $setting['variable'],
'subkey' => $setting['subkey'],
'category' => $setting['category'],
'type' => $setting['type'],
'comment' => $setting['comment'],
'access_url' => $setting['access_url'],
];
$connection = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config);
try {
if ($delifempty && empty($value)) {
$sql = "DELETE FROM $table
WHERE
selected_value = '$value' AND
variable = '{{$setting['variable']}}' AND
access_url = '{$setting['access_url']}'
";
$connection->executeQuery($sql);
$case = "delete";
} else {
$sql = " SELECT * FROM $table
WHERE
variable = '".$setting['variable']."' AND
access_url = '{$setting['access_url']}'
";
$result = $connection->fetchAll($sql);
if (!empty($result)) {
$sql = "UPDATE $table SET selected_value = '$value' WHERE id = $settingId";
$errors = '';
foreach ($vchamilos as $instance) {
$table = 'settings_current';
$config = new \Doctrine\DBAL\Configuration();
$connectionParams = [
'dbname' => $instance['main_database'],
'user' => $instance['db_user'],
'password' => $instance['db_password'],
'host' => $instance['db_host'],
'driver' => 'pdo_mysql',
];
$connection = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config);
try {
$variable = $setting['variable'];
$subKey = $setting['subkey'];
$category = $setting['category'];
$accessUrl = $setting['access_url'];
if ($deleteIfEmpty && empty($value)) {
$sql = "DELETE FROM $table
WHERE
selected_value = '$value' AND
variable = '$variable' AND
access_url = '$accessUrl'
";
$connection->executeQuery($sql);
$case = 'delete';
} else {
$connection->insert($table, $params);
$sql = "SELECT * FROM $table
WHERE
variable = '$variable' AND
access_url = '$accessUrl'
";
$result = $connection->fetchAll($sql);
if (!empty($result)) {
//$sql = "UPDATE $table SET selected_value = '$value' WHERE id = $settingId";
$sql = "UPDATE $table SET selected_value = '$value' WHERE variable = '$variable'";
if (!empty($subKey)) {
$sql .= " AND subkey = '$subKey' ";
}
if (!empty($category)) {
$sql .= " AND category = '$category'";
}
$connection->executeQuery($sql);
} else {
$connection->insert($table, $params);
}
}
} catch (Exception $e) {
echo $e->getMessage();
}
} catch (Exception $e) {
echo $e->getMessage();
}
}
return $errors;
} else {
return "Bad ID. Non numeric";
}
return $errors;
} else {
return "Bad ID. Non numeric";
}
break;
}
return 0;

@ -10,7 +10,7 @@ $action = isset($_GET['what']) ? $_GET['what'] : '';
define('CHAMILO_INTERNAL', true);
$plugin = VChamiloPlugin::create();
$thisurl = api_get_path(WEB_PLUGIN_PATH).'vchamilo/views/manage.php';
$thisUrl = api_get_path(WEB_PLUGIN_PATH).'vchamilo/views/manage.php';
if ($action) {
require_once api_get_path(SYS_PLUGIN_PATH).'vchamilo/views/syncparams.controller.php';
@ -18,7 +18,7 @@ if ($action) {
$settings = api_get_settings();
$table = new HTML_Table(['class' => 'data_table', 'width' => '100%']);
$table = new HTML_Table(['class' => 'table']);
$column = 0;
$row = 0;
$headers = [
@ -39,14 +39,16 @@ foreach ($settings as $param) {
$check = '';
$attrs = ['center' => 'left'];
$syncButton = '
<input class="btn btn-default" type="button" name="syncthis" value="'.$plugin->get_lang('syncthis').'" onclick="ajax_sync_setting(\''.$param['id'].'\')" />
<input class="btn btn-default" type="button" name="syncthis"
value="'.$plugin->get_lang('syncthis').'" onclick="ajax_sync_setting(\''.$param['id'].'\')" />
<span id="res_'.$param['id'].'"></span>';
$data = [
$check,
isset($param['subkey']) && !empty($param['subkey']) ? $param['variable'].' ['.$param['subkey'].']' : $param['variable'],
$param['category'],
$param['access_url'],
'<input type="text" disabled name="value_'.$param['id'].'" value="'.htmlspecialchars($param['selected_value'], ENT_COMPAT, 'UTF-8').'" />'.
'<input type="text" disabled name="value_'.$param['id'].'"
value="'.htmlspecialchars($param['selected_value'], ENT_COMPAT, 'UTF-8').'" />'.
'<br />Master value: '.$param['selected_value'],
$syncButton,
];
@ -54,7 +56,7 @@ foreach ($settings as $param) {
$table->setRowAttributes($row, ['id' => 'row_'.$param['id']], true);
}
$content = '<form name="settingsform" action="'.$thisurl.'">';
$content = '<form name="settingsform" action="'.$thisUrl.'">';
$content .= '<input type="hidden" name="what" value="" />';
$content .= $table->toHtml();
$content .= '</form>';
@ -67,10 +69,8 @@ function ajax_sync_setting(settingid) {
var webUrl = '".api_get_path(WEB_PATH)."';
var spare = $('#row_'+settingid).html();
var formobj = document.forms['settingsform'];
var url = webUrl + 'plugin/vchamilo/ajax/service.php?what=syncthis&settingid='+settingid+'&value='+encodeURIComponent(formobj.elements['value_'+settingid].value);
var url = webUrl + 'plugin/vchamilo/ajax/service.php?what=syncthis&settingid='+settingid+'&value='+encodeURIComponent(formobj.elements['value_'+settingid].value);
$('#row_'+settingid).html('<td colspan=\"7\"><img src=\"'+webUrl+'plugin/vchamilo/pix/ajax_waiter.gif\" /></td>');
$.get(url, function (data) {
$('#row_'+settingid).html(spare);
$('#res_'+settingid).html(data);

Loading…
Cancel
Save