Fixing issues in new work UI see BT#6418

1.9.x
Julio Montoya 12 years ago
parent 16af4748b6
commit eb963a891c
  1. 21
      main/work/downloadfolder.inc.php
  2. 19
      main/work/student_work.php
  3. 13
      main/work/work.php

@ -23,12 +23,13 @@ if (empty($work_data)) {
//prevent some stuff
if (empty($path)) {
$path = '/';
$path = '/';
}
if (empty($_course) || empty($_course['path'])) {
api_not_allowed();
}
$sys_course_path = api_get_path(SYS_COURSE_PATH);
//zip library for creation of the zipfile
@ -63,6 +64,17 @@ if (api_is_allowed_to_edit()) {
props.visibility<>'2' ";
} else {
$courseInfo = api_get_course_info();
$userCondition = null;
// All users
if ($courseInfo['show_score'] == 0) {
// Do another filter
} else {
// Only teachers
$userCondition = " AND props.insert_user_id='".api_get_user_id();
}
//for other users, we need to create a zipfile with only visible files and folders
$sql = "SELECT url, title, description, insert_user_id, insert_date, contains_file
FROM $tbl_student_publication AS work INNER JOIN $prop_table AS props
@ -74,8 +86,8 @@ if (api_is_allowed_to_edit()) {
work.accepted = 1 AND
work.parent_id = $work_id AND
work.filetype='file' AND
props.visibility = '1' AND
props.insert_user_id='".api_get_user_id()."'
props.visibility = '1'
$userCondition
";
}
@ -105,7 +117,6 @@ while ($not_deleted_file = Database::fetch_assoc($query)) {
}
}
if (!empty($files)) {
//logging
event_download(basename($work_data['title']).'.zip (folder)');
@ -151,4 +162,4 @@ function diff($arr1, $arr2) {
}
}
return $res;
}
}

@ -89,11 +89,24 @@ foreach ($workPerUser as $work) {
}
$table->setCellContents($row, $column, $score);
$column++;
// Actions
$links = null;
if (empty($userResult['url'])) {
// is a text
$url = api_get_path(WEB_CODE_PATH).'work/view.php?'.api_get_cidreq().'&id='.$userResult['id'];
$links .= Display::url(Display::return_icon('default.png'), $url);
} else {
$url = api_get_path(WEB_CODE_PATH).'work/download.php?'.api_get_cidreq().'&id='.$userResult['id'];
$links .= Display::url(Display::return_icon('save.png'), $url);
}
$url = api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq().'&action=edit&item_id='.$userResult['id'].'&id='.$workId.'&parent_id='.$workId;
$link = Display::url(Display::return_icon('edit.png'), $url);
$links .= Display::url(Display::return_icon('edit.png'), $url);
$table->setCellContents($row, $column, $link);
//$table->setCellContents($row, $column, $link);
$table->setCellContents($row, $column, $links);
$row++;
$column = 0;

@ -56,7 +56,7 @@ api_protect_course_script(true);
require_once 'work.lib.php';
require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php';
include_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php';
require_once api_get_path(LIBRARY_PATH).'fileDisplay.lib.php';
@ -331,9 +331,11 @@ switch ($action) {
case 'settings':
//if posts
if ($is_allowed_to_edit && !empty($_POST['changeProperties'])) {
// changing the tool setting: default visibility of an uploaded document
$query = "UPDATE " . $main_course_table . " SET show_score='" . $uploadvisibledisabled . "' WHERE code='" . api_get_course_id() . "'";
// Changing the tool setting: default visibility of an uploaded document
// @todo i
$query = "UPDATE ".$main_course_table." SET show_score='" . $uploadvisibledisabled . "' WHERE code='" . api_get_course_id() . "'";
$res = Database::query($query);
/**
* Course data are cached in session so we need to update both the database
* and the session data
@ -341,7 +343,6 @@ switch ($action) {
$_course['show_score'] = $uploadvisibledisabled;
Session::write('_course', $course);
// changing the tool setting: is a student allowed to delete his/her own document
// database table definition
$table_course_setting = Database :: get_course_table(TOOL_COURSE_SETTING);
@ -1187,13 +1188,12 @@ switch ($action) {
echo '<div class="row">';
echo '<div class="span9">';
$userList = CourseManager::get_user_list_from_course_code($course_code, $session_id);
$userList = CourseManager::get_user_list_from_course_code($course_code, $session_id, null, null, STUDENT);
display_student_publications_list($work_id, $my_folder_data, $work_parents, $origin, $add_query, count($userList));
echo '</div>';
echo '<div class="span3">';
$table = new HTML_Table(array('class' => 'data_table'));
$column = 0;
$row = 0;
@ -1218,6 +1218,7 @@ switch ($action) {
$row++;
$column = 0;
}
echo $table->toHtml();
echo '</div>';
} else {

Loading…
Cancel
Save