Skip to content
Snippets Groups Projects
Select Git revision
  • ef081d53d560d1adb2671cbe38af3cfc36b58f03
  • master default protected
  • typos
  • development protected
  • ReadMe_Typos
  • example
  • feat/autocomplete-vscode
  • v3.3
  • v3.2
  • v3.1
  • v3.0
  • v2.2
  • v2.1
  • v2.0
  • old-example
  • v1.5
  • v1.4
  • v1.3
  • v1.0
  • v1.1
  • v1.2
21 results

HsH-classes.dtx

Blame
  • locallib.php 22.61 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();
    
    /**
     * Return the files from the loginbackgroundimage file area.
     * 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 array|null
     * @throws coding_exception
     * @throws dml_exception
     */
    function theme_boost_campus_get_loginbackgroundimage_files() {
    
        // Static variable to remember the files for subsequent calls of this function.
        static $files = null;
    
        if ($files == null) {
            // Get the system 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);
        }
    
        return $files;
    }
    
    /**
     * Get the random number for displaying the background image on the login page randomly.
     *
     * @return int|null
     * @throws coding_exception
     * @throws dml_exception
     */
    function theme_boost_campus_get_random_loginbackgroundimage_number() {
    
        // Static variable.
        static $number = null;
    
        if ($number == null) {
            // Get all files for loginbackgroundimages.
            $files = theme_boost_campus_get_loginbackgroundimage_files();