当前位置: 首页>>代码示例>>PHP>>正文


PHP user_has_role_assignment函数代码示例

本文整理汇总了PHP中user_has_role_assignment函数的典型用法代码示例。如果您正苦于以下问题:PHP user_has_role_assignment函数的具体用法?PHP user_has_role_assignment怎么用?PHP user_has_role_assignment使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了user_has_role_assignment函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: test_build

 public function test_build()
 {
     $fm = mr_fixture_manager::instance();
     $userid = $fm->get('user')->get('id');
     $roleid = $fm->get('role')->get('id');
     $context = context_course::instance($fm->get('course')->get('id'));
     $this->assertFalse(user_has_role_assignment($userid, $roleid, $context->id));
     $this->assertFalse(is_enrolled($context, $fm->get('user')->get_results()));
     $enrollment = new mr_fixture_enrollment($fm->get('course'), $fm->get('user'), enrol_get_plugin('manual'), $fm->get('role'));
     $enrollment->build();
     $this->assertTrue(user_has_role_assignment($userid, $roleid, $context->id));
     $this->assertTrue(is_enrolled($context, $fm->get('user')->get_results()));
 }
开发者ID:bgao-ca,项目名称:moodle-local_mr,代码行数:13,代码来源:testfixtureenrollment.php

示例2: test_destroy

 public function test_destroy()
 {
     $fm = mr_fixture_manager::instance();
     $userid = $fm->get('user')->get('id');
     $roleid = $fm->get('role')->get('id');
     $contextid = context_course::instance($fm->get('course')->get('id'))->id;
     $this->assertFalse(user_has_role_assignment($userid, $roleid, $contextid));
     $ra = new mr_fixture_role_assignment($fm->get('role'), $fm->get('user'), $fm->get('course'));
     $ra->build();
     $this->assertTrue(user_has_role_assignment($userid, $roleid, $contextid));
     $ra->destroy();
     $this->assertFalse(user_has_role_assignment($userid, $roleid, $contextid));
 }
开发者ID:bgao-ca,项目名称:moodle-local_mr,代码行数:13,代码来源:testfixtureroleassignment.php

示例3: theme_mmcmonkwearmouth_get_user_role

function theme_mmcmonkwearmouth_get_user_role($id)
{
    //Requires a setting save to change these in database for news.
    $roles = ["teacher" => 20, "staff" => 21, "parent" => 22, "student" => 19, "governor" => 23];
    $admins = get_admins();
    foreach ($admins as $admin) {
        if ($id == $admin->id) {
            return "admin";
        }
    }
    foreach ($roles as $roleTitle => $roleNumber) {
        if (user_has_role_assignment($id, $roleNumber)) {
            return $roleTitle;
        }
    }
}
开发者ID:markmcdermid,项目名称:mmcmonkwearmouth,代码行数:16,代码来源:lib.php

示例4: equella_getssotoken

/**
 * Create EQUELLA single sign on token for current user
 *
 * @return string
 */
function equella_getssotoken($course = null)
{
    global $USER, $CFG, $COURSE;
    if (empty($course)) {
        $course = $COURSE;
    }
    $context_sys = context_system::instance();
    $context_cc = null;
    if (!empty($course->category) && is_int($course->category)) {
        $context_cc = context_coursecat::instance($course->category);
    }
    $context_c = context_course::instance($course->id);
    // roles are ordered by shortname
    $editingroles = get_all_editing_roles();
    foreach ($editingroles as $role) {
        $hassystemrole = false;
        if (!empty($context_sys)) {
            $hassystemrole = user_has_role_assignment($USER->id, $role->id, $context_sys->id);
        }
        $hascategoryrole = false;
        if (!empty($context_cc)) {
            $hascategoryrole = user_has_role_assignment($USER->id, $role->id, $context_cc->id);
        }
        $hascourserole = false;
        if (!empty($context_c)) {
            $hascourserole = user_has_role_assignment($USER->id, $role->id, $context_c->id);
        }
        if ($hassystemrole || $hascategoryrole || $hascourserole) {
            // see if the user has a role that is linked to an equella role
            $shareid = $CFG->{"equella_{$role->shortname}_shareid"};
            if (!empty($shareid)) {
                return equella_getssotoken_raw($USER->username, $shareid, $CFG->{"equella_{$role->shortname}_sharedsecret"});
            }
        }
    }
    // no roles found, use the default shareid and secret
    $shareid = $CFG->equella_shareid;
    if (!empty($shareid)) {
        return equella_getssotoken_raw($USER->username, $shareid, $CFG->equella_sharedsecret);
    }
}
开发者ID:CTANZ,项目名称:moodle-mod_equella,代码行数:46,代码来源:lib.php

示例5: get_content

 public function get_content()
 {
     global $DB, $USER, $CFG;
     if ($this->content !== null) {
         return $this->content;
     }
     if (user_has_role_assignment($USER->id, 5)) {
         $config = get_config('domoscio');
         $count = $this->count_tests($config);
         if (count($count) > 1) {
             $plural = "s";
         } else {
             $plural = "";
         }
         $this->content = new stdClass();
         $this->content->text = '<span class="badge badge-important" style="font-size:18px">' . count($count) . '</span>' . get_string('text2', 'block_domoscio_reminder') . $plural . get_string('text3', 'block_domoscio_reminder');
         if (!empty($count)) {
             $this->content->footer = "<a href=" . $CFG->wwwroot . "/mod/domoscio/index.php>Let's go !</a>";
         }
     }
     return $this->content;
 }
开发者ID:Celumproject,项目名称:moodle-block_domoscioreminder,代码行数:22,代码来源:block_domoscio_reminder.php

示例6: getssotoken

    /**
     * Generate equella sso token
     *
     * @param string $readwrite
     * @return string
     */
    private function getssotoken($readwrite = 'read') {
        global $USER;

        if (empty($USER->username)) {
            return false;
        }

        if ($readwrite == 'write') {

            foreach (self::get_all_editing_roles() as $role) {
                if (user_has_role_assignment($USER->id, $role->id, $this->context->id)) {
                    // See if the user has a role that is linked to an equella role.
                    $shareid = $this->get_option("equella_{$role->shortname}_shareid");
                    if (!empty($shareid)) {
                        return $this->getssotoken_raw($USER->username, $shareid,
                            $this->get_option("equella_{$role->shortname}_sharedsecret"));
                    }
                }
            }
        }
        // If we are only reading, use the unadorned shareid and secret.
        $shareid = $this->get_option('equella_shareid');
        if (!empty($shareid)) {
            return $this->getssotoken_raw($USER->username, $shareid, $this->get_option('equella_sharedsecret'));
        }
    }
开发者ID:Burick,项目名称:moodle,代码行数:32,代码来源:lib.php

示例7: is_student

/**
 * Verify if the user is a student
 *
 * @param int
 * @param int
 * @return bool
 */
function is_student($userid)
{
    return user_has_role_assignment($userid, 5);
}
开发者ID:ramcoelho,项目名称:moodle-block_ranking,代码行数:11,代码来源:lib.php

示例8: add_to_egr

 /**
  * Enrol the user, add him to groups and assign him roles.
  *
  * @return bool false if an error occured
  */
 protected function add_to_egr()
 {
     global $DB;
     foreach ($this->rawdata as $field => $value) {
         if (preg_match('/^sysrole\\d+$/', $field)) {
             $removing = false;
             if (!empty($value)) {
                 $sysrolename = $value;
                 // Removing sysrole.
                 if ($sysrolename[0] == '-') {
                     $removing = true;
                     $sysrolename = substr($sysrolename, 1);
                 }
                 // System roles lookup.
                 $sysrolecache = uu_allowed_sysroles_cache();
                 if (array_key_exists($sysrolename, $sysrolecache)) {
                     $sysroleid = $sysrolecache[$sysrolename]->id;
                 } else {
                     $this->set_status('unknownrole', new lang_string('unknownrole', 'error', s($sysrolename)));
                     continue;
                 }
                 $isassigned = user_has_role_assignment($this->finaldata->id, $sysroleid, SYSCONTEXTID);
                 if ($removing) {
                     if ($isassigned) {
                         role_unassign($sysroleid, $this->finaldata->id, SYSCONTEXTID);
                     }
                 } else {
                     if (!$isassigned) {
                         role_assign($sysroleid, $this->finaldata->id, SYSCONTEXTID);
                     }
                 }
             }
         } else {
             if (preg_match('/^course\\d+$/', $field)) {
                 // Course number.
                 $i = substr($field, 6);
                 $shortname = $value;
                 $course = $DB->get_record('course', array('shortname' => $shortname));
                 $course->groups = NULL;
                 if (!$course) {
                     $this->set_status('unknowncourse', new lang_string('unknowncourse', 'error', s($shortname)));
                     continue;
                 }
                 $courseid = $course->id;
                 $coursecontext = context_course::instance($courseid);
                 $roles = uu_allowed_roles_cache();
                 // TODO: manualcache
                 if ($instances = enrol_get_instances($courseid, false)) {
                     foreach ($instances as $instance) {
                         if ($instance->enrol === 'manual') {
                             $coursecache = $instance;
                             break;
                         }
                     }
                 }
                 // Checking if manual enrol is enabled. If it's not, no
                 // enrolment is done.
                 if (enrol_is_enabled('manual')) {
                     $manual = enrol_get_plugin('manual');
                 } else {
                     $manual = NULL;
                 }
                 if ($courseid == SITEID) {
                     if (!empty($this->rawdata['role' . $i])) {
                         $rolename = $this->rawdata['role' . $i];
                         if (array_key_exists($rolename, $roles)) {
                             $roleid = $roles[$rolename]->id;
                         } else {
                             $this->set_status('unknownrole', new lang_string('unknownrole', 'error', s($rolename)));
                             continue;
                         }
                         role_assign($roleid, $this->finaldata->id, context_course::instance($courseid));
                     }
                 } else {
                     if ($manual) {
                         $roleid = false;
                         if (!empty($this->rawdata['role' . $i])) {
                             $rolename = $this->rawdata['role' . $i];
                             if (array_key_exists($rolename, $roles)) {
                                 $roleid = $roles[$rolename]->id;
                             } else {
                                 $this->set_status('unknownrole', new lang_string('unknownrole', 'error', s($rolename)));
                                 continue;
                             }
                         } else {
                             if (!empty($this->rawdata['type' . $i])) {
                                 // If no role, find "old" enrolment type.
                                 $addtype = $this->rawdata['type' . $i];
                                 if ($addtype < 1 or $addtype > 3) {
                                     $this->set_status('typeerror', new lang_string('typeerror', 'tool_uploadusercli'));
                                     continue;
                                 } else {
                                     $roleid = $this->rawdata['type' . $i];
                                 }
                             } else {
//.........这里部分代码省略.........
开发者ID:alexandru-elisei,项目名称:moodle-tool_uploadusercli,代码行数:101,代码来源:user.php

示例9: equella_is_instructor

function equella_is_instructor($user, $cm, $courseid)
{
    global $CFG, $DB;
    $course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
    $context_sys = context_system::instance();
    $context_cc = null;
    if (!empty($course->category)) {
        $context_cc = context_coursecat::instance($course->category);
    }
    $context_c = context_course::instance($courseid);
    // roles are ordered by shortname
    $editingroles = get_all_editing_roles();
    $isinstructor = false;
    foreach ($editingroles as $role) {
        $hassystemrole = user_has_role_assignment($user->id, $role->id, $context_sys->id);
        $hascategoryrole = false;
        if (!empty($context_cc)) {
            $hascategoryrole = user_has_role_assignment($user->id, $role->id, $context_cc->id);
        }
        $hascourserole = user_has_role_assignment($user->id, $role->id, $context_c->id);
        if ($hassystemrole || $hascategoryrole || $hascourserole) {
            return true;
        }
    }
    return false;
}
开发者ID:CTANZ,项目名称:moodle-mod_equella,代码行数:26,代码来源:locallib.php

示例10: get_user_roles

$roles = get_user_roles($context, $USER->id, true);
$participants = $streamline->participants;
if ($streamline->participants == null || $streamline->participants == "[]") {
    //The room that is being used comes from a previous version
    $moderator = has_capability('mod/streamline:moderate', $context);
} else {
    $moderator = bigbluebuttonbn_is_moderator($userID, $roles, $participants);
}
$administrator = has_capability('moodle/category:manage', $context);
//104.155.215.138
$ipaddress = trim($CFG->ServerURLforBigBlueButton);
$variable2 = substr($ipaddress, 0, strpos($ipaddress, "b"));
$variable = trim(trim($variable2), '/') . '/';
$moodle_dir = $CFG->wwwroot;
//Determine if user is the teacher
$teacher_role = user_has_role_assignment($USER->id, 3);
if ($teacher_role == 1) {
    $teacher = true;
} else {
    $teacher = false;
}
//Determine if the meeting has ended based on on the 'meetingended' field in the DB
if ($streamline->meetingended == 1) {
    $meetingEnded = true;
} else {
    $meetingEnded = false;
}
?>
	
	<link rel="stylesheet" type="text/css" href="streamline.css">
开发者ID:Brotality,项目名称:moodle-mod_streamline,代码行数:30,代码来源:BBB.php

示例11: get_content

 public function get_content()
 {
     global $DB, $USER;
     $this->content = new stdClass();
     $this->content->text = '';
     $this->content->footer = '';
     if (user_has_role_assignment($USER->id, 5)) {
         $eventsarray = content_unlock_generate_events_list();
         $us = $DB->get_records('content_unlock_system', array('deleted' => 0, 'blockinstanceid' => $this->instance->id));
         if (!empty($us)) {
             $unlocklist = '';
             $course = $DB->get_record('course', array('id' => $this->page->course->id));
             $info = get_fast_modinfo($course);
             foreach ($us as $unlocksystem) {
                 $sql = "SELECT *\n\t\t\t\t\t\t\tFROM {content_unlock_log} c\n\t\t\t\t\t\t\t\tINNER JOIN {logstore_standard_log} l ON c.logid = l.id\n\t\t\t\t\t\t\tWHERE l.userid = :userid\n\t\t\t\t\t\t\t\tAND c.unlocksystemid = :unlocksystemid";
                 $params['userid'] = $USER->id;
                 $params['unlocksystemid'] = $unlocksystem->id;
                 $unlocked_content = $DB->record_exists_sql($sql, $params);
                 if ($unlocked_content) {
                     continue;
                 }
                 $ccm = get_course_and_cm_from_cmid($unlocksystem->coursemoduleid);
                 if ($this->page->course->id != $ccm[0]->id) {
                     continue;
                 }
                 if (!(content_unlock_satisfies_conditions($unlocksystem->restrictions, $this->page->course->id, $USER->id) && (in_array($unlocksystem->conditions, self::$resource_events) || content_unlock_satisfies_block_conditions($unlocksystem, $this->page->course->id, $USER->id)))) {
                     continue;
                 }
                 $cm = $info->get_cm($unlocksystem->coursemoduleid);
                 $eventdescription = is_null($unlocksystem->eventdescription) ? $eventsarray[$unlocksystem->conditions] : $unlocksystem->eventdescription;
                 $unlocklist = $unlocklist . '<li>' . $cm->name . ' (' . get_string('modulename', $cm->modname) . ') por ' . (in_array($unlocksystem->conditions, self::$resource_events) ? content_unlock_get_block_conditions_text($unlocksystem) : $eventdescription) . '</li>';
             }
             if (strlen($unlocklist) > 0) {
                 $this->content->text = '<p>Você pode desbloquear:<ul>' . $unlocklist . '</ul></p>';
             }
         }
         if (isset($this->config)) {
             $lastunlocksnumber = isset($this->config->lastunlocksnumber) ? $this->config->lastunlocksnumber : 1;
         } else {
             $lastunlocksnumber = 0;
         }
         if ($lastunlocksnumber > 0) {
             $sql = "SELECT c.id as id, s.coursemoduleid as coursemoduleid, s.eventdescription as eventdescription, s.conditions as conditions, s.connective as connective\n\t\t\t\t\tFROM\n\t\t\t\t\t\t{content_unlock_log} c\n\t\t\t\t\tINNER JOIN {logstore_standard_log} l ON c.logid = l.id\n\t\t\t\t\tINNER JOIN {content_unlock_system} s ON c.unlocksystemid = s.id\n\t\t\t\t\tWHERE l.userid = :userid\n\t\t\t\t\t\tAND l.courseid = :courseid\n\t\t\t\t\t\tAND s.blockinstanceid = :blockinstanceid\n\t\t\t\t\tORDER BY c.id DESC";
             $params['userid'] = $USER->id;
             $params['courseid'] = $this->page->course->id;
             $params['blockinstanceid'] = $this->instance->id;
             $lastunlocks = $DB->get_records_sql($sql, $params, 0, $lastunlocksnumber);
             if (!empty($lastunlocks)) {
                 $lastunlockslist = '';
                 foreach ($lastunlocks as $lu) {
                     $ccm = get_course_and_cm_from_cmid($lu->coursemoduleid);
                     $course = $DB->get_record('course', array('id' => $ccm[0]->id));
                     $info = get_fast_modinfo($course);
                     $cm = $info->get_cm($lu->coursemoduleid);
                     $eventdescription = is_null($lu->eventdescription) ? $eventsarray[$lu->conditions] : $lu->eventdescription;
                     $lastunlockslist = $lastunlockslist . '<li>' . $cm->name . ' (' . get_string('modulename', $cm->modname) . ') por ' . (in_array($lu->conditions, self::$resource_events) ? content_unlock_get_block_conditions_text($lu) : $eventdescription) . '</li>';
                 }
                 $this->content->text = $this->content->text . '<p>Você desbloqueou recentemente:<ul>' . $lastunlockslist . '</ul></p>';
             }
         }
     }
     return $this->content;
 }
开发者ID:LoysGibertoni,项目名称:mdl_block_content_unlock,代码行数:63,代码来源:block_game_content_unlock.php

示例12: require_login

 require_login($course);
 $completion = new completion_info($course);
 $trackeduser = $user ? $user : $USER->id;
 if (!$completion->is_enabled()) {
     throw new moodle_exception('completionnotenabled', 'completion');
 } else {
     if (!$completion->is_tracked_user($trackeduser)) {
         throw new moodle_exception('nottracked', 'completion');
     }
 }
 if ($user && $rolec) {
     require_sesskey();
     completion_criteria::factory(array('id' => $rolec, 'criteriatype' => COMPLETION_CRITERIA_TYPE_ROLE));
     //TODO: this is dumb, because it does not fetch the data?!?!
     $criteria = completion_criteria_role::fetch(array('id' => $rolec));
     if ($criteria and user_has_role_assignment($USER->id, $criteria->role, $context->id)) {
         $criteria_completions = $completion->get_completions($user, COMPLETION_CRITERIA_TYPE_ROLE);
         foreach ($criteria_completions as $criteria_completion) {
             if ($criteria_completion->criteriaid == $rolec) {
                 $criteria->complete($criteria_completion);
                 break;
             }
         }
     }
     // Return to previous page
     $referer = clean_param($_SERVER['HTTP_REFERER'], PARAM_LOCALURL);
     if (!empty($referer)) {
         redirect($referer);
     } else {
         redirect('view.php?id=' . $course->id);
     }
开发者ID:Keneth1212,项目名称:moodle,代码行数:31,代码来源:togglecompletion.php

示例13: mass_enroll

/**
 * process the mass enrolment
 * @param csv_import_reader $cir  an import reader created by caller
 * @param Object $course  a course record from table mdl_course
 * @param Object $context  course context instance
 * @param Object $data    data from a moodleform 
 * @return string  log of operations 
 */
function mass_enroll($cir, $course, $context, $data) {
    global $CFG,$DB;
    require_once ($CFG->dirroot . '/group/lib.php');

    $result = '';
    
    $courseid=$course->id;
    $roleid = $data->roleassign;
    $useridfield = $data->firstcolumn;

    $enrollablecount = 0;
    $createdgroupscount = 0;
    $createdgroupingscount = 0;
    $createdgroups = '';
    $createdgroupings = '';


    $plugin = enrol_get_plugin('manual');
    //Moodle 2.x enrolment and role assignment are different
    // make sure couse DO have a manual enrolment plugin instance in that course
    //that we are going to use (only one instance is allowed @see enrol/manual/lib.php get_new_instance)
    // thus call to get_record is safe 
    $instance = $DB->get_record('enrol', array('courseid' => $course->id, 'enrol' => 'manual'));
    if (empty($instance)) {
        // Only add an enrol instance to the course if non-existent
        $enrolid = $plugin->add_instance($course);
        $instance = $DB->get_record('enrol', array('id' => $enrolid));
    }
    
   
    // init csv import helper
    $cir->init();
    while ($fields = $cir->next()) {
        $a = new StdClass();

        if (empty ($fields))
            continue;

        // print_r($fields);
        // $enrollablecount++;
        // continue;
        
        // 1rst column = id Moodle (idnumber,username or email)    
        // get rid on eventual double quotes unfortunately not done by Moodle CSV importer 
            $fields[0]= str_replace('"', '', trim($fields[0]));
        
        if (!$user = $DB->get_record('user', array($useridfield => $fields[0]))) {
            $result .= '<div class="alert alert-error">'.get_string('im:user_unknown', 'local_mass_enroll', $fields[0] ). '</div>';
            continue;
        }
        if(!$DB->record_exists_sql("select id from {local_userdata} where costcenterid=$course->costcenter AND userid=$user->id")){
            $costcentername = $DB->get_field('local_costcenter','fullname',array('id'=>$course->costcenter));
            $cs_object = new stdClass();
            $cs_object->csname = $costcentername;
            $cs_object->user   = fullname($user);
            $result .= '<div class="alert alert-error">'.get_string('im:user_notcostcenter', 'local_mass_enroll',$cs_object ). '</div>';
            continue; 
        }
        //already enroled ?
        if (user_has_role_assignment($user->id, $roleid, $context->id)) {
            $result .= '<div class="alert alert-error">'.get_string('im:already_in', 'local_mass_enroll', fullname($user)). '</div>';

        } else {
            //TODO take care of timestart/timeend in course settings
            // done in rev 1.1
            $timestart = time();
            // remove time part from the timestamp and keep only the date part
            $timestart = make_timestamp(date('Y', $timestart), date('m', $timestart), date('d', $timestart), 0, 0, 0);
            if ($instance->enrolperiod) {
                $timeend = $timestart + $instance->enrolperiod;
            } else {
                $timeend = 0;
            }
            // not anymore so easy in Moodle 2.x
            // if (!role_assign($roleid, $user->id, null, $context->id, $timestart, $timeend, 0, 'flatfile')) {
            //    $result .= get_string('im:error_in', 'local_mass_enroll', fullname($user)) . "";
            //    continue;
            //}
            //
            // Enrol the user with this plugin instance (unfortunately return void, no more status )
            $plugin->enrol_user($instance, $user->id,$roleid,$timestart,$timeend);
            $result .= '<div class="alert alert-success">'.get_string('im:enrolled_ok', 'local_mass_enroll', fullname($user)).'</div>';
            $enrollablecount++;
        }

        $group = str_replace('"','',trim($fields[1]));
        // 2nd column ?
        if (empty ($group)) {
            $result .= "";
            continue; // no group for this one
        }

//.........这里部分代码省略.........
开发者ID:narasimhaeabyas,项目名称:tataaiapro,代码行数:101,代码来源:lib.php

示例14: user_has_role_assignment

<?php

global $CFG, $DB, $OUTPUT, $HStuList, $StuList, $course;
$a1 = user_has_role_assignment($USER->id, 1);
$a2 = user_has_role_assignment($USER->id, 2);
$a3 = user_has_role_assignment($USER->id, 3);
$a4 = user_has_role_assignment($USER->id, 4);
$sadmin = is_siteadmin();
//echo $a1.','.$a2.','.$a3.','.$a4.','.$sadmin.'</br> ---';
if ($a2 == 1 || $a3 == 1 || $a4 == 1 || $sadmin == 1) {
    $sql = "SELECT u.username\n\t\t\tFROM mdl_role_assignments ra, mdl_user u, mdl_course c, mdl_context cxt\n\t\t\tWHERE ra.userid = u.id\n\t\t\tAND ra.contextid = cxt.id\n\t\t\tAND cxt.contextlevel =50\n\t\t\tAND cxt.instanceid = c.id\n\t\t\tAND c.shortname = ?\n\t\t\tAND (roleid = 5 OR roleid = 3 )";
    $p = $DB->get_records_sql($sql, array($course->shortname));
    foreach ($p as $k => $v) {
        foreach ($v as $r => $o) {
            $Sval = bin2hex($o);
            $HStuList .= $Sval . ',';
            $StuList .= $o . ',';
        }
    }
    $HStuList .= '-';
    $StuList .= '-';
    //	echo '<html><body onload="myFunction()"></body></html>';
    //	echo 'List of H students :'.$HStuList;
    //	echo '</br>';
    //	echo 'List of  students :'.$StuList;
    //	echo '</br>';
    //      echo 'name: '.$course->shortname;
}
开发者ID:Akshay224,项目名称:moodle-mod_streamline,代码行数:28,代码来源:DataPrep.php

示例15: array

     }
 }
 // Group members
 if ($canseemembers) {
     if ($members = groups_get_members($group->id)) {
         $membernames = array();
         foreach ($members as $member) {
             $pic = $OUTPUT->user_picture($member, array('courseid' => $course->id));
             if ($member->id == $USER->id) {
                 $membernames[] = '<span class="me">' . $pic . '&nbsp;' . fullname($member, $viewfullnames) . '</span>';
             } else {
                 $membernames[] = $pic . '&nbsp;<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $member->id . '&amp;course=' . $course->id . '">' . fullname($member, $viewfullnames) . '</a>';
             }
         }
         // Show assigned teacher, if exists, when enabled or when user is non-assigned teacher
         if ($groupselect->showassignedteacher or user_has_role_assignment($USER->id, $ASSIGNROLE, context_course::instance($course->id)->id)) {
             $teacherid = null;
             foreach ($assigned_relation as $r) {
                 if ($r->groupid === $group->id) {
                     $teacherid = $r->id;
                     break;
                 }
             }
             if ($teacherid) {
                 $teacher = null;
                 foreach ($assigned_teachers as $a) {
                     if ($a->id === $teacherid) {
                         $teacher = $a;
                         $break;
                     }
                 }
开发者ID:nwp90,项目名称:moodle-mod_groupselect,代码行数:31,代码来源:view.php


注:本文中的user_has_role_assignment函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。