Improving UI for the work tool see BT#6418

1.9.x
Julio Montoya 11 years ago
parent 4187d9034c
commit 96007fec70
  1. 8
      main/inc/ajax/model.ajax.php
  2. 53
      main/inc/lib/course.lib.php
  3. 20
      main/work/downloadfolder.inc.php
  4. 244
      main/work/edit.php
  5. 21
      main/work/student_work.php
  6. 332
      main/work/upload.php
  7. 88
      main/work/work.lib.php
  8. 403
      main/work/work.php
  9. 45
      main/work/work_list.php
  10. 42
      main/work/work_list_all.php
  11. 34
      main/work/work_list_others.php

@ -149,7 +149,13 @@ switch ($action) {
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());
$courseInfo = api_get_course_info();
// All
if ($courseInfo['show_score'] == '0') {
$count = get_count_work($work_id, null, api_get_user_id());
} else {
$count = get_count_work($work_id, api_get_user_id());
}
break;
case 'get_exercise_results':
require_once api_get_path(SYS_CODE_PATH).'exercice/exercise.lib.php';

@ -17,50 +17,6 @@
* @package chamilo.library
*/
/**
DOCUMENTATION
(list not up to date, you can auto generate documentation with phpDocumentor)
CourseManager::get_real_course_code_select_html($element_name, $has_size=true, $only_current_user_courses=true)
CourseManager::check_parameter($parameter, $error_message)
CourseManager::check_parameter_or_fail($parameter, $error_message)
CourseManager::course_code_exists($wanted_course_code)
CourseManager::get_real_course_list()
CourseManager::get_virtual_course_list()
GENERAL COURSE FUNCTIONS
CourseManager::get_access_settings($course_code)
CourseManager::set_course_tool_visibility($tool_table_id, $visibility)
CourseManager::get_user_in_course_status($user_id, $course_code)
CourseManager::add_user_to_course($user_id, $course_code)
CourseManager::get_virtual_course_info($real_course_code)
CourseManager::is_virtual_course_from_visual_code($visual_code)
CourseManager::is_virtual_course_from_system_code($system_code)
CourseManager::get_virtual_courses_linked_to_real_course($real_course_code)
CourseManager::get_list_of_virtual_courses_for_specific_user_and_real_course($user_id, $real_course_code)
CourseManager::has_virtual_courses_from_code($real_course_code, $user_id)
CourseManager::get_target_of_linked_course($virtual_course_code)
TITLE AND CODE FUNCTIONS
CourseManager::create_combined_name($user_is_registered_in_real_course, $real_course_name, $virtual_course_list)
CourseManager::create_combined_code($user_is_registered_in_real_course, $real_course_code, $virtual_course_list)
USER FUNCTIONS
CourseManager::get_real_course_list_of_user_as_course_admin($user_id)
CourseManager::get_course_list_of_user_as_course_admin($user_id)
CourseManager::is_user_subscribed_in_course($user_id, $course_code)
CourseManager::is_user_subscribed_in_real_or_linked_course($user_id, $course_code)
CourseManager::get_user_list_from_course_code($course_code)
CourseManager::get_real_and_linked_user_list($course_code);
GROUP FUNCTIONS
CourseManager::get_group_list_of_course($course_code)
CREATION FUNCTIONS
CourseManager::attempt_create_virtual_course($real_course_code, $course_title, $wanted_course_code, $course_language, $course_category)
*/
/* INIT SECTION */
require_once api_get_path(CONFIGURATION_PATH).'add_course.conf.php';
@ -1069,7 +1025,7 @@ class CourseManager {
*
* @return true if the user is registered in the real course or linked courses, false otherwise
*/
public static function is_user_subscribed_in_real_or_linked_course ($user_id, $course_code, $session_id = '') {
public static function is_user_subscribed_in_real_or_linked_course($user_id, $course_code, $session_id = '') {
if ($user_id != strval(intval($user_id))) {
return false;
@ -1223,7 +1179,7 @@ class CourseManager {
}
if ($return_count && $resumed_report) {
$sql .= ' AND field_id IS NOT NULL GROUP BY field_value ';
$sql .= ' AND field_id IS NOT NULL GROUP BY field_value ';
}
$sql .= ' '.$order_by.' '.$limit;
@ -1362,7 +1318,7 @@ class CourseManager {
$session_id = intval($session_id);
$course_code = Database::escape_string($course_code);
$sql .= 'SELECT DISTINCT count(*) as count FROM '.Database::get_main_table(TABLE_MAIN_USER).' as user ';
$sql = 'SELECT DISTINCT count(*) as count FROM '.Database::get_main_table(TABLE_MAIN_USER).' as user ';
$where = array();
if (!empty($session_id)) {
$sql .= ' LEFT JOIN '.Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER).' as session_course_user
@ -1682,8 +1638,7 @@ class CourseManager {
ON (g.id = gu.group_id AND g.c_id = $course_id AND gu.c_id = $course_id)
$session_condition
ORDER BY g.name";
}
else {
} else {
// get all groups even if they are empty
$sql = "SELECT g.id, g.name
FROM ".Database::get_course_table(TABLE_GROUP)." AS g

@ -17,6 +17,7 @@ api_protect_course_script(true);
require_once 'work.lib.php';
$work_data = get_work_data_by_id($work_id);
$groupId = api_get_group_id();
if (empty($work_data)) {
exit;
}
@ -53,15 +54,19 @@ $course_id = api_get_course_int_id();
if (api_is_allowed_to_edit()) {
//Search for all files that are not deleted => visibility != 2
$sql = "SELECT url, title, description, insert_user_id, insert_date, contains_file
$sql = "SELECT DISTINCT url, title, description, insert_user_id, insert_date, contains_file
FROM $tbl_student_publication AS work INNER JOIN $prop_table AS props
ON (props.c_id = $course_id AND
ON (
props.c_id = $course_id AND
work.c_id = $course_id AND
work.id = props.ref)
work.id = props.ref
)
WHERE props.tool='work' AND
work.parent_id = $work_id AND
work.filetype = 'file' AND
props.visibility<>'2' ";
props.visibility<>'2' AND
work.post_group_id = $groupId
";
} else {
$courseInfo = api_get_course_info();
@ -76,7 +81,7 @@ if (api_is_allowed_to_edit()) {
}
//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
$sql = "SELECT DISTINCT url, title, description, insert_user_id, insert_date, contains_file
FROM $tbl_student_publication AS work INNER JOIN $prop_table AS props
ON (props.c_id = $course_id AND
work.c_id = $course_id AND
@ -84,13 +89,14 @@ if (api_is_allowed_to_edit()) {
WHERE
props.tool='work' AND
work.accepted = 1 AND
work.active = 1 AND
work.parent_id = $work_id AND
work.filetype='file' AND
props.visibility = '1'
props.visibility = '1' AND
work.post_group_id = $groupId
$userCondition
";
}
$query = Database::query($sql);
//add tem to the zip file

@ -0,0 +1,244 @@
<?php
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';
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';
$this_section = SECTION_COURSES;
$work_id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : null;
$item_id = isset($_REQUEST['item_id']) ? intval($_REQUEST['item_id']) : null;
$work_table = Database :: get_course_table(TABLE_STUDENT_PUBLICATION);
$is_allowed_to_edit = api_is_allowed_to_edit();
$course_id = api_get_course_int_id();
$user_id = api_get_user_id();
$session_id = api_get_session_id();
$course_code = api_get_course_id();
$course_info = api_get_course_info();
if (empty($work_id) || empty($item_id)) {
api_not_allowed(true);
}
$parent_data = $my_folder_data = get_work_data_by_id($work_id);
if (empty($parent_data)) {
api_not_allowed(true);
}
$is_course_member = CourseManager::is_user_subscribed_in_real_or_linked_course($user_id, $course_code, $session_id);
$is_course_member = $is_course_member || api_is_platform_admin();
if ($is_course_member == false) {
api_not_allowed(true);
}
$check = Security::check_token('post');
$token = Security::get_token();
$student_can_edit_in_session = api_is_allowed_to_session_edit(false, true);
$has_ended = false;
$is_author = false;
$work_item = get_work_data_by_id($item_id);
//Get the author ID for that document from the item_property table
$is_author = user_is_author($item_id);
if (!$is_author) {
Display::display_warning_message(get_lang('NotAllowed'));
Display::display_footer();
}
if (!empty($my_folder_data)) {
$homework = get_work_assignment_by_id($my_folder_data['id']);
if ($homework['expires_on'] != '0000-00-00 00:00:00' || $homework['ends_on'] != '0000-00-00 00:00:00') {
$time_now = time();
if (!empty($homework['expires_on']) && $homework['expires_on'] != '0000-00-00 00:00:00') {
$time_expires = api_strtotime($homework['expires_on'], 'UTC');
$difference = $time_expires - $time_now;
if ($difference < 0) {
$has_expired = true;
}
}
if (empty($homework['expires_on']) || $homework['expires_on'] == '0000-00-00 00:00:00') {
$has_expired = false;
}
if (!empty($homework['ends_on']) && $homework['ends_on'] != '0000-00-00 00:00:00') {
$time_ends = api_strtotime($homework['ends_on'], 'UTC');
$difference2 = $time_ends - $time_now;
if ($difference2 < 0) {
$has_ended = true;
}
}
$ends_on = api_convert_and_format_date($homework['ends_on']);
$expires_on = api_convert_and_format_date($homework['expires_on']);
}
}
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq(), 'name' => get_lang('StudentPublications'));
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'work/work_list.php?'.api_get_cidreq().'&id='.$work_id, 'name' => $parent_data['title']);
// form title
$form_title = get_lang('Edit');
$interbreadcrumb[] = array('url' => '#', 'name' => $form_title);
$form = new FormValidator('form', 'POST', api_get_self()."?".api_get_cidreq()."&id=".$work_id."&gradebook=".Security::remove_XSS($_GET['gradebook'])."&origin=$origin", '', array('enctype' => "multipart/form-data"));
$form->addElement('header', $form_title);
$show_progress_bar = false;
if ($submitGroupWorkUrl) {
// For user comming from group space to publish his work
$realUrl = str_replace($_configuration['root_sys'], api_get_path(WEB_PATH), str_replace("\\", '/', realpath($submitGroupWorkUrl)));
$form->addElement('hidden', 'newWorkUrl', $submitGroupWorkUrl);
$text_document = $form->addElement('text', 'document', get_lang('Document'));
$defaults['document'] = '<a href="' . format_url($submitGroupWorkUrl) . '">' . $realUrl . '</a>';
$text_document->freeze();
} elseif ($item_id && ($is_allowed_to_edit or $is_author)) {
$workUrl = $currentCourseRepositoryWeb . $workUrl;
}
$form->addElement('hidden', 'id', $work_id);
$form->addElement('hidden', 'item_id', $item_id);
$form->addElement('text', 'title', get_lang('Title'), array('id' => 'file_upload', 'class' => 'span4'));
$form->add_html_editor('description', get_lang('Description'), false, false, array('ToolbarSet' => 'Work', 'Width' => '100%', 'Height' => '200'));
$defaults['title'] = $work_item['title'];
$defaults["description"] = $work_item['description'];
$defaults['qualification'] = $work_item['qualification'];
if ($is_allowed_to_edit && !empty($item_id)) {
// Get qualification from parent_id that'll allow the validation qualification over
$sql = "SELECT qualification FROM $work_table WHERE c_id = $course_id AND id ='$work_id' ";
$result = Database::query($sql);
$row = Database::fetch_array($result);
$qualification_over = $row['qualification'];
if (!empty($qualification_over) && intval($qualification_over) > 0) {
$form->addElement('text', 'qualification', array(get_lang('Qualification'), null, " / ".$qualification_over), 'size="10"');
$form->addElement('hidden', 'qualification_over', $qualification_over);
}
}
$form->addElement('hidden', 'active', 1);
$form->addElement('hidden', 'accepted', 1);
$form->addElement('hidden', 'item_to_edit', $item_id);
$form->addElement('hidden', 'sec_token', $token);
$text = get_lang('UpdateWork');
$class = 'save';
// fix the Ok button when we see the tool in the learn path
$form->addElement('style_submit_button', 'editWork', $text, array('class'=> $class, 'value' => "editWork"));
$form->setDefaults($defaults);
$error_message = null;
$_course = api_get_course_info();
$currentCourseRepositorySys = api_get_path(SYS_COURSE_PATH).$_course['path'] . '/';
$succeed = false;
if ($form->validate()) {
if ($student_can_edit_in_session && $check) {
if (isset($_POST['editWork'])) {
/*
* SPECIAL CASE ! For a work edited
*/
//Get the author ID for that document from the item_property table
$item_to_edit_id = intval($_POST['item_to_edit']);
$is_author = user_is_author($item_to_edit_id);
if ($is_author) {
$work_data = get_work_data_by_id($item_to_edit_id);
if (!empty($_POST['title']))
$title = isset($_POST['title']) ? $_POST['title'] : $work_data['title'];
$description = isset($_POST['description']) ? $_POST['description'] : $work_data['description'];
if ($is_allowed_to_edit && ($_POST['qualification'] !='' )) {
$add_to_update = ', qualificator_id ='."'".api_get_user_id()."',";
$add_to_update .= ' qualification = '."'".Database::escape_string($_POST['qualification'])."',";
$add_to_update .= ' date_of_qualification ='."'".api_get_utc_datetime()."'";
}
if ((int)$_POST['qualification'] > (int)$_POST['qualification_over']) {
Display::display_error_message(get_lang('QualificationMustNotBeMoreThanQualificationOver'));
} else {
$sql = "UPDATE " . $work_table . "
SET title = '" . Database::escape_string($title) . "',
description = '" . Database::escape_string($description) . "'
".$add_to_update."
WHERE c_id = $course_id AND id = $item_to_edit_id";
Database::query($sql);
}
api_item_property_update($_course, 'work', $item_to_edit_id, 'DocumentUpdated', $user_id);
$succeed = true;
$error_message .= Display::return_message(get_lang('ItemUpdated'), false);
} else {
$error_message .= Display::return_message(get_lang('IsNotPosibleSaveTheDocument'), 'error');
}
} else {
$error_message .= Display::return_message(get_lang('IsNotPosibleSaveTheDocument'), 'error');
}
Security::clear_token();
} else {
//Bad token or can't add works
$error_message = Display::return_message(get_lang('IsNotPosibleSaveTheDocument'), 'error');
}
$script = 'work_list.php';
if ($is_allowed_to_edit) {
$script = 'work_list_all.php';
}
header('Location: '.api_get_path(WEB_CODE_PATH).'work/'.$script.'?'.api_get_cidreq().'&id='.$work_id.'&error_message='.$error_message);
exit;
}
$htmlHeadXtra[] = to_javascript_work();
Display :: display_header(null);
if (!empty($work_id)) {
if ($is_allowed_to_edit) {
if (api_resource_is_locked_by_gradebook($work_id, LINK_STUDENTPUBLICATION)) {
echo Display::display_warning_message(get_lang('ResourceLockedByGradebook'));
} else {
$form->display();
}
} elseif ($is_author) {
if (empty($work_item['qualificator_id']) || $work_item['qualificator_id'] == 0) {
$form->display();
} else {
Display::display_error_message(get_lang('ActionNotAllowed'));
}
} elseif ($student_can_edit_in_session && $has_ended == false) {
$form->display();
} else {
Display::display_error_message(get_lang('ActionNotAllowed'));
}
} else {
Display::display_error_message(get_lang('ActionNotAllowed'));
}
Display :: display_footer();

@ -22,10 +22,16 @@ $studentId = isset($_GET['studentId']) ? intval($_GET['studentId']) : null;
if (empty($studentId)) {
api_not_allowed(true);
}
$tool_name = get_lang('StudentPublications');
$tool_name = get_lang('StudentPublications');
$group_id = api_get_group_id();
$userInfo = api_get_user_info($studentId);
if (empty($userInfo)) {
api_not_allowed(true);
}
if (!empty($group_id)) {
$group_properties = GroupManager :: get_group_properties($group_id);
$show_work = false;
@ -38,14 +44,20 @@ if (!empty($group_id)) {
}
if (!$show_work) {
api_not_allowed(true);
api_not_allowed();
}
$interbreadcrumb[] = array ('url' => '../group/group.php', 'name' => get_lang('Groups'));
$interbreadcrumb[] = array ('url' => '../group/group_space.php?gidReq='.$group_id, 'name' => get_lang('GroupSpace').' '.$group_properties['name']);
} else {
if (!api_is_course_admin()) {
api_not_allowed(true);
}
}
$interbreadcrumb[] = array ('url' => api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq(), 'name' => get_lang('StudentPublications'));
$interbreadcrumb[] = array ('url' => '#', 'name' => $userInfo['complete_name']);
Display :: display_header(null);
echo '<div class="actions">';
@ -72,9 +84,8 @@ foreach ($workPerUser as $work) {
$workExtraData = get_work_assignment_by_id($workId);
foreach ($work->user_results as $userResult) {
//var_dump($userResult);
$table->setCellContents($row, $column, $work->title.' ['.strip_tags($userResult['title']).']');
$table->setCellAttributes($row, $column, array('width' => '200px'));
$table->setCellAttributes($row, $column, array('width' => '300px'));
$column++;
$table->setCellContents($row, $column, $userResult['sent_date']);
$column++;
@ -103,7 +114,7 @@ foreach ($workPerUser as $work) {
$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;
$url = api_get_path(WEB_CODE_PATH).'work/edit.php?'.api_get_cidreq().'&item_id='.$userResult['id'].'&id='.$workId.'&parent_id='.$workId;
$links .= Display::url(Display::return_icon('edit.png'), $url);
$table->setCellContents($row, $column, $links);

@ -0,0 +1,332 @@
<?php
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';
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';
$this_section = SECTION_COURSES;
$work_id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : null;
$work_table = Database :: get_course_table(TABLE_STUDENT_PUBLICATION);
$is_allowed_to_edit = api_is_allowed_to_edit();
$course_id = api_get_course_int_id();
$user_id = api_get_user_id();
$session_id = api_get_session_id();
$course_code = api_get_course_id();
$course_info = api_get_course_info();
$group_id = api_get_group_id();
if (empty($work_id)) {
api_not_allowed(true);
}
$parent_data = $my_folder_data = get_work_data_by_id($work_id);
if (empty($parent_data)) {
api_not_allowed(true);
}
$is_course_member = CourseManager::is_user_subscribed_in_real_or_linked_course($user_id, $course_code, $session_id);
$is_course_member = $is_course_member || api_is_platform_admin();
if ($is_course_member == false) {
api_not_allowed(true);
}
$check = Security::check_token('post');
$token = Security::get_token();
$student_can_edit_in_session = api_is_allowed_to_session_edit(false, true);
$has_ended = false;
$is_author = false;
$parent_data['qualification'] = intval($parent_data['qualification']);
if (!empty($parent_data) && !empty($parent_data['qualification'])) {
$count = get_work_count_by_student($user_id, $work_id);
if ($count >= 1) {
Display::display_header();
if (api_get_course_setting('student_delete_own_publication') == '1') {
Display::display_warning_message(get_lang('CantUploadDeleteYourPaperFirst'));
} else {
Display::display_warning_message(get_lang('YouAlreadySentAPaperYouCantUpload'));
}
Display::display_footer();
exit;
}
}
if (!empty($my_folder_data)) {
$homework = get_work_assignment_by_id($my_folder_data['id']);
if ($homework['expires_on'] != '0000-00-00 00:00:00' || $homework['ends_on'] != '0000-00-00 00:00:00') {
$time_now = time();
if (!empty($homework['expires_on']) && $homework['expires_on'] != '0000-00-00 00:00:00') {
$time_expires = api_strtotime($homework['expires_on'], 'UTC');
$difference = $time_expires - $time_now;
if ($difference < 0) {
$has_expired = true;
}
}
if (empty($homework['expires_on']) || $homework['expires_on'] == '0000-00-00 00:00:00') {
$has_expired = false;
}
if (!empty($homework['ends_on']) && $homework['ends_on'] != '0000-00-00 00:00:00') {
$time_ends = api_strtotime($homework['ends_on'], 'UTC');
$difference2 = $time_ends - $time_now;
if ($difference2 < 0) {
$has_ended = true;
}
}
$ends_on = api_convert_and_format_date($homework['ends_on']);
$expires_on = api_convert_and_format_date($homework['expires_on']);
}
}
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq(), 'name' => get_lang('StudentPublications'));
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'work/work_list.php?'.api_get_cidreq().'&id='.$work_id, 'name' => $parent_data['title']);
// form title
$form_title = get_lang('UploadADocument');
$interbreadcrumb[] = array('url' => '#', 'name' => $form_title);
$form = new FormValidator('form', 'POST', api_get_self()."?".api_get_cidreq()."&id=".$work_id."&gradebook=".Security::remove_XSS($_GET['gradebook'])."&origin=$origin", '', array('enctype' => "multipart/form-data"));
$form->addElement('header', $form_title);
$show_progress_bar = false;
if ($submitGroupWorkUrl) {
// For user comming from group space to publish his work
$realUrl = str_replace($_configuration['root_sys'], api_get_path(WEB_PATH), str_replace("\\", '/', realpath($submitGroupWorkUrl)));
$form->addElement('hidden', 'newWorkUrl', $submitGroupWorkUrl);
$text_document = $form->addElement('text', 'document', get_lang('Document'));
$defaults['document'] = '<a href="' . format_url($submitGroupWorkUrl) . '">' . $realUrl . '</a>';
$text_document->freeze();
} else {
// else standard upload option
$form->addElement('file', 'file', get_lang('UploadADocument'), 'size="40" onchange="updateDocumentTitle(this.value)"');
$show_progress_bar = true;
}
$form->addElement('hidden', 'id', $work_id);
$form->addElement('hidden', 'contains_file', 0, array('id'=>'contains_file_id'));
$form->addElement('text', 'title', get_lang('Title'), array('id' => 'file_upload', 'class' => 'span4'));
//$form->addElement('html_editor', 'description', get_lang("Description"));
$form->add_html_editor('description', get_lang('Description'), false, false, array('ToolbarSet' => 'Work', 'Width' => '100%', 'Height' => '200'));
$form->addElement('hidden', 'active', 1);
$form->addElement('hidden', 'accepted', 1);
$form->addElement('hidden', 'sec_token', $token);
$text = get_lang('Send');
$class = 'upload';
// fix the Ok button when we see the tool in the learn path
if ($origin == 'learnpath') {
$form->addElement('html', '<div style="margin-left:137px">');
$form->addElement('style_submit_button', 'submitWork', $text, array('class'=> $class, 'value' => "submitWork"));
$form->addElement('html', '</div>');
} else {
$form->addElement('style_submit_button', 'submitWork', $text, array('class'=> $class, 'value' => "submitWork"));
}
if (!empty($_POST['submitWork']) || $item_id) {
$form->addElement('style_submit_button', 'cancelForm', get_lang('Cancel'), 'class="cancel"');
}
if ($show_progress_bar) {
$form->add_real_progress_bar('uploadWork', 'file');
}
$form->setDefaults($defaults);
$error_message = null;
$_course = api_get_course_info();
$currentCourseRepositorySys = api_get_path(SYS_COURSE_PATH).$_course['path'] . '/';
$succeed = false;
if ($form->validate()) {
if ($student_can_edit_in_session && $check) {
//check the token inserted into the form
if (isset($_POST['submitWork'])) {
$url = null;
$contains_file = 0;
if ($_POST['contains_file'] && !empty($_FILES['file']['size'])) {
$updir = $currentCourseRepositorySys . 'work/'; //directory path to upload
// Try to add an extension to the file if it has'nt one
$new_file_name = add_ext_on_mime(stripslashes($_FILES['file']['name']), $_FILES['file']['type']);
// Replace dangerous characters
$new_file_name = replace_dangerous_char($new_file_name, 'strict');
// Transform any .php file in .phps fo security
$new_file_name = php2phps($new_file_name);
$filesize = filesize($_FILES['file']['tmp_name']);
if (empty($filesize)) {
$error_message .= Display :: return_message(get_lang('UplUploadFailedSizeIsZero'), 'error');
$succeed = false;
} elseif (!filter_extension($new_file_name)) {
//filter extension
$error_message .= Display :: return_message(get_lang('UplUnableToSaveFileFilteredExtension'), 'error');
$succeed = false;
}
if (!$title) {
$title = $_FILES['file']['name'];
}
// Compose a unique file name to avoid any conflict
$new_file_name = api_get_unique_id();
$curdirpath = basename($my_folder_data['url']);
//if we come from the group tools the groupid will be saved in $work_table
$result = move_uploaded_file($_FILES['file']['tmp_name'], $updir.$curdirpath.'/'.$new_file_name);
if ($result) {
$url = 'work/'.$curdirpath.'/'.$new_file_name;
$contains_file = 1;
}
}
if (empty($title)) {
$title = get_lang('Untitled');
}
$documents_total_space = DocumentManager::documents_total_space();
$course_max_space = DocumentManager::get_course_quota();
$total_size = $filesize + $documents_total_space;
if ($total_size > $course_max_space) {
$error_message .= Display::return_message(get_lang('NoSpace'), 'warning');
} else {
$active = '1';
//author = '" . Database::escape_string($authors) . "',
$sql_add_publication = "INSERT INTO " . $work_table . " SET
c_id = $course_id ,
url = '" . $url . "',
title = '" . Database::escape_string($title) . "',
description = '" . Database::escape_string($description) . "',
contains_file = '".$contains_file."',
active = '" . $active . "',
accepted = '1',
post_group_id = '".$group_id."',
sent_date = '".api_get_utc_datetime()."',
parent_id = '".$work_id."' ,
session_id = '".intval($id_session)."' ,
user_id = '".$user_id."'";
//var_dump($sql_add_publication);exit;
Database::query($sql_add_publication);
$id = Database::insert_id();
}
if ($id) {
api_item_property_update($course_info, 'work', $id, 'DocumentAdded', $user_id, api_get_group_id());
$succeed = true;
}
} else {
$error_message .= Display::return_message(get_lang('IsNotPosibleSaveTheDocument'), 'error');
}
Security::clear_token();
} else {
//Bad token or can't add works
$error_message = Display::return_message(get_lang('IsNotPosibleSaveTheDocument'), 'error');
}
if (!empty($succeed) && !empty($id)) {
//last value is to check this is not "just" an edit
//YW Tis part serve to send a e-mail to the tutors when a new file is sent
$send = api_get_course_setting('email_alert_manager_on_new_doc');
if ($send > 0) {
// Lets predefine some variables. Be sure to change the from address!
if (empty($id_session)) {
//Teachers
$user_list = CourseManager::get_user_list_from_course_code(api_get_course_id(), null, null, null, COURSEMANAGER);
} else {
//Coaches
$user_list = CourseManager::get_user_list_from_course_code(api_get_course_id(), $session_id, null, null, 2);
}
$emailsubject = "[" . api_get_setting('siteName') . "] ".get_lang('SendMailBody')."\n".get_lang('CourseName')." : ".$_course['name']." ";
foreach ($user_list as $user_data) {
$to_user_id = $user_data['user_id'];
$emailbody = get_lang('SendMailBody')."\n".get_lang('CourseName')." : ".$_course['name']."\n";
$user_info = api_get_user_info($user_id);
$emailbody .= get_lang('UserName')." : ".api_get_person_name($user_info['firstname'], $user_info['lastname'])."\n";
$emailbody .= get_lang('DateSent')." : ".api_format_date(api_get_local_time())."\n";
$emailbody .= get_lang('WorkName')." : ".$title."\n\n".get_lang('DownloadLink')."\n";
$url = api_get_path(WEB_CODE_PATH)."work/work.php?".api_get_cidreq()."&amp;id=".$work_id;
$emailbody .= $url;
MessageManager::send_message_simple($to_user_id, $emailsubject, $emailbody);
}
}
$message = get_lang('DocAdd');
event_upload($id);
$error_message .= Display :: return_message(get_lang('DocAdd'));
$script = 'work_list.php';
if ($is_allowed_to_edit) {
$script = 'work_list_all.php';
}
header('Location: '.api_get_path(WEB_CODE_PATH).'work/'.$script.'?'.api_get_cidreq().'&id='.$work_id.'&error_message='.$error_message);
exit;
}
}
$htmlHeadXtra[] = to_javascript_work();
Display :: display_header(null);
if (!empty($work_id)) {
if ($is_allowed_to_edit) {
if (api_resource_is_locked_by_gradebook($work_id, LINK_STUDENTPUBLICATION)) {
echo Display::display_warning_message(get_lang('ResourceLockedByGradebook'));
} else {
$form->display();
}
} elseif ($is_author) {
if (empty($work_item['qualificator_id']) || $work_item['qualificator_id'] == 0) {
$form->display();
} else {
Display::display_error_message(get_lang('ActionNotAllowed'));
}
} elseif ($student_can_edit_in_session && $has_ended == false) {
$form->display();
} else {
Display::display_error_message(get_lang('ActionNotAllowed'));
}
} else {
Display::display_error_message(get_lang('ActionNotAllowed'));
}
Display :: display_footer();

@ -53,10 +53,7 @@ function display_action_links($id, $cur_dir_path, $show_tool_options, $display_u
}
}
if ($display_upload_link && api_is_allowed_to_session_edit(false, true) && !empty($id)) {
$display_output .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&id='.$id.'&action=upload_form&origin='.$origin.'&gradebook='.$gradebook.'">';
$display_output .= Display::return_icon('upload_file.png', get_lang('UploadADocument'),'',ICON_SIZE_MEDIUM).'</a>';
}
if (api_is_allowed_to_edit(null, true) && $origin != 'learnpath' && api_is_allowed_to_session_edit(false, true)) {
// Delete all files
@ -317,6 +314,7 @@ function getWorkList($id, $my_folder_data, $add_in_where_query)
$course_id = api_get_course_int_id();
$session_id = api_get_session_id();
$condition_session = api_get_session_condition($session_id);
$group_id = api_get_group_id();
$link_info = is_resource_in_course_gradebook(api_get_course_id(), 3 , $id, api_get_session_id());
$work_in_gradebook_link_id = $link_info['id'];
@ -334,11 +332,12 @@ function getWorkList($id, $my_folder_data, $add_in_where_query)
//Get list from database
if ($is_allowed_to_edit) {
$active_condition = ' active IN (0, 1)';
$sql_get_publications_list = "SELECT * FROM $work_table ".
" WHERE c_id = $course_id $add_in_where_query $condition_session AND $active_condition AND ".
" ( parent_id = 0) ".
" $contains_file_query ".
" ORDER BY sent_date DESC";
$sql_get_publications_list = "SELECT * FROM $work_table
WHERE c_id = $course_id $add_in_where_query $condition_session AND $active_condition AND (parent_id = 0) $contains_file_query ";
if (!empty($group_id)) {
$sql_get_publications_list .= " AND post_group_id = '".$group_id."' ";
}
$sql_get_publications_list .= " ORDER BY sent_date DESC";
} else {
if (!empty($group_id)) {
$group_query = " WHERE c_id = $course_id AND post_group_id = '".$group_id."' "; // set to select only messages posted by the user's group
@ -349,7 +348,7 @@ function getWorkList($id, $my_folder_data, $add_in_where_query)
}
//@todo how we can active or not an assignment?
$active_condition = ' AND active IN (1,0)';
$sql_get_publications_list = "SELECT * FROM $work_table $group_query $subdirs_query $add_in_where_query $active_condition $condition_session ORDER BY title";
$sql_get_publications_list = "SELECT * FROM $work_table $group_query $subdirs_query $add_in_where_query $active_condition $condition_session ORDER BY title";
}
$work_parents = array();
@ -379,18 +378,38 @@ function getWorkPerUser($userId)
return $result;
}
function getUniqueStudentAttempts($workId, $course_id, $userId = null)
/**
* @param int $workId
* @param int $course_id
* @param int $sessionId
* @param int $userId user id to filter
* @param array $onlyUserList only parse this user list
* @return mixed
*/
function getUniqueStudentAttempts($workId, $groupId, $course_id, $sessionId, $userId = null, $onlyUserList = array())
{
$work_table = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
$user_table = Database::get_main_table(TABLE_MAIN_USER);
$course_id = intval($course_id);
$workId = intval($workId);
$sessionId = intval($sessionId);
$groupId = intval($groupId);
$studentCondition = null;
if (!empty($onlyUserList)) {
$studentCondition = "AND u.user_id IN ('".implode("', '", $onlyUserList)."') ";
}
$sql_document = "SELECT count(*) FROM (
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 = ".$workId." AND w.active IN (0, 1)
WHERE w.c_id = $course_id AND
w.session_id = $sessionId AND
w.parent_id = ".$workId." AND
w.post_group_id = ".$groupId." AND
w.active IN (0, 1) $studentCondition
";
if (!empty($userId)) {
@ -401,6 +420,7 @@ function getUniqueStudentAttempts($workId, $course_id, $userId = null)
$res_document = Database::query($sql_document);
$rowCount = Database::fetch_row($res_document);
return $rowCount[0];
}
@ -410,7 +430,7 @@ function getUniqueStudentAttempts($workId, $course_id, $userId = null)
* @param $origin - typically empty or 'learnpath'
*/
function display_student_publications_list($id, $my_folder_data, $work_parents, $origin, $add_in_where_query = '', $countUsers = null)
function display_student_publications_list($id, $my_folder_data, $work_parents, $origin, $add_in_where_query = '', $userList = array())
{
global $gradebook;
@ -803,6 +823,7 @@ function display_student_publications_list($id, $my_folder_data, $work_parents,
if (api_is_allowed_to_edit()) {
$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)";*/
@ -826,12 +847,12 @@ function display_student_publications_list($id, $my_folder_data, $work_parents,
parent_id = ".$work_parent->id."";*/
}
//count documents
/*$res_document = Database::query($sql_document);
$count_document = Database::fetch_row($res_document);
$cant_files = $count_document[0];*/
$text_file = get_lang('FilesUpload');
if ($cant_files == 1) {
@ -884,20 +905,6 @@ function display_student_publications_list($id, $my_folder_data, $work_parents,
$row[] = '';
}
if ($direc_date != '' && $direc_date != '0000-00-00 00:00:00') {
$direc_date_local = api_get_local_time($direc_date);
//$row[] = date_to_str_ago($direc_date_local).'<br /><span class="dropbox_date">'.api_format_date($direc_date_local).'</span>';
} else {
$direc_date_local = '0000-00-00 00:00:00';
//$row[] = '';
}
/*if (!empty($homework)) {
$row[] = !empty($homework['expires_on']) && $homework['expires_on'] != '0000-00-00 00:00:00' ? api_get_utc_datetime($homework['expires_on']): '-';
} else {
$row[] = '-';
}*/
if (!empty($homework)) {
$row[] = !empty($homework['ends_on']) && $homework['ends_on'] != '0000-00-00 00:00:00' ? api_get_local_time($homework['ends_on']): '-';
} else {
@ -914,9 +921,9 @@ function display_student_publications_list($id, $my_folder_data, $work_parents,
if ($origin != 'learnpath') {
if ($is_allowed_to_edit) {
$cant_files_per_user = getUniqueStudentAttempts($work_data['id'], $course_id);
$cant_files_per_user = getUniqueStudentAttempts($work_data['id'], $group_id, $course_id, api_get_session_id(), null, $userList);
$row[] = $cant_files_per_user.'/'.$countUsers;
$row[] = $cant_files_per_user.'/'.count($userList);
if (api_resource_is_locked_by_gradebook($id2, LINK_STUDENTPUBLICATION)) {
$action .= Display::return_icon('edit_na.png', get_lang('Edit'), array(), ICON_SIZE_SMALL);
$action .= Display::return_icon('delete_na.png', get_lang('Delete'), array(), ICON_SIZE_SMALL);
@ -1644,8 +1651,7 @@ function get_count_work($work_id, $onlyMeUserId = null, $notMeUserId = null)
$where_condition .= " AND u.user_id = ".intval($onlyMeUserId);
}
$sql = "SELECT count(*) as count ".
$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 ".
" AND prop.tool='work' AND work.active = 1 ".
@ -1818,7 +1824,7 @@ function get_work_user_list($start, $limit, $column, $direction, $work_id, $wher
$work['sent_date'] = date_to_str_ago(api_get_local_time($work['sent_date'])).' '.$add_string.'<br />'.$work_date;
//Actions
$url = api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq().'&id='.$work_id.'&origin='.$origin.'&gradebook='.Security::remove_XSS($_GET['gradebook']);
$url = api_get_path(WEB_CODE_PATH).'work/';
$action = '';
if ($is_allowed_to_edit) {
if ($locked) {
@ -1829,10 +1835,10 @@ function get_work_user_list($start, $limit, $column, $direction, $work_id, $wher
}
} else {
if ($qualification_exists) {
$action .= '<a href="'.$url.'&amp;action=edit&item_id='.$item_id.'&amp;parent_id='.$work['parent_id'].'" title="'.get_lang('Modify').'" >'.
$action .= '<a href="'.$url.'edit.php?'.api_get_cidreq().'&item_id='.$item_id.'&id='.$work['parent_id'].'" title="'.get_lang('Modify').'" >'.
Display::return_icon('rate_work.png', get_lang('CorrectAndRate'),array(), ICON_SIZE_SMALL).'</a>';
} else {
$action .= '<a href="'.$url.'&amp;action=edit&item_id='.$item_id.'&gradebook='.Security::remove_XSS($_GET['gradebook']).'&amp;parent_id='.$work['parent_id'].'" title="'.get_lang('Modify').'" >'.
$action .= '<a href="'.$url.'edit.php?'.api_get_cidreq().'&item_id='.$item_id.'&id='.$work['parent_id'].'&gradebook='.Security::remove_XSS($_GET['gradebook']).'" title="'.get_lang('Modify').'">'.
Display::return_icon('edit.png', get_lang('Comment'),array(), ICON_SIZE_SMALL).'</a>';
}
}
@ -1840,27 +1846,27 @@ function get_work_user_list($start, $limit, $column, $direction, $work_id, $wher
if ($locked) {
$action .= Display::return_icon('move_na.png', get_lang('Move'),array(), ICON_SIZE_SMALL);
} else {
$action .= '<a href="'.$url.'&amp;action=move&item_id='.$item_id.'" title="'.get_lang('Move').'">'.Display::return_icon('move.png', get_lang('Move'),array(), ICON_SIZE_SMALL).'</a>';
$action .= '<a href="'.$url.'work.php?'.api_get_cidreq().'&action=move&item_id='.$item_id.'" title="'.get_lang('Move').'">'.Display::return_icon('move.png', get_lang('Move'),array(), ICON_SIZE_SMALL).'</a>';
}
}
if ($work['accepted'] == '1') {
$action .= '<a href="'.$url.'&amp;action=make_invisible&item_id='.$item_id.'&amp;'.$sort_params.'" title="'.get_lang('Invisible').'" >'.Display::return_icon('visible.png', get_lang('Invisible'),array(), ICON_SIZE_SMALL).'</a>';
$action .= '<a href="'.$url.'work.php?'.api_get_cidreq().'&action=make_invisible&item_id='.$item_id.'&amp;'.$sort_params.'" title="'.get_lang('Invisible').'" >'.Display::return_icon('visible.png', get_lang('Invisible'),array(), ICON_SIZE_SMALL).'</a>';
} else {
$action .= '<a href="'.$url.'&amp;action=make_visible&item_id='.$item_id.'&amp;'.$sort_params.'" title="'.get_lang('Visible').'" >'.Display::return_icon('invisible.png', get_lang('Visible'),array(), ICON_SIZE_SMALL).'</a> ';
$action .= '<a href="'.$url.'work.php?'.api_get_cidreq().'&action=make_visible&item_id='.$item_id.'&amp;'.$sort_params.'" title="'.get_lang('Visible').'" >'.Display::return_icon('invisible.png', get_lang('Visible'),array(), ICON_SIZE_SMALL).'</a> ';
}
if ($locked) {
$action .= Display::return_icon('delete_na.png', get_lang('Delete'),'',ICON_SIZE_SMALL);
} else {
$action .= '<a href="'.$url.'&amp;action=delete&amp;item_id='.$item_id.'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES))."'".')) return false;" title="'.get_lang('Delete').'" >'.Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
$action .= '<a href="'.$url.'work.php?'.api_get_cidreq().'&action=delete&amp;item_id='.$item_id.'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES))."'".')) return false;" title="'.get_lang('Delete').'" >'.Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
}
} elseif ($is_author && (empty($work['qualificator_id']) || $work['qualificator_id'] == 0)) {
if (api_is_allowed_to_session_edit(false, true)) {
$action .= '<a href="'.$url.'&amp;action=edit&item_id='.$item_id.'" title="'.get_lang('Modify').'" >'.Display::return_icon('edit.png', get_lang('Modify'),array(), ICON_SIZE_SMALL).'</a>';
$action .= '<a href="'.$url.'edit.php?'.api_get_cidreq().'&item_id='.$item_id.'&id='.$work['parent_id'].'" title="'.get_lang('Modify').'" >'.Display::return_icon('edit.png', get_lang('Modify'),array(), ICON_SIZE_SMALL).'</a>';
} else {
$action .= Display::return_icon('edit_na.png', get_lang('Modify'),array(), ICON_SIZE_SMALL);
}
if (api_get_course_setting('student_delete_own_publication') == 1) {
$action .= '<a href="'.$url.'&amp;action=delete&amp;item_id='.$item_id.'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES))."'".')) return false;" title="'.get_lang('Delete').'" >'.Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
$action .= '<a href="'.$url.'work.php?'.api_get_cidreq().'&action=delete&amp;item_id='.$item_id.'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES))."'".')) return false;" title="'.get_lang('Delete').'" >'.Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
}
} else {
$action .= Display::return_icon('edit_na.png', get_lang('Modify'),array(), ICON_SIZE_SMALL);

@ -91,15 +91,14 @@ $table_user = Database :: get_main_table(TABLE_MAIN_USER);
$table_session = Database :: get_main_table(TABLE_MAIN_SESSION);
$table_session_course_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$_course = api_get_course_info();
/* Constants and variables */
$tool_name = get_lang('StudentPublications');
$course_code = api_get_course_id();
$session_id = api_get_session_id();
$is_course_member = CourseManager::is_user_subscribed_in_real_or_linked_course($user_id, $course_code,$session_id);
$is_course_member = $is_course_member || api_is_platform_admin();
$currentCourseRepositorySys = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/';
$currentCourseRepositoryWeb = api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/';
@ -110,11 +109,9 @@ $currentUserEmail = $_user['mail'];
$item_id = isset($_REQUEST['item_id']) ? intval($_REQUEST['item_id']) : null;
$parent_id = isset($_REQUEST['parent_id']) ? Database::escape_string($_REQUEST['parent_id']) : '';
$origin = isset($_REQUEST['origin']) ? Security::remove_XSS($_REQUEST['origin']) : '';
$submitGroupWorkUrl = isset($_REQUEST['submitGroupWorkUrl']) ? Security::remove_XSS($_REQUEST['submitGroupWorkUrl']) : '';
$title = isset($_REQUEST['title']) ? $_REQUEST['title'] : '';
$description = isset($_REQUEST['description']) ? $_REQUEST['description'] : '';
$uploadvisibledisabled = isset($_REQUEST['uploadvisibledisabled']) ? Database::escape_string($_REQUEST['uploadvisibledisabled']) : $course_info['show_score'];
// get data for publication assignment
@ -242,7 +239,7 @@ if (!empty($group_id)) {
//stats
event_access_tool(TOOL_STUDENTPUBLICATION);
$is_allowed_to_edit = api_is_allowed_to_edit(); //has to come after display_tool_view_option();
$is_allowed_to_edit = api_is_allowed_to_edit();
$student_can_edit_in_session = api_is_allowed_to_session_edit(false, true);
@ -294,9 +291,7 @@ if (!empty($my_folder_data)) {
$expires_on = api_convert_and_format_date($homework['expires_on']);
if ($has_ended) {
//if (!api_is_allowed_to_edit()) {
$display_upload_link = false;
//}
$message = Display::return_message(get_lang('EndDateAlreadyPassed').' '.$ends_on, 'error');
} elseif ($has_expired) {
$display_upload_link = true;
@ -371,362 +366,6 @@ switch ($action) {
Display::display_footer();
}
break;
case 'edit':
case 'upload_form': //can be add or edit work
$is_author = false;
if (empty($item_id)) {
$parent_data = get_work_data_by_id($work_id);
$parent_data['qualification'] = intval($parent_data['qualification']);
if (!empty($parent_data) && !empty($parent_data['qualification'])) {
$count = get_work_count_by_student($user_id, $work_id);
if ($count >= 1 ) {
if (api_get_course_setting('student_delete_own_publication') == '1') {
Display::display_warning_message(get_lang('CantUploadDeleteYourPaperFirst'));
} else {
Display::display_warning_message(get_lang('YouAlreadySentAPaperYouCantUpload'));
}
Display::display_footer();
exit;
}
}
} else {
//we found the current user is the author
$sql = "SELECT * FROM $work_table WHERE c_id = $course_id AND id = $item_id";
$result = Database::query($sql);
$work_item = array();
if ($result) {
$work_item = Database::fetch_array($result);
}
//Get the author ID for that document from the item_property table
$is_author = user_is_author($item_id);
if (!$is_author) {
Display::display_warning_message(get_lang('NotAllowed'));
Display::display_footer();
}
}
$form = new FormValidator('form', 'POST', api_get_self()."?".api_get_cidreq()."&action=upload&id=".$work_id."&gradebook=".Security::remove_XSS($_GET['gradebook'])."&origin=$origin", '', array('enctype' => "multipart/form-data"));
// form title
if ($item_id) {
$form_title = get_lang('Edit');
} else {
$form_title = get_lang('UploadADocument');
}
$form->addElement('header', $form_title);
if (!empty ($error_message)) {
Display :: display_error_message($error_message);
}
$show_progress_bar = false;
if ($submitGroupWorkUrl) {
// For user comming from group space to publish his work
$realUrl = str_replace($_configuration['root_sys'], api_get_path(WEB_PATH), str_replace("\\", '/', realpath($submitGroupWorkUrl)));
$form->addElement('hidden', 'newWorkUrl', $submitGroupWorkUrl);
$text_document = $form->addElement('text', 'document', get_lang('Document'));
$defaults['document'] = '<a href="' . format_url($submitGroupWorkUrl) . '">' . $realUrl . '</a>';
$text_document->freeze();
} elseif ($item_id && ($is_allowed_to_edit or $is_author)) {
$workUrl = $currentCourseRepositoryWeb . $workUrl;
} else {
// else standard upload option
$form->addElement('file', 'file', get_lang('UploadADocument'), 'size="40" onchange="updateDocumentTitle(this.value)"');
$show_progress_bar = true;
}
$form->addElement('hidden', 'id', $work_id);
if (empty($item_id)) {
$form->addElement('hidden', 'contains_file', 0, array('id'=>'contains_file_id'));
} else {
$form->addElement('hidden', 'item_id', $item_id);
}
$form->addElement('text', 'title', get_lang('Title'), array('id' => 'file_upload', 'class' => 'span4'));
//$form->addElement('html_editor', 'description', get_lang("Description"));
$form->add_html_editor('description', get_lang('Description'), false, false, array('ToolbarSet' => 'Work', 'Width' => '100%', 'Height' => '200'));
if ($item_id && !empty($work_item)) {
$defaults['title'] = $work_item['title'];
$defaults["description"] = $work_item['description'];
$defaults['qualification'] = $work_item['qualification'];
}
if ($is_allowed_to_edit && !empty($item_id)) {
// Get qualification from parent_id that'll allow the validation qualification over
$sql = "SELECT qualification FROM $work_table WHERE c_id = $course_id AND id ='$parent_id' ";
$result = Database::query($sql);
$row = Database::fetch_array($result);
$qualification_over = $row['qualification'];
if (!empty($qualification_over) && intval($qualification_over) > 0) {
$form->addElement('text', 'qualification', array(get_lang('Qualification'), null, " / ".$qualification_over), 'size="10"');
$form->addElement('hidden', 'qualification_over', $qualification_over);
}
}
$form->addElement('hidden', 'active', 1);
$form->addElement('hidden', 'accepted', 1);
$form->addElement('hidden', 'item_to_edit', $item_id);
$token = Security::get_token();
$form->addElement('hidden', 'sec_token', $token);
if ($item_id) {
$text = get_lang('UpdateWork');
$class = 'save';
} else {
$text = get_lang('Send');
$class = 'upload';
}
// fix the Ok button when we see the tool in the learn path
if ($origin == 'learnpath') {
$form->addElement('html', '<div style="margin-left:137px">');
$form->addElement('style_submit_button', 'submitWork', $text, array('class'=> $class, 'value' => "submitWork"));
$form->addElement('html', '</div>');
} else {
if ($item_id) {
$form->addElement('style_submit_button', 'editWork', $text, array('class'=> $class, 'value' => "editWork"));
} else {
$form->addElement('style_submit_button', 'submitWork', $text, array('class'=> $class, 'value' => "submitWork"));
}
}
if (!empty($_POST['submitWork']) || $item_id) {
$form->addElement('style_submit_button', 'cancelForm', get_lang('Cancel'), 'class="cancel"');
}
if ($show_progress_bar) {
$form->add_real_progress_bar('uploadWork', 'file');
}
$form->setDefaults($defaults);
//fixes bug when showing modification form
if (!empty($work_id)) {
if ($is_allowed_to_edit) {
if (api_resource_is_locked_by_gradebook($work_id, LINK_STUDENTPUBLICATION)) {
echo Display::display_warning_message(get_lang('ResourceLockedByGradebook'));
} else {
$form->display();
}
} elseif ($is_author) {
if (empty($work_item['qualificator_id']) || $work_item['qualificator_id'] == 0) {
$form->display();
} else {
Display::display_error_message(get_lang('ActionNotAllowed'));
}
} elseif ($student_can_edit_in_session && $has_ended == false) {
$form->display();
} else {
Display::display_error_message(get_lang('ActionNotAllowed'));
}
} else {
Display::display_error_message(get_lang('ActionNotAllowed'));
}
break;
case 'upload':
$check = Security::check_token('post');
if ($student_can_edit_in_session && $check) {
//check the token inserted into the form
if (isset($_POST['submitWork']) && !empty($is_course_member)) {
$authors = api_get_person_name($currentUserFirstName, $currentUserLastName);
$url = null;
$contains_file = 0;
if ($_POST['contains_file'] && !empty($_FILES['file']['size'])) {
$updir = $currentCourseRepositorySys . 'work/'; //directory path to upload
// Try to add an extension to the file if it has'nt one
$new_file_name = add_ext_on_mime(stripslashes($_FILES['file']['name']), $_FILES['file']['type']);
// Replace dangerous characters
$new_file_name = replace_dangerous_char($new_file_name, 'strict');
// Transform any .php file in .phps fo security
$new_file_name = php2phps($new_file_name);
$filesize = filesize($_FILES['file']['tmp_name']);
if (empty($filesize)) {
Display :: display_error_message(get_lang('UplUploadFailedSizeIsZero'));
$succeed = false;
} elseif (!filter_extension($new_file_name)) {
//filter extension
Display :: display_error_message(get_lang('UplUnableToSaveFileFilteredExtension'));
$succeed = false;
}
if (!$title) {
$title = $_FILES['file']['name'];
}
// Compose a unique file name to avoid any conflict
$new_file_name = api_get_unique_id();
$curdirpath = basename($my_folder_data['url']);
//if we come from the group tools the groupid will be saved in $work_table
$result = @move_uploaded_file($_FILES['file']['tmp_name'], $updir.$curdirpath.'/'.$new_file_name);
if ($result) {
$url = 'work/'.$curdirpath.'/'.$new_file_name;
$contains_file = 1;
}
}
if (empty($title)) {
$title = get_lang('Untitled');
}
$documents_total_space = DocumentManager::documents_total_space();
$course_max_space = DocumentManager::get_course_quota();
$total_size = $filesize + $documents_total_space;
if ($total_size > $course_max_space) {
$error_message = get_lang('NoSpace');
} else {
$active = '1';
$sql_add_publication = "INSERT INTO " . $work_table . " SET
c_id = $course_id ,
url = '" . $url . "',
title = '" . Database::escape_string($title) . "',
description = '" . Database::escape_string($description) . "',
author = '" . Database::escape_string($authors) . "',
contains_file = '".$contains_file."',
active = '" . $active . "',
accepted = '1',
post_group_id = '".$group_id."',
sent_date = '".api_get_utc_datetime()."',
parent_id = '".$work_id."' ,
session_id = '".intval($id_session)."' ,
user_id = '".$user_id."'";
//var_dump($sql_add_publication);exit;
Database::query($sql_add_publication);
$id = Database::insert_id();
}
if ($id) {
api_item_property_update($course_info, 'work', $id, 'DocumentAdded', $user_id, api_get_group_id());
/*
* See task #5145
if($uploadvisibledisabled){
$sql = "UPDATE $work_table SET accepted = 0 WHERE c_id = $course_id AND id = $id";
Database::query($sql);
api_item_property_update($course_info, 'work', $id, 'invisible', api_get_user_id());
}else{
//api_item_property_update($course_info, 'work', $id, 'visible', api_get_user_id());
}*/
$succeed = true;
}
} elseif ($newWorkUrl) {
// SPECIAL CASE ! For a work coming from another area (i.e. groups)
/*
$url = str_replace('../../' . $_course['path'] . '/', '', $newWorkUrl);
if (!$title) {
$title = basename($workUrl);
}
$sql = "INSERT INTO " . $work_table . " SET
c_id = $course_id,
url = '" . $url . "',
title = '" . Database::escape_string($title) . "',
description = '" . Database::escape_string($description) . "',
author = '" . Database::escape_string($authors) . "',
post_group_id = '".$group_id."',
sent_date = '".api_get_utc_datetime()."',
session_id = '".intval($id_session)."',
user_id = '".$user_id."'";
Database::query($sql);
$insertId = Database::insert_id();
api_item_property_update($_course, 'work', $insertId, 'DocumentAdded', $user_id, $group_id);
$succeed = true;*/
} elseif (isset($_POST['editWork'])) {
/*
* SPECIAL CASE ! For a work edited
*/
//Get the author ID for that document from the item_property table
$item_to_edit_id = intval($_POST['item_to_edit']);
$is_author = user_is_author($item_to_edit_id);
if ($is_author) {
$work_data = get_work_data_by_id($item_to_edit_id);
if (!empty($_POST['title']))
$title = isset($_POST['title']) ? $_POST['title'] : $work_data['title'];
$description = isset($_POST['description']) ? $_POST['description'] : $work_data['description'];
if ($is_allowed_to_edit && ($_POST['qualification'] !='' )) {
$add_to_update = ', qualificator_id ='."'".api_get_user_id()."',";
$add_to_update .= ' qualification = '."'".Database::escape_string($_POST['qualification'])."',";
$add_to_update .= ' date_of_qualification ='."'".api_get_utc_datetime()."'";
}
if ((int)$_POST['qualification'] > (int)$_POST['qualification_over']) {
Display::display_error_message(get_lang('QualificationMustNotBeMoreThanQualificationOver'));
} else {
$sql = "UPDATE " . $work_table . "
SET title = '" . Database::escape_string($title) . "',
description = '" . Database::escape_string($description) . "'
".$add_to_update."
WHERE c_id = $course_id AND id = $item_to_edit_id";
Database::query($sql);
}
api_item_property_update($_course, 'work', $item_to_edit_id, 'DocumentUpdated', $user_id);
$succeed = true;
Display :: display_confirmation_message(get_lang('ItemUpdated'), false);
} else {
$error_message = get_lang('IsNotPosibleSaveTheDocument');
}
} else {
$error_message = get_lang('IsNotPosibleSaveTheDocument');
}
Security::clear_token();
} else {
//Bad token or can't add works
$error_message = get_lang('IsNotPosibleSaveTheDocument');
}
if (!empty($succeed) && !empty($id)) {
//last value is to check this is not "just" an edit
//YW Tis part serve to send a e-mail to the tutors when a new file is sent
$send = api_get_course_setting('email_alert_manager_on_new_doc');
if ($send > 0) {
// Lets predefine some variables. Be sure to change the from address!
if (empty($id_session)) {
//Teachers
$user_list = CourseManager::get_user_list_from_course_code(api_get_course_id(), null, null, null, COURSEMANAGER);
} else {
//Coaches
$user_list = CourseManager::get_user_list_from_course_code(api_get_course_id(), $session_id, null, null, 2);
}
$emailsubject = "[" . api_get_setting('siteName') . "] ".get_lang('SendMailBody')."\n".get_lang('CourseName')." : ".$_course['name']." ";
foreach ($user_list as $user_data) {
$to_user_id = $user_data['user_id'];
$emailbody = get_lang('SendMailBody')."\n".get_lang('CourseName')." : ".$_course['name']."\n";
$user_id = api_get_user_id();
$user_info = api_get_user_info($user_id);
$emailbody .= get_lang('UserName')." : ".api_get_person_name($user_info['firstname'], $user_info['lastname'])."\n";
$emailbody .= get_lang('DateSent')." : ".api_format_date(api_get_local_time())."\n";
$emailbody .= get_lang('WorkName')." : ".$title."\n\n".get_lang('DownloadLink')."\n";
$url = api_get_path(WEB_CODE_PATH)."work/work.php?".api_get_cidreq()."&amp;id=".$work_id;
$emailbody .= $url;
MessageManager::send_message_simple($to_user_id, $emailsubject, $emailbody);
}
}
$message = get_lang('DocAdd');
event_upload($id);
Display :: display_confirmation_message(get_lang('DocAdd'), false);
} else {
if (!empty($error_message)) {
Display :: display_warning_message($error_message, false);
}
}
case 'create_dir':
case 'add':
//$check = Security::check_token('post');
@ -776,7 +415,6 @@ switch ($action) {
$form->addElement('advanced_settings',draw_date_picker('expires'));
$form->addElement('html', '</div>');
$form->addElement('checkbox', 'type2', null, get_lang('EnableEndDate'), array('id' =>'make_calification_id', 'onclick' => "javascript: if(this.checked){document.getElementById('option3').style.display='block';}else{document.getElementById('option3').style.display='none';}"));
$form->addElement('html', '<div id="option3" style="display: none;">');
@ -825,8 +463,8 @@ switch ($action) {
date_of_qualification = '0000-00-00 00:00:00',
weight = '".Database::escape_string($_POST['weight'])."',
session_id = '".intval($id_session)."',
allow_text_assignment = '".Database::escape_string($_POST['allow_text_assignment'])."',
contains_file = 0,
allow_text_assignment = '".Database::escape_string($_POST['allow_text_assignment'])."',
contains_file = 0,
user_id = '".$user_id."'";
Database::query($sql_add_publication);
@ -1060,15 +698,17 @@ switch ($action) {
if (($is_allowed_to_edit && $locked == false) || ($locked == false AND $is_author && api_get_course_setting('student_delete_own_publication') == 1 && $work_data['qualificator_id'] == 0)) {
//we found the current user is the author
$queryString1 = "SELECT url, contains_file FROM " . $work_table . " WHERE c_id = $course_id AND id = $item_id";
$queryString1 = "SELECT url, contains_file FROM ".$work_table." WHERE c_id = $course_id AND id = $item_id";
$result1 = Database::query($queryString1);
$row = Database::fetch_array($result1);
if (Database::num_rows($result1) > 0) {
$queryString2 = "UPDATE " . $work_table . " SET active = 2 WHERE c_id = $course_id AND id = $item_id";
$queryString3 = "DELETE FROM " . $TSTDPUBASG . " WHERE c_id = $course_id AND publication_id = $item_id";
$queryString2 = "UPDATE " . $work_table . " SET active = 2 WHERE c_id = $course_id AND id = $item_id";
$queryString3 = "DELETE FROM ".$TSTDPUBASG ." WHERE c_id = $course_id AND publication_id = $item_id";
Database::query($queryString2);
Database::query($queryString3);
api_item_property_update($_course, 'work', $item_id, 'DocumentDeleted', $user_id);
$work = $row['url'];
@ -1094,6 +734,7 @@ switch ($action) {
}
}
}
if (!$file_deleted) {
Display::display_error_message(get_lang('YouAreNotAllowedToDeleteThisDocument'));
}
@ -1110,7 +751,6 @@ switch ($action) {
echo '<p><div><strong>'.get_lang('Description').':</strong><p>'.Security::remove_XSS($my_folder_data['description'], STUDENT).'</p></div></p>';
}
//User works
if (isset($work_id) && !empty($work_id) && !$display_list_users_without_publication) {
} elseif (isset($_GET['list']) && $_GET['list'] == 'without') {
@ -1130,9 +770,18 @@ switch ($action) {
// Work list
echo '<div class="row">';
echo '<div class="span9">';
if (!empty($group_id)) {
$userList = GroupManager::get_users($group_id);
} else {
if (empty($session_id)) {
$userList = CourseManager::get_user_list_from_course_code($course_code, $session_id, null, null, STUDENT);
} else {
$userList = CourseManager::get_user_list_from_course_code($course_code, $session_id, null, null, 0);
}
$userList = array_keys($userList);
}
$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));
display_student_publications_list($work_id, $my_folder_data, $work_parents, $origin, $add_query, $userList);
echo '</div>';
echo '<div class="span3">';
@ -1148,13 +797,15 @@ switch ($action) {
$row++;
$column = 0;
foreach ($userList as $user) {
$url = Display::url(api_get_person_name($user['firstname'], $user['lastname']), api_get_path(WEB_CODE_PATH).'work/student_work.php?studentId='.$user['user_id']);
foreach ($userList as $userId) {
$user = api_get_user_info($userId);
$link = api_get_path(WEB_CODE_PATH).'work/student_work.php?'.api_get_cidreq().'&studentId='.$user['user_id'];
$url = Display::url(api_get_person_name($user['firstname'], $user['lastname']), $link);
$table->setCellContents($row, $column, $url);
$column++;
$userWorks = 0;
foreach ($work_parents as $work) {
$userWorks += getUniqueStudentAttempts($work->id, $course_id, $user['user_id']);
$userWorks += getUniqueStudentAttempts($work->id, $group_id, $course_id, $session_id, $user['user_id']);
}
$cell = $userWorks." / ".count($work_parents);
$table->setCellContents($row, $column, $cell);

@ -22,26 +22,59 @@ if (empty($workId)) {
api_not_allowed(true);
}
$my_folder_data = get_work_data_by_id($workId);
if (empty($my_folder_data)) {
api_not_allowed(true);
}
$work_data = get_work_assignment_by_id($workId);
$tool_name = get_lang('StudentPublications');
$group_id = api_get_group_id();
$courseInfo = api_get_course_info();
$htmlHeadXtra[] = api_get_jqgrid_js();
$url_dir = api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq();
if ($courseInfo['show_score'] == 1) {
api_not_allowed(true);
if (!empty($group_id)) {
$group_properties = GroupManager :: get_group_properties($group_id);
$show_work = false;
if (api_is_allowed_to_edit(false, true)) {
$show_work = true;
} else {
// you are not a teacher
$show_work = GroupManager::user_has_access($user_id, $group_id, GroupManager::GROUP_TOOL_WORK);
}
if (!$show_work) {
api_not_allowed();
}
$interbreadcrumb[] = array ('url' => '../group/group.php', 'name' => get_lang('Groups'));
$interbreadcrumb[] = array ('url' => '../group/group_space.php?gidReq='.$group_id, 'name' => get_lang('GroupSpace').' '.$group_properties['name']);
}
$htmlHeadXtra[] = api_get_jqgrid_js();
$interbreadcrumb[] = array ('url' => api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq(), 'name' => get_lang('StudentPublications'));
$interbreadcrumb[] = array ('url' => api_get_path(WEB_CODE_PATH).'work/work_list.php?'.api_get_cidreq().'&id='.$workId, 'name' => $my_folder_data['title']);
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>';
if (api_is_allowed_to_session_edit(false, true) && !empty($workId)) {
echo '<a href="'.api_get_path(WEB_CODE_PATH).'work/upload.php?'.api_get_cidreq().'&id='.$workId.'&origin='.$origin.'&gradebook='.$gradebook.'">';
echo Display::return_icon('upload_file.png', get_lang('UploadADocument'),'',ICON_SIZE_MEDIUM).'</a>';
}
echo '</div>';
// User works
$work_data = get_work_assignment_by_id($workId);
$error_message = isset($_GET['error_message']) ? Security::remove_XSS($_GET['error_message']) : null;
if (!empty($error_message)) {
echo $error_message;
}
$check_qualification = intval($my_folder_data['qualification']);
if (!empty($work_data['enable_qualification']) && !empty($check_qualification)) {

@ -22,6 +22,13 @@ if (empty($workId)) {
api_not_allowed(true);
}
$my_folder_data = get_work_data_by_id($workId);
if (empty($my_folder_data)) {
api_not_allowed(true);
}
$work_data = get_work_assignment_by_id($workId);
if (!api_is_allowed_to_edit()) {
api_not_allowed(true);
}
@ -30,20 +37,47 @@ $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();
if (!empty($group_id)) {
$group_properties = GroupManager :: get_group_properties($group_id);
$show_work = false;
if (api_is_allowed_to_edit(false, true)) {
$show_work = true;
} else {
// you are not a teacher
$show_work = GroupManager::user_has_access($user_id, $group_id, GroupManager::GROUP_TOOL_WORK);
}
if (!$show_work) {
api_not_allowed();
}
$interbreadcrumb[] = array ('url' => '../group/group.php', 'name' => get_lang('Groups'));
$interbreadcrumb[] = array ('url' => '../group/group_space.php?gidReq='.$group_id, 'name' => get_lang('GroupSpace').' '.$group_properties['name']);
}
$htmlHeadXtra[] = api_get_jqgrid_js();
$interbreadcrumb[] = array ('url' => api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq(), 'name' => get_lang('StudentPublications'));
$interbreadcrumb[] = array ('url' => api_get_path(WEB_CODE_PATH).'work/work_list_all.php?'.api_get_cidreq().'&id='.$workId, 'name' => $my_folder_data['title']);
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>';
if (api_is_allowed_to_session_edit(false, true) && !empty($workId)) {
echo '<a href="'.api_get_path(WEB_CODE_PATH).'work/upload.php?'.api_get_cidreq().'&id='.$workId.'&origin='.$origin.'&gradebook='.$gradebook.'">';
echo Display::return_icon('upload_file.png', get_lang('UploadADocument'),'',ICON_SIZE_MEDIUM).'</a>';
}
echo '</div>';
$error_message = isset($_GET['error_message']) ? Security::remove_XSS($_GET['error_message']) : null;
if (!empty($error_message)) {
echo $error_message;
}
// 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)) {

@ -24,18 +24,46 @@ if (empty($workId)) {
$my_folder_data = get_work_data_by_id($workId);
$tool_name = get_lang('StudentPublications');
if (empty($my_folder_data)) {
api_not_allowed(true);
}
$work_data = get_work_assignment_by_id($workId);
$tool_name = get_lang('StudentPublications');
$group_id = api_get_group_id();
$courseInfo = api_get_course_info();
// not all users
if ($courseInfo['show_score'] == 1) {
api_not_allowed(true);
}
$htmlHeadXtra[] = api_get_jqgrid_js();
if (!empty($group_id)) {
$group_properties = GroupManager :: get_group_properties($group_id);
$show_work = false;
if (api_is_allowed_to_edit(false, true)) {
$show_work = true;
} else {
// you are not a teacher
$show_work = GroupManager::user_has_access($user_id, $group_id, GroupManager::GROUP_TOOL_WORK);
}
if (!$show_work) {
api_not_allowed();
}
$interbreadcrumb[] = array ('url' => '../group/group.php', 'name' => get_lang('Groups'));
$interbreadcrumb[] = array ('url' => '../group/group_space.php?gidReq='.$group_id, 'name' => get_lang('GroupSpace').' '.$group_properties['name']);
}
$interbreadcrumb[] = array ('url' => api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq(), 'name' => get_lang('StudentPublications'));
$interbreadcrumb[] = array ('url' => api_get_path(WEB_CODE_PATH).'work/work_list_others.php?'.api_get_cidreq().'&id='.$workId, 'name' => $my_folder_data['title']);
Display :: display_header(null);
echo '<div class="actions">';
@ -47,8 +75,6 @@ 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)) {

Loading…
Cancel
Save