示例#1
0
    /**
     * Set theme, include CSS files
     */
    public function set_css_files()
    {
        global $disable_js_and_css_files;
        $css = array();

        $this->theme = api_get_visual_theme();

        if (!empty($this->preview_theme)) {
            $this->theme = $this->preview_theme;
        }

        //Base CSS
        $css[] = api_get_cdn_path(api_get_path(WEB_CSS_PATH).'base.css');

        //Default CSS responsive design
        $css[] = api_get_cdn_path(api_get_path(WEB_CSS_PATH).'bootstrap-responsive.css');


        //Extra CSS files
        $css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/thickbox.css';
        $css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/chosen/chosen.css';

        if (api_is_global_chat_enabled()) {
            $css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/chat/css/chat.css';
        }

        $css[] = api_get_path(WEB_CSS_PATH).'font_awesome/css/font-awesome.css';
        $css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/mediaelement/mediaelementplayer.css';
        //THEME CSS STYLE
        $css[] = api_get_cdn_path(api_get_path(WEB_CSS_PATH).'responsive.css');
        $css[] = api_get_cdn_path(api_get_path(WEB_CSS_PATH).$this->theme.'/default.css');

        if ($this->show_learnpath) {
            $css[] = api_get_path(WEB_CSS_PATH).$this->theme.'/learnpath.css';

            // if we have a SCORM file in theme, don't use default_scorm.css file
            if (is_file(api_get_path(SYS_CSS_PATH).$this->theme.'/scorm.css')) {
                $css[] = api_get_path(WEB_CSS_PATH).$this->theme.'/scorm.css';
            } else {
                $css[] = api_get_cdn_path(api_get_path(WEB_CSS_PATH).'default_scorm.css');
            }
        }

        $css_file_to_string = null;
        foreach ($css as $file) {
            $css_file_to_string .= api_get_css($file);
        }

        // @todo move this somewhere else. Special fix when using tablets in order to see the text near icons
        if (SHOW_TEXT_NEAR_ICONS == true) {
            //hack in order to fix the actions buttons
            $css_file_to_string .= '<style>
                .td_actions a {
                    float:left;
                    width:100%;
                }
                .forum_message_left a {
                    float:left;
                    width:100%;
                }
                </style>';
        }

        $navigator_info = api_get_navigator();
        if ($navigator_info['name'] == 'Internet Explorer' && $navigator_info['version'] == '6') {
            $css_file_to_string .= 'img, div { behavior: url('.api_get_path(WEB_LIBRARY_PATH).'javascript/iepngfix/iepngfix.htc) } '."\n";
        }

        if (!$disable_js_and_css_files) {
            $this->assign('css_file_to_string', $css_file_to_string);

            $style_print = api_get_css(api_get_cdn_path(api_get_path(WEB_CSS_PATH).$this->theme.'/print.css'), 'print');
            $this->assign('css_style_print', $style_print);
        }

        // Logo
        $logo = return_logo($this->theme);
        $this->assign('logo', $logo);
    }
示例#2
0
 /**
  * Prepare custom CSS to be added at the very end of the <head> section
  * @return void
  * @see setCssFiles() for the mainstream CSS files
  */
 public function setCssCustomFiles()
 {
     global $disable_js_and_css_files;
     // Base CSS
     $css[] = api_get_cdn_path(api_get_path(WEB_CSS_PATH) . 'base.css');
     if ($this->show_learnpath) {
         $css[] = api_get_cdn_path(api_get_path(WEB_CSS_PATH) . 'scorm.css');
         if (is_file(api_get_path(SYS_CSS_PATH) . 'themes/' . $this->theme . '/learnpath.css')) {
             $css[] = api_get_path(WEB_CSS_PATH) . 'themes/' . $this->theme . '/learnpath.css';
         }
     }
     $css[] = api_get_cdn_path(api_get_path(WEB_CSS_PATH) . 'themes/' . $this->theme . '/default.css');
     $css_file_to_string = null;
     foreach ($css as $file) {
         $css_file_to_string .= api_get_css($file);
     }
     // @todo move this somewhere else. Special fix when using tablets in order to see the text near icons
     if (SHOW_TEXT_NEAR_ICONS == true) {
         //hack in order to fix the actions buttons
         $css_file_to_string .= '<style>
             .td_actions a {
                 float:left;
                 width:100%;
             }
             .forum_message_left a {
                 float:left;
                 width:100%;
             }
             </style>';
     }
     $navigator_info = api_get_navigator();
     if ($navigator_info['name'] == 'Internet Explorer' && $navigator_info['version'] == '6') {
         $css_file_to_string .= 'img, div { behavior: url(' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/iepngfix/iepngfix.htc) } ' . "\n";
     }
     if (!$disable_js_and_css_files) {
         $this->assign('css_custom_file_to_string', $css_file_to_string);
         $style_print = '';
         if (is_readable(api_get_path(SYS_CSS_PATH) . $this->theme . '/print.css')) {
             $style_print = api_get_css(api_get_cdn_path(api_get_path(WEB_CSS_PATH) . $this->theme . '/print.css'), 'print');
         }
         $this->assign('css_style_print', $style_print);
     }
     // Logo
     $logo = return_logo($this->theme);
     $this->assign('logo', $logo);
     $this->assign('show_media_element', 1);
 }
示例#3
0
 /**
  * This public function returns the htmlcode for an icon
  *
  * @param string   The filename of the file (in the main/img/ folder
  * @param string   The alt text (probably a language variable)
  * @param array    Additional attributes (for instance height, width, onclick, ...)
  * @param integer  The wanted width of the icon (to be looked for in the corresponding img/icons/ folder)
  * @return string  An HTML string of the right <img> tag
  *
  * @author Patrick Cool <*****@*****.**>, Ghent University 2006
  * @author Julio Montoya 2010 Function improved, adding image constants
  * @author Yannick Warnier 2011 Added size handler
  * @version Feb 2011
  */
 public static function return_icon($image, $alt_text = '', $additional_attributes = array(), $size = ICON_SIZE_SMALL, $show_text = true, $return_only_path = false)
 {
     $code_path = api_get_path(SYS_CODE_PATH);
     $w_code_path = api_get_path(WEB_CODE_PATH);
     $image = trim($image);
     $theme = 'css/' . api_get_visual_theme() . '/icons/';
     $icon = '';
     $size_extra = '';
     if (isset($size)) {
         $size = intval($size);
         $size_extra = $size . '/';
     } else {
         $size = ICON_SIZE_SMALL;
     }
     //Checking the theme icons folder example: main/css/chamilo/icons/XXX
     if (is_file($code_path . $theme . $size_extra . $image)) {
         $icon = $w_code_path . $theme . $size_extra . $image;
     } elseif (is_file($code_path . 'img/icons/' . $size_extra . $image)) {
         //Checking the main/img/icons/XXX/ folder
         $icon = $w_code_path . 'img/icons/' . $size_extra . $image;
     } else {
         //Checking the img/ folder
         $icon = $w_code_path . 'img/' . $image;
     }
     $icon = api_get_cdn_path($icon);
     if ($return_only_path) {
         return $icon;
     }
     $img = self::img($icon, $alt_text, $additional_attributes);
     if (SHOW_TEXT_NEAR_ICONS == true and !empty($alt_text)) {
         if ($show_text) {
             $img = "{$img} {$alt_text}";
         }
     }
     return $img;
 }
示例#4
0
 /**
  * This public function returns the htmlcode for an icon
  *
  * @param string   The filename of the file (in the main/img/ folder
  * @param string   The alt text (probably a language variable)
  * @param array    Additional attributes (for instance height, width, onclick, ...)
  * @param integer  The wanted width of the icon (to be looked for in the corresponding img/icons/ folder)
  * @return string  An HTML string of the right <img> tag
  *
  * @author Patrick Cool <*****@*****.**>, Ghent University 2006
  * @author Julio Montoya 2010 Function improved, adding image constants
  * @author Yannick Warnier 2011 Added size handler
  * @version Feb 2011
  */
 public static function return_icon($image, $alt_text = '', $additional_attributes = array(), $size = ICON_SIZE_SMALL, $show_text = true, $return_only_path = false)
 {
     $code_path = api_get_path(SYS_CODE_PATH);
     $w_code_path = api_get_path(WEB_CODE_PATH);
     $alternateCssPath = api_get_path(SYS_CSS_PATH);
     $alternateWebCssPath = api_get_path(WEB_CSS_PATH);
     $image = trim($image);
     $theme = 'themes/' . api_get_visual_theme() . '/icons/';
     $size_extra = '';
     if (isset($size)) {
         $size = intval($size);
         $size_extra = $size . '/';
     } else {
         $size = ICON_SIZE_SMALL;
     }
     //Checking the theme icons folder example: app/Resources/public/css/themes/chamilo/icons/XXX
     if (is_file($alternateCssPath . $theme . $size_extra . $image)) {
         $icon = $alternateWebCssPath . $theme . $size_extra . $image;
     } elseif (is_file($code_path . 'img/icons/' . $size_extra . $image)) {
         //Checking the main/img/icons/XXX/ folder
         $icon = $w_code_path . 'img/icons/' . $size_extra . $image;
     } else {
         //Checking the img/ folder
         $icon = $w_code_path . 'img/' . $image;
     }
     // Special code to enable SVG - refs #7359 - Needs more work
     // The code below does something else to "test out" SVG: for each icon,
     // 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') {
         $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)) {
             $icon = $w_code_path . 'img/icons/svg/' . $svgImage;
         }
         if (empty($additional_attributes['height'])) {
             $additional_attributes['height'] = $size;
         }
         if (empty($additional_attributes['width'])) {
             $additional_attributes['width'] = $size;
         }
     }
     $icon = api_get_cdn_path($icon);
     if ($return_only_path) {
         return $icon;
     }
     $img = self::img($icon, $alt_text, $additional_attributes);
     if (SHOW_TEXT_NEAR_ICONS == true and !empty($alt_text)) {
         if ($show_text) {
             $img = "{$img} {$alt_text}";
         }
     }
     return $img;
 }
示例#5
0
 /**
  * Set theme, include CSS files
  */
 private function setCssFiles()
 {
     $css = array();
     $this->theme = api_get_visual_theme();
     if (isset($_POST['style']) && api_is_platform_admin()) {
         $this->preview_theme = $_POST['style'];
     }
     if (!empty($this->preview_theme)) {
         $this->theme = $this->preview_theme;
     }
     $this->app['theme'] = $this->theme;
     $cssPath = api_get_path(WEB_CSS_PATH);
     $webLibraryPath = api_get_path(WEB_LIBRARY_JS_PATH);
     // Loads only 1 css file
     if ($this->app['assetic.enabled']) {
         $css[] = $cssPath . 'themes/' . $this->theme . '/style.css';
     } else {
         // Bootstrap
         //api_get_path(WEB_LIBRARY_JS_PATH).
         $css[] = $webLibraryPath . 'bootstrap/css/bootstrap.css';
         // Base CSS.
         $css[] = $cssPath . 'base.css';
         // Extra CSS files.
         if ($this->show_learnpath) {
             //$css[] = $cssPath.$this->theme.'/learnpath.css';
             //$css[] = $cssPath.$this->theme.'/scorm.css';
         }
         if (api_is_global_chat_enabled()) {
             $css[] = $webLibraryPath . 'chat/css/chat.css';
         }
         $css[] = $webLibraryPath . 'jquery-ui/css/' . $this->jquery_ui_theme . '/jquery-ui-custom.css';
     }
     $css[] = $webLibraryPath . 'font-awesome/css/font-awesome.css';
     $css[] = $webLibraryPath . 'thickbox.css';
     $css[] = $webLibraryPath . 'pace/pace.css';
     $css[] = $webLibraryPath . 'chosen/chosen.css';
     $css[] = $webLibraryPath . 'tag/style.css';
     // Default theme CSS.
     $css[] = api_get_cdn_path($cssPath . 'themes/' . $this->theme . '/default.css');
     $this->addResource($css, 'css');
     if (!$this->disableJsAndCss) {
         $style = api_get_css(api_get_cdn_path($cssPath . 'themes/' . $this->theme . '/print.css'), 'print');
         $this->addResource($style, 'no_js_css');
     }
 }
 /**
  * Set theme, include CSS files
  */
 private function setCssFiles()
 {
     global $disable_js_and_css_files;
     $css = array();
     $this->theme = api_get_visual_theme();
     if (isset($_POST['style']) && api_is_platform_admin()) {
         $this->preview_theme = $_POST['style'];
     }
     if (!empty($this->preview_theme)) {
         $this->theme = $this->preview_theme;
     }
     $this->app['theme'] = $this->theme;
     $cssPath = api_get_path(WEB_CSS_PATH);
     // Loads only 1 css file
     if ($this->app['assetic.enabled']) {
         $css[] = api_get_path(WEB_PUBLIC_PATH) . 'css/' . $this->theme . '/style.css';
     } else {
         // Bootstrap
         $css[] = api_get_cdn_path(api_get_path(WEB_LIBRARY_PATH) . 'javascript/bootstrap/css/bootstrap.css');
         //$css[] = api_get_cdn_path(api_get_path(WEB_LIBRARY_PATH).'javascript/bootstrap/css/bootstrap-theme.css');
         // Base CSS.
         $css[] = api_get_cdn_path($cssPath . 'base.css');
         // Default theme CSS.
         $css[] = api_get_cdn_path($cssPath . $this->theme . '/default.css');
         // Extra CSS files.
         if ($this->show_learnpath) {
             //$css[] = $cssPath.$this->theme.'/learnpath.css';
             //$css[] = $cssPath.$this->theme.'/scorm.css';
         }
         if (api_is_global_chat_enabled()) {
             $css[] = api_get_path(WEB_LIBRARY_PATH) . 'javascript/chat/css/chat.css';
         }
         $css[] = api_get_path(WEB_LIBRARY_PATH) . 'javascript/jquery-ui/css/' . $this->jquery_ui_theme . '/jquery-ui-custom.css';
         //$css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-ui/default.css';
     }
     $css[] = api_get_path(WEB_LIBRARY_PATH) . 'javascript/font-awesome/css/font-awesome.css';
     $css[] = api_get_path(WEB_LIBRARY_PATH) . 'javascript/thickbox.css';
     $css[] = api_get_path(WEB_LIBRARY_PATH) . 'javascript/chosen/chosen.css';
     $css_file_to_string = null;
     foreach ($css as $file) {
         $css_file_to_string .= api_get_css($file);
     }
     // @todo move this somewhere else. Special fix when using tablets in order to see the text near icons
     if (SHOW_TEXT_NEAR_ICONS == true) {
         //hack in order to fix the actions buttons
         $css_file_to_string .= '<style>
             .td_actions a {
                 float:left;
                 width:100%;
             }
             .forum_message_left a {
                 float:left;
                 width:100%;
             }
             </style>';
     }
     $navigator_info = api_get_navigator();
     if ($navigator_info['name'] == 'Internet Explorer' && $navigator_info['version'] == '6') {
         $css_file_to_string .= 'img, div { behavior: url(' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/iepngfix/iepngfix.htc) } ' . "\n";
     }
     if (!$disable_js_and_css_files) {
         $this->assign('css_file_to_string', $css_file_to_string);
         $style_print = api_get_css(api_get_cdn_path($cssPath . $this->theme . '/print.css'), 'print');
         $this->assign('css_style_print', $style_print);
     }
 }