Beispiel #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 this page is student.
    if (!G\isstudent($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);
    // This part added as the highlighting of the navigators was not working.
    G\makenavigatorlinkactive($PAGE, "assessment");
    echo $OUTPUT->header();
    // NextCourse: function to change the course in "Contributed Courses" Coloumn