Beispiel #1
0
     if (has_capability('moodle/local:canassignselftorafl', get_context_instance(CONTEXT_COURSE, SITEID))) {
         $roleid = get_field('role', 'id', 'shortname', ROLE_LPCONTRIBUTOR);
         if (!user_has_role_assignment($USER->id, $roleid, $context->id)) {
             //if isn't already a contributor, assign as one
             role_assign($roleid, $USER->id, 0, $context->id);
             local_role_processing($course, $roleid);
             $notifymessage = get_string('raflautoaddcontrib', 'rafl');
         }
         $canviewrafl = true;
     }
 }
 if ($canviewrafl) {
     require_once $CFG->dirroot . '/mod/rafl/locallib.php';
     $rafl = new localLibRafl();
     // get the right module id
     $moduleid = $rafl->get_course_module_id($course->id);
     $country_item_id = $rafl->get_rafl_item_id_by_country('uk');
     page_print_position($pageblocks, BLOCK_POS_LEFT, null);
     echo '<td id="middle-column">';
     if (!empty($notifymessage)) {
         notify($notifymessage);
     }
     $rafl->display_rafl_component($course->id, $country_item_id, $CFG);
     echo '</td>';
     page_print_position($pageblocks, BLOCK_POS_RIGHT, null);
 } else {
     echo '<tr>';
     page_print_position($pageblocks, BLOCK_POS_LEFT, null);
     echo '<td id="middle-column">';
     notify('You do not have permission for RAFL View on this learning path.  Please switch back to Standard View.');
     echo '</td>';