Beispiel #1
0
function report_show_table($course, $students, $course_sess, $classes, $settings, $url_options, $name_pattern, $order)
{
    global $DB, $CFG, $OUTPUT, $wwwBlock;
    $table = new html_table();
    $i = 0;
    foreach ($students as $student) {
        $i++;
        $pic_options = array('size' => 20, 'link' => true, 'alttext' => true, 'courseid' => $course->id, 'popup' => true);
        $username = jbxl_get_user_name($student->id, $name_pattern);
        $table->data[$student->id][] = $OUTPUT->user_picture($student->user, $pic_options);
        $table->data[$student->id][] = '<a href="' . $wwwBlock . '/index.php?course=' . $course->id . '&amp;student=' . $student->id . '" target="_blank">' . $username . '</a>';
        if ($CFG->output_idnumber) {
            if (empty($student->idnumber)) {
                $table->data[$student->id][] = '-';
            } else {
                $table->data[$student->id][] = $student->idnumber;
            }
        }
        $user_summary = autoattend_get_user_summary($student->id, $course->id);
        if ($classes) {
            $table->data[$student->id][] = $user_summary['classname'];
        }
        $table->data[$student->id][] = $user_summary['grade'];
        $table->data[$student->id][] = $user_summary['percent'] . '%';
        $table->data[$student->id][] = $user_summary['P'];
        $table->data[$student->id][] = $user_summary['L'];
        $table->data[$student->id][] = $user_summary['E'];
        $table->data[$student->id][] = $user_summary['X'];
        $table->data[$student->id][] = $user_summary['Y'];
        $j = 0;
        foreach ($course_sess as $sessdata) {
            if ($j > 0 and $j % PAGE_COLUMN_SIZE == 0) {
                $table->data[$student->id][] = '<a href="' . $wwwBlock . '/index.php?course=' . $course->id . '&amp;student=' . $student->id . '" target="_blank">' . $username . '</a>';
            }
            //
            $j++;
            $att = $DB->get_record('autoattend_students', array('attsid' => $sessdata->id, 'studentid' => $student->id));
            if ($att and ($sessdata->classid == $student->classid or $sessdata->classid == 0)) {
                $table->data[$student->id][] = $settings[$att->status]->acronym;
            } else {
                $table->data[$student->id][] = get_string('novalue', 'block_autoattend');
            }
        }
        //
        if ($i % PAGE_ROW_SIZE == 0) {
            report_make_header($table, $course_sess, $classes, $settings, $url_options, $name_pattern, $order);
            echo '<div align="center" style="overflow-x: auto;">';
            echo html_writer::table($table);
            echo '</div><br /><br />';
            unset($table->data);
        }
    }
    if ($i % PAGE_ROW_SIZE != 0 or $i == 0) {
        report_make_header($table, $course_sess, $classes, $settings, $url_options, $name_pattern, $order);
        echo '<div align="center" style="overflow-x: auto;">';
        echo html_writer::table($table);
        echo '</div><br /><br />';
    }
    return;
}
function updateAttendance_show_table($course, $students, $sessdata, $settings, $attsid, $attend, $classid, $name_pattern, $order, $isteacher)
{
    global $CFG, $DB, $OUTPUT, $wwwBlock, $TIME_OFFSET;
    $url_options = '?course=' . $course->id . '&amp;class=' . $classid . '&amp;attend=' . $attend . '&amp;attsid=' . $attsid;
    $sessndate = strftime(get_string('strftimedmshort', 'block_autoattend'), $sessdata->sessdate + $TIME_OFFSET);
    $table = new html_table();
    $i = 0;
    foreach ($students as $student) {
        $classinfo = autoattend_get_user_class($student->id, $course->id, true);
        // ID Only
        if ($classinfo->classid == $classid or $classid == 0 or $classid == NON_CLASSID and $classinfo->classid == 0) {
            //
            $att = $DB->get_record('autoattend_students', array('attsid' => $attsid, 'studentid' => $student->id));
            if ($att) {
                $status = $att->status;
                $called = $att->called;
            } else {
                $status = 'Y';
                $called = 'D';
            }
            if ($attend == 'A' or $attend == 'Z' and ($status == 'X' or $status == 'Y') or $attend == $status) {
                $i++;
                $table->data[$student->id][] = $i;
                $pic_options = array('size' => 20, 'link' => true, 'alttext' => true, 'courseid' => $course->id, 'popup' => true);
                $username = jbxl_get_user_name($student->id, $name_pattern);
                $table->data[$student->id][] = $OUTPUT->user_picture($student->user, $pic_options);
                $table->data[$student->id][] = '<a href="' . $wwwBlock . '/index.php?course=' . $course->id . '&amp;student=' . $student->id . '" target="_blank">' . $username . '</a>';
                if ($CFG->output_idnumber) {
                    if (empty($student->idnumber)) {
                        $table->data[$student->id][] = '-';
                    } else {
                        $table->data[$student->id][] = $student->idnumber;
                    }
                }
                $table->data[$student->id][] = $student->classname;
                foreach ($settings as $set) {
                    $checked = $set->status == $status ? 'checked' : '';
                    $table->data[$student->id][] = '<input name="statusid' . $student->id . '" ' . 'type="radio"  value="' . $set->status . '" ' . $checked . ' />';
                }
                $table->data[$student->id][] = get_string($called . 'methodfull', 'block_autoattend');
                //
                if (!$att or $att->status === 'X' or $att->status === 'Y') {
                    $table->data[$student->id][] = get_string('novalue', 'block_autoattend');
                } else {
                    $calleddate = strftime(get_string('strftimedmshort', 'block_autoattend'), $att->calledtime + $TIME_OFFSET);
                    $calledtime = strftime(get_string('strftimehmshort', 'block_autoattend'), $att->calledtime + $TIME_OFFSET);
                    if ($sessndate === $calleddate) {
                        $table->data[$student->id][] = $calledtime;
                    } else {
                        $table->data[$student->id][] = $calledtime . '&nbsp;(' . $calleddate . ')';
                    }
                }
                //
                if ($att) {
                    $ipaddr = $att->ipaddress ? $att->ipaddress : get_string('novalue', 'block_autoattend');
                    $ipurl = autoattend_get_ipresolv_url($ipaddr);
                    if ($ipurl) {
                        $table->data[$student->id][] = "<a href={$ipurl} target=_blank>{$ipaddr}</a>";
                    } else {
                        $table->data[$student->id][] = $ipaddr;
                    }
                } else {
                    $table->data[$student->id][] = get_string('novalue', 'block_autoattend');
                }
                //
                $remarks = $att ? $att->remarks : '';
                $input = '<input type="text"   name="remarks' . $student->id . '" size="20" maxlength="40" value="' . $remarks . '" />';
                $prvvl1 = '<input type="hidden" name="prvstatusid' . $student->id . '" value="' . $status . '" />';
                $prvvl2 = '<input type="hidden" name="prvremarks' . $student->id . '" value="' . $remarks . '" />';
                $table->data[$student->id][] = $input . $prvvl1 . $prvvl2;
                //
                if ($i % PAGE_ROW_SIZE == 0) {
                    updateAttendance_make_header($table, $settings, $url_options, $i - PAGE_ROW_SIZE, $i, $name_pattern, $order);
                    echo '<div align="center" style="overflow-x: auto;">';
                    // スクロールしません
                    echo html_writer::table($table);
                    echo '<div align="center">';
                    updateAttendance_show_button($isteacher);
                    echo '</div>';
                    echo '</div><br />';
                    unset($table->data);
                }
            }
        }
    }
    //
    if ($i % PAGE_ROW_SIZE != 0 or $i == 0) {
        updateAttendance_make_header($table, $settings, $url_options, $i - $i % PAGE_ROW_SIZE, $i, $name_pattern, $order);
        echo '<div align="center" style="overflow-x: auto;">';
        echo html_writer::table($table);
        echo '<div align="center">';
        updateAttendance_show_button($isteacher);
        echo '</div>';
        echo '</div>';
    }
    return;
}
Beispiel #3
0
function autoattend_print_user($user, $course, $printing = null)
{
    global $DB, $CFG, $USER, $OUTPUT, $TIME_OFFSET;
    $wwwBlock = $CFG->wwwroot . '/blocks/autoattend';
    $wwwGrade = $CFG->wwwroot . '/grade/report/user';
    $wwwReport = $CFG->wwwroot . '/report/log';
    $wwwMesg = $CFG->wwwroot . '/message';
    $wwwUser = $CFG->wwwroot . '/user';
    if (!is_object($course)) {
        $course = $DB->get_record('course', array('id' => $course));
    }
    $courseid = $course->id;
    $userid = $user->id;
    $context = jbxl_get_course_context($courseid);
    $isteacher = jbxl_is_teacher($USER->id, $context);
    $summary = autoattend_get_user_summary($user->id, $courseid);
    if (!$summary) {
        notice(get_string('attendnotstarted', 'block_autoattend'), $CFG->wwwroot . '/course/view.php?id=' . $courseid);
    } else {
        $complete = $summary['complete'];
        $percent = $summary['percent'] . ' %';
        $grade = $summary['grade'];
        $maxgrade = $summary['maxgrade'];
        $settings = $summary['settings'];
        $classid = $summary['classid'];
        $classname = $summary['classname'];
        //
        if ($CFG->output_idnumber) {
            if (empty($user->idnumber)) {
                $user_idnum = ' - ';
            } else {
                $user_idnum = $user->idnumber;
            }
            $disp_idnum = '[' . $user_idnum . ']';
        } else {
            $user_idnum = '';
            $disp_idnum = '';
        }
        //
        $name_pattern = autoattend_get_namepattern($courseid);
        $username = jbxl_get_user_name($user->id, $name_pattern);
        include 'html/print_user_header.html';
        //
        if ($classid >= 0) {
            // !出欠から除外
            //
            $table = new html_table();
            // Header
            $table->head[] = '#';
            $table->align[] = 'right';
            $table->size[] = '20px';
            $table->wrap[] = 'nowrap';
            $table->head[] = get_string('date');
            $table->align[] = 'center';
            $table->size[] = '40px';
            $table->wrap[] = 'nowrap';
            $table->head[] = get_string('starttime', 'block_autoattend');
            $table->align[] = 'center';
            $table->size[] = '60px';
            $table->wrap[] = 'nowrap';
            $table->head[] = get_string('endtime', 'block_autoattend');
            $table->align[] = 'center';
            $table->size[] = '60px';
            $table->wrap[] = 'nowrap';
            $table->head[] = get_string('classname', 'block_autoattend');
            $table->align[] = 'center';
            $table->size[] = '40px';
            $table->wrap[] = 'nowrap';
            $table->head[] = get_string('description', 'block_autoattend');
            $table->align[] = 'left';
            $table->size[] = '40px';
            $table->wrap[] = 'nowrap';
            $table->head[] = get_string('status', 'block_autoattend');
            $table->align[] = 'center';
            $table->size[] = '40px';
            $table->wrap[] = 'nowrap';
            $table->head[] = get_string('callmethod', 'block_autoattend');
            $table->align[] = 'center';
            $table->size[] = '60px';
            $table->wrap[] = 'nowrap';
            $table->head[] = get_string('calledtime', 'block_autoattend');
            $table->align[] = 'center';
            $table->size[] = '60px';
            $table->wrap[] = 'nowrap';
            $table->head[] = get_string('ip', 'block_autoattend');
            $table->align[] = 'center';
            $table->size[] = '80px';
            $table->wrap[] = 'nowrap';
            $table->head[] = get_string('remarks', 'block_autoattend');
            $table->align[] = 'center';
            $table->size[] = '120px';
            $table->wrap[] = 'nowrap';
            $i = 0;
            foreach ($summary['attitems'] as $att) {
                if ($att->classid == $classid or $att->classid == 0) {
                    $table->data[$i][] = $i + 1;
                    $table->data[$i][] = strftime(get_string('strftimedmyw', 'block_autoattend'), $att->sessdate + $TIME_OFFSET);
                    $table->data[$i][] = strftime(get_string('strftimehourmin', 'block_autoattend'), $att->starttime + $TIME_OFFSET);
                    $table->data[$i][] = strftime(get_string('strftimehourmin', 'block_autoattend'), $att->endtime + $TIME_OFFSET);
                    $table->data[$i][] = autoattend_get_user_classname($att->classid);
                    $table->data[$i][] = $att->description ? $att->description : get_string('nodescription', 'block_autoattend');
                    if ($att->studentid) {
                        if ($att->status == 'Y') {
                            if (time() > $att->endtime) {
                                $table->data[$i][] = $settings['X']->acronym;
                            } else {
                                $table->data[$i][] = get_string('novalue', 'block_autoattend');
                            }
                        } else {
                            $table->data[$i][] = $settings[$att->status]->acronym;
                        }
                        $table->data[$i][] = get_string($att->called . 'methodfull', 'block_autoattend');
                    } else {
                        $table->data[$i][] = get_string('novalue', 'block_autoattend');
                        $table->data[$i][] = get_string('novalue', 'block_autoattend');
                    }
                    //
                    if (!$att->studentid or $att->status === 'X' or $att->status === 'Y') {
                        $table->data[$i][] = get_string('novalue', 'block_autoattend');
                    } else {
                        $sessndate = strftime(get_string('strftimedmshort', 'block_autoattend'), $att->sessdate + $TIME_OFFSET);
                        $calleddate = strftime(get_string('strftimedmshort', 'block_autoattend'), $att->calledtime + $TIME_OFFSET);
                        $calledtime = strftime(get_string('strftimehmshort', 'block_autoattend'), $att->calledtime + $TIME_OFFSET);
                        //$table->data[$i][] = strftime(get_string('strftimecalled', 'block_autoattend'), $att->calledtime + $TIME_OFFSET);
                        if ($sessndate === $calleddate) {
                            //$table->data[$i][] = '<div align="left">'.$calledtime.'</div>';
                            $table->data[$i][] = $calledtime;
                        } else {
                            //$table->data[$i][] = '<div align="left">'.$calledtime.'&nbsp;('.$calleddate.')</div>';
                            $table->data[$i][] = $calledtime . '&nbsp;(' . $calleddate . ')';
                        }
                    }
                    //
                    $ipaddr = $att->ipaddress ? $att->ipaddress : get_string('novalue', 'block_autoattend');
                    if ($ipaddr) {
                        //$ipurl  = jbxl_get_ipresolv_url($ipaddr);
                        $ipurl = autoattend_get_ipresolv_url($ipaddr);
                        if ($ipurl) {
                            $table->data[$i][] = "<a href={$ipurl} target=_blank>{$ipaddr}</a>";
                        } else {
                            $table->data[$i][] = $ipaddr;
                        }
                    } else {
                        $table->data[$i][] = get_string('novalue', 'block_autoattend');
                    }
                    $table->data[$i][] = $att->remarks;
                    $i++;
                }
            }
            echo '<div align="left">';
            echo html_writer::table($table);
            echo '</div>';
        }
        //
        echo '</td>';
        echo '</tr>';
        echo '</table>';
        echo '</div>';
    }
    return;
}
Beispiel #4
0
$settings = $summary['settings'];
$useratt = '';
foreach ($settings as $set) {
    $desc = get_string($set->status . 'desc', 'block_autoattend');
    $useratt .= $desc . ': <strong>' . $summary[$set->status] . '</strong>' . '&nbsp;&nbsp;';
}
$percent = sprintf('%0.1f', $summary['percent']) . ' %';
$grade = $summary['grade'];
$maxgrade = $summary['maxgrade'];
//
//$currenttab = 'attendance';
//include('tabs.php');
//
// Display Attendance Table
if ($attitems) {
    $disp_id = '';
    if ($CFG->output_idnumber) {
        if (empty($user->idnumber)) {
            $disp_id = '&nbsp;[ - ]';
        } else {
            $disp_id = '&nbsp;[' . $user->idnumber . ']';
        }
    }
    $name_pattern = autoattend_get_namepattern($course->id);
    $username = jbxl_get_user_name($user, $name_pattern);
    $pic_opts = array('size' => 30, 'link' => true, 'alttext' => true, 'courseid' => $course->id, 'popup' => true);
    include 'html/updateUser.html';
} else {
    echo $OUTPUT->heading(get_string('nothingtodisplay'));
}
echo $OUTPUT->footer($course);
 function jbxl_get_user_link($user, $pattern = 'fullname', $target = '')
 {
     global $DB, $CFG;
     if (!is_object($user)) {
         $user = $DB->get_record('user', array('id' => $user));
     }
     if (!$user) {
         return '';
     }
     if (!empty($target)) {
         $target = 'target="' . $target . '"';
     }
     $user_name = jbxl_get_user_name($user, $pattern);
     $link = '<a href=' . $CFG->wwwroot . '/user/view.php?id=' . $user->id . ' ' . $target . ' >' . $user_name . '</a>';
     return $link;
 }
Beispiel #6
0
function class_division_show_table($students, $courseid, $classid, $name_pattern, $order, $classes, $newclassid)
{
    global $CFG, $wwwBlock, $OUTPUT;
    $url_options = '?course=' . $courseid . '&amp;class=' . $classid;
    //
    if (empty($order) or $order == 'ASC') {
        $order = 'DESC';
    } else {
        $order = 'ASC';
    }
    //
    $table = new html_table();
    $i = 0;
    $n = 0;
    foreach ($students as $student) {
        $classinfo = autoattend_get_user_class($student->id, $courseid);
        if ($classinfo->classid == $classid or $classid == 0 or $classid == NON_CLASSID and $classinfo->classid == 0 or $classid == VALID_CLASSID and $classinfo->classid >= 0) {
            $i++;
            $table->data[$student->id][] = $i;
            $username = jbxl_get_user_name($student->id, $name_pattern);
            $pic_options = array('size' => 20, 'link' => true, 'alttext' => true, 'courseid' => $courseid, 'popup' => true);
            $table->data[$student->id][] = $OUTPUT->user_picture($student, $pic_options);
            $table->data[$student->id][] = '<a href="' . $wwwBlock . '/index.php?course=' . $courseid . '&amp;student=' . $student->id . '" target="_blank">' . $username . '</a>';
            if ($CFG->output_idnumber) {
                if (empty($student->idnumber)) {
                    $idnum = ' - ';
                } else {
                    $idnum = $student->idnumber;
                }
                $table->data[$student->id][] = $idnum;
            }
            $table->data[$student->id][] = $classinfo->name;
            $table->data[$student->id][] = '<input type="checkbox" name="changeclass' . $student->id . '" value="1" />';
            //
            if ($i % PAGE_ROW_SIZE == 0) {
                echo '<div align="center">';
                class_division_make_header($table, $url_options, $i - PAGE_ROW_SIZE, $i, $name_pattern, $order);
                echo html_writer::table($table);
                class_division_submit_button($classes, $newclassid, $n);
                $n++;
                echo '</div><br />';
                //echo '</div>';
                unset($table->data);
            }
        }
    }
    if ($i % PAGE_ROW_SIZE != 0 or $i == 0) {
        echo '<div align="center">';
        class_division_make_header($table, $url_options, $i - $i % PAGE_ROW_SIZE, $i, $name_pattern, $order);
        echo html_writer::table($table);
        class_division_submit_button($classes, $newclassid, $n);
        echo '</div>';
    }
    return;
}