Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 14... Línea 14...
14
// You should have received a copy of the GNU General Public License
14
// You should have received a copy of the GNU General Public License
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
Línea 16... Línea 16...
16
 
16
 
Línea -... Línea 17...
-
 
17
namespace core_course\output;
-
 
18
 
17
namespace core_course\output;
19
use action_menu;
18
 
20
use action_menu_link_secondary;
19
use context_coursecat;
21
use context_coursecat;
20
use core_course_category;
22
use core_course_category;
21
use course_request;
23
use course_request;
Línea 61... Línea 63...
61
                    $url = new moodle_url($this->page->url, ['categoryid' => $id]);
63
                    $url = new moodle_url($this->page->url, ['categoryid' => $id]);
62
                    $options[$url->out()] = $cat;
64
                    $options[$url->out()] = $cat;
63
                }
65
                }
64
                $currenturl = new moodle_url($this->page->url, ['categoryid' => $this->category->id]);
66
                $currenturl = new moodle_url($this->page->url, ['categoryid' => $this->category->id]);
65
                $select = new \url_select($options, $currenturl, null);
67
                $select = new \url_select($options, $currenturl, null);
66
                $select->set_label(get_string('categories'), ['class' => 'sr-only']);
68
                $select->set_label(get_string('categories'), ['class' => 'visually-hidden']);
67
                $select->class .= ' text-truncate w-100';
69
                $select->class .= ' text-truncate w-100';
68
                return $select->export_for_template($output);
70
                return $select->export_for_template($output);
69
            }
71
            }
70
        }
72
        }
Línea 159... Línea 161...
159
     *              - categoryselect A list of available categories to be fed into a urlselect
161
     *              - categoryselect A list of available categories to be fed into a urlselect
160
     *              - search The course search form
162
     *              - search The course search form
161
     *              - additionaloptions Additional actions that can be performed in a category
163
     *              - additionaloptions Additional actions that can be performed in a category
162
     */
164
     */
163
    public function export_for_template(\renderer_base $output): array {
165
    public function export_for_template(\renderer_base $output): array {
-
 
166
        $additionaloptions = $this->get_additional_category_options();
-
 
167
        // Generate the action menu if there are additional options.
-
 
168
        if (!empty($additionaloptions)) {
-
 
169
            $actionmenu = new action_menu();
-
 
170
            $actionmenu->set_kebab_trigger(get_string('moreactions'));
-
 
171
            $actionmenu->set_additional_classes('ms-auto');
-
 
172
            foreach ($additionaloptions['options'] as $option) {
-
 
173
                $actionmenu->add(new action_menu_link_secondary(
-
 
174
                    $option['url'],
-
 
175
                    null,
-
 
176
                    $option['string']
-
 
177
                ));
-
 
178
            }
-
 
179
            $actionmenucontent = $output->render($actionmenu);
-
 
180
        }
-
 
181
 
164
        return [
182
        return [
165
            'categoryselect' => $this->get_category_select($output),
183
            'categoryselect' => $this->get_category_select($output),
166
            'search' => $this->get_search_form(),
184
            'search' => $this->get_search_form(),
167
            'additionaloptions' => $this->get_additional_category_options()
185
            'additionaloptions' => $actionmenucontent ?? '',
168
        ];
186
        ];
169
    }
187
    }
Línea 170... Línea 188...
170
 
188