Selaa lähdekoodia

Adding the header logo in the template instead of PHP

Julio Montoya 11 vuotta sitten
vanhempi
commit
4b04d193f2

+ 22 - 31
main/inc/lib/template.lib.php

@@ -44,14 +44,15 @@ class Template
         $this->app['classic_layout'] = true;
         $this->navigation_array = $this->returnNavigationArray();
 
-        //just in case
+        // Just in case
         global $tool_name;
 
-        //Page title
+        // Page title
         $this->title = isset($app['title']) ? $app['title'] : $tool_name;
         $this->show_learnpath = $app['template.show_learnpath'];
 
-        // Current themes: cupertino, smoothness, ui-lightness. Find the themes folder in main/inc/lib/javascript/jquery-ui
+        /* Current themes: cupertino, smoothness, ui-lightness.
+           Find the themes folder in main/inc/lib/javascript/jquery-ui */
         $this->jquery_ui_theme = 'smoothness';
 
         //Setting system variables
@@ -80,7 +81,6 @@ class Template
 
         //header and footer are showed by default
         $this->setFooter($app['template.show_footer']);
-
         $this->setHeader($app['template.show_header']);
 
         $this->setHeaderParameters();
@@ -339,7 +339,7 @@ class Template
 
     /**
      * Set theme, include CSS files  */
-    private function set_css_files()
+    private function setCssFiles()
     {
         global $disable_js_and_css_files;
         $css = array();
@@ -350,6 +350,8 @@ class Template
             $this->theme = $this->preview_theme;
         }
 
+        $this->app['theme'] = $this->theme;
+
         $cssPath = api_get_path(WEB_CSS_PATH);
 
         //Base CSS
@@ -414,14 +416,14 @@ class Template
         }
 
         // Logo
-        $logo = $this->returnLogo($this->theme);
-        $this->assign('logo', $logo);
+        /*$logo = $this->returnLogo($this->theme);
+        $this->assign('logo', $logo);*/
     }
 
     /**
      *
      */
-    private function set_js_files()
+    private function setJsFiles()
     {
         global $disable_js_and_css_files, $htmlHeadXtra;
         //JS files
@@ -534,8 +536,8 @@ class Template
         $this->assign('title_string', $title_string);
 
         //Setting the theme and CSS files
-        $this->set_css_files();
-        $this->set_js_files();
+        $this->setCSSFiles();
+        $this->setJsFiles();
 
         // Implementation of prefetch.
         // See http://cdn.chamilo.org/main/img/online.png for details
@@ -841,7 +843,7 @@ class Template
         return $menu;
     }
 
-    function returnNavigationLinks()
+    public function returnNavigationLinks()
     {
         $html = '';
 
@@ -866,7 +868,7 @@ class Template
         return $html;
     }
 
-    function render_layout($layout = null)
+    public function render_layout($layout = null)
     {
         if (empty($layout)) {
             $layout = $this->app['default_layout'];
@@ -874,7 +876,7 @@ class Template
         return $this->app['twig']->render($this->app['template_style'].'/layout/'.$layout);
     }
 
-    function render_template($template, $elements = array())
+    public function render_template($template, $elements = array())
     {
         return $this->app['twig']->render($this->app['template_style'].'/'.$template, $elements);
     }
@@ -979,7 +981,12 @@ class Template
         return $navigation;
     }
 
-    function returnLogo($theme)
+    /**
+     * @param string $theme
+     * @deprecated the logo is wrote in the main_header.tpl file
+     * @return string
+     */
+    public function returnLogo($theme)
     {
         $_course = api_get_course_info();
         $html = '';
@@ -1014,25 +1021,10 @@ class Template
             }
         }
 
-        /* //  Course title section
-         if (!empty($_cid) and $_cid != -1 and isset($_course)) {
-             //Put the name of the course in the header
-             $html .= '<div id="my_courses">';
-             $html .= '</div>';
-         } elseif (isset($nameTools) && $language_file != 'course_home') {
-             //Put the name of the user-tools in the header
-             if (!isset($user_id)) {
-                 //echo '<div id="my_courses"></div>';
-             } elseif (!$noPHP_SELF) {
-                 $html .= '<div id="my_courses"><a href="'.api_get_self().'?'.api_get_cidreq(). '" target="_top">'.$nameTools.'</a></div>';
-             } else {
-                 $html .= '<div id="my_courses">'.$nameTools.'</div>';
-             }
-         }*/
         return $html;
     }
 
-    function returnNotificationMenu()
+    public function returnNotificationMenu()
     {
         $_course = api_get_course_info();
         $course_id = api_get_course_id();
@@ -1250,7 +1242,6 @@ class Template
 
     /**
      * Return breadcrumb
-     * @param array $interbreadcrumb
      * @return string
      */
     public function returnBreadcrumb()

+ 7 - 1
main/template/default/layout/main_header.tpl

@@ -51,7 +51,12 @@
                 <div class="row">
                     <div id="header_left" class="span4">
                         {# logo #}
-                        {{ logo }}
+
+                        <div id="logo">
+                            <a href="{{ _p.web }}">
+                                <img title="{{ "siteName" | get_setting }}" src="{{ _p.web_css }}/{{ app.theme }}/images/header-logo.png" />
+                            </a>
+                        </div>
 
                         {# plugin_header left #}
                         {% if plugin_header_left is not null %}
@@ -60,6 +65,7 @@
                             </div>
                         {% endif %}
                     </div>
+
                     <div id="header_center" class="span3">
                         {# plugin_header center #}
                         {% if plugin_header_center is not null %}

+ 0 - 1
main/template/default/layout/menu.tpl

@@ -39,7 +39,6 @@
                                 {{ message_link }}
                             </li>
                         </ul>
-
                     <li>
                         <a id="logout_button" class="logout" title="{{ "Logout"|get_lang }}" href="{{ logout_link }}" >
                             <img src="{{ "exit.png"|icon(22) }}">