예제 #1
0
function cscircles_students_page()
{
    echo "<div class='wrap'>\n<h2>Manage CS Circles Students</h2>";
    if (isSoft($_REQUEST, 'submitted', 'true')) {
        $d = 0;
        $h = 0;
        $newhide = "";
        $newnicks = array();
        $newgroups = array();
        foreach ($_REQUEST as $key => $val) {
            if (substr($key, 0, 1) == 's' && is_numeric(substr($key, 1))) {
                $id = substr($key, 1);
                if ($val == 'hide') {
                    if ($newhide != '') {
                        $newhide .= ",";
                    }
                    $newhide .= substr($key, 1);
                    $h++;
                } else {
                    if ($val == 'remove') {
                        if (strtolower(get_user_meta(substr($key, 1), 'pbguru', true)) == strtolower(wp_get_current_user()->user_login)) {
                            update_user_meta(substr($key, 1), 'pbguru', '');
                        }
                        $d++;
                    }
                }
            }
            if (substr($key, 0, 1) == 'n' && is_numeric(substr($key, 1))) {
                $id = substr($key, 1);
                $nick = $val;
                $nick = preg_replace('_[<>&\\"\\\\]_', "", trim($nick));
                if ($nick != '') {
                    $newnicks[$id] = $nick;
                }
            }
            if (substr($key, 0, 1) == 'g' && is_numeric(substr($key, 1))) {
                $id = substr($key, 1);
                $group = $val;
                $group = preg_replace('_[<>&\\"\\\\]_', "", trim($group));
                if ($group != '') {
                    $newgroups[$id] = $group;
                }
            }
        }
        update_user_meta(wp_get_current_user()->ID, 'pb_hidestudents', $newhide);
        update_user_meta(wp_get_current_user()->ID, 'pb_studentnicks', json_encode($newnicks));
        update_user_meta(wp_get_current_user()->ID, 'pb_studentgroups', json_encode($newgroups));
        echo "<div class='updated'>Deleted {$d} students. You have {$h} hidden students.</div>";
    }
    echo "<script type='text/javascript'>classlist = function() {\n var classes={};\n jQuery('.grouplabel').each(function(i, elt) {classes[elt.value] = true;});\n var keys = [];\n for(var key in classes) {\n   if (classes.hasOwnProperty(key)) {\n     keys.push(key);\n   }\n }\n keys.sort();\n jQuery('#classlist-select').html('');\n jQuery('#classlist-select').append(new Option('', ''));\n jQuery('#classlist-select').append(new Option('<show all students>', '<show all students>'));\n for (var i = 0; i < keys.length; i++) {\n   if (keys[i] != '')\n     jQuery('#classlist-select').append(new Option(keys[i], keys[i]));\n } \n}\nselectClass = function() {\n  theclass = jQuery('#classlist-select')[0].value;\n  jQuery('.student-row').each(function(i, row){\n    if (jQuery(row).find('.grouplabel')[0].value == theclass || theclass == '<show all students>')\n     jQuery(jQuery(row).find('.unhide')[0]).prop('checked',true);\n    else\n     jQuery(jQuery(row).find('.hide')[0]).prop('checked',true);\n  });\n}\njQuery(classlist); // call once on load\n</script>";
    echo "<p>Students who are hidden or removed won't show up\non the Progress page. You still have access to \nmessages between you and them in the Mail page histories.</p>\n\n<p>If you hide a student, you can unhide them later.</p>\n<p>If you remove a student, their guru is cleared. They would have to re-add you if you want them back.</p>\n<p>Students are listed in order of registration on CS Circles (earliest first).</p>\n<!--<p>Nicknames are optional. Otherwise, students appear by their e-mail and/or userid.</p>-->\n";
    if (count(getStudents(true)) == 0) {
        echo "<div class='error'>You have no students. This page will disappear, and reappear if you get more students.</div>";
    } else {
        echo "<form method='get' action='users.php'>\n   <input type='hidden' name='page' value='cscircles-students'>\n   <input type='hidden' name='submitted' value='true'>\n<table style='text-align:center'><tr><th>Unhidden</th><th>Hidden</th><th>Remove</th><th>Username</th><th>Name</th><th>E-mail</th><th>Optional nickname <br>(appears just to you, throughout site)</th><th>Optional class/section label</th></tr>";
        $hidden = get_user_meta(wp_get_current_user()->ID, 'pb_hidestudents', true);
        $nicks = json_decode(get_user_meta(wp_get_current_user()->ID, 'pb_studentnicks', true), true);
        $groups = json_decode(get_user_meta(wp_get_current_user()->ID, 'pb_studentgroups', true), true);
        if (!is_array($nicks)) {
            $nicks = array();
        }
        if (!is_array($groups)) {
            $groups = array();
        }
        if ($hidden == '') {
            $hidden = '';
        }
        $hidden = explode(",", $hidden);
        foreach (getStudents(true) as $index => $id) {
            $user = get_userdata($id);
            $hid = in_array($id, $hidden);
            $c1 = $hid ? "" : "checked='true'";
            $c2 = $hid ? "checked='true'" : "";
            $nick = getSoft($nicks, $id, '');
            $group = getSoft($groups, $id, '');
            echo "<tr class='student-row'>\n<td><input type='radio' class='unhide' name='s{$id}' {$c1} value='unhide'/></td>\n<td><input type='radio' class='hide' name='s{$id}' {$c2} value='hide'/></td>\n<td><input type='radio' name='s{$id}' value='remove'/></td>\n<td>{$user->user_login}</td>\n<td>{$user->user_firstname} {$user->user_lastname}</td>\n<td>{$user->user_email}</td>\n<td><input style='width:100%' type='text' name = 'n{$id}' value=\"{$nick}\"></td>\n<td><input style='width:100%' type='text' class = 'grouplabel' name = 'g{$id}' value=\"{$group}\" onkeyup=\"javascript:classlist()\" onchange=\"javascript:classlist()\"></td>\n</tr>";
        }
        echo "<tr id='classlist-tr'>\n   <td colspan='7' style='text-align:right'>\n   <div id='classlist-label'>Show a class and hide all other students? (Select and press <b>Submit</b> to activate.)</div>\n   </td>\n   <td style='text-align:left'><select id='classlist-select' onchange='javascript:selectClass()'></select></td></tr>";
        echo "</table>\n   <button class='button-primary' id='submit'>Submit</button></form>";
        echo "</div>";
    }
}
예제 #2
0
    <div class="grade" id="remove">
        <h4>Remove Grade</h4>
        <form action="manageGradesSubmit.php" method="post">
            <?php 
    if (isLoginAsAdmin()) {
        echo generateDropDownListWithFirstOption(getAllUniversitiesNames(), "Select University", 'selectedUniversity', 'selectedUniversityRemove');
        echo generateDropDownListWithFirstOption(null, "Select University First", 'selectedDepartmentId', 'selectedDepartmentRemove');
        echo generateDropDownListWithFirstOption(null, "Select Department First", 'selectedStudentId', 'selectedStudentRemove');
        echo generateDropDownListWithFirstOption(null, "Select Student First", 'selectedCourseId', 'selectedCourseRemove');
        echo generateDropDownListWithFirstOption(null, "Select Course First", 'selectedGradeId', 'selectedGradeRemove');
    } else {
        if (isLoginAsSecretary()) {
            $departmentId = $_SESSION["departmentId"];
            echo "<input type='hidden' id='selectedDepartmentRemove' name='selectedDepartmentId' value='{$departmentId}'>";
            echo generateDropDownListWithFirstOptionAndSpecifiedValueKey(getStudents($departmentId), "Select Student", 'selectedStudentId', 'selectedStudentRemoveSec', 'studentId', 'studentUsername');
            echo generateDropDownListWithFirstOption(null, "Select Student First", 'selectedCourseId', 'selectedCourseRemoveSec');
            echo generateDropDownListWithFirstOption(null, "Select Course First", 'selectedGradeId', 'selectedGradeRemoveSec');
        }
    }
    ?>
            <input type="submit" name="submit" class="warningButton" value="remove">
        </form>
    </div>

    <?php 
}
?>

</div>
예제 #3
0
 print $row["name"];
 print "</td>";
 print "<td style='width: 34%; vertical-align: top'>";
 print "<span style='font-size: 115%; font-weight: bold'>" . _('Date') . "</span><br/>";
 print dateConvertBack($guid, $row["date"]);
 print "</td>";
 print "</tr>";
 print "<tr>";
 print "<td style='padding-top: 15px; width: 34%; vertical-align: top' colspan=3>";
 print "<span style='font-size: 115%; font-weight: bold'>" . _('Homework Details') . "</span><br/>";
 print $row["homeworkDetails"];
 print "</td>";
 print "</tr>";
 print "</table>";
 $role = getCARole($guid, $connection2, $row["gibbonCourseClassID"]);
 $sqlList = getStudents($guid, $connection2, $role, $row["gibbonCourseClassID"], $row["homeworkCrowdAssessOtherTeachersRead"], $row["homeworkCrowdAssessOtherParentsRead"], $row["homeworkCrowdAssessSubmitterParentsRead"], $row["homeworkCrowdAssessClassmatesParentsRead"], $row["homeworkCrowdAssessOtherStudentsRead"], $row["homeworkCrowdAssessClassmatesRead"]);
 //Return $sqlList as table
 if ($sqlList[1] != "") {
     try {
         $resultList = $connection2->prepare($sqlList[1]);
         $resultList->execute($sqlList[0]);
     } catch (PDOException $e) {
         print "<div class='error'>" . $e->getMessage() . "</div>";
     }
     if ($resultList->rowCount() < 1) {
         print "<div class='error'>";
         print "There is currently no work to assess.";
         print "</div>";
     } else {
         print "<table cellspacing='0' style='width: 100%'>";
         print "<tr class='head'>";
예제 #4
0
    }
    //$system_message = $system_message . "rows returned: " . mysql_num_rows($student_result_limit) . "<BR>";
    //$system_message = $system_message . $student_query_limit . "<BR>";
    //find the totals...
    $student_result_total = mysql_query($student_query);
    if (!$student_result_total) {
        $error_message = "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$student_query}'<BR>";
        return NULL;
    }
    $szTotalStudents = mysql_num_rows($student_result_total);
    $system_message = $system_message . "Number of archived students: {$szTotalStudents}<BR>";
    $system_message = $system_message . "(Showing: " . mysql_num_rows($student_result_limit) . ")<BR>";
    //$system_message = $system_message . "<BR>$student_query<BR><BR>";
    return $student_result_limit;
}
$sqlStudents = getStudents();
//$szTotalStudents contains total number of stdnts.
//get totals...
if (!$sqlStudents) {
    $system_message = $system_message . $error_message;
    IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR');
}
//set back vars...
$szBackGetVars = "";
foreach ($_GET as $key => $value) {
    $szBackGetVars = $szBackGetVars . $key . "=" . $value . "&";
}
//strip trailing '&'
$szBackGetVars = substr($szBackGetVars, 0, -1);
?>
 
예제 #5
0
<?php

error_reporting(E_ALL);
if (isset($_GET['classSchedId'])) {
    $classSchedId = $_GET['classSchedId'];
}
$schedClass = getSchClassAllInfo($dbconn, $classSchedId);
//all info for class
$students = getStudents($dbconn, $classSchedId);
$numReg = getCountParticipants($dbconn, $classSchedId);
function pb_menu_items($wp_admin_bar)
{
    $wp_admin_bar->add_menu(array('parent' => 'user-actions', 'href' => _cscurl('progress'), 'title' => ___t('My Progress'), 'id' => 'up'));
    if (!get_option('cscircles_hide_help')) {
        $wp_admin_bar->add_menu(array('parent' => 'user-actions', 'href' => _cscurl('mail'), 'title' => ___t('Mail'), 'id' => 'uppity'));
    }
    $wp_admin_bar->add_menu(array('id' => 'snappy', 'parent' => 'user-actions', 'title' => ___t('Console (new window)'), 'href' => _cscurl('console'), "meta" => array("target" => "_blank")));
    $wp_admin_bar->add_menu(array('id' => 'snappie', 'parent' => 'user-actions', 'title' => ___t('Visualizer (new window)'), 'href' => _cscurl('visualize'), "meta" => array("target" => "_blank")));
    $wp_admin_bar->add_menu(array('id' => 'crackle', 'parent' => 'user-actions', 'title' => ___t('Resources (new window)'), 'href' => _cscurl('resources'), "meta" => array("target" => "_blank")));
    $wp_admin_bar->add_menu(array('id' => 'pop', 'parent' => 'user-actions', 'title' => ___t('Contact Us (new window)'), 'href' => _cscurl('contact'), "meta" => array("target" => "_blank")));
    if (!is_admin()) {
        $wp_admin_bar->add_menu(array('parent' => 'top-secondary', 'id' => 'totop', 'title' => '<img onclick="scrollToTop()" title="' . ___t('scroll to top') . '"' . ' class="icon" src="' . UFILES . 'up.png"/>'));
    }
    global $wpdb;
    $mailtable = $wpdb->prefix . "pb_mail";
    // check first, since upon initial installation it might be a problem due to being in header
    if ($wpdb->get_var("SHOW TABLES LIKE '{$mailtable}'") == $mailtable) {
        $students = pybox_on() ? getStudents() : array();
        if (pybox_on() && (count($students) > 0 || userIsAdmin() || userIsAssistant())) {
            if (userIsAdmin()) {
                $where = "(uto = " . getUserID() . " OR uto = 0)";
            } else {
                $where = "(uto = " . getUserID() . ")";
                //"AND ustudent IN (".implode(',', $students)."))";
            }
            $where = $where . "AND unanswered = 1";
            $count = $wpdb->get_var("SELECT COUNT(1) FROM " . $wpdb->prefix . "pb_mail WHERE {$where}");
            if ($count > 0) {
                $msg = $wpdb->get_row("SELECT ustudent, problem, ID FROM " . $wpdb->prefix . "pb_mail \n                             WHERE {$where} ORDER BY ID ASC LIMIT 1", ARRAY_A);
                $url = _cscurl('mail') . "?who=" . $msg['ustudent'] . "&what=" . $msg['problem'] . "&which=" . $msg['ID'] . '#m';
                $wp_admin_bar->add_menu(array('parent' => 'top-secondary', 'id' => 'mail', 'href' => $url, 'title' => '<img title="' . ___t('goto oldest unanswered mail') . '"' . 'class="icon" src="' . UFILES . "mail-icon.png\"/>({$count})"));
            }
        }
    }
    if (current_user_can('level_10')) {
        $wp_admin_bar->add_node(array('id' => 'admin-menu', 'parent' => 'top-secondary', 'title' => 'su', 'meta' => array('class' => '', 'title' => 'Admin Menu')));
        $ap = get_page_by_title('Admin Pages');
        $more_links = array('Wordpress Dashboard' => get_bloginfo('wpurl') . '/wp-admin/index.php', 'Edit THIS Page' => get_edit_post_link());
        if ($_SERVER['SERVER_NAME'] = 'cscircles.cemc.uwaterloo.ca') {
            $more_links['MySQL Frontend'] = "/~atkong/pma/";
            $more_links['[rebuild /export directory]'] = '/nav/?export=Y';
        }
        if ($ap != null) {
            //      $more_links['Daily submit-code usage'] = get_permalink($ap).'/profiling/?frequency=10&activity=submit-code';
            $more_links['CS Circles Options'] = admin_url('admin.php?page=cscircles-options');
            $more_links['Rebuild Databases'] = admin_url('admin.php?page=cscircles-makedb');
            $more_links['[listing of admin-manual follows]'] = get_permalink($ap);
            $pages = get_pages(array('child_of' => $ap->ID, 'post_status' => 'publish,private'));
            foreach ($pages as $page) {
                $more_links[$page->post_title] = get_permalink($page);
            }
        }
        $i = 0;
        foreach ($more_links as $title => $link) {
            $wp_admin_bar->add_node(array('parent' => 'admin-menu', 'id' => "morelinks" . $i++, 'href' => $link, 'title' => $title));
        }
    }
}
function pbmailpage($options, $content)
{
    if (!is_user_logged_in()) {
        return __t("You must login to view the mail page.");
    }
    $v = validate();
    if ($v[0] != 'success') {
        return $v[1];
    }
    // error message
    extract($v[1]);
    // $student, $problem, $focus, $sid
    $name = nicefiedUsername($sid, FALSE);
    $r = '';
    global $wpdb;
    $students = getStudents();
    $cstudents = count($students);
    $r .= reselector($students, $cstudents);
    $r .= '<hr style="width:80%;align:center;">';
    if ($problem !== NULL) {
        $finished = $wpdb->get_var($wpdb->prepare("SELECT time FROM " . $wpdb->prefix . "pb_completed WHERE userid = %d AND problem = %s", $sid, $problem['slug']));
        $r .= '<div class="history-note">' . sprintf(__t('Mail about %1$s [%3$s] for %2$s'), $problem['publicname'], userString($sid), '<a href="' . $problem['url'] . '">' . __t('link to original page') . '</a>');
        $r .= '</div>';
        if ($finished !== NULL) {
            $r .= "<img title='" . $student->user_login . __t(" has completed this problem.") . "' src='" . UFILES . "checked.png' class='pycheck'/>";
        } else {
            $r .= "<img title='" . $student->user_login . __t(" has not completed this problem.") . "' src='" . UFILES . "icon.png' class='pycheck'/>";
        }
        if ($finished !== NULL) {
            $r .= "<div class='history-prenote'>" . sprintf(__t('Note: this student completed the problem at %s'), $finished) . "</div>";
        }
        $r .= '<i>' . __t('Click on a message title to toggle the message open or closed.') . '</i>';
        global $mailcond;
        $messages = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "pb_mail WHERE ustudent = %d AND problem = %s AND {$mailcond} ORDER BY ID desc", $sid, $problem['slug']), ARRAY_A);
        foreach ($messages as $i => $message) {
            $c = $message['ID'] == $focus ? " showing" : " hiding";
            $idp = $message['ID'] == $focus ? " id='m' " : '';
            $r .= "<div {$idp} class='collapseContain{$c}' style='border-radius: 5px;'>";
            $title = __t("From") . " " . nicefiedUsername($message['ufrom'], FALSE) . ' ' . __t('to') . ' ' . nicefiedUsername($message['uto'], FALSE) . ', ' . $message['time'];
            if (count($messages) > 1 && $i == 0) {
                $title .= " " . __t("(newest)");
            }
            if (count($messages) > 1 && $i == count($messages) - 1) {
                $title .= " " . __t("(oldest)");
            }
            $r .= "<div class='collapseHead'><span class='icon'></span>{$title}</div>";
            $r .= "<div class='collapseBody'><span class='quoth'>" . __t("Quote/<br/>Reply") . "</span>" . preBox($message['body'], -1, 10000, "font-size:12px; line-height:14px; white-space: pre-wrap;") . '</div>';
            $r .= '</div>';
        }
        $to = "";
        if (getUserID() == $sid) {
            $guru_login = get_the_author_meta('pbguru', get_current_user_id());
            $guru = get_user_by('login', $guru_login);
            // FALSE if does not exist
            $to .= '<div style="text-align: center">';
            $to .= __t('Send a question by e-mail to: ');
            if ($guru !== FALSE) {
                $to .= "<select class='recipient'>\n<option value='1'>" . __t("My guru") . " ({$guru_login})</option>\n<option value='-1'>" . __t("CS Circles Assistant") . "</option>\n</select></div>";
            } else {
                $to .= "<select class='recipient'>\n<option value='-1'>" . __t("CS Circles Assistant") . "</option>\n<option value='0'>" . __t("(No guru is specified)") . "</option>\n</select>";
                $to .= '<br/></div>';
            }
        }
        $r .= '<div class="pybox fixsresize mailform" id="mailform">
<div id="bodyarea" class="pyboxTextwrap">
<textarea name="body" class="resizy" placeholder="' . __t('Type here to send a reply about this problem') . '" style="width:100%; white-space: pre-wrap; font-size: 11px; line-height:13px" rows=12></textarea>
</div>
' . $to;
        if (getUserID() != $sid) {
            $r .= '<input style="position:relative; top:2px" type="checkbox" id="noreply" onclick="toggleVisibility(\'bodyarea\')">' . ' <label style="font-size:75%" for="noreply">' . __t('Just mark as read without replying') . '</label><br>';
        }
        $r .= '<button onclick="mailReply(' . $sid . ',\'' . $problem['slug'] . '\');">' . __t('Send this message!') . '</button>
</div>';
        $problemname = $problem['publicname'];
        $r .= '<hr style="width:80%;align:center;">';
        if (getUserID() != $sid) {
            $r .= "<div class='history-note'><a href='" . cscurl('progress') . '?user='******'>" . sprintf(__t("%s's progress page (new window)"), $name) . "</a></div>";
        }
        $r .= "\n<div class='collapseContain hiding'>\n<div class='collapseHead'><span class='icon'></span>" . __t("Problem description for") . " " . $problem['publicname'] . "</div>\n<div class='collapseBody'>" . apply_filters('the_content', pyBoxHandler(json_decode($problem['shortcodeArgs'], TRUE), $problem['content'])) . "</div>\n</div>";
        if (getUserID() != $sid) {
            $r .= niceFlex('us', sprintf(__t('%1$s\'s submissions for %2$s'), $name, $problemname), 'problem-history', 'dbProblemHistory', array('user' => $sid, 'p' => $problem['slug']));
        }
        $r .= niceFlex('ms', sprintf(__t("My previous submissions for %s"), $problemname), 'problem-history', 'dbProblemHistory', array('p' => $problem['slug']));
        if (getUserID() != $sid) {
            $r .= niceFlex('omp', sprintf(__t("My other messages about %s"), $problemname), 'mail', 'dbMail', array('what' => $problem['slug'], 'xwho' => $sid));
        }
        $r .= niceFlex('oms', getUserID() == $sid ? __t("My messages for other programs") : sprintf(__t("Messages to/from %s for other problems"), $name), 'mail', 'dbMail', array('who' => $sid, 'xwhat' => $problem['slug']));
    }
    if ($cstudents > 0 || userIsAssistant()) {
        $r .= niceFlex('allstu', sprintf(__t("All messages ever about %s's work"), $name), 'mail', 'dbMail', array('who' => $sid));
    }
    $r .= niceFlex('allme', __t("All messages ever to or from me"), 'mail', 'dbMail', array());
    return $r;
}
예제 #8
0
}
connect();
if ($user = checkStatus($id)) {
    $page = isset($_GET['page']) ? $_GET['page'] : 1;
    //设置每页显示的数量
    $length = 5;
    //获取当前满足条件的记录数有多少
    $counts = getCounts();
    //计算前一页和后一页
    $prev = $page <= 1 ? 1 : $page - 1;
    //前一页
    //求出总页数
    $pages = ceil($counts / $length);
    //下一页
    $next = $page >= $pages ? $pages : $page + 1;
    $students = getStudents($page, $length);
} else {
    redirect('login.html', 3, '您还没有登录或者登录已经失效,请重新登录!');
}
?>
	<div id ="all" style="width:100%;height:100%;float:left">
		<div id="header" style="width:100%;height:20px;float:left">
			<div id="userinfo" style="width:50%;float:left;text-align:right">
				欢迎<?php 
echo $user['u_username'];
?>
登录系统
			</div>
			<div id="userinfo" style="width:50%;float:left;text-align:right">
				<a href="logout.php?id=<?php 
echo $user['u_id'];
function getStudentList($with_hidden = false)
{
    if (!is_user_logged_in()) {
        return FALSE;
    }
    $students = getStudents();
    return '(' . implode(',', $students) . ')';
}
예제 #10
0
<?php

session_start();
require_once '../db/database.php';
spl_autoload_register('loadClass');
if (!isset($_SESSION['user']) || $_SESSION['username'] == "-error-") {
    header('Location: accueil.php');
}
$user = unserialize($_SESSION['user']);
$students = getStudents();
$levels = array();
?>

<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
    <title>Panel enseignant</title>
    <meta charset="utf-8" />
    <link rel="stylesheet" href="../plugin/bootstrap/css/bootstrap.min.css" type="text/css" />
    <link rel="stylesheet" href="../css/style.css" type="text/css" />
    <style>
    body {
    	padding-top: 15px;
    	width: 75%;
    	margin: auto;
    	}
    	header table .btn {
    		margin-left: 15px;
    	}
    	</style>
예제 #11
0
    ?>
                <input type="submit" name="submit" value="transfer">
            </form>
            <?php 
}
?>
    </div>

    <div class="student" id="remove">
        <h4>Remove Student</h4>
        <form action="manageStudentsSubmit.php" method="post">
            <?php 
if (isLoginAsAdmin()) {
    echo generateDropDownListWithFirstOption(getAllUniversitiesNames(), "Select University", 'selectedUniversity', 'selectedUniversityRemove');
    echo generateDropDownListWithFirstOption(null, "Select University First", 'selectedDepartmentId', 'selectedDepartmentRemove');
    echo generateDropDownListWithFirstOption(null, "Select Department First", 'selectedStudentId', 'selectedStudentRemove');
} else {
    if (isLoginAsSecretary()) {
        $departmentId = $_SESSION["departmentId"];
        echo "<input type='hidden' name='selectedDepartmentId' value='{$departmentId}'>";
        echo generateDropDownListWithSpecifiedValueKey(getStudents($departmentId), 'selectedStudentId', 'selectedStudentRemove', 'studentId', 'studentUsername');
    }
}
?>
            <input type="submit" name="submit" class="warningButton" value="remove">
        </form>
    </div>
</div>

<?php 
include 'footer.php';
function dbMail($limit, $sortname, $sortorder, $req = NULL)
{
    global $db_query_info;
    $db_query_info = array();
    $who = getSoft($req === NULL ? $_REQUEST : $req, "who", "");
    $xwho = getSoft($req === NULL ? $_REQUEST : $req, "xwho", "");
    $what = getSoft($req === NULL ? $_REQUEST : $req, "what", "");
    $xwhat = getSoft($req === NULL ? $_REQUEST : $req, "xwhat", "");
    $unans = getSoft($req === NULL ? $_REQUEST : $req, "unans", "");
    $db_query_info['type'] = 'mail-history';
    $db_query_info['who'] = $who;
    $db_query_info['xwho'] = $xwho;
    $db_query_info['what'] = $what;
    $db_query_info['xwhat'] = $xwhat;
    $db_query_info['unans'] = $unans;
    if (!is_user_logged_in()) {
        return __t("You must log in to view past mail.");
    }
    $where = 'WHERE 1';
    if (userIsAdmin()) {
        $where .= ' AND (uto = ' . getUserID() . ' OR uto = 0 OR ufrom = ' . getUserID() . ' OR ufrom = 0)';
    } else {
        $students = getStudents();
        $students[] = getUserID();
        $where .= ' AND (ustudent IN (' . implode(',', $students) . ') OR uto = ' . getUserID() . ' OR ufrom = ' . getUserID() . ' )';
    }
    if ($who != '') {
        if (!is_numeric($who)) {
            return sprintf(__t("%s must be numeric."), "'who'");
        }
        $who = (int) $who;
        if (userIsAdmin() || getUserID() == $who || getUserID() == guruIDID($who) || userIsAssistant()) {
            $where .= ' AND ustudent = ' . $who;
        } else {
            return __t("Access denied.");
        }
    } else {
        if ($xwho != '') {
            if (!is_numeric($xwho)) {
                return sprintf(__t("%s must be numeric."), "'xwho'");
            }
            $xwho = (int) $xwho;
            $where .= ' AND ustudent != ' . $xwho;
        }
    }
    if ($unans != '') {
        if (!is_numeric($unans)) {
            return sprintf(__t("%s must be numeric."), "'unans'");
        }
        $unans = (int) $unans;
        $where .= ' AND unanswered = ' . $unans;
    }
    global $wpdb;
    if ($what != '') {
        $where .= $wpdb->prepare(' AND problem = %s', $what);
    }
    if ($xwhat != '') {
        $where .= $wpdb->prepare(' AND problem != %s', $xwhat);
    }
    $table_name = $wpdb->prefix . "pb_mail";
    $knownFields = array(__t("from") => "ufrom", __t("to") => "uto", __t("when") => "time", __t("message") => "body", __t("problem") => "problem", __t("replied?") => "unanswered");
    $sortString = array_key_exists($sortname, $knownFields) ? $knownFields[$sortname] . " " . $sortorder . ", " : "";
    $count = $wpdb->get_var("SELECT COUNT(1) from {$table_name} {$where}");
    $prep = "SELECT * from {$table_name} {$where} ORDER BY {$sortString} ID DESC" . $limit;
    //   pyboxlog($prep);
    $flexirows = array();
    foreach ($wpdb->get_results($prep, ARRAY_A) as $r) {
        $cell = array();
        $cell[__t('from')] = nicefiedUsername($r['ufrom']);
        $cell[__t('to')] = nicefiedUsername($r['uto']);
        $url = cscurl('mail') . "?who=" . $r['ustudent'] . "&what=" . $r['problem'] . "&which=" . $r['ID'] . "#m";
        $cell[__t('when')] = str_replace(' ', '<br>', $r['time']);
        if ($what == '') {
            $cell[__t('problem')] = $r['problem'];
        }
        if ($unans == '') {
            $cell[__t('replied?')] = $r['unanswered'] == 1 ? __t('no') : __t('yes');
        }
        $cell[__t('message')] = "<a href='{$url}'>" . preBox($r['body']) . "</a>";
        $flexirows[] = array('id' => $r['ID'], 'cell' => $cell);
    }
    return array('total' => $count, 'rows' => $flexirows);
}
예제 #13
0
         $departmentId = $_POST[$key];
         $pro = getProfessors($departmentId);
         echo generateOptionsWithSpecifiedValueField($pro, 'professorId', 'professorUsername');
     }
     break;
 case 'departmentIdAndReturnSecretaryId':
     if (!empty($_POST[$key])) {
         $departmentId = $_POST[$key];
         $sec = getSecretaries($departmentId);
         echo generateOptionsWithSpecifiedValueField($sec, 'secretaryId', 'secretaryUsername');
     }
     break;
 case 'departmentIdAndReturnStudentId':
     if (!empty($_POST[$key])) {
         $departmentId = $_POST[$key];
         $stu = getStudents($departmentId);
         echo generateOptionsWithSpecifiedValueField($stu, 'studentId', 'studentUsername');
     }
     break;
 case 'departmentIdAndReturnCourseId':
     if (!empty($_POST[$key])) {
         $departmentId = $_POST[$key];
         $cou = getCourses($departmentId);
         echo generateOptionsWithSpecifiedValueField($cou, 'courseId', 'courseName');
     }
     break;
 case 'departmentIdAndReturnClassId':
     if (!empty($_POST[$key])) {
         $departmentId = $_POST[$key];
         $cla = getClasses($departmentId);
         echo generateOptionsWithSpecifiedValueField($cla, 'classId', 'className');
예제 #14
0
	else
	{
		while (!feof($fp))
		{			
			$line = fgets($fp);
			$element = split("\|", $line);
				
			if(strcmp(trim($element[14]), "Student") == 0)
			{
				echoLine($element);
			}
		}
	}
}

getStudents();


 

//Populate the form with variables.

/*
      <a href="students.html">Edit account</a> - 
      <a href="students.html">Block account</a> - 
      <a href="students.html">Email student</a>
*/

?>
 
</table>
예제 #15
0
파일: index.php 프로젝트: eebrah/schoolsys
</tr>
<tr>
	<th>date registered</th>
	<td>' . $student->getDateOfAdmission() . '</td>
</tr>
</table>';
                    } else {
                        $pageBody .= '
<div class="dialog error">
<p>Sorry, but in order to view a students record, you must identify that student first, perhaps from <a href="?section=students&amp;action=list">here</a>?</p>
</div>';
                    }
                    break;
                case "list":
                default:
                    $students = getStudents("all");
                    if (count($students) > 0) {
                        $pageBody .= '
<table class="fancy sortable searchable">
<thead>
	<tr>
		<th>#</th>
		<th>school ID</th>
		<th>form</th>
		<th>name</th>
		<th>actions</th>
	</tr>
</thead>
<tbody>';
                        $count = 1;
                        foreach ($students as $studentID) {
function pyUser($options, $content)
{
    if (!is_user_logged_in()) {
        return __t("You must login to view your user page.");
    }
    global $wpdb;
    $user = wp_get_current_user();
    $uid = $user->ID;
    $students = getStudents();
    $cstudents = count($students);
    $problem_table = $wpdb->prefix . "pb_problems";
    $problems = $wpdb->get_results("SELECT * FROM {$problem_table} WHERE facultative = 0 AND lang = '" . currLang2() . "' AND lesson IS NOT NULL ORDER BY lesson ASC, boxid ASC", ARRAY_A);
    $problemsByNumber = array();
    foreach ($problems as $prow) {
        $problemsByNumber[$prow['slug']] = $prow;
    }
    $gp = getSoft($_GET, "problem", "");
    if ($gp != "" && $gp != "console" && !array_key_exists($gp, $problemsByNumber)) {
        echo sprintf(__t("Problem %s not found (at least in current language)"), $gp);
        return;
    }
    if (userIsAdmin() || userIsAssistant() || $cstudents > 0) {
        $preamble = "<div class='progress-selector'>\n       <form method='get'><table style='border:none'><tr><td>" . sprintf(__t("View one of your students? (you have %s)"), $cstudents) . '</td><td>';
        $options = array();
        $options[''] = __t('Show only me');
        $options['all'] = __t('Summary of all my students');
        if (!userIsAdmin()) {
            foreach ($students as $student) {
                $info = get_userdata($student);
                $options[$info->ID] = userString($info->ID);
            }
        }
        if (userIsAdmin()) {
            $preamble .= 'blank: you; "all": all; id#: user (<a href="' . cscurl('allusers') . '">list</a>) <input style = "padding:0px;width:60px" type="text" name="user" value="' . getSoft($_REQUEST, 'user', '') . '">';
        } else {
            $preamble .= optionsHelper($options, 'user');
        }
        $preamble .= '</td></tr><tr><td>';
        $preamble .= __t("Just show submissions for one problem?");
        $options = array();
        $options[''] = __t('Show all');
        $options['console'] = __t('Console');
        foreach ($problems as $problem) {
            if ($problem['type'] == 'code') {
                $options[$problem['slug']] = $problem['publicname'];
            }
        }
        $preamble .= '</td><td>';
        $preamble .= optionsHelper($options, 'problem');
        $preamble .= "</td></tr><tr><td colspan='2' style='text-align:center'><input style='width: 25%' type='submit' value='" . __t('Submit') . "'/></tr></td></table></form></div>";
        echo $preamble;
    }
    $allStudents = isSoft($_GET, 'user', 'all');
    $viewingAsStudent = '' == getSoft($_GET, 'user', '');
    $allProblems = $gp == "";
    if (!$viewingAsStudent) {
        if ($allProblems) {
            $problem_html = "all problems";
        } else {
            if ($gp == 'console') {
                $problem_html = "Console";
            } else {
                $problem_html = "<a href='" . $problemsByNumber[$gp]['url'] . "'>" . $problemsByNumber[$gp]['publicname'] . "</a>";
            }
        }
    }
    if (!$allStudents && array_key_exists('user', $_GET) && $_GET['user'] != '') {
        if (!is_numeric($_GET['user'])) {
            return __t("User id must be numeric.");
        }
        $getuid = (int) $_GET['user'];
        if (userIsAdmin() || userIsAssistant()) {
            if (get_userdata($getuid) === FALSE) {
                return __t("Invalid user id.");
            }
        } else {
            if (!in_array($getuid, $students)) {
                return __t("Invalid user id.");
            }
        }
        $uid = $getuid;
        $user = get_userdata($uid);
        echo "<div class='history-prenote'>" . sprintf(__t("Now viewing %s for "), $problem_html) . userString($uid) . '</div>';
    }
    if ($allStudents) {
        echo "<div class='history-prenote'>" . sprintf(__t("Now viewing %s for all of your students"), $problem_html) . "</div>";
    }
    /***************** end of header ***************/
    $flexigrids = "";
    $completed_table = $wpdb->prefix . "pb_completed";
    if ($allStudents && !$allProblems && $gp != "console") {
        $flexigrids .= niceFlex('perstudent', sprintf(__t("Solutions by my students for %s"), $problemsByNumber[$_GET['problem']]['publicname']), 'problem-summary', 'dbProblemSummary', array('p' => $_GET['problem']));
    }
    $dbparams = array();
    if (getSoft($_GET, 'user', '') != '') {
        $dbparams['user'] = $_GET['user'];
    }
    if (getSoft($_GET, 'problem', '') != '') {
        $dbparams['problemhash'] = $_GET['problem'];
    }
    $flexigrids .= niceFlex('submittedcode', $allProblems ? __t("Submitted code") : sprintf(__t("Submitted code for %s"), $_GET['problem'] == 'console' ? 'Console' : $problemsByNumber[$_GET['problem']]['publicname']), 'entire-history', 'dbEntireHistory', $dbparams);
    $recent = "";
    if (!$allStudents) {
        // queries more than 6 in order to fill out progress table of all problems
        $completed = $wpdb->get_results("SELECT * FROM {$completed_table} WHERE userid = {$uid} ORDER BY time DESC", ARRAY_A);
        $recent .= '<div class="recent"><span class="latest-title">' . __t("Latest problems completed") . ":</span>";
        // but for now we only use 6 entries for "most recently completed" section
        for ($i = 0; $i < count($completed) && $i < 6; $i++) {
            $p = getSoft($problemsByNumber, $completed[$i]['problem'], FALSE);
            if ($p !== FALSE) {
                if (getSoft($_GET, 'user', '') != '') {
                    if ($problemsByNumber[$p['slug']]['type'] == 'code') {
                        $url = '.?user='******'user'] . '&problem=' . $p['slug'];
                    } else {
                        $url = null;
                    }
                } else {
                    $url = $p['url'];
                }
                $recent .= ' <a class="open-same-window problem-completed" ';
                if ($url != null) {
                    $recent .= ' href="' . $url . '" ';
                }
                $recent .= ' title="' . $completed[$i]['time'] . '">' . $p['publicname'] . '</a>';
            } else {
                $recent .= '[' . $completed[$i]['problem'] . ']';
            }
        }
        $recent .= '</div>';
    }
    $submissions_table = $wpdb->prefix . "pb_submissions";
    $studentTable = '';
    if ($allStudents && !userIsAdmin()) {
        $studentList = getStudentList();
        $where = "WHERE userid in {$studentList}";
        if (!$allProblems) {
            $where .= $wpdb->prepare("and problem LIKE %s", $gp);
        }
        // show number of problems each student completed
        $scompleted = $wpdb->get_results("SELECT userid, count(1) as comps from {$completed_table} {$where} GROUP BY userid", OBJECT_K);
        // show number of submissions by each student for this problem
        $ssubmissions = $wpdb->get_results("SELECT userid, count(1) as subs from {$submissions_table} {$where} GROUP BY userid", OBJECT_K);
        $studentTable .= '<div class="history-note">Student listing (click name to drill down)</div>';
        $studentTable .= '<table>';
        foreach (getStudents() as $stu) {
            $studentTable .= '<tr>';
            $studentTable .= '<td>';
            $studentTable .= '<a class="open-same-window" href="?user='******'&problem=' . $gp . '">';
            $studentTable .= userString($stu);
            $studentTable .= '</a></td>';
            $studentTable .= '<td>';
            if ($allProblems) {
                $studentTable .= (array_key_exists($stu, $scompleted) ? $scompleted[$stu]->comps : 0) . ' completed';
            } else {
                $studentTable .= '<img src="' . UFILES . (array_key_exists($stu, $scompleted) ? 'checked' : 'icon') . '.png"/>';
            }
            $studentTable .= '</td>';
            $studentTable .= '<td>';
            $studentTable .= (array_key_exists($stu, $ssubmissions) ? $ssubmissions[$stu]->subs : 0) . ' submissions';
            $studentTable .= '</td>';
            $studentTable .= '</tr>';
        }
        $studentTable .= '</table>';
    }
    $lessons_table = $wpdb->prefix . "pb_lessons";
    $lessons = $wpdb->get_results("SELECT * FROM {$lessons_table} WHERE lang = '" . currLang2() . "'", ARRAY_A);
    $lessonsByNumber = array();
    foreach ($lessons as $lrow) {
        $lessonsByNumber[$lrow['ordering']] = $lrow;
    }
    $overview = '';
    if ($allProblems || !$allStudents) {
        $overview = '<h2 style="margin-top:5px;text-align:center">' . __t('List of all problems') . ' ' . ($allStudents ? __t('(with #completed)') : __t('(with #submissions)')) . '</h2>';
        if (!$viewingAsStudent) {
            $overview .= "<div style='text-align:center'>Click on the <img style='height:1em,width:1em' src='" . UFILES . "/icon.png'> to drill down.</div>";
        }
        $checkIt = array();
        //array from slug to boolean, whether to check the icon
        $showNum = array();
        //array from slug to number, number to display beside each
        if ($allStudents) {
            if (userIsAdmin() || userIsAssistant()) {
                $completed = $wpdb->get_results("SELECT count(userid), problem from {$completed_table} GROUP BY problem", ARRAY_A);
            } else {
                $studentList = getStudentList();
                $completed = $wpdb->get_results("SELECT count(userid), problem from {$completed_table} WHERE userid in {$studentList} GROUP BY problem", ARRAY_A);
            }
            foreach ($completed as $crow) {
                $showNum[$crow['problem']] = $crow['count(userid)'];
            }
        } else {
            $submissions = $wpdb->get_results("SELECT count(1), problem from {$submissions_table} WHERE userid = {$uid} GROUP BY problem", ARRAY_A);
            foreach ($submissions as $srow) {
                $showNum[$srow['problem']] = $srow['count(1)'];
            }
            foreach ($completed as $crow) {
                // this was queried earlier
                $checkIt[$crow['problem']] = TRUE;
            }
        }
        $overview .= '<table style="width:auto;border:none;margin:0px auto;">';
        $lesson = -1;
        $lrow = NULL;
        $llink = "";
        $firstloop = true;
        foreach ($problems as $prow) {
            if ($prow['lesson'] != $lesson) {
                if (!$firstloop) {
                    $overview .= "</td></tr>\n";
                }
                $firstloop = false;
                $overview .= "<tr><td class='lessoninfo'>";
                $lesson = $prow['lesson'];
                $lrow = $lessonsByNumber[$lesson];
                $overview .= '<a class="open-same-window" href="';
                $llink = get_page_link($lrow['id']);
                $overview .= $llink;
                $overview .= '">';
                $overview .= $lrow['number'] . ": " . $lrow['title'];
                $overview .= '</a></td><td>';
            }
            if (!$viewingAsStudent) {
                // drill-down link
                $url = '.?user='******'user'] . '&problem=' . $prow['slug'];
            } else {
                $url = $prow['url'];
            }
            $overview .= '<a class="open-same-window" ';
            if ($url != null) {
                $overview .= ' href="' . $url . '" ';
            }
            $overview .= '>';
            $overview .= '<table class="history-tablette" ><tr class="history-tablette-top"><td>';
            $overview .= '<img style="margin:-10px 0px" title="' . $prow['publicname'] . '" src="' . UFILES . (isSoft($checkIt, $prow['slug'], TRUE) ? 'checked' : 'icon') . '.png"/>';
            $overview .= '</a></td></tr><tr class="history-tablette-bottom"><td>';
            /*      $overview .= '<a class="open-same-window" ';
                  if ($url != null) $overview .= ' href="' . $url . '" ';
                  $overview .= '>';*/
            $overview .= array_key_exists($prow['slug'], $showNum) ? $showNum[$prow['slug']] : '&nbsp;';
            $overview .= '</td></tr></table></a>';
        }
        $overview .= '</table>';
    }
    return "<div class='userpage'>{$flexigrids} {$recent} {$studentTable} {$overview}</div>";
}