예제 #1
0
/**
 * @param int $workId
 * @param string $courseCode
 * @param int $sessionId
 * @param int $groupId
 * @param int $start
 * @param int $limit
 * @param int $sidx
 * @param string $sord
 * @param bool $getCount
 * @return array|int
 */
function getWorkUserListData(
    $workId,
    $courseCode,
    $sessionId,
    $groupId,
    $start,
    $limit,
    $sidx,
    $sord,
    $getCount = false
) {
    $my_folder_data = get_work_data_by_id($workId);
    $workParents = array();
    if (empty($my_folder_data)) {
        $workParents = getWorkList($workId, $my_folder_data, null);
    }

    $workIdList = array();
    if (!empty($workParents)) {
        foreach ($workParents as $work) {
            $workIdList[] = $work->id;
        }
    }

    $courseInfo = api_get_course_info($courseCode);

    $userList = getWorkUserList(
        $courseCode,
        $sessionId,
        $groupId,
        $start,
        $limit,
        $sidx,
        $sord,
        $getCount
    );

    if ($getCount) {
        return $userList;
    }
    $results = array();
    if (!empty($userList)) {
        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);
            $userWorks = 0;
            if (!empty($workIdList)) {
                $userWorks = getUniqueStudentAttempts(
                    $workIdList,
                    $groupId,
                    $courseInfo['real_id'],
                    $sessionId,
                    $user['user_id']
                );
            }
            $works = $userWorks." / ".count($workParents);
            $results[] = array('student' => $url, 'works' => $works);
        }
    }
    return $results;
}
예제 #2
0
            $headers = array(get_lang('Students'), get_lang('Works'));
            foreach ($headers as $header) {
                $table->setHeaderContents($row, $column, $header);
                $column++;
            }
            $row++;
            $column = 0;
            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, $group_id, $course_id, $session_id, $user['user_id']);
                }
                $cell = $userWorks . " / " . count($work_parents);
                $table->setCellContents($row, $column, $cell);
                $row++;
                $column = 0;
            }
            echo $table->toHtml();
            echo '</div>';
        } else {
            display_student_publications_list($work_id, $my_folder_data, $work_parents, $origin, $add_query, null);
        }
        break;
}
if ($origin != 'learnpath') {
    //we are not in the learning path tool
예제 #3
0
/**
 * Display the list of student publications, taking into account the user status
 *
 * @param $origin - typically empty or 'learnpath'
 */
function display_student_publications_list($id, $my_folder_data, $work_parents, $origin, $add_in_where_query = '', $userList = array())
{
    global $gradebook;
    $_course = api_get_course_info();
    // Database table names
    $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);
    $work_assigment = Database::get_course_table(TABLE_STUDENT_PUBLICATION_ASSIGNMENT);
    $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
    $session_id = api_get_session_id();
    $condition_session = api_get_session_condition($session_id);
    $course_id = api_get_course_int_id();
    $course_info = api_get_course_info(api_get_course_id());
    $sort_params = array();
    if (isset($_GET['column'])) {
        $sort_params[] = 'column=' . Security::remove_XSS($_GET['column']);
    }
    if (isset($_GET['page_nr'])) {
        $sort_params[] = 'page_nr=' . Security::remove_XSS($_GET['page_nr']);
    }
    if (isset($_GET['per_page'])) {
        $sort_params[] = 'per_page=' . Security::remove_XSS($_GET['per_page']);
    }
    if (isset($_GET['direction'])) {
        $sort_params[] = 'direction=' . Security::remove_XSS($_GET['direction']);
    }
    $sort_params = implode('&amp;', $sort_params);
    $my_params = $sort_params;
    $origin = Security::remove_XSS($origin);
    $qualification_exists = false;
    if (!empty($my_folder_data['qualification']) && intval($my_folder_data['qualification']) > 0) {
        $qualification_exists = true;
    }
    $edit_dir = isset($_GET['edit_dir']) ? intval($_GET['edit_dir']) : '';
    $table_header = array();
    $table_has_actions_column = false;
    $table_header[] = array(get_lang('Type'), false, 'style="width:40px"');
    $table_header[] = array(get_lang('Title'), true);
    if (!empty($id)) {
        $table_header[] = array(get_lang('FirstName'), true);
        $table_header[] = array(get_lang('LastName'), true);
    }
    $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;
        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();
    // List of all folders if no id was provided
    $group_id = api_get_group_id();
    if (is_array($work_parents)) {
        foreach ($work_parents as $work_parent) {
            $sql_select_directory = "SELECT\n\t\t\t        title,\n\t\t\t        url,\n\t\t\t        prop.insert_date,\n\t\t\t        prop.lastedit_date,\n\t\t\t        work.id, author,\n\t\t\t        has_properties,\n\t\t\t        view_properties,\n\t\t\t        description,\n\t\t\t        qualification,\n\t\t\t        weight,\n\t\t\t        allow_text_assignment\n                FROM " . $iprop_table . " prop INNER JOIN " . $work_table . " work ON (prop.ref=work.id AND prop.c_id = {$course_id})\n                WHERE active IN (0, 1) AND ";
            if (!empty($group_id)) {
                $sql_select_directory .= " work.post_group_id = '" . $group_id . "' ";
                // set to select only messages posted by the user's group
            } else {
                $sql_select_directory .= " work.post_group_id = '0' ";
            }
            $sql_select_directory .= " AND " . "  work.c_id = {$course_id} AND " . "  work.id  = " . $work_parent->id . " AND " . "  work.filetype = 'folder' AND " . "  prop.tool='work' {$condition_session}";
            $result = Database::query($sql_select_directory);
            $row = Database::fetch_array($result, 'ASSOC');
            if (!$row) {
                // the folder belongs to another session
                continue;
            }
            $direc_date = $row['lastedit_date'];
            //directory's date
            $author = $row['author'];
            //directory's author
            $view_properties = $row['view_properties'];
            $is_assignment = $row['has_properties'];
            $id2 = $row['id'];
            //work id
            $locked = api_resource_is_locked_by_gradebook($id2, LINK_STUDENTPUBLICATION);
            // form edit directory
            if (!empty($row['has_properties'])) {
                $sql = Database::query('SELECT * FROM ' . $work_assigment . ' WHERE c_id = ' . $course_id . ' AND id = "' . $row['has_properties'] . '" LIMIT 1');
                $homework = Database::fetch_array($sql);
            }
            // save original value for later
            $utc_expiry_time = $homework['expires_on'];
            if ($is_allowed_to_edit && $locked == false) {
                if (!empty($edit_dir) && $edit_dir == $id2) {
                    $form_folder = new FormValidator('edit_dir', 'post', api_get_self() . '?origin=' . $origin . '&gradebook=' . $gradebook . '&edit_dir=' . $id2);
                    $form_folder->addElement('text', 'dir_name', get_lang('Title'));
                    $form_folder->addElement('hidden', 'work_id', $id2);
                    $form_folder->addRule('dir_name', get_lang('ThisFieldIsRequired'), 'required');
                    $my_title = !empty($row['title']) ? $row['title'] : basename($row['url']);
                    $defaults = array('dir_name' => Security::remove_XSS($my_title), 'description' => Security::remove_XSS($row['description']));
                    $form_folder->add_html_editor('description', get_lang('Description'), false, false, array('ToolbarSet' => 'work', 'Width' => '80%', 'Height' => '200'));
                    $there_is_a_end_date = false;
                    $form_folder->addElement('advanced_settings', 'work', get_lang('AdvancedParameters'));
                    $form_folder->addElement('html', '<div id="work_options" style="display: none;">');
                    if (empty($default)) {
                        $default = api_get_local_time();
                    }
                    $parts = explode(' ', $default);
                    list($d_year, $d_month, $d_day) = explode('-', $parts[0]);
                    list($d_hour, $d_minute) = explode(':', $parts[1]);
                    $qualification_input[] = $form_folder->createElement('text', 'qualification');
                    $form_folder->addGroup($qualification_input, 'qualification', get_lang('QualificationNumeric'));
                    if (Gradebook::is_active()) {
                        $link_info = is_resource_in_course_gradebook(api_get_course_id(), LINK_STUDENTPUBLICATION, $id2);
                        $form_folder->addElement('checkbox', 'make_calification', null, get_lang('MakeQualifiable'), 'onclick="javascript: if(this.checked){document.getElementById(\'option3\').style.display = \'block\';}else{document.getElementById(\'option3\').style.display = \'none\';}"');
                        if (!empty($link_info)) {
                            $form_folder->addElement('html', '<div id=\'option3\' style="display:block">');
                        } else {
                            $form_folder->addElement('html', '<div id=\'option3\' style="display:none">');
                        }
                        //Loading gradebook select
                        load_gradebook_select_in_tool($form_folder);
                        $weight_input2[] = $form_folder->createElement('text', 'weight');
                        $form_folder->addGroup($weight_input2, 'weight', get_lang('WeightInTheGradebook'), 'size="10"');
                        $form_folder->addElement('html', '</div>');
                        $defaults['weight[weight]'] = $link_info['weight'];
                        if (!empty($link_info)) {
                            $defaults['category_id'] = $link_info['category_id'];
                            $defaults['make_calification'] = 1;
                        }
                    } else {
                        $defaults['category_id'] = '';
                    }
                    if ($homework['expires_on'] != '0000-00-00 00:00:00') {
                        $homework['expires_on'] = api_get_local_time($homework['expires_on']);
                        $there_is_a_expire_date = true;
                        $defaults['enableExpiryDate'] = true;
                        $form_folder->addElement('checkbox', 'enableExpiryDate', null, get_lang('EnableExpiryDate'), 'onclick="javascript: if(this.checked){document.getElementById(\'option1\').style.display = \'block\';}else{document.getElementById(\'option1\').style.display = \'none\';}"');
                        $form_folder->addElement('html', '<div id=\'option1\' style="display:block">');
                        $form_folder->addGroup(create_group_date_select(), 'expires', get_lang('ExpiresAt'));
                        $form_folder->addElement('html', '</div>');
                    } else {
                        $homework['expires_on'] = api_get_local_time();
                        $expires_date_array = convert_date_to_array(api_get_local_time(), 'expires');
                        $defaults = array_merge($defaults, $expires_date_array);
                        $there_is_a_expire_date = false;
                        $form_folder->addElement('checkbox', 'enableExpiryDate', null, get_lang('EnableExpiryDate'), 'onclick="javascript: if(this.checked){document.getElementById(\'option1\').style.display = \'block\';}else{document.getElementById(\'option1\').style.display = \'none\';}"');
                        $form_folder->addElement('html', '<div id=\'option1\' style="display:none">');
                        $form_folder->addGroup(create_group_date_select(), 'expires', get_lang('ExpiresAt'));
                        $form_folder->addElement('html', '</div>');
                    }
                    if ($homework['ends_on'] != '0000-00-00 00:00:00') {
                        $homework['ends_on'] = api_get_local_time($homework['ends_on']);
                        $there_is_a_end_date = true;
                        $defaults['enableEndDate'] = true;
                        $form_folder->addElement('checkbox', 'enableEndDate', null, get_lang('EnableEndDate'), 'onclick="javascript: if(this.checked){document.getElementById(\'option2\').style.display = \'block\';}else{document.getElementById(\'option2\').style.display = \'none\';}"');
                        $form_folder->addElement('html', '<div id=\'option2\' style="display:block">');
                        $form_folder->addGroup(create_group_date_select(), 'ends', get_lang('EndsAt'));
                        $form_folder->addElement('html', '</div>');
                        $form_folder->addRule(array('expires', 'ends'), get_lang('DateExpiredNotBeLessDeadLine'), 'comparedate');
                    } else {
                        $homework['ends_on'] = api_get_local_time();
                        $expires_date_array = convert_date_to_array(api_get_local_time(), 'ends');
                        $defaults = array_merge($defaults, $expires_date_array);
                        $there_is_a_end_date = false;
                        $form_folder->addElement('checkbox', 'enableEndDate', null, get_lang('EnableEndDate'), 'onclick="javascript: if(this.checked){document.getElementById(\'option2\').style.display = \'block\';}else{document.getElementById(\'option2\').style.display = \'none\';}"');
                        $form_folder->addElement('html', '<div id=\'option2\' style="display:none">');
                        $form_folder->addGroup(create_group_date_select(), 'ends', get_lang('EndsAt'));
                        $form_folder->addElement('html', '</div>');
                        $form_folder->addRule(array('expires', 'ends'), get_lang('DateExpiredNotBeLessDeadLine'), 'comparedate');
                    }
                    if ($there_is_a_expire_date && $there_is_a_end_date) {
                        $form_folder->addRule(array('expires', 'ends'), get_lang('DateExpiredNotBeLessDeadLine'), 'comparedate');
                    }
                    $form_folder->addElement('checkbox', 'allow_text_assignment', null, get_lang('AllowTextAssignments'));
                    $form_folder->addElement('html', '</div>');
                    $form_folder->addElement('style_submit_button', 'submit', get_lang('ModifyDirectory'), 'class="save"');
                    if ($there_is_a_end_date) {
                        $end_date_array = convert_date_to_array($homework['ends_on'], 'ends');
                        $defaults = array_merge($defaults, $end_date_array);
                    }
                    if ($there_is_a_expire_date) {
                        $expires_date_array = convert_date_to_array($homework['expires_on'], 'expires');
                        $defaults = array_merge($defaults, $expires_date_array);
                    }
                    if (!empty($row['qualification'])) {
                        $defaults = array_merge($defaults, array('qualification[qualification]' => $row['qualification']));
                    }
                    $defaults['allow_text_assignment'] = $row['allow_text_assignment'];
                    $form_folder->setDefaults($defaults);
                    $display_edit_form = true;
                    if ($form_folder->validate()) {
                        if ($_POST['enableExpiryDate'] == '1') {
                            $there_is_a_expire_date = true;
                        } else {
                            $there_is_a_expire_date = false;
                        }
                        if ($_POST['enableEndDate'] == '1') {
                            $there_is_a_end_date = true;
                        } else {
                            $there_is_a_end_date = false;
                        }
                        $values = $form_folder->exportValues();
                        $work_id = $values['work_id'];
                        $dir_name = replace_dangerous_char($values['dir_name']);
                        $dir_name = disable_dangerous_file($dir_name);
                        $edit_check = false;
                        $work_data = get_work_data_by_id($work_id);
                        if (!empty($work_data)) {
                            $edit_check = true;
                        } else {
                            $edit_check = true;
                        }
                        if ($edit_check) {
                            $TABLEAGENDA = Database::get_course_table(TABLE_AGENDA);
                            $expires_query = ' SET expires_on = ' . "'" . ($there_is_a_expire_date ? api_get_utc_datetime(get_date_from_group('expires')) : '0000-00-00 00:00:00') . "'";
                            Database::query('UPDATE ' . $work_assigment . $expires_query . ' WHERE c_id = ' . $course_id . ' AND id = ' . "'" . $row['has_properties'] . "'");
                            $sql_add_publication = "UPDATE " . $work_table . " SET has_properties  = '" . $row['has_properties'] . "', view_properties=1 WHERE c_id = {$course_id} AND id ='" . $row['id'] . "'";
                            Database::query($sql_add_publication);
                            $ends_query = ' SET ends_on = ' . "'" . ($there_is_a_end_date ? api_get_utc_datetime(get_date_from_group('ends')) : '0000-00-00 00:00:00') . "'";
                            Database::query('UPDATE ' . $work_assigment . $ends_query . ' WHERE c_id = ' . $course_id . ' AND id = ' . "'" . $row['has_properties'] . "'");
                            $sql_add_publication = "UPDATE " . $work_table . " SET has_properties  = '" . $row['has_properties'] . "', view_properties=1 WHERE c_id = {$course_id} AND id ='" . $row['id'] . "'";
                            Database::query($sql_add_publication);
                            $qualification_value = isset($_POST['qualification']['qualification']) && !empty($_POST['qualification']['qualification']) ? intval($_POST['qualification']['qualification']) : 0;
                            $enable_qualification = !empty($qualification_value) ? 1 : 0;
                            $sql_add_publication = "UPDATE " . $work_assigment . " SET enable_qualification  = '" . $enable_qualification . "' WHERE c_id = {$course_id} AND publication_id ='" . $row['id'] . "'";
                            Database::query($sql_add_publication);
                            $sql = 'UPDATE ' . $work_table . ' SET
                                                 allow_text_assignment = ' . "'" . intval($_POST['allow_text_assignment']) . "'" . ' ,
                                                 title = ' . "'" . Database::escape_string($_POST['dir_name']) . "'" . ',
                                                 description = ' . "'" . Database::escape_string($_POST['description']) . "'" . ',
                                                 qualification = ' . "'" . Database::escape_string($_POST['qualification']['qualification']) . "'" . ',
                                                 weight = ' . "'" . Database::escape_string($_POST['weight']['weight']) . "'" . '
                                             WHERE c_id = ' . $course_id . ' AND id = ' . $row['id'];
                            Database::query($sql);
                            require_once api_get_path(SYS_CODE_PATH) . 'gradebook/lib/gradebook_functions.inc.php';
                            require_once api_get_path(SYS_CODE_PATH) . 'gradebook/lib/be/gradebookitem.class.php';
                            require_once api_get_path(SYS_CODE_PATH) . 'gradebook/lib/be/evaluation.class.php';
                            require_once api_get_path(SYS_CODE_PATH) . 'gradebook/lib/be/abstractlink.class.php';
                            $link_info = is_resource_in_course_gradebook(api_get_course_id(), LINK_STUDENTPUBLICATION, $row['id'], api_get_session_id());
                            $link_id = null;
                            if (!empty($link_info)) {
                                $link_id = $link_info['id'];
                            }
                            if (isset($_POST['make_calification']) && $_POST['make_calification'] == 1 && !empty($_POST['category_id'])) {
                                if (empty($link_id)) {
                                    add_resource_to_course_gradebook($_POST['category_id'], api_get_course_id(), LINK_STUDENTPUBLICATION, $row['id'], $_POST['dir_name'], (double) $_POST['weight']['weight'], (double) $_POST['qualification']['qualification'], $_POST['description'], 1, api_get_session_id(), $link_id);
                                } else {
                                    update_resource_from_course_gradebook($link_id, api_get_course_id(), $_POST['weight']['weight']);
                                }
                            } else {
                                //Delete everything of the gradebook
                                remove_resource_from_course_gradebook($link_id);
                            }
                            update_dir_name($work_data, $dir_name, $values['dir_name']);
                            $dir = $dir_name;
                            $display_edit_form = false;
                            // gets calendar_id from student_publication_assigment
                            $sql = "SELECT add_to_calendar FROM {$work_assigment} WHERE c_id = {$course_id} AND publication_id ='" . $row['id'] . "'";
                            $res = Database::query($sql);
                            $calendar_id = Database::fetch_row($res);
                            $dir_name = sprintf(get_lang('HandingOverOfTaskX'), $dir_name);
                            $end_date = $row['insert_date'];
                            if ($_POST['enableExpiryDate'] == '1') {
                                $end_date = Database::escape_string(api_get_utc_datetime(get_date_from_group('expires')));
                            }
                            // update from agenda if it exists
                            if (!empty($calendar_id[0])) {
                                $sql = "UPDATE " . $TABLEAGENDA . "\n\t\t\t\t\t\t\t\t\t\tSET title='" . $values['dir_name'] . "',\n\t\t\t\t\t\t\t\t\t\t\tcontent  = '" . Database::escape_string($_POST['description']) . "',\n\t\t\t\t\t\t\t\t\t\t\tstart_date = '" . $end_date . "',\n\t\t\t\t\t\t\t\t\t\t\tend_date   = '" . $end_date . "'\n\t\t\t\t\t\t\t\t\t\tWHERE c_id = {$course_id} AND id='" . $calendar_id[0] . "'";
                                Database::query($sql);
                            }
                            Display::display_confirmation_message(get_lang('FolderEdited'));
                        } else {
                            Display::display_warning_message(get_lang('FileExists'));
                        }
                    }
                }
            }
            $work_data = get_work_data_by_id($work_parent->id);
            $action = '';
            $row = array();
            $class = '';
            $course_id = api_get_course_int_id();
            $session_id = api_get_session_id();
            if (api_is_allowed_to_edit()) {
                $cant_files = get_count_work($work_data['id']);
            } else {
                $isSubscribed = userIsSubscribedToWork(api_get_user_id(), $work_data['id'], $course_id);
                if ($isSubscribed == false) {
                    continue;
                }
                $cant_files = get_count_work($work_data['id'], api_get_user_id());
            }
            $text_file = get_lang('FilesUpload');
            if ($cant_files == 1) {
                $text_file = api_strtolower(get_lang('FileUpload'));
            }
            $icon = Display::return_icon('work.png', get_lang('Assignment'), array(), ICON_SIZE_SMALL);
            if (!empty($display_edit_form) && !empty($edit_dir) && $edit_dir == $id2) {
                $row[] = $icon;
                $row[] = '<span class="invisible" style="display:none">' . $dir . '</span>' . $form_folder->toHtml();
                // form to edit the directory's name
            } else {
                $row[] = '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&origin=' . $origin . '&gradebook=' . $gradebook . '">' . $icon . '</a>';
                $add_to_name = '';
                require_once api_get_path(SYS_CODE_PATH) . 'gradebook/lib/gradebook_functions.inc.php';
                $link_info = is_resource_in_course_gradebook(api_get_course_id(), 3, $id2, api_get_session_id());
                $link_id = $link_info['id'];
                $count = 0;
                if ($link_info !== false) {
                    $gradebook_data = get_resource_from_course_gradebook($link_id);
                    $count = $gradebook_data['weight'];
                }
                if ($count > 0) {
                    $add_to_name = Display::label(get_lang('IncludedInEvaluation'), 'info');
                } else {
                    $add_to_name = '';
                }
                $work_title = !empty($work_data['title']) ? $work_data['title'] : basename($work_data['url']);
                // Work name
                if ($cant_files > 0) {
                    $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>';
                }
                $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;
            }
            if ($count_files != 0) {
                $row[] = '';
            }
            if (!empty($homework)) {
                // use original utc value saved previously to avoid doubling the utc-to-local conversion ($homework['expires_on'] might have been tainted)
                $row[] = !empty($utc_expiry_time) && $utc_expiry_time != '0000-00-00 00:00:00' ? api_get_local_time($utc_expiry_time) : '-';
            } else {
                $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'], $group_id, $course_id, api_get_session_id(), null, $userList);
                    $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);
                    } else {
                        $action .= '<a href="' . api_get_self() . '?cidReq=' . api_get_course_id() . '&origin=' . $origin . '&gradebook=' . $gradebook . '&edit_dir=' . $id2 . '">' . Display::return_icon('edit.png', get_lang('Modify'), array(), ICON_SIZE_SMALL) . '</a>';
                        $action .= ' <a href="' . api_get_self() . '?' . api_get_cidreq() . '&origin=' . $origin . '&gradebook=' . $gradebook . '&delete_dir=' . $id2 . '" onclick="javascript:if(!confirm(' . "'" . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)) . "'" . ')) return false;" title="' . get_lang('DirDelete') . '"  >' . Display::return_icon('delete.png', get_lang('DirDelete'), '', ICON_SIZE_SMALL) . '</a>';
                    }
                    $row[] = $action;
                } else {
                    $row[] = '';
                }
            }
            //$row[] = $direc_date_local;
            $row[] = $work_data['title'];
            $table_data[] = $row;
        }
    }
    $sorting_options = array();
    $sorting_options['column'] = 1;
    // Here we change the way how the columns are going to be sorted
    // in this case the the column of LastResent ( 4th element in $column_header) we will be order like the column RealDate
    // because in the column RealDate we have the days in a correct format "2008-03-12 10:35:48"
    $column_order = array();
    $i = 0;
    foreach ($table_header as $item) {
        $column_order[$i] = $i;
        $i++;
    }
    if (empty($my_folder_data)) {
        $column_order[1] = 5;
    } else {
        $column_order[2] = 2;
    }
    // An array with the setting of the columns -> 1: columns that we will show, 0:columns that will be hide
    $column_show = array();
    $column_show[] = 1;
    // type 0
    $column_show[] = 1;
    // title 1
    if (!empty($my_folder_data)) {
        $column_show[] = 1;
        // 2
        $column_show[] = 1;
        // 3
        if ($qualification_exists) {
            $column_show[] = 1;
            // 4
        }
    }
    $column_show[] = 1;
    //date
    if ($table_has_actions_column) {
        $column_show[] = 1;
        // modify
    }
    $column_show[] = 1;
    //real date in correct format
    $column_show[] = 0;
    //real date in correct format
    $paging_options = array();
    if (isset($_GET['curdirpath'])) {
        $my_params = array('curdirpath' => Security::remove_XSS($_GET['curdirpath']));
    }
    $my_params = array('id' => isset($_GET['id']) ? $_GET['id'] : null);
    if (isset($_GET['edit_dir'])) {
        $my_params = array('edit_dir' => intval($_GET['edit_dir']));
    }
    $my_params['origin'] = $origin;
    Display::display_sortable_config_table('work', $table_header, $table_data, $sorting_options, $paging_options, $my_params, $column_show, $column_order);
}