Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 40... Línea 40...
40
 
40
 
41
    /** @var course_format the course format */
41
    /** @var course_format the course format */
Línea 42... Línea 42...
42
    protected $format;
42
    protected $format;
43
 
43
 
Línea 44... Línea 44...
44
    /** @var section_info the section object */
44
    /** @var section_info the section object */
45
    private $section;
45
    protected $section;
Línea 46... Línea 46...
46
 
46
 
Línea 156... Línea 156...
156
    public function get_choice_list(): choicelist {
156
    public function get_choice_list(): choicelist {
157
        $choice = new choicelist();
157
        $choice = new choicelist();
158
        $choice->add_option(
158
        $choice->add_option(
159
            NOGROUPS,
159
            NOGROUPS,
160
            get_string('groupsnone', 'group'),
160
            get_string('groupsnone', 'group'),
161
            $this->get_option_data(null, 'cmNoGroups', $this->mod->id)
161
            $this->get_option_data(null, 'cmNoGroups', 'cm_nogroups')
162
        );
162
        );
163
        $choice->add_option(
163
        $choice->add_option(
164
            SEPARATEGROUPS,
164
            SEPARATEGROUPS,
165
            get_string('groupsseparate', 'group'),
165
            get_string('groupsseparate', 'group'),
166
            $this->get_option_data('groupsseparate', 'cmSeparateGroups', $this->mod->id)
166
            $this->get_option_data('groupsseparate', 'cmSeparateGroups', 'cm_separategroups')
167
        );
167
        );
168
        $choice->add_option(
168
        $choice->add_option(
169
            VISIBLEGROUPS,
169
            VISIBLEGROUPS,
170
            get_string('groupsvisible', 'group'),
170
            get_string('groupsvisible', 'group'),
171
            $this->get_option_data('groupsvisible', 'cmVisibleGroups', $this->mod->id)
171
            $this->get_option_data('groupsvisible', 'cmVisibleGroups', 'cm_visiblegroups')
172
        );
172
        );
173
        $choice->set_selected_value($this->mod->effectivegroupmode);
173
        $choice->set_selected_value($this->mod->effectivegroupmode);
174
        return $choice;
174
        return $choice;
175
    }
175
    }
Línea 176... Línea 176...
176
 
176
 
177
    /**
177
    /**
178
     * Get the data for the option.
178
     * Get the data for the option.
179
     * @param string|null $name the name of the option
179
     * @param string|null $name the name of the option
180
     * @param string $action the state action of the option
180
     * @param string $mutation the mutation name
181
     * @param int $id the id of the module
181
     * @param string $stateaction the state action name
182
     * @return array
182
     * @return array
183
     */
183
     */
-
 
184
    private function get_option_data(?string $name, string $mutation, string $stateaction): array {
-
 
185
        $format = $this->format;
-
 
186
        $nonajaxurl = $format->get_update_url(
-
 
187
            action: $stateaction,
-
 
188
            ids: [$this->mod->id],
-
 
189
            returnurl: $format->get_view_url($format->get_sectionnum(), ['navigation' => true]),
-
 
190
        );
184
    private function get_option_data(?string $name, string $action, int $id): array {
191
 
185
        return [
192
        return [
186
            'description' => ($name) ? get_string("groupmode_{$name}_help", 'group') : null,
193
            'description' => ($name) ? get_string("groupmode_{$name}_help", 'group') : null,
187
            // The dropdown icons are decorative, so we don't need to provide alt text.
194
            // The dropdown icons are decorative, so we don't need to provide alt text.
-
 
195
            'icon' => $this->get_action_icon($mutation),
188
            'icon' => $this->get_action_icon($action),
196
            'url' => $nonajaxurl,
189
            'extras' => [
197
            'extras' => [
190
                'data-id' => $id,
198
                'data-id' => $this->mod->id,
191
                'data-action' => $action,
199
                'data-action' => $mutation,
192
            ]
200
            ]
193
        ];
201
        ];
Línea 194... Línea 202...
194
    }
202
    }