Internal: Database: Fix internal methods calls with name vs title (8) - plugins - refs #3581 #4706

pull/5096/head
Yannick Warnier 10 months ago
parent 7cab38ec49
commit a27ff91588
  1. 6
      public/plugin/advanced_subscription/src/AdvancedSubscriptionPlugin.php
  2. 2
      public/plugin/advanced_subscription/src/HookAdvancedSubscription.php
  3. 2
      public/plugin/advanced_subscription/src/open_session.php
  4. 8
      public/plugin/buycourses/src/buy_course_plugin.class.php
  5. 8
      public/plugin/buycourses/src/buycourses.ajax.php
  6. 4
      public/plugin/buycourses/src/service_process_confirm.php
  7. 4
      public/plugin/buycourses/src/service_success.php
  8. 2
      public/plugin/buycourses/src/services_edit.php
  9. 2
      public/plugin/courselegal/CourseLegalPlugin.php
  10. 2
      public/plugin/dashboard/block_session/block_session.class.php
  11. 4
      public/plugin/justification/Justification.php
  12. 10
      public/plugin/justification/README.md
  13. 6
      public/plugin/learning_calendar/LearningCalendarPlugin.php
  14. 8
      public/plugin/learning_calendar/README.md
  15. 2
      public/plugin/learning_calendar/calendar_users.php
  16. 2
      public/plugin/studentfollowup/my_students.php
  17. 42
      public/plugin/vchamilo/README.md
  18. 6
      public/plugin/vchamilo/install.php
  19. 2
      public/plugin/vchamilo/lib/Virtual.php

@ -1260,7 +1260,7 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
}
/**
* List all session (id, name) for select input.
* List all session (id, title) for select input.
*
* @param int $limit
*
@ -1270,11 +1270,11 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
{
$limit = (int) $limit;
$sessionTable = Database::get_main_table(TABLE_MAIN_SESSION);
$columns = 'id, name';
$columns = 'id, title';
$conditions = [];
if ($limit > 0) {
$conditions = [
'order' => 'name',
'order' => 'title',
'limit' => $limit,
];
}

@ -263,7 +263,7 @@ class HookAdvancedSubscription extends HookObserver implements HookAdminBlockObs
'name' => 'coach_id',
'type' => 'xsd:int',
],
// session.name
// session.title
'name' => [
'name' => 'name',
'type' => 'xsd:string',

@ -35,7 +35,7 @@ if (SessionManager::isUserSubscribedAsStudent(
'errorMessages',
[sprintf(
$plugin->get_lang('YouAreAlreadySubscribedToSessionX'),
$sessionInfo['name']
$sessionInfo['title']
)]
);
} else {

@ -2096,7 +2096,7 @@ class BuyCoursesPlugin extends Plugin
$return = Database::insert(
$servicesTable,
[
'name' => Security::remove_XSS($service['name']),
'title' => Security::remove_XSS($service['name']),
'description' => Security::remove_XSS($service['description']),
'price' => $service['price'],
'tax_perc' => '' != $service['tax_perc'] ? (int) $service['tax_perc'] : null,
@ -2151,7 +2151,7 @@ class BuyCoursesPlugin extends Plugin
return Database::update(
$servicesTable,
[
'name' => Security::remove_XSS($service['name']),
'title' => Security::remove_XSS($service['name']),
'description' => Security::remove_XSS($service['description']),
'price' => $service['price'],
'tax_perc' => '' != $service['tax_perc'] ? (int) $service['tax_perc'] : null,
@ -2419,7 +2419,7 @@ class BuyCoursesPlugin extends Plugin
$isoCode = $currency['iso_code'];
$servicesSale = Database::select(
'ss.*, s.name, s.description, s.price as service_price, s.duration_days, s.applies_to, s.owner_id, s.visibility, s.image',
'ss.*, s.title, s.description, s.price as service_price, s.duration_days, s.applies_to, s.owner_id, s.visibility, s.image',
"$servicesSaleTable ss $innerJoins",
$conditions,
'first'
@ -2428,7 +2428,7 @@ class BuyCoursesPlugin extends Plugin
$buyer = api_get_user_info($servicesSale['buyer_id']);
$servicesSale['service']['id'] = $servicesSale['service_id'];
$servicesSale['service']['name'] = $servicesSale['name'];
$servicesSale['service']['title'] = $servicesSale['title'];
$servicesSale['service']['description'] = $servicesSale['description'];
$servicesSale['service']['price'] = $servicesSale['service_price'];
$servicesSale['service']['currency'] = $isoCode;

@ -386,7 +386,7 @@ switch ($action) {
"moneda" => $serviceSale['currency'],
"monto" => intval(floatval($serviceSale['price']) * 100),
"usuario" => $user['username'],
"descripcion" => $serviceSale['service']['name'],
"descripcion" => $serviceSale['service']['title'],
"pedido" => $serviceSale['reference'],
"codigo_pais" => "PE",
"direccion" => get_lang('None'),
@ -405,7 +405,7 @@ switch ($action) {
Display::return_message(
sprintf(
$plugin->get_lang('SubscriptionToCourseXSuccessful'),
$serviceSale['service']['name']
$serviceSale['service']['title']
),
'success'
)
@ -453,7 +453,7 @@ switch ($action) {
$html .= "<br />";
$html .= "<legend>{$plugin->get_lang('ServiceInformation')}</legend>";
$html .= "<ul>";
$html .= "<li><b>{$plugin->get_lang('ServiceName')}:</b> {$serviceSale['service']['name']}</li> ";
$html .= "<li><b>{$plugin->get_lang('ServiceName')}:</b> {$serviceSale['service']['title']}</li> ";
$html .= "<li><b>{$plugin->get_lang('Description')}:</b> {$serviceSale['service']['description']}</li> ";
$nodeType = $serviceSale['node_type'];
$nodeName = '';
@ -563,7 +563,7 @@ switch ($action) {
if ($response) {
$html .= Display::return_message(
sprintf($plugin->get_lang('SubscriptionToServiceXSuccessful'), $serviceSale['service']['name']),
sprintf($plugin->get_lang('SubscriptionToServiceXSuccessful'), $serviceSale['service']['title']),
'success'
);
} else {

@ -128,7 +128,7 @@ switch ($serviceSale['payment_type']) {
$messageTemplate->assign(
'service_sale',
[
'name' => $serviceSale['service']['name'],
'name' => $serviceSale['service']['title'],
'buyer' => $serviceSale['buyer']['name'],
'buy_date' => $serviceSale['buy_date'],
'start_date' => $serviceSale['start_date'],
@ -206,7 +206,7 @@ switch ($serviceSale['payment_type']) {
$template = new Template();
$template->assign('terms', $globalParameters['terms_and_conditions']);
$template->assign('title', $serviceSale['service']['name']);
$template->assign('title', $serviceSale['service']['title']);
$template->assign('price', $serviceSale['price']);
$template->assign('currency', $serviceSale['currency_id']);
$template->assign('buying_service', $serviceSale);

@ -84,7 +84,7 @@ if ($form->validate()) {
if ($serviceSaleIsCompleted) {
Display::addFlash(
Display::return_message(
sprintf($plugin->get_lang('SubscriptionToServiceXSuccessful'), $serviceSale['service']['name']),
sprintf($plugin->get_lang('SubscriptionToServiceXSuccessful'), $serviceSale['service']['title']),
'success'
)
);
@ -171,7 +171,7 @@ $interbreadcrumb[] = [
$templateName = $plugin->get_lang('PaymentMethods');
$tpl = new Template($templateName);
$tpl->assign('title', $serviceSale['service']['name']);
$tpl->assign('title', $serviceSale['service']['title']);
$tpl->assign('price', $serviceSale['price']);
$tpl->assign('currency', $serviceSale['currency_id']);
$tpl->assign('service', $serviceSale);

@ -39,7 +39,7 @@ $globalSettingsParams = $plugin->getGlobalParameters();
$service = $plugin->getService($serviceId);
$formDefaultValues = [
'name' => $service['name'],
'name' => $service['title'],
'description' => $service['description'],
'price' => $service['price'],
'tax_perc' => $service['tax_perc'],

@ -200,7 +200,7 @@ class CourseLegalPlugin extends Plugin
$sesstionTitle = null;
if (!empty($sessionInfo)) {
$sesstionTitle = ' ('.$sessionInfo['name'].')';
$sesstionTitle = ' ('.$sessionInfo['title'].')';
}
$courseTitle = $courseInfo['title'].$sesstionTitle;

@ -89,7 +89,7 @@ class BlockSession extends Block
$i = 1;
foreach ($sessions as $session) {
$session_id = (int) ($session['id']);
$title = $session['name'];
$title = $session['title'];
if (!empty($session['access_start_date'])) {
$dateFrom = api_convert_and_format_date(

@ -57,7 +57,7 @@ class Justification extends Plugin
public function getList()
{
$sql = 'SELECT * FROM justification_document ORDER BY name ';
$sql = 'SELECT * FROM justification_document ORDER BY title ';
$query = Database::query($sql);
return Database::store_result($query, 'ASSOC');
@ -71,7 +71,7 @@ class Justification extends Plugin
$sql = "CREATE TABLE IF NOT EXISTS justification_document (
id INT unsigned NOT NULL auto_increment PRIMARY KEY,
code TEXT NULL,
name TEXT NULL,
title TEXT NULL,
validity_duration INT,
comment TEXT NULL,
date_manual_on INT

@ -2,4 +2,12 @@ Justification
==============
1. Enable the plugin.
2. Create the justification files in plugin/justification/list.php
2. Create the justification files in plugin/justification/list.php
Changelog
=======
v2.0 (for Chamilo v2.0)
-----------------------
ALTER TABLE justification_document CHANGE COLUMN name title TEXT NULL;

@ -93,7 +93,7 @@ class LearningCalendarPlugin extends Plugin
$sql = "
CREATE TABLE IF NOT EXISTS learning_calendar_events(
id int not null AUTO_INCREMENT primary key,
name varchar(255) default '',
title varchar(255) default '',
calendar_id int not null,
start_date date not null,
end_date date not null,
@ -651,7 +651,7 @@ class LearningCalendarPlugin extends Plugin
$html = '';
if (!empty($list)) {
$html = implode('&nbsp;', array_column($list, 'name'));
$html = implode('&nbsp;', array_column($list, 'title'));
}
return $html;
@ -1011,7 +1011,7 @@ class LearningCalendarPlugin extends Plugin
}
} else {
$params = [
'name' => '',
'title' => '',
'calendar_id' => $calendarId,
'start_date' => $startDate,
'end_date' => $startDate,

@ -1,2 +1,10 @@
## Learning calendar
This plugin allows for a complex scheduling of courses and inactivity times for
students with professional practices.
## Changelog
### v2.0 (for Chamilo v2.0)
ALTER TABLE learning_calendar_events CHANGE COLUMN name title varchar(255) default '';

@ -51,7 +51,7 @@ $column_model = [
$extraParams['autowidth'] = 'true';
// height auto
$extraParams['height'] = 'auto';
$extraParams['sortname'] = 'name';
$extraParams['sortname'] = 'title';
$extraParams['sortorder'] = 'desc';
$extraParams['multiselect'] = true;

@ -165,7 +165,7 @@ $form->addText(
);
if (!empty($fullSessionList)) {
$options = array_column($fullSessionList, 'name', 'id');
$options = array_column($fullSessionList, 'title', 'id');
$options[0] = get_lang('Please select an option');
ksort($options);
$form->addSelect('session_id', get_lang('Session'), $options);

@ -3,21 +3,27 @@ Virtual Chamilo
Authors : Valery Fremaux (valery.fremaux@gmail.com), Julio Montoya, Angel Quiroz, Yannick Warnier
Virtual Chamilo (or vChamilo) is a feature that allows you to easily run several chamilo instances
Virtual Chamilo (or vChamilo) is a feature that allows you to easily run several chamilo instances
sharing the same code base, with separate documents and databases, acting mostly like containers
sharing the same libraries.
With vChamilo, your first Chamilo portal acts as a container (or "controller"), and a seed
(or image) for the Chamilo instances you will install afterwards. This first image should be
(or image) for the Chamilo instances you will install afterwards. This first image should be
created automatically when configuring the plugin, but if it isn't, the plugin will tell you
so and ask to generate one through the interface.
Once the plugin is fully setup, you will be able to create new Chamilo instances in a
matter of minutes (or seconds on powerful servers).
Changelog
=========
*Version 1.8 (Chamilo v2.0)*
Changed field name to match new Chamilo terminology:
ALTER TABLE vchamilo_config CHANGE COLUMN name title varchar(64) NOT NULL;
*Version 1.7*
Added support for (optional) custom CSS folder
@ -41,7 +47,7 @@ Improved usability and added validations. No DB update required.
*Version 1.4*
Database upgrade needed:
Database upgrade needed:
ALTER TABLE vchamilo ADD COLUMN password_encryption VARCHAR(255);
@ -74,13 +80,13 @@ include_once $_configuration['root_sys'].'plugin/vchamilo/lib/Virtual.php';
Virtual::hookConfiguration($_configuration);
```
And add (or uncomment) the line to enable multi-url:
```
$_configuration['multiple_access_urls'] = true;
```
At this point, make sure there is no caching mechanism maintaining the previous configuration
version before you continue. Enabling the multi-url option should have the immediate effect
of adding a multi-url management link at the bottom of the "Platform" block in the
of adding a multi-url management link at the bottom of the "Platform" block in the
administration main page.
Take a moment to update the configuration of the default host in the multi-url configuration page
@ -88,13 +94,13 @@ to the real hostname of your main (controller) portal.
2. Change the permissions on the <chamiloroot>/plugin/vchamilo/templates/ directory as it will
be necessary for the plugin to create files and directories there
3. Create a common directory to be used for all Chamilo-related files.
3. Create a common directory to be used for all Chamilo-related files.
We recommend using <chamiloroot>/var/ for that. Inside that directory, create the following 4
directories: cache/, courses/, home/ and upload/ and give permissions to the web user to write
into them (exactly the same way you did it for the app/ directory when installing Chamilo)
4. Enable and configure the plugin in the Chamilo administration's plugins list
(if in doubt, use the suggested values). Please note that the proxy configuration part is
totally optional and is not maintained by the Chamilo team at this point.
4. Enable and configure the plugin in the Chamilo administration's plugins list
(if in doubt, use the suggested values). Please note that the proxy configuration part is
totally optional and is not maintained by the Chamilo team at this point.
5. Enable additional virtual hosts in your Apache config (unless you use subdirectories). All virtual hosts should point to the same DocumentRoot as the initial Chamilo installation.
6. For each virtual host or subdirectory, you will need to configure specific redirection rules (remember, this is still at beta-level):
@ -107,18 +113,18 @@ the specific details of each instance. For example:
```
RewriteRule /app/upload/(.*)$ http://beeznest.chamilo.net/var/upload/beeznest-chamilo-net/$1 [QSA,L]
```
Although your vChamilo instances *will* work basically without this rewrite rule, you will end
Although your vChamilo instances *will* work basically without this rewrite rule, you will end
up observing issues of files not appearing while uploading files on the instance.
Note that the domain of the instance, in the last part of the path, will be transformed
Note that the domain of the instance, in the last part of the path, will be transformed
from dot-separated domain (beeznest.chamilo.net) to dash-separated-domain (beeznest-chamilo-net).
7. Finally, go to the "Instances manager" and create new instances. Once an instance has been
7. Finally, go to the "Instances manager" and create new instances. Once an instance has been
created, make sure you edit it and set the "Archive URL", "Home URL" and "Upload URL". These should
have the form of the "Web root" of the instance + the common directory + {archive|home|upload} + the
have the form of the "Web root" of the instance + the common directory + {archive|home|upload} + the
instance domain with dots changed to hyphens.
For example, if you have used "var/" as a common directory and your instance URL (Web Root) is
For example, if you have used "var/" as a common directory and your instance URL (Web Root) is
https://chamilo1.beeznest.com/, then your "Archive URL" would look like this:
https://chamilo1.beeznest.com/var/archive/chamilo1-beeznest-com/
@ -130,13 +136,13 @@ Important note about file system permissions
-------------
vChamilo instances *need* a central directory where to store all their files. You should create
that directory (as mentioned in point 3 above) and make sure it has the right permissions.
that directory (as mentioned in point 3 above) and make sure it has the right permissions.
The plugin/vchamilo/templates/ directory also needs to be writeable by the web server.
Additional notes
-------------
The vChamilo plugin can work in combination with the "Chamilo Shell":https://github.com/chamilo/chamilo-lms
The vChamilo plugin can work in combination with the "Chamilo Shell":https://github.com/chamilo/chamilo-lms
(or "chash") to ensure a good level of automatization of heavy processes, like upgrading to a higher version.
Although upgrading still has a manual process (in part), it will certainly save you dozens of hours if
upgrading dozens of portals.

@ -26,7 +26,7 @@ $sql = "
root_web varchar(120),
db_host varchar(80) NOT NULL,
db_user varchar(16) DEFAULT 'root',
db_password varchar(32),
db_password varchar(32),
table_prefix varchar(16),
db_prefix varchar(16),
main_database varchar(60) DEFAULT 'chamilo',
@ -57,9 +57,9 @@ $table = 'vchamilo_config';
$tablename = Database::get_main_table($table);
// TODO: rename "name" and "value" fields - these are reserved keywords
$sql = "CREATE TABLE IF NOT EXISTS $tablename (
id int(11) NOT NULL AUTO_INCREMENT,
id int(11) NOT NULL AUTO_INCREMENT,
component int(11) NOT NULL,
`name` varchar(64) NOT NULL,
title varchar(64) NOT NULL,
`value` varchar(255) NOT NULL,
longvalue varchar(255) NOT NULL,
PRIMARY KEY (id)

@ -43,7 +43,7 @@ class Virtual
if ($result->rowCount()) {
$data = $result->fetch();
$excludes = ['id', 'name'];
$excludes = ['id', 'title'];
$query = "SELECT * FROM settings_current WHERE subkey = 'vchamilo'";
$virtualSettings = $connection->executeQuery($query);
$virtualSettings = $virtualSettings->fetchAll();

Loading…
Cancel
Save