Proyectos de Subversion Moodle

Rev

Rev 4 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 4 Rev 5
Línea 37... Línea 37...
37
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
37
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
38
 */
38
 */
39
class block_point_view_edit_form extends block_edit_form {
39
class block_point_view_edit_form extends block_edit_form {
Línea 40... Línea 40...
40
 
40
 
41
    /**
-
 
42
     * @var boolean Whether javascript should be added on display (needed since Moodle 4.2 and dynamic forms).
-
 
43
     */
-
 
44
    protected $addjs = false;
-
 
45
 
-
 
46
    /**
41
    /**
47
     * Configuration page
42
     * Configuration page
48
     *
43
     *
49
     * @param MoodleQuickForm $mform
44
     * @param MoodleQuickForm $mform
50
     */
45
     */
Línea 133... Línea 128...
133
                            [ 'class' => 'pt-3' ]);
128
                            [ 'class' => 'pt-3' ]);
Línea 134... Línea 129...
134
 
129
 
135
                    $oldsection = $cm->sectionnum;
130
                    $oldsection = $cm->sectionnum;
Línea 136... Línea -...
136
                }
-
 
137
 
-
 
138
                $purposeclass = '';
-
 
139
                if (defined('FEATURE_MOD_PURPOSE')) {
-
 
140
                    $purposeclass = ' ' . plugin_supports('mod', $cm->modname, FEATURE_MOD_PURPOSE, MOD_PURPOSE_OTHER);
131
                }
141
                }
132
 
142
                $icon = $OUTPUT->pix_icon('icon', $cm->get_module_type_name(), $cm->modname,
-
 
143
                        [ 'class' => 'iconlarge activityicon' ]);
-
 
Línea 144... Línea 133...
144
                $icon = html_writer::span($icon, 'activityiconcontainer' . $purposeclass);
133
                $icon = $OUTPUT->pix_icon('icon', $cm->get_module_type_name(), $cm->modname,
145
                $name = html_writer::span($cm->get_formatted_name(), 'activity-name');
134
                        [ 'class' => 'iconlarge activityicon' ]);
Línea 146... Línea 135...
146
 
135
 
Línea 147... Línea 136...
147
                $this->add_activity_config($mform, $cm->id, $sectionid, $cm->modname, $icon . $name);
136
                $this->add_activity_config($mform, $cm->id, $sectionid, $cm->modname, $icon . $cm->get_formatted_name());
Línea 191... Línea 180...
191
                $cmshtml .= '</div>'; // Close section.
180
                $cmshtml .= '</div>'; // Close section.
192
            }
181
            }
193
            $mform->addElement('html', html_writer::div(
182
            $mform->addElement('html', html_writer::div(
194
                    html_writer::tag('legend', get_string('resetreactionsbymodule', 'block_point_view')) . $cmshtml, 'ml-3 mb-2'));
183
                    html_writer::tag('legend', get_string('resetreactionsbymodule', 'block_point_view')) . $cmshtml, 'ml-3 mb-2'));
Línea 195... Línea -...
195
 
-
 
196
            $this->addjs = true;
-
 
197
        } else {
-
 
198
            $this->add_warning_message($mform, get_string('blockdisabled', 'block_point_view'));
-
 
199
        }
-
 
200
    }
-
 
201
 
-
 
202
    /**
-
 
203
     * {@inheritDoc}
-
 
204
     * @see moodleform::display()
-
 
205
     */
-
 
206
    public function display() {
-
 
207
        parent::display();
-
 
208
        // Javascript needs to be added from display() function, since Moodle 4.2 and dynamic forms.
-
 
209
        if ($this->addjs) {
184
 
210
            // Call javascript from a static function in locallib, because Moodle linter won't let us call global $PAGE from here
185
            // Call javascript from a static function in locallib, because Moodle linter won't let us call global $PAGE from here
211
            // (and $this->page actually contains the course page, not the edit form page).
186
            // (and $this->page actually contains the course page, not the edit form page).
-
 
187
            block_point_view_require_edit_form_javascript($this->block->context->id);
-
 
188
 
-
 
189
        } else {
212
            block_point_view_require_edit_form_javascript($this->block->context->id);
190
            $this->add_warning_message($mform, get_string('blockdisabled', 'block_point_view'));
213
        }
191
        }
Línea 214... Línea 192...
214
    }
192
    }
215
 
193