Proyectos de Subversion Moodle

Rev

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

Rev 5 Rev 6
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
 
41
    /**
46
    /**
42
     * Configuration page
47
     * Configuration page
43
     *
48
     *
44
     * @param MoodleQuickForm $mform
49
     * @param MoodleQuickForm $mform
45
     */
50
     */
Línea 128... Línea 133...
128
                            [ 'class' => 'pt-3' ]);
133
                            [ 'class' => 'pt-3' ]);
Línea 129... Línea 134...
129
 
134
 
130
                    $oldsection = $cm->sectionnum;
135
                    $oldsection = $cm->sectionnum;
Línea -... Línea 136...
-
 
136
                }
-
 
137
 
-
 
138
                $purposeclass = '';
-
 
139
                if (defined('FEATURE_MOD_PURPOSE')) {
131
                }
140
                    $purposeclass = ' ' . plugin_supports('mod', $cm->modname, FEATURE_MOD_PURPOSE, MOD_PURPOSE_OTHER);
132
 
141
                }
-
 
142
                $icon = $OUTPUT->pix_icon('icon', $cm->get_module_type_name(), $cm->modname,
-
 
143
                        [ 'class' => 'iconlarge activityicon' ]);
Línea 133... Línea 144...
133
                $icon = $OUTPUT->pix_icon('icon', $cm->get_module_type_name(), $cm->modname,
144
                $icon = html_writer::span($icon, 'activityiconcontainer' . $purposeclass);
134
                        [ 'class' => 'iconlarge activityicon' ]);
145
                $name = html_writer::span($cm->get_formatted_name(), 'activity-name');
Línea 135... Línea 146...
135
 
146
 
Línea 136... Línea 147...
136
                $this->add_activity_config($mform, $cm->id, $sectionid, $cm->modname, $icon . $cm->get_formatted_name());
147
                $this->add_activity_config($mform, $cm->id, $sectionid, $cm->modname, $icon . $name);
Línea 180... Línea 191...
180
                $cmshtml .= '</div>'; // Close section.
191
                $cmshtml .= '</div>'; // Close section.
181
            }
192
            }
182
            $mform->addElement('html', html_writer::div(
193
            $mform->addElement('html', html_writer::div(
183
                    html_writer::tag('legend', get_string('resetreactionsbymodule', 'block_point_view')) . $cmshtml, 'ml-3 mb-2'));
194
                    html_writer::tag('legend', get_string('resetreactionsbymodule', 'block_point_view')) . $cmshtml, 'ml-3 mb-2'));
Línea -... Línea 195...
-
 
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.
184
 
209
        if ($this->addjs) {
185
            // Call javascript from a static function in locallib, because Moodle linter won't let us call global $PAGE from here
210
            // Call javascript from a static function in locallib, because Moodle linter won't let us call global $PAGE from here
186
            // (and $this->page actually contains the course page, not the edit form page).
211
            // (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 {
-
 
190
            $this->add_warning_message($mform, get_string('blockdisabled', 'block_point_view'));
212
            block_point_view_require_edit_form_javascript($this->block->context->id);
191
        }
213
        }
Línea 192... Línea 214...
192
    }
214
    }
193
 
215