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

Added footer extra content (as initially planned instead of header)

Yannick Warnier 13 жил өмнө
parent
commit
98755f6505

+ 14 - 3
main/admin/settings.php

@@ -197,7 +197,7 @@ if (!empty($_GET['category']) && !in_array($_GET['category'], array('Plugins', '
                 }
                 break;
             case 'textarea':            	
-            	if ($row['variable'] == 'header_extra_content') {
+                if ($row['variable'] == 'header_extra_content') {
             		$file = api_get_path(SYS_PATH).api_get_home_path().'header_extra_content';
             		$value = '';
             		if (file_exists($file)) {
@@ -205,6 +205,14 @@ if (!empty($_GET['category']) && !in_array($_GET['category'], array('Plugins', '
             		}
             	    $form->addElement('textarea', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])) , array('rows'=>'10','cols'=>'50'), $hideme);
             	    $default_values[$row['variable']] = $value;            	        
+                } elseif ($row['variable'] == 'footer_extra_content') {
+            		$file = api_get_path(SYS_PATH).api_get_home_path().'footer_extra_content';
+            		$value = '';
+            		if (file_exists($file)) {
+						$value = file_get_contents($file);
+            		}
+            	    $form->addElement('textarea', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])) , array('rows'=>'10','cols'=>'50'), $hideme);
+            	    $default_values[$row['variable']] = $value;            	        
             	} else {
                 	$form->addElement('textarea', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])) , array('rows'=>'10','cols'=>'50'), $hideme);
                 	$default_values[$row['variable']] = $row['selected_value'];
@@ -417,7 +425,10 @@ if (!empty($_GET['category']) && !in_array($_GET['category'], array('Plugins', '
                     		file_put_contents(api_get_path(SYS_PATH).api_get_home_path().'/header_extra_content', $value);                    		
                     		$value = api_get_home_path().'/header_extra_content';
                     		break;
-
+                    	case 'footer_extra_content':
+                    		file_put_contents(api_get_path(SYS_PATH).api_get_home_path().'/footer_extra_content', $value);                    		
+                    		$value = api_get_home_path().'/footer_extra_content';
+                    		break;
                         // URL validation for some settings.
                         case 'InstitutionUrl':
                         case 'course_validation_terms_and_conditions_url':
@@ -583,4 +594,4 @@ if (!empty($_GET['category'])) {
 }
 
 /* FOOTER */
-Display :: display_footer();
+Display :: display_footer();

+ 9 - 1
main/inc/footer.inc.php

@@ -136,6 +136,14 @@ echo '</div>';
 
 
 echo '</div> <!-- end of #footer -->';
+
+if (!api_is_platform_admin()) {
+        $extra_footer = trim(api_get_setting('footer_extra_content'));
+        if (!empty($extra_footer)) {
+                echo $extra_footer;
+        }
+}
+
 /*
 // Test server mode indicator and information for testing purposes.
 if (api_is_platform_admin()) {
@@ -173,4 +181,4 @@ $(document).ready( function() {
 });
 </script>
 </body>
-</html>
+</html>

+ 1 - 1
main/inc/header.inc.php

@@ -214,4 +214,4 @@ if (defined('CHAMILO_HOMEPAGE') && CHAMILO_HOMEPAGE)
 <?php
 
 // Banner
-require_once api_get_path(INCLUDE_PATH).'banner.inc.php';
+require_once api_get_path(INCLUDE_PATH).'banner.inc.php';

+ 7 - 0
main/inc/lib/main_api.lib.php

@@ -1798,6 +1798,13 @@ function api_get_setting($variable, $key = null) {
 	    	return $value ;
     	}
     }
+    if ($variable == 'footer_extra_content') {    	
+    	$filename = api_get_path(SYS_PATH).api_get_home_path().'header_extra_content';
+	    if (file_exists($filename)) {
+	    	$value = file_get_contents($filename);
+	    	return $value ;
+    	}
+    }
     return is_null($key) ? ((isset($_setting[$variable]) && $_setting[$variable] != '') ? $_setting[$variable] : null) : $_setting[$variable][$key];
 }
 

+ 8 - 1
main/inc/lib/template.lib.php

@@ -317,6 +317,13 @@ class Template extends Smarty {
 		
 		//$platform = get_lang('Platform').' <a href="'.$_configuration['software_url'].'" target="_blank">'.$_configuration['software_name'].' '.$_configuration['system_version'].'</a> &copy; '.date('Y');		
 		//$this->assign('platform_name', $platform);
+
+		if (!api_is_platform_admin()) {
+			$extra_footer = trim(api_get_setting('footer_extra_content'));
+			if (!empty($extra_footer)) {				
+				$this->assign('footer_extra_content', $extra_footer);
+			}		
+		}
 		
 		$administrator_data = get_lang('Manager'). ' : '. Display::encrypted_mailto_link(api_get_setting('emailAdministrator'), api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))); 
 		$this->assign('administrator_name', $administrator_data);
@@ -325,4 +332,4 @@ class Template extends Smarty {
 	
 		$this->assign('execution_stats', $stats);		
 	}
-}
+}

+ 2 - 2
main/install/migrate-db-1.8.8-1.9.0-pre.sql

@@ -13,11 +13,11 @@
 -- This first part is for the main database
 
 -- xxMAINxx
-UPDATE settings_current SET selected_value = '1.9.0.15672' WHERE variable = 'chamilo_database_version';
+UPDATE settings_current SET selected_value = '1.9.0.15858' WHERE variable = 'chamilo_database_version';
 
 INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('filter_terms', NULL, 'textarea', 'Security', '', 'FilterTermsTitle', 'FilterTermsComment', NULL, NULL, 0);
 
-INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('header_extra_content', NULL, 'textarea', 'Tracking', '', 'HeaderExtraContentTitle', 'HeaderExtraContentComment', NULL, NULL, 1);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('header_extra_content', NULL, 'textarea', 'Tracking', '', 'HeaderExtraContentTitle', 'HeaderExtraContentComment', NULL, NULL, 1),('footer_extra_content', NULL, 'textarea', 'Tracking', '', 'FooterExtraContentTitle', 'FooterExtraContentComment', NULL, NULL,1);
 
 ALTER TABLE personal_agenda ADD COLUMN all_day INTEGER NOT NULL DEFAULT 0;
 ALTER TABLE sys_calendar ADD COLUMN all_day INTEGER NOT NULL DEFAULT 0;

+ 2 - 2
main/template/default/layout/footer.tpl

@@ -19,7 +19,7 @@
 		<div style="clear:both"></div>
 	</div>
 </div> <!-- end of #footer -->
-
+{$footer_extra_content}
 {literal}
 <script>
 $(document).ready( function() {
@@ -27,4 +27,4 @@ $(document).ready( function() {
 });
 </script>
 {/literal}
-{$execution_stats}
+{$execution_stats}