~ubuntu-branches/ubuntu/jaunty/moodle/jaunty

« back to all changes in this revision

Viewing changes to grade/import/keymanager.php

  • Committer: Bazaar Package Importer
  • Author(s): Jordan Mantha, Matt Oquist
  • Date: 2009-02-25 15:16:22 UTC
  • mfrom: (1.1.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20090225151622-0ekt1liwhv2obfza
Tags: 1.9.4.dfsg-0ubuntu1
* Merge with Debian git (Closes LP: #322961, #239481, #334611):
  - use Ubuntu's smarty lib directory for linking
  - use internal yui library 
  - add update-notifier support back in

[Matt Oquist]
  * renamed prerm script
  * significantly rewrote postinst and other maintainer scripts to improve
    user experience and package maintainability
    (Closes LP: #225662, #325450, #327843, #303078, #234609)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php  //$Id: keymanager.php,v 1.1 2007/09/26 09:42:31 skodak Exp $
 
2
 
 
3
///////////////////////////////////////////////////////////////////////////
 
4
//                                                                       //
 
5
// NOTICE OF COPYRIGHT                                                   //
 
6
//                                                                       //
 
7
// Moodle - Modular Object-Oriented Dynamic Learning Environment         //
 
8
//          http://moodle.com                                            //
 
9
//                                                                       //
 
10
// Copyright (C) 1999 onwards  Martin Dougiamas  http://moodle.com       //
 
11
//                                                                       //
 
12
// This program is free software; you can redistribute it and/or modify  //
 
13
// it under the terms of the GNU General Public License as published by  //
 
14
// the Free Software Foundation; either version 2 of the License, or     //
 
15
// (at your option) any later version.                                   //
 
16
//                                                                       //
 
17
// This program is distributed in the hope that it will be useful,       //
 
18
// but WITHOUT ANY WARRANTY; without even the implied warranty of        //
 
19
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         //
 
20
// GNU General Public License for more details:                          //
 
21
//                                                                       //
 
22
//          http://www.gnu.org/copyleft/gpl.html                         //
 
23
//                                                                       //
 
24
///////////////////////////////////////////////////////////////////////////
 
25
 
 
26
require_once '../../config.php';
 
27
require_once $CFG->dirroot.'/grade/lib.php';
 
28
 
 
29
$id     = required_param('id', PARAM_INT); // course id
 
30
 
 
31
if (!$course = get_record('course', 'id', $id)) {
 
32
    print_error('nocourseid');
 
33
}
 
34
 
 
35
require_login($course);
 
36
$context = get_context_instance(CONTEXT_COURSE, $id);
 
37
 
 
38
require_capability('moodle/grade:import', $context);
 
39
 
 
40
$strgrades = get_string('grades', 'grades');
 
41
$navigation = grade_build_nav(__FILE__, null, array('courseid' => $course->id));
 
42
 
 
43
print_header($course->shortname.': '.get_string('grades'), $course->fullname, $navigation);
 
44
print_grade_plugin_selector($id, '', '');
 
45
 
 
46
$stredit         = get_string('edit');
 
47
$strdelete       = get_string('delete');
 
48
 
 
49
$data = array();
 
50
if ($keys = get_records_select('user_private_key', "script='grade/import' AND instance={$course->id} AND userid={$USER->id}")) {
 
51
    foreach($keys as $key) {
 
52
        $line = array();
 
53
        $line[0] = format_string($key->value);
 
54
        $line[1] = $key->iprestriction;
 
55
        $line[2] = empty($key->validuntil) ? get_string('always') : userdate($key->validuntil);
 
56
 
 
57
        $buttons  = "<a title=\"$stredit\" href=\"key.php?id=$key->id\"><img".
 
58
                    " src=\"$CFG->pixpath/t/edit.gif\" class=\"iconsmall\" alt=\"$stredit\" /></a> ";
 
59
        $buttons .= "<a title=\"$strdelete\" href=\"key.php?id=$key->id&amp;delete=1\"><img".
 
60
                    " src=\"$CFG->pixpath/t/delete.gif\" class=\"iconsmall\" alt=\"$strdelete\" /></a> ";
 
61
 
 
62
        $line[3] = $buttons;
 
63
        $data[] = $line;
 
64
    }
 
65
}
 
66
$table->head  = array(get_string('keyvalue', 'userkey'), get_string('keyiprestriction', 'userkey'), get_string('keyvaliduntil', 'userkey'), $stredit);
 
67
$table->size  = array('50%', '30%', '10%', '10%');
 
68
$table->align = array('left', 'left', 'left', 'center');
 
69
$table->width = '90%';
 
70
$table->data  = $data;
 
71
print_table($table);
 
72
 
 
73
echo '<div class="buttons">';
 
74
print_single_button('key.php', array('courseid'=>$course->id), get_string('newuserkey', 'userkey'));
 
75
echo '</div>';
 
76
 
 
77
print_footer();
 
78
?>