コード例 #1
0
 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
 * @package ILP
 * @version 2.0
 */
require_once '../configpath.php';
global $USER, $CFG, $SESSION, $PARSER, $PAGE;
//include any neccessary files
// Meta includes
require_once $CFG->dirroot . '/blocks/ilp/actions_includes.php';
//get the id of the course that is currently being used
$user_id = $PARSER->required_param('user_id', PARAM_INT);
//get the id of the course that is currently being used
$course_id = $PARSER->optional_param('course_id', NULL, PARAM_INT);
// instantiate the db
$dbc = new ilp_db();
$plpuser = $dbc->get_user_by_id($user_id);
$dashboardurl = $CFG->wwwroot . "/blocks/ilp/actions/view_main.php?user_id={$user_id}&course_id={$course_id}";
$userprofileurl = stripos($CFG->release, "2.") === false ? $CFG->wwwroot . "/user/view.php?id={$user_id}" : $CFG->wwwroot . "/user/profile.php?id={$user_id}";
if ($user_id != $USER->id) {
    if (!empty($access_viewotherilp) && !empty($course_id)) {
        $listurl = "{$CFG->wwwroot}/blocks/ilp/actions/view_studentlist.php?tutor=0&course_id={$course_id}";
    } else {
        $listurl = "{$CFG->wwwroot}/blocks/ilp/actions/view_studentlist.php?tutor=1&course_id=0";
    }
    $PAGE->navbar->add(get_string('ilps', 'block_ilp'), $listurl, 'title');
    $PAGE->navbar->add(get_string('ilpname', 'block_ilp'), $dashboardurl, 'title');
} else {
    $PAGE->navbar->add(get_string('myilp', 'block_ilp'), $dashboardurl, 'title');
}
// setup the navigation breadcrumbs
//user intials
コード例 #2
0
//get the id of the user that is currently being used
$student_id = $PARSER->required_param('student_id', PARAM_INT);
//get the id of the course that is currently being used
$course_id = $PARSER->optional_param('course_id', NULL, PARAM_INT);
//get the selectedtab param if it exists
$selecttedtab = $PARSER->optional_param('selectedtab', NULL, PARAM_RAW);
//get the selectedtab param if it exists
$tabitem = $PARSER->optional_param('tabitem', NULL, PARAM_RAW);
//get the changed status
$ajax = $PARSER->required_param('ajax', PARAM_RAW);
//get the changed status
$status_id = $PARSER->required_param('select_userstatus', PARAM_RAW);
// instantiate the db
$dbc = new ilp_db();
//retreive the user record from the database
$student = $dbc->get_user_by_id($student_id);
if (empty($student)) {
    //trigger error
}
//
$stausitem = $dbc->get_status_item_by_id($status_id);
$userstatus = $dbc->get_user_status($student_id);
$userstatus->user_modified_id = $USER->id;
$userstatus->parent_id = $status_id;
if ($dbc->update_userstatus($userstatus)) {
    if ($ajax == 'false') {
        $return_url = $CFG->wwwroot . '/blocks/ilp/actions/view_main.php?user_id=' . $student_id . '&course_id=' . $course_id . '&tabitem=' . $tabitem . '&selectedtab=' . $selecttedtab;
        redirect($return_url, get_string("stausupdated", 'block_ilp'), ILP_REDIRECT_DELAY);
    } else {
        $userstatuscolor = get_config('block_ilp', 'passcolour');
        if (!empty($statusitem)) {
コード例 #3
0
 $success = $mform->process_data($formdata);
 //if saving the data was not successful
 if (!$success) {
     //print an error message
     print_error('commentcreationerror', 'block_ilp');
 }
 if (!isset($formdata->saveanddisplaybutton)) {
     //notify the user that a comment has been made on one of their report entries
     if ($USER->id != $entry->user_id) {
         $reportsviewtab = $dbc->get_tab_plugin_by_name('ilp_dashboard_reports_tab');
         $reportstaburl = !empty($reportsviewtab) ? "&selectedtab={$reportsviewtab->id}&tabitem={$reportsviewtab->id}:{$report->id}" : "";
         $message = new stdClass();
         $message->component = 'block_ilp';
         $message->name = 'ilp_comment';
         $message->subject = get_string('newreportcomment', 'block_ilp', $report);
         $message->userfrom = $dbc->get_user_by_id($USER->id);
         $message->userto = $dbc->get_user_by_id($entry->user_id);
         $message->fullmessage = get_string('newreportcomment', 'block_ilp', $report);
         $message->fullmessageformat = FORMAT_PLAIN;
         $message->contexturl = $CFG->wwwroot . "/blocks/ilp/actions/view_main.php?user_id={$entry->user_id}{$reportstaburl}";
         $message->contexturlname = get_string('viewreport', 'block_ilp');
         if (stripos($CFG->release, "2.") !== false) {
             message_send($message);
         } else {
             require_once $CFG->dirroot . '/message/lib.php';
             message_post_message($message->userfrom, $message->userto, $message->fullmessage, $message->fullmessageformat, 'direct');
         }
     }
     $return_url = $CFG->wwwroot . "/blocks/ilp/actions/view_main.php?user_id={$user_id}&selectedtab={$selectedtab}&tabitem={$tabitem}&course_id={$course_id}";
     redirect($return_url, get_string("commentcreationsuc", 'block_ilp'), ILP_REDIRECT_DELAY);
 }
コード例 #4
0
//if this is moodle 1.9 then require the moodle 2 emulator
if (stripos($CFG->release, "2.") === false) {
    require_once $CFG->dirroot . '/blocks/ilp/db/moodle2_emulator.php';
}
//include the access checks file
require_once $CFG->dirroot . '/blocks/ilp/db/accesscheck.php';
if ($USER->id != $user_id) {
    //we only require the viewotherilp capabilty id the user is not a ilp admin
    if (empty($access_ilp_admin)) {
        require_capability('block/ilp:viewotherilp', $context);
    }
    if (!empty($course_id)) {
        $currentcoursecontext = get_context_instance(CONTEXT_COURSE, $course_id);
        if ($context == $currentcoursecontext) {
            $dbc = new ilp_db();
            $userenrolled = $dbc->get_user_by_id($user_id);
            //check that the user is enrolled on the current course if not then print error
            $viewilp = true;
            if (stripos($CFG->release, "2.") === false) {
                if (!has_capability('moodle/course:view', $context, $userenrolled->id)) {
                    $viewilp = false;
                }
            } else {
                if (!is_enrolled($context, $userenrolled)) {
                    $viewilp = false;
                }
            }
            if (empty($viewilp)) {
                print_error('usernotenrolled', 'block_ilp');
            }
        }