Exemplo n.º 1
0
$max_pset = $Conf->setting("pset_forwarded");
foreach ($Conf->psets() as $pset) {
    if (Contact::student_can_see_pset($pset) && $pset->id > $max_pset && !$pset->gitless) {
        Contact::forward_pset_links($pset->id);
    }
}
if (!$Me->is_empty() && ($Me === $User || $Me->isPC) && $Qreq->set_username && check_post() && ($repoclass = RepositorySite::$sitemap[$Qreq->reposite]) && in_array($repoclass, RepositorySite::site_classes($Conf))) {
    if ($repoclass::save_username($User, $Qreq->username)) {
        redirectSelf();
    }
}
if (!$Me->is_empty() && $Qreq->set_repo !== null) {
    ContactView::set_repo_action($User);
}
if ($Qreq->set_partner !== null) {
    ContactView::set_partner_action($User);
}
if ((isset($_REQUEST["set_drop"]) || isset($_REQUEST["set_undrop"])) && $Me->isPC && $User->is_student() && check_post()) {
    Dbl::qe("update ContactInfo set dropped=? where contactId=?", isset($_REQUEST["set_drop"]) ? $Now : 0, $User->contactId);
    redirectSelf();
}
// download
function collect_pset_info(&$students, $pset, $where, $entries, $nonanonymous)
{
    global $Conf, $Me;
    $result = $Conf->qe_raw("select c.contactId, c.firstName, c.lastName, c.email,\n\tc.huid, c.anon_username, c.seascode_username, c.github_username, c.extension,\n\tr.repoid, r.url, r.open, r.working, r.lastpset,\n\trg.gradehash, rg.gradercid\n\tfrom ContactInfo c\n\tleft join ContactLink l on (l.cid=c.contactId and l.type=" . LINK_REPO . " and l.pset={$pset->id})\n\tleft join Repository r on (r.repoid=l.link)\n\tleft join RepositoryGrade rg on (rg.repoid=r.repoid and rg.pset={$pset->id} and not rg.placeholder)\n\twhere ({$where})\n\tand (rg.repoid is not null or not c.dropped)\n\tgroup by c.contactId");
    $sort = $Qreq->sort;
    while ($s = edb_orow($result)) {
        $s->is_anonymous = $pset->anonymous && !$nonanonymous;
        $username = $s->is_anonymous ? $s->anon_username : ($s->github_username ?: $s->seascode_username);
        Contact::set_sorter($s, $sort);