Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 88... Línea 88...
88
     * @return array
88
     * @return array
89
     */
89
     */
90
    protected static function define_other_properties(): array {
90
    protected static function define_other_properties(): array {
91
        return [
91
        return [
92
            'table' => ['type' => PARAM_RAW],
92
            'table' => ['type' => PARAM_RAW],
-
 
93
            'button' => [
-
 
94
                'type' => report_action_exporter::read_properties_definition(),
-
 
95
                'optional' => true,
-
 
96
            ],
-
 
97
            'infocontainer' => ['type' => PARAM_RAW],
93
            'filtersapplied' => ['type' => PARAM_INT],
98
            'filtersapplied' => ['type' => PARAM_INT],
94
            'filterspresent' => ['type' => PARAM_BOOL],
99
            'filterspresent' => ['type' => PARAM_BOOL],
95
            'filtersform' => ['type' => PARAM_RAW],
100
            'filtersform' => ['type' => PARAM_RAW],
96
            'attributes' => [
101
            'attributes' => [
97
                'type' => [
102
                'type' => [
Línea 134... Línea 139...
134
     */
139
     */
135
    protected function get_other_values(renderer_base $output): array {
140
    protected function get_other_values(renderer_base $output): array {
136
        /** @var datasource $report */
141
        /** @var datasource $report */
137
        $report = manager::get_report_from_persistent($this->persistent);
142
        $report = manager::get_report_from_persistent($this->persistent);
Línea -... Línea 143...
-
 
143
 
138
 
144
        $optionalvalues = [];
139
        $filterspresent = false;
145
        $filterspresent = false;
140
        $filtersform = '';
146
        $filtersform = '';
Línea 141... Línea 147...
141
        $attributes = [];
147
        $attributes = [];
Línea 149... Línea 155...
149
            $filterset->add_filter(new integer_filter('pagesize', null, [$this->related['pagesize']]));
155
            $filterset->add_filter(new integer_filter('pagesize', null, [$this->related['pagesize']]));
Línea 150... Línea 156...
150
 
156
 
151
            $table = custom_report_table_view::create($this->persistent->get('id'), $this->download);
157
            $table = custom_report_table_view::create($this->persistent->get('id'), $this->download);
Línea -... Línea 158...
-
 
158
            $table->set_filterset($filterset);
-
 
159
 
-
 
160
            // Export global report action.
-
 
161
            if ($reportaction = $report->get_report_action()) {
-
 
162
                $optionalvalues['button'] = $reportaction->export_for_template($output);
152
            $table->set_filterset($filterset);
163
            }
153
 
164
 
154
            // Generate filters form if report contains any filters.
165
            // Generate filters form if report contains any filters.
155
            $filterspresent = !empty($report->get_active_filters());
166
            $filterspresent = !empty($report->get_active_filters());
156
            if ($filterspresent && empty($this->download)) {
167
            if ($filterspresent && empty($this->download)) {
Línea 167... Línea 178...
167
                return ['name' => $key, 'value' => $value];
178
                return ['name' => $key, 'value' => $value];
168
            }, array_keys($reportattributes), $reportattributes);
179
            }, array_keys($reportattributes), $reportattributes);
169
        }
180
        }
Línea 170... Línea 181...
170
 
181
 
171
        // If we are editing we need all this information for the template.
-
 
172
        $editordata = [];
182
        // If we are editing we need all this information for the template.
173
        if ($this->editmode) {
183
        if ($this->editmode) {
174
            $menucardsexporter = new custom_report_column_cards_exporter(null, ['report' => $report]);
184
            $menucardsexporter = new custom_report_column_cards_exporter(null, ['report' => $report]);
Línea 175... Línea 185...
175
            $editordata['sidebarmenucards'] = (array) $menucardsexporter->export($output);
185
            $optionalvalues['sidebarmenucards'] = (array) $menucardsexporter->export($output);
176
 
186
 
Línea 177... Línea 187...
177
            $conditionsexporter = new custom_report_conditions_exporter(null, ['report' => $report]);
187
            $conditionsexporter = new custom_report_conditions_exporter(null, ['report' => $report]);
178
            $editordata['conditions'] = (array) $conditionsexporter->export($output);
188
            $optionalvalues['conditions'] = (array) $conditionsexporter->export($output);
Línea 179... Línea 189...
179
 
189
 
180
            $filtersexporter = new custom_report_filters_exporter(null, ['report' => $report]);
190
            $filtersexporter = new custom_report_filters_exporter(null, ['report' => $report]);
Línea 181... Línea 191...
181
            $editordata['filters'] = (array) $filtersexporter->export($output);
191
            $optionalvalues['filters'] = (array) $filtersexporter->export($output);
182
 
192
 
183
            $sortingexporter = new custom_report_columns_sorting_exporter(null, ['report' => $report]);
193
            $sortingexporter = new custom_report_columns_sorting_exporter(null, ['report' => $report]);
Línea 184... Línea 194...
184
            $editordata['sorting'] = (array) $sortingexporter->export($output);
194
            $optionalvalues['sorting'] = (array) $sortingexporter->export($output);
185
 
195
 
-
 
196
            $cardviewexporter = new custom_report_card_view_exporter(null, ['report' => $report]);
186
            $cardviewexporter = new custom_report_card_view_exporter(null, ['report' => $report]);
197
            $optionalvalues['cardview'] = (array) $cardviewexporter->export($output);
187
            $editordata['cardview'] = (array) $cardviewexporter->export($output);
198
        }
188
        }
199
 
189
 
200
        return [
190
        return [
201
            'table' => $output->render($table),
191
            'table' => $output->render($table),
202
            'infocontainer' => $report->get_report_info_container(),
192
            'filtersapplied' => $report->get_applied_filter_count(),
203
            'filtersapplied' => $report->get_applied_filter_count(),
193
            'filterspresent' => $filterspresent,
204
            'filterspresent' => $filterspresent,
194
            'filtersform' => $filtersform,
205
            'filtersform' => $filtersform,
Línea 195... Línea 206...
195
            'attributes' => $attributes,
206
            'attributes' => $attributes,
196
            'classes' => $classes ?? '',
207
            'classes' => $classes ?? '',
197
            'editmode' => $this->editmode,
208
            'editmode' => $this->editmode,