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


PHP get_course_students函数代码示例

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


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

示例1: groups_create_automatic_grouping

/**
 * Distributes students into groups randomly and creates a grouping with those 
 * groups.
 * 
 * You need to call groups_seed_random_number_generator() at some point in your 
 * script before calling this function. 
 * 
 * Note that this function does not distribute teachers into groups - this still 
 * needs to be done manually. 
 * 
 * @param int $courseid The id of the course that the grouping should belong to
 * @param int $nostudentspergroup The number of students to put in each group - 
 * this can be set to false if you prefer to specify the number of groups 
 * instead
 * @param int $nogroups The number of groups - this can be set to false if you 
 * prefer to specify the number of student in each group. If both are specified 
 * then $nostudentspergroup takes precedence. If neither is
 * specified then the function does nothing and returns false. 
 * @param boolean $distribevenly If $noofstudentspergroup is specified, then 
 * if this is set to true, any leftover students are distributed evenly among 
 * the groups, whereas if it is set to false then they are put in a separate 
 * group. 
 * @param object $groupsettings The default settings to give each group. 
 * This should contain prefix and defaultgroupdescription fields. The groups 
 * are named with the prefix followed by 1, 2, etc. and given the
 * default group description set. 
 * @param int $groupid If this is not set to false, then only students in the 
 * specified group are distributed into groups, not all the students enrolled on 
 * the course. 
 * @param boolean $alphabetical If this is set to true, then the students are 
 * not distributed randomly but in alphabetical order of last name. 
 * @return int The id of the grouping
 */
function groups_create_automatic_grouping($courseid, $nostudentspergroup, $nogroups, $distribevenly, $groupingsettings, $groupid = false, $alphabetical = false)
{
    if (!$nostudentspergroup and !$noteacherspergroup and !$nogroups) {
        $groupingid = false;
    } else {
        // Set $userids to the list of students that we want to put into groups
        // in the grouping
        if (!$groupid) {
            $users = get_course_students($courseid);
            $userids = groups_users_to_userids($users);
        } else {
            $userids = groups_get_members($groupid);
        }
        // Distribute the users into sets according to the parameters specified
        $userarrays = groups_distribute_in_random_sets($userids, $nostudentspergroup, $nogroups, $distribevenly, !$alphabetical);
        if (!$userarrays) {
            $groupingid = false;
        } else {
            // Create the grouping that the groups we create will go into
            $groupingid = groups_create_grouping($courseid, $groupingsettings);
            // Get the prefix for the names of each group and default group
            // description to give each group
            if (!$groupingsettings->prefix) {
                $prefix = get_string('defaultgroupprefix', 'groups');
            } else {
                $prefix = $groupingsettings->prefix;
            }
            if (!$groupingsettings->defaultgroupdescription) {
                $defaultgroupdescription = '';
            } else {
                $defaultgroupdescription = $groupingsettings->defaultgroupdescription;
            }
            // Now create a group for each set of students, add the group to the
            // grouping and then add the students
            $i = 1;
            foreach ($userarrays as $userids) {
                $groupsettings->name = $prefix . ' ' . $i;
                $groupsettings->description = $defaultgroupdescription;
                $i++;
                $groupid = groups_create_group($courseid, $groupsettings);
                $groupadded = groups_add_group_to_grouping($groupid, $groupingid);
                if (!$groupid or !$groupadded) {
                    $groupingid = false;
                } else {
                    if ($userids) {
                        foreach ($userids as $userid) {
                            $usersadded = groups_add_member($groupid, $userid);
                            // If unsuccessful just carry on I guess
                        }
                    }
                }
            }
        }
    }
    return $groupingid;
}
开发者ID:veritech,项目名称:pare-project,代码行数:89,代码来源:automaticgroupinglib.php

示例2: array

// these are ones that have been checked and submitted to the page
if (isset($_REQUEST['read'])) {
    $read = $_REQUEST['read'];
} else {
    $read = array();
}
if (isset($_REQUEST['write'])) {
    $write = $_REQUEST['write'];
} else {
    $write = array();
}
// either grab all the students or grab all the students in a given group
if ($groupid != -1) {
    $students = get_group_users($groupid, 'u.firstname ASC, u.lastname ASC');
} else {
    $students = get_course_students($courseid, "u.firstname ASC, u.lastname ASC", "", 0, 99999, '', '', NULL, '', 'u.id,u.firstname,u.lastname');
}
if (!($groups = get_groups($courseid))) {
    $groups = array();
}
// dont think we need to pass anything here... ?
print_header("", "", "", "", "", true, "");
print_heading(get_string('permissions', 'netpublish'), 'center', 3);
// start the form off
echo "<form method=\"post\" action=\"permissions.php\" name=\"theform\" id=\"theform\">\n    <input type=\"hidden\" name=\"id\" value=\"{$courseid}\" />\n    <input type=\"hidden\" name=\"groupid\" value=\"\" />";
// making tabs
$tabs = array();
$tabrows = array();
// this tab is for viewing all the students
$tabrows[] = new tabobject(-1, "javascript:document.theform.groupid.value=-1; document.theform.submit();", get_string('viewall', 'netpublish'));
// create a tab foreach group
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:31,代码来源:permissions.php

示例3: add_to_log

            $entrybyuser[$entry->userid]->rating = $vals['r'];
            $entrybyuser[$entry->userid]->entrycomment = $vals['c'];
            $entrybyuser[$entry->userid]->teacher = $USER->id;
            $entrybyuser[$entry->userid]->timemarked = $timenow;
        }
    }
    add_to_log($course->id, "journal", "update feedback", "report.php?id={$cm->id}", "{$count} users", $cm->id);
    notify(get_string("feedbackupdated", "journal", "{$count}"), "green");
} else {
    add_to_log($course->id, "journal", "view responses", "report.php?id={$cm->id}", "{$journal->id}", $cm->id);
}
/// Print out the journal entries
if ($currentgroup) {
    $users = get_group_users($currentgroup);
} else {
    $users = get_course_students($course->id);
}
if (!$users) {
    print_heading(get_string("nousersyet"));
} else {
    $grades = make_grades_menu($journal->assessed);
    $teachers = get_course_teachers($course->id);
    $allowedtograde = ($groupmode != VISIBLEGROUPS or isteacheredit($course->id) or ismember($currentgroup));
    if ($allowedtograde) {
        echo '<form action="report.php" method="post">';
    }
    if ($usersdone = journal_get_users_done($journal)) {
        foreach ($usersdone as $user) {
            if ($currentgroup) {
                if (!ismember($currentgroup, $user->id)) {
                    /// Yes, it's inefficient, but this module will die
开发者ID:veritech,项目名称:pare-project,代码行数:31,代码来源:report.php

示例4: nanogong_unlock_all_messages

/**
 * Unlock messages in the NanoGong database.
 **/
function nanogong_unlock_all_messages($nanogong, $groupid)
{
    global $CFG, $USER;
    if (!isteacheredit($nanogong->course)) {
        return false;
    }
    if (empty($groupid)) {
        $students = get_course_students($nanogong->course, "u.lastname, u.firstname");
    } else {
        $students = get_course_students($nanogong->course, "u.lastname, u.firstname", '', '', '', '', '', $groupid);
    }
    if (!$students) {
        $students = array();
    }
    foreach ($students as $student) {
        $nanogong_messages = get_records_select("nanogong_message", "nanogongid={$nanogong->id} AND userid={$student->id}");
        if (!$nanogong_messages) {
            $nanogong_messages = array();
        }
        foreach ($nanogong_messages as $nanogong_message) {
            $nanogong_message->locked = 0;
            update_record("nanogong_message", $nanogong_message);
        }
    }
    return true;
}
开发者ID:nagyistoce,项目名称:moodle-Teach-Pilot,代码行数:29,代码来源:locallib.php

示例5: hotpot_get_report_users

function hotpot_get_report_users($course, $formdata)
{
    $users = array();
    /// Check to see if groups are being used in this module
    $groupmode = groupmode($course, $cm);
    //TODO: there is no $cm defined!
    $currentgroup = setup_and_print_groups($course, $groupmode, "report.php?id={$cm->id}&mode=simple");
    $sort = "u.lastname ASC";
    switch ($formdata['reportusers']) {
        case 'students':
            if ($currentgroup) {
                $users = get_group_students($currentgroup, $sort);
            } else {
                $users = get_course_students($course->id, $sort);
            }
            break;
        case 'all':
            if ($currentgroup) {
                $users = get_group_users($currentgroup, $sort);
            } else {
                $users = get_course_users($course->id, $sort);
            }
            break;
    }
    return $users;
}
开发者ID:r007,项目名称:PMoodle,代码行数:26,代码来源:report.php

示例6: redirect

     redirect("view.php?id={$cm->id}", get_string('nopersonchosen', 'dialogue'));
 } else {
     if (substr($params->recipientid, 0, 1) == 'g') {
         // it's a group
         $groupid = intval(substr($params->recipientid, 1));
         $sql = "SELECT MAX(grouping)+1 AS grouping from {$CFG->prefix}dialogue_conversations";
         $grouping = get_field_sql($sql);
         if (!$grouping) {
             $grouping = 1;
         }
         if ($groupid) {
             // it's a real group
             $recipients = get_records_sql("SELECT u.*" . " FROM {$CFG->prefix}user u," . " {$CFG->prefix}groups_members g" . " WHERE g.groupid = {$groupid} " . " AND u.id = g.userid");
         } else {
             // it's all participants
             $recipients = get_course_students($course->id);
         }
     } else {
         $recipients[$params->recipientid] = get_record('user', 'id', $params->recipientid);
         $groupid = 0;
         $grouping = 0;
     }
     if ($recipients) {
         $n = 0;
         foreach ($recipients as $recipient) {
             if ($recipient->id == $USER->id) {
                 // teacher could be member of a group
                 continue;
             }
             if (empty($params->firstentry)) {
                 redirect("view.php?id={$cm->id}", get_string('notextentered', 'dialogue'));
开发者ID:netspotau,项目名称:moodle-mod_dialogue,代码行数:31,代码来源:dialogues.php

示例7: wwassignment_grades

/**
* @desc Contacts webwork to find out the completion status of a problem set for all users in a course.
* @param integer $wwassignmentid The problem set
* @return object The student grades indexed by student ID.
*/
function wwassignment_grades($wwassignmentid)
{
    //	error_log("Begin wwassignment_grades -- legacy function?");
    global $COURSE, $DB;
    $wwclient = new wwassignment_client();
    $wwassignment = $DB->get_record('wwassignment', array('id' => $wwassignmentid));
    $courseid = $wwassignment->course;
    $studentgrades = new stdClass();
    $studentgrades->grades = array();
    $studentgrades->maxgrade = 0;
    $gradeformula = '$finalgrade += ($problem->status > 0) ? 1 : 0;';
    $wwcoursename = _wwassignment_mapped_course($courseid, false);
    $wwsetname = _wwassignment_mapped_set($wwassignmentid, false);
    // enumerate over the students in the course:
    $students = get_course_students($courseid);
    $usernamearray = array();
    foreach ($students as $student) {
        array_push($usernamearray, $student->username);
    }
    $gradearray = $wwclient->grade_users_sets($wwcoursename, $usernamearray, $wwsetname);
    $i = 0;
    foreach ($students as $student) {
        $studentgrades->grades[$student->id] = $gradearray[$i];
        $i++;
    }
    $studentgrades->maxgrade = $wwclient->get_max_grade($wwcoursename, $wwsetname);
    //    error_log("End wwassignment_grades -- legacy function?");
    return $studentgrades;
}
开发者ID:bjornbe,项目名称:wwassignment,代码行数:34,代码来源:lib.php

示例8: mygroupid

            if (isadmin()) {
                $mygroupid = false;
                $SESSION->lstgroupid = false;
            } else {
                $mygroupid = mygroupid($course->id);
            }
        } else {
            $mygroupid = $SESSION->lstgroupid;
        }
        if ($mygroupid) {
            $students = get_group_students($mygroupid, 'u.lastname ASC');
        } else {
            $students = get_course_students($course->id, $sort = "u.lastname", $dir = "ASC");
        }
    } else {
        $students = get_course_students($course->id, $sort = "u.lastname", $dir = "ASC");
    }
    $mygroupid = isset($mygroupid) ? $mygroupid : NULL;
    $completedFeedbackCount = get_completeds_group_count($feedback, $mygroupid);
    echo '<div align="center"><a href="analysis.php?id=' . $id . '">';
    echo get_string('analysis', 'feedback') . ' (' . get_string('completed_feedbacks', 'feedback') . ': ' . $completedFeedbackCount . ')</a>';
    echo '</div>';
}
echo '<p>';
print_simple_box_start('center');
if (isteacher($course->id) || isadmin()) {
    echo '<div align="center">';
    echo '<form action="edit.php?id=' . $id . '" method="post">';
    echo '<input type="hidden" name="sesskey" value="' . $USER->sesskey . '" />';
    echo '<input type="hidden" name="id" value="' . $id . '" />';
    echo '<button type="submit">' . get_string('edit_items', 'feedback') . '</button>';
开发者ID:kai707,项目名称:ITSA-backup,代码行数:31,代码来源:view.php

示例9: error

         error(get_string('theCOurseNowNoStudent6', 'block_report_module'));
     } else {
         if ($course = $DB->get_record('course', array('id' => $courseID))) {
             $userPass = true;
             $timeDifferent = getTimeDifferent($dateform);
             $courseUserLogData = produceUserCourseLog($userID, $courseID, $timeDifferent);
             $courseUserArray[$courseID] = produceCourseUserArray($userID, $courseID, $courseUserLogData, $userPass);
             $userPassArray[$courseID] = $userPass;
         } else {
             error(get_string('pleaseSelectRightCourseName6', 'block_report_module'));
         }
     }
 } else {
     $courses = reportmycoursesdata($userID);
     foreach ($courses as $theCourseID => $theCourseName) {
         if (get_course_students($theCourseID)) {
             //!the course no student
             if ($DB->get_record('reportmodule', array('courseid' => $theCourseID))) {
                 //!the course don't setup stardard
                 if ($courseActionItem = getCourseActionItem($theCourseID)) {
                     //!the course no action
                     $userPass = true;
                     $timeDifferent = getTimeDifferent($dateform);
                     $courseUserLogData = produceUserCourseLog($userID, $theCourseID, $timeDifferent);
                     $courseUserArray[$theCourseID] = produceCourseUserArray($userID, $theCourseID, $courseUserLogData, $userPass);
                     $userPassArray[$theCourseID] = $userPass;
                 }
             }
         }
     }
     if (!$courseUserArray) {
开发者ID:stepsgithub,项目名称:moodle-block_report_module,代码行数:31,代码来源:index.php

示例10: nanogong_grades

/**
 * Must return an array of grades for a given instance of this module, 
 * indexed by user.  It also returns a maximum allowed grade.
 * 
 * Example:
 *    $return->grades = array of grades;
 *    $return->maxgrade = maximum allowed grade;
 *
 *    return $return;
 *
 * @param int $modid ID of an instance of this module
 * @return mixed Null or object with an array of grades and with the maximum grade
 **/
function nanogong_grades($modid)
{
    if (!($nanogong = get_record('nanogong', 'id', $modid))) {
        return null;
    }
    $grades = array();
    $students = get_course_students($nanogong->course);
    $nanogong_messages = get_records("nanogong_message", "nanogongid", $nanogong->id);
    if ($students != null) {
        foreach ($students as $student) {
            $grade = "-";
            if ($nanogong_messages) {
                $count = 0;
                foreach ($nanogong_messages as $nanogong_message) {
                    if ($nanogong_message->userid != $student->id) {
                        continue;
                    }
                    if ($grade == "-") {
                        $grade = $nanogong_message->score;
                    } else {
                        $grade += $nanogong_message->score;
                    }
                    $count++;
                }
                if ($count > 0) {
                    $grade = $grade / $count;
                }
            }
            $grades[$student->id] = $grade;
        }
    }
    $return->grades = $grades;
    $return->maxgrade = $nanogong->maxscore;
    return $return;
}
开发者ID:kai707,项目名称:ITSA-backup,代码行数:48,代码来源:lib.php

示例11: webquest_grades

function webquest_grades($webquestid)
{
    $return = null;
    if ($webquest = get_record("webquest", "id", $webquestid)) {
        if ($webquest->gradingstrategy > 0) {
            if (!$webquest->teamsmode) {
                if ($students = get_course_students($webquest->course)) {
                    foreach ($students as $student) {
                        $submission = get_record("webquest_submissions", "webquestid", $webquest->id, "userid", $student->id);
                        if (count_records("webquest_grades", "sid", $submission->id)) {
                            $grade = number_format($submission->grade * $webquest->grade / 100);
                        } else {
                            $grade = null;
                        }
                        $return->grades[$student->id] = $grade;
                    }
                }
            } else {
                if ($students = get_course_students($webquest->course)) {
                    if ($submissionsraw = get_records("webquest_submissions", "webquestid", $webquest->id)) {
                        require_once "locallib.php";
                        foreach ($submissionsraw as $submission) {
                            if (count_records("webquest_grades", "sid", $submission->id)) {
                                $grade = number_format($submission->grade * $webquest->grade / 100);
                            } else {
                                $grade = null;
                            }
                            if ($membersid = webquest_get_team_members($submission->userid)) {
                                foreach ($membersid as $memberid) {
                                    $return->grades[$memberid] = $grade;
                                }
                            }
                        }
                    }
                }
            }
            $return->maxgrade = $webquest->grade;
        }
    }
    return $return;
}
开发者ID:kai707,项目名称:ITSA-backup,代码行数:41,代码来源:lib.php

示例12: cron

 function cron()
 {
     global $DB;
     $status = true;
     require_once 'lib/function.php';
     if ($courses = $DB->get_records_select('reportmodule', array())) {
         $output = '';
         $separate = ',';
         foreach ($courses as $course) {
             $courseUserArray = array();
             $userPassArray = array();
             $userIDDataArray = array();
             $actionIDNameArray = array();
             $courseID = $course->courseid;
             $students = get_course_students($courseID);
             $timeDifferent = getTimeDifferent('all');
             if ($students) {
                 foreach ($students as $theUserID => $theStudentObj) {
                     if (!$DB->get_record('user', array('id' => $theUserID))) {
                         break;
                     }
                     $userPass = true;
                     $courseUserLogData = produceUserCourseLog($theUserID, $courseID, $timeDifferent);
                     $courseUserArray[$theUserID] = produceCourseUserArray($theUserID, $courseID, $courseUserLogData, $userPass);
                     $userPassArray[$theUserID] = $userPass;
                 }
             }
             /*
             $category = $DB->get_record('course_categories', array('id'=>$course->category));
             $categoryName = format_string($category->name);
             */
             $course = $DB->get_record('course', array('id' => $courseID));
             $courseName = format_string($course->fullname);
             foreach ($courseUserArray as $theUserID => $courseUserData) {
                 $user = $DB->get_record('user', array('id' => $theUserID));
                 $userIDDataArray[$theUserID] = array();
                 $userIDDataArray[$theUserID]['name'] = $user->firstname . $user->lastname;
                 $userIDDataArray[$theUserID]['description'] = $user->description;
                 $userIDDataArray[$theUserID]['email'] = $user->email;
                 foreach ($courseUserData as $courseUserActionID => $courseUserActionContent) {
                     $actionIDNameArray[$courseUserActionID] = getCourseActionModName($courseUserActionID) ? getCourseActionModName($courseUserActionID) : get_string('courseTime3', 'reportmodule');
                 }
             }
             foreach ($courseUserArray as $userID => $actionInfo) {
                 $output .= $course->id . $separate;
                 $output .= $course->fullname . $separate;
                 //$output .= $userIDDataArray[$userID]['name'] . $separate;
                 //$output .= $userIDDataArray[$userID]['description'] . $separate;
                 $output .= $userIDDataArray[$userID]['email'] . $separate;
                 $passType = 0;
                 $coursePass = false;
                 $courseTime = 0;
                 $courseDate = '';
                 $actionPass = false;
                 $actionScore = 0;
                 $actionDate = 0;
                 $actionQuiz = 0;
                 foreach ($actionInfo as $actionID => $actionContent) {
                     if ($actionID == 'course') {
                         if ($actionContent['timeEnable']) {
                             $coursePass = $actionContent['timePass'];
                             $courseTime = $actionContent['time'];
                             $courseDate = $actionContent['date'] ? date('Y/m/d', $actionContent['date']) : '';
                             $passType += 1;
                         }
                     }
                     if ($actionContent['timeEnable']) {
                         //$output .= $actionContent['time'] . $separate;
                     }
                     if ($actionContent['scoreEnable']) {
                         //$output .= $actionContent['score'] . $separate;
                         // First Quiz
                         if ($actionContent['itemmodule'] == 'quiz' && !$actionQuiz) {
                             $actionPass = $actionContent['scorePass'];
                             $actionScore = $actionContent['score'];
                             $actionDate = $actionContent['scoreDate'] ? date('Y/m/d', $actionContent['scoreDate']) : '';
                             $actionQuiz++;
                             $passType += 2;
                         }
                     }
                     if ($actionContent['timePass'] and $actionContent['scorePass']) {
                         //$output .= '通過' . $separate;
                     } else {
                         //$output .= '不通過' . $separate;
                     }
                 }
                 //$output .= $userPassArray[$userID]?'通過':'不通過';
                 $output .= $passType . $separate . ($coursePass ? '1' : '0') . $separate . ($actionPass ? '1' : '0') . $separate . $courseTime . $separate . $actionScore . $separate . $courseDate . $separate . $actionDate;
                 $output .= "\r\n";
             }
         }
     }
     $temp = tmpfile();
     fwrite($temp, $output);
     fseek($temp, 0);
     $meta_data = stream_get_meta_data($temp);
     $filename = $meta_data["uri"];
     // FTP access parameters
     $host = 'FTP_HOST';
     $usr = 'FTP_USER';
//.........这里部分代码省略.........
开发者ID:stepsgithub,项目名称:moodle-block_report_module,代码行数:101,代码来源:block_report_module.php

示例13: exercise_list_submissions_for_admin

function exercise_list_submissions_for_admin($exercise)
{
    // list the teacher sublmissions first
    global $CFG, $USER;
    if (!($course = get_record("course", "id", $exercise->course))) {
        error("Course is misconfigured");
    }
    if (!($cm = get_coursemodule_from_instance("exercise", $exercise->id, $course->id))) {
        error("Course Module ID was incorrect");
    }
    $groupid = get_current_group($course->id);
    exercise_print_assignment_info($exercise);
    print_heading_with_help(get_string("administration"), "administration", "exercise");
    echo "<p align=\"center\"><b><a href=\"assessments.php?action=teachertable&amp;id={$cm->id}\">" . get_string("teacherassessmenttable", "exercise", $course->teacher) . "</a></b></p>\n";
    if (isteacheredit($course->id)) {
        // list any teacher submissions
        $table->head = array(get_string("title", "exercise"), get_string("submitted", "exercise"), get_string("action", "exercise"));
        $table->align = array("left", "left", "left");
        $table->size = array("*", "*", "*");
        $table->cellpadding = 2;
        $table->cellspacing = 0;
        if ($submissions = exercise_get_teacher_submissions($exercise)) {
            foreach ($submissions as $submission) {
                $action = "<a href=\"submissions.php?action=adminamendtitle&amp;id={$cm->id}&amp;sid={$submission->id}\">" . get_string("amendtitle", "exercise") . "</a>";
                if (isteacheredit($course->id)) {
                    $action .= " | <a href=\"submissions.php?action=adminconfirmdelete&amp;id={$cm->id}&amp;sid={$submission->id}\">" . get_string("delete", "exercise") . "</a>";
                }
                $table->data[] = array(exercise_print_submission_title($exercise, $submission), userdate($submission->timecreated), $action);
            }
            print_heading(get_string("studentsubmissions", "exercise", $course->teacher), "center");
            print_table($table);
        }
    }
    // list student assessments
    // Get all the students...
    if ($users = get_course_students($course->id, "u.lastname, u.firstname")) {
        $timenow = time();
        unset($table);
        $table->head = array(get_string("name"), get_string("title", "exercise"), get_string("assessed", "exercise"), get_string("action", "exercise"));
        $table->align = array("left", "left", "left", "left");
        $table->size = array("*", "*", "*", "*");
        $table->cellpadding = 2;
        $table->cellspacing = 0;
        $nassessments = 0;
        foreach ($users as $user) {
            // check group membership, if necessary
            if ($groupid) {
                // check user's group
                if (!groups_is_member($groupid, $user->id)) {
                    continue;
                    // skip this user
                }
            }
            if ($assessments = exercise_get_user_assessments($exercise, $user)) {
                $title = '';
                foreach ($assessments as $assessment) {
                    if (!($submission = get_record("exercise_submissions", "id", $assessment->submissionid))) {
                        error("exercise_list_submissions_for_admin: Submission record not found!");
                    }
                    $title .= $submission->title;
                    // test for allocated assesments which have not been done
                    if ($assessment->timecreated < $timenow) {
                        // show only warm or cold assessments
                        $title .= " {" . number_format($assessment->grade * $exercise->grade / 100.0, 0);
                        if ($assessment->timegraded) {
                            $title .= "/" . number_format($assessment->gradinggrade * $exercise->gradinggrade / 100.0, 0);
                        }
                        $title .= "} ";
                        if ($realassessments = exercise_count_user_assessments_done($exercise, $user)) {
                            $action = "<a href=\"assessments.php?action=adminlistbystudent&amp;id={$cm->id}&amp;userid={$user->id}\">" . get_string("view", "exercise") . "</a>";
                        } else {
                            $action = "";
                        }
                        $nassessments++;
                        $table->data[] = array(fullname($user), $title, userdate($assessment->timecreated), $action);
                    }
                }
            }
        }
        if (isset($table->data)) {
            if ($groupid) {
                if (!groups_group_exists($groupid)) {
                    //TODO:
                    error("List unassessed student submissions: group not found");
                }
                print_heading("{$group->name} " . get_string("studentassessments", "exercise", $course->student) . " [{$nassessments}]");
            } else {
                print_heading(get_string("studentassessments", "exercise", $course->student) . " [{$nassessments}]");
            }
            print_table($table);
            echo "<p align=\"center\">" . get_string("noteonstudentassessments", "exercise");
            echo "<br />{" . get_string("maximumgrade") . ": {$exercise->grade} / " . get_string("maximumgrade") . ": {$exercise->gradinggrade}}</p>\n";
            // grading grade analysis
            unset($table);
            $table->head = array(get_string("count", "exercise"), get_string("mean", "exercise"), get_string("standarddeviation", "exercise"), get_string("maximum", "exercise"), get_string("minimum", "exercise"));
            $table->align = array("center", "center", "center", "center", "center");
            $table->size = array("*", "*", "*", "*", "*");
            $table->cellpadding = 2;
            $table->cellspacing = 0;
            if ($groupid) {
//.........这里部分代码省略.........
开发者ID:r007,项目名称:PMoodle,代码行数:101,代码来源:locallib.php

示例14: wwassignment_grades

/**
* @desc Contacts webwork to find out the completion status of a problem set for all users in a course.
* @param integer $wwassignmentid The problem set
* @return object The student grades indexed by student ID.
*/
function wwassignment_grades($wwassignmentid)
{
    global $COURSE;
    $wwclient = new wwassignment_client();
    $studentgrades = new stdClass();
    $studentgrades->grades = array();
    $studentgrades->maxgrade = 0;
    $gradeformula = '$finalgrade += ($problem->status > 0) ? 1 : 0;';
    $wwcoursename = _wwassignment_mapped_course($COURSE->id, false);
    $wwsetname = _wwassignment_mapped_set($wwassignmentid, false);
    // enumerate over the students in the course:
    $students = get_course_students($COURSE->id);
    $usernamearray = array();
    foreach ($students as $student) {
        array_push($usernamearray, $student->username);
    }
    $gradearray = $wwclient->grade_users_sets($wwcoursename, $usernamearray, $wwsetname);
    $i = 0;
    foreach ($students as $student) {
        $studentgrades->grades[$student->id] = $gradearray[$i];
        $i++;
    }
    $studentgrades->maxgrade = $wwclient->get_max_grade($wwcoursename, $wwsetname);
    return $studentgrades;
}
开发者ID:bjornbe,项目名称:wwassignment,代码行数:30,代码来源:lib.php

示例15: build_facstu_list_table

 function build_facstu_list_table($interview, $cm, $course)
 {
     global $DB, $OUTPUT;
     $strstudent = get_string('student', 'interview');
     $strphoto = get_string('photo', 'interview');
     $stremail = get_string('email', 'interview');
     // collects the students in the course
     $students = get_course_students($course->id, $sort = "u.lastname", $dir = "ASC");
     // If there are no students, will notify
     if (!$students) {
         $OUTPUT->notify(get_string('noexistingstudents'));
         // If there are students, creates a table with the users
         // that have not picked a horary string
     } else {
         // Defines the headings and alignments in the table of students
         $stu_list_table = new html_table();
         $stu_list_table->head = array($strphoto, $strstudent, $stremail);
         $stu_list_table->align = array('CENTER', 'CENTER', 'CENTER');
         $stu_list_table->data = array();
         // Begins the link to send mail to all the
         // students that have not picked a string
         $mailto = '<a href="mailto:';
         // Para cada uno de los estudiantes
         // For each of the students
         foreach ($students as $student) {
             $row = array();
             // If a relationship that complies with the restrictions does not exist
             if (!$DB->record_exists('interview_slots', array('student' => $student->id, 'interviewid' => $interview->id))) {
                 // Shows the user image
                 $picture = $OUTPUT->user_picture($student);
                 $row["picture"] = $picture;
                 // Shows the full name in link format
                 $name = "<a href=\"../../user/view.php?id={$student->id}&amp;course={$interview->course}\">" . fullname($student) . "</a>";
                 $row["name"] = $name;
                 // Creates a link to the mailto list for the user
                 $email = obfuscate_mailto($student->email);
                 $row["email"] = $email;
                 // Inserts the data in the table
                 $stu_list_table->data[] = array($picture, $name, $email);
                 //, $actions);
             }
         }
     }
     return $stu_list_table;
 }
开发者ID:eriko,项目名称:interview,代码行数:45,代码来源:renderer.php


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