Adding new work UI view see BT#6418

1.9.x
Julio Montoya 12 years ago
parent c0eb3ef405
commit 583588b4e5
  1. 109
      main/inc/ajax/model.ajax.php
  2. 1
      main/work/student_work.php
  3. 71
      main/work/work.lib.php
  4. 59
      main/work/work.php
  5. 103
      main/work/work_list.php
  6. 105
      main/work/work_list_all.php
  7. 107
      main/work/work_list_others.php

@ -31,15 +31,20 @@ if (!in_array($sord, array('asc','desc'))) {
$sord = 'desc';
}
if (!in_array($action, array(
if (!in_array(
$action,
array(
'get_exercise_results',
'get_hotpotatoes_exercise_results',
'get_work_user_list',
'get_work_user_list_others',
'get_work_user_list_all',
'get_timelines',
'get_user_skill_ranking',
'get_usergroups_teacher'))
) {
api_protect_admin_script(true);
'get_usergroups_teacher'
)
)) {
api_protect_admin_script(true);
}
//Search features
@ -63,7 +68,8 @@ $ops = array (
//@todo move this in the display_class or somewhere else
function get_where_clause($col, $oper, $val) {
function get_where_clause($col, $oper, $val)
{
global $ops;
if (empty($col)){
return '';
@ -126,17 +132,27 @@ switch ($action) {
$course_id = api_get_course_int_id();
$count = Question::get_count_course_medias($course_id);
break;
case 'get_user_skill_ranking':
$skill = new Skill();
$count = $skill->get_user_list_skill_ranking_count();
break;
case 'get_work_user_list':
case 'get_user_skill_ranking':
$skill = new Skill();
$count = $skill->get_user_list_skill_ranking_count();
break;
case 'get_work_user_list_all':
require_once api_get_path(SYS_CODE_PATH).'work/work.lib.php';
$work_id = $_REQUEST['work_id'];
$count = get_count_work($work_id);
break;
case 'get_exercise_results':
require_once api_get_path(SYS_CODE_PATH).'exercice/exercise.lib.php';
case 'get_work_user_list_others':
require_once api_get_path(SYS_CODE_PATH).'work/work.lib.php';
$work_id = $_REQUEST['work_id'];
$count = get_count_work($work_id, api_get_user_id());
break;
case 'get_work_user_list':
require_once api_get_path(SYS_CODE_PATH).'work/work.lib.php';
$work_id = $_REQUEST['work_id'];
$count = get_count_work($work_id, null, api_get_user_id());
break;
case 'get_exercise_results':
require_once api_get_path(SYS_CODE_PATH).'exercice/exercise.lib.php';
$exercise_id = $_REQUEST['exerciseId'];
if (isset($_GET['filter_by_user']) && !empty($_GET['filter_by_user'])) {
@ -147,13 +163,13 @@ switch ($action) {
$where_condition .= " AND te.exe_user_id = '$filter_user'";
}
}
$count = get_count_exam_results($exercise_id, $where_condition);
break;
case 'get_hotpotatoes_exercise_results':
require_once api_get_path(SYS_CODE_PATH).'exercice/exercise.lib.php';
$count = get_count_exam_results($exercise_id, $where_condition);
break;
case 'get_hotpotatoes_exercise_results':
require_once api_get_path(SYS_CODE_PATH).'exercice/exercise.lib.php';
$hotpot_path = $_REQUEST['path'];
$count = get_count_exam_hotpotatoes_results($hotpot_path);
break;
$count = get_count_exam_hotpotatoes_results($hotpot_path);
break;
case 'get_sessions':
$count = SessionManager::get_count_admin();
break;
@ -294,12 +310,30 @@ switch ($action) {
}
}
break;
case 'get_work_user_list_all':
if (isset($_GET['type']) && $_GET['type'] == 'simple') {
$columns = array('type', 'firstname', 'lastname', 'username', 'title', 'qualification', 'sent_date', 'qualificator_id', 'actions');
} else {
$columns = array('type', 'firstname', 'lastname', 'username', 'title', 'sent_date', 'actions');
}
$result = get_work_user_list($start, $limit, $sidx, $sord, $work_id, $where_condition);
break;
case 'get_work_user_list_others':
if (isset($_GET['type']) && $_GET['type'] == 'simple') {
$columns = array('type', 'firstname', 'lastname', 'username', 'title', 'qualification', 'sent_date', 'qualificator_id', 'actions');
} else {
$columns = array('type', 'firstname', 'lastname', 'username', 'title', 'sent_date', 'actions');
}
$where_condition .= " AND u.user_id <> ".api_get_user_id();
$result = get_work_user_list($start, $limit, $sidx, $sord, $work_id, $where_condition);
break;
case 'get_work_user_list':
if (isset($_GET['type']) && $_GET['type'] == 'simple') {
$columns = array('type', 'firstname', 'lastname', 'username', 'title', 'qualification', 'sent_date', 'qualificator_id', 'actions');
} else {
$columns = array('type', 'firstname', 'lastname', 'username', 'title', 'sent_date', 'actions');
}
$where_condition .= " AND u.user_id = ".api_get_user_id();
$result = get_work_user_list($start, $limit, $sidx, $sord, $work_id, $where_condition);
break;
case 'get_exercise_results':
@ -540,24 +574,27 @@ switch ($action) {
exit;
}
$allowed_actions = array('get_careers',
'get_promotions',
'get_usergroups',
'get_usergroups_teacher',
'get_gradebooks',
'get_sessions',
'get_exercise_results',
'get_hotpotatoes_exercise_results',
'get_work_user_list',
'get_timelines',
'get_grade_models',
'get_event_email_template',
'get_user_skill_ranking',
//'get_extra_fields',
//'get_extra_field_options',
//'get_course_exercise_medias',
'get_user_course_report',
'get_user_course_report_resumed'
$allowed_actions = array(
'get_careers',
'get_promotions',
'get_usergroups',
'get_usergroups_teacher',
'get_gradebooks',
'get_sessions',
'get_exercise_results',
'get_hotpotatoes_exercise_results',
'get_work_user_list',
'get_work_user_list_others',
'get_work_user_list_all',
'get_timelines',
'get_grade_models',
'get_event_email_template',
'get_user_skill_ranking',
//'get_extra_fields',
//'get_extra_field_options',
//'get_course_exercise_medias',
'get_user_course_report',
'get_user_course_report_resumed'
);
//5. Creating an obj to return a json

@ -116,4 +116,3 @@ foreach ($workPerUser as $work) {
echo $table->toHtml();
Display :: display_footer();

@ -454,7 +454,6 @@ function display_student_publications_list($id, $my_folder_data, $work_parents,
$qualification_exists = true;
}
$edit_dir = isset($_GET['edit_dir']) ? $_GET['edit_dir'] : '';
$table_header = array();
@ -467,22 +466,23 @@ function display_student_publications_list($id, $my_folder_data, $work_parents,
$table_header[] = array(get_lang('LastName'), true);
}
//$table_header[] = array(get_lang('Date'), true, 'style="width:200px"');
$table_header[] = array(get_lang('HandOutDateLimit'), true, 'style="width:200px"');
if ($is_allowed_to_edit) {
$table_header[] = array(get_lang('HandedOut'), false);
$table_header[] = array(get_lang('Actions'), false, 'style="width:90px"', array('class'=>'td_actions'));
$table_has_actions_column = true;
} else {
//$table_header[] = array(get_lang('HandedOutDate'), false);
}
if ($qualification_exists) {
$table_header[] = array(get_lang('Qualification'), true);
}
if ($qualification_exists) {
$table_header[] = array(get_lang('Qualification'), true);
}
} else {
// All users
if ($course_info['show_score'] == 0) {
$table_header[] = array(get_lang('Others'), false);
}
}
$table_data = array();
@ -802,14 +802,18 @@ function display_student_publications_list($id, $my_folder_data, $work_parents,
$session_id = api_get_session_id();
if (api_is_allowed_to_edit()) {
$sql_document = "SELECT count(*)
$cant_files = get_count_work($work_data['id']);
/*$sql_document = "SELECT count(*)
FROM $work_table w INNER JOIN $user_table u ON w.user_id = u.user_id
WHERE w.c_id = $course_id AND w.parent_id = ".$work_data['id']." AND w.active IN (0, 1)";
WHERE w.c_id = $course_id AND w.parent_id = ".$work_data['id']." AND w.active IN (0, 1)";*/
} else {
$cant_files = get_count_work($work_data['id'], api_get_user_id());
/*
$user_filter = "user_id = ".api_get_user_id()." AND ";
if ($course_info['show_score'] == 0) {
$user_filter = null;
}
$sql_document = "SELECT count(*) FROM $work_table s, $iprop_table p
WHERE s.c_id = $course_id AND
p.c_id = $course_id AND
@ -819,15 +823,14 @@ function display_student_publications_list($id, $my_folder_data, $work_parents,
$user_filter
parent_id = ".$work_data['id']." AND
active = 1 AND
parent_id = ".$work_parent->id."";
parent_id = ".$work_parent->id."";*/
}
//count documents
$res_document = Database::query($sql_document);
/*$res_document = Database::query($sql_document);
$count_document = Database::fetch_row($res_document);
$cant_files = $count_document[0];
$cant_files = $count_document[0];*/
$cant_files_per_user = getUniqueStudentAttempts($work_data['id'], $course_id);
$text_file = get_lang('FilesUpload');
@ -866,7 +869,13 @@ function display_student_publications_list($id, $my_folder_data, $work_parents,
$zip = '<a href="downloadfolder.inc.php?id='.$work_data['id'].'">'.Display::return_icon('save_pack.png', get_lang('Save'), array('style' => 'float:right;'), ICON_SIZE_SMALL).'</a>';
}
//}
$url = $zip.'<a href="'.api_get_self().'?'.api_get_cidreq().'&origin='.$origin.'&gradebook='.Security::remove_XSS($_GET['gradebook']).'&id='.$work_data['id'].'"'.$class.'>'.
$link = 'work_list.php';
if (api_is_allowed_to_edit()) {
$link = 'work_list_all.php';
}
$url = $zip.'<a href="'.api_get_path(WEB_CODE_PATH).'work/'.$link.'?'.api_get_cidreq().'&origin='.$origin.'&gradebook='.Security::remove_XSS($_GET['gradebook']).'&id='.$work_data['id'].'"'.$class.'>'.
$work_title.'</a> '.$add_to_name.'<br />'.$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";

@ -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;
?>
<script>
$(function() {
<?php
echo Display::grid_js('results', $url, $columns, $column_model, $extra_params);
?>
});
</script>
<?php
echo Display::grid_html('results');
} elseif (isset($_GET['list']) && $_GET['list'] == 'without') {
//User with no works
display_list_users_without_publication($work_id);

@ -0,0 +1,103 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
$language_file = array('exercice', 'work', 'document', 'admin', 'gradebook');
require_once '../inc/global.inc.php';
$current_course_tool = TOOL_STUDENTPUBLICATION;
/* Configuration settings */
api_protect_course_script(true);
// Including necessary files
require_once 'work.lib.php';
$this_section = SECTION_COURSES;
$workId = isset($_GET['id']) ? intval($_GET['id']) : null;
if (empty($workId)) {
api_not_allowed(true);
}
$tool_name = get_lang('StudentPublications');
$group_id = api_get_group_id();
$courseInfo = api_get_course_info();
if ($courseInfo['show_score'] == 1) {
api_not_allowed(true);
}
$htmlHeadXtra[] = api_get_jqgrid_js();
Display :: display_header(null);
echo '<div class="actions">';
echo '<a href="'.api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq().'&origin='.$origin.'&gradebook='.$gradebook.'">'.Display::return_icon('back.png', get_lang('BackToWorksList'),'',ICON_SIZE_MEDIUM).'</a>';
echo '</div>';
// 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;
?>
<script>
$(function() {
<?php
echo Display::grid_js('results', $url, $columns, $column_model, $extra_params);
?>
});
</script>
<?php
echo Display::grid_html('results');
Display :: display_footer();

@ -0,0 +1,105 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
$language_file = array('exercice', 'work', 'document', 'admin', 'gradebook');
require_once '../inc/global.inc.php';
$current_course_tool = TOOL_STUDENTPUBLICATION;
/* Configuration settings */
api_protect_course_script(true);
// Including necessary files
require_once 'work.lib.php';
$this_section = SECTION_COURSES;
$workId = isset($_GET['id']) ? intval($_GET['id']) : null;
if (empty($workId)) {
api_not_allowed(true);
}
if (!api_is_allowed_to_edit()) {
api_not_allowed(true);
}
$tool_name = get_lang('StudentPublications');
$group_id = api_get_group_id();
$courseInfo = api_get_course_info();
if ($courseInfo['show_score'] == 1) {
api_not_allowed(true);
}
$htmlHeadXtra[] = api_get_jqgrid_js();
Display :: display_header(null);
echo '<div class="actions">';
echo '<a href="'.api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq().'&origin='.$origin.'&gradebook='.$gradebook.'">'.Display::return_icon('back.png', get_lang('BackToWorksList'),'',ICON_SIZE_MEDIUM).'</a>';
echo '</div>';
// 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;
?>
<script>
$(function() {
<?php
echo Display::grid_js('results', $url, $columns, $column_model, $extra_params);
?>
});
</script>
<?php
echo Display::grid_html('results');
Display :: display_footer();

@ -0,0 +1,107 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
$language_file = array('exercice', 'work', 'document', 'admin', 'gradebook');
require_once '../inc/global.inc.php';
$current_course_tool = TOOL_STUDENTPUBLICATION;
/* Configuration settings */
api_protect_course_script(true);
// Including necessary files
require_once 'work.lib.php';
$this_section = SECTION_COURSES;
$workId = isset($_GET['id']) ? intval($_GET['id']) : null;
if (empty($workId)) {
api_not_allowed(true);
}
$my_folder_data = get_work_data_by_id($workId);
$tool_name = get_lang('StudentPublications');
$group_id = api_get_group_id();
$courseInfo = api_get_course_info();
if ($courseInfo['show_score'] == 1) {
api_not_allowed(true);
}
$htmlHeadXtra[] = api_get_jqgrid_js();
Display :: display_header(null);
echo '<div class="actions">';
echo '<a href="'.api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq().'&origin='.$origin.'&gradebook='.$gradebook.'">'.Display::return_icon('back.png', get_lang('BackToWorksList'),'',ICON_SIZE_MEDIUM).'</a>';
echo '</div>';
if (!empty($my_folder_data['description'])) {
echo '<p><div><strong>'.get_lang('Description').':</strong><p>'.Security::remove_XSS($my_folder_data['description'], STUDENT).'</p></div></p>';
}
// 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['sortname'] = 'firstname';
$url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_work_user_list_others&work_id='.$workId.'&type='.$type;
?>
<script>
$(function() {
<?php
echo Display::grid_js('results', $url, $columns, $column_model, $extra_params);
?>
});
</script>
<?php
echo Display::grid_html('results');
Display :: display_footer();
Loading…
Cancel
Save