Proyectos de Subversion Moodle

Rev

Rev 1 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
// This file is part of Moodle - http://moodle.org/
3
//
4
// Moodle is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// Moodle is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
16
 
17
/**
18
 * print the confirm dialog to use template and create new items from template
19
 *
20
 * @author Andreas Grabs
21
 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
22
 * @package mod_feedback
23
 */
24
 
25
require_once("../../config.php");
26
require_once("lib.php");
27
 
28
$id = required_param('id', PARAM_INT);
29
$templateid = optional_param('templateid', false, PARAM_INT);
30
 
31
if (!$templateid) {
32
    redirect('edit.php?id='.$id);
33
}
1441 ariadna 34
$template = $DB->get_record('feedback_template', ['id' => $templateid], '*', MUST_EXIST);
1 efrain 35
 
36
$url = new moodle_url('/mod/feedback/use_templ.php', array('id'=>$id, 'templateid'=>$templateid));
37
$PAGE->set_url($url);
38
 
39
list($course, $cm) = get_course_and_cm_from_cmid($id, 'feedback');
40
$context = context_module::instance($cm->id);
41
 
42
require_login($course, true, $cm);
43
 
44
$feedback = $PAGE->activityrecord;
45
$feedbackstructure = new mod_feedback_structure($feedback, $cm, 0, $templateid);
46
 
47
require_capability('mod/feedback:edititems', $context);
48
 
49
/// Print the page header
50
$strfeedbacks = get_string("modulenameplural", "feedback");
51
$strfeedback  = get_string("modulename", "feedback");
52
 
53
$params = ['id' => $id];
54
$activeurl = new moodle_url('/mod/feedback/manage_templates.php', $params);
55
$PAGE->set_url($activeurl);
56
 
57
$PAGE->set_heading($course->fullname);
58
$PAGE->set_title($feedback->name);
1441 ariadna 59
$PAGE->add_body_class('limitedwidth');
1 efrain 60
$PAGE->activityheader->set_attrs([
61
    "hidecompletion" => true,
62
    "description" => ''
63
]);
1441 ariadna 64
$actionbar = new \mod_feedback\output\edit_template_action_bar($cm->id, $templateid);
1 efrain 65
/** @var \mod_feedback\output\renderer $renderer */
66
$renderer = $PAGE->get_renderer('mod_feedback');
67
 
68
echo $OUTPUT->header();
1441 ariadna 69
echo $OUTPUT->heading(get_string('previewtemplate', 'mod_feedback', $template->name), 3);
1 efrain 70
echo $renderer->main_action_bar($actionbar);
71
 
72
$form = new mod_feedback_complete_form(mod_feedback_complete_form::MODE_VIEW_TEMPLATE,
73
        $feedbackstructure, 'feedback_preview_form', ['templateid' => $templateid]);
74
$form->display();
75
 
76
echo $OUTPUT->footer();
77