コード例 #1
0
ファイル: renderer.php プロジェクト: evltuma/moodle
 /**
  * A renderer for the standard upload file form.
  *
  * @param object $course The course we are doing all of this action in.
  * @param object $mform The mform for uploading CSV files.
  * @return string html to be displayed.
  */
 public function standard_upload_file_form($course, $mform)
 {
     $output = groups_print_course_menu($course, 'index.php?id=' . $course->id, true);
     $output .= html_writer::start_tag('div', array('class' => 'clearer'));
     $output .= html_writer::end_tag('div');
     // Form.
     ob_start();
     $mform->display();
     $output .= ob_get_contents();
     ob_end_clean();
     return $output;
 }
コード例 #2
0
ファイル: index.php プロジェクト: covex-nn/moodle
        $table = new html_table();
        $table->head = $header;
        $csvimport->init();
        $previewdata = array();
        while ($numlines <= $formdata->previewrows) {
            $lines = $csvimport->next();
            if ($lines) {
                $previewdata[] = $lines;
            }
            $numlines++;
        }
        $table->data = $previewdata;
        echo html_writer::table($table);
    } else {
        // Display the standard upload file form.
        groups_print_course_menu($course, 'index.php?id=' . $id);
        echo html_writer::start_tag('div', array('class' => 'clearer'));
        echo html_writer::end_tag('div');
        $mform->display();
        echo $OUTPUT->footer();
        die;
    }
}
// Data has already been submitted so we can use the $iid to retrieve it.
$csvimport = new csv_import_reader($iid, 'grade');
$header = $csvimport->get_columns();
// we create a form to handle mapping data from the file to the database.
$mform2 = new grade_import_mapping_form(null, array('gradeitems' => $gradeitems, 'header' => $header));
$mform2->set_data(array('iid' => $iid, 'id' => $id, 'importcode' => $importcode, 'verbosescales' => $verbosescales));
// Here, if we have data, we process the fields and enter the information into the database.
if ($formdata = $mform2->get_data()) {
コード例 #3
0
ファイル: index.php プロジェクト: Jtgadbois/Pedadida
    // Navigation and header
    $strreports = get_string("reports");
    $strcompletion = get_string('activitycompletion', 'completion');

    $PAGE->set_title($strcompletion);
    $PAGE->set_heading($course->fullname);
    echo $OUTPUT->header();

    if ($svgcleverness) {
        $PAGE->requires->js('/report/progress/textrotate.js');
        $PAGE->requires->js_function_call('textrotate_init', null, true);
    }

    // Handle groups (if enabled)
    groups_print_course_menu($course,$CFG->wwwroot.'/report/progress/?course='.$course->id);
}

if (count($activities)==0) {
    echo $OUTPUT->container(get_string('err_noactivities', 'completion'), 'errorbox errorboxcontent');
    echo $OUTPUT->footer();
    exit;
}

// If no users in this course what-so-ever
if (!$grandtotal) {
    echo $OUTPUT->container(get_string('err_nousers', 'completion'), 'errorbox errorboxcontent');
    echo $OUTPUT->footer();
    exit;
}
コード例 #4
0
ファイル: index.php プロジェクト: harshasunny/grade
         $user = $userdata->user;
         $report = new grade_report_user($courseid, $gpr, $context, $user->id);
         $studentnamelink = html_writer::link(new moodle_url('/user/view.php', array('id' => $report->user->id, 'course' => $courseid)), fullname($report->user));
         echo $OUTPUT->heading(get_string('pluginname', 'gradereport_user') . ' - ' . $studentnamelink);
         if ($report->fill_table()) {
             echo '<br />' . $report->print_table(true);
         }
         echo "<p style = 'page-break-after: always;'></p>";
     }
     $gui->close();
 } else {
     // Only show one user's report
     $report = new grade_report_user($courseid, $gpr, $context, $userid);
     $studentnamelink = html_writer::link(new moodle_url('/user/view.php', array('id' => $report->user->id, 'course' => $courseid)), fullname($report->user));
     print_grade_page_head($courseid, 'report', 'user', get_string('pluginname', 'gradereport_user') . ' - ' . $studentnamelink, false, false, true, null, null, $report->user);
     groups_print_course_menu($course, $gpr->get_return_url('index.php?id=' . $courseid, array('userid' => 0)));
     if ($user_selector) {
         $renderer = $PAGE->get_renderer('gradereport_user');
         $showallusersoptions = true;
         echo $renderer->graded_users_selector('user', $course, $userid, $currentgroup, $showallusersoptions);
     }
     if ($currentgroup and !groups_is_member($currentgroup, $userid)) {
         echo $OUTPUT->notification(get_string('groupusernotmember', 'error'));
     } else {
         if ($report->fill_table()) {
             echo '<br />' . $report->print_table(true, $userid, $courseid);
             //START BY @HARSHA
             //echo '<br />'.$report->print_table(true);
         }
     }
 }
コード例 #5
0
ファイル: lib.php プロジェクト: tyleung/CMPUT401MoodleExams
 /**
  * Sets up this object's group variables, mainly to restrict the selection of users to display.
  */
 protected function setup_groups()
 {
     /// find out current groups mode
     if ($this->groupmode = groups_get_course_groupmode($this->course)) {
         $this->currentgroup = groups_get_course_group($this->course, true);
         $this->group_selector = groups_print_course_menu($this->course, $this->pbarurl, true);
         if ($this->groupmode == SEPARATEGROUPS and !$this->currentgroup and !has_capability('moodle/site:accessallgroups', $this->context)) {
             $this->currentgroup = -2;
             // means can not access any groups at all
         }
         if ($this->currentgroup) {
             $this->groupsql = " JOIN {groups_members} gm ON gm.userid = u.id ";
             $this->groupwheresql = " AND gm.groupid = :gr_grpid ";
             $this->groupwheresql_params = array('gr_grpid' => $this->currentgroup);
         }
     }
 }
コード例 #6
0
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
require __DIR__ . '/../../config.php';
$courseid = required_param('courseid', PARAM_INT);
require_login($courseid);
$manager = block_xp_manager::get($courseid);
$context = $manager->get_context();
if (!$manager->can_view_ladder_page()) {
    throw new moodle_exception('nopermissions', '', '', 'view_ladder_page');
}
// Some stuff.
$url = new moodle_url('/blocks/xp/ladder.php', array('courseid' => $courseid));
$strladder = get_string('ladder', 'block_xp');
// Page info.
$PAGE->set_context($context);
$PAGE->set_pagelayout('course');
$PAGE->set_title($strladder);
$PAGE->set_heading($COURSE->fullname);
$PAGE->set_url($url);
$manager = block_xp_manager::get($courseid);
$group = groups_get_course_group($manager->get_course(), true);
$renderer = $PAGE->get_renderer('block_xp');
echo $OUTPUT->header();
echo $OUTPUT->heading($strladder);
echo $renderer->navigation($manager, 'ladder');
echo $renderer->notices($manager);
groups_print_course_menu($manager->get_course(), $url);
$table = new block_xp_ladder_table('block_xp_ladder', $courseid, $group, array('identitymode' => $manager->get_config('identitymode'), 'rankmode' => $manager->get_config('rankmode'), 'neighboursonly' => $manager->get_config('neighbours') > 0, 'neighboursabove' => $manager->get_config('neighbours'), 'neighboursbelow' => $manager->get_config('neighbours')));
$table->define_baseurl($url);
echo $table->out(20, false);
echo $OUTPUT->footer();
コード例 #7
0
ファイル: view.php プロジェクト: rrusso/moodle2-adobeconnect
    }
    aconnect_logout($aconnect);
}
// Log in the current user
$login = $usrobj->username;
$password = $usrobj->username;
$https = false;
if (isset($CFG->adobeconnect_https) and !empty($CFG->adobeconnect_https)) {
    $https = true;
}
$aconnect = new connect_class_dom($CFG->adobeconnect_host, $CFG->adobeconnect_port, '', '', '', $https);
$aconnect->request_http_header_login(1, $login);
$adobesession = $aconnect->get_cookie();
if ($cm->groupmode) {
    // Not sure if this is needed anymore...
    groups_print_course_menu($course, "view.php?id={$id}");
}
$aconnect = aconnect_login();
// Get the Meeting details
$cond = array('instanceid' => $adobeconnect->id, 'groupid' => $groupid);
$scoid = $DB->get_field('adobeconnect_meeting_groups', 'meetingscoid', $cond);
$meetfldscoid = aconnect_get_folder($aconnect, 'my-meetings');
$filter = array('filter-sco-id' => $scoid);
if ($meeting = aconnect_meeting_exists($aconnect, $meetfldscoid, $filter)) {
    $meeting = current($meeting);
} else {
    $message = get_string('nomeeting', 'adobeconnect');
    $OUTPUT->notification($message);
    aconnect_logout($aconnect);
    die;
}
コード例 #8
0
ファイル: index.php プロジェクト: alanaipe2015/moodle
if ($mycourses = enrol_get_my_courses()) {
    $courselist = array();
    $popupurl = new moodle_url('/user/index.php?roleid=' . $roleid . '&sifirst=&silast=');
    foreach ($mycourses as $mycourse) {
        $coursecontext = context_course::instance($mycourse->id);
        $courselist[$mycourse->id] = format_string($mycourse->shortname, true, array('context' => $coursecontext));
    }
    if (has_capability('moodle/site:viewparticipants', $systemcontext)) {
        unset($courselist[SITEID]);
        $courselist = array(SITEID => format_string($SITE->shortname, true, array('context' => $systemcontext))) + $courselist;
    }
    $select = new single_select($popupurl, 'id', $courselist, $course->id, null, 'courseform');
    $select->set_label(get_string('mycourses'));
    $controlstable->data[0]->cells[] = $OUTPUT->render($select);
}
if ($groupmenu = groups_print_course_menu($course, $baseurl->out(), true)) {
    $controlstable->data[0]->cells[] = $groupmenu;
}
if (!isset($hiddenfields['lastaccess'])) {
    // Get minimum lastaccess for this course and display a dropbox to filter by lastaccess going back this far.
    // We need to make it diferently for normal courses and site course.
    if (!$isfrontpage) {
        $minlastaccess = $DB->get_field_sql('SELECT min(timeaccess)
                                               FROM {user_lastaccess}
                                              WHERE courseid = ?
                                                    AND timeaccess != 0', array($course->id));
        $lastaccess0exists = $DB->record_exists('user_lastaccess', array('courseid' => $course->id, 'timeaccess' => 0));
    } else {
        $minlastaccess = $DB->get_field_sql('SELECT min(lastaccess)
                                               FROM {user}
                                              WHERE lastaccess != 0');
コード例 #9
0
ファイル: participants.php プロジェクト: henriquecrang/e-UNI
                $rolenames[$role->id] = strip_tags(role_get_name($role, $context));
                // Used in menus etc later on
            } else {
                $rolenames[$role->id] = strip_tags(format_string($role->name));
                // Used in menus etc later on
            }
        }
    }
    /// If there are multiple Roles in the course, then show a drop down menu for switching
    if (count($rolenames) > 1) {
        echo '<div class="rolesform">';
        echo get_string('currentrole', 'role') . ': ';
        $rolenames = array(0 => get_string('all')) + $rolenames;
        popup_form("{$wwwroot}/blocks/email_list/email/participants.php?id={$courseid}&amp;group={$selgroup}&amp;page={$page}&amp;perpage={$perpage}&amp;search={$search}&amp;fname={$firstinitial}&amp;lname={$lastinitial}&amp;contextid={$context->id}&amp;roleid=", $rolenames, 'rolesform', $roleid, '');
        echo '</div>';
    }
    // Prints group selector for users with a viewallgroups capability if course groupmode is separate
    echo '<br />';
    groups_print_course_menu($course, $wwwroot . '/blocks/email_list/email/participants.php?id=' . $course->id);
    echo '<br /><br />';
    echo '<div id="participants"></div>' . '<iframe id="idsearch" name="bssearch" src="get_users.php?id=' . $courseid . '&amp;roleid=' . $roleid . '&amp;group=' . $selgroup . '&amp;page=' . $page . '&amp;perpage=' . $perpage . '&amp;search=' . $search . '&amp;fname=' . $firstinitial . '&amp;lname=' . $lastinitial . '" style="display:none;"></iframe>' . "\n\n";
    print_spacer(1, 4, false);
    if ($perpage == '7') {
        echo '<div id="to_all_users" class="all_users"><img src="' . $CFG->wwwroot . '/blocks/email_list/email/images/add.png" height="16" width="16" alt="' . get_string("course") . '" /> <a href="' . $wwwroot . '/blocks/email_list/email/participants.php?id=' . $courseid . '&amp;group=' . $selgroup . '&amp;perpage=99999&amp;search=' . $search . '&amp;roleid=' . $roleid . '&amp;fname=' . $firstinitial . '&amp;lname=' . $lastinitial . '">' . get_string('showallusers') . '</a></div>';
    } else {
        echo '<div id="to_all_users" class="all_users"><img src="' . $CFG->wwwroot . '/blocks/email_list/email/images/delete.png" height="16" width="16" alt="' . get_string("course") . '" /> <a href="' . $wwwroot . '/blocks/email_list/email/participants.php?id=' . $courseid . '&amp;group=' . $selgroup . '&amp;perpage=7&amp;search=' . $search . '&amp;roleid=' . $roleid . '&amp;fname=' . $firstinitial . '&amp;lname=' . $lastinitial . '">' . get_string('showperpage', '', 7) . '</a></div>';
    }
}
// Print close button
close_window_button();
print_footer();
コード例 #10
0
ファイル: view.php プロジェクト: rabeshi/anti_plagiarism
         $members1[] = $row->user1;
         $members1[] = $row->user2;
     }
     $select = "apid={$antipla->id} AND (user1={$seed->user2} OR user2={$seed->user2})";
     $results = get_records_select('block_anti_plagiarism_pairs', $select);
     $members2 = array();
     foreach ($results as $row) {
         $members2[] = $row->user1;
         $members2[] = $row->user2;
     }
     $members = array_unique(array_intersect($members1, $members2));
     $member_str = implode(',', $members);
     $select = "apid={$antipla->id} AND user1 IN ({$member_str}) AND user2 IN ({$member_str})";
     $results = get_records_select('block_anti_plagiarism_pairs', $select, 'rank');
 } else {
     groups_print_course_menu($course, "view.php?id={$id}&block={$block}&action={$action}");
     $group = groups_get_course_group($course);
     echo '<div class="clearer"></div>';
     $where = "apid = {$antipla->id}";
     if ($group != 0) {
         if ($users = groups_get_members($group, 'u.id', 'u.id')) {
             $users = array_keys($users);
             $userids = implode(',', $users);
             $where .= ' AND (user1 IN (' . $userids . ') OR user2 IN (' . $userids . '))';
         } else {
             $results = false;
         }
     }
     $where .= $action === 'confirmed' ? ' AND confirmed=1' : '';
     if (!isset($results)) {
         $results = get_records_select('block_anti_plagiarism_pairs', $where, 'rank');
コード例 #11
0
ファイル: lib.php プロジェクト: edwinphillips/moodle-485cb39
 /**
  * Sets up this object's group variables, mainly to restrict the selection of users to display.
  */
 function setup_groups()
 {
     global $CFG;
     /// find out current groups mode
     if ($this->groupmode = groups_get_course_groupmode($this->course)) {
         $this->currentgroup = groups_get_course_group($this->course, true);
         $this->group_selector = groups_print_course_menu($this->course, $this->pbarurl, true);
         if ($this->groupmode == SEPARATEGROUPS and !$this->currentgroup and !has_capability('moodle/site:accessallgroups', $this->context)) {
             $this->currentgroup = -2;
             // means can not accesss any groups at all
         }
         if ($this->currentgroup) {
             $this->groupsql = " JOIN {$CFG->prefix}groups_members gm ON gm.userid = u.id ";
             $this->groupwheresql = " AND gm.groupid = {$this->currentgroup} ";
         }
     }
 }
コード例 #12
0
 /**
  * Sets up this object's group variables, mainly to restrict the selection of users to display.
  */
 function setup_groups()
 {
     global $CFG;
     /// find out current groups mode
     $this->group_selector = groups_print_course_menu($this->course, $this->pbarurl, true);
     $this->currentgroup = groups_get_course_group($this->course);
     if ($this->currentgroup) {
         $this->groupsql = " LEFT JOIN {$CFG->prefix}groups_members gm ON gm.userid = u.id ";
         $this->groupwheresql = " AND gm.groupid = {$this->currentgroup} ";
     }
 }
コード例 #13
0
 function get_content()
 {
     global $COURSE, $CFG, $USER;
     if ($this->content !== NULL) {
         return $this->content;
     }
     $filteropt = new stdClass();
     $filteropt->overflowdiv = true;
     if ($this->content_is_trusted()) {
         // fancy html allowed only on course, category and system blocks.
         $filteropt->noclean = true;
     }
     $this->content = new stdClass();
     $this->content->text = '';
     $usegroupmenu = true;
     if (has_capability('moodle/site:accessallgroups', context_course::instance($COURSE->id))) {
         $usegroupmenu = true;
     } else {
         $usergroupings = groups_get_user_groups($COURSE->id, $USER->id);
         if (count($usergroupings) == 1) {
             $usergroups = array_pop($usergroupings);
             if (count($usergroups) == 1) {
                 $usegroupmenu = false;
                 $uniquegroup = array_pop($usergroups);
             }
         }
     }
     $coursegroups = groups_get_all_groups($COURSE->id);
     if ($coursegroups && $usegroupmenu) {
         $this->content->text .= groups_print_course_menu($COURSE, $CFG->wwwroot . '/course/view.php?id=' . $COURSE->id, true);
     }
     $gid = 0 + groups_get_course_group($COURSE, $USER->id);
     if (@$uniquegroup && !$gid) {
         $gid = $uniquegroup;
     }
     $textkeys = array('text_all');
     if (!empty($coursegroups)) {
         $textkeys[] = 'text_' . $gid;
     }
     foreach ($textkeys as $tk) {
         if (isset($this->config->{$tk})) {
             $format = FORMAT_HTML;
             // Check to see if the format has been properly set on the config
             $formatkey = str_replace('text_', 'format_', $tk);
             if (isset($this->config->{$formatkey})) {
                 $format = $this->config->{$formatkey};
             }
             // rewrite url
             $this->config->{$tk} = file_rewrite_pluginfile_urls($this->config->{$tk}, 'pluginfile.php', $this->context->id, 'block_groupspecifichtml', 'content', NULL);
             // Default to FORMAT_HTML which is what will have been used before the
             // editor was properly implemented for the block.
             $this->content->text .= format_text($this->config->{$tk}, $format, $filteropt);
         } else {
             $this->content->text .= '';
         }
     }
     $this->content->footer = '';
     unset($filteropt);
     // memory footprint
     if (empty($this->content->text)) {
         $this->content->text = '&nbsp;';
     }
     return $this->content;
 }
コード例 #14
0
        } else {
            if (!empty($data->addbcc)) {
                foreach ($userids as $userid) {
                    $message->add_recipient('bcc', $userid);
                }
            }
        }
    }
    $url = new moodle_url('/local/mail/compose.php', array('m' => $messageid));
    redirect($url);
}
// Display page
echo $OUTPUT->header();
echo $OUTPUT->container_start('mail-recipients');
echo $OUTPUT->heading(get_string('addrecipients', 'local_mail'), 2);
groups_print_course_menu($COURSE, $PAGE->url);
echo html_writer::start_tag('form', array('method' => 'post', 'action' => $url));
$participants->display();
echo $OUTPUT->container_start('buttons');
$label = get_string('addto', 'local_mail');
$attributes = array('type' => 'submit', 'name' => 'addto', 'value' => $label);
echo html_writer::empty_tag('input', $attributes);
$label = get_string('addcc', 'local_mail');
$attributes = array('type' => 'submit', 'name' => 'addcc', 'value' => $label);
echo html_writer::empty_tag('input', $attributes);
$label = get_string('addbcc', 'local_mail');
$attributes = array('type' => 'submit', 'name' => 'addbcc', 'value' => $label);
echo html_writer::empty_tag('input', $attributes);
$label = get_string('cancel');
$attributes = array('type' => 'submit', 'name' => 'cancel', 'value' => $label);
echo html_writer::empty_tag('input', $attributes);
コード例 #15
0
        $line = "\n" . chr(0);
    } else {
        header('Content-Type: text/csv; charset=UTF-8');
        $sep = ",";
        $line = "\n";
    }
} else {
    // Navigation and header
    $strcompletion = get_string('coursecompletion');
    $PAGE->set_title($strcompletion);
    $PAGE->set_heading($course->fullname);
    echo $OUTPUT->header();
    $PAGE->requires->yui2_lib(array('yahoo', 'dom', 'element', 'event'));
    $PAGE->requires->js('/course/report/completion/textrotate.js');
    // Handle groups (if enabled)
    groups_print_course_menu($course, $CFG->wwwroot . '/course/report/completion/?course=' . $course->id);
}
// Generate where clause
$where = array();
$where_params = array();
if ($sifirst !== 'all') {
    $where[] = $DB->sql_like('u.firstname', ':sifirst', false);
    $where_params['sifirst'] = $sifirst . '%';
}
if ($silast !== 'all') {
    $where[] = $DB->sql_like('u.lastname', ':silast', false);
    $where_params['silast'] = $silast . '%';
}
// Get user match count
$total = $completion->get_num_tracked_users(implode(' AND ', $where), $where_params, $group);
// Total user count
コード例 #16
0
/**
 * This function show all participants of one course. Choose user/s to sent mail.
 *
 * @uses $CFG, $USER
 * @param int $courseid Course ID
 * @param int $roleid   Role ID
 * @param int $currentgroup Current group
 * @return Array Users to sending mail.
 * @todo Finish documenting this function
 */
function email_choose_users_to_send($courseid, $roleid, $currentgroup)
{
    global $CFG, $USER;
    if (!($course = get_record('course', 'id', $courseid))) {
        print_error('invalidcourseid', 'block_email_list');
    }
    // Prepare users to choose us
    if ($courseid) {
        if ($course->id == SITEID) {
            $context = get_context_instance(CONTEXT_SYSTEM, SITEID);
            // SYSTEM context
        } else {
            $context = get_context_instance(CONTEXT_COURSE, $course->id);
            // Course context
        }
        // Security issue
        $sitecontext = get_context_instance(CONTEXT_SYSTEM);
        $frontpagectx = get_context_instance(CONTEXT_COURSE, SITEID);
        if ($context->id != $frontpagectx->id) {
            require_capability('moodle/course:viewparticipants', $context);
        } else {
            require_capability('moodle/site:viewparticipants', $sitecontext);
        }
        $rolesnames = array();
        $avoidroles = array();
        if ($roles = get_roles_used_in_context($context, true)) {
            $canviewroles = get_roles_with_capability('moodle/course:view', CAP_ALLOW, $context);
            $doanythingroles = get_roles_with_capability('moodle/site:doanything', CAP_ALLOW, $sitecontext);
            if (!$CFG->email_add_admins) {
                $adminsroles = get_roles_with_capability('moodle/legacy:admin', CAP_ALLOW, $sitecontext);
            }
            foreach ($roles as $role) {
                if (!isset($canviewroles[$role->id])) {
                    // Avoid this role (eg course creator)
                    $avoidroles[] = $role->id;
                    unset($roles[$role->id]);
                    continue;
                }
                if (isset($doanythingroles[$role->id])) {
                    // Avoid this role (ie admin)
                    $avoidroles[] = $role->id;
                    unset($roles[$role->id]);
                    continue;
                }
                if (!$CFG->email_add_admins) {
                    if (isset($adminsroles[$role->id])) {
                        // Avoid this role (ie admin)
                        $avoidroles[] = $role->id;
                        unset($roles[$role->id]);
                        continue;
                    }
                }
                // Prevent - CONTRIB-609
                if (function_exists('role_get_name')) {
                    $rolenames[$role->id] = strip_tags(role_get_name($role, $context));
                    // Used in menus etc later on
                } else {
                    $rolenames[$role->id] = strip_tags(format_string($role->name));
                    // Used in menus etc later on
                }
            }
        }
        // we are looking for all users with this role assigned in this context or higher
        if ($usercontexts = get_parent_contexts($context)) {
            $listofcontexts = '(' . implode(',', $usercontexts) . ')';
        } else {
            $listofcontexts = '(' . $sitecontext->id . ')';
            // must be site
        }
        if ($roleid) {
            $selectrole = " AND r.roleid = {$roleid} ";
        } else {
            $selectrole = " ";
        }
        if ($context->id != $frontpagectx->id) {
            $select = 'SELECT DISTINCT u.id, u.username, u.firstname, u.lastname ';
        } else {
            $select = 'SELECT u.id, u.username, u.firstname, u.lastname ';
        }
        if ($context->id != $frontpagectx->id) {
            $from = "FROM {$CFG->prefix}user u\n\t                LEFT OUTER JOIN {$CFG->prefix}context ctx\n\t                    ON (u.id=ctx.instanceid AND ctx.contextlevel = " . CONTEXT_USER . ")\n\t                JOIN {$CFG->prefix}role_assignments r\n\t                    ON u.id=r.userid\n\t                LEFT OUTER JOIN {$CFG->prefix}user_lastaccess ul\n\t                    ON (r.userid=ul.userid and ul.courseid = {$course->id}) ";
        } else {
            $from = "FROM {$CFG->prefix}user u\n\t                LEFT OUTER JOIN {$CFG->prefix}context ctx\n\t                    ON (u.id=ctx.instanceid AND ctx.contextlevel = " . CONTEXT_USER . ") ";
        }
        $hiddensql = has_capability('moodle/role:viewhiddenassigns', $context) ? '' : ' AND r.hidden = 0 ';
        // exclude users with roles we are avoiding
        if ($avoidroles) {
            $adminroles = 'AND r.roleid NOT IN (';
            $adminroles .= implode(',', $avoidroles);
            $adminroles .= ')';
        } else {
            $adminroles = '';
        }
        // join on 2 conditions
        // otherwise we run into the problem of having records in ul table, but not relevant course
        // and user record is not pulled out
        if ($context->id != $frontpagectx->id) {
            $where = "WHERE (r.contextid = {$context->id} OR r.contextid in {$listofcontexts})\n\t            AND u.deleted = 0 {$selectrole}\n\t            AND (ul.courseid = {$course->id} OR ul.courseid IS NULL)\n\t            AND u.username != 'guest'\n\t            {$adminroles}\n\t            {$hiddensql} ";
        } else {
            $where = "WHERE u.deleted = 0\n\t            AND u.username != 'guest'";
        }
        if ($currentgroup and $course->groupmode != 0) {
            // Displaying a group by choice
            $from .= 'LEFT JOIN ' . $CFG->prefix . 'groups_members gm ON u.id = gm.userid ';
            // $currentgroup can be an array of groups id
            if (is_array($currentgroup)) {
                $where .= ' AND gm.groupid IN (' . implode(',', $currentgroup) . ') ';
            } else {
                if ($currentgroup == 0) {
                    if (!has_capability('block/email_list:viewallgroups', $context) && $COURSE->groupmode == 1) {
                        $groupids = groups_get_groups_for_user($USER->id, $COURSE->id);
                        $where .= 'AND gm.groupid IN (' . implode(',', $groupids) . ')';
                    }
                } else {
                    $where .= 'AND gm.groupid = ' . $currentgroup;
                }
            }
            $where .= ' AND gm.groupid = ' . $currentgroup;
        }
        $sort = ' ORDER BY u.firstname, u.lastname';
        $userlist = get_records_sql($select . $from . $where . $sort);
        if ($userlist) {
            foreach ($userlist as $user) {
                $unselectedusers[$user->id] = addslashes(fullname($user, has_capability('moodle/site:viewfullnames', $context)));
            }
        }
        /// If there are multiple Roles in the course, then show a drop down menu for switching
        if (count($rolenames) > 1) {
            echo '<div class="rolesform">';
            echo get_string('currentrole', 'role') . ': ';
            $rolenames = array(0 => get_string('all')) + $rolenames;
            popup_form("{$CFG->wwwroot}/blocks/email_list/email/participants.php?id={$courseid}&amp;group={$currentgroup}&amp;contextid={$context->id}&amp;roleid=", $rolenames, 'rolesform', $roleid, '');
            echo '</div>';
        }
        // Prints group selector for users with a viewallgroups capability if course groupmode is separate
        echo '<br />';
        groups_print_course_menu($course, $CFG->wwwroot . '/blocks/email_list/email/participants.php?id=' . $course->id);
        echo '<br /><br />';
    }
    // Prepare tags
    $straddusersto = get_string('addusersto', 'block_email_list');
    $stradduserscc = get_string('cc', 'block_email_list');
    $straddusersbcc = get_string('bcc', 'block_email_list');
    $stradd = get_string('ok');
    $strto = get_string('to', 'block_email_list');
    $strcc = get_string('cc', 'block_email_list');
    $strbcc = get_string('bcc', 'block_email_list');
    $strselectedusersremove = get_string('selectedusersremove', 'block_email_list');
    $straction = get_string('selectaction', 'block_email_list');
    $strcancel = get_string('cancel');
    // Create an object for define parametrer
    $options = new stdClass();
    $options->id = $courseid;
    // Prepare url
    $toform = email_build_url($options, true);
    -($url = $CFG->wwwroot . '/blocks/email_list/email/sendmail.php');
    if ($options) {
        $urlhtml = email_build_url($options);
    }
    include_once 'participants.html';
}
コード例 #17
0
ファイル: index.php プロジェクト: nicolasconnault/moodle2.0
/// Print my course menus
if ($mycourses = get_my_courses($USER->id)) {
    echo '<td class="left">';
    $courselist = array();
    foreach ($mycourses as $mycourse) {
        $courselist[$mycourse->id] = format_string($mycourse->shortname);
    }
    if (has_capability('moodle/site:viewparticipants', $systemcontext)) {
        unset($courselist[SITEID]);
        $courselist = array(SITEID => format_string($SITE->shortname)) + $courselist;
    }
    popup_form($CFG->wwwroot . '/user/index.php?roleid=' . $roleid . '&amp;sifirst=&amp;silast=&amp;id=', $courselist, 'courseform', $course->id, '', '', '', false, 'self', get_string('mycourses'));
    echo '</td>';
}
echo '<td class="left">';
groups_print_course_menu($course, $baseurl);
echo '</td>';
if (!isset($hiddenfields['lastaccess'])) {
    // get minimum lastaccess for this course and display a dropbox to filter by lastaccess going back this far.
    // we need to make it diferently for normal courses and site course
    if ($context->id != $frontpagectx->id) {
        $minlastaccess = $DB->get_field_sql('SELECT min(timeaccess)
                                                   FROM {user_lastaccess}
                                                  WHERE courseid = ?
                                                        AND timeaccess != 0', array($course->id));
        $lastaccess0exists = $DB->record_exists('user_lastaccess', array('courseid' => $course->id, 'timeaccess' => 0));
    } else {
        $minlastaccess = $DB->get_field_sql('SELECT min(lastaccess)
                                                   FROM {user}
                                                  WHERE lastaccess != 0');
        $lastaccess0exists = $DB->record_exists('user', array('lastaccess' => 0));
コード例 #18
0
    $studentroleid = $studentrole->id;
} else {
    $studentroleid = 0;
}
$roleselected = optional_param('role', $studentroleid, PARAM_INT);
$rolewhere = $roleselected != 0 ? "AND a.roleid = {$roleselected}" : '';
// Output group selector if there are groups in the course.
echo $OUTPUT->container_start('progressoverviewmenus');
$groupuserid = 0;
if (!has_capability('moodle/site:accessallgroups', $context)) {
    $groupuserid = $USER->id;
}
$groups = groups_get_all_groups($course->id);
if (!empty($groups)) {
    $course->groupmode = 2;
    groups_print_course_menu($course, $PAGE->url);
}
// Output the roles menu.
$sql = "SELECT DISTINCT r.id, r.name, r.shortname\n          FROM {role} r, {role_assignments} a\n         WHERE a.contextid = :contextid\n           AND r.id = a.roleid";
$params = array('contextid' => $context->id);
$roles = role_fix_names($DB->get_records_sql($sql, $params), $context);
$rolestodisplay = array(0 => get_string('allparticipants'));
foreach ($roles as $role) {
    $rolestodisplay[$role->id] = $role->localname;
}
echo '&nbsp;' . get_string('role');
echo $OUTPUT->single_select($PAGE->url, 'role', $rolestodisplay, $roleselected);
echo $OUTPUT->container_end();
// Apply group restrictions.
$params = array();
$groupjoin = '';
コード例 #19
0
ファイル: index.php プロジェクト: educakanchay/campus
if ($mycourses = enrol_get_my_courses()) {
    $courselist = array();
    $popupurl = new moodle_url('/user/index.php?roleid=' . $roleid . '&sifirst=&silast=');
    foreach ($mycourses as $mycourse) {
        $coursecontext = context_course::instance($mycourse->id);
        $courselist[$mycourse->id] = format_string($mycourse->shortname, true, array('context' => $coursecontext));
    }
    if (has_capability('moodle/site:viewparticipants', $systemcontext)) {
        unset($courselist[SITEID]);
        $courselist = array(SITEID => format_string($SITE->shortname, true, array('context' => $systemcontext))) + $courselist;
    }
    $select = new single_select($popupurl, 'id', $courselist, $course->id, null, 'courseform');
    $select->set_label(get_string('mycourses'));
    $controlstable->data[0]->cells[] = $OUTPUT->render($select);
}
$controlstable->data[0]->cells[] = groups_print_course_menu($course, $baseurl->out(), true);
if (!isset($hiddenfields['lastaccess'])) {
    // Get minimum lastaccess for this course and display a dropbox to filter by lastaccess going back this far.
    // We need to make it diferently for normal courses and site course.
    if (!$isfrontpage) {
        $minlastaccess = $DB->get_field_sql('SELECT min(timeaccess)
                                               FROM {user_lastaccess}
                                              WHERE courseid = ?
                                                    AND timeaccess != 0', array($course->id));
        $lastaccess0exists = $DB->record_exists('user_lastaccess', array('courseid' => $course->id, 'timeaccess' => 0));
    } else {
        $minlastaccess = $DB->get_field_sql('SELECT min(lastaccess)
                                               FROM {user}
                                              WHERE lastaccess != 0');
        $lastaccess0exists = $DB->record_exists('user', array('lastaccess' => 0));
    }
コード例 #20
0
ファイル: index.php プロジェクト: ajv/Offline-Caching
    $courselist = array();
    $popupurl = new moodle_url($CFG->wwwroot . '/user/index.php?roleid=' . $roleid . '&sifirst=&silast=');
    foreach ($mycourses as $mycourse) {
        $courselist[$mycourse->id] = format_string($mycourse->shortname);
    }
    if (has_capability('moodle/site:viewparticipants', $systemcontext)) {
        unset($courselist[SITEID]);
        $courselist = array(SITEID => format_string($SITE->shortname)) + $courselist;
    }
    $select = html_select::make_popup_form($popupurl, 'id', $courselist, 'courseform', $course->id);
    $select->set_label(get_string('mycourses'));
    echo $OUTPUT->select($select);
    echo '</td>';
}
echo '<td class="left">';
groups_print_course_menu($course, $baseurl->out());
echo '</td>';
if (!isset($hiddenfields['lastaccess'])) {
    // get minimum lastaccess for this course and display a dropbox to filter by lastaccess going back this far.
    // we need to make it diferently for normal courses and site course
    if ($context->id != $frontpagectx->id) {
        $minlastaccess = $DB->get_field_sql('SELECT min(timeaccess)
                                                   FROM {user_lastaccess}
                                                  WHERE courseid = ?
                                                        AND timeaccess != 0', array($course->id));
        $lastaccess0exists = $DB->record_exists('user_lastaccess', array('courseid' => $course->id, 'timeaccess' => 0));
    } else {
        $minlastaccess = $DB->get_field_sql('SELECT min(lastaccess)
                                                   FROM {user}
                                                  WHERE lastaccess != 0');
        $lastaccess0exists = $DB->record_exists('user', array('lastaccess' => 0));