Merge branch 'master' of github.com:chamilo/chamilo-lms into person_name

pull/2650/head
Angel Fernando Quiroz Campos 7 years ago
commit 64837f5077
  1. 78
      app/Migrations/Schema/V200/Version20.php
  2. 34
      app/Migrations/Schema/V200/Version20180904175500.php
  3. 9
      assets/css/app.scss
  4. 8
      assets/js/app.js
  5. 11
      assets/js/vendor.js
  6. 4
      composer.json
  7. 1
      config/bundles.php
  8. 15
      config/packages/graphql.yaml
  9. 3
      config/packages/twig.yaml
  10. 3
      config/routes/graphql.yaml
  11. 8
      config/services.yaml
  12. 2
      main/blog/blog.php
  13. 1
      main/calendar/agenda_js.php
  14. 32
      main/cron/import_csv.php
  15. 18
      main/document/showinframes.php
  16. 2
      main/exercise/admin.php
  17. 16
      main/exercise/exercise.class.php
  18. 7
      main/exercise/hotspot_admin.inc.php
  19. 6
      main/exercise/overview.php
  20. 2
      main/exercise/stats.php
  21. 2
      main/gradebook/certificate_report.php
  22. 17
      main/gradebook/gradebook_edit_result.php
  23. 23
      main/gradebook/gradebook_statistics.php
  24. 147
      main/gradebook/gradebook_view_result.php
  25. 29
      main/gradebook/lib/be/category.class.php
  26. 11
      main/gradebook/lib/be/result.class.php
  27. 23
      main/gradebook/lib/fe/displaygradebook.php
  28. 5
      main/gradebook/lib/fe/evalform.class.php
  29. 69
      main/gradebook/lib/fe/resulttable.class.php
  30. 101
      main/inc/global.inc.php
  31. 30
      main/inc/global_error_message.inc.php
  32. 9
      main/inc/introductionSection.inc.php
  33. 3
      main/inc/lib/AnnouncementManager.php
  34. 265
      main/inc/lib/add_course.lib.inc.php
  35. 1
      main/inc/lib/agenda.lib.php
  36. 168
      main/inc/lib/api.lib.php
  37. 7
      main/inc/lib/certificate.lib.php
  38. 31
      main/inc/lib/course.lib.php
  39. 3
      main/inc/lib/events.lib.php
  40. 37
      main/inc/lib/exercise.lib.php
  41. 62
      main/inc/lib/fileUpload.lib.php
  42. 12
      main/inc/lib/message.lib.php
  43. 3
      main/inc/lib/notification.lib.php
  44. 2
      main/inc/lib/security.lib.php
  45. 10
      main/inc/lib/sortable_table.class.php
  46. 192
      main/inc/lib/template.lib.php
  47. 4
      main/inc/lib/urlmanager.lib.php
  48. 17
      main/inc/lib/userportal.lib.php
  49. 4
      main/install/configuration.dist.php
  50. 5
      main/install/index.php
  51. 92
      main/install/install.lib.php
  52. 2
      main/messages/inbox.php
  53. 4
      main/portfolio/index.php
  54. 3
      main/session/about.php
  55. 3
      main/session/resume_session.php
  56. 4
      main/social/group_topics.php
  57. 40
      main/social/personal_data.php
  58. 29
      main/template/default/agenda/month.html.twig
  59. 2
      main/template/default/chat/chat.html.twig
  60. 3
      main/work/work.lib.php
  61. 4
      package.json
  62. 8
      plugin/date/README.md
  63. 22
      plugin/date/index.act.php
  64. 10
      plugin/date/index.dsp.php
  65. 11
      plugin/date/index.php
  66. 20
      plugin/date/plugin.php
  67. 10
      plugin/date/start.php
  68. 109
      src/ApiBundle/GraphQL/Auth.php
  69. 51
      src/ApiBundle/GraphQL/Mutation/RootMutation.php
  70. 68
      src/ApiBundle/GraphQL/Resolver/MessageResolver.php
  71. 52
      src/ApiBundle/GraphQL/Resolver/RootResolver.php
  72. 75
      src/ApiBundle/GraphQL/Resolver/UserResolver.php
  73. 35
      src/ApiBundle/GraphQL/Type/Enum.types.yaml
  74. 21
      src/ApiBundle/GraphQL/Type/Mutation.types.yaml
  75. 75
      src/ApiBundle/GraphQL/Type/Query.types.yaml
  76. 2
      src/CoreBundle/Component/Editor/CkEditor/Toolbar/TestMatching.php
  77. 2
      src/CoreBundle/Component/Editor/CkEditor/Toolbar/TestQuestionDescription.php
  78. 2
      src/CoreBundle/Controller/ResourceController.php
  79. 23
      src/CoreBundle/Entity/AccessUrl.php
  80. 19
      src/CoreBundle/Entity/AccessUrlRelCourse.php
  81. 50
      src/CoreBundle/Entity/Course.php
  82. 27
      src/CoreBundle/Entity/GradebookEvaluation.php
  83. 27
      src/CoreBundle/Entity/GradebookLink.php
  84. 66
      src/CoreBundle/Entity/GradebookResultLog.php
  85. 75
      src/CoreBundle/Entity/Message.php
  86. 23
      src/CoreBundle/Entity/MessageAttachment.php
  87. 5
      src/CoreBundle/Entity/PortfolioCategory.php
  88. 24
      src/CoreBundle/Entity/SessionCategory.php
  89. 2
      src/CoreBundle/Entity/SessionRelCourseRelUser.php
  90. 51
      src/CoreBundle/Entity/Templates.php
  91. 52
      src/CoreBundle/Entity/TrackEAttempt.php
  92. 66
      src/CoreBundle/Entity/TrackEHotspot.php
  93. 50
      src/CoreBundle/Entity/TrackEUploads.php
  94. 11
      src/CoreBundle/EventListener/LegacyListener.php
  95. 125
      src/CoreBundle/EventListener/LegacyLoginListener.php
  96. 44
      src/CoreBundle/EventListener/LocaleListener.php
  97. 43
      src/CoreBundle/Repository/MessageRepository.php
  98. 1
      src/CoreBundle/Repository/SessionRepository.php
  99. 25
      src/CoreBundle/Resources/views/Admin/switcher_links.html.twig
  100. 2
      src/CoreBundle/Resources/views/Index/page.html.twig
  101. Some files were not shown because too many files have changed in this diff Show More

@ -38,7 +38,6 @@ class Version20 extends AbstractMigrationChamilo
$this->addSql('CREATE TABLE IF NOT EXISTS classification__tag (id INT AUTO_INCREMENT NOT NULL, context INT DEFAULT NULL, name VARCHAR(255) NOT NULL, enabled TINYINT(1) NOT NULL, slug VARCHAR(190) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_CA57A1C7E25D857E (context), UNIQUE INDEX tag_context (slug, context), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;');
$this->addSql('CREATE TABLE IF NOT EXISTS classification__collection (id INT AUTO_INCREMENT NOT NULL, context INT DEFAULT NULL, media_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, enabled TINYINT(1) NOT NULL, slug VARCHAR(190) NOT NULL, description VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_A406B56AE25D857E (context), INDEX IDX_A406B56AEA9FDD75 (media_id), UNIQUE INDEX tag_collection (slug, context), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;');
$this->addSql('CREATE UNIQUE INDEX UNIQ_A406B56A989D9B62 ON classification__collection (slug)');
$this->addSql('CREATE TABLE IF NOT EXISTS classification__context (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, enabled TINYINT(1) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;');
$this->addSql('CREATE TABLE IF NOT EXISTS classification__category (id INT AUTO_INCREMENT NOT NULL, parent_id INT DEFAULT NULL, context INT DEFAULT NULL, media_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, enabled TINYINT(1) NOT NULL, slug VARCHAR(255) NOT NULL, description VARCHAR(255) DEFAULT NULL, position INT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_43629B36727ACA70 (parent_id), INDEX IDX_43629B36E25D857E (context), INDEX IDX_43629B36EA9FDD75 (media_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;');
$this->addSql('CREATE TABLE IF NOT EXISTS media__gallery_media (id INT AUTO_INCREMENT NOT NULL, gallery_id INT DEFAULT NULL, media_id INT DEFAULT NULL, position INT NOT NULL, enabled TINYINT(1) NOT NULL, updated_at DATETIME NOT NULL, created_at DATETIME NOT NULL, INDEX IDX_80D4C5414E7AF8F (gallery_id), INDEX IDX_80D4C541EA9FDD75 (media_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;');
@ -125,7 +124,7 @@ class Version20 extends AbstractMigrationChamilo
$this->addSql('ALTER TABLE hook_observer CHANGE class_name class_name VARCHAR(190) DEFAULT NULL');
$connection = $this->getEntityManager()->getConnection();
$sql = "SELECT * FROM course_category";
$sql = 'SELECT * FROM course_category';
$result = $connection->executeQuery($sql);
$all = $result->fetchAll();
@ -143,13 +142,11 @@ class Version20 extends AbstractMigrationChamilo
}
$this->addSql('ALTER TABLE course_category CHANGE parent_id parent_id INT DEFAULT NULL;');
$this->addSql('ALTER TABLE course_category ADD CONSTRAINT FK_AFF87497727ACA70 FOREIGN KEY (parent_id) REFERENCES course_category (id);');
$this->addSql('ALTER TABLE settings_current ADD CONSTRAINT FK_62F79C3B9436187B FOREIGN KEY (access_url) REFERENCES access_url (id);');
$this->addSql('ALTER TABLE settings_current CHANGE variable variable VARCHAR(190) DEFAULT NULL, CHANGE subkey subkey VARCHAR(190) DEFAULT NULL;');
$this->addSql('ALTER TABLE settings_options CHANGE variable variable VARCHAR(190) DEFAULT NULL, CHANGE value value VARCHAR(190) DEFAULT NULL');
$this->addSql(' ALTER TABLE hook_event CHANGE class_name class_name VARCHAR(190) DEFAULT NULL;');
$this->addSql('ALTER TABLE hook_event CHANGE class_name class_name VARCHAR(190) DEFAULT NULL;');
$this->addSql('ALTER TABLE access_url_rel_session ADD id INT AUTO_INCREMENT NOT NULL, CHANGE access_url_id access_url_id INT DEFAULT NULL, CHANGE session_id session_id INT DEFAULT NULL, ADD PRIMARY KEY (id);');
$this->addSql('ALTER TABLE access_url_rel_session ADD CONSTRAINT FK_6CBA5F5D613FECDF FOREIGN KEY (session_id) REFERENCES session (id);');
@ -171,6 +168,17 @@ class Version20 extends AbstractMigrationChamilo
$this->addSql('UPDATE session_category SET date_start = NULL WHERE date_start = "0000-00-00"');
$this->addSql('UPDATE session_category SET date_end = NULL WHERE date_end = "0000-00-00"');
$this->addSql('DELETE FROM message WHERE user_sender_id IS NULL OR user_sender_id = 0');
$this->addSql('ALTER TABLE message CHANGE user_receiver_id user_receiver_id INT DEFAULT NULL');
$this->addSql('UPDATE message SET user_receiver_id = NULL WHERE user_receiver_id = 0');
$this->addSql('DELETE FROM message WHERE user_sender_id NOT IN (SELECT id FROM user)');
$this->addSql('DELETE FROM message WHERE user_receiver_id IS NOT NULL AND user_receiver_id NOT IN (SELECT id FROM user)');
$this->addSql('ALTER TABLE message ADD CONSTRAINT FK_B6BD307FF6C43E79 FOREIGN KEY (user_sender_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE message ADD CONSTRAINT FK_B6BD307F64482423 FOREIGN KEY (user_receiver_id) REFERENCES user (id)');
$table = $schema->getTable('message');
if (!$table->hasIndex('idx_message_user_receiver_status')) {
$this->addSql('CREATE INDEX idx_message_user_receiver_status ON message (user_receiver_id, msg_status)');
@ -250,7 +258,7 @@ class Version20 extends AbstractMigrationChamilo
$tables = [
'shared_survey',
'specific_field_values',
'templates'
'templates',
];
foreach ($tables as $table) {
@ -400,7 +408,7 @@ class Version20 extends AbstractMigrationChamilo
'show_glossary_in_documents' => 'document',
'show_glossary_in_extra_tools' => 'glossary',
//'show_toolshortcuts' => '',
'survey_email_sender_noreply'=> 'survey',
'survey_email_sender_noreply' => 'survey',
'allow_coach_feedback_exercises' => 'exercise',
'sessionadmin_autosubscribe' => 'registration',
'sessionadmin_page_after_login' => 'registration',
@ -410,7 +418,7 @@ class Version20 extends AbstractMigrationChamilo
'icons_mode_svg' => 'display',
'server_type' => 'platform',
'show_official_code_whoisonline' => 'platform',
'show_terms_if_profile_completed' => 'ticket'
'show_terms_if_profile_completed' => 'ticket',
];
foreach ($settings as $variable => $category) {
@ -496,7 +504,7 @@ class Version20 extends AbstractMigrationChamilo
// Portfolio
if (!$schema->hasTable('portfolio')) {
$this->addSql('CREATE TABLE portfolio_category (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, title LONGTEXT NOT NULL, description LONGTEXT DEFAULT NULL, is_visible TINYINT(1) DEFAULT "1" NOT NULL, INDEX user (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;');
$this->addSql('CREATE TABLE portfolio_category (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, title LONGTEXT DEFAULT NULL, description LONGTEXT DEFAULT NULL, is_visible TINYINT(1) DEFAULT "1" NOT NULL, INDEX user (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;');
$this->addSql('CREATE TABLE portfolio (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, c_id INT DEFAULT NULL, session_id INT DEFAULT NULL, category_id INT DEFAULT NULL, title LONGTEXT NOT NULL, content LONGTEXT NOT NULL, creation_date DATETIME NOT NULL, update_date DATETIME NOT NULL, is_visible TINYINT(1) DEFAULT "1" NOT NULL, INDEX user (user_id), INDEX course (c_id), INDEX session (session_id), INDEX category (category_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;');
$this->addSql('ALTER TABLE portfolio_category ADD CONSTRAINT FK_7AC64359A76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE portfolio ADD CONSTRAINT FK_A9ED1062A76ED395 FOREIGN KEY (user_id) REFERENCES user (id);');
@ -559,7 +567,6 @@ class Version20 extends AbstractMigrationChamilo
$this->addSql('ALTER TABLE c_glossary CHANGE name name LONGTEXT NOT NULL');
$this->addSql('ALTER TABLE c_tool CHANGE name name LONGTEXT NOT NULL');
$this->addSql('ALTER TABLE portfolio CHANGE title title LONGTEXT NOT NULL');
$this->addSql('ALTER TABLE portfolio_category CHANGE title title LONGTEXT NOT NULL');
$table = $schema->getTable('gradebook_category');
if (!$table->hasColumn('gradebooks_to_validate_in_dependence')) {
@ -639,8 +646,8 @@ class Version20 extends AbstractMigrationChamilo
$this->addSql('ALTER TABLE c_document ADD CONSTRAINT FK_C9FA0CBD1BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id);');
$this->addSql('CREATE UNIQUE INDEX UNIQ_C9FA0CBD1BAD783F ON c_document (resource_node_id)');
$this->addSql('ALTER TABLE c_document CHANGE session_id session_id INT DEFAULT NULL;');
$this->addSql('UPDATE c_document SET session_id = null WHERE session_id = 0');
$this->addSql('ALTER TABLE c_document ADD CONSTRAINT FK_C9FA0CBD613FECDF FOREIGN KEY (session_id) REFERENCES session (id)');
$this->addSql('CREATE INDEX IDX_C9FA0CBD613FECDF ON c_document (session_id)');
@ -659,6 +666,55 @@ class Version20 extends AbstractMigrationChamilo
$this->addSql('ALTER TABLE access_url_rel_usergroup ADD CONSTRAINT FK_AD488DD573444FD5 FOREIGN KEY (access_url_id) REFERENCES access_url (id)');
$this->addSql('CREATE INDEX IDX_AD488DD573444FD5 ON access_url_rel_usergroup (access_url_id)');
$this->addSql('ALTER TABLE track_e_exercises CHANGE session_id session_id INT NOT NULL');
// Update template
$this->addSql('DELETE FROM templates WHERE course_code NOT IN (SELECT code FROM course)');
$this->addSql('ALTER TABLE templates ADD c_id INT DEFAULT NULL');
$this->addSql('CREATE INDEX IDX_6F287D8E91D79BD3 ON templates (c_id)');
$this->addSql('ALTER TABLE templates ADD CONSTRAINT FK_6F287D8E91D79BD3 FOREIGN KEY (c_id) REFERENCES course (id)');
$this->addSql('UPDATE templates SET c_id = (SELECT id FROM course WHERE code = course_code)');
$this->addSql('ALTER TABLE gradebook_result_log CHANGE id_result result_id INT NOT NULL');
$this->addSql('ALTER TABLE c_group_info CHANGE category_id category_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE c_quiz_question_category ADD session_id INT DEFAULT NULL');
$this->addSql('CREATE INDEX IDX_1414369D613FECDF ON c_quiz_question_category (session_id)');
$this->addSql('ALTER TABLE c_quiz_question_category ADD CONSTRAINT FK_1414369D613FECDF FOREIGN KEY (session_id) REFERENCES session (id)');
$this->addSql('ALTER TABLE track_e_attempt CHANGE c_id c_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE track_e_attempt ADD CONSTRAINT FK_F8C342C391D79BD3 FOREIGN KEY (c_id) REFERENCES course (id)');
$this->addSql('ALTER TABLE track_e_hotspot ADD CONSTRAINT FK_A89CC3B691D79BD3 FOREIGN KEY (c_id) REFERENCES course (id)');
$this->addSql('CREATE INDEX IDX_A89CC3B691D79BD3 ON track_e_hotspot (c_id)');
// Drop unused columns
$dropColumnsAndIndex = [
'track_e_uploads' => ['columns' => ['upload_cours_id'], 'index' => ['upload_cours_id']],
'track_e_hotspot' => ['columns' => ['hotspot_course_code'], 'index' => ['hotspot_course_code']],
'templates' => ['columns' => ['course_code'], 'index' => []],
];
foreach ($dropColumnsAndIndex as $tableName => $data) {
if ($schema->hasTable($tableName)) {
$indexList = $data['index'];
foreach ($indexList as $index) {
if ($table->hasIndex($index)) {
$table->dropIndex($index);
}
}
$columns = $data['columns'];
$table = $schema->getTable($tableName);
foreach ($columns as $column) {
if ($table->hasColumn($column)) {
$table->dropColumn($column);
}
}
}
}
// Drop unused tables
$dropTables = ['event_email_template', 'event_sent', 'user_rel_event_type', 'openid_association'];
foreach ($dropTables as $table) {

@ -0,0 +1,34 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V200;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Class Version20180904175500
*
* Add foreign key from message
*
* @package Application\Migrations\Schema\V200
*/
class Version20180904175500 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->addSql('CREATE INDEX IDX_B68FF524537A1329 ON message_attachment (message_id)');
$this->addSql('ALTER TABLE message_attachment CHANGE message_id message_id BIGINT NOT NULL');
$this->addSql('ALTER TABLE message_attachment ADD CONSTRAINT FK_B68FF524537A1329 FOREIGN KEY (message_id) REFERENCES message (id)');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
}
}

@ -2,5 +2,12 @@
@import "~@fortawesome/fontawesome-free/css/all.css";
@import '~chosen-js/chosen.css';
@import '~flag-icon-css/sass/flag-icon.scss';
@import 'base.css';
@import "~fullcalendar/dist/fullcalendar.css";
@import "~select2/dist/css/select2.css";
@import "~bootstrap-daterangepicker/daterangepicker.scss";
@import "~bootstrap-select/dist/css/bootstrap-select.css";
@import '~jquery-ui/themes/base/all.css';
@import 'base.css';

@ -3,11 +3,7 @@ const routes = require('../../public/js/fos_js_routes.json');
import Routing from '../../vendor/friendsofsymfony/jsrouting-bundle/Resources/public/js/router.min.js';
Routing.setRoutingData(routes);
import 'image-map-resizer';
import 'jquery.scrollbar';
import 'jquery-ui/ui/widgets/datepicker';
import 'jquery-ui/ui/widgets/tooltip';
import 'chosen-js';
require('./vendor');
// @todo rework url naming
var homePublicUrl = Routing.generate('home') + 'public/';
@ -455,7 +451,7 @@ function setCheckbox(value, table_id) {
}
function action_click(element, table_id) {
d = $("#"+table_id);
var d = $("#"+table_id);
if (!confirm('ConfirmYourChoice')) {
//if (!confirm('{{ "ConfirmYourChoice"|get_lang }}')) {
return false;

@ -2,10 +2,6 @@ var moment = require("moment");
require("moment/min/locales.min");
global.moment = moment;
var $ = require("jquery");
// create global $ and jQuery variables
window.jQuery = window.$ = global.$ = global.jQuery = $;
require("webpack-jquery-ui");
require("webpack-jquery-ui/css");
@ -25,14 +21,10 @@ require("jquery.scrollbar");
require("blueimp-file-upload");
require("select2");
require("timeago");
require("select2/dist/css/select2.css");
require('bootstrap-select/dist/js/bootstrap-select.js');
require('bootstrap-select/dist/css/bootstrap-select.css');
require('flag-icon-css/css/flag-icon.css');
require("bootstrap-daterangepicker");
require("bootstrap-daterangepicker/daterangepicker.scss");
require("fullcalendar/dist/fullcalendar.js");
require("fullcalendar/dist/fullcalendar.css");
require("fullcalendar/dist/gcal.js");
require("fullcalendar/dist/locale-all.js");
@ -40,7 +32,6 @@ require("fullcalendar/dist/locale-all.js");
// doesn't work with webpack added directly in /public/libs folder
/*
require("fullcalendar");
require("pwstrength-bootstrap");
require("js-cookie");

@ -156,7 +156,9 @@
"liip/theme-bundle": "^1.5",
"a2lix/translation-form-bundle": "^3.0",
"lunetics/locale-bundle": "^2.6",
"oneup/uploader-bundle": "^2.0"
"oneup/uploader-bundle": "^2.0",
"overblog/graphql-bundle": "^0.11.4",
"firebase/php-jwt": "^5.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.7",

@ -71,4 +71,5 @@ return [
Ivory\CKEditorBundle\IvoryCKEditorBundle::class => ['all' => true],
Oneup\UploaderBundle\OneupUploaderBundle::class => ['all' => true],
APY\DataGridBundle\APYDataGridBundle::class => ['all' => true],
Overblog\GraphQLBundle\OverblogGraphQLBundle::class => ['all' => true],
];

@ -0,0 +1,15 @@
overblog_graphql:
definitions:
schema:
query: Query
mutation: Mutation
mappings:
auto_discover: false
types:
# -
# type: yaml
# dir: "%kernel.project_dir%/config/graphql/types"
# suffix: ~
-
type: yaml
dir: "%kernel.root_dir%/ApiBundle/GraphQL/Type"

@ -10,13 +10,10 @@ twig:
show_footer: true
software_name: Chamilo
version: 2
session_teachers:
teachers:
news_counter:
news_list:
messages_count:
message_link:
administrator_name:
execution_stats:
course_session_block:
show_course_shortcut:

@ -0,0 +1,3 @@
overblog_graphql_endpoint:
resource: "@OverblogGraphQLBundle/Resources/config/routing/graphql.yml"
prefix: /graphql

@ -41,6 +41,14 @@ services:
arguments:
$debug: '%kernel.debug%'
Chamilo\ApiBundle\GraphQL\Resolver\:
resource: '../src/ApiBundle/GraphQL/Resolver'
tags: ['overblog_graphql.resolver']
Chamilo\ApiBundle\GraphQL\Mutation\:
resource: '../src/ApiBundle/GraphQL/Mutation'
tags: ['overblog_graphql.mutation']
sylius_settings:
driver: doctrine/orm

@ -436,7 +436,7 @@ $content = $tpl->fetch($blogLayout);
if ($actionsLeft) {
$tpl->assign(
'actions',
Display::return_introduction_section(TOOL_BLOGS)
Display::return_introduction_section(TOOL_BLOGS."_$blog_id")
.Display::toolbarAction('toolbar', [$actionsLeft])
);
}

@ -165,6 +165,7 @@ if ($type == 'course' && !empty($group_id)) {
}
$defaultView = api_get_setting('default_calendar_view');
if (empty($defaultView)) {
$defaultView = 'month';
}

@ -1029,7 +1029,7 @@ class ImportCsv
}
if (empty($sessionId)) {
$this->logger->addInfo("external_sessionID: ".$externalSessionId." does not exists.");
$this->logger->addInfo("external_sessionID: $externalSessionId does not exists.");
}
$teacherId = null;
$sessionInfo = [];
@ -1082,13 +1082,11 @@ class ImportCsv
$startDateMonth = substr($date, 4, 2);
$startDateDay = substr($date, 6, 8);
$startDate = $startDateYear.'-'.$startDateMonth.'-'.$startDateDay.' '.$startTime.":00";
$endDate = $startDateYear.'-'.$startDateMonth.'-'.$startDateDay.' '.$endTime.":00";
$startDate = $startDateYear.'-'.$startDateMonth.'-'.$startDateDay.' '.$startTime.':00';
$endDate = $startDateYear.'-'.$startDateMonth.'-'.$startDateDay.' '.$endTime.':00';
if (!api_is_valid_date($startDate) || !api_is_valid_date($endDate)) {
$this->logger->addInfo(
"Verify your dates: '$startDate' : '$endDate' "
);
$this->logger->addInfo("Verify your dates: '$startDate' : '$endDate' ");
$errorFound = true;
}
@ -1124,7 +1122,7 @@ class ImportCsv
}
if (empty($eventsToCreate)) {
$this->logger->addInfo("No events to add");
$this->logger->addInfo('No events to add');
return 0;
}
@ -1134,9 +1132,7 @@ class ImportCsv
$externalEventId = null;
$extraField = new ExtraField('calendar_event');
$extraFieldInfo = $extraField->get_handler_field_info_by_field_variable(
$extraFieldName
);
$extraFieldInfo = $extraField->get_handler_field_info_by_field_variable($extraFieldName);
if (empty($extraFieldInfo)) {
$this->logger->addInfo(
@ -1396,6 +1392,12 @@ class ImportCsv
$this->logger->addInfo(
"Mail to be sent because start date: ".$event['start']." and no announcement found."
);
$senderId = $this->defaultAdminId;
if (!empty($coaches) && isset($coaches[0]) && !empty($coaches[0])) {
$senderId = $coaches[0];
}
$announcementId = AnnouncementManager::add_announcement(
$courseInfo,
$event['session_id'],
@ -1409,12 +1411,12 @@ class ImportCsv
null,
null,
false,
$this->defaultAdminId
$senderId
);
if ($announcementId) {
$this->logger->addInfo("Announcement added: ".(int) ($announcementId)." in $info");
$this->logger->addInfo("<<--SENDING MAIL-->>");
$this->logger->addInfo("Announcement added: $announcementId in $info");
$this->logger->addInfo("<<--SENDING MAIL Sender id: $senderId-->>");
$report['mail_sent']++;
AnnouncementManager::sendEmail(
$courseInfo,
@ -1423,11 +1425,11 @@ class ImportCsv
false,
false,
$this->logger,
$this->defaultAdminId
$senderId
);
} else {
$this->logger->addError(
"Error when trying to add announcement with title ".$subject." here: $info"
"Error when trying to add announcement with title $subject here: $info and SenderId = $senderId"
);
}
} else {

@ -27,7 +27,7 @@ require_once __DIR__.'/../inc/global.inc.php';
api_protect_course_script();
$header_file = isset($_GET['file']) ? Security::remove_XSS($_GET['file']) : null;
$document_id = intval($_GET['id']);
$document_id = (int) $_GET['id'];
$originIsLearnpath = isset($_GET['origin']) && $_GET['origin'] === 'learnpathitem';
$courseInfo = api_get_course_info();
$course_code = api_get_course_id();
@ -174,20 +174,8 @@ if (api_is_course_admin()) {
}
$js_glossary_in_documents = '
$.frameReady(function(){
// $("<div>I am a div courses</div>").prependTo("body");
}, "top.mainFrame",
{
load: [
{ type:"script", id:"_fr1", src:"'.api_get_jquery_web_path().'"},
{ type:"script", id:"_fr7", src:"'.api_get_path(WEB_PUBLIC_PATH).'assets/MathJax/MathJax.js?config=AM_HTMLorMML"},
{ type:"script", id:"_fr4", src:"'.api_get_path(WEB_PUBLIC_PATH).'assets/jquery-ui/jquery-ui.min.js"},
{ type:"stylesheet", id:"_fr5", src:"'.api_get_path(WEB_PUBLIC_PATH).'assets/jquery-ui/themes/smoothness/jquery-ui.min.css"},
{ type:"stylesheet", id:"_fr6", src:"'.api_get_path(WEB_PUBLIC_PATH).'assets/jquery-ui/themes/smoothness/theme.css"},
{ type:"script", id:"_fr2", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.highlight.js"},
{ type:"script", id:"_fr3", src:"'.api_get_path(WEB_CODE_PATH).'glossary/glossary.js.php?'.api_get_cidreq().'"}
]
});';
setFrameReady("mainFrame");
';
$web_odf_supported_files = DocumentManager::get_web_odf_extension_list();
// PDF should be displayed with viewerJS

@ -127,7 +127,6 @@ $objAnswer = Session::read('objAnswer');
$_course = api_get_course_info();
// document path
$documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
// picture path
@ -308,6 +307,7 @@ if ($modifyIn == 'thisExercise') {
$modifyIn = 'allExercises';
}
}
$htmlHeadXtra[] = api_get_js('jqueryui-touch-punch/jquery.ui.touch-punch.min.js');
$htmlHeadXtra[] = api_get_js('jquery.jsPlumb.all.js');

@ -8201,17 +8201,17 @@ class Exercise
'<table width="730" height="136" border="0" cellpadding="3" cellspacing="3">';
$msg .= $open_question_list;
$msg .= '</table><br />';
$msg1 = str_replace("#exercise#", $this->exercise, $msg);
$msg = str_replace("#firstName#", $user_info['firstname'], $msg1);
$msg1 = str_replace("#lastName#", $user_info['lastname'], $msg);
$msg = str_replace("#mail#", $user_info['email'], $msg1);
$msg = str_replace("#course#", $courseInfo['name'], $msg1);
$msg = str_replace("#exercise#", $this->exercise, $msg);
$msg = str_replace("#firstName#", $user_info['firstname'], $msg);
$msg = str_replace("#lastName#", $user_info['lastname'], $msg);
$msg = str_replace("#mail#", $user_info['email'], $msg);
$msg = str_replace("#course#", $courseInfo['name'], $msg);
if ($origin != 'learnpath') {
$msg .= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>';
}
$msg1 = str_replace("#url#", $url_email, $msg);
$mail_content = $msg1;
$msg = str_replace("#url#", $url_email, $msg);
$subject = get_lang('OpenQuestionsAttempted');
if (!empty($teachers)) {
@ -8219,7 +8219,7 @@ class Exercise
MessageManager::send_message_simple(
$user_id,
$subject,
$mail_content
$msg
);
}
}

@ -11,7 +11,7 @@ use ChamiloSession as Session;
*
* @author Toon Keppens
*/
$modifyAnswers = intval($_GET['hotspotadmin']);
$modifyAnswers = (int) $_GET['hotspotadmin'];
if (!is_object($objQuestion)) {
$objQuestion = Question::read($modifyAnswers);
@ -30,7 +30,7 @@ if ($modifyIn) {
echo '$modifyIn was set'."<br />\n";
}
// if the user has chosen to modify the question only in the current exercise
if ($modifyIn == 'thisExercise') {
if ($modifyIn === 'thisExercise') {
// duplicates the question
$questionId = $objQuestion->duplicate();
@ -71,14 +71,13 @@ $hotspot_admin_url = api_get_path(WEB_CODE_PATH).'exercise/admin.php?'.api_get_c
// the answer form has been submitted
$submitAnswers = isset($_POST['submitAnswers']) ? true : false;
$buttonBack = isset($_POST['buttonBack']) ? true : false;
$nbrAnswers = isset($_POST['nbrAnswers']) ? intval($_POST['nbrAnswers']) : 0;
$nbrAnswers = isset($_POST['nbrAnswers']) ? (int) $_POST['nbrAnswers'] : 0;
if ($submitAnswers || $buttonBack) {
if ($answerType == HOT_SPOT) {
if ($debug > 0) {
echo '$submitAnswers or $buttonBack was set'."<br />\n";
}
$questionWeighting = $nbrGoodAnswers = 0;
for ($i = 1; $i <= $nbrAnswers; $i++) {
if ($debug > 0) {

@ -83,12 +83,12 @@ if ($is_allowed_to_edit && $objExercise->sessionId == $sessionId) {
Display::return_icon('edit.png', get_lang('Edit'), [], ICON_SIZE_SMALL),
api_get_path(WEB_CODE_PATH).'exercise/admin.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id
);
} elseif (api_is_teacher()) {
$edit_link = Display::url(
$edit_link .= Display::url(
Display::return_icon('test_results.png', get_lang('Results'), [], ICON_SIZE_SMALL),
'exercise_report.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id
api_get_path(WEB_CODE_PATH).'exercise/exercise_report.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id
);
}
$iconExercise = Display::return_icon('test-quiz.png', null, [], ICON_SIZE_MEDIUM);
// Exercise name.

@ -235,7 +235,7 @@ if (!empty($question_list)) {
$answer_id,
$question_id,
$exerciseId,
$courseCode,
api_get_course_int_id(),
$sessionId
);
$percentage = 0;

@ -1,6 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* List all certificates filtered by session/course and month/year.
*

@ -37,8 +37,23 @@ if ($edit_result_form->validate()) {
if (empty($score)) {
$score = 0;
}
$result->set_score(api_number_format($score, api_get_setting('gradebook_number_decimals')));
$score = api_number_format($score, api_get_setting('gradebook_number_decimals'));
$result->set_score($score);
$result->save();
$allowMultipleAttempts = api_get_configuration_value('gradebook_multiple_evaluation_attempts');
if ($allowMultipleAttempts) {
$table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_RESULT_ATTEMPT);
$now = api_get_utc_datetime();
$params = [
'result_id' => $result->get_id(),
'score' => $score,
'comment' => '',
'created_at' => $now,
'updated_at' => $now,
];
Database::insert($table, $params);
}
}
Display::addFlash(Display::return_message(get_lang('AllResultsEdited')));
header('Location: gradebook_view_result.php?selecteval='.$select_eval.'&'.api_get_cidreq());

@ -10,13 +10,20 @@ require_once __DIR__.'/../inc/global.inc.php';
api_block_anonymous_users();
$eval = Evaluation :: load($_GET['selecteval']);
if ($eval[0]->get_category_id() < 0) {
$categoryId = (int) $_GET['selecteval'];
$eval = Evaluation::load($categoryId);
if (!isset($eval[0])) {
api_not_allowed(true);
}
/** @var Evaluation $eval */
$eval = $eval[0];
if ($eval->get_category_id() < 0) {
// if category id is negative, then the evaluation's origin is a link
$link = LinkFactory::get_evaluation_link($eval[0]->get_id());
$link = LinkFactory::get_evaluation_link($eval->get_id());
$currentcat = Category::load($link->get_category_id());
} else {
$currentcat = Category::load($eval[0]->get_category_id());
$currentcat = Category::load($eval->get_category_id());
}
$interbreadcrumb[] = [
@ -26,7 +33,7 @@ $interbreadcrumb[] = [
if (api_is_allowed_to_edit()) {
$interbreadcrumb[] = [
'url' => 'gradebook_view_result.php?selecteval='.intval($_GET['selecteval']).'&'.api_get_cidreq(),
'url' => 'gradebook_view_result.php?selecteval='.$categoryId.'&'.api_get_cidreq(),
'name' => get_lang('ViewResult'),
];
}
@ -34,7 +41,7 @@ $displayScore = ScoreDisplay::instance();
Display::display_header(get_lang('EvaluationStatistics'));
DisplayGradebook::display_header_result(
$eval[0],
$eval,
$currentcat[0]->get_id(),
0,
'statistics'
@ -48,7 +55,7 @@ if (!$displayScore->is_custom() || empty($displays)) {
echo Display::return_message(get_lang('PleaseEnableScoringSystem'), 'error', false);
}
} else {
$allresults = Result::load(null, null, $eval[0]->get_id());
$allresults = Result::load(null, null, $eval->get_id());
$nr_items = [];
foreach ($displays as $itemsdisplay) {
$nr_items[$itemsdisplay['display']] = 0;
@ -59,7 +66,7 @@ if (!$displayScore->is_custom() || empty($displays)) {
$score = $result->get_score();
if (isset($score)) {
$display = $displayScore->display_score(
[$score, $eval[0]->get_max()],
[$score, $eval->get_max()],
SCORE_CUSTOM,
SCORE_ONLY_CUSTOM,
true

@ -54,9 +54,130 @@ if (isset($_GET['selecteval'])) {
$iscourse = !empty(api_get_course_id());
}
$allowMultipleAttempts = api_get_configuration_value('gradebook_multiple_evaluation_attempts');
if (isset($_GET['action'])) {
switch ($_GET['action']) {
case 'delete_attempt':
$result = Result::load($_GET['editres']);
if ($allowMultipleAttempts && !empty($result) && isset($result[0]) && api_is_allowed_to_edit()) {
/** @var Result $result */
$result = $result[0];
$url = api_get_self().'?selecteval='.$select_eval.'&'.api_get_cidreq().'&editres='.$result->get_id();
$table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_RESULT_ATTEMPT);
if (isset($_GET['result_attempt_id'])) {
$attemptId = (int) $_GET['result_attempt_id'];
$sql = "DELETE FROM $table WHERE result_id = ".$result->get_id()." AND id = $attemptId";
Database::query($sql);
Display::addFlash(Display::return_message(get_lang('Deleted')));
}
header('Location: '.$url.'&action=add_attempt');
exit;
}
break;
case 'add_attempt':
$result = Result::load($_GET['editres']);
if ($allowMultipleAttempts && !empty($result) && isset($result[0]) && api_is_allowed_to_edit()) {
/** @var Result $result */
$result = $result[0];
$backUrl = api_get_self().'?selecteval='.$select_eval.'&'.api_get_cidreq();
$interbreadcrumb[] = [
'url' => $backUrl,
'name' => get_lang('Details'),
];
/** @var Evaluation $evaluation */
$evaluation = $eval[0];
$table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_RESULT_ATTEMPT);
$now = api_get_utc_datetime();
$url = api_get_self().'?selecteval='.$select_eval.'&'.api_get_cidreq().'&editres='.$result->get_id();
$form = new FormValidator('attempt', 'post', $url.'&action=add_attempt');
$form->addHeader(get_lang('AddResult'));
$form->addLabel(get_lang('CurrentScore'), $result->get_score());
$form->addFloat(
'score',
[
get_lang('Score'),
null,
'/ '.$evaluation->get_max(),
],
true,
[
'size' => '4',
'maxlength' => '5',
],
false,
0,
$evaluation->get_max()
);
$form->addTextarea('comment', get_lang('Comment'));
/*$form->addRule(
'score',
get_lang('ValueTooBig'),
'max_numeric_length',
$evaluation->get_max()
);*/
$form->addButtonSave(get_lang('Save'));
$attemptList = ResultTable::getResultAttemptTable($result, $url);
$form->addLabel(get_lang('Attempts'), $attemptList);
if ($form->validate()) {
$values = $form->getSubmitValues();
$newScore = $values['score'];
$newScore = api_number_format(
$newScore,
api_get_setting('gradebook_number_decimals')
);
$params = [
'result_id' => $result->get_id(),
'score' => $newScore,
'comment' => $values['comment'],
'created_at' => $now,
'updated_at' => $now,
];
Database::insert($table, $params);
if ($newScore > $result->get_score()) {
$result->set_score($newScore);
$result->save();
}
Display::addFlash(Display::return_message(get_lang('Saved')));
header('Location: '.api_get_self().'?selecteval='.$select_eval.'&'.api_get_cidreq());
exit;
}
Display::display_header();
$items[] = [
'url' => $backUrl,
'content' => Display::return_icon(
'back.png',
get_lang('Back'),
[],
ICON_SIZE_MEDIUM
),
];
echo Display::actions($items);
$form->display();
Display::display_footer();
exit;
}
break;
}
}
if (isset($_GET['editres'])) {
$edit_res_xml = Security::remove_XSS($_GET['editres']);
$resultedit = Result :: load($edit_res_xml);
$resultedit = Result::load($edit_res_xml);
$edit_res_form = new EvalForm(
EvalForm::TYPE_RESULT_EDIT,
$eval[0],
@ -76,15 +197,27 @@ if (isset($_GET['editres'])) {
$result->set_evaluation_id($select_eval);
$row_value = isset($values['score']) ? $values['score'] : 0;
if (!empty($row_value) || $row_value == 0) {
$result->set_score(
api_number_format(
$row_value,
api_get_setting('gradebook_number_decimals')
)
$row_value = api_number_format(
$row_value,
api_get_setting('gradebook_number_decimals')
);
$result->set_score($row_value);
}
$result->save();
unset($result);
if ($allowMultipleAttempts && !empty($result->get_id())) {
$table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_RESULT_ATTEMPT);
$now = api_get_utc_datetime();
$params = [
'result_id' => $result->get_id(),
'score' => $row_value,
'comment' => $values['comment'],
'created_at' => $now,
'updated_at' => $now,
];
Database::insert($table, $params);
}
Display::addFlash(Display::return_message(get_lang('ResultEdited'), 'normal', false));
header('Location: gradebook_view_result.php?selecteval='.$select_eval.'&editresmessage=&'.api_get_cidreq());

@ -806,20 +806,25 @@ class Category implements GradebookItem
/**
* Shows all information of an category.
*
* @param int $categoryId
*
* @return array
*/
public function showAllCategoryInfo($categoryId = '')
public function showAllCategoryInfo($categoryId = 0)
{
if ($categoryId == '') {
return null;
} else {
$table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
$sql = 'SELECT * FROM '.$table.'
WHERE id = '.intval($categoryId);
$result = Database::query($sql);
$row = Database::fetch_array($result, 'ASSOC');
return $row;
$categoryId = (int) $categoryId;
if (empty($categoryId)) {
return [];
}
$table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
$sql = 'SELECT * FROM '.$table.'
WHERE id = '.$categoryId;
$result = Database::query($sql);
$row = Database::fetch_array($result, 'ASSOC');
return $row;
}
/**
@ -913,7 +918,7 @@ class Category implements GradebookItem
* Calculate the score of this category.
*
* @param int $stud_id student id (default: all students - then the average is returned)
* @param int $session_id
* @param $type
* @param string $course_code
* @param int $session_id
*

@ -230,14 +230,13 @@ class Result
public function addResultLog($userid, $evaluationid)
{
if (isset($userid) && isset($evaluationid)) {
$tbl_grade_results_log = Database::get_main_table(TABLE_MAIN_GRADEBOOK_RESULT_LOG);
$table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_RESULT_LOG);
$result = new Result();
$arr_result = $result->load(null, $userid, $evaluationid);
$arr = get_object_vars($arr_result[0]);
$sql = 'INSERT INTO '.$tbl_grade_results_log
.' (id_result,user_id, evaluation_id,created_at';
$sql = 'INSERT INTO '.$table.' (result_id,user_id, evaluation_id,created_at';
if (isset($arr['score'])) {
$sql .= ',score';
}
@ -283,5 +282,11 @@ class Result
$table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_RESULT);
$sql = 'DELETE FROM '.$table.' WHERE id = '.$this->id;
Database::query($sql);
$allowMultipleAttempts = api_get_configuration_value('gradebook_multiple_evaluation_attempts');
if ($allowMultipleAttempts) {
$table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_RESULT_ATTEMPT);
$sql = "DELETE FROM $table WHERE result_id = ".$this->id;
Database::query($sql);
}
}
}

@ -11,7 +11,7 @@ class DisplayGradebook
/**
* Displays the header for the result page containing the navigation tree and links.
*
* @param $evalobj
* @param Evaluation $evalobj
* @param $selectcat
* @param $shownavbar 1=show navigation bar
* @param $forpdf only output for pdf file
@ -74,6 +74,17 @@ class DisplayGradebook
'h3',
get_lang('Score').': '.$scoredisplay->display_score($student_score, SCORE_DIV_PERCENT)
);
$allowMultipleAttempts = api_get_configuration_value('gradebook_multiple_evaluation_attempts');
if ($allowMultipleAttempts) {
$results = Result::load(null, api_get_user_id(), $evalobj->get_id());
if (!empty($results)) {
/** @var Result $resultData */
foreach ($results as $resultData) {
$student_score .= ResultTable::getResultAttemptTable($resultData);
}
}
}
}
}
$description = '';
@ -100,15 +111,7 @@ class DisplayGradebook
if (!$evalobj->has_results()) {
$evalinfo .= '<br /><i>'.get_lang('NoResultsInEvaluation').'</i>';
}
/* Code comment without reason
elseif ($scoredisplay->is_custom() && api_get_self() != '/main/gradebook/gradebook_statistics.php') {
if (api_is_allowed_to_edit(null, true)) {
if ($page != 'statistics') {
//$evalinfo .= '<br /><br /><a href="gradebook_view_result.php?selecteval='.Security::remove_XSS($_GET['selecteval']).'"> '.Display::return_icon(('evaluation_rate.png'),get_lang('ViewResult'),'',ICON_SIZE_MEDIUM) . '</a>';
}
}
}
*/
if ($page != 'statistics') {
if (api_is_allowed_to_edit(null, true)) {
$evalinfo .= '<br /><a href="gradebook_statistics.php?'.api_get_cidreq().'&selecteval='.Security::remove_XSS($_GET['selecteval']).'"> '.

@ -395,6 +395,11 @@ class EvalForm extends FormValidator
$this->evaluation_object->get_max()
);
$allowMultipleAttempts = api_get_configuration_value('gradebook_multiple_evaluation_attempts');
if ($allowMultipleAttempts) {
$this->addTextarea('comment', get_lang('Comment'));
}
$this->addButtonSave(get_lang('Edit'), 'submit');
$this->addElement('hidden', 'hid_user_id', $this->result_object->get_user_id());
}

@ -164,6 +164,54 @@ class ResultTable extends SortableTable
return $sortable_data;
}
/**
* @param Result $result
* @param string $url
*
* @return string
*/
public static function getResultAttemptTable($result, $url = '')
{
if (empty($result)) {
return '';
}
$table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_RESULT_ATTEMPT);
$sql = "SELECT * FROM $table WHERE result_id = ".$result->get_id().' ORDER BY created_at DESC';
$resultQuery = Database::query($sql);
$list = Database::store_result($resultQuery);
$htmlTable = new HTML_Table(['class' => 'data_table']);
$htmlTable->setHeaderContents(0, 0, get_lang('Score'));
$htmlTable->setHeaderContents(0, 1, get_lang('Comment'));
$htmlTable->setHeaderContents(0, 2, get_lang('CreatedAt'));
if (!empty($url)) {
$htmlTable->setHeaderContents(0, 3, get_lang('Actions'));
}
$row = 1;
foreach ($list as $data) {
$htmlTable->setCellContents($row, 0, $data['score']);
$htmlTable->setCellContents($row, 1, $data['comment']);
$htmlTable->setCellContents($row, 2, Display::dateToStringAgoAndLongDate($data['created_at']));
if (!empty($url)) {
$htmlTable->setCellContents(
$row,
3,
Display::url(
Display::return_icon('delete.png', get_lang('Delete')),
$url.'&action=delete_attempt&result_attempt_id='.$data['id']
)
);
}
$row++;
}
return $htmlTable->toHtml();
}
/**
* @param array $item
*
@ -172,10 +220,25 @@ class ResultTable extends SortableTable
private function build_edit_column($item)
{
$locked_status = $this->evaluation->get_locked();
$allowMultipleAttempts = api_get_configuration_value('gradebook_multiple_evaluation_attempts');
$baseUrl = api_get_self().'?selecteval='.$this->evaluation->get_id().'&'.api_get_cidreq();
if (api_is_allowed_to_edit(null, true) && $locked_status == 0) {
//api_is_course_admin()
$edit_column = '<a href="'.api_get_self().'?editres='.$item['result_id'].'&selecteval='.$this->evaluation->get_id().'&'.api_get_cidreq().'">'.
Display::return_icon('edit.png', get_lang('Modify'), '', '22').'</a>';
$edit_column = '';
if ($allowMultipleAttempts) {
if (!empty($item['percentage_score'])) {
$edit_column .=
Display::url(
Display::return_icon('add.png', get_lang('AddAttempt'), '', '22'),
$baseUrl.'&action=add_attempt&editres='.$item['result_id']
);
} else {
$edit_column .= '<a href="'.api_get_self().'?editres='.$item['result_id'].'&selecteval='.$this->evaluation->get_id().'&'.api_get_cidreq().'">'.
Display::return_icon('edit.png', get_lang('Modify'), '', '22').'</a>';
}
} else {
$edit_column .= '<a href="'.api_get_self().'?editres='.$item['result_id'].'&selecteval='.$this->evaluation->get_id().'&'.api_get_cidreq().'">'.
Display::return_icon('edit.png', get_lang('Modify'), '', '22').'</a>';
}
$edit_column .= ' <a href="'.api_get_self().'?delete_mark='.$item['result_id'].'&selecteval='.$this->evaluation->get_id().'&'.api_get_cidreq().'">'.
Display::return_icon('delete.png', get_lang('Delete'), '', '22').'</a>';
}

@ -34,7 +34,6 @@ require_once __DIR__.'/../../public/legacy.php';
// Check the PHP version
api_check_php_version(__DIR__.'/');
try {
// Get settings from .env file created when installation Chamilo
$envFile = __DIR__.'/../../.env';
@ -56,7 +55,6 @@ try {
$response = $kernel->handle($request);
$container = $kernel->getContainer();
if ($kernel->isInstalled()) {
require_once $kernel->getConfigurationFile();
} else {
@ -389,106 +387,11 @@ try {
}
}
// Checking if we have a valid language. If not we set it to the platform language.
$valid_languages = api_get_languages();
if (!empty($valid_languages)) {
if (!in_array($user_language, $valid_languages)) {
$user_language = api_get_setting('platformLanguage');
}
$language_priority1 = api_get_setting('languagePriority1');
$language_priority2 = api_get_setting('languagePriority2');
$language_priority3 = api_get_setting('languagePriority3');
$language_priority4 = api_get_setting('languagePriority4');
if (isset($_GET['language']) ||
(isset($_POST['language_list']) && !empty($_POST['language_list'])) ||
!empty($browser_language)
) {
$user_selected_language = $user_language; // $_GET['language']; or HTTP_ACCEPT_LANGUAGE
$_SESSION['user_language_choice'] = $user_selected_language;
$platformLanguage = $user_selected_language;
}
if (!empty($language_priority4) && api_get_language_from_type($language_priority4) !== false) {
$language_interface = api_get_language_from_type($language_priority4);
} else {
$language_interface = api_get_setting('platformLanguage');
}
if (!empty($language_priority3) && api_get_language_from_type($language_priority3) !== false) {
$language_interface = api_get_language_from_type($language_priority3);
} else {
if (isset($_SESSION['user_language_choice'])) {
$language_interface = $_SESSION['user_language_choice'];
}
}
if (!empty($language_priority2) && api_get_language_from_type($language_priority2) !== false) {
$language_interface = api_get_language_from_type($language_priority2);
} else {
if (isset($_user['language'])) {
$language_interface = $_user['language'];
}
}
if (!empty($language_priority1) && api_get_language_from_type($language_priority1) !== false) {
$language_interface = api_get_language_from_type($language_priority1);
} else {
if (isset($_course['language'])) {
$language_interface = $_course['language'];
}
}
// If language is set via browser ignore the priority
if (isset($_GET['language'])) {
$language_interface = $user_language;
}
$allow = api_get_configuration_value('show_language_selector_in_menu');
// Overwrite all lang configs and use the menu language
if ($allow) {
if (isset($_SESSION['user_language_choice'])) {
$userEntity = api_get_user_entity(api_get_user_id());
if ($userEntity) {
if (isset($_GET['language'])) {
$language_interface = $_SESSION['user_language_choice'];
$userEntity->setLanguage($language_interface);
Database::getManager()->merge($userEntity);
Database::getManager()->flush();
// Update cache
api_get_user_info(
api_get_user_id(),
true,
false,
true,
false,
true,
true
);
if (isset($_SESSION['_user'])) {
$_SESSION['_user']['language'] = $language_interface;
}
}
$language_interface = $_SESSION['user_language_choice'] = $userEntity->getLanguage();
}
} else {
$userInfo = api_get_user_info();
if (!empty($userInfo['language'])) {
$_SESSION['user_language_choice'] = $userInfo['language'];
$language_interface = $userInfo['language'];
}
}
}
}
/**
* Include the trad4all language file.
*/
// if the sub-language feature is on
$parent_path = SubLanguageManager::get_parent_language_path($language_interface);
/*$parent_path = SubLanguageManager::get_parent_language_path($language_interface);
if (!empty($parent_path)) {
// include English
include $langpath.'english/trad4all.inc.php';
@ -514,7 +417,7 @@ try {
if (file_exists($langfile)) {
include $langfile;
}
}
}*/
// include the local (contextual) parameters of this course or section
//require_once __DIR__.'/local.inc.php';

@ -58,14 +58,14 @@ if (is_int($global_error_code) && $global_error_code > 0) {
$root_rel = '';
$installation_guide_url = $root_rel.'documentation/installation_guide.html';
$css_list = [
'public/build/chamilo.css',
'public/build/vendor.css',
'public/build/css/app.css',
'public/build/css/base.css',
'public/build/css/themes/'.$theme.'/default.css',
];
$web_img = 'main/img';
$root_sys = str_replace('\\', '/', realpath(__DIR__.'/../../')).'/';
$css_def = '';
foreach ($css_list as $cssFile) {
$cssFile = $root_sys.$cssFile;
@ -272,35 +272,27 @@ EOM;
</div>
</header>
<section id="menu-bar">
<nav class="navbar navbar-default">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#menuone" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse" id="menuone">
<ul class="nav navbar-nav">
<li id="current" class="active tab-homepage"><a href="#" target="_self">Homepage</a></li>
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<div class="container">
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only"></span></a>
</li>
</ul>
</div>
</div>
</div>
</nav>
</section>
<section id="content-error">
<div class="container">
<div class="panel panel-default">
<div class="panel-body">
<div class="well">
<div class="alert alert-danger" role="alert">
{DESCRIPTION}
{CODE}
</div>
</div>
</div>
</div>
</section>
</div>

@ -32,6 +32,7 @@ use Chamilo\CourseBundle\Entity\CToolIntro;
$em = Database::getManager();
$intro_editAllowed = $is_allowed_to_edit = api_is_allowed_to_edit();
$session_id = api_get_session_id();
$blogParam = isset($_GET['blog_id']) ? ('&blog_id='.(int) $_GET['blog_id']) : '';
$introduction_section = '';
@ -46,7 +47,7 @@ if (!empty($courseId)) {
$form = new FormValidator(
'introduction_text',
'post',
api_get_self().'?'.api_get_cidreq()
api_get_self().'?'.api_get_cidreq().$blogParam
);
} else {
$form = new FormValidator('introduction_text');
@ -304,7 +305,7 @@ if ($intro_dispCommand) {
$toolbar .= '<div class="toolbar-edit">';
$toolbar .= '<div class="btn-group pull-right" role="group">';
if (!empty($courseId)) {
$textIntro = '<a class="btn btn-default" title="'.addslashes(get_lang('AddIntro')).'" href="'.api_get_self().'?'.api_get_cidreq().'&intro_cmdAdd=1">';
$textIntro = '<a class="btn btn-default" title="'.addslashes(get_lang('AddIntro')).'" href="'.api_get_self().'?'.api_get_cidreq().$blogParam.'&intro_cmdAdd=1">';
$textIntro .= '<em class="fa fa-file-text"></em> ';
$textIntro .= "</a>";
$toolbar .= $textIntro.$editIconButton;
@ -319,10 +320,10 @@ if ($intro_dispCommand) {
$toolbar .= '<div class="btn-group pull-right" rol="group">';
if (!empty($courseId)) {
$toolbar .=
'<a class="btn btn-default" href="'.api_get_self().'?'.api_get_cidreq().'&intro_cmdEdit=1" title="'.get_lang('Modify').'">
'<a class="btn btn-default" href="'.api_get_self().'?'.api_get_cidreq().$blogParam.'&intro_cmdEdit=1" title="'.get_lang('Modify').'">
<em class="fa fa-pencil"></em></a>';
$toolbar .= $editIconButton;
$toolbar .= "<a class=\"btn btn-default\" href=\"".api_get_self()."?".api_get_cidreq()."&intro_cmdDel=1\" onclick=\"javascript:
$toolbar .= "<a class=\"btn btn-default\" href=\"".api_get_self()."?".api_get_cidreq().$blogParam."&intro_cmdDel=1\" onclick=\"javascript:
if(!confirm('".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)).
"')) return false;\"><em class=\"fa fa-trash-o\"></em></a>";
} else {

@ -29,6 +29,7 @@ class AnnouncementManager
{
$tags = [
'((user_name))',
'((user_email))',
'((user_firstname))',
'((user_lastname))',
'((user_official_code))',
@ -93,8 +94,10 @@ class AnnouncementManager
$data['user_firstname'] = '';
$data['user_lastname'] = '';
$data['user_official_code'] = '';
$data['user_email'] = '';
if (!empty($readerInfo)) {
$data['user_name'] = $readerInfo['username'];
$data['user_email'] = $readerInfo['email'];
$data['user_firstname'] = $readerInfo['firstname'];
$data['user_lastname'] = $readerInfo['lastname'];
$data['user_official_code'] = $readerInfo['official_code'];

@ -2,9 +2,7 @@
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CourseBundle\Entity\CTool;
use Chamilo\CourseBundle\Entity\CToolIntro;
use Chamilo\CourseBundle\Tool\BaseTool;
/**
* Class AddCourse.
@ -447,205 +445,6 @@ class AddCourse
$course = api_get_course_entity($course_id);
$settingsManager = CourseManager::getCourseSettingsManager();
$settingsManager->setCourse($course);
//$toolList = CourseManager::getToolList();
//$toolList = $toolList->getTools();
/** @var BaseTool $tool */
/* foreach ($toolList as $tool) {
$toolName = $tool->getName();
$visibility = self::string2binary(
api_get_setting_in_list('course.active_tools_on_create', $toolName)
);
$toolObject = new CTool();
$toolObject
->setName($tool->getName())
->setCategory($tool->getCategory())
->setLink($tool->getLink())
->setImage($tool->getImage())
->setVisibility($visibility)
->setAddedTool(0)
->setAdmin(0)
->setTarget($tool->getTarget())
;
$tools[] = $toolObject;
//$settings = $settingsManager->load($toolName);
//var_dump($settings);
//$settingsManager->save($settings);
}
$course->setTools($tools);
$em->persist($course);
$em->flush($course);
foreach ($tools as $tool) {
$tool->setId($tool->getIid());
$em->refresh($course);
}
$em->flush($course);*/
/* Course tools */
/*
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 1, '".TOOL_COURSE_DESCRIPTION."','course_description/','info.gif','".
self::string2binary(api_get_setting_in_list('course_create_active_tools', 'course_description'))."','0','squaregrey.gif', 0,'_self','authoring','0')"
);
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 2, '".TOOL_CALENDAR_EVENT."','calendar/agenda.php','agenda.gif','".
self::string2binary(api_get_setting_in_list('course_create_active_tools', 'agenda'))."','0','squaregrey.gif',0,'_self','interaction','0')"
);
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 3, '".TOOL_DOCUMENT."','document/document.php','folder_document.gif','".self::string2binary(
api_get_setting_in_list('course_create_active_tools', 'documents')
)."','0','squaregrey.gif',0,'_self','authoring','0')"
);
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 4, '".TOOL_LEARNPATH."','lp/lp_controller.php','scorms.gif','".self::string2binary(
api_get_setting_in_list('course_create_active_tools', 'learning_path')
)."','0','squaregrey.gif',0,'_self','authoring','0')"
);
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 5, '".TOOL_LINK."','link/link.php','links.gif','".self::string2binary(
api_get_setting_in_list('course_create_active_tools', 'links')
)."','0','squaregrey.gif',0,'_self','authoring','0')"
);
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 6, '".TOOL_QUIZ."','exercise/exercise.php','quiz.gif','".self::string2binary(
api_get_setting_in_list('course_create_active_tools', 'quiz')
)."','0','squaregrey.gif',0,'_self','authoring','0')"
);
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 7, '".TOOL_ANNOUNCEMENT."','announcements/announcements.php','valves.gif','".self::string2binary(
api_get_setting_in_list('course_create_active_tools', 'announcements')
)."','0','squaregrey.gif', 0,'_self','authoring','0')"
);
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 8, '".TOOL_FORUM."','forum/index.php','forum.gif','".self::string2binary(
api_get_setting_in_list('course_create_active_tools', 'forums')
)."','0','squaregrey.gif',0,'_self','interaction','0')"
);
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 9, '".TOOL_DROPBOX."','dropbox/index.php','dropbox.gif','".self::string2binary(
api_get_setting_in_list('course_create_active_tools', 'dropbox')
)."','0','squaregrey.gif',0,'_self','interaction','0')"
);
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 10, '".TOOL_USER."','user/user.php','members.gif','".self::string2binary(
api_get_setting_in_list('course_create_active_tools', 'users')
)."','0','squaregrey.gif',0,'_self','interaction','0')"
);
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 11, '".TOOL_GROUP."','group/group.php','group.gif','".self::string2binary(
api_get_setting_in_list('course_create_active_tools', 'groups')
)."','0','squaregrey.gif',0,'_self','interaction','0')"
);
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 12, '".TOOL_CHAT."','chat/chat.php','chat.gif','".self::string2binary(
api_get_setting_in_list('course_create_active_tools', 'chat')
)."','0','squaregrey.gif',0,'_self','interaction','0')"
);
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 13, '".TOOL_STUDENTPUBLICATION."','work/work.php','works.gif','".self::string2binary(
api_get_setting_in_list(
'course_create_active_tools',
'student_publications'
)
)."','0','squaregrey.gif',0,'_self','interaction','0')"
);
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 14, '".TOOL_SURVEY."','survey/survey_list.php','survey.gif','".self::string2binary(
api_get_setting_in_list('course_create_active_tools', 'survey')
)."','0','squaregrey.gif',0,'_self','interaction','0')"
);
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 15, '".TOOL_WIKI."','wiki/index.php','wiki.gif','".self::string2binary(
api_get_setting_in_list('course_create_active_tools', 'wiki')
)."','0','squaregrey.gif',0,'_self','interaction','0')"
);
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 16, '".TOOL_GRADEBOOK."','gradebook/index.php','gradebook.gif','".self::string2binary(
api_get_setting_in_list('course_create_active_tools', 'gradebook')
)."','0','squaregrey.gif',0,'_self','authoring','0')"
);
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 17, '".TOOL_GLOSSARY."','glossary/index.php','glossary.gif','".self::string2binary(
api_get_setting_in_list('course_create_active_tools', 'glossary')
)."','0','squaregrey.gif',0,'_self','authoring','0')"
);
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 18, '".TOOL_NOTEBOOK."','notebook/index.php','notebook.gif','".self::string2binary(
api_get_setting_in_list('course_create_active_tools', 'notebook')
)."','0','squaregrey.gif',0,'_self','interaction','0')"
);
$setting = intval(self::string2binary(
api_get_setting_in_list('course_create_active_tools', 'attendances')
));
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 19, '".TOOL_ATTENDANCE."','attendance/index.php','attendance.gif','".$setting."','0','squaregrey.gif',0,'_self','authoring','0')"
);
$setting = intval(self::string2binary(
api_get_setting_in_list('course_create_active_tools', 'course_progress')
));
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 20, '".TOOL_COURSE_PROGRESS."','course_progress/index.php','course_progress.gif','".$setting."','0','squaregrey.gif',0,'_self','authoring','0')"
);
if (api_get_setting('search_enabled') === 'true') {
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 23, '".TOOL_SEARCH."','search/','info.gif','".self::string2binary(
api_get_setting_in_list(
'course_create_active_tools',
'enable_search'
)
)."','0','search.gif',0,'_self','authoring','0')"
);
}*/
/*$sql = "INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 24,'".TOOL_BLOGS."','blog/blog_admin.php','blog_admin.gif','".intval(
self::string2binary(api_get_setting_in_list('course_create_active_tools', 'blogs'))
)."','1','squaregrey.gif',0,'_self','admin','0')";
Database::query($sql);*/
/* Course homepage tools for course admin only */
/*
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 25, '".TOOL_TRACKING."','tracking/courseLog.php','statistics.gif','$visible_for_course_admin','1','', 0,'_self','admin','0')"
);
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 26, '".TOOL_COURSE_SETTING."','course_info/infocours.php','reference.gif','$visible_for_course_admin','1','', 0,'_self','admin','0')"
);
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 27, '".TOOL_COURSE_MAINTENANCE."','course_info/maintenance.php','backup.gif','$visible_for_course_admin','1','',0,'_self', 'admin','0')"
);*/
$alert = api_get_setting('email_alert_manager_on_new_quiz');
if ($alert === 'true') {
@ -670,6 +469,8 @@ class AddCourse
'display_info_advance_inside_homecourse' => ['default' => 1, 'category' => 'thematic_advance'],
'email_alert_students_on_new_homework' => ['default' => 0, 'category' => 'work'],
'enable_lp_auto_launch' => ['default' => 0, 'category' => 'learning_path'],
'enable_exercise_auto_launch' => ['default' => 0, 'category' => 'exercise'],
'enable_document_auto_launch' => ['default' => 0, 'category' => 'document'],
'pdf_export_watermark_text' => ['default' => '', 'category' => 'learning_path'],
'allow_public_certificates' => [
'default' => api_get_setting('allow_public_certificates') === 'true' ? 1 : '',
@ -677,7 +478,9 @@ class AddCourse
],
'documents_default_visibility' => ['default' => 'visible', 'category' => 'document'],
'show_course_in_user_language' => ['default' => 2, 'category' => null],
'email_to_teachers_on_new_work_feedback' => ['default' => 1, 'category' => null],
];
$counter = 1;
foreach ($settings as $variable => $setting) {
$title = isset($setting['title']) ? $setting['title'] : '';
@ -722,7 +525,7 @@ class AddCourse
$counter = 1;
foreach ($files as $file) {
self::insertDocument($course_id, $counter, $file, $authorId);
self::insertDocument($courseInfo, $counter, $file, $authorId);
$counter++;
}
@ -748,7 +551,7 @@ class AddCourse
];
foreach ($files as $file) {
self::insertDocument($course_id, $counter, $file, $authorId);
self::insertDocument($courseInfo, $counter, $file, $authorId);
$counter++;
}
@ -1134,51 +937,27 @@ class AddCourse
}
/**
* @param int $course_id
* @param array $courseInfo
* @param int $counter
* @param array $file
* @param int $authorId
*/
public static function insertDocument($course_id, $counter, $file, $authorId = 0)
public static function insertDocument($courseInfo, $counter, $file, $authorId = 0)
{
$tableItem = Database::get_course_table(TABLE_ITEM_PROPERTY);
$tableDocument = Database::get_course_table(TABLE_DOCUMENT);
$now = api_get_utc_datetime();
$sql = "INSERT INTO $tableDocument (id, c_id, path,title,filetype,size, readonly, session_id)
VALUES ($counter, $course_id, '".$file['path']."', '".$file['title']."', '".$file['filetype']."', '".$file['size']."', 0, 0)";
Database::query($sql);
$docId = Database:: insert_id();
$authorId = empty($authorId) ? api_get_user_id() : (int) $authorId;
if ($docId) {
$sql = "UPDATE $tableDocument SET id = iid WHERE iid = $docId";
Database::query($sql);
$id = Database::insert(
$tableItem,
[
'id' => $counter,
'c_id' => $course_id,
'tool' => 'document',
'insert_user_id' => $authorId,
'insert_date' => $now,
'lastedit_date' => $now,
'ref' => $docId,
'lastedit_type' => 'DocumentAdded',
'lastedit_user_id' => $authorId,
'to_group_id' => null,
'to_user_id' => null,
'visibility' => 0,
]
);
if ($id) {
$sql = "UPDATE $tableItem SET id = iid WHERE iid = $id";
Database::query($sql);
}
}
add_document(
$courseInfo,
$file['path'],
$file['filetype'],
$file['size'],
$file['title'],
null,
0,
true,
0,
0,
0,
false
);
}
/**

@ -57,7 +57,6 @@ class Agenda
// Setting the course object if we are in a course
$courseInfo = api_get_course_info_by_id($courseId);
if (!empty($courseInfo)) {
$this->set_course($courseInfo);
}

@ -1,6 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Entity\Session as SessionEntity;
use Chamilo\CoreBundle\Entity\SettingsCurrent;
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CourseBundle\Entity\CItemProperty;
@ -1460,7 +1462,7 @@ function _api_format_user($user, $add_password = false, $loadAvatars = true)
$result['complete_name'] = api_get_person_name($result['firstname'], $result['lastname']);
$result['complete_name_with_username'] = $result['complete_name'];
if (!empty($user['username']) && api_get_setting('platform.hide_username_with_complete_name') === 'false') {
if (!empty($user['username']) && api_get_setting('profile.hide_username_with_complete_name') === 'false') {
$result['complete_name_with_username'] = $result['complete_name'].' ('.$user['username'].')';
}
@ -2069,7 +2071,7 @@ function api_get_course_info($course_code = null, $strict = false)
/**
* @param int $courseId
*
* @return \Chamilo\CoreBundle\Entity\Course
* @return Course
*/
function api_get_course_entity($courseId = 0)
{
@ -2083,7 +2085,7 @@ function api_get_course_entity($courseId = 0)
/**
* @param int $id
*
* @return \Chamilo\CoreBundle\Entity\Session
* @return SessionEntity
*/
function api_get_session_entity($id = 0)
{
@ -4723,6 +4725,8 @@ function api_get_item_property_info($course_id, $tool, $ref, $session_id = 0, $g
* @param bool Whether we use the JQuery Chozen library or not
* (in some cases, like the indexing language picker, it can alter the presentation)
*
* @deprecated
*
* @return string
*/
function api_get_languages_combo($name = 'language')
@ -4758,71 +4762,6 @@ function api_get_languages_combo($name = 'language')
return $ret;
}
/**
* Displays a form (drop down menu) so the user can select his/her preferred language.
* The form works with or without javascript.
*
* @param bool Hide form if only one language available (defaults to false = show the box anyway)
* @param bool $showAsButton
*
* @return null|string Display the box directly
*/
function api_display_language_form($hide_if_no_choice = false, $showAsButton = false)
{
// Retrieve a complete list of all the languages.
$language_list = api_get_languages();
if (count($language_list) <= 1 && $hide_if_no_choice) {
// don't show any form
return '';
}
// The the current language of the user so that his/her language occurs as selected in the dropdown menu.
if (isset($_SESSION['user_language_choice'])) {
$user_selected_language = $_SESSION['user_language_choice'];
}
if (empty($user_selected_language)) {
$user_selected_language = api_get_setting('platformLanguage');
}
$user_selected_language = 'en';
$countryCode = languageToCountryIsoCode($user_selected_language);
$language = api_get_language_from_iso($user_selected_language);
$url = api_get_self();
if ($showAsButton) {
$html = '<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<span class="flag-icon flag-icon-'.$countryCode.'"></span>
'.$language->getOriginalName().'
<span class="caret">
</span>
</button>';
} else {
$html = '
<a href="'.$url.'" class="dropdown-toggle" data-toggle="dropdown" role="button">
<span class="flag-icon flag-icon-'.$countryCode.'"></span>
'.$language->getOriginalName().'
<span class="caret"></span>
</a>
';
}
$html .= '<ul class="dropdown-menu" role="menu">';
foreach ($language_list as $iso => $data) {
$urlLink = $url.'?language='.$data;
$html .= '<li><a href="'.$urlLink.'">';
$html .= '<span class="flag-icon flag-icon-'.languageToCountryIsoCode($iso).'"></span> '.$data.'</a></li>';
}
$html .= '</ul>';
if ($showAsButton) {
$html .= '</div>';
}
return $html;
}
/**
* @param string $languageIsoCode
*
@ -4957,73 +4896,6 @@ function api_get_language_id($language)
return $row['id'];
}
/**
* Gets language of the requested type for the current user. Types are :
* user_profil_lang : profile language of current user
* user_select_lang : language selected by user at login
* course_lang : language of the current course
* platform_lang : default platform language.
*
* @param string $lang_type
*
* @return string
*/
function api_get_language_from_type($lang_type)
{
$return = false;
switch ($lang_type) {
case 'platform_lang':
$temp_lang = api_get_setting('platformLanguage');
if (!empty($temp_lang)) {
$return = $temp_lang;
}
break;
case 'user_profil_lang':
$_user = api_get_user_info();
if (isset($_user['language']) && !empty($_user['language'])) {
$return = $_user['language'];
}
break;
case 'user_selected_lang':
if (isset($_SESSION['user_language_choice']) && !empty($_SESSION['user_language_choice'])) {
$return = $_SESSION['user_language_choice'];
}
break;
case 'course_lang':
global $_course;
$cidReq = null;
if (empty($_course)) {
// Code modified because the local.inc.php file it's declarated after this work
// causing the function api_get_course_info() returns a null value
$cidReq = isset($_GET["cidReq"]) ? Database::escape_string($_GET["cidReq"]) : null;
$cDir = (!empty($_GET['cDir']) ? $_GET['cDir'] : null);
if (empty($cidReq) && !empty($cDir)) {
$c = CourseManager::getCourseCodeFromDirectory($cDir);
if ($c) {
$cidReq = $c;
}
}
}
$_course = api_get_course_info($cidReq);
if (isset($_course['language']) && !empty($_course['language'])) {
$return = $_course['language'];
$showCourseInUserLanguage = api_get_course_setting('show_course_in_user_language');
if ($showCourseInUserLanguage == 1) {
$userInfo = api_get_user_info();
if (isset($userInfo['language'])) {
$return = $userInfo['language'];
}
}
}
break;
default:
$return = false;
break;
}
return $return;
}
/**
* Get the language information by its id.
*
@ -8833,13 +8705,10 @@ function api_create_protected_dir($name, $parentDirectory)
}
/**
* Sends an HTML email using the phpmailer class (and multipart/alternative to downgrade gracefully)
* Sends an email
* Sender name and email can be specified, if not specified
* name and email of the platform admin are used.
*
* @author Bert Vanderkimpen ICT&O UGent
* @author Yannick Warnier <yannick.warnier@beeznest.com>
*
* @param string name of recipient
* @param string email of recipient
* @param string email subject
@ -8851,9 +8720,7 @@ function api_create_protected_dir($name, $parentDirectory)
* @param bool True for attaching a embedded file inside content html (optional)
* @param array Additional parameters
*
* @return int true if mail was sent
*
* @see class.phpmailer.php
* @return bool true if mail was sent
*/
function api_mail_html(
$recipientName,
@ -8864,9 +8731,13 @@ function api_mail_html(
$senderEmail = '',
$extra_headers = [],
$data_file = [],
$embedded_image = false,
$embeddedImage = false,
$additionalParameters = []
) {
if (!api_valid_email($recipientEmail)) {
return false;
}
// Default values
$notification = new Notification();
$defaultEmail = $notification->getDefaultPlatformSenderEmail();
@ -8901,11 +8772,6 @@ function api_mail_html(
str_replace('<br />', "\n", api_html_entity_decode($message))
);*/
if (!api_valid_email($recipientEmail)) {
return 0;
}
/*if (is_array($extra_headers) && count($extra_headers) > 0) {
foreach ($extra_headers as $key => $value) {
switch (strtolower($key)) {
@ -8943,7 +8809,7 @@ function api_mail_html(
}
}
// Attachment ...
// Attachment
if (!empty($data_file)) {
foreach ($data_file as $file_attach) {
if (!empty($file_attach['path']) && !empty($file_attach['filename'])) {
@ -8966,7 +8832,7 @@ function api_mail_html(
'mail_header_style' => api_get_configuration_value('mail_header_style'),
'mail_content_style' => api_get_configuration_value('mail_content_style'),
'link' => $additionalParameters['link'] ?? '',
'automatic_email_text' => $automaticEmailText
'automatic_email_text' => $automaticEmailText,
];
$paramsHtml = $paramsText = $params;
@ -9006,8 +8872,6 @@ function api_mail_html(
$type = $message->getHeaders()->get('Content-Type');
$type->setCharset('utf-8');
//$type->setValue('text/html');
Container::getMailer()->send($message);
return true;

@ -218,12 +218,13 @@ class Certificate extends Model
}
$params['hide_print_button'] = isset($params['hide_print_button']) ? true : false;
$categoryId = 0;
if (isset($this->certificate_data) && isset($this->certificate_data['cat_id'])) {
$my_category = Category::load($this->certificate_data['cat_id']);
$categoryId = $this->certificate_data['cat_id'];
$my_category = Category::load($categoryId);
}
if (isset($my_category[0]) &&
if (isset($my_category[0]) && !empty($categoryId) &&
$my_category[0]->is_certificate_available($this->user_id)
) {
$courseInfo = api_get_course_info($my_category[0]->get_course_code());

@ -2274,17 +2274,14 @@ class CourseManager
return false;
}
$codeFiltered = Database::escape_string($code);
$sql = "SELECT * FROM $table_course
WHERE code = '$codeFiltered'";
$res = Database::query($sql);
$course = api_get_course_info($code);
if (Database::num_rows($res) == 0) {
return;
if (empty($course)) {
return false;
}
$course = Database::fetch_array($res);
$courseId = $course['id']; // int
$codeFiltered = $course['code'];
$courseId = $course['real_id']; // int
$count = 0;
if (api_is_multiple_url_enabled()) {
@ -2296,7 +2293,7 @@ class CourseManager
$count = UrlManager::getCountUrlRelCourse($courseId);
}
if ($count == 0) {
if ($count === 0) {
self::create_database_dump($code);
$course_tables = AddCourse::get_course_tables();
@ -2404,18 +2401,20 @@ class CourseManager
WHERE course_id = $courseId";
Database::query($sql);
if (api_get_configuration_value('allow_skill_rel_items')) {
$sql = "DELETE FROM skill_rel_course WHERE c_id = $courseId";
Database::query($sql);
}
$sql = "DELETE FROM skill_rel_course WHERE c_id = $courseId";
Database::query($sql);
// Deletes all groups, group-users, group-tutors information
// To prevent fK mix up on some tables
GroupManager::deleteAllGroupsFromCourse($courseId);
// Delete the course from the database
$sql = "DELETE FROM $table_course WHERE id = $courseId";
Database::query($sql);
/*$sql = "DELETE FROM $table_course WHERE id = $courseId";
Database::query($sql);*/
$courseEntity = api_get_course_entity($courseId);
Database::getManager()->remove($courseEntity);
Database::getManager()->flush();
// delete extra course fields
$extraFieldValues = new ExtraFieldValue('course');
@ -4337,7 +4336,7 @@ class CourseManager
$now = date('Y-m-d h:i:s');
$user_id = api_get_user_id();
$course_info = api_get_course_info_by_id($course['real_id']);
$course_visibility = $course_info['visibility'];
$course_visibility = (int) $course_info['visibility'];
if ($course_visibility === COURSE_VISIBILITY_HIDDEN) {
return '';

@ -305,7 +305,6 @@ class Event
$sql = "INSERT INTO $table
( upload_user_id,
c_id,
upload_cours_id,
upload_work_id,
upload_date,
upload_session_id
@ -313,7 +312,6 @@ class Event
VALUES (
$userId,
$courseId,
'',
$documentId,
'$reallyNow',
$sessionId
@ -742,7 +740,6 @@ class Event
return Database::insert(
$table,
[
'hotspot_course_code' => api_get_course_id(),
'hotspot_user_id' => api_get_user_id(),
'c_id' => api_get_course_int_id(),
'hotspot_exe_id' => $exeId,

@ -3958,11 +3958,11 @@ EOT;
/**
* Get number of answers to hotspot questions.
*
* @param int $answer_id
* @param int $question_id
* @param int $exercise_id
* @param string $course_code
* @param int $session_id
* @param int $answer_id
* @param int $question_id
* @param int $exercise_id
* @param int $courseId
* @param int $session_id
*
* @return int
*/
@ -3970,27 +3970,20 @@ EOT;
$answer_id,
$question_id,
$exercise_id,
$course_code,
$courseId,
$session_id
) {
$track_exercises = Database::get_main_table(
TABLE_STATISTIC_TRACK_E_EXERCISES
);
$track_hotspot = Database::get_main_table(
TABLE_STATISTIC_TRACK_E_HOTSPOT
);
$track_exercises = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
$track_hotspot = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT);
$courseUser = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$courseTable = Database::get_main_table(TABLE_MAIN_COURSE);
$courseUserSession = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$courseUserSession = Database::get_main_table(
TABLE_MAIN_SESSION_COURSE_USER
);
$question_id = intval($question_id);
$answer_id = intval($answer_id);
$exercise_id = intval($exercise_id);
$course_code = Database::escape_string($course_code);
$session_id = intval($session_id);
$question_id = (int) $question_id;
$answer_id = (int) $answer_id;
$exercise_id = (int) $exercise_id;
$courseId = (int) $courseId;
$session_id = (int) $session_id;
if (empty($session_id)) {
$courseCondition = "
@ -4013,7 +4006,7 @@ EOT;
$courseCondition
WHERE
exe_exo_id = $exercise_id AND
a.hotspot_course_code = '$course_code' AND
a.c_id = $courseId AND
e.session_id = $session_id AND
hotspot_answer_id = $answer_id AND
hotspot_question_id = $question_id AND

@ -1,6 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
use Chamilo\CourseBundle\Entity\CDocument;
/**
* FILE UPLOAD LIBRARY.
*
@ -214,7 +216,7 @@ function process_uploaded_file($uploaded_file, $show_output = true)
* @param bool $treat_spaces_as_hyphens
*
* So far only use for unzip_uploaded_document function.
* If no output wanted on success, set to false.
* If no output wanted on success, set to false
*
* @return string path of the saved file
*/
@ -1335,22 +1337,50 @@ function add_document(
) {
$sessionId = empty($sessionId) ? api_get_session_id() : $sessionId;
$userId = empty($userId) ? api_get_user_id() : $userId;
$userEntity = api_get_user_entity($userId);
$courseEntity = api_get_course_entity(api_get_course_int_id());
$session = api_get_session_entity($sessionId);
$readonly = (int) $readonly;
$c_id = $courseInfo['real_id'];
$params = [
'c_id' => $c_id,
'path' => $path,
'filetype' => $fileType,
'size' => $fileSize,
'title' => $title,
'comment' => $comment,
'readonly' => $readonly,
'session_id' => $sessionId,
];
$table = Database::get_course_table(TABLE_DOCUMENT);
$documentId = Database::insert($table, $params);
$em = Database::getManager();
$documentRepo = $em->getRepository('ChamiloCourseBundle:CDocument');
$document = new CDocument();
$document
->setCourse($courseEntity)
->setPath($path)
->setFiletype($fileType)
->setSize($fileSize)
->setTitle($title)
->setComment($comment)
->setReadonly($readonly)
->setSession($session)
;
$em->persist($document);
$em->flush();
/*$resourceNode = $documentRepo->addResourceNode($document, $userEntity);
$document->setResourceNode($resourceNode);
$em->persist($document);
$em->flush();
$resourceRight = new \Chamilo\CoreBundle\Entity\Resource\ResourceRights();
$resourceRight->setMask(\Chamilo\CoreBundle\Security\Authorization\Voter\ResourceNodeVoter::getEditorMask());
$resourceRight->setRole(\Chamilo\CoreBundle\Security\Authorization\Voter\ResourceNodeVoter::ROLE_CURRENT_COURSE_TEACHER);
$documentRepo->addResourceToCourse($resourceNode, $courseEntity, $resourceRight);
$resourceRight = new \Chamilo\CoreBundle\Entity\Resource\ResourceRights();
$resourceRight->setMask(\Chamilo\CoreBundle\Security\Authorization\Voter\ResourceNodeVoter::getReaderMask());
$resourceRight->setRole(\Chamilo\CoreBundle\Security\Authorization\Voter\ResourceNodeVoter::ROLE_CURRENT_COURSE_STUDENT);
$documentRepo->addResourceToCourse($resourceNode, $courseEntity, $resourceRight);*/
$documentId = $document->getIid();
if ($documentId) {
$table = Database::get_course_table(TABLE_DOCUMENT);
$sql = "UPDATE $table SET id = iid WHERE iid = $documentId";
Database::query($sql);
@ -1370,7 +1400,7 @@ function add_document(
$courseTitle = $courseInfo['title'];
if (!empty($sessionId)) {
$sessionInfo = api_get_session_info($sessionId);
$courseTitle .= " ( ".$sessionInfo['name'].") ";
$courseTitle .= ' ( '.$sessionInfo['name'].') ';
}
$url = api_get_path(WEB_CODE_PATH).

@ -464,7 +464,7 @@ class MessageManager
return false;
} elseif ($totalFileSize > intval(api_get_setting('message_max_upload_filesize'))) {
$warning = sprintf(
get_lang("FilesSizeExceedsX"),
get_lang('FilesSizeExceedsX'),
format_file_size(api_get_setting('message_max_upload_filesize'))
);
@ -481,15 +481,14 @@ class MessageManager
//@todo it's possible to edit a message? yes, only for groups
if (!empty($editMessageId)) {
$query = " UPDATE $table SET
update_date = '".$now."',
content = '".Database::escape_string($content)."'
update_date = '".$now."',
content = '".Database::escape_string($content)."'
WHERE id = '$editMessageId' ";
Database::query($query);
$messageId = $editMessageId;
} else {
$params = [
'user_sender_id' => $user_sender_id,
'user_receiver_id' => $receiver_user_id,
'msg_status' => MESSAGE_STATUS_UNREAD,
'send_date' => $now,
'title' => $subject,
@ -498,6 +497,9 @@ class MessageManager
'parent_id' => $parent_id,
'update_date' => $now,
];
if (!empty($receiver_user_id)) {
$params['user_receiver_id'] = $receiver_user_id;
}
$messageId = Database::insert($table, $params);
}
@ -2257,6 +2259,8 @@ class MessageManager
/**
* Get the data of the last received messages for a user.
*
* @deprecated 2.0 Use Chamilo\CoreBundle\Repository\MessageRepository::getFromLastOneReceived
*
* @param int $userId The user id
* @param int $lastId The id of the last received message
*

@ -303,8 +303,7 @@ class Notification extends Model
case self::NOTIFY_INVITATION_AT_ONCE:
case self::NOTIFY_GROUP_AT_ONCE:
$extraHeaders = [];
$noReply = api_get_setting('noreply_email_address');
if (empty($noReply) && isset($senderInfo['email'])) {
if (isset($senderInfo['email'])) {
$extraHeaders = [
'reply_to' => [
'name' => $senderInfo['complete_name'],

@ -309,7 +309,7 @@ class Security
}
}
if ($user_status === COURSEMANAGERLOWSECURITY) {
if ($user_status == COURSEMANAGERLOWSECURITY) {
return $var; // No filtering.
}

@ -130,15 +130,15 @@ class SortableTable extends HTML_Table
$table_id = $table_name.uniqid();
}
$this->table_id = $table_id;
parent::__construct(['class' => 'data_table table', 'id' => $table_id]);
parent::__construct(['class' => 'table table-striped table-hover', 'id' => $table_id]);
$this->table_name = $table_name;
$this->additional_parameters = [];
$this->param_prefix = $table_name.'_';
$this->page_nr = Session::read($this->param_prefix.'page_nr', 1);
$this->page_nr = isset($_GET[$this->param_prefix.'page_nr']) ? intval($_GET[$this->param_prefix.'page_nr']) : $this->page_nr;
$this->page_nr = isset($_GET[$this->param_prefix.'page_nr']) ? (int) $_GET[$this->param_prefix.'page_nr'] : $this->page_nr;
$this->column = Session::read($this->param_prefix.'column', $default_column);
$this->column = isset($_GET[$this->param_prefix.'column']) ? intval($_GET[$this->param_prefix.'column']) : $this->column;
$this->column = isset($_GET[$this->param_prefix.'column']) ? (int) $_GET[$this->param_prefix.'column'] : $this->column;
// Default direction.
if (in_array(strtoupper($default_order_direction), ['ASC', 'DESC'])) {
@ -163,9 +163,9 @@ class SortableTable extends HTML_Table
if (!in_array($my_get_direction, ['ASC', 'DESC'])) {
$this->direction = 'ASC';
} else {
if ($my_get_direction == 'ASC') {
if ($my_get_direction === 'ASC') {
$this->direction = 'ASC';
} elseif ($my_get_direction == 'DESC') {
} elseif ($my_get_direction === 'DESC') {
$this->direction = 'DESC';
}
}

@ -216,7 +216,7 @@ class Template
$this->set_course_parameters();
// Setting administrator variables
$this->setAdministratorParams();
//$this->setAdministratorParams();
//$this->setCSSEditor();
// Header and footer are showed by default
@ -235,11 +235,6 @@ class Template
$this->assign('locale', api_get_language_isocode());
$this->assign('login_class', null);
$allow = api_get_configuration_value('show_language_selector_in_menu');
if ($allow) {
$this->assign('language_form', api_display_language_form());
}
// Chamilo plugins
if ($this->show_header) {
if ($this->load_plugins) {
@ -614,7 +609,7 @@ class Template
$this->themeDir = self::getThemeDir($this->theme);
// Setting app paths/URLs
$this->assign('_p', $this->getWebPaths());
//$this->assign('_p', $this->getWebPaths());
// Here we can add system parameters that can be use in any template
$_s = [
@ -636,23 +631,28 @@ class Template
*/
public static function getGlobals()
{
$queryString = empty($_SERVER['QUERY_STRING']) ? '' : $_SERVER['QUERY_STRING'];
$requestURI = empty($_SERVER['REQUEST_URI']) ? '' : $_SERVER['REQUEST_URI'];
$_p = [
'web' => api_get_path(WEB_PATH),
'web_public' => api_get_path(WEB_PUBLIC_PATH),
'web_url' => api_get_web_url(),
'web_relative' => api_get_path(REL_PATH),
'web_course' => api_get_path(WEB_COURSE_PATH),
'web_main' => api_get_path(WEB_CODE_PATH),
'web_css' => api_get_path(WEB_CSS_PATH),
//'web_css_theme' => api_get_path(WEB_CSS_PATH) . 'themes/' . $this->theme . '/',
//'web_css_theme' => api_get_path(WEB_CSS_PATH).$this->themeDir,
'web_ajax' => api_get_path(WEB_AJAX_PATH),
'web_img' => api_get_path(WEB_IMG_PATH),
'web_plugin' => api_get_path(WEB_PLUGIN_PATH),
'web_plugin_asset' => api_get_path(WEB_PLUGIN_ASSET_PATH),
'web_lib' => api_get_path(WEB_LIBRARY_PATH),
'web_upload' => api_get_path(WEB_UPLOAD_PATH),
'web_self' => api_get_self(),
'web_query_vars' => api_htmlentities($_SERVER['QUERY_STRING']),
'web_self_query_vars' => api_htmlentities($_SERVER['REQUEST_URI']),
'web_query_vars' => api_htmlentities($queryString),
'web_self_query_vars' => api_htmlentities($requestURI),
'web_cid_query' => api_get_cidreq(),
'web_rel_code' => api_get_path(REL_CODE_PATH),
];
$_s = [
@ -915,8 +915,8 @@ class Template
if (!$disable_js_and_css_files) {
$this->assign('js_file_to_string', $js_file_to_string);
$extraHeaders = '<script>var _p = '.json_encode($this->getWebPaths(), JSON_PRETTY_PRINT).'</script>';
$extraHeaders = '';
//$extraHeaders = '<script>var _p = '.json_encode($this->getWebPaths(), JSON_PRETTY_PRINT).'</script>';
//Adding jquery ui by default
$extraHeaders .= api_get_jquery_ui_js();
if (isset($htmlHeadXtra) && $htmlHeadXtra) {
@ -1115,29 +1115,6 @@ class Template
return $theme;
}
/**
* @param bool|true $setLoginForm
*/
public function setLoginForm($setLoginForm = true)
{
global $loginFailed;
$userId = api_get_user_id();
if (!($userId) || api_is_anonymous($userId)) {
// Only display if the user isn't logged in.
$this->assign(
'login_language_form',
api_display_language_form(true, true)
);
if ($setLoginForm) {
$this->assign('login_form', $this->displayLoginForm());
if ($loginFailed) {
$this->assign('login_failed', $this::handleLoginFailed());
}
}
}
}
/**
* @return string
*/
@ -1493,37 +1470,6 @@ class Template
$this->assign('_u', $user_info);
}
/**
* Get an array of all the web paths available (e.g. 'web' => 'https://my.chamilo.site/').
*
* @return array
*/
private function getWebPaths()
{
$queryString = empty($_SERVER['QUERY_STRING']) ? '' : $_SERVER['QUERY_STRING'];
$requestURI = empty($_SERVER['REQUEST_URI']) ? '' : $_SERVER['REQUEST_URI'];
return [
'web' => api_get_path(WEB_PATH),
'web_url' => api_get_web_url(),
'web_relative' => api_get_path(REL_PATH),
'web_course' => api_get_path(WEB_COURSE_PATH),
'web_main' => api_get_path(WEB_CODE_PATH),
'web_css' => api_get_path(WEB_CSS_PATH),
'web_css_theme' => api_get_path(WEB_CSS_PATH).$this->themeDir,
'web_ajax' => api_get_path(WEB_AJAX_PATH),
'web_img' => api_get_path(WEB_IMG_PATH),
'web_plugin' => api_get_path(WEB_PLUGIN_PATH),
'web_lib' => api_get_path(WEB_LIBRARY_PATH),
'web_upload' => api_get_path(WEB_UPLOAD_PATH),
'web_self' => api_get_self(),
'web_query_vars' => api_htmlentities($queryString),
'web_self_query_vars' => api_htmlentities($requestURI),
'web_cid_query' => api_get_cidreq(),
'web_rel_code' => api_get_path(REL_CODE_PATH),
];
}
/**
* Set header parameters.
*
@ -1611,11 +1557,8 @@ class Template
$this->assignFavIcon(); //Set a 'favico' var for the template
$this->setHelp();
$this->assignBugNotification(); //Prepare the 'bug_notification' var for the template
$this->assignAccessibilityBlock(); //Prepare the 'accessibility' var for the template
// Preparing values for the menu
// Logout link
@ -1755,30 +1698,7 @@ class Template
*/
private function set_footer_parameters()
{
if (api_get_setting('show_administrator_data') === 'true') {
$firstName = api_get_setting('administratorName');
$lastName = api_get_setting('administratorSurname');
if (!empty($firstName) && !empty($lastName)) {
$name = api_get_person_name($firstName, $lastName);
} else {
$name = $lastName;
if (empty($lastName)) {
$name = $firstName;
}
}
$adminName = '';
// Administrator name
if (!empty($name)) {
$adminName = get_lang('Manager').' : '.
Display::encrypted_mailto_link(
api_get_setting('emailAdministrator'),
$name
);
}
$this->assign('administrator_name', $adminName);
}
// Loading footer extra content
if (!api_is_platform_admin()) {
@ -1789,72 +1709,8 @@ class Template
}
// Tutor name
if (api_get_setting('show_tutor_data') == 'true') {
// Course manager
$courseId = api_get_course_int_id();
$id_session = api_get_session_id();
if (!empty($courseId)) {
$tutor_data = '';
if ($id_session != 0) {
$coachs_email = CourseManager::get_email_of_tutor_to_session(
$id_session,
$courseId
);
$email_link = [];
foreach ($coachs_email as $coach) {
$email_link[] = Display::encrypted_mailto_link($coach['email'], $coach['complete_name']);
}
if (count($coachs_email) > 1) {
$tutor_data .= get_lang('Coachs').' : ';
$tutor_data .= array_to_string($email_link, CourseManager::USER_SEPARATOR);
} elseif (count($coachs_email) == 1) {
$tutor_data .= get_lang('Coach').' : ';
$tutor_data .= array_to_string($email_link, CourseManager::USER_SEPARATOR);
} elseif (count($coachs_email) == 0) {
$tutor_data .= '';
}
}
$this->assign('session_teachers', $tutor_data);
}
}
if (api_get_setting('show_teacher_data') == 'true') {
// course manager
$courseId = api_get_course_int_id();
if (!empty($courseId)) {
$teacher_data = '';
$mail = CourseManager::get_emails_of_tutors_to_course($courseId);
if (!empty($mail)) {
$teachers_parsed = [];
foreach ($mail as $value) {
foreach ($value as $email => $name) {
$teachers_parsed[] = Display::encrypted_mailto_link($email, $name);
}
}
$label = get_lang('Teacher');
if (count($mail) > 1) {
$label = get_lang('Teachers');
}
$teacher_data .= $label.' : '.array_to_string($teachers_parsed, CourseManager::USER_SEPARATOR);
}
$this->assign('teachers', $teacher_data);
}
}
}
/**
* Set administrator variables.
*/
private function setAdministratorParams()
{
$_admin = [
'email' => api_get_setting('emailAdministrator'),
'surname' => api_get_setting('administratorSurname'),
'name' => api_get_setting('administratorName'),
'telephone' => api_get_setting('administratorTelephone'),
];
$this->assign('_admin', $_admin);
}
/**
@ -1953,28 +1809,6 @@ class Template
return true;
}
/**
* Assign HTML code to the 'accessibility' template variable (usually shown above top menu).
*
* @return bool Always return true (even if empty string)
*/
private function assignAccessibilityBlock()
{
$resize = '';
if (api_get_setting('accessibility_font_resize') == 'true') {
$resize .= '<div class="resize_font">';
$resize .= '<div class="btn-group">';
$resize .= '<a title="'.get_lang('DecreaseFontSize').'" href="#" class="decrease_font btn btn-default"><em class="fa fa-font"></em></a>';
$resize .= '<a title="'.get_lang('ResetFontSize').'" href="#" class="reset_font btn btn-default"><em class="fa fa-font"></em></a>';
$resize .= '<a title="'.get_lang('IncreaseFontSize').'" href="#" class="increase_font btn btn-default"><em class="fa fa-font"></em></a>';
$resize .= '</div>';
$resize .= '</div>';
}
$this->assign('accessibility', $resize);
return true;
}
/**
* Assign HTML code to the 'social_meta' template variable (usually shown above top menu).
*

@ -280,14 +280,14 @@ class UrlManager
*/
public static function getCountUrlRelCourse($courseId)
{
$courseId = intval($courseId);
$courseId = (int) $courseId;
$tableUrlRelCourse = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$sql = "SELECT *
FROM $tableUrlRelCourse
WHERE c_id = '$courseId'";
$res = Database::query($sql);
return Database::num_rows($res);
return (int) Database::num_rows($res);
}
/**

@ -6,8 +6,8 @@
*/
class IndexManager
{
const VIEW_BY_DEFAULT = 0;
const VIEW_BY_SESSION = 1;
public const VIEW_BY_DEFAULT = 0;
public const VIEW_BY_SESSION = 1;
// An instance of the template engine
// No need to initialize because IndexManager is not static,
@ -49,15 +49,6 @@ class IndexManager
}
}
/**
* @param bool $setLoginForm
*/
public function set_login_form($setLoginForm = true)
{
global $loginFailed;
$this->tpl->setLoginForm($setLoginForm);
}
/**
* @param array $personal_course_list
*/
@ -1673,7 +1664,9 @@ class IndexManager
$session_id,
'session_course_item'
);
$html_courses_session[] = $c[1];
if (isset($c[1])) {
$html_courses_session[] = $c[1];
}
}
$count_courses_session++;
$count++;

@ -657,10 +657,6 @@ $_configuration['gradebook_badge_sidebar'] = [
'gradebooks' => [1, 2, 3]
];*/
// Show language selector in main menu an update the language in the user's
// profile.
//$_configuration['show_language_selector_in_menu'] = false;
// When using the my-courses list filter by category, set this option to true
// to only show courses in the user's configured language
// $_configuration['my_courses_show_courses_in_user_language_only'] = false;

@ -342,7 +342,6 @@ if ($encryptPassForm == '1') {
@import "../../public/build/css/themes/chamilo/default.css";
</style>
<script type="text/javascript" src="../../public/build/vendor.js"></script>
<script type="text/javascript" src="../../public/build/app.js"></script>
<script type="text/javascript">
$(document).ready( function() {
@ -353,7 +352,7 @@ if ($encryptPassForm == '1') {
});
$("#button_please_wait").hide();
$("button").addClass('btn btn-default');
$("button").addClass('btn btn-secondary');
// Allow Chamilo install in IE
$("button").click(function() {
@ -702,7 +701,7 @@ if (@$_POST['step2']) {
<table width="100%">
<tr>
<td>
<button type="submit" class="btn btn-default" name="step4" value="&lt; <?php echo get_lang('Previous'); ?>" >
<button type="submit" class="btn btn-secondary" name="step4" value="&lt; <?php echo get_lang('Previous'); ?>" >
<em class="fa fa-backward"> </em> <?php echo get_lang('Previous'); ?>
</button>
</td>

@ -512,8 +512,8 @@ function get_language_folder_list()
* WARNING - this function relies heavily on global variables $updateFromConfigFile
* and $configFile, and also changes these globals. This can be rewritten.
*
* @param string $param the parameter of which the value is returned
* @param string If we want to give the path rather than take it from POST
* @param string $param the parameter of which the value is returned
* @param string $updatePath If we want to give the path rather than take it from POST
*
* @return string the value of the parameter
*
@ -597,7 +597,7 @@ function get_config_param_from_db($param = '')
* @param string $dbNameForm DB name
* @param int $dbPortForm DB port
*
* @return Database
* @return \Database
*/
function connectToDatabase(
$dbHostForm,
@ -1063,13 +1063,15 @@ function display_requirements(
<input type="text" name="updatePath" size="50" value="<?php echo ($badUpdatePath && !empty($updatePath)) ? htmlentities($updatePath) : ''; ?>" />
</p>
<p>
<button type="submit" class="btn btn-default" name="step1" value="<?php echo get_lang('Back'); ?>" >
<em class="fa fa-backward"> <?php echo get_lang('Back'); ?></em>
</button>
<input type="hidden" name="is_executable" id="is_executable" value="-" />
<button type="submit" class="btn btn-success" name="<?php echo isset($_POST['step2_update_6']) ? 'step2_update_6' : 'step2_update_8'; ?>" value="<?php echo get_lang('Next'); ?> &gt;" >
<em class="fa fa-forward"> </em> <?php echo get_lang('Next'); ?>
</button>
<div class="btn-group">
<button type="submit" class="btn btn-secondary" name="step1" value="<?php echo get_lang('Back'); ?>" >
<em class="fa fa-backward"> <?php echo get_lang('Back'); ?></em>
</button>
<input type="hidden" name="is_executable" id="is_executable" value="-" />
<button type="submit" class="btn btn-success" name="<?php echo isset($_POST['step2_update_6']) ? 'step2_update_6' : 'step2_update_8'; ?>" value="<?php echo get_lang('Next'); ?> &gt;" >
<em class="fa fa-forward"> </em> <?php echo get_lang('Next'); ?>
</button>
</div>
</p>
</div>
</div>
@ -1167,14 +1169,14 @@ function display_requirements(
// And now display the choice buttons (go back or install)?>
<p align="center" style="padding-top:15px">
<button type="submit" name="step1" class="btn btn-default" onclick="javascript: window.location='index.php'; return false;" value="<?php echo get_lang('Previous'); ?>" >
<em class="fa fa-backward"> </em> <?php echo get_lang('Previous'); ?>
</button>
<button type="submit" name="step2_install" class="btn btn-success" value="<?php echo get_lang("NewInstallation"); ?>" <?php if ($error) {
<button type="submit" name="step1" class="btn btn-default" onclick="javascript: window.location='index.php'; return false;" value="<?php echo get_lang('Previous'); ?>" >
<em class="fa fa-backward"> </em> <?php echo get_lang('Previous'); ?>
</button>
<button type="submit" name="step2_install" class="btn btn-success" value="<?php echo get_lang("NewInstallation"); ?>" <?php if ($error) {
echo 'disabled="disabled"';
} ?> >
<em class="fa fa-forward"> </em> <?php echo get_lang('NewInstallation'); ?>
</button>
<em class="fa fa-forward"> </em> <?php echo get_lang('NewInstallation'); ?>
</button>
<input type="hidden" name="is_executable" id="is_executable" value="-" />
<button type="submit" class="btn btn-default" <?php echo !$error ?: 'disabled="disabled"'; ?> name="step2_update_8" value="Upgrade from Chamilo 1.9.x">
<em class="fa fa-forward" aria-hidden="true"></em> <?php echo get_lang('UpgradeVersion'); ?>
@ -1533,19 +1535,51 @@ function display_database_settings_form(
$database_exists_text = '';
$manager = null;
try {
$manager = connectToDatabase(
if ($installType === 'update') {
/** @var \Database $manager */
$manager = connectToDatabase(
$dbHostForm,
$dbUsernameForm,
$dbPassForm,
$dbNameForm,
$dbPortForm
);
$connection = $manager->getConnection();
$connection->connect();
$schemaManager = $connection->getSchemaManager();
// Test create/alter/drop table
$table = 'zXxTESTxX_'.mt_rand(0, 1000);
$sql = "CREATE TABLE $table (id INT AUTO_INCREMENT NOT NULL, name varchar(255), PRIMARY KEY(id))";
$connection->query($sql);
$tableCreationWorks = false;
$tableDropWorks = false;
if ($schemaManager->tablesExist($table)) {
$tableCreationWorks = true;
$sql = "ALTER TABLE $table ADD COLUMN name2 varchar(140) ";
$connection->query($sql);
$schemaManager->dropTable($table);
$tableDropWorks = $schemaManager->tablesExist($table) === false;
}
} else {
$manager = connectToDatabase(
$dbHostForm,
$dbUsernameForm,
$dbPassForm,
null,
$dbPortForm
);
$databases = $manager->getConnection()->getSchemaManager()->listDatabases();
if (in_array($dbNameForm, $databases)) {
$database_exists_text = '<div class="alert alert-warning">'.get_lang('ADatabaseWithTheSameNameAlreadyExists').'</div>';
$schemaManager = $manager->getConnection()->getSchemaManager();
$databases = $schemaManager->listDatabases();
if (in_array($dbNameForm, $databases)) {
$database_exists_text = '<div class="alert alert-warning">'.get_lang('ADatabaseWithTheSameNameAlreadyExists').'</div>';
}
}
} catch (Exception $e) {
$database_exists_text = $e->getMessage();
$manager = false;
}
if ($manager && $manager->getConnection()->isConnected()): ?>
@ -1554,6 +1588,14 @@ function display_database_settings_form(
Database host: <strong><?php echo $manager->getConnection()->getHost(); ?></strong><br/>
Database port: <strong><?php echo $manager->getConnection()->getPort(); ?></strong><br/>
Database driver: <strong><?php echo $manager->getConnection()->getDriver()->getName(); ?></strong><br/>
<?php
if ($installType === 'update') {
echo get_lang('CreateTableWorks').' <strong>Ok</strong>';
echo '<br/ >';
echo get_lang('AlterTableWorks').' <strong>Ok</strong>';
echo '<br/ >';
echo get_lang('DropColumnWorks').' <strong>Ok</strong>';
} ?>
</div>
<?php else: ?>
<div id="db_status" class="alert alert-danger">
@ -1569,20 +1611,20 @@ function display_database_settings_form(
</button>
<input type="hidden" name="is_executable" id="is_executable" value="-" />
<?php if ($manager) {
?>
?>
<button type="submit" class="btn btn-success" name="step4" value="<?php echo get_lang('Next'); ?> &gt;" >
<em class="fa fa-forward"> </em> <?php echo get_lang('Next'); ?>
</button>
<?php
} else {
?>
} else {
?>
<button
disabled="disabled"
type="submit" class="btn btn-success disabled" name="step4" value="<?php echo get_lang('Next'); ?> &gt;" >
<em class="fa fa-forward"> </em> <?php echo get_lang('Next'); ?>
</button>
<?php
} ?>
} ?>
</div>
<?php
}
@ -3578,7 +3620,7 @@ function migrateSwitch($fromVersion, $manager, $processFiles = true)
{
error_log('Starting migration process from '.$fromVersion.' ('.date('Y-m-d H:i:s').')');
echo '<a class="btn btn-default" href="javascript:void(0)" id="details_button">'.get_lang('Details').'</a><br />';
echo '<a class="btn btn-secondary" href="javascript:void(0)" id="details_button">'.get_lang('Details').'</a><br />';
echo '<div id="details" style="display:none">';
$connection = $manager->getConnection();

@ -146,7 +146,7 @@ if (api_get_setting('allow_social_tool') === 'true') {
if (!isset($_GET['del_msg'])) {
$social_right_content .= MessageManager::inbox_display($keyword);
} else {
$num_msg = intval($_POST['total']);
$num_msg = (int) $_POST['total'];
for ($i = 0; $i < $num_msg; $i++) {
if ($_POST[$i]) {
//the user_id was necessary to delete a message??

@ -8,6 +8,10 @@ use Chamilo\CoreBundle\Entity\PortfolioCategory;
use Chamilo\CoreBundle\Entity\Session;
use Chamilo\UserBundle\Entity\User;
// Make sure we void the course context if we are in the social network section
if (empty($_GET['cidReq'])) {
$cidReset = true;
}
require_once __DIR__.'/../inc/global.inc.php';
api_block_anonymous_users();

@ -1,11 +1,10 @@
<?php
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Entity\SessionRelCourse;
use Chamilo\CoreBundle\Entity\ExtraField;
use Chamilo\CoreBundle\Entity\SequenceResource;
use Chamilo\CoreBundle\Entity\Session;
use Chamilo\CoreBundle\Entity\SessionRelCourse;
use Chamilo\CoreBundle\Repository\SequenceRepository;
use Chamilo\CourseBundle\Entity\CCourseDescription;
use Chamilo\UserBundle\Entity\User;

@ -1,10 +1,9 @@
<?php
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Entity\SessionRelCourse;
use Chamilo\CoreBundle\Entity\SequenceResource;
use Chamilo\CoreBundle\Entity\Session;
use Chamilo\CoreBundle\Entity\SessionRelCourse;
use Chamilo\CoreBundle\Entity\SessionRelCourseRelUser;
use Chamilo\CoreBundle\Repository\SequenceRepository;
use Chamilo\CoreBundle\Repository\SessionRepository;

@ -52,9 +52,7 @@ if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete') {
}
// My friends
$friend_html = SocialManager::listMyFriendsBlock(
$user_id
);
$friend_html = SocialManager::listMyFriendsBlock(api_get_user_id());
$content = null;
$social_right_content = '';

@ -1,8 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\Repository\LegalRepository;
/**
* @package chamilo.messages
*/
@ -10,6 +8,8 @@ $cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
api_set_more_memory_and_time_limits();
api_block_anonymous_users();
if (api_get_configuration_value('disable_gdpr')) {
@ -41,7 +41,12 @@ if (api_get_setting('allow_terms_conditions') === 'true') {
$formToString = $form->returnForm();
$formDelete = new FormValidator('delete_account', 'post', api_get_self().'?action=delete_account&user_id='.$userId);
$formDelete->addTextarea('explanation', [get_lang('DeleteAccount'), get_lang('ExplanationDeleteAccount')], [], true);
$formDelete->addTextarea(
'explanation',
[get_lang('DeleteAccount'), get_lang('ExplanationDeleteAccount')],
[],
true
);
$formDelete->addHidden('action', 'delete_account');
$formDelete->addButtonDelete(get_lang('DeleteAccount'));
$formToString .= $formDelete->returnForm();
@ -105,19 +110,6 @@ switch ($action) {
$explanation = $formDelete->getSubmitValue('explanation');
UserManager::createDataPrivacyExtraFields();
// Remove delete agreement if it was sent:
/*UserManager::update_extra_field_value(
$userId,
'request_for_legal_agreement_consent_removal',
''
);
UserManager::update_extra_field_value(
$userId,
'request_for_legal_agreement_consent_removal_justification',
''
);*/
UserManager::update_extra_field_value(
$userId,
'request_for_delete_account',
@ -174,13 +166,6 @@ switch ($action) {
$explanation
);
/*$extraFieldValue = new ExtraFieldValue('user');
$value = $extraFieldValue->get_values_by_handler_and_field_variable(
$userId,
'legal_accept'
);
$result = $extraFieldValue->delete($value['id']);*/
Display::addFlash(Display::return_message(get_lang('Sent')));
Event::addEvent(
@ -255,7 +240,7 @@ if ($allowSocial) {
$personalDataContent = '<ul>';
$properties = json_decode($propertiesToJson);
$webCoursePath = api_get_path(WEB_COURSE_PATH);
$showWarningMessage = false;
foreach ($properties as $key => $value) {
if (is_array($value) || is_object($value)) {
switch ($key) {
@ -297,6 +282,9 @@ foreach ($properties as $key => $value) {
if (empty($subValue)) {
$personalDataContent .= '<li>'.get_lang('NoData').'</li>';
} else {
if (count($subValue) === 1000) {
$showWarningMessage = true;
}
foreach ($subValue as $subSubValue) {
if ($category === 'DocumentsAdded') {
$documentLink = Display::url(
@ -447,6 +435,10 @@ if (api_get_setting('allow_terms_conditions') === 'true') {
$termLink = Display::url(get_lang('ReadTermsAndConditions'), $url);
}
if ($showWarningMessage) {
Display::addFlash(Display::return_message(get_lang('MoreDataAvailableInTheDatabaseButTrunkedForEfficiencyReasons')));
}
// Block Social Avatar
SocialManager::setSocialUserBlock($tpl, api_get_user_id(), 'messages');
if (api_get_setting('allow_social_tool') === 'true') {

@ -279,6 +279,35 @@ $(document).ready(function() {
var diffDays = moment(end).diff(start, 'days');
var endDateMinusOne = '';
// If event is not editable then just return the qtip
if (!calEvent.editable) {
var onHoverInfo = '';
{% if calEvent.description %}
if (calEvent.description) {
onHoverInfo = calEvent.description;
}
{% endif %}
{% if on_hover_info.comment %}
if (calEvent.comment) {
onHoverInfo = onHoverInfo + calEvent.comment;
}
{% endif %}
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
$(this).qtip({
overwrite: false,
show: {ready: true},
content: onHoverInfo,
position: {
at: 'top center',
my: 'bottom center'
}
});
return;
}
}
if (end) {
var clone = end.clone();
endDateMinusOne = clone.subtract(1, 'days').format('{{ js_format_date }}');

@ -121,7 +121,7 @@
' </button>';
}
html += ' </li>' +
{% if chamilo_settings_get('platform.hide_username_in_course_chat') == 'false' %}
{% if chamilo_settings_get('profile.hide_username_in_course_chat') == 'false' %}
' <li><small>' + user.username + '</small></li>' +
{% else %}
' <li>&nbsp;</li>' +

@ -5111,7 +5111,8 @@ function getFileContents($id, $courseInfo, $sessionId = 0, $correction = false,
$is_editor = api_is_allowed_to_edit(true, true, true);
$student_is_owner_of_work = user_is_author($row['id'], api_get_user_id());
if ($is_editor ||
if (($forceAccessForCourseAdmins && $isAllow) ||
$is_editor ||
$student_is_owner_of_work ||
($doc_visible_for_all && $work_is_visible)
) {

@ -7,7 +7,7 @@
"@symfony/webpack-encore": "0.20.*",
"babel-preset-react": "^6.24.1",
"bootstrap": "^4.1.3",
"copy-webpack-plugin": "^4.3.1",
"copy-webpack-plugin": "^4.5",
"node-sass": "^4.5.3",
"popper.js": "^1.14.4",
"sass-loader": "^6.0.7",
@ -37,10 +37,12 @@
"moment": "^2.22",
"multiselect-two-sides": "^2.5.5",
"mxgraph": "^3.9.3",
"optimize-css-assets-webpack-plugin": "^5.0.1",
"qtip2": "^3.0.3",
"select2": "^4.0.6-rc.1",
"simplewebrtc": "^3.0.1",
"timeago": "^1.6.3",
"uglifyjs-webpack-plugin": "^1.3.0",
"webcamjs": "^1.0",
"webpack-jquery-ui": "^1.0.0"
}

@ -1,8 +0,0 @@
Date plugin
===
This plugin is more of a demo and a plugin example than a real, functional plugin.
It will show the current date in an area of your choice.
The .act.php and .dsp.php files are just remains of a time where we didn't use the Twig templating system.

@ -1,22 +0,0 @@
<?php
/**
* Action script for example date plugin.
*
* @package chamilo.plugin.date
*/
/**
* Initialization.
*/
$convert_lang_to_code = [
"english" => "en_US",
"french" => "fr_BE",
"dutch" => "nl_NL",
"german" => "de_DE",
"japanese" => "ja_JP",
"danish" => "da_DK",
];
if (!empty($_SESSION['user_language_choice']) && !empty($convert_lang_to_code[$_SESSION['user_language_choice']])) {
$code = $convert_lang_to_code[$_SESSION['user_language_choice']];
$locale = setlocale(LC_TIME, $code);
}
$date = strftime('%c');

@ -1,10 +0,0 @@
<?php
/**
* Display script for example date plugin.
*
* @package chamilo.plugin.date
*/
/**
* Display.
*/
echo '<div class="well">'.strip_tags($date).'</div>';

@ -1,11 +0,0 @@
<?php
/**
* Controller for example date plugin.
*
* @package chamilo.plugin.date
*/
/**
* Code.
*/
require 'index.act.php';
require 'index.dsp.php';

@ -1,20 +0,0 @@
<?php
/**
* 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
*
* @author Yannick Warnier <ywarnier@beeznest.org>
*/
/**
* Plugin details (must be present).
*/
//the plugin title
$plugin_info['title'] = 'Date';
//the comments that go with the plugin
$plugin_info['comment'] = "Multinational date display";
//the plugin version
$plugin_info['version'] = '1.0';
//the plugin author
$plugin_info['author'] = 'Yannick Warnier';

@ -1,10 +0,0 @@
<?php
/**
* Controller for example date plugin.
*
* @package chamilo.plugin.date
*/
/**
* Code.
*/
require 'index.php';

@ -0,0 +1,109 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\ApiBundle\GraphQL;
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\UserBundle\Entity\User;
use Firebase\JWT\JWT;
/**
* Class Auth.
*
* @package Chamilo\ApiBundle\GraphQL
*/
class Auth
{
/**
* @param string $username
* @param string $password
*
* @throws \Exception
*
* @return string
*/
public function getUserToken($username, $password): string
{
/** @var User $user */
$user = Container::getUserManager()->findUserBy(['username' => $username]);
if (!$user) {
throw new \Exception(get_lang('NoUser'));
}
$encoder = Container::$container->get('chamilo_user.security.encoder');
$isValid = $encoder->isPasswordValid(
$user->getPassword(),
$password,
$user->getSalt()
);
if (!$isValid) {
throw new \Exception(get_lang('InvalidId'));
}
return self::generateToken($user->getId());
}
/**
* @param \ArrayObject $context
*
* @throws \Exception
*/
public static function checkAuthorization(\ArrayObject $context): void
{
$header = Container::getRequest()->headers->get('Authorization');
$token = str_replace(['Bearer ', 'bearer '], '', $header);
if (empty($token)) {
throw new \Exception(get_lang('NotAllowed'));
}
$tokenData = Auth::getTokenData($token);
/** @var User $user */
$user = Container::getUserManager()->find($tokenData['user']);
if (!$user) {
throw new \Exception(get_lang('NotAllowed'));
}
$context->offsetSet('user', $user);
}
/**
* @param int $userId
*
* @return string
*/
private static function generateToken($userId): string
{
$secret = Container::$container->getParameter('secret');
$time = time();
$payload = [
'iat' => $time,
'exp' => $time + (60 * 60 * 24),
'data' => [
'user' => $userId,
],
];
return JWT::encode($payload, $secret, 'HS384');
}
/**
* @param string $token
*
* @return array
*/
private static function getTokenData($token): array
{
$secret = Container::$container->getParameter('secret');
$jwt = JWT::decode($token, $secret, ['HS384']);
$data = (array) $jwt->data;
return $data;
}
}

@ -0,0 +1,51 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\ApiBundle\GraphQL\Mutation;
use Chamilo\ApiBundle\GraphQL\Auth;
use Overblog\GraphQLBundle\Definition\Argument;
use Overblog\GraphQLBundle\Definition\Resolver\AliasedInterface;
use Overblog\GraphQLBundle\Definition\Resolver\MutationInterface;
use Overblog\GraphQLBundle\Error\UserError;
/**
* Class RootMutation.
*
* @package Chamilo\ApiBundle\GraphQL\Mutation
*/
class RootMutation implements MutationInterface, AliasedInterface
{
/**
* Returns methods aliases.
*
* For instance:
* array('myMethod' => 'myAlias')
*
* @return array
*/
public static function getAliases()
{
return [
'mutationAuthenticate' => 'authenticate',
];
}
/**
* @param Argument $args
*
* @return array
*/
public function mutationAuthenticate(Argument $args)
{
try {
$token = Auth::getUserToken($args['username'], $args['password']);
} catch (\Exception $exception) {
throw new UserError(get_lang('NotAllowed'));
}
return [
'token' => $token,
];
}
}

@ -0,0 +1,68 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\ApiBundle\GraphQL\Resolver;
use Chamilo\CoreBundle\Entity\Message;
use Overblog\GraphQLBundle\Definition\Resolver\AliasedInterface;
use Overblog\GraphQLBundle\Definition\Resolver\ResolverInterface;
/**
* Class MessageResolver.
*
* @package Chamilo\ApiBundle\GraphQL\Resolver
*/
class MessageResolver implements ResolverInterface, AliasedInterface
{
/**
* Returns methods aliases.
*
* For instance:
* array('myMethod' => 'myAlias')
*
* @return array
*/
public static function getAliases()
{
return [
'resolveSender' => 'message_sender',
'resolveExcerpt' => 'message_excerpt',
'resolveHasAttachments' => 'message_has_attachments',
];
}
/**
* @param Message $message
*
* @return \Chamilo\UserBundle\Entity\User
*/
public function resolveSender(Message $message)
{
return $message->getUserSender();
}
/**
* @param Message $message
* @param int $length
*
* @return string
*/
public function resolveExcerpt($message, $length = 50)
{
$striped = strip_tags($message->getContent());
$replaced = str_replace(["\r\n", "\n"], ' ', $striped);
$trimmed = trim($replaced);
return api_trunc_str($trimmed, $length);
}
/**
* @param Message $message
*
* @return bool
*/
public function resolveHasAttachments(Message $message)
{
return $message->getAttachments()->count() > 0;
}
}

@ -0,0 +1,52 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\ApiBundle\GraphQL\Resolver;
use Chamilo\ApiBundle\GraphQL\Auth;
use Chamilo\UserBundle\Entity\User;
use Overblog\GraphQLBundle\Definition\Resolver\AliasedInterface;
use Overblog\GraphQLBundle\Definition\Resolver\ResolverInterface;
use Overblog\GraphQLBundle\Error\UserError;
/**
* Class RootResolver.
*
* @package Chamilo\ApiBundle\GraphQL\Resolver
*/
class RootResolver implements ResolverInterface, AliasedInterface
{
/**
* Returns methods aliases.
*
* For instance:
* array('myMethod' => 'myAlias')
*
* @return array
*/
public static function getAliases()
{
return [
'resolverViewer' => 'viewer',
];
}
/**
* @param \ArrayObject $context
*
* @return User
*/
public function resolverViewer(\ArrayObject $context)
{
try {
Auth::checkAuthorization($context);
} catch (\Exception $exception) {
throw new UserError($exception->getMessage());
}
/** @var User $user */
$user = $context->offsetGet('user');
return $user;
}
}

@ -0,0 +1,75 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\ApiBundle\GraphQL\Resolver;
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CoreBundle\Repository\MessageRepository;
use Chamilo\UserBundle\Entity\User;
use Overblog\GraphQLBundle\Definition\Resolver\AliasedInterface;
use Overblog\GraphQLBundle\Definition\Resolver\ResolverInterface;
/**
* Class UserResolver.
*
* @package Chamilo\ApiBundle\GraphQL\Resolver
*/
class UserResolver implements ResolverInterface, AliasedInterface
{
public const IMAGE_SIZE_TINY = 16;
public const IMAGE_SIZE_SMALL = 32;
public const IMAGE_SIZE_MEDIUM = 64;
public const IMAGE_SIZE_BIG = 128;
/**
* Returns methods aliases.
*
* For instance:
* array('myMethod' => 'myAlias')
*
* @return array
*/
public static function getAliases(): array
{
return [
'resolveUserPicture' => 'user_picture',
'resolveUserMessages' => 'user_messages',
];
}
/**
* @param int $size
* @param \ArrayObject $context
*
* @return string
*/
public function resolveUserPicture($size, \ArrayObject $context): string
{
/** @var User $user */
$user = $context->offsetGet('user');
if (!$user) {
return null;
}
$path = $user->getAvatarOrAnonymous((int) $size);
$url = Container::getAsset()->getUrl($path);
return $url;
}
/**
* @param User $user
* @param int $lastId
*
* @return array
*/
public function resolveUserMessages(User $user, $lastId = 0): array
{
/** @var MessageRepository $messageRepo */
$messageRepo = Container::getEntityManager()->getRepository('ChamiloCoreBundle:Message');
$messages = $messageRepo->getFromLastOneReceived($user, (int) $lastId);
return $messages;
}
}

@ -0,0 +1,35 @@
UserStatus:
type: enum
config:
description: "One of the statuses for the user."
values:
TEACHER:
description: "Global status of a user: Course Manager."
value: '@=constant("Chamilo\\UserBundle\\Entity\\User::TEACHER")'
SESSION_ADMIN:
description: "Global status of a user: Session Admin."
value: '@=constant("Chamilo\\UserBundle\\Entity\\User::SESSION_ADMIN")'
DRH:
description: "Global status of a user: Human Ressource Manager."
value: '@=constant("Chamilo\\UserBundle\\Entity\\User::DRH")'
STUDENT:
description: "Global status of a user: Student."
value: '@=constant("Chamilo\\UserBundle\\Entity\\User::STUDENT")'
UserImageSize:
type: enum
config:
description: 'One of the sizes for the user picture.'
values:
SIZE_TINY:
description: 'Image in small size: 16px.'
value: '@=constant("Chamilo\\ApiBundle\\GraphQL\\Resolver\\UserResolver::IMAGE_SIZE_TINY")'
SIZE_SMALL:
description: 'Image in small size: 32px.'
value: '@=constant("Chamilo\\ApiBundle\\GraphQL\\Resolver\\UserResolver::IMAGE_SIZE_SMALL")'
SIZE_MEDIUM:
description: 'Image in small size: 64px.'
value: '@=constant("Chamilo\\ApiBundle\\GraphQL\\Resolver\\UserResolver::IMAGE_SIZE_MEDIUM")'
SIZE_BIG:
description: 'Image in small size: 128px.'
value: '@=constant("Chamilo\\ApiBundle\\GraphQL\\Resolver\\UserResolver::IMAGE_SIZE_BIG")'

@ -0,0 +1,21 @@
Mutation:
type: object
config:
fields:
authenticate:
description: "Authenticate user."
type: "AuthenticatePayload!"
args:
username:
type: "String!"
password:
type: "String!"
resolve: "@=mutation('authenticate', [args])"
AuthenticatePayload:
type: object
config:
fields:
token:
description: "Authorization token."
type: "String!"

@ -0,0 +1,75 @@
Query:
type: object
config:
description: "GraphQL queries."
fields:
viewer:
description: "A registered user on the platform."
type: "User"
resolve: "@=resolver('viewer', [context])"
User:
type: object
config:
description: "Registered user."
fields:
id:
description: "The unique ID of the user."
type: "Int"
firstname:
type: "String"
lastname:
type: "String"
username:
type: "String"
email:
type: "String"
officialCode:
type: "String"
status:
type: "UserStatus"
picture:
type: "String"
args:
size:
type: "UserImageSize"
defaultValue: '@=constant("Chamilo\\ApiBundle\\GraphQL\\Resolver\\UserResolver::IMAGE_SIZE_SMALL")'
resolve: "@=resolver('user_picture', [args['size'], context])"
messages:
description: 'Received messages for the user.'
type: '[UserMessage]'
args:
lastId:
description: 'Last received by the app message ID.'
type: 'Int'
defaultValue: 0
resolve: "@=resolver('user_messages', [value, args['lastId']])"
UserMessage:
type: object
config:
description: 'Received message by user.'
fields:
id:
description: 'The unique ID of the message.'
type: 'Int'
title:
type: 'String'
content:
type: 'String'
sender:
type: 'User'
resolve: "@=resolver('message_sender', [value])"
sendDate:
type: 'String'
excerpt:
type: 'String'
args:
length:
description: 'The approximate desired length. 50 chars by default.'
type: 'Int'
defaultValue: 50
resolve: "@=resolver('message_excerpt', [value, args['length']])"
hasAttachments:
type: 'Boolean'
resolve: "@=resolver('message_has_attachments', [value])"

@ -105,7 +105,7 @@ class TestMatching extends Basic
['BulletedList', 'NumberedList', 'HorizontalRule'],
['JustifyLeft', 'JustifyCenter', 'JustifyBlock'],
['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'],
['Toolbarswitch'],
['Source', 'Toolbarswitch'],
];
}
}

@ -131,7 +131,7 @@ class TestQuestionDescription extends Basic
['Link', 'Unlink', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath', 'Asciisvg'],
['BulletedList', 'NumberedList', 'HorizontalRule'],
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'],
['Styles', 'Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'],
['Source', 'Toolbarswitch'],
];
}

@ -280,10 +280,8 @@ class ResourceController extends BaseResourceController implements CourseControl
case 'user':
// Only for me
if (isset($share['only_me'])) {
error_log('only_me');
$repository->addResourceOnlyToMe($resourceNode);
} else {
error_log('others');
// To other users
$repository->addResourceToUserList($resourceNode, $idList);
}

@ -3,6 +3,7 @@
namespace Chamilo\CoreBundle\Entity;
use Chamilo\CoreBundle\Traits\CourseTrait;
use Doctrine\ORM\Mapping as ORM;
/**
@ -13,6 +14,8 @@ use Doctrine\ORM\Mapping as ORM;
*/
class AccessUrl
{
use CourseTrait;
/**
* @var int
*
@ -429,26 +432,6 @@ class AccessUrl
return $this;
}
/**
* @return mixed
*/
public function getCourse()
{
return $this->course;
}
/**
* @param mixed $course
*
* @return AccessUrl
*/
public function setCourse($course)
{
$this->course = $course;
return $this;
}
/**
* @return mixed
*/

@ -3,6 +3,7 @@
namespace Chamilo\CoreBundle\Entity;
use Chamilo\CoreBundle\Traits\CourseTrait;
use Doctrine\ORM\Mapping as ORM;
/**
@ -13,6 +14,8 @@ use Doctrine\ORM\Mapping as ORM;
*/
class AccessUrlRelCourse
{
use CourseTrait;
/**
* @var int
*
@ -73,20 +76,4 @@ class AccessUrlRelCourse
{
return $this->url;
}
/**
* @param Course $course
*/
public function setCourse(Course $course)
{
$this->course = $course;
}
/**
* @return Course
*/
public function getCourse()
{
return $this->course;
}
}

@ -27,6 +27,7 @@ use Symfony\Component\Validator\Constraints as Assert;
* @UniqueEntity("code")
* @UniqueEntity("visualCode")
* @UniqueEntity("directory")
*
* @ORM\Entity(repositoryClass="Chamilo\CoreBundle\Repository\CourseRepository")
* @ORM\EntityListeners({"Chamilo\CoreBundle\Entity\Listener\CourseListener"})
*/
@ -66,22 +67,22 @@ class Course
protected $users;
/**
* @ORM\OneToMany(targetEntity="AccessUrlRelCourse", mappedBy="course", cascade={"persist"}, orphanRemoval=true)
* @ORM\OneToMany(targetEntity="AccessUrlRelCourse", mappedBy="course", cascade={"persist", "remove"}, orphanRemoval=true)
*/
protected $urls;
/**
* @ORM\OneToMany(targetEntity="SessionRelCourse", mappedBy="course", cascade={"persist"})
* @ORM\OneToMany(targetEntity="SessionRelCourse", mappedBy="course", cascade={"persist", "remove"})
*/
protected $sessions;
/**
* @ORM\OneToMany(targetEntity="SessionRelCourseRelUser", mappedBy="course", cascade={"persist"})
* @ORM\OneToMany(targetEntity="SessionRelCourseRelUser", mappedBy="course", cascade={"persist", "remove"})
*/
protected $sessionUserSubscriptions;
/**
* @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CGroupInfo", mappedBy="course", cascade={"persist"}, orphanRemoval=true)
* @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CGroupInfo", mappedBy="course", cascade={"persist", "remove"}, orphanRemoval=true)
*/
protected $groups;
@ -91,7 +92,7 @@ class Course
//protected $items;
/**
* @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CTool", mappedBy="course", cascade={"persist"})
* @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CTool", mappedBy="course", cascade={"persist", "remove"})
*/
protected $tools;
@ -106,42 +107,42 @@ class Course
protected $currentUrl;
/**
* @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\SkillRelUser", mappedBy="course", cascade={"persist"})
* @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\SkillRelUser", mappedBy="course", cascade={"persist", "remove"})
*/
protected $issuedSkills;
/**
* @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\GradebookCategory", mappedBy="course")
* @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\GradebookCategory", mappedBy="course", cascade={"persist", "remove"})
*/
protected $gradebookCategories;
/**
* @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\GradebookEvaluation", mappedBy="course")
* @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\GradebookEvaluation", mappedBy="course", cascade={"persist", "remove"})
*/
protected $gradebookEvaluations;
/**
* @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\GradebookLink", mappedBy="course")
* @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\GradebookLink", mappedBy="course", cascade={"persist", "remove"})
*/
protected $gradebookLinks;
/**
* @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\TrackEHotspot", mappedBy="course")
* @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\TrackEHotspot", mappedBy="course", cascade={"persist", "remove"})
*/
protected $trackEHotspots;
/**
* @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\TrackEAttempt", mappedBy="course")
* @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\TrackEAttempt", mappedBy="course", cascade={"persist", "remove"})
*/
protected $trackEAttempts;
/**
* @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\SearchEngineRef", mappedBy="course")
* @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\SearchEngineRef", mappedBy="course", cascade={"persist", "remove"})
*/
protected $searchEngineRefs;
/**
* @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\Templates", mappedBy="course")
* @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\Templates", mappedBy="course", cascade={"persist", "remove"})
*/
protected $templates;
@ -234,7 +235,9 @@ class Course
/**
* @var string
*
* @Assert\Url()
*
* @ORM\Column(name="department_url", type="string", length=180, nullable=true, unique=false)
*/
protected $departmentUrl;
@ -323,11 +326,6 @@ class Course
*/
protected $courseTypeId;
/**
* @ORM\OneToMany(targetEntity="Chamilo\NotebookBundle\Entity\CNotebook", mappedBy="course")
*/
//protected $notebooks;
/**
* ORM\OneToMany(targetEntity="CurriculumCategory", mappedBy="course").
*/
@ -379,22 +377,6 @@ class Course
return $this->sessions;
}
/**
* @return ArrayCollection
*/
public function getNotebooks()
{
return $this->notebooks;
}
/**
* @return ArrayCollection
*/
public function getItems()
{
return $this->items;
}
/**
* @return ArrayCollection
*/

@ -3,6 +3,7 @@
namespace Chamilo\CoreBundle\Entity;
use Chamilo\CoreBundle\Traits\CourseTrait;
use Doctrine\ORM\Mapping as ORM;
/**
@ -13,6 +14,8 @@ use Doctrine\ORM\Mapping as ORM;
*/
class GradebookEvaluation
{
use CourseTrait;
/**
* @var int
*
@ -170,30 +173,6 @@ class GradebookEvaluation
return $this->userId;
}
/**
* Set course.
*
* @param \Chamilo\CoreBundle\Entity\Course|null $course
*
* @return \Chamilo\CoreBundle\Entity\GradebookEvaluation
*/
public function setCourse($course)
{
$this->course = $course;
return $this;
}
/**
* Get course.
*
* @return \Chamilo\CoreBundle\Entity\Course
*/
public function getCourse()
{
return $this->course;
}
/**
* Set categoryId.
*

@ -3,6 +3,7 @@
namespace Chamilo\CoreBundle\Entity;
use Chamilo\CoreBundle\Traits\CourseTrait;
use Doctrine\ORM\Mapping as ORM;
/**
@ -13,6 +14,8 @@ use Doctrine\ORM\Mapping as ORM;
*/
class GradebookLink
{
use CourseTrait;
/**
* @var int
*
@ -156,30 +159,6 @@ class GradebookLink
return $this->userId;
}
/**
* Set course.
*
* @param \Chamilo\CoreBundle\Entity\Course $course
*
* @return \Chamilo\CoreBundle\Entity\GradebookLink
*/
public function setCourse(Course $course)
{
$this->course = $course;
return $this;
}
/**
* Get course.
*
* @return \Chamilo\CoreBundle\Entity\Course
*/
public function getCourse()
{
return $this->course;
}
/**
* Set categoryId.
*

@ -16,9 +16,18 @@ class GradebookResultLog
/**
* @var int
*
* @ORM\Column(name="id_result", type="integer", nullable=false)
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
protected $idResult;
protected $id;
/**
* @var int
*
* @ORM\Column(name="result_id", type="integer", nullable=false)
*/
protected $resultId;
/**
* @var int
@ -48,39 +57,6 @@ class GradebookResultLog
*/
protected $score;
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
protected $id;
/**
* Set idResult.
*
* @param int $idResult
*
* @return GradebookResultLog
*/
public function setIdResult($idResult)
{
$this->idResult = $idResult;
return $this;
}
/**
* Get idResult.
*
* @return int
*/
public function getIdResult()
{
return $this->idResult;
}
/**
* Set userId.
*
@ -186,4 +162,24 @@ class GradebookResultLog
{
return $this->id;
}
/**
* @return int
*/
public function getResultId(): int
{
return $this->resultId;
}
/**
* @param int $resultId
*
* @return GradebookResultLog
*/
public function setResultId(int $resultId): GradebookResultLog
{
$this->resultId = $resultId;
return $this;
}
}

@ -3,6 +3,8 @@
namespace Chamilo\CoreBundle\Entity;
use Chamilo\UserBundle\Entity\User;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
/**
@ -17,7 +19,7 @@ use Doctrine\ORM\Mapping as ORM;
* @ORM\Index(name="idx_message_group", columns={"group_id"}),
* @ORM\Index(name="idx_message_parent", columns={"parent_id"})
* })
* @ORM\Entity
* @ORM\Entity(repositoryClass="Chamilo\CoreBundle\Repository\MessageRepository")
*/
class Message
{
@ -31,18 +33,20 @@ class Message
protected $id;
/**
* @var int
* @var User
*
* @ORM\Column(name="user_sender_id", type="integer", nullable=false)
* @ORM\ManyToOne(targetEntity="Chamilo\UserBundle\Entity\User", inversedBy="sentMessages")
* @ORM\JoinColumn(name="user_sender_id", referencedColumnName="id", nullable=false)
*/
protected $userSenderId;
protected $userSender;
/**
* @var int
* @var User
*
* @ORM\Column(name="user_receiver_id", type="integer", nullable=false)
* @ORM\ManyToOne(targetEntity="Chamilo\UserBundle\Entity\User", inversedBy="receivedMessages")
* @ORM\JoinColumn(name="user_receiver_id", referencedColumnName="id", nullable=true)
*/
protected $userReceiverId;
protected $userReceiver;
/**
* @var bool
@ -101,51 +105,66 @@ class Message
protected $votes;
/**
* Set userSenderId.
* @var ArrayCollection
*
* @param int $userSenderId
* @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\MessageAttachment", mappedBy="message")
*/
protected $attachments;
/**
* Message constructor.
*/
public function __construct()
{
$this->attachments = new ArrayCollection();
}
/**
* Set userSender.
*
* @param User $userSender
*
* @return Message
*/
public function setUserSenderId($userSenderId)
public function setUserSender(User $userSender)
{
$this->userSenderId = $userSenderId;
$this->userSender = $userSender;
return $this;
}
/**
* Get userSenderId.
* Get userSender.
*
* @return int
* @return User
*/
public function getUserSenderId()
public function getUserSender()
{
return $this->userSenderId;
return $this->userSender;
}
/**
* Set userReceiverId.
* Set userReceiver.
*
* @param int $userReceiverId
* @param User $userReceiver
*
* @return Message
*/
public function setUserReceiverId($userReceiverId)
public function setUserReceiver(User $userReceiver)
{
$this->userReceiverId = $userReceiverId;
$this->userReceiver = $userReceiver;
return $this;
}
/**
* Get userReceiverId.
* Get userReceiver.
*
* @return int
* @return User
*/
public function getUserReceiverId()
public function getUserReceiver()
{
return $this->userReceiverId;
return $this->userReceiver;
}
/**
@ -349,4 +368,14 @@ class Message
{
return $this->votes;
}
/**
* Get attachments.
*
* @return ArrayCollection
*/
public function getAttachments()
{
return $this->attachments;
}
}

@ -44,11 +44,12 @@ class MessageAttachment
protected $size;
/**
* @var int
* @var Message
*
* @ORM\Column(name="message_id", type="integer", nullable=false)
* @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Message", inversedBy="attachments")
* @ORM\JoinColumn(name="message_id", referencedColumnName="id", nullable=false)
*/
protected $messageId;
protected $message;
/**
* @var string
@ -130,27 +131,27 @@ class MessageAttachment
}
/**
* Set messageId.
* Set message.
*
* @param int $messageId
* @param Message $message
*
* @return MessageAttachment
*/
public function setMessageId($messageId)
public function setMessage(Message $message)
{
$this->messageId = $messageId;
$this->message = $message;
return $this;
}
/**
* Get messageId.
* Get message.
*
* @return int
* @return Message
*/
public function getMessageId()
public function getMessage()
{
return $this->messageId;
return $this->message;
}
/**

@ -11,16 +11,13 @@ use Doctrine\ORM\Mapping as ORM;
/**
* Class PortfolioCategory.
*
* @package Chamilo\CoreBundle\Entity
*
* @ORM\Table(
* name="portfolio_category",
* indexes={
* @ORM\Index(name="user", columns={"user_id"})
* }
* )
* Add @ to the next line if api_get_configuration_value('allow_portfolio_tool') is true
* @ORM\Entity()
* @ORM\Entity
*/
class PortfolioCategory
{

@ -165,28 +165,4 @@ class SessionCategory
{
return $this->dateEnd;
}
/**
* Set accessUrlId.
*
* @param int $accessUrlId
*
* @return SessionCategory
*/
public function setAccessUrlId($accessUrlId)
{
$this->accessUrlId = $accessUrlId;
return $this;
}
/**
* Get accessUrlId.
*
* @return int
*/
public function getAccessUrlId()
{
return $this->accessUrlId;
}
}

@ -227,7 +227,7 @@ class SessionRelCourseRelUser
*
* @return int
*/
public function getLegalAgreement(): int
public function getLegalAgreement()
{
return $this->legalAgreement;
}

@ -37,11 +37,12 @@ class Templates
protected $description;
/**
* @var string
* @var Course
*
* @ORM\Column(name="course_code", type="string", length=40, nullable=false)
* @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course", cascade={"persist"})
* @ORM\JoinColumn(name="c_id", referencedColumnName="id")
*/
protected $courseCode;
protected $course;
/**
* @var int
@ -112,30 +113,6 @@ class Templates
return $this->description;
}
/**
* Set courseCode.
*
* @param string $courseCode
*
* @return Templates
*/
public function setCourseCode($courseCode)
{
$this->courseCode = $courseCode;
return $this;
}
/**
* Get courseCode.
*
* @return string
*/
public function getCourseCode()
{
return $this->courseCode;
}
/**
* Set userId.
*
@ -217,4 +194,24 @@ class Templates
{
return $this->id;
}
/**
* @return Course
*/
public function getCourse(): Course
{
return $this->course;
}
/**
* @param Course $course
*
* @return Templates
*/
public function setCourse(Course $course): Templates
{
$this->course = $course;
return $this;
}
}

@ -3,6 +3,7 @@
namespace Chamilo\CoreBundle\Entity;
use Chamilo\CoreBundle\Traits\CourseTrait;
use Doctrine\ORM\Mapping as ORM;
/**
@ -22,6 +23,17 @@ use Doctrine\ORM\Mapping as ORM;
*/
class TrackEAttempt
{
use CourseTrait;
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
protected $id;
/**
* @var int
*
@ -64,13 +76,6 @@ class TrackEAttempt
*/
protected $marks;
/**
* @var int
*
* @ORM\Column(name="c_id", type="integer", nullable=false)
*/
protected $cId;
/**
* @var int
*
@ -100,13 +105,10 @@ class TrackEAttempt
protected $filename;
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
* @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course")
* @ORM\JoinColumn(name="c_id", referencedColumnName="id")
*/
protected $id;
protected $course;
/**
* Set exeId.
@ -252,30 +254,6 @@ class TrackEAttempt
return $this->marks;
}
/**
* Set cId.
*
* @param int $cId
*
* @return TrackEAttempt
*/
public function setCId($cId)
{
$this->cId = $cId;
return $this;
}
/**
* Get cId.
*
* @return int
*/
public function getCId()
{
return $this->cId;
}
/**
* Set position.
*

@ -3,13 +3,13 @@
namespace Chamilo\CoreBundle\Entity;
use Chamilo\CoreBundle\Traits\CourseTrait;
use Doctrine\ORM\Mapping as ORM;
/**
* TrackEHotspot.
*
* @ORM\Table(name="track_e_hotspot", indexes={
* @ORM\Index(name="hotspot_course_code", columns={"hotspot_course_code"}),
* @ORM\Index(name="hotspot_user_id", columns={"hotspot_user_id"}),
* @ORM\Index(name="hotspot_exe_id", columns={"hotspot_exe_id"}),
* @ORM\Index(name="hotspot_question_id", columns={"hotspot_question_id"})
@ -18,6 +18,8 @@ use Doctrine\ORM\Mapping as ORM;
*/
class TrackEHotspot
{
use CourseTrait;
/**
* @var int
*
@ -35,18 +37,10 @@ class TrackEHotspot
protected $hotspotUserId;
/**
* @var string
*
* @ORM\Column(name="hotspot_course_code", type="string", length=50, nullable=false)
* @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course")
* @ORM\JoinColumn(name="c_id", referencedColumnName="id")
*/
protected $hotspotCourseCode;
/**
* @var int
*
* @ORM\Column(name="c_id", type="integer", nullable=true)
*/
protected $cId;
protected $course;
/**
* @var int
@ -107,54 +101,6 @@ class TrackEHotspot
return $this->hotspotUserId;
}
/**
* Set hotspotCourseCode.
*
* @param string $hotspotCourseCode
*
* @return TrackEHotspot
*/
public function setHotspotCourseCode($hotspotCourseCode)
{
$this->hotspotCourseCode = $hotspotCourseCode;
return $this;
}
/**
* Get hotspotCourseCode.
*
* @return string
*/
public function getHotspotCourseCode()
{
return $this->hotspotCourseCode;
}
/**
* Set cId.
*
* @param int $cId
*
* @return TrackEHotspot
*/
public function setCId($cId)
{
$this->cId = $cId;
return $this;
}
/**
* Get cId.
*
* @return int
*/
public function getCId()
{
return $this->cId;
}
/**
* Set hotspotExeId.
*

@ -13,7 +13,6 @@ use Doctrine\ORM\Mapping as ORM;
* indexes={
* @ORM\Index(name="course", columns={"c_id"}),
* @ORM\Index(name="upload_user_id", columns={"upload_user_id"}),
* @ORM\Index(name="upload_cours_id", columns={"upload_cours_id"}),
* @ORM\Index(name="upload_session_id", columns={"upload_session_id"})
* }
* )
@ -21,6 +20,15 @@ use Doctrine\ORM\Mapping as ORM;
*/
class TrackEUploads
{
/**
* @var int
*
* @ORM\Column(name="upload_id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
protected $uploadId;
/**
* @var int
*
@ -35,13 +43,6 @@ class TrackEUploads
*/
protected $uploadDate;
/**
* @var string
*
* @ORM\Column(name="upload_cours_id", type="string", length=40, nullable=false)
*/
protected $uploadCoursId;
/**
* @var int
*
@ -63,15 +64,6 @@ class TrackEUploads
*/
protected $uploadSessionId;
/**
* @var int
*
* @ORM\Column(name="upload_id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
protected $uploadId;
/**
* Set uploadUserId.
*
@ -120,30 +112,6 @@ class TrackEUploads
return $this->uploadDate;
}
/**
* Set uploadCoursId.
*
* @param string $uploadCoursId
*
* @return TrackEUploads
*/
public function setUploadCoursId($uploadCoursId)
{
$this->uploadCoursId = $uploadCoursId;
return $this;
}
/**
* Get uploadCoursId.
*
* @return string
*/
public function getUploadCoursId()
{
return $this->uploadCoursId;
}
/**
* Set cId.
*

@ -10,6 +10,7 @@ use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\Routing\Route;
use \CourseManager;
/**
* Class LegacyListener
@ -149,7 +150,15 @@ class LegacyListener
$languageList[languageToCountryIsoCode($isoCode)] = $language;
}
$twig->addGlobal('current_locale_iso', languageToCountryIsoCode($request->getLocale()));
$isoFixed = languageToCountryIsoCode($request->getLocale());
$twig->addGlobal(
'current_locale_info',
[
'iso' => $isoFixed,
'text' => $languageList[$isoFixed],
]
);
$twig->addGlobal('available_locales', $languages);
$twig->addGlobal('show_toolbar', \Template::isToolBarDisplayedForUser() ? 1 : 0);

@ -1,125 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\EventListener;
use Chamilo\UserBundle\Entity\User;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
/**
* Class LegacyLoginListener.
* File not needed the real listener is LegacyListener.
*
* @deprecated use LegacyListener
*
* @package Chamilo\CoreBundle\EventListener
*/
class LegacyLoginListener implements EventSubscriberInterface
{
/** @var ContainerInterface */
protected $container;
protected $tokenStorage;
/**
* LegacyLoginListener constructor.
*
* @param ContainerInterface $container
* @param TokenStorageInterface $tokenStorage
*/
public function __construct(ContainerInterface $container, TokenStorageInterface $tokenStorage)
{
$this->container = $container;
$this->tokenStorage = $tokenStorage;
}
/**
* @param GetResponseEvent $event
*/
public function onKernelRequest(GetResponseEvent $event)
{
$request = $event->getRequest();
if (!$request->hasPreviousSession()) {
return;
}
$container = $this->container;
$token = $this->tokenStorage->getToken();
if ($token) {
$isGranted = $container->get('security.authorization_checker')->isGranted('IS_AUTHENTICATED_FULLY');
if ($isGranted) {
} else {
if (isset($_SESSION) && isset($_SESSION['_user'])) {
if ($_SESSION['_user']['active'] == 1) {
$username = $_SESSION['_user']['username'];
$criteria = ['username' => $username];
/** @var User $user */
$user = $container->get('fos_user.user_manager')->findOneBy($criteria);
if ($user) {
$em = $container->get('doctrine');
/** @var User $completeUser */
$completeUser = $em->getRepository('ChamiloUserBundle:User')->findOneBy($criteria);
$user->setLanguage($completeUser->getLanguage());
$isAdminUser = $em->getRepository('ChamiloCoreBundle:Admin')->findOneBy(['userId' => $user->getId()]);
if ($isAdminUser) {
$user->setSuperAdmin(true);
}
$languages = ['german' => 'de', 'english' => 'en', 'spanish' => 'es', 'french' => 'fr'];
$locale = isset($languages[$user->getLanguage()]) ? $languages[$user->getLanguage()] : '';
if ($user && !empty($locale)) {
$user->setLocale($locale);
//$request->getSession()->set('_locale_user', $locale);
// if no explicit locale has been set on this request, use one from the session
$request->getSession()->set('_locale', $locale);
$request->setLocale($locale);
}
$token = new UsernamePasswordToken($user, null, 'admin', $user->getRoles());
$this->tokenStorage->setToken($token); //now the user is logged in
//now dispatch the login event
$event = new InteractiveLoginEvent($request, $token);
$container->get('event_dispatcher')->dispatch("security.interactive_login", $event);
$container->get('event_dispatcher')->addListener(
KernelEvents::RESPONSE,
[$this, 'redirectUser']
);
}
}
}
}
}
}
/**
* @return array
*/
public static function getSubscribedEvents()
{
return [
// must be registered before the default Locale listener
KernelEvents::REQUEST => [['onKernelRequest', 15]],
];
}
/**
* @param FilterResponseEvent $event
*/
public function redirectUser(FilterResponseEvent $event)
{
$uri = $event->getRequest()->getUri();
// on effectue la redirection
$response = new RedirectResponse($uri);
$event->setResponse($response);
}
}

@ -60,20 +60,24 @@ class LocaleListener implements EventSubscriberInterface
if ($locale = $request->attributes->get('_locale')) {
$request->getSession()->set('_locale', $locale);
} else {
$localeList = [];
// 1. Check platform locale
/** @var SettingsManager $settings */
$settings = $this->container->get('chamilo.settings.manager');
$platformLocale = $settings->getSetting('language.platform_language');
if (!empty($platformLocale)) {
$locale = $platformLocale;
$localeList['platform_lang'] = $platformLocale;
//$locale = $platformLocale;
}
// 2. Check user locale
// _locale_user is set when user logins the system check UserLocaleListener
$userLocale = $request->getSession()->get('_locale_user');
if (!empty($userLocale)) {
$locale = $userLocale;
//$locale = $userLocale;
$localeList['user_profil_lang'] = $platformLocale;
}
// 3. Check course locale
@ -96,7 +100,8 @@ class LocaleListener implements EventSubscriberInterface
if (!empty($course)) {
$courseLocale = $course->getCourseLanguage();
if (!empty($courseLocale)) {
$locale = $courseLocale;
//$locale = $courseLocale;
$localeList['course_lang'] = $platformLocale;
}
}
}
@ -104,7 +109,38 @@ class LocaleListener implements EventSubscriberInterface
// 4. force locale if it was selected from the URL
$localeFromUrl = $request->get('_locale');
if (!empty($localeFromUrl)) {
$locale = $localeFromUrl;
//$locale = $localeFromUrl;
$localeList['user_selected_lang'] = $platformLocale;
}
$priorityList = [
'language_priority_4',
'language_priority_3',
'language_priority_2',
'language_priority_1',
];
$locale = '';
foreach ($priorityList as $setting) {
$priority = $settings->getSetting("language.$setting");
if (!empty($priority) && isset($localeList[$priority])) {
$locale = $localeList[$priority];
}
}
if (empty($locale)) {
// Use default order
$priorityList = [
'platform_lang',
'user_profil_lang',
'course_lang',
'user_selected_lang',
];
foreach ($priorityList as $setting) {
if (isset($localeList[$setting])) {
$locale = $localeList[$setting];
}
}
}
// if no explicit locale has been set on this request, use one from the session

@ -0,0 +1,43 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Repository;
use Chamilo\UserBundle\Entity\User;
use Doctrine\ORM\EntityRepository;
/**
* Class MessageRepository.
*
* @package Chamilo\CoreBundle\Repository
*/
class MessageRepository extends EntityRepository
{
/**
* @param User $user
* @param int $lastMessageId
*
* @return mixed
*/
public function getFromLastOneReceived(User $user, $lastMessageId = 0)
{
$qb = $this->createQueryBuilder('m');
$qb
->where(
$qb->expr()->eq('m.userReceiver', $user->getId())
)
->andWhere(
$qb->expr()->eq('m.msgStatus', MESSAGE_STATUS_UNREAD)
)
->andWhere(
$qb->expr()->gt('m.id', (int) $lastMessageId)
)
->orderBy(
'm.sendDate',
'DESC'
);
return $qb->getQuery()->getResult();
}
}

@ -14,5 +14,4 @@ use Doctrine\ORM\EntityRepository;
*/
class SessionRepository extends EntityRepository
{
}

@ -1,28 +1,29 @@
{% if chamilo_settings_get('language.show_language_selector_in_menu') == 'true' %}
{% autoescape false %}
<div class="btn-group" role="group">
<button
type="button"
class="btn btn-secondary dropdown-toggle"
class="btn btn-default dropdown-toggle"
data-toggle="dropdown"
aria-haspopup="true"
aria-expanded="false"
>
<span class="flag-icon flag-icon-{{ current_locale_iso }}"></span>
{{ current_locale_iso }}
<span class="flag-icon flag-icon-{{ current_locale_info.iso }}"></span>
{{ current_locale_info.text }}
<span class="caret">
</span>
</button>
<div class="dropdown-menu" role="menu">
{% autoescape false %}
{% for index, locale in available_locales %}
<a class="dropdown-item" href="{{ app.request.attributes.get('_route') }}?_locale={{ index }}">
<span class="flag-icon flag-icon-{{ index }}"></span>
{{ locale }}
</a>
{% endfor %}
{% endautoescape %}
{% for index, locale in available_locales %}
<a class="dropdown-item" href="{{ app.request.attributes.get('_route') }}?_locale={{ index }}">
<span class="flag-icon flag-icon-{{ index }}"></span>
{{ locale }}
</a>
{% endfor %}
</div>
</div>
{% endautoescape %}
{% endif %}
{#<div class="dropdown">#}
{#<button type="button" id="dropdownMenu1" data-toggle="dropdown"#}

@ -1,5 +1,5 @@
{% if is_granted('ROLE_ADMIN') %}
<a href="{{ url('edit_page', { 'slug': slug }) }}" class="btn btn-primary" >
<a href="{{ _p.web_public ~ 'internal_page/edit/' ~ slug }}" class="btn btn-primary" >
<i class="fas fa-edit"></i> {{ "header.edit_page"|trans({}, 'SonataPageBundle') }}
</a>
{% endif %}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save