Proyectos de Subversion Moodle

Rev

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

Rev 11 Rev 1441
Línea 114... Línea 114...
114
        capability_manager $capabilitymanager,
114
        capability_manager $capabilitymanager,
115
        url_factory $urlfactory,
115
        url_factory $urlfactory,
116
        forum_gradeitem $forumgradeitem,
116
        forum_gradeitem $forumgradeitem,
117
        string $template,
117
        string $template,
118
        array $notifications = [],
118
        array $notifications = [],
119
        callable $postprocessfortemplate = null
119
        ?callable $postprocessfortemplate = null
120
    ) {
120
    ) {
121
        $this->forum = $forum;
121
        $this->forum = $forum;
122
        $this->renderer = $renderer;
122
        $this->renderer = $renderer;
123
        $this->legacydatamapperfactory = $legacydatamapperfactory;
123
        $this->legacydatamapperfactory = $legacydatamapperfactory;
124
        $this->exporterfactory = $exporterfactory;
124
        $this->exporterfactory = $exporterfactory;
Línea 154... Línea 154...
154
        \cm_info $cm,
154
        \cm_info $cm,
155
        ?int $groupid,
155
        ?int $groupid,
156
        ?int $sortorder,
156
        ?int $sortorder,
157
        ?int $pageno,
157
        ?int $pageno,
158
        ?int $pagesize,
158
        ?int $pagesize,
159
        int $displaymode = null,
159
        ?int $displaymode = null,
160
        bool $enablediscussioncreation = true
160
        bool $enablediscussioncreation = true
161
    ): string {
161
    ): string {
162
        global $PAGE;
162
        global $PAGE;
Línea 163... Línea 163...
163
 
163
 
Línea 383... Línea 383...
383
            ))->set_show_closebutton();
383
            ))->set_show_closebutton();
384
        }
384
        }
Línea 385... Línea 385...
385
 
385
 
386
        if ($forum->is_in_group_mode() && !$capabilitymanager->can_access_all_groups($user)) {
386
        if ($forum->is_in_group_mode() && !$capabilitymanager->can_access_all_groups($user)) {
-
 
387
            if ($groupid === null) {
-
 
388
                $isvisiblegroupsmode = $forum->get_effective_group_mode() == VISIBLEGROUPS;
-
 
389
                $isgroupmember = !empty(groups_get_user_groups($forum->get_course_id(), $user->id)[0]);
-
 
390
 
387
            if ($groupid === null) {
391
                if (
-
 
392
                    !$capabilitymanager->can_post_to_my_groups($user)
-
 
393
                    && $isvisiblegroupsmode
-
 
394
                    && $isgroupmember
388
                if (!$capabilitymanager->can_post_to_my_groups($user)) {
395
                ) {
389
                    $notifications[] = (new notification(
396
                    $notifications[] = (new notification(
390
                        get_string('cannotadddiscussiongroup', 'mod_forum'),
397
                        get_string('cannotadddiscussionall', 'mod_forum'),
391
                        \core\output\notification::NOTIFY_WARNING
398
                        \core\output\notification::NOTIFY_WARNING
392
                    ))->set_show_closebutton();
399
                    ))->set_show_closebutton();
393
                } else {
400
                } else {
394
                    $notifications[] = (new notification(
401
                    $notifications[] = (new notification(
395
                        get_string('cannotadddiscussionall', 'mod_forum'),
402
                        get_string('cannotadddiscussiongroup', 'mod_forum'),
396
                        \core\output\notification::NOTIFY_WARNING
403
                        \core\output\notification::NOTIFY_WARNING
397
                    ))->set_show_closebutton();
404
                    ))->set_show_closebutton();
398
                }
405
                }
399
            } else if (!$capabilitymanager->can_access_group($user, $groupid)) {
406
            } else if (!$capabilitymanager->can_access_group($user, $groupid)) {