File: edit.php

package info (click to toggle)
moodle 1.6.3-2%2Betch3
  • links: PTS
  • area: main
  • in suites: etch
  • size: 37,172 kB
  • ctags: 51,688
  • sloc: php: 231,916; sql: 5,631; xml: 2,688; sh: 1,185; perl: 638; makefile: 48; pascal: 36
file content (78 lines) | stat: -rw-r--r-- 2,728 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php // $Id: edit.php,v 1.6 2006/03/07 23:51:21 skodak Exp $
/**
* Page to edit the question bank
*
* TODO: add logging
*
* @version $Id: edit.php,v 1.6 2006/03/07 23:51:21 skodak Exp $
* @author Martin Dougiamas and many others. This has recently been extensively
*         rewritten by Gustav Delius and other members of the Serving Mathematics project
*         {@link http://maths.york.ac.uk/serving_maths}
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package question
*/
    require_once("../config.php");
    require_once("editlib.php");

    require_login();

    $courseid  = required_param('courseid', PARAM_INT);

    // The optional parameter 'clean' allows us to clear module information,
    // guaranteeing a module-independent  question bank editing interface
    if (optional_param('clean', false, PARAM_BOOL)) {
        unset($SESSION->modform);
    }

    if (! $course = get_record("course", "id", $courseid)) {
        error("This course doesn't exist");
    }

    require_login($course->id, false);

    if (!isteacheredit($course->id)) {
        error("You can't modify this course!");
    }
    
    $SESSION->returnurl = $FULLME;

    // Print basic page layout.

    $streditingquestions = get_string('editquestions', "quiz");

    // TODO: generalise this to any activity
    $strquizzes = get_string('modulenameplural', 'quiz');
    $streditingquestions = get_string('editquestions', "quiz");
    if (isset($SESSION->modform->instance) and $quiz = get_record('quiz', 'id', $SESSION->modform->instance)) {
        $strupdatemodule = isteacheredit($course->id)
            ? update_module_button($SESSION->modform->cmid, $course->id, get_string('modulename', 'quiz'))
            : "";
        print_header_simple($streditingquestions, '',
                 "<a href=\"$CFG->wwwroot/mod/quiz/index.php?id=$course->id\">$strquizzes</a>".
                 " -> <a href=\"$CFG->wwwroot/mod/quiz/view.php?q={$SESSION->modform->instance}\">".format_string($SESSION->modform->name).'</a>'.
                 " -> $streditingquestions",
                 "", "", true, $strupdatemodule);

        $currenttab = 'edit';
        $mode = 'questions';
        $quiz = &$SESSION->modform;
        include($CFG->dirroot.'/mod/quiz/tabs.php');
    } else {
        print_header_simple($streditingquestions, '',
                 "$streditingquestions");
    
        // print tabs
        $currenttab = 'questions';
        include('tabs.php');
    }

    echo '<table align="center" border="0" cellpadding="2" cellspacing="0">';
    echo '<tr><td valign="top">';

    include($CFG->dirroot.'/question/showbank.php');

    echo '</td></tr>';
    echo '</table>';

    print_footer($course);
?>