Merge branch '1.10.x' of github.com:chamilo/chamilo-lms into 1.10.x

1.10.x
Yannick Warnier 10 years ago
commit 7246e94917
  1. 7
      app/Migrations/AbstractMigrationChamilo.php
  2. 44
      app/Migrations/Schema/V110/Version110.php
  3. 106
      app/Migrations/Schema/V110/Version20150505132304.php
  4. 23
      app/Migrations/Schema/V110/Version20150507152600.php
  5. 2
      app/Migrations/Schema/V110/Version20150511133949.php
  6. 29
      app/Migrations/Schema/V110/Version20150519153200.php
  7. 9
      app/Migrations/Schema/V110/Version20150521113600.php
  8. 1
      app/Migrations/Schema/V110/Version20150522112023.php
  9. 1
      app/Migrations/Schema/V110/Version20150527101600.php
  10. 65
      app/Migrations/Schema/V110/Version20150529164400.php
  11. 32
      app/Migrations/Schema/V110/Version20150603151200.php
  12. 3
      app/Migrations/Schema/V110/Version20150603181728.php
  13. 12
      app/Migrations/Schema/V110/Version20150713132630.php
  14. 3
      composer.json
  15. 18
      main/admin/ldap_import_students_to_session.php
  16. 4
      main/admin/ldap_synchro.php
  17. 5
      main/admin/sub_language.class.php
  18. 4
      main/auth/ldap/authldap.php
  19. 12
      main/gamification/my_progress.php
  20. 3
      main/gradebook/index.php
  21. 114
      main/gradebook/lib/be/category.class.php
  22. 28
      main/inc/lib/GamificationUtils.php
  23. 5
      main/inc/lib/database.constants.inc.php
  24. 4
      main/inc/lib/myspace.lib.php
  25. 20
      main/inc/lib/sessionmanager.lib.php
  26. 10
      main/inc/local.inc.php
  27. 1
      main/install/database.sql
  28. 2
      main/install/index.php
  29. 243
      main/install/install.lib.php
  30. 88
      main/newscorm/learnpath.class.php
  31. 42
      main/newscorm/lp_view.php
  32. 6
      main/session/session_import.php
  33. 8
      main/template/default/gamification/my_progress.tpl
  34. 36
      main/template/default/learnpath/view.tpl
  35. 4
      main/webservices/registration.soap.php
  36. 21
      src/Chamilo/CoreBundle/Entity/GradeComponents.php
  37. 21
      src/Chamilo/CoreBundle/Entity/GradeModel.php
  38. 20
      src/Chamilo/CoreBundle/Entity/GradebookCategory.php
  39. 21
      src/Chamilo/CoreBundle/Entity/GradebookCertificate.php
  40. 21
      src/Chamilo/CoreBundle/Entity/GradebookEvaluation.php
  41. 22
      src/Chamilo/CoreBundle/Entity/GradebookLink.php
  42. 1
      src/Chamilo/CoreBundle/Entity/GradebookLinkevalLog.php
  43. 1
      src/Chamilo/CoreBundle/Entity/GradebookResult.php
  44. 1
      src/Chamilo/CoreBundle/Entity/GradebookResultLog.php
  45. 1
      src/Chamilo/CoreBundle/Entity/GradebookScoreDisplay.php
  46. 168
      src/Chamilo/CoreBundle/Entity/GradebookScoreLog.php
  47. 47
      src/Chamilo/CoreBundle/Entity/SessionRelUser.php
  48. 4
      src/Chamilo/CoreBundle/Entity/SettingsCurrent.php
  49. 23
      src/Chamilo/CoreBundle/Entity/SettingsOptions.php
  50. 29
      src/Chamilo/CourseBundle/Entity/CForumForum.php
  51. 44
      src/Chamilo/CourseBundle/Entity/CForumThread.php
  52. 9
      src/Chamilo/CourseBundle/Entity/CForumThreadQualifyLog.php

@ -30,7 +30,6 @@ abstract class AbstractMigrationChamilo extends AbstractMigration
*/ */
public function getEntityManager() public function getEntityManager()
{ {
if (empty($this->manager)) { if (empty($this->manager)) {
$dbParams = array( $dbParams = array(
'driver' => 'pdo_mysql', 'driver' => 'pdo_mysql',
@ -100,7 +99,7 @@ abstract class AbstractMigrationChamilo extends AbstractMigration
->setAccessUrlLocked($accessUrlLocked); ->setAccessUrlLocked($accessUrlLocked);
$this->getEntityManager()->persist($setting); $this->getEntityManager()->persist($setting);
$this->getEntityManager()->flush(); //$this->getEntityManager()->flush();
if (count($options) > 0) { if (count($options) > 0) {
foreach ($options as $option) { foreach ($options as $option) {
@ -111,14 +110,16 @@ abstract class AbstractMigrationChamilo extends AbstractMigration
$option['text'] = 'No'; $option['text'] = 'No';
} }
} }
$settingOption = new SettingsOptions(); $settingOption = new SettingsOptions();
$settingOption $settingOption
->setVariable($variable) ->setVariable($variable)
->setValue($option['value']) ->setValue($option['value'])
->setDisplayText($option['text']); ->setDisplayText($option['text']);
$this->getEntityManager()->persist($settingOption); $this->getEntityManager()->persist($settingOption);
$this->getEntityManager()->flush();
} }
} }
$this->getEntityManager()->flush();
} }
} }

@ -29,10 +29,10 @@ class Version110 extends AbstractMigrationChamilo
$this->addSql("CREATE TABLE IF NOT EXISTS hook_observer( id int UNSIGNED NOT NULL AUTO_INCREMENT, class_name varchar(255) UNIQUE, path varchar(255) NOT NULL, plugin_name varchar(255) NULL, PRIMARY KEY PK_hook_management_hook_observer(id))"); $this->addSql("CREATE TABLE IF NOT EXISTS hook_observer( id int UNSIGNED NOT NULL AUTO_INCREMENT, class_name varchar(255) UNIQUE, path varchar(255) NOT NULL, plugin_name varchar(255) NULL, PRIMARY KEY PK_hook_management_hook_observer(id))");
$this->addSql("CREATE TABLE IF NOT EXISTS hook_event( id int UNSIGNED NOT NULL AUTO_INCREMENT, class_name varchar(255) UNIQUE, description varchar(255), PRIMARY KEY PK_hook_management_hook_event(id))"); $this->addSql("CREATE TABLE IF NOT EXISTS hook_event( id int UNSIGNED NOT NULL AUTO_INCREMENT, class_name varchar(255) UNIQUE, description varchar(255), PRIMARY KEY PK_hook_management_hook_event(id))");
$this->addSql("CREATE TABLE IF NOT EXISTS hook_call( id int UNSIGNED NOT NULL AUTO_INCREMENT, hook_event_id int UNSIGNED NOT NULL, hook_observer_id int UNSIGNED NOT NULL, type tinyint NOT NULL, hook_order int UNSIGNED NOT NULL, enabled tinyint NOT NULL, PRIMARY KEY PK_hook_management_hook_call(id))"); $this->addSql("CREATE TABLE IF NOT EXISTS hook_call( id int UNSIGNED NOT NULL AUTO_INCREMENT, hook_event_id int UNSIGNED NOT NULL, hook_observer_id int UNSIGNED NOT NULL, type tinyint NOT NULL, hook_order int UNSIGNED NOT NULL, enabled tinyint NOT NULL, PRIMARY KEY PK_hook_management_hook_call(id))");
$this->addSql("CREATE TABLE IF NOT EXISTS c_student_publication_rel_document (id INT PRIMARY KEY NOT NULL AUTO_INCREMENT, work_id INT NOT NULL, document_id INT NOT NULL, c_id INT NOT NULL)"); $this->addSql("CREATE TABLE IF NOT EXISTS c_student_publication_rel_document (iid INT PRIMARY KEY NOT NULL AUTO_INCREMENT, id INT, work_id INT NOT NULL, document_id INT NOT NULL, c_id INT NOT NULL)");
$this->addSql("CREATE TABLE IF NOT EXISTS c_student_publication_rel_user (id INT PRIMARY KEY NOT NULL AUTO_INCREMENT, work_id INT NOT NULL, user_id INT NOT NULL, c_id INT NOT NULL)"); $this->addSql("CREATE TABLE IF NOT EXISTS c_student_publication_rel_user (iid INT PRIMARY KEY NOT NULL AUTO_INCREMENT, id INT, work_id INT NOT NULL, user_id INT NOT NULL, c_id INT NOT NULL)");
$this->addSql("CREATE TABLE IF NOT EXISTS c_student_publication_comment (id INT PRIMARY KEY NOT NULL AUTO_INCREMENT, work_id INT NOT NULL, c_id INT NOT NULL, comment text, file VARCHAR(255), user_id int NOT NULL, sent_at datetime NOT NULL)"); $this->addSql("CREATE TABLE IF NOT EXISTS c_student_publication_comment (iid INT PRIMARY KEY NOT NULL AUTO_INCREMENT, id INT, work_id INT NOT NULL, c_id INT NOT NULL, comment text, file VARCHAR(255), user_id int NOT NULL, sent_at datetime NOT NULL)");
$this->addSql("CREATE TABLE IF NOT EXISTS c_attendance_calendar_rel_group (id int NOT NULL auto_increment PRIMARY KEY, c_id INT NOT NULL, group_id INT NOT NULL, calendar_id INT NOT NULL)"); $this->addSql("CREATE TABLE IF NOT EXISTS c_attendance_calendar_rel_group (iid int NOT NULL auto_increment PRIMARY KEY, id INT, c_id INT NOT NULL, group_id INT NOT NULL, calendar_id INT NOT NULL)");
//$this->addSql("ALTER TABLE skill_rel_user ADD COLUMN course_id INT NOT NULL DEFAULT 0 AFTER id"); //$this->addSql("ALTER TABLE skill_rel_user ADD COLUMN course_id INT NOT NULL DEFAULT 0 AFTER id");
//$this->addSql("ALTER TABLE skill_rel_user ADD COLUMN session_id INT NOT NULL DEFAULT 0 AFTER course_id"); //$this->addSql("ALTER TABLE skill_rel_user ADD COLUMN session_id INT NOT NULL DEFAULT 0 AFTER course_id");
@ -178,7 +178,7 @@ class Version110 extends AbstractMigrationChamilo
//'c_role_user', //'c_role_user',
'c_student_publication', 'c_student_publication',
'c_student_publication_assignment', 'c_student_publication_assignment',
//'c_student_publication_comment', 'c_student_publication_comment',
'c_student_publication_rel_document', 'c_student_publication_rel_document',
'c_student_publication_rel_user', 'c_student_publication_rel_user',
//'c_survey', //'c_survey',
@ -201,20 +201,19 @@ class Version110 extends AbstractMigrationChamilo
]; ];
foreach ($tables as $table) { foreach ($tables as $table) {
$this->addSql("ALTER TABLE $table MODIFY COLUMN id int unsigned DEFAULT NULL"); if ($schema->hasTable($table)) {
$this->addSql("ALTER TABLE $table MODIFY COLUMN c_id int unsigned DEFAULT NULL"); $this->addSql("ALTER TABLE $table MODIFY COLUMN id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE $table DROP PRIMARY KEY"); $this->addSql("ALTER TABLE $table MODIFY COLUMN c_id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE $table ADD COLUMN iid int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT"); $this->addSql("ALTER TABLE $table DROP PRIMARY KEY");
$this->addSql("ALTER TABLE $table ADD COLUMN iid int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT");
}
} }
$this->addSql("ALTER TABLE c_attendance_calendar_rel_group MODIFY COLUMN id int unsigned DEFAULT NULL"); if ($schema->hasTable('c_attendance_calendar_rel_group')) {
$this->addSql("ALTER TABLE c_attendance_calendar_rel_group DROP PRIMARY KEY"); $this->addSql("ALTER TABLE c_attendance_calendar_rel_group MODIFY COLUMN id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE c_attendance_calendar_rel_group ADD COLUMN iid int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT"); $this->addSql("ALTER TABLE c_attendance_calendar_rel_group DROP PRIMARY KEY");
$this->addSql("ALTER TABLE c_attendance_calendar_rel_group ADD COLUMN iid int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT");
$this->addSql("ALTER TABLE c_student_publication_comment MODIFY COLUMN id int unsigned DEFAULT NULL"); }
$this->addSql("ALTER TABLE c_student_publication_comment DROP PRIMARY KEY");
$this->addSql("ALTER TABLE c_student_publication_comment ADD COLUMN iid int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT");
$this->addSql("ALTER TABLE c_attendance_sheet MODIFY COLUMN c_id int unsigned DEFAULT NULL"); $this->addSql("ALTER TABLE c_attendance_sheet MODIFY COLUMN c_id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE c_attendance_sheet DROP PRIMARY KEY"); $this->addSql("ALTER TABLE c_attendance_sheet DROP PRIMARY KEY");
@ -334,7 +333,7 @@ class Version110 extends AbstractMigrationChamilo
$this->addSql("ALTER TABLE c_quiz_answer MODIFY COLUMN c_id int unsigned DEFAULT NULL"); $this->addSql("ALTER TABLE c_quiz_answer MODIFY COLUMN c_id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE c_quiz_answer MODIFY COLUMN id_auto int unsigned DEFAULT NULL"); $this->addSql("ALTER TABLE c_quiz_answer MODIFY COLUMN id_auto int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE c_quiz_answer DROP PRIMARY KEY"); $this->addSql("ALTER TABLE c_quiz_answer DROP PRIMARY KEY");
$this->addSql("ALTER TABLE c_quiz_answer MODIFY COLUMN id_auto int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT"); $this->addSql("ALTER TABLE c_quiz_answer ADD COLUMN iid int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT");
$this->addSql("ALTER TABLE c_quiz_question_rel_category MODIFY COLUMN c_id int unsigned DEFAULT NULL"); $this->addSql("ALTER TABLE c_quiz_question_rel_category MODIFY COLUMN c_id int unsigned DEFAULT NULL");
$this->addSql("ALTER TABLE c_quiz_question_rel_category MODIFY COLUMN question_id int unsigned DEFAULT NULL"); $this->addSql("ALTER TABLE c_quiz_question_rel_category MODIFY COLUMN question_id int unsigned DEFAULT NULL");
@ -441,6 +440,11 @@ class Version110 extends AbstractMigrationChamilo
$this->addSql("UPDATE access_url_rel_course SET c_id = (SELECT id FROM course WHERE code = course_code)"); $this->addSql("UPDATE access_url_rel_course SET c_id = (SELECT id FROM course WHERE code = course_code)");
$this->addSql("ALTER TABLE settings_current DROP INDEX unique_setting");
$this->addSql("ALTER TABLE settings_options DROP INDEX unique_setting_option");
$this->addSql("DELETE FROM settings_current WHERE variable = 'wcag_anysurfer_public_pages'");
$this->addSql("DELETE FROM settings_current WHERE variable = 'wcag_anysurfer_public_pages'"); $this->addSql("DELETE FROM settings_current WHERE variable = 'wcag_anysurfer_public_pages'");
$this->addSql("DELETE FROM settings_options WHERE variable = 'wcag_anysurfer_public_pages'"); $this->addSql("DELETE FROM settings_options WHERE variable = 'wcag_anysurfer_public_pages'");
$this->addSql("DELETE FROM settings_current WHERE variable = 'advanced_filemanager'"); $this->addSql("DELETE FROM settings_current WHERE variable = 'advanced_filemanager'");
@ -460,10 +464,6 @@ class Version110 extends AbstractMigrationChamilo
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('enabled_mathjax', 'true', 'Yes')"); $this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('enabled_mathjax', 'true', 'Yes')");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('enabled_mathjax', 'false', 'No')"); $this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('enabled_mathjax', 'false', 'No')");
$this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('enabled_mathjax', NULL, 'radio', 'Editor', 'false', 'EnableMathJaxTitle', 'EnableMathJaxComment', NULL, NULL, 0)");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('enabled_mathjax', 'true', 'Yes')");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('enabled_mathjax', 'false', 'No')");
$this->addSql("INSERT INTO language (original_name, english_name, isocode, dokeos_folder, available) VALUES ('Føroyskt', 'faroese', 'fo', 'faroese', 0), ('Tagalog', 'tagalog', 'tl', 'tagalog',1), ('Tibetan', 'tibetan', 'bo', 'tibetan', 0), ('isiXhosa', 'xhosa', 'xh', 'xhosa', 0)"); $this->addSql("INSERT INTO language (original_name, english_name, isocode, dokeos_folder, available) VALUES ('Føroyskt', 'faroese', 'fo', 'faroese', 0), ('Tagalog', 'tagalog', 'tl', 'tagalog',1), ('Tibetan', 'tibetan', 'bo', 'tibetan', 0), ('isiXhosa', 'xhosa', 'xh', 'xhosa', 0)");
$this->addSql("DELETE FROM settings_options WHERE variable = 'show_glossary_in_extra_tools'"); $this->addSql("DELETE FROM settings_options WHERE variable = 'show_glossary_in_extra_tools'");

@ -3,11 +3,7 @@
namespace Application\Migrations\Schema\V110; namespace Application\Migrations\Schema\V110;
use Chamilo\CoreBundle\Entity\ExtraField;
use Chamilo\CoreBundle\Entity\ExtraFieldOptions;
use Chamilo\CoreBundle\Entity\ExtraFieldValues;
use Application\Migrations\AbstractMigrationChamilo; use Application\Migrations\AbstractMigrationChamilo;
use Database;
use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\Schema;
/** /**
@ -49,109 +45,7 @@ class Version20150505132304 extends AbstractMigrationChamilo
*/ */
public function postUp(Schema $schema) public function postUp(Schema $schema)
{ {
// Extra fields
$extraFieldTables = [
ExtraField::USER_FIELD_TYPE => Database::get_main_table(TABLE_MAIN_USER_FIELD),
ExtraField::COURSE_FIELD_TYPE => Database::get_main_table(TABLE_MAIN_COURSE_FIELD),
//ExtraField::LP_FIELD_TYPE => Database::get_main_table(TABLE_MAIN_LP_FIELD),
ExtraField::SESSION_FIELD_TYPE => Database::get_main_table(TABLE_MAIN_SESSION_FIELD),
//ExtraField::CALENDAR_FIELD_TYPE => Database::get_main_table(TABLE_MAIN_CALENDAR_EVENT_FIELD),
//ExtraField::QUESTION_FIELD_TYPE => Database::get_main_table(TABLE_MAIN_CALENDAR_EVENT_FIELD),
//ExtraField::USER_FIELD_TYPE => //Database::get_main_table(TABLE_MAIN_SPECIFIC_FIELD),
];
$em = $this->getEntityManager();
$connection = $em->getConnection();
foreach ($extraFieldTables as $type => $table) {
//continue;
$sql = "SELECT * FROM $table ";
$result = $connection->query($sql);
$fields = $result->fetchAll();
foreach ($fields as $field) {
$originalId = $field['id'];
$extraField = new ExtraField();
$extraField
->setExtraFieldType($type)
->setVariable($field['field_variable'])
->setFieldType($field['field_type'])
->setDisplayText($field['field_display_text'])
->setDefaultValue($field['field_default_value'])
->setFieldOrder($field['field_order'])
->setVisible($field['field_visible'])
->setChangeable($field['field_changeable'])
->setFilter($field['field_filter']);
$em->persist($extraField);
$em->flush();
$values = array();
switch ($type) {
case ExtraField::USER_FIELD_TYPE:
$optionTable = Database::get_main_table(
TABLE_MAIN_USER_FIELD_OPTIONS
);
$valueTable = Database::get_main_table(
TABLE_MAIN_USER_FIELD_VALUES
);
$handlerId = 'user_id';
break;
case ExtraField::COURSE_FIELD_TYPE:
$optionTable = Database::get_main_table(
TABLE_MAIN_COURSE_FIELD_OPTIONS
);
$valueTable = Database::get_main_table(
TABLE_MAIN_COURSE_FIELD_VALUES
);
$handlerId = 'c_id';
break;
case ExtraField::SESSION_FIELD_TYPE:
$optionTable = Database::get_main_table(
TABLE_MAIN_SESSION_FIELD_OPTIONS
);
$valueTable = Database::get_main_table(
TABLE_MAIN_SESSION_FIELD_VALUES
);
$handlerId = 'session_id';
break;
}
if (!empty($optionTable)) {
$sql = "SELECT * FROM $optionTable WHERE field_id = $originalId ";
$result = $connection->query($sql);
$options = $result->fetchAll();
foreach ($options as $option) {
$extraFieldOption = new ExtraFieldOptions();
$extraFieldOption
->setDisplayText($option['option_display_text'])
->setField($extraField)
->setOptionOrder($option['option_order'])
->setValue($option['option_value']);
$em->persist($extraFieldOption);
$em->flush();
}
$sql = "SELECT * FROM $valueTable WHERE field_id = $originalId ";
$result = $connection->query($sql);
$values = $result->fetchAll();
}
if (!empty($values)) {
foreach ($values as $value) {
$extraFieldValue = new ExtraFieldValues();
$extraFieldValue
->setValue($value['field_value'])
->setField($extraField)
->setItemId($value[$handlerId]);
$em->persist($extraFieldValue);
$em->flush();
}
}
}
}
} }
/** /**

@ -28,12 +28,13 @@ class Version20150507152600 extends AbstractMigrationChamilo
// Setting $_configuration['hide_home_top_when_connected'] = true; // Setting $_configuration['hide_home_top_when_connected'] = true;
$value = api_get_configuration_value('hide_home_top_when_connected'); $value = api_get_configuration_value('hide_home_top_when_connected');
$this->addSettingCurrent( $this->addSettingCurrent(
'hide_home_top_when_connected', 'hide_home_top_when_connected',
'', '',
'radio', 'radio',
'Platform', 'Platform',
($value?'true':'false'), ($value ? 'true' : 'false'),
'HideHomeTopContentWhenLoggedInText', 'HideHomeTopContentWhenLoggedInText',
'HideHomeTopContentWhenLoggedInComment', 'HideHomeTopContentWhenLoggedInComment',
null, null,
@ -41,7 +42,10 @@ class Version20150507152600 extends AbstractMigrationChamilo
1, 1,
true, true,
false, false,
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']] [
0 => ['value' => 'true', 'text' => 'Yes'],
1 => ['value' => 'false', 'text' => 'No'],
]
); );
// Hide the global announcements for non-connected users // Hide the global announcements for non-connected users
@ -60,7 +64,10 @@ class Version20150507152600 extends AbstractMigrationChamilo
1, 1,
true, true,
false, false,
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']] [
0 => ['value' => 'true', 'text' => 'Yes'],
1 => ['value' => 'false', 'text' => 'No'],
]
); );
// Use this course as template for all new courses (define course real ID as value) // Use this course as template for all new courses (define course real ID as value)
@ -79,7 +86,10 @@ class Version20150507152600 extends AbstractMigrationChamilo
1, 1,
true, true,
false, false,
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']] [
0 => ['value' => 'true', 'text' => 'Yes'],
1 => ['value' => 'false', 'text' => 'No'],
]
); );
// Add password strength checker // Add password strength checker
@ -98,7 +108,10 @@ class Version20150507152600 extends AbstractMigrationChamilo
1, 1,
true, true,
false, false,
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']] [
0 => ['value' => 'true', 'text' => 'Yes'],
1 => ['value' => 'false', 'text' => 'No'],
]
); );
// Enable captcha // Enable captcha

@ -18,7 +18,7 @@ class Version20150511133949 extends AbstractMigrationChamilo
{ {
$this->addSql('ALTER TABLE user ADD salt VARCHAR(255) NOT NULL'); $this->addSql('ALTER TABLE user ADD salt VARCHAR(255) NOT NULL');
$this->addSql('ALTER TABLE user ADD username_canonical VARCHAR(100) NOT NULL'); $this->addSql('ALTER TABLE user ADD username_canonical VARCHAR(100) NOT NULL');
$this->addSql('CREATE UNIQUE INDEX UNIQ_8D93D64992FC23A8 ON user (username_canonical)'); //$this->addSql('CREATE UNIQUE INDEX UNIQ_8D93D64992FC23A8 ON user (username_canonical)');
$this->addSql('ALTER TABLE user CHANGE password password VARCHAR(255) NOT NULL'); $this->addSql('ALTER TABLE user CHANGE password password VARCHAR(255) NOT NULL');
$this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('allow_teachers_to_create_sessions', NULL,'radio','Session','false','AllowTeachersToCreateSessionsTitle','AllowTeachersToCreateSessionsComment', NULL, NULL, 0)"); $this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('allow_teachers_to_create_sessions', NULL,'radio','Session','false','AllowTeachersToCreateSessionsTitle','AllowTeachersToCreateSessionsComment', NULL, NULL, 0)");

@ -0,0 +1,29 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Username changes
*/
class Version20150519153200 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->addSql('ALTER TABLE session_rel_user ADD COLUMN registered_at DATETIME NOT NULL');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql('ALTER TABLE session_rel_user DROP COLUMN registered_at');
}
}

@ -18,10 +18,6 @@ class Version20150521113600 extends AbstractMigrationChamilo
{ {
$this->addSql('ALTER TABLE c_forum_thread MODIFY thread_replies int UNSIGNED NOT NULL DEFAULT 0'); $this->addSql('ALTER TABLE c_forum_thread MODIFY thread_replies int UNSIGNED NOT NULL DEFAULT 0');
$this->addSql('ALTER TABLE c_forum_thread MODIFY thread_views int UNSIGNED NOT NULL DEFAULT 0'); $this->addSql('ALTER TABLE c_forum_thread MODIFY thread_views int UNSIGNED NOT NULL DEFAULT 0');
$this->addSql("
UPDATE settings_current SET selected_value = '1.10.0.40' WHERE variable = 'chamilo_database_version'
");
} }
/** /**
@ -31,10 +27,5 @@ class Version20150521113600 extends AbstractMigrationChamilo
{ {
$this->addSql('ALTER TABLE c_forum_thread MODIFY thread_replies int NULL'); $this->addSql('ALTER TABLE c_forum_thread MODIFY thread_replies int NULL');
$this->addSql('ALTER TABLE c_forum_thread MODIFY thread_views int NULL'); $this->addSql('ALTER TABLE c_forum_thread MODIFY thread_views int NULL');
$this->addSql("
UPDATE settings_current SET selected_value = '1.10.0.39' WHERE variable = 'chamilo_database_version'
");
} }
} }

@ -22,6 +22,7 @@ class Version20150522112023 extends AbstractMigrationChamilo
$this->addSql('ALTER TABLE usergroup ADD group_type INT NOT NULL, ADD created_at DATETIME NOT NULL, ADD updated_at DATETIME NOT NULL'); $this->addSql('ALTER TABLE usergroup ADD group_type INT NOT NULL, ADD created_at DATETIME NOT NULL, ADD updated_at DATETIME NOT NULL');
$this->addSql('ALTER TABLE usergroup ADD picture VARCHAR(255) DEFAULT NULL, ADD url VARCHAR(255) DEFAULT NULL, ADD visibility VARCHAR(255) NOT NULL, ADD allow_members_leave_group INT NOT NULL, CHANGE description description LONGTEXT DEFAULT NULL'); $this->addSql('ALTER TABLE usergroup ADD picture VARCHAR(255) DEFAULT NULL, ADD url VARCHAR(255) DEFAULT NULL, ADD visibility VARCHAR(255) NOT NULL, ADD allow_members_leave_group INT NOT NULL, CHANGE description description LONGTEXT DEFAULT NULL');
$this->addSql('CREATE TABLE usergroup_rel_usergroup (id INT AUTO_INCREMENT NOT NULL, group_id INT NOT NULL, subgroup_id INT NOT NULL, relation_type INT NOT NULL, PRIMARY KEY(id));'); $this->addSql('CREATE TABLE usergroup_rel_usergroup (id INT AUTO_INCREMENT NOT NULL, group_id INT NOT NULL, subgroup_id INT NOT NULL, relation_type INT NOT NULL, PRIMARY KEY(id));');
$this->addSql('ALTER TABLE usergroup_rel_user ADD relation_type INT');
if (!$schema->hasTable('access_url_rel_usergroup')) { if (!$schema->hasTable('access_url_rel_usergroup')) {
$this->addSql( $this->addSql(

@ -52,5 +52,4 @@ class Version20150527101600 extends AbstractMigrationChamilo
$this->addSql("DELETE FROM settings_options WHERE variable = 'gamification_mode'"); $this->addSql("DELETE FROM settings_options WHERE variable = 'gamification_mode'");
$this->addSql("DELETE FROM settings_current WHERE variable = 'gamification_mode'"); $this->addSql("DELETE FROM settings_current WHERE variable = 'gamification_mode'");
} }
} }

@ -0,0 +1,65 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Type as TableColumnType;
/**
* Session date changes
*/
class Version20150529164400 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$gradebookScoreLog = $schema->createTable('gradebook_score_log');
$gradebookScoreLog->addColumn(
'id',
TableColumnType::INTEGER,
['unsigned' => true, 'autoincrement' => true, 'notnull' => true]
);
$gradebookScoreLog->addColumn(
'category_id',
TableColumnType::INTEGER,
['unsigned' => true, 'notnull' => true]
);
$gradebookScoreLog->addColumn(
'user_id',
TableColumnType::INTEGER,
['unsigned' => true, 'notnull' => true]
);
$gradebookScoreLog->addColumn(
'score',
TableColumnType::FLOAT,
['notnull' => true, 'scale' => 0, 'precision' => 10]
);
$gradebookScoreLog->addColumn(
'registered_at',
TableColumnType::DATETIME,
['notnull' => true]
);
$gradebookScoreLog->setPrimaryKey(['id']);
$gradebookScoreLog->addIndex(
['user_id'],
'idx_gradebook_score_log_user'
);
$gradebookScoreLog->addIndex(
['user_id', 'category_id'],
'idx_gradebook_score_log_user_category'
);
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$schema->dropTable('gradebook_score_log');
}
}

@ -0,0 +1,32 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V110;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Session date changes
*/
class Version20150603151200 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->addSql('ALTER TABLE c_forum_forum ADD lp_id INTEGER UNSIGNED NOT NULL');
$this->addSql('ALTER TABLE c_forum_thread ADD lp_item_id INTEGER UNSIGNED NOT NULL');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql('ALTER TABLE c_forum_forum DROP lp_id');
$this->addSql('ALTER TABLE c_forum_thread DROP lp_item_id');
}
}

@ -17,9 +17,6 @@ class Version20150603181728 extends AbstractMigrationChamilo
public function up(Schema $schema) public function up(Schema $schema)
{ {
$this->addSql('ALTER TABLE c_lp ADD max_attempts INT NOT NULL, ADD subscribe_users INT NOT NULL DEFAULT 0'); $this->addSql('ALTER TABLE c_lp ADD max_attempts INT NOT NULL, ADD subscribe_users INT NOT NULL DEFAULT 0');
$this->addSql('DELETE FROM c_item_property TABLE c_lp ADD max_attempts INT NOT NULL, ADD subscribe_users INT NOT NULL DEFAULT 0');
$this->addSql('ALTER TABLE c_item_property CHANGE c_id c_id INT DEFAULT NULL, CHANGE insert_user_id insert_user_id INT DEFAULT NULL, CHANGE start_visible start_visible DATETIME DEFAULT NULL, CHANGE end_visible end_visible DATETIME DEFAULT NULL, CHANGE session_id session_id INT DEFAULT NULL'); $this->addSql('ALTER TABLE c_item_property CHANGE c_id c_id INT DEFAULT NULL, CHANGE insert_user_id insert_user_id INT DEFAULT NULL, CHANGE start_visible start_visible DATETIME DEFAULT NULL, CHANGE end_visible end_visible DATETIME DEFAULT NULL, CHANGE session_id session_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE c_item_property ADD CONSTRAINT FK_1D84C18191D79BD3 FOREIGN KEY (c_id) REFERENCES course (id)'); $this->addSql('ALTER TABLE c_item_property ADD CONSTRAINT FK_1D84C18191D79BD3 FOREIGN KEY (c_id) REFERENCES course (id)');
$this->addSql('ALTER TABLE c_item_property ADD CONSTRAINT FK_1D84C181330D47E9 FOREIGN KEY (to_group_id) REFERENCES c_group_info (iid)'); $this->addSql('ALTER TABLE c_item_property ADD CONSTRAINT FK_1D84C181330D47E9 FOREIGN KEY (to_group_id) REFERENCES c_group_info (iid)');

@ -18,9 +18,15 @@ class Version20150713132630 extends AbstractMigrationChamilo
*/ */
public function up(Schema $schema) public function up(Schema $schema)
{ {
$this->addSql('ALTER TABLE c_student_publication ADD url_correction VARCHAR(255) DEFAULT NULL'); if ($schema->hasTable('c_student_publication')) {
$this->addSql('ALTER TABLE c_student_publication ADD title_correction VARCHAR(255) DEFAULT NULL'); $this->addSql('ALTER TABLE c_student_publication ADD url_correction VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE c_student_publication ADD document_id INT NOT NULL'); $this->addSql('ALTER TABLE c_student_publication ADD title_correction VARCHAR(255) DEFAULT NULL');
if (!$schema->getTable('c_student_publication')->hasColumn('document_id')) {
$this->addSql(
'ALTER TABLE c_student_publication ADD document_id INT NOT NULL'
);
}
}
} }
/** /**

@ -10,7 +10,8 @@
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"Chamilo\\": "src/Chamilo/" "Chamilo\\": "src/Chamilo/",
"Application\\": "app/"
}, },
"classmap": [ "classmap": [
"main/auth", "main/auth",

@ -162,13 +162,17 @@ elseif (!empty($annee) && !empty($id_session) && ($_POST['confirmed']=='yes'))
$tbl_session_user = Database::get_main_table(TABLE_MAIN_SESSION_USER); $tbl_session_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
foreach ($UserList as $user_id) { foreach ($UserList as $user_id) {
$sql = 'INSERT INTO '.$tbl_session_user.' SET $res_user = Database::insert(
user_id ="'.intval($user_id).'", $tbl_session_user,
session_id = "'.intval($id_session).'"'; [
$res_user = Database::query($sql); 'session_id' => intval($id_session),
if ($res_user) { 'user_id' => intval($user_id),
$num++; 'registered_at' => api_get_utc_datetime()
} ]
);
if ($res_user !== false) {
$num++;
}
} }
if($num>0) { if($num>0) {

@ -149,8 +149,8 @@ foreach($Sessions as $session){
} }
// On ajoute la relation entre l'utilisateur et la session // On ajoute la relation entre l'utilisateur et la session
foreach($UserList as $enreg_user){ foreach($UserList as $enreg_user){
$sql = "INSERT IGNORE INTO $tbl_session_rel_user(session_id, user_id) " . $sql = "INSERT IGNORE INTO $tbl_session_rel_user(session_id, user_id, registered_at) " .
"VALUES('$id_session','$enreg_user')"; "VALUES('$id_session','$enreg_user', '" . api_get_utc_datetime() . "')";
Database::query($sql); Database::query($sql);
} }
$sql = "SELECT COUNT(user_id) as nbUsers " . $sql = "SELECT COUNT(user_id) as nbUsers " .

@ -0,0 +1,5 @@
<?php
/*
* File needed to overwrite file in 1.9.x
*/

@ -581,8 +581,8 @@ function ldap_add_user_to_session($UserList, $id_session) {
foreach ($UserList as $enreg_user) { foreach ($UserList as $enreg_user) {
$enreg_user = (int) $enreg_user; $enreg_user = (int) $enreg_user;
Database::query("INSERT IGNORE INTO $tbl_session_rel_user ". Database::query("INSERT IGNORE INTO $tbl_session_rel_user ".
" (session_id, user_id) " . " (session_id, user_id, registered_at) " .
" VALUES('$id_session','$enreg_user')"); " VALUES('$id_session','$enreg_user', '" . api_get_utc_datetime() . "')");
} }
// We update the number of users in the session // We update the number of users in the session
$sql = "SELECT COUNT(user_id) as nbUsers FROM $tbl_session_rel_user ". $sql = "SELECT COUNT(user_id) as nbUsers FROM $tbl_session_rel_user ".

@ -34,11 +34,15 @@ $sessionList = [];
foreach ($sessionCourseSubscriptions as $subscription) { foreach ($sessionCourseSubscriptions as $subscription) {
$session = $subscription->getSession(); $session = $subscription->getSession();
if (array_key_exists($session->getId(), $sessionList)) {
continue;
}
if ($currentSession && $currentSession->getId() === $session->getId()) { if ($currentSession && $currentSession->getId() === $session->getId()) {
$allowAccess = true; $allowAccess = true;
} }
$sessionList[] = $session; $sessionList[$session->getId()] = $session;
} }
if ($currentSession && !$allowAccess) { if ($currentSession && !$allowAccess) {
@ -53,15 +57,15 @@ $template->assign(
); );
$template->assign( $template->assign(
'gamification_stars', 'gamification_stars',
GamificationUtils::getTotalUserStars($user->getId(), $user->getStatus()) GamificationUtils::getTotalUserStars($user->getId(), $user->getStatus())
); );
$template->assign( $template->assign(
'gamification_points', 'gamification_points',
GamificationUtils::getTotalUserPoints($user->getId(), $user->getStatus()) GamificationUtils::getTotalUserPoints($user->getId(), $user->getStatus())
); );
$template->assign( $template->assign(
'gamification_progress', 'gamification_progress',
GamificationUtils::getTotalUserProgress($user->getId(), $user->getStatus()) GamificationUtils::getTotalUserProgress($user->getId(), $user->getStatus())
); );
$template->assign('sessions', $sessionList); $template->assign('sessions', $sessionList);
$template->assign('current_session', $currentSession); $template->assign('current_session', $currentSession);

@ -777,6 +777,9 @@ if ($category != '0') {
['class' => 'btn btn-default'] ['class' => 'btn btn-default']
); );
} }
$currentScore = Category::getCurrentScore($stud_id, $category_id, $course_code, $session_id, true);
Category::registerCurrentScore($currentScore, $stud_id, $category_id);
} }
} }
} }

@ -2009,14 +2009,98 @@ class Category implements GradebookItem
* @param \Category $category The gradebook category * @param \Category $category The gradebook category
* @return boolean * @return boolean
*/ */
public static function userFinishedCourse($userId, \Category $category) public static function userFinishedCourse($userId, \Category $category = null, $categoryId = 0)
{ {
if (is_null($category) && empty($categoryId)) {
return false;
}
$courseCode = api_get_course_id();
$sessionId = api_get_session_id();
if (is_null($category) && !empty($categoryId)) {
$cats_course = Category::load(
$categoryId,
null,
$courseCode,
null,
null,
$sessionId,
false
);
$category = $cats_course[0];
}
$currentScore = self::getCurrentScore($userId, $category->get_id(), $courseCode, $sessionId, true);
$minCertificateScore = $category->get_certificate_min_score();
return !empty($minCertificateScore) && $currentScore >= $minCertificateScore;
}
/**
* Get the current score (as percentage) on a gradebook category for a user
* @param int $userId The user id
* @param int $categoryId The gradebook category
* @param int $courseCode The course code
* @param int $sessionId Optional. The session id
* @return float The score
*/
public static function getCurrentScore($userId, $categoryId, $courseCode, $sessionId = 0, $recalculate = false)
{
if ($recalculate) {
return self::calculateCurrentScore($userId, $categoryId, $courseCode, $sessionId);
}
$resultData = Database::select(
'*',
Database::get_main_table(TABLE_MAIN_GRADEBOOK_SCORE_LOG),
[
'where' => [
'category_id = ? AND user_id = ?' => [$categoryId, $userId],
],
'order' => 'registered_at DESC',
'limit' => '1'
],
'fisrt'
);
if (empty($resultData)) {
return 0;
}
return $resultData['score'];
}
/**
* Calculate the current score on a gradebook category for a user
* @param int $userId The user id
* @param int $categoryId The gradebook category
* @param int $courseCode The course code
* @param int $sessionId Optional. The session id
* @return float The score
*/
private static function calculateCurrentScore($userId, $categoryId, $courseCode, $sessionId)
{
$cats_course = Category::load(
$categoryId,
null,
$courseCode,
null,
null,
$sessionId,
false
);
$category = $cats_course[0];
$courseEvaluations = $category->get_evaluations($userId, true); $courseEvaluations = $category->get_evaluations($userId, true);
$courseLinks = $category->get_links($userId, true); $courseLinks = $category->get_links($userId, true);
$evaluationsAndLinks = array_merge($courseEvaluations, $courseLinks); $evaluationsAndLinks = array_merge($courseEvaluations, $courseLinks);
$totalItemValue = 0; $categoryScore = 0;
for ($i = 0; $i < count($evaluationsAndLinks); $i++) { for ($i = 0; $i < count($evaluationsAndLinks); $i++) {
$item = $evaluationsAndLinks[$i]; $item = $evaluationsAndLinks[$i];
@ -2028,14 +2112,30 @@ class Category implements GradebookItem
$itemValue = $score[0] / $divider * $item->get_weight(); $itemValue = $score[0] / $divider * $item->get_weight();
} }
$totalItemValue += $itemValue; $categoryScore += $itemValue;
} }
$totalItemValue = floatval($totalItemValue); return floatval($categoryScore);
}
$minCertificateScore = $category->get_certificate_min_score();
return !empty($minCertificateScore) && $totalItemValue >= $minCertificateScore; /**
* Register the current score for a user on a category gradebook
* @param float $score The achieved score
* @param int $userId The user id
* @param int $categoryId The gradebook category
* @return int The insert id
*/
public static function registerCurrentScore($score, $userId, $categoryId)
{
return Database::insert(
Database::get_main_table(TABLE_MAIN_GRADEBOOK_SCORE_LOG),
[
'category_id' => intval($categoryId),
'user_id' => intval($userId),
'score' => floatval($score),
'registered_at' => api_get_utc_datetime()
]
);
} }
} }

@ -13,7 +13,7 @@ class GamificationUtils
* Get the calculated points on session with gamification mode * Get the calculated points on session with gamification mode
* @param int $userId The user ID * @param int $userId The user ID
* @param int $userStatus The user Status * @param int $userStatus The user Status
* @return int * @return float
*/ */
public static function getTotalUserPoints($userId, $userStatus) public static function getTotalUserPoints($userId, $userStatus)
{ {
@ -32,7 +32,7 @@ class GamificationUtils
$points += self::getSessionPoints($session['id'], $userId); $points += self::getSessionPoints($session['id'], $userId);
} }
return $points; return round($points / count($sessions), 2);
} }
/** /**
@ -58,6 +58,10 @@ class GamificationUtils
); );
$learnPaths = $learnPathListObject->get_flat_list(); $learnPaths = $learnPathListObject->get_flat_list();
if (empty($learnPaths)) {
continue;
}
$score = 0; $score = 0;
foreach ($learnPaths as $learnPathId => $learnPathInfo) { foreach ($learnPaths as $learnPathId => $learnPathInfo) {
@ -74,10 +78,10 @@ class GamificationUtils
$score += $learnPath->getCalculateScore($sessionId); $score += $learnPath->getCalculateScore($sessionId);
} }
$totalPoints += $score; $totalPoints += round($score / count($learnPaths), 2);
} }
return $totalPoints / count($courses); return round($totalPoints / count($courses), 2);
} }
/** /**
@ -112,7 +116,7 @@ class GamificationUtils
$progress += $courseProgress; $progress += $courseProgress;
} }
return $progress / count($courses); return round($progress / count($courses), 2);
} }
/** /**
@ -138,6 +142,10 @@ class GamificationUtils
); );
$learnPaths = $learnPathListObject->get_flat_list(); $learnPaths = $learnPathListObject->get_flat_list();
if (empty($learnPaths)) {
continue;
}
$stars = 0; $stars = 0;
foreach ($learnPaths as $learnPathId => $learnPathInfo) { foreach ($learnPaths as $learnPathId => $learnPathInfo) {
@ -154,10 +162,10 @@ class GamificationUtils
$stars += $learnPath->getCalculateStars($sessionId); $stars += $learnPath->getCalculateStars($sessionId);
} }
$totalStars += $stars; $totalStars += round($stars / count($learnPaths));
} }
return $totalStars / count($courses); return round($totalStars / count($courses));
} }
/** /**
@ -183,14 +191,14 @@ class GamificationUtils
$stars += self::getSessionStars($session['id'], $userId); $stars += self::getSessionStars($session['id'], $userId);
} }
return $stars; return round($stars / count($sessions));
} }
/** /**
* Get the total progress on sessions with gamification mode * Get the total progress on sessions with gamification mode
* @param int $userId The user ID * @param int $userId The user ID
* @param int $userStatus The user Status * @param int $userStatus The user Status
* @return int * @return float
*/ */
public static function getTotalUserProgress($userId, $userStatus) public static function getTotalUserProgress($userId, $userStatus)
{ {
@ -209,7 +217,7 @@ class GamificationUtils
$progress += self::getSessionProgress($session['id'], $userId); $progress += self::getSessionProgress($session['id'], $userId);
} }
return $progress; return round($progress / count($sessions), 2);
} }
} }

@ -56,6 +56,7 @@ define('TABLE_MAIN_GRADEBOOK_RESULT_LOG', 'gradebook_result_log');
define('TABLE_MAIN_GRADEBOOK_LINK', 'gradebook_link'); define('TABLE_MAIN_GRADEBOOK_LINK', 'gradebook_link');
define('TABLE_MAIN_GRADEBOOK_SCORE_DISPLAY', 'gradebook_score_display'); define('TABLE_MAIN_GRADEBOOK_SCORE_DISPLAY', 'gradebook_score_display');
define('TABLE_MAIN_GRADEBOOK_CERTIFICATE', 'gradebook_certificate'); define('TABLE_MAIN_GRADEBOOK_CERTIFICATE', 'gradebook_certificate');
define('TABLE_MAIN_GRADEBOOK_SCORE_LOG', 'gradebook_score_log');
// Profiling // Profiling
@ -80,8 +81,10 @@ define('TABLE_MAIN_TAG', 'tag');
define('TABLE_MAIN_USER_REL_TAG', 'user_rel_tag'); define('TABLE_MAIN_USER_REL_TAG', 'user_rel_tag');
define('TABLE_MAIN_EXTRA_FIELD_REL_TAG', 'extra_field_rel_tag'); define('TABLE_MAIN_EXTRA_FIELD_REL_TAG', 'extra_field_rel_tag');
define('TABLE_MAIN_GROUP', 'groups');
//User groups //User groups
/*define('TABLE_MAIN_GROUP', 'groups'); /*
define('TABLE_MAIN_USER_REL_GROUP', 'group_rel_user'); define('TABLE_MAIN_USER_REL_GROUP', 'group_rel_user');
define('TABLE_MAIN_GROUP_REL_TAG', 'group_rel_tag'); define('TABLE_MAIN_GROUP_REL_TAG', 'group_rel_tag');
define('TABLE_MAIN_GROUP_REL_GROUP', 'group_rel_group');*/ define('TABLE_MAIN_GROUP_REL_GROUP', 'group_rel_group');*/

@ -2569,8 +2569,8 @@ class MySpace
$new_users = array(); $new_users = array();
foreach ($users as $index => $user) { foreach ($users as $index => $user) {
$userid = $user['id']; $userid = $user['id'];
$sql_insert = "INSERT IGNORE INTO $tbl_session_rel_user(session_id, user_id) $sql_insert = "INSERT IGNORE INTO $tbl_session_rel_user(session_id, user_id, registered_at)
VALUES ('$id_session','$userid')"; VALUES ('$id_session','$userid', '" . api_get_utc_datetime() . "')";
Database::query($sql_insert); Database::query($sql_insert);
$user['added_at_session'] = 1; $user['added_at_session'] = 1;
$new_users[] = $user; $new_users[] = $user;

@ -1688,8 +1688,8 @@ class SessionManager
foreach ($user_list as $enreg_user) { foreach ($user_list as $enreg_user) {
$enreg_user = Database::escape_string($enreg_user); $enreg_user = Database::escape_string($enreg_user);
$nbr_users++; $nbr_users++;
$sql = "INSERT IGNORE INTO $tbl_session_rel_user (relation_type, session_id, user_id) $sql = "INSERT IGNORE INTO $tbl_session_rel_user (relation_type, session_id, user_id, registered_at)
VALUES (0, $id_session, $enreg_user)"; VALUES (0, $id_session, $enreg_user, '" . api_get_utc_datetime() . "')";
Database::query($sql); Database::query($sql);
} }
@ -1913,8 +1913,8 @@ class SessionManager
if (empty($count)) { if (empty($count)) {
// If user is not registered to a session then add it. // If user is not registered to a session then add it.
$sql = "INSERT IGNORE INTO $tbl_session_rel_user (session_id, user_id) $sql = "INSERT IGNORE INTO $tbl_session_rel_user (session_id, user_id, registered_at)
VALUES ($session_id, $enreg_user)"; VALUES ($session_id, $enreg_user, '" . api_get_utc_datetime() . "')";
Database::query($sql); Database::query($sql);
$sql = "UPDATE $tbl_session SET nbr_users = nbr_users + 1 $sql = "UPDATE $tbl_session SET nbr_users = nbr_users + 1
@ -2817,8 +2817,13 @@ class SessionManager
foreach ($sessions_list as $session_id) { foreach ($sessions_list as $session_id) {
$session_id = intval($session_id); $session_id = intval($session_id);
$sql = "INSERT IGNORE INTO $tbl_session_rel_user (session_id, user_id, relation_type) $sql = "INSERT IGNORE INTO $tbl_session_rel_user (session_id, user_id, relation_type, registered_at)
VALUES ($session_id, $userId, '" . SESSION_RELATION_TYPE_RRHH . "')"; VALUES (
$session_id,
$userId,
'" . SESSION_RELATION_TYPE_RRHH . "',
'" . api_get_utc_datetime() . "'
)";
Database::query($sql); Database::query($sql);
$affected_rows++; $affected_rows++;
} }
@ -4241,7 +4246,8 @@ class SessionManager
// Insert new users. // Insert new users.
$sql = "INSERT IGNORE INTO $tbl_session_user SET $sql = "INSERT IGNORE INTO $tbl_session_user SET
user_id = '$user_id', user_id = '$user_id',
session_id = '$session_id'"; session_id = '$session_id',
registered_at = '" . api_get_utc_datetime() . "'";
Database::query($sql); Database::query($sql);
if ($debug) { if ($debug) {
$logger->addInfo("Sessions - Adding User #$user_id ($user) to session #$session_id"); $logger->addInfo("Sessions - Adding User #$user_id ($user) to session #$session_id");

@ -316,8 +316,16 @@ if (!empty($_SESSION['_user']['user_id']) && !($login || $logout)) {
if ($uData['auth_source'] == PLATFORM_AUTH_SOURCE || if ($uData['auth_source'] == PLATFORM_AUTH_SOURCE ||
$uData['auth_source'] == CAS_AUTH_SOURCE $uData['auth_source'] == CAS_AUTH_SOURCE
) { ) {
$validPassword = false;
$user = $userManager->findUserByUsername($login); $user = $userManager->findUserByUsername($login);
$validPassword = UserManager::isPasswordValid($password, $user);
if ($user) {
$validPassword = UserManager::isPasswordValid(
$password,
$user
);
}
// The authentication of this user is managed by Chamilo itself // The authentication of this user is managed by Chamilo itself
//$password = api_get_encrypted_password(trim(stripslashes($password))); //$password = api_get_encrypted_password(trim(stripslashes($password)));

@ -513,6 +513,7 @@ CREATE TABLE IF NOT EXISTS session_rel_user (
id_user mediumint unsigned NOT NULL default '0', id_user mediumint unsigned NOT NULL default '0',
relation_type int default 0, relation_type int default 0,
duration int, duration int,
registered_at DATETIME not null,
PRIMARY KEY (id_session, id_user, relation_type) PRIMARY KEY (id_session, id_user, relation_type)
); );

@ -681,7 +681,7 @@ if (@$_POST['step2']) {
$manager $manager
); );
fixIds($manager->getConnection()); fixIds($manager);
include 'update-files-1.9.0-1.10.0.inc.php'; include 'update-files-1.9.0-1.10.0.inc.php';
// Only updates the configuration.inc.php with the new version // Only updates the configuration.inc.php with the new version

@ -11,7 +11,9 @@
*/ */
use Doctrine\ORM\EntityManager; use Doctrine\ORM\EntityManager;
use Doctrine\DBAL\Connection; use Chamilo\CoreBundle\Entity\ExtraField;
use Chamilo\CoreBundle\Entity\ExtraFieldOptions;
use Chamilo\CoreBundle\Entity\ExtraFieldValues;
/* CONSTANTS */ /* CONSTANTS */
define('SYSTEM_CONFIG_FILENAME', 'configuration.dist.php'); define('SYSTEM_CONFIG_FILENAME', 'configuration.dist.php');
@ -1942,13 +1944,9 @@ function migrate($chamiloVersion, EntityManager $manager)
} }
} }
/** function fixIds(EntityManager $em)
* @param Connection $connection {
*/ $connection = $em->getConnection();
function fixIds(Connection $connection) {
// Fix c_lp_item
$connection = $this->connection;
$sql = "SELECT * FROM c_lp_item"; $sql = "SELECT * FROM c_lp_item";
$result = $connection->fetchAll($sql); $result = $connection->fetchAll($sql);
@ -1962,43 +1960,43 @@ function fixIds(Connection $connection) {
switch ($item['item_type']) { switch ($item['item_type']) {
case TOOL_LINK: case TOOL_LINK:
$sql = "SELECT * c_link WHERE c_id = $courseId AND id = $ref"; $sql = "SELECT * FROM c_link WHERE c_id = $courseId AND id = $ref";
$data = $connection->fetchArray($sql); $data = $connection->fetchAssoc($sql);
if ($data) { if ($data) {
$newId = $data['iid']; $newId = $data['iid'];
} }
break; break;
case TOOL_STUDENTPUBLICATION: case TOOL_STUDENTPUBLICATION:
$sql = "SELECT * c_student_publication WHERE c_id = $courseId AND id = $ref"; $sql = "SELECT * FROM c_student_publication WHERE c_id = $courseId AND id = $ref";
$data = $connection->fetchArray($sql); $data = $connection->fetchAssoc($sql);
if ($data) { if ($data) {
$newId = $data['iid']; $newId = $data['iid'];
} }
break; break;
case TOOL_QUIZ: case TOOL_QUIZ:
$sql = "SELECT * c_quiz WHERE c_id = $courseId AND id = $ref"; $sql = "SELECT * FROM c_quiz WHERE c_id = $courseId AND id = $ref";
$data = $connection->fetchArray($sql); $data = $connection->fetchAssoc($sql);
if ($data) { if ($data) {
$newId = $data['iid']; $newId = $data['iid'];
} }
break; break;
case TOOL_DOCUMENT: case TOOL_DOCUMENT:
$sql = "SELECT * c_document WHERE c_id = $courseId AND id = $ref"; $sql = "SELECT * FROM c_document WHERE c_id = $courseId AND id = $ref";
$data = $connection->fetchArray($sql); $data = $connection->fetchAssoc($sql);
if ($data) { if ($data) {
$newId = $data['iid']; $newId = $data['iid'];
} }
break; break;
case TOOL_FORUM: case TOOL_FORUM:
$sql = "SELECT * c_forum_forum WHERE c_id = $courseId AND id = $ref"; $sql = "SELECT * FROM c_forum_forum WHERE c_id = $courseId AND id = $ref";
$data = $connection->fetchArray($sql); $data = $connection->fetchAssoc($sql);
if ($data) { if ($data) {
$newId = $data['iid']; $newId = $data['iid'];
} }
break; break;
case 'thread': case 'thread':
$sql = "SELECT * c_forum_thread WHERE c_id = $courseId AND id = $ref"; $sql = "SELECT * FROM c_forum_thread WHERE c_id = $courseId AND id = $ref";
$data = $connection->fetchArray($sql); $data = $connection->fetchAssoc($sql);
if ($data) { if ($data) {
$newId = $data['iid']; $newId = $data['iid'];
} }
@ -2054,9 +2052,9 @@ function fixIds(Connection $connection) {
// Fix group id // Fix group id
if (!empty($groupId)) { if (!empty($groupId)) {
$sql = "SELECT * c_group_info $sql = "SELECT * FROM c_group_info
WHERE c_id = $courseId AND id = $groupId LIMIT 1"; WHERE c_id = $courseId AND id = $groupId LIMIT 1";
$data = $connection->fetchArray($sql); $data = $connection->fetchAssoc($sql);
if (!empty($data)) { if (!empty($data)) {
$newGroupId = $data['iid']; $newGroupId = $data['iid'];
$sql = "UPDATE $table SET group_id = $newGroupId $sql = "UPDATE $table SET group_id = $newGroupId
@ -2085,8 +2083,8 @@ function fixIds(Connection $connection) {
// Fix group id // Fix group id
if (!empty($groupId)) { if (!empty($groupId)) {
$sql = "SELECT * c_group_info WHERE c_id = $courseId AND id = $groupId"; $sql = "SELECT * FROM c_group_info WHERE c_id = $courseId AND id = $groupId";
$data = $connection->fetchArray($sql); $data = $connection->fetchAssoc($sql);
if (!empty($data)) { if (!empty($data)) {
$newGroupId = $data['iid']; $newGroupId = $data['iid'];
$sql = "UPDATE c_item_property SET to_group_id = $newGroupId $sql = "UPDATE c_item_property SET to_group_id = $newGroupId
@ -2099,42 +2097,34 @@ function fixIds(Connection $connection) {
} }
} }
$sql = null; $sql = '';
$newId = '';
switch ($item['tool']) { switch ($item['tool']) {
case TOOL_LINK: case TOOL_LINK:
$sql = "SELECT * c_link WHERE c_id = $courseId AND id = $ref "; $sql = "SELECT * FROM c_link WHERE c_id = $courseId AND id = $ref ";
$data = $connection->fetchArray($sql);
$newId = $data['iid'];
break; break;
case TOOL_STUDENTPUBLICATION: case TOOL_STUDENTPUBLICATION:
$sql = "SELECT * c_student_publication WHERE c_id = $courseId AND id = $ref"; $sql = "SELECT * FROM c_student_publication WHERE c_id = $courseId AND id = $ref";
$data = $connection->fetchArray($sql);
$newId = $data['iid'];
break; break;
case TOOL_QUIZ: case TOOL_QUIZ:
$sql = "SELECT * c_quiz WHERE c_id = $courseId AND id = $ref"; $sql = "SELECT * FROM c_quiz WHERE c_id = $courseId AND id = $ref";
$data = $connection->fetchArray($sql);
$newId = $data['iid'];
break; break;
case TOOL_DOCUMENT: case TOOL_DOCUMENT:
$sql = "SELECT * c_document WHERE c_id = $courseId AND id = $ref"; $sql = "SELECT * FROM c_document WHERE c_id = $courseId AND id = $ref";
$data = $connection->fetchArray($sql);
$newId = $data['iid'];
break; break;
case TOOL_FORUM: case TOOL_FORUM:
$sql = "SELECT * c_forum_forum WHERE c_id = $courseId AND id = $ref"; $sql = "SELECT * FROM c_forum_forum WHERE c_id = $courseId AND id = $ref";
$data = $connection->fetchArray($sql);
$newId = $data['iid'];
break; break;
case 'thread': case 'thread':
$sql = "SELECT * c_forum_thread WHERE c_id = $courseId AND id = $ref"; $sql = "SELECT * FROM c_forum_thread WHERE c_id = $courseId AND id = $ref";
$data = $connection->fetchArray($sql);
$newId = $data['iid'];
break; break;
} }
if (!empty($sql)) { if (!empty($sql) && !empty($newId)) {
$data = $connection->fetchAssoc($sql);
if (isset($data['iid'])) {
$newId = $data['iid'];
}
$sql = "UPDATE c_item_property SET ref = $newId WHERE iid = $iid"; $sql = "UPDATE c_item_property SET ref = $newId WHERE iid = $iid";
$connection->executeQuery($sql); $connection->executeQuery($sql);
} }
@ -2144,52 +2134,47 @@ function fixIds(Connection $connection) {
$sql = "SELECT * FROM gradebook_link"; $sql = "SELECT * FROM gradebook_link";
$result = $connection->fetchAll($sql); $result = $connection->fetchAll($sql);
foreach ($result as $item) { foreach ($result as $item) {
$courseId = $item['c_id']; $courseCode = $item['course_code'];
$courseInfo = api_get_course_info($courseCode);
if (empty($courseInfo)) {
continue;
}
$courseId = $courseInfo['real_id'];
$ref = $item['ref_id']; $ref = $item['ref_id'];
$sql = null; $iid = $item['id'];
$sql = '';
switch ($item['tool']) { switch ($item['type']) {
case TOOL_LINK: case LINK_LEARNPATH:
$sql = "SELECT * c_link WHERE c_id = $courseId AND id = $ref "; $sql = "SELECT * FROM c_link WHERE c_id = $courseId AND id = $ref ";
$data = $connection->fetchArray($sql);
$newId = $data['iid'];
break;
case TOOL_STUDENTPUBLICATION:
$sql = "SELECT * c_student_publication WHERE c_id = $courseId AND id = $ref";
$data = $connection->fetchArray($sql);
$newId = $data['iid'];
break; break;
case TOOL_QUIZ: case LINK_STUDENTPUBLICATION:
$sql = "SELECT * c_quiz WHERE c_id = $courseId AND id = $ref"; $sql = "SELECT * FROM c_student_publication WHERE c_id = $courseId AND id = $ref";
$data = $connection->fetchArray($sql);
$newId = $data['iid'];
break; break;
case TOOL_DOCUMENT: case LINK_EXERCISE:
$sql = "SELECT * c_document WHERE c_id = $courseId AND id = $ref"; $sql = "SELECT * FROM c_quiz WHERE c_id = $courseId AND id = $ref";
$data = $connection->fetchArray($sql);
$newId = $data['iid'];
break; break;
case TOOL_FORUM: case LINK_ATTENDANCE:
$sql = "SELECT * c_forum_forum WHERE c_id = $courseId AND id = $ref"; //$sql = "SELECT * FROM c_document WHERE c_id = $courseId AND id = $ref";
$data = $connection->fetchArray($sql);
$newId = $data['iid'];
break; break;
case 'thread': case LINK_FORUM_THREAD:
$sql = "SELECT * c_forum_thread WHERE c_id = $courseId AND id = $ref"; $sql = "SELECT * FROM c_forum_thread WHERE c_id = $courseId AND id = $ref";
$data = $connection->fetchArray($sql);
$newId = $data['iid'];
break; break;
} }
if (!empty($sql)) { if (!empty($sql)) {
$sql = "UPDATE c_item_property SET ref_id = $newId WHERE iid = $iid"; $data = $connection->fetchAssoc($sql);
$connection->executeQuery($sql); if (isset($data) && isset($data['iid'])) {
$newId = $data['iid'];
$sql = "UPDATE gradebook_link SET ref_id = $newId
WHERE id = $iid";
$connection->executeQuery($sql);
}
} }
} }
$sql = "SELECT * FROM groups"; $sql = "SELECT * FROM groups";
$result = $connection->executeQuery($sql); $result = $connection->executeQuery($sql);
$groups = $result->fetchAll(); $groups = $result->fetchAll();
@ -2284,13 +2269,115 @@ function fixIds(Connection $connection) {
if (isset($oldGroups[$data['group_id']])) { if (isset($oldGroups[$data['group_id']])) {
$data['group_id'] = $oldGroups[$data['group_id']]; $data['group_id'] = $oldGroups[$data['group_id']];
$sql = "INSERT INTO usergroup_rel_tag (tag_id, usergroup_id) $sql = "INSERT INTO usergroup_rel_tag (tag_id, usergroup_id)
VALUES ('{$data['tag_id']}', '{$data['group_id']}')"; VALUES ('{$data['tag_id']}', '{$data['group_id']}')";
$connection->executeQuery($sql); $connection->executeQuery($sql);
} }
} }
} }
} }
// Extra fields
$extraFieldTables = [
ExtraField::USER_FIELD_TYPE => Database::get_main_table(TABLE_MAIN_USER_FIELD),
ExtraField::COURSE_FIELD_TYPE => Database::get_main_table(TABLE_MAIN_COURSE_FIELD),
//ExtraField::LP_FIELD_TYPE => Database::get_main_table(TABLE_MAIN_LP_FIELD),
ExtraField::SESSION_FIELD_TYPE => Database::get_main_table(TABLE_MAIN_SESSION_FIELD),
//ExtraField::CALENDAR_FIELD_TYPE => Database::get_main_table(TABLE_MAIN_CALENDAR_EVENT_FIELD),
//ExtraField::QUESTION_FIELD_TYPE => Database::get_main_table(TABLE_MAIN_CALENDAR_EVENT_FIELD),
//ExtraField::USER_FIELD_TYPE => //Database::get_main_table(TABLE_MAIN_SPECIFIC_FIELD),
];
foreach ($extraFieldTables as $type => $table) {
//continue;
$sql = "SELECT * FROM $table ";
$result = $connection->query($sql);
$fields = $result->fetchAll();
foreach ($fields as $field) {
$originalId = $field['id'];
$extraField = new ExtraField();
$extraField
->setExtraFieldType($type)
->setVariable($field['field_variable'])
->setFieldType($field['field_type'])
->setDisplayText($field['field_display_text'])
->setDefaultValue($field['field_default_value'])
->setFieldOrder($field['field_order'])
->setVisible($field['field_visible'])
->setChangeable($field['field_changeable'])
->setFilter($field['field_filter']);
$em->persist($extraField);
$em->flush();
$values = array();
switch ($type) {
case ExtraField::USER_FIELD_TYPE:
$optionTable = Database::get_main_table(
TABLE_MAIN_USER_FIELD_OPTIONS
);
$valueTable = Database::get_main_table(
TABLE_MAIN_USER_FIELD_VALUES
);
$handlerId = 'user_id';
break;
case ExtraField::COURSE_FIELD_TYPE:
$optionTable = Database::get_main_table(
TABLE_MAIN_COURSE_FIELD_OPTIONS
);
$valueTable = Database::get_main_table(
TABLE_MAIN_COURSE_FIELD_VALUES
);
$handlerId = 'c_id';
break;
case ExtraField::SESSION_FIELD_TYPE:
$optionTable = Database::get_main_table(
TABLE_MAIN_SESSION_FIELD_OPTIONS
);
$valueTable = Database::get_main_table(
TABLE_MAIN_SESSION_FIELD_VALUES
);
$handlerId = 'session_id';
break;
}
if (!empty($optionTable)) {
$sql = "SELECT * FROM $optionTable WHERE field_id = $originalId ";
$result = $connection->query($sql);
$options = $result->fetchAll();
foreach ($options as $option) {
$extraFieldOption = new ExtraFieldOptions();
$extraFieldOption
->setDisplayText($option['option_display_text'])
->setField($extraField)
->setOptionOrder($option['option_order'])
->setValue($option['option_value']);
$em->persist($extraFieldOption);
$em->flush();
}
$sql = "SELECT * FROM $valueTable WHERE field_id = $originalId ";
$result = $connection->query($sql);
$values = $result->fetchAll();
}
if (!empty($values)) {
foreach ($values as $value) {
$extraFieldValue = new ExtraFieldValues();
$extraFieldValue
->setValue($value['field_value'])
->setField($extraField)
->setItemId($value[$handlerId]);
$em->persist($extraFieldValue);
$em->flush();
}
}
}
}
} }
/** /**

@ -10202,69 +10202,67 @@ EOD;
// Calculate stars chapters evaluation // Calculate stars chapters evaluation
$exercisesItems = $this->getExercisesItems(); $exercisesItems = $this->getExercisesItems();
if ($exercisesItems === false) { if (!empty($exercisesItems)) {
return $stars; $totalResult = 0;
}
$totalResult = 0;
foreach ($exercisesItems as $exerciseItem) { foreach ($exercisesItems as $exerciseItem) {
$exerciseResultInfo = Event::getExerciseResultsByUser( $exerciseResultInfo = Event::getExerciseResultsByUser(
$this->user_id, $this->user_id,
$exerciseItem->ref, $exerciseItem->path,
$this->course_int_id, $this->course_int_id,
$sessionId, $sessionId,
$this->lp_id, $this->lp_id,
$exerciseItem->db_id $exerciseItem->db_id
); );
$exerciseResult = 0; $exerciseResult = 0;
foreach ($exerciseResultInfo as $result) { foreach ($exerciseResultInfo as $result) {
$exerciseResult += $result['exe_result'] * 100 / $result['exe_weighting']; $exerciseResult += $result['exe_result'] * 100 / $result['exe_weighting'];
} }
$exerciseAverage = $exerciseResult / (count($exerciseResultInfo) > 0 ? count($exerciseResultInfo) : 1); $exerciseAverage = $exerciseResult / (count($exerciseResultInfo) > 0 ? count($exerciseResultInfo) : 1);
$totalResult += $exerciseAverage; $totalResult += $exerciseAverage;
} }
$totalExerciseAverage = $totalResult / (count($exercisesItems) > 0 ? count($exercisesItems) : 1); $totalExerciseAverage = $totalResult / (count($exercisesItems) > 0 ? count($exercisesItems) : 1);
if ($totalExerciseAverage >= 50) { if ($totalExerciseAverage >= 50) {
$stars++; $stars++;
} }
if ($totalExerciseAverage >= 80) { if ($totalExerciseAverage >= 80) {
$stars++; $stars++;
}
} }
// Calculate star for final evaluation // Calculate star for final evaluation
$finalEvaluationItem = $this->getFinalEvaluationItem(); $finalEvaluationItem = $this->getFinalEvaluationItem();
if (empty($finalEvaluationItem)) { if (!empty($finalEvaluationItem)) {
return $stars; $evaluationResultInfo = Event::getExerciseResultsByUser(
} $this->user_id,
$finalEvaluationItem->path,
$this->course_int_id,
$sessionId,
$this->lp_id,
$finalEvaluationItem->db_id
);
$evaluationResultInfo = Event::getExerciseResultsByUser( $evaluationResult = 0;
$this->user_id,
$finalEvaluationItem->ref,
$this->course_int_id,
$sessionId,
$this->lp_id,
$finalEvaluationItem->db_id
);
$evaluationResult = 0; foreach ($evaluationResultInfo as $result) {
$evaluationResult += $result['exe_result'] * 100 / $result['exe_weighting'];
}
foreach ($evaluationResultInfo as $result) { $averageDivisor = count($evaluationResultInfo) > 0 ? count($evaluationResultInfo) : 1;
$evaluationResult += $result['exe_result'] * 100 / $result['exe_weighting'];
}
$evaluationAverage = $evaluationResult / (count($evaluationResultInfo) > 0 ? count($evaluationResultInfo) : 1); $evaluationAverage = $evaluationResult / $averageDivisor;
if ($evaluationAverage >= 80) { if ($evaluationAverage >= 80) {
$stars++; $stars++;
}
} }
return $stars; return $stars;

@ -32,6 +32,7 @@ $show_learnpath = true;
api_protect_course_script(); api_protect_course_script();
$lp_id = intval($_GET['lp_id']); $lp_id = intval($_GET['lp_id']);
$sessionId = api_get_session_id();
// Check if the learning path is visible for student - (LP requisites) // Check if the learning path is visible for student - (LP requisites)
@ -51,7 +52,7 @@ $visibility = api_get_item_visibility(
$lp_id, $lp_id,
$action, $action,
api_get_user_id(), api_get_user_id(),
api_get_session_id() $sessionId
); );
if (!api_is_allowed_to_edit(false, true, false, false) && intval($visibility) == 0) { if (!api_is_allowed_to_edit(false, true, false, false) && intval($visibility) == 0) {
api_not_allowed(true); api_not_allowed(true);
@ -390,6 +391,14 @@ if (api_get_course_setting('lp_return_link') == 1) {
$buttonHomeText = get_lang('LearningPathList'); $buttonHomeText = get_lang('LearningPathList');
} }
$lpPreviewImagePath = 'unknown_250_100.jpg';
if ($_SESSION['oLP']->get_preview_image()) {
$lpPreviewImagePath = $_SESSION['oLP']->get_preview_image_path();
}
$gamificationMode = api_get_setting('gamification_mode');
$template = new Template('title', false, false, true, true, false); $template = new Template('title', false, false, true, true, false);
$template->assign('glossary_extra_tools', api_get_setting('show_glossary_in_extra_tools')); $template->assign('glossary_extra_tools', api_get_setting('show_glossary_in_extra_tools'));
$template->assign( $template->assign(
@ -401,21 +410,44 @@ $template->assign('jquery_web_path', api_get_jquery_web_path());
$template->assign('jquery_ui_js_web_path', api_get_jquery_ui_js_web_path()); $template->assign('jquery_ui_js_web_path', api_get_jquery_ui_js_web_path());
$template->assign('jquery_ui_css_web_path', api_get_jquery_ui_css_web_path()); $template->assign('jquery_ui_css_web_path', api_get_jquery_ui_css_web_path());
$template->assign('is_allowed_to_edit', $is_allowed_to_edit); $template->assign('is_allowed_to_edit', $is_allowed_to_edit);
$template->assign('gamification_mode', api_get_setting('gamification_mode')); $template->assign('gamification_mode', $gamificationMode);
$template->assign('breadcrumb', $breadcrumb); $template->assign('breadcrumb', $breadcrumb);
$template->assign('button_home_url', $buttonHomeUrl); $template->assign('button_home_url', $buttonHomeUrl);
$template->assign('button_home_text', $buttonHomeText); $template->assign('button_home_text', $buttonHomeText);
$template->assign('navigation_bar', $navigation_bar); $template->assign('navigation_bar', $navigation_bar);
$template->assign('progress_bar', $progress_bar); $template->assign('progress_bar', $progress_bar);
$template->assign('oLP', $_SESSION['oLP']);
$template->assign('show_audio_player', $show_audioplayer); $template->assign('show_audio_player', $show_audioplayer);
$template->assign('media_player', $mediaplayer); $template->assign('media_player', $mediaplayer);
$template->assign('toc_list', $get_toc_list); $template->assign('toc_list', $get_toc_list);
$template->assign('iframe_src', $src); $template->assign('iframe_src', $src);
$template->assign('navigation_bar_bottom', $navigation_bar_bottom); $template->assign('navigation_bar_bottom', $navigation_bar_bottom);
if ($gamificationMode == 1) {
$template->assign(
'gamification_stars',
$_SESSION['oLP']->getCalculateStars($sessionId)
);
$template->assign(
'gamification_points',
$_SESSION['oLP']->getCalculateScore($sessionId)
);
}
$template->assign(
'lp_preview_image',
Display::return_icon(
$lpPreviewImagePath,
null,
['height' => 96, 'width' => 104]
)
);
$template->assign('lp_author', $_SESSION['oLP']->get_author());
$template->assign('lp_mode', $_SESSION['oLP']->mode);
$template->assign(
'lp_html_toc',
$_SESSION['oLP']->get_html_toc($get_toc_list)
);
$content = $template->fetch('default/learnpath/view.tpl'); $content = $template->fetch('default/learnpath/view.tpl');
$template->assign('content', $content); $template->assign('content', $content);

@ -317,7 +317,8 @@ if (isset($_POST['formSent']) && $_POST['formSent']) {
if ($user_id !== false) { if ($user_id !== false) {
$sql = "INSERT IGNORE INTO $tbl_session_user SET $sql = "INSERT IGNORE INTO $tbl_session_user SET
user_id ='$user_id', user_id ='$user_id',
session_id = '$session_id'"; session_id = '$session_id',
registered_at = '" . api_get_utc_datetime() . "'";
$rs_user = Database::query($sql); $rs_user = Database::query($sql);
$user_counter++; $user_counter++;
} }
@ -369,7 +370,8 @@ if (isset($_POST['formSent']) && $_POST['formSent']) {
// Adding to session_rel_user table. // Adding to session_rel_user table.
$sql = "INSERT IGNORE INTO $tbl_session_user SET $sql = "INSERT IGNORE INTO $tbl_session_user SET
user_id ='$user_id', user_id ='$user_id',
session_id = '$session_id'"; session_id = '$session_id',
registered_at = '" . api_get_utc_datetime() . "'";
$rs_user = Database::query($sql); $rs_user = Database::query($sql);
$user_counter++; $user_counter++;
// Adding to session_rel_user_rel_course table. // Adding to session_rel_user_rel_course table.

@ -14,9 +14,11 @@
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% for i in 1..(5 - gamification_stars) %} {% if 4 - gamification_stars > 0 %}
<i class="fa fa-star in"></i> {% for i in 1..(4 - gamification_stars) %}
{% endfor %} <i class="fa fa-star in"></i>
{% endfor %}
{% endif %}
</div> </div>
<div class="progress"> <div class="progress">

@ -13,21 +13,27 @@
{% if gamification_mode == 1 %} {% if gamification_mode == 1 %}
<div class="row"> <div class="row">
<div class="col-xs-8"> <div class="col-xs-8">
{% set lp_stars = oLP.getCalculateStars() %} {% if gamification_stars > 0 %}
{% if lp_stars > 0%} {% for i in 1..gamification_stars %}
{% for i in 1..lp_stars %}
<i class="fa fa-star fa-2x"></i> <i class="fa fa-star fa-2x"></i>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if lp_stars < 4 %} {% if gamification_stars < 4 %}
{% for i in 1..4 - lp_stars %} {% for i in 1..4 - gamification_stars %}
<i class="fa fa-star-o fa-2x"></i> <i class="fa fa-star-o fa-2x"></i>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
</div> </div>
<div class="col-xs-4 text-right"> <div class="col-xs-4 text-right">
{{ "XPoints"|get_lang|format(oLP.getCalculateScore()) }} {{ "XPoints"|get_lang|format(gamification_points) }}
</div>
</div>
<div class="row">
<div class="col-xs-12 navegation-bar" id="lp_navigation_elem">
<div id="progress_bar">
{{ progress_bar }}
</div>
</div> </div>
</div> </div>
{% else %} {% else %}
@ -44,13 +50,7 @@
<i class="fa fa-home"></i> {{ button_home_text }} <i class="fa fa-home"></i> {{ button_home_text }}
</a> </a>
<div class="image-avatar"> <div class="image-avatar">{{ lp_preview_image }}</div>
{% if oLP.get_preview_image() %}
<img src="{{ oLP.get_preview_image_path() }}" width="104" height="96">
{% else %}
<img src="{{ "unknown_250_100.jpg"|icon }}" width="104" height="96">
{% endif %}
</div>
<div id="lp_navigation_elem" class="navegation-bar"> <div id="lp_navigation_elem" class="navegation-bar">
{{ navigation_bar }} {{ navigation_bar }}
@ -60,9 +60,7 @@
</div> </div>
</div> </div>
<div class="description-autor"> <div class="description-autor">{{ lp_author }}</div>
{{ oLP.get_author() }}
</div>
{% if show_audio_player %} {% if show_audio_player %}
<div id="lp_media_file"> <div id="lp_media_file">
@ -75,9 +73,7 @@
{# TOC layout #} {# TOC layout #}
<div id="toc_id" name="toc_name"> <div id="toc_id" name="toc_name">
<div id="learning_path_toc" class="scorm-list"> <div id="learning_path_toc" class="scorm-list">{{ lp_html_toc }}</div>
{{ oLP.get_html_toc(toc_list) }}
</div>
</div> </div>
{# end TOC layout #} {# end TOC layout #}
@ -88,7 +84,7 @@
{# right zone #} {# right zone #}
<div id="learning_path_right_zone" style="height:100%" class="content-scorm"> <div id="learning_path_right_zone" style="height:100%" class="content-scorm">
{% if oLP.mode == 'fullscreen' %} {% if lp_mode == 'fullscreen' %}
<iframe id="content_id_blank" name="content_name_blank" src="blank.php" border="0" frameborder="0" style="width: 100%; height: 100%" allowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true"></iframe> <iframe id="content_id_blank" name="content_name_blank" src="blank.php" border="0" frameborder="0" style="width: 100%; height: 100%" allowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true"></iframe>
{% else %} {% else %}
<iframe id="content_id" name="content_name" src="{{ iframe_src }}" border="0" frameborder="0" style="display: block; width: 100%; height: 100%" allowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true"></iframe> <iframe id="content_id" name="content_name" src="{{ iframe_src }}" border="0" frameborder="0" style="display: block; width: 100%; height: 100%" allowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true"></iframe>

@ -4823,8 +4823,8 @@ function WSSuscribeUsersToSession($params)
foreach ($usersList as $enreg_user) { foreach ($usersList as $enreg_user) {
$enreg_user = Database::escape_string($enreg_user); $enreg_user = Database::escape_string($enreg_user);
$nbr_users++; $nbr_users++;
$sql = "INSERT IGNORE INTO $tbl_session_rel_user(session_id, user_id) $sql = "INSERT IGNORE INTO $tbl_session_rel_user(session_id, user_id, registered_at)
VALUES ('$sessionId','$enreg_user')"; VALUES ('$sessionId','$enreg_user', '" . api_get_utc_datetime() . "')";
Database::query($sql); Database::query($sql);
} }

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;
@ -12,6 +13,15 @@ use Doctrine\ORM\Mapping as ORM;
*/ */
class GradeComponents class GradeComponents
{ {
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/
private $id;
/** /**
* @var string * @var string
* *
@ -40,17 +50,6 @@ class GradeComponents
*/ */
private $gradeModelId; private $gradeModelId;
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/** /**
* Set percentage * Set percentage
* *

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;
@ -12,6 +13,15 @@ use Doctrine\ORM\Mapping as ORM;
*/ */
class GradeModel class GradeModel
{ {
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/
private $id;
/** /**
* @var string * @var string
* *
@ -47,17 +57,6 @@ class GradeModel
*/ */
private $defaultExternalEvalPrefix; private $defaultExternalEvalPrefix;
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/** /**
* Set name * Set name
* *

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;
@ -12,6 +13,14 @@ use Doctrine\ORM\Mapping as ORM;
*/ */
class GradebookCategory class GradebookCategory
{ {
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/
private $id;
/** /**
* @var string * @var string
@ -123,17 +132,6 @@ class GradebookCategory
*/ */
private $isRequirement; private $isRequirement;
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/** /**
* Set name * Set name
* *

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;
@ -12,6 +13,15 @@ use Doctrine\ORM\Mapping as ORM;
*/ */
class GradebookCertificate class GradebookCertificate
{ {
/**
* @var integer
*
* @ORM\Column(name="id", type="bigint")
* @ORM\Id
* @ORM\GeneratedValue
*/
private $id;
/** /**
* @var integer * @var integer
* *
@ -47,17 +57,6 @@ class GradebookCertificate
*/ */
private $pathCertificate; private $pathCertificate;
/**
* @var integer
*
* @ORM\Column(name="id", type="bigint")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/** /**
* Set catId * Set catId
* *

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;
@ -12,6 +13,15 @@ use Doctrine\ORM\Mapping as ORM;
*/ */
class GradebookEvaluation class GradebookEvaluation
{ {
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/
private $id;
/** /**
* @var string * @var string
* *
@ -89,17 +99,6 @@ class GradebookEvaluation
*/ */
private $locked; private $locked;
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/** /**
* Set name * Set name
* *

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;
@ -12,6 +13,15 @@ use Doctrine\ORM\Mapping as ORM;
*/ */
class GradebookLink class GradebookLink
{ {
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/
private $id;
/** /**
* @var integer * @var integer
* *
@ -75,21 +85,11 @@ class GradebookLink
*/ */
private $locked; private $locked;
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/** /**
* Set type * Set type
* *
* @param integer $type * @param integer $type
*
* @return GradebookLink * @return GradebookLink
*/ */
public function setType($type) public function setType($type)

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;

@ -0,0 +1,168 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* GradebookScoreLog
*
* @ORM\Table(
* name="gradebook_score_log", indexes={
* @ORM\Index(name="idx_gradebook_score_log_user", columns={"user_id"}),
* @ORM\Index(name="idx_gradebook_score_log_user_category", columns={"user_id", "category_id"})
* }
* )
* @ORM\Entity
*/
class GradebookScoreLog
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/
private $id;
/**
* @var integer
*
* @ORM\Column(name="category_id", type="integer", nullable=false)
*/
private $categoryId;
/**
* @var integer
*
* @ORM\Column(name="user_id", type="integer", nullable=false)
*/
private $userId;
/**
* @var float
*
* @ORM\Column(name="score", type="float", precision=10, scale=0, nullable=false)
*/
private $score;
/**
* @var \DateTime
*
* @ORM\Column(name="registered_at", type="datetime", nullable=false)
*/
private $registeredAt;
/**
* Get the category id
* @return int
*/
public function getCategoryId()
{
return $this->categoryId;
}
/**
* Get the user id
* @return int
*/
public function getUserId()
{
return $this->userId;
}
/**
* Get the achieved score
* @return float
*/
public function getScore()
{
return $this->score;
}
/**
* Get the datetime of register
* @return \DateTime
*/
public function getRegisteredAt()
{
return $this->registeredAt;
}
/**
* Get the id
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set the category id
* @param int $categoryId
*
* @return $this
*/
public function setCategoryId($categoryId)
{
$this->categoryId = $categoryId;
return $this;
}
/**
* Set the user id
* @param int $userId
*
* @return $this
*/
public function setUserId($userId)
{
$this->userId = $userId;
return $this;
}
/**
* Set the achieved score
* @param int $score
*
* @return $this
*/
public function setScore($score)
{
$this->score = $score;
return $this;
}
/**
* Set the datetime of register
* @param \DateTime $registeredAt
*
* @return $this
*/
public function setRegisteredAt(\DateTime $registeredAt)
{
$this->registeredAt = $registeredAt;
return $this;
}
/**
* Set the id
* @param int $id
*
* @return $this
*/
public function setId($id)
{
$this->id = $id;
return $this;
}
}

@ -28,11 +28,6 @@ class SessionRelUser
*/ */
private $iid; private $iid;
public $relationTypeList = array(
0 => 'student',
1 => 'drh'
);
/** /**
* @ORM\ManyToOne(targetEntity="Session", inversedBy="users", cascade={"persist"}) * @ORM\ManyToOne(targetEntity="Session", inversedBy="users", cascade={"persist"})
* @ORM\JoinColumn(name="session_id", referencedColumnName="id") * @ORM\JoinColumn(name="session_id", referencedColumnName="id")
@ -55,24 +50,35 @@ class SessionRelUser
/** /**
* @var integer * @var integer
* *
* @ORM\Column(name="moved_to", type="integer", precision=0, scale=0, nullable=true, unique=false) * @ORM\Column(name="moved_to", type="integer", nullable=true, unique=false)
*/ */
private $movedTo; private $movedTo;
/** /**
* @var integer * @var integer
* *
* @ORM\Column(name="moved_status", type="integer", precision=0, scale=0, nullable=true, unique=false) * @ORM\Column(name="moved_status", type="integer", nullable=true, unique=false)
*/ */
private $movedStatus; private $movedStatus;
/** /**
* @var \DateTime * @var \DateTime
* *
* @ORM\Column(name="moved_at", type="datetime", precision=0, scale=0, nullable=true, unique=false) * @ORM\Column(name="moved_at", type="datetime", nullable=true, unique=false)
*/ */
private $movedAt; private $movedAt;
/**
* @var \DateTime
* @ORM\Column(name="registered_at", type="datetime", nullable=false, unique=false)
*/
private $registeredAt;
public $relationTypeList = array(
0 => 'student',
1 => 'drh'
);
/** /**
* Constructor * Constructor
*/ */
@ -81,6 +87,7 @@ class SessionRelUser
$this->moved_to = null; $this->moved_to = null;
$this->movedStatus = null; $this->movedStatus = null;
$this->movedAt = null; $this->movedAt = null;
$this->registeredAt = new \DateTime('now', new \DateTimeZone('UTC'));
} }
/** /**
@ -218,6 +225,7 @@ class SessionRelUser
* Set movedAt * Set movedAt
* *
* @param \DateTime $movedAt * @param \DateTime $movedAt
*
* @return SessionRelUser * @return SessionRelUser
*/ */
public function setMovedAt($movedAt) public function setMovedAt($movedAt)
@ -236,4 +244,27 @@ class SessionRelUser
{ {
return $this->movedAt; return $this->movedAt;
} }
/**
* Set registeredAt
* @param \DateTime $registeredAt
*
* @return $this
*/
public function setRegisteredAt(\DateTime $registeredAt)
{
$this->registeredAt = $registeredAt;
return $this;
}
/**
* Get registeredAt
* @return \DateTime
*/
public function getRegisteredAt()
{
return $this->registeredAt;
}
} }

@ -8,7 +8,7 @@ use Doctrine\ORM\Mapping as ORM;
/** /**
* SettingsCurrent * SettingsCurrent
* *
* @ORM\Table(name="settings_current", uniqueConstraints={@ORM\UniqueConstraint(name="unique_setting", columns={"variable", "subkey", "category", "access_url"})}, indexes={@ORM\Index(name="access_url", columns={"access_url"})}) * @ORM\Table(name="settings_current", uniqueConstraints={@ORM\UniqueConstraint(name="unique_setting", columns={"variable", "access_url"})}, indexes={@ORM\Index(name="access_url", columns={"access_url"})})
* @ORM\Entity * @ORM\Entity
*/ */
class SettingsCurrent class SettingsCurrent
@ -18,7 +18,7 @@ class SettingsCurrent
* *
* @ORM\Column(name="id", type="integer") * @ORM\Column(name="id", type="integer")
* @ORM\Id * @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY") * @ORM\GeneratedValue
*/ */
private $id; private $id;

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;
@ -7,11 +8,20 @@ use Doctrine\ORM\Mapping as ORM;
/** /**
* SettingsOptions * SettingsOptions
* *
* @ORM\Table(name="settings_options", uniqueConstraints={@ORM\UniqueConstraint(name="id", columns={"id"}), @ORM\UniqueConstraint(name="unique_setting_option", columns={"variable", "value"})}) * @ORM\Table(name="settings_options", uniqueConstraints={@ORM\UniqueConstraint(name="unique_setting_option", columns={"variable", "value"})})
* @ORM\Entity * @ORM\Entity
*/ */
class SettingsOptions class SettingsOptions
{ {
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/
private $id;
/** /**
* @var string * @var string
* *
@ -33,17 +43,6 @@ class SettingsOptions
*/ */
private $displayText; private $displayText;
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/** /**
* Set variable * Set variable
* *

@ -176,6 +176,13 @@ class CForumForum
*/ */
private $endTime; private $endTime;
/**
* @var integer
*
* @ORM\Column(name="lp_id", type="integer", options={"unsigned":true})
*/
private $lpId;
/** /**
* Set forumTitle * Set forumTitle
* *
@ -681,4 +688,26 @@ class CForumForum
{ {
return $this->cId; return $this->cId;
} }
/**
* Set lpId
* @param integer $lpId
* @return \Chamilo\CourseBundle\Entity\CForumForum
*/
public function setLpId($lpId)
{
$this->lpId = $lpId;
return $this;
}
/**
* Get lpId
* @return integer
*/
public function getLpId()
{
return $this->lpId;
}
} }

@ -148,6 +148,13 @@ class CForumThread
*/ */
private $threadPeerQualify; private $threadPeerQualify;
/**
* @var integer
*
* @ORM\Column(name="lp_item_id", type="integer", options={"unsigned":true})
*/
private $lpItemId;
/** /**
* Constructor * Constructor
*/ */
@ -224,6 +231,7 @@ class CForumThread
* Set threadReplies * Set threadReplies
* *
* @param integer $threadReplies * @param integer $threadReplies
*
* @return CForumThread * @return CForumThread
*/ */
public function setThreadReplies($threadReplies) public function setThreadReplies($threadReplies)
@ -247,6 +255,7 @@ class CForumThread
* Set threadPosterId * Set threadPosterId
* *
* @param integer $threadPosterId * @param integer $threadPosterId
*
* @return CForumThread * @return CForumThread
*/ */
public function setThreadPosterId($threadPosterId) public function setThreadPosterId($threadPosterId)
@ -270,6 +279,7 @@ class CForumThread
* Set threadPosterName * Set threadPosterName
* *
* @param string $threadPosterName * @param string $threadPosterName
*
* @return CForumThread * @return CForumThread
*/ */
public function setThreadPosterName($threadPosterName) public function setThreadPosterName($threadPosterName)
@ -293,6 +303,7 @@ class CForumThread
* Set threadViews * Set threadViews
* *
* @param integer $threadViews * @param integer $threadViews
*
* @return CForumThread * @return CForumThread
*/ */
public function setThreadViews($threadViews) public function setThreadViews($threadViews)
@ -316,6 +327,7 @@ class CForumThread
* Set threadLastPost * Set threadLastPost
* *
* @param integer $threadLastPost * @param integer $threadLastPost
*
* @return CForumThread * @return CForumThread
*/ */
public function setThreadLastPost($threadLastPost) public function setThreadLastPost($threadLastPost)
@ -339,6 +351,7 @@ class CForumThread
* Set threadDate * Set threadDate
* *
* @param \DateTime $threadDate * @param \DateTime $threadDate
*
* @return CForumThread * @return CForumThread
*/ */
public function setThreadDate($threadDate) public function setThreadDate($threadDate)
@ -362,6 +375,7 @@ class CForumThread
* Set threadSticky * Set threadSticky
* *
* @param boolean $threadSticky * @param boolean $threadSticky
*
* @return CForumThread * @return CForumThread
*/ */
public function setThreadSticky($threadSticky) public function setThreadSticky($threadSticky)
@ -385,6 +399,7 @@ class CForumThread
* Set locked * Set locked
* *
* @param integer $locked * @param integer $locked
*
* @return CForumThread * @return CForumThread
*/ */
public function setLocked($locked) public function setLocked($locked)
@ -408,6 +423,7 @@ class CForumThread
* Set sessionId * Set sessionId
* *
* @param integer $sessionId * @param integer $sessionId
*
* @return CForumThread * @return CForumThread
*/ */
public function setSessionId($sessionId) public function setSessionId($sessionId)
@ -431,6 +447,7 @@ class CForumThread
* Set threadTitleQualify * Set threadTitleQualify
* *
* @param string $threadTitleQualify * @param string $threadTitleQualify
*
* @return CForumThread * @return CForumThread
*/ */
public function setThreadTitleQualify($threadTitleQualify) public function setThreadTitleQualify($threadTitleQualify)
@ -454,6 +471,7 @@ class CForumThread
* Set threadQualifyMax * Set threadQualifyMax
* *
* @param float $threadQualifyMax * @param float $threadQualifyMax
*
* @return CForumThread * @return CForumThread
*/ */
public function setThreadQualifyMax($threadQualifyMax) public function setThreadQualifyMax($threadQualifyMax)
@ -477,6 +495,7 @@ class CForumThread
* Set threadCloseDate * Set threadCloseDate
* *
* @param \DateTime $threadCloseDate * @param \DateTime $threadCloseDate
*
* @return CForumThread * @return CForumThread
*/ */
public function setThreadCloseDate($threadCloseDate) public function setThreadCloseDate($threadCloseDate)
@ -500,6 +519,7 @@ class CForumThread
* Set threadWeight * Set threadWeight
* *
* @param float $threadWeight * @param float $threadWeight
*
* @return CForumThread * @return CForumThread
*/ */
public function setThreadWeight($threadWeight) public function setThreadWeight($threadWeight)
@ -523,6 +543,7 @@ class CForumThread
* Set threadId * Set threadId
* *
* @param integer $threadId * @param integer $threadId
*
* @return CForumThread * @return CForumThread
*/ */
public function setThreadId($threadId) public function setThreadId($threadId)
@ -546,6 +567,7 @@ class CForumThread
* Set cId * Set cId
* *
* @param integer $cId * @param integer $cId
*
* @return CForumThread * @return CForumThread
*/ */
public function setCId($cId) public function setCId($cId)
@ -564,4 +586,26 @@ class CForumThread
{ {
return $this->cId; return $this->cId;
} }
/**
* Set lpItemId
* @param integer $lpItemId
*
* @return $this
*/
public function setLpItemId($lpItemId)
{
$this->lpItemId = $lpItemId;
return $this;
}
/**
* Get lpId
* @return integer
*/
public function getLpItemId()
{
return $this->lpItemId;
}
} }

@ -13,7 +13,6 @@ use Doctrine\ORM\Mapping as ORM;
*/ */
class CForumThreadQualifyLog class CForumThreadQualifyLog
{ {
/** /**
* @var integer * @var integer
* *
@ -83,6 +82,7 @@ class CForumThreadQualifyLog
* Set userId * Set userId
* *
* @param integer $userId * @param integer $userId
*
* @return CForumThreadQualifyLog * @return CForumThreadQualifyLog
*/ */
public function setUserId($userId) public function setUserId($userId)
@ -106,6 +106,7 @@ class CForumThreadQualifyLog
* Set threadId * Set threadId
* *
* @param integer $threadId * @param integer $threadId
*
* @return CForumThreadQualifyLog * @return CForumThreadQualifyLog
*/ */
public function setThreadId($threadId) public function setThreadId($threadId)
@ -129,6 +130,7 @@ class CForumThreadQualifyLog
* Set qualify * Set qualify
* *
* @param float $qualify * @param float $qualify
*
* @return CForumThreadQualifyLog * @return CForumThreadQualifyLog
*/ */
public function setQualify($qualify) public function setQualify($qualify)
@ -152,6 +154,7 @@ class CForumThreadQualifyLog
* Set qualifyUserId * Set qualifyUserId
* *
* @param integer $qualifyUserId * @param integer $qualifyUserId
*
* @return CForumThreadQualifyLog * @return CForumThreadQualifyLog
*/ */
public function setQualifyUserId($qualifyUserId) public function setQualifyUserId($qualifyUserId)
@ -175,6 +178,7 @@ class CForumThreadQualifyLog
* Set qualifyTime * Set qualifyTime
* *
* @param \DateTime $qualifyTime * @param \DateTime $qualifyTime
*
* @return CForumThreadQualifyLog * @return CForumThreadQualifyLog
*/ */
public function setQualifyTime($qualifyTime) public function setQualifyTime($qualifyTime)
@ -198,6 +202,7 @@ class CForumThreadQualifyLog
* Set sessionId * Set sessionId
* *
* @param integer $sessionId * @param integer $sessionId
*
* @return CForumThreadQualifyLog * @return CForumThreadQualifyLog
*/ */
public function setSessionId($sessionId) public function setSessionId($sessionId)
@ -221,6 +226,7 @@ class CForumThreadQualifyLog
* Set id * Set id
* *
* @param integer $id * @param integer $id
*
* @return CForumThreadQualifyLog * @return CForumThreadQualifyLog
*/ */
public function setId($id) public function setId($id)
@ -244,6 +250,7 @@ class CForumThreadQualifyLog
* Set cId * Set cId
* *
* @param integer $cId * @param integer $cId
*
* @return CForumThreadQualifyLog * @return CForumThreadQualifyLog
*/ */
public function setCId($cId) public function setCId($cId)

Loading…
Cancel
Save