Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'wip-mdl-35787-m23' of git://github.com/rajeshtaneja/moo…

…dle into MOODLE_23_STABLE
  • Loading branch information...
commit df79fff95b3c93a47eb19bb2b4938fe6274ab8f4 2 parents a82535f + 18f9ad3
Dan Poltawski authored November 05, 2012
37  auth/mnet/auth.php
@@ -378,23 +378,28 @@ function confirm_mnet_session($token, $remotepeer) {
378 378
                 $extra = $DB->get_records_sql($sql);
379 379
 
380 380
                 $keys = array_keys($courses);
381  
-                $defaultrole = reset(get_archetype_roles('student'));
382  
-                //$defaultrole = get_default_course_role($ccache[$shortname]); //TODO: rewrite this completely, there is no default course role any more!!!
383  
-                foreach ($keys AS $id) {
384  
-                    if ($courses[$id]->visible == 0) {
385  
-                        unset($courses[$id]);
386  
-                        continue;
  381
+                $studentroles = get_archetype_roles('student');
  382
+                if (!empty($studentroles)) {
  383
+                    $defaultrole = reset($studentroles);
  384
+                    //$defaultrole = get_default_course_role($ccache[$shortname]); //TODO: rewrite this completely, there is no default course role any more!!!
  385
+                    foreach ($keys AS $id) {
  386
+                        if ($courses[$id]->visible == 0) {
  387
+                            unset($courses[$id]);
  388
+                            continue;
  389
+                        }
  390
+                        $courses[$id]->cat_id          = $courses[$id]->category;
  391
+                        $courses[$id]->defaultroleid   = $defaultrole->id;
  392
+                        unset($courses[$id]->category);
  393
+                        unset($courses[$id]->visible);
  394
+
  395
+                        $courses[$id]->cat_name        = $extra[$id]->cat_name;
  396
+                        $courses[$id]->cat_description = $extra[$id]->cat_description;
  397
+                        $courses[$id]->defaultrolename = $defaultrole->name;
  398
+                        // coerce to array
  399
+                        $courses[$id] = (array)$courses[$id];
387 400
                     }
388  
-                    $courses[$id]->cat_id          = $courses[$id]->category;
389  
-                    $courses[$id]->defaultroleid   = $defaultrole->id;
390  
-                    unset($courses[$id]->category);
391  
-                    unset($courses[$id]->visible);
392  
-
393  
-                    $courses[$id]->cat_name        = $extra[$id]->cat_name;
394  
-                    $courses[$id]->cat_description = $extra[$id]->cat_description;
395  
-                    $courses[$id]->defaultrolename = $defaultrole->name;
396  
-                    // coerce to array
397  
-                    $courses[$id] = (array)$courses[$id];
  401
+                } else {
  402
+                    throw new moodle_exception('unknownrole', 'error', '', 'student');
398 403
                 }
399 404
             } else {
400 405
                 // if the array is empty, send it anyway
2  mnet/service/enrol/course.php
@@ -62,7 +62,7 @@
62 62
 
63 63
 // collapsible course summary
64 64
 if (!empty($course->summary)) {
65  
-    unset($options);
  65
+    $options = new stdClass();
66 66
     $options->trusted = false;
67 67
     $options->para    = false;
68 68
     $options->filter  = false;

0 notes on commit df79fff

Please sign in to comment.
Something went wrong with that request. Please try again.