Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
 
3
// This file is part of Moodle - http://moodle.org/
4
//
5
// Moodle is free software: you can redistribute it and/or modify
6
// it under the terms of the GNU General Public License as published by
7
// the Free Software Foundation, either version 3 of the License, or
8
// (at your option) any later version.
9
//
10
// Moodle is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
// GNU General Public License for more details.
14
//
15
// You should have received a copy of the GNU General Public License
16
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
17
 
18
/**
19
 * At this page, teachers allocate submissions to students for a review
20
 *
21
 * The allocation logic itself is delegated to allocators - subplugins in ./allocation
22
 * folder.
23
 *
24
 * @package    mod_workshop
25
 * @copyright  2009 David Mudrak <david.mudrak@gmail.com>
26
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
27
 */
28
 
29
require(__DIR__.'/../../config.php');
30
require_once(__DIR__.'/locallib.php');
31
require_once(__DIR__.'/allocation/lib.php');
32
 
33
$cmid       = required_param('cmid', PARAM_INT);                    // course module
34
$method     = optional_param('method', 'manual', PARAM_ALPHA);      // method to use
35
 
36
$cm         = get_coursemodule_from_id('workshop', $cmid, 0, false, MUST_EXIST);
37
$course     = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
38
$workshop   = $DB->get_record('workshop', array('id' => $cm->instance), '*', MUST_EXIST);
39
$workshop   = new workshop($workshop, $cm, $course);
40
 
41
$url = $workshop->allocation_url($method);
42
$PAGE->set_url($url);
43
 
44
require_login($course, false, $cm);
45
$context = $PAGE->context;
46
require_capability('mod/workshop:allocate', $context);
47
 
48
$PAGE->set_title($workshop->name);
49
$PAGE->set_heading($course->fullname);
50
$PAGE->navbar->add(get_string('allocation', 'workshop'), $workshop->allocation_url($method));
51
$PAGE->activityheader->set_attrs([
52
    'hidecompletion' => true,
53
    'description' => ''
54
]);
55
 
56
$allocator  = $workshop->allocator_instance($method);
57
$initresult = $allocator->init();
58
 
59
//
60
// Output starts here
61
//
62
$actionbar = new \mod_workshop\output\actionbar($url, $workshop);
63
 
64
$output = $PAGE->get_renderer('mod_workshop');
65
echo $output->header();
66
echo $output->render_allocation_menu($actionbar);
67
 
68
if (is_null($initresult->get_status()) or $initresult->get_status() == workshop_allocation_result::STATUS_VOID) {
69
    echo $output->container_start('allocator-ui');
70
    echo $allocator->ui();
71
    echo $output->container_end();
72
} else {
73
    echo $output->container_start('allocator-init-results');
74
    echo $output->render($initresult);
75
    echo $output->continue_button($workshop->allocation_url($method));
76
    echo $output->container_end();
77
}
78
echo $output->footer();