本文整理汇总了PHP中groups_get_group_name函数的典型用法代码示例。如果您正苦于以下问题:PHP groups_get_group_name函数的具体用法?PHP groups_get_group_name怎么用?PHP groups_get_group_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了groups_get_group_name函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: report_data
public function report_data($visualreport)
{
$data = array();
$data['header'] = array();
$data['header']['student'] = 'student';
$data['header']['grade'] = 'grade';
$data['header']['item'] = 'item';
$data['header']['group'] = 'group';
foreach ($visualreport->grades as $itemkey => $itemgrades) {
foreach ($itemgrades as $studentkey => $studentdata) {
if ($studentdata != null && $studentdata->finalgrade != null) {
foreach (groups_get_user_groups($visualreport->courseid, $studentkey) as $grouping) {
if (count($grouping) > 0) {
foreach ($grouping as $group) {
$data[$studentkey . '-' . $itemkey . '-' . $group]['student'] = $visualreport->users[$studentkey]->firstname . ' ' . $visualreport->users[$studentkey]->lastname;
$data[$studentkey . '-' . $itemkey . '-' . $group]['grade'] = $studentdata->standardise_score($studentdata->finalgrade, $visualreport->gtree->items[$itemkey]->grademin, $visualreport->gtree->items[$itemkey]->grademax, 0, 100);
$data[$studentkey . '-' . $itemkey . '-' . $group]['item'] = $visualreport->gtree->items[$itemkey]->get_name();
$data[$studentkey . '-' . $itemkey . '-' . $group]['group'] = groups_get_group_name($group);
}
} else {
$data[$studentkey . '-' . $itemkey . '-ng']['student'] = $visualreport->users[$studentkey]->firstname . ' ' . $visualreport->users[$studentkey]->lastname;
$data[$studentkey . '-' . $itemkey . '-ng']['grade'] = $studentdata->standardise_score($studentdata->finalgrade, $visualreport->gtree->items[$itemkey]->grademin, $visualreport->gtree->items[$itemkey]->grademax, 0, 100);
$data[$studentkey . '-' . $itemkey . '-ng']['item'] = $visualreport->gtree->items[$itemkey]->get_name();
$data[$studentkey . '-' . $itemkey . '-ng']['group'] = get_string('nogroup', 'gradereport_visual');
}
}
}
}
}
return $data;
}
示例2: groups_get_group_displayname
/**
* Returns the display name of a group - the group name followed by
* the number of members in brackets.
* @param int $groupid The group ID.
* @return string The display name of the group
*/
function groups_get_group_displayname($groupid)
{
if ($groupname = groups_get_group_name($groupid)) {
$count = groups_count_group_members($groupid);
return "{$groupname} ({$count})";
}
return false;
}
示例3: report_data
public function report_data($visualreport)
{
$data = array();
$data['header'] = array();
$data['header']['grade'] = 'grade';
$data['header']['item'] = 'item';
$data['header']['group'] = 'group';
$count = array();
foreach ($visualreport->grades as $itemkey => $itemgrades) {
foreach ($itemgrades as $studentkey => $studentdata) {
if ($studentdata != null && $studentdata->finalgrade != null) {
foreach (groups_get_user_groups($visualreport->courseid, $studentkey) as $grouping) {
if (count($grouping) > 0) {
foreach ($grouping as $group) {
if (!isset($data[$itemkey . '-' . $group])) {
$data[$itemkey . '-' . $group] = array();
$data[$itemkey . '-' . $group]['grade'] = $studentdata->standardise_score($studentdata->finalgrade, $visualreport->gtree->items[$itemkey]->grademin, $visualreport->gtree->items[$itemkey]->grademax, 0, 100);
$data[$itemkey . '-' . $group]['item'] = $visualreport->gtree->items[$itemkey]->get_name();
$data[$itemkey . '-' . $group]['group'] = groups_get_group_name($group);
$count[$itemkey . '-' . $group] = 1;
} else {
$data[$itemkey . '-' . $group]['grade'] += $studentdata->standardise_score($studentdata->finalgrade, $visualreport->gtree->items[$itemkey]->grademin, $visualreport->gtree->items[$itemkey]->grademax, 0, 100);
$count[$itemkey . '-' . $group]++;
}
}
} else {
if (!isset($data[$itemkey . '-ng'])) {
$data[$itemkey . '-ng'] = array();
$data[$itemkey . '-ng']['grade'] = $studentdata->standardise_score($studentdata->finalgrade, $visualreport->gtree->items[$itemkey]->grademin, $visualreport->gtree->items[$itemkey]->grademax, 0, 100);
$data[$itemkey . '-ng']['item'] = $visualreport->gtree->items[$itemkey]->get_name();
$data[$itemkey . '-ng']['group'] = get_string('nogroup', 'gradereport_visual');
$count[$itemkey . '-ng'] = 1;
} else {
$data[$itemkey . '-ng']['grade'] += $studentdata->standardise_score($studentdata->finalgrade, $visualreport->gtree->items[$itemkey]->grademin, $visualreport->gtree->items[$itemkey]->grademax, 0, 100);
$count[$itemkey . '-ng']++;
}
}
if (!isset($data[$itemkey . '-ag'])) {
$data[$itemkey . '-ag'] = array();
$data[$itemkey . '-ag']['grade'] = $studentdata->standardise_score($studentdata->finalgrade, $visualreport->gtree->items[$itemkey]->grademin, $visualreport->gtree->items[$itemkey]->grademax, 0, 100);
$data[$itemkey . '-ag']['item'] = $visualreport->gtree->items[$itemkey]->get_name();
$data[$itemkey . '-ag']['group'] = get_string('allgroups', 'gradereport_visual');
$count[$itemkey . '-ag'] = 1;
} else {
$data[$itemkey . '-ag']['grade'] += $studentdata->standardise_score($studentdata->finalgrade, $visualreport->gtree->items[$itemkey]->grademin, $visualreport->gtree->items[$itemkey]->grademax, 0, 100);
$count[$itemkey . '-ag']++;
}
}
}
}
}
foreach ($data as $key => $row) {
if ($key != 'header') {
$data[$key]['grade'] /= $count[$key];
}
}
return $data;
}
示例4: test_create_group
function test_create_group()
{
$this->assertTrue($this->groupid = groups_create_group($this->courseid));
$this->assertTrue(groups_group_exists($this->groupid));
$this->assertTrue(groups_group_belongs_to_course($this->groupid, $this->courseid));
$this->assertTrue($groupids = groups_get_groups($this->courseid));
//array...
$this->assertTrue($groupinfo = groups_set_default_group_settings());
$groupinfo->name = 'Group ' . $this->getLabel();
//'Temporary Group Name'
$this->assertTrue(groups_set_group_settings($this->groupid, $groupinfo));
$this->assertTrue($groupinfo->name == groups_get_group_name($this->groupid));
$this->assertTrue($this->courseid == groups_get_course($this->groupid));
}
示例5: definition
function definition()
{
global $COURSE;
$mform =& $this->_form;
//-------------------------------------------------------------------------------
$mform->addElement('header', 'preferencespage', get_string('preferencespage', 'quiz_overview'));
if (!$this->_customdata['currentgroup']) {
$studentsstring = get_string('participants');
} else {
$a = new stdClass();
$a->coursestudent = get_string('participants');
$a->groupname = groups_get_group_name($this->_customdata['currentgroup']);
if (20 < strlen($a->groupname)) {
$studentsstring = get_string('studentingrouplong', 'quiz_overview', $a);
} else {
$studentsstring = get_string('studentingroup', 'quiz_overview', $a);
}
}
$options = array();
if (!$this->_customdata['currentgroup']) {
$options[QUIZ_REPORT_ATTEMPTS_ALL] = get_string('optallattempts', 'quiz_overview');
}
if ($this->_customdata['currentgroup'] || $COURSE->id != SITEID) {
$options[QUIZ_REPORT_ATTEMPTS_ALL_STUDENTS] = get_string('optallstudents', 'quiz_overview', $studentsstring);
$options[QUIZ_REPORT_ATTEMPTS_STUDENTS_WITH] = get_string('optattemptsonly', 'quiz_overview', $studentsstring);
$options[QUIZ_REPORT_ATTEMPTS_STUDENTS_WITH_NO] = get_string('optnoattemptsonly', 'quiz_overview', $studentsstring);
}
$mform->addElement('select', 'attemptsmode', get_string('show', 'quiz_overview'), $options);
$showattemptsgrp = array();
if ($this->_customdata['qmsubselect']) {
$gm = '<span class="highlight">' . quiz_get_grading_option_name($this->_customdata['quiz']->grademethod) . '</span>';
$showattemptsgrp[] =& $mform->createElement('advcheckbox', 'qmfilter', get_string('showattempts', 'quiz_overview'), get_string('optonlygradedattempts', 'quiz_overview', $gm), null, array(0, 1));
}
if (has_capability('mod/quiz:regrade', $this->_customdata['context'])) {
$showattemptsgrp[] =& $mform->createElement('advcheckbox', 'regradefilter', get_string('showattempts', 'quiz_overview'), get_string('optonlyregradedattempts', 'quiz_overview'), null, array(0, 1));
}
if ($showattemptsgrp) {
$mform->addGroup($showattemptsgrp, null, get_string('showattempts', 'quiz_overview'), '<br />', false);
}
//-------------------------------------------------------------------------------
$mform->addElement('header', 'preferencesuser', get_string('preferencesuser', 'quiz_overview'));
$mform->addElement('text', 'pagesize', get_string('pagesize', 'quiz_overview'));
$mform->setType('pagesize', PARAM_INT);
$mform->addElement('selectyesno', 'detailedmarks', get_string('showdetailedmarks', 'quiz_overview'));
$mform->addElement('submit', 'submitbutton', get_string('preferencessave', 'quiz_overview'));
}
示例6: definition
protected function definition() {
$mform = $this->_form;
$mform->addElement('header', 'preferencespage',
get_string('preferencespage', 'quiz_overview'));
if (!$this->_customdata['currentgroup']) {
$studentsstring = get_string('participants');
} else {
$a = new stdClass();
$a->coursestudent = get_string('participants');
$a->groupname = groups_get_group_name($this->_customdata['currentgroup']);
if (20 < strlen($a->groupname)) {
$studentsstring = get_string('studentingrouplong', 'quiz_overview', $a);
} else {
$studentsstring = get_string('studentingroup', 'quiz_overview', $a);
}
}
$options = array();
if (!$this->_customdata['currentgroup']) {
$options[quiz_attempts_report::ALL_ATTEMPTS] = get_string('optallattempts', 'quiz_overview');
}
if ($this->_customdata['currentgroup'] ||
!is_inside_frontpage($this->_customdata['context'])) {
$options[quiz_attempts_report::ALL_STUDENTS] =
get_string('optallstudents', 'quiz_overview', $studentsstring);
$options[quiz_attempts_report::STUDENTS_WITH] =
get_string('optattemptsonly', 'quiz_overview', $studentsstring);
$options[quiz_attempts_report::STUDENTS_WITH_NO] =
get_string('optnoattemptsonly', 'quiz_overview', $studentsstring);
}
$mform->addElement('select', 'attemptsmode',
get_string('show', 'quiz_overview'), $options);
$this->definition_inner($mform);
$mform->addElement('header', 'preferencesuser',
get_string('preferencesuser', 'quiz_overview'));
$mform->addElement('text', 'pagesize', get_string('pagesize', 'quiz_overview'));
$mform->setType('pagesize', PARAM_INT);
$mform->addElement('submit', 'submitbutton',
get_string('preferencessave', 'quiz_overview'));
}
示例7: definition
protected function definition()
{
$mform = $this->_form;
$mform->addElement('header', 'preferencespage', get_string('preferencespage', 'quiz_overview'));
if (!$this->_customdata['currentgroup']) {
$studentsstring = get_string('participants');
} else {
$a = new stdClass();
$a->coursestudent = get_string('participants');
$a->groupname = groups_get_group_name($this->_customdata['currentgroup']);
if (20 < strlen($a->groupname)) {
$studentsstring = get_string('studentingrouplong', 'quiz_overview', $a);
} else {
$studentsstring = get_string('studentingroup', 'quiz_overview', $a);
}
}
$options = array();
if (!$this->_customdata['currentgroup']) {
$options[QUIZ_REPORT_ATTEMPTS_ALL] = get_string('optallattempts', 'quiz_overview');
}
if ($this->_customdata['currentgroup'] || !is_inside_frontpage($this->_customdata['context'])) {
$options[QUIZ_REPORT_ATTEMPTS_ALL_STUDENTS] = get_string('optallstudents', 'quiz_overview', $studentsstring);
$options[QUIZ_REPORT_ATTEMPTS_STUDENTS_WITH] = get_string('optattemptsonly', 'quiz_overview', $studentsstring);
$options[QUIZ_REPORT_ATTEMPTS_STUDENTS_WITH_NO] = get_string('optnoattemptsonly', 'quiz_overview', $studentsstring);
}
$mform->addElement('select', 'attemptsmode', get_string('show', 'quiz_overview'), $options);
if ($this->_customdata['qmsubselect']) {
$gm = '<span class="gradedattempt">' . quiz_get_grading_option_name($this->_customdata['quiz']->grademethod) . '</span>';
$mform->addElement('advcheckbox', 'qmfilter', get_string('showattempts', 'quiz_overview'), get_string('optonlygradedattempts', 'quiz_overview', $gm), null, array(0, 1));
}
$colsgroup = array();
$colsgroup[] = $mform->createElement('advcheckbox', 'qtext', '', get_string('summaryofquestiontext', 'quiz_responses'));
$colsgroup[] = $mform->createElement('advcheckbox', 'resp', '', get_string('summaryofresponse', 'quiz_responses'));
$colsgroup[] = $mform->createElement('advcheckbox', 'right', '', get_string('summaryofrightanswer', 'quiz_responses'));
$mform->addGroup($colsgroup, null, get_string('include', 'quiz_responses'), '<br />', false);
$mform->addElement('header', 'preferencesuser', get_string('preferencesuser', 'quiz_overview'));
$mform->addElement('text', 'pagesize', get_string('pagesize', 'quiz_overview'));
$mform->setType('pagesize', PARAM_INT);
$mform->addElement('submit', 'submitbutton', get_string('preferencessave', 'quiz_overview'));
}
示例8: definition
function definition()
{
global $COURSE;
$mform =& $this->_form;
//-------------------------------------------------------------------------------
$mform->addElement('header', 'preferencespage', get_string('preferencespage', 'quiz_overview'));
if (!$this->_customdata['currentgroup']) {
$studentsstring = get_string('participants');
} else {
$a = new object();
$a->coursestudent = get_string('participants');
$a->groupname = groups_get_group_name($this->_customdata['currentgroup']);
if (20 < strlen($a->groupname)) {
$studentsstring = get_string('studentingrouplong', 'quiz_overview', $a);
} else {
$studentsstring = get_string('studentingroup', 'quiz_overview', $a);
}
}
$options = array();
if (!$this->_customdata['currentgroup']) {
$options[QUIZ_REPORT_ATTEMPTS_ALL] = get_string('optallattempts', 'quiz_overview');
}
if ($this->_customdata['currentgroup'] || $COURSE->id != SITEID) {
$options[QUIZ_REPORT_ATTEMPTS_ALL_STUDENTS] = get_string('optallstudents', 'quiz_overview', $studentsstring);
$options[QUIZ_REPORT_ATTEMPTS_STUDENTS_WITH] = get_string('optattemptsonly', 'quiz_overview', $studentsstring);
$options[QUIZ_REPORT_ATTEMPTS_STUDENTS_WITH_NO] = get_string('optnoattemptsonly', 'quiz_overview', $studentsstring);
}
$mform->addElement('select', 'attemptsmode', get_string('show', 'quiz_overview'), $options);
if ($this->_customdata['qmsubselect']) {
$gm = '<span class="highlight">' . quiz_get_grading_option_name($this->_customdata['quiz']->grademethod) . '</span>';
$mform->addElement('advcheckbox', 'qmfilter', get_string('show', 'quiz_overview'), get_string('optonlygradedattempts', 'quiz_overview', $gm), null, array(0, 1));
}
//-------------------------------------------------------------------------------
$mform->addElement('header', 'preferencesuser', get_string('preferencesuser', 'quiz_overview'));
$mform->addElement('text', 'pagesize', get_string('pagesize', 'quiz_overview'));
$mform->setType('pagesize', PARAM_INT);
$this->add_action_buttons(false, get_string('preferencessave', 'quiz_overview'));
}
示例9: report_ncccscensus_generate_report
//.........这里部分代码省略.........
$status = $result->status;
$grade = $result->grade;
if ($type == REPORT_NCCCSCENSUS_ACTION_VIEW && $grade == get_string('nograde', $reportname)) {
$specialstatus = new html_table_cell($status);
$specialstatus->style = 'background-color: ' . get_config('report_ncccscensus', 'gradenogradecolour');
$status = $specialstatus;
} else {
if ($type == REPORT_NCCCSCENSUS_ACTION_VIEW && $result->overridden) {
$specialstatus = new html_table_cell($status);
$specialstatus->style = 'background-color: ' . get_config('report_ncccscensus', 'gradeoverridecolour');
$status = $specialstatus;
}
}
$datum[] = $status;
$datum[] = $result->submitdate;
if ($type == REPORT_NCCCSCENSUS_ACTION_VIEW && $grade == get_string('nograde', $reportname)) {
$nograde = new html_table_cell($grade);
$nograde->style = 'background-color: ' . get_config('report_ncccscensus', 'gradenogradecolour');
$grade = $nograde;
} else {
if ($type == REPORT_NCCCSCENSUS_ACTION_VIEW && $result->overridden) {
$overriddengrade = new html_table_cell($grade);
$overriddengrade->style = 'background-color: ' . get_config('report_ncccscensus', 'gradeoverridecolour');
$grade = $overriddengrade;
}
}
$datum[] = $grade;
$datum[] = $result->date;
$table->data[] = $datum;
}
}
$course = $DB->get_record('course', array('id' => $cid));
if ($group > 0) {
$groupname = groups_get_group_name($group);
}
$datestring = 'n/j/y';
$reportrange = date($datestring, $formdata->startdate) . ' - ' . date($datestring, $formdata->enddate);
if ($type != REPORT_NCCCSCENSUS_ACTION_VIEW) {
$date = usergetdate(time(), get_user_timezone());
$filename = 'CensusRpt2_';
$filename .= date('MdY_Hi', mktime($date['hours'], $date['minutes'], 0, $date['mon'], $date['mday'], $date['year']));
}
if ($type == REPORT_NCCCSCENSUS_ACTION_VIEW) {
if (report_ncccscensus_check_field_status('showcoursename', 'html')) {
echo '<b>' . get_string('coursetitle', $reportname) . ':</b> ' . $course->fullname . '<br>';
}
if (report_ncccscensus_check_field_status('showcoursecode', 'html')) {
echo '<b>' . get_string('coursecode', $reportname) . ':</b> ' . $course->shortname . '<br>';
}
// Only show course ID if present.
if (report_ncccscensus_check_field_status('showcourseid', 'html') && $course->idnumber !== '') {
echo '<b>' . get_string('courseid', $reportname) . ':</b> ' . $course->idnumber . '<br>';
}
if (report_ncccscensus_check_field_status('showteachername', 'html')) {
if (!empty($namesarrayview)) {
$instructors = implode(', ', $namesarrayview);
echo '<b>' . get_string('instructor', $reportname) . ':</b> ' . $instructors . '<br>';
}
}
echo '<b>' . get_string('reportrange', $reportname) . ':</b> ' . $reportrange . '<br>';
if (isset($groupname)) {
echo '<b>' . get_string('section', $reportname) . ':</b> ' . $groupname . '<br>';
} else {
echo '<b>' . get_string('section', $reportname) . ':</b> ' . get_string('allgroupspdf', $reportname) . '<br>';
}
echo '<br>';
示例10: download_submissions
/**
* Download a zip file of all assignment submissions
*
* @return void
*/
private function download_submissions() {
global $CFG,$DB;
// More efficient to load this here.
require_once($CFG->libdir.'/filelib.php');
// Load all users with submit.
$students = get_enrolled_users($this->context, "mod/assign:submit");
// Build a list of files to zip.
$filesforzipping = array();
$fs = get_file_storage();
$groupmode = groups_get_activity_groupmode($this->get_course_module());
// All users.
$groupid = 0;
$groupname = '';
if ($groupmode) {
$groupid = groups_get_activity_group($this->get_course_module(), true);
$groupname = groups_get_group_name($groupid).'-';
}
// Construct the zip file name.
$filename = clean_filename($this->get_course()->shortname.'-'.
$this->get_instance()->name.'-'.
$groupname.$this->get_course_module()->id.".zip");
// Get all the files for each student.
foreach ($students as $student) {
$userid = $student->id;
if ((groups_is_member($groupid, $userid) or !$groupmode or !$groupid)) {
// Get the plugins to add their own files to the zip.
$submissiongroup = false;
$groupname = '';
if ($this->get_instance()->teamsubmission) {
$submission = $this->get_group_submission($userid, 0, false);
$submissiongroup = $this->get_submission_group($userid);
$groupname = '-' . $submissiongroup->name;
} else {
$submission = $this->get_user_submission($userid, false);
}
if ($this->is_blind_marking()) {
$prefix = clean_filename(str_replace('_', ' ', get_string('participant', 'assign') . $groupname) .
"_" . $this->get_uniqueid_for_user($userid) . "_");
} else {
$prefix = clean_filename(str_replace('_', ' ', fullname($student) . $groupname) .
"_" . $this->get_uniqueid_for_user($userid) . "_");
}
if ($submission) {
foreach ($this->submissionplugins as $plugin) {
if ($plugin->is_enabled() && $plugin->is_visible()) {
$pluginfiles = $plugin->get_files($submission);
foreach ($pluginfiles as $zipfilename => $file) {
$subtype = $plugin->get_subtype();
$type = $plugin->get_type();
$prefixedfilename = $prefix . $subtype . '_' . $type . '_' . $zipfilename;
$filesforzipping[$prefixedfilename] = $file;
}
}
}
}
}
}
if ($zipfile = $this->pack_files($filesforzipping)) {
$this->add_to_log('download all submissions', get_string('downloadall', 'assign'));
// Send file and delete after sending.
send_temp_file($zipfile, $filename);
}
}
示例11: get_string
if ($id == $groupid) {
$grouplist = get_string('subscribedthisgroup', 'forumng');
break;
}
}
} else {
$numberofdiscussions = count($user->discussionids);
if ($numberofdiscussions > 0) {
$numberofdiscussions = ($numberofdiscussions == 1 ? get_string("numberofdiscussion", "forumng", $numberofdiscussions) : get_string("numberofdiscussions", "forumng", $numberofdiscussions)) . '<br />';
} else {
$numberofdiscussions = '';
}
$grouplist = '';
if (count($user->groupids)) {
foreach ($user->groupids as $id) {
$grouplist .= groups_get_group_name($id) . '<br />';
}
}
}
$row[] = $numberofdiscussions . $grouplist;
}
if ($user->link) {
$table->data[] = $row;
}
}
print html_writer::table($table);
if ($canmanage) {
if ($gotsome) {
print '<div id="forumng-buttons"><input type="submit" ' . 'name="unsubscribe" value="' . get_string('unsubscribeselected', 'forumng') . '" /></div>';
}
print '</div></form>';
示例12: display_filemanager_link
/**
*
* @uses $CFG
* @uses $USER
*/
function display_filemanager_link()
{
global $CFG, $USER;
if (!($course = get_record('course', 'id', $this->instance->pageid))) {
error("Course ID is incorrect");
}
$coursecontext = get_context_instance(CONTEXT_COURSE, $this->instance->pageid);
$canmanagegroups = has_capability('block/file_manager:canmanagegroups', $coursecontext);
$this->content->items[] = "<a title=\"" . get_string('msgfilemanager', 'block_file_manager') . "\" href=\"{$CFG->wwwroot}/blocks/file_manager/view.php?id={$this->instance->pageid}&groupid=0\">" . get_string('myfiles', 'block_file_manager') . "</a>";
$this->content->icons[] = "<img src=\"{$CFG->pixpath}/i/files.gif\" alt=\"\" />";
// If the user is member of any group of this course, links for each group in which he belongs must be displayed
$groupmode = groups_get_course_groupmode($course);
$groupsarray = array();
switch ($groupmode) {
case NOGROUPS:
// Nothing to display
break;
case SEPARATEGROUPS:
if ($canmanagegroups) {
// Displays all groups because of super rights
$groupsarray = groups_get_all_groups($this->instance->pageid);
} else {
// Display only links for groups in which the user is member
$groupsarray = groups_get_all_groups($this->instance->pageid, $USER->id);
}
break;
case VISIBLEGROUPS:
// Display a link for all groups
$groupsarray = groups_get_all_groups($this->instance->pageid);
break;
}
// Displays group links if user in a group.
if (is_array($groupsarray)) {
foreach ($groupsarray as $groupid => $value) {
$this->content->items[] = "<a title=\"" . get_string('msgfilemanagergroup', 'block_file_manager') . "\" href=\"{$CFG->wwwroot}/blocks/file_manager/view.php?id={$this->instance->pageid}&groupid={$groupid}\">" . groups_get_group_name($groupid) . "</a>";
$this->content->icons[] = "<img src=\"{$CFG->pixpath}/i/files.gif\" alt=\"\" />";
}
}
}
示例13: get_string
$PAGE->set_heading(format_string($course->fullname));
echo $questionnaire->renderer->header();
// Print the tabs.
if ($byresponse) {
$SESSION->questionnaire->current_tab = 'vrespsummary';
}
if ($individualresponse) {
$SESSION->questionnaire->current_tab = 'individualresp';
}
include 'tabs.php';
// Print the main part of the page.
// TODO provide option to select how many columns and/or responses per page.
if ($noresponses) {
$questionnaire->page->add_to_page('respondentinfo', get_string('group') . ' <strong>' . groups_get_group_name($currentgroupid) . '</strong>: ' . get_string('noresponses', 'questionnaire'));
} else {
$groupname = get_string('group') . ': <strong>' . groups_get_group_name($currentgroupid) . '</strong>';
if ($currentgroupid == 0) {
$groupname = get_string('allparticipants');
}
if ($byresponse) {
$respinfo = '';
$respinfo .= $questionnaire->renderer->box_start();
$respinfo .= $questionnaire->renderer->help_icon('viewindividualresponse', 'questionnaire') . ' ';
$respinfo .= get_string('viewindividualresponse', 'questionnaire') . ' <strong> : ' . $groupname . '</strong>';
$respinfo .= $questionnaire->renderer->box_end();
$questionnaire->page->add_to_page('respondentinfo', $respinfo);
}
$questionnaire->survey_results_navbar_alpha($rid, $currentgroupid, $cm, $byresponse);
if (!$byresponse) {
// Show respondents individual responses.
$questionnaire->view_response($rid, $referer = '', $blankquestionnaire = false, $resps, $compare = true, $isgroupmember = true, $allresponses = false, $currentgroupid);
示例14: get_downloadable_feedback_filename
/**
* This function returns sensible filename for a feedback file.
* @param int|\assign $assignment
* @param int $userid
* @param int $attemptnumber (-1 means latest attempt)
* @return string
*/
protected static function get_downloadable_feedback_filename($assignment, $userid, $attemptnumber)
{
global $DB;
$assignment = self::get_assignment_from_param($assignment);
$groupmode = groups_get_activity_groupmode($assignment->get_course_module());
$groupname = '';
if ($groupmode) {
$groupid = groups_get_activity_group($assignment->get_course_module(), true);
$groupname = groups_get_group_name($groupid) . '-';
}
if ($groupname == '-') {
$groupname = '';
}
$grade = $assignment->get_user_grade($userid, true, $attemptnumber);
$user = $DB->get_record('user', array('id' => $userid), '*', MUST_EXIST);
if ($assignment->is_blind_marking()) {
$prefix = $groupname . get_string('participant', 'assign');
$prefix = str_replace('_', ' ', $prefix);
$prefix = clean_filename($prefix . '_' . $assignment->get_uniqueid_for_user($userid) . '_');
} else {
$prefix = $groupname . fullname($user);
$prefix = str_replace('_', ' ', $prefix);
$prefix = clean_filename($prefix . '_' . $assignment->get_uniqueid_for_user($userid) . '_');
}
$prefix .= $grade->attemptnumber;
return $prefix . '.pdf';
}
示例15: workshopplus_update_grades
/**
* Update workshopplus grades in the gradebook
*
* Needed by grade_update_mod_grades() in lib/gradelib.php
*
* @category grade
* @param stdClass $workshopplus instance object with extra cmidnumber and modname property
* @param int $userid update grade of specific user only, 0 means all participants
* @return void
*/
function workshopplus_update_grades(stdclass $workshopplus, $userid = 0)
{
global $CFG, $DB;
require_once $CFG->libdir . '/gradelib.php';
$whereuser = $userid ? ' AND authorid = :userid' : '';
$params = array('workshopplusid' => $workshopplus->id, 'userid' => $userid);
$sql = 'SELECT authorid, grade, gradeover, gradeoverby, feedbackauthor, feedbackauthorformat, timemodified, timegraded
FROM {workshopplus_submissions}
WHERE workshopplusid = :workshopplusid AND example=0' . $whereuser;
$records = $DB->get_records_sql($sql, $params);
$submissiongrades = array();
foreach ($records as $record) {
$grade = new stdclass();
$grade->userid = $record->authorid;
if (!is_null($record->gradeover)) {
$grade->rawgrade = grade_floatval($workshopplus->grade * $record->gradeover / 100);
$grade->usermodified = $record->gradeoverby;
} else {
$grade->rawgrade = grade_floatval($workshopplus->grade * $record->grade / 100);
}
$grade->feedback = $record->feedbackauthor;
$grade->feedbackformat = $record->feedbackauthorformat;
$grade->datesubmitted = $record->timemodified;
$grade->dategraded = $record->timegraded;
$submissiongrades[$record->authorid] = $grade;
////// Find the groupmates and also update their records
////////////By Morteza
/// find the group id of the current user
$usergroups = groups_get_user_groups($workshopplus->course, $grade->userid);
$currentgroupid = $usergroups[0][0];
// Get the current group name from the group id.
$currentgroupname = groups_get_group_name($currentgroupid);
// loop over members of that group
$groupmembers = groups_get_members($currentgroupid, $fields = 'u.*');
/* Commenting out section for blind copy of grades
* -- Sayantan - 28.04.2015
foreach ($groupmembers as $memberid=>$member){
if ($memberid != $grade->userid) {
$newgrade = clone $grade;
$newgrade->userid = $memberid;
$submissiongrades[$memberid] = $newgrade;
}
}
*/
//////////end by Morteza
/*
* Begin: Change by Sayantan
* Date: 28.04.2015
*/
// Also think of scenario where author belonged to another group - Not possible unless students are
// allowed to resubmit their solutions - have to think about this one
// Check if this assignment has been graded previously (entry exists in grade_grades)
// no -> this is a new grading, simply copy grade of author to the group members
// yes -> this is a regrading
$params = array('workshopplusid' => $workshopplus->id, 'userid' => $grade->userid);
$sql = 'SELECT COUNT(1) AS cnt FROM moodle_grade_grades grades ' . 'INNER JOIN moodle_grade_items items ' . 'WHERE items.id = grades.itemid AND items.iteminstance = :workshopplusid AND grades.userid=:userid';
$records = $DB->get_records_sql($sql, $params);
$flag_re_grading = 0;
foreach ($records as $record) {
if ($record->cnt > 0) {
// Check if records exist in grade_grades
$flag_re_grading = 1;
// If records exist in grade_grades then this is a regrading
}
}
if ($flag_re_grading == 0) {
// This is a new grading, hence copy grades
foreach ($groupmembers as $memberid => $member) {
if ($memberid != $grade->userid) {
$newgrade = clone $grade;
$newgrade->userid = $memberid;
$submissiongrades[$memberid] = $newgrade;
}
}
} else {
// This is a re grading, hence existing grades should not be overwritten
// + Check the time in which each member joined the group
// + If the time of joining group is later than time of previous grading then member was in a
// separate group when the initial grading was done and should get the grades he/she received
// in that group
// + If the member has no previous records - assign zero grade since this assignment was not
// done by that member (as he was not part of any group when the assignment was first graded)
//
foreach ($groupmembers as $memberid => $member) {
if ($memberid != $grade->userid) {
// Check time at which $memberid joined the group
$joining_time = 0;
$params = array('userid' => $memberid);
$sql = 'SELECT timeadded FROM moodle_groups_members WHERE userid=:userid';
$records = $DB->get_records_sql($sql, $params);
//.........这里部分代码省略.........