From 583588b4e5e17404b366c10d5282f1a466c48634 Mon Sep 17 00:00:00 2001
From: Julio Montoya '.Security::remove_XSS($my_folder_data['description'], STUDENT).'
'.$cant_files.' '.$text_file.$dirtext;
$row[] = $url;
}
@@ -895,9 +904,18 @@ function display_student_publications_list($id, $my_folder_data, $work_parents,
$row[] = '-';
}
+ if (!$is_allowed_to_edit) {
+ if ($course_info['show_score'] == 0) {
+ $url = api_get_path(WEB_CODE_PATH).'work/work_list_others.php?'.api_get_cidreq().'&id='.$work_parent->id;
+ $row[] = Display::url(Display::return_icon('group.png', get_lang('Others')), $url);
+ }
+ }
if ($origin != 'learnpath') {
if ($is_allowed_to_edit) {
+
+ $cant_files_per_user = getUniqueStudentAttempts($work_data['id'], $course_id);
+
$row[] = $cant_files_per_user.'/'.$countUsers;
if (api_resource_is_locked_by_gradebook($id2, LINK_STUDENTPUBLICATION)) {
$action .= Display::return_icon('edit_na.png', get_lang('Edit'), array(), ICON_SIZE_SMALL);
@@ -1575,7 +1593,14 @@ function get_work_id($path) {
}
}
-function get_count_work($work_id) {
+/**
+ * @param int $work_id
+ * @param int $onlyMeUserId show only my works
+ * @param int $notMeUserId show works from everyone except me
+ * @return int
+ */
+function get_count_work($work_id, $onlyMeUserId = null, $notMeUserId = null)
+{
$work_table = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
$iprop_table = Database::get_course_table(TABLE_ITEM_PROPERTY);
$user_table = Database::get_main_table(TABLE_MAIN_USER);
@@ -1609,6 +1634,17 @@ function get_count_work($work_id) {
$extra_conditions .= " AND parent_id = ".$work_id." ";
+ $where_condition = null;
+
+ if (!empty($notMeUserId)) {
+ $where_condition .= " AND u.user_id <> ".intval($notMeUserId);
+ }
+
+ if (!empty($onlyMeUserId)) {
+ $where_condition .= " AND u.user_id = ".intval($onlyMeUserId);
+ }
+
+
$sql = "SELECT count(*) as count ".
" FROM ".$iprop_table." prop INNER JOIN ".$work_table." work ".
" ON (prop.ref=work.id AND prop.c_id = $course_id ".
@@ -1690,7 +1726,6 @@ function get_work_user_list($start, $limit, $column, $direction, $work_id, $wher
FROM $work_condition $user_condition $course_conditions
WHERE $extra_conditions $where_condition $condition_session ";
-
$sql .= " ORDER BY $column $direction ";
$sql .= " LIMIT $start, $limit";
diff --git a/main/work/work.php b/main/work/work.php
index 53e753f10d..6f79b68daf 100644
--- a/main/work/work.php
+++ b/main/work/work.php
@@ -239,7 +239,6 @@ if (!empty($group_id)) {
}
}
-
//stats
event_access_tool(TOOL_STUDENTPUBLICATION);
@@ -1113,63 +1112,7 @@ switch ($action) {
//User works
if (isset($work_id) && !empty($work_id) && !$display_list_users_without_publication) {
- $work_data = get_work_assignment_by_id($work_id);
- $check_qualification = intval($my_folder_data['qualification']);
-
- if (!empty($work_data['enable_qualification']) && !empty($check_qualification)) {
- $type = 'simple';
- $columns = array(get_lang('Type'), get_lang('FirstName'), get_lang('LastName'), get_lang('LoginName'), get_lang('Title'), get_lang('Qualification'), get_lang('Date'), get_lang('Status'), get_lang('Actions'));
- $column_model = array (
- array('name'=>'type', 'index'=>'file', 'width'=>'12', 'align'=>'left', 'search' => 'false'),
- array('name'=>'firstname', 'index'=>'firstname', 'width'=>'35', 'align'=>'left', 'search' => 'true'),
- array('name'=>'lastname', 'index'=>'lastname', 'width'=>'35', 'align'=>'left', 'search' => 'true'),
- array('name'=>'username', 'index'=>'username', 'width'=>'30', 'align'=>'left', 'search' => 'true'),
- array('name'=>'title', 'index'=>'title', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'wrap_cell' => 'true'),
- // array('name'=>'file', 'index'=>'file', 'width'=>'20', 'align'=>'left', 'search' => 'false'),
- array('name'=>'qualification', 'index'=>'qualification', 'width'=>'20', 'align'=>'left', 'search' => 'true'),
- array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'50', 'align'=>'left', 'search' => 'true'),
- array('name'=>'qualificator_id','index'=>'qualificator_id', 'width'=>'30', 'align'=>'left', 'search' => 'true'),
- array('name'=>'actions', 'index'=>'actions', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'sortable'=>'false')
- );
- } else {
- $type = 'complex';
- $columns = array(get_lang('Type'), get_lang('FirstName'), get_lang('LastName'), get_lang('LoginName'), get_lang('Title'), get_lang('Date'), get_lang('Actions'));
- $column_model = array (
- array('name'=>'type', 'index'=>'file', 'width'=>'12', 'align'=>'left', 'search' => 'false'),
- array('name'=>'firstname', 'index'=>'firstname', 'width'=>'35', 'align'=>'left', 'search' => 'true'),
- array('name'=>'lastname', 'index'=>'lastname', 'width'=>'35', 'align'=>'left', 'search' => 'true'),
- array('name'=>'username', 'index'=>'username', 'width'=>'30', 'align'=>'left', 'search' => 'true'),
- array('name'=>'title', 'index'=>'title', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'wrap_cell' => "true"),
- // array('name'=>'file', 'index'=>'file', 'width'=>'20', 'align'=>'left', 'search' => 'false'),
- //array('name'=>'qualification', 'index'=>'qualification', 'width'=>'20', 'align'=>'left', 'search' => 'true'),
- array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'50', 'align'=>'left', 'search' => 'true'),
- //array('name'=>'qualificator_id','index'=>'qualificator_id', 'width'=>'30', 'align'=>'left', 'search' => 'true'),
- array('name'=>'actions', 'index'=>'actions', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'sortable'=>'false')
- );
- }
- $extra_params = array();
-
- //Autowidth
- $extra_params['autowidth'] = 'true';
-
- //height auto
- $extra_params['height'] = 'auto';
- //$extra_params['excel'] = 'excel';
-
- //$extra_params['rowList'] = array(10, 20 ,30);
-
- $extra_params['sortname'] = 'firstname';
- $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_work_user_list&work_id='.$work_id.'&type='.$type;
- ?>
-
- ';
+echo ''.Display::return_icon('back.png', get_lang('BackToWorksList'),'',ICON_SIZE_MEDIUM).'';
+echo '';
+
+// User works
+$work_data = get_work_assignment_by_id($workId);
+$check_qualification = intval($my_folder_data['qualification']);
+
+if (!empty($work_data['enable_qualification']) && !empty($check_qualification)) {
+ $type = 'simple';
+ $columns = array(get_lang('Type'), get_lang('FirstName'), get_lang('LastName'), get_lang('LoginName'), get_lang('Title'), get_lang('Qualification'), get_lang('Date'), get_lang('Status'), get_lang('Actions'));
+ $column_model = array (
+ array('name'=>'type', 'index'=>'file', 'width'=>'12', 'align'=>'left', 'search' => 'false'),
+ array('name'=>'firstname', 'index'=>'firstname', 'width'=>'35', 'align'=>'left', 'search' => 'true'),
+ array('name'=>'lastname', 'index'=>'lastname', 'width'=>'35', 'align'=>'left', 'search' => 'true'),
+ array('name'=>'username', 'index'=>'username', 'width'=>'30', 'align'=>'left', 'search' => 'true'),
+ array('name'=>'title', 'index'=>'title', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'wrap_cell' => 'true'),
+ // array('name'=>'file', 'index'=>'file', 'width'=>'20', 'align'=>'left', 'search' => 'false'),
+ array('name'=>'qualification', 'index'=>'qualification', 'width'=>'20', 'align'=>'left', 'search' => 'true'),
+ array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'50', 'align'=>'left', 'search' => 'true'),
+ array('name'=>'qualificator_id','index'=>'qualificator_id', 'width'=>'30', 'align'=>'left', 'search' => 'true'),
+ array('name'=>'actions', 'index'=>'actions', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'sortable'=>'false')
+ );
+} else {
+ $type = 'complex';
+ $columns = array(get_lang('Type'), get_lang('FirstName'), get_lang('LastName'), get_lang('LoginName'), get_lang('Title'), get_lang('Date'), get_lang('Actions'));
+ $column_model = array (
+ array('name'=>'type', 'index'=>'file', 'width'=>'12', 'align'=>'left', 'search' => 'false'),
+ array('name'=>'firstname', 'index'=>'firstname', 'width'=>'35', 'align'=>'left', 'search' => 'true'),
+ array('name'=>'lastname', 'index'=>'lastname', 'width'=>'35', 'align'=>'left', 'search' => 'true'),
+ array('name'=>'username', 'index'=>'username', 'width'=>'30', 'align'=>'left', 'search' => 'true'),
+ array('name'=>'title', 'index'=>'title', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'wrap_cell' => "true"),
+ // array('name'=>'file', 'index'=>'file', 'width'=>'20', 'align'=>'left', 'search' => 'false'),
+ //array('name'=>'qualification', 'index'=>'qualification', 'width'=>'20', 'align'=>'left', 'search' => 'true'),
+ array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'50', 'align'=>'left', 'search' => 'true'),
+ //array('name'=>'qualificator_id','index'=>'qualificator_id', 'width'=>'30', 'align'=>'left', 'search' => 'true'),
+ array('name'=>'actions', 'index'=>'actions', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'sortable'=>'false')
+ );
+}
+
+$extra_params = array();
+
+//Autowidth
+$extra_params['autowidth'] = 'true';
+
+//height auto
+$extra_params['height'] = 'auto';
+//$extra_params['excel'] = 'excel';
+
+//$extra_params['rowList'] = array(10, 20 ,30);
+
+$extra_params['sortname'] = 'firstname';
+$url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_work_user_list&work_id='.$workId.'&type='.$type;
+?>
+
+';
+echo ''.Display::return_icon('back.png', get_lang('BackToWorksList'),'',ICON_SIZE_MEDIUM).'';
+echo '';
+
+// User works
+$work_data = get_work_assignment_by_id($workId);
+$check_qualification = intval($my_folder_data['qualification']);
+
+if (!empty($work_data['enable_qualification']) && !empty($check_qualification)) {
+ $type = 'simple';
+ $columns = array(get_lang('Type'), get_lang('FirstName'), get_lang('LastName'), get_lang('LoginName'), get_lang('Title'), get_lang('Qualification'), get_lang('Date'), get_lang('Status'), get_lang('Actions'));
+ $column_model = array (
+ array('name'=>'type', 'index'=>'file', 'width'=>'12', 'align'=>'left', 'search' => 'false'),
+ array('name'=>'firstname', 'index'=>'firstname', 'width'=>'35', 'align'=>'left', 'search' => 'true'),
+ array('name'=>'lastname', 'index'=>'lastname', 'width'=>'35', 'align'=>'left', 'search' => 'true'),
+ array('name'=>'username', 'index'=>'username', 'width'=>'30', 'align'=>'left', 'search' => 'true'),
+ array('name'=>'title', 'index'=>'title', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'wrap_cell' => 'true'),
+ // array('name'=>'file', 'index'=>'file', 'width'=>'20', 'align'=>'left', 'search' => 'false'),
+ array('name'=>'qualification', 'index'=>'qualification', 'width'=>'20', 'align'=>'left', 'search' => 'true'),
+ array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'50', 'align'=>'left', 'search' => 'true'),
+ array('name'=>'qualificator_id','index'=>'qualificator_id', 'width'=>'30', 'align'=>'left', 'search' => 'true'),
+ array('name'=>'actions', 'index'=>'actions', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'sortable'=>'false')
+ );
+} else {
+ $type = 'complex';
+ $columns = array(get_lang('Type'), get_lang('FirstName'), get_lang('LastName'), get_lang('LoginName'), get_lang('Title'), get_lang('Date'), get_lang('Actions'));
+ $column_model = array (
+ array('name'=>'type', 'index'=>'file', 'width'=>'12', 'align'=>'left', 'search' => 'false'),
+ array('name'=>'firstname', 'index'=>'firstname', 'width'=>'35', 'align'=>'left', 'search' => 'true'),
+ array('name'=>'lastname', 'index'=>'lastname', 'width'=>'35', 'align'=>'left', 'search' => 'true'),
+ array('name'=>'username', 'index'=>'username', 'width'=>'30', 'align'=>'left', 'search' => 'true'),
+ array('name'=>'title', 'index'=>'title', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'wrap_cell' => "true"),
+ // array('name'=>'file', 'index'=>'file', 'width'=>'20', 'align'=>'left', 'search' => 'false'),
+ //array('name'=>'qualification', 'index'=>'qualification', 'width'=>'20', 'align'=>'left', 'search' => 'true'),
+ array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'50', 'align'=>'left', 'search' => 'true'),
+ //array('name'=>'qualificator_id','index'=>'qualificator_id', 'width'=>'30', 'align'=>'left', 'search' => 'true'),
+ array('name'=>'actions', 'index'=>'actions', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'sortable'=>'false')
+ );
+}
+
+$extra_params = array();
+
+//Autowidth
+$extra_params['autowidth'] = 'true';
+
+//height auto
+$extra_params['height'] = 'auto';
+//$extra_params['excel'] = 'excel';
+
+//$extra_params['rowList'] = array(10, 20 ,30);
+
+$extra_params['sortname'] = 'firstname';
+$url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_work_user_list_all&work_id='.$workId.'&type='.$type;
+?>
+
+';
+echo ''.Display::return_icon('back.png', get_lang('BackToWorksList'),'',ICON_SIZE_MEDIUM).'';
+echo '';
+
+
+if (!empty($my_folder_data['description'])) {
+ echo '