Пример #1
0
function local_gas_extends_navigation(global_navigation $navigation)
{
    global $DB, $USER, $COURSE, $SESSION;
    $prconfig = $DB->count_records('config_plugins', array('plugin' => 'local_gas'));
    if ($prconfig > 0 && G\isuservalid($USER->id)) {
        $node = $navigation->find('local_gas', navigation_node::TYPE_CONTAINER);
        if (!$node) {
            $node = $navigation->add(get_string('pluginname', 'local_gas'), null, navigation_node::TYPE_CONTAINER, get_string('pluginname', 'local_gas'), 'local_gas');
        }
        $node->add(get_string('generalInfo', 'local_gas'), new moodle_url('/local/gas/index.php'), null, null, "generalInfo");
        if (G\isstudent($USER->id)) {
            $node->add(get_string('assessment', 'local_gas'), new moodle_url('/local/gas/student.php'), null, null, "assessment");
        }
        if (G\isteacher($USER->id)) {
            $node->add(get_string('courseAssessment', 'local_gas'), new moodle_url('/local/gas/teacherassessment.php'), null, null, "courseAssessment");
            $node->add(get_string('courseAssessmentReport', 'local_gas'), new moodle_url('/local/gas/coursereport.php'), null, null, "courseAssessmentReport");
        }
        if (has_capability('local/gas:administrator', context_course::instance($COURSE->id))) {
            $node->add(get_string('attributeManagement', 'local_gas'), new moodle_url('/local/gas/attributemanagement.php'), null, null, "attributeManagement");
        }
    }
}
// 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/>.
//
// Author: Behdad Bakhshinategh!
use GAAT\functions as G;
require_once dirname(__FILE__) . '/lib/functions.php';
require_once dirname(__FILE__) . '/config.php';
require_once dirname(__FILE__) . '/locallib.php';
$displaypage = function () {
    // CHECK And PREPARE DATA.
    global $CFG, $OUTPUT, $SESSION, $PAGE, $DB, $COURSE, $USER;
    // Check if the user accessing the page is instructor.
    if (!G\isteacher($USER->id)) {
        redirect(new moodle_url('/local/gas/index.php'));
    }
    $PAGE->set_pagelayout('report');
    $id = optional_param('id', 0, PARAM_INT);
    // List id.
    require_login(1, false);
    // Use course 1 because this has nothing to do with an actual course, just like course 1.
    $context = context_system::instance();
    $pagetitle = get_string('pluginname', 'local_gas');
    $pageheading = get_string('pluginname', 'local_gas');
    echo local_gas_page('/index.php?id=' . $id, $pagetitle, $pageheading, $context);
    // Code for manualy activing a link in navigator.
    G\makenavigatorlinkactive($PAGE, "courseAssessment");
    echo $OUTPUT->header();
    $initjs = "var formSubmitting = false;\n        var changesHappened = false;\n        var setFormSubmitting = function () {\n            formSubmitting = true;\n        };\n        var setChanges = function () {\n            changesHappened = true;\n        };\n        window.onload = function () {\n            window.addEventListener('beforeunload', function (e) {\n                if (formSubmitting || !changesHappened) {\n                    return undefined;\n                }\n                var confirmationMessage = 'It looks like you have been editing something. '\n                        + 'If you leave before saving, your changes will be lost.';\n                (e || window.event).returnValue = confirmationMessage;\n                return confirmationMessage;\n            });\n        };\n\n        function RefreshChart() {\n            var d = [];\n            var d2 = [];\n            d.push(d2);";