diff --git a/main/exercice/admin.php b/main/exercice/admin.php
index 972bd85444..ab984c9a55 100644
--- a/main/exercice/admin.php
+++ b/main/exercice/admin.php
@@ -512,12 +512,8 @@ if ($inATest) {
ICON_SIZE_MEDIUM
).'';
} else {
- echo ''.Display::return_icon(
- 'settings.png',
- get_lang('ModifyExercise'),
- '',
- ICON_SIZE_MEDIUM
- ).'';
+ echo ''.
+ Display::return_icon('settings.png', get_lang('ModifyExercise'), '', ICON_SIZE_MEDIUM ).'';
}
// @todo if you have 5000 questions this will slow down everything
@@ -534,27 +530,11 @@ if ($inATest) {
echo ''.sprintf(get_lang('XQuestionsWithTotalScoreY'), $objExercise->selectNbrQuestions(), $maxScoreAllQuestions ).'';*/
echo '';
} else {
- if (isset($_GET['newQuestion'])) {
- // we are in create a new question from question pool not in a test
- echo '
';
- } else {
- // If we are in question_poolbut not in an test, go back to question create in pool
- echo '';
- }
+ // we are in create a new question from question pool not in a test
+ echo '';
}
diff --git a/main/exercice/exercise_submit.php b/main/exercice/exercise_submit.php
index fcb9251fa8..0b8ecf3e92 100644
--- a/main/exercice/exercise_submit.php
+++ b/main/exercice/exercise_submit.php
@@ -839,7 +839,6 @@ if (is_null($current_question)) {
}
}
-
if ($question_count != 0) {
if (($objExercise->type == ALL_ON_ONE_PAGE || $current_question > $question_count)) {
if (api_is_allowed_to_session_edit()) {
@@ -1270,6 +1269,7 @@ if (!empty($error)) {
}
$("#save_for_now_"+question_id).html("'.addslashes(Display::return_icon('save.png', get_lang('Saved'), array(), ICON_SIZE_SMALL)).'");
+
if (redirect) {
window.location = url;
}
diff --git a/vendor/chamilo/chash/src/Chash/Command/Chash/SetupCommand.php b/vendor/chamilo/chash/src/Chash/Command/Chash/SetupCommand.php
index 8885568172..32d8512ae1 100644
--- a/vendor/chamilo/chash/src/Chash/Command/Chash/SetupCommand.php
+++ b/vendor/chamilo/chash/src/Chash/Command/Chash/SetupCommand.php
@@ -7,6 +7,7 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console;
use Symfony\Component\Yaml\Dumper;
+use Symfony\Component\Filesystem\Filesystem;
/**
* Class StatusCommand
@@ -15,13 +16,15 @@ class SetupCommand extends AbstractCommand
{
public $migrationFile = null;
+ /**
+ *
+ */
protected function configure()
{
$this
->setName('chash:setup')
->setDescription('Setups the migration.yml')
- ->addOption('migration-yml-path', null, InputOption::VALUE_OPTIONAL, 'The path to the migration.yml file')
- ->addOption('migration-class-path', null, InputOption::VALUE_OPTIONAL, 'The path to the migration class');
+ ->addOption('temp-folder', null, InputOption::VALUE_OPTIONAL, 'The temp folder.', '/tmp');
}
/**
@@ -34,41 +37,41 @@ class SetupCommand extends AbstractCommand
*/
protected function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
{
- $path = $input->getOption('migration-yml-path');
+ $tempFolder = $input->getOption('temp-folder');
- if (empty($path)) {
- $srcPath = realpath(__DIR__.'/../../../').'/Chash/Migrations/';
- } else {
- $srcPath = $path;
- }
+ $fs = new Filesystem();
- $migrationClassPath = $input->getOption('migration-class-path');
+ $migrationsFolder = $tempFolder.'/Migrations/';
- if (empty($migrationClassPath)) {
- $migrationClassPath = $srcPath;
+ if (!$fs->exists($migrationsFolder)) {
+ $fs->mkdir($migrationsFolder);
}
$migrations = array(
'name' => 'Chamilo Migrations',
'migrations_namespace' => 'Chash\Migrations',
'table_name' => 'chamilo_migration_versions',
- 'migrations_directory' => $migrationClassPath
+ 'migrations_directory' => $migrationsFolder
);
- // does not work because it need a callable function yml_emit
- /*$config = new \Zend\Config\Config($migrations, true);
- $writer = new \Zend\Config\Writer\Yaml();
- $writer->toFile($srcPath.'/Chash/Migrations/migrations.ypl', $config);*/
$dumper = new Dumper();
$yaml = $dumper->dump($migrations, 1);
- $file = $srcPath.'/migrations.yml';
+ $file = $migrationsFolder.'migrations.yml';
file_put_contents($file, $yaml);
+ $migrationPathSource = __DIR__.'/../../../Chash/Migrations/';
+
+ $fs->mirror($migrationPathSource, $migrationsFolder);
+
// migrations_directory
$output->writeln("Chash migrations.yml saved: $file");
$this->migrationFile = $file;
}
+ /**
+ * Gets the migration file path
+ * @return string
+ */
public function getMigrationFile()
{
return $this->migrationFile;
diff --git a/vendor/chamilo/chash/src/Chash/Command/Files/GenerateTempFileStructureCommand.php b/vendor/chamilo/chash/src/Chash/Command/Files/GenerateTempFileStructureCommand.php
index 908b67dbaa..f0b117e025 100644
--- a/vendor/chamilo/chash/src/Chash/Command/Files/GenerateTempFileStructureCommand.php
+++ b/vendor/chamilo/chash/src/Chash/Command/Files/GenerateTempFileStructureCommand.php
@@ -10,7 +10,6 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Filesystem\Filesystem;
-
class GenerateTempFileStructureCommand extends CommonChamiloDatabaseCommand
{
/**
@@ -37,7 +36,6 @@ class GenerateTempFileStructureCommand extends CommonChamiloDatabaseCommand
// Data folders
$files = $this->getConfigurationHelper()->getTempFolderList();
$this->createFolders($output, $files, 0777);
-
}
/**
diff --git a/vendor/chamilo/chash/src/Chash/Command/Installation/UpgradeCommand.php b/vendor/chamilo/chash/src/Chash/Command/Installation/UpgradeCommand.php
index 77de846e30..4678c9c441 100644
--- a/vendor/chamilo/chash/src/Chash/Command/Installation/UpgradeCommand.php
+++ b/vendor/chamilo/chash/src/Chash/Command/Installation/UpgradeCommand.php
@@ -6,7 +6,6 @@ use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console;
-use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Yaml\Dumper;
use Symfony\Component\Yaml\Parser;
@@ -41,10 +40,10 @@ class UpgradeCommand extends CommonCommand
->addOption('dry-run', null, InputOption::VALUE_NONE, 'Execute the migration as a dry run.')
->addOption('update-installation', null, InputOption::VALUE_OPTIONAL, 'Updates the portal with the current zip file. http:// or /var/www/file.zip')
->addOption('temp-folder', null, InputOption::VALUE_OPTIONAL, 'The temp folder.', '/tmp')
- ->addOption('migration-yml-path', null, InputOption::VALUE_OPTIONAL, 'The temp folder.')
- ->addOption('migration-class-path', null, InputOption::VALUE_OPTIONAL, 'The temp folder.')
->addOption('download-package', null, InputOption::VALUE_OPTIONAL, 'Downloads the chamilo package', 'true')
- ->addOption('silent', null, InputOption::VALUE_NONE, 'Execute the migration with out asking questions.');
+ ->addOption('silent', null, InputOption::VALUE_NONE, 'Execute the migration with out asking questions.')
+ ->addOption('linux-user', null, InputOption::VALUE_OPTIONAL, 'user', 'www-data')
+ ->addOption('linux-group', null, InputOption::VALUE_OPTIONAL, 'group', 'www-data');
//->addOption('force', null, InputOption::VALUE_NONE, 'Force the update. Only for tests');
}
@@ -64,21 +63,15 @@ class UpgradeCommand extends CommonCommand
// Setting up Chash
$command = $this->getApplication()->find('chash:setup');
- $migrationPath = $input->getOption('migration-yml-path');
- $migrationDir = $input->getOption('migration-class-path');
+
+ // User options
+ $linuxUser = $input->getOption('linux-user');
+ $linuxGroup = $input->getOption('linux-group');
$arguments = array(
'command' => 'chash:setup'
);
- if (!empty($migrationPath)) {
- $arguments['--migration-yml-path'] = $migrationPath;
- }
-
- if (!empty($migrationDir)) {
- $arguments['--migration-class-path'] = $migrationDir;
- }
-
$inputSetup = new ArrayInput($arguments);
$command->run($inputSetup, $output);
@@ -131,6 +124,15 @@ class UpgradeCommand extends CommonCommand
}
$this->setConfigurationPath($configurationPath);
+ // $_configuration['password_encryption'] must exists
+
+ if (isset($_configuration['password_encryption'])) {
+ $output->writeln(" \$_configuration[password_encryption] value found: ".$_configuration['password_encryption']."");
+ } else {
+ $output->writeln("\$_configuration['password_encryption'] not found. The key 'password_encryption' or the variable '\$userPasswordCrypted' must exists in the configuration.php file ");
+ return 0;
+ }
+
// In order to use Doctrine migrations
// Setting configuration variable in order to get the doctrine version:
@@ -318,7 +320,6 @@ class UpgradeCommand extends CommonCommand
if ($version == '1.10.0') {
$this->removeUnUsedFiles($output, $path);
$this->copyConfigFilesToNewLocation($output);
-
}
}
@@ -338,6 +339,8 @@ class UpgradeCommand extends CommonCommand
$arguments = array(
'command' => 'files:set_permissions_after_install',
'--conf' => $this->getConfigurationHelper()->getConfigurationFilePath($path),
+ '--linux-user' => $linuxUser,
+ '--linux-group' => $linuxGroup,
'--dry-run' => $dryRun
);
diff --git a/vendor/chamilo/chash/src/Chash/Resources/Database/1.10.0/db_course.sql b/vendor/chamilo/chash/src/Chash/Resources/Database/1.10.0/db_course.sql
index 05c1fbfe41..a079cfaeec 100644
--- a/vendor/chamilo/chash/src/Chash/Resources/Database/1.10.0/db_course.sql
+++ b/vendor/chamilo/chash/src/Chash/Resources/Database/1.10.0/db_course.sql
@@ -1581,6 +1581,7 @@ CREATE TABLE c_student_publication (
id int(10) unsigned NOT NULL AUTO_INCREMENT,
url varchar(255) DEFAULT NULL,
title varchar(255) DEFAULT NULL,
+ filename varchar(255) DEFAULT NULL,
description text,
author varchar(255) DEFAULT NULL,
active tinyint(4) DEFAULT NULL,
@@ -2031,3 +2032,13 @@ CREATE TABLE c_student_publication_rel_user (
user_id INT NOT NULL,
c_id INT NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+DROP TABLE IF EXISTS c_student_publication_comment;
+CREATE TABLE c_student_publication_comment (
+ id INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
+ work_id INT NOT NULL,
+ c_id INT NOT NULL,
+ comment text,
+ user_id int NOT NULL,
+ sent_at datetime NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
diff --git a/vendor/chamilo/chash/src/Chash/Resources/Database/1.10.0/db_main.sql b/vendor/chamilo/chash/src/Chash/Resources/Database/1.10.0/db_main.sql
index fbe0c91686..89df218fca 100644
--- a/vendor/chamilo/chash/src/Chash/Resources/Database/1.10.0/db_main.sql
+++ b/vendor/chamilo/chash/src/Chash/Resources/Database/1.10.0/db_main.sql
@@ -180,6 +180,7 @@ CREATE TABLE IF NOT EXISTS course (
registration_code varchar(255) NOT NULL default '',
legal TEXT NOT NULL,
activate_legal INT NOT NULL DEFAULT 0,
+ add_teachers_to_sessions_courses tinyint NOT NULL default 0,
PRIMARY KEY (id),
UNIQUE KEY code (code)
);
@@ -3580,4 +3581,4 @@ CREATE TABLE curriculum_rel_user (
-- Do not move this
-UPDATE settings_current SET selected_value = '1.10.0.044' WHERE variable = 'chamilo_database_version';
+UPDATE settings_current SET selected_value = '1.10.0.047' WHERE variable = 'chamilo_database_version';
diff --git a/vendor/chamilo/chash/src/Chash/Resources/Database/1.10.0/migrate-db-1.9.0-1.10.0-pre.sql b/vendor/chamilo/chash/src/Chash/Resources/Database/1.10.0/migrate-db-1.9.0-1.10.0-pre.sql
index 8763a2dfdc..abff353517 100644
--- a/vendor/chamilo/chash/src/Chash/Resources/Database/1.10.0/migrate-db-1.9.0-1.10.0-pre.sql
+++ b/vendor/chamilo/chash/src/Chash/Resources/Database/1.10.0/migrate-db-1.9.0-1.10.0-pre.sql
@@ -20,6 +20,7 @@ CREATE TABLE IF NOT EXISTS course_field_options (id int NOT NULL auto_increment,
CREATE TABLE IF NOT EXISTS c_quiz_order( iid bigint unsigned NOT NULL auto_increment, c_id int unsigned NOT NULL, session_id int unsigned NOT NULL, exercise_id int NOT NULL, exercise_order INT NOT NULL, PRIMARY KEY (iid));
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);
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);
+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, user_id int NOT NULL, sent_at datetime NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS gradebook_evaluation_type(id INT unsigned PRIMARY KEY NOT NULL AUTO_INCREMENT, name varchar(255), external_id INT unsigned NOT NULL DEFAULT 0);
CREATE TABLE IF NOT EXISTS question_field (id int NOT NULL auto_increment, field_type int NOT NULL default 1, field_variable varchar(64) NOT NULL, field_display_text varchar(64), field_default_value text, field_order int, field_visible tinyint default 0, field_changeable tinyint default 0, field_filter tinyint default 0, tms DATETIME NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY(id));
CREATE TABLE IF NOT EXISTS question_field_options(id int NOT NULL auto_increment, field_id int NOT NULL, option_value text, option_display_text varchar(255), option_order int, tms DATETIME NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (id));
@@ -42,6 +43,9 @@ CREATE TABLE IF NOT EXISTS branch_transaction (id bigint unsigned not null AUTO_
-- ALTER TABLE c_lp_item ADD INDEX idx_c_lp_item_cid_lp_id (c_id, lp_id);
-- ALTER TABLE c_lp_item_view ADD INDEX idx_c_lp_item_view_cid_lp_view_id_lp_item_id(c_id, lp_view_id, lp_item_id);
+ALTER TABLE c_student_publication ADD COLUMN filename varchar(255) DEFAULT NULL;
+ALTER TABLE course ADD COLUMN add_teachers_to_sessions_courses tinyint NOT NULL default 0;
+
ALTER TABLE c_tool_intro MODIFY COLUMN intro_text MEDIUMTEXT NOT NULL;
ALTER TABLE user MODIFY COLUMN hr_dept_id int unsigned default 0;
ALTER TABLE session MODIFY COLUMN nbr_courses int unsigned NOT NULL default 0;
@@ -152,4 +156,4 @@ INSERT INTO branch_transaction_status VALUES (1, 'To be executed'), (2, 'Execute
UPDATE course_field SET field_type = 3 WHERE field_variable = 'special_course';
-- Do not move this
-UPDATE settings_current SET selected_value = '1.10.0.044' WHERE variable = 'chamilo_database_version';
+UPDATE settings_current SET selected_value = '1.10.0.047' WHERE variable = 'chamilo_database_version';
diff --git a/vendor/chamilo/chash/src/Chash/Resources/Database/1.10.0/update-db-1.9.0-1.10.0.inc.php b/vendor/chamilo/chash/src/Chash/Resources/Database/1.10.0/update-db-1.9.0-1.10.0.inc.php
index 9ab5e68e57..09ec559a3e 100644
--- a/vendor/chamilo/chash/src/Chash/Resources/Database/1.10.0/update-db-1.9.0-1.10.0.inc.php
+++ b/vendor/chamilo/chash/src/Chash/Resources/Database/1.10.0/update-db-1.9.0-1.10.0.inc.php
@@ -70,6 +70,9 @@ $update = function($_configuration, \Doctrine\DBAL\Connection $mainConnection, $
$sql = "SELECT id, code FROM $course_table";
$result = $mainConnection->executeQuery($sql);
$rows = $result->fetchAll();
+
+ $courseSettingtable = "$dbNameForm.c_course_setting";
+
foreach ($rows as $row) {
$courseId = $row['id'];
$courseCode = $row['code'];
@@ -97,6 +100,19 @@ $update = function($_configuration, \Doctrine\DBAL\Connection $mainConnection, $
$sql = "INSERT INTO $accessUrlRelCourseTable (access_url_id, course_code, c_id) VALUES ('1', '$courseCode', '$courseId')";
$mainConnection->executeQuery($sql);
}
+
+ $sql = "SELECT c_id FROM $courseSettingtable WHERE c_id = $courseId WHERE variable = 'show_course_system_documents'";
+ $result = $mainConnection->executeQuery($sql);
+ if ($result->rowCount() == 0) {
+ $mainConnection->executeQuery($sql);
+ $data = array(
+ 'variable' => 'show_course_system_documents',
+ 'c_id' => $courseId,
+ 'category' => 'documents',
+ 'value' => '0'
+ );
+ $mainConnection->insert($courseSettingtable, $data);
+ }
}
// Updating c_quiz_order