Skip to content
Snippets Groups Projects
Select Git revision
  • 3aac17f48d3c1ca8adcab9be206b94f074e7b4cc
  • master default protected
  • hsh_v3.11
  • hsh_v3.10-r6
  • hsh_v3.10-r3
  • v3.9-r9
  • v3.10-r6
  • v3.9-r8
  • v3.10-r5
  • v3.9-r7
  • v3.10-r4
  • v3.9-r6
  • v3.10-r3
  • v3.9-r5
  • v3.10-r2
  • v3.9-r4
  • v3.10-r1
  • v3.9-r3
  • v3.9-r2
  • v3.9-r1
  • v3.8-r5
  • v3.8-r4
  • v3.8-r3
  • v3.8-r2
  • v3.8-r1
25 results

post.scss

  • locallib.php 16.93 KiB
    <?php
    // This file is part of Moodle - http://moodle.org/
    //
    // Moodle is free software: you can redistribute it and/or modify
    // it under the terms of the GNU General Public License as published by
    // the Free Software Foundation, either version 3 of the License, or
    // (at your option) any later version.
    //
    // Moodle is distributed in the hope that it will be useful,
    // but WITHOUT ANY WARRANTY; without even the implied warranty of
    // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    // GNU General Public License for more details.
    //
    // You should have received a copy of the GNU General Public License
    // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
    /**
     * Theme Boost Campus - Locallib file
     *
     * @package   theme_boost_campus
     * @copyright 2017 Kathrin Osswald, Ulm University kathrin.osswald@uni-ulm.de
     * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
     */
    
     defined('MOODLE_INTERNAL') || die();
    
    
    /**
     * Get a random class for body tag for the background image of the login page.
     * This function always loads the files from the filearea that is not really performant.
     * However, we accept this at the moment as it is only invoked on the login page.
     *
     * @return string
     */
    function theme_boost_campus_get_random_loginbackgroundimage_class() {
    
        // Fetch context.
        $systemcontext = \context_system::instance();
    
        // Get filearea.
        $fs = get_file_storage();
    
        // Get all files from filearea.
        $files = $fs->get_area_files($systemcontext->id, 'theme_boost_campus', 'loginbackgroundimage', false, 'itemid', false);
    
        // Get count of array elements.
        $filecount = count($files);
    
        /* We only add this class to the body background of the login page if images are uploaded at all (filearea contains images). */
        if ($filecount > 0) {
            // Generate random number.
            $randomindex = rand(1, $filecount);
            return "loginbackgroundimage" . $randomindex;
        } else {
            return "";
        }
    }
    
    
    /**
     * Add background images from setting 'loginbackgroundimage' to SCSS.
     *
     * @return string
     */
    function theme_boost_campus_get_loginbackgroundimage_scss() {
        $count = 0;
        $scss = "";
    
        // Fetch context.
        $systemcontext = \context_system::instance();