Skip to content

Commit

Permalink
added word count display
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Jul 6, 2005
1 parent db83128 commit c6dba19
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 3 deletions.
39 changes: 36 additions & 3 deletions mod/assignment/type/online/assignment.class.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -29,9 +29,12 @@ function view() {


if ($data = data_submitted()) { // No incoming data? if ($data = data_submitted()) { // No incoming data?
if ($this->update_submission($data)) { if ($this->update_submission($data)) {
notify(get_string('submissionsaved', 'assignment')); //redirect to get updated submission date and word count
redirect('view.php?id='.$this->cm->id.'&saved=1');
} }
} } else if (!empty($_GET['saved'])) {
notify(get_string('submissionsaved', 'assignment'));
}


print_simple_box_start('center', '70%', '', '', 'generalbox', 'online'); print_simple_box_start('center', '70%', '', '', 'generalbox', 'online');
$submission = $this->get_submission(); $submission = $this->get_submission();
Expand Down Expand Up @@ -59,6 +62,36 @@ function view() {
$this->view_footer(); $this->view_footer();
} }


/*
* Display the assignment dates
*/
function view_dates() {
global $USER;

if (!$this->assignment->timeavailable && !$this->assignment->timedue) {
return;
}

print_simple_box_start('center', '', '', '', 'generalbox', 'dates');
echo '<table>';
if ($this->assignment->timeavailable) {
echo '<tr><td class="c0">'.get_string('availabledate','assignment').':</td>';
echo ' <td class="c1">'.userdate($this->assignment->timeavailable).'</td></tr>';
}
if ($this->assignment->timedue) {
echo '<tr><td class="c0">'.get_string('duedate','assignment').':</td>';
echo ' <td class="c1">'.userdate($this->assignment->timedue).'</td></tr>';
}
$submission = $this->get_submission($USER->id);
if ($submission) {
echo '<tr><td class="c0">'.get_string('lastedited').':</td>';
echo ' <td class="c1">'.userdate($submission->timemodified);
echo ' ('.get_string('numwords', '', count_words(format_text($submission->data1, $submission->data2))).')</td></tr>';
}
echo '</table>';
print_simple_box_end();
}

function view_edit_form($submission = NULL) { function view_edit_form($submission = NULL) {
global $CFG; global $CFG;


Expand Down Expand Up @@ -162,7 +195,7 @@ function print_user_files($userid, $return=false) {
$output = '<div class="files">'. $output = '<div class="files">'.
'<img align="middle" src="'.$CFG->pixpath.'/f/html.gif" height="16" width="16" alt="html" />'. '<img align="middle" src="'.$CFG->pixpath.'/f/html.gif" height="16" width="16" alt="html" />'.
link_to_popup_window ('/mod/assignment/type/online/file.php?id='.$this->cm->id.'&amp;userid='. link_to_popup_window ('/mod/assignment/type/online/file.php?id='.$this->cm->id.'&amp;userid='.
$submission->userid, 'file'.$userid, shorten_text(strip_tags(format_text($submission->data1,$submission->data2)), 15), 450, 580, $submission->userid, 'file'.$userid, shorten_text(trim(strip_tags(format_text($submission->data1,$submission->data2))), 15), 450, 580,
get_string('submission', 'assignment'), 'none', true). get_string('submission', 'assignment'), 'none', true).
'</div>'; '</div>';


Expand Down
13 changes: 13 additions & 0 deletions mod/assignment/type/online/file.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -38,6 +38,19 @@


if ($submission = $assignmentinstance->get_submission($userid)) { if ($submission = $assignmentinstance->get_submission($userid)) {
print_header(fullname($user,true).': '.$assignment->name); print_header(fullname($user,true).': '.$assignment->name);

print_simple_box_start('center', '', '', '', 'generalbox', 'dates');
echo '<table>';
if ($assignment->timedue) {
echo '<tr><td class="c0">'.get_string('duedate','assignment').':</td>';
echo ' <td class="c1">'.userdate($assignment->timedue).'</td></tr>';
}
echo '<tr><td class="c0">'.get_string('lastedited').':</td>';
echo ' <td class="c1">'.userdate($submission->timemodified);
echo ' ('.get_string('numwords', '', count_words(format_text($submission->data1, $submission->data2))).')</td></tr>';
echo '</table>';
print_simple_box_end();

print_simple_box(format_text($submission->data1, $submission->data2), 'center', '100%'); print_simple_box(format_text($submission->data1, $submission->data2), 'center', '100%');
close_window_button(); close_window_button();
print_footer('none'); print_footer('none');
Expand Down

0 comments on commit c6dba19

Please sign in to comment.