コード例 #1
0
ファイル: favourite.php プロジェクト: nikosv/openeclass
                        GROUP BY module_id", $terms, $course_id);
        foreach ($result as $row) {
            $mid = $row->module_id;
            if ($mid == MODULE_ID_UNITS) { // course inits
                $chart->growWithPoint($langCourseUnits, $row->tot_dur);
            } else { // other modules
                $chart->growWithPoint($modules[$mid]['title'], $row->tot_dur);
            }
        }
        $chart_error = $langDurationExpl;
        break;
}

if (isset($_POST['btnUsage'])) {
    $chart->normalize();
    $tool_content .= $chart->plot($chart_error);
}

$letterlinks = '';
$result = Database::get()->queryArray("SELECT LEFT(a.surname, 1) AS first_letter
        FROM user AS a LEFT JOIN course_user AS b ON a.id = b.user_id
        WHERE b.course_id = ?d
        GROUP BY first_letter ORDER BY first_letter", $course_id);
foreach ($result as $row) {
    $first_letter = $row->first_letter;
    $letterlinks .= '<a href="?course=' . $course_code . '&amp;first=' . urlencode($first_letter) . '">' . q($first_letter) . '</a> ';
}

$user_opts = '<option value="-1">' . $langAllUsers . "</option>";
$user_opts .= '<option value="0">' . $langAnonymous . "</option>";
コード例 #2
0
            }
            break;
        case "monthly":
            foreach ($result as $$row) {
                $chart->growWithPoint($langMonths[$row->month], $row->cnt);
            }
            break;
        case "yearly":
            foreach ($result as $$row) {
                $chart->growWithPoint($row->year, $row->cnt);
            }
            break;
    }
}

$tool_content .= $chart->plot($langNoStatistics);

/* * ***********************************************************************
  Form for determining time period, time interval and course
 * ************************************************************************* */

//possible courses
$letterlinks = '';
Database::get()->queryFunc("SELECT LEFT(title, 1) AS first_letter FROM course GROUP BY first_letter ORDER BY first_letter"
        , function ($row) use(&$letterlinks) {
    $first_letter = $row->first_letter;
    $letterlinks .= '<a href="?first=' . $first_letter . '">' . $first_letter . '</a> ';
});

if (isset($_GET['first'])) {
    $firstletter = $_GET['first'];
コード例 #3
0
ファイル: oldStats.php プロジェクト: nikosv/openeclass
                        FROM loginout_summary
                        WHERE $date_where
                        GROUP BY MONTH(start_date)";

$result = Database::get()->queryArray($query);

if (count($result) > 0) {
    $chart = new Plotter();
    $chart->setTitle($langOldStats);

    //add points to chart
    foreach ($result as $row) {
        $mont = $langMonths[$row->month];
        $chart->growWithPoint($mont . " - " . $row->year, $row->visits);
    }
    $tool_content .= "<p>" . $langVisits . "</p>" . $chart->plot();
} else {
    $tool_content .= "<div class='alert alert-warning'>$langNoStatistics</div>";
}

$tool_content .= '<div class="form-wrapper"><form class="form-horizontal" role="form" method="post">';
$tool_content .= "<div class='input-append date form-group' id='user_date_start' data-date = '" . q($user_date_start) . "' data-date-format='dd-mm-yyyy'>
    <label class='col-sm-2 control-label'>$langStartDate:</label>
        <div class='col-xs-10 col-sm-9'>               
            <input class='form-control' name='user_date_start' type='text' value = '" . q($user_date_start) . "'>
        </div>
        <div class='col-xs-2 col-sm-1'>
            <span class='add-on'><i class='fa fa-times'></i></span>
            <span class='add-on'><i class='fa fa-calendar'></i></span>
        </div>
        </div>";        
コード例 #4
0
ファイル: portfolio.php プロジェクト: kostastzo/openeclass
/**
* draws statistics graph
* @global type $uid
* @global type $langCourseVisits
s * @return type
*/
function courseVisitsPlot()
{
    global $uid, $langCourseVisits, $langNoStats;
    $totalHits = 0;
    $totalDuration = 0;
    $result = Database::get()->queryArray("SELECT a.code code, a.title title\n                                        FROM course AS a LEFT JOIN course_user AS b\n                                             ON a.id = b.course_id\n                                        WHERE b.user_id = ?d\n                                        AND a.visible != " . COURSE_INACTIVE . "\n                                        ORDER BY a.title", $uid);
    if (count($result) > 0) {
        // found courses ?
        foreach ($result as $row) {
            $course_codes[] = $row->code;
            $course_names[$row->code] = $row->title;
        }
        foreach ($course_codes as $code) {
            $cid = course_code_to_id($code);
            $row = Database::get()->querySingle("SELECT SUM(hits) AS cnt FROM actions_daily\n                                WHERE user_id = ?d\n                                AND course_id =?d", $uid, $cid);
            if ($row) {
                $totalHits += $row->cnt;
                $hits[$code] = $row->cnt;
            }
            $result = Database::get()->querySingle("SELECT SUM(duration) AS duration FROM actions_daily\n                                        WHERE user_id = ?d\n                                        AND course_id = ?d", $uid, $cid);
            $duration[$code] = $result->duration;
            $totalDuration += $duration[$code];
        }
        $chart = new Plotter(600, 300);
        $chart->setTitle($langCourseVisits);
        foreach ($hits as $code => $count) {
            if ($count > 0) {
                $chart->addPoint($course_names[$code], $count);
                $chart->modDimension(7, 0);
            }
        }
        return $chart->plot();
    } else {
        return "{$langNoStats}";
    }
}
コード例 #5
0
ファイル: index.php プロジェクト: kostastzo/openeclass
function show_assignment($id, $display_graph_results = false)
{
    global $tool_content, $m, $langBack, $langNoSubmissions, $langSubmissions, $langEndDeadline, $langWEndDeadline, $langNEndDeadline, $langDays, $langDaysLeft, $langGradeOk, $course_code, $webDir, $urlServer, $langGraphResults, $m, $course_code, $themeimg, $works_url, $course_id, $langDelWarnUserAssignment, $langAutoJudgeShowWorkResultRpt;
    $row = Database::get()->querySingle("SELECT *, CAST(UNIX_TIMESTAMP(deadline)-UNIX_TIMESTAMP(NOW()) AS SIGNED) AS time\n                                FROM assignment\n                                WHERE course_id = ?d AND id = ?d", $course_id, $id);
    $nav[] = $works_url;
    assignment_details($id, $row);
    $rev = @($_REQUEST['rev'] == 1) ? ' DESC' : '';
    if (isset($_REQUEST['sort'])) {
        if ($_REQUEST['sort'] == 'am') {
            $order = 'am';
        } elseif ($_REQUEST['sort'] == 'date') {
            $order = 'submission_date';
        } elseif ($_REQUEST['sort'] == 'grade') {
            $order = 'grade';
        } elseif ($_REQUEST['sort'] == 'filename') {
            $order = 'file_name';
        } else {
            $order = 'surname';
        }
    } else {
        $order = 'surname';
    }
    $result = Database::get()->queryArray("SELECT * FROM assignment_submit AS assign, user\n                                 WHERE assign.assignment_id = ?d AND user.id = assign.uid\n                                 ORDER BY ?s ?s", $id, $order, $rev);
    $num_results = count($result);
    if ($num_results > 0) {
        if ($num_results == 1) {
            $num_of_submissions = $m['one_submission'];
        } else {
            $num_of_submissions = sprintf("{$m['more_submissions']}", $num_results);
        }
        $gradeOccurances = array();
        // Named array to hold grade occurances/stats
        $gradesExists = 0;
        foreach ($result as $row) {
            $theGrade = $row->grade;
            if ($theGrade) {
                $gradesExists = 1;
                if (!isset($gradeOccurances[$theGrade])) {
                    $gradeOccurances[$theGrade] = 1;
                } else {
                    if ($gradesExists) {
                        ++$gradeOccurances[$theGrade];
                    }
                }
            }
        }
        if (!$display_graph_results) {
            $result = Database::get()->queryArray("SELECT assign.id id, assign.file_name file_name,\n                                                   assign.uid uid, assign.group_id group_id,\n                                                   assign.submission_date submission_date,\n                                                   assign.grade_submission_date grade_submission_date,\n                                                   assign.grade grade, assign.comments comments,\n                                                   assign.grade_comments grade_comments,\n                                                   assignment.deadline deadline\n                                                   FROM assignment_submit AS assign, user, assignment\n                                                   WHERE assign.assignment_id = ?d AND assign.assignment_id = assignment.id AND user.id = assign.uid\n                                                   ORDER BY ?s ?s", $id, $order, $rev);
            $tool_content .= "\n                        <form action='{$_SERVER['SCRIPT_NAME']}?course={$course_code}' method='post'>\n                        <input type='hidden' name='grades_id' value='{$id}' />\n                        <p><div class='sub_title1'>{$langSubmissions}:</div><p>\n                        <p>{$num_of_submissions}</p>\n                        <table width='100%' class='sortable'>\n                        <tr>\n                      <th width='3'>&nbsp;</th>";
            sort_link($m['username'], 'username');
            sort_link($m['am'], 'am');
            sort_link($m['filename'], 'filename');
            sort_link($m['sub_date'], 'date');
            sort_link($m['grade'], 'grade');
            $tool_content .= "</tr>";
            $i = 1;
            foreach ($result as $row) {
                //is it a group assignment?
                if (!empty($row->group_id)) {
                    $subContentGroup = "{$m['groupsubmit']} " . "<a href='../group/group_space.php?course={$course_code}&amp;group_id={$row->group_id}'>" . "{$m['ofgroup']} " . gid_to_name($row->group_id) . "</a>";
                } else {
                    $subContentGroup = '';
                }
                $uid_2_name = display_user($row->uid);
                $stud_am = Database::get()->querySingle("SELECT am FROM user WHERE id = ?d", $row->uid)->am;
                if ($i % 2 == 1) {
                    $row_color = "class='even'";
                } else {
                    $row_color = "class='odd'";
                }
                $filelink = empty($row->file_name) ? '&nbsp;' : "<a href='{$_SERVER['SCRIPT_NAME']}?course={$course_code}&amp;get={$row->id}'>" . q($row->file_name) . "</a>";
                $late_sub_text = (int) $row->deadline && $row->submission_date > $row->deadline ? '<div style="color:red;">$m[late_submission]</div>' : '';
                $tool_content .= "\n                                <tr {$row_color}>\n                                <td align='right' width='4' rowspan='2' valign='top'>{$i}.</td>\n                                <td>{$uid_2_name}</td>\n                                <td width='85'>" . q($stud_am) . "</td>\n                                <td width='180'>{$filelink}\n                                <a href='{$_SERVER['SCRIPT_NAME']}?course={$course_code}&amp;id={$id}&amp;as_id={$row->id}' onClick='return confirmation(\"{$langDelWarnUserAssignment}\");'>\n                                 <img src='{$themeimg}/delete.png' title='{$m['WorkDelete']}' />\n                                </a>\n                                </td>\n                                <td width='100'>" . nice_format($row->submission_date, TRUE) . $late_sub_text . "</td>\n                                <td width='5'>\n                                <div align='center'><input type='text' value='{$row->grade}' maxlength='3' size='3' name='grades[{$row->id}]'></div>\n                                </td>\n                                </tr>\n                                <tr {$row_color}>\n                                <td colspan='5'>\n                                <div>{$subContentGroup}</div>";
                if (trim($row->comments != '')) {
                    $tool_content .= "<div style='margin-top: .5em;'><b>{$m['comments']}:</b> " . q($row->comments) . '</div>';
                }
                //professor comments
                $gradelink = "grade_edit.php?course={$course_code}&amp;assignment={$id}&amp;submission={$row->id}";
                $reportlink = "work_result_rpt.php?course={$course_code}&amp;assignment={$id}&amp;submission={$row->id}";
                if (trim($row->grade_comments)) {
                    $label = $m['gradecomments'] . ':';
                    $icon = 'edit.png';
                    $comments = "<div class='smaller'>" . standard_text_escape($row->grade_comments) . "</div>";
                } else {
                    $label = $m['addgradecomments'];
                    $icon = 'add.png';
                    $comments = '';
                }
                if ($row->grade_comments || $row->grade != '') {
                    $comments .= "<div class='smaller'><i>({$m['grade_comment_date']}: " . nice_format($row->grade_submission_date) . ")</i></div>";
                }
                $tool_content .= "<div style='padding-top: .5em;'><a href='{$gradelink}'><b>{$label}</b></a>\n\t\t\t\t  <a href='{$gradelink}'><img src='{$themeimg}/{$icon}'></a>\n\t\t\t\t  {$comments}\n\t\t\t\t  <a href='{$reportlink}'><b>{$langAutoJudgeShowWorkResultRpt}</b></a>\n                                </td>\n                                </tr>";
                $i++;
            }
            //END of Foreach
            $tool_content .= "</table>\n                        <p class='smaller right'><img src='{$themeimg}/email.png' alt='' >\n                                {$m['email_users']}: <input type='checkbox' value='1' name='email'></p>\n                        <p><input class='btn btn-primary' type='submit' name='submit_grades' value='{$langGradeOk}'></p>\n                        </form>";
        } else {
            // display pie chart with grades results
            if ($gradesExists) {
                // Used to display grades distribution chart
                $graded_submissions_count = Database::get()->querySingle("SELECT COUNT(*) AS count FROM assignment_submit AS assign, user\n                                                             WHERE assign.assignment_id = ?d AND user.id = assign.uid AND\n                                                             assign.grade <> ''", $id)->count;
                $chart = new Plotter();
                $chart->setTitle("{$langGraphResults}");
                foreach ($gradeOccurances as $gradeValue => $gradeOccurance) {
                    $percentage = round(100.0 * $gradeOccurance / $graded_submissions_count, 2);
                    $chart->growWithPoint("{$gradeValue} ({$percentage}%)", $percentage);
                }
                $tool_content .= $chart->plot();
            }
        }
    } else {
        $tool_content .= "\n                      <p class='sub_title1'>{$langSubmissions}:</p>\n                      <div class='alert alert-warning'>{$langNoSubmissions}</div>";
    }
}
コード例 #6
0
ファイル: results.php プロジェクト: nikosv/openeclass
                }
                break;
            case "weekly":
                foreach ($result as $row) {
                    $row->tot_dur = round($row->tot_dur / 60);
                    $chart->growWithPoint($row->week_start . ' - ' . $row->week_end, $row->tot_dur);
                }
                break;
            case "monthly":
                foreach ($result as $row) {
                    $row->tot_dur = round($row->tot_dur / 60);
                    $chart->growWithPoint($langMonths[$row->month], $row->tot_dur);
                }
                break;
            case "yearly":
                foreach ($result as $row) {
                    $row->tot_dur = round($row->tot_dur / 60);
                    $chart->growWithPoint($row->year, $row->tot_dur);
                }
                break;
        }

        $chart->setTitle("$langDurationVisits");
        $tool_content .= "<div class='alert alert-info'>$langDurationExpl</div>";

        break;
}

$errorMsg = '<div class="alert alert-warning">' . $langNoStatistics . '</div>';
$tool_content .= $chart->plot($errorMsg);
コード例 #7
0
ファイル: index.php プロジェクト: nikosv/openeclass
function show_assignment($id, $display_graph_results = false) {
    global $tool_content, $m, $langBack, $langNoSubmissions, $langSubmissions,
    $langEndDeadline, $langWEndDeadline, $langNEndDeadline, $langWorkOnlineText,
    $langDays, $langDaysLeft, $langGradeOk, $course_code, $webDir, $urlServer,
    $langGraphResults, $m, $course_code, $themeimg, $works_url, $course_id,
    $langDelWarnUserAssignment, $langQuestionView, $langDelete, $langEditChange,
    $langAutoJudgeShowWorkResultRpt;

    $assign = Database::get()->querySingle("SELECT *, CAST(UNIX_TIMESTAMP(deadline)-UNIX_TIMESTAMP(NOW()) AS SIGNED) AS time
                                FROM assignment
                                WHERE course_id = ?d AND id = ?d", $course_id, $id);

    $nav[] = $works_url;
    assignment_details($id, $assign);

    $rev = (@($_REQUEST['rev'] == 1)) ? 'DESC' : 'ASC';
    if (isset($_REQUEST['sort'])) {
        if ($_REQUEST['sort'] == 'am') {
            $order = 'am';
        } elseif ($_REQUEST['sort'] == 'date') {
            $order = 'submission_date';
        } elseif ($_REQUEST['sort'] == 'grade') {
            $order = 'grade';
        } elseif ($_REQUEST['sort'] == 'filename') {
            $order = 'file_name';
        } else {
            $order = 'surname';
        }
    } else {
        $order = 'surname';
    }

    $result1 = Database::get()->queryArray("SELECT * FROM assignment_submit AS assign, user
                                 WHERE assign.assignment_id = ?d AND user.id = assign.uid
                                 ORDER BY ?s ?s", $id, $order, $rev);

    $num_results = count($result1);
    if ($num_results > 0) {
        if ($num_results == 1) {
            $num_of_submissions = $m['one_submission'];
        } else {
            $num_of_submissions = sprintf("$m[more_submissions]", $num_results);
        }

        $gradeOccurances = array(); // Named array to hold grade occurances/stats
        $gradesExists = 0;
        foreach ($result1 as $row) {
            $theGrade = $row->grade;
            if ($theGrade) {
                $gradesExists = 1;
                if (!isset($gradeOccurances[$theGrade])) {
                    $gradeOccurances[$theGrade] = 1;
                } else {
                    if ($gradesExists) {
                        ++$gradeOccurances[$theGrade];
                    }
                }
            }
        }
        if (!$display_graph_results) {

            $result = Database::get()->queryArray("SELECT assign.id id, assign.file_name file_name,
                                                   assign.uid uid, assign.group_id group_id,
                                                   assign.submission_date submission_date,
                                                   assign.grade_submission_date grade_submission_date,
                                                   assign.grade grade, assign.comments comments,
                                                   assign.grade_comments grade_comments,
                                                   assignment.grading_scale_id grading_scale_id,
                                                   assignment.deadline deadline
                                                   FROM assignment_submit AS assign, user, assignment
                                                   WHERE assign.assignment_id = ?d AND assign.assignment_id = assignment.id AND user.id = assign.uid
                                                   ORDER BY $order $rev", $id);
            $tool_content .= "
                        <form action='$_SERVER[SCRIPT_NAME]?course=$course_code' method='post' class='form-inline'>
                        <input type='hidden' name='grades_id' value='$id' />
                        <br>
                        <div class='margin-bottom-thin'>
                            <b>$langSubmissions:</b>&nbsp; $num_results
                        </div>
                        <div class='table-responsive'>
                        <table class='table-default'>
                        <tbody>
                        <tr class='list-header'>
                      <th width='3'>&nbsp;</th>";
            sort_link($m['username'], 'username');
            sort_link($m['am'], 'am');
            $assign->submission_type ? $tool_content .= "<th>$langWorkOnlineText</th>" : sort_link($m['filename'], 'filename');
            sort_link($m['sub_date'], 'date');
            sort_link($m['grade'], 'grade');
            $tool_content .= "<th width='5%' class='text-center'><i class='fa fa-cogs'></i></th></tr>";

            $i = 1;
            foreach ($result as $row) {
                //is it a group assignment?
                if (!empty($row->group_id)) {
                    $subContentGroup = "$m[groupsubmit] " .
                            "<a href='../group/group_space.php?course=$course_code&amp;group_id=$row->group_id'>" .
                            "$m[ofgroup] " . gid_to_name($row->group_id) . "</a>";
                } else {
                    $subContentGroup = '';
                }
                $uid_2_name = display_user($row->uid);
                $stud_am = Database::get()->querySingle("SELECT am FROM user WHERE id = ?d", $row->uid)->am;
                if ($assign->submission_type) {
                    $filelink = "<a href='#' class='onlineText btn btn-xs btn-default' data-id='$row->id'>$langQuestionView</a>";
                } else {
                    $filelink = empty($row->file_name) ? '&nbsp;' :
                            ("<a href='$_SERVER[SCRIPT_NAME]?course=$course_code&amp;get=$row->id'>" .
                            q($row->file_name) . "</a>");
                }
                if(Session::has("grades")) {
                    $grades = Session::get('grades');
                    $grade = $grades[$row->id]['grade'];
                } else {
                    $grade = $row->grade;
                }
                if ($row->grading_scale_id) {
                    $serialized_scale_data = Database::get()->querySingle('SELECT scales FROM grading_scale WHERE id = ?d AND course_id = ?d', $row->grading_scale_id, $course_id)->scales;
                    $scales = unserialize($serialized_scale_data);
                    $scale_options = "<option value> - </option>";
                    $scale_values = array_value_recursive('scale_item_value', $scales);
                    if (!in_array($grade, $scale_values) && !is_null($grade)) {
                        $grade = closest($grade, $scale_values)['value'];
                    }
                    foreach ($scales as $scale) {
                        $scale_options .= "<option value='$scale[scale_item_value]'".($scale['scale_item_value'] == $grade ? " selected" : "").">$scale[scale_item_name]</option>";
                    }
                    $grade_field = "
                            <select name='grades[$row->id][grade]' class='form-control' id='scales'>
                                $scale_options
                            </select>";
                } else {
                    $grade_field = "<input class='form-control' type='text' value='$grade' name='grades[$row->id][grade]' maxlength='4' size='3'>";
                }
                $late_sub_text = $row->deadline && $row->submission_date > $row->deadline ?  "<div style='color:red;'><small>$m[late_submission]</small></div>" : '';
                $tool_content .= "
                                <tr>
                                <td align='right' width='4' rowspan='2' valign='top'>$i.</td>
                                <td>${uid_2_name}</td>
                                <td width='85'>" . q($stud_am) . "</td>
                                <td class='text-center' width='180'>
                                        $filelink
                                </td>
                                <td width='100'>" . nice_format($row->submission_date, TRUE) .$late_sub_text. "</td>
                                <td width='5'>
                                    <div class='form-group ".(Session::getError("grade.$row->id") ? "has-error" : "")."'>
                                        $grade_field
                                        <span class='help-block'>".Session::getError("grade.$row->id")."</span>
                                    </div>
                                </td>
                                <td class='option-btn-cell'>".
                                    action_button(array(
                                        array(
                                            'title' => $langEditChange,
                                            'url' => "grade_edit.php?course=$course_code&amp;assignment=$id&amp;submission=$row->id",
                                            'level' => 'primary',
                                            'icon' => 'fa-edit'
                                        ),
                                        array(
                                            'title' => $langDelete,
                                            'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&amp;id=$id&amp;as_id=$row->id",
                                            'class' => 'delete',
                                            'icon' => 'fa-times',
                                            'confirm' => $langDelWarnUserAssignment
                                        )
                                    ))."
                                </td>
                                </tr>
                                <tr>
                                <td colspan='6'>
                                <div>$subContentGroup</div>";
                if (trim($row->comments != '')) {
                    $tool_content .= "<div style='margin-top: .5em;'>" .
                            q($row->comments) . '</div>';
                }
                //professor comments
                if ($row->grade_comments || $row->grade != '') {
                    $comments = "<br><div class='label label-primary'>" .
                            nice_format($row->grade_submission_date) . "</div>";
                }
                if (trim($row->grade_comments)) {
                    $label = '<b>'.$m['gradecomments'] . '</b>:';
                    $comments .= "&nbsp;<span>" . standard_text_escape($row->grade_comments) . "</span>";
                } else {
                    $label = '';
                    $comments = '';
                }
                $tool_content .= "<div style='padding-top: .5em;'>$label
				  $comments
                                ";
                if(AutojudgeApp::getAutojudge()->isEnabled()) {
                    $reportlink = "work_result_rpt.php?course=$course_code&amp;assignment=$id&amp;submission=$row->id";
                    $tool_content .= "<a href='$reportlink'><b>$langAutoJudgeShowWorkResultRpt</b></a>";
                }
                $tool_content .= "
                                </td>
                                </tr>";
                $i++;
            } //END of Foreach

            $tool_content .= "
                    </tbody>
                </table>
            </div>
            <div class='form-group'>
                <div class='col-xs-12'>
                    <div class='checkbox'>
                      <label>
                        <input type='checkbox' value='1' name='email'> $m[email_users]
                      </label>
                    </div>
                </div>
            </div>
            <div class='pull-right'>
                <button class='btn btn-primary' type='submit' name='submit_grades'>$langGradeOk</button>
            </div>
        </form>";
        } else {
        // display pie chart with grades results
            if ($gradesExists) {
                // Used to display grades distribution chart
                $graded_submissions_count = Database::get()->querySingle("SELECT COUNT(*) AS count FROM assignment_submit AS assign, user
                                                             WHERE assign.assignment_id = ?d AND user.id = assign.uid AND
                                                             assign.grade <> ''", $id)->count;
                $chart = new Plotter();
                $chart->setTitle("$langGraphResults");
                if ($assign->grading_scale_id) {
                    $serialized_scale_data = Database::get()->querySingle('SELECT scales FROM grading_scale WHERE id = ?d AND course_id = ?d', $assign->grading_scale_id, $course_id)->scales;
                    $scales = unserialize($serialized_scale_data);
                    $scale_values = array_value_recursive('scale_item_value', $scales);
                }
                foreach ($gradeOccurances as $gradeValue => $gradeOccurance) {
                    $percentage = round((100.0 * $gradeOccurance / $graded_submissions_count),2);
                    if ($assign->grading_scale_id) {
                        $key = closest($gradeValue, $scale_values, true)['key'];
                        $gradeValue = $scales[$key]['scale_item_name'];
                    }
                    $chart->growWithPoint("$gradeValue ($percentage%)", $percentage);
                }
                $tool_content .= $chart->plot();
            }
        }
    } else {
        $tool_content .= "
                      <p class='sub_title1'>$langSubmissions:</p>
                      <div class='alert alert-warning'>$langNoSubmissions</div>";
    }
}
コード例 #8
0
            $totalHits += $row->cnt;
            $hits[$code] = $row->cnt;
        }
        $result = Database::get()->querySingle("SELECT SUM(duration) AS duration FROM actions_daily\n                                        WHERE user_id = ?d\n                                        AND course_id = ?d", $uid, $cid);
        $duration[$code] = $result->duration;
        $totalDuration += $duration[$code];
    }
    $chart = new Plotter(600, 300);
    $chart->setTitle($langCourseVisits);
    foreach ($hits as $code => $count) {
        if ($count > 0) {
            $chart->addPoint($course_names[$code], $count);
            $chart->modDimension(7, 0);
        }
    }
    $tool_content .= $chart->plot();
    $totalDuration = format_time_duration(0 + $totalDuration);
    $tool_content .= "<fieldset>\n                <legend>{$langPlatformGenStats}</legend>\n                <table class='table-default'>\n                <tr>\n                <th>{$langTotalVisitsCourses}:</th>\n                <td>{$totalHits}</td>\n                </tr>\n                <tr>\n                <th>{$langDurationVisits}:</th>\n                <td>{$totalDuration}</td>\n                </tr>\n                <tr>\n                <th valign='top'>{$langDurationVisitsPerCourse}:</th>\n                <td>\n                <table class='table-default' width='550'>\n                <tr>\n                <th>{$langCourseTitle}</th>                   \n                <th width='160'>{$langDuration}</th>\n                </tr>";
    foreach ($duration as $code => $time) {
        $tool_content .= "                \n                <td>" . q(course_code_to_title($code)) . "</td>\n                <td width='140'>" . format_time_duration(0 + $time) . "</td>\n                </tr>";
    }
    $tool_content .= "</table></td></tr>";
}
// End of chart display; chart unlinked at end of script.
$tool_content .= "<tr><th>{$langLastVisits}:</th><td>";
$tool_content .= "<table class='table-default' width='550'>\n            <tr>\n              <th>{$langDate}</th>\n              <th width='140'>{$langAction}</th>\n            </tr>";
$act["LOGIN"] = "******";
$act["LOGOUT"] = "<font color='#FF0000'>{$langLogout}</font>";
$q = Database::get()->queryArray("SELECT * FROM loginout\n                        WHERE id_user = ?d ORDER by idLog DESC LIMIT 10", $uid);
foreach ($q as $result) {
    $when = $result->when;
コード例 #9
0
ファイル: personal_stats.php プロジェクト: nikosv/openeclass
    $chart->setTitle($langCourseVisits);
    foreach ($hits as $code => $count) {
        if ($count > 0) {
            $chart->addPoint($course_names[$code], $count);
            $chart->modDimension(7, 0);
        }
    }
    $tool_content .= action_bar(array(
                                array('title' => $langBack,
                                      'url' => $urlServer,
                                      'icon' => 'fa-reply',
                                      'level' => 'primary-label',
                                      'button-class' => 'btn-default')
                            ), false);
    $tool_content .= "<div class='row margin-bottom-fat'><div class='col-xs-12'>" .
        $chart->plot() .
        "</div></div>";

    $totalDuration = format_time_duration(0 + $totalDuration, 240);
    $tool_content .= "
                <div class='row margin-top-fat'>
                    <div class='col-xs-12'>
                        <ul class='list-group'>
                            <li class='list-group-item disabled'>
                                <div class='row'>
                                    <div class='col-sm-12'><b>$langPlatformGenStats</b></div>
                                </div>
                            </li>
                            <li class='list-group-item'>
                                <div class='row'>
                                    <div class='col-sm-8'>$langTotalVisitsCourses</div>