Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 155... Línea 155...
155
                $testcontext = context_system::instance();
155
                $testcontext = context_system::instance();
156
            }
156
            }
157
            foreach (array_keys($availabletypes) as $activity) {
157
            foreach (array_keys($availabletypes) as $activity) {
158
                $capability = "mod/{$activity}:addinstance";
158
                $capability = "mod/{$activity}:addinstance";
159
                if (!has_capability($capability, $testcontext)) {
159
                if (!has_capability($capability, $testcontext)) {
-
 
160
                    if (!$this->categoryid) {
160
                    unset($availabletypes[$activity]);
161
                        unset($availabletypes[$activity]);
-
 
162
                    } else {
-
 
163
                        // We do not have a course yet, so we guess if the user will have the capability to add the activity after
-
 
164
                        // creating the course.
-
 
165
                        $categorycontext = \context_coursecat::instance($this->categoryid);
-
 
166
                        if (!guess_if_creator_will_have_course_capability($capability, $categorycontext)) {
-
 
167
                            unset($availabletypes[$activity]);
-
 
168
                        }
-
 
169
                    }
161
                }
170
                }
162
            }
171
            }
163
        }
172
        }
Línea 164... Línea 173...
164
 
173