コード例 #1
0
ファイル: face.php プロジェクト: kohler/peteramati
function output($User)
{
    global $Me;
    $u = $Me->user_linkpart($User);
    echo '<div class="facebook61">', '<a href="', hoturl("index", ["u" => $u]), '">', '<img class="bigface61" src="' . hoturl("face", ["u" => $u, "imageid" => $User->contactImageId ?: 0]) . '" border="0" />', '</a>', '<h2 class="infacebook61"><a class="q" href="', hoturl("index", ["u" => $u]), '">', htmlspecialchars($u), '</a>';
    if ($Me->privChair) {
        echo "&nbsp;", become_user_link($User);
    }
    echo '</h2>';
    if ($User !== $Me) {
        echo '<h3 class="infacebook61">', Text::user_html($User), '</h3>';
    }
    echo '</div>';
}
コード例 #2
0
ファイル: profile.php プロジェクト: benesch/peteramati
    }
    if (@$_POST["sysadmin"]) {
        $roles |= Contact::ROLE_ADMIN;
    }
    $ck[] = "roles={$roles}";
    Dbl::qe_apply("update ContactInfo set " . join($ck, ",") . " where contactId=" . $User->contactId, $cv);
    redirectSelf();
}
$Conf->header("Profile", "profile");
$xsep = " <span class='barsep'>&nbsp;|&nbsp;</span> ";
echo "<div id='homeinfo'>";
echo "<h2 class='homeemail'>", Text::user_html($User), "</h2>";
if ($User->seascode_username || $User->huid) {
    echo '<h3><a href="', hoturl("index", array("u" => $Me->user_linkpart($User))), '">', htmlspecialchars($User->seascode_username ?: $User->huid), '</a>';
    if ($Me->privChair) {
        echo "&nbsp;", become_user_link($User);
    }
    echo "</h3>";
}
if ($User->dropped) {
    ContactView::echo_group("", '<strong class="err">You have dropped the course.</strong> If this is incorrect, contact us.');
}
echo Ht::form(hoturl_post("profile", array("u" => $User->email))), "<div>";
if ($User->disabled || $User->password == "") {
    echo Ht::submit("enable", "Enable user", array("value" => 1));
} else {
    echo Ht::submit("disable", "Disable user", array("value" => 1));
}
echo '<hr>';
echo '<table class="pltable" style="margin-top:1em"><tbody class="pltable pltable_alternate">';
echo '<tr><td class="pl pls">Roles</td><td class="pl">';
コード例 #3
0
ファイル: pset.php プロジェクト: kohler/peteramati
function echo_grader()
{
    global $Me, $User, $Pset, $Info;
    $gradercid = $Info->gradercid();
    if ($Info->is_grading_commit() && $Me->can_see_grader($Pset, $User)) {
        $pcm = pcMembers();
        $gpc = get($pcm, $gradercid);
        $value_post = "";
        if ($Me->can_set_grader($Pset, $User)) {
            $sel = array();
            if (!$gpc) {
                $sel["none"] = "(None)";
                $sel[] = null;
            }
            foreach (pcMembers() as $pcm) {
                $sel[$pcm->email] = Text::name_html($pcm);
            }
            $value = Ht::form($Info->hoturl_post("pset", array("setgrader" => 1))) . "<div>" . Ht::select("grader", $sel, $gpc ? $gpc->email : "none", array("onchange" => "setgrader61(this)"));
            $value_post = "<span class=\"ajaxsave61\"></span></div></form>";
        } else {
            if (isset($pcm[$gradercid])) {
                $value = Text::name_html($pcm[$gradercid]);
            } else {
                $value = "???";
            }
        }
        if ($Me->privChair) {
            $value .= "&nbsp;" . become_user_link($gpc);
        }
        ContactView::echo_group("grader", $value . $value_post);
    }
}
コード例 #4
0
ファイル: home.php プロジェクト: benesch/peteramati
function render_pset_row($pset, $students, $s, $row, $pcmembers)
{
    global $Me, $Now, $Profile;
    $row->sortprefix = "";
    $ncol = 0;
    $t0 = $Profile ? microtime(true) : 0;
    $t = "<td class=\"s61username\">";
    if ($pset->anonymous) {
        $x = $s->anon_username;
    } else {
        $x = $s->seascode_username ?: ($s->huid ?: $s->email);
    }
    $t .= "<a href=\"" . hoturl("pset", array("pset" => $pset->urlkey, "u" => $x, "sort" => @$_REQUEST["sort"])) . "\">" . htmlspecialchars($x) . "</a>";
    if ($Me->privChair) {
        $t .= "&nbsp;" . become_user_link($x, Text::name_html($s));
    }
    $t .= "</td>";
    ++$ncol;
    if (!$pset->anonymous) {
        $t .= "<td>" . Text::name_html($s) . ($s->extension ? " (X)" : "") . "</td>";
        ++$ncol;
    }
    $t .= "<td>";
    if ($s->gradercid) {
        if (isset($pcmembers[$s->gradercid])) {
            $t .= htmlspecialchars($pcmembers[$s->gradercid]->firstName);
        } else {
            $t .= "???";
        }
    }
    $t .= "</td>";
    ++$ncol;
    // are any commits committed?
    if (!$pset->gitless_grades) {
        if (($s->placeholder || $s->gradehash === null) && $s->repoid && ($s->placeholder_at < $Now - 3600 && rand(0, 2) == 0 || $s->placeholder_at < $Now - 600 && rand(0, 10) == 0) && (!$s->repoviewable || !$s->gradehash)) {
            // XXX this is slow given that most info is already loaded
            $info = ContactView::user_pset_info($s, $pset);
            $info->set_commit(null);
            $s->gradehash = $info->commit_hash() ?: null;
            $s->placeholder = 1;
            Dbl::qe("insert into RepositoryGrade (repoid, pset, gradehash, placeholder, placeholder_at) values (?, ?, ?, 1, ?) on duplicate key update gradehash=(if(placeholder=1,values(gradehash),gradehash)), placeholder_at=values(placeholder_at)", $s->repoid, $pset->id, $s->gradehash, $Now);
            if (!$s->repoviewable) {
                $s->repoviewable = $s->can_view_repo_contents($s);
            }
        }
        if (!$s->gradehash || $s->dropped) {
            $row->sortprefix = "~1 ";
        }
    }
    if (count($pset->grades)) {
        if ($pset->gitless_grades) {
            $gi = Contact::contact_grade_for($s, $pset);
            $gi = $gi ? $gi->notes : null;
        } else {
            if ($s->gradehash && !$s->placeholder) {
                $gi = $Me->commit_info($s->gradehash, $pset);
            } else {
                $gi = null;
            }
        }
        if (!$pset->gitless_grades) {
            $t .= "<td>";
            if ($gi && @$gi->linenotes) {
                $t .= "♪";
            } else {
                if ($Me->contactId == $s->gradercid) {
                    $s->incomplete = true;
                }
            }
            if ($gi && $s->gradercid != @$gi->gradercid && $Me->privChair) {
                $t .= "<sup>*</sup>";
            }
            $t .= "</td>";
            ++$ncol;
        }
        $garr = render_grades($pset, $gi, $s);
        $t .= '<td class="r">' . join('</td><td class="r">', $garr->all) . '</td>';
        $ncol += count($garr->all);
    }
    //echo "<td><a href=\"mailto:", htmlspecialchars($s->email), "\">",
    //htmlspecialchars($s->email), "</a></td>";
    $t .= "<td>";
    if ($s->url) {
        $t .= $s->repo_link($s->url, "repo");
        if (!$s->working) {
            $t .= ' <strong class="err">broken</strong>';
        } else {
            if (!$s->repoviewable) {
                $t .= ' <strong class="err">unconfirmed</strong>';
            }
        }
        if ($s->open) {
            $t .= ' <strong class="err">open</strong>';
        }
        if ($s->pcid != $s->rpcid || $s->pcid && (!isset($students[$s->pcid]) || $students[$s->pcid]->repoid != $s->repoid)) {
            $t .= ' <strong class="err">partner</strong>';
        }
    }
    $t .= "</td>";
    ++$ncol;
    if ($Profile) {
        $t .= sprintf("<td class=\"r\">%.06f</td>", microtime(true) - $t0);
        ++$ncol;
    }
    if (!@$row->ncol || $ncol > $row->ncol) {
        $row->ncol = $ncol;
    }
    $s->printed = true;
    return $t;
}
コード例 #5
0
ファイル: helpers.php プロジェクト: benesch/peteramati
function authorTable($aus, $viewAs = null)
{
    global $Conf;
    $out = "";
    if (!is_array($aus)) {
        $aus = explode("\n", $aus);
    }
    foreach ($aus as $aux) {
        $au = trim(is_array($aux) ? Text::user_html($aux) : $aux);
        if ($au != '') {
            if (strlen($au) > 30) {
                $out .= "<span class='autblentry_long'>";
            } else {
                $out .= "<span class='autblentry'>";
            }
            $out .= $au;
            if ($viewAs !== null && is_array($aux) && count($aux) >= 2 && $viewAs->email != $aux[2] && $viewAs->privChair) {
                $out .= " " . become_user_link($aux[2], Text::name_html($aux));
            }
            $out .= "</span> ";
        }
    }
    return $out;
}
コード例 #6
0
ファイル: contactview.php プロジェクト: kohler/peteramati
 static function echo_heading($user)
 {
     global $Me;
     $u = $Me->user_linkpart($user);
     if ($user !== $Me && !$user->is_anonymous && $user->contactImageId) {
         echo '<img class="smallface61" src="' . hoturl("face", array("u" => $u, "imageid" => $user->contactImageId)) . '" />';
     }
     echo '<h2 class="homeemail"><a href="', hoturl("index", array("u" => $u)), '">', htmlspecialchars($u), '</a>';
     if ($user->extension) {
         echo " (X)";
     }
     if ($Me->privChair) {
         echo "&nbsp;", become_user_link($user);
     }
     echo '</h2>';
     if ($user !== $Me && !$user->is_anonymous) {
         echo '<h3>', Text::user_html($user), '</h3>';
     }
     if ($user->dropped) {
         ContactView::echo_group("", '<strong class="err">You have dropped the course.</strong> If this is incorrect, contact us.');
     }
     echo '<hr class="c" />';
 }