. require_once '../../config.php'; require_once $CFG->dirroot.'/grade/lib.php'; $id = required_param('id', PARAM_INT); // course id if (!$course = get_record('course', 'id', $id)) { print_error('nocourseid'); } require_login($course); $context = get_context_instance(CONTEXT_COURSE, $id); require_capability('moodle/grade:import', $context); print_grade_page_head($course->id, 'import', 'keymanager', get_string('keymanager', 'grades')); $stredit = get_string('edit'); $strdelete = get_string('delete'); $data = array(); if ($keys = get_records_select('user_private_key', "script='grade/import' AND instance={$course->id} AND userid={$USER->id}")) { foreach($keys as $key) { $line = array(); $line[0] = format_string($key->value); $line[1] = $key->iprestriction; $line[2] = empty($key->validuntil) ? get_string('always') : userdate($key->validuntil); $buttons = "id\">pixpath/t/edit.gif\" class=\"iconsmall\" alt=\"$stredit\" /> "; $buttons .= "id&delete=1\">pixpath/t/delete.gif\" class=\"iconsmall\" alt=\"$strdelete\" /> "; $line[3] = $buttons; $data[] = $line; } } $table->head = array(get_string('keyvalue', 'userkey'), get_string('keyiprestriction', 'userkey'), get_string('keyvaliduntil', 'userkey'), $stredit); $table->size = array('50%', '30%', '10%', '10%'); $table->align = array('left', 'left', 'left', 'center'); $table->width = '90%'; $table->data = $data; print_table($table); echo '
'; print_single_button('key.php', array('courseid'=>$course->id), get_string('newuserkey', 'userkey')); echo '
'; print_footer(); ?>