Эх сурвалжийг харах

Minor - Fixed language variable name in assignments

Yannick Warnier 8 жил өмнө
parent
commit
7d38be5584

+ 39 - 0
app/Migrations/Schema/V111/Version20160712150000.php

@@ -0,0 +1,39 @@
+<?php
+/* For licensing terms, see /license.txt */
+
+namespace Application\Migrations\Schema\V111;
+
+use Application\Migrations\AbstractMigrationChamilo;
+use Doctrine\DBAL\Schema\Schema;
+use Doctrine\DBAL\Types\Type;
+
+/**
+ * Class Version20160712150000
+ * Add option to use SVG icons instead of their PNG version
+ * @package Application\Migrations\Schema\V111
+ */
+class Version20160712150000 extends AbstractMigrationChamilo
+{
+    /**
+     * @param Schema $schema
+     * @throws \Doctrine\DBAL\DBALException
+     * @throws \Doctrine\DBAL\Schema\SchemaException
+     */
+    public function up(Schema $schema)
+    {
+        $this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('icons_mode_svg', NULL, 'radio', 'Tuning', 'false', 'IconsModeSVGTitle','IconsModeSVGComment','',NULL, 1)");
+        $this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('icons_mode_svg','true','Yes') ");
+        $this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('icons_mode_svg','false','No') ");
+    }
+
+    /**
+     * @param Schema $schema
+     * @throws \Doctrine\DBAL\DBALException
+     * @throws \Doctrine\DBAL\Schema\SchemaException
+     */
+    public function down(Schema $schema)
+    {
+        $this->addSql("DELETE FROM settings_current WHERE variable = 'icons_mode_svg'");
+        $this->addSql("DELETE FROM settings_options WHERE variable = 'icons_mode_svg'");
+    }
+}

+ 4 - 5
main/inc/lib/display.lib.php

@@ -777,10 +777,9 @@ class Display
         // it checks if there is an SVG version. If so, it uses it.
         // When moving this to production, the return_icon() calls should
         // ask for the SVG version directly
-        $testServer = api_get_setting('server_type');
-        if ($testServer == 'test' && $return_only_path == false) {
-            // if you want to uncomment this add a setting
-            /*$svgImage = substr($image, 0, -3) . 'svg';
+        $svgIcons = api_get_setting('icons_mode_svg');
+        if ($svgIcons == 'true' && $return_only_path == false) {
+            $svgImage = substr($image, 0, -3) . 'svg';
             if (is_file($code_path . $theme . 'svg/' . $svgImage)) {
                 $icon = $w_code_path . $theme . 'svg/' . $svgImage;
             } elseif (is_file($code_path . 'img/icons/svg/' . $svgImage)) {
@@ -792,7 +791,7 @@ class Display
             }
             if (empty($additional_attributes['width'])) {
                 $additional_attributes['width'] = $size;
-            }*/
+            }
         }
 
         $icon = api_get_cdn_path($icon);

+ 6 - 0
main/install/data.sql

@@ -1889,3 +1889,9 @@ INSERT INTO access_url_rel_course_category (access_url_id, course_category_id) V
 UPDATE settings_current SET selected_value = '1.11.0.5' WHERE variable = 'chamilo_database_version';
 
 INSERT INTO extra_field (extra_field_type, field_type, variable, display_text, visible, changeable, created_at) VALUES (8, 10, 'tags', 'Tags', 1, 1, NOW());
+
+UPDATE settings_current SET selected_value = '1.11.0.6' WHERE variable = 'chamilo_database_version';
+
+INSERT INTO settings_current (variable, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('icons_mode_svg', NULL, 'radio', 'Tuning', 'false', 'IconsModeSVGTitle', 'IconsModeSVGComment', '', NULL, 1);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('icons_mode_svg', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('icons_mode_svg', 'false', 'No');