Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 23... Línea 23...
23
use core_reportbuilder\permission;
23
use core_reportbuilder\permission;
24
use moodle_url;
24
use moodle_url;
25
use core_form\dynamic_form;
25
use core_form\dynamic_form;
26
use core_reportbuilder\datasource;
26
use core_reportbuilder\datasource;
27
use core_reportbuilder\manager;
27
use core_reportbuilder\manager;
-
 
28
use core_reportbuilder\customfield\report_handler;
28
use core_reportbuilder\local\helpers\report as reporthelper;
29
use core_reportbuilder\local\helpers\report as reporthelper;
29
use core_tag_tag;
30
use core_tag_tag;
Línea 30... Línea 31...
30
 
31
 
Línea 72... Línea 73...
72
    }
73
    }
Línea 73... Línea 74...
73
 
74
 
74
    /**
75
    /**
75
     * Ensure current user is able to use this form
76
     * Ensure current user is able to use this form
76
     *
77
     *
77
     * A {@see \core_reportbuilder\report_access_exception} will be thrown if they can't
78
     * A {@see \core_reportbuilder\exception\report_access_exception} will be thrown if they can't
78
     */
79
     */
79
    protected function check_access_for_dynamic_submission(): void {
80
    protected function check_access_for_dynamic_submission(): void {
Línea 80... Línea 81...
80
        $report = $this->get_custom_report();
81
        $report = $this->get_custom_report();
Línea 90... Línea 91...
90
     * Form definition
91
     * Form definition
91
     */
92
     */
92
    public function definition() {
93
    public function definition() {
93
        $mform = $this->_form;
94
        $mform = $this->_form;
Línea -... Línea 95...
-
 
95
 
-
 
96
        $mform->addElement('header', 'general', get_string('general', 'form'));
94
 
97
 
95
        $mform->addElement('hidden', 'id');
98
        $mform->addElement('hidden', 'id');
Línea 96... Línea 99...
96
        $mform->setType('id', PARAM_INT);
99
        $mform->setType('id', PARAM_INT);
97
 
100
 
Línea 117... Línea 120...
117
        $mform->addHelpButton('uniquerows', 'uniquerows', 'core_reportbuilder');
120
        $mform->addHelpButton('uniquerows', 'uniquerows', 'core_reportbuilder');
Línea 118... Línea 121...
118
 
121
 
119
        $mform->addElement('tags', 'tags', get_string('tags'), [
122
        $mform->addElement('tags', 'tags', get_string('tags'), [
120
            'component' => 'core_reportbuilder', 'itemtype' => 'reportbuilder_report',
123
            'component' => 'core_reportbuilder', 'itemtype' => 'reportbuilder_report',
-
 
124
        ]);
-
 
125
 
-
 
126
        // Add custom fields to the form.
-
 
127
        $reportid = empty($this->_customdata['id']) ? 0 : $this->_customdata['id'];
121
        ]);
128
        report_handler::create()->instance_form_definition($mform, $reportid);
Línea 122... Línea 129...
122
    }
129
    }
123
 
130
 
124
    /**
131
    /**
Línea 142... Línea 149...
142
     * Load in existing data as form defaults
149
     * Load in existing data as form defaults
143
     */
150
     */
144
    public function set_data_for_dynamic_submission(): void {
151
    public function set_data_for_dynamic_submission(): void {
145
        if ($persistent = $this->get_custom_report()?->get_report_persistent()) {
152
        if ($persistent = $this->get_custom_report()?->get_report_persistent()) {
146
            $tags = core_tag_tag::get_item_tags_array('core_reportbuilder', 'reportbuilder_report', $persistent->get('id'));
153
            $tags = core_tag_tag::get_item_tags_array('core_reportbuilder', 'reportbuilder_report', $persistent->get('id'));
147
            $this->set_data(array_merge((array) $persistent->to_record(), ['tags' => $tags]));
154
            $data = (object) array_merge((array) $persistent->to_record(), ['tags' => $tags]);
-
 
155
            report_handler::create()->instance_form_before_set_data($data);
-
 
156
            $this->set_data($data);
148
        }
157
        }
149
    }
158
    }
Línea 150... Línea 159...
150
 
159
 
151
    /**
160
    /**