Skip to content

Commit 1c99701

Browse files
committed
Add download icon for teacher on grading form of student assignments - refs #7192
1 parent f4924ed commit 1c99701

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

main/work/edit.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,16 @@
147147
$form->addElement('hidden', 'id', $work_id);
148148
$form->addElement('hidden', 'item_id', $item_id);
149149
$form->addElement('text', 'title', get_lang('Title'), array('id' => 'file_upload', 'class' => 'span4'));
150+
if ($is_allowed_to_edit && !empty($item_id)) {
151+
$sql = "SELECT contains_file, url FROM $work_table WHERE c_id = $course_id AND id ='$item_id' ";
152+
$result = Database::query($sql);
153+
if ($result !== false && Database::num_rows($result) > 0) {
154+
$row = Database::fetch_array($result);
155+
if ($row['contains_file'] || !empty($row['url'])) {
156+
$form->addElement('html', '<div class="control-group"><label class="control-label">'.get_lang('Download').'</label><div class="controls"><a href="'.api_get_path(WEB_CODE_PATH).'work/download.php?id='.$item_id.'&'.api_get_cidreq().'">'.Display::return_icon('save.png', get_lang('Save'),array(), ICON_SIZE_MEDIUM).'</a></div></div>');
157+
}
158+
}
159+
}
150160
$form->add_html_editor('description', get_lang('Description'), false, false, getWorkDescriptionToolbar());
151161

152162
$defaults['title'] = $work_item['title'];

0 commit comments

Comments
 (0)