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

/**
 * Class for loading/storing related competencies from the DB.
 *
 * @package    core_competency
 * @copyright  2015 David Monllao
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
namespace core_competency;
defined('MOODLE_INTERNAL') || die();

use lang_string;
use stdClass;

/**
 * Class for loading/storing related_competencies from the DB.
 *
 * @package    core_competency
 * @copyright  2015 David Monllao
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
class related_competency extends persistent {

    const TABLE = 'competency_relatedcomp';

    /**
     * Return the definition of the properties of this model.
     *
     * @return array
     */
    protected static function define_properties() {
        return array(
            'competencyid' => array(
                'type' => PARAM_INT
            ),
            'relatedcompetencyid' => array(
                'type' => PARAM_INT
            ),
        );
    }

    /**
     * Validate competency ID.
     *
     * @param int $data The competency ID.
     * @return true|lang_string
     */
    protected function validate_competencyid($data) {
        if (!competency::record_exists($data)) {
            return new lang_string('invaliddata', 'error');
        }
        return true;
    }

    /**
     * Validate related competency ID.
     *
     * @param int $data The related competency ID.
     * @return true|lang_string
     */
    protected function validate_relatedcompetencyid($data) {

        if ($this->get('competencyid') == $data) {
            // A competency cannot be related to itself.
            return new lang_string('invaliddata', 'error');

        } if ($this->get('competencyid') > $data) {
            // The competency ID must be lower than the related competency ID.
            return new lang_string('invaliddata', 'error');

        } else if (!competency::record_exists($data)) {
            return new lang_string('invaliddata', 'error');

        } else if (!competency::share_same_framework(array($data, $this->get('competencyid')))) {
            // The competencies must belong to the same framework.
            return new lang_string('invaliddata', 'error');
        }

        return true;
    }

    /**
     * Get relation specifying both competencies.
     *
     * This does not perform any validation on the data passed. If the relation exists in the database
     * then it is loaded in a the model, if not then it is up to the developer to save the model.
     *
     * @param int $competencyid
     * @param int $relatedcompetencyid
     * @return related_competency
     */
    public static function get_relation($competencyid, $relatedcompetencyid) {
        global $DB;

        // Lower id always as competencyid so we know which one is competencyid and which one relatedcompetencyid.
        $relation = new static();
        if ($competencyid > $relatedcompetencyid) {
            $relation->set('competencyid', $relatedcompetencyid);
            $relation->set('relatedcompetencyid', $competencyid);
        } else {
            $relation->set('competencyid', $competencyid);
            $relation->set('relatedcompetencyid', $relatedcompetencyid);
        }

        // We can do it because we have bidirectional relations in the DB.
        $params = array(
            'competencyid' => $relation->get('competencyid'),
            'relatedcompetencyid' => $relation->get('relatedcompetencyid')
        );
        if ($record = $DB->get_record(self::TABLE, $params)) {
            $relation->from_record($record);
        }

        return $relation;
    }

    /**
     * Get the competencies related to a competency.
     *
     * @param  int $competencyid The competency ID.
     * @return competency[]
     */
    public static function get_related_competencies($competencyid) {
        global $DB;

        $fields = competency::get_sql_fields('c', 'c_');
        $sql = "(SELECT $fields, " . $DB->sql_concat('rc.relatedcompetencyid', "'_'", 'rc.competencyid') . " AS rid
                   FROM {" . self::TABLE . "} rc
                   JOIN {" . competency::TABLE . "} c
                     ON c.id = rc.relatedcompetencyid
                  WHERE rc.competencyid = :cid)
              UNION ALL
                (SELECT $fields, " . $DB->sql_concat('rc.competencyid', "'_'", 'rc.relatedcompetencyid') . " AS rid
                   FROM {" . self::TABLE . "} rc
                   JOIN {" . competency::TABLE . "} c
                     ON c.id = rc.competencyid
                  WHERE rc.relatedcompetencyid = :cid2)
               ORDER BY c_path ASC, c_sortorder ASC";

        $competencies = array();
        $records = $DB->get_recordset_sql($sql, array('cid' => $competencyid, 'cid2' => $competencyid));
        foreach ($records as $record) {
            unset($record->rid);
            $competencies[$record->c_id] = new competency(null, competency::extract_record($record, 'c_'));
        }
        $records->close();

        return $competencies;
    }

    /**
     * Get the related competencies from competency ids.
     *
     * @param  int[] $competencyids Array of competency ids.
     * @return related_competency[]
     */
    public static function get_multiple_relations($competencyids) {
        global $DB;

        if (empty($competencyids)) {
            return array();
        }

        list($insql, $params) = $DB->get_in_or_equal($competencyids);

        $records = $DB->get_records_select(self::TABLE,
                                            "competencyid $insql OR relatedcompetencyid $insql",
                                            array_merge($params, $params)
                                            );

        $relatedcompetencies = array();
        foreach ($records as $record) {
            unset($record->id);
            $relatedcompetencies[] = new related_competency(null, $record);
        }
        return $relatedcompetencies;
    }

    /**
     * Delete relations using competencies.
     *
     * @param array $competencyids Array of competencies ids.
     * @return bool True if relations were deleted successfully.
     */
    public static function delete_multiple_relations($competencyids) {
        global $DB;
        if (empty($competencyids)) {
            return true;
        }

        list($insql, $params) = $DB->get_in_or_equal($competencyids);
        return $DB->delete_records_select(self::TABLE,
                                            "competencyid $insql OR relatedcompetencyid $insql",
                                            array_merge($params, $params)
                                            );
    }

}

Filemanager

Name Type Size Permission Actions
external Folder 0777
privacy Folder 0777
reportbuilder Folder 0777
api.php File 205.32 KB 0777
competency.php File 27.8 KB 0777
competency_framework.php File 15.8 KB 0777
competency_rule.php File 3.03 KB 0777
competency_rule_all.php File 2.77 KB 0777
competency_rule_points.php File 6.65 KB 0777
course_competency.php File 13.76 KB 0777
course_competency_settings.php File 3.92 KB 0777
course_module_competency.php File 10.5 KB 0777
evidence.php File 10.28 KB 0777
external.php File 134.71 KB 0777
persistent.php File 1.85 KB 0777
plan.php File 21.52 KB 0777
plan_competency.php File 5.36 KB 0777
related_competency.php File 7.23 KB 0777
template.php File 5.72 KB 0777
template_cohort.php File 8.04 KB 0777
template_competency.php File 8.83 KB 0777
url.php File 6.07 KB 0777
user_competency.php File 16.48 KB 0777
user_competency_course.php File 9.13 KB 0777
user_competency_plan.php File 11.74 KB 0777
user_evidence.php File 5.66 KB 0777
user_evidence_competency.php File 5.38 KB 0777
Filemanager