__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

www-data@216.73.216.10: ~ $
// 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/>.

/**
 * Select course categories for LTI tool.
 *
 * @module     mod_lti/coursecategory
 * @copyright  2023 Jackson D'souza <jackson.dsouza@catalyst-eu.net>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 * @since      4.3
 */

define([], function() {

    document.addEventListener('click', event => {
        const checkedbox = event.target.closest(".lticoursecategories");

        if (checkedbox) {
            // Get checkbox status.
            const checkboxstatus = checkedbox.checked;

            // Check / Uncheck all child category checkboxes based on selected checkbox status.
            const categorycontainer = document.querySelector('#collapse' + checkedbox.value);
            if (categorycontainer) {
                const categorycontainercheckbox = categorycontainer.querySelectorAll('input[type="checkbox"]');
                for (let i = 0; i < categorycontainercheckbox.length; i++) {
                    categorycontainercheckbox[i].checked = checkboxstatus;
                }
            }

            const lticategorytree = document.querySelector('.modltitree');
            const ltitreecheckbox = lticategorytree.querySelectorAll('input[type="checkbox"]');
            let listvalue = '';
            for (let i = 0; i < ltitreecheckbox.length; i++) {
                if (ltitreecheckbox[i].checked) {
                    if (listvalue.length == 0) {
                        listvalue = ltitreecheckbox[i].value;
                    } else {
                        listvalue = listvalue + ',' + ltitreecheckbox[i].value;
                    }
                }
            }
            document.querySelector('input[name="lti_coursecategories"]').value = listvalue;
        }
    });

    /**
     * Get parent elements with class = accordion.
     *
     * @method getParents
     * @private
     * @param {string} elem DOM element.
     * @return {array} Parent elements.
     */
    function getParents(elem) {
        // Set up a parent array
        const parents = [];

        // Push each parent element to the array
        for (; elem && elem !== document; elem = elem.parentNode) {
            if (elem.classList.contains('accordion-group')) {
                parents.push(elem);
            }
        }

        // Return our parent array
        return parents;
    }

    return /** @alias module:mod_lti/coursecategory */ {

        /**
         * Initialise this module.
         * Loop through checkbox form elements starting with #cat-{N} and set it to checked
         * if {N} is found in the Selected category(s) list. Show / Hide the parent UL element.
         *
         * @param {string} selectedcategories Selected category(s).
         */
        init: function(selectedcategories) {
            if (selectedcategories.length) {
                const separator = ",";
                const values = selectedcategories.split(separator);

                for (let i = 0; i < values.length; i++) {
                    const categoryid = document.getElementById("cat-" + values[i]);
                    if (categoryid.value !== 0) {
                        categoryid.checked = true;
                    }
                    const parents = getParents(categoryid);
                    parents.forEach(function(element) {
                        const elem = element.querySelector('a.accordion-toggle');
                        const elembody = element.querySelector('.accordion-body');

                        if (elem && elem.classList.contains('collapsed')) {
                            elem.classList.remove('collapsed');
                        }
                        if (elembody) {
                            elembody.classList.remove('collapse');
                            elembody.classList.add('show');
                        }
                    });
                }
            }
        }
    };
});

Filemanager

Name Type Size Permission Actions
cartridge_registration_form.js File 6.5 KB 0777
contentitem.js File 10.78 KB 0777
contentitem_return.js File 1.57 KB 0777
course_tools_list.js File 4.12 KB 0777
coursecategory.js File 4.48 KB 0777
events.js File 1.54 KB 0777
external_registration.js File 21.92 KB 0777
external_registration_return.js File 2.05 KB 0777
form-field.js File 4.16 KB 0777
keys.js File 1.05 KB 0777
mod_form.js File 2.99 KB 0777
repository.js File 1.39 KB 0777
tool_card_controller.js File 22.95 KB 0777
tool_configure_controller.js File 16.22 KB 0777
tool_proxy.js File 2.88 KB 0777
tool_proxy_card_controller.js File 9.09 KB 0777
tool_type.js File 4.68 KB 0777
tool_types_and_proxies.js File 2.02 KB 0777
Filemanager