Add select_course type for settings_current and set it to the course_creation_use_template - refs #8133

ofaj
Angel Fernando Quiroz Campos 10 years ago
parent 992bcacb0a
commit 47a2dcab16
  1. 32
      app/Migrations/Schema/V111/Version20160315155700.php
  2. 19
      main/admin/settings.lib.php
  3. 2
      main/install/data.sql

@ -0,0 +1,32 @@
<?php
/* For licensing terms, see /license.txt */
namespace Application\Migrations\Schema\V111;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Class Version20160315155700
* Change type of the course_creation_use_template setting
*/
class Version20160315155700 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function up(Schema $schema)
{
$this->addSql("UPDATE settings_current SET type = 'select_course' WHERE variable = 'course_creation_use_template'");
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
}
}

@ -1167,6 +1167,7 @@ function update_gradebook_score_display_custom_values($values) {
function generate_settings_form($settings, $settings_by_access_list)
{
global $_configuration, $settings_to_avoid, $convert_byte_to_mega_list;
$em = Database::getManager();
$table_settings_current = Database :: get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
$form = new FormValidator('settings', 'post', 'settings.php?category='.Security::remove_XSS($_GET['category']));
@ -1416,6 +1417,24 @@ function generate_settings_form($settings, $settings_by_access_list)
break;
case 'custom':
break;
case 'select_course':
$courseSelect = $form->addElement(
'select_ajax',
$row['variable'],
[
get_lang($row['title']),
get_lang($row['comment']),
],
null,
['url' => api_get_path(WEB_AJAX_PATH) . 'course.ajax.php?a=search_course']
);
if (!empty($row['selected_value'])) {
$course = $em->find('ChamiloCoreBundle:Course', $row['selected_value']);
$courseSelect->addOption($course->getTitle(), $course->getCode(), ['selected' => 'selected']);
}
break;
}
switch ($row['variable']) {

@ -1632,7 +1632,7 @@ INSERT INTO settings_current
VALUES
('hide_home_top_when_connected', '', 'radio', 'Platform', 'false', 'HideHomeTopContentWhenLoggedInText', 'HideHomeTopContentWhenLoggedInComment', NULL, '', true),
('hide_global_announcements_when_not_connected','','radio','Platform','false', 'HideGlobalAnnouncementsWhenNotLoggedInText','HideGlobalAnnouncementsWhenNotLoggedInComment',NULL,'', true),
('course_creation_use_template','','textfield','Course','','CourseCreationUsesTemplateText','CourseCreationUsesTemplateComment',NULL,'',true),
('course_creation_use_template','','select_course','Course','','CourseCreationUsesTemplateText','CourseCreationUsesTemplateComment',NULL,'',true),
('allow_strength_pass_checker','','radio','Security','true','EnablePasswordStrengthCheckerText','EnablePasswordStrengthCheckerComment',NULL,'',true),
('allow_captcha','','radio','Security','false','EnableCaptchaText','EnableCaptchaComment',NULL,'',true),
('captcha_number_mistakes_to_block_account','','textfield','Security',5,'CaptchaNumberOfMistakesBeforeBlockingAccountText','CaptchaNumberOfMistakesBeforeBlockingAccountComment',NULL,'',true),

Loading…
Cancel
Save