Exemple #1
0
<?php

define('IN_ECS', true);
require dirname(__FILE__) . '/includes/init.php';
if ($_REQUEST['act'] == 'list') {
    $students = get_students($class_code);
    $smarty->assign("tmp_students", $students);
    //将学生数据每十个一行进行处理
    $stds = array();
    $j = 0;
    for ($i = 0; $i < count($students); $i++) {
        $stds[$j][] = $students[$i];
        if (($i + 1) % 10 == 0) {
            $j++;
        }
    }
    $smarty->assign("students", $stds);
    $duty_items = get_duty_items($class_code);
    $smarty->assign("duty_items", $duty_items);
    $smarty->display('duty_list.htm');
    exit;
} elseif ($_REQUEST['act'] == 'ajax_list') {
    $list = duty_list();
    make_json($list);
} elseif ($_REQUEST['act'] == 'ajax_add') {
    $students = empty($_REQUEST['students']) ? "" : trim($_REQUEST['students']);
    $items = empty($_REQUEST['duty_items']) ? "" : trim($_REQUEST['duty_items']);
    $student_arry = explode(",", $students);
    $item_arry = explode("###SPLIT_V1###", $items);
    $total = 0;
    foreach ($student_arry as $student) {
/**
 * 按考试名称,对成绩进行汇总
 * 学生学号,科目。。。,总分,年级排名,年级进退
 */
function scoreStatistics($class_code, $prj_id)
{
    //获取考试科目
    $subjects = get_subjects($class_code, $prj_id);
    if (count($subjects) < 1) {
        return array();
    }
    //获取考试成绩
    $sql = "select * FROM " . $GLOBALS['ecs']->table("score") . " WHERE class_code='" . $class_code . "' AND prj_id='" . $prj_id . "' ";
    $scores = $GLOBALS['db']->getAll($sql);
    //获取年级排名
    $sql = "select * FROM " . $GLOBALS['ecs']->table("grade_rank") . " WHERE class_code='" . $class_code . "' AND prj_id='" . $prj_id . "' ";
    $grade_rank = $GLOBALS['db']->getAll($sql);
    //获取班级学生
    $students = get_students($class_code);
    foreach ($students as $k => $s) {
        foreach ($scores as $score) {
            if ($score["student_code"] == $s['code']) {
                $students[$k][$score["subject"]] = $score["score"];
                //科目=》成绩
            }
        }
        foreach ($grade_rank as $rank) {
            if ($rank["student_code"] == $s['code']) {
                $students[$k]['grade_rank'] = $rank["grade_rank"];
                //年级排名,年级进退
                $students[$k]['up_down'] = $rank["up_down"];
                //年级排名,年级进退
                break;
            }
        }
    }
    $res = array();
    //学生学号,科目。。。,总分,年级排名,年级进退
    foreach ($students as $s) {
        $res[$s['code']]['student_code'] = $s['code'];
        $res[$s['code']]['student_name'] = $s['name'];
        $total = 0;
        foreach ($subjects as $subject) {
            $hasScore = false;
            foreach ($s as $sub => $score) {
                if ($sub == $subject['subject']) {
                    $res[$s['code']][$sub] = $score;
                    //科目=》成绩
                    $total += $score;
                    $hasScore = true;
                    break;
                }
            }
            if (!$hasScore) {
                $res[$s['code']][$subject["subject"]] = '';
                //科目=》成绩
            }
        }
        $res[$s['code']]['total'] = $total;
        //总分
        $res[$s['code']]['grade_rank'] = $s['grade_rank'];
        //年级排名,年级进退
        $res[$s['code']]['up_down'] = $s['up_down'];
        //年级排名,年级进退
    }
    $res = set_rank($res);
    // 	print_r($res);
    return $res;
}
    die($file);
} elseif ($_REQUEST['act'] == 'template') {
    //考试名称
    $prj_id = empty($_REQUEST['prj_id']) ? '' : trim($_REQUEST['prj_id']);
    //考试名称
    $prj_name = get_exam_prj_name($prj_id);
    $subjects = get_subjects($class_code, $prj_id);
    $content = '您选择的《' . $prj_name . '》还没有进行考试安排!';
    if (count($subjects) > 0) {
        $content = "考试名称,考试名称ID,学号,姓名,";
        //学生学号,科目。。。,年级排名,年级进退
        foreach ($subjects as $v) {
            $content .= $v["subject"] . ',';
        }
        $content .= "年级排名,年级进退\r\n";
        $students = get_students($class_code, 'code');
        foreach ($students as $s) {
            $content .= $prj_name . ',' . $prj_id . ',';
            //考试名称,考试名称
            $content .= $s['code'] . ',' . $s['name'] . ',';
            //学号,姓名
            // 			foreach ($subjects as $subject){
            // 				$content .= ',';//如果没有对应科目的成绩,返回空数据
            // 			}
            // 			$content .= ',';
            $content .= "\r\n";
        }
    }
    $charset = empty($_REQUEST['charset']) ? 'UTF8' : trim($_REQUEST['charset']);
    $file = ecs_iconv(EC_CHARSET, $charset, $content);
    header("Content-Disposition: attachment; filename=《" . $prj_name . "》考试成绩导入模板.csv");
Exemple #4
0
<?php

define('IN_ECS', true);
require dirname(__FILE__) . '/includes/init.php';
// require_once(ROOT_PATH. 'data/jpgraph/jpgraph.php');
// require_once(ROOT_PATH. 'data/jpgraph/jpgraph_line.php');
// require_once(ROOT_PATH. 'data/jpgraph/jpgraph_scatter.php');
// $graph = new Graph(800,600);	//图形大小
//查询条件加载
//班级所有学生
$students = get_students($_SESSION["class_code"]);
// print_r($students);echo '<br>';
//班级所有考试科目
$subjects = get_subjects($_SESSION["class_code"]);
// print_r($subjects);echo '<br>';
// if ($_REQUEST['act'] == 'score_trend')//学生历次考试成绩走势图
// {
// 	$student_code = empty($_REQUEST['search_student_code']) ? '' : trim($_REQUEST['search_student_code']);//学生学号
// 	$subject = empty($_REQUEST['search_subject']) ? '' : trim($_REQUEST['search_subject']);//科目
// 	$list = get_scores_by_exam($class_code, "", "", $student_code, " s.exam_code", $subject);
// 	$student = $list[0]["student_name"];
// 	$title = $student_code."-".$student."同学历次考试成绩走势图";
// 	$X = array();//横轴——历年的考试名称
// 	foreach($list as $k=>$v){
// 		$X[] = $v["exam_name"];
// 	}
// // 	print_r($X);echo '<br>';
// 	$X = array('A','B','C','D');
// 	$graph = score_trend($title, $X);
// }
require_once ROOT_PATH . 'data/jpgraph/jpgraph.php';
function set_params()
{
    global $smarty, $_SESSION;
    //查询条件加载
    //班级所有学生
    $students = get_students($_SESSION["class_code"]);
    $smarty->assign("students", $students);
    //考试名称
    $prjs = get_exam_prjs($_SESSION["class_code"]);
    $smarty->assign("prjs", $prjs);
    //考试科目
    $subjects = get_exam_subjects();
    $smarty->assign("exam_subjects", $subjects);
}
 function cron()
 {
     global $CFG;
     // If the system is disabled, we die right here
     if (empty($CFG->block_student_gradeviewer_enable)) {
         mtrace(get_string('auto_not_enabled', 'block_student_gradeviewer'));
         return true;
     }
     // Get the current time
     $now = time();
     $start_time = explode(" ", microtime());
     $start_time = $start_time[1] + $start_time[0];
     // Get the current semester or semesters
     $current_semester = current_semester($now);
     // There is no semester to work with
     if (!$current_semester) {
         mtrace(get_string('auto_no_semester', 'block_student_gradeviewer'));
         return true;
     }
     // There may be an instance where we're in two semesters
     foreach ($current_semester as $semester) {
         // Is the semester in reporting session?
         // These are admin configurable days
         $in_reporting_session = is_within_timespan($now, $semester);
         // Get valid sections; Valid sections are sections that have been created
         // with a valid idnumber and visiblility is set to 1
         $sections = get_valid_sections($semester);
         if (!$sections) {
             continue;
         }
         $processed = 0;
         foreach ($sections as $section) {
             $processed += 1;
             if ($processed % 100 == 0) {
                 mtrace("Processing {$processed} sections");
             }
             // Determine if the student is doing poorly
             $lagging_algorithm = new lagging_algorithm($section);
             $failing_algorithm = new failing_algorithm($section);
             // Skip section, if either algorithm hasn't loaded
             if (!$lagging_algorithm->loaded) {
                 continue;
             }
             // Get all the students for the sections
             $students = get_students($section);
             if (!$students) {
                 continue;
             }
             $primary = get_primary($section);
             foreach ($students as $student) {
                 $lagging = $lagging_algorithm->process($student);
                 $failing = $failing_algorithm->process($student);
                 // Source is automatic unless otherwise defined
                 $source = AUTOMATIC_REFERRAL_SOURCE;
                 // Surprise! the student is actually doing above the rest
                 if ($lagging == EXCEPTIONAL and !$failing) {
                     // Source is praise
                     $source = POSITIVE_REFERRAL_SOURCE;
                     $message = get_string('auto_praise', 'block_student_gradeviewer');
                 } else {
                     if ($failing and $lagging == LAGGING) {
                         $message = get_string('auto_failing_lagging', 'block_student_gradeviewer');
                     } else {
                         if ($failing) {
                             $message = get_string('auto_failing', 'block_student_gradeviewer');
                         } else {
                             if ($lagging == LAGGING) {
                                 $message = get_string('auto_lagging', 'block_student_gradeviewer');
                             }
                         }
                     }
                 }
                 // log this student referral
                 if (!empty($message)) {
                     $referral = new stdClass();
                     $referral->usersid = $student->id;
                     $referral->sectionsid = $section->id;
                     $referral->referrerid = $primary->id;
                     $referral->reason = $message;
                     $referral->date_referred = $now;
                     $referral->semestersid = $semester->id;
                     $referral->source = $source;
                     insert_record('block_student_referrals', $referral);
                 }
                 // reset our message variable
                 $message = "";
             }
         }
         // Finished processing all the sections in the semester
         mtrace("Finished processing {$processed} sections in " . get_string('format_semester', 'block_student_gradeviewer', $semester));
         // After we finish processing the primary, we're done with that teacher
         // we can now submit the first of the email digest, if they want
         if (!empty($CFG->cas_email)) {
             $instructors = get_moodle_instructors($semester);
             foreach ($instructors as $instructor) {
                 $digestable_sections = get_digestable_sections($instructor, $semester);
                 // If the instructor has disabled reporting for himself, then don't worry about
                 // even trying to report
                 if (empty($digestable_sections)) {
                     continue;
                 }
                 report_to($instructor, $now, $semester, 'with_instructor', 'format_referrals', $digestable_sections);
             }
         }
         // We have finished reporting for primaries, now we report to subsystems
         // We report by enabled reporting in the admin screens
         foreach (array('cas', 'acsa') as $subsystem) {
             if (!empty($CFG->{$subsystem . '_email'})) {
                 $mentors = get_mentors($subsystem);
                 foreach ($mentors as $mentor) {
                     report_to($mentor, $now, $semester, 'with_mentor', 'format_referrals', $subsystem);
                 }
                 // Get separate referred students
                 $student_function = "get_{$subsystem}_students";
                 $students = $student_function($now);
                 foreach ($students as $student) {
                     $digestable_sections = get_all_student_sections($student, $semester);
                     // If they do not have any digestable sections, then skip
                     if (empty($digestable_sections)) {
                         continue;
                     }
                     $referrals = with_student($student, $now, $digestable_sections);
                     foreach ($referrals as $referral) {
                         if ($in_reporting_session or !student_was_referred($student, $referral->sectionsid)) {
                             // If in session or the student has never been referrred before
                             notify_student($student, $referral);
                         }
                     }
                     // If student feedback is disabled, then don't worry about feedback
                     if (empty($CFG->block_student_gradeviewer_student_feedback)) {
                         continue;
                     }
                     $yesterday_referrals = with_student($student, $now - DAY_IN_SECONDS, $digestable_sections, 4);
                     $no_longer_referred = no_longer_referred($yesterday_referrals, $referrals);
                     // They are no longer referred in these sections
                     foreach ($no_longer_referred as $referral) {
                         $recovered = true;
                         notify_student($student, $referral, $recovered);
                     }
                 }
                 // The above work does count for students who were referred a previous
                 // run, but no longer referred. We want these too.
                 if (!empty($CFG->block_student_gradeviewer_student_feedback)) {
                     $yesterdays_students = $student_function($now - DAY_IN_SECONDS, 4);
                     // Gets all students who were referred yesterday and no longer, today
                     $students_no_longer_referred = no_longer_referred($yesterdays_students, $students, 'student_comp');
                     foreach ($students_no_longer_referred as $student) {
                         // Still adhere to notifications
                         $digestable_sections = get_all_student_sections($student, $semester);
                         if (empty($digestable_sections)) {
                             continue;
                         }
                         // Get yesterdays referral for this student
                         $yesterdays_referrals = with_student($student, $now - DAY_IN_SECONDS, $digestable_sections, 4);
                         foreach ($yesterdays_referrals as $referral) {
                             $recovered = true;
                             notify_student($student, $referral, $recovered);
                         }
                     }
                 }
                 $admins = get_early_warning_admins($subsystem);
                 report_to($admins, $now, $semester, "with_{$subsystem}_admin", "format_referrals");
             }
         }
     }
     $end_time = explode(" ", microtime());
     $end_time = $end_time[1] + $end_time[0];
     $a->time = $end_time - $start_time;
     mtrace(get_string('auto_elapsed', 'block_student_gradeviewer', $a));
     return true;
     // Finished the automatic referral process
 }
Exemple #7
0
     print "Done.  <a href=\"attendance.php?add\" title=\"add another\">Add another</a>?";
 } elseif (user_type() == "teacher") {
     if (!isset($_POST['selectabsences']) or $_POST['selectabsences'] == "" or is_numeric($_POST['selectabsences']) == FALSE) {
         cust_die("You must submit the student who is absent.");
     }
     $absent_student = escape_string(htmlspecialchars($_POST['selectabsences']));
     // see if the teacher teachers the user
     connect_sql();
     $teacher_id = $_SESSION['id'];
     $student_list = "";
     // get the teacher's classes
     $classes = @query("SELECT `ID` FROM `classes` WHERE `teacher`='{$teacher_id}'") or die("Error getting the class list from the database.");
     while ($row = result($classes)) {
         // get the students in those classes..
         if (get_students($row->ID) != "") {
             $student_list .= get_students($row->ID) . ",";
         }
     }
     // remove the last comma
     $student_list = substr($student_list, 0, strlen($student_list) - 1);
     $students = explode(",", $student_list);
     if (!in_array($absent_student, $students)) {
         cust_die("You are not allowed to mark that student absent because you do not teach him or her.");
     }
     // okay, they're allowed to mark the student absent...
     // get the timestamp; it's used to see if the user has already been added for the day, and adding 'em if they haven't been
     $timestamp = time();
     // has the user been added?
     $latest_absence = @query("SELECT `timestamp` FROM `absences` WHERE `user_ID`='{$absent_student}' ORDER BY `timestamp` DESC LIMIT 1") or die("Error checking the database.");
     if (num_rows($latest_absence) != 0) {
         while ($row = result($latest_absence)) {
Exemple #8
0
 function reduce_section($in, $section)
 {
     global $CFG;
     list($section, $id) = explode('_', $section);
     $a->id = $id;
     $rtn = get_students($a);
     $inter = empty($in) ? array() : $in;
     return array_merge($inter, $rtn ? $rtn : array());
 }
Exemple #9
0
        ?>
" class="ok" /></td>
              </tr>

            </table>
          </div>
        <?php 
        if (in_array('invigilators', $configObject->get('midexam_clarification'))) {
            echo "<div id=\"clarifymsgtbl\" class=\" cohortlist\" style=\"float:left; width:50%\"><table cellpadding=\"2\" cellspacing=\"0\" style=\"width:100%; line-height:150%\">\n<tr><th>" . $string['midexamclarifications'] . "</th></tr>\n</table>\n";
            echo "<div id=\"msg{$property_id}\" class=\"clarifymsg\"><span class=\"blankclarification\">" . $string['examquestionclarifications'] . "</span></div>\n</div>\n";
            echo '<div id="store_' . $property_id . '" style="display: none;"></div>';
        }
        $modules = implode('\',\'', $modules);
        $modules = '\'' . $modules . '\'';
        echo "<div class=\"cohortlist\" id=\"cohortlist_" . $property_id . "\">\n";
        get_students($modules, $property_object, $log_lab_end_time, $allow_timing, $string, $mysqli);
        echo "</div>\n";
        ?>
      </div>
    <?php 
    }
    ?>

    <div id="checklist" class="tab-area" style="padding: 30px 100px 0px 100px;">
      <div class="preexam">
        <h1><?php 
    echo $string['preexam'];
    ?>
</h1>
        <?php 
    echo $string['preexamlist'];
Exemple #10
0
function student_map_total($school_id, $exam_id, $class_id, $section_id)
{
    $students = array();
    $students = get_students($school_id, $class_id, $section_id);
    $student_map_tot = array();
    foreach ($students as $student_id => $student_name) {
        $student_map_tot["{$student_id}"] = get_tot_mark($school_id, $exam_id, $student_id);
    }
    return $student_map_tot;
}
Exemple #11
0
     while ($name = result($the_name)) {
         print "<td>{$name->assign_name}</td>";
     }
 }
 print "</tr>\n<tr class=\"spreadinformation\"><td>Points Possible";
 // get the points the assignment is worth
 foreach ($assignments_to_use as $assignment) {
     $points_possible = @query("SELECT `points_possible` FROM `grades` WHERE `assign_number`='{$assignment}' LIMIT 1");
     while ($points = result($points_possible)) {
         print "<td>{$points->points_possible}</td>";
     }
 }
 print "</tr>";
 $tdcolour = 0;
 // get the students that attend the class
 $students = explode(",", get_students($class_id));
 foreach ($students as $student) {
     // get user's name
     $student_name2 = @query("SELECT `firstname`, `surname` FROM `users` WHERE `ID`='{$student}'") or die("Error getting information from the database.");
     while ($row = result($student_name2)) {
         $student_name = stripslashes($row->firstname) . " " . stripslashes($row->surname);
         $info = @query("SELECT `studentID` FROM `students` WHERE `ID`='{$student}' LIMIT 1") or die("Error checking the database.");
         while ($row2 = result($info)) {
             print "<tr class=\"tdcolour{$tdcolour}\"><td>{$student_name}</td>";
             // get his or her assignments and print them
             $assignments = @query("SELECT * FROM `grades` WHERE `class_id`='{$class_id}' AND `grading_period`='{$grading_period}' AND `student_ID`='{$student}'");
             while ($row3 = result($assignments)) {
                 print "<td>{$row3->points_scored}</td>";
             }
             print "</tr>";
         }
Exemple #12
0
/* 
 * Sameer Jain
 * sameejain@my.smccd.edu
 * CIS 380
 * OL
 * final
 * Sameer Jain
 * 12/18/15
 */
require '../model/database.php';
require '../model/product_db.php';
$student_id = filter_input(INPUT_POST, 'student_id');
$score = filter_input(INPUT_POST, 'score');
$event_id = filter_input(INPUT_POST, 'event_id');
$students = get_students();
$events = get_grades();
$event_counter = 0;
$student_counter = 0;
foreach ($events as $event) {
    if (in_array($event_id, $event)) {
        $event_counter++;
    }
}
foreach ($students as $student) {
    if (in_array($student_id, $student)) {
        $student_counter++;
    }
}
if ($student_id == NULL || $event_id == NULL || $score == NULL || $student_counter == 0 || $event_counter == 0) {
    $error = "Invalid product data. Check all fields and try again.";
Exemple #13
0
        $sections = $user->getSectionsForMoodleCourse($course);
    } else {
        echo '<span class="error">' . get_string('no_permission', 'block_student_gradeviewer') . '</span>';
        print_footer();
        die;
    }
}
echo '<form method="POST" action="report.php">
        <div class="report_wrap">';
// Grab the course item
$course_item = grade_item::fetch_course_item($courseid);
unset($where['section']);
$printed = false;
// For each section, grab the students for each sections
foreach ($sections as $id => $section) {
    $students = get_students($section, $where);
    // No students means skip this section
    if (!$students) {
        continue;
    }
    $printed = true;
    $referrals = get_referred_students($section);
    $name = get_string('format_section', 'block_courseprefs', $section);
    echo '<h2 class="section_header">' . print_checkbox('section_' . $section->id, 1, false, '', '', '', true) . $name . '</h2>
            <ul id="section_' . $section->id . '" class="student_list">';
    foreach ($students as $usersid => $student) {
        $images = array_reduce(array_map('print_source', array_filter($referrals, create_function('$referral', '
                                return $referral->usersid == ' . $usersid . ';
                            '))), 'reduce_source');
        $grade = new grade_grade(array('userid' => $student->moodleid, 'itemid' => $course_item->id));
        echo '<li>';
echo $user->firstname . ' ' . $user->lastname;
?>
</p>
<p class="printonly"><?php 
echo date('jS F Y', $now);
?>
</p>
<?php 
if (!array_key_exists('home', $_GET)) {
    echo '<p class="noprint"><a href="javascript:history.go(-1)">' . get_string('back', 'block_progress') . '</a></p>';
}
?>
<p class="noprint"><?php 
echo generate_group_links($course->id, 'summary_course.php');
?>
</p>
<?php 
if (array_key_exists('group', $_GET)) {
    $students = get_students($course->id, $_GET['prefix'], $_GET['group']);
} else {
    $students = get_students($course->id, $_GET['prefix']);
}
echo display_grid($CFG->prefix, $course->id, $students, $criteria);
echo display_key($CFG->prefix, $course->id, $criteria);
?>
<p class="noprint footer"><a href="#" onClick="window.print();return false"><?php 
print_string('print', 'block_progress');
?>
</a></p>
</body>
</html>
Exemple #15
0
            if ($student_id != "") {
                $the_studentID = @query("SELECT `studentID` FROM `students` WHERE `ID`='{$student_id}'") or die("Error checking the database.");
                while ($result = result($the_studentID)) {
                    $studentID = $result->studentID;
                }
                $name2 = @query("SELECT `firstname`, `surname` FROM `users` WHERE `ID`='{$student_id}'") or die("Error checking the database.");
                while ($row = result($name2)) {
                    $name = stripslashes($row->firstname) . " " . stripslashes($row->surname);
                    print "<tr><td><a href=\"messages.php?compose&amp;id={$student_id}\" title=\"send a message to {$name}\">{$name}</a></td><td>" . class_average($student_id, $class_id, current_semester) . "</td></tr>\n";
                }
            }
        }
        print "</table></span>\n";
        print "<span id=\"idspan\" style=\"display: none; \"><table id=\"idtable\">\n";
        print "<tr><th>ID</th><th>average</th></tr>\n";
        $students = get_students($class_id);
        $student = explode(",", $students);
        foreach ($student as $student_id) {
            if ($student_id != "") {
                $the_studentID = @query("SELECT `studentID` FROM `students` WHERE `ID`='{$student_id}'") or die("Error checking the database.");
                while ($result = result($the_studentID)) {
                    $studentID = $result->studentID;
                    print "<tr><td>{$studentID}</td><td>" . class_average($student_id, $class_id, current_semester) . "</td></tr>\n";
                }
            }
        }
        print "</table></span>\n";
        print "<div id=\"printlink\"><hr /><a href=\"javascript:window.print()\" title=\"print this page\">print</a></div>";
    }
} elseif (isset($_GET['class'])) {
    if (user_type() == "user") {
Exemple #16
0
<!--
    MD.OWES QURUNY SHUBHO
    http://shubho.info
-->
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <?php 
// Declare a simple function to return an
// array from our object
function get_students($obj)
{
    if (!is_object($obj)) {
        return false;
    }
    return $obj->students;
}
// Declare a new class instance and fill up
// some values
$obj = new stdClass();
$obj->students = array('Kalle', 'Ross', 'Felipe');
var_dump(get_students(null));
echo "</br>";
var_dump(get_students($obj));
?>
    </body>
</html>